function autoHeight(){$(".main-wrapper").css("min-height",0),$(".main-wrapper").css("min-height",$(document).height()-$(".footer").innerHeight())}function editPopUp(t,e,i){$.ajax({url:"/editWindow",type:"post",data:"action="+t+"&relation="+e+"&fieldType="+i,success:function(t){$(".modal-content").html(t),$("#modal-box").modal("show")}})}function perFormFetchItem(t){var e=parseInt(t.match(/\d+/)[0],10),i=$("#"+t),s=$("#"+t).find(".link");if(i.find(".item-image").remove(),""==s.val())return clearForm(t),!1;if(0==e)var n="";else var n=e;marketplace_field_handler(t);var o=s.val().replace("http://","").replace("https://","").replace("m.","").replace("www.","").split(/[\/?.#]/)[0];"ebay"==o||"amazon"==o||"etsy"==o?($("input[type='radio'][name='deal["+e+"][marketplace_id]'][data-slug="+o+"]").prop("checked",!0),i.find(".marketplace_dependent:not('.image_url_field')").show(),i.find(".default-deal-photo").hide(),i.find(".browse-field").find("label .item-image").remove()):($("input[type='radio'][name='deal["+e+"][marketplace_id]'][data-slug='other-website']").prop("checked",!0),marketplace_field_handler(t,"other-website"),i.find(".default-deal-photo").show()),itemAjax(e,s,i,n)}function itemAjax(t,e,i,s){$.ajax({type:"POST",url:"/deal/fetchItem",async:!1,data:"marketPlace_id="+$("input[type='radio'][name='deal["+t+"][marketplace_id]']:checked").val()+"&link="+encodeURIComponent(e.val()),dataType:"json",context:i,beforeSend:function(){$("#error").html(""),$(".spinner").show()},success:function(e){$.each(e,function(e,n){var o="#"+e+s;return"error"==e?($(".spinner").hide(),clearForm(i[0].id),i.find(o).html(n),!1):("select"==i.find(o).attr("type")?i.find("input[type='select'][name='deal["+t+"]["+e+"]'][value="+n+"]").prop("selected",!0).change():"checkbox"==i.find(o).attr("type")||"radio"==$(o).attr("type")?i.find("input[name='deal["+t+"]["+e+"]']").val(n):i.find(o).val(n),"shipping"==e&&"Y"==n&&i.find("#shipping"+s).prop("checked",!0),"international_shipping_charge"==e&&"Y"==n&&i.find("#international_shipping_charge"+s).prop("checked",!0),"item-image"==e&&i.find(".browse-field").append(n),"currency"==e&&i.find("#select_currency"+s).val(n).prop("selected",!0).change(),"changePriceForm"==e&&("From"==n?(i.find("#is_variant"+s).val("Y").prop("checked",!0),i.find(".fromPrice").remove(),$('
'+n+"
").insertBefore(".priceWrapper")):(i.find(".fromPrice").remove(),i.find("#is_variant"+s).val("N").prop("checked",!0),i.find(".price_wrap label").html(n))),void("itemId"==e&&i.find("#item_id"+s).val(n)))})},complete:function(){$(".spinner").hide()}})}function openPopUp(t){$.ajax({url:"/"+t,type:"post",success:function(e){$(".modal-content").html(e),$("#modal-box").modal("show"),"registration"==t&&($("body").append(""),$(".modal-dialog").css("max-width","400px")),"claimreward"==t&&($("body").append(""),$(".modal-dialog").css("max-width","369px")),"signin"==t&&($("body").append(""),$(".modal-dialog").css("max-width","369px")),"mobilebanner"==t&&($("body").append(""),$(".modal-dialog").css("max-width","400px")),"contact"==t&&($("body").append(""),$(".modal-dialog").css("max-width","400px"))}})}function saveDeal(t){return 0==global_php_vars.isUserLoggedIn?(openSignInPopUp("signin"),!1):void $.ajax({type:"POST",url:"/deal/saveDeal",async:!1,data:{dealId:t},dataType:"json",success:function(t){return"error"==t.status?!1:($(".pro-wishlist").html(t.innerText),void $(".pro-deal-social.for-only-mobile .pro-wishlist").html(t.innerText))}})}function saveVoucher(t){return 0==global_php_vars.isUserLoggedIn?(openSignInPopUp("signin"),!1):void $.ajax({type:"POST",url:"/voucher/saveVoucher",async:!1,data:{voucherId:t},dataType:"json",success:function(t){return"error"==t.status?!1:($(".pro-wishlist").html(t.innerText),void $(".pro-deal-social.for-only-mobile .pro-wishlist").html(t.innerText))}})}function saveSale(t){return 0==global_php_vars.isUserLoggedIn?(openSignInPopUp("signin"),!1):void $.ajax({type:"POST",url:"/sale/saveSale",async:!1,data:{saleId:t},dataType:"json",success:function(t){return"error"==t.status?!1:($(".pro-wishlist").html(t.innerText),void $(".pro-deal-social.for-only-mobile .pro-wishlist").html(t.innerText))}})}function subscribeDeal(t){return 0==global_php_vars.isUserLoggedIn?(openSignInPopUp("signin"),!1):void $.ajax({type:"POST",url:"/deal/subscribeDeal",async:!1,data:{dealId:t},dataType:"json",success:function(t){return"error"==t.status?!1:void $(".subscribeDeal").text("Deal Subscribed")}})}function clearForm(t){var e=$("#"+t);e.find(".item-image").remove(),e.find("input[type='text'],textarea").not(":button, :submit, :reset").val(""),e.find("select").removeAttr("selected").find("option:first").prop("selected","selected"),e.find(".price_wrap label").html("Price"),e.find(".help-block").html(""),e.find("input[type='checkbox']").val("N").prop("checked",!1),e.find(".marketplace_dependent").hide(),e.find(".default-deal-photo").show(),e.find(".default-deal-photo").show(),e.find(".browse-field").find("label .item-image").remove(),e.find(".bootstrap-tagsinput input[type='text']").val(""),e.find(".bootstrap-tagsinput span").remove(),e.find(".item_id").html(""),e.find("#is_variant").val("N").prop("checked",!1)}function marketplace_field_handler(t,e){var i=$("#"+t);""!=e&&"other-website"!=e?(i.find(".marketplace_dependent").hide(),i.find(".api_fields :input").each(function(t){"checkbox"==$(this).attr("type")||$(this).is("select")?$(this).attr("disabled",!0):$(this).attr("readonly",!0)})):(i.find(".marketplace_dependent").show(),i.find(".marketplace_dependent_field").attr("readonly",!1),i.find(".marketplace_dependent_field").attr("disabled",!1))}function expendThis(t){$("#"+t+" .deal-hide").toggle(),"View More"==$("#"+t+" .view-more").text()?$("#"+t+" .view-more").html("View Less"):$("#"+t+" .view-more").html("View More")}function marketPlaceChangeHandler(){$("#deal-form .com-check").on("click","img",function(){var t=($(this).attr("data-mp-id"),$(this).closest(".cloneya").attr("id"));clearForm(t),marketplace_field_handler(t,$(this).attr("data-slug"))})}function checkEmailAlreadyExist(t){$.ajax({type:"POST",url:"/user/checkIfEmailExist",async:!1,data:{email:t},dataType:"json",success:function(t){0==t.status?($("#deal-form #username, #voucher-form #username").val(""),$("#deal-form .username_wrap .help-block, #voucher-form .username_wrap .help-block").empty(),$("#deal-form .username_wrap input, #voucher-form .username_wrap input").removeClass("deal-error"),$("#deal-form .username_wrap,#voucher-form .username_wrap").show()):($("#deal-form .username_wrap, #voucher-form .username_wrap").hide(),$("#deal-form #username,#voucher-form #username").val(t.username))}})}function initializeUsernameCheck(){$(".check-username").on("focusout blur",function(t){var e=$(this);$.ajax({type:"POST",url:"/user/checkIfUserNameExist",async:1,data:{username:e.val()},dataType:"json",beforeSend:function(){e.parent().removeClass("has-success"),e.parent().removeClass("has-error")},success:function(t){t.status?(e.parent().addClass("has-error"),$(".username_error").parent("div").removeClass("has-success"),$(".username_error").parent("div").addClass("has-error")):($(".username_error").parent("div").removeClass("has-error"),$(".username_error").parent("div").addClass("has-success"),e.parent().addClass("has-success")),$(".username_error").html(t.message)}})})} var slidebars=function(){var t=$("[canvas]"),e={},i=!1,s=!1,n=["top","right","bottom","left"],o=["reveal","push","overlay","shift"],a=function(i){var s=$(),n="0px, 0px",o=1e3*parseFloat(e[i].element.css("transitionDuration"),10);return("reveal"===e[i].style||"push"===e[i].style||"shift"===e[i].style)&&(s=s.add(t)),("push"===e[i].style||"overlay"===e[i].style||"shift"===e[i].style)&&(s=s.add(e[i].element)),e[i].active&&("top"===e[i].side?n="0px, "+e[i].element.css("height"):"right"===e[i].side?n="-"+e[i].element.css("width")+", 0px":"bottom"===e[i].side?n="0px, -"+e[i].element.css("height"):"left"===e[i].side&&(n=e[i].element.css("width")+", 0px")),{elements:s,amount:n,duration:o}},r=function(t,i,s,n){if(l(t))throw"Error registering Slidebar, a Slidebar with id '"+t+"' already exists.";e[t]={id:t,side:i,style:s,element:n,active:!1}},l=function(t){return e.hasOwnProperty(t)?!0:!1};this.init=function(t){if(i)throw"Slidebars has already been initialized.";s||($("[off-canvas]").each(function(){var t=$(this).attr("off-canvas").split(" ",3);if(!t||!t[0]||-1===n.indexOf(t[1])||-1===o.indexOf(t[2]))throw"Error registering Slidebar, please specifiy a valid id, side and style'.";r(t[0],t[1],t[2],$(this))}),s=!0),i=!0,this.css(),$(h).trigger("init"),"function"==typeof t&&t()},this.exit=function(t){if(!i)throw"Slidebars hasn't been initialized.";var e=function(){i=!1,$(h).trigger("exit"),"function"==typeof t&&t()};this.getActiveSlidebar()?this.close(e):e()},this.css=function(t){if(!i)throw"Slidebars hasn't been initialized.";for(var s in e)if(l(s)){var n;n="top"===e[s].side||"bottom"===e[s].side?e[s].element.css("height"):e[s].element.css("width"),("push"===e[s].style||"overlay"===e[s].style||"shift"===e[s].style)&&e[s].element.css("margin-"+e[s].side,"-"+n)}this.getActiveSlidebar()&&this.open(this.getActiveSlidebar()),$(h).trigger("css"),"function"==typeof t&&t()},this.open=function(t,s){if(!i)throw"Slidebars hasn't been initialized.";if(!t)throw"You must pass a Slidebar id.";if(!l(t))throw"Error opening Slidebar, there is no Slidebar with id '"+t+"'.";var n=function(){e[t].active=!0,e[t].element.css("display","block"),$(h).trigger("opening",[e[t].id]);var i=a(t);i.elements.css({"transition-duration":i.duration+"ms",transform:"translate(0)"}),setTimeout(function(){$(h).trigger("opened",[e[t].id]),"function"==typeof s&&s()},i.duration)};this.getActiveSlidebar()&&this.getActiveSlidebar()!==t?this.close(n):n()},this.close=function(t,s){if("function"==typeof t&&(s=t,t=null),!i)throw"Slidebars hasn't been initialized.";if(t&&!l(t))throw"Error closing Slidebar, there is no Slidebar with id '"+t+"'.";if(t||(t=this.getActiveSlidebar()),t&&e[t].active){e[t].active=!1,$(h).trigger("closing",[e[t].id]);var n=a(t);n.elements.css("transform",""),setTimeout(function(){n.elements.css("transition-duration",""),e[t].element.css("display",""),$(h).trigger("closed",[e[t].id]),"function"==typeof s&&s()},n.duration)}},this.toggle=function(t,s){if(!i)throw"Slidebars hasn't been initialized.";if(!t)throw"You must pass a Slidebar id.";if(!l(t))throw"Error toggling Slidebar, there is no Slidebar with id '"+t+"'.";e[t].active?($("body, html").css("overflow","auto"),this.close(t,function(){"function"==typeof s&&s()})):($("body, html").css("overflow","hidden"),this.open(t,function(){"function"==typeof s&&s()}))},this.isActive=function(){return i},this.isActiveSlidebar=function(t){if(!i)throw"Slidebars hasn't been initialized.";if(!t)throw"You must provide a Slidebar id.";if(!l(t))throw"Error retrieving Slidebar, there is no Slidebar with id '"+t+"'.";return e[t].active},this.getActiveSlidebar=function(){if(!i)throw"Slidebars hasn't been initialized.";var t=!1;for(var s in e)if(l(s)&&e[s].active){t=e[s].id;break}return t},this.getSlidebars=function(){if(!i)throw"Slidebars hasn't been initialized.";var t=[];for(var s in e)l(s)&&t.push(e[s].id);return t},this.getSlidebar=function(t){if(!i)throw"Slidebars hasn't been initialized.";if(!t)throw"You must pass a Slidebar id.";if(!l(t))throw"Error retrieving Slidebar, there is no Slidebar with id '"+t+"'.";return e[t]},this.events={};var h=this.events;$(window).on("resize",this.css.bind(this))};!function(t){var e=new slidebars;t(e.events).on("init",function(){}),t(e.events).on("exit",function(){}),t(e.events).on("css",function(){}),t(e.events).on("opening",function(t,e){}),t(e.events).on("opened",function(t,e){}),t(e.events).on("closing",function(t,e){}),t(e.events).on("closed",function(t,e){}),e.init(),t(".js-open-left-slidebar").on("click",function(t){t.stopPropagation(),e.open("slidebar-1")}),t(".js-close-left-slidebar").on("click",function(t){t.stopPropagation(),e.close("slidebar-1")}),t(".js-toggle-left-slidebar").on("click",function(t){t.stopPropagation(),e.toggle("slidebar-1")}),t(".js-open-right-slidebar").on("click",function(t){t.stopPropagation(),e.open("slidebar-2")}),t(".js-close-right-slidebar").on("click",function(t){t.stopPropagation(),e.close("slidebar-2")}),t(".js-toggle-right-slidebar").on("click",function(t){t.stopPropagation(),e.toggle("slidebar-2")}),t(".js-open-top-slidebar").on("click",function(t){t.stopPropagation(),e.open("slidebar-3")}),t(".js-close-top-slidebar").on("click",function(t){t.stopPropagation(),e.close("slidebar-3")}),t(".js-toggle-top-slidebar").on("click",function(t){t.stopPropagation(),e.toggle("slidebar-3")}),t(".js-open-bottom-slidebar").on("click",function(t){t.stopPropagation(),e.open("slidebar-4")}),t(".js-close-bottom-slidebar").on("click",function(t){t.stopPropagation(),e.close("slidebar-4")}),t(".js-toggle-bottom-slidebar").on("click",function(t){t.stopPropagation(),e.toggle("slidebar-4")}),t(e.events).on("opened",function(){t('[canvas="container"]').addClass("js-close-any-slidebar")}),t(e.events).on("closed",function(){t('[canvas="container"]').removeClass("js-close-any-slidebar")}),t("body").on("click",".js-close-any-slidebar",function(t){t.stopPropagation(),e.close()}),t(".js-initialize-slidebars").on("click",function(t){t.stopPropagation(),e.init()}),t(".js-exit-slidebars").on("click",function(t){t.stopPropagation(),e.exit()}),t(".js-reset-slidebars-css").on("click",function(t){t.stopPropagation(),e.css()}),t(".js-is-active").on("click",function(t){t.stopPropagation(),console.log(e.isActive())}),t(".js-is-active-slidebar").on("click",function(t){t.stopPropagation();var i=prompt("Enter a Slidebar id");console.log(e.isActiveSlidebar(i))}),t(".js-get-active-slidebar").on("click",function(t){t.stopPropagation(),console.log(e.getActiveSlidebar())}),t(".js-get-all-slidebars").on("click",function(t){t.stopPropagation(),console.log(e.getSlidebars())}),t(".js-get-slidebar").on("click",function(t){t.stopPropagation();var i=prompt("Enter a Slidebar id");console.log(e.getSlidebar(i))}),t(".js-init-callback").on("click",function(t){t.stopPropagation(),e.init(function(){console.log("Init callback")})}),t(".js-exit-callback").on("click",function(t){t.stopPropagation(),e.exit(function(){console.log("Exit callback")})}),t(".js-css-callback").on("click",function(t){t.stopPropagation(),e.css(function(){console.log("CSS callback")})}),t(".js-open-callback").on("click",function(t){t.stopPropagation(),e.open("slidebar-1",function(){console.log("Open callback")})}),t(".js-close-callback").on("click",function(t){t.stopPropagation(),e.close(function(){console.log("Close callback")})}),t(".js-toggle-callback").on("click",function(t){t.stopPropagation(),e.toggle("slidebar-1",function(){console.log("Toggle callback")})})}(jQuery) ,!function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):t.jQuery)}(this,function(t){"use strict";t.fn.typeWatch=function(e){function i(t,e){var i="DIV"===t.type?jQuery(t.el).html():jQuery(t.el).val();(i.length>=o.captureLength&&i!=t.text||e&&(i.length>=o.captureLength||o.allowSubmit)||0==i.length&&t.text)&&(t.text=i,t.cb.call(t.el,i))}function s(t){var e=(t.type||t.nodeName).toUpperCase();if(jQuery.inArray(e,o.inputTypes)>=0){var s={timer:null,text:"DIV"===e?jQuery(t).html():jQuery(t).val(),cb:o.callback,el:t,type:e,wait:o.wait};o.highlight&&"DIV"!==e&&jQuery(t).focus(function(){this.select()});var n=function(t){var n=s.wait,o=!1,a=e;"undefined"!=typeof t.keyCode&&13==t.keyCode&&"TEXTAREA"!==a&&"DIV"!==e&&(console.log("OVERRIDE"),n=1,o=!0);var r=function(){i(s,o)};clearTimeout(s.timer),s.timer=setTimeout(r,n)};jQuery(t).on("keydown paste cut input",n)}}var n=["TEXT","TEXTAREA","PASSWORD","TEL","SEARCH","URL","EMAIL","DATETIME","DATE","MONTH","WEEK","TIME","DATETIME-LOCAL","NUMBER","RANGE","DIV"],o=t.extend({wait:750,callback:function(){},highlight:!0,captureLength:2,allowSubmit:!1,inputTypes:n},e);return this.each(function(){s(this)})}}),!function(t,e){"function"==typeof define&&define.amd?define("bloodhound",["jquery"],function(i){return t.Bloodhound=e(i)}):"object"==typeof exports?module.exports=e(require("jquery")):t.Bloodhound=e(jQuery)}(this,function(t){var e=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(t){return!t||/^\s*$/.test(t)},escapeRegExChars:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isArray:t.isArray,isFunction:t.isFunction,isObject:t.isPlainObject,isUndefined:function(t){return"undefined"==typeof t},isElement:function(t){return!(!t||1!==t.nodeType)},isJQuery:function(e){return e instanceof t},toStr:function(t){return e.isUndefined(t)||null===t?"":t+""},bind:t.proxy,each:function(e,i){function s(t,e){return i(e,t)}t.each(e,s)},map:t.map,filter:t.grep,every:function(e,i){var s=!0;return e?(t.each(e,function(t,n){return(s=i.call(null,n,t,e))?void 0:!1}),!!s):s},some:function(e,i){var s=!1;return e?(t.each(e,function(t,n){return(s=i.call(null,n,t,e))?!1:void 0}),!!s):s},mixin:t.extend,identity:function(t){return t},clone:function(e){return t.extend(!0,{},e)},getIdGenerator:function(){var t=0;return function(){return t++}},templatify:function(e){function i(){return String(e)}return t.isFunction(e)?e:i},defer:function(t){setTimeout(t,0)},debounce:function(t,e,i){var s,n;return function(){var o,a,r=this,l=arguments;return o=function(){s=null,i||(n=t.apply(r,l))},a=i&&!s,clearTimeout(s),s=setTimeout(o,e),a&&(n=t.apply(r,l)),n}},throttle:function(t,e){var i,s,n,o,a,r;return a=0,r=function(){a=new Date,n=null,o=t.apply(i,s)},function(){var l=new Date,h=e-(l-a);return i=this,s=arguments,0>=h?(clearTimeout(n),n=null,a=l,o=t.apply(i,s)):n||(n=setTimeout(r,h)),o}},stringify:function(t){return e.isString(t)?t:JSON.stringify(t)},noop:function(){}}}(),i="0.11.1",s=function(){"use strict";function t(t){return t=e.toStr(t),t?t.split(/\s+/):[]}function i(t){return t=e.toStr(t),t?t.split(/\W+/):[]}function s(t){return function(i){return i=e.isArray(i)?i:[].slice.call(arguments,0),function(s){var n=[];return e.each(i,function(i){n=n.concat(t(e.toStr(s[i])))}),n}}}return{nonword:i,whitespace:t,obj:{nonword:s(i),whitespace:s(t)}}}(),n=function(){"use strict";function i(i){this.maxSize=e.isNumber(i)?i:100,this.reset(),this.maxSize<=0&&(this.set=this.get=t.noop)}function s(){this.head=this.tail=null}function n(t,e){this.key=t,this.val=e,this.prev=this.next=null}return e.mixin(i.prototype,{set:function(t,e){var i,s=this.list.tail;this.size>=this.maxSize&&(this.list.remove(s),delete this.hash[s.key],this.size--),(i=this.hash[t])?(i.val=e,this.list.moveToFront(i)):(i=new n(t,e),this.list.add(i),this.hash[t]=i,this.size++)},get:function(t){var e=this.hash[t];return e?(this.list.moveToFront(e),e.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new s}}),e.mixin(s.prototype,{add:function(t){this.head&&(t.next=this.head,this.head.prev=t),this.head=t,this.tail=this.tail||t},remove:function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev},moveToFront:function(t){this.remove(t),this.add(t)}}),i}(),o=function(){"use strict";function i(t,i){this.prefix=["__",t,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+e.escapeRegExChars(this.prefix)),this.ls=i||r,!this.ls&&this._noop()}function s(){return(new Date).getTime()}function n(t){return JSON.stringify(e.isUndefined(t)?null:t)}function o(e){return t.parseJSON(e)}function a(t){var e,i,s=[],n=r.length;for(e=0;n>e;e++)(i=r.key(e)).match(t)&&s.push(i.replace(t,""));return s}var r;try{r=window.localStorage,r.setItem("~~~","!"),r.removeItem("~~~")}catch(l){r=null}return e.mixin(i.prototype,{_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=e.noop},_safeSet:function(t,e){try{this.ls.setItem(t,e)}catch(i){"QuotaExceededError"===i.name&&(this.clear(),this._noop())}},get:function(t){return this.isExpired(t)&&this.remove(t),o(this.ls.getItem(this._prefix(t)))},set:function(t,i,o){return e.isNumber(o)?this._safeSet(this._ttlKey(t),n(s()+o)):this.ls.removeItem(this._ttlKey(t)),this._safeSet(this._prefix(t),n(i))},remove:function(t){return this.ls.removeItem(this._ttlKey(t)),this.ls.removeItem(this._prefix(t)),this},clear:function(){var t,e=a(this.keyMatcher);for(t=e.length;t--;)this.remove(e[t]);return this},isExpired:function(t){var i=o(this.ls.getItem(this._ttlKey(t)));return e.isNumber(i)&&s()>i?!0:!1}}),i}(),a=function(){"use strict";function i(t){t=t||{},this.cancelled=!1,this.lastReq=null,this._send=t.transport,this._get=t.limiter?t.limiter(this._get):this._get,this._cache=t.cache===!1?new n(0):r}var s=0,o={},a=6,r=new n(10);return i.setMaxPendingRequests=function(t){a=t},i.resetCache=function(){r.reset()},e.mixin(i.prototype,{_fingerprint:function(e){return e=e||{},e.url+e.type+t.param(e.data||{})},_get:function(t,e){function i(t){e(null,t),c._cache.set(l,t)}function n(){e(!0)}function r(){s--,delete o[l],c.onDeckRequestArgs&&(c._get.apply(c,c.onDeckRequestArgs),c.onDeckRequestArgs=null)}var l,h,c=this;l=this._fingerprint(t),this.cancelled||l!==this.lastReq||((h=o[l])?h.done(i).fail(n):a>s?(s++,o[l]=this._send(t).done(i).fail(n).always(r)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(i,s){var n,o;s=s||t.noop,i=e.isString(i)?{url:i}:i||{},o=this._fingerprint(i),this.cancelled=!1,this.lastReq=o,(n=this._cache.get(o))?s(null,n):this._get(i,s)},cancel:function(){this.cancelled=!0}}),i}(),r=window.SearchIndex=function(){"use strict";function i(i){i=i||{},i.datumTokenizer&&i.queryTokenizer||t.error("datumTokenizer and queryTokenizer are both required"),this.identify=i.identify||e.stringify,this.datumTokenizer=i.datumTokenizer,this.queryTokenizer=i.queryTokenizer,this.reset()}function s(t){return t=e.filter(t,function(t){return!!t}),t=e.map(t,function(t){return t.toLowerCase()})}function n(){var t={};return t[l]=[],t[r]={},t}function o(t){for(var e={},i=[],s=0,n=t.length;n>s;s++)e[t[s]]||(e[t[s]]=!0,i.push(t[s]));return i}function a(t,e){var i=0,s=0,n=[];t=t.sort(),e=e.sort();for(var o=t.length,a=e.length;o>i&&a>s;)t[i]e[s]?s++:(n.push(t[i]),i++,s++);return n}var r="c",l="i";return e.mixin(i.prototype,{bootstrap:function(t){this.datums=t.datums,this.trie=t.trie},add:function(t){var i=this;t=e.isArray(t)?t:[t],e.each(t,function(t){var o,a;i.datums[o=i.identify(t)]=t,a=s(i.datumTokenizer(t)),e.each(a,function(t){var e,s,a;for(e=i.trie,s=t.split("");a=s.shift();)e=e[r][a]||(e[r][a]=n()),e[l].push(o)})})},get:function(t){var i=this;return e.map(t,function(t){return i.datums[t]})},search:function(t){var i,n,h=this;return i=s(this.queryTokenizer(t)),e.each(i,function(t){var e,i,s,o;if(n&&0===n.length)return!1;for(e=h.trie,i=t.split("");e&&(s=i.shift());)e=e[r][s];return e&&0===i.length?(o=e[l].slice(0),void(n=n?a(n,o):o)):(n=[],!1)}),n?e.map(o(n),function(t){return h.datums[t]}):[]},all:function(){var t=[];for(var e in this.datums)t.push(this.datums[e]);return t},reset:function(){this.datums={},this.trie=n()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),i}(),l=function(){"use strict";function t(t){this.url=t.url,this.ttl=t.ttl,this.cache=t.cache,this.prepare=t.prepare,this.transform=t.transform,this.transport=t.transport,this.thumbprint=t.thumbprint,this.storage=new o(t.cacheKey)}var i;return i={data:"data",protocol:"protocol",thumbprint:"thumbprint"},e.mixin(t.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(t){this.cache&&(this.storage.set(i.data,t,this.ttl),this.storage.set(i.protocol,location.protocol,this.ttl),this.storage.set(i.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var t,e={};return this.cache?(e.data=this.storage.get(i.data),e.protocol=this.storage.get(i.protocol),e.thumbprint=this.storage.get(i.thumbprint),t=e.thumbprint!==this.thumbprint||e.protocol!==location.protocol,e.data&&!t?e.data:null):null},fromNetwork:function(t){function e(){t(!0)}function i(e){t(null,n.transform(e))}var s,n=this;t&&(s=this.prepare(this._settings()),this.transport(s).fail(e).done(i))},clear:function(){return this.storage.clear(),this}}),t}(),h=function(){"use strict";function t(t){this.url=t.url,this.prepare=t.prepare,this.transform=t.transform,this.transport=new a({cache:t.cache,limiter:t.limiter,transport:t.transport})}return e.mixin(t.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(t,e){function i(t,i){e(t?[]:n.transform(i))}var s,n=this;return e?(t=t||"",s=this.prepare(t,this._settings()),this.transport.get(s,i)):void 0},cancelLastRequest:function(){this.transport.cancel()}}),t}(),c=function(){"use strict";function s(s){var n;return s?(n={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:e.identity,transform:e.identity,transport:null},s=e.isString(s)?{url:s}:s,s=e.mixin(n,s),!s.url&&t.error("prefetch requires url to be set"),s.transform=s.filter||s.transform,s.cacheKey=s.cacheKey||s.url,s.thumbprint=i+s.thumbprint,s.transport=s.transport?r(s.transport):t.ajax,s):null}function n(i){var s;return i?(s={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:e.identity,transport:null},i=e.isString(i)?{url:i}:i,i=e.mixin(s,i),!i.url&&t.error("remote requires url to be set"),i.transform=i.filter||i.transform,i.prepare=o(i),i.limiter=a(i),i.transport=i.transport?r(i.transport):t.ajax,delete i.replace,delete i.wildcard,delete i.rateLimitBy,delete i.rateLimitWait,i):void 0}function o(t){function e(t,e){return e.url=o(e.url,t),e}function i(t,e){return e.url=e.url.replace(a,encodeURIComponent(t)),e}function s(t,e){return e}var n,o,a;return n=t.prepare,o=t.replace,a=t.wildcard,n?n:n=o?e:t.wildcard?i:s}function a(t){function i(t){return function(i){return e.debounce(i,t)}}function s(t){return function(i){return e.throttle(i,t)}}var n,o,a;return n=t.limiter,o=t.rateLimitBy,a=t.rateLimitWait,n||(n=/^throttle$/i.test(o)?s(a):i(a)),n}function r(i){return function(s){function n(t){e.defer(function(){a.resolve(t)})}function o(t){e.defer(function(){a.reject(t)})}var a=t.Deferred();return i(s,n,o),a}}return function(i){var o,a;return o={initialize:!0,identify:e.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null},i=e.mixin(o,i||{}),!i.datumTokenizer&&t.error("datumTokenizer is required"),!i.queryTokenizer&&t.error("queryTokenizer is required"),a=i.sorter,i.sorter=a?function(t){return t.sort(a)}:e.identity,i.local=e.isFunction(i.local)?i.local():i.local,i.prefetch=s(i.prefetch),i.remote=n(i.remote),i}}(),u=function(){"use strict";function i(t){t=c(t),this.sorter=t.sorter,this.identify=t.identify,this.sufficient=t.sufficient,this.local=t.local,this.remote=t.remote?new h(t.remote):null,this.prefetch=t.prefetch?new l(t.prefetch):null,this.index=new r({identify:this.identify,datumTokenizer:t.datumTokenizer,queryTokenizer:t.queryTokenizer}),t.initialize!==!1&&this.initialize()}var n;return n=window&&window.Bloodhound,i.noConflict=function(){return window&&(window.Bloodhound=n),i},i.tokenizers=s,e.mixin(i.prototype,{__ttAdapter:function(){function t(t,e,s){return i.search(t,e,s)}function e(t,e){return i.search(t,e)}var i=this;return this.remote?t:e},_loadPrefetch:function(){function e(t,e){return t?i.reject():(n.add(e),n.prefetch.store(n.index.serialize()),void i.resolve())}var i,s,n=this;return i=t.Deferred(),this.prefetch?(s=this.prefetch.fromCache())?(this.index.bootstrap(s),i.resolve()):this.prefetch.fromNetwork(e):i.resolve(),i.promise()},_initialize:function(){function t(){e.add(e.local)}var e=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(t),this.initPromise},initialize:function(t){return!this.initPromise||t?this._initialize():this.initPromise},add:function(t){return this.index.add(t),this},get:function(t){return t=e.isArray(t)?t:[].slice.call(arguments),this.index.get(t)},search:function(t,i,s){function n(t){var i=[];e.each(t,function(t){!e.some(o,function(e){return a.identify(t)===a.identify(e)})&&i.push(t)}),s&&s(i)}var o,a=this;return o=this.sorter(this.index.search(t)),i(this.remote?o.slice():o),this.remote&&o.length=h?(clearTimeout(n),n=null,a=l,o=t.apply(i,s)):n||(n=setTimeout(r,h)),o}},stringify:function(t){return e.isString(t)?t:JSON.stringify(t)},noop:function(){}}}(),i=function(){"use strict";function t(t){var a,r;return r=e.mixin({},o,t),a={css:n(),classes:r,html:i(r),selectors:s(r)},{css:a.css,html:a.html,classes:a.classes,selectors:a.selectors,mixin:function(t){e.mixin(t,a)}}}function i(t){return{wrapper:'',menu:'
'}}function s(t){var i={};return e.each(t,function(t,e){i[e]="."+t}),i}function n(){var t={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"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return e.isMsie()&&e.mixin(t.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),t}var o={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return t}(),s=function(){"use strict";function i(e){e&&e.el||t.error("EventBus initialized without el"),this.$el=t(e.el)}var s,n;return s="typeahead:",n={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},e.mixin(i.prototype,{_trigger:function(e,i){var n;return n=t.Event(s+e),(i=i||[]).unshift(n),this.$el.trigger.apply(this.$el,i),n},before:function(t){var e,i;return e=[].slice.call(arguments,1),i=this._trigger("before"+t,e),i.isDefaultPrevented()},trigger:function(t){var e;this._trigger(t,[].slice.call(arguments,1)),(e=n[t])&&this._trigger(e,[].slice.call(arguments,1))}}),i}(),n=function(){"use strict";function t(t,e,i,s){var n;if(!i)return this;for(e=e.split(l),i=s?r(i,s):i,this._callbacks=this._callbacks||{};n=e.shift();)this._callbacks[n]=this._callbacks[n]||{sync:[],async:[]},this._callbacks[n][t].push(i);return this}function e(e,i,s){return t.call(this,"async",e,i,s)}function i(e,i,s){return t.call(this,"sync",e,i,s)}function s(t){var e;if(!this._callbacks)return this;for(t=t.split(l);e=t.shift();)delete this._callbacks[e];return this}function n(t){var e,i,s,n,a;if(!this._callbacks)return this;for(t=t.split(l),s=[].slice.call(arguments,1);(e=t.shift())&&(i=this._callbacks[e]);)n=o(i.sync,this,[e].concat(s)),a=o(i.async,this,[e].concat(s)),n()&&h(a);return this}function o(t,e,i){function s(){for(var s,n=0,o=t.length;!s&&o>n;n+=1)s=t[n].apply(e,i)===!1;return!s}return s}function a(){var t;return t=window.setImmediate?function(t){setImmediate(function(){t()})}:function(t){setTimeout(function(){t()},0)}}function r(t,e){return t.bind?t.bind(e):function(){t.apply(e,[].slice.call(arguments,0))}}var l=/\s+/,h=a();return{onSync:i,onAsync:e,off:s,trigger:n}}(),o=function(t){"use strict";function i(t,i,s){for(var n,o=[],a=0,r=t.length;r>a;a++)o.push(e.escapeRegExChars(t[a]));return n=s?"\\b("+o.join("|")+")\\b":"("+o.join("|")+")",i?new RegExp(n):new RegExp(n,"i")}var s={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(n){function o(e){var i,s,o;return(i=r.exec(e.data))&&(o=t.createElement(n.tagName),n.className&&(o.className=n.className),s=e.splitText(i.index),s.splitText(i[0].length),o.appendChild(s.cloneNode(!0)),e.parentNode.replaceChild(o,s)),!!i}function a(t,e){for(var i,s=3,n=0;n