if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(){"use strict";var n=jQuery.fn.jquery.split(" ")[0].split(".");if(n[0]<2&&n[1]<9||1==n[0]&&9==n[1]&&n[2]<1||3<n[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4");}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var i=!1,r=this;n(this).one("bsTransitionEnd",function(){i=!0});return setTimeout(function(){i||n(r).trigger(n.support.transition.end)},t),this};n(function(){n.support.transition=function(){var i=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(i.style[n]!==undefined)return{end:t[n]};return!1}();n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(n){"use strict";var i='[data-dismiss="alert"]',t=function(t){n(t).on("click",i,this.close)},r;t.VERSION="3.4.1";t.TRANSITION_DURATION=150;t.prototype.close=function(i){function e(){u.detach().trigger("closed.bs.alert").remove()}var f=n(this),r=f.attr("data-target"),u;r||(r=(r=f.attr("href"))&&r.replace(/.*(?=#[^\s]*$)/,""));r="#"===r?[]:r;u=n(document).find(r);i&&i.preventDefault();u.length||(u=f.closest(".alert"));u.trigger(i=n.Event("close.bs.alert"));i.isDefaultPrevented()||(u.removeClass("in"),n.support.transition&&u.hasClass("fade")?u.one("bsTransitionEnd",e).emulateTransitionEnd(t.TRANSITION_DURATION):e())};r=n.fn.alert;n.fn.alert=function(i){return this.each(function(){var r=n(this),u=r.data("bs.alert");u||r.data("bs.alert",u=new t(this));"string"==typeof i&&u[i].call(r)})};n.fn.alert.Constructor=t;n.fn.alert.noConflict=function(){return n.fn.alert=r,this};n(document).on("click.bs.alert.data-api",i,t.prototype.close)}(jQuery),function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.button"),f="object"==typeof i&&i;r||u.data("bs.button",r=new t(this,f));"toggle"==i?r.toggle():i&&r.setState(i)})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.isLoading=!1},r;t.VERSION="3.4.1";t.DEFAULTS={loadingText:"loading..."};t.prototype.setState=function(t){var i="disabled",r=this.$element,f=r.is("input")?"val":"html",u=r.data();t+="Text";null==u.resetText&&r.data("resetText",r[f]());setTimeout(n.proxy(function(){r[f](null==u[t]?this.options[t]:u[t]);"loadingText"==t?(this.isLoading=!0,r.addClass(i).attr(i,i).prop(i,!0)):this.isLoading&&(this.isLoading=!1,r.removeClass(i).removeAttr(i).prop(i,!1))},this),0)};t.prototype.toggle=function(){var t=!0,i=this.$element.closest('[data-toggle="buttons"]'),n;i.length?(n=this.$element.find("input"),"radio"==n.prop("type")?(n.prop("checked")&&(t=!1),i.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==n.prop("type")&&(n.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),n.prop("checked",this.$element.hasClass("active")),t&&n.trigger("change")):(this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active"))};r=n.fn.button;n.fn.button=i;n.fn.button.Constructor=t;n.fn.button.noConflict=function(){return n.fn.button=r,this};n(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var r=n(t.target).closest(".btn");i.call(r,"toggle");n(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),r.is("input,button")?r.trigger("focus"):r.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){n(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.carousel"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i),e="string"==typeof i?i:f.slide;r||u.data("bs.carousel",r=new t(this,f));"number"==typeof i?r.to(i):e?r[e]():f.interval&&r.pause().cycle()})}var t=function(t,i){this.$element=n(t);this.$indicators=this.$element.find(".carousel-indicators");this.options=i;this.paused=null;this.sliding=null;this.interval=null;this.$active=null;this.$items=null;this.options.keyboard&&this.$element.on("keydown.bs.carousel",n.proxy(this.keydown,this));"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",n.proxy(this.pause,this)).on("mouseleave.bs.carousel",n.proxy(this.cycle,this))},u,r;t.VERSION="3.4.1";t.TRANSITION_DURATION=600;t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0};t.prototype.keydown=function(n){if(!/input|textarea/i.test(n.target.tagName)){switch(n.which){case 37:this.prev();break;case 39:this.next();break;default:return}n.preventDefault()}};t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(n.proxy(this.next,this),this.options.interval)),this};t.prototype.getItemIndex=function(n){return this.$items=n.parent().children(".item"),this.$items.index(n||this.$active)};t.prototype.getItemForDirection=function(n,t){var i=this.getItemIndex(t),r;return("prev"==n&&0===i||"next"==n&&i==this.$items.length-1)&&!this.options.wrap?t:(r=(i+("prev"==n?-1:1))%this.$items.length,this.$items.eq(r))};t.prototype.to=function(n){var i=this,t=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(n>this.$items.length-1||n<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){i.to(n)}):t==n?this.pause().cycle():this.slide(t<n?"next":"prev",this.$items.eq(n))};t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&n.support.transition&&(this.$element.trigger(n.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this};t.prototype.next=function(){if(!this.sliding)return this.slide("next")};t.prototype.prev=function(){if(!this.sliding)return this.slide("prev")};t.prototype.slide=function(i,r){var e=this.$element.find(".item.active"),u=r||this.getItemForDirection(i,e),l=this.interval,f="next"==i?"left":"right",a=this,o,s,h,c;return u.hasClass("active")?this.sliding=!1:(o=u[0],s=n.Event("slide.bs.carousel",{relatedTarget:o,direction:f}),(this.$element.trigger(s),!s.isDefaultPrevented())?((this.sliding=!0,l&&this.pause(),this.$indicators.length)&&(this.$indicators.find(".active").removeClass("active"),h=n(this.$indicators.children()[this.getItemIndex(u)]),h&&h.addClass("active")),c=n.Event("slid.bs.carousel",{relatedTarget:o,direction:f}),n.support.transition&&this.$element.hasClass("slide")?(u.addClass(i),"object"==typeof u&&u.length&&u[0].offsetWidth,e.addClass(f),u.addClass(f),e.one("bsTransitionEnd",function(){u.removeClass([i,f].join(" ")).addClass("active");e.removeClass(["active",f].join(" "));a.sliding=!1;setTimeout(function(){a.$element.trigger(c)},0)}).emulateTransitionEnd(t.TRANSITION_DURATION)):(e.removeClass("active"),u.addClass("active"),this.sliding=!1,this.$element.trigger(c)),l&&this.cycle(),this):void 0)};u=n.fn.carousel;n.fn.carousel=i;n.fn.carousel.Constructor=t;n.fn.carousel.noConflict=function(){return n.fn.carousel=u,this};r=function(t){var u=n(this),f=u.attr("href"),s,r,o,e;f&&(f=f.replace(/.*(?=#[^\s]+$)/,""));s=u.attr("data-target")||f;r=n(document).find(s);r.hasClass("carousel")&&(o=n.extend({},r.data(),u.data()),e=u.attr("data-slide-to"),e&&(o.interval=!1),i.call(r,o),e&&r.data("bs.carousel").to(e),t.preventDefault())};n(document).on("click.bs.carousel.data-api","[data-slide]",r).on("click.bs.carousel.data-api","[data-slide-to]",r);n(window).on("load",function(){n('[data-ride="carousel"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery),function(n){"use strict";function r(t){var i,r=t.attr("data-target")||(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return n(document).find(r)}function i(i){return this.each(function(){var u=n(this),r=u.data("bs.collapse"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i);!r&&f.toggle&&/show|hide/.test(i)&&(f.toggle=!1);r||u.data("bs.collapse",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.$trigger=n('[data-toggle="collapse"][href="#'+i.id+'"],[data-toggle="collapse"][data-target="#'+i.id+'"]');this.transitioning=null;this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger);this.options.toggle&&this.toggle()},u;t.VERSION="3.4.1";t.TRANSITION_DURATION=350;t.DEFAULTS={toggle:!0};t.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"};t.prototype.show=function(){var f,r,e,u,o,s;if(!this.transitioning&&!this.$element.hasClass("in")&&(r=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing"),!(r&&r.length&&(f=r.data("bs.collapse"))&&f.transitioning)&&(e=n.Event("show.bs.collapse"),this.$element.trigger(e),!e.isDefaultPrevented()))){if(r&&r.length&&(i.call(r,"hide"),f||r.data("bs.collapse",null)),u=this.dimension(),this.$element.removeClass("collapse").addClass("collapsing")[u](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1,o=function(){this.$element.removeClass("collapsing").addClass("collapse in")[u]("");this.transitioning=0;this.$element.trigger("shown.bs.collapse")},!n.support.transition)return o.call(this);s=n.camelCase(["scroll",u].join("-"));this.$element.one("bsTransitionEnd",n.proxy(o,this)).emulateTransitionEnd(t.TRANSITION_DURATION)[u](this.$element[0][s])}};t.prototype.hide=function(){var r,i,u;if(!this.transitioning&&this.$element.hasClass("in")&&(r=n.Event("hide.bs.collapse"),this.$element.trigger(r),!r.isDefaultPrevented())){if(i=this.dimension(),this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1,u=function(){this.transitioning=0;this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")},!n.support.transition)return u.call(this);this.$element[i](0).one("bsTransitionEnd",n.proxy(u,this)).emulateTransitionEnd(t.TRANSITION_DURATION)}};t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};t.prototype.getParent=function(){return n(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(n.proxy(function(t,i){var u=n(i);this.addAriaAndCollapsedClass(r(u),u)},this)).end()};t.prototype.addAriaAndCollapsedClass=function(n,t){var i=n.hasClass("in");n.attr("aria-expanded",i);t.toggleClass("collapsed",!i).attr("aria-expanded",i)};u=n.fn.collapse;n.fn.collapse=i;n.fn.collapse.Constructor=t;n.fn.collapse.noConflict=function(){return n.fn.collapse=u,this};n(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var u=n(this),f,e;u.attr("data-target")||t.preventDefault();f=r(u);e=f.data("bs.collapse")?"toggle":u.data();i.call(f,e)})}(jQuery),function(n){"use strict";function r(t){var i=t.attr("data-target"),r;return i||(i=(i=t.attr("href"))&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,"")),r="#"!==i?n(document).find(i):null,r&&r.length?r:t.parent()}function u(t){t&&3===t.which||(n(".dropdown-backdrop").remove(),n(i).each(function(){var u=n(this),i=r(u),f={relatedTarget:this};i.hasClass("open")&&(t&&"click"==t.type&&/input|textarea/i.test(t.target.tagName)&&n.contains(i[0],t.target)||(i.trigger(t=n.Event("hide.bs.dropdown",f)),t.isDefaultPrevented()||(u.attr("aria-expanded","false"),i.removeClass("open").trigger(n.Event("hidden.bs.dropdown",f)))))}))}var i='[data-toggle="dropdown"]',t=function(t){n(t).on("click.bs.dropdown",this.toggle)},f;t.VERSION="3.4.1";t.prototype.toggle=function(t){var f=n(this),i,o,e;if(!f.is(".disabled, :disabled")){if(i=r(f),o=i.hasClass("open"),u(),!o){if("ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&n(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(n(this)).on("click",u),e={relatedTarget:this},i.trigger(t=n.Event("show.bs.dropdown",e)),t.isDefaultPrevented())return;f.trigger("focus").attr("aria-expanded","true");i.toggleClass("open").trigger(n.Event("shown.bs.dropdown",e))}return!1}};t.prototype.keydown=function(t){var e,o,s,f,u;if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)&&(e=n(this),t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled"))){if(o=r(e),s=o.hasClass("open"),!s&&27!=t.which||s&&27==t.which)return 27==t.which&&o.find(i).trigger("focus"),e.trigger("click");f=o.find(".dropdown-menu li:not(.disabled):visible a");f.length&&(u=f.index(t.target),38==t.which&&0<u&&u--,40==t.which&&u<f.length-1&&u++,~u||(u=0),f.eq(u).trigger("focus"))}};f=n.fn.dropdown;n.fn.dropdown=function(i){return this.each(function(){var r=n(this),u=r.data("bs.dropdown");u||r.data("bs.dropdown",u=new t(this));"string"==typeof i&&u[i].call(r)})};n.fn.dropdown.Constructor=t;n.fn.dropdown.noConflict=function(){return n.fn.dropdown=f,this};n(document).on("click.bs.dropdown.data-api",u).on("click.bs.dropdown.data-api",".dropdown form",function(n){n.stopPropagation()}).on("click.bs.dropdown.data-api",i,t.prototype.toggle).on("keydown.bs.dropdown.data-api",i,t.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",t.prototype.keydown)}(jQuery),function(n){"use strict";function i(i,r){return this.each(function(){var f=n(this),u=f.data("bs.modal"),e=n.extend({},t.DEFAULTS,f.data(),"object"==typeof i&&i);u||f.data("bs.modal",u=new t(this,e));"string"==typeof i?u[i](r):e.show&&u.show(r)})}var t=function(t,i){this.options=i;this.$body=n(document.body);this.$element=n(t);this.$dialog=this.$element.find(".modal-dialog");this.$backdrop=null;this.isShown=null;this.originalBodyPad=null;this.scrollbarWidth=0;this.ignoreBackdropClick=!1;this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom";this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,n.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))},r;t.VERSION="3.4.1";t.TRANSITION_DURATION=300;t.BACKDROP_TRANSITION_DURATION=150;t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0};t.prototype.toggle=function(n){return this.isShown?this.hide():this.show(n)};t.prototype.show=function(i){var r=this,u=n.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(u);this.isShown||u.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',n.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){r.$element.one("mouseup.dismiss.bs.modal",function(t){n(t.target).is(r.$element)&&(r.ignoreBackdropClick=!0)})}),this.backdrop(function(){var f=n.support.transition&&r.$element.hasClass("fade"),u;r.$element.parent().length||r.$element.appendTo(r.$body);r.$element.show().scrollTop(0);r.adjustDialog();f&&r.$element[0].offsetWidth;r.$element.addClass("in");r.enforceFocus();u=n.Event("shown.bs.modal",{relatedTarget:i});f?r.$dialog.one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(u)}).emulateTransitionEnd(t.TRANSITION_DURATION):r.$element.trigger("focus").trigger(u)}))};t.prototype.hide=function(i){i&&i.preventDefault();i=n.Event("hide.bs.modal");this.$element.trigger(i);this.isShown&&!i.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),n(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),n.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",n.proxy(this.hideModal,this)).emulateTransitionEnd(t.TRANSITION_DURATION):this.hideModal())};t.prototype.enforceFocus=function(){n(document).off("focusin.bs.modal").on("focusin.bs.modal",n.proxy(function(n){document===n.target||this.$element[0]===n.target||this.$element.has(n.target).length||this.$element.trigger("focus")},this))};t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",n.proxy(function(n){27==n.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")};t.prototype.resize=function(){this.isShown?n(window).on("resize.bs.modal",n.proxy(this.handleUpdate,this)):n(window).off("resize.bs.modal")};t.prototype.hideModal=function(){var n=this;this.$element.hide();this.backdrop(function(){n.$body.removeClass("modal-open");n.resetAdjustments();n.resetScrollbar();n.$element.trigger("hidden.bs.modal")})};t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null};t.prototype.backdrop=function(i){var e=this,f=this.$element.hasClass("fade")?"fade":"",r,u;if(this.isShown&&this.options.backdrop){if(r=n.support.transition&&f,this.$backdrop=n(document.createElement("div")).addClass("modal-backdrop "+f).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",n.proxy(function(n){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:n.target===n.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!i)return;r?this.$backdrop.one("bsTransitionEnd",i).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):i()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),u=function(){e.removeBackdrop();i&&i()},n.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",u).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):u()):i&&i()};t.prototype.handleUpdate=function(){this.adjustDialog()};t.prototype.adjustDialog=function(){var n=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&n?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!n?this.scrollbarWidth:""})};t.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})};t.prototype.checkScrollbar=function(){var n=window.innerWidth,t;n||(t=document.documentElement.getBoundingClientRect(),n=t.right-Math.abs(t.left));this.bodyIsOverflowing=document.body.clientWidth<n;this.scrollbarWidth=this.measureScrollbar()};t.prototype.setScrollbar=function(){var i=parseInt(this.$body.css("padding-right")||0,10),t;this.originalBodyPad=document.body.style.paddingRight||"";t=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",i+t),n(this.fixedContent).each(function(i,r){var u=r.style.paddingRight,f=n(r).css("padding-right");n(r).data("padding-right",u).css("padding-right",parseFloat(f)+t+"px")}))};t.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad);n(this.fixedContent).each(function(t,i){var r=n(i).data("padding-right");n(i).removeData("padding-right");i.style.paddingRight=r||""})};t.prototype.measureScrollbar=function(){var n=document.createElement("div"),t;return n.className="modal-scrollbar-measure",this.$body.append(n),t=n.offsetWidth-n.clientWidth,this.$body[0].removeChild(n),t};r=n.fn.modal;n.fn.modal=i;n.fn.modal.Constructor=t;n.fn.modal.noConflict=function(){return n.fn.modal=r,this};n(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=n(this),f=r.attr("href"),e=r.attr("data-target")||f&&f.replace(/.*(?=#[^\s]+$)/,""),u=n(document).find(e),o=u.data("bs.modal")?"toggle":n.extend({remote:!/#/.test(f)&&f},u.data(),r.data());r.is("a")&&t.preventDefault();u.one("show.bs.modal",function(n){n.isDefaultPrevented()||u.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})});i.call(u,o,this)})}(jQuery),function(n){"use strict";function s(t,i){var r=t.nodeName.toLowerCase();if(-1!==n.inArray(r,i))return-1===n.inArray(r,f)||Boolean(t.nodeValue.match(e)||t.nodeValue.match(o));for(var s=n(i).filter(function(n,t){return t instanceof RegExp}),u=0,h=s.length;u<h;u++)if(r.match(s[u]))return!0;return!1}function i(t,i,r){var f,u,h;if(0===t.length)return t;if(r&&"function"==typeof r)return r(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;f=document.implementation.createHTMLDocument("sanitization");f.body.innerHTML=t;for(var a=n.map(i,function(n,t){return t}),l=n(f.body).find("*"),o=0,v=l.length;o<v;o++)if(u=l[o],h=u.nodeName.toLowerCase(),-1!==n.inArray(h,a))for(var c=n.map(u.attributes,function(n){return n}),y=[].concat(i["*"]||[],i[h]||[]),e=0,p=c.length;e<p;e++)s(c[e],y)||u.removeAttribute(c[e].nodeName);else u.parentNode.removeChild(u);return f.body.innerHTML}var u=["sanitize","whiteList","sanitizeFn"],f=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],e=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i,t=function(n,t){this.type=null;this.options=null;this.enabled=null;this.timeout=null;this.hoverState=null;this.$element=null;this.inState=null;this.init("tooltip",n,t)},r;t.VERSION="3.4.1";t.TRANSITION_DURATION=150;t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"><\/div><div class="tooltip-inner"><\/div><\/div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]}};t.prototype.init=function(t,i,r){var f,e,u,o,s;if(this.enabled=!0,this.type=t,this.$element=n(i),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&n(document).find(n.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(f=this.options.trigger.split(" "),e=f.length;e--;)if(u=f[e],"click"==u)this.$element.on("click."+this.type,this.options.selector,n.proxy(this.toggle,this));else"manual"!=u&&(o="hover"==u?"mouseenter":"focusin",s="hover"==u?"mouseleave":"focusout",this.$element.on(o+"."+this.type,this.options.selector,n.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,n.proxy(this.leave,this)));this.options.selector?this._options=n.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()};t.prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.getOptions=function(t){var r=this.$element.data(),f;for(f in r)r.hasOwnProperty(f)&&-1!==n.inArray(f,u)&&delete r[f];return(t=n.extend({},this.getDefaults(),r,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=i(t.template,t.whiteList,t.sanitizeFn)),t};t.prototype.getDelegateOptions=function(){var t={},i=this.getDefaults();return this._options&&n.each(this._options,function(n,r){i[n]!=r&&(t[n]=r)}),t};t.prototype.enter=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);if(i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),t instanceof n.Event&&(i.inState["focusin"==t.type?"focus":"hover"]=!0),i.tip().hasClass("in")||"in"==i.hoverState)i.hoverState="in";else{if(clearTimeout(i.timeout),i.hoverState="in",!i.options.delay||!i.options.delay.show)return i.show();i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)}};t.prototype.isInStateTrue=function(){for(var n in this.inState)if(this.inState[n])return!0;return!1};t.prototype.leave=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);if(i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),t instanceof n.Event&&(i.inState["focusout"==t.type?"focus":"hover"]=!1),!i.isInStateTrue()){if(clearTimeout(i.timeout),i.hoverState="out",!i.options.delay||!i.options.delay.hide)return i.hide();i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)}};t.prototype.show=function(){var c=n.Event("show.bs."+this.type),l,p,e,w,h;if(this.hasContent()&&this.enabled){if(this.$element.trigger(c),l=n.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]),c.isDefaultPrevented()||!l)return;var u=this,r=this.tip(),a=this.getUID(this.type);this.setContent();r.attr("id",a);this.$element.attr("aria-describedby",a);this.options.animation&&r.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement,v=/\s?auto?\s?/i,y=v.test(i);y&&(i=i.replace(v,"")||"top");r.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this);this.options.container?r.appendTo(n(document).find(this.options.container)):r.insertAfter(this.$element);this.$element.trigger("inserted.bs."+this.type);var f=this.getPosition(),o=r[0].offsetWidth,s=r[0].offsetHeight;y&&(p=i,e=this.getPosition(this.$viewport),i="bottom"==i&&f.bottom+s>e.bottom?"top":"top"==i&&f.top-s<e.top?"bottom":"right"==i&&f.right+o>e.width?"left":"left"==i&&f.left-o<e.left?"right":i,r.removeClass(p).addClass(i));w=this.getCalculatedOffset(i,f,o,s);this.applyPlacement(w,i);h=function(){var n=u.hoverState;u.$element.trigger("shown.bs."+u.type);u.hoverState=null;"out"==n&&u.leave(u)};n.support.transition&&this.$tip.hasClass("fade")?r.one("bsTransitionEnd",h).emulateTransitionEnd(t.TRANSITION_DURATION):h()}};t.prototype.applyPlacement=function(t,i){var r=this.tip(),l=r[0].offsetWidth,e=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),s=parseInt(r.css("margin-left"),10),h,f,u;isNaN(o)&&(o=0);isNaN(s)&&(s=0);t.top+=o;t.left+=s;n.offset.setOffset(r[0],n.extend({using:function(n){r.css({top:Math.round(n.top),left:Math.round(n.left)})}},t),0);r.addClass("in");h=r[0].offsetWidth;f=r[0].offsetHeight;"top"==i&&f!=e&&(t.top=t.top+e-f);u=this.getViewportAdjustedDelta(i,t,h,f);u.left?t.left+=u.left:t.top+=u.top;var c=/top|bottom/.test(i),a=c?2*u.left-l+h:2*u.top-e+f,v=c?"offsetWidth":"offsetHeight";r.offset(t);this.replaceArrow(a,r[0][v],c)};t.prototype.replaceArrow=function(n,t,i){this.arrow().css(i?"left":"top",50*(1-n/t)+"%").css(i?"top":"left","")};t.prototype.setContent=function(){var t=this.tip(),n=this.getTitle();this.options.html?(this.options.sanitize&&(n=i(n,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(n)):t.find(".tooltip-inner").text(n);t.removeClass("fade in top bottom left right")};t.prototype.hide=function(i){function e(){"in"!=r.hoverState&&u.detach();r.$element&&r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type);i&&i()}var r=this,u=n(this.$tip),f=n.Event("hide.bs."+this.type);if(this.$element.trigger(f),!f.isDefaultPrevented())return u.removeClass("in"),n.support.transition&&u.hasClass("fade")?u.one("bsTransitionEnd",e).emulateTransitionEnd(t.TRANSITION_DURATION):e(),this.hoverState=null,this};t.prototype.fixTitle=function(){var n=this.$element;(n.attr("title")||"string"!=typeof n.attr("data-original-title"))&&n.attr("data-original-title",n.attr("title")||"").attr("title","")};t.prototype.hasContent=function(){return this.getTitle()};t.prototype.getPosition=function(t){var r=(t=t||this.$element)[0],u="BODY"==r.tagName,i=r.getBoundingClientRect();null==i.width&&(i=n.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var f=window.SVGElement&&r instanceof window.SVGElement,e=u?{top:0,left:0}:f?null:t.offset(),o={scroll:u?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},s=u?{width:n(window).width(),height:n(window).height()}:null;return n.extend({},i,o,s,e)};t.prototype.getCalculatedOffset=function(n,t,i,r){return"bottom"==n?{top:t.top+t.height,left:t.left+t.width/2-i/2}:"top"==n?{top:t.top-r,left:t.left+t.width/2-i/2}:"left"==n?{top:t.top+t.height/2-r/2,left:t.left-i}:{top:t.top+t.height/2-r/2,left:t.left+t.width}};t.prototype.getViewportAdjustedDelta=function(n,t,i,r){var f={top:0,left:0},e,u,o,s,h,c;return this.$viewport?(e=this.options.viewport&&this.options.viewport.padding||0,u=this.getPosition(this.$viewport),/right|left/.test(n)?(o=t.top-e-u.scroll,s=t.top+e-u.scroll+r,o<u.top?f.top=u.top-o:s>u.top+u.height&&(f.top=u.top+u.height-s)):(h=t.left-e,c=t.left+e+i,h<u.left?f.left=u.left-h:c>u.right&&(f.left=u.left+u.width-c)),f):f};t.prototype.getTitle=function(){var t=this.$element,n=this.options;return t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)};t.prototype.getUID=function(n){for(;n+=~~(1e6*Math.random()),document.getElementById(n););return n};t.prototype.tip=function(){if(!this.$tip&&(this.$tip=n(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")};t.prototype.enable=function(){this.enabled=!0};t.prototype.disable=function(){this.enabled=!1};t.prototype.toggleEnabled=function(){this.enabled=!this.enabled};t.prototype.toggle=function(t){var i=this;t&&((i=n(t.currentTarget).data("bs."+this.type))||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)));t?(i.inState.click=!i.inState.click,i.isInStateTrue()?i.enter(i):i.leave(i)):i.tip().hasClass("in")?i.leave(i):i.enter(i)};t.prototype.destroy=function(){var n=this;clearTimeout(this.timeout);this.hide(function(){n.$element.off("."+n.type).removeData("bs."+n.type);n.$tip&&n.$tip.detach();n.$tip=null;n.$arrow=null;n.$viewport=null;n.$element=null})};t.prototype.sanitizeHtml=function(n){return i(n,this.options.whiteList,this.options.sanitizeFn)};r=n.fn.tooltip;n.fn.tooltip=function(i){return this.each(function(){var u=n(this),r=u.data("bs.tooltip"),f="object"==typeof i&&i;!r&&/destroy|hide/.test(i)||(r||u.data("bs.tooltip",r=new t(this,f)),"string"==typeof i&&r[i]())})};n.fn.tooltip.Constructor=t;n.fn.tooltip.noConflict=function(){return n.fn.tooltip=r,this}}(jQuery),function(n){"use strict";var t=function(n,t){this.init("popover",n,t)},i;if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");t.VERSION="3.4.1";t.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"><\/div><h3 class="popover-title"><\/h3><div class="popover-content"><\/div><\/div>'});((t.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=t).prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.setContent=function(){var n=this.tip(),i=this.getTitle(),t=this.getContent(),r;this.options.html?(r=typeof t,this.options.sanitize&&(i=this.sanitizeHtml(i),"string"===r&&(t=this.sanitizeHtml(t))),n.find(".popover-title").html(i),n.find(".popover-content").children().detach().end()["string"===r?"html":"append"](t)):(n.find(".popover-title").text(i),n.find(".popover-content").children().detach().end().text(t));n.removeClass("fade top bottom left right in");n.find(".popover-title").html()||n.find(".popover-title").hide()};t.prototype.hasContent=function(){return this.getTitle()||this.getContent()};t.prototype.getContent=function(){var t=this.$element,n=this.options;return t.attr("data-content")||("function"==typeof n.content?n.content.call(t[0]):n.content)};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};i=n.fn.popover;n.fn.popover=function(i){return this.each(function(){var u=n(this),r=u.data("bs.popover"),f="object"==typeof i&&i;!r&&/destroy|hide/.test(i)||(r||u.data("bs.popover",r=new t(this,f)),"string"==typeof i&&r[i]())})};n.fn.popover.Constructor=t;n.fn.popover.noConflict=function(){return n.fn.popover=i,this}}(jQuery),function(n){"use strict";function t(i,r){this.$body=n(document.body);this.$scrollElement=n(i).is(document.body)?n(window):n(i);this.options=n.extend({},t.DEFAULTS,r);this.selector=(this.options.target||"")+" .nav li > a";this.offsets=[];this.targets=[];this.activeTarget=null;this.scrollHeight=0;this.$scrollElement.on("scroll.bs.scrollspy",n.proxy(this.process,this));this.refresh();this.process()}function i(i){return this.each(function(){var u=n(this),r=u.data("bs.scrollspy"),f="object"==typeof i&&i;r||u.data("bs.scrollspy",r=new t(this,f));"string"==typeof i&&r[i]()})}t.VERSION="3.4.1";t.DEFAULTS={offset:10};t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)};t.prototype.refresh=function(){var t=this,i="offset",r=0;this.offsets=[];this.targets=[];this.scrollHeight=this.getScrollHeight();n.isWindow(this.$scrollElement[0])||(i="position",r=this.$scrollElement.scrollTop());this.$body.find(this.selector).map(function(){var f=n(this),u=f.data("target")||f.attr("href"),t=/^#./.test(u)&&n(u);return t&&t.length&&t.is(":visible")&&[[t[i]().top+r,u]]||null}).sort(function(n,t){return n[0]-t[0]}).each(function(){t.offsets.push(this[0]);t.targets.push(this[1])})};t.prototype.process=function(){var n,i=this.$scrollElement.scrollTop()+this.options.offset,f=this.getScrollHeight(),e=this.options.offset+f-this.$scrollElement.height(),t=this.offsets,r=this.targets,u=this.activeTarget;if(this.scrollHeight!=f&&this.refresh(),e<=i)return u!=(n=r[r.length-1])&&this.activate(n);if(u&&i<t[0])return this.activeTarget=null,this.clear();for(n=t.length;n--;)u!=r[n]&&i>=t[n]&&(t[n+1]===undefined||i<t[n+1])&&this.activate(r[n])};t.prototype.activate=function(t){this.activeTarget=t;this.clear();var r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=n(r).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active"));i.trigger("activate.bs.scrollspy")};t.prototype.clear=function(){n(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var r=n.fn.scrollspy;n.fn.scrollspy=i;n.fn.scrollspy.Constructor=t;n.fn.scrollspy.noConflict=function(){return n.fn.scrollspy=r,this};n(window).on("load.bs.scrollspy.data-api",function(){n('[data-spy="scroll"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery),function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.tab");r||u.data("bs.tab",r=new t(this));"string"==typeof i&&r[i]()})}var t=function(t){this.element=n(t)},u,i;t.VERSION="3.4.1";t.TRANSITION_DURATION=150;t.prototype.show=function(){var t=this.element,f=t.closest("ul:not(.dropdown-menu)"),i=t.data("target"),u;if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var r=f.find(".active:last a"),e=n.Event("hide.bs.tab",{relatedTarget:t[0]}),o=n.Event("show.bs.tab",{relatedTarget:r[0]});(r.trigger(e),t.trigger(o),o.isDefaultPrevented()||e.isDefaultPrevented())||(u=n(document).find(i),this.activate(t.closest("li"),f),this.activate(u,u.parent(),function(){r.trigger({type:"hidden.bs.tab",relatedTarget:t[0]});t.trigger({type:"shown.bs.tab",relatedTarget:r[0]})}))}};t.prototype.activate=function(i,r,u){function o(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1);i.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0);e?(i[0].offsetWidth,i.addClass("in")):i.removeClass("fade");i.parent(".dropdown-menu").length&&i.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0);u&&u()}var f=r.find("> .active"),e=u&&n.support.transition&&(f.length&&f.hasClass("fade")||!!r.find("> .fade").length);f.length&&e?f.one("bsTransitionEnd",o).emulateTransitionEnd(t.TRANSITION_DURATION):o();f.removeClass("in")};u=n.fn.tab;n.fn.tab=r;n.fn.tab.Constructor=t;n.fn.tab.noConflict=function(){return n.fn.tab=u,this};i=function(t){t.preventDefault();r.call(n(this),"show")};n(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.affix"),f="object"==typeof i&&i;r||u.data("bs.affix",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.options=n.extend({},t.DEFAULTS,r);var u=this.options.target===t.DEFAULTS.target?n(this.options.target):n(document).find(this.options.target);this.$target=u.on("scroll.bs.affix.data-api",n.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",n.proxy(this.checkPositionWithEventLoop,this));this.$element=n(i);this.affixed=null;this.unpin=null;this.pinnedOffset=null;this.checkPosition()},r;t.VERSION="3.4.1";t.RESET="affix affix-top affix-bottom";t.DEFAULTS={offset:0,target:window};t.prototype.getState=function(n,t,i,r){var u=this.$target.scrollTop(),e=this.$element.offset(),o=this.$target.height(),f,s;return null!=i&&"top"==this.affixed?u<i&&"top":"bottom"==this.affixed?null!=i?!(u+this.unpin<=e.top)&&"bottom":!(u+o<=n-r)&&"bottom":(f=null==this.affixed,s=f?u:e.top,null!=i&&u<=i?"top":null!=r&&n-r<=s+(f?o:t)&&"bottom")};t.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(t.RESET).addClass("affix");var n=this.$target.scrollTop(),i=this.$element.offset();return this.pinnedOffset=i.top-n};t.prototype.checkPositionWithEventLoop=function(){setTimeout(n.proxy(this.checkPosition,this),1)};t.prototype.checkPosition=function(){var i,e,o;if(this.$element.is(":visible")){var s=this.$element.height(),r=this.options.offset,f=r.top,u=r.bottom,h=Math.max(n(document).height(),n(document.body).height());if("object"!=typeof r&&(u=f=r),"function"==typeof f&&(f=r.top(this.$element)),"function"==typeof u&&(u=r.bottom(this.$element)),i=this.getState(h,s,f,u),this.affixed!=i){if(null!=this.unpin&&this.$element.css("top",""),e="affix"+(i?"-"+i:""),o=n.Event(e+".bs.affix"),this.$element.trigger(o),o.isDefaultPrevented())return;this.affixed=i;this.unpin="bottom"==i?this.getPinnedOffset():null;this.$element.removeClass(t.RESET).addClass(e).trigger(e.replace("affix","affixed")+".bs.affix")}"bottom"==i&&this.$element.offset({top:h-s-u})}};r=n.fn.affix;n.fn.affix=i;n.fn.affix.Constructor=t;n.fn.affix.noConflict=function(){return n.fn.affix=r,this};n(window).on("load",function(){n('[data-spy="affix"]').each(function(){var r=n(this),t=r.data();t.offset=t.offset||{};null!=t.offsetBottom&&(t.offset.bottom=t.offsetBottom);null!=t.offsetTop&&(t.offset.top=t.offsetTop);i.call(r,t)})})}(jQuery);window.matchMedia=window.matchMedia||function(n){var u,i=n.documentElement,f=i.firstElementChild||i.firstChild,r=n.createElement("body"),t=n.createElement("div");return t.id="mq-test-1",t.style.cssText="position:absolute;top:-100em",r.style.background="none",r.appendChild(t),function(n){return t.innerHTML='&shy;<style media="'+n+'"> #mq-test-1 { width: 42px; }<\/style>',i.insertBefore(r,f),u=t.offsetWidth==42,i.removeChild(r),{matches:u,media:n}}}(document),function(n){function d(){a(!0)}if(n.respond={},respond.update=function(){},respond.mediaQueriesSupported=n.matchMedia&&n.matchMedia("only all").matches,!respond.mediaQueriesSupported){var t=n.document,i=t.documentElement,e=[],u=[],r=[],o={},v=30,f=t.getElementsByTagName("head")[0]||i,g=t.getElementsByTagName("base")[0],s=f.getElementsByTagName("link"),h=[],y=function(){for(var f=s,c=f.length,r=0,t,i,u,e;r<c;r++)t=f[r],i=t.href,u=t.media,e=t.rel&&t.rel.toLowerCase()==="stylesheet",!i||!e||o[i]||(t.styleSheet&&t.styleSheet.rawCssText?(w(t.styleSheet.rawCssText,i,u),o[i]=!0):(/^([a-zA-Z:]*\/\/)/.test(i)||g)&&i.replace(RegExp.$1,"").split("/")[0]!==n.location.host||h.push({href:i,media:u}));p()},p=function(){if(h.length){var n=h.shift();nt(n.href,function(t){w(t,n.href,n.media);o[n.href]=!0;p()})}},w=function(n,t,i){var o=n.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),s=o&&o.length||0,t=t.substring(0,t.lastIndexOf("/")),v=function(n){return n.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+t+"$2$3")},y=!s&&i,h=0,f,c,r,l,p;for(t.length&&(t+="/"),y&&(s=1);h<s;h++)for(f=0,y?(c=i,u.push(v(n))):(c=o[h].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,u.push(RegExp.$2&&v(RegExp.$2))),l=c.split(","),p=l.length;f<p;f++)r=l[f],e.push({media:r.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:u.length-1,hasquery:r.indexOf("(")>-1,minw:r.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:r.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")});a()},c,b,k=function(){var u,r=t.createElement("div"),n=t.body,f=!1;return r.style.cssText="position:absolute;font-size:1em;width:1em",n||(n=f=t.createElement("body"),n.style.background="none"),n.appendChild(r),i.insertBefore(n,i.firstChild),u=r.offsetWidth,f?i.removeChild(n):n.removeChild(r),l=parseFloat(u)},l,a=function(n){var nt="clientWidth",tt=i[nt],it=t.compatMode==="CSS1Compat"&&tt||t.body[nt]||tt,d={},ot=s[s.length-1],rt=(new Date).getTime(),o,h,g;if(n&&c&&rt-c<v){clearTimeout(b);b=setTimeout(a,v);return}c=rt;for(o in e){var y=e[o],p=y.minw,w=y.maxw,ut=p===null,ft=w===null,et="em";!p||(p=parseFloat(p)*(p.indexOf(et)>-1?l||k():1));!w||(w=parseFloat(w)*(w.indexOf(et)>-1?l||k():1));y.hasquery&&(ut&&ft||!(ut||it>=p)||!(ft||it<=w))||(d[y.media]||(d[y.media]=[]),d[y.media].push(u[y.rules]))}for(o in r)r[o]&&r[o].parentNode===f&&f.removeChild(r[o]);for(o in d)h=t.createElement("style"),g=d[o].join("\n"),h.type="text/css",h.media=o,f.insertBefore(h,ot.nextSibling),h.styleSheet?h.styleSheet.cssText=g:h.appendChild(t.createTextNode(g)),r.push(h)},nt=function(n,t){var i=tt();i&&(i.open("GET",n,!0),i.onreadystatechange=function(){i.readyState==4&&(i.status==200||i.status==304)&&t(i.responseText)},i.readyState!=4)&&i.send(null)},tt=function(){var n=!1;try{n=new XMLHttpRequest}catch(t){n=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return n}}();y();respond.update=y;n.addEventListener?n.addEventListener("resize",d,!1):n.attachEvent&&n.attachEvent("onresize",d)}}(this),function(n){typeof define=="function"&&define.amd?define("jquery-typeahead",["jquery"],function(t){return n(t)}):typeof module=="object"&&module.exports?module.exports=function(t,i){return t===undefined&&(t=typeof window!="undefined"?require("jquery"):require("jquery")(i)),n(t)}():n(jQuery)}(function(n){"use strict";var u,t;window.Typeahead={version:"2.8.0"};var f={input:null,minLength:2,maxLength:!1,maxItem:8,dynamic:!1,delay:300,order:null,offset:!1,hint:!1,accent:!1,highlight:!0,group:!1,groupOrder:null,maxItemPerGroup:null,dropdownFilter:!1,dynamicFilter:null,backdrop:!1,backdropOnFocus:!1,cache:!1,ttl:36e5,compression:!1,searchOnFocus:!1,blurOnTab:!0,resultContainer:null,generateOnLoad:null,mustSelectItem:!1,href:null,display:["display"],template:null,templateValue:null,groupTemplate:null,correlativeTemplate:!1,emptyTemplate:!1,cancelButton:!0,loadingAnimation:!0,filter:!0,matcher:null,source:null,callback:{onInit:null,onReady:null,onShowLayout:null,onHideLayout:null,onSearch:null,onResult:null,onLayoutBuiltBefore:null,onLayoutBuiltAfter:null,onNavigateBefore:null,onNavigateAfter:null,onMouseEnter:null,onMouseLeave:null,onClickBefore:null,onClickAfter:null,onDropdownFilter:null,onSendRequest:null,onReceiveRequest:null,onPopulateSource:null,onCacheSave:null,onSubmit:null,onCancel:null},selector:{container:"typeahead__container",result:"typeahead__result",list:"typeahead__list",group:"typeahead__group",item:"typeahead__item",empty:"typeahead__empty",display:"typeahead__display",query:"typeahead__query",filter:"typeahead__filter",filterButton:"typeahead__filter-button",dropdown:"typeahead__dropdown",dropdownItem:"typeahead__dropdown-item",button:"typeahead__button",backdrop:"typeahead__backdrop",hint:"typeahead__hint",cancelButton:"typeahead__cancel-button"},debug:!1},e=".typeahead",r={from:"ãàáäâẽèéëêìíïîõòóöôùúüûñç",to:"aaaaaeeeeeiiiiooooouuuunc"},o=~window.navigator.appVersion.indexOf("MSIE 9."),s=~window.navigator.appVersion.indexOf("MSIE 10"),h=~window.navigator.userAgent.indexOf("Trident")&&~window.navigator.userAgent.indexOf("rv:11"),i=function(n,t){this.rawQuery=n.val()||"";this.query=n.val()||"";this.selector=n[0].selector;this.deferred=null;this.tmpSource={};this.source={};this.dynamicGroups=[];this.hasDynamicGroups=!1;this.generatedGroupCount=0;this.groupBy="group";this.groups=[];this.searchGroups=[];this.generateGroups=[];this.requestGroups=[];this.result={};this.groupTemplate="";this.resultHtml=null;this.resultCount=0;this.resultCountPerGroup={};this.options=t;this.node=n;this.namespace="."+this.helper.slugify.call(this,this.selector)+e;this.container=null;this.resultContainer=null;this.item=null;this.xhr={};this.hintIndex=null;this.filters={dropdown:{},dynamic:{}};this.dropdownFilter={"static":[],dynamic:[]};this.dropdownFilterAll=null;this.isDropdownEvent=!1;this.requests={};this.backdrop={};this.hint={};this.hasDragged=!1;this.focusOnly=!1;this.__construct()};return i.prototype={_validateCacheMethod:function(n){var i;if(n===!0)n="localStorage";else if(typeof n=="string"&&!~["localStorage","sessionStorage"].indexOf(n))return this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:'Invalid options.cache, possible options are "localStorage" or "sessionStorage"'}),t.print()),!1;i=typeof window[n]!="undefined";try{window[n].setItem("typeahead","typeahead");window[n].removeItem("typeahead")}catch(r){i=!1}return i&&n||!1},extendOptions:function(){if(this.options.cache=this._validateCacheMethod(this.options.cache),this.options.compression&&(typeof LZString=="object"&&this.options.cache||(this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:"Missing LZString Library or options.cache, no compression will occur."}),t.print()),this.options.compression=!1)),(!this.options.maxLength||isNaN(this.options.maxLength))&&(this.options.maxLength=Infinity),typeof this.options.maxItem!="undefined"&&~[0,!1].indexOf(this.options.maxItem)&&(this.options.maxItem=Infinity),this.options.maxItemPerGroup&&!/^\d+$/.test(this.options.maxItemPerGroup)&&(this.options.maxItemPerGroup=null),this.options.display&&!Array.isArray(this.options.display)&&(this.options.display=[this.options.display]),this.options.group&&(Array.isArray(this.options.group)?this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:"options.group must be a boolean|string|object as of 2.5.0"}),t.print()):(typeof this.options.group=="string"?this.options.group={key:this.options.group}:typeof this.options.group=="boolean"&&(this.options.group={key:"group"}),this.options.group.key=this.options.group.key||"group")),this.options.highlight&&!~["any",!0].indexOf(this.options.highlight)&&(this.options.highlight=!1),this.options.dropdownFilter&&this.options.dropdownFilter instanceof Object){Array.isArray(this.options.dropdownFilter)||(this.options.dropdownFilter=[this.options.dropdownFilter]);for(var i=0,u=this.options.dropdownFilter.length;i<u;++i)this.dropdownFilter[this.options.dropdownFilter[i].value?"static":"dynamic"].push(this.options.dropdownFilter[i])}this.options.dynamicFilter&&!Array.isArray(this.options.dynamicFilter)&&(this.options.dynamicFilter=[this.options.dynamicFilter]);this.options.accent&&(typeof this.options.accent=="object"?this.options.accent.from&&this.options.accent.to&&this.options.accent.from.length===this.options.accent.to.length||this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:'Invalid "options.accent", from and to must be defined and same length.'}),t.print()):this.options.accent=r);this.options.groupTemplate&&(this.groupTemplate=this.options.groupTemplate);this.options.resultContainer&&(typeof this.options.resultContainer=="string"&&(this.options.resultContainer=n(this.options.resultContainer)),this.options.resultContainer instanceof n&&this.options.resultContainer[0]?this.resultContainer=this.options.resultContainer:this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:'Invalid jQuery selector or jQuery Object for "options.resultContainer".'}),t.print()));this.options.maxItemPerGroup&&this.options.group&&this.options.group.key&&(this.groupBy=this.options.group.key);this.options.callback&&this.options.callback.onClick&&(this.options.callback.onClickBefore=this.options.callback.onClick,delete this.options.callback.onClick);this.options.callback&&this.options.callback.onNavigate&&(this.options.callback.onNavigateBefore=this.options.callback.onNavigate,delete this.options.callback.onNavigate);this.options=n.extend(!0,{},f,this.options)},unifySourceFormat:function(){this.dynamicGroups=[];Array.isArray(this.options.source)&&(this.options.source={group:{data:this.options.source}});typeof this.options.source=="string"&&(this.options.source={group:{ajax:{url:this.options.source}}});this.options.source.ajax&&(this.options.source={group:{ajax:this.options.source.ajax}});(this.options.source.url||this.options.source.data)&&(this.options.source={group:this.options.source});var i,n,r;for(i in this.options.source)if(this.options.source.hasOwnProperty(i)){if(n=this.options.source[i],typeof n=="string"&&(n={ajax:{url:n}}),r=n.url||n.ajax,Array.isArray(r)?(n.ajax=typeof r[0]=="string"?{url:r[0]}:r[0],n.ajax.path=n.ajax.path||r[1]||null,delete n.url):(typeof n.url=="object"?n.ajax=n.url:typeof n.url=="string"&&(n.ajax={url:n.url}),delete n.url),!n.data&&!n.ajax)return this.options.debug&&(t.log({node:this.selector,"function":"unifySourceFormat()",arguments:JSON.stringify(this.options.source),message:'Undefined "options.source.'+i+'.[data|ajax]" is Missing - Typeahead dropped'}),t.print()),!1;n.display&&!Array.isArray(n.display)&&(n.display=[n.display]);n.minLength=typeof n.minLength=="number"?n.minLength:this.options.minLength;n.maxLength=typeof n.maxLength=="number"?n.maxLength:this.options.maxLength;n.dynamic=typeof n.dynamic=="boolean"||this.options.dynamic;n.minLength>n.maxLength&&(n.minLength=n.maxLength);this.options.source[i]=n;this.options.source[i].dynamic&&this.dynamicGroups.push(i);n.cache=typeof n.cache!="undefined"?this._validateCacheMethod(n.cache):this.options.cache;n.compression&&(typeof LZString=="object"&&n.cache||(this.options.debug&&(t.log({node:this.selector,"function":"unifySourceFormat()",message:"Missing LZString Library or group.cache, no compression will occur on group: "+i}),t.print()),n.compression=!1))}return this.hasDynamicGroups=this.options.dynamic||!!this.dynamicGroups.length,!0},init:function(){this.helper.executeCallback.call(this,this.options.callback.onInit,[this.node]);this.container=this.node.closest("."+this.options.selector.container);this.options.debug&&(t.log({node:this.selector,"function":"init()",message:"OK - Typeahead activated on "+this.selector}),t.print())},delegateEvents:function(){var t=this,u=["focus"+this.namespace,"input"+this.namespace,"propertychange"+this.namespace,"keydown"+this.namespace,"keyup"+this.namespace,"search"+this.namespace,"generate"+this.namespace],i,r;n("html").on("touchmove",function(){t.hasDragged=!0}).on("touchstart",function(){t.hasDragged=!1});this.node.closest("form").on("submit",function(n){if(t.options.mustSelectItem&&t.helper.isEmpty(t.item)){n.preventDefault();return}return t.options.backdropOnFocus||t.hideLayout(),t.options.callback.onSubmit?t.helper.executeCallback.call(t,t.options.callback.onSubmit,[t.node,this,t.item,n]):void 0}).on("reset",function(){setTimeout(function(){t.node.trigger("input"+t.namespace);t.hideLayout()})});if(i=!1,this.node.attr("placeholder")&&(s||h)){r=!0;this.node.on("focusin focusout",function(){r=!!(!this.value&&this.placeholder)});this.node.on("input",function(n){r&&(n.stopImmediatePropagation(),r=!1)})}this.node.off(this.namespace).on(u.join(" "),function(r,u){switch(r.type){case"generate":t.generateSource(Object.keys(t.options.source));break;case"focus":if(t.focusOnly){t.focusOnly=!1;break}t.options.backdropOnFocus&&(t.buildBackdropLayout(),t.showLayout());t.options.searchOnFocus&&(t.deferred=n.Deferred(),t.generateSource());break;case"keydown":r.keyCode&&~[9,13,27,38,39,40].indexOf(r.keyCode)&&(i=!0,t.navigate(r));break;case"keyup":o&&t.node[0].value.replace(/^\s+/,"").toString().length<t.query.length&&t.node.trigger("input"+t.namespace);break;case"propertychange":if(i){i=!1;break}case"input":t.deferred=n.Deferred();t.rawQuery=t.node[0].value.toString();t.query=t.rawQuery.replace(/^\s+/,"");t.rawQuery===""&&t.query===""&&(r.originalEvent=u||{},t.helper.executeCallback.call(t,t.options.callback.onCancel,[t.node,r]));t.options.cancelButton&&t.toggleCancelButtonVisibility();t.options.hint&&t.hint.container&&t.hint.container.val()!==""&&t.hint.container.val().indexOf(t.rawQuery)!==0&&t.hint.container.val("");t.hasDynamicGroups?t.helper.typeWatch(function(){t.generateSource()},t.options.delay):t.generateSource();break;case"search":t.searchResult();t.buildLayout();t.result.length||t.searchGroups.length&&t.options.emptyTemplate&&t.query.length?t.showLayout():t.hideLayout();t.deferred&&t.deferred.resolve()}return t.deferred&&t.deferred.promise()});this.options.generateOnLoad&&this.node.trigger("generate"+this.namespace)},filterGenerateSource:function(){this.searchGroups=[];this.generateGroups=[];for(var n in this.options.source)if(this.options.source.hasOwnProperty(n)&&this.query.length>=this.options.source[n].minLength&&this.query.length<=this.options.source[n].maxLength){if(this.searchGroups.push(n),!this.options.source[n].dynamic&&this.source[n])continue;this.generateGroups.push(n)}},generateSource:function(i){var h,r,o,u,s,l,f,c,e,a;if(this.filterGenerateSource(),Array.isArray(i)&&i.length)this.generateGroups=i;else if(!this.generateGroups.length){this.node.trigger("search"+this.namespace);return}if(this.requestGroups=[],this.generatedGroupCount=0,this.options.loadingAnimation&&this.container.addClass("loading"),!this.helper.isEmpty(this.xhr)){for(e in this.xhr)this.xhr.hasOwnProperty(e)&&this.xhr[e].abort();this.xhr={}}for(h=this,e=0,a=this.generateGroups.length;e<a;++e){if(r=this.generateGroups[e],u=this.options.source[r],s=u.cache,l=u.compression,s&&(f=window[s].getItem("TYPEAHEAD_"+this.selector+":"+r),f)){l&&(f=LZString.decompressFromUTF16(f));c=!1;try{f=JSON.parse(f+"");f.data&&f.ttl>(new Date).getTime()?(this.populateSource(f.data,r),c=!0,this.options.debug&&(t.log({node:this.selector,"function":"generateSource()",message:'Source for group "'+r+'" found in '+s}),t.print())):window[s].removeItem("TYPEAHEAD_"+this.selector+":"+r)}catch(v){}if(c)continue}if(u.data&&!u.ajax){typeof u.data=="function"?(o=u.data.call(this),Array.isArray(o)?h.populateSource(o,r):typeof o.promise=="function"&&function(t){n.when(o).then(function(n){n&&Array.isArray(n)&&h.populateSource(n,t)})}(r)):this.populateSource(n.extend(!0,[],u.data),r);continue}u.ajax&&(this.requests[r]||(this.requests[r]=this.generateRequestObject(r)),this.requestGroups.push(r))}return this.requestGroups.length&&this.handleRequests(),!!this.generateGroups.length},generateRequestObject:function(n){var u=this,i=this.options.source[n],t={request:{url:i.ajax.url||null,dataType:"json",beforeSend:function(t){u.xhr[n]=t;var r=u.requests[n].callback.beforeSend||i.ajax.beforeSend;typeof r=="function"&&r.apply(null,arguments)}},callback:{beforeSend:null,done:null,fail:null,then:null,always:null},extra:{path:i.ajax.path||null,group:n},validForGroup:[n]},r;if(typeof i.ajax!="function"&&(i.ajax instanceof Object&&(t=this.extendXhrObject(t,i.ajax)),Object.keys(this.options.source).length>1))for(r in this.requests)this.requests.hasOwnProperty(r)&&(this.requests[r].isDuplicated||t.request.url&&t.request.url===this.requests[r].request.url&&(this.requests[r].validForGroup.push(n),t.isDuplicated=!0,delete t.validForGroup));return t},extendXhrObject:function(t,i){return typeof i.callback=="object"&&(t.callback=i.callback,delete i.callback),typeof i.beforeSend=="function"&&(t.callback.beforeSend=i.beforeSend,delete i.beforeSend),t.request=n.extend(!0,t.request,i),t.request.dataType.toLowerCase()!=="jsonp"||t.request.jsonpCallback||(t.request.jsonpCallback="callback_"+t.extra.group),t},handleRequests:function(){var i=this,r,f=this.requestGroups.length,u,e;if(this.helper.executeCallback.call(this,this.options.callback.onSendRequest,[this.node,this.query])!==!1)for(u=0,e=this.requestGroups.length;u<e;++u)(r=this.requestGroups[u],this.requests[r].isDuplicated)||function(r,u){var c,e,o,s,h;if(typeof i.options.source[r].ajax=="function"){if(c=i.options.source[r].ajax.call(i,i.query),u=i.extendXhrObject(i.generateRequestObject(r),typeof c=="object"?c:{}),typeof u.request!="object"||!u.request.url){i.options.debug&&(t.log({node:i.selector,"function":"handleRequests",message:'Source function must return an object containing ".url" key for group "'+r+'"'}),t.print());i.populateSource([],r);return}i.requests[r]=u}if(o=!1,~u.request.url.indexOf("{{query}}")&&(o||(u=n.extend(!0,{},u),o=!0),u.request.url=u.request.url.replace("{{query}}",encodeURIComponent(i.query))),u.request.data)for(h in u.request.data)if(u.request.data.hasOwnProperty(h)&&~String(u.request.data[h]).indexOf("{{query}}")){o||(u=n.extend(!0,{},u),o=!0);u.request.data[h]=u.request.data[h].replace("{{query}}",i.query);break}n.ajax(u.request).done(function(n,r,f){s=null;for(var o=0,h=u.validForGroup.length;o<h;o++)e=i.requests[u.validForGroup[o]],e.callback.done instanceof Function&&(s=e.callback.done.call(i,n,r,f),Array.isArray(s)&&typeof s=="object"||i.options.debug&&(t.log({node:i.selector,"function":"Ajax.callback.done()",message:"Invalid returned data has to be an Array"}),t.print()))}).fail(function(n,r,f){for(var o=0,s=u.validForGroup.length;o<s;o++)e=i.requests[u.validForGroup[o]],e.callback.fail instanceof Function&&e.callback.fail.call(i,n,r,f);i.options.debug&&(t.log({node:i.selector,"function":"Ajax.callback.fail()",arguments:JSON.stringify(u.request),message:r}),console.log(f),t.print())}).always(function(n,t,r){for(var o=0,h=u.validForGroup.length;o<h;o++){if(e=i.requests[u.validForGroup[o]],e.callback.always instanceof Function&&e.callback.always.call(i,n,t,r),typeof r!="object")return;i.populateSource(typeof n.promise=="function"&&[]||s||n,e.extra.group,e.extra.path||e.request.path);f-=1;f===0&&i.helper.executeCallback.call(i,i.options.callback.onReceiveRequest,[i.node,i.query])}}).then(function(n,t){for(var r=0,f=u.validForGroup.length;r<f;r++)e=i.requests[u.validForGroup[r]],e.callback.then instanceof Function&&e.callback.then.call(i,n,t)})}(r,this.requests[r])},populateSource:function(n,i,r){var b=this,e=this.options.source[i],o=e.ajax&&e.data,p,k,h,l,a,s,d,c,v,u,f,y;for(r&&typeof r=="string"&&(n=this.helper.namespace.call(this,r,n)),typeof n=="undefined"&&this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:r,message:"Invalid data path."}),t.print()),Array.isArray(n)||(this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:JSON.stringify({group:i}),message:"Invalid data type, must be Array type."}),t.print()),n=[]),o&&(typeof o=="function"&&(o=o()),Array.isArray(o)?n=n.concat(o):this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:JSON.stringify(o),message:"WARNING - this.options.source."+i+".data Must be an Array or a function that returns an Array."}),t.print())),k=e.display?e.display[0]==="compiled"?e.display[1]:e.display[0]:this.options.display[0]==="compiled"?this.options.display[1]:this.options.display[0],u=0,f=n.length;u<f;u++){if(n[u]===null||typeof n[u]=="boolean"){this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",message:"WARNING - NULL/BOOLEAN value inside "+i+"! The data was skipped."}),t.print());continue}typeof n[u]=="string"&&(p={},p[k]=n[u],n[u]=p);n[u].group=i}if(!this.hasDynamicGroups&&this.dropdownFilter.dynamic.length)for(a={},u=0,f=n.length;u<f;u++)for(s=0,d=this.dropdownFilter.dynamic.length;s<d;s++)(h=this.dropdownFilter.dynamic[s].key,l=n[u][h],l)&&(this.dropdownFilter.dynamic[s].value||(this.dropdownFilter.dynamic[s].value=[]),a[h]||(a[h]=[]),~a[h].indexOf(l.toLowerCase())||(a[h].push(l.toLowerCase()),this.dropdownFilter.dynamic[s].value.push(l)));if(this.options.correlativeTemplate)if(c=e.template||this.options.template,v="",typeof c=="function"&&(c=c.call(this,"",{})),c){if(Array.isArray(this.options.correlativeTemplate))for(u=0,f=this.options.correlativeTemplate.length;u<f;u++)v+="{{"+this.options.correlativeTemplate[u]+"}} ";else v=c.replace(/<.+?>/g,"");for(u=0,f=n.length;u<f;u++)n[u].compiled=v.replace(/\{\{([\w\-\.]+)(?:\|(\w+))?}}/g,function(t,i){return b.helper.namespace.call(b,i,n[u],"get","")}).trim();e.display?~e.display.indexOf("compiled")||e.display.unshift("compiled"):~this.options.display.indexOf("compiled")||this.options.display.unshift("compiled")}else this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:String(i),message:"WARNING - this.options.correlativeTemplate is enabled but no template was found."}),t.print());this.options.callback.onPopulateSource&&(n=this.helper.executeCallback.call(this,this.options.callback.onPopulateSource,[this.node,n,i,r]),this.options.debug&&(n&&Array.isArray(n)||(t.log({node:this.selector,"function":"callback.populateSource()",message:'callback.onPopulateSource must return the "data" parameter'}),t.print())));this.tmpSource[i]=Array.isArray(n)&&n||[];var w=this.options.source[i].cache,g=this.options.source[i].compression,nt=this.options.source[i].ttl||this.options.ttl;w&&!window[w].getItem("TYPEAHEAD_"+this.selector+":"+i)&&(this.options.callback.onCacheSave&&(n=this.helper.executeCallback.call(this,this.options.callback.onCacheSave,[this.node,n,i,r]),this.options.debug&&(n&&Array.isArray(n)||(t.log({node:this.selector,"function":"callback.populateSource()",message:'callback.onCacheSave must return the "data" parameter'}),t.print()))),y=JSON.stringify({data:n,ttl:(new Date).getTime()+nt}),g&&(y=LZString.compressToUTF16(y)),window[w].setItem("TYPEAHEAD_"+this.selector+":"+i,y));this.incrementGeneratedGroup()},incrementGeneratedGroup:function(){if(this.generatedGroupCount++,this.generatedGroupCount===this.generateGroups.length){this.xhr={};for(var n=0,t=this.generateGroups.length;n<t;n++)this.source[this.generateGroups[n]]=this.tmpSource[this.generateGroups[n]];this.hasDynamicGroups||this.buildDropdownItemLayout("dynamic");this.options.loadingAnimation&&this.container.removeClass("loading");this.node.trigger("search"+this.namespace)}},navigate:function(n){if(this.helper.executeCallback.call(this,this.options.callback.onNavigateBefore,[this.node,this.query,n]),n.keyCode===27){n.preventDefault();this.query.length?(this.resetInput(),this.node.trigger("input"+this.namespace,[n])):(this.node.blur(),this.hideLayout());return}if(this.options.blurOnTab&&n.keyCode===9){this.node.blur();this.hideLayout();return}if(this.result.length){var i=this.resultContainer.find("."+this.options.selector.item),r=i.filter(".active"),u=r[0]&&i.index(r)||null,t=null;if(n.keyCode===13){r.length>0&&(n.preventDefault(),r.find("a:first").trigger("click",n));return}if(n.keyCode===39){u?i.eq(u).find("a:first")[0].click():this.options.hint&&this.hint.container.val()!==""&&this.helper.getCaret(this.node[0])>=this.query.length&&i.find('a[data-index="'+this.hintIndex+'"]')[0].click();return}i.length>0&&r.removeClass("active");n.keyCode===38?(n.preventDefault(),r.length>0?u-1>=0&&(t=u-1,i.eq(t).addClass("active")):(t=i.length-1,i.last().addClass("active"))):n.keyCode===40&&(n.preventDefault(),r.length>0?u+1<i.length&&(t=u+1,i.eq(t).addClass("active")):(t=0,i.first().addClass("active")));n.preventInputChange&&~[38,40].indexOf(n.keyCode)&&this.buildHintLayout(t!==null&&t<this.result.length?[this.result[t]]:null);this.options.hint&&this.hint.container&&this.hint.container.css("color",n.preventInputChange?this.hint.css.color:t===null&&this.hint.css.color||this.hint.container.css("background-color")||"fff");this.node.val(t!==null&&!n.preventInputChange?this.result[t][this.result[t].matchedKey]:this.rawQuery);this.helper.executeCallback.call(this,this.options.callback.onNavigateAfter,[this.node,i,t!==null&&i.eq(t).find("a:first")||undefined,t!==null&&this.result[t]||undefined,this.query,n])}},searchResult:function(n){(n||(this.item={}),this.resetLayout(),this.helper.executeCallback.call(this,this.options.callback.onSearch,[this.node,this.query])!==!1)&&(this.searchGroups.length&&this.searchResultData(),this.helper.executeCallback.call(this,this.options.callback.onResult,[this.node,this.query,this.result,this.resultCount,this.resultCountPerGroup]),this.isDropdownEvent&&(this.helper.executeCallback.call(this,this.options.callback.onDropdownFilter,[this.node,this.query,this.filters.dropdown,this.result]),this.isDropdownEvent=!1))},searchResultData:function(){var nt=this,v=this.groupBy,e=null,r,tt,c,y=this.query.toLowerCase(),ut=this.options.maxItem,l=this.options.maxItemPerGroup,at=this.filters.dynamic&&!this.helper.isEmpty(this.filters.dynamic),s,ft={},p,w,et,b,vt=typeof this.options.matcher=="function"&&this.options.matcher,ot,k,it,d,ht,o,ct,a,lt,f,st,i,rt,g,u,h;for(this.options.accent&&(y=this.helper.removeAccent.call(this,y)),u=0,h=this.searchGroups.length;u<h;++u)if(i=this.searchGroups[u],!this.filters.dropdown||this.filters.dropdown.key!=="group"||this.filters.dropdown.value===i)for(p=typeof this.options.source[i].filter!="undefined"?this.options.source[i].filter:this.options.filter,et=typeof this.options.source[i].matcher=="function"&&this.options.source[i].matcher||vt,d=0,ht=this.source[i].length;d<ht;d++){if(this.resultItemCount>=ut&&!this.options.callback.onResult)break;if((!at||this.dynamicFilter.validate.apply(this,[this.source[i][d]]))&&(r=this.source[i][d],r!==null&&typeof r!="boolean")&&(!this.filters.dropdown||(r[this.filters.dropdown.key]||"").toLowerCase()===(this.filters.dropdown.value||"").toLowerCase())){if(e=v==="group"?i:r[v]?r[v]:r.group,e&&!this.result[e]&&(this.result[e]=[],this.resultCountPerGroup[e]=0),l&&v==="group"&&this.result[e].length>=l&&!this.options.callback.onResult)break;for(f=this.options.source[i].display||this.options.display,o=0,ct=f.length;o<ct;++o){if(p!==!1){if(s=/\./.test(f[o])?this.helper.namespace.call(this,f[o],r):r[f[o]],typeof s=="undefined"||s===""){this.options.debug&&(ft[o]={display:f[o],data:r});continue}s=this.helper.cleanStringFromScript(s)}if(typeof p=="function"){if(w=p.call(this,r,s),w===undefined)break;if(!w)continue;typeof w=="object"&&(r=w)}if(~[undefined,!0].indexOf(p)){if(c=s,c=c.toString().toLowerCase(),this.options.accent&&(c=this.helper.removeAccent.call(this,c)),tt=c.indexOf(y),this.options.correlativeTemplate&&f[o]==="compiled"&&tt<0&&/\s/.test(y))for(ot=!0,k=y.split(" "),it=c,a=0,lt=k.length;a<lt;a++)if(k[a]!==""){if(!~it.indexOf(k[a])){ot=!1;break}it=it.replace(k[a],"")}if(tt<0&&!ot)continue;if(this.options.offset&&tt!==0)continue;if(et){if(b=et.call(this,r,s),b===undefined)break;if(!b)continue;typeof b=="object"&&(r=b)}}if(this.resultCount++,this.resultCountPerGroup[e]++,this.resultItemCount<ut){if(l&&this.result[e].length>=l)break;this.result[e].push(n.extend(!0,{matchedKey:f[o]},r));this.resultItemCount++}break}if(!this.options.callback.onResult){if(this.resultItemCount>=ut)break;if(l&&this.result[e].length>=l&&v==="group")break}}}if(this.options.debug&&(this.helper.isEmpty(ft)||(t.log({node:this.selector,"function":"searchResult()",arguments:JSON.stringify(ft),message:"Missing keys for display, make sure options.display is set properly."}),t.print())),this.options.order){f=[];for(i in this.result)if(this.result.hasOwnProperty(i)){for(u=0,h=this.result[i].length;u<h;u++)st=this.options.source[this.result[i][u].group].display||this.options.display,~f.indexOf(st[0])||f.push(st[0]);this.result[i].sort(nt.helper.sort(f,nt.options.order==="asc",function(n){return n.toString().toUpperCase()}))}}for(rt=[],g=[],g=typeof this.options.groupOrder=="function"?this.options.groupOrder.apply(this,[this.node,this.query,this.result,this.resultCount,this.resultCountPerGroup]):Array.isArray(this.options.groupOrder)?this.options.groupOrder:typeof this.options.groupOrder=="string"&&~["asc","desc"].indexOf(this.options.groupOrder)?Object.keys(this.result).sort(nt.helper.sort([],nt.options.groupOrder==="asc",function(n){return n.toString().toUpperCase()})):Object.keys(this.result),u=0,h=g.length;u<h;u++)rt=rt.concat(this.result[g[u]]||[]);this.groups=JSON.parse(JSON.stringify(g));this.result=rt},buildLayout:function(){if(this.buildHtmlLayout(),this.buildBackdropLayout(),this.buildHintLayout(),this.options.callback.onLayoutBuiltBefore){var i=this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltBefore,[this.node,this.query,this.result,this.resultHtml]);i instanceof n?this.resultHtml=i:this.options.debug&&(t.log({node:this.selector,"function":"callback.onLayoutBuiltBefore()",message:"Invalid returned value - You must return resultHtmlList jQuery Object"}),t.print())}this.resultHtml&&this.resultContainer.html(this.resultHtml);this.options.callback.onLayoutBuiltAfter&&this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltAfter,[this.node,this.query,this.result])},buildHtmlLayout:function(){var a,o,f,w,i,e,b,s,c,v,k,l,p,h,d,u,y;if(this.options.resultContainer!==!1){if(this.resultContainer||(this.resultContainer=n("<div/>",{"class":this.options.selector.result}),this.container.append(this.resultContainer)),!this.result.length)if(this.options.emptyTemplate&&this.query!=="")a=typeof this.options.emptyTemplate=="function"?this.options.emptyTemplate.call(this,this.query):this.options.emptyTemplate.replace(/\{\{query}}/gi,this.helper.cleanStringFromScript(this.query));else return;o=this.query.toLowerCase();this.options.accent&&(o=this.helper.removeAccent.call(this,o));var t=this,r=this.groupTemplate||"<ul><\/ul>",g=!1;for(this.groupTemplate?r=n(r.replace(/<([^>]+)>\{\{(.+?)}}<\/[^>]+>/g,function(n,i,r){var f="",e=r==="group"?t.groups:[r],u,o;if(!t.result.length)return g===!0?"":(g=!0,"<"+i+' class="'+t.options.selector.empty+'"><a href="javascript:;">'+a+"<\/a><\/"+i+">");for(u=0,o=e.length;u<o;++u)f+="<"+i+' data-group-template="'+e[u]+'"><ul><\/ul><\/'+i+">";return f})):(r=n(r),this.result.length||r.append(a instanceof n?a:'<li class="'+t.options.selector.empty+'"><a href="javascript:;">'+a+"<\/a><\/li>")),r.addClass(this.options.selector.list+(this.helper.isEmpty(this.result)?" empty":"")),h=this.groupTemplate&&this.result.length&&t.groups||[],u=0,y=this.result.length;u<y;++u)i=this.result[u],f=i.group,e=this.options.source[i.group].href||this.options.href,k=[],l=this.options.source[i.group].display||this.options.display,this.options.group&&(f=i[this.options.group.key],this.options.group.template&&(typeof this.options.group.template=="function"?w=this.options.group.template(i):typeof this.options.template=="string"&&(w=this.options.group.template.replace(/\{\{([\w\-\.]+)}}/gi,function(n,r){return t.helper.namespace.call(t,r,i,"get","")}))),r.find('[data-search-group="'+f+'"]')[0]||(this.groupTemplate?r.find('[data-group-template="'+f+'"] ul'):r).append(n("<li/>",{"class":t.options.selector.group,html:n("<a/>",{href:"javascript:;",html:w||f,tabindex:-1}),"data-search-group":f}))),this.groupTemplate&&h.length&&(d=h.indexOf(f||i.group),~d&&h.splice(d,1)),b=n("<li/>",{"class":t.options.selector.item+" "+t.options.selector.group+"-"+this.helper.slugify.call(this,f),html:n("<a/>",{href:function(){return e&&(typeof e=="string"?e=e.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(n,r,u){var f=t.helper.namespace.call(t,r,i,"get","");return u=u&&u.split("|")||[],~u.indexOf("slugify")&&(f=t.helper.slugify.call(t,f)),f}):typeof e=="function"&&(e=e(i)),i.href=e),e||"javascript:;"}(),"data-group":f,"data-index":u,html:function(){if(s=i.group&&t.options.source[i.group].template||t.options.template,s)typeof s=="function"&&(s=s.call(t,t.query,i)),v=s.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(n,r,u){var f=t.helper.cleanStringFromScript(String(t.helper.namespace.call(t,r,i,"get","")));return u=u&&u.split("|")||[],~u.indexOf("slugify")&&(f=t.helper.slugify.call(t,f)),~u.indexOf("raw")||t.options.highlight===!0&&o&&~l.indexOf(r)&&(f=t.helper.highlight.call(t,f,o.split(" "),t.options.accent)),f});else{for(var r=0,u=l.length;r<u;r++)(p=/\./.test(l[r])?t.helper.namespace.call(t,l[r],i,"get",""):i[l[r]],typeof p!="undefined"&&p!=="")&&k.push(p);v='<span class="'+t.options.selector.display+'">'+t.helper.cleanStringFromScript(String(k.join(" ")))+"<\/span>"}(t.options.highlight===!0&&o&&!s||t.options.highlight==="any")&&(v=t.helper.highlight.call(t,v,o.split(" "),t.options.accent));n(this).append(v)}})}),function(i,r,u){u.on("click",function(i,u){if(u&&typeof u=="object"&&(i.originalEvent=u),t.options.mustSelectItem&&t.helper.isEmpty(r)){i.preventDefault();return}(t.item=r,t.helper.executeCallback.call(t,t.options.callback.onClickBefore,[t.node,n(this),r,i])!==!1)&&(i.originalEvent&&i.originalEvent.defaultPrevented||i.isDefaultPrevented()||(c=r.group&&t.options.source[r.group].templateValue||t.options.templateValue,typeof c=="function"&&(c=c.call(t)),t.query=t.rawQuery=c?c.replace(/\{\{([\w\-\.]+)}}/gi,function(n,i){return t.helper.namespace.call(t,i,r,"get","")}):t.helper.namespace.call(t,r.matchedKey,r).toString(),t.focusOnly=!0,t.node.val(t.query).focus(),t.searchResult(!0),t.buildLayout(),t.hideLayout(),t.helper.executeCallback.call(t,t.options.callback.onClickAfter,[t.node,n(this),r,i])))});u.on("mouseenter",function(i){t.helper.executeCallback.call(t,t.options.callback.onMouseEnter,[t.node,n(this),r,i])});u.on("mouseleave",function(i){t.helper.executeCallback.call(t,t.options.callback.onMouseLeave,[t.node,n(this),r,i])})}(u,i,b),(this.groupTemplate?r.find('[data-group-template="'+f+'"] ul'):r).append(b);if(this.result.length&&h.length)for(u=0,y=h.length;u<y;++u)r.find('[data-group-template="'+h[u]+'"]').remove();this.resultHtml=r}},buildBackdropLayout:function(){this.options.backdrop&&(this.backdrop.container||(this.backdrop.css=n.extend({opacity:.6,filter:"alpha(opacity=60)",position:"fixed",top:0,right:0,bottom:0,left:0,"z-index":1040,"background-color":"#000"},this.options.backdrop),this.backdrop.container=n("<div/>",{"class":this.options.selector.backdrop,css:this.backdrop.css}).insertAfter(this.container)),this.container.addClass("backdrop").css({"z-index":this.backdrop.css["z-index"]+1,position:"relative"}))},buildHintLayout:function(t){var f,s,e,i,h,r,c;if(this.options.hint){if(this.node[0].scrollWidth>Math.ceil(this.node.innerWidth())){this.hint.container&&this.hint.container.val("");return}var l=this,o="",t=t||this.result,u=this.query.toLowerCase();if(this.options.accent&&(u=this.helper.removeAccent.call(this,u)),this.hintIndex=null,this.searchGroups.length){if(this.hint.container||(this.hint.css=n.extend({"border-color":"transparent",position:"absolute",top:0,display:"inline","z-index":-1,float:"none",color:"silver","box-shadow":"none",cursor:"default","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},this.options.hint),this.hint.container=n("<input/>",{type:this.node.attr("type"),"class":this.node.attr("class"),readonly:!0,unselectable:"on","aria-hidden":"true",tabindex:-1,click:function(){l.node.focus()}}).addClass(this.options.selector.hint).css(this.hint.css).insertAfter(this.node),this.node.parent().css({position:"relative"})),this.hint.container.css("color",this.hint.css.color),u)for(i=0,h=t.length;i<h;i++){for(s=t[i].group,f=this.options.source[s].display||this.options.display,r=0,c=f.length;r<c;r++)if(e=String(t[i][f[r]]).toLowerCase(),this.options.accent&&(e=this.helper.removeAccent.call(this,e)),e.indexOf(u)===0){o=String(t[i][f[r]]);this.hintIndex=i;break}if(this.hintIndex!==null)break}this.hint.container.val(o.length>0&&this.rawQuery+o.substring(this.query.length)||"")}}},buildDropdownLayout:function(){if(this.options.dropdownFilter){var t=this;n("<span/>",{"class":this.options.selector.filter,html:function(){n(this).append(n("<button/>",{type:"button","class":t.options.selector.filterButton,style:"display: none;",click:function(i){i.stopPropagation();t.container.toggleClass("filter");var r=t.namespace+"-dropdown-filter";if(n("html").off(r),t.container.hasClass("filter"))n("html").on("click"+r+" touchend"+r,function(i){n(i.target).closest("."+t.options.selector.filter)[0]||t.hasDragged||t.container.removeClass("filter")})}}));n(this).append(n("<ul/>",{"class":t.options.selector.dropdown}))}}).insertAfter(t.container.find("."+t.options.selector.query))}},buildDropdownItemLayout:function(t){function l(n){n.value==="*"?delete this.filters.dropdown:this.filters.dropdown=n;this.container.removeClass("filter").find("."+this.options.selector.filterButton).html(n.template);this.isDropdownEvent=!0;this.node.trigger("search"+this.namespace);this.node.focus()}var f,o,r,s;if(this.options.dropdownFilter){var u=this,e,h=typeof this.options.dropdownFilter=="string"&&this.options.dropdownFilter||"All",c=this.container.find("."+this.options.selector.dropdown),i;for(t==="static"&&(this.options.dropdownFilter===!0||typeof this.options.dropdownFilter=="string")&&this.dropdownFilter.static.push({key:"group",template:"{{group}}",all:h,value:Object.keys(this.options.source)}),f=0,o=this.dropdownFilter[t].length;f<o;f++)for(i=this.dropdownFilter[t][f],Array.isArray(i.value)||(i.value=[i.value]),i.all&&(this.dropdownFilterAll=i.all),r=0,s=i.value.length;r<=s;r++){if(r===s&&f!==o-1)continue;else if(r===s&&f===o-1&&t==="static"&&this.dropdownFilter.dynamic.length)continue;e=this.dropdownFilterAll||h;i.value[r]?e=i.template?i.template.replace(new RegExp("{{"+i.key+"}}","gi"),i.value[r]):i.value[r]:this.container.find("."+u.options.selector.filterButton).html(e),function(t,i,r){c.append(n("<li/>",{"class":u.options.selector.dropdownItem+" "+u.helper.slugify.call(u,i.key+"-"+(i.value[t]||h)),html:n("<a/>",{href:"javascript:;",html:r,click:function(n){n.preventDefault();l.call(u,{key:i.key,value:i.value[t]||"*",template:r})}})}))}(r,i,e)}this.dropdownFilter[t].length&&this.container.find("."+u.options.selector.filterButton).removeAttr("style")}},dynamicFilter:{isEnabled:!1,init:function(){this.options.dynamicFilter&&(this.dynamicFilter.bind.call(this),this.dynamicFilter.isEnabled=!0)},validate:function(n){var u,i=null,r=null,f,t;for(t in this.filters.dynamic)if(this.filters.dynamic.hasOwnProperty(t)&&(f=~t.indexOf(".")?this.helper.namespace.call(this,t,n,"get"):n[t],this.filters.dynamic[t].modifier!=="|"||i||(i=f==this.filters.dynamic[t].value||!1),this.filters.dynamic[t].modifier==="&"))if(f==this.filters.dynamic[t].value)r=!0;else{r=!1;break}return u=i,r!==null&&(u=r,r===!0&&i!==null&&(u=i)),!!u},set:function(n,t){var i=n.match(/^([|&])?(.+)/);t?this.filters.dynamic[i[2]]={modifier:i[1]||"|",value:t}:delete this.filters.dynamic[i[2]];this.dynamicFilter.isEnabled&&this.generateSource()},bind:function(){for(var r=this,i,u=0,f=this.options.dynamicFilter.length;u<f;u++){if(i=this.options.dynamicFilter[u],typeof i.selector=="string"&&(i.selector=n(i.selector)),!(i.selector instanceof n)||!i.selector[0]||!i.key){this.options.debug&&(t.log({node:this.selector,"function":"buildDynamicLayout()",message:'Invalid jQuery selector or jQuery Object for "filter.selector" or missing filter.key'}),t.print());continue}(function(n){n.selector.off(r.namespace).on("change"+r.namespace,function(){r.dynamicFilter.set.apply(r,[n.key,r.dynamicFilter.getValue(this)])}).trigger("change"+r.namespace)})(i)}},getValue:function(n){var t;return n.tagName==="SELECT"?t=n.value:n.tagName==="INPUT"&&(n.type==="checkbox"?t=n.checked&&n.getAttribute("value")||n.checked||null:n.type==="radio"&&n.checked&&(t=n.value)),t}},showLayout:function(){function t(){var t=this;n("html").off("keydown"+this.namespace).on("keydown"+this.namespace,function(i){i.keyCode&&i.keyCode===9&&setTimeout(function(){n(":focus").closest(t.container).find(t.node)[0]||t.hideLayout()},0)});n("html").off("click"+this.namespace+" touchend"+this.namespace).on("click"+this.namespace+" touchend"+this.namespace,function(i){n(i.target).closest(t.container)[0]||t.hasDragged||t.hideLayout()})}this.container.hasClass("result")||(this.result.length||this.options.emptyTemplate||this.options.backdropOnFocus)&&(t.call(this),this.container.addClass([this.result.length||this.searchGroups.length&&this.options.emptyTemplate&&this.query.length?"result ":"",this.options.hint&&this.searchGroups.length?"hint":"",this.options.backdrop||this.options.backdropOnFocus?"backdrop":""].join(" ")),this.helper.executeCallback.call(this,this.options.callback.onShowLayout,[this.node,this.query]))},hideLayout:function(){(this.container.hasClass("result")||this.container.hasClass("backdrop"))&&((this.container.removeClass("result hint filter"+(this.options.backdropOnFocus&&n(this.node).is(":focus")?"":" backdrop")),this.options.backdropOnFocus&&this.container.hasClass("backdrop"))||(n("html").off(this.namespace),this.helper.executeCallback.call(this,this.options.callback.onHideLayout,[this.node,this.query])))},resetLayout:function(){this.result={};this.groups=[];this.resultCount=0;this.resultCountPerGroup={};this.resultItemCount=0;this.resultHtml=null;this.options.hint&&this.hint.container&&this.hint.container.val("")},resetInput:function(){this.node.val("");this.item=null;this.query="";this.rawQuery=""},buildCancelButtonLayout:function(){if(this.options.cancelButton){var t=this;n("<span/>",{"class":this.options.selector.cancelButton,mousedown:function(n){n.stopImmediatePropagation();n.preventDefault();t.resetInput();t.node.trigger("input"+t.namespace,[n])}}).insertBefore(this.node)}},toggleCancelButtonVisibility:function(){this.container.toggleClass("cancel",!!this.query.length)},__construct:function(){(this.extendOptions(),this.unifySourceFormat())&&(this.dynamicFilter.init.apply(this),this.init(),this.buildDropdownLayout(),this.buildDropdownItemLayout("static"),this.delegateEvents(),this.buildCancelButtonLayout(),this.helper.executeCallback.call(this,this.options.callback.onReady,[this.node]))},helper:{isEmpty:function(n){for(var t in n)if(n.hasOwnProperty(t))return!1;return!0},removeAccent:function(n){if(typeof n=="string"){var t=r;return typeof this.options.accent=="object"&&(t=this.options.accent),n.toLowerCase().replace(new RegExp("["+t.from+"]","g"),function(n){return t.to[t.from.indexOf(n)]})}},slugify:function(n){return n=String(n),n!==""&&(n=this.helper.removeAccent.call(this,n),n=n.replace(/[^-a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")),n},sort:function(n,t,i){var r=function(t){for(var r=0,u=n.length;r<u;r++)if(typeof t[n[r]]!="undefined")return i(t[n[r]]);return t};return t=[-1,1][+!!t],function(n,i){return n=r(n),i=r(i),t*((n>i)-(i>n))}},replaceAt:function(n,t,i,r){return n.substring(0,t)+r+n.substring(t+i)},highlight:function(n,t,i){var f,u,r;for(n=String(n),f=i&&this.helper.removeAccent.call(this,n)||n,u=[],Array.isArray(t)||(t=[t]),t.sort(function(n,t){return t.length-n.length}),r=t.length-1;r>=0;r--){if(t[r].trim()===""){t.splice(r,1);continue}t[r]=t[r].replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}for(f.replace(new RegExp("(?:"+t.join("|")+")(?!([^<]+)?>)","gi"),function(n,t,i){u.push({offset:i,length:n.length})}),r=u.length-1;r>=0;r--)n=this.helper.replaceAt(n,u[r].offset,u[r].length,"<strong>"+n.substr(u[r].offset,u[r].length)+"<\/strong>");return n},getCaret:function(n){var i,t,r;return n.selectionStart?n.selectionStart:document.selection?(n.focus(),i=document.selection.createRange(),i===null)?0:(t=n.createTextRange(),r=t.duplicate(),t.moveToBookmark(i.getBookmark()),r.setEndPoint("EndToStart",t),r.text.length):0},cleanStringFromScript:function(n){return typeof n=="string"&&n.replace(/<\/?(?:script|iframe)\b[^>]*>/gm,"")||n},executeCallback:function(n,i){if(n){var r;if(typeof n=="function")r=n;else if((typeof n=="string"||Array.isArray(n))&&(typeof n=="string"&&(n=[n,[]]),r=this.helper.namespace.call(this,n[0],window),typeof r!="function")){this.options.debug&&(t.log({node:this.selector,"function":"executeCallback()",arguments:JSON.stringify(n),message:'WARNING - Invalid callback function"'}),t.print());return}return r.apply(this,(n[1]||[]).concat(i?i:[]))}},namespace:function(n,i,r,u){var s,o,h;if(typeof n!="string"||n==="")return this.options.debug&&(t.log({node:this.options.input||this.selector,"function":"helper.namespace()",arguments:n,message:'ERROR - Missing string"'}),t.print()),!1;if(s=typeof u!="undefined"?u:undefined,!~n.indexOf("."))return i[n]||s;var c=n.split("."),f=i||window,r=r||"get",e="";for(o=0,h=c.length;o<h;o++){if(e=c[o],typeof f[e]=="undefined"){if(~["get","delete"].indexOf(r))return typeof u!="undefined"?u:undefined;f[e]={}}if(~["set","create","delete"].indexOf(r)&&o===h-1)if(r==="set"||r==="create")f[e]=s;else return delete f[e],!0;f=f[e]}return f},typeWatch:function(){var n=0;return function(t,i){clearTimeout(n);n=setTimeout(t,i)}}()}},n.fn.typeahead=n.typeahead=function(n){return u.typeahead(this,n)},u={typeahead:function(r,u){var o,e,f,s;if(!u||!u.source||typeof u.source!="object"){t.log({node:r.selector||u&&u.input,"function":"$.typeahead()",arguments:JSON.stringify(u&&u.source||""),message:'Undefined "options" or "options.source" or invalid source type - Typeahead dropped'});t.print();return}if(typeof r=="function"){if(!u.input){t.log({node:r.selector,"function":"$.typeahead()",message:'Undefined "options.input" - Typeahead dropped'});t.print();return}r=n(u.input)}if(!r.length||r[0].nodeName!=="INPUT"){t.log({node:r.selector,"function":"$.typeahead()",arguments:JSON.stringify(u.input),message:"Unable to find jQuery input element - Typeahead dropped"});t.print();return}if(r.length===1)return r[0].selector=r.selector||u.input||r[0].nodeName.toLowerCase(),window.Typeahead[r[0].selector]=new i(r,u);for(o={},f=0,s=r.length;f<s;++f)e=r[f].nodeName.toLowerCase(),typeof o[e]!="undefined"&&(e+=f),r[f].selector=e,window.Typeahead[e]=o[e]=new i(r.eq(f),u);return o}},t={table:{},log:function(t){t.message&&typeof t.message=="string"&&(this.table[t.message]=n.extend({node:"","function":"",arguments:""},t))},print:function(){!i.prototype.helper.isEmpty(this.table)&&console&&console.table&&((console.group!==undefined||console.table!==undefined)&&(console.groupCollapsed("--- jQuery Typeahead Debug ---"),console.table(this.table),console.groupEnd()),this.table={})}},t.log({message:"WARNING - You are using the DEBUG version. Use /dist/jquery.typeahead.min.js in production."}),t.print(),window.console=window.console||{log:function(){}},Array.isArray||(Array.isArray=function(n){return Object.prototype.toString.call(n)==="[object Array]"}),"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),"indexOf"in Array.prototype||(Array.prototype.indexOf=function(n,t){t===undefined&&(t=0);t<0&&(t+=this.length);t<0&&(t=0);for(var i=this.length;t<i;t++)if(t in this&&this[t]===n)return t;return-1}),Object.keys||(Object.keys=function(n){var i=[],t;for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&i.push(t);return i}),i})