/// <reference path="../../Misc/Typings/google.analytics.d.ts"/>
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var GoogleAnalytics = /** @class */ (function () {
            function GoogleAnalytics(trackingId) {
                !function (i, s, o, g, r, a, m) {
                    i['GoogleAnalyticsObject'] = r;
                    i[r] = i[r] || function () {
                        (i[r].q = i[r].q || []).push(arguments);
                    }, i[r].l = 1 * new Date();
                    a = s.createElement(o),
                        m = s.getElementsByTagName(o)[0];
                    a.async = 1;
                    a.src = g;
                    m.parentNode.insertBefore(a, m);
                }(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
                ga('create', trackingId, 'auto');
                ga('send', 'pageview');
            }
            return GoogleAnalytics;
        }());
        Common.GoogleAnalytics = GoogleAnalytics;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=google-analytics.js.map
/*!
 * autocomplete.js 0.21.8
 * https://github.com/algolia/autocomplete.js
 * Copyright 2016 Algolia, Inc. and other contributors; Licensed MIT
 */
!function (a) { function b(d) { if (c[d]) return c[d].exports; var e = c[d] = { exports: {}, id: d, loaded: !1 }; return a[d].call(e.exports, e, e.exports, b), e.loaded = !0, e.exports } var c = {}; return b.m = a, b.c = c, b.p = "", b(0) }([function (a, b, c) { "use strict"; a.exports = c(1) }, function (a, b, c) { "use strict"; var d = c(2), e = c(3); d.element = e; var f = c(4); f.isArray = e.isArray, f.isFunction = e.isFunction, f.isObject = e.isPlainObject, f.bind = e.proxy, f.each = function (a, b) { function c(a, c) { return b(c, a) } e.each(a, c) }, f.map = e.map, f.mixin = e.extend, f.Event = e.Event; var g, h, i, j = c(5), k = c(6); g = e.fn.autocomplete, h = "aaAutocomplete", i = { initialize: function (a, b) { function c() { var c, d = e(this), f = new k({ el: d }); c = new j({ input: d, eventBus: f, dropdownMenuContainer: a.dropdownMenuContainer, hint: void 0 === a.hint || !!a.hint, minLength: a.minLength, autoselect: a.autoselect, openOnFocus: a.openOnFocus, templates: a.templates, debug: a.debug, cssClasses: a.cssClasses, datasets: b, keyboardShortcuts: a.keyboardShortcuts }), d.data(h, c) } return b = f.isArray(b) ? b : [].slice.call(arguments, 1), a = a || {}, this.each(c) }, open: function () { function a() { var a, b = e(this); (a = b.data(h)) && a.open() } return this.each(a) }, close: function () { function a() { var a, b = e(this); (a = b.data(h)) && a.close() } return this.each(a) }, val: function (a) { function b() { var b, c = e(this); (b = c.data(h)) && b.setVal(a) } function c(a) { var b, c; return (b = a.data(h)) && (c = b.getVal()), c } return arguments.length ? this.each(b) : c(this.first()) }, destroy: function () { function a() { var a, b = e(this); (a = b.data(h)) && (a.destroy(), b.removeData(h)) } return this.each(a) } }, e.fn.autocomplete = function (a) { var b; return i[a] && "initialize" !== a ? (b = this.filter(function () { return !!e(this).data(h) }), i[a].apply(b, [].slice.call(arguments, 1))) : i.initialize.apply(this, arguments) }, e.fn.autocomplete.noConflict = function () { return e.fn.autocomplete = g, this }, e.fn.autocomplete.sources = j.sources, a.exports = e.fn.autocomplete }, function (a, b) { "use strict"; a.exports = { element: null } }, function (a, b) { a.exports = jQuery }, function (a, b, c) { "use strict"; var d = c(2); a.exports = { isArray: null, isFunction: null, isObject: null, bind: null, each: null, map: null, mixin: null, isMsie: function () { return !!/(msie|trident)/i.test(navigator.userAgent) && navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] }, escapeRegExChars: function (a) { return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") }, isNumber: function (a) { return "number" == typeof a }, toStr: function (a) { return void 0 === a || null === a ? "" : a + "" }, cloneDeep: function (a) { var b = this.mixin({}, a), c = this; return this.each(b, function (a, d) { a && (c.isArray(a) ? b[d] = [].concat(a) : c.isObject(a) && (b[d] = c.cloneDeep(a))) }), b }, error: function (a) { throw new Error(a) }, every: function (a, b) { var c = !0; return a ? (this.each(a, function (d, e) { if (c = b.call(null, d, e, a), !c) return !1 }), !!c) : c }, any: function (a, b) { var c = !1; return a ? (this.each(a, function (d, e) { if (b.call(null, d, e, a)) return c = !0, !1 }), c) : c }, getUniqueId: function () { var a = 0; return function () { return a++ } }(), templatify: function (a) { if (this.isFunction(a)) return a; var b = d.element(a); return "SCRIPT" === b.prop("tagName") ? function () { return b.text() } : function () { return String(a) } }, defer: function (a) { setTimeout(a, 0) }, noop: function () { }, className: function (a, b, c) { return (c ? "" : ".") + a + "-" + b } } }, function (a, b, c) { "use strict"; function d(a) { var b, c, f; a = a || {}, a.input || i.error("missing input"), this.isActivated = !1, this.debug = !!a.debug, this.autoselect = !!a.autoselect, this.openOnFocus = !!a.openOnFocus, this.minLength = i.isNumber(a.minLength) ? a.minLength : 1, this.cssClasses = a.cssClasses = i.mixin({}, o.defaultClasses, a.cssClasses || {}), this.$node = e(a), b = this.$node.find(i.className(this.cssClasses.prefix, this.cssClasses.dropdownMenu)), c = this.$node.find(i.className(this.cssClasses.prefix, this.cssClasses.input)), f = this.$node.find(i.className(this.cssClasses.prefix, this.cssClasses.hint)), a.dropdownMenuContainer && j.element(a.dropdownMenuContainer).css("position", "relative").append(b.css("top", "0")), c.on("blur.aa", function (a) { var d = document.activeElement; i.isMsie() && (b.is(d) || b.has(d).length > 0) && (a.preventDefault(), a.stopImmediatePropagation(), i.defer(function () { c.focus() })) }), b.on("mousedown.aa", function (a) { a.preventDefault() }), this.eventBus = a.eventBus || new k({ el: c }), this.dropdown = new d.Dropdown({ menu: b, datasets: a.datasets, templates: a.templates, cssClasses: this.cssClasses, minLength: this.minLength }).onSync("suggestionClicked", this._onSuggestionClicked, this).onSync("cursorMoved", this._onCursorMoved, this).onSync("cursorRemoved", this._onCursorRemoved, this).onSync("opened", this._onOpened, this).onSync("closed", this._onClosed, this).onSync("shown", this._onShown, this).onSync("empty", this._onEmpty, this).onAsync("datasetRendered", this._onDatasetRendered, this), this.input = new d.Input({ input: c, hint: f }).onSync("focused", this._onFocused, this).onSync("blurred", this._onBlurred, this).onSync("enterKeyed", this._onEnterKeyed, this).onSync("tabKeyed", this._onTabKeyed, this).onSync("escKeyed", this._onEscKeyed, this).onSync("upKeyed", this._onUpKeyed, this).onSync("downKeyed", this._onDownKeyed, this).onSync("leftKeyed", this._onLeftKeyed, this).onSync("rightKeyed", this._onRightKeyed, this).onSync("queryChanged", this._onQueryChanged, this).onSync("whitespaceChanged", this._onWhitespaceChanged, this), this._bindKeyboardShortcuts(c, a), this._setLanguageDirection() } function e(a) { var b, c, d, e; b = j.element(a.input), c = j.element(n.wrapper.replace("%ROOT%", a.cssClasses.root)).css(o.wrapper), "block" === b.css("display") && "table" === b.parent().css("display") && c.css("display", "table-cell"); var g = n.dropdown.replace("%PREFIX%", a.cssClasses.prefix).replace("%DROPDOWN_MENU%", a.cssClasses.dropdownMenu); d = j.element(g).css(o.dropdown), a.templates && a.templates.dropdownMenu && d.html(i.templatify(a.templates.dropdownMenu)()), e = b.clone().css(o.hint).css(f(b)), e.val("").addClass(i.className(a.cssClasses.prefix, a.cssClasses.hint, !0)).removeAttr("id name placeholder required").prop("readonly", !0).attr({ autocomplete: "off", spellcheck: "false", tabindex: -1 }), e.removeData && e.removeData(), b.data(h, { dir: b.attr("dir"), autocomplete: b.attr("autocomplete"), spellcheck: b.attr("spellcheck"), style: b.attr("style") }), b.addClass(i.className(a.cssClasses.prefix, a.cssClasses.input, !0)).attr({ autocomplete: "off", spellcheck: !1 }).css(a.hint ? o.input : o.inputWithNoHint); try { b.attr("dir") || b.attr("dir", "auto") } catch (a) { } return b.wrap(c).parent().prepend(a.hint ? e : null).append(d) } function f(a) { return { backgroundAttachment: a.css("background-attachment"), backgroundClip: a.css("background-clip"), backgroundColor: a.css("background-color"), backgroundImage: a.css("background-image"), backgroundOrigin: a.css("background-origin"), backgroundPosition: a.css("background-position"), backgroundRepeat: a.css("background-repeat"), backgroundSize: a.css("background-size") } } function g(a, b) { var c = a.find(i.className(b.prefix, b.input)); i.each(c.data(h), function (a, b) { void 0 === a ? c.removeAttr(b) : c.attr(b, a) }), c.detach().removeClass(i.className(b.prefix, b.input, !0)).insertAfter(a), c.removeData && c.removeData(h), a.remove() } var h = "aaAttrs", i = c(4), j = c(2), k = c(6), l = c(7), m = c(11), n = c(13), o = c(14); i.mixin(d.prototype, { _bindKeyboardShortcuts: function (a, b) { if (b.keyboardShortcuts) { var c = []; i.each(b.keyboardShortcuts, function (a) { "string" == typeof a && (a = a.toUpperCase().charCodeAt(0)), c.push(a) }), j.element(document).keydown(function (b) { var d = b.target || b.srcElement, e = d.tagName; if (!d.isContentEditable && "INPUT" !== e && "SELECT" !== e && "TEXTAREA" !== e) { var f = b.which || b.keyCode; c.indexOf(f) !== -1 && (a.focus(), b.stopPropagation(), b.preventDefault()) } }) } }, _onSuggestionClicked: function (a, b) { var c; (c = this.dropdown.getDatumForSuggestion(b)) && this._select(c) }, _onCursorMoved: function (a, b) { var c = this.dropdown.getDatumForCursor(); c && (b && this.input.setInputValue(c.value, !0), this.eventBus.trigger("cursorchanged", c.raw, c.datasetName)) }, _onCursorRemoved: function () { this.input.resetInputValue(), this._updateHint() }, _onDatasetRendered: function () { this._updateHint(), this.eventBus.trigger("updated") }, _onOpened: function () { this._updateHint(), this.eventBus.trigger("opened") }, _onEmpty: function () { this.eventBus.trigger("empty") }, _onShown: function () { this.eventBus.trigger("shown"), this.autoselect && this.dropdown.cursorTopSuggestion() }, _onClosed: function () { this.input.clearHint(), this.eventBus.trigger("closed") }, _onFocused: function () { if (this.isActivated = !0, this.openOnFocus) { var a = this.input.getQuery(); a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.empty(), this.dropdown.open() } }, _onBlurred: function () { this.debug || (this.isActivated = !1, this.dropdown.empty(), this.dropdown.close()) }, _onEnterKeyed: function (a, b) { var c, d; c = this.dropdown.getDatumForCursor(), d = this.dropdown.getDatumForTopSuggestion(), c ? (this._select(c), b.preventDefault()) : this.autoselect && d && (this._select(d), b.preventDefault()) }, _onTabKeyed: function (a, b) { var c; (c = this.dropdown.getDatumForCursor()) ? (this._select(c), b.preventDefault()) : this._autocomplete(!0) }, _onEscKeyed: function () { this.dropdown.close(), this.input.resetInputValue() }, _onUpKeyed: function () { var a = this.input.getQuery(); this.dropdown.isEmpty && a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.moveCursorUp(), this.dropdown.open() }, _onDownKeyed: function () { var a = this.input.getQuery(); this.dropdown.isEmpty && a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.moveCursorDown(), this.dropdown.open() }, _onLeftKeyed: function () { "rtl" === this.dir && this._autocomplete() }, _onRightKeyed: function () { "ltr" === this.dir && this._autocomplete() }, _onQueryChanged: function (a, b) { this.input.clearHintIfInvalid(), b.length >= this.minLength ? this.dropdown.update(b) : this.dropdown.empty(), this.dropdown.open(), this._setLanguageDirection() }, _onWhitespaceChanged: function () { this._updateHint(), this.dropdown.open() }, _setLanguageDirection: function () { var a = this.input.getLanguageDirection(); this.dir !== a && (this.dir = a, this.$node.css("direction", a), this.dropdown.setLanguageDirection(a)) }, _updateHint: function () { var a, b, c, d, e, f; a = this.dropdown.getDatumForTopSuggestion(), a && this.dropdown.isVisible() && !this.input.hasOverflow() ? (b = this.input.getInputValue(), c = l.normalizeQuery(b), d = i.escapeRegExChars(c), e = new RegExp("^(?:" + d + ")(.+$)", "i"), f = e.exec(a.value), f ? this.input.setHint(b + f[1]) : this.input.clearHint()) : this.input.clearHint() }, _autocomplete: function (a) { var b, c, d, e; b = this.input.getHint(), c = this.input.getQuery(), d = a || this.input.isCursorAtEnd(), b && c !== b && d && (e = this.dropdown.getDatumForTopSuggestion(), e && this.input.setInputValue(e.value), this.eventBus.trigger("autocompleted", e.raw, e.datasetName)) }, _select: function (a) { "undefined" != typeof a.value && this.input.setQuery(a.value), this.input.setInputValue(a.value, !0), this._setLanguageDirection(); var b = this.eventBus.trigger("selected", a.raw, a.datasetName); b.isDefaultPrevented() === !1 && (this.dropdown.close(), i.defer(i.bind(this.dropdown.empty, this.dropdown))) }, open: function () { if (!this.isActivated) { var a = this.input.getInputValue(); a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.empty() } this.dropdown.open() }, close: function () { this.dropdown.close() }, setVal: function (a) { a = i.toStr(a), this.isActivated ? this.input.setInputValue(a) : (this.input.setQuery(a), this.input.setInputValue(a, !0)), this._setLanguageDirection() }, getVal: function () { return this.input.getQuery() }, destroy: function () { this.input.destroy(), this.dropdown.destroy(), g(this.$node, this.cssClasses), this.$node = null } }), d.Dropdown = m, d.Input = l, d.sources = c(15), a.exports = d }, function (a, b, c) { "use strict"; function d(a) { a && a.el || f.error("EventBus initialized without el"), this.$el = g.element(a.el) } var e = "autocomplete:", f = c(4), g = c(2); f.mixin(d.prototype, { trigger: function (a) { var b = [].slice.call(arguments, 1), c = f.Event(e + a); return this.$el.trigger(c, b), c } }), a.exports = d }, function (a, b, c) { "use strict"; function d(a) { var b, c, d, f, g = this; a = a || {}, a.input || i.error("input is missing"), b = i.bind(this._onBlur, this), c = i.bind(this._onFocus, this), d = i.bind(this._onKeydown, this), f = i.bind(this._onInput, this), this.$hint = j.element(a.hint), this.$input = j.element(a.input).on("blur.aa", b).on("focus.aa", c).on("keydown.aa", d), 0 === this.$hint.length && (this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = i.noop), i.isMsie() ? this.$input.on("keydown.aa keypress.aa cut.aa paste.aa", function (a) { h[a.which || a.keyCode] || i.defer(i.bind(g._onInput, g, a)) }) : this.$input.on("input.aa", f), this.query = this.$input.val(), this.$overflowHelper = e(this.$input) } function e(a) { return j.element('<pre aria-hidden="true"></pre>').css({ position: "absolute", visibility: "hidden", whiteSpace: "pre", fontFamily: a.css("font-family"), fontSize: a.css("font-size"), fontStyle: a.css("font-style"), fontVariant: a.css("font-variant"), fontWeight: a.css("font-weight"), wordSpacing: a.css("word-spacing"), letterSpacing: a.css("letter-spacing"), textIndent: a.css("text-indent"), textRendering: a.css("text-rendering"), textTransform: a.css("text-transform") }).insertAfter(a) } function f(a, b) { return d.normalizeQuery(a) === d.normalizeQuery(b) } function g(a) { return a.altKey || a.ctrlKey || a.metaKey || a.shiftKey } var h; h = { 9: "tab", 27: "esc", 37: "left", 39: "right", 13: "enter", 38: "up", 40: "down" }; var i = c(4), j = c(2), k = c(8); d.normalizeQuery = function (a) { return (a || "").replace(/^\s*/g, "").replace(/\s{2,}/g, " ") }, i.mixin(d.prototype, k, { _onBlur: function () { this.resetInputValue(), this.trigger("blurred") }, _onFocus: function () { this.trigger("focused") }, _onKeydown: function (a) { var b = h[a.which || a.keyCode]; this._managePreventDefault(b, a), b && this._shouldTrigger(b, a) && this.trigger(b + "Keyed", a) }, _onInput: function () { this._checkInputValue() }, _managePreventDefault: function (a, b) { var c, d, e; switch (a) { case "tab": d = this.getHint(), e = this.getInputValue(), c = d && d !== e && !g(b); break; case "up": case "down": c = !g(b); break; default: c = !1 } c && b.preventDefault() }, _shouldTrigger: function (a, b) { var c; switch (a) { case "tab": c = !g(b); break; default: c = !0 } return c }, _checkInputValue: function () { var a, b, c; a = this.getInputValue(), b = f(a, this.query), c = !(!b || !this.query) && this.query.length !== a.length, this.query = a, b ? c && this.trigger("whitespaceChanged", this.query) : this.trigger("queryChanged", this.query) }, focus: function () { this.$input.focus() }, blur: function () { this.$input.blur() }, getQuery: function () { return this.query }, setQuery: function (a) { this.query = a }, getInputValue: function () { return this.$input.val() }, setInputValue: function (a, b) { "undefined" == typeof a && (a = this.query), this.$input.val(a), b ? this.clearHint() : this._checkInputValue() }, resetInputValue: function () { this.setInputValue(this.query, !0) }, getHint: function () { return this.$hint.val() }, setHint: function (a) { this.$hint.val(a) }, clearHint: function () { this.setHint("") }, clearHintIfInvalid: function () { var a, b, c, d; a = this.getInputValue(), b = this.getHint(), c = a !== b && 0 === b.indexOf(a), d = "" !== a && c && !this.hasOverflow(), d || this.clearHint() }, getLanguageDirection: function () { return (this.$input.css("direction") || "ltr").toLowerCase() }, hasOverflow: function () { var a = this.$input.width() - 2; return this.$overflowHelper.text(this.getInputValue()), this.$overflowHelper.width() >= a }, isCursorAtEnd: function () { var a, b, c; return a = this.$input.val().length, b = this.$input[0].selectionStart, i.isNumber(b) ? b === a : !document.selection || (c = document.selection.createRange(), c.moveStart("character", -a), a === c.text.length) }, destroy: function () { this.$hint.off(".aa"), this.$input.off(".aa"), this.$hint = this.$input = this.$overflowHelper = null } }), a.exports = d }, function (a, b, c) { (function (b) { "use strict"; function c(a, b, c, d) { var e; if (!c) return this; for (b = b.split(k), c = d ? j(c, d) : c, this._callbacks = this._callbacks || {}; e = b.shift() ;) this._callbacks[e] = this._callbacks[e] || { sync: [], async: [] }, this._callbacks[e][a].push(c); return this } function d(a, b, d) { return c.call(this, "async", a, b, d) } function e(a, b, d) { return c.call(this, "sync", a, b, d) } function f(a) { var b; if (!this._callbacks) return this; for (a = a.split(k) ; b = a.shift() ;) delete this._callbacks[b]; return this } function g(a) { var b, c, d, e, f; if (!this._callbacks) return this; for (a = a.split(k), d = [].slice.call(arguments, 1) ; (b = a.shift()) && (c = this._callbacks[b]) ;) e = h(c.sync, this, [b].concat(d)), f = h(c.async, this, [b].concat(d)), e() && l(f); return this } function h(a, b, c) { function d() { for (var d, e = 0, f = a.length; !d && e < f; e += 1) d = a[e].apply(b, c) === !1; return !d } return d } function i() { var a; return a = window.setImmediate ? function (a) { b(function () { a() }) } : function (a) { setTimeout(function () { a() }, 0) } } function j(a, b) { return a.bind ? a.bind(b) : function () { a.apply(b, [].slice.call(arguments, 0)) } } var k = /\s+/, l = i(); a.exports = { onSync: e, onAsync: d, off: f, trigger: g } }).call(b, c(9).setImmediate) }, function (a, b, c) { (function (a, d) { function e(a, b) { this._id = a, this._clearFn = b } var f = c(10).nextTick, g = Function.prototype.apply, h = Array.prototype.slice, i = {}, j = 0; b.setTimeout = function () { return new e(g.call(setTimeout, window, arguments), clearTimeout) }, b.setInterval = function () { return new e(g.call(setInterval, window, arguments), clearInterval) }, b.clearTimeout = b.clearInterval = function (a) { a.close() }, e.prototype.unref = e.prototype.ref = function () { }, e.prototype.close = function () { this._clearFn.call(window, this._id) }, b.enroll = function (a, b) { clearTimeout(a._idleTimeoutId), a._idleTimeout = b }, b.unenroll = function (a) { clearTimeout(a._idleTimeoutId), a._idleTimeout = -1 }, b._unrefActive = b.active = function (a) { clearTimeout(a._idleTimeoutId); var b = a._idleTimeout; b >= 0 && (a._idleTimeoutId = setTimeout(function () { a._onTimeout && a._onTimeout() }, b)) }, b.setImmediate = "function" == typeof a ? a : function (a) { var c = j++, d = !(arguments.length < 2) && h.call(arguments, 1); return i[c] = !0, f(function () { i[c] && (d ? a.apply(null, d) : a.call(null), b.clearImmediate(c)) }), c }, b.clearImmediate = "function" == typeof d ? d : function (a) { delete i[a] } }).call(b, c(9).setImmediate, c(9).clearImmediate) }, function (a, b) { function c() { throw new Error("setTimeout has not been defined") } function d() { throw new Error("clearTimeout has not been defined") } function e(a) { if (k === setTimeout) return setTimeout(a, 0); if ((k === c || !k) && setTimeout) return k = setTimeout, setTimeout(a, 0); try { return k(a, 0) } catch (b) { try { return k.call(null, a, 0) } catch (b) { return k.call(this, a, 0) } } } function f(a) { if (l === clearTimeout) return clearTimeout(a); if ((l === d || !l) && clearTimeout) return l = clearTimeout, clearTimeout(a); try { return l(a) } catch (b) { try { return l.call(null, a) } catch (b) { return l.call(this, a) } } } function g() { p && n && (p = !1, n.length ? o = n.concat(o) : q = -1, o.length && h()) } function h() { if (!p) { var a = e(g); p = !0; for (var b = o.length; b;) { for (n = o, o = []; ++q < b;) n && n[q].run(); q = -1, b = o.length } n = null, p = !1, f(a) } } function i(a, b) { this.fun = a, this.array = b } function j() { } var k, l, m = a.exports = {}; !function () { try { k = "function" == typeof setTimeout ? setTimeout : c } catch (a) { k = c } try { l = "function" == typeof clearTimeout ? clearTimeout : d } catch (a) { l = d } }(); var n, o = [], p = !1, q = -1; m.nextTick = function (a) { var b = new Array(arguments.length - 1); if (arguments.length > 1) for (var c = 1; c < arguments.length; c++) b[c - 1] = arguments[c]; o.push(new i(a, b)), 1 !== o.length || p || e(h) }, i.prototype.run = function () { this.fun.apply(null, this.array) }, m.title = "browser", m.browser = !0, m.env = {}, m.argv = [], m.version = "", m.versions = {}, m.on = j, m.addListener = j, m.once = j, m.off = j, m.removeListener = j, m.removeAllListeners = j, m.emit = j, m.binding = function (a) { throw new Error("process.binding is not supported") }, m.cwd = function () { return "/" }, m.chdir = function (a) { throw new Error("process.chdir is not supported") }, m.umask = function () { return 0 } }, function (a, b, c) { "use strict"; function d(a) { var b, c, d, h = this; a = a || {}, a.menu || f.error("menu is required"), f.isArray(a.datasets) || f.isObject(a.datasets) || f.error("1 or more datasets required"), a.datasets || f.error("datasets is required"), this.isOpen = !1, this.isEmpty = !0, this.minLength = a.minLength || 0, this.cssClasses = f.mixin({}, j.defaultClasses, a.cssClasses || {}), this.templates = {}, b = f.bind(this._onSuggestionClick, this), c = f.bind(this._onSuggestionMouseEnter, this), d = f.bind(this._onSuggestionMouseLeave, this); var i = f.className(this.cssClasses.prefix, this.cssClasses.suggestion); this.$menu = g.element(a.menu).on("click.aa", i, b).on("mouseenter.aa", i, c).on("mouseleave.aa", i, d), a.templates && a.templates.header && (this.templates.header = f.templatify(a.templates.header), this.$menu.prepend(this.templates.header())), a.templates && a.templates.empty && (this.templates.empty = f.templatify(a.templates.empty), this.$empty = g.element('<div class="' + f.className(this.cssClasses.prefix, this.cssClasses.empty, !0) + '"></div>'), this.$menu.append(this.$empty)), this.datasets = f.map(a.datasets, function (b) { return e(h.$menu, b, a.cssClasses) }), f.each(this.datasets, function (a) { var b = a.getRoot(); b && 0 === b.parent().length && h.$menu.append(b), a.onSync("rendered", h._onRendered, h) }), a.templates && a.templates.footer && (this.templates.footer = f.templatify(a.templates.footer), this.$menu.append(this.templates.footer())) } function e(a, b, c) { return new d.Dataset(f.mixin({ $menu: a, cssClasses: c }, b)) } var f = c(4), g = c(2), h = c(8), i = c(12), j = c(14); f.mixin(d.prototype, h, { _onSuggestionClick: function (a) { this.trigger("suggestionClicked", g.element(a.currentTarget)) }, _onSuggestionMouseEnter: function (a) { var b = g.element(a.currentTarget); b.hasClass(f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0)) || (this._removeCursor(), this._setCursor(b, !1)) }, _onSuggestionMouseLeave: function (a) { if (a.relatedTarget) { var b = g.element(a.relatedTarget); if (b.closest("." + f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0)).length > 0) return } this._removeCursor(), this.trigger("cursorRemoved") }, _onRendered: function (a, b) { function c(a) { return a.isEmpty() } function d(a) { return a.templates && a.templates.empty } if (this.isEmpty = f.every(this.datasets, c), this.isEmpty) if (b.length >= this.minLength && this.trigger("empty"), this.$empty) if (b.length < this.minLength) this._hide(); else { var e = this.templates.empty({ query: this.datasets[0] && this.datasets[0].query }); this.$empty.html(e), this._show() } else f.any(this.datasets, d) ? b.length < this.minLength ? this._hide() : this._show() : this._hide(); else this.isOpen && (this.$empty && this.$empty.empty(), b.length >= this.minLength ? this._show() : this._hide()); this.trigger("datasetRendered") }, _hide: function () { this.$menu.hide() }, _show: function () { this.$menu.css("display", "block"), this.trigger("shown") }, _getSuggestions: function () { return this.$menu.find(f.className(this.cssClasses.prefix, this.cssClasses.suggestion)) }, _getCursor: function () { return this.$menu.find(f.className(this.cssClasses.prefix, this.cssClasses.cursor)).first() }, _setCursor: function (a, b) { a.first().addClass(f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0)), this.trigger("cursorMoved", b) }, _removeCursor: function () { this._getCursor().removeClass(f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0)) }, _moveCursor: function (a) { var b, c, d, e; if (this.isOpen) { if (c = this._getCursor(), b = this._getSuggestions(), this._removeCursor(), d = b.index(c) + a, d = (d + 1) % (b.length + 1) - 1, d === -1) return void this.trigger("cursorRemoved"); d < -1 && (d = b.length - 1), this._setCursor(e = b.eq(d), !0), this._ensureVisible(e) } }, _ensureVisible: function (a) { var b, c, d, e; b = a.position().top, c = b + a.height() + parseInt(a.css("margin-top"), 10) + parseInt(a.css("margin-bottom"), 10), d = this.$menu.scrollTop(), e = this.$menu.height() + parseInt(this.$menu.css("paddingTop"), 10) + parseInt(this.$menu.css("paddingBottom"), 10), b < 0 ? this.$menu.scrollTop(d + b) : e < c && this.$menu.scrollTop(d + (c - e)) }, close: function () { this.isOpen && (this.isOpen = !1, this._removeCursor(), this._hide(), this.trigger("closed")) }, open: function () { this.isOpen || (this.isOpen = !0, this.isEmpty || this._show(), this.trigger("opened")) }, setLanguageDirection: function (a) { this.$menu.css("ltr" === a ? j.ltr : j.rtl) }, moveCursorUp: function () { this._moveCursor(-1) }, moveCursorDown: function () { this._moveCursor(1) }, getDatumForSuggestion: function (a) { var b = null; return a.length && (b = { raw: i.extractDatum(a), value: i.extractValue(a), datasetName: i.extractDatasetName(a) }), b }, getDatumForCursor: function () { return this.getDatumForSuggestion(this._getCursor().first()) }, getDatumForTopSuggestion: function () { return this.getDatumForSuggestion(this._getSuggestions().first()) }, cursorTopSuggestion: function () { this._setCursor(this._getSuggestions().first(), !1) }, update: function (a) { function b(b) { b.update(a) } f.each(this.datasets, b) }, empty: function () { function a(a) { a.clear() } f.each(this.datasets, a), this.isEmpty = !0 }, isVisible: function () { return this.isOpen && !this.isEmpty }, destroy: function () { function a(a) { a.destroy() } this.$menu.off(".aa"), this.$menu = null, f.each(this.datasets, a) } }), d.Dataset = i, a.exports = d }, function (a, b, c) { "use strict"; function d(a) { a = a || {}, a.templates = a.templates || {}, a.source || k.error("missing source"), a.name && !g(a.name) && k.error("invalid dataset name: " + a.name), this.query = null, this._isEmpty = !0, this.highlight = !!a.highlight, this.name = "undefined" == typeof a.name || null === a.name ? k.getUniqueId() : a.name, this.source = a.source, this.displayFn = e(a.display || a.displayKey), this.templates = f(a.templates, this.displayFn), this.cssClasses = k.mixin({}, n.defaultClasses, a.cssClasses || {}); var b = k.className(this.cssClasses.prefix, this.cssClasses.dataset); this.$el = a.$menu && a.$menu.find(b + "-" + this.name).length > 0 ? l.element(a.$menu.find(b + "-" + this.name)[0]) : l.element(m.dataset.replace("%CLASS%", this.name).replace("%PREFIX%", this.cssClasses.prefix).replace("%DATASET%", this.cssClasses.dataset)), this.$menu = a.$menu } function e(a) { function b(b) { return b[a] } return a = a || "value", k.isFunction(a) ? a : b } function f(a, b) { function c(a) { return "<p>" + b(a) + "</p>" } return { empty: a.empty && k.templatify(a.empty), header: a.header && k.templatify(a.header), footer: a.footer && k.templatify(a.footer), suggestion: a.suggestion || c } } function g(a) { return /^[_a-zA-Z0-9-]+$/.test(a) } var h = "aaDataset", i = "aaValue", j = "aaDatum", k = c(4), l = c(2), m = c(13), n = c(14), o = c(8); d.extractDatasetName = function (a) { return l.element(a).data(h) }, d.extractValue = function (a) { return l.element(a).data(i) }, d.extractDatum = function (a) { var b = l.element(a).data(j); return "string" == typeof b && (b = JSON.parse(b)), b }, k.mixin(d.prototype, o, { _render: function (a, b) { function c() { var b = [].slice.call(arguments, 0); return b = [{ query: a, isEmpty: !0 }].concat(b), o.templates.empty.apply(this, b) } function d() { function a(a) { var b, c = m.suggestion.replace("%PREFIX%", f.cssClasses.prefix).replace("%SUGGESTION%", f.cssClasses.suggestion); return b = l.element(c).append(o.templates.suggestion.apply(this, [a].concat(e))), b.data(h, o.name), b.data(i, o.displayFn(a) || void 0), b.data(j, JSON.stringify(a)), b.children().each(function () { l.element(this).css(n.suggestionChild) }), b } var c, d, e = [].slice.call(arguments, 0), f = this, g = m.suggestions.replace("%PREFIX%", this.cssClasses.prefix).replace("%SUGGESTIONS%", this.cssClasses.suggestions); return c = l.element(g).css(n.suggestions), d = k.map(b, a), c.append.apply(c, d), c } function e() { var b = [].slice.call(arguments, 0); return b = [{ query: a, isEmpty: !g }].concat(b), o.templates.header.apply(this, b) } function f() { var b = [].slice.call(arguments, 0); return b = [{ query: a, isEmpty: !g }].concat(b), o.templates.footer.apply(this, b) } if (this.$el) { var g, o = this, p = [].slice.call(arguments, 2); this.$el.empty(), g = b && b.length, this._isEmpty = !g, !g && this.templates.empty ? this.$el.html(c.apply(this, p)).prepend(o.templates.header ? e.apply(this, p) : null).append(o.templates.footer ? f.apply(this, p) : null) : g && this.$el.html(d.apply(this, p)).prepend(o.templates.header ? e.apply(this, p) : null).append(o.templates.footer ? f.apply(this, p) : null), this.$menu && this.$menu.addClass(this.cssClasses.prefix + "-" + (g ? "with" : "without") + "-" + this.name).removeClass(this.cssClasses.prefix + "-" + (g ? "without" : "with") + "-" + this.name), this.trigger("rendered", a) } }, getRoot: function () { return this.$el }, update: function (a) { function b(b) { if (!c.canceled && a === c.query) { var d = [].slice.call(arguments, 1); d = [a, b].concat(d), c._render.apply(c, d) } } var c = this; this.query = a, this.canceled = !1, this.source(a, b) }, cancel: function () { this.canceled = !0 }, clear: function () { this.cancel(), this.$el.empty(), this.trigger("rendered", "") }, isEmpty: function () { return this._isEmpty }, destroy: function () { this.$el = null } }), a.exports = d }, function (a, b) { "use strict"; a.exports = { wrapper: '<span class="%ROOT%"></span>', dropdown: '<span class="%PREFIX%-%DROPDOWN_MENU%"></span>', dataset: '<div class="%PREFIX%-%DATASET%-%CLASS%"></div>', suggestions: '<span class="%PREFIX%-%SUGGESTIONS%"></span>', suggestion: '<div class="%PREFIX%-%SUGGESTION%"></div>' } }, function (a, b, c) { "use strict"; var d = c(4), e = { wrapper: { position: "relative", display: "inline-block" }, hint: { position: "absolute", top: "0", left: "0", borderColor: "transparent", boxShadow: "none", opacity: "1" }, input: { position: "relative", verticalAlign: "top", backgroundColor: "transparent" }, inputWithNoHint: { position: "relative", verticalAlign: "top" }, dropdown: { position: "absolute", top: "100%", left: "0", zIndex: "100", display: "none" }, suggestions: { display: "block" }, suggestion: { whiteSpace: "nowrap", cursor: "pointer" }, suggestionChild: { whiteSpace: "normal" }, ltr: { left: "0", right: "auto" }, rtl: { left: "auto", right: "0" }, defaultClasses: { root: "algolia-autocomplete", prefix: "aa", dropdownMenu: "dropdown-menu", input: "input", hint: "hint", suggestions: "suggestions", suggestion: "suggestion", cursor: "cursor", dataset: "dataset", empty: "empty" } }; d.isMsie() && d.mixin(e.input, { backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)" }), d.isMsie() && d.isMsie() <= 7 && d.mixin(e.input, { marginTop: "-1px" }), a.exports = e }, function (a, b, c) { "use strict"; a.exports = { hits: c(16), popularIn: c(17) } }, function (a, b, c) { "use strict"; var d = c(4); a.exports = function (a, b) { function c(c, e) { a.search(c, b, function (a, b) { return a ? void d.error(a.message) : void e(b.hits, b) }) } return c } }, function (a, b, c) { "use strict"; var d = c(4); a.exports = function (a, b, c, e) { function f(f, i) { a.search(f, b, function (a, b) { if (a) return void d.error(a.message); if (b.hits.length > 0) { var f = b.hits[0], j = d.mixin({ hitsPerPage: 0 }, c); return delete j.source, delete j.index, void h.search(g(f), j, function (a, c) { if (a) return void d.error(a.message); var g = []; if (e.includeAll) { var h = e.allTitle || "All departments"; g.push(d.mixin({ facet: { value: h, count: c.nbHits } }, d.cloneDeep(f))) } d.each(c.facets, function (a, b) { d.each(a, function (a, c) { g.push(d.mixin({ facet: { facet: b, value: c, count: a } }, d.cloneDeep(f))) }) }); for (var j = 1; j < b.hits.length; ++j) g.push(b.hits[j]); i(g, b) }) } i([]) }) } if (!c.source) return d.error("Missing 'source' key"); var g = d.isFunction(c.source) ? c.source : function (a) { return a[c.source] }; if (!c.index) return d.error("Missing 'index' key"); var h = c.index; return e = e || {}, f } }]);
/*! flatpickr v2.2.5, @license MIT */
function Flatpickr(e,t){function n(){e._flatpickr&&M(e._flatpickr),e._flatpickr=ne,ne.element=e,ne.instanceConfig=t||{},W(),F(),N(),U(),R(),j(),ne.isOpen=ne.config.inline,ne.changeMonth=D,ne.clear=b,ne.close=y,ne.destroy=M,ne.formatDate=k,ne.jumpToDate=c,ne.open=L,ne.parseDate=S,ne.redraw=H,ne.set=P,ne.setDate=A,ne.toggle=z,ne.isMobile=!ne.config.disableMobile&&!ne.config.inline&&"single"===ne.config.mode&&!ne.config.disable.length&&!ne.config.enable.length&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),ne.isMobile||d(),l(),ne.minDateHasTime=ne.config.minDate&&(ne.config.minDate.getHours()||ne.config.minDate.getMinutes()||ne.config.minDate.getSeconds()),ne.maxDateHasTime=ne.config.maxDate&&(ne.config.maxDate.getHours()||ne.config.maxDate.getMinutes()||ne.config.maxDate.getSeconds()),ne.isMobile||Object.defineProperty(ne,"dateIsPicked",{set:function(e){return e?ne.calendarContainer.classList.add("dateIsPicked"):void ne.calendarContainer.classList.remove("dateIsPicked")}}),ne.dateIsPicked=ne.selectedDates.length>0||ne.config.noCalendar,ne.selectedDates.length&&(ne.config.enableTime&&r(),Q()),ne.config.weekNumbers&&(ne.calendarContainer.style.width=ne.days.offsetWidth+ne.weekWrapper.offsetWidth+"px"),J("Ready")}function a(e){ne.config.noCalendar&&!ne.selectedDates.length&&(ne.selectedDates=[ne.now]),te(e),ne.selectedDates.length&&(i(),Q())}function i(){if(ne.config.enableTime){var e=parseInt(ne.hourElement.value,10)||0,t=parseInt(ne.minuteElement.value,10)||0,n=ne.config.enableSeconds?parseInt(ne.secondElement.value,10)||0:0;ne.amPM&&(e=e%12+12*("PM"===ne.amPM.innerHTML)),ne.minDateHasTime&&0===ee(K(),ne.config.minDate)?(e=Math.max(e,ne.config.minDate.getHours()),e===ne.config.minDate.getHours()&&(t=Math.max(t,ne.config.minDate.getMinutes()))):ne.maxDateHasTime&&0===ee(K(),ne.config.maxDate)&&(e=Math.min(e,ne.config.maxDate.getHours()),e===ne.config.maxDate.getHours()&&(t=Math.min(t,ne.config.maxDate.getMinutes()))),o(e,t,n)}}function r(e){var t=e||K();t&&o(t.getHours(),t.getMinutes(),t.getSeconds())}function o(e,t,n){ne.selectedDates.length&&ne.selectedDates[ne.selectedDates.length-1].setHours(e%24,t,n||0,0),ne.config.enableTime&&!ne.isMobile&&(ne.hourElement.value=ne.pad(ne.config.time_24hr?e:(12+e)%12+12*(e%12===0)),ne.minuteElement.value=ne.pad(t),!ne.config.time_24hr&&ne.selectedDates.length&&(ne.amPM.textContent=K().getHours()>=12?"PM":"AM"),ne.config.enableSeconds&&(ne.secondElement.value=ne.pad(n)))}function l(){if(ne.config.wrap&&["open","close","toggle","clear"].forEach(function(e){try{ne.element.querySelector("[data-"+e+"]").addEventListener("click",ne[e])}catch(e){}}),"createEvent"in document&&(ne.changeEvent=document.createEvent("HTMLEvents"),ne.changeEvent.initEvent("change",!1,!0)),ne.isMobile)return B();ne.debouncedResize=Z(Y,50),ne.triggerChange=function(){return J("Change")},ne.debouncedChange=Z(ne.triggerChange,1e3),"range"===ne.config.mode&&ne.days.addEventListener("mouseover",I),document.addEventListener("keydown",T),window.addEventListener("resize",ne.debouncedResize);var e="undefined"!=typeof window.ontouchstart?"touchstart":"click";document.addEventListener(e,w),document.addEventListener("blur",w),ne.config.clickOpens&&(ne.altInput||ne.input).addEventListener("focus",L),ne.config.noCalendar||(ne.prevMonthNav.addEventListener("click",function(){return D(-1)}),ne.nextMonthNav.addEventListener("click",function(){return D(1)}),ne.currentYearElement.addEventListener("wheel",function(e){return Z(G(e),50)}),ne.currentYearElement.addEventListener("focus",function(){ne.currentYearElement.select()}),ne.currentYearElement.addEventListener("input",function(e){4===e.target.value.length&&(ne.currentYearElement.blur(),E(e.target.value),e.target.value=ne.currentYear)}),ne.days.addEventListener("click",O)),ne.config.enableTime&&(ne.timeContainer.addEventListener("wheel",function(e){return Z(a(e),5)}),ne.timeContainer.addEventListener("input",a),ne.timeContainer.addEventListener("wheel",ne.debouncedChange),ne.timeContainer.addEventListener("input",ne.triggerChange),ne.hourElement.addEventListener("focus",function(){ne.hourElement.select()}),ne.minuteElement.addEventListener("focus",function(){ne.minuteElement.select()}),ne.secondElement&&ne.secondElement.addEventListener("focus",function(){ne.secondElement.select()}),ne.amPM&&ne.amPM.addEventListener("click",function(e){a(e),ne.triggerChange(e)}))}function c(e){e=e?S(e):K()||(ne.config.minDate>ne.now?ne.config.minDate:ne.now);try{ne.currentYear=e.getFullYear(),ne.currentMonth=e.getMonth()}catch(t){console.error(t.stack),console.warn("Invalid date supplied: "+e)}ne.redraw()}function s(e,t){var n=e.target.parentNode.childNodes[0];n.value=parseInt(n.value,10)+t*(n.step||1);try{n.dispatchEvent(new Event("input",{bubbles:!0}))}catch(e){var a=document.createEvent("CustomEvent");a.initCustomEvent("input",!0,!0,{}),n.dispatchEvent(a)}}function u(e){var t=X("div","numInputWrapper"),n=X("input","numInput "+e),a=X("span","arrowUp"),i=X("span","arrowDown");return n.type="text",t.appendChild(n),t.appendChild(a),t.appendChild(i),a.addEventListener("click",function(e){return s(e,1)}),i.addEventListener("click",function(e){return s(e,-1)}),t}function d(){var e=document.createDocumentFragment();ne.calendarContainer=X("div","flatpickr-calendar"),ne.numInputType=navigator.userAgent.indexOf("MSIE 9.0")>0?"text":"number",ne.config.noCalendar||(e.appendChild(p()),ne.innerContainer=X("div","flatpickr-innerContainer"),ne.config.weekNumbers&&ne.innerContainer.appendChild(v()),ne.rContainer=X("div","flatpickr-rContainer"),ne.rContainer.appendChild(h()),ne.rContainer.appendChild(m()),ne.innerContainer.appendChild(ne.rContainer),e.appendChild(ne.innerContainer)),ne.config.enableTime&&e.appendChild(g()),"range"===ne.config.mode&&ne.calendarContainer.classList.add("rangeMode"),ne.calendarContainer.appendChild(e),ne.config.inline||ne.config.static?(ne.calendarContainer.classList.add(ne.config.inline?"inline":"static"),_(),ne.config.appendTo&&ne.config.appendTo.nodeType?ne.config.appendTo.appendChild(ne.calendarContainer):ne.element.parentNode.insertBefore(ne.calendarContainer,(ne.altInput||ne.input).nextSibling)):document.body.appendChild(ne.calendarContainer)}function f(e,t,n){var a=x(t),i=X("span","flatpickr-day "+e,t.getDate());return i.dateObj=t,0===ee(t,ne.now)&&i.classList.add("today"),a?(i.tabIndex=0,q(t)&&(i.classList.add("selected"),"range"===ne.config.mode?i.classList.add(0===ee(t,ne.selectedDates[0])?"startRange":"endRange"):ne.selectedDateElem=i)):(i.classList.add("disabled"),ne.selectedDates[0]&&t>ne.minRangeDate&&t<ne.selectedDates[0]?ne.minRangeDate=t:ne.selectedDates[0]&&t<ne.maxRangeDate&&t>ne.selectedDates[0]&&(ne.maxRangeDate=t)),"range"===ne.config.mode&&(V(t)&&!q(t)&&i.classList.add("inRange"),1===ne.selectedDates.length&&(t<ne.minRangeDate||t>ne.maxRangeDate)&&i.classList.add("notAllowed")),ne.config.weekNumbers&&"prevMonthDay"!==e&&n%7===1&&ne.weekNumbers.insertAdjacentHTML("beforeend","<span class='disabled flatpickr-day'>"+ne.config.getWeek(t)+"</span>"),J("DayCreate",i),i}function m(){ne.days||(ne.days=X("div","flatpickr-days"),ne.days.tabIndex=-1),ne.firstOfMonth=(new Date(ne.currentYear,ne.currentMonth,1).getDay()-ne.l10n.firstDayOfWeek+7)%7,ne.prevMonthDays=ne.utils.getDaysinMonth((ne.currentMonth-1+12)%12);var e=ne.utils.getDaysinMonth(),t=document.createDocumentFragment(),n=ne.prevMonthDays+1-ne.firstOfMonth;ne.config.weekNumbers&&(ne.weekNumbers.innerHTML=""),"range"===ne.config.mode&&(ne.minRangeDate=new Date(ne.currentYear,ne.currentMonth-1,n),ne.maxRangeDate=new Date(ne.currentYear,ne.currentMonth+1,(42-ne.firstOfMonth)%e)),ne.days.innerHTML="";for(var a=0;n<=ne.prevMonthDays;a++,n++)t.appendChild(f("prevMonthDay",new Date(ne.currentYear,ne.currentMonth-1,n),n));for(n=1;n<=e;n++)t.appendChild(f("",new Date(ne.currentYear,ne.currentMonth,n),n));for(var i=e+1;i<=42-ne.firstOfMonth;i++)t.appendChild(f("nextMonthDay",new Date(ne.currentYear,ne.currentMonth+1,i%e),i));return ne.days.appendChild(t),ne.days}function p(){var e=document.createDocumentFragment();ne.monthNav=X("div","flatpickr-month"),ne.prevMonthNav=X("span","flatpickr-prev-month"),ne.prevMonthNav.innerHTML=ne.config.prevArrow,ne.currentMonthElement=X("span","cur-month");var t=u("cur-year");return ne.currentYearElement=t.childNodes[0],ne.currentYearElement.title=ne.l10n.scrollTitle,ne.config.minDate&&(ne.currentYearElement.min=ne.config.minDate.getFullYear()),ne.config.maxDate&&(ne.currentYearElement.max=ne.config.maxDate.getFullYear(),ne.currentYearElement.disabled=ne.config.minDate&&ne.config.minDate.getFullYear()===ne.config.maxDate.getFullYear()),ne.nextMonthNav=X("span","flatpickr-next-month"),ne.nextMonthNav.innerHTML=ne.config.nextArrow,ne.navigationCurrentMonth=X("span","flatpickr-current-month"),ne.navigationCurrentMonth.appendChild(ne.currentMonthElement),ne.navigationCurrentMonth.appendChild(t),e.appendChild(ne.prevMonthNav),e.appendChild(ne.navigationCurrentMonth),e.appendChild(ne.nextMonthNav),ne.monthNav.appendChild(e),$(),ne.monthNav}function g(){ne.calendarContainer.classList.add("hasTime"),ne.timeContainer=X("div","flatpickr-time"),ne.timeContainer.tabIndex=-1;var e=X("span","flatpickr-time-separator",":"),t=u("flatpickr-hour");ne.hourElement=t.childNodes[0];var n=u("flatpickr-minute");if(ne.minuteElement=n.childNodes[0],ne.hourElement.tabIndex=ne.minuteElement.tabIndex=0,ne.hourElement.pattern=ne.minuteElement.pattern="d*",ne.hourElement.value=ne.pad(K()?K().getHours():ne.config.defaultHour),ne.minuteElement.value=ne.pad(K()?K().getMinutes():ne.config.defaultMinute),ne.hourElement.step=ne.config.hourIncrement,ne.minuteElement.step=ne.config.minuteIncrement,ne.hourElement.min=ne.config.time_24hr?0:1,ne.hourElement.max=ne.config.time_24hr?23:12,ne.minuteElement.min=0,ne.minuteElement.max=59,ne.hourElement.title=ne.minuteElement.title=ne.l10n.scrollTitle,ne.timeContainer.appendChild(t),ne.timeContainer.appendChild(e),ne.timeContainer.appendChild(n),ne.config.time_24hr&&ne.timeContainer.classList.add("time24hr"),ne.config.enableSeconds){ne.timeContainer.classList.add("hasSeconds");var a=u("flatpickr-second");ne.secondElement=a.childNodes[0],ne.secondElement.pattern=ne.hourElement.pattern,ne.secondElement.value=K()?ne.pad(K().getSeconds()):"00",ne.secondElement.step=ne.minuteElement.step,ne.secondElement.min=ne.minuteElement.min,ne.secondElement.max=ne.minuteElement.max,ne.timeContainer.appendChild(X("span","flatpickr-time-separator",":")),ne.timeContainer.appendChild(a)}return ne.config.time_24hr||(ne.amPM=X("span","flatpickr-am-pm",["AM","PM"][ne.hourElement.value>11|0]),ne.amPM.title=ne.l10n.toggleTitle,ne.amPM.tabIndex=0,ne.timeContainer.appendChild(ne.amPM)),ne.timeContainer}function h(){ne.weekdayContainer||(ne.weekdayContainer=X("div","flatpickr-weekdays"));var e=ne.l10n.firstDayOfWeek,t=ne.l10n.weekdays.shorthand.slice();return e>0&&e<t.length&&(t=[].concat(t.splice(e,t.length),t.splice(0,e))),ne.weekdayContainer.innerHTML="\n\t\t<span class=flatpickr-weekday>\n\t\t\t"+t.join("</span><span class=flatpickr-weekday>")+"\n\t\t</span>\n\t\t",ne.weekdayContainer}function v(){return ne.calendarContainer.classList.add("hasWeeks"),ne.weekWrapper=X("div","flatpickr-weekwrapper"),ne.weekWrapper.appendChild(X("span","flatpickr-weekday",ne.l10n.weekAbbreviation)),ne.weekNumbers=X("div","flatpickr-weeks"),ne.weekWrapper.appendChild(ne.weekNumbers),ne.weekWrapper}function D(e,t){ne.currentMonth="undefined"==typeof t||t?ne.currentMonth+e:e,E(),$(),m(),ne.config.noCalendar||ne.days.focus(),J("MonthChange")}function b(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];ne.input.value="",ne.altInput&&(ne.altInput.value=""),ne.mobileInput&&(ne.mobileInput.value=""),ne.selectedDates=[],ne.dateIsPicked=!1,ne.redraw(),e!==!1&&J("Change")}function y(){ne.isOpen=!1,ne.isMobile||(ne.calendarContainer.classList.remove("open"),(ne.altInput||ne.input).classList.remove("active")),J("Close")}function M(e){e=e||ne,e.clear(!1),document.removeEventListener("keydown",T),window.removeEventListener("resize",e.debouncedResize),document.removeEventListener("click",w),document.removeEventListener("blur",w),e.mobileInput&&e.mobileInput.parentNode?e.mobileInput.parentNode.removeChild(e.mobileInput):e.calendarContainer&&e.calendarContainer.parentNode&&e.calendarContainer.parentNode.removeChild(e.calendarContainer),e.altInput&&(e.input.type="text",e.altInput.parentNode&&e.altInput.parentNode.removeChild(e.altInput)),e.input.classList.remove("flatpickr-input"),e.input.removeEventListener("focus",L),e.input.removeAttribute("readonly"),delete e.input._flatpickr}function C(e){for(var t=e;t;){if(/flatpickr-day|flatpickr-calendar/.test(t.className))return!0;t=t.parentNode}return!1}function w(e){var t=ne.element.contains(e.target)||e.target===ne.input||e.target===ne.altInput;!ne.isOpen||C(e.target)||t||(ne.close(),"range"===ne.config.mode&&1===ne.selectedDates.length&&(ne.clear(),ne.redraw()))}function k(e,t){if(ne.config.formatDate)return ne.config.formatDate(e,t);var n=e.split("");return n.map(function(e,a){return ne.formats[e]&&"\\"!==n[a-1]?ne.formats[e](t):"\\"!==e?e:""}).join("")}function E(e){ne.currentMonth<0||ne.currentMonth>11?(ne.currentYear+=ne.currentMonth%11,ne.currentMonth=(ne.currentMonth+12)%12,J("YearChange")):e&&(!ne.currentYearElement.min||e>=ne.currentYearElement.min)&&(!ne.currentYearElement.max||e<=ne.currentYearElement.max)&&(ne.currentYear=parseInt(e,10)||ne.currentYear,ne.config.maxDate&&ne.currentYear===ne.config.maxDate.getFullYear()?ne.currentMonth=Math.min(ne.config.maxDate.getMonth(),ne.currentMonth):ne.config.minDate&&ne.currentYear===ne.config.minDate.getFullYear()&&(ne.currentMonth=Math.max(ne.config.minDate.getMonth(),ne.currentMonth)),ne.redraw(),J("YearChange"))}function x(e){if(ne.config.minDate&&ee(e,ne.config.minDate)<0||ne.config.maxDate&&ee(e,ne.config.maxDate)>0)return!1;if(!ne.config.enable.length&&!ne.config.disable.length)return!0;e=S(e,!0);for(var t,n=ne.config.enable.length>0,a=n?ne.config.enable:ne.config.disable,i=0;i<a.length;i++){if(t=a[i],t instanceof Function&&t(e))return n;if((t instanceof Date||"string"==typeof t)&&S(t,!0).getTime()===e.getTime())return n;if("object"===("undefined"==typeof t?"undefined":_typeof(t))&&t.from&&t.to&&e>=S(t.from)&&e<=S(t.to))return n}return!n}function T(e){if(ne.isOpen)switch(e.which){case 13:ne.timeContainer&&ne.timeContainer.contains(e.target)?Q():O(e);break;case 27:ne.clear(),ne.redraw(),ne.close();break;case 37:e.target!==ne.input&e.target!==ne.altInput&&D(-1);break;case 38:e.preventDefault(),ne.timeContainer&&ne.timeContainer.contains(e.target)?a(e):(ne.currentYear++,ne.redraw());break;case 39:e.target!==ne.input&e.target!==ne.altInput&&D(1);break;case 40:e.preventDefault(),ne.timeContainer&&ne.timeContainer.contains(e.target)?a(e):(ne.currentYear--,ne.redraw())}}function I(e){if(1===ne.selectedDates.length&&e.target.classList.contains("flatpickr-day")){for(var t=e.target.dateObj,n=S(ne.selectedDates[0],!0),a=Math.min(t.getTime(),ne.selectedDates[0].getTime()),i=Math.max(t.getTime(),ne.selectedDates[0].getTime()),r=!1,o=a;o<i;o+=ne.utils.duration.DAY)if(!x(new Date(o))){r=!0;break}for(var l=ne.days.childNodes[0].dateObj.getTime(),c=0;c<42;c++,l+=ne.utils.duration.DAY){var s=l<ne.minRangeDate.getTime()||l>ne.maxRangeDate.getTime();if(s)ne.days.childNodes[c].classList.add("notAllowed"),ne.days.childNodes[c].classList.remove("inRange","startRange","endRange");else if(!r||s){ne.days.childNodes[c].classList.remove("startRange","inRange","endRange","notAllowed");var u=Math.max(ne.minRangeDate.getTime(),a),d=Math.min(ne.maxRangeDate.getTime(),i);e.target.classList.add(t<ne.selectedDates[0]?"startRange":"endRange"),n>t&&l===n.getTime()?ne.days.childNodes[c].classList.add("endRange"):n<t&&l===n.getTime()?ne.days.childNodes[c].classList.add("startRange"):l>u&&l<d&&ne.days.childNodes[c].classList.add("inRange")}}}}function Y(){!ne.isOpen||ne.config.static||ne.config.inline||_()}function L(e){return ne.isMobile?(e&&(e.preventDefault(),e.target.blur()),setTimeout(function(){ne.mobileInput.click()},0),void J("Open")):void(ne.isOpen||(ne.altInput||ne.input).disabled||ne.config.inline||(ne.calendarContainer.classList.add("open"),ne.config.static||ne.config.inline||_(),ne.isOpen=!0,ne.config.allowInput||((ne.altInput||ne.input).blur(),(ne.config.noCalendar?ne.timeContainer:ne.selectedDateElem?ne.selectedDateElem:ne.days).focus()),(ne.altInput||ne.input).classList.add("active"),J("Open")))}function F(){var e=["utc","wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"];ne.config=Object.create(Flatpickr.defaultConfig);var t=_extends({},ne.instanceConfig,ne.element.dataset||{});Object.defineProperty(ne.config,"minDate",{get:function(){return this._minDate},set:function(e){this._minDate=S(e),ne.days&&H(),ne.currentYearElement&&(e&&this._minDate instanceof Date?(ne.minDateHasTime=this._minDate.getHours()||this._minDate.getMinutes()||this._minDate.getSeconds(),ne.currentYearElement.min=this._minDate.getFullYear()):ne.currentYearElement.removeAttribute("min"),ne.currentYearElement.disabled=this._maxDate&&this._minDate&&this._maxDate.getFullYear()===this._minDate.getFullYear())}}),Object.defineProperty(ne.config,"maxDate",{get:function(){return this._maxDate},set:function(e){this._maxDate=S(e),ne.days&&H(),ne.currentYearElement&&(e&&this._maxDate instanceof Date?(ne.currentYearElement.max=this._maxDate.getFullYear(),ne.maxDateHasTime=this._maxDate.getHours()||this._maxDate.getMinutes()||this._maxDate.getSeconds()):ne.currentYearElement.removeAttribute("max"),ne.currentYearElement.disabled=this._maxDate&&this._minDate&&this._maxDate.getFullYear()===this._minDate.getFullYear())}}),_extends(ne.config,t);for(var n=0;n<e.length;n++)ne.config[e[n]]=ne.config[e[n]]===!0||"true"===ne.config[e[n]];!t.dateFormat&&t.enableTime&&(ne.config.dateFormat=ne.config.noCalendar?"H:i"+(ne.config.enableSeconds?":S":""):Flatpickr.defaultConfig.dateFormat+" H:i"+(ne.config.enableSeconds?":S":"")),t.altInput&&t.enableTime&&!t.altFormat&&(ne.config.altFormat=ne.config.noCalendar?"h:i"+(ne.config.enableSeconds?":S K":" K"):Flatpickr.defaultConfig.altFormat+(" h:i"+(ne.config.enableSeconds?":S":"")+" K"))}function N(){"object"!==_typeof(ne.config.locale)&&"undefined"==typeof Flatpickr.l10ns[ne.config.locale]&&console.warn("flatpickr: invalid locale "+ne.config.locale),ne.l10n=_extends(Object.create(Flatpickr.l10ns.default),"object"===_typeof(ne.config.locale)?ne.config.locale:"default"!==ne.config.locale?Flatpickr.l10ns[ne.config.locale]||{}:{})}function S(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=/(\d+)/g,a=/^(\d{1,2})[:\s](\d\d)?[:\s]?(\d\d)?\s?(a|p)?/i,i=/^(\d+)$/g,r=e;if(e.toFixed||i.test(e))e=new Date(e);else if("string"==typeof e)if(e=e.trim(),"today"===e)e=new Date,t=!0;else if(ne.config.parseDate)e=ne.config.parseDate(e);else if(a.test(e)){var o=e.match(a),l=o[4]?o[1]%12+("p"===o[4].toLowerCase()?12:0):o[1];e=new Date,e.setHours(l,o[2]||0,o[3]||0)}else if(/Z$/.test(e)||/GMT$/.test(e))e=new Date(e);else if(n.test(e)&&/^[0-9]/.test(e)){var c=e.match(n);e=new Date(c[0]+"/"+(c[1]||1)+"/"+(c[2]||1)+" "+(c[3]||0)+":"+(c[4]||0)+":"+(c[5]||0))}else e=new Date(e);return e instanceof Date?(ne.config.utc&&!e.fp_isUTC&&(e=e.fp_toUTC()),t===!0&&e.setHours(0,0,0,0),e):(console.warn("flatpickr: invalid date "+r),console.info(ne.element),null)}function _(){var e=ne.calendarContainer.offsetHeight,t=ne.altInput||ne.input,n=t.getBoundingClientRect(),a=window.innerHeight-n.bottom+t.offsetHeight,i=void 0,r=window.pageXOffset+n.left;a<e?(i=window.pageYOffset-e+n.top-2,ne.calendarContainer.classList.remove("arrowTop"),ne.calendarContainer.classList.add("arrowBottom")):(i=window.pageYOffset+t.offsetHeight+n.top+2,ne.calendarContainer.classList.remove("arrowBottom"),ne.calendarContainer.classList.add("arrowTop")),ne.config.static||ne.config.inline||(ne.calendarContainer.style.top=i+"px",ne.calendarContainer.style.left=r+"px")}function H(){ne.config.noCalendar||ne.isMobile||(h(),$(),m())}function O(e){if(ne.config.allowInput&&13===e.which&&e.target===(ne.altInput||ne.input))return ne.setDate((ne.altInput||ne.input).value),e.target.blur();if(e.target.classList.contains("flatpickr-day")&&!e.target.classList.contains("disabled")&&!e.target.classList.contains("notAllowed")){var t=e.target.dateObj;if(ne.selectedDateElem=e.target,"single"===ne.config.mode)ne.selectedDates=[t],ne.config.enableTime||ne.close();else if("multiple"===ne.config.mode){var n=q(t);n?ne.selectedDates.splice(n,1):ne.selectedDates.push(t)}else"range"===ne.config.mode&&(2===ne.selectedDates.length&&ne.clear(),ne.selectedDates.push(t),ne.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()}));i(),t.getMonth()!==ne.currentMonth&&"range"!==ne.config.mode&&(ne.currentYear=t.getFullYear(),ne.currentMonth=t.getMonth(),$()),m(),ne.minDateHasTime&&ne.config.enableTime&&0===ee(t,ne.config.minDate)&&r(ne.config.minDate),Q(),setTimeout(function(){return ne.dateIsPicked=!0},50),"range"===ne.config.mode&&1===ne.selectedDates.length&&I(e),J("Change")}}function P(e,t){ne.config[e]=t,ne.redraw(),c()}function A(e,t){return e?(ne.selectedDates=(Array.isArray(e)?e.map(S):[S(e)]).filter(function(e){return e instanceof Date&&x(e)}),ne.redraw(),c(),r(),Q(),ne.dateIsPicked=ne.selectedDates.length>0,void(t&&J("Change"))):ne.clear()}function R(){ne.selectedDates=[],ne.now=new Date;var e=ne.config.defaultDate||ne.input.value;if(Array.isArray(e))ne.selectedDates=e.map(S);else if(e)switch(ne.config.mode){case"single":ne.selectedDates=[S(e)];break;case"multiple":ne.selectedDates=e.split("; ").map(S);break;case"range":ne.selectedDates=e.split(ne.l10n.rangeSeparator).map(S)}ne.selectedDates=ne.selectedDates.filter(function(e){return e instanceof Date&&e.getTime()&&x(e)});var t=ne.selectedDates.length?ne.selectedDates[0]:ne.config.minDate>ne.now?ne.config.minDate:ne.now;ne.currentYear=t.getFullYear(),ne.currentMonth=t.getMonth()}function j(){ne.utils={duration:{DAY:864e5},getDaysinMonth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ne.currentMonth,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ne.currentYear;return 1===e&&(t%4===0&&t%100!==0||t%400===0)?29:ne.l10n.daysInMonth[e]},monthToStr:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ne.config.shorthandCurrentMonth;return ne.l10n.months[(t?"short":"long")+"hand"][e]}}}function W(){ne.formats={D:function(e){return ne.l10n.weekdays.shorthand[ne.formats.w(e)]},F:function(e){return ne.utils.monthToStr(ne.formats.n(e)-1,!1)},H:function(e){return Flatpickr.prototype.pad(e.getHours())},J:function(e){return e.getDate()+ne.l10n.ordinal(e.getDate())},K:function(e){return e.getHours()>11?"PM":"AM"},M:function(e){return ne.utils.monthToStr(e.getMonth(),!0)},S:function(e){return Flatpickr.prototype.pad(e.getSeconds())},U:function(e){return e.getTime()/1e3},Y:function(e){return e.getFullYear()},d:function(e){return Flatpickr.prototype.pad(ne.formats.j(e))},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return Flatpickr.prototype.pad(e.getMinutes())},j:function(e){return e.getDate()},l:function(e){return ne.l10n.weekdays.longhand[ne.formats.w(e)]},m:function(e){return Flatpickr.prototype.pad(ne.formats.n(e))},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},w:function(e){return e.getDay()},y:function(e){return String(ne.formats.Y(e)).substring(2)}}}function U(){ne.input=ne.config.wrap?ne.element.querySelector("[data-input]"):ne.element,ne.input.classList.add("flatpickr-input"),ne.config.altInput&&(ne.altInput=X(ne.input.nodeName,ne.config.altInputClass),ne.altInput.placeholder=ne.input.placeholder,ne.altInput.type="text",ne.input.type="hidden",ne.input.parentNode&&ne.input.parentNode.insertBefore(ne.altInput,ne.input.nextSibling)),ne.config.allowInput||(ne.altInput||ne.input).setAttribute("readonly","readonly")}function B(){var e=ne.config.enableTime?ne.config.noCalendar?"time":"datetime-local":"date";ne.mobileInput=X("input","flatpickr-input flatpickr-mobile"),ne.mobileInput.step="any",ne.mobileInput.tabIndex=-1,ne.mobileInput.type=e,ne.mobileInput.disabled=ne.input.disabled,ne.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",ne.selectedDates.length&&(ne.mobileInput.defaultValue=ne.mobileInput.value=k(ne.mobileFormatStr,ne.selectedDates[0])),ne.config.minDate&&(ne.mobileInput.min=k("Y-m-d",ne.config.minDate)),ne.config.maxDate&&(ne.mobileInput.max=k("Y-m-d",ne.config.maxDate)),ne.input.type="hidden",ne.config.altInput&&(ne.altInput.type="hidden");try{ne.input.parentNode.insertBefore(ne.mobileInput,ne.input.nextSibling)}catch(e){}ne.mobileInput.addEventListener("change",function(e){ne.setDate(e.target.value),J("Change"),J("Close")})}function z(){ne.isOpen?ne.close():ne.open()}function J(e,t){if(ne.config["on"+e])for(var n=Array.isArray(ne.config["on"+e])?ne.config["on"+e]:[ne.config["on"+e]],a=0;a<n.length;a++)n[a](ne.selectedDates,ne.input.value,ne,t);if("Change"===e)try{ne.input.dispatchEvent(new Event("change",{bubbles:!0})),ne.input.dispatchEvent(new Event("input",{bubbles:!0}))}catch(e){if("createEvent"in document)return ne.input.dispatchEvent(ne.changeEvent);ne.input.fireEvent("onchange")}}function K(){return ne.selectedDates.length?ne.selectedDates[ne.selectedDates.length-1]:null}function q(e){for(var t=0;t<ne.selectedDates.length;t++)if(0===ee(ne.selectedDates[t],e))return""+t;return!1}function V(e){return!("range"!==ne.config.mode||ne.selectedDates.length<2)&&(ee(e,ne.selectedDates[0])>=0&&ee(e,ne.selectedDates[1])<=0)}function $(){if(!ne.config.noCalendar&&!ne.isMobile&&ne.monthNav){if(ne.currentMonthElement.textContent=ne.utils.monthToStr(ne.currentMonth)+" ",ne.currentYearElement.value=ne.currentYear,ne.config.minDate){var e=ne.currentYear===ne.config.minDate.getFullYear()?(ne.currentMonth+11)%12<ne.config.minDate.getMonth():ne.currentYear<ne.config.minDate.getFullYear();ne.prevMonthNav.style.display=e?"none":"block"}else ne.prevMonthNav.style.display="block";if(ne.config.maxDate){var t=ne.currentYear===ne.config.maxDate.getFullYear()?ne.currentMonth+1>ne.config.maxDate.getMonth():ne.currentYear>ne.config.maxDate.getFullYear();ne.nextMonthNav.style.display=t?"none":"block"}else ne.nextMonthNav.style.display="block"}}function Q(){if(!ne.selectedDates.length)return ne.clear();ne.isMobile&&(ne.mobileInput.value=ne.selectedDates.length?k(ne.mobileFormatStr,K()):"");var e="range"!==ne.config.mode?"; ":ne.l10n.rangeSeparator;ne.input.value=ne.selectedDates.map(function(e){return k(ne.config.dateFormat,e)}).join(e),ne.config.altInput&&(ne.altInput.value=ne.selectedDates.map(function(e){return k(ne.config.altFormat,e)}).join(e)),J("ValueUpdate")}function G(e){e.preventDefault();var t=Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY)),n=parseInt(e.target.value,10)+t;E(n),e.target.value=ne.currentYear}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=document.createElement(e);return a.className=t,n&&(a.innerHTML=n),a}function Z(e,t,n){var a=void 0;return function(){for(var i=arguments.length,r=Array(i),o=0;o<i;o++)r[o]=arguments[o];var l=this,c=function(){a=null,n||e.apply(l,r)};clearTimeout(a),a=setTimeout(c,t),n&&!a&&e.apply(l,r)}}function ee(e,t){return e instanceof Date&&t instanceof Date&&new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0)}function te(e){if(e.preventDefault(),e&&((e.target.value||e.target.textContent).length>=2||"keydown"!==e.type&&"input"!==e.type)&&e.target.blur(),ne.amPM&&e.target===ne.amPM)return e.target.textContent=["AM","PM"]["AM"===e.target.textContent|0];var t=Number(e.target.min),n=Number(e.target.max),a=Number(e.target.step),i=parseInt(e.target.value,10),r=Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY)),o=Number(i);"wheel"===e.type?o=i+a*r:"keydown"===e.type&&(o=i+a*(38===e.which?1:-1)),o<t?o=n+o+(e.target!==ne.hourElement)+(e.target===ne.hourElement&&!ne.amPM):o>n&&(o=e.target===ne.hourElement?o-n-!ne.amPM:t),ne.amPM&&e.target===ne.hourElement&&(1===a?o+i===23:Math.abs(o-i)>a)&&(ne.amPM.textContent="PM"===ne.amPM.innerHTML?"AM":"PM"),e.target.value=ne.pad(o)}var ne=this;return n(),ne}function _flatpickr(e,t){for(var n=[],a=0;a<e.length;a++)try{e[a]._flatpickr=new Flatpickr(e[a],t||{}),n.push(e[a]._flatpickr)}catch(e){console.warn(e,e.stack)}return 1===n.length?n[0]:n}function flatpickr(e,t){return _flatpickr(document.querySelectorAll(e),t)}var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Flatpickr.defaultConfig={mode:"single",utc:!1,wrap:!1,weekNumbers:!1,allowInput:!1,clickOpens:!0,time_24hr:!1,enableTime:!1,noCalendar:!1,dateFormat:"Y-m-d",altInput:!1,altInputClass:"flatpickr-input form-control input",altFormat:"F j, Y",defaultDate:null,minDate:null,maxDate:null,parseDate:null,formatDate:null,getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},enable:[],disable:[],shorthandCurrentMonth:!1,inline:!1,static:!1,appendTo:null,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",enableSeconds:!1,hourIncrement:1,minuteIncrement:5,defaultHour:12,defaultMinute:0,disableMobile:!1,locale:"default",onChange:null,onOpen:null,onClose:null,onReady:null,onValueUpdate:null,onDayCreate:null},Flatpickr.l10ns={en:{weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle"}},Flatpickr.l10ns.default=Flatpickr.l10ns.en,Flatpickr.localize=function(e){return _extends(Flatpickr.l10ns.default,e||{})},Flatpickr.prototype={pad:function(e){return("0"+e).slice(-2)}},"undefined"!=typeof HTMLElement&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return _flatpickr(this,e)},HTMLElement.prototype.flatpickr=function(e){return _flatpickr([this],e)}),"undefined"!=typeof jQuery&&(jQuery.fn.flatpickr=function(e){return _flatpickr(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+parseInt(e,10))},Date.prototype.fp_isUTC=!1,Date.prototype.fp_toUTC=function(){var e=new Date(this.getUTCFullYear(),this.getUTCMonth(),this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds());return e.fp_isUTC=!0,e},"classList"in document.documentElement||!Object.defineProperty||"undefined"==typeof HTMLElement||Object.defineProperty(HTMLElement.prototype,"classList",{
get:function(){function e(e){return function(n){var a=t.className.split(/\s+/),i=a.indexOf(n);e(a,i,n),t.className=a.join(" ")}}var t=this,n={add:e(function(e,t,n){~t||e.push(n)}),remove:e(function(e,t){~t&&e.splice(t,1)}),toggle:e(function(e,t,n){~t?e.splice(t,1):e.push(n)}),contains:function(e){return!!~t.className.split(/\s+/).indexOf(e)},item:function(e){return t.className.split(/\s+/)[e]||null}};return Object.defineProperty(n,"length",{get:function(){return t.className.split(/\s+/).length}}),n}}),"undefined"!=typeof module&&(module.exports=Flatpickr);

/// <reference path="../../Misc/Typings/facebook.d.ts"/>
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var Facebook = /** @class */ (function () {
            function Facebook(appId) {
                window.fbAsyncInit = function () {
                    FB.init({
                        appId: appId,
                        xfbml: true,
                        version: 'v2.8'
                    });
                    FB.AppEvents.logPageView();
                };
                !function (d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0];
                    if (d.getElementById(id)) {
                        return;
                    }
                    js = d.createElement(s);
                    js.id = id;
                    js.src = "//connect.facebook.net/en_US/sdk.js";
                    fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk');
            }
            return Facebook;
        }());
        Common.Facebook = Facebook;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=facebook.js.map
/*!
 * hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
 * http://cherne.net/brian/resources/jquery.hoverIntent.html
 *
 * You may use hoverIntent under the terms of the MIT license. Basically that
 * means you are free to use hoverIntent as long as this header is left intact.
 * Copyright 2007, 2014 Brian Cherne
 */
(function ($) { $.fn.hoverIntent = function (handlerIn, handlerOut, selector) { var cfg = { interval: 100, sensitivity: 6, timeout: 0 }; if (typeof handlerIn === "object") { cfg = $.extend(cfg, handlerIn) } else { if ($.isFunction(handlerOut)) { cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector }) } else { cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut }) } } var cX, cY, pX, pY; var track = function (ev) { cX = ev.pageX; cY = ev.pageY }; var compare = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if (Math.sqrt((pX - cX) * (pX - cX) + (pY - cY) * (pY - cY)) < cfg.sensitivity) { $(ob).off("mousemove.hoverIntent", track); ob.hoverIntent_s = true; return cfg.over.apply(ob, [ev]) } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function () { compare(ev, ob) }, cfg.interval) } }; var delay = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = false; return cfg.out.apply(ob, [ev]) }; var handleHover = function (e) { var ev = $.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t) } if (e.type === "mouseenter") { pX = ev.pageX; pY = ev.pageY; $(ob).on("mousemove.hoverIntent", track); if (!ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout(function () { compare(ev, ob) }, cfg.interval) } } else { $(ob).off("mousemove.hoverIntent", track); if (ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout(function () { delay(ev, ob) }, cfg.timeout) } } }; return this.on({ "mouseenter.hoverIntent": handleHover, "mouseleave.hoverIntent": handleHover }, cfg.selector) } })(jQuery);
/*!
 * imagesLoaded PACKAGED v4.1.1
 * JavaScript is all like "You images are done yet or what?"
 * MIT License
 */

!function (t, e) { "function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", e) : "object" == typeof module && module.exports ? module.exports = e() : t.EvEmitter = e() }("undefined" != typeof window ? window : this, function () { function t() { } var e = t.prototype; return e.on = function (t, e) { if (t && e) { var i = this._events = this._events || {}, n = i[t] = i[t] || []; return -1 == n.indexOf(e) && n.push(e), this } }, e.once = function (t, e) { if (t && e) { this.on(t, e); var i = this._onceEvents = this._onceEvents || {}, n = i[t] = i[t] || {}; return n[e] = !0, this } }, e.off = function (t, e) { var i = this._events && this._events[t]; if (i && i.length) { var n = i.indexOf(e); return -1 != n && i.splice(n, 1), this } }, e.emitEvent = function (t, e) { var i = this._events && this._events[t]; if (i && i.length) { var n = 0, o = i[n]; e = e || []; for (var r = this._onceEvents && this._onceEvents[t]; o;) { var s = r && r[o]; s && (this.off(t, o), delete r[o]), o.apply(this, e), n += s ? 0 : 1, o = i[n] } return this } }, t }), function (t, e) { "use strict"; "function" == typeof define && define.amd ? define(["ev-emitter/ev-emitter"], function (i) { return e(t, i) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("ev-emitter")) : t.imagesLoaded = e(t, t.EvEmitter) }(window, function (t, e) { function i(t, e) { for (var i in e) t[i] = e[i]; return t } function n(t) { var e = []; if (Array.isArray(t)) e = t; else if ("number" == typeof t.length) for (var i = 0; i < t.length; i++) e.push(t[i]); else e.push(t); return e } function o(t, e, r) { return this instanceof o ? ("string" == typeof t && (t = document.querySelectorAll(t)), this.elements = n(t), this.options = i({}, this.options), "function" == typeof e ? r = e : i(this.options, e), r && this.on("always", r), this.getImages(), h && (this.jqDeferred = new h.Deferred), void setTimeout(function () { this.check() }.bind(this))) : new o(t, e, r) } function r(t) { this.img = t } function s(t, e) { this.url = t, this.element = e, this.img = new Image } var h = t.jQuery, a = t.console; o.prototype = Object.create(e.prototype), o.prototype.options = {}, o.prototype.getImages = function () { this.images = [], this.elements.forEach(this.addElementImages, this) }, o.prototype.addElementImages = function (t) { "IMG" == t.nodeName && this.addImage(t), this.options.background === !0 && this.addElementBackgroundImages(t); var e = t.nodeType; if (e && d[e]) { for (var i = t.querySelectorAll("img"), n = 0; n < i.length; n++) { var o = i[n]; this.addImage(o) } if ("string" == typeof this.options.background) { var r = t.querySelectorAll(this.options.background); for (n = 0; n < r.length; n++) { var s = r[n]; this.addElementBackgroundImages(s) } } } }; var d = { 1: !0, 9: !0, 11: !0 }; return o.prototype.addElementBackgroundImages = function (t) { var e = getComputedStyle(t); if (e) for (var i = /url\((['"])?(.*?)\1\)/gi, n = i.exec(e.backgroundImage) ; null !== n;) { var o = n && n[2]; o && this.addBackground(o, t), n = i.exec(e.backgroundImage) } }, o.prototype.addImage = function (t) { var e = new r(t); this.images.push(e) }, o.prototype.addBackground = function (t, e) { var i = new s(t, e); this.images.push(i) }, o.prototype.check = function () { function t(t, i, n) { setTimeout(function () { e.progress(t, i, n) }) } var e = this; return this.progressedCount = 0, this.hasAnyBroken = !1, this.images.length ? void this.images.forEach(function (e) { e.once("progress", t), e.check() }) : void this.complete() }, o.prototype.progress = function (t, e, i) { this.progressedCount++, this.hasAnyBroken = this.hasAnyBroken || !t.isLoaded, this.emitEvent("progress", [this, t, e]), this.jqDeferred && this.jqDeferred.notify && this.jqDeferred.notify(this, t), this.progressedCount == this.images.length && this.complete(), this.options.debug && a && a.log("progress: " + i, t, e) }, o.prototype.complete = function () { var t = this.hasAnyBroken ? "fail" : "done"; if (this.isComplete = !0, this.emitEvent(t, [this]), this.emitEvent("always", [this]), this.jqDeferred) { var e = this.hasAnyBroken ? "reject" : "resolve"; this.jqDeferred[e](this) } }, r.prototype = Object.create(e.prototype), r.prototype.check = function () { var t = this.getIsImageComplete(); return t ? void this.confirm(0 !== this.img.naturalWidth, "naturalWidth") : (this.proxyImage = new Image, this.proxyImage.addEventListener("load", this), this.proxyImage.addEventListener("error", this), this.img.addEventListener("load", this), this.img.addEventListener("error", this), void (this.proxyImage.src = this.img.src)) }, r.prototype.getIsImageComplete = function () { return this.img.complete && void 0 !== this.img.naturalWidth }, r.prototype.confirm = function (t, e) { this.isLoaded = t, this.emitEvent("progress", [this, this.img, e]) }, r.prototype.handleEvent = function (t) { var e = "on" + t.type; this[e] && this[e](t) }, r.prototype.onload = function () { this.confirm(!0, "onload"), this.unbindEvents() }, r.prototype.onerror = function () { this.confirm(!1, "onerror"), this.unbindEvents() }, r.prototype.unbindEvents = function () { this.proxyImage.removeEventListener("load", this), this.proxyImage.removeEventListener("error", this), this.img.removeEventListener("load", this), this.img.removeEventListener("error", this) }, s.prototype = Object.create(r.prototype), s.prototype.check = function () { this.img.addEventListener("load", this), this.img.addEventListener("error", this), this.img.src = this.url; var t = this.getIsImageComplete(); t && (this.confirm(0 !== this.img.naturalWidth, "naturalWidth"), this.unbindEvents()) }, s.prototype.unbindEvents = function () { this.img.removeEventListener("load", this), this.img.removeEventListener("error", this) }, s.prototype.confirm = function (t, e) { this.isLoaded = t, this.emitEvent("progress", [this, this.element, e]) }, o.makeJQueryPlugin = function (e) { e = e || t.jQuery, e && (h = e, h.fn.imagesLoaded = function (t, e) { var i = new o(this, t, e); return i.jqDeferred.promise(h(this)) }) }, o.makeJQueryPlugin(), o });
/*
* $ lightbox_me
* By: Buck Wilson
* Version : 2.4
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


(function($) {

    $.fn.lightbox_me = function(options) {

        return this.each(function() {

            var
                opts = $.extend({}, $.fn.lightbox_me.defaults, options),
                $overlay = $(),
                $self = $(this),
                $iframe = $('<iframe id="foo" style="z-index: ' + (opts.zIndex + 1) + ';border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0; filter: mask();"/>');

            if (opts.showOverlay) {
                //check if there's an existing overlay, if so, make subequent ones clear
               var $currentOverlays = $(".js_lb_overlay:visible");
                if ($currentOverlays.length > 0){
                    $overlay = $('<div class="lb_overlay_clear js_lb_overlay"/>');
                } else {
                    $overlay = $('<div class="' + opts.classPrefix + '_overlay js_lb_overlay"/>');
                }
            }

            /*----------------------------------------------------
               DOM Building
            ---------------------------------------------------- */
            $('body').append($self.hide()).append($overlay);


            /*----------------------------------------------------
               Overlay CSS stuffs
            ---------------------------------------------------- */

            // set css of the overlay
            if (opts.showOverlay) {
                setOverlayHeight(); // pulled this into a function because it is called on window resize.
                $overlay.css({ position: 'absolute', width: '100%', top: 0, left: 0, right: 0, bottom: 0, zIndex: (opts.zIndex + 2), display: 'none' });
				if (!$overlay.hasClass('lb_overlay_clear')){
                	$overlay.css(opts.overlayCSS);
                }
            }

            /*----------------------------------------------------
               Animate it in.
            ---------------------------------------------------- */
               //
            if (opts.showOverlay) {
                $overlay.fadeIn(opts.overlaySpeed, function() {
                    setSelfPosition();
                    $self[opts.appearEffect](opts.lightboxSpeed, function() { setOverlayHeight(); setSelfPosition(); opts.onLoad()});
                });
            } else {
                setSelfPosition();
                $self[opts.appearEffect](opts.lightboxSpeed, function() { opts.onLoad()});
            }

            /*----------------------------------------------------
               Hide parent if parent specified (parentLightbox should be jquery reference to any parent lightbox)
            ---------------------------------------------------- */
            if (opts.parentLightbox) {
                opts.parentLightbox.fadeOut(200);
            }


            /*----------------------------------------------------
               Bind Events
            ---------------------------------------------------- */

            $(window).resize(setOverlayHeight)
                     .resize(setSelfPosition)
                     .scroll(setSelfPosition);

            $(window).bind('keyup.lightbox_me', observeKeyPress);

            if (opts.closeClick) {
                $overlay.click(function(e) { closeLightbox(); e.preventDefault; });
            }
            $self.delegate(opts.closeSelector, "click", function(e) {
                closeLightbox(); e.preventDefault();
            });
            $self.bind('close', closeLightbox);
            $self.bind('reposition', setSelfPosition);



            /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */


            /*----------------------------------------------------
               Private Functions
            ---------------------------------------------------- */

            /* Remove or hide all elements */
            function closeLightbox() {
                var s = $self[0].style;
                if (opts.destroyOnClose) {
                    $self.add($overlay).remove();
                } else {
                    $self.add($overlay).hide();
                }

                //show the hidden parent lightbox
                if (opts.parentLightbox) {
                    opts.parentLightbox.fadeIn(200);
                }
                if (opts.preventScroll) {
                    $('body').css('overflow', '');
                }
                $iframe.remove();

				        // clean up events.
                $self.undelegate(opts.closeSelector, "click");
                $self.unbind('close', closeLightbox);
                $self.unbind('repositon', setSelfPosition);
                
                $(window).unbind('resize', setOverlayHeight);
                $(window).unbind('resize', setSelfPosition);
                $(window).unbind('scroll', setSelfPosition);
                $(window).unbind('keyup.lightbox_me');
                opts.onClose();
            }


            /* Function to bind to the window to observe the escape/enter key press */
            function observeKeyPress(e) {
                if((e.keyCode == 27 || (e.DOM_VK_ESCAPE == 27 && e.which==0)) && opts.closeEsc) closeLightbox();
            }


            /* Set the height of the overlay
                    : if the document height is taller than the window, then set the overlay height to the document height.
                    : otherwise, just set overlay height: 100%
            */
            function setOverlayHeight() {
                if ($(window).height() < $(document).height()) {
                    $overlay.css({height: $(document).height() + 'px'});
                     $iframe.css({height: $(document).height() + 'px'});
                } else {
                    $overlay.css({height: '100%'});
                }
            }


            /* Set the position of the modal'd window ($self)
                    : if $self is taller than the window, then make it absolutely positioned
                    : otherwise fixed
            */
            function setSelfPosition() {
                var s = $self[0].style;

                // reset CSS so width is re-calculated for margin-left CSS
                $self.css({left: '50%', marginLeft: ($self.outerWidth() / 2) * -1,  zIndex: (opts.zIndex + 3) });


                /* we have to get a little fancy when dealing with height, because lightbox_me
                    is just so fancy.
                 */

                // if the height of $self is bigger than the window and self isn't already position absolute
                if (($self.height() + 80  >= $(window).height()) && ($self.css('position') != 'absolute')) {

                    // we are going to make it positioned where the user can see it, but they can still scroll
                    // so the top offset is based on the user's scroll position.
                    var topOffset = ($(document).scrollTop() + 40) + 'px';

                    if (opts.modalCSS.top)
                        topOffset = opts.modalCSS.top;

                    $self.css({ position: 'absolute', top: topOffset, marginTop: 0 });
                } else if ($self.height()+ 80  < $(window).height()) {
                    //if the height is less than the window height, then we're gonna make this thing position: fixed.
                    if (opts.centered) {
                        $self.css({ position: 'fixed', top: '50%', marginTop: ($self.outerHeight() / 2) * -1 });
                    } else {
                        $self.css({ position: 'fixed'}).css(opts.modalCSS);
                    }
                    if (opts.preventScroll) {
                        $('body').css('overflow', 'hidden');
                    }
                }
            }

        });



    };

    $.fn.lightbox_me.defaults = {

        // animation
        appearEffect: "fadeIn",
        appearEase: "",
        overlaySpeed: 250,
        lightboxSpeed: 300,

        // close
        closeSelector: ".close",
        closeClick: true,
        closeEsc: true,

        // behavior
        destroyOnClose: false,
        showOverlay: true,
        parentLightbox: false,
        preventScroll: false,

        // callbacks
        onLoad: function() {},
        onClose: function() {},

        // style
        classPrefix: 'lb',
        zIndex: 999,
        centered: false,
        modalCSS: {top: '40px'},
        overlayCSS: {background: 'black', opacity: .3}
    }
})(jQuery);

/// <reference path="../../../Misc/Typings/google.maps.d.ts"/>
/// <reference path="../../../Scripts/typings/jquery/jquery.d.ts"/>
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var GoogleMap = /** @class */ (function () {
            function GoogleMap() {
            }
            GoogleMap.renderBasicMarkerMap = function (mapLocation, mapOptions, markerOptions) {
                // Create a map object and specify the DOM element for display.
                mapOptions.scrollwheel = mapOptions.scrollwheel || GoogleMap.scrollwheel;
                mapOptions.mapTypeControl = mapOptions.mapTypeControl || GoogleMap.mapTypeControl;
                mapOptions.zoom = mapOptions.zoom || GoogleMap.zoom;
                var map = new google.maps.Map(mapLocation, mapOptions);
                // Create a marker and set its position.
                markerOptions.map = map;
                var marker = new google.maps.Marker(markerOptions);
                return new GoogleMapInformation(map, marker);
            };
            GoogleMap.panBasicMarkerMap = function (mapInfo, location) {
                mapInfo.map.panTo(location);
                mapInfo.marker.setPosition(location);
                return mapInfo;
            };
            GoogleMap.isTouchBrowser = function () {
                return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
            };
            //defaultLatLng: google.maps.LatLng;
            //biasingBounds: google.maps.LatLngBounds;
            //biasingRegion: string;
            //mapType: google.maps.MapTypeId;
            GoogleMap.scrollwheel = false;
            GoogleMap.mapTypeControl = false;
            GoogleMap.zoom = 12;
            return GoogleMap;
        }());
        Common.GoogleMap = GoogleMap;
        var GoogleMapInformation = /** @class */ (function () {
            function GoogleMapInformation(map, marker) {
                this.map = map;
                this.marker = marker;
            }
            return GoogleMapInformation;
        }());
        Common.GoogleMapInformation = GoogleMapInformation;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=google-map.js.map
/*!
 * Masonry PACKAGED v4.0.0
 * Cascading grid layout library
 * http://masonry.desandro.com
 * MIT License
 * by David DeSandro
 */

!function (t, e) { "use strict"; "function" == typeof define && define.amd ? define("jquery-bridget/jquery-bridget", ["jquery"], function (i) { e(t, i) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("jquery")) : t.jQueryBridget = e(t, t.jQuery) }(window, function (t, e) { "use strict"; function i(i, r, a) { function h(t, e, n) { var o, r = "$()." + i + '("' + e + '")'; return t.each(function (t, h) { var u = a.data(h, i); if (!u) return void s(i + " not initialized. Cannot call methods, i.e. " + r); var d = u[e]; if (!d || "_" == e.charAt(0)) return void s(r + " is not a valid method"); var c = d.apply(u, n); o = void 0 === o ? c : o }), void 0 !== o ? o : t } function u(t, e) { t.each(function (t, n) { var o = a.data(n, i); o ? (o.option(e), o._init()) : (o = new r(n, e), a.data(n, i, o)) }) } a = a || e || t.jQuery, a && (r.prototype.option || (r.prototype.option = function (t) { a.isPlainObject(t) && (this.options = a.extend(!0, this.options, t)) }), a.fn[i] = function (t) { if ("string" == typeof t) { var e = o.call(arguments, 1); return h(this, t, e) } return u(this, t), this }, n(a)) } function n(t) { !t || t && t.bridget || (t.bridget = i) } var o = Array.prototype.slice, r = t.console, s = "undefined" == typeof r ? function () { } : function (t) { r.error(t) }; return n(e || t.jQuery), i }), function (t, e) { "function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", e) : "object" == typeof module && module.exports ? module.exports = e() : t.EvEmitter = e() }(this, function () { function t() { } var e = t.prototype; return e.on = function (t, e) { if (t && e) { var i = this._events = this._events || {}, n = i[t] = i[t] || []; return -1 == n.indexOf(e) && n.push(e), this } }, e.once = function (t, e) { if (t && e) { this.on(t, e); var i = this._onceEvents = this._onceEvents || {}, n = i[t] = i[t] || []; return n[e] = !0, this } }, e.off = function (t, e) { var i = this._events && this._events[t]; if (i && i.length) { var n = i.indexOf(e); return -1 != n && i.splice(n, 1), this } }, e.emitEvent = function (t, e) { var i = this._events && this._events[t]; if (i && i.length) { var n = 0, o = i[n]; e = e || []; for (var r = this._onceEvents && this._onceEvents[t]; o;) { var s = r && r[o]; s && (this.off(t, o), delete r[o]), o.apply(this, e), n += s ? 0 : 1, o = i[n] } return this } }, t }), function (t, e) { "use strict"; "function" == typeof define && define.amd ? define("get-size/get-size", [], function () { return e() }) : "object" == typeof module && module.exports ? module.exports = e() : t.getSize = e() }(window, function () { "use strict"; function t(t) { var e = parseFloat(t), i = -1 == t.indexOf("%") && !isNaN(e); return i && e } function e() { } function i() { for (var t = { width: 0, height: 0, innerWidth: 0, innerHeight: 0, outerWidth: 0, outerHeight: 0 }, e = 0; u > e; e++) { var i = h[e]; t[i] = 0 } return t } function n(t) { var e = getComputedStyle(t); return e || a("Style returned " + e + ". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"), e } function o() { if (!d) { d = !0; var e = document.createElement("div"); e.style.width = "200px", e.style.padding = "1px 2px 3px 4px", e.style.borderStyle = "solid", e.style.borderWidth = "1px 2px 3px 4px", e.style.boxSizing = "border-box"; var i = document.body || document.documentElement; i.appendChild(e); var o = n(e); r.isBoxSizeOuter = s = 200 == t(o.width), i.removeChild(e) } } function r(e) { if (o(), "string" == typeof e && (e = document.querySelector(e)), e && "object" == typeof e && e.nodeType) { var r = n(e); if ("none" == r.display) return i(); var a = {}; a.width = e.offsetWidth, a.height = e.offsetHeight; for (var d = a.isBorderBox = "border-box" == r.boxSizing, c = 0; u > c; c++) { var l = h[c], f = r[l], m = parseFloat(f); a[l] = isNaN(m) ? 0 : m } var p = a.paddingLeft + a.paddingRight, g = a.paddingTop + a.paddingBottom, y = a.marginLeft + a.marginRight, v = a.marginTop + a.marginBottom, _ = a.borderLeftWidth + a.borderRightWidth, E = a.borderTopWidth + a.borderBottomWidth, z = d && s, b = t(r.width); b !== !1 && (a.width = b + (z ? 0 : p + _)); var x = t(r.height); return x !== !1 && (a.height = x + (z ? 0 : g + E)), a.innerWidth = a.width - (p + _), a.innerHeight = a.height - (g + E), a.outerWidth = a.width + y, a.outerHeight = a.height + v, a } } var s, a = "undefined" == typeof console ? e : function (t) { console.error(t) }, h = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "marginLeft", "marginRight", "marginTop", "marginBottom", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth"], u = h.length, d = !1; return r }), function (t, e) { "use strict"; "function" == typeof define && define.amd ? define("matches-selector/matches-selector", e) : "object" == typeof module && module.exports ? module.exports = e() : t.matchesSelector = e() }(window, function () { "use strict"; var t = function () { var t = Element.prototype; if (t.matches) return "matches"; if (t.matchesSelector) return "matchesSelector"; for (var e = ["webkit", "moz", "ms", "o"], i = 0; i < e.length; i++) { var n = e[i], o = n + "MatchesSelector"; if (t[o]) return o } }(); return function (e, i) { return e[t](i) } }), function (t, e) { "use strict"; "function" == typeof define && define.amd ? define("fizzy-ui-utils/utils", ["matches-selector/matches-selector"], function (i) { return e(t, i) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("desandro-matches-selector")) : t.fizzyUIUtils = e(t, t.matchesSelector) }(window, function (t, e) { var i = {}; i.extend = function (t, e) { for (var i in e) t[i] = e[i]; return t }, i.modulo = function (t, e) { return (t % e + e) % e }, i.makeArray = function (t) { var e = []; if (Array.isArray(t)) e = t; else if (t && "number" == typeof t.length) for (var i = 0; i < t.length; i++) e.push(t[i]); else e.push(t); return e }, i.removeFrom = function (t, e) { var i = t.indexOf(e); -1 != i && t.splice(i, 1) }, i.getParent = function (t, i) { for (; t != document.body;) if (t = t.parentNode, e(t, i)) return t }, i.getQueryElement = function (t) { return "string" == typeof t ? document.querySelector(t) : t }, i.handleEvent = function (t) { var e = "on" + t.type; this[e] && this[e](t) }, i.filterFindElements = function (t, n) { t = i.makeArray(t); var o = []; return t.forEach(function (t) { if (t instanceof HTMLElement) { if (!n) return void o.push(t); e(t, n) && o.push(t); for (var i = t.querySelectorAll(n), r = 0; r < i.length; r++) o.push(i[r]) } }), o }, i.debounceMethod = function (t, e, i) { var n = t.prototype[e], o = e + "Timeout"; t.prototype[e] = function () { var t = this[o]; t && clearTimeout(t); var e = arguments, r = this; this[o] = setTimeout(function () { n.apply(r, e), delete r[o] }, i || 100) } }, i.docReady = function (t) { "complete" == document.readyState ? t() : document.addEventListener("DOMContentLoaded", t) }, i.toDashed = function (t) { return t.replace(/(.)([A-Z])/g, function (t, e, i) { return e + "-" + i }).toLowerCase() }; var n = t.console; return i.htmlInit = function (e, o) { i.docReady(function () { var r = i.toDashed(o), s = "data-" + r, a = document.querySelectorAll("[" + s + "]"), h = document.querySelectorAll(".js-" + r), u = i.makeArray(a).concat(i.makeArray(h)), d = s + "-options", c = t.jQuery; u.forEach(function (t) { var i, r = t.getAttribute(s) || t.getAttribute(d); try { i = r && JSON.parse(r) } catch (a) { return void (n && n.error("Error parsing " + s + " on " + t.className + ": " + a)) } var h = new e(t, i); c && c.data(t, o, h) }) }) }, i }), function (t, e) { "function" == typeof define && define.amd ? define("outlayer/item", ["ev-emitter/ev-emitter", "get-size/get-size"], function (i, n) { return e(t, i, n) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("ev-emitter"), require("get-size")) : (t.Outlayer = {}, t.Outlayer.Item = e(t, t.EvEmitter, t.getSize)) }(window, function (t, e, i) { "use strict"; function n(t) { for (var e in t) return !1; return e = null, !0 } function o(t, e) { t && (this.element = t, this.layout = e, this.position = { x: 0, y: 0 }, this._create()) } function r(t) { return t.replace(/([A-Z])/g, function (t) { return "-" + t.toLowerCase() }) } var s = document.documentElement.style, a = "string" == typeof s.transition ? "transition" : "WebkitTransition", h = "string" == typeof s.transform ? "transform" : "WebkitTransform", u = { WebkitTransition: "webkitTransitionEnd", transition: "transitionend" }[a], d = [h, a, a + "Duration", a + "Property"], c = o.prototype = Object.create(e.prototype); c.constructor = o, c._create = function () { this._transn = { ingProperties: {}, clean: {}, onEnd: {} }, this.css({ position: "absolute" }) }, c.handleEvent = function (t) { var e = "on" + t.type; this[e] && this[e](t) }, c.getSize = function () { this.size = i(this.element) }, c.css = function (t) { var e = this.element.style; for (var i in t) { var n = d[i] || i; e[n] = t[i] } }, c.getPosition = function () { var t = getComputedStyle(this.element), e = this.layout._getOption("originLeft"), i = this.layout._getOption("originTop"), n = t[e ? "left" : "right"], o = t[i ? "top" : "bottom"], r = this.layout.size, s = -1 != n.indexOf("%") ? parseFloat(n) / 100 * r.width : parseInt(n, 10), a = -1 != o.indexOf("%") ? parseFloat(o) / 100 * r.height : parseInt(o, 10); s = isNaN(s) ? 0 : s, a = isNaN(a) ? 0 : a, s -= e ? r.paddingLeft : r.paddingRight, a -= i ? r.paddingTop : r.paddingBottom, this.position.x = s, this.position.y = a }, c.layoutPosition = function () { var t = this.layout.size, e = {}, i = this.layout._getOption("originLeft"), n = this.layout._getOption("originTop"), o = i ? "paddingLeft" : "paddingRight", r = i ? "left" : "right", s = i ? "right" : "left", a = this.position.x + t[o]; e[r] = this.getXValue(a), e[s] = ""; var h = n ? "paddingTop" : "paddingBottom", u = n ? "top" : "bottom", d = n ? "bottom" : "top", c = this.position.y + t[h]; e[u] = this.getYValue(c), e[d] = "", this.css(e), this.emitEvent("layout", [this]) }, c.getXValue = function (t) { var e = this.layout._getOption("horizontal"); return this.layout.options.percentPosition && !e ? t / this.layout.size.width * 100 + "%" : t + "px" }, c.getYValue = function (t) { var e = this.layout._getOption("horizontal"); return this.layout.options.percentPosition && e ? t / this.layout.size.height * 100 + "%" : t + "px" }, c._transitionTo = function (t, e) { this.getPosition(); var i = this.position.x, n = this.position.y, o = parseInt(t, 10), r = parseInt(e, 10), s = o === this.position.x && r === this.position.y; if (this.setPosition(t, e), s && !this.isTransitioning) return void this.layoutPosition(); var a = t - i, h = e - n, u = {}; u.transform = this.getTranslate(a, h), this.transition({ to: u, onTransitionEnd: { transform: this.layoutPosition }, isCleaning: !0 }) }, c.getTranslate = function (t, e) { var i = this.layout._getOption("originLeft"), n = this.layout._getOption("originTop"); return t = i ? t : -t, e = n ? e : -e, "translate3d(" + t + "px, " + e + "px, 0)" }, c.goTo = function (t, e) { this.setPosition(t, e), this.layoutPosition() }, c.moveTo = c._transitionTo, c.setPosition = function (t, e) { this.position.x = parseInt(t, 10), this.position.y = parseInt(e, 10) }, c._nonTransition = function (t) { this.css(t.to), t.isCleaning && this._removeStyles(t.to); for (var e in t.onTransitionEnd) t.onTransitionEnd[e].call(this) }, c._transition = function (t) { if (!parseFloat(this.layout.options.transitionDuration)) return void this._nonTransition(t); var e = this._transn; for (var i in t.onTransitionEnd) e.onEnd[i] = t.onTransitionEnd[i]; for (i in t.to) e.ingProperties[i] = !0, t.isCleaning && (e.clean[i] = !0); if (t.from) { this.css(t.from); var n = this.element.offsetHeight; n = null } this.enableTransition(t.to), this.css(t.to), this.isTransitioning = !0 }; var l = "opacity," + r(d.transform || "transform"); c.enableTransition = function () { this.isTransitioning || (this.css({ transitionProperty: l, transitionDuration: this.layout.options.transitionDuration }), this.element.addEventListener(u, this, !1)) }, c.transition = o.prototype[a ? "_transition" : "_nonTransition"], c.onwebkitTransitionEnd = function (t) { this.ontransitionend(t) }, c.onotransitionend = function (t) { this.ontransitionend(t) }; var f = { "-webkit-transform": "transform" }; c.ontransitionend = function (t) { if (t.target === this.element) { var e = this._transn, i = f[t.propertyName] || t.propertyName; if (delete e.ingProperties[i], n(e.ingProperties) && this.disableTransition(), i in e.clean && (this.element.style[t.propertyName] = "", delete e.clean[i]), i in e.onEnd) { var o = e.onEnd[i]; o.call(this), delete e.onEnd[i] } this.emitEvent("transitionEnd", [this]) } }, c.disableTransition = function () { this.removeTransitionStyles(), this.element.removeEventListener(u, this, !1), this.isTransitioning = !1 }, c._removeStyles = function (t) { var e = {}; for (var i in t) e[i] = ""; this.css(e) }; var m = { transitionProperty: "", transitionDuration: "" }; return c.removeTransitionStyles = function () { this.css(m) }, c.removeElem = function () { this.element.parentNode.removeChild(this.element), this.css({ display: "" }), this.emitEvent("remove", [this]) }, c.remove = function () { return a && parseFloat(this.layout.options.transitionDuration) ? (this.once("transitionEnd", function () { this.removeElem() }), void this.hide()) : void this.removeElem() }, c.reveal = function () { delete this.isHidden, this.css({ display: "" }); var t = this.layout.options, e = {}, i = this.getHideRevealTransitionEndProperty("visibleStyle"); e[i] = this.onRevealTransitionEnd, this.transition({ from: t.hiddenStyle, to: t.visibleStyle, isCleaning: !0, onTransitionEnd: e }) }, c.onRevealTransitionEnd = function () { this.isHidden || this.emitEvent("reveal") }, c.getHideRevealTransitionEndProperty = function (t) { var e = this.layout.options[t]; if (e.opacity) return "opacity"; for (var i in e) return i }, c.hide = function () { this.isHidden = !0, this.css({ display: "" }); var t = this.layout.options, e = {}, i = this.getHideRevealTransitionEndProperty("hiddenStyle"); e[i] = this.onHideTransitionEnd, this.transition({ from: t.visibleStyle, to: t.hiddenStyle, isCleaning: !0, onTransitionEnd: e }) }, c.onHideTransitionEnd = function () { this.isHidden && (this.css({ display: "none" }), this.emitEvent("hide")) }, c.destroy = function () { this.css({ position: "", left: "", right: "", top: "", bottom: "", transition: "", transform: "" }) }, o }), function (t, e) { "use strict"; "function" == typeof define && define.amd ? define("outlayer/outlayer", ["ev-emitter/ev-emitter", "get-size/get-size", "fizzy-ui-utils/utils", "./item"], function (i, n, o, r) { return e(t, i, n, o, r) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("ev-emitter"), require("get-size"), require("fizzy-ui-utils"), require("./item")) : t.Outlayer = e(t, t.EvEmitter, t.getSize, t.fizzyUIUtils, t.Outlayer.Item) }(window, function (t, e, i, n, o) { "use strict"; function r(t, e) { var i = n.getQueryElement(t); if (!i) return void (a && a.error("Bad element for " + this.constructor.namespace + ": " + (i || t))); this.element = i, h && (this.$element = h(this.element)), this.options = n.extend({}, this.constructor.defaults), this.option(e); var o = ++d; this.element.outlayerGUID = o, c[o] = this, this._create(); var r = this._getOption("initLayout"); r && this.layout() } function s(t) { function e() { t.apply(this, arguments) } return e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e } var a = t.console, h = t.jQuery, u = function () { }, d = 0, c = {}; r.namespace = "outlayer", r.Item = o, r.defaults = { containerStyle: { position: "relative" }, initLayout: !0, originLeft: !0, originTop: !0, resize: !0, resizeContainer: !0, transitionDuration: "0.4s", hiddenStyle: { opacity: 0, transform: "scale(0.001)" }, visibleStyle: { opacity: 1, transform: "scale(1)" } }; var l = r.prototype; return n.extend(l, e.prototype), l.option = function (t) { n.extend(this.options, t) }, l._getOption = function (t) { var e = this.constructor.compatOptions[t]; return e && void 0 !== this.options[e] ? this.options[e] : this.options[t] }, r.compatOptions = { initLayout: "isInitLayout", horizontal: "isHorizontal", layoutInstant: "isLayoutInstant", originLeft: "isOriginLeft", originTop: "isOriginTop", resize: "isResizeBound", resizeContainer: "isResizingContainer" }, l._create = function () { this.reloadItems(), this.stamps = [], this.stamp(this.options.stamp), n.extend(this.element.style, this.options.containerStyle); var t = this._getOption("resize"); t && this.bindResize() }, l.reloadItems = function () { this.items = this._itemize(this.element.children) }, l._itemize = function (t) { for (var e = this._filterFindItemElements(t), i = this.constructor.Item, n = [], o = 0; o < e.length; o++) { var r = e[o], s = new i(r, this); n.push(s) } return n }, l._filterFindItemElements = function (t) { return n.filterFindElements(t, this.options.itemSelector) }, l.getItemElements = function () { return this.items.map(function (t) { return t.element }) }, l.layout = function () { this._resetLayout(), this._manageStamps(); var t = this._getOption("layoutInstant"), e = void 0 !== t ? t : !this._isLayoutInited; this.layoutItems(this.items, e), this._isLayoutInited = !0 }, l._init = l.layout, l._resetLayout = function () { this.getSize() }, l.getSize = function () { this.size = i(this.element) }, l._getMeasurement = function (t, e) { var n, o = this.options[t]; o ? ("string" == typeof o ? n = this.element.querySelector(o) : o instanceof HTMLElement && (n = o), this[t] = n ? i(n)[e] : o) : this[t] = 0 }, l.layoutItems = function (t, e) { t = this._getItemsForLayout(t), this._layoutItems(t, e), this._postLayout() }, l._getItemsForLayout = function (t) { return t.filter(function (t) { return !t.isIgnored }) }, l._layoutItems = function (t, e) { if (this._emitCompleteOnItems("layout", t), t && t.length) { var i = []; t.forEach(function (t) { var n = this._getItemLayoutPosition(t); n.item = t, n.isInstant = e || t.isLayoutInstant, i.push(n) }, this), this._processLayoutQueue(i) } }, l._getItemLayoutPosition = function () { return { x: 0, y: 0 } }, l._processLayoutQueue = function (t) { t.forEach(function (t) { this._positionItem(t.item, t.x, t.y, t.isInstant) }, this) }, l._positionItem = function (t, e, i, n) { n ? t.goTo(e, i) : t.moveTo(e, i) }, l._postLayout = function () { this.resizeContainer() }, l.resizeContainer = function () { var t = this._getOption("resizeContainer"); if (t) { var e = this._getContainerSize(); e && (this._setContainerMeasure(e.width, !0), this._setContainerMeasure(e.height, !1)) } }, l._getContainerSize = u, l._setContainerMeasure = function (t, e) { if (void 0 !== t) { var i = this.size; i.isBorderBox && (t += e ? i.paddingLeft + i.paddingRight + i.borderLeftWidth + i.borderRightWidth : i.paddingBottom + i.paddingTop + i.borderTopWidth + i.borderBottomWidth), t = Math.max(t, 0), this.element.style[e ? "width" : "height"] = t + "px" } }, l._emitCompleteOnItems = function (t, e) { function i() { o.dispatchEvent(t + "Complete", null, [e]) } function n() { s++, s == r && i() } var o = this, r = e.length; if (!e || !r) return void i(); var s = 0; e.forEach(function (e) { e.once(t, n) }) }, l.dispatchEvent = function (t, e, i) { var n = e ? [e].concat(i) : i; if (this.emitEvent(t, n), h) if (this.$element = this.$element || h(this.element), e) { var o = h.Event(e); o.type = t, this.$element.trigger(o, i) } else this.$element.trigger(t, i) }, l.ignore = function (t) { var e = this.getItem(t); e && (e.isIgnored = !0) }, l.unignore = function (t) { var e = this.getItem(t); e && delete e.isIgnored }, l.stamp = function (t) { t = this._find(t), t && (this.stamps = this.stamps.concat(t), t.forEach(this.ignore, this)) }, l.unstamp = function (t) { t = this._find(t), t && t.forEach(function (t) { n.removeFrom(this.stamps, t), this.unignore(t) }, this) }, l._find = function (t) { return t ? ("string" == typeof t && (t = this.element.querySelectorAll(t)), t = n.makeArray(t)) : void 0 }, l._manageStamps = function () { this.stamps && this.stamps.length && (this._getBoundingRect(), this.stamps.forEach(this._manageStamp, this)) }, l._getBoundingRect = function () { var t = this.element.getBoundingClientRect(), e = this.size; this._boundingRect = { left: t.left + e.paddingLeft + e.borderLeftWidth, top: t.top + e.paddingTop + e.borderTopWidth, right: t.right - (e.paddingRight + e.borderRightWidth), bottom: t.bottom - (e.paddingBottom + e.borderBottomWidth) } }, l._manageStamp = u, l._getElementOffset = function (t) { var e = t.getBoundingClientRect(), n = this._boundingRect, o = i(t), r = { left: e.left - n.left - o.marginLeft, top: e.top - n.top - o.marginTop, right: n.right - e.right - o.marginRight, bottom: n.bottom - e.bottom - o.marginBottom }; return r }, l.handleEvent = n.handleEvent, l.bindResize = function () { t.addEventListener("resize", this), this.isResizeBound = !0 }, l.unbindResize = function () { t.removeEventListener("resize", this), this.isResizeBound = !1 }, l.onresize = function () { this.resize() }, n.debounceMethod(r, "onresize", 100), l.resize = function () { this.isResizeBound && this.needsResizeLayout() && this.layout() }, l.needsResizeLayout = function () { var t = i(this.element), e = this.size && t; return e && t.innerWidth !== this.size.innerWidth }, l.addItems = function (t) { var e = this._itemize(t); return e.length && (this.items = this.items.concat(e)), e }, l.appended = function (t) { var e = this.addItems(t); e.length && (this.layoutItems(e, !0), this.reveal(e)) }, l.prepended = function (t) { var e = this._itemize(t); if (e.length) { var i = this.items.slice(0); this.items = e.concat(i), this._resetLayout(), this._manageStamps(), this.layoutItems(e, !0), this.reveal(e), this.layoutItems(i) } }, l.reveal = function (t) { this._emitCompleteOnItems("reveal", t), t && t.length && t.forEach(function (t) { t.reveal() }) }, l.hide = function (t) { this._emitCompleteOnItems("hide", t), t && t.length && t.forEach(function (t) { t.hide() }) }, l.revealItemElements = function (t) { var e = this.getItems(t); this.reveal(e) }, l.hideItemElements = function (t) { var e = this.getItems(t); this.hide(e) }, l.getItem = function (t) { for (var e = 0; e < this.items.length; e++) { var i = this.items[e]; if (i.element == t) return i } }, l.getItems = function (t) { t = n.makeArray(t); var e = []; return t.forEach(function (t) { var i = this.getItem(t); i && e.push(i) }, this), e }, l.remove = function (t) { var e = this.getItems(t); this._emitCompleteOnItems("remove", e), e && e.length && e.forEach(function (t) { t.remove(), n.removeFrom(this.items, t) }, this) }, l.destroy = function () { var t = this.element.style; t.height = "", t.position = "", t.width = "", this.items.forEach(function (t) { t.destroy() }), this.unbindResize(); var e = this.element.outlayerGUID; delete c[e], delete this.element.outlayerGUID, h && h.removeData(this.element, this.constructor.namespace) }, r.data = function (t) { t = n.getQueryElement(t); var e = t && t.outlayerGUID; return e && c[e] }, r.create = function (t, e) { var i = s(r); return i.defaults = n.extend({}, r.defaults), n.extend(i.defaults, e), i.compatOptions = n.extend({}, r.compatOptions), i.namespace = t, i.data = r.data, i.Item = s(o), n.htmlInit(i, t), h && h.bridget && h.bridget(t, i), i }, r.Item = o, r }), function (t, e) { "function" == typeof define && define.amd ? define(["outlayer/outlayer", "get-size/get-size"], e) : "object" == typeof module && module.exports ? module.exports = e(require("outlayer"), require("get-size")) : t.Masonry = e(t.Outlayer, t.getSize) }(window, function (t, e) { var i = t.create("masonry"); return i.compatOptions.fitWidth = "isFitWidth", i.prototype._resetLayout = function () { this.getSize(), this._getMeasurement("columnWidth", "outerWidth"), this._getMeasurement("gutter", "outerWidth"), this.measureColumns(), this.colYs = []; for (var t = 0; t < this.cols; t++) this.colYs.push(0); this.maxY = 0 }, i.prototype.measureColumns = function () { if (this.getContainerWidth(), !this.columnWidth) { var t = this.items[0], i = t && t.element; this.columnWidth = i && e(i).outerWidth || this.containerWidth } var n = this.columnWidth += this.gutter, o = this.containerWidth + this.gutter, r = o / n, s = n - o % n, a = s && 1 > s ? "round" : "floor"; r = Math[a](r), this.cols = Math.max(r, 1) }, i.prototype.getContainerWidth = function () { var t = this._getOption("fitWidth"), i = t ? this.element.parentNode : this.element, n = e(i); this.containerWidth = n && n.innerWidth }, i.prototype._getItemLayoutPosition = function (t) { t.getSize(); var e = t.size.outerWidth % this.columnWidth, i = e && 1 > e ? "round" : "ceil", n = Math[i](t.size.outerWidth / this.columnWidth); n = Math.min(n, this.cols); for (var o = this._getColGroup(n), r = Math.min.apply(Math, o), s = o.indexOf(r), a = { x: this.columnWidth * s, y: r }, h = r + t.size.outerHeight, u = this.cols + 1 - o.length, d = 0; u > d; d++) this.colYs[s + d] = h; return a }, i.prototype._getColGroup = function (t) { if (2 > t) return this.colYs; for (var e = [], i = this.cols + 1 - t, n = 0; i > n; n++) { var o = this.colYs.slice(n, n + t); e[n] = Math.max.apply(Math, o) } return e }, i.prototype._manageStamp = function (t) { var i = e(t), n = this._getElementOffset(t), o = this._getOption("originLeft"), r = o ? n.left : n.right, s = r + i.outerWidth, a = Math.floor(r / this.columnWidth); a = Math.max(0, a); var h = Math.floor(s / this.columnWidth); h -= s % this.columnWidth ? 0 : 1, h = Math.min(this.cols - 1, h); for (var u = this._getOption("originTop"), d = (u ? n.top : n.bottom) + i.outerHeight, c = a; h >= c; c++) this.colYs[c] = Math.max(d, this.colYs[c]) }, i.prototype._getContainerSize = function () { this.maxY = Math.max.apply(Math, this.colYs); var t = { height: this.maxY }; return this._getOption("fitWidth") && (t.width = this._getContainerFitWidth()), t }, i.prototype._getContainerFitWidth = function () { for (var t = 0, e = this.cols; --e && 0 === this.colYs[e];) t++; return (this.cols - t) * this.columnWidth - this.gutter }, i.prototype.needsResizeLayout = function () { var t = this.containerWidth; return this.getContainerWidth(), t != this.containerWidth }, i });
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var Preview = /** @class */ (function () {
            function Preview(fixedPosElements) {
                if (fixedPosElements === void 0) { fixedPosElements = null; }
                this.previewQueryStringKey = 'preview';
                this.encryptedPreviewQueryStringKey = 'e';
                this.previewValue = this.getQueryStringValue(this.previewQueryStringKey);
                this.pageIsInPreviewMode = this.previewValue && !this.previewDateHasExpired(this.previewValue);
                if (this.pageIsInPreviewMode) {
                    $('html').addClass('preview');
                    // Add preview header
                    $('body').prepend('<div id="preview-overlay">Preview</div>');
                    var previewHeaderHeight = $('#preview-overlay').outerHeight();
                    // Wrap document to adjust everything
                    if (fixedPosElements)
                        fixedPosElements.css('margin-top', '+=' + previewHeaderHeight);
                    this.encryptedPreview = this.getQueryStringValue(this.encryptedPreviewQueryStringKey);
                    this.previewPortion = this.previewQueryStringKey + '=' + this.previewValue + '&' + this.encryptedPreviewQueryStringKey + '=' + this.encryptedPreview;
                    this.previewifyAnchors(null);
                    this.previewifyImages(null);
                }
            }
            // Public
            Preview.prototype.previewifyAnchors = function ($dom) {
                var self = this;
                if (!this.pageIsInPreviewMode)
                    return;
                ($dom || $('html'))
                    .find('a[href^="/"], a[href^="?"]')
                    .each(function () {
                    var $a = $(this), href = $a.attr('href');
                    if (href)
                        $a.attr('href', self.previewifyUrl(href));
                });
            };
            Preview.prototype.previewifyImages = function ($dom) {
                var self = this;
                if (!this.pageIsInPreviewMode)
                    return;
                ($dom || $('html'))
                    .find('img')
                    .filter(function (_, elt) {
                    var src = $(this).attr('src');
                    // NB: Images won't always have src attributes, esp. in preview mode where optionality isn't enforced
                    return src && src.indexOf('repository/libraries/id') !== -1;
                })
                    .each(function () {
                    var $img = $(this), src = $img.attr('src');
                    $img.attr('src', self.previewifyImageSrc(src));
                });
            };
            // Accessors
            Preview.prototype.previewifyUrl = function (url) {
                return this.pageIsInPreviewMode ? this._previewifyUrl(url) : url;
            };
            // Private
            Preview.prototype.getQueryStringValue = function (key) {
                var queries = window.location.search.substring(1).split('&');
                for (var i = 0; i < queries.length; i++) {
                    var pair = queries[i].split('=');
                    if (decodeURIComponent(pair[0]) == key) {
                        return pair[1];
                    }
                }
                return null;
            };
            Preview.prototype.previewDateHasExpired = function (encodedPreviewValue) {
                var decodedPreviewValue = decodeURIComponent(encodedPreviewValue), // Format: '14-05-14+05:42'
                dayPortions = decodedPreviewValue.split('+')[0].split('-'), timePortions = decodedPreviewValue.split('+')[1].split(':'), dt = new Date(+dayPortions[2] + 2000, +dayPortions[1] - 1, +dayPortions[0], +timePortions[0], +timePortions[1]);
                return dt.getTime() < new Date().getTime();
            };
            Preview.prototype._previewifyUrl = function (url) {
                var containsQueryString = url.indexOf('?') !== -1, alreadyContainsPreviewBits = containsQueryString && url.indexOf(this.previewQueryStringKey) !== -1;
                return alreadyContainsPreviewBits ? url : url + (containsQueryString ? '&' : '?') + this.previewPortion;
            };
            Preview.prototype.previewifyImageSrc = function (imgSrc) {
                var containsQueryString = imgSrc.indexOf('?') !== -1, alreadyContainsPreviewBits = containsQueryString && imgSrc.indexOf('version=head') !== -1;
                return alreadyContainsPreviewBits ? imgSrc : imgSrc + (containsQueryString ? '&' : '?') + 'version=head&activeOnly=false';
            };
            return Preview;
        }());
        Common.Preview = Preview;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=preview.js.map
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var TableOfContents = /** @class */ (function () {
            function TableOfContents(richContentContainer, showH1, showH3, showNumbering, offset) {
                if (offset === void 0) { offset = 0; }
                this.showH1 = showH1;
                this.showH3 = showH3;
                this.showNumbering = showNumbering;
                this.offset = offset;
                this.tableOfContents = document.createElement('ul');
                this.tableOfContents.id = 'inner-toc';
                var elementsRenderedByToC = (this.showH1 ? 'h1,h2' : 'h2') + (this.showH3 ? ',h3' : '');
                var toBeToCed = this.getElementsByTagNames(elementsRenderedByToC, richContentContainer);
                var level1Numbering = 0, level2Numbering = 1, level3Numbering = 1, currentState = '';
                for (var i = 0; i < toBeToCed.length; i++) {
                    var tmpli = document.createElement('li');
                    var tmp = document.createElement('a');
                    tmp.innerHTML = toBeToCed[i].innerHTML;
                    tmp.className = 'page';
                    tmpli.appendChild(tmp);
                    this.tableOfContents.appendChild(tmpli);
                    if (toBeToCed[i].nodeName == 'H1' && this.showNumbering) {
                        level1Numbering++;
                        tmpli.className += ' sn';
                        tmp.innerHTML = '<span class="toc-number">' + level1Numbering + '</span>' + tmp.innerHTML;
                        level2Numbering = 1;
                        level3Numbering = 1;
                    }
                    if (toBeToCed[i].nodeName == 'H2') {
                        if (this.showNumbering) {
                            tmpli.className += 'sn ';
                            if (currentState == 'newH2')
                                level2Numbering++;
                            if (this.showH1) {
                                tmp.innerHTML = '<span class="toc-number indent">' + level1Numbering + '.' + level2Numbering + '</span>' + tmp.innerHTML;
                            }
                            else {
                                tmp.innerHTML = '<span class="toc-number">' + level2Numbering + '</span>' + tmp.innerHTML;
                            }
                            currentState = 'newH2';
                            level3Numbering = 1;
                        }
                        if (this.showH1) {
                            tmpli.className += 'indent';
                        }
                    }
                    if (toBeToCed[i].nodeName == 'H3') {
                        if (this.showNumbering) {
                            tmpli.className += 'sn ';
                            if (this.showH1) {
                                tmp.innerHTML = '<span class="toc-number extra-indent">' + level1Numbering + '.' + level2Numbering + '.' + level3Numbering + '</span>' + tmp.innerHTML;
                            }
                            else {
                                tmp.innerHTML = '<span class="toc-number indent">' + level2Numbering + '.' + level3Numbering + '</span>' + tmp.innerHTML;
                            }
                            level3Numbering++;
                        }
                        if (this.showH1) {
                            tmpli.className += 'extra-';
                        }
                        tmpli.className += 'indent';
                    }
                    var headerId = 'toc-link-' + i;
                    tmp.href = '#' + headerId;
                    $('<div class="toc-destination-offset" style="top: ' + (offset || 0) + 'px" id="' + headerId + '"></div>')
                        .insertBefore($(toBeToCed[i]));
                }
            }
            TableOfContents.prototype.getTableOfContents = function () {
                return this.tableOfContents;
            };
            TableOfContents.prototype.getElementsByTagNames = function (elementTags, richTextContainer) {
                var tagNames = elementTags.split(',');
                var resultArray = new Array();
                for (var i = 0; i < tagNames.length; i++) {
                    var tags = richTextContainer.getElementsByTagName(tagNames[i]);
                    for (var j = 0; j < tags.length; j++) {
                        resultArray.push(tags[j]);
                    }
                }
                var testNode = resultArray[0];
                if (!testNode)
                    return [];
                if (testNode.sourceIndex) {
                    resultArray.sort(function (a, b) {
                        return a.sourceIndex - b.sourceIndex;
                    });
                }
                else if (testNode.compareDocumentPosition) {
                    resultArray.sort(function (a, b) {
                        return 3 - (a.compareDocumentPosition(b) & 6);
                    });
                }
                return resultArray;
            };
            return TableOfContents;
        }());
        Common.TableOfContents = TableOfContents;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=table-of-contents.js.map
// Might be better to just make this static
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var Twitter = /** @class */ (function () {
            function Twitter() {
                !function (d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
                    if (!d.getElementById(id)) {
                        js = d.createElement(s);
                        js.id = id;
                        js.src = p + '://platform.twitter.com/widgets.js';
                        fjs.parentNode.insertBefore(js, fjs);
                    }
                }(document, 'script', 'twitter-wjs');
            }
            return Twitter;
        }());
        Common.Twitter = Twitter;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=twitter.js.map
//     Underscore.js 1.8.3
//     http://underscorejs.org
//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.
(function () { function n(n) { function t(t, r, e, u, i, o) { for (; i >= 0 && o > i; i += n) { var a = u ? u[i] : i; e = r(e, t[a], a, t) } return e } return function (r, e, u, i) { e = b(e, i, 4); var o = !k(r) && m.keys(r), a = (o || r).length, c = n > 0 ? 0 : a - 1; return arguments.length < 3 && (u = r[o ? o[c] : c], c += n), t(r, e, u, o, c, a) } } function t(n) { return function (t, r, e) { r = x(r, e); for (var u = O(t), i = n > 0 ? 0 : u - 1; i >= 0 && u > i; i += n) if (r(t[i], i, t)) return i; return -1 } } function r(n, t, r) { return function (e, u, i) { var o = 0, a = O(e); if ("number" == typeof i) n > 0 ? o = i >= 0 ? i : Math.max(i + a, o) : a = i >= 0 ? Math.min(i + 1, a) : i + a + 1; else if (r && i && a) return i = r(e, u), e[i] === u ? i : -1; if (u !== u) return i = t(l.call(e, o, a), m.isNaN), i >= 0 ? i + o : -1; for (i = n > 0 ? o : a - 1; i >= 0 && a > i; i += n) if (e[i] === u) return i; return -1 } } function e(n, t) { var r = I.length, e = n.constructor, u = m.isFunction(e) && e.prototype || a, i = "constructor"; for (m.has(n, i) && !m.contains(t, i) && t.push(i) ; r--;) i = I[r], i in n && n[i] !== u[i] && !m.contains(t, i) && t.push(i) } var u = this, i = u._, o = Array.prototype, a = Object.prototype, c = Function.prototype, f = o.push, l = o.slice, s = a.toString, p = a.hasOwnProperty, h = Array.isArray, v = Object.keys, g = c.bind, y = Object.create, d = function () { }, m = function (n) { return n instanceof m ? n : this instanceof m ? void (this._wrapped = n) : new m(n) }; "undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = m), exports._ = m) : u._ = m, m.VERSION = "1.8.3"; var b = function (n, t, r) { if (t === void 0) return n; switch (null == r ? 3 : r) { case 1: return function (r) { return n.call(t, r) }; case 2: return function (r, e) { return n.call(t, r, e) }; case 3: return function (r, e, u) { return n.call(t, r, e, u) }; case 4: return function (r, e, u, i) { return n.call(t, r, e, u, i) } } return function () { return n.apply(t, arguments) } }, x = function (n, t, r) { return null == n ? m.identity : m.isFunction(n) ? b(n, t, r) : m.isObject(n) ? m.matcher(n) : m.property(n) }; m.iteratee = function (n, t) { return x(n, t, 1 / 0) }; var _ = function (n, t) { return function (r) { var e = arguments.length; if (2 > e || null == r) return r; for (var u = 1; e > u; u++) for (var i = arguments[u], o = n(i), a = o.length, c = 0; a > c; c++) { var f = o[c]; t && r[f] !== void 0 || (r[f] = i[f]) } return r } }, j = function (n) { if (!m.isObject(n)) return {}; if (y) return y(n); d.prototype = n; var t = new d; return d.prototype = null, t }, w = function (n) { return function (t) { return null == t ? void 0 : t[n] } }, A = Math.pow(2, 53) - 1, O = w("length"), k = function (n) { var t = O(n); return "number" == typeof t && t >= 0 && A >= t }; m.each = m.forEach = function (n, t, r) { t = b(t, r); var e, u; if (k(n)) for (e = 0, u = n.length; u > e; e++) t(n[e], e, n); else { var i = m.keys(n); for (e = 0, u = i.length; u > e; e++) t(n[i[e]], i[e], n) } return n }, m.map = m.collect = function (n, t, r) { t = x(t, r); for (var e = !k(n) && m.keys(n), u = (e || n).length, i = Array(u), o = 0; u > o; o++) { var a = e ? e[o] : o; i[o] = t(n[a], a, n) } return i }, m.reduce = m.foldl = m.inject = n(1), m.reduceRight = m.foldr = n(-1), m.find = m.detect = function (n, t, r) { var e; return e = k(n) ? m.findIndex(n, t, r) : m.findKey(n, t, r), e !== void 0 && e !== -1 ? n[e] : void 0 }, m.filter = m.select = function (n, t, r) { var e = []; return t = x(t, r), m.each(n, function (n, r, u) { t(n, r, u) && e.push(n) }), e }, m.reject = function (n, t, r) { return m.filter(n, m.negate(x(t)), r) }, m.every = m.all = function (n, t, r) { t = x(t, r); for (var e = !k(n) && m.keys(n), u = (e || n).length, i = 0; u > i; i++) { var o = e ? e[i] : i; if (!t(n[o], o, n)) return !1 } return !0 }, m.some = m.any = function (n, t, r) { t = x(t, r); for (var e = !k(n) && m.keys(n), u = (e || n).length, i = 0; u > i; i++) { var o = e ? e[i] : i; if (t(n[o], o, n)) return !0 } return !1 }, m.contains = m.includes = m.include = function (n, t, r, e) { return k(n) || (n = m.values(n)), ("number" != typeof r || e) && (r = 0), m.indexOf(n, t, r) >= 0 }, m.invoke = function (n, t) { var r = l.call(arguments, 2), e = m.isFunction(t); return m.map(n, function (n) { var u = e ? t : n[t]; return null == u ? u : u.apply(n, r) }) }, m.pluck = function (n, t) { return m.map(n, m.property(t)) }, m.where = function (n, t) { return m.filter(n, m.matcher(t)) }, m.findWhere = function (n, t) { return m.find(n, m.matcher(t)) }, m.max = function (n, t, r) { var e, u, i = -1 / 0, o = -1 / 0; if (null == t && null != n) { n = k(n) ? n : m.values(n); for (var a = 0, c = n.length; c > a; a++) e = n[a], e > i && (i = e) } else t = x(t, r), m.each(n, function (n, r, e) { u = t(n, r, e), (u > o || u === -1 / 0 && i === -1 / 0) && (i = n, o = u) }); return i }, m.min = function (n, t, r) { var e, u, i = 1 / 0, o = 1 / 0; if (null == t && null != n) { n = k(n) ? n : m.values(n); for (var a = 0, c = n.length; c > a; a++) e = n[a], i > e && (i = e) } else t = x(t, r), m.each(n, function (n, r, e) { u = t(n, r, e), (o > u || 1 / 0 === u && 1 / 0 === i) && (i = n, o = u) }); return i }, m.shuffle = function (n) { for (var t, r = k(n) ? n : m.values(n), e = r.length, u = Array(e), i = 0; e > i; i++) t = m.random(0, i), t !== i && (u[i] = u[t]), u[t] = r[i]; return u }, m.sample = function (n, t, r) { return null == t || r ? (k(n) || (n = m.values(n)), n[m.random(n.length - 1)]) : m.shuffle(n).slice(0, Math.max(0, t)) }, m.sortBy = function (n, t, r) { return t = x(t, r), m.pluck(m.map(n, function (n, r, e) { return { value: n, index: r, criteria: t(n, r, e) } }).sort(function (n, t) { var r = n.criteria, e = t.criteria; if (r !== e) { if (r > e || r === void 0) return 1; if (e > r || e === void 0) return -1 } return n.index - t.index }), "value") }; var F = function (n) { return function (t, r, e) { var u = {}; return r = x(r, e), m.each(t, function (e, i) { var o = r(e, i, t); n(u, e, o) }), u } }; m.groupBy = F(function (n, t, r) { m.has(n, r) ? n[r].push(t) : n[r] = [t] }), m.indexBy = F(function (n, t, r) { n[r] = t }), m.countBy = F(function (n, t, r) { m.has(n, r) ? n[r]++ : n[r] = 1 }), m.toArray = function (n) { return n ? m.isArray(n) ? l.call(n) : k(n) ? m.map(n, m.identity) : m.values(n) : [] }, m.size = function (n) { return null == n ? 0 : k(n) ? n.length : m.keys(n).length }, m.partition = function (n, t, r) { t = x(t, r); var e = [], u = []; return m.each(n, function (n, r, i) { (t(n, r, i) ? e : u).push(n) }), [e, u] }, m.first = m.head = m.take = function (n, t, r) { return null == n ? void 0 : null == t || r ? n[0] : m.initial(n, n.length - t) }, m.initial = function (n, t, r) { return l.call(n, 0, Math.max(0, n.length - (null == t || r ? 1 : t))) }, m.last = function (n, t, r) { return null == n ? void 0 : null == t || r ? n[n.length - 1] : m.rest(n, Math.max(0, n.length - t)) }, m.rest = m.tail = m.drop = function (n, t, r) { return l.call(n, null == t || r ? 1 : t) }, m.compact = function (n) { return m.filter(n, m.identity) }; var S = function (n, t, r, e) { for (var u = [], i = 0, o = e || 0, a = O(n) ; a > o; o++) { var c = n[o]; if (k(c) && (m.isArray(c) || m.isArguments(c))) { t || (c = S(c, t, r)); var f = 0, l = c.length; for (u.length += l; l > f;) u[i++] = c[f++] } else r || (u[i++] = c) } return u }; m.flatten = function (n, t) { return S(n, t, !1) }, m.without = function (n) { return m.difference(n, l.call(arguments, 1)) }, m.uniq = m.unique = function (n, t, r, e) { m.isBoolean(t) || (e = r, r = t, t = !1), null != r && (r = x(r, e)); for (var u = [], i = [], o = 0, a = O(n) ; a > o; o++) { var c = n[o], f = r ? r(c, o, n) : c; t ? (o && i === f || u.push(c), i = f) : r ? m.contains(i, f) || (i.push(f), u.push(c)) : m.contains(u, c) || u.push(c) } return u }, m.union = function () { return m.uniq(S(arguments, !0, !0)) }, m.intersection = function (n) { for (var t = [], r = arguments.length, e = 0, u = O(n) ; u > e; e++) { var i = n[e]; if (!m.contains(t, i)) { for (var o = 1; r > o && m.contains(arguments[o], i) ; o++); o === r && t.push(i) } } return t }, m.difference = function (n) { var t = S(arguments, !0, !0, 1); return m.filter(n, function (n) { return !m.contains(t, n) }) }, m.zip = function () { return m.unzip(arguments) }, m.unzip = function (n) { for (var t = n && m.max(n, O).length || 0, r = Array(t), e = 0; t > e; e++) r[e] = m.pluck(n, e); return r }, m.object = function (n, t) { for (var r = {}, e = 0, u = O(n) ; u > e; e++) t ? r[n[e]] = t[e] : r[n[e][0]] = n[e][1]; return r }, m.findIndex = t(1), m.findLastIndex = t(-1), m.sortedIndex = function (n, t, r, e) { r = x(r, e, 1); for (var u = r(t), i = 0, o = O(n) ; o > i;) { var a = Math.floor((i + o) / 2); r(n[a]) < u ? i = a + 1 : o = a } return i }, m.indexOf = r(1, m.findIndex, m.sortedIndex), m.lastIndexOf = r(-1, m.findLastIndex), m.range = function (n, t, r) { null == t && (t = n || 0, n = 0), r = r || 1; for (var e = Math.max(Math.ceil((t - n) / r), 0), u = Array(e), i = 0; e > i; i++, n += r) u[i] = n; return u }; var E = function (n, t, r, e, u) { if (!(e instanceof t)) return n.apply(r, u); var i = j(n.prototype), o = n.apply(i, u); return m.isObject(o) ? o : i }; m.bind = function (n, t) { if (g && n.bind === g) return g.apply(n, l.call(arguments, 1)); if (!m.isFunction(n)) throw new TypeError("Bind must be called on a function"); var r = l.call(arguments, 2), e = function () { return E(n, e, t, this, r.concat(l.call(arguments))) }; return e }, m.partial = function (n) { var t = l.call(arguments, 1), r = function () { for (var e = 0, u = t.length, i = Array(u), o = 0; u > o; o++) i[o] = t[o] === m ? arguments[e++] : t[o]; for (; e < arguments.length;) i.push(arguments[e++]); return E(n, r, this, this, i) }; return r }, m.bindAll = function (n) { var t, r, e = arguments.length; if (1 >= e) throw new Error("bindAll must be passed function names"); for (t = 1; e > t; t++) r = arguments[t], n[r] = m.bind(n[r], n); return n }, m.memoize = function (n, t) { var r = function (e) { var u = r.cache, i = "" + (t ? t.apply(this, arguments) : e); return m.has(u, i) || (u[i] = n.apply(this, arguments)), u[i] }; return r.cache = {}, r }, m.delay = function (n, t) { var r = l.call(arguments, 2); return setTimeout(function () { return n.apply(null, r) }, t) }, m.defer = m.partial(m.delay, m, 1), m.throttle = function (n, t, r) { var e, u, i, o = null, a = 0; r || (r = {}); var c = function () { a = r.leading === !1 ? 0 : m.now(), o = null, i = n.apply(e, u), o || (e = u = null) }; return function () { var f = m.now(); a || r.leading !== !1 || (a = f); var l = t - (f - a); return e = this, u = arguments, 0 >= l || l > t ? (o && (clearTimeout(o), o = null), a = f, i = n.apply(e, u), o || (e = u = null)) : o || r.trailing === !1 || (o = setTimeout(c, l)), i } }, m.debounce = function (n, t, r) { var e, u, i, o, a, c = function () { var f = m.now() - o; t > f && f >= 0 ? e = setTimeout(c, t - f) : (e = null, r || (a = n.apply(i, u), e || (i = u = null))) }; return function () { i = this, u = arguments, o = m.now(); var f = r && !e; return e || (e = setTimeout(c, t)), f && (a = n.apply(i, u), i = u = null), a } }, m.wrap = function (n, t) { return m.partial(t, n) }, m.negate = function (n) { return function () { return !n.apply(this, arguments) } }, m.compose = function () { var n = arguments, t = n.length - 1; return function () { for (var r = t, e = n[t].apply(this, arguments) ; r--;) e = n[r].call(this, e); return e } }, m.after = function (n, t) { return function () { return --n < 1 ? t.apply(this, arguments) : void 0 } }, m.before = function (n, t) { var r; return function () { return --n > 0 && (r = t.apply(this, arguments)), 1 >= n && (t = null), r } }, m.once = m.partial(m.before, 2); var M = !{ toString: null }.propertyIsEnumerable("toString"), I = ["valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"]; m.keys = function (n) { if (!m.isObject(n)) return []; if (v) return v(n); var t = []; for (var r in n) m.has(n, r) && t.push(r); return M && e(n, t), t }, m.allKeys = function (n) { if (!m.isObject(n)) return []; var t = []; for (var r in n) t.push(r); return M && e(n, t), t }, m.values = function (n) { for (var t = m.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = n[t[u]]; return e }, m.mapObject = function (n, t, r) { t = x(t, r); for (var e, u = m.keys(n), i = u.length, o = {}, a = 0; i > a; a++) e = u[a], o[e] = t(n[e], e, n); return o }, m.pairs = function (n) { for (var t = m.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = [t[u], n[t[u]]]; return e }, m.invert = function (n) { for (var t = {}, r = m.keys(n), e = 0, u = r.length; u > e; e++) t[n[r[e]]] = r[e]; return t }, m.functions = m.methods = function (n) { var t = []; for (var r in n) m.isFunction(n[r]) && t.push(r); return t.sort() }, m.extend = _(m.allKeys), m.extendOwn = m.assign = _(m.keys), m.findKey = function (n, t, r) { t = x(t, r); for (var e, u = m.keys(n), i = 0, o = u.length; o > i; i++) if (e = u[i], t(n[e], e, n)) return e }, m.pick = function (n, t, r) { var e, u, i = {}, o = n; if (null == o) return i; m.isFunction(t) ? (u = m.allKeys(o), e = b(t, r)) : (u = S(arguments, !1, !1, 1), e = function (n, t, r) { return t in r }, o = Object(o)); for (var a = 0, c = u.length; c > a; a++) { var f = u[a], l = o[f]; e(l, f, o) && (i[f] = l) } return i }, m.omit = function (n, t, r) { if (m.isFunction(t)) t = m.negate(t); else { var e = m.map(S(arguments, !1, !1, 1), String); t = function (n, t) { return !m.contains(e, t) } } return m.pick(n, t, r) }, m.defaults = _(m.allKeys, !0), m.create = function (n, t) { var r = j(n); return t && m.extendOwn(r, t), r }, m.clone = function (n) { return m.isObject(n) ? m.isArray(n) ? n.slice() : m.extend({}, n) : n }, m.tap = function (n, t) { return t(n), n }, m.isMatch = function (n, t) { var r = m.keys(t), e = r.length; if (null == n) return !e; for (var u = Object(n), i = 0; e > i; i++) { var o = r[i]; if (t[o] !== u[o] || !(o in u)) return !1 } return !0 }; var N = function (n, t, r, e) { if (n === t) return 0 !== n || 1 / n === 1 / t; if (null == n || null == t) return n === t; n instanceof m && (n = n._wrapped), t instanceof m && (t = t._wrapped); var u = s.call(n); if (u !== s.call(t)) return !1; switch (u) { case "[object RegExp]": case "[object String]": return "" + n == "" + t; case "[object Number]": return +n !== +n ? +t !== +t : 0 === +n ? 1 / +n === 1 / t : +n === +t; case "[object Date]": case "[object Boolean]": return +n === +t } var i = "[object Array]" === u; if (!i) { if ("object" != typeof n || "object" != typeof t) return !1; var o = n.constructor, a = t.constructor; if (o !== a && !(m.isFunction(o) && o instanceof o && m.isFunction(a) && a instanceof a) && "constructor" in n && "constructor" in t) return !1 } r = r || [], e = e || []; for (var c = r.length; c--;) if (r[c] === n) return e[c] === t; if (r.push(n), e.push(t), i) { if (c = n.length, c !== t.length) return !1; for (; c--;) if (!N(n[c], t[c], r, e)) return !1 } else { var f, l = m.keys(n); if (c = l.length, m.keys(t).length !== c) return !1; for (; c--;) if (f = l[c], !m.has(t, f) || !N(n[f], t[f], r, e)) return !1 } return r.pop(), e.pop(), !0 }; m.isEqual = function (n, t) { return N(n, t) }, m.isEmpty = function (n) { return null == n ? !0 : k(n) && (m.isArray(n) || m.isString(n) || m.isArguments(n)) ? 0 === n.length : 0 === m.keys(n).length }, m.isElement = function (n) { return !(!n || 1 !== n.nodeType) }, m.isArray = h || function (n) { return "[object Array]" === s.call(n) }, m.isObject = function (n) { var t = typeof n; return "function" === t || "object" === t && !!n }, m.each(["Arguments", "Function", "String", "Number", "Date", "RegExp", "Error"], function (n) { m["is" + n] = function (t) { return s.call(t) === "[object " + n + "]" } }), m.isArguments(arguments) || (m.isArguments = function (n) { return m.has(n, "callee") }), "function" != typeof /./ && "object" != typeof Int8Array && (m.isFunction = function (n) { return "function" == typeof n || !1 }), m.isFinite = function (n) { return isFinite(n) && !isNaN(parseFloat(n)) }, m.isNaN = function (n) { return m.isNumber(n) && n !== +n }, m.isBoolean = function (n) { return n === !0 || n === !1 || "[object Boolean]" === s.call(n) }, m.isNull = function (n) { return null === n }, m.isUndefined = function (n) { return n === void 0 }, m.has = function (n, t) { return null != n && p.call(n, t) }, m.noConflict = function () { return u._ = i, this }, m.identity = function (n) { return n }, m.constant = function (n) { return function () { return n } }, m.noop = function () { }, m.property = w, m.propertyOf = function (n) { return null == n ? function () { } : function (t) { return n[t] } }, m.matcher = m.matches = function (n) { return n = m.extendOwn({}, n), function (t) { return m.isMatch(t, n) } }, m.times = function (n, t, r) { var e = Array(Math.max(0, n)); t = b(t, r, 1); for (var u = 0; n > u; u++) e[u] = t(u); return e }, m.random = function (n, t) { return null == t && (t = n, n = 0), n + Math.floor(Math.random() * (t - n + 1)) }, m.now = Date.now || function () { return (new Date).getTime() }; var B = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" }, T = m.invert(B), R = function (n) { var t = function (t) { return n[t] }, r = "(?:" + m.keys(n).join("|") + ")", e = RegExp(r), u = RegExp(r, "g"); return function (n) { return n = null == n ? "" : "" + n, e.test(n) ? n.replace(u, t) : n } }; m.escape = R(B), m.unescape = R(T), m.result = function (n, t, r) { var e = null == n ? void 0 : n[t]; return e === void 0 && (e = r), m.isFunction(e) ? e.call(n) : e }; var q = 0; m.uniqueId = function (n) { var t = ++q + ""; return n ? n + t : t }, m.templateSettings = { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g }; var K = /(.)^/, z = { "'": "'", "\\": "\\", "\r": "r", "\n": "n", "\u2028": "u2028", "\u2029": "u2029" }, D = /\\|'|\r|\n|\u2028|\u2029/g, L = function (n) { return "\\" + z[n] }; m.template = function (n, t, r) { !t && r && (t = r), t = m.defaults({}, t, m.templateSettings); var e = RegExp([(t.escape || K).source, (t.interpolate || K).source, (t.evaluate || K).source].join("|") + "|$", "g"), u = 0, i = "__p+='"; n.replace(e, function (t, r, e, o, a) { return i += n.slice(u, a).replace(D, L), u = a + t.length, r ? i += "'+\n((__t=(" + r + "))==null?'':_.escape(__t))+\n'" : e ? i += "'+\n((__t=(" + e + "))==null?'':__t)+\n'" : o && (i += "';\n" + o + "\n__p+='"), t }), i += "';\n", t.variable || (i = "with(obj||{}){\n" + i + "}\n"), i = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + i + "return __p;\n"; try { var o = new Function(t.variable || "obj", "_", i) } catch (a) { throw a.source = i, a } var c = function (n) { return o.call(this, n, m) }, f = t.variable || "obj"; return c.source = "function(" + f + "){\n" + i + "}", c }, m.chain = function (n) { var t = m(n); return t._chain = !0, t }; var P = function (n, t) { return n._chain ? m(t).chain() : t }; m.mixin = function (n) { m.each(m.functions(n), function (t) { var r = m[t] = n[t]; m.prototype[t] = function () { var n = [this._wrapped]; return f.apply(n, arguments), P(this, r.apply(m, n)) } }) }, m.mixin(m), m.each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (n) { var t = o[n]; m.prototype[n] = function () { var r = this._wrapped; return t.apply(r, arguments), "shift" !== n && "splice" !== n || 0 !== r.length || delete r[0], P(this, r) } }), m.each(["concat", "join", "slice"], function (n) { var t = o[n]; m.prototype[n] = function () { return P(this, t.apply(this._wrapped, arguments)) } }), m.prototype.value = function () { return this._wrapped }, m.prototype.valueOf = m.prototype.toJSON = m.prototype.value, m.prototype.toString = function () { return "" + this._wrapped }, "function" == typeof define && define.amd && define("underscore", [], function () { return m }) }).call(this);
//# sourceMappingURL=underscore-min.map
/*! URI.js v1.18.1 http://medialize.github.io/URI.js/ */
/* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js */
(function (k, n) { "object" === typeof exports ? module.exports = n() : "function" === typeof define && define.amd ? define(n) : k.IPv6 = n(k) })(this, function (k) {
    var n = k && k.IPv6; return {
        best: function (g) {
            g = g.toLowerCase().split(":"); var f = g.length, d = 8; "" === g[0] && "" === g[1] && "" === g[2] ? (g.shift(), g.shift()) : "" === g[0] && "" === g[1] ? g.shift() : "" === g[f - 1] && "" === g[f - 2] && g.pop(); f = g.length; -1 !== g[f - 1].indexOf(".") && (d = 7); var h; for (h = 0; h < f && "" !== g[h]; h++); if (h < d) for (g.splice(h, 1, "0000") ; g.length < d;) g.splice(h, 0, "0000"); for (h = 0; h < d; h++) {
                for (var f =
                g[h].split(""), k = 0; 3 > k; k++) if ("0" === f[0] && 1 < f.length) f.splice(0, 1); else break; g[h] = f.join("")
            } var f = -1, p = k = 0, n = -1, u = !1; for (h = 0; h < d; h++) u ? "0" === g[h] ? p += 1 : (u = !1, p > k && (f = n, k = p)) : "0" === g[h] && (u = !0, n = h, p = 1); p > k && (f = n, k = p); 1 < k && g.splice(f, k, ""); f = g.length; d = ""; "" === g[0] && (d = ":"); for (h = 0; h < f; h++) { d += g[h]; if (h === f - 1) break; d += ":" } "" === g[f - 1] && (d += ":"); return d
        }, noConflict: function () { k.IPv6 === this && (k.IPv6 = n); return this }
    }
});
(function (k) {
    function n(d) { throw new RangeError(e[d]); } function g(d, e) { for (var f = d.length, h = []; f--;) h[f] = e(d[f]); return h } function f(d, e) { var f = d.split("@"), h = ""; 1 < f.length && (h = f[0] + "@", d = f[1]); d = d.replace(H, "."); f = d.split("."); f = g(f, e).join("."); return h + f } function d(d) { for (var e = [], f = 0, h = d.length, g, a; f < h;) g = d.charCodeAt(f++), 55296 <= g && 56319 >= g && f < h ? (a = d.charCodeAt(f++), 56320 == (a & 64512) ? e.push(((g & 1023) << 10) + (a & 1023) + 65536) : (e.push(g), f--)) : e.push(g); return e } function h(d) {
        return g(d, function (d) {
            var e =
            ""; 65535 < d && (d -= 65536, e += t(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023); return e += t(d)
        }).join("")
    } function w(d, e) { return d + 22 + 75 * (26 > d) - ((0 != e) << 5) } function p(d, e, f) { var h = 0; d = f ? r(d / 700) : d >> 1; for (d += r(d / e) ; 455 < d; h += 36) d = r(d / 35); return r(h + 36 * d / (d + 38)) } function D(d) {
        var e = [], f = d.length, g, k = 0, a = 128, b = 72, c, l, m, q, y; c = d.lastIndexOf("-"); 0 > c && (c = 0); for (l = 0; l < c; ++l) 128 <= d.charCodeAt(l) && n("not-basic"), e.push(d.charCodeAt(l)); for (c = 0 < c ? c + 1 : 0; c < f;) {
            l = k; g = 1; for (m = 36; ; m += 36) {
                c >= f && n("invalid-input"); q = d.charCodeAt(c++);
                q = 10 > q - 48 ? q - 22 : 26 > q - 65 ? q - 65 : 26 > q - 97 ? q - 97 : 36; (36 <= q || q > r((2147483647 - k) / g)) && n("overflow"); k += q * g; y = m <= b ? 1 : m >= b + 26 ? 26 : m - b; if (q < y) break; q = 36 - y; g > r(2147483647 / q) && n("overflow"); g *= q
            } g = e.length + 1; b = p(k - l, g, 0 == l); r(k / g) > 2147483647 - a && n("overflow"); a += r(k / g); k %= g; e.splice(k++, 0, a)
        } return h(e)
    } function u(e) {
        var f, g, h, k, a, b, c, l, m, q = [], y, E, I; e = d(e); y = e.length; f = 128; g = 0; a = 72; for (b = 0; b < y; ++b) m = e[b], 128 > m && q.push(t(m)); for ((h = k = q.length) && q.push("-") ; h < y;) {
            c = 2147483647; for (b = 0; b < y; ++b) m = e[b], m >= f && m < c && (c = m);
            E = h + 1; c - f > r((2147483647 - g) / E) && n("overflow"); g += (c - f) * E; f = c; for (b = 0; b < y; ++b) if (m = e[b], m < f && 2147483647 < ++g && n("overflow"), m == f) { l = g; for (c = 36; ; c += 36) { m = c <= a ? 1 : c >= a + 26 ? 26 : c - a; if (l < m) break; I = l - m; l = 36 - m; q.push(t(w(m + I % l, 0))); l = r(I / l) } q.push(t(w(l, 0))); a = p(g, E, h == k); g = 0; ++h } ++g; ++f
        } return q.join("")
    } var B = "object" == typeof exports && exports && !exports.nodeType && exports, C = "object" == typeof module && module && !module.nodeType && module, z = "object" == typeof global && global; if (z.global === z || z.window === z || z.self === z) k =
    z; var v, A = /^xn--/, F = /[^\x20-\x7E]/, H = /[\x2E\u3002\uFF0E\uFF61]/g, e = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, r = Math.floor, t = String.fromCharCode, x; v = { version: "1.3.2", ucs2: { decode: d, encode: h }, decode: D, encode: u, toASCII: function (d) { return f(d, function (d) { return F.test(d) ? "xn--" + u(d) : d }) }, toUnicode: function (d) { return f(d, function (d) { return A.test(d) ? D(d.slice(4).toLowerCase()) : d }) } }; if ("function" ==
    typeof define && "object" == typeof define.amd && define.amd) define("punycode", function () { return v }); else if (B && C) if (module.exports == B) C.exports = v; else for (x in v) v.hasOwnProperty(x) && (B[x] = v[x]); else k.punycode = v
})(this);
(function (k, n) { "object" === typeof exports ? module.exports = n() : "function" === typeof define && define.amd ? define(n) : k.SecondLevelDomains = n(k) })(this, function (k) {
    var n = k && k.SecondLevelDomains, g = {
        list: {
            ac: " com gov mil net org ", ae: " ac co gov mil name net org pro sch ", af: " com edu gov net org ", al: " com edu gov mil net org ", ao: " co ed gv it og pb ", ar: " com edu gob gov int mil net org tur ", at: " ac co gv or ", au: " asn com csiro edu gov id net org ", ba: " co com edu gov mil net org rs unbi unmo unsa untz unze ",
            bb: " biz co com edu gov info net org store tv ", bh: " biz cc com edu gov info net org ", bn: " com edu gov net org ", bo: " com edu gob gov int mil net org tv ", br: " adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ", bs: " com edu gov net org ", bz: " du et om ov rg ", ca: " ab bc mb nb nf nl ns nt nu on pe qc sk yk ",
            ck: " biz co edu gen gov info net org ", cn: " ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ", co: " com edu gov mil net nom org ", cr: " ac c co ed fi go or sa ", cy: " ac biz com ekloges gov ltd name net org parliament press pro tm ", "do": " art com edu gob gov mil net org sld web ", dz: " art asso com edu gov net org pol ", ec: " com edu fin gov info med mil net org pro ", eg: " com edu eun gov mil name net org sci ", er: " com edu gov ind mil net org rochest w ",
            es: " com edu gob nom org ", et: " biz com edu gov info name net org ", fj: " ac biz com info mil name net org pro ", fk: " ac co gov net nom org ", fr: " asso com f gouv nom prd presse tm ", gg: " co net org ", gh: " com edu gov mil org ", gn: " ac com gov net org ", gr: " com edu gov mil net org ", gt: " com edu gob ind mil net org ", gu: " com edu gov net org ", hk: " com edu gov idv net org ", hu: " 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",
            id: " ac co go mil net or sch web ", il: " ac co gov idf k12 muni net org ", "in": " ac co edu ernet firm gen gov i ind mil net nic org res ", iq: " com edu gov i mil net org ", ir: " ac co dnssec gov i id net org sch ", it: " edu gov ", je: " co net org ", jo: " com edu gov mil name net org sch ", jp: " ac ad co ed go gr lg ne or ", ke: " ac co go info me mobi ne or sc ", kh: " com edu gov mil net org per ", ki: " biz com de edu gov info mob net org tel ", km: " asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",
            kn: " edu gov net org ", kr: " ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ", kw: " com edu gov net org ", ky: " com edu gov net org ", kz: " com edu gov mil net org ", lb: " com edu gov net org ", lk: " assn com edu gov grp hotel int ltd net ngo org sch soc web ", lr: " com edu gov net org ", lv: " asn com conf edu gov id mil net org ", ly: " com edu gov id med net org plc sch ", ma: " ac co gov m net org press ",
            mc: " asso tm ", me: " ac co edu gov its net org priv ", mg: " com edu gov mil nom org prd tm ", mk: " com edu gov inf name net org pro ", ml: " com edu gov net org presse ", mn: " edu gov org ", mo: " com edu gov net org ", mt: " com edu gov net org ", mv: " aero biz com coop edu gov info int mil museum name net org pro ", mw: " ac co com coop edu gov int museum net org ", mx: " com edu gob net org ", my: " com edu gov mil name net org sch ", nf: " arts com firm info net other per rec store web ", ng: " biz com edu gov mil mobi name net org sch ",
            ni: " ac co com edu gob mil net nom org ", np: " com edu gov mil net org ", nr: " biz com edu gov info net org ", om: " ac biz co com edu gov med mil museum net org pro sch ", pe: " com edu gob mil net nom org sld ", ph: " com edu gov i mil net ngo org ", pk: " biz com edu fam gob gok gon gop gos gov net org web ", pl: " art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ", pr: " ac biz com edu est gov info isla name net org pro prof ",
            ps: " com edu gov net org plo sec ", pw: " belau co ed go ne or ", ro: " arts com firm info nom nt org rec store tm www ", rs: " ac co edu gov in org ", sb: " com edu gov net org ", sc: " com edu gov net org ", sh: " co com edu gov net nom org ", sl: " com edu gov net org ", st: " co com consulado edu embaixada gov mil net org principe saotome store ", sv: " com edu gob org red ", sz: " ac co org ", tr: " av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ", tt: " aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",
            tw: " club com ebiz edu game gov idv mil net org ", mu: " ac co com gov net or org ", mz: " ac co edu gov org ", na: " co com ", nz: " ac co cri geek gen govt health iwi maori mil net org parliament school ", pa: " abo ac com edu gob ing med net nom org sld ", pt: " com edu gov int net nome org publ ", py: " com edu gov mil net org ", qa: " com edu gov mil net org ", re: " asso com nom ", ru: " ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",
            rw: " ac co com edu gouv gov int mil net ", sa: " com edu gov med net org pub sch ", sd: " com edu gov info med net org tv ", se: " a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ", sg: " com edu gov idn net org per ", sn: " art com edu gouv org perso univ ", sy: " com edu gov mil net news org ", th: " ac co go in mi net or ", tj: " ac biz co com edu go gov info int mil name net nic org test web ", tn: " agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",
            tz: " ac co go ne or ", ua: " biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ", ug: " ac co go ne or org sc ", uk: " ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",
            us: " dni fed isa kids nsn ", uy: " com edu gub mil net org ", ve: " co com edu gob info mil net org web ", vi: " co com k12 net org ", vn: " ac biz com edu gov health info int name net org pro ", ye: " co com gov ltd me net org plc ", yu: " ac co edu gov org ", za: " ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ", zm: " ac co com edu gov net org sch "
        }, has: function (f) {
            var d = f.lastIndexOf("."); if (0 >= d || d >= f.length - 1) return !1;
            var h = f.lastIndexOf(".", d - 1); if (0 >= h || h >= d - 1) return !1; var k = g.list[f.slice(d + 1)]; return k ? 0 <= k.indexOf(" " + f.slice(h + 1, d) + " ") : !1
        }, is: function (f) { var d = f.lastIndexOf("."); if (0 >= d || d >= f.length - 1 || 0 <= f.lastIndexOf(".", d - 1)) return !1; var h = g.list[f.slice(d + 1)]; return h ? 0 <= h.indexOf(" " + f.slice(0, d) + " ") : !1 }, get: function (f) {
            var d = f.lastIndexOf("."); if (0 >= d || d >= f.length - 1) return null; var h = f.lastIndexOf(".", d - 1); if (0 >= h || h >= d - 1) return null; var k = g.list[f.slice(d + 1)]; return !k || 0 > k.indexOf(" " + f.slice(h +
            1, d) + " ") ? null : f.slice(h + 1)
        }, noConflict: function () { k.SecondLevelDomains === this && (k.SecondLevelDomains = n); return this }
    }; return g
});
(function (k, n) { "object" === typeof exports ? module.exports = n(require("./punycode"), require("./IPv6"), require("./SecondLevelDomains")) : "function" === typeof define && define.amd ? define(["./punycode", "./IPv6", "./SecondLevelDomains"], n) : k.URI = n(k.punycode, k.IPv6, k.SecondLevelDomains, k) })(this, function (k, n, g, f) {
    function d(a, b) {
        var c = 1 <= arguments.length, l = 2 <= arguments.length; if (!(this instanceof d)) return c ? l ? new d(a, b) : new d(a) : new d; if (void 0 === a) {
            if (c) throw new TypeError("undefined is not a valid argument for URI");
            a = "undefined" !== typeof location ? location.href + "" : ""
        } this.href(a); return void 0 !== b ? this.absoluteTo(b) : this
    } function h(a) { return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1") } function w(a) { return void 0 === a ? "Undefined" : String(Object.prototype.toString.call(a)).slice(8, -1) } function p(a) { return "Array" === w(a) } function D(a, b) {
        var c = {}, d, m; if ("RegExp" === w(b)) c = null; else if (p(b)) for (d = 0, m = b.length; d < m; d++) c[b[d]] = !0; else c[b] = !0; d = 0; for (m = a.length; d < m; d++) if (c && void 0 !== c[a[d]] || !c && b.test(a[d])) a.splice(d,
        1), m--, d--; return a
    } function u(a, b) { var c, d; if (p(b)) { c = 0; for (d = b.length; c < d; c++) if (!u(a, b[c])) return !1; return !0 } var m = w(b); c = 0; for (d = a.length; c < d; c++) if ("RegExp" === m) { if ("string" === typeof a[c] && a[c].match(b)) return !0 } else if (a[c] === b) return !0; return !1 } function B(a, b) { if (!p(a) || !p(b) || a.length !== b.length) return !1; a.sort(); b.sort(); for (var c = 0, d = a.length; c < d; c++) if (a[c] !== b[c]) return !1; return !0 } function C(a) { return a.replace(/^\/+|\/+$/g, "") } function z(a) { return escape(a) } function v(a) {
        return encodeURIComponent(a).replace(/[!'()*]/g,
        z).replace(/\*/g, "%2A")
    } function A(a) { return function (b, c) { if (void 0 === b) return this._parts[a] || ""; this._parts[a] = b || null; this.build(!c); return this } } function F(a, b) { return function (c, d) { if (void 0 === c) return this._parts[a] || ""; null !== c && (c += "", c.charAt(0) === b && (c = c.substring(1))); this._parts[a] = c; this.build(!d); return this } } var H = f && f.URI; d.version = "1.18.1"; var e = d.prototype, r = Object.prototype.hasOwnProperty; d._parts = function () {
        return {
            protocol: null, username: null, password: null, hostname: null, urn: null,
            port: null, path: null, query: null, fragment: null, duplicateQueryParameters: d.duplicateQueryParameters, escapeQuerySpace: d.escapeQuerySpace
        }
    }; d.duplicateQueryParameters = !1; d.escapeQuerySpace = !0; d.protocol_expression = /^[a-z][a-z0-9.+-]*$/i; d.idn_expression = /[^a-z0-9\.-]/i; d.punycode_expression = /(xn--)/i; d.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; d.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
    d.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/ig; d.findUri = { start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi, end: /[\s\r\n]|$/, trim: /[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/ }; d.defaultPorts = { http: "80", https: "443", ftp: "21", gopher: "70", ws: "80", wss: "443" }; d.invalid_hostname_characters =
    /[^a-zA-Z0-9\.-]/; d.domAttributes = { a: "href", blockquote: "cite", link: "href", base: "href", script: "src", form: "action", img: "src", area: "href", iframe: "src", embed: "src", source: "src", track: "src", input: "src", audio: "src", video: "src" }; d.getDomAttribute = function (a) { if (a && a.nodeName) { var b = a.nodeName.toLowerCase(); return "input" === b && "image" !== a.type ? void 0 : d.domAttributes[b] } }; d.encode = v; d.decode = decodeURIComponent; d.iso8859 = function () { d.encode = escape; d.decode = unescape }; d.unicode = function () {
        d.encode = v; d.decode =
        decodeURIComponent
    }; d.characters = {
        pathname: { encode: { expression: /%(24|26|2B|2C|3B|3D|3A|40)/ig, map: { "%24": "$", "%26": "&", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%3A": ":", "%40": "@" } }, decode: { expression: /[\/\?#]/g, map: { "/": "%2F", "?": "%3F", "#": "%23" } } }, reserved: {
            encode: {
                expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig, map: {
                    "%3A": ":", "%2F": "/", "%3F": "?", "%23": "#", "%5B": "[", "%5D": "]", "%40": "@", "%21": "!", "%24": "$", "%26": "&", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",",
                    "%3B": ";", "%3D": "="
                }
            }
        }, urnpath: { encode: { expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig, map: { "%21": "!", "%24": "$", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%40": "@" } }, decode: { expression: /[\/\?#:]/g, map: { "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" } } }
    }; d.encodeQuery = function (a, b) { var c = d.encode(a + ""); void 0 === b && (b = d.escapeQuerySpace); return b ? c.replace(/%20/g, "+") : c }; d.decodeQuery = function (a, b) {
        a += ""; void 0 === b && (b = d.escapeQuerySpace); try {
            return d.decode(b ? a.replace(/\+/g,
            "%20") : a)
        } catch (c) { return a }
    }; var t = { encode: "encode", decode: "decode" }, x, G = function (a, b) { return function (c) { try { return d[b](c + "").replace(d.characters[a][b].expression, function (c) { return d.characters[a][b].map[c] }) } catch (l) { return c } } }; for (x in t) d[x + "PathSegment"] = G("pathname", t[x]), d[x + "UrnPathSegment"] = G("urnpath", t[x]); t = function (a, b, c) { return function (l) { var m; m = c ? function (a) { return d[b](d[c](a)) } : d[b]; l = (l + "").split(a); for (var e = 0, f = l.length; e < f; e++) l[e] = m(l[e]); return l.join(a) } }; d.decodePath =
    t("/", "decodePathSegment"); d.decodeUrnPath = t(":", "decodeUrnPathSegment"); d.recodePath = t("/", "encodePathSegment", "decode"); d.recodeUrnPath = t(":", "encodeUrnPathSegment", "decode"); d.encodeReserved = G("reserved", "encode"); d.parse = function (a, b) {
        var c; b || (b = {}); c = a.indexOf("#"); -1 < c && (b.fragment = a.substring(c + 1) || null, a = a.substring(0, c)); c = a.indexOf("?"); -1 < c && (b.query = a.substring(c + 1) || null, a = a.substring(0, c)); "//" === a.substring(0, 2) ? (b.protocol = null, a = a.substring(2), a = d.parseAuthority(a, b)) : (c = a.indexOf(":"),
        -1 < c && (b.protocol = a.substring(0, c) || null, b.protocol && !b.protocol.match(d.protocol_expression) ? b.protocol = void 0 : "//" === a.substring(c + 1, c + 3) ? (a = a.substring(c + 3), a = d.parseAuthority(a, b)) : (a = a.substring(c + 1), b.urn = !0))); b.path = a; return b
    }; d.parseHost = function (a, b) {
        a = a.replace(/\\/g, "/"); var c = a.indexOf("/"), d; -1 === c && (c = a.length); if ("[" === a.charAt(0)) d = a.indexOf("]"), b.hostname = a.substring(1, d) || null, b.port = a.substring(d + 2, c) || null, "/" === b.port && (b.port = null); else {
            var m = a.indexOf(":"); d = a.indexOf("/");
            m = a.indexOf(":", m + 1); -1 !== m && (-1 === d || m < d) ? (b.hostname = a.substring(0, c) || null, b.port = null) : (d = a.substring(0, c).split(":"), b.hostname = d[0] || null, b.port = d[1] || null)
        } b.hostname && "/" !== a.substring(c).charAt(0) && (c++, a = "/" + a); return a.substring(c) || "/"
    }; d.parseAuthority = function (a, b) { a = d.parseUserinfo(a, b); return d.parseHost(a, b) }; d.parseUserinfo = function (a, b) {
        var c = a.indexOf("/"), l = a.lastIndexOf("@", -1 < c ? c : a.length - 1); -1 < l && (-1 === c || l < c) ? (c = a.substring(0, l).split(":"), b.username = c[0] ? d.decode(c[0]) : null,
        c.shift(), b.password = c[0] ? d.decode(c.join(":")) : null, a = a.substring(l + 1)) : (b.username = null, b.password = null); return a
    }; d.parseQuery = function (a, b) { if (!a) return {}; a = a.replace(/&+/g, "&").replace(/^\?*&*|&+$/g, ""); if (!a) return {}; for (var c = {}, l = a.split("&"), m = l.length, e, f, g = 0; g < m; g++) if (e = l[g].split("="), f = d.decodeQuery(e.shift(), b), e = e.length ? d.decodeQuery(e.join("="), b) : null, r.call(c, f)) { if ("string" === typeof c[f] || null === c[f]) c[f] = [c[f]]; c[f].push(e) } else c[f] = e; return c }; d.build = function (a) {
        var b = "";
        a.protocol && (b += a.protocol + ":"); a.urn || !b && !a.hostname || (b += "//"); b += d.buildAuthority(a) || ""; "string" === typeof a.path && ("/" !== a.path.charAt(0) && "string" === typeof a.hostname && (b += "/"), b += a.path); "string" === typeof a.query && a.query && (b += "?" + a.query); "string" === typeof a.fragment && a.fragment && (b += "#" + a.fragment); return b
    }; d.buildHost = function (a) { var b = ""; if (a.hostname) b = d.ip6_expression.test(a.hostname) ? b + ("[" + a.hostname + "]") : b + a.hostname; else return ""; a.port && (b += ":" + a.port); return b }; d.buildAuthority =
    function (a) { return d.buildUserinfo(a) + d.buildHost(a) }; d.buildUserinfo = function (a) { var b = ""; a.username && (b += d.encode(a.username)); a.password && (b += ":" + d.encode(a.password)); b && (b += "@"); return b }; d.buildQuery = function (a, b, c) { var l = "", m, e, f, g; for (e in a) if (r.call(a, e) && e) if (p(a[e])) for (m = {}, f = 0, g = a[e].length; f < g; f++) void 0 !== a[e][f] && void 0 === m[a[e][f] + ""] && (l += "&" + d.buildQueryParameter(e, a[e][f], c), !0 !== b && (m[a[e][f] + ""] = !0)); else void 0 !== a[e] && (l += "&" + d.buildQueryParameter(e, a[e], c)); return l.substring(1) };
    d.buildQueryParameter = function (a, b, c) { return d.encodeQuery(a, c) + (null !== b ? "=" + d.encodeQuery(b, c) : "") }; d.addQuery = function (a, b, c) { if ("object" === typeof b) for (var l in b) r.call(b, l) && d.addQuery(a, l, b[l]); else if ("string" === typeof b) void 0 === a[b] ? a[b] = c : ("string" === typeof a[b] && (a[b] = [a[b]]), p(c) || (c = [c]), a[b] = (a[b] || []).concat(c)); else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter"); }; d.removeQuery = function (a, b, c) {
        var l; if (p(b)) for (c = 0, l = b.length; c < l; c++) a[b[c]] =
        void 0; else if ("RegExp" === w(b)) for (l in a) b.test(l) && (a[l] = void 0); else if ("object" === typeof b) for (l in b) r.call(b, l) && d.removeQuery(a, l, b[l]); else if ("string" === typeof b) void 0 !== c ? "RegExp" === w(c) ? !p(a[b]) && c.test(a[b]) ? a[b] = void 0 : a[b] = D(a[b], c) : a[b] !== String(c) || p(c) && 1 !== c.length ? p(a[b]) && (a[b] = D(a[b], c)) : a[b] = void 0 : a[b] = void 0; else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");
    }; d.hasQuery = function (a, b, c, l) {
        switch (w(b)) {
            case "String": break;
            case "RegExp": for (var e in a) if (r.call(a, e) && b.test(e) && (void 0 === c || d.hasQuery(a, e, c))) return !0; return !1; case "Object": for (var f in b) if (r.call(b, f) && !d.hasQuery(a, f, b[f])) return !1; return !0; default: throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter");
        } switch (w(c)) {
            case "Undefined": return b in a; case "Boolean": return a = !(p(a[b]) ? !a[b].length : !a[b]), c === a; case "Function": return !!c(a[b], b, a); case "Array": return p(a[b]) ? (l ? u : B)(a[b], c) : !1; case "RegExp": return p(a[b]) ?
            l ? u(a[b], c) : !1 : !(!a[b] || !a[b].match(c)); case "Number": c = String(c); case "String": return p(a[b]) ? l ? u(a[b], c) : !1 : a[b] === c; default: throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");
        }
    }; d.joinPaths = function () {
        for (var a = [], b = [], c = 0, l = 0; l < arguments.length; l++) { var e = new d(arguments[l]); a.push(e); for (var e = e.segment(), f = 0; f < e.length; f++) "string" === typeof e[f] && b.push(e[f]), e[f] && c++ } if (!b.length || !c) return new d(""); b = (new d("")).segment(b);
        "" !== a[0].path() && "/" !== a[0].path().slice(0, 1) || b.path("/" + b.path()); return b.normalize()
    }; d.commonPath = function (a, b) { var c = Math.min(a.length, b.length), d; for (d = 0; d < c; d++) if (a.charAt(d) !== b.charAt(d)) { d--; break } if (1 > d) return a.charAt(0) === b.charAt(0) && "/" === a.charAt(0) ? "/" : ""; if ("/" !== a.charAt(d) || "/" !== b.charAt(d)) d = a.substring(0, d).lastIndexOf("/"); return a.substring(0, d + 1) }; d.withinString = function (a, b, c) {
        c || (c = {}); var l = c.start || d.findUri.start, e = c.end || d.findUri.end, f = c.trim || d.findUri.trim, g =
        /[a-z0-9-]=["']?$/i; for (l.lastIndex = 0; ;) { var h = l.exec(a); if (!h) break; h = h.index; if (c.ignoreHtml) { var k = a.slice(Math.max(h - 3, 0), h); if (k && g.test(k)) continue } var k = h + a.slice(h).search(e), n = a.slice(h, k).replace(f, ""); c.ignore && c.ignore.test(n) || (k = h + n.length, n = b(n, h, k, a), a = a.slice(0, h) + n + a.slice(k), l.lastIndex = h + n.length) } l.lastIndex = 0; return a
    }; d.ensureValidHostname = function (a) {
        if (a.match(d.invalid_hostname_characters)) {
            if (!k) throw new TypeError('Hostname "' + a + '" contains characters other than [A-Z0-9.-] and Punycode.js is not available');
            if (k.toASCII(a).match(d.invalid_hostname_characters)) throw new TypeError('Hostname "' + a + '" contains characters other than [A-Z0-9.-]');
        }
    }; d.noConflict = function (a) {
        if (a) return a = { URI: this.noConflict() }, f.URITemplate && "function" === typeof f.URITemplate.noConflict && (a.URITemplate = f.URITemplate.noConflict()), f.IPv6 && "function" === typeof f.IPv6.noConflict && (a.IPv6 = f.IPv6.noConflict()), f.SecondLevelDomains && "function" === typeof f.SecondLevelDomains.noConflict && (a.SecondLevelDomains = f.SecondLevelDomains.noConflict()),
        a; f.URI === this && (f.URI = H); return this
    }; e.build = function (a) { if (!0 === a) this._deferred_build = !0; else if (void 0 === a || this._deferred_build) this._string = d.build(this._parts), this._deferred_build = !1; return this }; e.clone = function () { return new d(this) }; e.valueOf = e.toString = function () { return this.build(!1)._string }; e.protocol = A("protocol"); e.username = A("username"); e.password = A("password"); e.hostname = A("hostname"); e.port = A("port"); e.query = F("query", "?"); e.fragment = F("fragment", "#"); e.search = function (a, b) {
        var c =
        this.query(a, b); return "string" === typeof c && c.length ? "?" + c : c
    }; e.hash = function (a, b) { var c = this.fragment(a, b); return "string" === typeof c && c.length ? "#" + c : c }; e.pathname = function (a, b) { if (void 0 === a || !0 === a) { var c = this._parts.path || (this._parts.hostname ? "/" : ""); return a ? (this._parts.urn ? d.decodeUrnPath : d.decodePath)(c) : c } this._parts.path = this._parts.urn ? a ? d.recodeUrnPath(a) : "" : a ? d.recodePath(a) : "/"; this.build(!b); return this }; e.path = e.pathname; e.href = function (a, b) {
        var c; if (void 0 === a) return this.toString();
        this._string = ""; this._parts = d._parts(); var e = a instanceof d, f = "object" === typeof a && (a.hostname || a.path || a.pathname); a.nodeName && (f = d.getDomAttribute(a), a = a[f] || "", f = !1); !e && f && void 0 !== a.pathname && (a = a.toString()); if ("string" === typeof a || a instanceof String) this._parts = d.parse(String(a), this._parts); else if (e || f) for (c in e = e ? a._parts : a, e) r.call(this._parts, c) && (this._parts[c] = e[c]); else throw new TypeError("invalid input"); this.build(!b); return this
    }; e.is = function (a) {
        var b = !1, c = !1, e = !1, f = !1, h = !1,
        k = !1, n = !1, p = !this._parts.urn; this._parts.hostname && (p = !1, c = d.ip4_expression.test(this._parts.hostname), e = d.ip6_expression.test(this._parts.hostname), b = c || e, h = (f = !b) && g && g.has(this._parts.hostname), k = f && d.idn_expression.test(this._parts.hostname), n = f && d.punycode_expression.test(this._parts.hostname)); switch (a.toLowerCase()) {
            case "relative": return p; case "absolute": return !p; case "domain": case "name": return f; case "sld": return h; case "ip": return b; case "ip4": case "ipv4": case "inet4": return c; case "ip6": case "ipv6": case "inet6": return e;
            case "idn": return k; case "url": return !this._parts.urn; case "urn": return !!this._parts.urn; case "punycode": return n
        } return null
    }; var J = e.protocol, K = e.port, L = e.hostname; e.protocol = function (a, b) { if (void 0 !== a && a && (a = a.replace(/:(\/\/)?$/, ""), !a.match(d.protocol_expression))) throw new TypeError('Protocol "' + a + "\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]"); return J.call(this, a, b) }; e.scheme = e.protocol; e.port = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 !==
        a && (0 === a && (a = null), a && (a += "", ":" === a.charAt(0) && (a = a.substring(1)), a.match(/[^0-9]/)))) throw new TypeError('Port "' + a + '" contains characters other than [0-9]'); return K.call(this, a, b)
    }; e.hostname = function (a, b) { if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 !== a) { var c = {}; if ("/" !== d.parseHost(a, c)) throw new TypeError('Hostname "' + a + '" contains characters other than [A-Z0-9.-]'); a = c.hostname } return L.call(this, a, b) }; e.origin = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 ===
        a) { var c = this.protocol(); return this.authority() ? (c ? c + "://" : "") + this.authority() : "" } c = d(a); this.protocol(c.protocol()).authority(c.authority()).build(!b); return this
    }; e.host = function (a, b) { if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 === a) return this._parts.hostname ? d.buildHost(this._parts) : ""; if ("/" !== d.parseHost(a, this._parts)) throw new TypeError('Hostname "' + a + '" contains characters other than [A-Z0-9.-]'); this.build(!b); return this }; e.authority = function (a, b) {
        if (this._parts.urn) return void 0 ===
        a ? "" : this; if (void 0 === a) return this._parts.hostname ? d.buildAuthority(this._parts) : ""; if ("/" !== d.parseAuthority(a, this._parts)) throw new TypeError('Hostname "' + a + '" contains characters other than [A-Z0-9.-]'); this.build(!b); return this
    }; e.userinfo = function (a, b) { if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 === a) { var c = d.buildUserinfo(this._parts); return c ? c.substring(0, c.length - 1) : c } "@" !== a[a.length - 1] && (a += "@"); d.parseUserinfo(a, this._parts); this.build(!b); return this }; e.resource = function (a,
    b) { var c; if (void 0 === a) return this.path() + this.search() + this.hash(); c = d.parse(a); this._parts.path = c.path; this._parts.query = c.query; this._parts.fragment = c.fragment; this.build(!b); return this }; e.subdomain = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 === a) { if (!this._parts.hostname || this.is("IP")) return ""; var c = this._parts.hostname.length - this.domain().length - 1; return this._parts.hostname.substring(0, c) || "" } c = this._parts.hostname.length - this.domain().length; c = this._parts.hostname.substring(0,
        c); c = new RegExp("^" + h(c)); a && "." !== a.charAt(a.length - 1) && (a += "."); a && d.ensureValidHostname(a); this._parts.hostname = this._parts.hostname.replace(c, a); this.build(!b); return this
    }; e.domain = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; "boolean" === typeof a && (b = a, a = void 0); if (void 0 === a) {
            if (!this._parts.hostname || this.is("IP")) return ""; var c = this._parts.hostname.match(/\./g); if (c && 2 > c.length) return this._parts.hostname; c = this._parts.hostname.length - this.tld(b).length - 1; c = this._parts.hostname.lastIndexOf(".",
            c - 1) + 1; return this._parts.hostname.substring(c) || ""
        } if (!a) throw new TypeError("cannot set domain empty"); d.ensureValidHostname(a); !this._parts.hostname || this.is("IP") ? this._parts.hostname = a : (c = new RegExp(h(this.domain()) + "$"), this._parts.hostname = this._parts.hostname.replace(c, a)); this.build(!b); return this
    }; e.tld = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; "boolean" === typeof a && (b = a, a = void 0); if (void 0 === a) {
            if (!this._parts.hostname || this.is("IP")) return ""; var c = this._parts.hostname.lastIndexOf("."),
            c = this._parts.hostname.substring(c + 1); return !0 !== b && g && g.list[c.toLowerCase()] ? g.get(this._parts.hostname) || c : c
        } if (a) if (a.match(/[^a-zA-Z0-9-]/)) if (g && g.is(a)) c = new RegExp(h(this.tld()) + "$"), this._parts.hostname = this._parts.hostname.replace(c, a); else throw new TypeError('TLD "' + a + '" contains characters other than [A-Z0-9]'); else {
            if (!this._parts.hostname || this.is("IP")) throw new ReferenceError("cannot set TLD on non-domain host"); c = new RegExp(h(this.tld()) + "$"); this._parts.hostname = this._parts.hostname.replace(c,
            a)
        } else throw new TypeError("cannot set TLD empty"); this.build(!b); return this
    }; e.directory = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 === a || !0 === a) { if (!this._parts.path && !this._parts.hostname) return ""; if ("/" === this._parts.path) return "/"; var c = this._parts.path.length - this.filename().length - 1, c = this._parts.path.substring(0, c) || (this._parts.hostname ? "/" : ""); return a ? d.decodePath(c) : c } c = this._parts.path.length - this.filename().length; c = this._parts.path.substring(0, c); c = new RegExp("^" +
        h(c)); this.is("relative") || (a || (a = "/"), "/" !== a.charAt(0) && (a = "/" + a)); a && "/" !== a.charAt(a.length - 1) && (a += "/"); a = d.recodePath(a); this._parts.path = this._parts.path.replace(c, a); this.build(!b); return this
    }; e.filename = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 === a || !0 === a) { if (!this._parts.path || "/" === this._parts.path) return ""; var c = this._parts.path.lastIndexOf("/"), c = this._parts.path.substring(c + 1); return a ? d.decodePathSegment(c) : c } c = !1; "/" === a.charAt(0) && (a = a.substring(1)); a.match(/\.?\//) &&
        (c = !0); var e = new RegExp(h(this.filename()) + "$"); a = d.recodePath(a); this._parts.path = this._parts.path.replace(e, a); c ? this.normalizePath(b) : this.build(!b); return this
    }; e.suffix = function (a, b) {
        if (this._parts.urn) return void 0 === a ? "" : this; if (void 0 === a || !0 === a) { if (!this._parts.path || "/" === this._parts.path) return ""; var c = this.filename(), e = c.lastIndexOf("."); if (-1 === e) return ""; c = c.substring(e + 1); c = /^[a-z0-9%]+$/i.test(c) ? c : ""; return a ? d.decodePathSegment(c) : c } "." === a.charAt(0) && (a = a.substring(1)); if (c = this.suffix()) e =
        a ? new RegExp(h(c) + "$") : new RegExp(h("." + c) + "$"); else { if (!a) return this; this._parts.path += "." + d.recodePath(a) } e && (a = d.recodePath(a), this._parts.path = this._parts.path.replace(e, a)); this.build(!b); return this
    }; e.segment = function (a, b, c) {
        var d = this._parts.urn ? ":" : "/", e = this.path(), f = "/" === e.substring(0, 1), e = e.split(d); void 0 !== a && "number" !== typeof a && (c = b, b = a, a = void 0); if (void 0 !== a && "number" !== typeof a) throw Error('Bad segment "' + a + '", must be 0-based integer'); f && e.shift(); 0 > a && (a = Math.max(e.length +
        a, 0)); if (void 0 === b) return void 0 === a ? e : e[a]; if (null === a || void 0 === e[a]) if (p(b)) { e = []; a = 0; for (var g = b.length; a < g; a++) if (b[a].length || e.length && e[e.length - 1].length) e.length && !e[e.length - 1].length && e.pop(), e.push(C(b[a])) } else { if (b || "string" === typeof b) b = C(b), "" === e[e.length - 1] ? e[e.length - 1] = b : e.push(b) } else b ? e[a] = C(b) : e.splice(a, 1); f && e.unshift(""); return this.path(e.join(d), c)
    }; e.segmentCoded = function (a, b, c) {
        var e, f; "number" !== typeof a && (c = b, b = a, a = void 0); if (void 0 === b) {
            a = this.segment(a, b, c); if (p(a)) for (e =
            0, f = a.length; e < f; e++) a[e] = d.decode(a[e]); else a = void 0 !== a ? d.decode(a) : void 0; return a
        } if (p(b)) for (e = 0, f = b.length; e < f; e++) b[e] = d.encode(b[e]); else b = "string" === typeof b || b instanceof String ? d.encode(b) : b; return this.segment(a, b, c)
    }; var M = e.query; e.query = function (a, b) {
        if (!0 === a) return d.parseQuery(this._parts.query, this._parts.escapeQuerySpace); if ("function" === typeof a) {
            var c = d.parseQuery(this._parts.query, this._parts.escapeQuerySpace), e = a.call(this, c); this._parts.query = d.buildQuery(e || c, this._parts.duplicateQueryParameters,
            this._parts.escapeQuerySpace); this.build(!b); return this
        } return void 0 !== a && "string" !== typeof a ? (this._parts.query = d.buildQuery(a, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), this.build(!b), this) : M.call(this, a, b)
    }; e.setQuery = function (a, b, c) {
        var e = d.parseQuery(this._parts.query, this._parts.escapeQuerySpace); if ("string" === typeof a || a instanceof String) e[a] = void 0 !== b ? b : null; else if ("object" === typeof a) for (var f in a) r.call(a, f) && (e[f] = a[f]); else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");
        this._parts.query = d.buildQuery(e, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); "string" !== typeof a && (c = b); this.build(!c); return this
    }; e.addQuery = function (a, b, c) { var e = d.parseQuery(this._parts.query, this._parts.escapeQuerySpace); d.addQuery(e, a, void 0 === b ? null : b); this._parts.query = d.buildQuery(e, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); "string" !== typeof a && (c = b); this.build(!c); return this }; e.removeQuery = function (a, b, c) {
        var e = d.parseQuery(this._parts.query,
        this._parts.escapeQuerySpace); d.removeQuery(e, a, b); this._parts.query = d.buildQuery(e, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); "string" !== typeof a && (c = b); this.build(!c); return this
    }; e.hasQuery = function (a, b, c) { var e = d.parseQuery(this._parts.query, this._parts.escapeQuerySpace); return d.hasQuery(e, a, b, c) }; e.setSearch = e.setQuery; e.addSearch = e.addQuery; e.removeSearch = e.removeQuery; e.hasSearch = e.hasQuery; e.normalize = function () {
        return this._parts.urn ? this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build() :
        this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()
    }; e.normalizeProtocol = function (a) { "string" === typeof this._parts.protocol && (this._parts.protocol = this._parts.protocol.toLowerCase(), this.build(!a)); return this }; e.normalizeHostname = function (a) {
        this._parts.hostname && (this.is("IDN") && k ? this._parts.hostname = k.toASCII(this._parts.hostname) : this.is("IPv6") && n && (this._parts.hostname = n.best(this._parts.hostname)), this._parts.hostname =
        this._parts.hostname.toLowerCase(), this.build(!a)); return this
    }; e.normalizePort = function (a) { "string" === typeof this._parts.protocol && this._parts.port === d.defaultPorts[this._parts.protocol] && (this._parts.port = null, this.build(!a)); return this }; e.normalizePath = function (a) {
        var b = this._parts.path; if (!b) return this; if (this._parts.urn) return this._parts.path = d.recodeUrnPath(this._parts.path), this.build(!a), this; if ("/" === this._parts.path) return this; var b = d.recodePath(b), c, e = "", f, g; "/" !== b.charAt(0) && (c = !0,
        b = "/" + b); if ("/.." === b.slice(-3) || "/." === b.slice(-2)) b += "/"; b = b.replace(/(\/(\.\/)+)|(\/\.$)/g, "/").replace(/\/{2,}/g, "/"); c && (e = b.substring(1).match(/^(\.\.\/)+/) || "") && (e = e[0]); for (; ;) { f = b.search(/\/\.\.(\/|$)/); if (-1 === f) break; else if (0 === f) { b = b.substring(3); continue } g = b.substring(0, f).lastIndexOf("/"); -1 === g && (g = f); b = b.substring(0, g) + b.substring(f + 3) } c && this.is("relative") && (b = e + b.substring(1)); this._parts.path = b; this.build(!a); return this
    }; e.normalizePathname = e.normalizePath; e.normalizeQuery =
    function (a) { "string" === typeof this._parts.query && (this._parts.query.length ? this.query(d.parseQuery(this._parts.query, this._parts.escapeQuerySpace)) : this._parts.query = null, this.build(!a)); return this }; e.normalizeFragment = function (a) { this._parts.fragment || (this._parts.fragment = null, this.build(!a)); return this }; e.normalizeSearch = e.normalizeQuery; e.normalizeHash = e.normalizeFragment; e.iso8859 = function () {
        var a = d.encode, b = d.decode; d.encode = escape; d.decode = decodeURIComponent; try { this.normalize() } finally {
            d.encode =
            a, d.decode = b
        } return this
    }; e.unicode = function () { var a = d.encode, b = d.decode; d.encode = v; d.decode = unescape; try { this.normalize() } finally { d.encode = a, d.decode = b } return this }; e.readable = function () {
        var a = this.clone(); a.username("").password("").normalize(); var b = ""; a._parts.protocol && (b += a._parts.protocol + "://"); a._parts.hostname && (a.is("punycode") && k ? (b += k.toUnicode(a._parts.hostname), a._parts.port && (b += ":" + a._parts.port)) : b += a.host()); a._parts.hostname && a._parts.path && "/" !== a._parts.path.charAt(0) && (b += "/");
        b += a.path(!0); if (a._parts.query) { for (var c = "", e = 0, f = a._parts.query.split("&"), g = f.length; e < g; e++) { var h = (f[e] || "").split("="), c = c + ("&" + d.decodeQuery(h[0], this._parts.escapeQuerySpace).replace(/&/g, "%26")); void 0 !== h[1] && (c += "=" + d.decodeQuery(h[1], this._parts.escapeQuerySpace).replace(/&/g, "%26")) } b += "?" + c.substring(1) } return b += d.decodeQuery(a.hash(), !0)
    }; e.absoluteTo = function (a) {
        var b = this.clone(), c = ["protocol", "username", "password", "hostname", "port"], e, f; if (this._parts.urn) throw Error("URNs do not have any generally defined hierarchical components");
        a instanceof d || (a = new d(a)); b._parts.protocol || (b._parts.protocol = a._parts.protocol); if (this._parts.hostname) return b; for (e = 0; f = c[e]; e++) b._parts[f] = a._parts[f]; b._parts.path ? ".." === b._parts.path.substring(-2) && (b._parts.path += "/") : (b._parts.path = a._parts.path, b._parts.query || (b._parts.query = a._parts.query)); "/" !== b.path().charAt(0) && (c = (c = a.directory()) ? c : 0 === a.path().indexOf("/") ? "/" : "", b._parts.path = (c ? c + "/" : "") + b._parts.path, b.normalizePath()); b.build(); return b
    }; e.relativeTo = function (a) {
        var b =
        this.clone().normalize(), c, e, f; if (b._parts.urn) throw Error("URNs do not have any generally defined hierarchical components"); a = (new d(a)).normalize(); c = b._parts; e = a._parts; f = b.path(); a = a.path(); if ("/" !== f.charAt(0)) throw Error("URI is already relative"); if ("/" !== a.charAt(0)) throw Error("Cannot calculate a URI relative to another relative URI"); c.protocol === e.protocol && (c.protocol = null); if (c.username === e.username && c.password === e.password && null === c.protocol && null === c.username && null === c.password && c.hostname ===
        e.hostname && c.port === e.port) c.hostname = null, c.port = null; else return b.build(); if (f === a) return c.path = "", b.build(); f = d.commonPath(f, a); if (!f) return b.build(); e = e.path.substring(f.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../"); c.path = e + c.path.substring(f.length) || "./"; return b.build()
    }; e.equals = function (a) {
        var b = this.clone(), c = new d(a), e; a = {}; var f, g; b.normalize(); c.normalize(); if (b.toString() === c.toString()) return !0; f = b.query(); e = c.query(); b.query(""); c.query(""); if (b.toString() !== c.toString() ||
        f.length !== e.length) return !1; b = d.parseQuery(f, this._parts.escapeQuerySpace); e = d.parseQuery(e, this._parts.escapeQuerySpace); for (g in b) if (r.call(b, g)) { if (!p(b[g])) { if (b[g] !== e[g]) return !1 } else if (!B(b[g], e[g])) return !1; a[g] = !0 } for (g in e) if (r.call(e, g) && !a[g]) return !1; return !0
    }; e.duplicateQueryParameters = function (a) { this._parts.duplicateQueryParameters = !!a; return this }; e.escapeQuerySpace = function (a) { this._parts.escapeQuerySpace = !!a; return this }; return d
});

/**
 * Newsletters.ts - Newsletters subscription management widget that can be embedded in external websites.
 *
 * @link        http://www.datacomsphere.com/
 * @version     0.5.4a
 */

// /// <reference path="../typings/jquery/jquery.d.ts" />

var DatacomSphere;
(function (DatacomSphere) {
    var Newsletters;
    (function (Newsletters) {
        "use strict";
        var NewslettersWidget = (function () {
            function NewslettersWidget(params) {
                this.service = new NewslettersService();
                this.settings = new NewslettersWidgetOptions();
                this.helper = new NewslettersHelper();
                //Defaults
                this.settings.node = $("#nw-placeholder");
                this.settings.isNewSignup = true;
                this.settings.tags = [];
                this.settings.events = {
                    onUpdate: null,
                    afterInit: null,
                    renderred: null
                };
                this.settings.integration = {
                    sphere: {
                        api: null
                    }
                };
                this.settings.events.onUpdate = function () {
                    alert("Thank you for signing up. To confirm your subscription, please check your email.");
                };
                this.settings.ui = {
                    caption: null,
                    implicitSignupMode: false,
                    showNameFieldsOnSignup: true,
                    title: 'Signup for Updates',
                    tags: {
                        title: 'h2'
                    }
                };
                var ui = this.settings.ui;
                //Defaulting text
                params.ui = params.ui || ui;
                params.ui.tags = params.ui.tags || ui.tags;
                params.ui.title = params.ui.title || ui.title;
                //Overrides
                this.settings = NewslettersHelper.extendDefaults(this.settings, params);
                ui.title = this.stripHTML(ui.title);
                ui.tags.title = this.stripHTML(ui.tags.title);
                ui.caption = this.stripHTML(ui.caption);
                //Initialise
                this.init();
            }
            NewslettersWidget.prototype.stripHTML = function (str) {
                if (str) {
                    return str.replace(/</g, "&lt;").replace(/>/g, "&gt;");
                }
            };
            NewslettersWidget.prototype.getNewsletters = function () {
                var service = this.service;
                var newsletters;
                service.getNewsletters(this.settings, this.render.bind(this, null)); //Maintain the context of this (widget) upon the callback
                return newsletters;
            };
            NewslettersWidget.prototype.getNewslettersForCurrentSphereUser = function () {
                var _this = this;
                var service = this.service;
                var newsletters;
                service.getSphereVerifiedUserDetails(this.settings, function (res) {
                    if (res == null) {
                        service.getNewsletters(_this.settings, _this.render.bind(_this, null)); //Maintain the context of this (widget) upon the callback
                        return;
                    }
                    else {
                        var email = res.Email;
                        _this.settings.email = email;
                        _this.settings.isNewSignup = !email;
                        service.getNewsletters(_this.settings, _this.render.bind(_this, email)); //Maintain the context of this (widget) upon the callback
                    }
                });
                return newsletters;
            };
            NewslettersWidget.prototype.render = function (email, content) {
                if (content instanceof Object && content["err"]) {
                    console.log("Newsletters: Could not initialise newsletters");
                    return;
                }
                var items = JSON.parse(content.toString());
                var form = $('<form id="nw-form"></form');
                var ui = this.settings.ui;
                if (typeof items === "undefined" || items == null || items.length == 0) {
                    //do nothing
                    return;
                }
                //Append the email field and change the form to be a signup form 
                if (!email) {
                    form.append('<div class="nw-signup-wrapper"></div>');
                    var signupWrapper = form.children().first();
                    signupWrapper.append('<div class="nw-input-group"><div class="nw-label-wrapper nw-email"><label for="nw-signup-email">Email</label></div><div class="nw-input-wrapper nw-email"><input type="email" id="nw-signup-email" required /></div></div>');
                    if (this.settings.ui.showNameFieldsOnSignup) {
                        signupWrapper.append('<div class="nw-input-group"><div class="nw-label-wrapper nw-first-name"><label for="nw-signup-first-name">First Name</label></div><div class="nw-input-wrapper nw-first-name"><input type="text" id="nw-signup-first-name" /></div></div>');
                        signupWrapper.append('<div class="nw-input-group"><div class="nw-label-wrapper nw-last-name"><label for="nw-signup-last-name">Last Name</label></div><div class="nw-input-wrapper nw-last-name"><input type="text" id="nw-signup-last-name" /></div></div>');
                    }
                }
                var hideFormElements = items.length <= 1 && ui.implicitSignupMode;
                form.append('<div class="nw-items-wrapper"></div>');
                var itemsWrapper = form.find('.nw-items-wrapper').first();
                if (hideFormElements) {
                    itemsWrapper.hide();
                }
                for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {
                    var item = items_1[_a];
                    var newsletter = new Newsletter;
                    newsletter.name = item.name;
                    newsletter.subscribed = item.subscribed;
                    itemsWrapper.append(newsletter.render(hideFormElements));
                }
                var button = '<input type="submit" id="nw-submit-button" value="Signup"></input>';
                form = form.append(button);
                var html = '';
                var caption = '';
                if (typeof ui.caption !== "undefined" && ui.caption) {
                    caption = NewslettersHelper.formatUnicorn('<{0}>{1}</{0}>', ['p', ui.caption]);
                }
                if (email) {
                    html = NewslettersHelper.formatUnicorn('<{0}>{1}</{0}><b>{2}</b>', [ui.tags.title, ui.title, this.settings.email]);
                }
                else {
                    html = NewslettersHelper.formatUnicorn('<{0}>{1}</{0}>', [ui.tags.title, ui.title]);
                }
                html += caption;
                html += form[0].outerHTML;
                html = NewslettersHelper.formatUnicorn('<div class="{0}">{1}</div>', ['nw-wrapper', html]);
                this.settings.node.html(html);
                if (typeof this.settings.events.renderred === "function") {
                    this.settings.events.renderred.call(this);
                }
            };
            ;
            NewslettersWidget.prototype.init = function () {
                //setup bindings
                var self = this;
                $(document).on("submit", "#nw-form", function (e) {
                    e.preventDefault();
                    if ($('#nw-signup-email').length > 0 && !$('#nw-signup-email').val()) {
                        alert('Please enter an email address.');
                        return false;
                    }
                    if ($('.nw-item-checkbox:checkbox').length > 0 && $('.nw-item-checkbox:checkbox:checked').length <= 0) {
                        alert('Please select at least one newsletter to subscribe to.');
                        return false;
                    }
                    var data = $("#nw-form").serialize();
                    var newsletterList = [];
                    $('input.nw-item-checkbox').each(function () {
                        newsletterList.push({ key: this.name.substring(3), value: this.checked ? "SUBSCRIBE" : "UNSUBSCRIBE" });
                    });
                    //IsNewSignup
                    var json = {
                        id: self.settings.id,
                        email: self.settings.email,
                        mailLists: newsletterList,
                        isNewSignup: !self.settings.email,
                        firstName: null,
                        lastName: null
                    };
                    if (self.settings.isNewSignup) {
                        json.isNewSignup = true;
                        json.email = $("#nw-signup-email").val();
                        json.firstName = $("#nw-signup-first-name").val();
                        json.lastName = $("#nw-signup-last-name").val();
                    }
                    self.service.updateSubscriptions(self.settings.email, self.settings, json, self.settings.events.onUpdate);
                });
                if (typeof this.settings.events.afterInit === "function") {
                    this.settings.events.afterInit.call(this);
                }
            };
            ;
            NewslettersWidget.prototype.extendDefaults = function (source, properties) {
                var property;
                for (property in properties) {
                    if (properties.hasOwnProperty(property)) {
                        if (typeof properties[property] !== "undefined" && properties[property] && typeof properties[property] == "object") {
                            var subproperty;
                            for (subproperty in properties[property]) {
                                if (properties[property].hasOwnProperty(subproperty)) {
                                    source[property][subproperty] = properties[property][subproperty];
                                }
                            }
                        }
                        else {
                            source[property] = properties[property];
                        }
                    }
                }
                return source;
            };
            return NewslettersWidget;
        }());
        Newsletters.NewslettersWidget = NewslettersWidget;
        ;
        var NewslettersHelper = (function () {
            function NewslettersHelper() {
            }
            NewslettersHelper.sendSyncAjaxRequest = function (type, url, params) {
                var request = $.ajax({
                    type: type,
                    url: url,
                    async: false
                }).done(function (res) {
                    return res;
                })
                    .fail(function (jqXHR, textStatus) {
                        console.error(jqXHR);
                    });
            };
            ;
            NewslettersHelper.sendAjaxRequest = function (type, url, params, callback, withCredentials) {
                if (withCredentials === void 0) { withCredentials = false; }
                var request = $.ajax({
                    type: type,
                    url: url,
                    xhrFields: {
                        withCredentials: withCredentials
                    },
                    data: params
                })
                    .done(function (res) {
                        callback(res);
                    })
                    .fail(function (jqXHR, textStatus) {
                        console.error(jqXHR);
                        callback({
                            err: true,
                            message: "Request could not be completed: " + textStatus
                        });
                    });
            };
            ;
            NewslettersHelper.formatUnicorn = function (s) {
                "use strict";
                var arguements = [];
                for (var _a = 1; _a < arguments.length; _a++) {
                    arguements[_a - 1] = arguments[_a];
                }
                var arguements = [];
                for (var _i = 1; _i < arguments.length; _i++) {
                    arguements[_i - 1] = arguments[_i];
                }
                var str = s.toString();
                if (arguments.length) {
                    var type = typeof arguements[0], args = type == 'string' || type == 'number' ? Array.prototype.slice.call(arguements) : arguements[0];
                    for (var arg in args)
                        str = str.replace(new RegExp('\\{' + arg + '\\}', 'gi'), args[arg]);
                }
                return str;
            };
            ;
            NewslettersHelper.extendDefaults = function (source, properties) {
                var property;
                for (property in properties) {
                    if (properties.hasOwnProperty(property)) {
                        if (typeof properties[property] !== "undefined" && properties[property] && typeof properties[property] == "object") {
                            var subproperty;
                            for (subproperty in properties[property]) {
                                if (properties[property].hasOwnProperty(subproperty)) {
                                    source[property][subproperty] = properties[property][subproperty];
                                }
                            }
                        }
                        else {
                            source[property] = properties[property];
                        }
                    }
                }
                return source;
            };
            return NewslettersHelper;
        }());
        Newsletters.NewslettersHelper = NewslettersHelper;
        ;
        var NewslettersService = (function () {
            function NewslettersService() {
                this.client = new NewslettersClient();
            }
            NewslettersService.prototype.getNewsletters = function (settings, callback) {
                var newsletters = this.client.getNewsletters(settings, callback);
                return newsletters;
            };
            ;
            NewslettersService.prototype.updateSubscriptions = function (email, settings, formData, callback) {
                var newsletters = this.client.updateSubscriptions(email, settings, formData, callback);
                return new Newsletter();
            };
            ;
            NewslettersService.prototype.getSphereVerifiedUserDetails = function (settings, callback) {
                return this.client.getSphereVerifiedUserDetails(settings, callback);
            };
            return NewslettersService;
        }());
        Newsletters.NewslettersService = NewslettersService;
        var NewslettersClient = (function () {
            function NewslettersClient() {
                this.GetNewslettersUrl = "list";
                this.GetUserSubscriptionsUrl = "subscriptions";
                this.UpdateUserSubscriptionsUrl = "subscriptions";
                this.GetAuthenticationStatusUrl = "Security/GetAuthenticationStatus";
            }
            NewslettersClient.prototype.getNewsletters = function (settings, callback) {
                var url = settings.api + "/" + this.GetNewslettersUrl;
                NewslettersHelper.sendAjaxRequest("GET", url, { 'id': settings.id, 'tags': settings.tags }, callback);
                return new Array();
            };
            ;
            NewslettersClient.prototype.getSphereVerifiedUserDetails = function (settings, callback) {
                var url = settings.integration.sphere.api + "/" + this.GetAuthenticationStatusUrl;
                var user = NewslettersHelper.sendAjaxRequest("GET", url, null, callback, true);
            };
            ;
            NewslettersClient.prototype.updateSubscriptions = function (email, settings, formData, callback) {
                var events = settings.events;
                var url = settings.api + "/" + this.UpdateUserSubscriptionsUrl;
                $("#nw-submit-button").prop("disabled", true); //get from handler not access directly
                if (typeof events !== "undefined" && typeof events.onUpdate !== "undefined") {
                    if (typeof events.onUpdate === "function") {
                        callback = events.onUpdate;
                    }
                }
                NewslettersHelper.sendAjaxRequest("POST", url, formData, callback);
                return new Array();
            };
            return NewslettersClient;
        }());
        Newsletters.NewslettersClient = NewslettersClient;
        ;
        var Subscriber = (function () {
            function Subscriber() {
            }
            return Subscriber;
        }());
        Newsletters.Subscriber = Subscriber;
        var Newsletter = (function () {
            function Newsletter() {
            }
            Newsletter.prototype.render = function (isInvisible) {
                if (!isInvisible) {
                    return "<div class='nw-item'><input type='checkbox' class='nw-item-checkbox' id= 'nw-" + this.name + "'  name= 'nw-" + this.name + "' value= '" + this.name + "' " + (this.subscribed ? "checked disabled" : "") + "/><label for='nw-" + this.name + "' > " + this.name + " </label></div>";
                }
                else {
                    return "<div class='nw-item'><input type='hidden' class='nw-item-checkbox nw-hidden' id= 'nw-" + this.name + "'  name= 'nw-" + this.name + "' value='SUBSCRIBE' checked/></div>";
                }
            };
            return Newsletter;
        }());
        var SphereUser = (function () {
            function SphereUser() {
            }
            return SphereUser;
        }());
        var NewslettersWidgetOptions = (function () {
            function NewslettersWidgetOptions() {
            }
            return NewslettersWidgetOptions;
        }());
    })(Newsletters = DatacomSphere.Newsletters || (DatacomSphere.Newsletters = {}));
})(DatacomSphere || (DatacomSphere = {}));

/// <reference path="../../Misc/Typings/newsletters.d.ts"/>
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        /**
         * You need to call this in an impl to get it to render any newsletter signup widgets you might have on a page.
         */
        var NewsletterSignupInitialiser = /** @class */ (function () {
            function NewsletterSignupInitialiser() {
            }
            // ReSharper disable once DuplicateIdentifierError
            NewsletterSignupInitialiser.initWidgets = function () {
                var widgetEles = $('.mc-newsletter-signup > div[id^=mc-nw-]');
                widgetEles.each(function (_, ele) {
                    var $ele = $(ele);
                    var title = $ele.data('title');
                    var caption = $ele.data('caption');
                    var widget = new DatacomSphere.Newsletters.NewslettersWidget({
                        node: $ele,
                        id: $ele.data('client'),
                        api: $ele.data('api-url'),
                        tags: $ele.data('tags'),
                        ui: {
                            title: title ? title : null,
                            caption: caption ? caption : null,
                            implicitSignupMode: true,
                            showNameFieldsOnSignup: $ele.data('show-name')
                        },
                        integration: {
                            sphere: {
                                api: $ele.data('os-api-url')
                            }
                        },
                        events: {
                            renderred: function () {
                                // HACK: If the page happens to have masonry, and there is an ancestor that happens to have masonry layout, relayout it.
                                if (Masonry) {
                                    var findMasonry = function ($e) {
                                        var m = Masonry.data($e[0]);
                                        if (m) {
                                            return m;
                                        }
                                        else if ($e.parent().length > 0) {
                                            return findMasonry($e.parent());
                                        }
                                        return null;
                                    };
                                    var masonry = findMasonry($('.mc-newsletter-signup'));
                                    if (masonry) {
                                        masonry.layout();
                                    }
                                }
                                // Hide MC wrapper (hehe) element if embed rendering has failed in any way
                                if ($ele.children().length === 0) {
                                    $ele.parent().hide();
                                }
                            }
                        }
                    });
                    widget.getNewslettersForCurrentSphereUser();
                });
            };
            return NewsletterSignupInitialiser;
        }());
        Common.NewsletterSignupInitialiser = NewsletterSignupInitialiser;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=newsletter-signup-initialiser.js.map
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var CookieHelper;
        (function (CookieHelper) {
            function GetCookieByKey(key) {
                // Regex from MDN Docs: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
                return document.cookie.replace(new RegExp('(?:(?:^|.*;\\s*)' + key + '\\s*\\=\\s*([^;]*).*$)|^.*$'), "$1");
            }
            CookieHelper.GetCookieByKey = GetCookieByKey;
            function SetCookieWithLongExpiry(key, value) {
                // Set expiration of cookie to 1 year from now
                var expirationDate = new Date();
                expirationDate.setFullYear(expirationDate.getFullYear() + 1);
                // Need to set path to /, otherwise it defaults to the current path (or even the parent path)!
                document.cookie = key + "=" + value + ";path=/;expires=" + expirationDate.toUTCString() + ";";
            }
            CookieHelper.SetCookieWithLongExpiry = SetCookieWithLongExpiry;
            function CookieIdMatchesId(id, cookieKey) {
                var alertId = encodeURIComponent(id);
                var cookieValue = GetCookieByKey(cookieKey);
                return !(!cookieValue || (cookieValue != alertId));
            }
            CookieHelper.CookieIdMatchesId = CookieIdMatchesId;
            function CookieLastModifiedIsNew(lastModified, cookieKey) {
                var cookieValue = GetCookieByKey(cookieKey);
                var cookieValueAsLastModified = new Date(cookieValue);
                return !cookieValue || (cookieValueAsLastModified.toString() == 'Invalid Date') || (lastModified > cookieValueAsLastModified);
            }
            CookieHelper.CookieLastModifiedIsNew = CookieLastModifiedIsNew;
        })(CookieHelper = Common.CookieHelper || (Common.CookieHelper = {}));
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=cookie-helper.js.map
var Impl;
(function (Impl) {
    var Common;
    (function (Common) {
        var Dropdown = /** @class */ (function () {
            function Dropdown(dropdowns, action) {
                if (action === void 0) { action = null; }
                this.dropdowns = dropdowns;
                this.dropdowns
                    .hoverIntent({
                    sensitivity: 2,
                    interval: 100,
                    timeout: 500,
                    over: function () { },
                    out: function () {
                        $(this).find('.dropdown-list').addClass('hide');
                        $(this).find('> button, > a').removeClass('active');
                        $(this).find('> button, > a').blur();
                    }
                })
                    .find('> button, > a').click(function (e) {
                    e.preventDefault();
                    action && action(e);
                    $(e.currentTarget).find('~ .dropdown-list').toggleClass('hide');
                    $(e.currentTarget).toggleClass('active');
                    return false;
                });
            }
            return Dropdown;
        }());
        Common.Dropdown = Dropdown;
    })(Common = Impl.Common || (Impl.Common = {}));
})(Impl || (Impl = {}));
//# sourceMappingURL=dropdown.js.map
