Advertisement
Guest User

Untitled

a guest
May 27th, 2015
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Moobot = function(a) {
  2.         a.paths = {
  3.             root: "r/47/",
  4.             js: "/r/47/js/",
  5.             css: "/r/47/css/",
  6.             img: "/r/47/img/",
  7.             sounds: "/r/47/sounds/",
  8.             data: "/r/47/data/",
  9.             templates: "/r/47/templates/"
  10.         };
  11.         return a
  12.     }(Moobot || {}),
  13.     Moobot = function(a) {
  14.         a.social = {
  15.             twitter: "MoobotApp",
  16.             facebook: "Moobot",
  17.             youtube: "TwitchTVMoobot",
  18.             tumblr: "MoobotApp"
  19.         };
  20.         return a
  21.     }(Moobot || {});
  22. ! function(a) {
  23.     a(function() {
  24.         var d = a.support,
  25.             c;
  26.         a: {
  27.             c = document.createElement("bootstrap");
  28.             var b = {
  29.                     WebkitTransition: "webkitTransitionEnd",
  30.                     MozTransition: "transitionend",
  31.                     OTransition: "oTransitionEnd otransitionend",
  32.                     transition: "transitionend"
  33.                 },
  34.                 e;
  35.             for (e in b)
  36.                 if (void 0 !== c.style[e]) {
  37.                     c = b[e];
  38.                     break a
  39.                 }
  40.             c = void 0
  41.         }
  42.         d.transition = c && {
  43.             end: c
  44.         }
  45.     })
  46. }(window.jQuery);
  47. ! function(a) {
  48.     var d = function(c) {
  49.         a(c).on("click", '[data-dismiss="alert"]', this.close)
  50.     };
  51.     d.prototype.close = function(c) {
  52.         function b() {
  53.             d.trigger("closed").remove()
  54.         }
  55.         var e = a(this),
  56.             f = e.attr("data-target"),
  57.             d;
  58.         f || (f = e.attr("href"), f = f && f.replace(/.*(?=#[^\s]*$)/, ""));
  59.         d = a(f);
  60.         c && c.preventDefault();
  61.         d.length || (d = e.hasClass("alert") ? e : e.parent());
  62.         d.trigger(c = a.Event("close"));
  63.         c.isDefaultPrevented() || (d.removeClass("in"), a.support.transition && d.hasClass("fade") ? d.on(a.support.transition.end, b) : b())
  64.     };
  65.     a.fn.alert = function(c) {
  66.         return this.each(function() {
  67.             var b =
  68.                 a(this),
  69.                 e = b.data("alert");
  70.             e || b.data("alert", e = new d(this));
  71.             "string" == typeof c && e[c].call(b)
  72.         })
  73.     };
  74.     a.fn.alert.Constructor = d;
  75.     a(function() {
  76.         a("body").on("click.alert.data-api", '[data-dismiss="alert"]', d.prototype.close)
  77.     })
  78. }(window.jQuery);
  79. ! function(a) {
  80.     var d = function(c, b) {
  81.         this.$element = a(c);
  82.         this.options = a.extend({}, a.fn.button.defaults, b)
  83.     };
  84.     d.prototype.setState = function(a) {
  85.         var b = this.$element,
  86.             e = b.data(),
  87.             d = b.is("input") ? "val" : "html";
  88.         a += "Text";
  89.         e.resetText || b.data("resetText", b[d]());
  90.         b[d](e[a] || this.options[a]);
  91.         setTimeout(function() {
  92.             "loadingText" == a ? b.addClass("disabled").attr("disabled", "disabled") : b.removeClass("disabled").removeAttr("disabled")
  93.         }, 0)
  94.     };
  95.     d.prototype.toggle = function() {
  96.         var a = this.$element.closest('[data-toggle="buttons-radio"]');
  97.         a && a.find(".active").removeClass("active");
  98.         this.$element.toggleClass("active")
  99.     };
  100.     a.fn.button = function(c) {
  101.         return this.each(function() {
  102.             var b = a(this),
  103.                 e = b.data("button"),
  104.                 f = "object" == typeof c && c;
  105.             e || b.data("button", e = new d(this, f));
  106.             "toggle" == c ? e.toggle() : c && e.setState(c)
  107.         })
  108.     };
  109.     a.fn.button.defaults = {
  110.         loadingText: "loading..."
  111.     };
  112.     a.fn.button.Constructor = d;
  113.     a(function() {
  114.         a("body").on("click.button.data-api", "[data-toggle^=button]", function(c) {
  115.             c = a(c.target);
  116.             c.hasClass("btn") || (c = c.closest(".btn"));
  117.             c.button("toggle")
  118.         })
  119.     })
  120. }(window.jQuery);
  121. ! function(a) {
  122.     var d = function(c, b) {
  123.         this.$element = a(c);
  124.         this.options = b;
  125.         this.options.slide && this.slide(this.options.slide);
  126.         "hover" == this.options.pause && this.$element.on("mouseenter", a.proxy(this.pause, this)).on("mouseleave", a.proxy(this.cycle, this))
  127.     };
  128.     d.prototype = {
  129.         cycle: function(c) {
  130.             return c || (this.paused = !1), this.options.interval && !this.paused && (this.interval = setInterval(a.proxy(this.next, this), this.options.interval)), this
  131.         },
  132.         to: function(c) {
  133.             var b = this.$element.find(".item.active"),
  134.                 e = b.parent().children(),
  135.                 b = e.index(b),
  136.                 d = this;
  137.             if (!(c > e.length - 1 || 0 > c)) return this.sliding ? this.$element.one("slid", function() {
  138.                 d.to(c)
  139.             }) : b == c ? this.pause().cycle() : this.slide(c > b ? "next" : "prev", a(e[c]))
  140.         },
  141.         pause: function(c) {
  142.             return c || (this.paused = !0), this.$element.find(".next, .prev").length && a.support.transition.end && (this.$element.trigger(a.support.transition.end), this.cycle()), clearInterval(this.interval), this.interval = null, this
  143.         },
  144.         next: function() {
  145.             if (!this.sliding) return this.slide("next")
  146.         },
  147.         prev: function() {
  148.             if (!this.sliding) return this.slide("prev")
  149.         },
  150.         slide: function(c, b) {
  151.             var e = this.$element.find(".item.active"),
  152.                 d = b || e[c](),
  153.                 h = this.interval,
  154.                 g = "next" == c ? "left" : "right",
  155.                 m = "next" == c ? "first" : "last",
  156.                 k = this,
  157.                 n = a.Event("slide", {
  158.                     relatedTarget: d[0]
  159.                 });
  160.             this.sliding = !0;
  161.             h && this.pause();
  162.             d = d.length ? d : this.$element.find(".item")[m]();
  163.             if (!d.hasClass("active")) {
  164.                 if (a.support.transition && this.$element.hasClass("slide")) {
  165.                     this.$element.trigger(n);
  166.                     if (n.isDefaultPrevented()) return;
  167.                     d.addClass(c);
  168.                     d[0].offsetWidth;
  169.                     e.addClass(g);
  170.                     d.addClass(g);
  171.                     this.$element.one(a.support.transition.end,
  172.                         function() {
  173.                             d.removeClass([c, g].join(" ")).addClass("active");
  174.                             e.removeClass(["active", g].join(" "));
  175.                             k.sliding = !1;
  176.                             setTimeout(function() {
  177.                                 k.$element.trigger("slid")
  178.                             }, 0)
  179.                         })
  180.                 } else {
  181.                     this.$element.trigger(n);
  182.                     if (n.isDefaultPrevented()) return;
  183.                     e.removeClass("active");
  184.                     d.addClass("active");
  185.                     this.sliding = !1;
  186.                     this.$element.trigger("slid")
  187.                 }
  188.                 return h && this.cycle(), this
  189.             }
  190.         }
  191.     };
  192.     a.fn.carousel = function(c) {
  193.         return this.each(function() {
  194.             var b = a(this),
  195.                 e = b.data("carousel"),
  196.                 f = a.extend({}, a.fn.carousel.defaults, "object" == typeof c && c),
  197.                 h = "string" == typeof c ? c : f.slide;
  198.             e || b.data("carousel", e = new d(this, f));
  199.             "number" == typeof c ? e.to(c) : h ? e[h]() : f.interval && e.cycle()
  200.         })
  201.     };
  202.     a.fn.carousel.defaults = {
  203.         interval: 5E3,
  204.         pause: "hover"
  205.     };
  206.     a.fn.carousel.Constructor = d;
  207.     a(function() {
  208.         a("body").on("click.carousel.data-api", "[data-slide]", function(c) {
  209.             var b = a(this),
  210.                 e, d = a(b.attr("data-target") || (e = b.attr("href")) && e.replace(/.*(?=#[^\s]+$)/, "")),
  211.                 b = !d.data("modal") && a.extend({}, d.data(), b.data());
  212.             d.carousel(b);
  213.             c.preventDefault()
  214.         })
  215.     })
  216. }(window.jQuery);
  217. ! function(a) {
  218.     var d = function(c, b) {
  219.         this.$element = a(c);
  220.         this.options = a.extend({}, a.fn.collapse.defaults, b);
  221.         this.options.parent && (this.$parent = a(this.options.parent));
  222.         this.options.toggle && this.toggle()
  223.     };
  224.     d.prototype = {
  225.         constructor: d,
  226.         dimension: function() {
  227.             return this.$element.hasClass("width") ? "width" : "height"
  228.         },
  229.         show: function() {
  230.             var c, b, e, d;
  231.             if (!this.transitioning) {
  232.                 c = this.dimension();
  233.                 b = a.camelCase(["scroll", c].join("-"));
  234.                 if ((e = this.$parent && this.$parent.find("> .accordion-group > .in")) && e.length) {
  235.                     if ((d = e.data("collapse")) &&
  236.                         d.transitioning) return;
  237.                     e.collapse("hide");
  238.                     d || e.data("collapse", null)
  239.                 }
  240.                 this.$element[c](0);
  241.                 this.transition("addClass", a.Event("show"), "shown");
  242.                 a.support.transition && this.$element[c](this.$element[0][b])
  243.             }
  244.         },
  245.         hide: function() {
  246.             var c;
  247.             this.transitioning || (c = this.dimension(), this.reset(this.$element[c]()), this.transition("removeClass", a.Event("hide"), "hidden"), this.$element[c](0))
  248.         },
  249.         reset: function(a) {
  250.             var b = this.dimension();
  251.             return this.$element.removeClass("collapse")[b](a || "auto")[0].offsetWidth, this.$element[null !==
  252.                 a ? "addClass" : "removeClass"]("collapse"), this
  253.         },
  254.         transition: function(c, b, e) {
  255.             var d = this,
  256.                 h = function() {
  257.                     "show" == b.type && d.reset();
  258.                     d.transitioning = 0;
  259.                     d.$element.trigger(e)
  260.                 };
  261.             this.$element.trigger(b);
  262.             b.isDefaultPrevented() || (this.transitioning = 1, this.$element[c]("in"), a.support.transition && this.$element.hasClass("collapse") ? this.$element.one(a.support.transition.end, h) : h())
  263.         },
  264.         toggle: function() {
  265.             this[this.$element.hasClass("in") ? "hide" : "show"]()
  266.         }
  267.     };
  268.     a.fn.collapse = function(c) {
  269.         return this.each(function() {
  270.             var b = a(this),
  271.                 e = b.data("collapse"),
  272.                 f = "object" == typeof c && c;
  273.             e || b.data("collapse", e = new d(this, f));
  274.             "string" == typeof c && e[c]()
  275.         })
  276.     };
  277.     a.fn.collapse.defaults = {
  278.         toggle: !0
  279.     };
  280.     a.fn.collapse.Constructor = d;
  281.     a(function() {
  282.         a("body").on("click.collapse.data-api", "[data-toggle=collapse]", function(c) {
  283.             var b = a(this),
  284.                 e;
  285.             c = b.attr("data-target") || c.preventDefault() || (e = b.attr("href")) && e.replace(/.*(?=#[^\s]+$)/, "");
  286.             e = a(c).data("collapse") ? "toggle" : b.data();
  287.             b[a(c).hasClass("in") ? "addClass" : "removeClass"]("collapsed");
  288.             a(c).collapse(e)
  289.         })
  290.     })
  291. }(window.jQuery);
  292. ! function(a) {
  293.     function d() {
  294.         c(a(b)).removeClass("open")
  295.     }
  296.  
  297.     function c(c) {
  298.         var b = c.attr("data-target"),
  299.             e;
  300.         return b || (b = c.attr("href"), b = b && /#/.test(b) && b.replace(/.*(?=#[^\s]*$)/, "")), e = a(b), e.length || (e = c.parent()), e
  301.     }
  302.     var b = "[data-toggle=dropdown]",
  303.         e = function(c) {
  304.             var b = a(c).on("click.dropdown.data-api", this.toggle);
  305.             a("html").on("click.dropdown.data-api", function() {
  306.                 b.parent().removeClass("open")
  307.             })
  308.         };
  309.     e.prototype = {
  310.         constructor: e,
  311.         toggle: function(b) {
  312.             b = a(this);
  313.             var e, g;
  314.             if (!b.is(".disabled, :disabled")) return e = c(b),
  315.                 g = e.hasClass("open"), d(), g || (e.toggleClass("open"), b.focus()), !1
  316.         },
  317.         keydown: function(b) {
  318.             var e, d, m;
  319.             if (/(38|40|27)/.test(b.keyCode) && (e = a(this), b.preventDefault(), b.stopPropagation(), !e.is(".disabled, :disabled"))) {
  320.                 d = c(e);
  321.                 m = d.hasClass("open");
  322.                 if (!m || m && 27 == b.keyCode) return e.click();
  323.                 e = a("[role=menu] li:not(.divider) a", d);
  324.                 e.length && (d = e.index(e.filter(":focus")), 38 == b.keyCode && 0 < d && d--, 40 == b.keyCode && d < e.length - 1 && d++, ~d || (d = 0), e.eq(d).focus())
  325.             }
  326.         }
  327.     };
  328.     a.fn.dropdown = function(c) {
  329.         return this.each(function() {
  330.             var b =
  331.                 a(this),
  332.                 d = b.data("dropdown");
  333.             d || b.data("dropdown", d = new e(this));
  334.             "string" == typeof c && d[c].call(b)
  335.         })
  336.     };
  337.     a.fn.dropdown.Constructor = e;
  338.     a(function() {
  339.         a("html").on("click.dropdown.data-api touchstart.dropdown.data-api", d);
  340.         a("body").on("click.dropdown touchstart.dropdown.data-api", ".dropdown form", function(a) {
  341.             a.stopPropagation()
  342.         }).on("click.dropdown.data-api touchstart.dropdown.data-api", b, e.prototype.toggle).on("keydown.dropdown.data-api touchstart.dropdown.data-api", b + ", [role=menu]", e.prototype.keydown)
  343.     })
  344. }(window.jQuery);
  345. ! function(a) {
  346.     var d = function(c, b) {
  347.         this.options = b;
  348.         this.$element = a(c).delegate('[data-dismiss="modal"]', "click.dismiss.modal", a.proxy(this.hide, this));
  349.         this.options.remote && this.$element.find(".modal-body").load(this.options.remote)
  350.     };
  351.     d.prototype = {
  352.         constructor: d,
  353.         toggle: function() {
  354.             return this[this.isShown ? "hide" : "show"]()
  355.         },
  356.         show: function() {
  357.             var c = this,
  358.                 b = a.Event("show");
  359.             this.$element.trigger(b);
  360.             this.isShown || b.isDefaultPrevented() || (a("body").addClass("modal-open"), this.isShown = !0, this.escape(), this.backdrop(function() {
  361.                 var b =
  362.                     a.support.transition && c.$element.hasClass("fade");
  363.                 c.$element.parent().length || c.$element.appendTo(document.body);
  364.                 c.$element.show();
  365.                 b && c.$element[0].offsetWidth;
  366.                 c.$element.addClass("in").attr("aria-hidden", !1).focus();
  367.                 c.enforceFocus();
  368.                 b ? c.$element.one(a.support.transition.end, function() {
  369.                     c.$element.trigger("shown")
  370.                 }) : c.$element.trigger("shown")
  371.             }))
  372.         },
  373.         hide: function(c) {
  374.             c && c.preventDefault();
  375.             c = a.Event("hide");
  376.             this.$element.trigger(c);
  377.             this.isShown && !c.isDefaultPrevented() && (this.isShown = !1, a("body").removeClass("modal-open"),
  378.                 this.escape(), a(document).off("focusin.modal"), this.$element.removeClass("in").attr("aria-hidden", !0), a.support.transition && this.$element.hasClass("fade") ? this.hideWithTransition() : this.hideModal())
  379.         },
  380.         enforceFocus: function() {
  381.             var c = this;
  382.             a(document).on("focusin.modal", function(a) {
  383.                 c.$element[0] !== a.target && !c.$element.has(a.target).length && c.$element.focus()
  384.             })
  385.         },
  386.         escape: function() {
  387.             var a = this;
  388.             this.isShown && this.options.keyboard ? this.$element.on("keyup.dismiss.modal", function(b) {
  389.                     27 == b.which && a.hide()
  390.                 }) : this.isShown ||
  391.                 this.$element.off("keyup.dismiss.modal")
  392.         },
  393.         hideWithTransition: function() {
  394.             var c = this,
  395.                 b = setTimeout(function() {
  396.                     c.$element.off(a.support.transition.end);
  397.                     c.hideModal()
  398.                 }, 500);
  399.             this.$element.one(a.support.transition.end, function() {
  400.                 clearTimeout(b);
  401.                 c.hideModal()
  402.             })
  403.         },
  404.         hideModal: function(a) {
  405.             this.$element.hide().trigger("hidden");
  406.             this.backdrop()
  407.         },
  408.         removeBackdrop: function() {
  409.             this.$backdrop.remove();
  410.             this.$backdrop = null
  411.         },
  412.         backdrop: function(c) {
  413.             var b = this.$element.hasClass("fade") ? "fade" : "";
  414.             if (this.isShown && this.options.backdrop) {
  415.                 var e =
  416.                     a.support.transition && b;
  417.                 this.$backdrop = a('<div class="modal-backdrop ' + b + '" />').appendTo(document.body);
  418.                 "static" != this.options.backdrop && this.$backdrop.click(a.proxy(this.hide, this));
  419.                 e && this.$backdrop[0].offsetWidth;
  420.                 this.$backdrop.addClass("in");
  421.                 e ? this.$backdrop.one(a.support.transition.end, c) : c()
  422.             } else !this.isShown && this.$backdrop ? (this.$backdrop.removeClass("in"), a.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one(a.support.transition.end, a.proxy(this.removeBackdrop, this)) : this.removeBackdrop()) :
  423.                 c && c()
  424.         }
  425.     };
  426.     a.fn.modal = function(c) {
  427.         return this.each(function() {
  428.             var b = a(this),
  429.                 e = b.data("modal"),
  430.                 f = a.extend({}, a.fn.modal.defaults, b.data(), "object" == typeof c && c);
  431.             e || b.data("modal", e = new d(this, f));
  432.             "string" == typeof c ? e[c]() : f.show && e.show()
  433.         })
  434.     };
  435.     a.fn.modal.defaults = {
  436.         backdrop: !0,
  437.         keyboard: !0,
  438.         show: !0
  439.     };
  440.     a.fn.modal.Constructor = d;
  441.     a(function() {
  442.         a("body").on("click.modal.data-api", '[data-toggle="modal"]', function(c) {
  443.             var b = a(this),
  444.                 e = b.attr("href"),
  445.                 d = a(b.attr("data-target") || e && e.replace(/.*(?=#[^\s]+$)/, "")),
  446.                 e = d.data("modal") ?
  447.                 "toggle" : a.extend({
  448.                     remote: !/#/.test(e) && e
  449.                 }, d.data(), b.data());
  450.             c.preventDefault();
  451.             d.modal(e).one("hide", function() {
  452.                 b.focus()
  453.             })
  454.         })
  455.     })
  456. }(window.jQuery);
  457. ! function(a) {
  458.     var d = function(a, b) {
  459.         this.init("tooltip", a, b)
  460.     };
  461.     d.prototype = {
  462.         constructor: d,
  463.         init: function(c, b, e) {
  464.             var d, h;
  465.             this.type = c;
  466.             this.$element = a(b);
  467.             this.options = this.getOptions(e);
  468.             this.enabled = !0;
  469.             "click" == this.options.trigger ? this.$element.on("click." + this.type, this.options.selector, a.proxy(this.toggle, this)) : "manual" != this.options.trigger && (d = "hover" == this.options.trigger ? "mouseenter" : "focus", h = "hover" == this.options.trigger ? "mouseleave" : "blur", this.$element.on(d + "." + this.type, this.options.selector,
  470.                 a.proxy(this.enter, this)), this.$element.on(h + "." + this.type, this.options.selector, a.proxy(this.leave, this)));
  471.             this.options.selector ? this._options = a.extend({}, this.options, {
  472.                 trigger: "manual",
  473.                 selector: ""
  474.             }) : this.fixTitle()
  475.         },
  476.         getOptions: function(c) {
  477.             return c = a.extend({}, a.fn[this.type].defaults, c, this.$element.data()), c.delay && "number" == typeof c.delay && (c.delay = {
  478.                 show: c.delay,
  479.                 hide: c.delay
  480.             }), c
  481.         },
  482.         enter: function(c) {
  483.             var b = a(c.currentTarget)[this.type](this._options).data(this.type);
  484.             if (!b.options.delay || !b.options.delay.show) return b.show();
  485.             clearTimeout(this.timeout);
  486.             b.hoverState = "in";
  487.             this.timeout = setTimeout(function() {
  488.                 "in" == b.hoverState && b.show()
  489.             }, b.options.delay.show)
  490.         },
  491.         leave: function(c) {
  492.             var b = a(c.currentTarget)[this.type](this._options).data(this.type);
  493.             this.timeout && clearTimeout(this.timeout);
  494.             if (!b.options.delay || !b.options.delay.hide) return b.hide();
  495.             b.hoverState = "out";
  496.             this.timeout = setTimeout(function() {
  497.                 "out" == b.hoverState && b.hide()
  498.             }, b.options.delay.hide)
  499.         },
  500.         show: function() {
  501.             var a, b, e, d, h, g, m;
  502.             if (this.hasContent() && this.enabled) {
  503.                 a = this.tip();
  504.                 this.setContent();
  505.                 this.options.animation && a.addClass("fade");
  506.                 g = "function" == typeof this.options.placement ? this.options.placement.call(this, a[0], this.$element[0]) : this.options.placement;
  507.                 b = /in/.test(g);
  508.                 a.remove().css({
  509.                     top: 0,
  510.                     left: 0,
  511.                     display: "block"
  512.                 }).appendTo(b ? this.$element : document.body);
  513.                 e = this.getPosition(b);
  514.                 d = a[0].offsetWidth;
  515.                 h = a[0].offsetHeight;
  516.                 switch (b ? g.split(" ")[1] : g) {
  517.                     case "bottom":
  518.                         m = {
  519.                             top: e.top + e.height,
  520.                             left: e.left + e.width / 2 - d / 2
  521.                         };
  522.                         break;
  523.                     case "top":
  524.                         m = {
  525.                             top: e.top - h,
  526.                             left: e.left + e.width / 2 - d / 2
  527.                         };
  528.                         break;
  529.                     case "left":
  530.                         m = {
  531.                             top: e.top + e.height / 2 - h / 2,
  532.                             left: e.left - d
  533.                         };
  534.                         break;
  535.                     case "right":
  536.                         m = {
  537.                             top: e.top + e.height / 2 - h / 2,
  538.                             left: e.left + e.width
  539.                         }
  540.                 }
  541.                 a.css(m).addClass(g).addClass("in")
  542.             }
  543.         },
  544.         setContent: function() {
  545.             var a = this.tip(),
  546.                 b = this.getTitle();
  547.             a.find(".tooltip-inner")[this.options.html ? "html" : "text"](b);
  548.             a.removeClass("fade in top bottom left right")
  549.         },
  550.         hide: function() {
  551.             function c() {
  552.                 var c = setTimeout(function() {
  553.                     b.off(a.support.transition.end).remove()
  554.                 }, 500);
  555.                 b.one(a.support.transition.end, function() {
  556.                     clearTimeout(c);
  557.                     b.remove()
  558.                 })
  559.             }
  560.             var b = this.tip();
  561.             return b.removeClass("in"), a.support.transition && this.$tip.hasClass("fade") ? c() : b.remove(), this
  562.         },
  563.         fixTitle: function() {
  564.             var a = this.$element;
  565.             (a.attr("title") || "string" != typeof a.attr("data-original-title")) && a.attr("data-original-title", a.attr("title") || "").removeAttr("title")
  566.         },
  567.         hasContent: function() {
  568.             return this.getTitle()
  569.         },
  570.         getPosition: function(c) {
  571.             return a.extend({}, c ? {
  572.                 top: 0,
  573.                 left: 0
  574.             } : this.$element.offset(), {
  575.                 width: this.$element[0].offsetWidth,
  576.                 height: this.$element[0].offsetHeight
  577.             })
  578.         },
  579.         getTitle: function() {
  580.             var a,
  581.                 b = this.$element,
  582.                 d = this.options;
  583.             return a = b.attr("data-original-title") || ("function" == typeof d.title ? d.title.call(b[0]) : d.title), a
  584.         },
  585.         tip: function() {
  586.             return this.$tip = this.$tip || a(this.options.template)
  587.         },
  588.         validate: function() {
  589.             this.$element[0].parentNode || (this.hide(), this.$element = null, this.options = null)
  590.         },
  591.         enable: function() {
  592.             this.enabled = !0
  593.         },
  594.         disable: function() {
  595.             this.enabled = !1
  596.         },
  597.         toggleEnabled: function() {
  598.             this.enabled = !this.enabled
  599.         },
  600.         toggle: function() {
  601.             this[this.tip().hasClass("in") ? "hide" : "show"]()
  602.         },
  603.         destroy: function() {
  604.             this.hide().$element.off("." +
  605.                 this.type).removeData(this.type)
  606.         }
  607.     };
  608.     a.fn.tooltip = function(c) {
  609.         return this.each(function() {
  610.             var b = a(this),
  611.                 e = b.data("tooltip"),
  612.                 f = "object" == typeof c && c;
  613.             e || b.data("tooltip", e = new d(this, f));
  614.             "string" == typeof c && e[c]()
  615.         })
  616.     };
  617.     a.fn.tooltip.Constructor = d;
  618.     a.fn.tooltip.defaults = {
  619.         animation: !1,
  620.         placement: "top",
  621.         selector: !1,
  622.         template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  623.         trigger: "hover",
  624.         title: "",
  625.         delay: 0,
  626.         html: !0
  627.     }
  628. }(window.jQuery);
  629. ! function(a) {
  630.     var d = function(a, b) {
  631.         this.init("popover", a, b)
  632.     };
  633.     d.prototype = a.extend({}, a.fn.tooltip.Constructor.prototype, {
  634.         constructor: d,
  635.         setContent: function() {
  636.             var a = this.tip(),
  637.                 b = this.getTitle(),
  638.                 d = this.getContent();
  639.             a.find(".popover-title")[this.options.html ? "html" : "text"](b);
  640.             a.find(".popover-content > *")[this.options.html ? "html" : "text"](d);
  641.             a.removeClass("fade top bottom left right in")
  642.         },
  643.         hasContent: function() {
  644.             return this.getTitle() || this.getContent()
  645.         },
  646.         getContent: function() {
  647.             var a, b = this.$element,
  648.                 d = this.options;
  649.             return a = b.attr("data-content") || ("function" == typeof d.content ? d.content.call(b[0]) : d.content), a
  650.         },
  651.         tip: function() {
  652.             return this.$tip || (this.$tip = a(this.options.template)), this.$tip
  653.         },
  654.         destroy: function() {
  655.             this.hide().$element.off("." + this.type).removeData(this.type)
  656.         }
  657.     });
  658.     a.fn.popover = function(c) {
  659.         return this.each(function() {
  660.             var b = a(this),
  661.                 e = b.data("popover"),
  662.                 f = "object" == typeof c && c;
  663.             e || b.data("popover", e = new d(this, f));
  664.             "string" == typeof c && e[c]()
  665.         })
  666.     };
  667.     a.fn.popover.Constructor = d;
  668.     a.fn.popover.defaults = a.extend({},
  669.         a.fn.tooltip.defaults, {
  670.             placement: "right",
  671.             trigger: "click",
  672.             content: "",
  673.             template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
  674.         })
  675. }(window.jQuery);
  676. ! function(a) {
  677.     function d(c, b) {
  678.         var d = a.proxy(this.process, this),
  679.             f = a(c).is("body") ? a(window) : a(c),
  680.             h;
  681.         this.options = a.extend({}, a.fn.scrollspy.defaults, b);
  682.         this.$scrollElement = f.on("scroll.scroll-spy.data-api", d);
  683.         this.selector = (this.options.target || (h = a(c).attr("href")) && h.replace(/.*(?=#[^\s]+$)/, "") || "") + " .nav li > a";
  684.         this.$body = a("body");
  685.         this.refresh();
  686.         this.process()
  687.     }
  688.     d.prototype = {
  689.         constructor: d,
  690.         refresh: function() {
  691.             var c = this;
  692.             this.offsets = a([]);
  693.             this.targets = a([]);
  694.             this.$body.find(this.selector).map(function() {
  695.                 var c =
  696.                     a(this),
  697.                     c = c.data("target") || c.attr("href"),
  698.                     d = /^#\w/.test(c) && a(c);
  699.                 return d && d.length && [
  700.                     [d.position().top, c]
  701.                 ] || null
  702.             }).sort(function(a, c) {
  703.                 return a[0] - c[0]
  704.             }).each(function() {
  705.                 c.offsets.push(this[0]);
  706.                 c.targets.push(this[1])
  707.             })
  708.         },
  709.         process: function() {
  710.             var a = this.$scrollElement.scrollTop() + this.options.offset,
  711.                 b = (this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight) - this.$scrollElement.height(),
  712.                 d = this.offsets,
  713.                 f = this.targets,
  714.                 h = this.activeTarget,
  715.                 g;
  716.             if (a >= b) return h != (g = f.last()[0]) && this.activate(g);
  717.             for (g =
  718.                 d.length; g--;) h != f[g] && a >= d[g] && (!d[g + 1] || a <= d[g + 1]) && this.activate(f[g])
  719.         },
  720.         activate: function(c) {
  721.             this.activeTarget = c;
  722.             a(this.selector).parent(".active").removeClass("active");
  723.             c = a(this.selector + '[data-target="' + c + '"],' + this.selector + '[href="' + c + '"]').parent("li").addClass("active");
  724.             c.parent(".dropdown-menu").length && (c = c.closest("li.dropdown").addClass("active"));
  725.             c.trigger("activate")
  726.         }
  727.     };
  728.     a.fn.scrollspy = function(c) {
  729.         return this.each(function() {
  730.             var b = a(this),
  731.                 e = b.data("scrollspy"),
  732.                 f = "object" == typeof c && c;
  733.             e || b.data("scrollspy", e = new d(this, f));
  734.             "string" == typeof c && e[c]()
  735.         })
  736.     };
  737.     a.fn.scrollspy.Constructor = d;
  738.     a.fn.scrollspy.defaults = {
  739.         offset: 10
  740.     };
  741.     a(window).on("load", function() {
  742.         a('[data-spy="scroll"]').each(function() {
  743.             var c = a(this);
  744.             c.scrollspy(c.data())
  745.         })
  746.     })
  747. }(window.jQuery);
  748. ! function(a) {
  749.     var d = function(c) {
  750.         this.element = a(c)
  751.     };
  752.     d.prototype = {
  753.         constructor: d,
  754.         show: function() {
  755.             var c = this.element,
  756.                 b = c.closest("ul:not(.dropdown-menu)"),
  757.                 d = c.attr("data-target"),
  758.                 f, h;
  759.             d || (d = c.attr("href"), d = d && d.replace(/.*(?=#[^\s]*$)/, ""));
  760.             c.parent("li").hasClass("active") || (f = b.find(".active a").last()[0], h = a.Event("show", {
  761.                 relatedTarget: f
  762.             }), c.trigger(h), h.isDefaultPrevented() || (d = a(d), this.activate(c.parent("li"), b), this.activate(d, d.parent(), function() {
  763.                 c.trigger({
  764.                     type: "shown",
  765.                     relatedTarget: f
  766.                 })
  767.             })))
  768.         },
  769.         activate: function(c, b, d) {
  770.             function f() {
  771.                 h.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");
  772.                 c.addClass("active");
  773.                 g ? (c[0].offsetWidth, c.addClass("in")) : c.removeClass("fade");
  774.                 c.parent(".dropdown-menu") && c.closest("li.dropdown").addClass("active");
  775.                 d && d()
  776.             }
  777.             var h = b.find("> .active"),
  778.                 g = d && a.support.transition && h.hasClass("fade");
  779.             g ? h.one(a.support.transition.end, f) : f();
  780.             h.removeClass("in")
  781.         }
  782.     };
  783.     a.fn.tab = function(c) {
  784.         return this.each(function() {
  785.             var b = a(this),
  786.                 e = b.data("tab");
  787.             e || b.data("tab",
  788.                 e = new d(this));
  789.             "string" == typeof c && e[c]()
  790.         })
  791.     };
  792.     a.fn.tab.Constructor = d;
  793.     a(function() {
  794.         a("body").on("click.tab.data-api", '[data-toggle="tab"], [data-toggle="pill"]', function(c) {
  795.             c.preventDefault();
  796.             a(this).tab("show")
  797.         })
  798.     })
  799. }(window.jQuery);
  800. ! function(a) {
  801.     var d = function(c, b) {
  802.         this.$element = a(c);
  803.         this.options = a.extend({}, a.fn.typeahead.defaults, b);
  804.         this.matcher = this.options.matcher || this.matcher;
  805.         this.sorter = this.options.sorter || this.sorter;
  806.         this.highlighter = this.options.highlighter || this.highlighter;
  807.         this.updater = this.options.updater || this.updater;
  808.         this.$menu = a(this.options.menu).appendTo("body");
  809.         this.source = this.options.source;
  810.         this.shown = !1;
  811.         this.listen()
  812.     };
  813.     d.prototype = {
  814.         constructor: d,
  815.         select: function() {
  816.             var a = this.$menu.find(".active").attr("data-value");
  817.             return this.$element.val(this.updater(a)).change(), this.hide()
  818.         },
  819.         updater: function(a) {
  820.             return a
  821.         },
  822.         show: function() {
  823.             var c = a.extend({}, this.$element.offset(), {
  824.                 height: this.$element[0].offsetHeight
  825.             });
  826.             return this.$menu.css({
  827.                 top: c.top + c.height,
  828.                 left: c.left
  829.             }), this.$menu.show(), this.shown = !0, this
  830.         },
  831.         hide: function() {
  832.             return this.$menu.hide(), this.shown = !1, this
  833.         },
  834.         lookup: function(c) {
  835.             var b;
  836.             return this.query = this.$element.val(), !this.query || this.query.length < this.options.minLength ? this.shown ? this.hide() : this : (b = a.isFunction(this.source) ?
  837.                 this.source(this.query, a.proxy(this.process, this)) : this.source, b ? this.process(b) : this)
  838.         },
  839.         process: function(c) {
  840.             var b = this;
  841.             return c = a.grep(c, function(a) {
  842.                 return b.matcher(a)
  843.             }), c = this.sorter(c), c.length ? this.render(c.slice(0, this.options.items)).show() : this.shown ? this.hide() : this
  844.         },
  845.         matcher: function(a) {
  846.             return ~a.toLowerCase().indexOf(this.query.toLowerCase())
  847.         },
  848.         sorter: function(a) {
  849.             for (var b = [], d = [], f = [], h; h = a.shift();) h.toLowerCase().indexOf(this.query.toLowerCase()) ? ~h.indexOf(this.query) ? d.push(h) : f.push(h) :
  850.                 b.push(h);
  851.             return b.concat(d, f)
  852.         },
  853.         highlighter: function(a) {
  854.             var b = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
  855.             return a.replace(new RegExp("(" + b + ")", "ig"), function(a, c) {
  856.                 return "<strong>" + c + "</strong>"
  857.             })
  858.         },
  859.         render: function(c) {
  860.             var b = this;
  861.             return c = a(c).map(function(c, d) {
  862.                 return c = a(b.options.item).attr("data-value", d), c.find("a").html(b.highlighter(d)), c[0]
  863.             }), c.first().addClass("active"), this.$menu.html(c), this
  864.         },
  865.         next: function(c) {
  866.             c = this.$menu.find(".active").removeClass("active").next();
  867.             c.length ||
  868.                 (c = a(this.$menu.find("li")[0]));
  869.             c.addClass("active")
  870.         },
  871.         prev: function(a) {
  872.             a = this.$menu.find(".active").removeClass("active").prev();
  873.             a.length || (a = this.$menu.find("li").last());
  874.             a.addClass("active")
  875.         },
  876.         listen: function() {
  877.             this.$element.on("blur", a.proxy(this.blur, this)).on("keypress", a.proxy(this.keypress, this)).on("keyup", a.proxy(this.keyup, this));
  878.             (a.browser.chrome || a.browser.webkit || a.browser.msie) && this.$element.on("keydown", a.proxy(this.keydown, this));
  879.             this.$menu.on("click", a.proxy(this.click, this)).on("mouseenter",
  880.                 "li", a.proxy(this.mouseenter, this))
  881.         },
  882.         move: function(a) {
  883.             if (this.shown) {
  884.                 switch (a.keyCode) {
  885.                     case 9:
  886.                     case 13:
  887.                     case 27:
  888.                         a.preventDefault();
  889.                         break;
  890.                     case 38:
  891.                         a.preventDefault();
  892.                         this.prev();
  893.                         break;
  894.                     case 40:
  895.                         a.preventDefault(), this.next()
  896.                 }
  897.                 a.stopPropagation()
  898.             }
  899.         },
  900.         keydown: function(c) {
  901.             this.suppressKeyPressRepeat = !~a.inArray(c.keyCode, [40, 38, 9, 13, 27]);
  902.             this.move(c)
  903.         },
  904.         keypress: function(a) {
  905.             this.suppressKeyPressRepeat || this.move(a)
  906.         },
  907.         keyup: function(a) {
  908.             switch (a.keyCode) {
  909.                 case 40:
  910.                 case 38:
  911.                     break;
  912.                 case 9:
  913.                 case 13:
  914.                     if (!this.shown) return;
  915.                     this.select();
  916.                     break;
  917.                 case 27:
  918.                     if (!this.shown) return;
  919.                     this.hide();
  920.                     break;
  921.                 default:
  922.                     this.lookup()
  923.             }
  924.             a.stopPropagation();
  925.             a.preventDefault()
  926.         },
  927.         blur: function(a) {
  928.             var b = this;
  929.             setTimeout(function() {
  930.                 b.hide()
  931.             }, 150)
  932.         },
  933.         click: function(a) {
  934.             a.stopPropagation();
  935.             a.preventDefault();
  936.             this.select()
  937.         },
  938.         mouseenter: function(c) {
  939.             this.$menu.find(".active").removeClass("active");
  940.             a(c.currentTarget).addClass("active")
  941.         }
  942.     };
  943.     a.fn.typeahead = function(c) {
  944.         return this.each(function() {
  945.             var b = a(this),
  946.                 e = b.data("typeahead"),
  947.                 f = "object" == typeof c && c;
  948.             e || b.data("typeahead",
  949.                 e = new d(this, f));
  950.             "string" == typeof c && e[c]()
  951.         })
  952.     };
  953.     a.fn.typeahead.defaults = {
  954.         source: [],
  955.         items: 8,
  956.         menu: '<ul class="typeahead dropdown-menu"></ul>',
  957.         item: '<li><a href="#"></a></li>',
  958.         minLength: 1
  959.     };
  960.     a.fn.typeahead.Constructor = d;
  961.     a(function() {
  962.         a("body").on("focus.typeahead.data-api", '[data-provide="typeahead"]', function(c) {
  963.             var b = a(this);
  964.             b.data("typeahead") || (c.preventDefault(), b.typeahead(b.data()))
  965.         })
  966.     })
  967. }(window.jQuery);
  968. ! function(a) {
  969.     var d = function(c, b) {
  970.         this.options = a.extend({}, a.fn.affix.defaults, b);
  971.         this.$window = a(window).on("scroll.affix.data-api", a.proxy(this.checkPosition, this));
  972.         this.$element = a(c);
  973.         this.checkPosition()
  974.     };
  975.     d.prototype.checkPosition = function() {
  976.         if (this.$element.is(":visible")) {
  977.             var c = a(document).height(),
  978.                 b = this.$window.scrollTop(),
  979.                 d = this.$element.offset(),
  980.                 f = this.options.offset,
  981.                 h = f.bottom,
  982.                 g = f.top;
  983.             "object" != typeof f && (h = g = f);
  984.             "function" == typeof g && (g = f.top());
  985.             "function" == typeof h && (h = f.bottom());
  986.             c = null !=
  987.                 this.unpin && b + this.unpin <= d.top ? !1 : null != h && d.top + this.$element.height() >= c - h ? "bottom" : null != g && b <= g ? "top" : !1;
  988.             this.affixed !== c && (this.affixed = c, this.unpin = "bottom" == c ? d.top - b : null, this.$element.removeClass("affix affix-top affix-bottom").addClass("affix" + (c ? "-" + c : "")))
  989.         }
  990.     };
  991.     a.fn.affix = function(c) {
  992.         return this.each(function() {
  993.             var b = a(this),
  994.                 e = b.data("affix"),
  995.                 f = "object" == typeof c && c;
  996.             e || b.data("affix", e = new d(this, f));
  997.             "string" == typeof c && e[c]()
  998.         })
  999.     };
  1000.     a.fn.affix.Constructor = d;
  1001.     a.fn.affix.defaults = {
  1002.         offset: 0
  1003.     };
  1004.     a(window).on("load",
  1005.         function() {
  1006.             a('[data-spy="affix"]').each(function() {
  1007.                 var c = a(this),
  1008.                     b = c.data();
  1009.                 b.offset = b.offset || {};
  1010.                 b.offsetBottom && (b.offset.bottom = b.offsetBottom);
  1011.                 b.offsetTop && (b.offset.top = b.offsetTop);
  1012.                 c.affix(b)
  1013.             })
  1014.         })
  1015. }(window.jQuery);
  1016. (function(a, d, c) {
  1017.     function b(a) {
  1018.         var b = {},
  1019.             d = /^jQuery\d+$/;
  1020.         c.each(a.attributes, function(a, c) {
  1021.             c.specified && !d.test(c.name) && (b[c.name] = c.value)
  1022.         });
  1023.         return b
  1024.     }
  1025.  
  1026.     function e(a, b) {
  1027.         var e = c(this);
  1028.         if (this.value == e.attr("placeholder") && e.hasClass("placeholder"))
  1029.             if (e.data("placeholder-password")) {
  1030.                 e = e.hide().next().show().attr("id", e.removeAttr("id").data("placeholder-id"));
  1031.                 if (!0 === a) return e[0].value = b;
  1032.                 e.focus()
  1033.             } else this.value = "", e.removeClass("placeholder"), this == d.activeElement && this.select()
  1034.     }
  1035.  
  1036.     function f() {
  1037.         var a,
  1038.             d = c(this),
  1039.             f = this.id;
  1040.         if ("" == this.value) {
  1041.             if ("password" == this.type) {
  1042.                 if (!d.data("placeholder-textinput")) {
  1043.                     try {
  1044.                         a = d.clone().attr({
  1045.                             type: "text"
  1046.                         })
  1047.                     } catch (k) {
  1048.                         a = c("<input>").attr(c.extend(b(this), {
  1049.                             type: "text"
  1050.                         }))
  1051.                     }
  1052.                     a.removeAttr("name").data({
  1053.                         "placeholder-password": !0,
  1054.                         "placeholder-id": f
  1055.                     }).bind("focus.placeholder", e);
  1056.                     d.data({
  1057.                         "placeholder-textinput": a,
  1058.                         "placeholder-id": f
  1059.                     }).before(a)
  1060.                 }
  1061.                 d = d.removeAttr("id").hide().prev().attr("id", f).show()
  1062.             }
  1063.             d.addClass("placeholder");
  1064.             d[0].value = d.attr("placeholder")
  1065.         } else d.removeClass("placeholder")
  1066.     }
  1067.     var h = "placeholder" in d.createElement("input"),
  1068.         g = "placeholder" in d.createElement("textarea"),
  1069.         m = c.fn,
  1070.         k = c.valHooks;
  1071.     h && g ? (m = m.placeholder = function() {
  1072.         return this
  1073.     }, m.input = m.textarea = !0) : (m = m.placeholder = function() {
  1074.         this.filter((h ? "textarea" : ":input") + "[placeholder]").not(".placeholder").bind({
  1075.             "focus.placeholder": e,
  1076.             "blur.placeholder": f
  1077.         }).data("placeholder-enabled", !0).trigger("blur.placeholder");
  1078.         return this
  1079.     }, m.input = h, m.textarea = g, m = {
  1080.         get: function(a) {
  1081.             var b = c(a);
  1082.             return b.data("placeholder-enabled") && b.hasClass("placeholder") ?
  1083.                 "" : a.value
  1084.         },
  1085.         set: function(a, b) {
  1086.             var k = c(a);
  1087.             if (!k.data("placeholder-enabled")) return a.value = b;
  1088.             "" == b ? (a.value = b, a != d.activeElement && f.call(a)) : k.hasClass("placeholder") ? e.call(a, !0, b) || (a.value = b) : a.value = b;
  1089.             return k
  1090.         }
  1091.     }, h || (k.input = m), g || (k.textarea = m), c(function() {
  1092.         c(d).delegate("form", "submit.placeholder", function() {
  1093.             var a = c(".placeholder", this).each(e);
  1094.             setTimeout(function() {
  1095.                 a.each(f)
  1096.             }, 10)
  1097.         })
  1098.     }), c(a).bind("beforeunload.placeholder", function() {
  1099.         c(".placeholder").each(function() {
  1100.             this.value = ""
  1101.         })
  1102.     }))
  1103. })(this, document,
  1104.     jQuery);
  1105. (function(a) {
  1106.     "function" === typeof define && define.amd ? define(["jquery"], a) : "object" === typeof exports ? a(require("jquery")) : a(jQuery)
  1107. })(function(a) {
  1108.     function d(a) {
  1109.         a = e.json ? JSON.stringify(a) : String(a);
  1110.         return e.raw ? a : encodeURIComponent(a)
  1111.     }
  1112.  
  1113.     function c(c, d) {
  1114.         var g;
  1115.         if (e.raw) g = c;
  1116.         else a: {
  1117.             var m = c;
  1118.             0 === m.indexOf('"') && (m = m.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\"));
  1119.             try {
  1120.                 m = decodeURIComponent(m.replace(b, " "));
  1121.                 g = e.json ? JSON.parse(m) : m;
  1122.                 break a
  1123.             } catch (k) {}
  1124.             g = void 0
  1125.         }
  1126.         return a.isFunction(d) ? d(g) : g
  1127.     }
  1128.     var b = /\+/g,
  1129.         e =
  1130.         a.cookie = function(b, h, g) {
  1131.             if (void 0 !== h && !a.isFunction(h)) {
  1132.                 g = a.extend({}, e.defaults, g);
  1133.                 if ("number" === typeof g.expires) {
  1134.                     var m = g.expires,
  1135.                         k = g.expires = new Date;
  1136.                     k.setTime(+k + 864E5 * m)
  1137.                 }
  1138.                 return document.cookie = [e.raw ? b : encodeURIComponent(b), "=", d(h), g.expires ? "; expires=" + g.expires.toUTCString() : "", g.path ? "; path=" + g.path : "", g.domain ? "; domain=" + g.domain : "", g.secure ? "; secure" : ""].join("")
  1139.             }
  1140.             g = b ? void 0 : {};
  1141.             for (var m = document.cookie ? document.cookie.split("; ") : [], k = 0, n = m.length; k < n; k++) {
  1142.                 var q = m[k].split("="),
  1143.                     l;
  1144.                 l = q.shift();
  1145.                 l = e.raw ? l : decodeURIComponent(l);
  1146.                 q = q.join("=");
  1147.                 if (b && b === l) {
  1148.                     g = c(q, h);
  1149.                     break
  1150.                 }
  1151.                 b || void 0 === (q = c(q)) || (g[l] = q)
  1152.             }
  1153.             return g
  1154.         };
  1155.     e.defaults = {};
  1156.     a.removeCookie = function(c, b) {
  1157.         if (void 0 === a.cookie(c)) return !1;
  1158.         a.cookie(c, "", a.extend({}, b, {
  1159.             expires: -1
  1160.         }));
  1161.         return !a.cookie(c)
  1162.     }
  1163. });
  1164. (function(a) {
  1165.     var d = !a.support.opacity;
  1166.     void 0 === a.proxy && a.extend({
  1167.         proxy: function(a, b) {
  1168.             a && (proxy = function() {
  1169.                 return a.apply(b || this, arguments)
  1170.             });
  1171.             return proxy
  1172.         }
  1173.     });
  1174.     a.extend(a.easing, {
  1175.         easeOutBackMin: function(a, b, d, f, h, g) {
  1176.             void 0 === g && (g = 1);
  1177.             return f * ((b = b / h - 1) * b * ((g + 1) * b + g) + 1) + d
  1178.         }
  1179.     });
  1180.     a.extend(a.expr[":"], {
  1181.         value: function(c) {
  1182.             return a(c).val()
  1183.         }
  1184.     });
  1185.     a.extend({
  1186.         MsgBoxObject: {
  1187.             defaults: {
  1188.                 name: "jquery-msgbox",
  1189.                 zIndex: 1E4,
  1190.                 width: 420,
  1191.                 height: "auto",
  1192.                 background: "#FFFFFF",
  1193.                 modal: !0,
  1194.                 overlay: {
  1195.                     background: "rgba(33,18,51,0.9)",
  1196.                     opacity: .5
  1197.                 },
  1198.                 showDuration: 200,
  1199.                 closeDuration: 100,
  1200.                 moveDuration: 550,
  1201.                 shake: {
  1202.                     distance: 10,
  1203.                     duration: 100,
  1204.                     transition: "easeOutBackMin",
  1205.                     loops: 2
  1206.                 },
  1207.                 form: {
  1208.                     active: !1,
  1209.                     action: "#",
  1210.                     method: "post"
  1211.                 },
  1212.                 emergefrom: "top"
  1213.             },
  1214.             options: {},
  1215.             esqueleto: {
  1216.                 msgbox: [],
  1217.                 wrapper: [],
  1218.                 form: [],
  1219.                 buttons: [],
  1220.                 inputs: []
  1221.             },
  1222.             visible: !1,
  1223.             i: 0,
  1224.             animation: !1,
  1225.             config: function(c) {
  1226.                 this.options = a.extend(!0, this.options, c);
  1227.                 this.overlay.element.css(this.options.overlay);
  1228.                 this.overlay.options.hideOnClick = !this.options.modal;
  1229.                 this.esqueleto.msgbox.css({
  1230.                     width: this.options.width,
  1231.                     height: this.options.height,
  1232.                     "background-color": this.options.background
  1233.                 });
  1234.                 this.moveBox()
  1235.             },
  1236.             overlay: {
  1237.                 create: function(c) {
  1238.                     this.options = c;
  1239.                     this.element = a('<div id="' + (new Date).getTime() + '"></div>');
  1240.                     this.element.css(a.extend({}, {
  1241.                         position: "fixed",
  1242.                         top: 0,
  1243.                         left: 0,
  1244.                         opacity: 0,
  1245.                         display: "none",
  1246.                         "z-index": this.options.zIndex
  1247.                     }, this.options.style));
  1248.                     this.element.click(a.proxy(function(c) {
  1249.                         this.options.hideOnClick && (a.isFunction(this.options.callback) ? this.options.callback() : this.hide());
  1250.                         c.preventDefault()
  1251.                     }, this));
  1252.                     this.hidden = !0;
  1253.                     this.inject();
  1254.                     return this
  1255.                 },
  1256.                 inject: function() {
  1257.                     this.target = a(document.body);
  1258.                     this.target.append(this.element);
  1259.                     if (d) {
  1260.                         this.element.css({
  1261.                             position: "absolute"
  1262.                         });
  1263.                         var c = parseInt(this.element.css("zIndex"));
  1264.                         if (!c) {
  1265.                             var c = 1,
  1266.                                 b = this.element.css("position");
  1267.                             "static" != b && b || this.element.css({
  1268.                                 position: "relative"
  1269.                             });
  1270.                             this.element.css({
  1271.                                 zIndex: c
  1272.                             })
  1273.                         }
  1274.                         c = (this.options.zIndex || 0 === this.options.zIndex) && c > this.options.zIndex ? this.options.zIndex : c - 1;
  1275.                         0 > c && (c = 1);
  1276.                         this.shim = a('<iframe id="IF_' + (new Date).getTime() + '" scrolling="no" frameborder=0 src=""></div>');
  1277.                         this.shim.css({
  1278.                             zIndex: c,
  1279.                             position: "absolute",
  1280.                             top: 0,
  1281.                             left: 0,
  1282.                             border: "none",
  1283.                             width: 0,
  1284.                             height: 0,
  1285.                             opacity: 0
  1286.                         });
  1287.                         this.shim.insertAfter(this.element);
  1288.                         a("html, body").css({
  1289.                             height: "100%",
  1290.                             width: "100%",
  1291.                             "margin-left": 0,
  1292.                             "margin-right": 0
  1293.                         })
  1294.                     }
  1295.                 },
  1296.                 resize: function(c, b) {
  1297.                     this.element.css({
  1298.                         height: 0,
  1299.                         width: 0
  1300.                     });
  1301.                     this.shim && this.shim.css({
  1302.                         height: 0,
  1303.                         width: 0
  1304.                     });
  1305.                     a(document).width();
  1306.                     var d = a(document).height();
  1307.                     this.element.css({
  1308.                         width: "100%",
  1309.                         height: b ? b : d
  1310.                     });
  1311.                     this.shim && (this.shim.css({
  1312.                         height: 0,
  1313.                         width: 0
  1314.                     }), this.shim.css({
  1315.                         position: "absolute",
  1316.                         left: 0,
  1317.                         top: 0,
  1318.                         width: this.element.width(),
  1319.                         height: b ? b : d
  1320.                     }));
  1321.                     return this
  1322.                 },
  1323.                 show: function() {
  1324.                     a(".modal") && a(".modal").removeAttr("tabindex");
  1325.                     a.browser.msie && a(".modal") && a(".modal").hide();
  1326.                     if (!this.hidden) return this;
  1327.                     this.transition && this.transition.stop();
  1328.                     this.target.bind("resize", a.proxy(this.resize, this));
  1329.                     this.resize();
  1330.                     this.shim && this.shim.css({
  1331.                         display: "block"
  1332.                     });
  1333.                     this.hidden = !1;
  1334.                     this.transition = this.element.fadeIn(this.options.showDuration, a.proxy(function() {
  1335.                         this.element.trigger("show")
  1336.                     }, this));
  1337.                     return this
  1338.                 },
  1339.                 hide: function() {
  1340.                     a(".modal") &&
  1341.                         (a(".modal").attr("tabindex", "-1"), a(".modal").focus());
  1342.                     a.browser.msie && a(".modal") && a(".modal").show();
  1343.                     if (this.hidden) return this;
  1344.                     this.transition && this.transition.stop();
  1345.                     this.target.unbind("resize");
  1346.                     this.shim && this.shim.css({
  1347.                         display: "none"
  1348.                     });
  1349.                     this.hidden = !0;
  1350.                     this.transition = this.element.fadeOut(this.options.closeDuration, a.proxy(function() {
  1351.                         this.element.trigger("hide");
  1352.                         this.element.css({
  1353.                             height: 0,
  1354.                             width: 0
  1355.                         })
  1356.                     }, this));
  1357.                     return this
  1358.                 }
  1359.             },
  1360.             create: function() {
  1361.                 this.options = a.extend(!0, this.defaults, this.options);
  1362.                 this.overlay.create({
  1363.                     style: this.options.overlay,
  1364.                     hideOnClick: !this.options.modal,
  1365.                     zIndex: this.options.zIndex - 1,
  1366.                     showDuration: this.options.showDuration,
  1367.                     closeDuration: this.options.closeDuration
  1368.                 });
  1369.                 this.esqueleto.msgbox = a('<div class="' + this.options.name + '"></div>');
  1370.                 this.esqueleto.msgbox.css({
  1371.                     display: "none",
  1372.                     position: "absolute",
  1373.                     top: 0,
  1374.                     left: 0,
  1375.                     width: this.options.width,
  1376.                     height: this.options.height,
  1377.                     "z-index": this.options.zIndex,
  1378.                     "word-wrap": "break-word",
  1379.                     "-moz-box-shadow": "0 0 15px rgba(0, 0, 0, 0.5)",
  1380.                     "-webkit-box-shadow": "0 0 15px rgba(0, 0, 0, 0.5)",
  1381.                     "box-shadow": "0 0 15px rgba(0, 0, 0, 0.5)",
  1382.                     "-moz-border-radius": "6px",
  1383.                     "-webkit-border-radius": "6px",
  1384.                     "border-radius": "6px",
  1385.                     "background-color": this.options.background
  1386.                 });
  1387.                 this.esqueleto.wrapper = a('<div class="' + this.options.name + '-wrapper"></div>');
  1388.                 this.esqueleto.msgbox.append(this.esqueleto.wrapper);
  1389.                 this.esqueleto.form = a('<form action="' + this.options.formaction + '" method="post"></form>');
  1390.                 this.esqueleto.wrapper.append(this.esqueleto.form);
  1391.                 this.esqueleto.wrapper.css({
  1392.                     height: d ? 80 : "auto",
  1393.                     "min-height": 80,
  1394.                     zoom: 1
  1395.                 });
  1396.                 a("body").append(this.esqueleto.msgbox);
  1397.                 this.addevents();
  1398.                 return this.esqueleto.msgbox
  1399.             },
  1400.             addevents: function() {
  1401.                 a(window).bind("resize", a.proxy(function() {
  1402.                     this.visible && (this.overlay.resize(), this.moveBox())
  1403.                 }, this));
  1404.                 a(window).bind("scroll", a.proxy(function() {
  1405.                     this.visible && this.moveBox()
  1406.                 }, this));
  1407.                 this.esqueleto.msgbox.bind("keyup", a.proxy(function(a) {
  1408.                     27 == a.keyCode && this.close(!1)
  1409.                 }, this));
  1410.                 this.esqueleto.form.bind("submit", a.proxy(function(c) {
  1411.                     a("input[type=submit]:first, button[type=submit]:first, button:first", this.esqueleto.form).trigger("click");
  1412.                     options.form.active || c.preventDefault()
  1413.                 }, this));
  1414.                 this.overlay.element.bind("show", a.proxy(function() {
  1415.                     a(this).triggerHandler("show")
  1416.                 }, this));
  1417.                 this.overlay.element.bind("hide", a.proxy(function() {
  1418.                     a(this).triggerHandler("close")
  1419.                 }, this))
  1420.             },
  1421.             show: function(c, b, d) {
  1422.                 var f = "alert info error prompt confirm custom".split(" ");
  1423.                 this.esqueleto.msgbox.queue(this.options.name, a.proxy(function(h) {
  1424.                         b = a.extend(!0, {
  1425.                             type: "alert",
  1426.                             form: {
  1427.                                 active: !1
  1428.                             }
  1429.                         }, b || {});
  1430.                         h = "undefined" === typeof b.buttons ? "confirm" == b.type || "prompt" == b.type ? [{
  1431.                             type: "submit",
  1432.                             value: "Ok"
  1433.                         }, {
  1434.                             type: "cancel",
  1435.                             value: "Cancel"
  1436.                         }] : [{
  1437.                             type: "submit",
  1438.                             value: "Ok"
  1439.                         }] : b.buttons;
  1440.                         var g = "undefined" === typeof b.inputs && "prompt" == b.type ? [{
  1441.                             type: "text",
  1442.                             name: "prompt",
  1443.                             value: ""
  1444.                         }] : b.inputs;
  1445.                         this.callback = a.isFunction(d) ? d : function(a) {};
  1446.                         "undefined" !== typeof g && (this.esqueleto.inputs = a('<div class="' + this.options.name + '-inputs"></div>'), this.esqueleto.form.append(this.esqueleto.inputs), a.each(g, a.proxy(function(c, b) {
  1447.                             if ("checkbox" == b.type) iLabel = b.label ? '<label class="' + this.options.name + '-label">' : "", fLabel =
  1448.                                 b.label ? b.label + "</label>" : "", b.value = void 0 === b.value ? "1" : b.value, iName = void 0 === b.name ? this.options.name + "-label-" + c : b.name, iChecked = b.checked, this.esqueleto.inputs.append(a(iLabel + '<input type="' + b.type + '" style="display:inline; width:auto;" name="' + iName + '" value="' + b.value + '" autocomplete="off"' + (iChecked ? ' checked="true"' : "") + "/> " + fLabel));
  1449.                             else if ("number" == b.type) iLabel = b.label ? '<label class="' + this.options.name + '-label">' + b.label : "", fLabel = b.label ? "</label>" : "", b.value = void 0 === b.value ? "" :
  1450.                                 b.value, b.placeholder = void 0 === b.placeholder ? "" : b.placeholder, iRequired = void 0 === b.required || 0 == b.required ? "" : 'required="true"', iMin = "undefined" === typeof b.min ? "" : 'min="' + b.min + '"', iMax = "undefined" === typeof b.max ? "" : 'max="' + b.max + '"', iName = void 0 === b.name ? this.options.name + "-label-" + c : b.name, this.esqueleto.inputs.append(a(iLabel + '<input type="' + b.type + '" name="' + iName + '" value="' + b.value + '" placeholder="' + b.placeholder + '" autocomplete="off" ' + iRequired + " " + iMin + " " + iMax + "/> " + fLabel));
  1451.                             else if ("select" ==
  1452.                                 b.type) {
  1453.                                 if ("undefined" !== typeof b.options && b.options instanceof Array && 0 < b.options.length) {
  1454.                                     iLabel = b.label ? '<label class="' + this.options.name + '-label">' + b.label : "";
  1455.                                     fLabel = b.label ? "</label>" : "";
  1456.                                     b.value = void 0 === b.value ? "" : b.value;
  1457.                                     b.placeholder = void 0 === b.placeholder ? "" : b.placeholder;
  1458.                                     iRequired = void 0 === b.required || 0 == b.required ? "" : 'required="true"';
  1459.                                     iName = void 0 === b.name ? this.options.name + "-label-" + c : b.name;
  1460.                                     var d = a(iLabel + '<select name="' + iName + '" ' + iRequired + '><option value="" disabled selected style="display:none;">' +
  1461.                                         b.placeholder + "</option></select> " + fLabel);
  1462.                                     a.map(b.options, function(b) {
  1463.                                         a(d).find("select").append('<option value="' + b + '">' + b + "</option>")
  1464.                                     });
  1465.                                     b.selected && a(d).find("select").val(b.selected);
  1466.                                     this.esqueleto.inputs.append(d)
  1467.                                 }
  1468.                             } else iLabel = b.label ? '<label class="' + this.options.name + '-label">' + b.label : "", fLabel = b.label ? "</label>" : "", b.value = void 0 === b.value ? "" : b.value, b.placeholder = void 0 === b.placeholder ? "" : b.placeholder, iRequired = void 0 === b.required || 0 == b.required ? "" : 'required="true"', iMaxLength = void 0 ===
  1469.                                 typeof b.maxlength ? "" : 'maxlength="' + b.maxlength + '"', iName = void 0 === b.name ? this.options.name + "-label-" + c : b.name, this.esqueleto.inputs.append(a(iLabel + '<input type="' + b.type + '" name="' + iName + '" value="' + b.value + '" placeholder="' + b.placeholder + '" autocomplete="off" ' + iRequired + " " + iMaxLength + "/>" + fLabel))
  1470.                         }, this)));
  1471.                         this.esqueleto.buttons = a('<div class="' + this.options.name + '-buttons"></div>');
  1472.                         this.esqueleto.form.append(this.esqueleto.buttons);
  1473.                         b.form.active ? (this.esqueleto.form.attr("action", void 0 === b.form.action ?
  1474.                             "#" : b.form.action), this.esqueleto.form.attr("method", void 0 === b.form.method ? "post" : b.form.method), this.options.form.active = !0) : (this.esqueleto.form.attr("action", "#"), this.esqueleto.form.attr("method", "post"), this.options.form.active = !1);
  1475.                         "prompt" != b.type ? a.each(h, a.proxy(function(b, c) {
  1476.                             "submit" == c.type ? this.esqueleto.buttons.append(a('<button type="submit" class="' + this.options.name + "-button-submit btn btn-primary" + (c["class"] || "") + '">' + c.value + "</button>").bind("click", a.proxy(function(a) {
  1477.                                 this.close(c.value);
  1478.                                 a.preventDefault()
  1479.                             }, this))) : "cancel" == c.type && this.esqueleto.buttons.append(a('<button type="button" class="' + this.options.name + "-button-cancel btn" + (c["class"] || "") + '">' + c.value + "</button>").bind("click", a.proxy(function(a) {
  1480.                                 this.close(!1);
  1481.                                 a.preventDefault()
  1482.                             }, this)))
  1483.                         }, this)) : "prompt" == b.type && a.each(h, a.proxy(function(c, b) {
  1484.                             "submit" == b.type ? this.esqueleto.buttons.append(a('<button type="submit" class="' + this.options.name + "-button-submit btn btn-primary" + (b["class"] || "") + '">' + b.value + "</button>").bind("click",
  1485.                                 a.proxy(function(b) {
  1486.                                     if (0 < a('input[required="true"]:not(:value)').length) a('input[required="true"]:not(:value):first').focus(), this.shake();
  1487.                                     else {
  1488.                                         if (this.options.form.active) return !0;
  1489.                                         this.close(this.toArguments(a("input, select", this.esqueleto.inputs)))
  1490.                                     }
  1491.                                     b.preventDefault()
  1492.                                 }, this))) : "cancel" == b.type && this.esqueleto.buttons.append(a('<button type="button" class="' + this.options.name + "-button-cancel btn" + (b["class"] || "") + '">' + b.value + "</button>").bind("click", a.proxy(function(a) {
  1493.                                     this.close(!1);
  1494.                                     a.preventDefault()
  1495.                                 },
  1496.                                 this)))
  1497.                         }, this));
  1498.                         this.esqueleto.form.prepend(c);
  1499.                         a.each(f, a.proxy(function(a, b) {
  1500.                             this.esqueleto.wrapper.removeClass(this.options.name + "-" + b)
  1501.                         }, this));
  1502.                         this.esqueleto.wrapper.addClass(this.options.name + "-" + b.type);
  1503.                         this.moveBox();
  1504.                         this.visible = !0;
  1505.                         this.overlay.show();
  1506.                         this.esqueleto.msgbox.css({
  1507.                             display: "block",
  1508.                             left: (a(document).width() - this.options.width) / 2
  1509.                         });
  1510.                         this.moveBox();
  1511.                         setTimeout(a.proxy(function() {
  1512.                             var b = a("input, button", this.esqueleto.msgbox);
  1513.                             b.length && b.get(0).focus()
  1514.                         }, this), this.options.moveDuration)
  1515.                     },
  1516.                     this));
  1517.                 this.i++;
  1518.                 1 == this.i && this.esqueleto.msgbox.dequeue(this.options.name)
  1519.             },
  1520.             toArguments: function(c) {
  1521.                 return a.map(c, function(b) {
  1522.                     return a(b).val()
  1523.                 })
  1524.             },
  1525.             moveBox: function() {
  1526.                 var c = a(window).width(),
  1527.                     b = a(window).height(),
  1528.                     d = a(window).scrollLeft(),
  1529.                     f = a(window).scrollTop(),
  1530.                     h = this.esqueleto.msgbox.outerHeight(),
  1531.                     g = 0,
  1532.                     m = 0,
  1533.                     g = d + (c - this.options.width) / 2,
  1534.                     m = "bottom" == this.options.emergefrom ? f + b + 80 : f - h - 80;
  1535.                 this.visible ? (this.animation && this.animation.stop, this.animation = this.esqueleto.msgbox.animate({
  1536.                     left: g,
  1537.                     top: f + (b - h) /
  1538.                         2
  1539.                 }, {
  1540.                     duration: this.options.moveDuration,
  1541.                     queue: !1,
  1542.                     easing: "easeOutBackMin"
  1543.                 })) : this.esqueleto.msgbox.css({
  1544.                     top: m,
  1545.                     left: g
  1546.                 })
  1547.             },
  1548.             close: function(c) {
  1549.                 this.esqueleto.msgbox.css({
  1550.                     display: "none",
  1551.                     top: 0
  1552.                 });
  1553.                 this.visible = !1;
  1554.                 a.isFunction(this.callback) && this.callback.apply(this, a.makeArray(c));
  1555.                 setTimeout(a.proxy(function() {
  1556.                     this.i--;
  1557.                     this.esqueleto.msgbox.dequeue(this.options.name)
  1558.                 }, this), this.options.closeDuration);
  1559.                 1 == this.i && this.overlay.hide();
  1560.                 this.moveBox();
  1561.                 this.esqueleto.form.empty()
  1562.             },
  1563.             shake: function() {
  1564.                 var a = this.options.shake.distance,
  1565.                     b = this.options.shake.duration,
  1566.                     d = this.options.shake.transition,
  1567.                     f = this.options.shake.loops,
  1568.                     h = this.esqueleto.msgbox.position().left,
  1569.                     g = this.esqueleto.msgbox;
  1570.                 for (i = 0; i < f; i++) g.animate({
  1571.                     left: h + a
  1572.                 }, b, d), g.animate({
  1573.                     left: h - a
  1574.                 }, b, d);
  1575.                 g.animate({
  1576.                     left: h + a
  1577.                 }, b, d);
  1578.                 g.animate({
  1579.                     left: h
  1580.                 }, b, d)
  1581.             }
  1582.         },
  1583.         msgbox: function(c, b, d) {
  1584.             if ("object" == typeof c) a.MsgBoxObject.config(c);
  1585.             else return a.MsgBoxObject.show(c, b, d)
  1586.         }
  1587.     });
  1588.     a(function() {
  1589.         if (1.2 < parseFloat(a.fn.jquery)) a.MsgBoxObject.create();
  1590.         else throw "The jQuery version that was loaded is too old. MsgBox requires jQuery 1.3+";
  1591.     })
  1592. })(jQuery);
  1593. var _ = {};
  1594. (function() {
  1595.     var a = {
  1596.         escape: {
  1597.             "&": "&#38;",
  1598.             "<": "&#60;",
  1599.             ">": "&#62;",
  1600.             '"': "&#34;",
  1601.             "'": "&#39;"
  1602.         },
  1603.         unescape: {}
  1604.     };
  1605.     $.map(a.escape, function(c, b) {
  1606.         a.unescape[c] = b
  1607.     });
  1608.     var d = {
  1609.         escape: new RegExp("[" + $.map(a.escape, function(a, b) {
  1610.             return b
  1611.         }).join("") + "]", "g"),
  1612.         unescape: new RegExp("(" + $.map(a.unescape, function(a, b) {
  1613.             return b
  1614.         }).join("|") + ")", "g")
  1615.     };
  1616.     $.map(["escape", "unescape"], function(c) {
  1617.         _[c] = function(b) {
  1618.             return null == b ? "" : ("" + b).replace(d[c], function(b) {
  1619.                 return a[c][b]
  1620.             })
  1621.         }
  1622.     })
  1623. })();
  1624. (function(a) {
  1625.     a.event.special.destroyed = {
  1626.         remove: function(a) {
  1627.             a.handler && a.handler()
  1628.         }
  1629.     }
  1630. })(jQuery);
  1631. (function() {
  1632.     var a = {},
  1633.         d = this,
  1634.         c = d.async;
  1635.     a.noConflict = function() {
  1636.         d.async = c;
  1637.         return a
  1638.     };
  1639.     var b = function(a, b) {
  1640.             if (a.forEach) return a.forEach(b);
  1641.             for (var c = 0; c < a.length; c += 1) b(a[c], c, a)
  1642.         },
  1643.         e = function(a, c) {
  1644.             if (a.map) return a.map(c);
  1645.             var d = [];
  1646.             b(a, function(a, b, e) {
  1647.                 d.push(c(a, b, e))
  1648.             });
  1649.             return d
  1650.         },
  1651.         f = function(a, c, d) {
  1652.             if (a.reduce) return a.reduce(c, d);
  1653.             b(a, function(a, b, e) {
  1654.                 d = c(d, a, b, e)
  1655.             });
  1656.             return d
  1657.         },
  1658.         h = function(a) {
  1659.             if (Object.keys) return Object.keys(a);
  1660.             var b = [],
  1661.                 c;
  1662.             for (c in a) a.hasOwnProperty(c) && b.push(c);
  1663.             return b
  1664.         };
  1665.     a.nextTick = "undefined" !==
  1666.         typeof process && process.nextTick ? process.nextTick : function(a) {
  1667.             setTimeout(a, 0)
  1668.         };
  1669.     a.forEach = function(a, c, d) {
  1670.         d = d || function() {};
  1671.         if (!a.length) return d();
  1672.         var e = 0;
  1673.         b(a, function(b) {
  1674.             c(b, function(b) {
  1675.                 b ? (d(b), d = function() {}) : (e += 1, e === a.length && d(null))
  1676.             })
  1677.         })
  1678.     };
  1679.     a.forEachSeries = function(a, b, c) {
  1680.         c = c || function() {};
  1681.         if (!a.length) return c();
  1682.         var d = 0,
  1683.             e = function() {
  1684.                 b(a[d], function(b) {
  1685.                     b ? (c(b), c = function() {}) : (d += 1, d === a.length ? c(null) : e())
  1686.                 })
  1687.             };
  1688.         e()
  1689.     };
  1690.     a.forEachLimit = function(a, b, c, d) {
  1691.         d = d || function() {};
  1692.         if (!a.length || 0 >= b) return d();
  1693.         var e = 0,
  1694.             f = 0,
  1695.             h = 0;
  1696.         (function E() {
  1697.             if (e === a.length) return d();
  1698.             for (; h < b && f < a.length;) f += 1, h += 1, c(a[f - 1], function(b) {
  1699.                 b ? (d(b), d = function() {}) : (e += 1, --h, e === a.length ? d() : E())
  1700.             })
  1701.         })()
  1702.     };
  1703.     var g = function(b) {
  1704.             return function() {
  1705.                 var c = Array.prototype.slice.call(arguments);
  1706.                 return b.apply(null, [a.forEach].concat(c))
  1707.             }
  1708.         },
  1709.         m = function(b) {
  1710.             return function() {
  1711.                 var c = Array.prototype.slice.call(arguments);
  1712.                 return b.apply(null, [a.forEachSeries].concat(c))
  1713.             }
  1714.         },
  1715.         k = function(a, b, c, d) {
  1716.             var f = [];
  1717.             b = e(b, function(a, b) {
  1718.                 return {
  1719.                     index: b,
  1720.                     value: a
  1721.                 }
  1722.             });
  1723.             a(b,
  1724.                 function(a, b) {
  1725.                     c(a.value, function(c, d) {
  1726.                         f[a.index] = d;
  1727.                         b(c)
  1728.                     })
  1729.                 },
  1730.                 function(a) {
  1731.                     d(a, f)
  1732.                 })
  1733.         };
  1734.     a.map = g(k);
  1735.     a.mapSeries = m(k);
  1736.     a.reduce = function(b, c, d, e) {
  1737.         a.forEachSeries(b, function(a, b) {
  1738.             d(c, a, function(a, d) {
  1739.                 c = d;
  1740.                 b(a)
  1741.             })
  1742.         }, function(a) {
  1743.             e(a, c)
  1744.         })
  1745.     };
  1746.     a.inject = a.reduce;
  1747.     a.foldl = a.reduce;
  1748.     a.reduceRight = function(b, c, d, f) {
  1749.         b = e(b, function(a) {
  1750.             return a
  1751.         }).reverse();
  1752.         a.reduce(b, c, d, f)
  1753.     };
  1754.     a.foldr = a.reduceRight;
  1755.     k = function(a, b, c, d) {
  1756.         var f = [];
  1757.         b = e(b, function(a, b) {
  1758.             return {
  1759.                 index: b,
  1760.                 value: a
  1761.             }
  1762.         });
  1763.         a(b, function(a, b) {
  1764.                 c(a.value, function(c) {
  1765.                     c && f.push(a);
  1766.                     b()
  1767.                 })
  1768.             },
  1769.             function(a) {
  1770.                 d(e(f.sort(function(a, b) {
  1771.                     return a.index - b.index
  1772.                 }), function(a) {
  1773.                     return a.value
  1774.                 }))
  1775.             })
  1776.     };
  1777.     a.filter = g(k);
  1778.     a.filterSeries = m(k);
  1779.     a.select = a.filter;
  1780.     a.selectSeries = a.filterSeries;
  1781.     k = function(a, b, c, d) {
  1782.         var f = [];
  1783.         b = e(b, function(a, b) {
  1784.             return {
  1785.                 index: b,
  1786.                 value: a
  1787.             }
  1788.         });
  1789.         a(b, function(a, b) {
  1790.             c(a.value, function(c) {
  1791.                 c || f.push(a);
  1792.                 b()
  1793.             })
  1794.         }, function(a) {
  1795.             d(e(f.sort(function(a, b) {
  1796.                 return a.index - b.index
  1797.             }), function(a) {
  1798.                 return a.value
  1799.             }))
  1800.         })
  1801.     };
  1802.     a.reject = g(k);
  1803.     a.rejectSeries = m(k);
  1804.     k = function(a, b, c, d) {
  1805.         a(b, function(a, b) {
  1806.             c(a, function(c) {
  1807.                 c ? (d(a),
  1808.                     d = function() {}) : b()
  1809.             })
  1810.         }, function(a) {
  1811.             d()
  1812.         })
  1813.     };
  1814.     a.detect = g(k);
  1815.     a.detectSeries = m(k);
  1816.     a.some = function(b, c, d) {
  1817.         a.forEach(b, function(a, b) {
  1818.             c(a, function(a) {
  1819.                 a && (d(!0), d = function() {});
  1820.                 b()
  1821.             })
  1822.         }, function(a) {
  1823.             d(!1)
  1824.         })
  1825.     };
  1826.     a.any = a.some;
  1827.     a.every = function(b, c, d) {
  1828.         a.forEach(b, function(a, b) {
  1829.             c(a, function(a) {
  1830.                 a || (d(!1), d = function() {});
  1831.                 b()
  1832.             })
  1833.         }, function(a) {
  1834.             d(!0)
  1835.         })
  1836.     };
  1837.     a.all = a.every;
  1838.     a.sortBy = function(b, c, d) {
  1839.         a.map(b, function(a, b) {
  1840.             c(a, function(c, d) {
  1841.                 c ? b(c) : b(null, {
  1842.                     value: a,
  1843.                     criteria: d
  1844.                 })
  1845.             })
  1846.         }, function(a, b) {
  1847.             if (a) return d(a);
  1848.             d(null, e(b.sort(function(a,
  1849.                 b) {
  1850.                 var c = a.criteria,
  1851.                     d = b.criteria;
  1852.                 return c < d ? -1 : c > d ? 1 : 0
  1853.             }), function(a) {
  1854.                 return a.value
  1855.             }))
  1856.         })
  1857.     };
  1858.     a.auto = function(a, c) {
  1859.         c = c || function() {};
  1860.         var d = h(a);
  1861.         if (!d.length) return c(null);
  1862.         var e = {},
  1863.             g = [],
  1864.             k = function(a) {
  1865.                 g.unshift(a)
  1866.             },
  1867.             m = function() {
  1868.                 b(g.slice(0), function(a) {
  1869.                     a()
  1870.                 })
  1871.             };
  1872.         k(function() {
  1873.             h(e).length === d.length && (c(null, e), c = function() {})
  1874.         });
  1875.         b(d, function(b) {
  1876.             var d = a[b] instanceof Function ? [a[b]] : a[b],
  1877.                 h = function(a) {
  1878.                     if (a) c(a), c = function() {};
  1879.                     else {
  1880.                         var r = Array.prototype.slice.call(arguments, 1);
  1881.                         1 >= r.length && (r = r[0]);
  1882.                         e[b] = r;
  1883.                         m()
  1884.                     }
  1885.                 },
  1886.                 r = d.slice(0, Math.abs(d.length - 1)) || [],
  1887.                 B = function() {
  1888.                     return f(r, function(a, b) {
  1889.                         return a && e.hasOwnProperty(b)
  1890.                     }, !0) && !e.hasOwnProperty(b)
  1891.                 };
  1892.             if (B()) d[d.length - 1](h, e);
  1893.             else {
  1894.                 var w = function() {
  1895.                     if (B()) {
  1896.                         a: for (var a = w, b = 0; b < g.length; b += 1)
  1897.                             if (g[b] === a) {
  1898.                                 g.splice(b, 1);
  1899.                                 break a
  1900.                             }d[d.length - 1](h, e)
  1901.                     }
  1902.                 };
  1903.                 k(w)
  1904.             }
  1905.         })
  1906.     };
  1907.     a.waterfall = function(b, c) {
  1908.         c = c || function() {};
  1909.         if (!b.length) return c();
  1910.         var d = function(b) {
  1911.             return function(e) {
  1912.                 if (e) c(e), c = function() {};
  1913.                 else {
  1914.                     var f = Array.prototype.slice.call(arguments, 1),
  1915.                         h = b.next();
  1916.                     h ? f.push(d(h)) : f.push(c);
  1917.                     a.nextTick(function() {
  1918.                         b.apply(null, f)
  1919.                     })
  1920.                 }
  1921.             }
  1922.         };
  1923.         d(a.iterator(b))()
  1924.     };
  1925.     a.parallel = function(b, c) {
  1926.         c = c || function() {};
  1927.         if (b.constructor === Array) a.map(b, function(a, b) {
  1928.             a && a(function(a) {
  1929.                 var c = Array.prototype.slice.call(arguments, 1);
  1930.                 1 >= c.length && (c = c[0]);
  1931.                 b.call(null, a, c)
  1932.             })
  1933.         }, c);
  1934.         else {
  1935.             var d = {};
  1936.             a.forEach(h(b), function(a, c) {
  1937.                 b[a](function(b) {
  1938.                     var e = Array.prototype.slice.call(arguments, 1);
  1939.                     1 >= e.length && (e = e[0]);
  1940.                     d[a] = e;
  1941.                     c(b)
  1942.                 })
  1943.             }, function(a) {
  1944.                 c(a, d)
  1945.             })
  1946.         }
  1947.     };
  1948.     a.series = function(b, c) {
  1949.         c = c || function() {};
  1950.         if (b.constructor === Array) a.mapSeries(b,
  1951.             function(a, b) {
  1952.                 a && a(function(a) {
  1953.                     var c = Array.prototype.slice.call(arguments, 1);
  1954.                     1 >= c.length && (c = c[0]);
  1955.                     b.call(null, a, c)
  1956.                 })
  1957.             }, c);
  1958.         else {
  1959.             var d = {};
  1960.             a.forEachSeries(h(b), function(a, c) {
  1961.                 b[a](function(b) {
  1962.                     var e = Array.prototype.slice.call(arguments, 1);
  1963.                     1 >= e.length && (e = e[0]);
  1964.                     d[a] = e;
  1965.                     c(b)
  1966.                 })
  1967.             }, function(a) {
  1968.                 c(a, d)
  1969.             })
  1970.         }
  1971.     };
  1972.     a.iterator = function(a) {
  1973.         var b = function(c) {
  1974.             var d = function() {
  1975.                 a.length && a[c].apply(null, arguments);
  1976.                 return d.next()
  1977.             };
  1978.             d.next = function() {
  1979.                 return c < a.length - 1 ? b(c + 1) : null
  1980.             };
  1981.             return d
  1982.         };
  1983.         return b(0)
  1984.     };
  1985.     a.apply = function(a) {
  1986.         var b =
  1987.             Array.prototype.slice.call(arguments, 1);
  1988.         return function() {
  1989.             return a.apply(null, b.concat(Array.prototype.slice.call(arguments)))
  1990.         }
  1991.     };
  1992.     k = function(a, b, c, d) {
  1993.         var e = [];
  1994.         a(b, function(a, b) {
  1995.             c(a, function(a, c) {
  1996.                 e = e.concat(c || []);
  1997.                 b(a)
  1998.             })
  1999.         }, function(a) {
  2000.             d(a, e)
  2001.         })
  2002.     };
  2003.     a.concat = g(k);
  2004.     a.concatSeries = m(k);
  2005.     a.whilst = function(b, c, d) {
  2006.         b() ? c(function(e) {
  2007.             if (e) return d(e);
  2008.             a.whilst(b, c, d)
  2009.         }) : d()
  2010.     };
  2011.     a.until = function(b, c, d) {
  2012.         b() ? d() : c(function(e) {
  2013.             if (e) return d(e);
  2014.             a.until(b, c, d)
  2015.         })
  2016.     };
  2017.     a.queue = function(c, d) {
  2018.         var e = 0,
  2019.             f = {
  2020.                 tasks: [],
  2021.                 concurrency: d,
  2022.                 saturated: null,
  2023.                 empty: null,
  2024.                 drain: null,
  2025.                 push: function(c, e) {
  2026.                     c.constructor !== Array && (c = [c]);
  2027.                     b(c, function(b) {
  2028.                         f.tasks.push({
  2029.                             data: b,
  2030.                             callback: "function" === typeof e ? e : null
  2031.                         });
  2032.                         f.saturated && f.tasks.length == d && f.saturated();
  2033.                         a.nextTick(f.process)
  2034.                     })
  2035.                 },
  2036.                 process: function() {
  2037.                     if (e < f.concurrency && f.tasks.length) {
  2038.                         var a = f.tasks.shift();
  2039.                         f.empty && 0 == f.tasks.length && f.empty();
  2040.                         e += 1;
  2041.                         c(a.data, function() {
  2042.                             --e;
  2043.                             a.callback && a.callback.apply(a, arguments);
  2044.                             f.drain && 0 == f.tasks.length + e && f.drain();
  2045.                             f.process()
  2046.                         })
  2047.                     }
  2048.                 },
  2049.                 length: function() {
  2050.                     return f.tasks.length
  2051.                 },
  2052.                 running: function() {
  2053.                     return e
  2054.                 }
  2055.             };
  2056.         return f
  2057.     };
  2058.     g = function(a) {
  2059.         return function(c) {
  2060.             var d = Array.prototype.slice.call(arguments, 1);
  2061.             c.apply(null, d.concat([function(c) {
  2062.                 var d = Array.prototype.slice.call(arguments, 1);
  2063.                 "undefined" !== typeof console && (c ? console.error && console.error(c) : console[a] && b(d, function(b) {
  2064.                     console[a](b)
  2065.                 }))
  2066.             }]))
  2067.         }
  2068.     };
  2069.     a.log = g("log");
  2070.     a.dir = g("dir");
  2071.     a.memoize = function(a, b) {
  2072.         var c = {},
  2073.             d = {};
  2074.         b = b || function(a) {
  2075.             return a
  2076.         };
  2077.         var e = function() {
  2078.             var e = Array.prototype.slice.call(arguments),
  2079.                 f = e.pop(),
  2080.                 h = b.apply(null, e);
  2081.             h in
  2082.                 c ? f.apply(null, c[h]) : h in d ? d[h].push(f) : (d[h] = [f], a.apply(null, e.concat([function() {
  2083.                     c[h] = arguments;
  2084.                     var a = d[h];
  2085.                     delete d[h];
  2086.                     for (var b = 0, r = a.length; b < r; b++) a[b].apply(null, arguments)
  2087.                 }])))
  2088.         };
  2089.         e.unmemoized = a;
  2090.         return e
  2091.     };
  2092.     a.unmemoize = function(a) {
  2093.         return function() {
  2094.             return (a.unmemoized || a).apply(null, arguments)
  2095.         }
  2096.     };
  2097.     "undefined" !== typeof define && define.amd ? define("async", [], function() {
  2098.         return a
  2099.     }) : "undefined" !== typeof module && module.exports ? module.exports = a : d.async = a
  2100. })();
  2101. (kite = function(a, d) {
  2102.     function c(a) {
  2103.         console && console.log("kite:" + a)
  2104.     }
  2105.  
  2106.     function b(a, b) {
  2107.         for (var c = a + 1; c < b;) {
  2108.             var d = p[c];
  2109.             c & 1 ? d ? c += d() : ++c : (l += d, ++c)
  2110.         }
  2111.     }
  2112.  
  2113.     function e(a, c, d) {
  2114.         var e = v,
  2115.             f = y;
  2116.         if (a instanceof Array) {
  2117.             var h = a.length;
  2118.             for (y = 0; y < h; ++y) v = a[y], b(c, d)
  2119.         } else v = a, y = void 0, b(c, d);
  2120.         v = e;
  2121.         y = f
  2122.     }
  2123.  
  2124.     function f(a, b) {
  2125.         D = a;
  2126.         l = "";
  2127.         u = b || kite.formatters || {};
  2128.         e(a instanceof Array ? {
  2129.             "": a
  2130.         } : a, -1, p.length);
  2131.         return l
  2132.     }
  2133.  
  2134.     function h(a, b, c, d) {
  2135.         return function() {
  2136.             var f = v[a],
  2137.                 h;
  2138.             h = f ? f instanceof Array && 0 == f.length ? !1 : !0 : !1;
  2139.             return h ? (e(f, b, c), (d || c) - b) : c -
  2140.                 b
  2141.         }
  2142.     }
  2143.  
  2144.     function g(a) {
  2145.         var b = u[a];
  2146.         if ("function" == typeof b) return b;
  2147.         a = a.replace("@", "_val_").replace("#", "_ctx_");
  2148.         try {
  2149.             return new Function("_val_", "_ctx_", "_root_", "_formatters_", "_log_", "{try { with(_formatters_) {with(_root_){return (" + a + ");}}} catch(e){_log_('formatter:' + e + ' in " + a + "');}}")
  2150.         } catch (d) {
  2151.             c(d + " in " + a)
  2152.         }
  2153.     }
  2154.  
  2155.     function m(a) {
  2156.         if ("" == a) return a;
  2157.         var b, d = a.indexOf("|");
  2158.         0 <= d && (b = a.substr(d + 1), a = a.substr(0, d), b = g(b));
  2159.         if ("" == a || "." == a) return b ? function() {
  2160.             l += b(v, v, D, u, c);
  2161.             return 1
  2162.         } : function() {
  2163.             void 0 !== v &&
  2164.                 (l += v);
  2165.             return 1
  2166.         };
  2167.         if (/^w+$/.test(a)) return b ? function() {
  2168.             l += b(v[a], v, D, u, c);
  2169.             return 1
  2170.         } : function() {
  2171.             var b = v[a];
  2172.             void 0 !== b && (l += b);
  2173.             return 1
  2174.         };
  2175.         var e;
  2176.         try {
  2177.             e = new Function("_in_", "_log_", "{try {return (_in_." + a + ");} catch(e){ _log_(e + ' in " + a + "'); }}")
  2178.         } catch (f) {
  2179.             c(f + " in " + a);
  2180.             return
  2181.         }
  2182.         return b ? function() {
  2183.             l += b(e(v, c), v, D, u, c);
  2184.             return 1
  2185.         } : function() {
  2186.             var a = e(v, c);
  2187.             void 0 !== a && (l += a);
  2188.             return 1
  2189.         }
  2190.     }
  2191.  
  2192.     function k(a, c) {
  2193.         return function() {
  2194.             b(a, c);
  2195.             return c - a + 1
  2196.         }
  2197.     }
  2198.  
  2199.     function n(a, d, e, w) {
  2200.         var f = new Function("_ctx_", "at", "_formatters_", "_log_",
  2201.             "try { with(_formatters_){with(_ctx_) {return (" + a + ");}}} catch(e){_log_('conditional:' + e + ' in \"" + a + "\"'); }");
  2202.         return function() {
  2203.             return f(v, y, u, c) ? (b(d, e), w - d) : e - d
  2204.         }
  2205.     }
  2206.  
  2207.     function q() {
  2208.         for (var b = 0; b < a.length;) {
  2209.             var c = a.indexOf("{{", b);
  2210.             if (0 > c) break;
  2211.             var d = a.indexOf("}}", c + 2);
  2212.             if (0 > d) break;
  2213.             p.push(a.substring(b, c));
  2214.             p.push(a.substring(c + 2, d));
  2215.             b = d + 2
  2216.         }
  2217.         p.push(a.substr(b))
  2218.     }
  2219.     var l = "",
  2220.         p = [],
  2221.         D = null,
  2222.         v = null,
  2223.         y = 0,
  2224.         u = kite.formatters || {};
  2225.     if ("#" == a.charAt(0)) {
  2226.         var E = null,
  2227.             E = document.getElementById(a.substr(1));
  2228.         if (!E) throw "Template element #" +
  2229.             E + " not found";
  2230.         a = E.innerHTML
  2231.     }(function() {
  2232.         function a(e, f) {
  2233.             for (var h = e + 2; h < d; h += 2) {
  2234.                 var g = p[h];
  2235.                 switch (g.charAt(0)) {
  2236.                     case "#":
  2237.                         h = b(h, g.substr(1));
  2238.                         continue;
  2239.                     case "?":
  2240.                         h = c(h, g.substr(1));
  2241.                         "/?" == p[h] ? p[h] = "" : h -= 2;
  2242.                         continue;
  2243.                     case "/":
  2244.                         return p[e] = k(e, h), g.substr(1) == f && (p[h] = ""), h;
  2245.                     case "^":
  2246.                         return p[e] = k(e, h), h;
  2247.                     default:
  2248.                         p[h] = m(g)
  2249.                 }
  2250.             }
  2251.             return h
  2252.         }
  2253.  
  2254.         function b(e, f) {
  2255.             for (var g = e + 2; g < d; g += 2) {
  2256.                 var k = p[g];
  2257.                 switch (k.charAt(0)) {
  2258.                     case "#":
  2259.                         g = b(g, k.substr(1));
  2260.                         continue;
  2261.                     case "?":
  2262.                         g = c(g, k.substr(1));
  2263.                         "/?" == p[g] ? p[g] = "" : g -= 2;
  2264.                         continue;
  2265.                     case "^":
  2266.                         if (k.substr(1) ==
  2267.                             f) return k = g, g = a(g, f), p[e] = h(f, e, k, g), g;
  2268.                         p[e] = h(f, e, g, g);
  2269.                         return g - 2;
  2270.                     case "/":
  2271.                         p[e] = h(f, e, g);
  2272.                         if (k.substr(1) != f) return g - 2;
  2273.                         p[g] = "";
  2274.                         return g;
  2275.                     default:
  2276.                         p[g] = m(k)
  2277.                 }
  2278.             }
  2279.             return g
  2280.         }
  2281.  
  2282.         function c(e, f) {
  2283.             for (var h = e + 2; h < d; h += 2) {
  2284.                 var g = p[h];
  2285.                 switch (g.charAt(0)) {
  2286.                     case "#":
  2287.                         h = b(h, g.substr(1));
  2288.                         continue;
  2289.                     case "?":
  2290.                         var k = h,
  2291.                             h = c(h, g.substr(1));
  2292.                         p[e] = n(f, e, k, h);
  2293.                         return h;
  2294.                     case "^":
  2295.                         if ("?" == g.substr(1)) return k = h, h = a(h, "?"), p[e] = n(f, e, k, h), h;
  2296.                         p[e] = n(f, e, h, h);
  2297.                         return h;
  2298.                     case "/":
  2299.                         p[e] = n(f, e, h, h);
  2300.                         if ("?" != g.substr(1)) return h - 2;
  2301.                         p[h] = "";
  2302.                         return h;
  2303.                     default:
  2304.                         p[h] =
  2305.                             m(g)
  2306.                 }
  2307.             }
  2308.             return h
  2309.         }
  2310.         q();
  2311.         var d = p.length;
  2312.         b(-1, "")
  2313.     })();
  2314.     return void 0 === d ? function(a, b) {
  2315.         return f(a, b)
  2316.     } : f(d, u)
  2317. }).formatters = {
  2318.     date: function(a) {
  2319.         var d = a.split("-");
  2320.         return 3 != d.length ? a : "January February March April May June July August September October November December".split(" ")[parseInt(d[1], 10) - 1] + " " + parseInt(d[2], 10) + ", " + d[0]
  2321.     },
  2322.     escaped: function(a) {
  2323.         return a.replace("&", "&amp;").replace('"', "&quot;").replace("'", "&#39;").replace("<", "&lt;").replace(">", "&gt;")
  2324.     }
  2325. };
  2326. window.Modernizr = function(a, d, c) {
  2327.     var b = {},
  2328.         e = d.documentElement,
  2329.         f = d.createElement("modernizr"),
  2330.         f = f.style,
  2331.         h = " -webkit- -moz- -o- -ms- ".split(" "),
  2332.         g = {},
  2333.         m = [],
  2334.         k = m.slice,
  2335.         n, q = function(a, b, c, f) {
  2336.             var h, r, B, w, g = d.createElement("div"),
  2337.                 G = d.body,
  2338.                 k = G || d.createElement("body");
  2339.             if (parseInt(c, 10))
  2340.                 for (; c--;) B = d.createElement("div"), B.id = f ? f[c] : "modernizr" + (c + 1), g.appendChild(B);
  2341.             return h = ['&#173;<style id="smodernizr">', a, "</style>"].join(""), g.id = "modernizr", (G ? g : k).innerHTML += h, k.appendChild(g), G || (k.style.background =
  2342.                 "", k.style.overflow = "hidden", w = e.style.overflow, e.style.overflow = "hidden", e.appendChild(k)), r = b(g, a), G ? g.parentNode.removeChild(g) : (k.parentNode.removeChild(k), e.style.overflow = w), !!r
  2343.         },
  2344.         l = {}.hasOwnProperty,
  2345.         p;
  2346.     "undefined" !== typeof l && "undefined" !== typeof l.call ? p = function(a, b) {
  2347.         return l.call(a, b)
  2348.     } : p = function(a, b) {
  2349.         return b in a && "undefined" === typeof a.constructor.prototype[b]
  2350.     };
  2351.     Function.prototype.bind || (Function.prototype.bind = function(a) {
  2352.         var b = this;
  2353.         if ("function" != typeof b) throw new TypeError;
  2354.         var c = k.call(arguments,
  2355.                 1),
  2356.             d = function() {
  2357.                 if (this instanceof d) {
  2358.                     var e = function() {};
  2359.                     e.prototype = b.prototype;
  2360.                     var e = new e,
  2361.                         r = b.apply(e, c.concat(k.call(arguments)));
  2362.                     return Object(r) === r ? r : e
  2363.                 }
  2364.                 return b.apply(a, c.concat(k.call(arguments)))
  2365.             };
  2366.         return d
  2367.     });
  2368.     g.touch = function() {
  2369.         var b;
  2370.         return "ontouchstart" in a || a.DocumentTouch && d instanceof DocumentTouch ? b = !0 : q(["@media (", h.join("touch-enabled),("), "modernizr){#modernizr{top:9px;position:absolute}}"].join(""), function(a) {
  2371.             b = 9 === a.offsetTop
  2372.         }), b
  2373.     };
  2374.     g.audio = function() {
  2375.         var a = d.createElement("audio"),
  2376.             b = !1;
  2377.         try {
  2378.             if (b = !!a.canPlayType) b = new Boolean(b), b.ogg = a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), b.mp3 = a.canPlayType("audio/mpeg;").replace(/^no$/, ""), b.wav = a.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""), b.m4a = (a.canPlayType("audio/x-m4a;") || a.canPlayType("audio/aac;")).replace(/^no$/, "")
  2379.         } catch (c) {}
  2380.         return b
  2381.     };
  2382.     g.localstorage = function() {
  2383.         try {
  2384.             return localStorage.setItem("modernizr", "modernizr"), localStorage.removeItem("modernizr"), !0
  2385.         } catch (a) {
  2386.             return !1
  2387.         }
  2388.     };
  2389.     for (var D in g) p(g,
  2390.         D) && (n = D.toLowerCase(), b[n] = g[D](), m.push((b[n] ? "" : "no-") + n));
  2391.     b.addTest = function(a, d) {
  2392.         if ("object" == typeof a)
  2393.             for (var f in a) p(a, f) && b.addTest(f, a[f]);
  2394.         else {
  2395.             a = a.toLowerCase();
  2396.             if (b[a] !== c) return b;
  2397.             d = "function" == typeof d ? d() : d;
  2398.             "undefined" != typeof enableClasses && enableClasses && (e.className += " " + (d ? "" : "no-") + a);
  2399.             b[a] = d
  2400.         }
  2401.         return b
  2402.     };
  2403.     f.cssText = "";
  2404.     return f = null, b._version = "2.6.3", b._prefixes = h, b.testStyles = q, b
  2405. }(this, this.document);
  2406. (function(a, d) {
  2407.     var c = a.document,
  2408.         b = c.documentElement,
  2409.         e = "ontouchmove" in c,
  2410.         f = "WebkitOverflowScrolling" in b.style || !e && 1200 < a.screen.width || function() {
  2411.             var b = a.navigator.userAgent,
  2412.                 c = b.match(/AppleWebKit\/([0-9]+)/),
  2413.                 d = c && c[1],
  2414.                 e = c && 534 <= d;
  2415.             return b.match(/Android ([0-9]+)/) && 3 <= RegExp.$1 && e || b.match(/ Version\/([0-9]+)/) && 0 <= RegExp.$1 && a.blackberry && e || -1 < b.indexOf(/PlayBook/) && 0 <= RegExp.$1 && e || b.match(/Fennec\/([0-9]+)/) && 4 <= RegExp.$1 || b.match(/wOSBrowser\/([0-9]+)/) && 233 <= RegExp.$1 && e || b.match(/NokiaBrowser\/([0-9\.]+)/) &&
  2416.                 7.3 === parseFloat(RegExp.$1) && c && 533 <= d
  2417.         }(),
  2418.         h = function(a, b, c, d) {
  2419.             return c * ((a = a / d - 1) * a * a + 1) + b
  2420.         },
  2421.         g = !1,
  2422.         m, k = function(b, c) {
  2423.             var e = 0,
  2424.                 f = b.scrollLeft,
  2425.                 h = b.scrollTop,
  2426.                 g = {
  2427.                     top: "+0",
  2428.                     left: "+0",
  2429.                     duration: 100,
  2430.                     easing: a.overthrow.easing
  2431.                 },
  2432.                 k, r;
  2433.             if (c)
  2434.                 for (var B in g) c[B] !== d && (g[B] = c[B]);
  2435.             "string" === typeof g.left ? (g.left = parseFloat(g.left), k = g.left + f) : (k = g.left, g.left -= f);
  2436.             "string" === typeof g.top ? (g.top = parseFloat(g.top), r = g.top + h) : (r = g.top, g.top -= h);
  2437.             m = setInterval(function() {
  2438.                 e++ < g.duration ? (b.scrollLeft = g.easing(e, f, g.left, g.duration),
  2439.                     b.scrollTop = g.easing(e, h, g.top, g.duration)) : (k !== b.scrollLeft && (b.scrollLeft = k), r !== b.scrollTop && (b.scrollTop = r), q())
  2440.             }, 1);
  2441.             return {
  2442.                 top: r,
  2443.                 left: k,
  2444.                 duration: g.duration,
  2445.                 easing: g.easing
  2446.             }
  2447.         },
  2448.         n = function(a, b) {
  2449.             return !b && a.className && -1 < a.className.indexOf("overthrow") && a || n(a.parentNode)
  2450.         },
  2451.         q = function() {
  2452.             clearInterval(m)
  2453.         },
  2454.         l = function() {
  2455.             if (!g) {
  2456.                 g = !0;
  2457.                 if (f || e) b.className += " overthrow-enabled";
  2458.                 a.overthrow.forget = function() {
  2459.                     b.className = b.className.replace("overthrow-enabled", "");
  2460.                     c.removeEventListener && c.removeEventListener("touchstart",
  2461.                         B, !1);
  2462.                     a.overthrow.easing = h;
  2463.                     g = !1
  2464.                 };
  2465.                 if (!f && e) {
  2466.                     var d, m = [],
  2467.                         l = [],
  2468.                         y, u, E = function() {
  2469.                             var a = 8 * (m[0] - m[m.length - 1]),
  2470.                                 b = 8 * (l[0] - l[l.length - 1]),
  2471.                                 c = Math.max(Math.abs(b), Math.abs(a)) / 8,
  2472.                                 a = (0 < a ? "+" : "") + a,
  2473.                                 b = (0 < b ? "+" : "") + b;
  2474.                             !isNaN(c) && 0 < c && (80 < Math.abs(b) || 80 < Math.abs(a)) && k(d, {
  2475.                                 left: b,
  2476.                                 top: a,
  2477.                                 duration: c
  2478.                             })
  2479.                         },
  2480.                         A, r = function(a) {
  2481.                             A = d.querySelectorAll("textarea, input");
  2482.                             for (var b = 0, c = A.length; b < c; b++) A[b].style.pointerEvents = a
  2483.                         },
  2484.                         B = function(a) {
  2485.                             q();
  2486.                             m = [];
  2487.                             y = null;
  2488.                             l = [];
  2489.                             u = null;
  2490.                             if ((d = n(a.target)) && d !== b && !(1 < a.touches.length)) {
  2491.                                 r("none");
  2492.                                 var e = d.scrollTop,
  2493.                                     B = d.scrollLeft,
  2494.                                     f = d.offsetHeight,
  2495.                                     h = d.offsetWidth,
  2496.                                     g = a.touches[0].pageY,
  2497.                                     k = a.touches[0].pageX,
  2498.                                     I = d.scrollHeight,
  2499.                                     A = d.scrollWidth,
  2500.                                     z = function(b) {
  2501.                                         var r = e + g - b.touches[0].pageY,
  2502.                                             n = B + k - b.touches[0].pageX,
  2503.                                             q = r >= (m.length ? m[0] : 0),
  2504.                                             F = n >= (l.length ? l[0] : 0);
  2505.                                         if (0 < r && r < I - f || 0 < n && n < A - h) b.preventDefault();
  2506.                                         else if (c.createEvent) {
  2507.                                             b = d.parentNode || d.touchchild || d;
  2508.                                             var z;
  2509.                                             b !== d && (z = c.createEvent("HTMLEvents"), z.initEvent("touchend", !0, !0), d.dispatchEvent(z), b.touchchild = d, d = b, b.dispatchEvent(a))
  2510.                                         }
  2511.                                         y && q !== y && (m = [],
  2512.                                             y = null);
  2513.                                         u && F !== u && (l = [], u = null);
  2514.                                         y = q;
  2515.                                         u = F;
  2516.                                         d.scrollTop = r;
  2517.                                         d.scrollLeft = n;
  2518.                                         m.unshift(r);
  2519.                                         l.unshift(n);
  2520.                                         3 < m.length && m.pop();
  2521.                                         3 < l.length && l.pop()
  2522.                                     },
  2523.                                     F = function(a) {
  2524.                                         E();
  2525.                                         r("auto");
  2526.                                         setTimeout(function() {
  2527.                                             r("none")
  2528.                                         }, 450);
  2529.                                         d.removeEventListener("touchmove", z, !1);
  2530.                                         d.removeEventListener("touchend", F, !1)
  2531.                                     };
  2532.                                 d.addEventListener("touchmove", z, !1);
  2533.                                 d.addEventListener("touchend", F, !1)
  2534.                             }
  2535.                         };
  2536.                     c.addEventListener("touchstart", B, !1)
  2537.                 }
  2538.             }
  2539.         };
  2540.     a.overthrow = {
  2541.         set: l,
  2542.         forget: function() {},
  2543.         easing: h,
  2544.         toss: k,
  2545.         intercept: q,
  2546.         closest: n,
  2547.         support: f ? "native" : e && "polyfilled" ||
  2548.             "none"
  2549.     };
  2550.     l()
  2551. })(this);
  2552. (function(a, d) {
  2553.     "function" === typeof define && define.amd ? define("sifter", d) : "object" === typeof exports ? module.exports = d() : a.Sifter = d()
  2554. })(this, function() {
  2555.     var a = function(a, b) {
  2556.         this.items = a;
  2557.         this.settings = b || {
  2558.             diacritics: !0
  2559.         }
  2560.     };
  2561.     a.prototype.tokenize = function(a) {
  2562.         a = (String(a || "").toLowerCase() + "").replace(/^\s+|\s+$|/g, "");
  2563.         if (!a || !a.length) return [];
  2564.         var b, c, d, f = [],
  2565.             q = a.split(/ +/);
  2566.         a = 0;
  2567.         for (b = q.length; a < b; a++) {
  2568.             c = (q[a] + "").replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
  2569.             if (this.settings.diacritics)
  2570.                 for (d in e) e.hasOwnProperty(d) && (c =
  2571.                     c.replace(new RegExp(d, "g"), e[d]));
  2572.             f.push({
  2573.                 string: q[a],
  2574.                 regex: new RegExp(c, "i")
  2575.             })
  2576.         }
  2577.         return f
  2578.     };
  2579.     a.prototype.iterator = function(a, c) {
  2580.         (b(a) ? Array.prototype.forEach || function(a) {
  2581.             for (var b = 0, c = this.length; b < c; b++) a(this[b], b, this)
  2582.         } : function(a) {
  2583.             for (var b in this) this.hasOwnProperty(b) && a(this[b], b, this)
  2584.         }).apply(a, [c])
  2585.     };
  2586.     a.prototype.getScoreFunction = function(a, b) {
  2587.         var c, d, e;
  2588.         a = this.prepareSearch(a, b);
  2589.         d = a.tokens;
  2590.         c = a.options.fields;
  2591.         e = d.length;
  2592.         var f = function(a, b) {
  2593.                 var c, d;
  2594.                 if (!a) return 0;
  2595.                 a = String(a || "");
  2596.                 d = a.search(b.regex);
  2597.                 if (-1 === d) return 0;
  2598.                 c = b.string.length / a.length;
  2599.                 0 === d && (c += .5);
  2600.                 return c
  2601.             },
  2602.             l = function() {
  2603.                 var a = c.length;
  2604.                 return a ? 1 === a ? function(a, b) {
  2605.                     return f(b[c[0]], a)
  2606.                 } : function(b, d) {
  2607.                     for (var e = 0, g = 0; e < a; e++) g += f(d[c[e]], b);
  2608.                     return g / a
  2609.                 } : function() {
  2610.                     return 0
  2611.                 }
  2612.             }();
  2613.         return e ? 1 === e ? function(a) {
  2614.             return l(d[0], a)
  2615.         } : "and" === a.options.conjunction ? function(a) {
  2616.             for (var b, c = 0, f = 0; c < e; c++) {
  2617.                 b = l(d[c], a);
  2618.                 if (0 >= b) return 0;
  2619.                 f += b
  2620.             }
  2621.             return f / e
  2622.         } : function(a) {
  2623.             for (var b = 0, c = 0; b < e; b++) c += l(d[b], a);
  2624.             return c / e
  2625.         } : function() {
  2626.             return 0
  2627.         }
  2628.     };
  2629.     a.prototype.getSortFunction =
  2630.         function(a, b) {
  2631.             var c, e, f, q, l, p, D, v, y, u;
  2632.             f = this;
  2633.             a = f.prepareSearch(a, b);
  2634.             u = !a.query && b.sort_empty || b.sort;
  2635.             y = function(a, b) {
  2636.                 return "$score" === a ? b.score : f.items[b.id][a]
  2637.             };
  2638.             l = [];
  2639.             if (u)
  2640.                 for (c = 0, e = u.length; c < e; c++)(a.query || "$score" !== u[c].field) && l.push(u[c]);
  2641.             if (a.query) {
  2642.                 u = !0;
  2643.                 c = 0;
  2644.                 for (e = l.length; c < e; c++)
  2645.                     if ("$score" === l[c].field) {
  2646.                         u = !1;
  2647.                         break
  2648.                     }
  2649.                 u && l.unshift({
  2650.                     field: "$score",
  2651.                     direction: "desc"
  2652.                 })
  2653.             } else
  2654.                 for (c = 0, e = l.length; c < e; c++)
  2655.                     if ("$score" === l[c].field) {
  2656.                         l.splice(c, 1);
  2657.                         break
  2658.                     }
  2659.             v = [];
  2660.             c = 0;
  2661.             for (e = l.length; c < e; c++) v.push("desc" ===
  2662.                 l[c].direction ? -1 : 1);
  2663.             return (p = l.length) ? 1 === p ? (q = l[0].field, D = v[0], function(a, b) {
  2664.                 return D * d(y(q, a), y(q, b))
  2665.             }) : function(a, b) {
  2666.                 var c, e;
  2667.                 for (c = 0; c < p; c++)
  2668.                     if (e = l[c].field, e = v[c] * d(y(e, a), y(e, b))) return e;
  2669.                 return 0
  2670.             } : null
  2671.         };
  2672.     a.prototype.prepareSearch = function(a, d) {
  2673.         if ("object" === typeof a) return a;
  2674.         d = c({}, d);
  2675.         var e = d.fields,
  2676.             f = d.sort,
  2677.             n = d.sort_empty;
  2678.         e && !b(e) && (d.fields = [e]);
  2679.         f && !b(f) && (d.sort = [f]);
  2680.         n && !b(n) && (d.sort_empty = [n]);
  2681.         return {
  2682.             options: d,
  2683.             query: String(a || "").toLowerCase(),
  2684.             tokens: this.tokenize(a),
  2685.             total: 0,
  2686.             items: []
  2687.         }
  2688.     };
  2689.     a.prototype.search = function(a, b) {
  2690.         var c, d, e, f;
  2691.         d = this.prepareSearch(a, b);
  2692.         b = d.options;
  2693.         a = d.query;
  2694.         f = b.score || this.getScoreFunction(d);
  2695.         a.length ? this.iterator(this.items, function(a, e) {
  2696.             c = f(a);
  2697.             (!1 === b.filter || 0 < c) && d.items.push({
  2698.                 score: c,
  2699.                 id: e
  2700.             })
  2701.         }) : this.iterator(this.items, function(a, b) {
  2702.             d.items.push({
  2703.                 score: 1,
  2704.                 id: b
  2705.             })
  2706.         });
  2707.         (e = this.getSortFunction(d, b)) && d.items.sort(e);
  2708.         d.total = d.items.length;
  2709.         "number" === typeof b.limit && (d.items = d.items.slice(0, b.limit));
  2710.         return d
  2711.     };
  2712.     var d = function(a, b) {
  2713.             if ("number" === typeof a && "number" ===
  2714.                 typeof b) return a > b ? 1 : a < b ? -1 : 0;
  2715.             a = f(String(a || ""));
  2716.             b = f(String(b || ""));
  2717.             return a > b ? 1 : b > a ? -1 : 0
  2718.         },
  2719.         c = function(a, b) {
  2720.             var c, d, e, f;
  2721.             c = 1;
  2722.             for (d = arguments.length; c < d; c++)
  2723.                 if (f = arguments[c])
  2724.                     for (e in f) f.hasOwnProperty(e) && (a[e] = f[e]);
  2725.             return a
  2726.         },
  2727.         b = Array.isArray || $ && $.isArray || function(a) {
  2728.             return "[object Array]" === Object.prototype.toString.call(a)
  2729.         },
  2730.         e = {
  2731.             a: "[a\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u0100\u0101\u0105\u0104]",
  2732.             c: "[c\u00c7\u00e7\u0107\u0106\u010d\u010c]",
  2733.             d: "[d\u0111\u0110\u010f\u010e]",
  2734.             e: "[e\u00c8\u00c9\u00ca\u00cb\u00e8\u00e9\u00ea\u00eb\u011b\u011a\u0112\u0113\u0119\u0118]",
  2735.             i: "[i\u00cc\u00cd\u00ce\u00cf\u00ec\u00ed\u00ee\u00ef\u012a\u012b]",
  2736.             l: "[l\u0142\u0141]",
  2737.             n: "[n\u00d1\u00f1\u0148\u0147\u0144\u0143]",
  2738.             o: "[o\u00d2\u00d3\u00d4\u00d5\u00d5\u00d6\u00d8\u00f2\u00f3\u00f4\u00f5\u00f6\u00f8\u014c\u014d]",
  2739.             r: "[r\u0159\u0158]",
  2740.             s: "[s\u0160\u0161\u015b\u015a]",
  2741.             t: "[t\u0165\u0164]",
  2742.             u: "[u\u00d9\u00da\u00db\u00dc\u00f9\u00fa\u00fb\u00fc\u016f\u016e\u016a\u016b]",
  2743.             y: "[y\u0178\u00ff\u00fd\u00dd]",
  2744.             z: "[z\u017d\u017e\u017c\u017b\u017a\u0179]"
  2745.         },
  2746.         f = function() {
  2747.             var a, b, c, d, f = "",
  2748.                 q = {};
  2749.             for (c in e)
  2750.                 if (e.hasOwnProperty(c))
  2751.                     for (d = e[c].substring(2, e[c].length - 1), f += d, a = 0, b = d.length; a < b; a++) q[d.charAt(a)] = c;
  2752.             var l = new RegExp("[" + f + "]", "g");
  2753.             return function(a) {
  2754.                 return a.replace(l, function(a) {
  2755.                     return q[a]
  2756.                 }).toLowerCase()
  2757.             }
  2758.         }();
  2759.     return a
  2760. });
  2761. (function(a, d) {
  2762.     "function" === typeof define && define.amd ? define("microplugin", d) : "object" === typeof exports ? module.exports = d() : a.MicroPlugin = d()
  2763. })(this, function() {
  2764.     var a = {
  2765.         isArray: Array.isArray || function(a) {
  2766.             return "[object Array]" === Object.prototype.toString.call(a)
  2767.         }
  2768.     };
  2769.     return {
  2770.         mixin: function(d) {
  2771.             d.plugins = {};
  2772.             d.prototype.initializePlugins = function(c) {
  2773.                 var b, d, f = [];
  2774.                 this.plugins = {
  2775.                     names: [],
  2776.                     settings: {},
  2777.                     requested: {},
  2778.                     loaded: {}
  2779.                 };
  2780.                 if (a.isArray(c))
  2781.                     for (b = 0, d = c.length; b < d; b++) "string" === typeof c[b] ? f.push(c[b]) : (this.plugins.settings[c[b].name] =
  2782.                         c[b].options, f.push(c[b].name));
  2783.                 else if (c)
  2784.                     for (b in c) c.hasOwnProperty(b) && (this.plugins.settings[b] = c[b], f.push(b));
  2785.                 for (; f.length;) this.require(f.shift())
  2786.             };
  2787.             d.prototype.loadPlugin = function(a) {
  2788.                 var b = this.plugins,
  2789.                     e = d.plugins[a];
  2790.                 if (!d.plugins.hasOwnProperty(a)) throw Error('Unable to find "' + a + '" plugin');
  2791.                 b.requested[a] = !0;
  2792.                 b.loaded[a] = e.fn.apply(this, [this.plugins.settings[a] || {}]);
  2793.                 b.names.push(a)
  2794.             };
  2795.             d.prototype.require = function(a) {
  2796.                 var b = this.plugins;
  2797.                 if (!this.plugins.loaded.hasOwnProperty(a)) {
  2798.                     if (b.requested[a]) throw Error('Plugin has circular dependency ("' +
  2799.                         a + '")');
  2800.                     this.loadPlugin(a)
  2801.                 }
  2802.                 return b.loaded[a]
  2803.             };
  2804.             d.define = function(a, b) {
  2805.                 d.plugins[a] = {
  2806.                     name: a,
  2807.                     fn: b
  2808.                 }
  2809.             }
  2810.         }
  2811.     }
  2812. });
  2813. (function(a, d) {
  2814.     "function" === typeof define && define.amd ? define("selectize", ["jquery", "sifter", "microplugin"], d) : "object" === typeof exports ? module.exports = d(require("jquery"), require("sifter"), require("microplugin")) : a.Selectize = d(a.jQuery, a.Sifter, a.MicroPlugin)
  2815. })(this, function(a, d, c) {
  2816.     var b = function(a, b) {
  2817.             if ("string" !== typeof b || b.length) {
  2818.                 var c = "string" === typeof b ? new RegExp(b, "i") : b,
  2819.                     d = function(a) {
  2820.                         var b = 0;
  2821.                         if (3 === a.nodeType) {
  2822.                             var r = a.data.search(c);
  2823.                             if (0 <= r && 0 < a.data.length) {
  2824.                                 var e = a.data.match(c),
  2825.                                     b = document.createElement("span");
  2826.                                 b.className = "highlight";
  2827.                                 a = a.splitText(r);
  2828.                                 a.splitText(e[0].length);
  2829.                                 r = a.cloneNode(!0);
  2830.                                 b.appendChild(r);
  2831.                                 a.parentNode.replaceChild(b, a);
  2832.                                 b = 1
  2833.                             }
  2834.                         } else if (1 === a.nodeType && a.childNodes && !/(script|style)/i.test(a.tagName))
  2835.                             for (r = 0; r < a.childNodes.length; ++r) r += d(a.childNodes[r]);
  2836.                         return b
  2837.                     };
  2838.                 return a.each(function() {
  2839.                     d(this)
  2840.                 })
  2841.             }
  2842.         },
  2843.         e = function() {};
  2844.     e.prototype = {
  2845.         on: function(a, b) {
  2846.             this._events = this._events || {};
  2847.             this._events[a] = this._events[a] || [];
  2848.             this._events[a].push(b)
  2849.         },
  2850.         off: function(a, b) {
  2851.             var c = arguments.length;
  2852.             if (0 === c) return delete this._events;
  2853.             if (1 === c) return delete this._events[a];
  2854.             this._events = this._events || {};
  2855.             !1 !== a in this._events && this._events[a].splice(this._events[a].indexOf(b), 1)
  2856.         },
  2857.         trigger: function(a) {
  2858.             this._events = this._events || {};
  2859.             if (!1 !== a in this._events)
  2860.                 for (var b = 0; b < this._events[a].length; b++) this._events[a][b].apply(this, Array.prototype.slice.call(arguments, 1))
  2861.         }
  2862.     };
  2863.     e.mixin = function(a) {
  2864.         for (var b = ["on", "off", "trigger"], c = 0; c < b.length; c++) a.prototype[b[c]] = e.prototype[b[c]]
  2865.     };
  2866.     var f = /Mac/.test(navigator.userAgent),
  2867.         h = f ? 91 : 17,
  2868.         g = f ? 18 :
  2869.         17,
  2870.         m = !/android/i.test(window.navigator.userAgent) && !!document.createElement("form").validity,
  2871.         k = function(a) {
  2872.             return "undefined" === typeof a || null === a ? null : "boolean" === typeof a ? a ? "1" : "0" : a + ""
  2873.         },
  2874.         n = function(a) {
  2875.             return (a + "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;")
  2876.         },
  2877.         q = function(a) {
  2878.             return (a + "").replace(/\$/g, "$$$$")
  2879.         },
  2880.         l = {
  2881.             before: function(a, b, c) {
  2882.                 var d = a[b];
  2883.                 a[b] = function() {
  2884.                     c.apply(a, arguments);
  2885.                     return d.apply(a, arguments)
  2886.                 }
  2887.             },
  2888.             after: function(a, b, c) {
  2889.                 var d = a[b];
  2890.                 a[b] = function() {
  2891.                     var b =
  2892.                         d.apply(a, arguments);
  2893.                     c.apply(a, arguments);
  2894.                     return b
  2895.                 }
  2896.             }
  2897.         },
  2898.         p = function(a) {
  2899.             var b = !1;
  2900.             return function() {
  2901.                 b || (b = !0, a.apply(this, arguments))
  2902.             }
  2903.         },
  2904.         D = function(a, b) {
  2905.             var c;
  2906.             return function() {
  2907.                 var d = this,
  2908.                     e = arguments;
  2909.                 window.clearTimeout(c);
  2910.                 c = window.setTimeout(function() {
  2911.                     a.apply(d, e)
  2912.                 }, b)
  2913.             }
  2914.         },
  2915.         v = function(a, b, c) {
  2916.             var d, e = a.trigger,
  2917.                 f = {};
  2918.             a.trigger = function() {
  2919.                 var c = arguments[0];
  2920.                 if (-1 !== b.indexOf(c)) f[c] = arguments;
  2921.                 else return e.apply(a, arguments)
  2922.             };
  2923.             c.apply(a, []);
  2924.             a.trigger = e;
  2925.             for (d in f) f.hasOwnProperty(d) && e.apply(a, f[d])
  2926.         },
  2927.         y = function(a,
  2928.             b, c, d) {
  2929.             a.on(b, c, function(b) {
  2930.                 for (var c = b.target; c && c.parentNode !== a[0];) c = c.parentNode;
  2931.                 b.currentTarget = c;
  2932.                 return d.apply(this, [b])
  2933.             })
  2934.         },
  2935.         u = function(a) {
  2936.             var b = {};
  2937.             if ("selectionStart" in a) b.start = a.selectionStart, b.length = a.selectionEnd - b.start;
  2938.             else if (document.selection) {
  2939.                 a.focus();
  2940.                 var c = document.selection.createRange(),
  2941.                     d = document.selection.createRange().text.length;
  2942.                 c.moveStart("character", -a.value.length);
  2943.                 b.start = c.text.length - d;
  2944.                 b.length = d
  2945.             }
  2946.             return b
  2947.         },
  2948.         E = function(b) {
  2949.             var c = null,
  2950.                 d = function(d, e) {
  2951.                     var f, g, w;
  2952.                     d = d ||
  2953.                         window.event || {};
  2954.                     e = e || {};
  2955.                     if (!d.metaKey && !d.altKey && (e.force || !1 !== b.data("grow"))) {
  2956.                         f = b.val();
  2957.                         d.type && "keydown" === d.type.toLowerCase() && (g = d.keyCode, w = 97 <= g && 122 >= g || 65 <= g && 90 >= g || 48 <= g && 57 >= g || 32 === g, 46 === g || 8 === g ? (w = u(b[0]), w.length ? f = f.substring(0, w.start) + f.substring(w.start + w.length) : 8 === g && w.start ? f = f.substring(0, w.start - 1) + f.substring(w.start + 1) : 46 === g && "undefined" !== typeof w.start && (f = f.substring(0, w.start) + f.substring(w.start + 1))) : w && (g = d.shiftKey, w = String.fromCharCode(d.keyCode), w = g ? w.toUpperCase() :
  2958.                             w.toLowerCase(), f += w));
  2959.                         g = b.attr("placeholder");
  2960.                         !f && g && (f = g);
  2961.                         if (f) {
  2962.                             f = a("<test>").css({
  2963.                                 position: "absolute",
  2964.                                 top: -99999,
  2965.                                 left: -99999,
  2966.                                 width: "auto",
  2967.                                 padding: 0,
  2968.                                 whiteSpace: "pre"
  2969.                             }).text(f).appendTo("body");
  2970.                             g = ["letterSpacing", "fontSize", "fontFamily", "fontWeight", "textTransform"];
  2971.                             var h, k = {};
  2972.                             if (g)
  2973.                                 for (w = 0, h = g.length; w < h; w++) k[g[w]] = b.css(g[w]);
  2974.                             else k = b.css();
  2975.                             f.css(k);
  2976.                             g = f.width();
  2977.                             f.remove();
  2978.                             f = g
  2979.                         } else f = 0;
  2980.                         f += 4;
  2981.                         f !== c && (c = f, b.width(f), b.triggerHandler("resize"))
  2982.                     }
  2983.                 };
  2984.             b.on("keydown keyup update blur", d);
  2985.             d()
  2986.         },
  2987.         A = function(b,
  2988.             c) {
  2989.             var e, f;
  2990.             e = b[0];
  2991.             e.selectize = this;
  2992.             f = (f = (f = window.getComputedStyle && window.getComputedStyle(e, null)) ? f.getPropertyValue("direction") : e.currentStyle && e.currentStyle.direction) || b.parents("[dir]:first").attr("dir") || "";
  2993.             a.extend(this, {
  2994.                 order: 0,
  2995.                 settings: c,
  2996.                 $input: b,
  2997.                 tabIndex: b.attr("tabindex") || "",
  2998.                 tagType: "select" === e.tagName.toLowerCase() ? 1 : 2,
  2999.                 rtl: /rtl/i.test(f),
  3000.                 eventNS: ".selectize" + ++A.count,
  3001.                 highlightedValue: null,
  3002.                 isOpen: !1,
  3003.                 isDisabled: !1,
  3004.                 isRequired: b.is("[required]"),
  3005.                 isInvalid: !1,
  3006.                 isLocked: !1,
  3007.                 isFocused: !1,
  3008.                 isInputHidden: !1,
  3009.                 isSetup: !1,
  3010.                 isShiftDown: !1,
  3011.                 isCmdDown: !1,
  3012.                 isCtrlDown: !1,
  3013.                 ignoreFocus: !1,
  3014.                 ignoreBlur: !1,
  3015.                 ignoreHover: !1,
  3016.                 hasOptions: !1,
  3017.                 currentResults: null,
  3018.                 lastValue: "",
  3019.                 caretPos: 0,
  3020.                 loading: 0,
  3021.                 loadedSearches: {},
  3022.                 $activeOption: null,
  3023.                 $activeItems: [],
  3024.                 optgroups: {},
  3025.                 options: {},
  3026.                 userOptions: {},
  3027.                 items: [],
  3028.                 renderCache: {},
  3029.                 onSearchChange: null === c.loadThrottle ? this.onSearchChange : D(this.onSearchChange, c.loadThrottle)
  3030.             });
  3031.             this.sifter = new d(this.options, {
  3032.                 diacritics: c.diacritics
  3033.             });
  3034.             if (this.settings.options) {
  3035.                 e = 0;
  3036.                 for (f = this.settings.options.length; e <
  3037.                     f; e++) this.registerOption(this.settings.options[e]);
  3038.                 delete this.settings.options
  3039.             }
  3040.             if (this.settings.optgroups) {
  3041.                 e = 0;
  3042.                 for (f = this.settings.optgroups.length; e < f; e++) this.registerOptionGroup(this.settings.optgroups[e]);
  3043.                 delete this.settings.optgroups
  3044.             }
  3045.             this.settings.mode = this.settings.mode || (1 === this.settings.maxItems ? "single" : "multi");
  3046.             "boolean" !== typeof this.settings.hideSelected && (this.settings.hideSelected = "multi" === this.settings.mode);
  3047.             this.initializePlugins(this.settings.plugins);
  3048.             this.setupCallbacks();
  3049.             this.setupTemplates();
  3050.             this.setup()
  3051.         };
  3052.     e.mixin(A);
  3053.     c.mixin(A);
  3054.     a.extend(A.prototype, {
  3055.         setup: function() {
  3056.             var b = this,
  3057.                 c = b.settings,
  3058.                 d = b.eventNS,
  3059.                 e = a(window),
  3060.                 k = a(document),
  3061.                 C = b.$input,
  3062.                 l, H, n, p, q, z;
  3063.             q = b.settings.mode;
  3064.             z = C.attr("class") || "";
  3065.             l = a("<div>").addClass(c.wrapperClass).addClass(z).addClass(q);
  3066.             H = a("<div>").addClass(c.inputClass).addClass("items").appendTo(l);
  3067.             n = a('<input type="text" autocomplete="off" />').appendTo(H).attr("tabindex", C.is(":disabled") ? "-1" : b.tabIndex);
  3068.             p = a(c.dropdownParent || l);
  3069.             p = a("<div>").addClass(c.dropdownClass).addClass(q).hide().appendTo(p);
  3070.             q = a("<div>").addClass(c.dropdownContentClass).appendTo(p);
  3071.             b.settings.copyClassesToDropdown && p.addClass(z);
  3072.             l.css({
  3073.                 width: C[0].style.width
  3074.             });
  3075.             b.plugins.names.length && (z = "plugin-" + b.plugins.names.join(" plugin-"), l.addClass(z), p.addClass(z));
  3076.             (null === c.maxItems || 1 < c.maxItems) && 1 === b.tagType && C.attr("multiple", "multiple");
  3077.             b.settings.placeholder && n.attr("placeholder", c.placeholder);
  3078.             !b.settings.splitOn && b.settings.delimiter && (z = b.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), b.settings.splitOn =
  3079.                 new RegExp("\\s*" + z + "+\\s*"));
  3080.             C.attr("autocorrect") && n.attr("autocorrect", C.attr("autocorrect"));
  3081.             C.attr("autocapitalize") && n.attr("autocapitalize", C.attr("autocapitalize"));
  3082.             b.$wrapper = l;
  3083.             b.$control = H;
  3084.             b.$control_input = n;
  3085.             b.$dropdown = p;
  3086.             b.$dropdown_content = q;
  3087.             p.on("mouseenter", "[data-selectable]", function() {
  3088.                 return b.onOptionHover.apply(b, arguments)
  3089.             });
  3090.             p.on("mousedown click", "[data-selectable]", function() {
  3091.                 return b.onOptionSelect.apply(b, arguments)
  3092.             });
  3093.             y(H, "mousedown", "*:not(input)", function() {
  3094.                 return b.onItemSelect.apply(b,
  3095.                     arguments)
  3096.             });
  3097.             E(n);
  3098.             H.on({
  3099.                 mousedown: function() {
  3100.                     return b.onMouseDown.apply(b, arguments)
  3101.                 },
  3102.                 click: function() {
  3103.                     return b.onClick.apply(b, arguments)
  3104.                 }
  3105.             });
  3106.             n.on({
  3107.                 mousedown: function(a) {
  3108.                     a.stopPropagation()
  3109.                 },
  3110.                 keydown: function() {
  3111.                     return b.onKeyDown.apply(b, arguments)
  3112.                 },
  3113.                 keyup: function() {
  3114.                     return b.onKeyUp.apply(b, arguments)
  3115.                 },
  3116.                 keypress: function() {
  3117.                     return b.onKeyPress.apply(b, arguments)
  3118.                 },
  3119.                 resize: function() {
  3120.                     b.positionDropdown.apply(b, [])
  3121.                 },
  3122.                 blur: function() {
  3123.                     return b.onBlur.apply(b, arguments)
  3124.                 },
  3125.                 focus: function() {
  3126.                     b.ignoreBlur = !1;
  3127.                     return b.onFocus.apply(b,
  3128.                         arguments)
  3129.                 },
  3130.                 paste: function() {
  3131.                     return b.onPaste.apply(b, arguments)
  3132.                 }
  3133.             });
  3134.             k.on("keydown" + d, function(a) {
  3135.                 b.isCmdDown = a[f ? "metaKey" : "ctrlKey"];
  3136.                 b.isCtrlDown = a[f ? "altKey" : "ctrlKey"];
  3137.                 b.isShiftDown = a.shiftKey
  3138.             });
  3139.             k.on("keyup" + d, function(a) {
  3140.                 a.keyCode === g && (b.isCtrlDown = !1);
  3141.                 16 === a.keyCode && (b.isShiftDown = !1);
  3142.                 a.keyCode === h && (b.isCmdDown = !1)
  3143.             });
  3144.             k.on("mousedown" + d, function(a) {
  3145.                 if (b.isFocused) {
  3146.                     if (a.target === b.$dropdown[0] || a.target.parentNode === b.$dropdown[0]) return !1;
  3147.                     b.$control.has(a.target).length || a.target === b.$control[0] ||
  3148.                         b.blur(a.target)
  3149.                 }
  3150.             });
  3151.             e.on(["scroll" + d, "resize" + d].join(" "), function() {
  3152.                 b.isOpen && b.positionDropdown.apply(b, arguments)
  3153.             });
  3154.             e.on("mousemove" + d, function() {
  3155.                 b.ignoreHover = !1
  3156.             });
  3157.             this.revertSettings = {
  3158.                 $children: C.children().detach(),
  3159.                 tabindex: C.attr("tabindex")
  3160.             };
  3161.             C.attr("tabindex", -1).hide().after(b.$wrapper);
  3162.             a.isArray(c.items) && (b.setValue(c.items), delete c.items);
  3163.             if (m) C.on("invalid" + d, function(a) {
  3164.                 a.preventDefault();
  3165.                 b.isInvalid = !0;
  3166.                 b.refreshState()
  3167.             });
  3168.             b.updateOriginalInput();
  3169.             b.refreshItems();
  3170.             b.refreshState();
  3171.             b.updatePlaceholder();
  3172.             b.isSetup = !0;
  3173.             C.is(":disabled") && b.disable();
  3174.             b.on("change", this.onChange);
  3175.             C.data("selectize", b);
  3176.             C.addClass("selectized");
  3177.             b.trigger("initialize");
  3178.             if (!0 === c.preload) b.onSearchChange("")
  3179.         },
  3180.         setupTemplates: function() {
  3181.             var b = this.settings.labelField,
  3182.                 c = this.settings.optgroupLabelField;
  3183.             this.settings.render = a.extend({}, {
  3184.                 optgroup: function(a) {
  3185.                     return '<div class="optgroup">' + a.html + "</div>"
  3186.                 },
  3187.                 optgroup_header: function(a, b) {
  3188.                     return '<div class="optgroup-header">' + b(a[c]) + "</div>"
  3189.                 },
  3190.                 option: function(a, c) {
  3191.                     return '<div class="option">' +
  3192.                         c(a[b]) + "</div>"
  3193.                 },
  3194.                 item: function(a, c) {
  3195.                     return '<div class="item">' + c(a[b]) + "</div>"
  3196.                 },
  3197.                 option_create: function(a, b) {
  3198.                     return '<div class="create">Add <strong>' + b(a.input) + "</strong>&hellip;</div>"
  3199.                 }
  3200.             }, this.settings.render)
  3201.         },
  3202.         setupCallbacks: function() {
  3203.             var a, b, c = {
  3204.                 initialize: "onInitialize",
  3205.                 change: "onChange",
  3206.                 item_add: "onItemAdd",
  3207.                 item_remove: "onItemRemove",
  3208.                 clear: "onClear",
  3209.                 option_add: "onOptionAdd",
  3210.                 option_remove: "onOptionRemove",
  3211.                 option_clear: "onOptionClear",
  3212.                 optgroup_add: "onOptionGroupAdd",
  3213.                 optgroup_remove: "onOptionGroupRemove",
  3214.                 optgroup_clear: "onOptionGroupClear",
  3215.                 dropdown_open: "onDropdownOpen",
  3216.                 dropdown_close: "onDropdownClose",
  3217.                 type: "onType",
  3218.                 load: "onLoad",
  3219.                 focus: "onFocus",
  3220.                 blur: "onBlur"
  3221.             };
  3222.             for (a in c)
  3223.                 if (c.hasOwnProperty(a) && (b = this.settings[c[a]])) this.on(a, b)
  3224.         },
  3225.         onClick: function(a) {
  3226.             this.isFocused || (this.focus(), a.preventDefault())
  3227.         },
  3228.         onMouseDown: function(b) {
  3229.             var c = this,
  3230.                 d = b.isDefaultPrevented();
  3231.             a(b.target);
  3232.             if (c.isFocused) {
  3233.                 if (b.target !== c.$control_input[0]) return "single" === c.settings.mode ? c.isOpen ? c.close() : c.open() : d || c.setActiveItem(null), !1
  3234.             } else d || window.setTimeout(function() {
  3235.                 c.focus()
  3236.             }, 0)
  3237.         },
  3238.         onChange: function() {
  3239.             this.$input.trigger("change")
  3240.         },
  3241.         onPaste: function(b) {
  3242.             var c = this;
  3243.             c.isFull() || c.isInputHidden || c.isLocked ? b.preventDefault() : c.settings.splitOn && setTimeout(function() {
  3244.                 for (var b = a.trim(c.$control_input.val() || "").split(c.settings.splitOn), d = 0, e = b.length; d < e; d++) c.createItem(b[d])
  3245.             }, 0)
  3246.         },
  3247.         onKeyPress: function(a) {
  3248.             if (this.isLocked) return a && a.preventDefault();
  3249.             var b = String.fromCharCode(a.keyCode || a.which);
  3250.             if (this.settings.create && "multi" ===
  3251.                 this.settings.mode && b === this.settings.delimiter) return this.createItem(), a.preventDefault(), !1
  3252.         },
  3253.         onKeyDown: function(a) {
  3254.             if (this.isLocked) 9 !== a.keyCode && a.preventDefault();
  3255.             else {
  3256.                 switch (a.keyCode) {
  3257.                     case 65:
  3258.                         if (this.isCmdDown) {
  3259.                             this.selectAll();
  3260.                             return
  3261.                         }
  3262.                         break;
  3263.                     case 27:
  3264.                         this.isOpen && (a.preventDefault(), a.stopPropagation(), this.close());
  3265.                         return;
  3266.                     case 78:
  3267.                         if (!a.ctrlKey || a.altKey) break;
  3268.                     case 40:
  3269.                         if (!this.isOpen && this.hasOptions) this.open();
  3270.                         else if (this.$activeOption) {
  3271.                             this.ignoreHover = !0;
  3272.                             var b = this.getAdjacentOption(this.$activeOption,
  3273.                                 1);
  3274.                             b.length && this.setActiveOption(b, !0, !0)
  3275.                         }
  3276.                         a.preventDefault();
  3277.                         return;
  3278.                     case 80:
  3279.                         if (!a.ctrlKey || a.altKey) break;
  3280.                     case 38:
  3281.                         this.$activeOption && (this.ignoreHover = !0, b = this.getAdjacentOption(this.$activeOption, -1), b.length && this.setActiveOption(b, !0, !0));
  3282.                         a.preventDefault();
  3283.                         return;
  3284.                     case 13:
  3285.                         this.isOpen && this.$activeOption && (this.onOptionSelect({
  3286.                             currentTarget: this.$activeOption
  3287.                         }), a.preventDefault());
  3288.                         return;
  3289.                     case 37:
  3290.                         this.advanceSelection(-1, a);
  3291.                         return;
  3292.                     case 39:
  3293.                         this.advanceSelection(1, a);
  3294.                         return;
  3295.                     case 9:
  3296.                         this.settings.selectOnTab &&
  3297.                             this.isOpen && this.$activeOption && (this.onOptionSelect({
  3298.                                 currentTarget: this.$activeOption
  3299.                             }), this.isFull() || a.preventDefault());
  3300.                         this.settings.create && this.createItem() && a.preventDefault();
  3301.                         return;
  3302.                     case 8:
  3303.                     case 46:
  3304.                         this.deleteSelection(a);
  3305.                         return
  3306.                 }!this.isFull() && !this.isInputHidden || (f ? a.metaKey : a.ctrlKey) || a.preventDefault()
  3307.             }
  3308.         },
  3309.         onKeyUp: function(a) {
  3310.             if (this.isLocked) return a && a.preventDefault();
  3311.             a = this.$control_input.val() || "";
  3312.             this.lastValue !== a && (this.lastValue = a, this.onSearchChange(a), this.refreshOptions(),
  3313.                 this.trigger("type", a))
  3314.         },
  3315.         onSearchChange: function(a) {
  3316.             var b = this,
  3317.                 c = b.settings.load;
  3318.             c && !b.loadedSearches.hasOwnProperty(a) && (b.loadedSearches[a] = !0, b.load(function(d) {
  3319.                 c.apply(b, [a, d])
  3320.             }))
  3321.         },
  3322.         onFocus: function(a) {
  3323.             var b = this.isFocused;
  3324.             if (this.isDisabled) return this.blur(), a && a.preventDefault(), !1;
  3325.             if (!this.ignoreFocus) {
  3326.                 this.isFocused = !0;
  3327.                 if ("focus" === this.settings.preload) this.onSearchChange("");
  3328.                 b || this.trigger("focus");
  3329.                 this.$activeItems.length || (this.showInput(), this.setActiveItem(null), this.refreshOptions(!!this.settings.openOnFocus));
  3330.                 this.refreshState()
  3331.             }
  3332.         },
  3333.         onBlur: function(a, b) {
  3334.             var c = this;
  3335.             if (c.isFocused && (c.isFocused = !1, !c.ignoreFocus))
  3336.                 if (c.ignoreBlur || document.activeElement !== c.$dropdown_content[0]) {
  3337.                     var d = function() {
  3338.                         c.close();
  3339.                         c.setTextboxValue("");
  3340.                         c.setActiveItem(null);
  3341.                         c.setActiveOption(null);
  3342.                         c.setCaret(c.items.length);
  3343.                         c.refreshState();
  3344.                         (b || document.body).focus();
  3345.                         c.ignoreFocus = !1;
  3346.                         c.trigger("blur")
  3347.                     };
  3348.                     c.ignoreFocus = !0;
  3349.                     c.settings.create && c.settings.createOnBlur ? c.createItem(null, !1, d) : d()
  3350.                 } else c.ignoreBlur = !0, c.onFocus(a)
  3351.         },
  3352.         onOptionHover: function(a) {
  3353.             this.ignoreHover ||
  3354.                 this.setActiveOption(a.currentTarget, !1)
  3355.         },
  3356.         onOptionSelect: function(b) {
  3357.             var c, d = this;
  3358.             b.preventDefault && (b.preventDefault(), b.stopPropagation());
  3359.             c = a(b.currentTarget);
  3360.             c.hasClass("create") ? d.createItem(null, function() {
  3361.                 d.settings.closeAfterSelect && d.close()
  3362.             }) : (c = c.attr("data-value"), "undefined" !== typeof c && (d.lastQuery = null, d.setTextboxValue(""), d.addItem(c), d.settings.closeAfterSelect ? d.close() : !d.settings.hideSelected && b.type && /mouse/.test(b.type) && d.setActiveOption(d.getOption(c))))
  3363.         },
  3364.         onItemSelect: function(a) {
  3365.             this.isLocked ||
  3366.                 "multi" !== this.settings.mode || (a.preventDefault(), this.setActiveItem(a.currentTarget, a))
  3367.         },
  3368.         load: function(a) {
  3369.             var b = this,
  3370.                 c = b.$wrapper.addClass(b.settings.loadingClass);
  3371.             b.loading++;
  3372.             a.apply(b, [function(a) {
  3373.                 b.loading = Math.max(b.loading - 1, 0);
  3374.                 a && a.length && (b.addOption(a), b.refreshOptions(b.isFocused && !b.isInputHidden));
  3375.                 b.loading || c.removeClass(b.settings.loadingClass);
  3376.                 b.trigger("load", a)
  3377.             }])
  3378.         },
  3379.         setTextboxValue: function(a) {
  3380.             var b = this.$control_input;
  3381.             b.val() !== a && (b.val(a).triggerHandler("update"), this.lastValue =
  3382.                 a)
  3383.         },
  3384.         getValue: function() {
  3385.             return 1 === this.tagType && this.$input.attr("multiple") ? this.items : this.items.join(this.settings.delimiter)
  3386.         },
  3387.         setValue: function(a, b) {
  3388.             v(this, b ? [] : ["change"], function() {
  3389.                 this.clear();
  3390.                 this.addItems(a, b)
  3391.             })
  3392.         },
  3393.         setActiveItem: function(b, c) {
  3394.             var d, e, f;
  3395.             if ("single" !== this.settings.mode)
  3396.                 if (b = a(b), b.length) {
  3397.                     d = c && c.type.toLowerCase();
  3398.                     if ("mousedown" === d && this.isShiftDown && this.$activeItems.length) {
  3399.                         d = this.$control.children(".active:last");
  3400.                         e = Array.prototype.indexOf.apply(this.$control[0].childNodes, [d[0]]);
  3401.                         d = Array.prototype.indexOf.apply(this.$control[0].childNodes, [b[0]]);
  3402.                         e > d && (f = e, e = d, d = f);
  3403.                         for (; e <= d; e++) f = this.$control[0].childNodes[e], -1 === this.$activeItems.indexOf(f) && (a(f).addClass("active"), this.$activeItems.push(f));
  3404.                         c.preventDefault()
  3405.                     } else "mousedown" === d && this.isCtrlDown || "keydown" === d && this.isShiftDown ? b.hasClass("active") ? (d = this.$activeItems.indexOf(b[0]), this.$activeItems.splice(d, 1), b.removeClass("active")) : this.$activeItems.push(b.addClass("active")[0]) : (a(this.$activeItems).removeClass("active"),
  3406.                         this.$activeItems = [b.addClass("active")[0]]);
  3407.                     this.hideInput();
  3408.                     this.isFocused || this.focus()
  3409.                 } else a(this.$activeItems).removeClass("active"), this.$activeItems = [], this.isFocused && this.showInput()
  3410.         },
  3411.         setActiveOption: function(b, c, d) {
  3412.             var e, f, g;
  3413.             this.$activeOption && this.$activeOption.removeClass("active");
  3414.             this.$activeOption = null;
  3415.             b = a(b);
  3416.             b.length && (this.$activeOption = b.addClass("active"), c || "undefined" === typeof c) && (b = this.$dropdown_content.height(), e = this.$activeOption.outerHeight(!0), c = this.$dropdown_content.scrollTop() ||
  3417.                 0, f = this.$activeOption.offset().top - this.$dropdown_content.offset().top + c, g = f - b + e, f + e > b + c ? this.$dropdown_content.stop().animate({
  3418.                     scrollTop: g
  3419.                 }, d ? this.settings.scrollDuration : 0) : f < c && this.$dropdown_content.stop().animate({
  3420.                     scrollTop: f
  3421.                 }, d ? this.settings.scrollDuration : 0))
  3422.         },
  3423.         selectAll: function() {
  3424.             "single" !== this.settings.mode && (this.$activeItems = Array.prototype.slice.apply(this.$control.children(":not(input)").addClass("active")), this.$activeItems.length && (this.hideInput(), this.close()), this.focus())
  3425.         },
  3426.         hideInput: function() {
  3427.             this.setTextboxValue("");
  3428.             this.$control_input.css({
  3429.                 opacity: 0,
  3430.                 position: "absolute",
  3431.                 left: this.rtl ? 1E4 : -1E4
  3432.             });
  3433.             this.isInputHidden = !0
  3434.         },
  3435.         showInput: function() {
  3436.             this.$control_input.css({
  3437.                 opacity: 1,
  3438.                 position: "relative",
  3439.                 left: 0
  3440.             });
  3441.             this.isInputHidden = !1
  3442.         },
  3443.         focus: function() {
  3444.             var a = this;
  3445.             a.isDisabled || (a.ignoreFocus = !0, a.$control_input[0].focus(), window.setTimeout(function() {
  3446.                 a.ignoreFocus = !1;
  3447.                 a.onFocus()
  3448.             }, 0))
  3449.         },
  3450.         blur: function(a) {
  3451.             this.$control_input[0].blur();
  3452.             this.onBlur(null, a)
  3453.         },
  3454.         getScoreFunction: function(a) {
  3455.             return this.sifter.getScoreFunction(a, this.getSearchOptions())
  3456.         },
  3457.         getSearchOptions: function() {
  3458.             var a = this.settings,
  3459.                 b = a.sortField;
  3460.             "string" === typeof b && (b = [{
  3461.                 field: b
  3462.             }]);
  3463.             return {
  3464.                 fields: a.searchField,
  3465.                 conjunction: a.searchConjunction,
  3466.                 sort: b
  3467.             }
  3468.         },
  3469.         search: function(b) {
  3470.             var c, d;
  3471.             c = this.settings;
  3472.             var e = this.getSearchOptions();
  3473.             if (c.score && (d = this.settings.score.apply(this, [b]), "function" !== typeof d)) throw Error('Selectize "score" setting must be a function that returns a function');
  3474.             b !== this.lastQuery ? (this.lastQuery = b, this.currentResults = b = this.sifter.search(b, a.extend(e, {
  3475.                     score: d
  3476.                 }))) :
  3477.                 b = a.extend(!0, {}, this.currentResults);
  3478.             if (c.hideSelected)
  3479.                 for (c = b.items.length - 1; 0 <= c; c--) - 1 !== this.items.indexOf(k(b.items[c].id)) && b.items.splice(c, 1);
  3480.             return b
  3481.         },
  3482.         refreshOptions: function(c) {
  3483.             var d, e, f, g, h, m, l, n, p, q, z, F;
  3484.             "undefined" === typeof c && (c = !0);
  3485.             var t = this;
  3486.             z = a.trim(t.$control_input.val());
  3487.             var u = t.search(z),
  3488.                 v = t.$dropdown_content,
  3489.                 y = t.$activeOption && k(t.$activeOption.attr("data-value"));
  3490.             g = u.items.length;
  3491.             "number" === typeof t.settings.maxOptions && (g = Math.min(g, t.settings.maxOptions));
  3492.             h = {};
  3493.             m = [];
  3494.             for (d = 0; d <
  3495.                 g; d++)
  3496.                 for (l = t.options[u.items[d].id], n = t.render("option", l), l = l[t.settings.optgroupField] || "", p = a.isArray(l) ? l : [l], e = 0, f = p && p.length; e < f; e++) l = p[e], t.optgroups.hasOwnProperty(l) || (l = ""), h.hasOwnProperty(l) || (h[l] = [], m.push(l)), h[l].push(n);
  3497.             this.settings.lockOptgroupOrder && m.sort(function(a, b) {
  3498.                 return (t.optgroups[a].$order || 0) - (t.optgroups[b].$order || 0)
  3499.             });
  3500.             n = [];
  3501.             d = 0;
  3502.             for (g = m.length; d < g; d++) l = m[d], t.optgroups.hasOwnProperty(l) && h[l].length ? (e = t.render("optgroup_header", t.optgroups[l]) || "", e += h[l].join(""),
  3503.                 n.push(t.render("optgroup", a.extend({}, t.optgroups[l], {
  3504.                     html: e
  3505.                 })))) : n.push(h[l].join(""));
  3506.             v.html(n.join(""));
  3507.             if (t.settings.highlight && u.query.length && u.tokens.length)
  3508.                 for (d = 0, g = u.tokens.length; d < g; d++) b(v, u.tokens[d].regex);
  3509.             if (!t.settings.hideSelected)
  3510.                 for (d = 0, g = t.items.length; d < g; d++) t.getOption(t.items[d]).addClass("selected");
  3511.             if (d = t.canCreate(z)) v.prepend(t.render("option_create", {
  3512.                 input: z
  3513.             })), F = a(v[0].childNodes[0]);
  3514.             t.hasOptions = 0 < u.items.length || d;
  3515.             t.hasOptions ? (0 < u.items.length ? ((z = y && t.getOption(y)) &&
  3516.                 z.length ? q = z : "single" === t.settings.mode && t.items.length && (q = t.getOption(t.items[0])), q && q.length || (q = F && !t.settings.addPrecedence ? t.getAdjacentOption(F, 1) : v.find("[data-selectable]:first"))) : q = F, t.setActiveOption(q), c && !t.isOpen && t.open()) : (t.setActiveOption(null), c && t.isOpen && t.close())
  3517.         },
  3518.         addOption: function(b) {
  3519.             var c, d;
  3520.             if (a.isArray(b))
  3521.                 for (c = 0, d = b.length; c < d; c++) this.addOption(b[c]);
  3522.             else if (c = this.registerOption(b)) this.userOptions[c] = !0, this.lastQuery = null, this.trigger("option_add", c, b)
  3523.         },
  3524.         registerOption: function(a) {
  3525.             var b =
  3526.                 k(a[this.settings.valueField]);
  3527.             if (!b || this.options.hasOwnProperty(b)) return !1;
  3528.             a.$order = a.$order || ++this.order;
  3529.             this.options[b] = a;
  3530.             return b
  3531.         },
  3532.         registerOptionGroup: function(a) {
  3533.             var b = k(a[this.settings.optgroupValueField]);
  3534.             if (!b) return !1;
  3535.             a.$order = a.$order || ++this.order;
  3536.             this.optgroups[b] = a;
  3537.             return b
  3538.         },
  3539.         addOptionGroup: function(a, b) {
  3540.             b[this.settings.optgroupValueField] = a;
  3541.             (a = this.registerOptionGroup(b)) && this.trigger("optgroup_add", a, b)
  3542.         },
  3543.         removeOptionGroup: function(a) {
  3544.             this.optgroups.hasOwnProperty(a) && (delete this.optgroups[a],
  3545.                 this.renderCache = {}, this.trigger("optgroup_remove", a))
  3546.         },
  3547.         clearOptionGroups: function() {
  3548.             this.optgroups = {};
  3549.             this.renderCache = {};
  3550.             this.trigger("optgroup_clear")
  3551.         },
  3552.         updateOption: function(b, c) {
  3553.             var d, e, f;
  3554.             b = k(b);
  3555.             d = k(c[this.settings.valueField]);
  3556.             if (null !== b && this.options.hasOwnProperty(b)) {
  3557.                 if ("string" !== typeof d) throw Error("Value must be set in option data");
  3558.                 f = this.options[b].$order;
  3559.                 d !== b && (delete this.options[b], e = this.items.indexOf(b), -1 !== e && this.items.splice(e, 1, d));
  3560.                 c.$order = c.$order || f;
  3561.                 this.options[d] = c;
  3562.                 e = this.renderCache.item;
  3563.                 f = this.renderCache.option;
  3564.                 e && (delete e[b], delete e[d]);
  3565.                 f && (delete f[b], delete f[d]); - 1 !== this.items.indexOf(d) && (d = this.getItem(b), e = a(this.render("item", c)), d.hasClass("active") && e.addClass("active"), d.replaceWith(e));
  3566.                 this.lastQuery = null;
  3567.                 this.isOpen && this.refreshOptions(!1)
  3568.             }
  3569.         },
  3570.         removeOption: function(a, b) {
  3571.             a = k(a);
  3572.             var c = this.renderCache.item,
  3573.                 d = this.renderCache.option;
  3574.             c && delete c[a];
  3575.             d && delete d[a];
  3576.             delete this.userOptions[a];
  3577.             delete this.options[a];
  3578.             this.lastQuery = null;
  3579.             this.trigger("option_remove",
  3580.                 a);
  3581.             this.removeItem(a, b)
  3582.         },
  3583.         clearOptions: function() {
  3584.             this.loadedSearches = {};
  3585.             this.userOptions = {};
  3586.             this.renderCache = {};
  3587.             this.options = this.sifter.items = {};
  3588.             this.lastQuery = null;
  3589.             this.trigger("option_clear");
  3590.             this.clear()
  3591.         },
  3592.         getOption: function(a) {
  3593.             return this.getElementWithValue(a, this.$dropdown_content.find("[data-selectable]"))
  3594.         },
  3595.         getAdjacentOption: function(b, c) {
  3596.             var d = this.$dropdown.find("[data-selectable]"),
  3597.                 e = d.index(b) + c;
  3598.             return 0 <= e && e < d.length ? d.eq(e) : a()
  3599.         },
  3600.         getElementWithValue: function(b, c) {
  3601.             b = k(b);
  3602.             if ("undefined" !==
  3603.                 typeof b && null !== b)
  3604.                 for (var d = 0, e = c.length; d < e; d++)
  3605.                     if (c[d].getAttribute("data-value") === b) return a(c[d]);
  3606.             return a()
  3607.         },
  3608.         getItem: function(a) {
  3609.             return this.getElementWithValue(a, this.$control.children())
  3610.         },
  3611.         addItems: function(b, c) {
  3612.             for (var d = a.isArray(b) ? b : [b], e = 0, f = d.length; e < f; e++) this.isPending = e < f - 1, this.addItem(d[e], c)
  3613.         },
  3614.         addItem: function(b, c) {
  3615.             v(this, c ? [] : ["change"], function() {
  3616.                 var d, e, f, g = this.settings.mode;
  3617.                 b = k(b); - 1 !== this.items.indexOf(b) ? "single" === g && this.close() : this.options.hasOwnProperty(b) && ("single" ===
  3618.                     g && this.clear(), "multi" === g && this.isFull() || (d = a(this.render("item", this.options[b])), f = this.isFull(), this.items.splice(this.caretPos, 0, b), this.insertAtCaret(d), (!this.isPending || !f && this.isFull()) && this.refreshState(), this.isSetup && (f = this.$dropdown_content.find("[data-selectable]"), this.isPending || (e = this.getOption(b), e = this.getAdjacentOption(e, 1).attr("data-value"), this.refreshOptions(this.isFocused && "single" !== g), e && this.setActiveOption(this.getOption(e))), !f.length || this.isFull() ? this.close() :
  3619.                         this.positionDropdown(), this.updatePlaceholder(), this.trigger("item_add", b, d), this.updateOriginalInput({
  3620.                             silent: c
  3621.                         }))))
  3622.             })
  3623.         },
  3624.         removeItem: function(a, b) {
  3625.             var c, d, e;
  3626.             c = "object" === typeof a ? a : this.getItem(a);
  3627.             a = k(c.attr("data-value"));
  3628.             d = this.items.indexOf(a); - 1 !== d && (c.remove(), c.hasClass("active") && (e = this.$activeItems.indexOf(c[0]), this.$activeItems.splice(e, 1)), this.items.splice(d, 1), this.lastQuery = null, !this.settings.persist && this.userOptions.hasOwnProperty(a) && this.removeOption(a, b), d < this.caretPos && this.setCaret(this.caretPos -
  3629.                 1), this.refreshState(), this.updatePlaceholder(), this.updateOriginalInput({
  3630.                 silent: b
  3631.             }), this.positionDropdown(), this.trigger("item_remove", a, c))
  3632.         },
  3633.         createItem: function(b, c) {
  3634.             var d = this,
  3635.                 e = d.caretPos;
  3636.             b = b || a.trim(d.$control_input.val() || "");
  3637.             var f = arguments[arguments.length - 1];
  3638.             "function" !== typeof f && (f = function() {});
  3639.             "boolean" !== typeof c && (c = !0);
  3640.             if (!d.canCreate(b)) return f(), !1;
  3641.             d.lock();
  3642.             var g = "function" === typeof d.settings.create ? this.settings.create : function(a) {
  3643.                     var b = {};
  3644.                     b[d.settings.labelField] = a;
  3645.                     b[d.settings.valueField] =
  3646.                         a;
  3647.                     return b
  3648.                 },
  3649.                 h = p(function(a) {
  3650.                     d.unlock();
  3651.                     if (!a || "object" !== typeof a) return f();
  3652.                     var b = k(a[d.settings.valueField]);
  3653.                     if ("string" !== typeof b) return f();
  3654.                     d.setTextboxValue("");
  3655.                     d.addOption(a);
  3656.                     d.setCaret(e);
  3657.                     d.addItem(b);
  3658.                     d.refreshOptions(c && "single" !== d.settings.mode);
  3659.                     f(a)
  3660.                 }),
  3661.                 g = g.apply(this, [b, h]);
  3662.             "undefined" !== typeof g && h(g);
  3663.             return !0
  3664.         },
  3665.         refreshItems: function() {
  3666.             this.lastQuery = null;
  3667.             this.isSetup && this.addItem(this.items);
  3668.             this.refreshState();
  3669.             this.updateOriginalInput()
  3670.         },
  3671.         refreshState: function() {
  3672.             this.isRequired && (this.items.length &&
  3673.                 (this.isInvalid = !1), this.$control_input.prop("required", void 0));
  3674.             this.refreshClasses()
  3675.         },
  3676.         refreshClasses: function() {
  3677.             var b = this.isFull(),
  3678.                 c = this.isLocked;
  3679.             this.$wrapper.toggleClass("rtl", this.rtl);
  3680.             this.$control.toggleClass("focus", this.isFocused).toggleClass("disabled", this.isDisabled).toggleClass("required", this.isRequired).toggleClass("invalid", this.isInvalid).toggleClass("locked", c).toggleClass("full", b).toggleClass("not-full", !b).toggleClass("input-active", this.isFocused && !this.isInputHidden).toggleClass("dropdown-active",
  3681.                 this.isOpen).toggleClass("has-options", !a.isEmptyObject(this.options)).toggleClass("has-items", 0 < this.items.length);
  3682.             this.$control_input.data("grow", !b && !c)
  3683.         },
  3684.         isFull: function() {
  3685.             return null !== this.settings.maxItems && this.items.length >= this.settings.maxItems
  3686.         },
  3687.         updateOriginalInput: function(a) {
  3688.             var b, c, d, e;
  3689.             a = a || {};
  3690.             if (1 === this.tagType) {
  3691.                 d = [];
  3692.                 b = 0;
  3693.                 for (c = this.items.length; b < c; b++) e = this.options[this.items[b]][this.settings.labelField] || "", d.push('<option value="' + n(this.items[b]) + '" selected="selected">' + n(e) +
  3694.                     "</option>");
  3695.                 d.length || this.$input.attr("multiple") || d.push('<option value="" selected="selected"></option>');
  3696.                 this.$input.html(d.join(""))
  3697.             } else this.$input.val(this.getValue()), this.$input.attr("value", this.$input.val());
  3698.             this.isSetup && (a.silent || this.trigger("change", this.$input.val()))
  3699.         },
  3700.         updatePlaceholder: function() {
  3701.             if (this.settings.placeholder) {
  3702.                 var a = this.$control_input;
  3703.                 this.items.length ? a.removeAttr("placeholder") : a.attr("placeholder", this.settings.placeholder);
  3704.                 a.triggerHandler("update", {
  3705.                     force: !0
  3706.                 })
  3707.             }
  3708.         },
  3709.         open: function() {
  3710.             this.isLocked || this.isOpen || "multi" === this.settings.mode && this.isFull() || (this.focus(), this.isOpen = !0, this.refreshState(), this.$dropdown.css({
  3711.                 visibility: "hidden",
  3712.                 display: "block"
  3713.             }), this.positionDropdown(), this.$dropdown.css({
  3714.                 visibility: "visible"
  3715.             }), this.trigger("dropdown_open", this.$dropdown))
  3716.         },
  3717.         close: function() {
  3718.             var a = this.isOpen;
  3719.             "single" === this.settings.mode && this.items.length && this.hideInput();
  3720.             this.isOpen = !1;
  3721.             this.$dropdown.hide();
  3722.             this.setActiveOption(null);
  3723.             this.refreshState();
  3724.             a && this.trigger("dropdown_close",
  3725.                 this.$dropdown)
  3726.         },
  3727.         positionDropdown: function() {
  3728.             var a = this.$control,
  3729.                 b = "body" === this.settings.dropdownParent ? a.offset() : a.position();
  3730.             b.top += a.outerHeight(!0);
  3731.             this.$dropdown.css({
  3732.                 width: a.outerWidth(),
  3733.                 top: b.top,
  3734.                 left: b.left
  3735.             })
  3736.         },
  3737.         clear: function(a) {
  3738.             this.items.length && (this.$control.children(":not(input)").remove(), this.items = [], this.lastQuery = null, this.setCaret(0), this.setActiveItem(null), this.updatePlaceholder(), this.updateOriginalInput({
  3739.                 silent: a
  3740.             }), this.refreshState(), this.showInput(), this.trigger("clear"))
  3741.         },
  3742.         insertAtCaret: function(b) {
  3743.             var c = Math.min(this.caretPos, this.items.length);
  3744.             0 === c ? this.$control.prepend(b) : a(this.$control[0].childNodes[c]).before(b);
  3745.             this.setCaret(c + 1)
  3746.         },
  3747.         deleteSelection: function(b) {
  3748.             var c, d, e, f, g;
  3749.             c = b && 8 === b.keyCode ? -1 : 1;
  3750.             d = u(this.$control_input[0]);
  3751.             this.$activeOption && !this.settings.hideSelected && (g = this.getAdjacentOption(this.$activeOption, -1).attr("data-value"));
  3752.             e = [];
  3753.             if (this.$activeItems.length) {
  3754.                 f = this.$control.children(".active:" + (0 < c ? "last" : "first"));
  3755.                 f = this.$control.children(":not(input)").index(f);
  3756.                 0 < c && f++;
  3757.                 c = 0;
  3758.                 for (d = this.$activeItems.length; c < d; c++) e.push(a(this.$activeItems[c]).attr("data-value"));
  3759.                 b && (b.preventDefault(), b.stopPropagation())
  3760.             } else(this.isFocused || "single" === this.settings.mode) && this.items.length && (0 > c && 0 === d.start && 0 === d.length ? e.push(this.items[this.caretPos - 1]) : 0 < c && d.start === this.$control_input.val().length && e.push(this.items[this.caretPos]));
  3761.             if (!e.length || "function" === typeof this.settings.onDelete && !1 === this.settings.onDelete.apply(this, [e])) return !1;
  3762.             for ("undefined" !== typeof f &&
  3763.                 this.setCaret(f); e.length;) this.removeItem(e.pop());
  3764.             this.showInput();
  3765.             this.positionDropdown();
  3766.             this.refreshOptions(!0);
  3767.             g && (b = this.getOption(g), b.length && this.setActiveOption(b));
  3768.             return !0
  3769.         },
  3770.         advanceSelection: function(a, b) {
  3771.             var c, d;
  3772.             0 !== a && (this.rtl && (a *= -1), c = 0 < a ? "last" : "first", d = u(this.$control_input[0]), this.isFocused && !this.isInputHidden ? (c = this.$control_input.val().length, (d = 0 > a ? 0 === d.start && 0 === d.length : d.start === c) && !c && this.advanceCaret(a, b)) : (d = this.$control.children(".active:" + c), d.length && (d = this.$control.children(":not(input)").index(d),
  3773.                 this.setActiveItem(null), this.setCaret(0 < a ? d + 1 : d))))
  3774.         },
  3775.         advanceCaret: function(a, b) {
  3776.             var c;
  3777.             0 !== a && (c = 0 < a ? "next" : "prev", this.isShiftDown ? (c = this.$control_input[c](), c.length && (this.hideInput(), this.setActiveItem(c), b && b.preventDefault())) : this.setCaret(this.caretPos + a))
  3778.         },
  3779.         setCaret: function(b) {
  3780.             b = "single" === this.settings.mode ? this.items.length : Math.max(0, Math.min(this.items.length, b));
  3781.             if (!this.isPending) {
  3782.                 var c, d, e, f;
  3783.                 e = this.$control.children(":not(input)");
  3784.                 c = 0;
  3785.                 for (d = e.length; c < d; c++) f = a(e[c]).detach(), c < b ?
  3786.                     this.$control_input.before(f) : this.$control.append(f)
  3787.             }
  3788.             this.caretPos = b
  3789.         },
  3790.         lock: function() {
  3791.             this.close();
  3792.             this.isLocked = !0;
  3793.             this.refreshState()
  3794.         },
  3795.         unlock: function() {
  3796.             this.isLocked = !1;
  3797.             this.refreshState()
  3798.         },
  3799.         disable: function() {
  3800.             this.$input.prop("disabled", !0);
  3801.             this.$control_input.prop("disabled", !0).prop("tabindex", -1);
  3802.             this.isDisabled = !0;
  3803.             this.lock()
  3804.         },
  3805.         enable: function() {
  3806.             this.$input.prop("disabled", !1);
  3807.             this.$control_input.prop("disabled", !1).prop("tabindex", this.tabIndex);
  3808.             this.isDisabled = !1;
  3809.             this.unlock()
  3810.         },
  3811.         destroy: function() {
  3812.             var b =
  3813.                 this.eventNS,
  3814.                 c = this.revertSettings;
  3815.             this.trigger("destroy");
  3816.             this.off();
  3817.             this.$wrapper.remove();
  3818.             this.$dropdown.remove();
  3819.             this.$input.html("").append(c.$children).removeAttr("tabindex").removeClass("selectized").attr({
  3820.                 tabindex: c.tabindex
  3821.             }).show();
  3822.             this.$control_input.removeData("grow");
  3823.             this.$input.removeData("selectize");
  3824.             a(window).off(b);
  3825.             a(document).off(b);
  3826.             a(document.body).off(b);
  3827.             delete this.$input[0].selectize
  3828.         },
  3829.         render: function(a, b) {
  3830.             var c, d, e = "",
  3831.                 f = !1,
  3832.                 g = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
  3833.             if ("option" === a || "item" === a) c = k(b[this.settings.valueField]), f = !!c;
  3834.             if (f && ("undefined" === typeof this.renderCache[a] && (this.renderCache[a] = {}), this.renderCache[a].hasOwnProperty(c))) return this.renderCache[a][c];
  3835.             e = this.settings.render[a].apply(this, [b, n]);
  3836.             if ("option" === a || "option_create" === a) e = e.replace(g, "<$1 data-selectable");
  3837.             "optgroup" === a && (d = b[this.settings.optgroupValueField] || "", e = e.replace(g, '<$1 data-group="' + q(n(d)) + '"'));
  3838.             if ("option" === a || "item" === a) e = e.replace(g, '<$1 data-value="' + q(n(c ||
  3839.                 "")) + '"');
  3840.             f && (this.renderCache[a][c] = e);
  3841.             return e
  3842.         },
  3843.         clearCache: function(a) {
  3844.             "undefined" === typeof a ? this.renderCache = {} : delete this.renderCache[a]
  3845.         },
  3846.         canCreate: function(a) {
  3847.             if (!this.settings.create) return !1;
  3848.             var b = this.settings.createFilter;
  3849.             return a.length && ("function" !== typeof b || b.apply(this, [a])) && ("string" !== typeof b || (new RegExp(b)).test(a)) && (!(b instanceof RegExp) || b.test(a))
  3850.         }
  3851.     });
  3852.     A.count = 0;
  3853.     A.defaults = {
  3854.         options: [],
  3855.         optgroups: [],
  3856.         plugins: [],
  3857.         delimiter: ",",
  3858.         splitOn: null,
  3859.         persist: !0,
  3860.         diacritics: !0,
  3861.         create: !1,
  3862.         createOnBlur: !1,
  3863.         createFilter: null,
  3864.         highlight: !0,
  3865.         openOnFocus: !0,
  3866.         maxOptions: 1E3,
  3867.         maxItems: null,
  3868.         hideSelected: null,
  3869.         addPrecedence: !1,
  3870.         selectOnTab: !1,
  3871.         preload: !1,
  3872.         allowEmptyOption: !1,
  3873.         closeAfterSelect: !1,
  3874.         scrollDuration: 60,
  3875.         loadThrottle: 300,
  3876.         loadingClass: "loading",
  3877.         dataAttr: "data-data",
  3878.         optgroupField: "optgroup",
  3879.         valueField: "value",
  3880.         labelField: "text",
  3881.         optgroupLabelField: "label",
  3882.         optgroupValueField: "value",
  3883.         lockOptgroupOrder: !1,
  3884.         sortField: "$order",
  3885.         searchField: ["text"],
  3886.         searchConjunction: "and",
  3887.         mode: null,
  3888.         wrapperClass: "selectize-control",
  3889.         inputClass: "selectize-input",
  3890.         dropdownClass: "selectize-dropdown",
  3891.         dropdownContentClass: "selectize-dropdown-content",
  3892.         dropdownParent: null,
  3893.         copyClassesToDropdown: !0,
  3894.         render: {}
  3895.     };
  3896.     a.fn.selectize = function(b) {
  3897.         var c = a.fn.selectize.defaults,
  3898.             d = a.extend({}, c, b),
  3899.             e = d.dataAttr,
  3900.             f = d.labelField,
  3901.             g = d.valueField,
  3902.             h = d.optgroupField,
  3903.             m = d.optgroupLabelField,
  3904.             l = d.optgroupValueField,
  3905.             n = {},
  3906.             p = function(b, c) {
  3907.                 var r, p, B, q, u = c.options,
  3908.                     v = function(a) {
  3909.                         a = e && a.attr(e);
  3910.                         return "string" === typeof a && a.length ? JSON.parse(a) : null
  3911.                     },
  3912.                     y = function(b, e) {
  3913.                         b = a(b);
  3914.                         var m = k(b.attr("value"));
  3915.                         if (m || d.allowEmptyOption)
  3916.                             if (n.hasOwnProperty(m)) {
  3917.                                 if (e) {
  3918.                                     var l = n[m][h];
  3919.                                     l ? a.isArray(l) ? l.push(e) : n[m][h] = [l, e] : n[m][h] = e
  3920.                                 }
  3921.                             } else l = v(b) || {}, l[f] = l[f] || b.text(), l[g] = l[g] || m, l[h] = l[h] || e, n[m] = l, u.push(l), b.is(":selected") && c.items.push(m)
  3922.                     },
  3923.                     A = function(b) {
  3924.                         var d, e, f;
  3925.                         b = a(b);
  3926.                         if (e = b.attr("label")) d = v(b) || {}, d[m] = e, d[l] = e, c.optgroups.push(d);
  3927.                         f = a("option", b);
  3928.                         b = 0;
  3929.                         for (d = f.length; b < d; b++) y(f[b], e)
  3930.                     };
  3931.                 c.maxItems = b.attr("multiple") ? null : 1;
  3932.                 q = b.children();
  3933.                 r = 0;
  3934.                 for (p = q.length; r < p; r++) B = q[r].tagName.toLowerCase(), "optgroup" ===
  3935.                     B ? A(q[r]) : "option" === B && y(q[r])
  3936.             };
  3937.         return this.each(function() {
  3938.             if (!this.selectize) {
  3939.                 var h = a(this),
  3940.                     k = this.tagName.toLowerCase(),
  3941.                     m = h.attr("placeholder") || h.attr("data-placeholder");
  3942.                 m || d.allowEmptyOption || (m = h.children('option[value=""]').text());
  3943.                 m = {
  3944.                     placeholder: m,
  3945.                     options: [],
  3946.                     optgroups: [],
  3947.                     items: []
  3948.                 };
  3949.                 if ("select" === k) p(h, m);
  3950.                 else {
  3951.                     var l, n, q;
  3952.                     if (k = h.attr(e))
  3953.                         for (m.options = JSON.parse(k), k = 0, l = m.options.length; k < l; k++) m.items.push(m.options[k][g]);
  3954.                     else if (k = a.trim(h.val() || ""), d.allowEmptyOption || k.length) {
  3955.                         n = k.split(d.delimiter);
  3956.                         k = 0;
  3957.                         for (l = n.length; k < l; k++) q = {}, q[f] = n[k], q[g] = n[k], m.options.push(q);
  3958.                         m.items = n
  3959.                     }
  3960.                 }
  3961.                 new A(h, a.extend(!0, {}, c, m, b))
  3962.             }
  3963.         })
  3964.     };
  3965.     a.fn.selectize.defaults = A.defaults;
  3966.     a.fn.selectize.support = {
  3967.         validity: m
  3968.     };
  3969.     A.define("drag_drop", function(b) {
  3970.         if (!a.fn.sortable) throw Error('The "drag_drop" plugin requires jQuery UI "sortable".');
  3971.         if ("multi" === this.settings.mode) {
  3972.             var c = this;
  3973.             c.lock = function() {
  3974.                 var a = c.lock;
  3975.                 return function() {
  3976.                     var b = c.$control.data("sortable");
  3977.                     b && b.disable();
  3978.                     return a.apply(c, arguments)
  3979.                 }
  3980.             }();
  3981.             c.unlock = function() {
  3982.                 var a =
  3983.                     c.unlock;
  3984.                 return function() {
  3985.                     var b = c.$control.data("sortable");
  3986.                     b && b.enable();
  3987.                     return a.apply(c, arguments)
  3988.                 }
  3989.             }();
  3990.             c.setup = function() {
  3991.                 var b = c.setup;
  3992.                 return function() {
  3993.                     b.apply(this, arguments);
  3994.                     var d = c.$control.sortable({
  3995.                         items: "[data-value]",
  3996.                         forcePlaceholderSize: !0,
  3997.                         disabled: c.isLocked,
  3998.                         start: function(a, b) {
  3999.                             b.placeholder.css("width", b.helper.css("width"));
  4000.                             d.css({
  4001.                                 overflow: "visible"
  4002.                             })
  4003.                         },
  4004.                         stop: function() {
  4005.                             d.css({
  4006.                                 overflow: "hidden"
  4007.                             });
  4008.                             var b = c.$activeItems ? c.$activeItems.slice() : null,
  4009.                                 e = [];
  4010.                             d.children("[data-value]").each(function() {
  4011.                                 e.push(a(this).attr("data-value"))
  4012.                             });
  4013.                             c.setValue(e);
  4014.                             c.setActiveItem(b)
  4015.                         }
  4016.                     })
  4017.                 }
  4018.             }()
  4019.         }
  4020.     });
  4021.     A.define("dropdown_header", function(b) {
  4022.         var c = this;
  4023.         b = a.extend({
  4024.                 title: "Untitled",
  4025.                 headerClass: "selectize-dropdown-header",
  4026.                 titleRowClass: "selectize-dropdown-header-title",
  4027.                 labelClass: "selectize-dropdown-header-label",
  4028.                 closeClass: "selectize-dropdown-header-close",
  4029.                 html: function(a) {
  4030.                     return '<div class="' + a.headerClass + '"><div class="' + a.titleRowClass + '"><span class="' + a.labelClass + '">' + a.title + '</span><a href="javascript:void(0)" class="' + a.closeClass + '">&times;</a></div></div>'
  4031.                 }
  4032.             },
  4033.             b);
  4034.         c.setup = function() {
  4035.             var d = c.setup;
  4036.             return function() {
  4037.                 d.apply(c, arguments);
  4038.                 c.$dropdown_header = a(b.html(b));
  4039.                 c.$dropdown.prepend(c.$dropdown_header)
  4040.             }
  4041.         }()
  4042.     });
  4043.     A.define("optgroup_columns", function(b) {
  4044.         var c = this;
  4045.         b = a.extend({
  4046.             equalizeWidth: !0,
  4047.             equalizeHeight: !0
  4048.         }, b);
  4049.         this.getAdjacentOption = function(b, c) {
  4050.             var d = b.closest("[data-group]").find("[data-selectable]"),
  4051.                 e = d.index(b) + c;
  4052.             return 0 <= e && e < d.length ? d.eq(e) : a()
  4053.         };
  4054.         this.onKeyDown = function() {
  4055.             var a = c.onKeyDown;
  4056.             return function(b) {
  4057.                 var d, e;
  4058.                 if (!this.isOpen || 37 !== b.keyCode &&
  4059.                     39 !== b.keyCode) return a.apply(this, arguments);
  4060.                 c.ignoreHover = !0;
  4061.                 e = this.$activeOption.closest("[data-group]");
  4062.                 d = e.find("[data-selectable]").index(this.$activeOption);
  4063.                 e = 37 === b.keyCode ? e.prev("[data-group]") : e.next("[data-group]");
  4064.                 e = e.find("[data-selectable]");
  4065.                 d = e.eq(Math.min(e.length - 1, d));
  4066.                 d.length && this.setActiveOption(d)
  4067.             }
  4068.         }();
  4069.         var d = function() {
  4070.                 var a, b = d.width,
  4071.                     c = document;
  4072.                 "undefined" === typeof b && (a = c.createElement("div"), a.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',
  4073.                     a = a.firstChild, c.body.appendChild(a), b = d.width = a.offsetWidth - a.clientWidth, c.body.removeChild(a));
  4074.                 return b
  4075.             },
  4076.             e = function() {
  4077.                 var e, f, g, h;
  4078.                 h = a("[data-group]", c.$dropdown_content);
  4079.                 if ((f = h.length) && c.$dropdown_content.width()) {
  4080.                     if (b.equalizeHeight) {
  4081.                         for (e = g = 0; e < f; e++) g = Math.max(g, h.eq(e).height());
  4082.                         h.css({
  4083.                             height: g
  4084.                         })
  4085.                     }
  4086.                     b.equalizeWidth && (g = c.$dropdown_content.innerWidth() - d(), e = Math.round(g / f), h.css({
  4087.                         width: e
  4088.                     }), 1 < f && (e = g - e * (f - 1), h.eq(f - 1).css({
  4089.                         width: e
  4090.                     })))
  4091.                 }
  4092.             };
  4093.         if (b.equalizeHeight || b.equalizeWidth) l.after(this, "positionDropdown",
  4094.             e), l.after(this, "refreshOptions", e)
  4095.     });
  4096.     A.define("remove_button", function(b) {
  4097.         if ("single" !== this.settings.mode) {
  4098.             b = a.extend({
  4099.                 label: "&times;",
  4100.                 title: "Remove",
  4101.                 className: "remove",
  4102.                 append: !0
  4103.             }, b);
  4104.             var c = this,
  4105.                 d = '<a href="javascript:void(0)" class="' + b.className + '" tabindex="-1" title="' + n(b.title) + '">' + b.label + "</a>";
  4106.             this.setup = function() {
  4107.                 var e = c.setup;
  4108.                 return function() {
  4109.                     if (b.append) {
  4110.                         var f = c.settings.render.item;
  4111.                         c.settings.render.item = function(a) {
  4112.                             var b = f.apply(this, arguments),
  4113.                                 c = b.search(/(<\/[^>]+>\s*)$/);
  4114.                             return b.substring(0,
  4115.                                 c) + d + b.substring(c)
  4116.                         }
  4117.                     }
  4118.                     e.apply(this, arguments);
  4119.                     this.$control.on("click", "." + b.className, function(b) {
  4120.                         b.preventDefault();
  4121.                         c.isLocked || (b = a(b.currentTarget).parent(), c.setActiveItem(b), c.deleteSelection() && c.setCaret(c.items.length))
  4122.                     })
  4123.                 }
  4124.             }()
  4125.         }
  4126.     });
  4127.     A.define("restore_on_backspace", function(a) {
  4128.         var b = this;
  4129.         a.text = a.text || function(a) {
  4130.             return a[this.settings.labelField]
  4131.         };
  4132.         this.onKeyDown = function() {
  4133.             var c = b.onKeyDown;
  4134.             return function(b) {
  4135.                 var d;
  4136.                 if (8 === b.keyCode && "" === this.$control_input.val() && !this.$activeItems.length &&
  4137.                     (d = this.caretPos - 1, 0 <= d && d < this.items.length)) {
  4138.                     d = this.options[this.items[d]];
  4139.                     this.deleteSelection(b) && (this.setTextboxValue(a.text.apply(this, [d])), this.refreshOptions(!0));
  4140.                     b.preventDefault();
  4141.                     return
  4142.                 }
  4143.                 return c.apply(this, arguments)
  4144.             }
  4145.         }()
  4146.     });
  4147.     return A
  4148. });
  4149. Moobot = function(a) {
  4150.     a.version = 47;
  4151.     a.username = "moobot";
  4152.     return a
  4153. }(Moobot || {});
  4154. Moobot = function(a) {
  4155.     var d = {};
  4156.     a.event = {
  4157.         trigger: function(a, b) {
  4158.             d[a] && $.each(d[a], function(e) {
  4159.                 d[a][e](b)
  4160.             })
  4161.         },
  4162.         subscribe: function(a, b) {
  4163.             d[a] || (d[a] = []);
  4164.             d[a].push(b)
  4165.         }
  4166.     };
  4167.     return a
  4168. }(Moobot || {});
  4169. Moobot = function(a) {
  4170.     a.user = {
  4171.         username: function() {
  4172.             if ("undefined" !== typeof $.cookie("login") && "undefined" !== typeof $.cookie("token")) return $.cookie("login")
  4173.         },
  4174.         token: function() {
  4175.             if ("undefined" !== typeof $.cookie("token")) return $.cookie("token")
  4176.         },
  4177.         loggedin: function() {
  4178.             return "undefined" !== typeof Moobot.user.username()
  4179.         },
  4180.         login: function(a, c, b) {
  4181.             "undefined" !== typeof a && "undefined" !== typeof c && (b = "undefined" !== typeof b && (b instanceof Date || "number" === typeof b) ? new Date(b) : 29, $.cookie("login", a, {
  4182.                     expires: b,
  4183.                     path: "/"
  4184.                 }),
  4185.                 $.cookie("token", c, {
  4186.                     expires: b,
  4187.                     path: "/"
  4188.                 }), $.cookie("welcome", !0, {
  4189.                     expires: 365,
  4190.                     path: "/"
  4191.                 }), Moobot.event.trigger("User/login"))
  4192.         },
  4193.         logout: function() {
  4194.             if (Moobot.user.loggedin()) {
  4195.                 var d = setTimeout(function() {
  4196.                     Moobot.event.trigger("User/logout")
  4197.                 }, 5E3);
  4198.                 a.api.request("/user/logout", {
  4199.                     callback: function() {
  4200.                         clearTimeout(d);
  4201.                         Moobot.event.trigger("User/logout")
  4202.                     },
  4203.                     error: function() {
  4204.                         clearTimeout(d);
  4205.                         Moobot.event.trigger("User/logout")
  4206.                     }
  4207.                 });
  4208.                 $.removeCookie("login", {
  4209.                     path: "/"
  4210.                 });
  4211.                 $.removeCookie("token", {
  4212.                     path: "/"
  4213.                 })
  4214.             }
  4215.         },
  4216.         regex: /^[a-zA-Z0-9_]{2,25}$/,
  4217.         valid: function(a) {
  4218.             return Moobot.user.regex.test(a)
  4219.         }
  4220.     };
  4221.     return a
  4222. }(Moobot || {});
  4223. Moobot = function(a) {
  4224.     a.dashboard = {
  4225.         dashboard: function() {
  4226.             return window.location.pathname.replace("/", "").toLowerCase()
  4227.         }
  4228.     };
  4229.     return a
  4230. }(Moobot || {});
  4231. Moobot = function(a) {
  4232.     var d = function(a) {
  4233.         try {
  4234.             "undefined" !== typeof a.abort && a.abort()
  4235.         } catch (b) {}
  4236.     };
  4237.     a.api = {
  4238.         abort: d,
  4239.         request: function(a, b) {
  4240.             b = $.extend({
  4241.                 version: 1,
  4242.                 params: {},
  4243.                 timeout: 1E4,
  4244.                 error: function(a) {
  4245.                     Moobot.api.error(a)
  4246.                 }
  4247.             }, b);
  4248.             b.params.auth_token = Moobot.user.token();
  4249.             var e = null,
  4250.                 f = setTimeout(function() {
  4251.                     null !== e && (d(e), b.error({
  4252.                         message: "Could not connect to service, try again later",
  4253.                         error: "API",
  4254.                         status: 1
  4255.                     }))
  4256.                 }, b.timeout);
  4257.             return e = $.getJSON(location.protocol + "//api." + location.hostname + "/" + b.version + a + "?callback=?",
  4258.                 b.params,
  4259.                 function(a) {
  4260.                     null !== f && clearTimeout(f);
  4261.                     "undefined" !== typeof a && null !== a && "undefined" !== typeof a.error ? b.error(a) : "undefined" !== typeof b.callback && b.callback(a)
  4262.                 }).fail(function() {
  4263.                 null !== f && clearTimeout(f);
  4264.                 "abort" !== e.statusText && b.error({
  4265.                     message: "Could not connect to service, try again later",
  4266.                     error: "API",
  4267.                     status: 0
  4268.                 })
  4269.             })
  4270.         },
  4271.         error: function(a) {
  4272.             a = $.extend({
  4273.                 message: "An unknown error occured",
  4274.                 error: "Error",
  4275.                 status: 0
  4276.             }, $.isPlainObject(a) ? a : {});
  4277.             Moobot.event.trigger("Api/error", a)
  4278.         }
  4279.     };
  4280.     return a
  4281. }(Moobot || {});
  4282. Moobot.event.subscribe("Api/error", function(a) {
  4283.     "undefined" !== typeof _gaq && _gaq.push(["_trackEvent", "API", "Error", a.error])
  4284. });
  4285. Moobot = function(a) {
  4286.     a.misc = $.extend(a.misc || {}, {
  4287.         numberFormat: function(a) {
  4288.             x = (a + "").split(".");
  4289.             x1 = x[0];
  4290.             x2 = 1 < x.length ? "." + x[1] : "";
  4291.             for (a = /(\d+)(\d{3})/; a.test(x1);) x1 = x1.replace(a, "$1,$2");
  4292.             return x1 + x2
  4293.         },
  4294.         sentenceCase: function(a) {
  4295.             return a.charAt(0).toUpperCase() + a.substr(1)
  4296.         },
  4297.         regexEscape: function(a) {
  4298.             return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08")
  4299.         }
  4300.     });
  4301.     return a
  4302. }(Moobot || {});
  4303. Moobot = function(a) {
  4304.     a.misc = $.extend(a.misc || {}, {
  4305.         scrollbar: {
  4306.             show: function() {
  4307.                 $("body").css({
  4308.                     "margin-left": "0",
  4309.                     overflow: "auto"
  4310.                 });
  4311.                 $.each([".navbar-fixed-top .navbar-inner", ".subnavbar .subnavbar-inner", ".main .main-inner", "#footer"], function(a, c) {
  4312.                     $(c).removeAttr("style")
  4313.                 })
  4314.             },
  4315.             hide: function() {
  4316.                 var a = $(document).outerHeight(!0) > $(window).outerHeight(!0),
  4317.                     c = 979 < $(window).outerWidth(!0);
  4318.                 if (a) {
  4319.                     var b = function() {
  4320.                         var a, b;
  4321.                         void 0 === b && (a = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),
  4322.                             b = a.children(), b = b.innerWidth() - b.height(99).innerWidth(), a.remove());
  4323.                         return b
  4324.                     }();
  4325.                     c ? $("body").css("margin-left", -b) : $.each([".navbar-fixed-top .navbar-inner", ".subnavbar .subnavbar-inner", ".main .main-inner", "#footer"], function(a, c) {
  4326.                         $(c).css("padding-right", parseInt($(c).css("padding-right"), 10) + b)
  4327.                     })
  4328.                 }
  4329.                 $("body").css("overflow", "hidden")
  4330.             }
  4331.         }
  4332.     });
  4333.     return a
  4334. }(Moobot || {});
  4335. Moobot = function(a) {
  4336.     var d = function(a) {
  4337.         var b = function(a, b) {
  4338.             var c = a[b];
  4339.             "string" === typeof c ? a[b] = _.escape(c) : "object" === typeof c && d(c)
  4340.         };
  4341.         if (a instanceof Array) $.each(a, function(d, e) {
  4342.             b(a, d)
  4343.         });
  4344.         else if ("object" === typeof a)
  4345.             for (var e in a) b(a, e)
  4346.     };
  4347.     a.misc = $.extend(a.misc || {}, {
  4348.         escapeObject: d
  4349.     });
  4350.     return a
  4351. }(Moobot || {});
  4352. Moobot = function(a) {
  4353.     var d = [],
  4354.         c = function(a, b) {
  4355.             for (var c = 0; c < d.length; c++)
  4356.                 if (d[c].name === a && d[c].type === b) return d[c]
  4357.         },
  4358.         b = function(a, b, d, e) {
  4359.             a = c(a, b);
  4360.             "undefined" === typeof a.callbacks && (a.callbacks = []);
  4361.             a.callbacks.push({
  4362.                 callback: d || $.noop,
  4363.                 error: e || $.noop
  4364.             })
  4365.         },
  4366.         e = function(a, b, d) {
  4367.             a = c(a, b);
  4368.             d || (a.loaded = !0);
  4369.             $.map(a.callbacks || [], function(a) {
  4370.                 d ? a.error() : a.callback()
  4371.             });
  4372.             a.callbacks = [];
  4373.             delete a.request
  4374.         };
  4375.     a.resource = {
  4376.         add: function(a) {
  4377.             d.push($.extend(a, {
  4378.                 loaded: !1
  4379.             }))
  4380.         },
  4381.         remove: function(a) {
  4382.             d = $.grep(d, function(b) {
  4383.                 return b.name !==
  4384.                     a
  4385.             })
  4386.         },
  4387.         fetch: function(a) {
  4388.             var d = c(a.name, a.type);
  4389.             if ("undefined" !== typeof d)
  4390.                 if (d.loaded) "undefined" !== typeof a.callback && a.callback();
  4391.                 else if ("undefined" === typeof d.request) {
  4392.                 b(a.name, a.type, a.callback || $.noop, a.error || $.noop);
  4393.                 var g;
  4394.                 if ("js" === d.type) g = $.getScript(d.path, function() {
  4395.                     e(a.name, a.type, !1)
  4396.                 }).fail(function() {
  4397.                     "abort" !== g.statusText ? e(a.name, a.type, !0) : (delete d.request, d.callbacks = [])
  4398.                 });
  4399.                 else if ("css" === d.type) g = $.get(d.path, function(b) {
  4400.                     $("<style />").text(b).appendTo($("head"));
  4401.                     e(a.name, a.type, !1)
  4402.                 }).fail(function() {
  4403.                     "abort" !== g.statusText ? e(a.name, a.type, !0) : (delete d.request, d.callbacks = [])
  4404.                 });
  4405.                 else if ("template" === d.type) g = $.get(d.path, function(b) {
  4406.                     0 < b.length && $("body").append(b);
  4407.                     e(a.name, a.type, !1)
  4408.                 }).fail(function() {
  4409.                     "abort" !== g.statusText ? e(a.name, a.type, !0) : (delete d.request, d.callbacks = [])
  4410.                 });
  4411.                 else {
  4412.                     e(a.name, a.type, !1);
  4413.                     return
  4414.                 }
  4415.                 if ("undefined" !== typeof g) return d.request = g
  4416.             } else b(a.name, a.type, a.callback || $.noop, a.error || $.noop)
  4417.         }
  4418.     };
  4419.     return a
  4420. }(Moobot || {});
  4421. Moobot.resource.add({
  4422.     name: "localforage",
  4423.     type: "js",
  4424.     path: Moobot.paths.js + "ext/localforage.js"
  4425. });
  4426. Moobot = function(a) {
  4427.     var d = function() {
  4428.         return Modernizr.localstorage
  4429.     };
  4430.     a.storage = {
  4431.         support: d,
  4432.         get: function(a) {
  4433.             if (d() && null !== localStorage["moobot." + a]) return localStorage["moobot." + a]
  4434.         },
  4435.         set: function(a, b) {
  4436.             d() && (localStorage["moobot." + a] = b)
  4437.         }
  4438.     };
  4439.     return a
  4440. }(Moobot || {});
  4441. Moobot = function(a) {
  4442.     var d = {
  4443.             FAIL: "fail",
  4444.             FETCH: "fetch"
  4445.         },
  4446.         c = function() {
  4447.             var a = !1;
  4448.             try {
  4449.                 new Blob([new Int8Array([17, -45.3])], {
  4450.                     type: "image/jpeg"
  4451.                 }), a = !0
  4452.             } catch (b) {}
  4453.             return Moobot.storage.support() && a
  4454.         },
  4455.         b = function(a) {
  4456.             c() ? Moobot.resource.fetch({
  4457.                 name: "localforage",
  4458.                 type: "js",
  4459.                 callback: function() {
  4460.                     localforage.config({
  4461.                         name: "moobot_filestorage",
  4462.                         version: 1,
  4463.                         size: 4980736,
  4464.                         description: "Moobot File Storage"
  4465.                     });
  4466.                     a(null)
  4467.                 },
  4468.                 error: function() {
  4469.                     a(d.FETCH)
  4470.                 }
  4471.             }) : a(d.FAIL)
  4472.         };
  4473.     a.storage = $.extend(a.storage || {}, {
  4474.         filestorage: {
  4475.             error: d,
  4476.             supported: c,
  4477.             init: b,
  4478.             set: function(a, f, h) {
  4479.                 c() && "undefined" !== typeof a && "undefined" !== typeof f && f instanceof File ? b(function(b) {
  4480.                     null === b ? (b = new FileReader, b.onloadend = function(b) {
  4481.                         if (b.target.readyState == FileReader.DONE) try {
  4482.                             localforage.setItem(a, {
  4483.                                 value: b.target.result,
  4484.                                 type: f.type
  4485.                             }, function(a) {
  4486.                                 h(null)
  4487.                             })
  4488.                         } catch (c) {
  4489.                             h(d.FAIL)
  4490.                         }
  4491.                     }, b.onerror = function() {
  4492.                         h(d.FAIL)
  4493.                     }, b.readAsArrayBuffer(f)) : h(b)
  4494.                 }) : h(d.FAIL)
  4495.             },
  4496.             get: function(a, f) {
  4497.                 c() ? b(function(b) {
  4498.                     null === b ? localforage.getItem(a, function(a) {
  4499.                         f(null, null !== a ? window.URL.createObjectURL(new Blob([a.value], {
  4500.                             type: a.type
  4501.                         })) : null)
  4502.                     }) : f(b)
  4503.                 }) : f(d.FAIL)
  4504.             },
  4505.             remove: function(a, f) {
  4506.                 c() ? b(function(b) {
  4507.                     null === b ? localforage.removeItem(a, function(a) {
  4508.                         f(null)
  4509.                     }) : f(b)
  4510.                 }) : f(d.FAIL)
  4511.             }
  4512.         }
  4513.     });
  4514.     return a
  4515. }(Moobot || {});
  4516. Moobot = function(a) {
  4517.     a.widgets = {
  4518.         list: [],
  4519.         contains: function(a) {
  4520.             if ("undefined" !== typeof a)
  4521.                 for (var c = 0; c < Moobot.widgets.list.length; c++)
  4522.                     if (Moobot.widgets.list[c].id === a) return !0;
  4523.             return !1
  4524.         },
  4525.         get: function(a) {
  4526.             if ("undefined" !== typeof a)
  4527.                 for (var c = 0; c < Moobot.widgets.list.length; c++)
  4528.                     if (Moobot.widgets.list[c].id === a) return Moobot.widgets.list[c]
  4529.         },
  4530.         add: function(a, c, b, e) {
  4531.             Moobot.widgets.contains(a) || (c = {
  4532.                 id: a,
  4533.                 params: c,
  4534.                 callback: function() {
  4535.                     b(a)
  4536.                 },
  4537.                 populate: function() {
  4538.                     Moobot.event.trigger("Widget/populating", a);
  4539.                     e(a, function() {
  4540.                         Moobot.event.trigger("Widget/populated",
  4541.                             a)
  4542.                     })
  4543.                 }
  4544.             }, Moobot.widgets.list.push(c), Moobot.event.trigger("Widget/add", c))
  4545.         },
  4546.         populate: function(a) {
  4547.             a = Moobot.widgets.get(a);
  4548.             "undefined" !== typeof a && a.populate()
  4549.         },
  4550.         update: function(a, c) {
  4551.             if (Moobot.widgets.contains(a))
  4552.                 for (var b = 0; b < Moobot.widgets.list.length; b++)
  4553.                     if (Moobot.widgets.list[b].id === a) return $.extend(Moobot.widgets.list[b], c), !0;
  4554.             return !1
  4555.         },
  4556.         visible: function(a) {
  4557.             a = Moobot.widgets.get(a);
  4558.             return "undefined" === typeof a.visible || a.visible
  4559.         },
  4560.         show: function(a) {
  4561.             Moobot.widgets.update(a, {
  4562.                 visible: !0
  4563.             }) && Moobot.event.trigger("Widget/toggle",
  4564.                 a)
  4565.         },
  4566.         hide: function(a) {
  4567.             Moobot.widgets.update(a, {
  4568.                 visible: !1
  4569.             }) && Moobot.event.trigger("Widget/toggle", a)
  4570.         }
  4571.     };
  4572.     return a
  4573. }(Moobot || {});
  4574. Moobot.event.subscribe("Widget/toggle", function(a) {
  4575.     Moobot.storage.set("widgets." + a + ".visible", Moobot.widgets.visible(a))
  4576. });
  4577. Moobot.event.subscribe("Widget/populated", function(a) {
  4578.     var d = Moobot.storage.get("widgets." + a + ".visible");
  4579.     "undefined" === typeof d || "true" !== d && Moobot.widgets.hide(a)
  4580. });
  4581. Moobot.event.subscribe("Widget/populated", function(a) {
  4582.     $("input, textarea").placeholder()
  4583. });
  4584. Moobot.event.subscribe("Widget/add", function(a) {
  4585.     "undefined" !== typeof a.params.after && 0 < $("." + a.params.after).length ? $(kite("#" + a.params.template, a)).insertAfter("." + a.params.after) : $(".widget-container-" + a.params.type).append(kite("#" + a.params.template, a));
  4586.     a.callback(a.id);
  4587.     a.populate()
  4588. });
  4589. Moobot.event.subscribe("Widget/populating", function(a) {
  4590.     $("." + a).find(".widget-content").addClass("widget-loading");
  4591.     $("." + a).find(".widget-content").empty()
  4592. });
  4593. Moobot.event.subscribe("Widget/populated", function(a) {
  4594.     $("." + a).find(".widget-content").removeClass("widget-loading")
  4595. });
  4596. Moobot.event.subscribe("Widget/toggle", function(a) {
  4597.     Moobot.widgets.visible(a) ? $("." + a).find(".widget-content").removeClass("hide") : $("." + a).find(".widget-content").addClass("hide")
  4598. });
  4599. Moobot = function(a) {
  4600.     a.widgets.data = function(a, c) {
  4601.         "" !== c && null !== c ? $("." + a + " .widget-content").html(c) : $("." + a + " .widget-content").empty()
  4602.     };
  4603.     return a
  4604. }(Moobot || {});
  4605. Moobot = function(a) {
  4606.     a.widgets.buttons = {
  4607.         disable: function(a) {
  4608.             a.addClass("disabled");
  4609.             setTimeout($.proxy(function() {
  4610.                 $(this).removeClass("disabled")
  4611.             }, a), 5E3)
  4612.         },
  4613.         btnrefresh: function(a) {
  4614.             var c = $(kite("#template-widget-button", {
  4615.                 class_name: "btn-refresh",
  4616.                 icon: "icon-refresh"
  4617.             })).appendTo("." + a + " .widget-header .btn-group").click(function() {
  4618.                 $(this).hasClass("disabled") || (Moobot.widgets.buttons.disable($(this)), Moobot.widgets.get(a).populate())
  4619.             });
  4620.             Modernizr.touch || c.tooltip({
  4621.                 title: "Refresh"
  4622.             })
  4623.         },
  4624.         btncustom: function(a,
  4625.             c) {
  4626.             var b = $(kite("#template-widget-button", {
  4627.                 class_name: c.class_name,
  4628.                 icon: c.icon
  4629.             })).appendTo("." + a + " " + ("undefined" !== typeof c.container ? c.container : ".widget-header") + " .btn-group");
  4630.             Modernizr.touch || b.tooltip({
  4631.                 title: c.tooltip
  4632.             });
  4633.             return b
  4634.         },
  4635.         btnleft: function(a) {
  4636.             return Moobot.widgets.buttons.btncustom(a, {
  4637.                 class_name: "btn-nav btn-nav-left",
  4638.                 icon: "icon-chevron-left",
  4639.                 tooltip: "Previous"
  4640.             })
  4641.         },
  4642.         btnright: function(a) {
  4643.             return Moobot.widgets.buttons.btncustom(a, {
  4644.                 class_name: "btn-nav btn-nav-right",
  4645.                 icon: "icon-chevron-right",
  4646.                 tooltip: "Next"
  4647.             })
  4648.         },
  4649.         btnpopout: function(a) {
  4650.             return Moobot.widgets.buttons.btncustom(a, {
  4651.                 class_name: "btn-popout",
  4652.                 icon: "icon-external-link",
  4653.                 tooltip: "Pop-out"
  4654.             })
  4655.         },
  4656.         btnzoomin: function(a) {
  4657.             return Moobot.widgets.buttons.btncustom(a, {
  4658.                 class_name: "btn-zoom-in",
  4659.                 icon: "icon-zoom-in",
  4660.                 tooltip: "Zoom-in"
  4661.             })
  4662.         },
  4663.         btnzoomout: function(a) {
  4664.             return Moobot.widgets.buttons.btncustom(a, {
  4665.                 class_name: "btn-zoom-out",
  4666.                 icon: "icon-zoom-out",
  4667.                 tooltip: "Zoom-out"
  4668.             })
  4669.         },
  4670.         btntoggle: function(a) {
  4671.             var c = $(kite("#template-widget-button", {
  4672.                 class_name: "btn-toggle",
  4673.                 icon: "icon-minus"
  4674.             })).appendTo("." + a + " .widget-header .btn-group").click(function() {
  4675.                 $(this).hasClass("disabled") || (Moobot.widgets.visible(a) ? Moobot.widgets.hide(a) : Moobot.widgets.show(a))
  4676.             });
  4677.             Modernizr.touch || c.tooltip({
  4678.                 title: "Hide"
  4679.             });
  4680.             0 < $("." + a + " .widget-header .btn-toggle").length && $("." + a).find(".widget-header").click(function() {
  4681.                 Moobot.widgets.visible(a) ? Moobot.widgets.hide(a) : Moobot.widgets.show(a)
  4682.             }).children().click(function() {
  4683.                 return $(this).is("h1, h2, h3, h4, h5, h6")
  4684.             })
  4685.         }
  4686.     };
  4687.     return a
  4688. }(Moobot || {});
  4689. Moobot.event.subscribe("Widget/toggle", function(a) {
  4690.     var d = function(a) {
  4691.             return a ? "icon-minus" : "icon-plus"
  4692.         },
  4693.         c = function(a) {
  4694.             return a ? "Hide" : "Show"
  4695.         },
  4696.         b = $("." + a + " .widget-header .btn-toggle");
  4697.     0 < $(b).length && (Modernizr.touch || ($(b).tooltip("destroy"), $(b).tooltip({
  4698.         title: c(Moobot.widgets.visible(a))
  4699.     })), $(b).find("i").attr("class", d(Moobot.widgets.visible(a))))
  4700. });
  4701. Moobot = function(a) {
  4702.     var d = window.location.hash ? window.location.hash.substring(1) : null,
  4703.         c = function(a) {
  4704.             var c = Moobot.modals.current();
  4705.             $(".tooltip").remove();
  4706.             $(".popover").remove();
  4707.             "undefined" !== typeof c && $("#" + c).remove();
  4708.             "undefined" !== typeof a && a && ($(".modal-backdrop").remove(), "undefined" !== typeof c && $("body").removeClass("modal-open"));
  4709.             return c
  4710.         };
  4711.     a.modals = {
  4712.         hash: d,
  4713.         list: [],
  4714.         contains: function(a) {
  4715.             if ("undefined" !== typeof a)
  4716.                 for (var c = 0; c < Moobot.modals.list.length; c++)
  4717.                     if (Moobot.modals.list[c].id === a) return !0;
  4718.             return !1
  4719.         },
  4720.         get: function(a) {
  4721.             if ("undefined" !== typeof a)
  4722.                 for (var c = 0; c < Moobot.modals.list.length; c++)
  4723.                     if (Moobot.modals.list[c].id === a) return Moobot.modals.list[c]
  4724.         },
  4725.         add: function(a, c, d) {
  4726.             Moobot.modals.contains(a) || (c = {
  4727.                 id: a,
  4728.                 params: c,
  4729.                 callback: function() {
  4730.                     d(a)
  4731.                 }
  4732.             }, Moobot.modals.list.push(c), Moobot.event.trigger("Modal/add", c))
  4733.         },
  4734.         update: function(a, c) {
  4735.             if (Moobot.modals.contains(a))
  4736.                 for (var d = 0; d < Moobot.modals.list.length; d++)
  4737.                     if (Moobot.modals.list[d].id === a) return $.extend(Moobot.modals.list[d], c), !0;
  4738.             return !1
  4739.         },
  4740.         current: function() {
  4741.             if (0 <
  4742.                 $(".modal").length) return $(".modal").attr("id")
  4743.         },
  4744.         show: function(a) {
  4745.             Moobot.event.trigger("Modal/show", a)
  4746.         },
  4747.         hide: function(a) {
  4748.             Moobot.event.trigger("Modal/hide", a)
  4749.         },
  4750.         close: function(a) {
  4751.             Moobot.event.trigger("Modal/close", a)
  4752.         },
  4753.         clean: c,
  4754.         destroy: function() {
  4755.             "undefined" !== typeof c(!0) && Moobot.event.trigger("Modal/destroy")
  4756.         },
  4757.         backdrop: function() {
  4758.             $(".modal-backdrop.in").height() < $(document).height() && $(".modal-backdrop.in").height($(document).height())
  4759.         }
  4760.     };
  4761.     return a
  4762. }(Moobot || {});
  4763. Moobot = function(a) {
  4764.     var d = [];
  4765.     Moobot.event.subscribe("Modal/show", function(a) {
  4766.         0 < d.length && d[d.length - 1] === a && d.pop();
  4767.         d.push(a)
  4768.     });
  4769.     Moobot.event.subscribe("Modal/hide", function(a) {
  4770.         d.pop()
  4771.     });
  4772.     Moobot.event.subscribe("Modal/destroy", function(a) {
  4773.         d = []
  4774.     });
  4775.     a.modals.open = function() {
  4776.         return d
  4777.     };
  4778.     return a
  4779. }(Moobot || {});
  4780. Moobot = function(a) {
  4781.     var d = [],
  4782.         c = function(a) {
  4783.             d = $.grep(d, function(b) {
  4784.                 return b !== a
  4785.             })
  4786.         },
  4787.         b = function(a) {
  4788.             try {
  4789.                 "undefined" !== typeof a.abort && a.abort()
  4790.             } catch (b) {}
  4791.         };
  4792.     a.modals.requests = {
  4793.         add: function(a) {
  4794.             d.push(a)
  4795.         },
  4796.         remove: c,
  4797.         abort: b,
  4798.         clear: function() {
  4799.             $.each(d, function(a, d) {
  4800.                 b(d);
  4801.                 c(d)
  4802.             })
  4803.         }
  4804.     };
  4805.     return a
  4806. }(Moobot || {});
  4807. Moobot.event.subscribe("Modal/show", function(a) {
  4808.     Moobot.modals.clean(!1);
  4809.     var d = Moobot.modals.get(a);
  4810.     $("body").append(kite("#" + d.params.template, {
  4811.         title: d.params.title,
  4812.         id: a
  4813.     }));
  4814.     $("#" + a).on("hidden", function() {
  4815.         Moobot.modals.hide(a)
  4816.     });
  4817.     d.callback();
  4818.     d = {};
  4819.     0 === $(".modal-backdrop").length ? d.backdrop = "static" : d.backdrop = !1;
  4820.     $("#" + a).modal(d);
  4821.     d.backdrop && $(".modal-backdrop").click(function() {
  4822.         var a = Moobot.modals.current();
  4823.         0 < $(".modal.fade.in").length && "undefined" !== typeof a && "undefined" === typeof Moobot.modals.get(a).params["static"] &&
  4824.             $(".modal").modal("hide")
  4825.     });
  4826.     Moobot.modals.backdrop();
  4827.     $("input, textarea").placeholder()
  4828. });
  4829. Moobot.event.subscribe("Modal/loaded", function(a) {
  4830.     $("input, textarea").placeholder()
  4831. });
  4832. Moobot.event.subscribe("Modal/show", function(a) {
  4833.     "undefined" !== typeof _gaq && _gaq.push(["_trackEvent", "Modal", "Show", a])
  4834. });
  4835. Moobot.event.subscribe("Modal/hide", function(a) {
  4836.     Moobot.modals.requests.clear();
  4837.     0 < Moobot.modals.open().length ? Moobot.modals.show(Moobot.modals.open()[Moobot.modals.open().length - 1]) : Moobot.modals.destroy()
  4838. });
  4839. Moobot.event.subscribe("Modal/close", function(a) {
  4840.     Moobot.modals.requests.clear();
  4841.     $("#" + a).modal("hide")
  4842. });
  4843. $(window).resize(function() {
  4844.     $("body .modal-backdrop.in").length && Moobot.modals.backdrop()
  4845. });
  4846. Moobot.event.subscribe("Modal/show", function(a) {
  4847.     Moobot.misc.scrollbar.hide()
  4848. });
  4849. (function() {
  4850.     var a = function() {
  4851.         "undefined" === typeof Moobot.modals.get(Moobot.modals.current()) && Moobot.misc.scrollbar.show()
  4852.     };
  4853.     Moobot.event.subscribe("Modal/hide", a);
  4854.     Moobot.event.subscribe("Modal/destroy", a)
  4855. })();
  4856. Moobot.event.subscribe("Loaded", function() {
  4857.     null !== Moobot.modals.hash && $.map(Moobot.modals.list, function(a) {
  4858.         "undefined" !== typeof a.params.hash && a.params.hash === Moobot.modals.hash && Moobot.modals.show(a.id)
  4859.     })
  4860. });
  4861. Moobot.event.subscribe("Modal/show", function(a) {
  4862.     "undefined" !== typeof Moobot.modals.get(a).params.hash && setTimeout(function() {
  4863.         "undefined" !== typeof Moobot.modals.current() && Moobot.modals.current() === a && (window.location.hash = Moobot.modals.get(a).params.hash)
  4864.     }, 200)
  4865. });
  4866. Moobot.event.subscribe("Modal/hide", function() {
  4867.     window.location.hash = ""
  4868. });
  4869. Moobot.event.subscribe("Modal/destroy", function() {
  4870.     window.location.hash = ""
  4871. });
  4872. Moobot = function(a) {
  4873.     a.modals.search = function(a) {
  4874.         a = $.extend({
  4875.             placeholder: "Search",
  4876.             formatQuery: function(a) {
  4877.                 return a
  4878.             },
  4879.             search: $.noop
  4880.         }, a);
  4881.         var c = $('<input id="inputSearch" class="span12" type="text" placeholder="' + a.placeholder + '">').bind("propertychange input paste", function() {
  4882.             var b = a.formatQuery($(this).val()).toLowerCase(),
  4883.                 c = $(a.table).find("tbody tr");
  4884.             "" !== b && $.map(c, function(c) {
  4885.                 var e = _.unescape($(c).data(a.key)).toLowerCase(),
  4886.                     g = (new Levenshtein(b, e)).distance;
  4887.                 e.substr(0, b.length) === b && 0 !== g && (g = 1);
  4888.                 $(c).data("distance", g)
  4889.             });
  4890.             c.sort(function(c, e) {
  4891.                 if ("" !== b) {
  4892.                     var g = parseInt($(c).data("distance"), 10),
  4893.                         m = parseInt($(e).data("distance"), 10);
  4894.                     return g == m ? 0 : g > m ? 1 : -1
  4895.                 }
  4896.                 return _.unescape($(c).data(a.key)).toLowerCase() > _.unescape($(e).data(a.key)).toLowerCase() ? 1 : -1
  4897.             });
  4898.             c.detach().appendTo($(a.table).find("tbody"));
  4899.             a.search()
  4900.         });
  4901.         $(c).keypress(function(b) {
  4902.             13 === b.which && (0 < $(this).val().length && 0 < $(a.table).find("tbody tr").length && "undefined" !== typeof a.action && a.action($($(a.table).find("tbody tr")[0])), b.preventDefault())
  4903.         });
  4904.         return c
  4905.     };
  4906.     return a
  4907. }(Moobot || {});
  4908. Moobot = function(a) {
  4909.     var d = !1;
  4910.     a.information = {
  4911.         send: function(a) {
  4912.             var b = "undefined" !== typeof a.append_type ? a.append_type : "appendTo",
  4913.                 d = $(kite("#template-information", {
  4914.                     type: a.type,
  4915.                     body: ("undefined" !== typeof a.heading ? '<h4 class="alert-heading">' + a.heading + "</h4>" : "") + "<p>" + a.message + "</p>"
  4916.                 }))[b]("undefined" === typeof a.container ? ".information-container" : a.container);
  4917.             d.hide();
  4918.             d.slideDown("slow", function() {
  4919.                 if ("undefined" === typeof a.hide || a.hide) {
  4920.                     $(d).addClass("alert-fade");
  4921.                     var b = function() {
  4922.                             return $('div[class*="alert-fade"]').length
  4923.                         },
  4924.                         h = function() {
  4925.                             d.slideUp("slow", function() {
  4926.                                 d.remove()
  4927.                             })
  4928.                         },
  4929.                         g = !1,
  4930.                         m = !1,
  4931.                         k = function() {
  4932.                             Moobot.information.delay() ? setTimeout(k, 15E3 * (0 < b() ? b() : 1)) : (m || h(), g = !0)
  4933.                         };
  4934.                     setTimeout(k, 15E3 * (0 < b() ? b() : 1));
  4935.                     d.mouseenter(function() {
  4936.                         m = !0
  4937.                     }).mouseleave(function() {
  4938.                         m = !1;
  4939.                         g && h()
  4940.                     })
  4941.                 }
  4942.             });
  4943.             "undefined" !== typeof a.silent && a.silent || (Moobot.modals.destroy(), ("undefined" === typeof a.scroll || a.scroll) && $("html, body").animate({
  4944.                 scrollTop: $("body").offset().top
  4945.             }, 500))
  4946.         },
  4947.         warning: function(a, b) {
  4948.             Moobot.information.send({
  4949.                 message: a,
  4950.                 heading: b,
  4951.                 hide: !1
  4952.             })
  4953.         },
  4954.         error: function(a, b) {
  4955.             Moobot.information.send({
  4956.                 message: a,
  4957.                 heading: b,
  4958.                 type: "alert-error"
  4959.             })
  4960.         },
  4961.         success: function(a, b) {
  4962.             Moobot.information.send({
  4963.                 message: a,
  4964.                 heading: b,
  4965.                 type: "alert-success"
  4966.             })
  4967.         },
  4968.         info: function(a, b) {
  4969.             Moobot.information.send({
  4970.                 message: a,
  4971.                 heading: b,
  4972.                 type: "alert-info"
  4973.             })
  4974.         },
  4975.         delay: function(a) {
  4976.             "boolean" === typeof a && (d = a);
  4977.             return d
  4978.         }
  4979.     };
  4980.     return a
  4981. }(Moobot || {});
  4982. $.ajaxSetup({
  4983.     cache: !0
  4984. });
  4985. $.fn.typeahead.Constructor.prototype.lookup = function() {
  4986.     var a;
  4987.     this.query = this.$element.val() || "";
  4988.     return this.query.length < this.options.minLength ? this.shown ? this.hide() : this : (a = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source) ? this.process(a) : this
  4989. };
  4990. $.fn.typeahead.Constructor.prototype.highlighter = function(a) {
  4991.     var d = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
  4992.     return a.replace(new RegExp("(" + d + ")", "ig"), function(a, b) {
  4993.         return b
  4994.     })
  4995. };
  4996. $.fn.typeahead.Constructor.prototype.render = function(a) {
  4997.     var d = this;
  4998.     a = $(a).map(function(a, b) {
  4999.         a = $(d.options.item).attr("data-value", b);
  5000.         a.find("a").html(_.escape(d.highlighter(b)));
  5001.         return a[0]
  5002.     });
  5003.     a.first().addClass("active");
  5004.     this.$menu.html(a);
  5005.     return this
  5006. };
  5007. Moobot.event.subscribe("Api/error", function(a) {
  5008.     Moobot.information.error(a.message, "Oops!")
  5009. });
  5010. Moobot.event.subscribe("Api/error", function(a) {
  5011.     "Not authorized" === a.message && Moobot.user.logout()
  5012. });
  5013. Moobot = function(a) {
  5014.     a.dashboard.access = function() {
  5015.         return Moobot.user.username() === Moobot.dashboard.dashboard() || -1 !== $.inArray(Moobot.dashboard.dashboard(), Moobot.dashboard.list) || "undefined" !== typeof Moobot.dashboard.special && Moobot.dashboard.special
  5016.     };
  5017.     return a
  5018. }(Moobot || {});
  5019. Moobot = function(a) {
  5020.     a.dashboard.init = {
  5021.         any: function() {
  5022.             var a = Moobot.dashboard.access() ? "editor" : "guest",
  5023.                 c = {
  5024.                     templates: function(b) {
  5025.                         $.get(Moobot.paths.templates + "dashboard." + a + ".php", function(a) {
  5026.                             0 < a.length ? ($("body").append(a), b(null)) : b("Fail")
  5027.                         }).fail(function() {
  5028.                             b("Fail")
  5029.                         })
  5030.                     },
  5031.                     js: function(b) {
  5032.                         $.getScript(Moobot.paths.js + "dashboard." + a + ".js", function() {
  5033.                             b(null)
  5034.                         }).fail(function() {
  5035.                             b("Fail")
  5036.                         })
  5037.                     }
  5038.                 };
  5039.             Moobot.dashboard.access() && (c.features_user = function(a) {
  5040.                 Moobot.api.request("/user/features", {
  5041.                     callback: function(c) {
  5042.                         "undefined" !==
  5043.                         typeof c.features && c.features instanceof Array ? a(null, c.features) : a("Fail")
  5044.                     },
  5045.                     error: function(c) {
  5046.                         a("Fail", c)
  5047.                     }
  5048.                 })
  5049.             }, c.features_channel = function(a) {
  5050.                 Moobot.api.request("/channel/features", {
  5051.                     callback: function(c) {
  5052.                         "undefined" !== typeof c.features && c.features instanceof Array ? a(null, c.features) : a("Fail")
  5053.                     },
  5054.                     params: {
  5055.                         channel: Moobot.dashboard.dashboard()
  5056.                     },
  5057.                     error: function(c) {
  5058.                         a("Fail", c)
  5059.                     }
  5060.                 })
  5061.             });
  5062.             async.parallel(c, function(b, c) {
  5063.                 null === b && (Moobot.user.loggedin() ? (Moobot.dashboard.special && Moobot.information.info("Your user account has been detected as a special user, meaning you can access any dashboard by simply navigating to it",
  5064.                     "Special user"), Moobot.widgets.add("widget-dashboard", {
  5065.                     title: "Dashboard",
  5066.                     icon: "icon-dashboard",
  5067.                     type: "right",
  5068.                     template: "template-widget"
  5069.                 }, function(a) {
  5070.                     Moobot.widgets.buttons.btntoggle(a)
  5071.                 }, function(a, b) {
  5072.                     Moobot.widgets.data(a, kite("#template-widget-dashboard", {}));
  5073.                     if (Moobot.dashboard.special) $("." + a + " #inputWidgetDashboardNavigate").selectize({
  5074.                         valueField: "name",
  5075.                         labelField: "name",
  5076.                         searchField: "name",
  5077.                         options: [],
  5078.                         create: !0,
  5079.                         highlight: !1,
  5080.                         loadThrottle: 100,
  5081.                         addPrecedence: !0,
  5082.                         render: {
  5083.                             option: function(a, b) {
  5084.                                 return kite("#template-widget-dashboard-dropdown",
  5085.                                     $.extend(a, {
  5086.                                         img: "undefined" !== typeof a.logo && null !== a.logo ? a.logo.replace("300x300", "50x50") : Moobot.paths.img + "404_user_70x70.jpg",
  5087.                                         displayname: "undefined" !== typeof a.display_name ? a.display_name : Moobot.misc.sentenceCase(a.name)
  5088.                                     }))
  5089.                             },
  5090.                             option_create: function(a) {
  5091.                                 return '<div class="create">Navigate to <strong>' + _.escape(a.input) + "</strong>&hellip;</div>"
  5092.                             }
  5093.                         },
  5094.                         load: function(a, b) {
  5095.                             if (!a.length) return b();
  5096.                             Twitch.api.request("/search/channels", {
  5097.                                 version: 3,
  5098.                                 callback: function(a) {
  5099.                                     b(a.channels)
  5100.                                 },
  5101.                                 error: function(a) {
  5102.                                     Twitch.api.error(a);
  5103.                                     b()
  5104.                                 },
  5105.                                 params: {
  5106.                                     q: a,
  5107.                                     limit: 10
  5108.                                 }
  5109.                             })
  5110.                         },
  5111.                         create: function(a) {
  5112.                             return {
  5113.                                 name: a
  5114.                             }
  5115.                         },
  5116.                         onChange: function(a) {
  5117.                             Moobot.user.valid(a) && ("undefined" !== typeof _gaq && _gaq.push(["_trackEvent", "Interaction", "DashboardNavigation"]), setTimeout(function() {
  5118.                                 window.location.href = "/" + encodeURIComponent(a.toLowerCase())
  5119.                             }, 500))
  5120.                         }
  5121.                     });
  5122.                     else {
  5123.                         var c = 0,
  5124.                             d = function(a) {
  5125.                                 c + 1E4 <= Date.now() ? (c = Date.now(), Moobot.api.request("/user/dashboards", {
  5126.                                     callback: function(b) {
  5127.                                         var c = [];
  5128.                                         $.each(b.dashboards, function(a, b) {
  5129.                                             b !== Moobot.dashboard.dashboard() && c.push({
  5130.                                                 name: b
  5131.                                             })
  5132.                                         });
  5133.                                         Moobot.user.username() !== Moobot.dashboard.dashboard() && c.push({
  5134.                                             name: Moobot.user.username()
  5135.                                         });
  5136.                                         a(c)
  5137.                                     },
  5138.                                     error: function(b) {
  5139.                                         Moobot.api.error(b);
  5140.                                         a()
  5141.                                     }
  5142.                                 })) : a()
  5143.                             };
  5144.                         $("." + a + " #inputWidgetDashboardNavigate").selectize({
  5145.                             loadThrottle: 100,
  5146.                             valueField: "name",
  5147.                             labelField: "name",
  5148.                             searchField: "name",
  5149.                             options: [],
  5150.                             create: !1,
  5151.                             highlight: !1,
  5152.                             render: {
  5153.                                 option: function(a, b) {
  5154.                                     return kite("#template-widget-dashboard-dropdown", $.extend(a, {
  5155.                                         img: Moobot.paths.data + "/thumb/" + a.name,
  5156.                                         displayname: Moobot.misc.sentenceCase(a.name)
  5157.                                     }))
  5158.                                 }
  5159.                             },
  5160.                             load: function(a,
  5161.                                 b) {
  5162.                                 d(b)
  5163.                             },
  5164.                             onChange: function(a) {
  5165.                                 Moobot.user.valid(a) && ("undefined" !== typeof _gaq && _gaq.push(["_trackEvent", "Interaction", "DashboardNavigation"]), setTimeout(function() {
  5166.                                     window.location.href = "/" + encodeURIComponent(a.toLowerCase())
  5167.                                 }, 500))
  5168.                             }
  5169.                         });
  5170.                         $("." + a + " #inputWidgetDashboardNavigate + .selectize-control .selectize-input input").blur(function() {
  5171.                             c = 0;
  5172.                             $("." + a + " #inputWidgetDashboardNavigate")[0].selectize.clearOptions()
  5173.                         });
  5174.                         $("." + a + " #inputWidgetDashboardNavigate + .selectize-control .selectize-input input").focus(function() {
  5175.                             $("." +
  5176.                                 a + " #inputWidgetDashboardNavigate")[0].selectize.load(d)
  5177.                         });
  5178.                         0 === Moobot.dashboard.list.length && $("." + a).addClass("hide")
  5179.                     }
  5180.                     b()
  5181.                 })) : ($(".nav-login").click(function() {
  5182.                     $.cookie("redirectusername", Moobot.dashboard.dashboard(), {
  5183.                         expires: 1,
  5184.                         path: "/"
  5185.                     })
  5186.                 }), $(".alert-connect .close").click(function(a) {
  5187.                     $(this).parent(".alert").remove();
  5188.                     a.preventDefault();
  5189.                     return !1
  5190.                 })), Moobot.resource.add({
  5191.                     name: "chat-commands",
  5192.                     type: "template",
  5193.                     path: Moobot.paths.root + "commands"
  5194.                 }), Moobot.modals.add("modal-chat-commands", {
  5195.                     title: "Chat commands",
  5196.                     template: "template-modal",
  5197.                     hash: "commands"
  5198.                 }, function(a) {
  5199.                     $("#" + a + " .modal-body").addClass("modal-loading");
  5200.                     var b = [];
  5201.                     b.push(function(a) {
  5202.                         var b = Moobot.resource.fetch({
  5203.                             name: "chat-commands",
  5204.                             type: "template",
  5205.                             callback: function(c) {
  5206.                                 Moobot.modals.requests.remove(b);
  5207.                                 a(null)
  5208.                             },
  5209.                             error: function() {
  5210.                                 Moobot.modals.requests.remove(b);
  5211.                                 Moobot.information.error("Could not load chat command list", "Oops!");
  5212.                                 a("Fail")
  5213.                             }
  5214.                         });
  5215.                         Moobot.modals.requests.add(b)
  5216.                     });
  5217.                     async.parallel(b, function(b) {
  5218.                         $("#" + a + " .modal-body").removeClass("modal-loading");
  5219.                         null !== b ? Moobot.modals.close(a) : ($("#" + a + " .modal-body").append(kite("#template-modal-commandlist", {})), $("#" + a + " .modal-body").append(kite("#template-chat-commands", {})), Moobot.event.trigger("Modal/loaded", a))
  5220.                     })
  5221.                 }), $(".nav-commands").click(function(a) {
  5222.                     Moobot.modals.show("modal-chat-commands");
  5223.                     a.preventDefault()
  5224.                 }), Moobot.dashboard.init[a](), Moobot.dashboard.access() && $.map($.merge(c.features_user || [], c.features_channel || []), function(a) {
  5225.                     Moobot.features.set(a)
  5226.                 }))
  5227.             })
  5228.         }
  5229.     };
  5230.     return a
  5231. }(Moobot || {});
  5232. $(function() {
  5233.     $(".sticky-wrapper").addClass("page-loading");
  5234.     var a = {};
  5235.     Moobot.user.loggedin() && (a.dashboards = function(a) {
  5236.         Moobot.api.request("/user/dashboards", {
  5237.             callback: function(c) {
  5238.                 c.dashboards instanceof Array ? (Moobot.dashboard.list = c.dashboards, Moobot.dashboard.special = c.special, a(null)) : a("Fail")
  5239.             },
  5240.             error: function(c) {
  5241.                 a("Fail", c)
  5242.             }
  5243.         })
  5244.     });
  5245.     a.meta = function(a) {
  5246.         Moobot.api.request("/channel/meta", {
  5247.             callback: function(c) {
  5248.                 Moobot.dashboard.meta = c;
  5249.                 a(null)
  5250.             },
  5251.             params: {
  5252.                 channel: Moobot.dashboard.dashboard()
  5253.             },
  5254.             error: function(c) {
  5255.                 a("Fail",
  5256.                     c)
  5257.             }
  5258.         })
  5259.     };
  5260.     $.isEmptyObject(a) ? Moobot.dashboard.init.any() : async.series(a, function(a, c) {
  5261.         $(".sticky-wrapper").removeClass("page-loading");
  5262.         null === a ? Moobot.dashboard.init.any() : "undefined" !== typeof c.dashboards && 0 === c.dashboards.status && "API" === c.dashboards.error ? Moobot.information.send({
  5263.             message: c.dashboards.message,
  5264.             heading: "Oops!",
  5265.             type: "alert-error",
  5266.             hide: !1
  5267.         }) : "undefined" !== typeof c.meta && "Could not find channel" === c.meta.message ? (Moobot.dashboard.special || (Moobot.information.send({
  5268.             message: "Are you <code>" +
  5269.                 _.escape(Moobot.dashboard.dashboard()) + "</code>? Connect now to start using moobot.",
  5270.             heading: "Connect",
  5271.             type: "alert-info alert-connect",
  5272.             hide: !1
  5273.         }), $(".alert-connect").wrap("<a href=\"/r/login\" class=\"alert-link\" onClick=\"trackOutboundLink(this, {category: 'Login', action: 'Popup', label: 'New dashboard'}); return false;\" />"), $(".alert-connect .close").click(function(a) {
  5274.             $(this).parent(".alert").remove();
  5275.             a.preventDefault();
  5276.             return !1
  5277.         })), Moobot.user.loggedin() && Moobot.dashboard.special && (Moobot.information.send({
  5278.             message: "Since you're a special user, do you want to create the dashboard for <code>" +
  5279.                 _.escape(Moobot.dashboard.dashboard()) + "</code>? Click this alert to start using this dashboard now.",
  5280.             heading: "Create",
  5281.             type: "alert-info alert-create",
  5282.             hide: !1
  5283.         }), $(".alert-create").wrap('<a href="#" class="alert-link" />'), $(".alert-create").click(function(a) {
  5284.             $.msgbox("Are you sure you want to create the dashboard for <code>" + _.escape(Moobot.dashboard.dashboard()) + "</code>?", {
  5285.                 type: "confirm",
  5286.                 buttons: [{
  5287.                     type: "cancel",
  5288.                     value: "Cancel"
  5289.                 }, {
  5290.                     type: "submit",
  5291.                     value: "Create"
  5292.                 }]
  5293.             }, function(a) {
  5294.                 a && Moobot.api.request("/user/create", {
  5295.                     callback: function(a) {
  5296.                         null !== a && "undefined" !== typeof a.username && location.reload()
  5297.                     },
  5298.                     params: {
  5299.                         channel: Moobot.dashboard.dashboard()
  5300.                     }
  5301.                 })
  5302.             });
  5303.             a.preventDefault()
  5304.         }), $(".alert-create .close").click(function(a) {
  5305.             $(this).parent(".alert").remove();
  5306.             a.preventDefault();
  5307.             return !1
  5308.         }))) : "undefined" !== typeof c.dashboards ? Moobot.api.error(c.dashboards) : "undefined" !== typeof c.meta ? Moobot.api.error(c.meta) : Moobot.information.send({
  5309.             message: "An unexpected error occured while trying to load the dashboard. Please contact support as soon as possible.",
  5310.             heading: "Error!",
  5311.             type: "alert-error",
  5312.             hide: !1
  5313.         })
  5314.     })
  5315. });
  5316. $(function() {
  5317.     Moobot.user.loggedin() ? ($(".nav-logout").removeClass("hide"), $(".nav-dashboard").removeClass("hide"), Moobot.dashboard.dashboard() === Moobot.user.username() && $(".nav-dashboard").addClass("active"), $(".nav-dashboard a").attr("href", "/" + Moobot.user.username()), $(".nav-logout").click(function() {
  5318.         Moobot.user.logout()
  5319.     })) : $(".nav-login").removeClass("hide");
  5320.     switch (window.location.pathname) {
  5321.         case "/":
  5322.             $(".nav-login").addClass("active");
  5323.             break;
  5324.         case "/r/about":
  5325.             $(".nav-about").addClass("active")
  5326.     }
  5327. });
  5328. Moobot.event.subscribe("User/logout", function() {
  5329.     window.location.replace("/.")
  5330. });
  5331. $(function() {
  5332.     $("input, textarea").placeholder();
  5333.     $(".nav-commands").removeClass("hide");
  5334.     $("a.dropdown-toggle, .dropdown-menu a").on("touchstart", function(a) {
  5335.         a.stopPropagation()
  5336.     })
  5337. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement