!function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}(window,function(a,b){"use strict";if(b.getElementsByClassName){var c,d,e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)})},v=function(a,d,e,f,g){var h=b.createEvent("CustomEvent");return e||(e={}),e.instance=c,h.initCustomEvent(d,!f,!g,e),a.dispatchEvent(h),h},w=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c<d.minSize&&b&&!a._lazysizesWidth;)c=b.offsetWidth,b=b.parentNode;return c},z=function(){var a,c,d=[],e=[],f=d,g=function(){var b=f;for(f=d.length?e:d,a=!0,c=!1;b.length;)b.shift()();a=!1},h=function(d,e){a&&!e?d.apply(this,arguments):(f.push(d),c||(c=!0,(b.hidden?k:l)(g)))};return h._lsFlush=g,h}(),A=function(a,b){return b?function(){z(a)}:function(){var b=this,c=arguments;z(function(){a.apply(b,c)})}},B=function(a){var b,c=0,e=d.throttleDelay,g=d.ricTimeout,h=function(){b=!1,c=f.now(),a()},i=m&&g>49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:A(function(){k(h)},!0);return function(a){var d;(a=a===!0)&&(g=33),b||(b=!0,d=e-(f.now()-c),0>d&&(d=0),a||9>d?i():k(i,d))}},C=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;d>a?k(g,d-a):(m||e)(e)};return function(){c=f.now(),b||(b=k(g,d))}};!function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};d=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in d||(d[b]=c[b]);a.lazySizesConfig=d,k(function(){d.init&&F()})}();var D=function(){var g,l,m,o,p,y,D,F,G,H,I,J,K,L,M=/^img$/i,N=/^iframe$/i,O="onscroll"in a&&!/(gle|ng)bot/.test(navigator.userAgent),P=0,Q=0,R=0,S=-1,T=function(a){R--,a&&a.target&&u(a.target,T),(!a||0>R||!a.target)&&(R=0)},U=function(a,c){var d,f=a,g="hidden"==x(b.body,"visibility")||"hidden"!=x(a.parentNode,"visibility")&&"hidden"!=x(a,"visibility");for(F-=c,I+=c,G-=c,H+=c;g&&(f=f.offsetParent)&&f!=b.body&&f!=e;)g=(x(f,"opacity")||1)>0,g&&"visible"!=x(f,"overflow")&&(d=f.getBoundingClientRect(),g=H>d.left&&G<d.right&&I>d.top-1&&F<d.bottom+1);return g},V=function(){var a,f,h,j,k,m,n,p,q,r=c.elements;if((o=d.loadMode)&&8>R&&(a=r.length)){f=0,S++,null==K&&("expand"in d||(d.expand=e.clientHeight>500&&e.clientWidth>500?500:370),J=d.expand,K=J*d.expFactor),K>Q&&1>R&&S>2&&o>2&&!b.hidden?(Q=K,S=0):Q=o>1&&S>1&&6>R?J:P;for(;a>f;f++)if(r[f]&&!r[f]._lazyRace)if(O)if((p=r[f][i]("data-expand"))&&(m=1*p)||(m=Q),q!==m&&(y=innerWidth+m*L,D=innerHeight+m,n=-1*m,q=m),h=r[f].getBoundingClientRect(),(I=h.bottom)>=n&&(F=h.top)<=D&&(H=h.right)>=n*L&&(G=h.left)<=y&&(I||H||G||F)&&(d.loadHidden||"hidden"!=x(r[f],"visibility"))&&(l&&3>R&&!p&&(3>o||4>S)||U(r[f],m))){if(ba(r[f]),k=!0,R>9)break}else!k&&l&&!j&&4>R&&4>S&&o>2&&(g[0]||d.preloadAfterLoad)&&(g[0]||!p&&(I||H||G||F||"auto"!=r[f][i](d.sizesAttr)))&&(j=g[0]||r[f]);else ba(r[f]);j&&!k&&ba(j)}},W=B(V),X=function(a){s(a.target,d.loadedClass),t(a.target,d.loadingClass),u(a.target,Z),v(a.target,"lazyloaded")},Y=A(X),Z=function(a){Y({target:a.target})},$=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},_=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},aa=A(function(a,b,c,e,f){var g,h,j,l,o,p;(o=v(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?s(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),o={target:a},p&&(u(a,T,!0),clearTimeout(m),m=k(T,2500),s(a,d.loadingClass),u(a,Z,!0)),l&&q.call(j.getElementsByTagName("source"),_),h?a.setAttribute("srcset",h):g&&!l&&(N.test(a.nodeName)?$(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,d.lazyClass),z(function(){(!p||a.complete&&a.naturalWidth>1)&&(p?T(o):R--,X(o))},!0)}),ba=function(a){var b,c=M.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&l||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,d.errorClass)||!r(a,d.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,R++,aa(a,b,f,e,c))},ca=function(){if(!l){if(f.now()-p<999)return void k(ca,999);var a=C(function(){d.loadMode=3,W()});l=!0,d.loadMode=3,W(),j("scroll",function(){3==d.loadMode&&(d.loadMode=2),a()},!0)}};return{_:function(){p=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),L=d.hFac,j("scroll",W,!0),j("resize",W,!0),a.MutationObserver?new MutationObserver(W).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",W,!0),e[h]("DOMAttrModified",W,!0),setInterval(W,999)),j("hashchange",W,!0),["focus","mouseover","click","load","transitionend","animationend","webkitAnimationEnd"].forEach(function(a){b[h](a,W,!0)}),/d$|^c/.test(b.readyState)?ca():(j("load",ca),b[h]("DOMContentLoaded",W),k(ca,2e4)),c.elements.length?(V(),z._lsFlush()):W()},checkElems:W,unveil:ba}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;g>f;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||w(a,c.detail)}),e=function(a,b,d){var e,f=a.parentNode;f&&(d=y(a,f,d),e=v(a,"lazybeforesizes",{width:d,dataAttr:!!b}),e.defaultPrevented||(d=e.detail.width,d&&d!==a._lazysizesWidth&&c(a,f,e,d)))},f=function(){var b,c=a.length;if(c)for(b=0;c>b;b++)e(a[b])},g=C(f);return{_:function(){a=b.getElementsByClassName(d.autosizesClass),j("resize",g)},checkElems:g,updateElem:e}}(),F=function(){F.i||(F.i=!0,E._(),D._())};return c={cfg:d,autoSizer:E,loader:D,init:F,uP:w,aC:s,rC:t,hC:r,fire:v,gW:y,rAF:z}}});(function(window,document){'use strict';if('IntersectionObserver'in window&&'IntersectionObserverEntry'in window&&'intersectionRatio'in window.IntersectionObserverEntry.prototype){if(!('isIntersecting'in window.IntersectionObserverEntry.prototype)){Object.defineProperty(window.IntersectionObserverEntry.prototype,'isIntersecting',{get:function(){return this.intersectionRatio>0;}});}
return;}
var registry=[];function IntersectionObserverEntry(entry){this.time=entry.time;this.target=entry.target;this.rootBounds=entry.rootBounds;this.boundingClientRect=entry.boundingClientRect;this.intersectionRect=entry.intersectionRect||getEmptyRect();this.isIntersecting=!!entry.intersectionRect;var targetRect=this.boundingClientRect;var targetArea=targetRect.width*targetRect.height;var intersectionRect=this.intersectionRect;var intersectionArea=intersectionRect.width*intersectionRect.height;if(targetArea){this.intersectionRatio=intersectionArea/targetArea;}else{this.intersectionRatio=this.isIntersecting?1:0;}}
function IntersectionObserver(callback,opt_options){var options=opt_options||{};if(typeof callback!='function'){throw new Error('callback must be a function');}
if(options.root&&options.root.nodeType!=1){throw new Error('root must be an Element');}
this._checkForIntersections=throttle(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT);this._callback=callback;this._observationTargets=[];this._queuedEntries=[];this._rootMarginValues=this._parseRootMargin(options.rootMargin);this.thresholds=this._initThresholds(options.threshold);this.root=options.root||null;this.rootMargin=this._rootMarginValues.map(function(margin){return margin.value+margin.unit;}).join(' ');}
IntersectionObserver.prototype.THROTTLE_TIMEOUT=100;IntersectionObserver.prototype.POLL_INTERVAL=null;IntersectionObserver.prototype.USE_MUTATION_OBSERVER=true;IntersectionObserver.prototype.observe=function(target){var isTargetAlreadyObserved=this._observationTargets.some(function(item){return item.element==target;});if(isTargetAlreadyObserved){return;}
if(!(target&&target.nodeType==1)){throw new Error('target must be an Element');}
this._registerInstance();this._observationTargets.push({element:target,entry:null});this._monitorIntersections();this._checkForIntersections();};IntersectionObserver.prototype.unobserve=function(target){this._observationTargets=this._observationTargets.filter(function(item){return item.element!=target;});if(!this._observationTargets.length){this._unmonitorIntersections();this._unregisterInstance();}};IntersectionObserver.prototype.disconnect=function(){this._observationTargets=[];this._unmonitorIntersections();this._unregisterInstance();};IntersectionObserver.prototype.takeRecords=function(){var records=this._queuedEntries.slice();this._queuedEntries=[];return records;};IntersectionObserver.prototype._initThresholds=function(opt_threshold){var threshold=opt_threshold||[0];if(!Array.isArray(threshold))threshold=[threshold];return threshold.sort().filter(function(t,i,a){if(typeof t!='number'||isNaN(t)||t<0||t>1){throw new Error('threshold must be a number between 0 and 1 inclusively');}
return t!==a[i-1];});};IntersectionObserver.prototype._parseRootMargin=function(opt_rootMargin){var marginString=opt_rootMargin||'0px';var margins=marginString.split(/\s+/).map(function(margin){var parts=/^(-?\d*\.?\d+)(px|%)$/.exec(margin);if(!parts){throw new Error('rootMargin must be specified in pixels or percent');}
return{value:parseFloat(parts[1]),unit:parts[2]};});margins[1]=margins[1]||margins[0];margins[2]=margins[2]||margins[0];margins[3]=margins[3]||margins[1];return margins;};IntersectionObserver.prototype._monitorIntersections=function(){if(!this._monitoringIntersections){this._monitoringIntersections=true;if(this.POLL_INTERVAL){this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL);}
else{addEvent(window,'resize',this._checkForIntersections,true);addEvent(document,'scroll',this._checkForIntersections,true);if(this.USE_MUTATION_OBSERVER&&'MutationObserver'in window){this._domObserver=new MutationObserver(this._checkForIntersections);this._domObserver.observe(document,{attributes:true,childList:true,characterData:true,subtree:true});}}}};IntersectionObserver.prototype._unmonitorIntersections=function(){if(this._monitoringIntersections){this._monitoringIntersections=false;clearInterval(this._monitoringInterval);this._monitoringInterval=null;removeEvent(window,'resize',this._checkForIntersections,true);removeEvent(document,'scroll',this._checkForIntersections,true);if(this._domObserver){this._domObserver.disconnect();this._domObserver=null;}}};IntersectionObserver.prototype._checkForIntersections=function(){var rootIsInDom=this._rootIsInDom();var rootRect=rootIsInDom?this._getRootRect():getEmptyRect();this._observationTargets.forEach(function(item){var target=item.element;var targetRect=getBoundingClientRect(target);var rootContainsTarget=this._rootContainsTarget(target);var oldEntry=item.entry;var intersectionRect=rootIsInDom&&rootContainsTarget&&this._computeTargetAndRootIntersection(target,rootRect);var newEntry=item.entry=new IntersectionObserverEntry({time:now(),target:target,boundingClientRect:targetRect,rootBounds:rootRect,intersectionRect:intersectionRect});if(!oldEntry){this._queuedEntries.push(newEntry);}else if(rootIsInDom&&rootContainsTarget){if(this._hasCrossedThreshold(oldEntry,newEntry)){this._queuedEntries.push(newEntry);}}else{if(oldEntry&&oldEntry.isIntersecting){this._queuedEntries.push(newEntry);}}},this);if(this._queuedEntries.length){this._callback(this.takeRecords(),this);}};IntersectionObserver.prototype._computeTargetAndRootIntersection=function(target,rootRect){if(window.getComputedStyle(target).display=='none')return;var targetRect=getBoundingClientRect(target);var intersectionRect=targetRect;var parent=getParentNode(target);var atRoot=false;while(!atRoot){var parentRect=null;var parentComputedStyle=parent.nodeType==1?window.getComputedStyle(parent):{};if(parentComputedStyle.display=='none')return;if(parent==this.root||parent==document){atRoot=true;parentRect=rootRect;}else{if(parent!=document.body&&parent!=document.documentElement&&parentComputedStyle.overflow!='visible'){parentRect=getBoundingClientRect(parent);}}
if(parentRect){intersectionRect=computeRectIntersection(parentRect,intersectionRect);if(!intersectionRect)break;}
parent=getParentNode(parent);}
return intersectionRect;};IntersectionObserver.prototype._getRootRect=function(){var rootRect;if(this.root){rootRect=getBoundingClientRect(this.root);}else{var html=document.documentElement;var body=document.body;rootRect={top:0,left:0,right:html.clientWidth||body.clientWidth,width:html.clientWidth||body.clientWidth,bottom:html.clientHeight||body.clientHeight,height:html.clientHeight||body.clientHeight};}
return this._expandRectByRootMargin(rootRect);};IntersectionObserver.prototype._expandRectByRootMargin=function(rect){var margins=this._rootMarginValues.map(function(margin,i){return margin.unit=='px'?margin.value:margin.value*(i%2?rect.width:rect.height)/100;});var newRect={top:rect.top-margins[0],right:rect.right+margins[1],bottom:rect.bottom+margins[2],left:rect.left-margins[3]};newRect.width=newRect.right-newRect.left;newRect.height=newRect.bottom-newRect.top;return newRect;};IntersectionObserver.prototype._hasCrossedThreshold=function(oldEntry,newEntry){var oldRatio=oldEntry&&oldEntry.isIntersecting?oldEntry.intersectionRatio||0:-1;var newRatio=newEntry.isIntersecting?newEntry.intersectionRatio||0:-1;if(oldRatio===newRatio)return;for(var i=0;i<this.thresholds.length;i++){var threshold=this.thresholds[i];if(threshold==oldRatio||threshold==newRatio||threshold<oldRatio!==threshold<newRatio){return true;}}};IntersectionObserver.prototype._rootIsInDom=function(){return!this.root||containsDeep(document,this.root);};IntersectionObserver.prototype._rootContainsTarget=function(target){return containsDeep(this.root||document,target);};IntersectionObserver.prototype._registerInstance=function(){if(registry.indexOf(this)<0){registry.push(this);}};IntersectionObserver.prototype._unregisterInstance=function(){var index=registry.indexOf(this);if(index!=-1)registry.splice(index,1);};function now(){return window.performance&&performance.now&&performance.now();}
function throttle(fn,timeout){var timer=null;return function(){if(!timer){timer=setTimeout(function(){fn();timer=null;},timeout);}};}
function addEvent(node,event,fn,opt_useCapture){if(typeof node.addEventListener=='function'){node.addEventListener(event,fn,opt_useCapture||false);}
else if(typeof node.attachEvent=='function'){node.attachEvent('on'+event,fn);}}
function removeEvent(node,event,fn,opt_useCapture){if(typeof node.removeEventListener=='function'){node.removeEventListener(event,fn,opt_useCapture||false);}
else if(typeof node.detatchEvent=='function'){node.detatchEvent('on'+event,fn);}}
function computeRectIntersection(rect1,rect2){var top=Math.max(rect1.top,rect2.top);var bottom=Math.min(rect1.bottom,rect2.bottom);var left=Math.max(rect1.left,rect2.left);var right=Math.min(rect1.right,rect2.right);var width=right-left;var height=bottom-top;return(width>=0&&height>=0)&&{top:top,bottom:bottom,left:left,right:right,width:width,height:height};}
function getBoundingClientRect(el){var rect;try{rect=el.getBoundingClientRect();}catch(err){}
if(!rect)return getEmptyRect();if(!(rect.width&&rect.height)){rect={top:rect.top,right:rect.right,bottom:rect.bottom,left:rect.left,width:rect.right-rect.left,height:rect.bottom-rect.top};}
return rect;}
function getEmptyRect(){return{top:0,bottom:0,left:0,right:0,width:0,height:0};}
function containsDeep(parent,child){var node=child;while(node){if(node==parent)return true;node=getParentNode(node);}
return false;}
function getParentNode(node){var parent=node.parentNode;if(parent&&parent.nodeType==11&&parent.host){return parent.host;}
return parent;}
window.IntersectionObserver=IntersectionObserver;window.IntersectionObserverEntry=IntersectionObserverEntry;}(window,document));!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.Countdown=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var defaultOptions={date:"June 7, 2087 15:03:25",refresh:1e3,offset:0,onEnd:function(){return},render:function(date){this.el.innerHTML=date.years+" years, "+date.days+" days, "+this.leadingZeros(date.hours)+" hours, "+this.leadingZeros(date.min)+" min and "+this.leadingZeros(date.sec)+" sec"}};var Countdown=function(el,options){this.el=el;this.options={};this.interval=false;this.mergeOptions=function(options){for(var i in defaultOptions){if(defaultOptions.hasOwnProperty(i)){this.options[i]=typeof options[i]!=="undefined"?options[i]:defaultOptions[i];if(i==="date"&&typeof this.options.date!=="object"){this.options.date=new Date(this.options.date)}if(typeof this.options[i]==="function"){this.options[i]=this.options[i].bind(this)}}}if(typeof this.options.date!=="object"){this.options.date=new Date(this.options.date)}}.bind(this);this.mergeOptions(options);this.getDiffDate=function(){var diff=(this.options.date.getTime()-Date.now()+this.options.offset)/1e3;var dateData={years:0,days:0,hours:0,min:0,sec:0,millisec:0};if(diff<=0){if(this.interval){this.stop();this.options.onEnd()}return dateData}if(diff>=365.25*86400){dateData.years=Math.floor(diff/(365.25*86400));diff-=dateData.years*365.25*86400}if(diff>=86400){dateData.days=Math.floor(diff/86400);diff-=dateData.days*86400}if(diff>=3600){dateData.hours=Math.floor(diff/3600);diff-=dateData.hours*3600}if(diff>=60){dateData.min=Math.floor(diff/60);diff-=dateData.min*60}dateData.sec=Math.round(diff);dateData.millisec=diff%1*1e3;return dateData}.bind(this);this.leadingZeros=function(num,length){length=length||2;num=String(num);if(num.length>length){return num}return(Array(length+1).join("0")+num).substr(-length)};this.update=function(newDate){if(typeof newDate!=="object"){newDate=new Date(newDate)}this.options.date=newDate;this.render();return this}.bind(this);this.stop=function(){if(this.interval){clearInterval(this.interval);this.interval=false}return this}.bind(this);this.render=function(){this.options.render(this.getDiffDate());return this}.bind(this);this.start=function(){if(this.interval){return}this.render();if(this.options.refresh){this.interval=setInterval(this.render,this.options.refresh)}return this}.bind(this);this.updateOffset=function(offset){this.options.offset=offset;return this}.bind(this);this.restart=function(options){this.mergeOptions(options);this.interval=false;this.start();return this}.bind(this);this.start()};module.exports=Countdown},{}],2:[function(require,module,exports){var Countdown=require("./countdown.js");var NAME="countdown";var DATA_ATTR="date";jQuery.fn.countdown=function(options){return $.each(this,function(i,el){var $el=$(el);if(!$el.data(NAME)){if($el.data(DATA_ATTR)){options.date=$el.data(DATA_ATTR)}$el.data(NAME,new Countdown(el,options))}})};module.exports=Countdown},{"./countdown.js":1}]},{},[2])(2)});!function(a,b){"function"==typeof define&&define.amd?define("typeahead.js",["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){var b=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(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},isElement:function(a){return!(!a||1!==a.nodeType)},isJQuery:function(b){return b instanceof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,identity:function(a){return a},clone:function(b){return a.extend(!0,{},b)},getIdGenerator:function(){var a=0;return function(){return a++}},templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c=function(){"use strict";function a(a){var g,h;return h=b.mixin({},f,a),g={css:e(),classes:h,html:c(h),selectors:d(h)},{css:g.css,html:g.html,classes:g.classes,selectors:g.selectors,mixin:function(a){b.mixin(a,g)}}}function c(a){return{wrapper:'<span class="'+a.wrapper+'"></span>',menu:'<div class="'+a.menu+'"></div>'}}function d(a){var c={};return b.each(a,function(a,b){c[b]="."+a}),c}function e(){var a={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 b.isMsie()&&b.mixin(a.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),a}var f={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 a}(),d=function(){"use strict";function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d,e;return d="typeahead:",e={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},b.mixin(c.prototype,{_trigger:function(b,c){var e;return e=a.Event(d+b),(c=c||[]).unshift(e),this.$el.trigger.apply(this.$el,c),e},before:function(a){var b,c;return b=[].slice.call(arguments,1),c=this._trigger("before"+a,b),c.isDefaultPrevented()},trigger:function(a){var b;this._trigger(a,[].slice.call(arguments,1)),(b=e[a])&&this._trigger(b,[].slice.call(arguments,1))}}),c}(),e=function(){"use strict";function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift();)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){var b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift();)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift())&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e()&&j(g);return this}function f(a,b,c){function d(){for(var d,e=0,f=a.length;!d&&f>e;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g(){var a;return a=window.setImmediate?function(a){setImmediate(function(){a()})}:function(a){setTimeout(function(){a()},0)}}function h(a,b){return a.bind?a.bind(b):function(){a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g();return{onSync:c,onAsync:b,off:d,trigger:e}}(),f=function(a){"use strict";function c(a,c,d){for(var e,f=[],g=0,h=a.length;h>g;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(e){function f(b){var c,d,f;return(c=h.exec(b.data))&&(f=a.createElement(e.tagName),e.className&&(f.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),f.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(f,d)),!!c}function g(a,b){for(var c,d=3,e=0;e<a.childNodes.length;e++)c=a.childNodes[e],c.nodeType===d?e+=b(c)?1:0:g(c,b)}var h;e=b.mixin({},d,e),e.node&&e.pattern&&(e.pattern=b.isArray(e.pattern)?e.pattern:[e.pattern],h=c(e.pattern,e.caseSensitive,e.wordsOnly),g(e.node,f))}}(window.document),g=function(){"use strict";function c(c,e){c=c||{},c.input||a.error("input is missing"),e.mixin(this),this.$hint=a(c.hint),this.$input=a(c.input),this.query=this.$input.val(),this.queryWhenFocused=this.hasFocus()?this.query:null,this.$overflowHelper=d(this.$input),this._checkLanguageDirection(),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=b.noop)}function d(b){return a('<pre aria-hidden="true"></pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:b.css("font-family"),fontSize:b.css("font-size"),fontStyle:b.css("font-style"),fontVariant:b.css("font-variant"),fontWeight:b.css("font-weight"),wordSpacing:b.css("word-spacing"),letterSpacing:b.css("letter-spacing"),textIndent:b.css("text-indent"),textRendering:b.css("text-rendering"),textTransform:b.css("text-transform")}).insertAfter(b)}function f(a,b){return c.normalizeQuery(a)===c.normalizeQuery(b)}function g(a){return a.altKey||a.ctrlKey||a.metaKey||a.shiftKey}var h;return h={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},c.normalizeQuery=function(a){return b.toStr(a).replace(/^\s*/g,"").replace(/\s{2,}/g," ")},b.mixin(c.prototype,e,{_onBlur:function(){this.resetInputValue(),this.trigger("blurred")},_onFocus:function(){this.queryWhenFocused=this.query,this.trigger("focused")},_onKeydown:function(a){var b=h[a.which||a.keyCode];this._managePreventDefault(b,a),b&&this._shouldTrigger(b,a)&&this.trigger(b+"Keyed",a)},_onInput:function(){this._setQuery(this.getInputValue()),this.clearHintIfInvalid(),this._checkLanguageDirection()},_managePreventDefault:function(a,b){var c;switch(a){case"up":case"down":c=!g(b);break;default:c=!1}c&&b.preventDefault()},_shouldTrigger:function(a,b){var c;switch(a){case"tab":c=!g(b);break;default:c=!0}return c},_checkLanguageDirection:function(){var a=(this.$input.css("direction")||"ltr").toLowerCase();this.dir!==a&&(this.dir=a,this.$hint.attr("dir",a),this.trigger("langDirChanged",a))},_setQuery:function(a,b){var c,d;c=f(a,this.query),d=c?this.query.length!==a.length:!1,this.query=a,b||c?!b&&d&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},bind:function(){var a,c,d,e,f=this;return a=b.bind(this._onBlur,this),c=b.bind(this._onFocus,this),d=b.bind(this._onKeydown,this),e=b.bind(this._onInput,this),this.$input.on("blur.tt",a).on("focus.tt",c).on("keydown.tt",d),!b.isMsie()||b.isMsie()>9?this.$input.on("input.tt",e):this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(a){h[a.which||a.keyCode]||b.defer(b.bind(f._onInput,f,a))}),this},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getLangDir:function(){return this.dir},getQuery:function(){return this.query||""},setQuery:function(a,b){this.setInputValue(a),this._setQuery(a,b)},hasQueryChangedSinceLastFocus:function(){return this.query!==this.queryWhenFocused},getInputValue:function(){return this.$input.val()},setInputValue:function(a){this.$input.val(a),this.clearHintIfInvalid(),this._checkLanguageDirection()},resetInputValue:function(){this.setInputValue(this.query)},getHint:function(){return this.$hint.val()},setHint:function(a){this.$hint.val(a)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var a,b,c,d;a=this.getInputValue(),b=this.getHint(),c=a!==b&&0===b.indexOf(a),d=""!==a&&c&&!this.hasOverflow(),!d&&this.clearHint()},hasFocus:function(){return this.$input.is(":focus")},hasOverflow:function(){var a=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=a},isCursorAtEnd:function(){var a,c,d;return a=this.$input.val().length,c=this.$input[0].selectionStart,b.isNumber(c)?c===a:document.selection?(d=document.selection.createRange(),d.moveStart("character",-a),a===d.text.length):!0},destroy:function(){this.$hint.off(".tt"),this.$input.off(".tt"),this.$overflowHelper.remove(),this.$hint=this.$input=this.$overflowHelper=a("<div>")}}),c}(),h=function(){"use strict";function c(c,e){c=c||{},c.templates=c.templates||{},c.templates.notFound=c.templates.notFound||c.templates.empty,c.source||a.error("missing source"),c.node||a.error("missing node"),c.name&&!h(c.name)&&a.error("invalid dataset name: "+c.name),e.mixin(this),this.highlight=!!c.highlight,this.name=c.name||j(),this.limit=c.limit||5,this.displayFn=d(c.display||c.displayKey),this.templates=g(c.templates,this.displayFn),this.source=c.source.__ttAdapter?c.source.__ttAdapter():c.source,this.async=b.isUndefined(c.async)?this.source.length>2:!!c.async,this._resetLastSuggestion(),this.$el=a(c.node).addClass(this.classes.dataset).addClass(this.classes.dataset+"-"+this.name)}function d(a){function c(b){return b[a]}return a=a||b.stringify,b.isFunction(a)?a:c}function g(c,d){function e(b){return a("<div>").text(d(b))}return{notFound:c.notFound&&b.templatify(c.notFound),pending:c.pending&&b.templatify(c.pending),header:c.header&&b.templatify(c.header),footer:c.footer&&b.templatify(c.footer),suggestion:c.suggestion||e}}function h(a){return/^[_a-zA-Z0-9-]+$/.test(a)}var i,j;return i={val:"tt-selectable-display",obj:"tt-selectable-object"},j=b.getIdGenerator(),c.extractData=function(b){var c=a(b);return c.data(i.obj)?{val:c.data(i.val)||"",obj:c.data(i.obj)||null}:null},b.mixin(c.prototype,e,{_overwrite:function(a,b){b=b||[],b.length?this._renderSuggestions(a,b):this.async&&this.templates.pending?this._renderPending(a):!this.async&&this.templates.notFound?this._renderNotFound(a):this._empty(),this.trigger("rendered",this.name,b,!1)},_append:function(a,b){b=b||[],b.length&&this.$lastSuggestion.length?this._appendSuggestions(a,b):b.length?this._renderSuggestions(a,b):!this.$lastSuggestion.length&&this.templates.notFound&&this._renderNotFound(a),this.trigger("rendered",this.name,b,!0)},_renderSuggestions:function(a,b){var c;c=this._getSuggestionsFragment(a,b),this.$lastSuggestion=c.children().last(),this.$el.html(c).prepend(this._getHeader(a,b)).append(this._getFooter(a,b))},_appendSuggestions:function(a,b){var c,d;c=this._getSuggestionsFragment(a,b),d=c.children().last(),this.$lastSuggestion.after(c),this.$lastSuggestion=d},_renderPending:function(a){var b=this.templates.pending;this._resetLastSuggestion(),b&&this.$el.html(b({query:a,dataset:this.name}))},_renderNotFound:function(a){var b=this.templates.notFound;this._resetLastSuggestion(),b&&this.$el.html(b({query:a,dataset:this.name}))},_empty:function(){this.$el.empty(),this._resetLastSuggestion()},_getSuggestionsFragment:function(c,d){var e,g=this;return e=document.createDocumentFragment(),b.each(d,function(b){var d,f;f=g._injectQuery(c,b),d=a(g.templates.suggestion(f)).data(i.obj,b).data(i.val,g.displayFn(b)).addClass(g.classes.suggestion+" "+g.classes.selectable),e.appendChild(d[0])}),this.highlight&&f({className:this.classes.highlight,node:e,pattern:c}),a(e)},_getFooter:function(a,b){return this.templates.footer?this.templates.footer({query:a,suggestions:b,dataset:this.name}):null},_getHeader:function(a,b){return this.templates.header?this.templates.header({query:a,suggestions:b,dataset:this.name}):null},_resetLastSuggestion:function(){this.$lastSuggestion=a()},_injectQuery:function(a,c){return b.isObject(c)?b.mixin({_query:a},c):c},update:function(b){function c(a){g||(g=!0,a=(a||[]).slice(0,e.limit),h=a.length,e._overwrite(b,a),h<e.limit&&e.async&&e.trigger("asyncRequested",b))}function d(c){c=c||[],!f&&h<e.limit&&(e.cancel=a.noop,h+=c.length,e._append(b,c.slice(0,e.limit-h)),e.async&&e.trigger("asyncReceived",b))}var e=this,f=!1,g=!1,h=0;this.cancel(),this.cancel=function(){f=!0,e.cancel=a.noop,e.async&&e.trigger("asyncCanceled",b)},this.source(b,c,d),!g&&c([])},cancel:a.noop,clear:function(){this._empty(),this.cancel(),this.trigger("cleared")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=a("<div>")}}),c}(),i=function(){"use strict";function c(c,d){function e(b){var c=f.$node.find(b.node).first();return b.node=c.length?c:a("<div>").appendTo(f.$node),new h(b,d)}var f=this;c=c||{},c.node||a.error("node is required"),d.mixin(this),this.$node=a(c.node),this.query=null,this.datasets=b.map(c.datasets,e)}return b.mixin(c.prototype,e,{_onSelectableClick:function(b){this.trigger("selectableClicked",a(b.currentTarget))},_onRendered:function(a,b,c,d){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty()),this.trigger("datasetRendered",b,c,d)},_onCleared:function(){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty()),this.trigger("datasetCleared")},_propagate:function(){this.trigger.apply(this,arguments)},_allDatasetsEmpty:function(){function a(a){return a.isEmpty()}return b.every(this.datasets,a)},_getSelectables:function(){return this.$node.find(this.selectors.selectable)},_removeCursor:function(){var a=this.getActiveSelectable();a&&a.removeClass(this.classes.cursor)},_ensureVisible:function(a){var b,c,d,e;b=a.position().top,c=b+a.outerHeight(!0),d=this.$node.scrollTop(),e=this.$node.height()+parseInt(this.$node.css("paddingTop"),10)+parseInt(this.$node.css("paddingBottom"),10),0>b?this.$node.scrollTop(d+b):c>e&&this.$node.scrollTop(d+(c-e))},bind:function(){var a,c=this;return a=b.bind(this._onSelectableClick,this),this.$node.on("click.tt",this.selectors.selectable,a),b.each(this.datasets,function(a){a.onSync("asyncRequested",c._propagate,c).onSync("asyncCanceled",c._propagate,c).onSync("asyncReceived",c._propagate,c).onSync("rendered",c._onRendered,c).onSync("cleared",c._onCleared,c)}),this},isOpen:function(){return this.$node.hasClass(this.classes.open)},open:function(){this.$node.addClass(this.classes.open)},close:function(){this.$node.removeClass(this.classes.open),this._removeCursor()},setLanguageDirection:function(a){this.$node.attr("dir",a)},selectableRelativeToCursor:function(a){var b,c,d,e;return c=this.getActiveSelectable(),b=this._getSelectables(),d=c?b.index(c):-1,e=d+a,e=(e+1)%(b.length+1)-1,e=-1>e?b.length-1:e,-1===e?null:b.eq(e)},setCursor:function(a){this._removeCursor(),(a=a&&a.first())&&(a.addClass(this.classes.cursor),this._ensureVisible(a))},getSelectableData:function(a){return a&&a.length?h.extractData(a):null},getActiveSelectable:function(){var a=this._getSelectables().filter(this.selectors.cursor).first();return a.length?a:null},getTopSelectable:function(){var a=this._getSelectables().first();return a.length?a:null},update:function(a){function c(b){b.update(a)}var d=a!==this.query;return d&&(this.query=a,b.each(this.datasets,c)),d},empty:function(){function a(a){a.clear()}b.each(this.datasets,a),this.query=null,this.$node.addClass(this.classes.empty)},destroy:function(){function c(a){a.destroy()}this.$node.off(".tt"),this.$node=a("<div>"),b.each(this.datasets,c)}}),c}(),j=function(){"use strict";function a(){i.apply(this,[].slice.call(arguments,0))}var c=i.prototype;return b.mixin(a.prototype,i.prototype,{open:function(){return!this._allDatasetsEmpty()&&this._show(),c.open.apply(this,[].slice.call(arguments,0))},close:function(){return this._hide(),c.close.apply(this,[].slice.call(arguments,0))},_onRendered:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),c._onRendered.apply(this,[].slice.call(arguments,0))},_onCleared:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),c._onCleared.apply(this,[].slice.call(arguments,0))},setLanguageDirection:function(a){return this.$node.css("ltr"===a?this.css.ltr:this.css.rtl),c.setLanguageDirection.apply(this,[].slice.call(arguments,0))},_hide:function(){this.$node.hide()},_show:function(){this.$node.css("display","block")}}),a}(),k=function(){"use strict";function c(c,e){var f,g,h,i,j,k,l,m,n,o,p;c=c||{},c.input||a.error("missing input"),c.menu||a.error("missing menu"),c.eventBus||a.error("missing event bus"),e.mixin(this),this.eventBus=c.eventBus,this.minLength=b.isNumber(c.minLength)?c.minLength:1,this.input=c.input,this.menu=c.menu,this.enabled=!0,this.active=!1,this.input.hasFocus()&&this.activate(),this.dir=this.input.getLangDir(),this._hacks(),this.menu.bind().onSync("selectableClicked",this._onSelectableClicked,this).onSync("asyncRequested",this._onAsyncRequested,this).onSync("asyncCanceled",this._onAsyncCanceled,this).onSync("asyncReceived",this._onAsyncReceived,this).onSync("datasetRendered",this._onDatasetRendered,this).onSync("datasetCleared",this._onDatasetCleared,this),f=d(this,"activate","open","_onFocused"),g=d(this,"deactivate","_onBlurred"),h=d(this,"isActive","isOpen","_onEnterKeyed"),i=d(this,"isActive","isOpen","_onTabKeyed"),j=d(this,"isActive","_onEscKeyed"),k=d(this,"isActive","open","_onUpKeyed"),l=d(this,"isActive","open","_onDownKeyed"),m=d(this,"isActive","isOpen","_onLeftKeyed"),n=d(this,"isActive","isOpen","_onRightKeyed"),o=d(this,"_openIfActive","_onQueryChanged"),p=d(this,"_openIfActive","_onWhitespaceChanged"),this.input.bind().onSync("focused",f,this).onSync("blurred",g,this).onSync("enterKeyed",h,this).onSync("tabKeyed",i,this).onSync("escKeyed",j,this).onSync("upKeyed",k,this).onSync("downKeyed",l,this).onSync("leftKeyed",m,this).onSync("rightKeyed",n,this).onSync("queryChanged",o,this).onSync("whitespaceChanged",p,this).onSync("langDirChanged",this._onLangDirChanged,this)}function d(a){var c=[].slice.call(arguments,1);return function(){var d=[].slice.call(arguments);b.each(c,function(b){return a[b].apply(a,d)})}}return b.mixin(c.prototype,{_hacks:function(){var c,d;c=this.input.$input||a("<div>"),d=this.menu.$node||a("<div>"),c.on("blur.tt",function(a){var e,f,g;e=document.activeElement,f=d.is(e),g=d.has(e).length>0,b.isMsie()&&(f||g)&&(a.preventDefault(),a.stopImmediatePropagation(),b.defer(function(){c.focus()}))}),d.on("mousedown.tt",function(a){a.preventDefault()})},_onSelectableClicked:function(a,b){this.select(b)},_onDatasetCleared:function(){this._updateHint()},_onDatasetRendered:function(a,b,c,d){this._updateHint(),this.eventBus.trigger("render",c,d,b)},_onAsyncRequested:function(a,b,c){this.eventBus.trigger("asyncrequest",c,b)},_onAsyncCanceled:function(a,b,c){this.eventBus.trigger("asynccancel",c,b)},_onAsyncReceived:function(a,b,c){this.eventBus.trigger("asyncreceive",c,b)},_onFocused:function(){this._minLengthMet()&&this.menu.update(this.input.getQuery())},_onBlurred:function(){this.input.hasQueryChangedSinceLastFocus()&&this.eventBus.trigger("change",this.input.getQuery())},_onEnterKeyed:function(a,b){var c;(c=this.menu.getActiveSelectable())&&this.select(c)&&b.preventDefault()},_onTabKeyed:function(a,b){var c;(c=this.menu.getActiveSelectable())?this.select(c)&&b.preventDefault():(c=this.menu.getTopSelectable())&&this.autocomplete(c)&&b.preventDefault()},_onEscKeyed:function(){this.close()},_onUpKeyed:function(){this.moveCursor(-1)},_onDownKeyed:function(){this.moveCursor(1)},_onLeftKeyed:function(){"rtl"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onRightKeyed:function(){"ltr"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onQueryChanged:function(a,b){this._minLengthMet(b)?this.menu.update(b):this.menu.empty()},_onWhitespaceChanged:function(){this._updateHint()},_onLangDirChanged:function(a,b){this.dir!==b&&(this.dir=b,this.menu.setLanguageDirection(b))},_openIfActive:function(){this.isActive()&&this.open()},_minLengthMet:function(a){return a=b.isString(a)?a:this.input.getQuery()||"",a.length>=this.minLength},_updateHint:function(){var a,c,d,e,f,h,i;a=this.menu.getTopSelectable(),c=this.menu.getSelectableData(a),d=this.input.getInputValue(),!c||b.isBlankString(d)||this.input.hasOverflow()?this.input.clearHint():(e=g.normalizeQuery(d),f=b.escapeRegExChars(e),h=new RegExp("^(?:"+f+")(.+$)","i"),i=h.exec(c.val),i&&this.input.setHint(d+i[1]))},isEnabled:function(){return this.enabled},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},isActive:function(){return this.active},activate:function(){return this.isActive()?!0:!this.isEnabled()||this.eventBus.before("active")?!1:(this.active=!0,this.eventBus.trigger("active"),!0)},deactivate:function(){return this.isActive()?this.eventBus.before("idle")?!1:(this.active=!1,this.close(),this.eventBus.trigger("idle"),!0):!0},isOpen:function(){return this.menu.isOpen()},open:function(){return this.isOpen()||this.eventBus.before("open")||(this.menu.open(),this._updateHint(),this.eventBus.trigger("open")),this.isOpen()},close:function(){return this.isOpen()&&!this.eventBus.before("close")&&(this.menu.close(),this.input.clearHint(),this.input.resetInputValue(),this.eventBus.trigger("close")),!this.isOpen()},setVal:function(a){this.input.setQuery(b.toStr(a))},getVal:function(){return this.input.getQuery()},select:function(a){var b=this.menu.getSelectableData(a);return b&&!this.eventBus.before("select",b.obj)?(this.input.setQuery(b.val,!0),this.eventBus.trigger("select",b.obj),this.close(),!0):!1},autocomplete:function(a){var b,c,d;return b=this.input.getQuery(),c=this.menu.getSelectableData(a),d=c&&b!==c.val,d&&!this.eventBus.before("autocomplete",c.obj)?(this.input.setQuery(c.val),this.eventBus.trigger("autocomplete",c.obj),!0):!1},moveCursor:function(a){var b,c,d,e,f;return b=this.input.getQuery(),c=this.menu.selectableRelativeToCursor(a),d=this.menu.getSelectableData(c),e=d?d.obj:null,f=this._minLengthMet()&&this.menu.update(b),f||this.eventBus.before("cursorchange",e)?!1:(this.menu.setCursor(c),d?this.input.setInputValue(d.val):(this.input.resetInputValue(),this._updateHint()),this.eventBus.trigger("cursorchange",e),!0)},destroy:function(){this.input.destroy(),this.menu.destroy()}}),c}();!function(){"use strict";function e(b,c){b.each(function(){var b,d=a(this);(b=d.data(p.typeahead))&&c(b,d)})}function f(a,b){return a.clone().addClass(b.classes.hint).removeData().css(b.css.hint).css(l(a)).prop("readonly",!0).removeAttr("id name placeholder required").attr({autocomplete:"off",spellcheck:"false",tabindex:-1})}function h(a,b){a.data(p.attrs,{dir:a.attr("dir"),autocomplete:a.attr("autocomplete"),spellcheck:a.attr("spellcheck"),style:a.attr("style")}),a.addClass(b.classes.input).attr({autocomplete:"off",spellcheck:!1});try{!a.attr("dir")&&a.attr("dir","auto")}catch(c){}return a}function l(a){return{backgroundAttachment:a.css("background-attachment"),backgroundClip:a.css("background-clip"),backgroundColor:a.css("background-color"),backgroundImage:a.css("background-image"),backgroundOrigin:a.css("background-origin"),backgroundPosition:a.css("background-position"),backgroundRepeat:a.css("background-repeat"),backgroundSize:a.css("background-size")}}function m(a){var c,d;c=a.data(p.www),d=a.parent().filter(c.selectors.wrapper),b.each(a.data(p.attrs),function(c,d){b.isUndefined(c)?a.removeAttr(d):a.attr(d,c)}),a.removeData(p.typeahead).removeData(p.www).removeData(p.attr).removeClass(c.classes.input),d.length&&(a.detach().insertAfter(d),d.remove())}function n(c){var d,e;return d=b.isJQuery(c)||b.isElement(c),e=d?a(c).first():[],e.length?e:null}var o,p,q;o=a.fn.typeahead,p={www:"tt-www",attrs:"tt-attrs",typeahead:"tt-typeahead"},q={initialize:function(e,l){function m(){var c,m,q,r,s,t,u,v,w,x,y;b.each(l,function(a){a.highlight=!!e.highlight}),c=a(this),m=a(o.html.wrapper),q=n(e.hint),r=n(e.menu),s=e.hint!==!1&&!q,t=e.menu!==!1&&!r,s&&(q=f(c,o)),t&&(r=a(o.html.menu).css(o.css.menu)),q&&q.val(""),c=h(c,o),(s||t)&&(m.css(o.css.wrapper),c.css(s?o.css.input:o.css.inputWithNoHint),c.wrap(m).parent().prepend(s?q:null).append(t?r:null)),y=t?j:i,u=new d({el:c}),v=new g({hint:q,input:c},o),w=new y({node:r,datasets:l},o),x=new k({input:v,menu:w,eventBus:u,minLength:e.minLength},o),c.data(p.www,o),c.data(p.typeahead,x)}var o;return l=b.isArray(l)?l:[].slice.call(arguments,1),e=e||{},o=c(e.classNames),this.each(m)},isEnabled:function(){var a;return e(this.first(),function(b){a=b.isEnabled()}),a},enable:function(){return e(this,function(a){a.enable()}),this},disable:function(){return e(this,function(a){a.disable()}),this},isActive:function(){var a;return e(this.first(),function(b){a=b.isActive()}),a},activate:function(){return e(this,function(a){a.activate()}),this},deactivate:function(){return e(this,function(a){a.deactivate()}),this},isOpen:function(){var a;return e(this.first(),function(b){a=b.isOpen()}),a},open:function(){return e(this,function(a){a.open()}),this},close:function(){return e(this,function(a){a.close()}),this},select:function(b){var c=!1,d=a(b);return e(this.first(),function(a){c=a.select(d)}),c},autocomplete:function(b){var c=!1,d=a(b);return e(this.first(),function(a){c=a.autocomplete(d)}),c},moveCursor:function(a){var b=!1;return e(this.first(),function(c){b=c.moveCursor(a)}),b},val:function(a){var b;return arguments.length?(e(this,function(b){b.setVal(a)}),this):(e(this.first(),function(a){b=a.getVal()}),b)},destroy:function(){return e(this,function(a,b){m(b),a.destroy()}),this}},a.fn.typeahead=function(a){return q[a]?q[a].apply(this,[].slice.call(arguments,1)):q.initialize.apply(this,arguments)},a.fn.typeahead.noConflict=function(){return a.fn.typeahead=o,this}}()});(function(window,factory){if(typeof module=='object'&&module.exports){module.exports=factory(window,require('jquery'),);}else{window.jQueryBridget=factory(window,window.jQuery,);}}(window,function factory(window,jQuery){let console=window.console;let logError=typeof console=='undefined'?function(){}:function(message){console.error(message);};function jQueryBridget(namespace,PluginClass,$){$=$||jQuery||window.jQuery;if(!$){return;}
if(!PluginClass.prototype.option){PluginClass.prototype.option=function(opts){if(!opts)return;this.options=Object.assign(this.options||{},opts);};}
$.fn[namespace]=function(arg0,...args){if(typeof arg0=='string'){return methodCall(this,arg0,args);}
plainCall(this,arg0);return this;};function methodCall($elems,methodName,args){let returnValue;let pluginMethodStr=`$().${namespace}("${methodName}")`;$elems.each(function(i,elem){let instance=$.data(elem,namespace);if(!instance){logError(`${namespace}not initialized.`+`Cannot call method ${pluginMethodStr}`);return;}
let method=instance[methodName];if(!method||methodName.charAt(0)=='_'){logError(`${pluginMethodStr}is not a valid method`);return;}
let value=method.apply(instance,args);returnValue=returnValue===undefined?value:returnValue;});return returnValue!==undefined?returnValue:$elems;}
function plainCall($elems,options){$elems.each(function(i,elem){let instance=$.data(elem,namespace);if(instance){instance.option(options);instance._init();}else{instance=new PluginClass(elem,options);$.data(elem,namespace,instance);}});}}
return jQueryBridget;}));(function(global,factory){if(typeof module=='object'&&module.exports){module.exports=factory();}else{global.EvEmitter=factory();}}(typeof window!='undefined'?window:this,function(){function EvEmitter(){}
let proto=EvEmitter.prototype;proto.on=function(eventName,listener){if(!eventName||!listener)return this;let events=this._events=this._events||{};let listeners=events[eventName]=events[eventName]||[];if(!listeners.includes(listener)){listeners.push(listener);}
return this;};proto.once=function(eventName,listener){if(!eventName||!listener)return this;this.on(eventName,listener);let onceEvents=this._onceEvents=this._onceEvents||{};let onceListeners=onceEvents[eventName]=onceEvents[eventName]||{};onceListeners[listener]=true;return this;};proto.off=function(eventName,listener){let listeners=this._events&&this._events[eventName];if(!listeners||!listeners.length)return this;let index=listeners.indexOf(listener);if(index!=-1){listeners.splice(index,1);}
return this;};proto.emitEvent=function(eventName,args){let listeners=this._events&&this._events[eventName];if(!listeners||!listeners.length)return this;listeners=listeners.slice(0);args=args||[];let onceListeners=this._onceEvents&&this._onceEvents[eventName];for(let listener of listeners){let isOnce=onceListeners&&onceListeners[listener];if(isOnce){this.off(eventName,listener);delete onceListeners[listener];}
listener.apply(this,args);}
return this;};proto.allOff=function(){delete this._events;delete this._onceEvents;return this;};return EvEmitter;}));(function(global,factory){if(typeof module=='object'&&module.exports){module.exports=factory(global);}else{global.fizzyUIUtils=factory(global);}}(this,function factory(global){let utils={};utils.extend=function(a,b){return Object.assign(a,b);};utils.modulo=function(num,div){return((num%div)+div)%div;};utils.makeArray=function(obj){if(Array.isArray(obj))return obj;if(obj===null||obj===undefined)return[];let isArrayLike=typeof obj=='object'&&typeof obj.length=='number';if(isArrayLike)return[...obj];return[obj];};utils.removeFrom=function(ary,obj){let index=ary.indexOf(obj);if(index!=-1){ary.splice(index,1);}};utils.getParent=function(elem,selector){while(elem.parentNode&&elem!=document.body){elem=elem.parentNode;if(elem.matches(selector))return elem;}};utils.getQueryElement=function(elem){if(typeof elem=='string'){return document.querySelector(elem);}
return elem;};utils.handleEvent=function(event){let method='on'+event.type;if(this[method]){this[method](event);}};utils.filterFindElements=function(elems,selector){elems=utils.makeArray(elems);return elems.filter((elem)=>elem instanceof HTMLElement).reduce((ffElems,elem)=>{if(!selector){ffElems.push(elem);return ffElems;}
if(elem.matches(selector)){ffElems.push(elem);}
let childElems=elem.querySelectorAll(selector);ffElems=ffElems.concat(...childElems);return ffElems;},[]);};utils.debounceMethod=function(_class,methodName,threshold){threshold=threshold||100;let method=_class.prototype[methodName];let timeoutName=methodName+'Timeout';_class.prototype[methodName]=function(){clearTimeout(this[timeoutName]);let args=arguments;this[timeoutName]=setTimeout(()=>{method.apply(this,args);delete this[timeoutName];},threshold);};};utils.docReady=function(onDocReady){let readyState=document.readyState;if(readyState=='complete'||readyState=='interactive'){setTimeout(onDocReady);}else{document.addEventListener('DOMContentLoaded',onDocReady);}};utils.toDashed=function(str){return str.replace(/(.)([A-Z])/g,function(match,$1,$2){return $1+'-'+$2;}).toLowerCase();};let console=global.console;utils.htmlInit=function(WidgetClass,namespace){utils.docReady(function(){let params=(new URL(document.location)).searchParams;if(params.get("page")!=null){$('.previous-wrapper').show();setTimeout(function(){$('.go-previous').click(function(){InfiniteScroll.prototype.loadPreviousPage()})},100)}
let dashedNamespace=utils.toDashed(namespace);let dataAttr='data-'+dashedNamespace;let dataAttrElems=document.querySelectorAll(`[${dataAttr}]`);let jQuery=global.jQuery;[...dataAttrElems].forEach((elem)=>{let attr=elem.getAttribute(dataAttr);let options;try{options=attr&&JSON.parse(attr);}catch(error){if(console){console.error(`Error parsing ${dataAttr}on ${elem.className}:${error}`);}
return;}
let instance=new WidgetClass(elem,options);if(jQuery){jQuery.data(elem,namespace,instance);}});});};return utils;}));(function(window,factory){if(typeof module=='object'&&module.exports){module.exports=factory(window,require('ev-emitter'),require('fizzy-ui-utils'),);}else{window.InfiniteScroll=factory(window,window.EvEmitter,window.fizzyUIUtils,);}}(window,function factory(window,EvEmitter,utils){let jQuery=window.jQuery;let instances={};function InfiniteScroll(element,options){let queryElem=utils.getQueryElement(element);if(!queryElem){console.error('Bad element for InfiniteScroll: '+(queryElem||element));return;}
element=queryElem;if(element.infiniteScrollGUID){let instance=instances[element.infiniteScrollGUID];instance.option(options);return instance;}
this.element=element;this.options={...InfiniteScroll.defaults};this.option(options);if(jQuery){this.$element=jQuery(this.element);}
this.create();}
InfiniteScroll.defaults={};InfiniteScroll.create={};InfiniteScroll.destroy={};let proto=InfiniteScroll.prototype;Object.assign(proto,EvEmitter.prototype);let GUID=0;proto.create=function(){let id=this.guid=++GUID;this.element.infiniteScrollGUID=id;instances[id]=this;this.pageIndex=1;this.loadCount=0;this.updateGetPath();let hasPath=this.getPath&&this.getPath();if(!hasPath){console.error('Disabling InfiniteScroll');return;}
this.updateGetAbsolutePath();this.log('initialized',[this.element.className]);this.callOnInit();for(let method in InfiniteScroll.create){InfiniteScroll.create[method].call(this);}};proto.option=function(opts){Object.assign(this.options,opts);};proto.callOnInit=function(){let onInit=this.options.onInit;if(onInit){onInit.call(this,this);}};proto.dispatchEvent=function(type,event,args){this.log(type,args);let emitArgs=event?[event].concat(args):args;this.emitEvent(type,emitArgs);if(!jQuery||!this.$element){return;}
type+='.infiniteScroll';let $event=type;if(event){let jQEvent=jQuery.Event(event);jQEvent.type=type;$event=jQEvent;}
this.$element.trigger($event,args);};let loggers={initialized:(className)=>`on ${className}`,request:(path)=>`URL:${path}`,load:(response,path)=>`${response.title||''}.URL:${path}`,error:(error,path)=>`${error}.URL:${path}`,append:(response,path,items)=>`${items.length}items.URL:${path}`,last:(response,path)=>`URL:${path}`,history:(title,path)=>`URL:${path}`,pageIndex:function(index,origin){return`current page determined to be:${index}from ${origin}`;},};proto.log=function(type,args){if(!this.options.debug)return;let message=`[InfiniteScroll]${type}`;let logger=loggers[type];if(logger)message+='. '+logger.apply(this,args);console.log(message);};proto.updateMeasurements=function(){this.windowHeight=window.innerHeight;let rect=this.element.getBoundingClientRect();this.top=rect.top+window.scrollY;};proto.updateScroller=function(){let elementScroll=this.options.elementScroll;if(!elementScroll){this.scroller=window;return;}
this.scroller=elementScroll===true?this.element:utils.getQueryElement(elementScroll);if(!this.scroller){throw new Error(`Unable to find elementScroll:${elementScroll}`);}};proto.updateGetPath=function(){let optPath=this.options.path;if(!optPath){console.error(`InfiniteScroll path option required.Set as:${optPath}`);return;}
let type=typeof optPath;if(type=='function'){this.getPath=optPath;return;}
let templateMatch=type=='string'&&optPath.match('{{#}}');if(templateMatch){this.updateGetPathTemplate(optPath);return;}
this.updateGetPathSelector(optPath);};proto.updateGetPathTemplate=function(optPath){this.getPath=()=>{let nextIndex=this.pageIndex+1;return optPath.replace('{{#}}',nextIndex);};let regexString=optPath.replace(/(\\\?|\?)/,'\\?').replace('{{#}}','(\\d\\d?\\d?)');let templateRe=new RegExp(regexString);let match=location.href.match(templateRe);if(match){this.pageIndex=parseInt(match[1],10);this.log('pageIndex',[this.pageIndex,'template string']);}};let pathRegexes=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/,];let getPathParts=InfiniteScroll.getPathParts=function(href){if(!href)return;for(let regex of pathRegexes){let match=href.match(regex);if(match){let[,begin,index,end]=match;return{begin,index,end};}}};proto.updateGetPathSelector=function(optPath){let hrefElem=document.querySelector(optPath);if(!hrefElem){console.error(`Bad InfiniteScroll path option.Next link not found:${optPath}`);return;}
let href=hrefElem.getAttribute('href');let pathParts=getPathParts(href);if(!pathParts){console.error(`InfiniteScroll unable to parse next link href:${href}`);return;}
let{begin,index,end}=pathParts;this.isPathSelector=true;this.getPath=()=>begin+(this.pageIndex+1)+end;this.pageIndex=parseInt(index,10)-1;this.log('pageIndex',[this.pageIndex,'next link']);};proto.updateGetAbsolutePath=function(){let path=this.getPath();let isAbsolute=path.match(/^http/)||path.match(/^\//);if(isAbsolute){this.getAbsolutePath=this.getPath;return;}
let{pathname}=location;let isQuery=path.match(/^\?/);let directory=pathname.substring(0,pathname.lastIndexOf('/'));let pathStart=isQuery?pathname:directory+'/';this.getAbsolutePath=()=>pathStart+this.getPath();};InfiniteScroll.create.hideNav=function(){let nav=utils.getQueryElement(this.options.hideNav);if(!nav)return;nav.style.display='none';this.nav=nav;};InfiniteScroll.destroy.hideNav=function(){if(this.nav)this.nav.style.display='';};proto.destroy=function(){this.allOff();for(let method in InfiniteScroll.destroy){InfiniteScroll.destroy[method].call(this);}
delete this.element.infiniteScrollGUID;delete instances[this.guid];if(jQuery&&this.$element){jQuery.removeData(this.element,'infiniteScroll');}};InfiniteScroll.throttle=function(fn,threshold){threshold=threshold||200;let last,timeout;return function(){let now=+new Date();let args=arguments;let trigger=()=>{last=now;fn.apply(this,args);};if(last&&now<last+threshold){clearTimeout(timeout);timeout=setTimeout(trigger,threshold);}else{trigger();}};};InfiniteScroll.data=function(elem){elem=utils.getQueryElement(elem);let id=elem&&elem.infiniteScrollGUID;return id&&instances[id];};InfiniteScroll.setJQuery=function(jqry){jQuery=jqry;};utils.htmlInit(InfiniteScroll,'infinite-scroll');proto._init=function(){};let{jQueryBridget}=window;if(jQuery&&jQueryBridget){jQueryBridget('infiniteScroll',InfiniteScroll,jQuery);}
return InfiniteScroll;}));(function(window,factory){if(typeof module=='object'&&module.exports){module.exports=factory(window,require('./core'),);}else{factory(window,window.InfiniteScroll,);}}(window,function factory(window,InfiniteScroll){let proto=InfiniteScroll.prototype;Object.assign(InfiniteScroll.defaults,{loadOnScroll:true,checkLastPage:true,responseBody:'text',domParseResponse:true,});InfiniteScroll.create.pageLoad=function(){this.canLoad=true;this.on('scrollThreshold',this.onScrollThresholdLoad);this.on('load',this.checkLastPage);if(this.options.outlayer){this.on('append',this.onAppendOutlayer);}};proto.onScrollThresholdLoad=function(){if(this.options.loadOnScroll)this.loadNextPage();};let domParser=new DOMParser();proto.loadNextPage=function(){console.log('LNP')
if(this.isLoading||!this.canLoad)return;let{responseBody,domParseResponse,fetchOptions}=this.options;console.log('resbody',responseBody)
let path=this.getAbsolutePath();let lastPath=new URL(window.location.href);var editedPath=new URL(path);console.log('PATHHH',path)
editedPath.pathname=lastPath.pathname;path=editedPath.href;this.isLoading=true;if(typeof fetchOptions=='function')fetchOptions=fetchOptions();let fetchPromise=fetch(path,fetchOptions).then((response)=>{if(!response.ok){let error=new Error(response.statusText);this.onPageError(error,path,response);return{response};}
return response[responseBody]().then((body)=>{let canDomParse=responseBody=='text'&&domParseResponse;if(canDomParse){body=domParser.parseFromString(body,'text/html');}
if(response.status==204){this.lastPageReached(body,path);return{body,response};}else{return this.onPageLoad(body,path,response);}});}).catch((error)=>{this.onPageError(error,path);});this.dispatchEvent('request',null,[path,fetchPromise]);return fetchPromise;};proto.loadPreviousPage=function(){let previousPath=new URL(location.href);let previousParams=new URLSearchParams(previousPath.search);if(previousParams.get('page')!=null){var pageIndex=parseInt(previousParams.get('page'));if(pageIndex>2){pageIndex--;previousParams.set('page',pageIndex)}else{previousParams.delete('page')}
previousPath.search=previousParams.toString();var url=previousPath.href;$('.status-top').show();$('.go-previous').html('<i class="fa fa-spinner fa-spin"></i>')
location.href=url;}}
proto.onPageLoad=function(body,path,response){console.log('onpageloadddd')
if(!this.options.append){this.isLoading=false;}
this.pageIndex++;this.loadCount++;this.dispatchEvent('load',null,[body,path,response]);return this.appendNextPage(body,path,response);};proto.appendNextPage=function(body,path,response){let{append,responseBody,domParseResponse}=this.options;let isDocument=responseBody=='text'&&domParseResponse;if(!isDocument||!append)return{body,response};let items=body.querySelectorAll(append);let promiseValue={body,response,items};if(!items||!items.length){this.lastPageReached(body,path);return promiseValue;}
let fragment=getItemsFragment(items);let appendReady=()=>{this.appendItems(items,fragment);this.isLoading=false;this.dispatchEvent('append',null,[body,path,items,response]);return promiseValue;};if(this.options.outlayer){return this.appendOutlayerItems(fragment,appendReady);}else{return appendReady();}};proto.appendItems=function(items,fragment){if(!items||!items.length)return;fragment=fragment||getItemsFragment(items);refreshScripts(fragment);this.element.appendChild(fragment);};function getItemsFragment(items){let fragment=document.createDocumentFragment();if(items)fragment.append(...items);return fragment;}
function refreshScripts(fragment){let scripts=fragment.querySelectorAll('script');for(let script of scripts){let freshScript=document.createElement('script');let attrs=script.attributes;for(let attr of attrs){freshScript.setAttribute(attr.name,attr.value);}
freshScript.innerHTML=script.innerHTML;script.parentNode.replaceChild(freshScript,script);}}
proto.appendOutlayerItems=function(fragment,appendReady){let imagesLoaded=InfiniteScroll.imagesLoaded||window.imagesLoaded;if(!imagesLoaded){console.error('[InfiniteScroll] imagesLoaded required for outlayer option');this.isLoading=false;return;}
return new Promise(function(resolve){imagesLoaded(fragment,function(){let bodyResponse=appendReady();resolve(bodyResponse);});});};proto.onAppendOutlayer=function(response,path,items){this.options.outlayer.appended(items);};proto.checkLastPage=function(body,path){let{checkLastPage,path:pathOpt}=this.options;if(!checkLastPage)return;if(typeof pathOpt=='function'){let nextPath=this.getPath();if(!nextPath){this.lastPageReached(body,path);return;}}
let selector;if(typeof checkLastPage=='string'){selector=checkLastPage;}else if(this.isPathSelector){selector=pathOpt;}
if(!selector||!body.querySelector)return;let nextElem=body.querySelector(selector);if(!nextElem)this.lastPageReached(body,path);};proto.lastPageReached=function(body,path){this.canLoad=false;this.dispatchEvent('last',null,[body,path]);};proto.onPageError=function(error,path,response){this.isLoading=false;this.canLoad=false;this.dispatchEvent('error',null,[error,path,response]);return error;};InfiniteScroll.create.prefill=function(){if(!this.options.prefill)return;let append=this.options.append;if(!append){console.error(`append option required for prefill.Set as:${append}`);return;}
this.updateMeasurements();this.updateScroller();this.isPrefilling=true;this.on('append',this.prefill);this.once('error',this.stopPrefill);this.once('last',this.stopPrefill);this.prefill();};proto.prefill=function(){let distance=this.getPrefillDistance();this.isPrefilling=distance>=0;if(this.isPrefilling){this.log('prefill');this.loadNextPage();}else{this.stopPrefill();}};proto.getPrefillDistance=function(){if(this.options.elementScroll){return this.scroller.clientHeight-this.scroller.scrollHeight;}
return this.windowHeight-this.element.clientHeight;};proto.stopPrefill=function(){this.log('stopPrefill');this.off('append',this.prefill);};return InfiniteScroll;}));(function(window,factory){if(typeof module=='object'&&module.exports){module.exports=factory(window,require('./core'),require('fizzy-ui-utils'),);}else{factory(window,window.InfiniteScroll,window.fizzyUIUtils,);}}(window,function factory(window,InfiniteScroll,utils){let proto=InfiniteScroll.prototype;var dynamicThreshold=400;if($(window).width()<768){dynamicThreshold=800;}
console.log(dynamicThreshold)
Object.assign(InfiniteScroll.defaults,{scrollThreshold:dynamicThreshold,});InfiniteScroll.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this);this.resizeHandler=this.onResize.bind(this);let scrollThreshold=this.options.scrollThreshold;let isEnable=scrollThreshold||scrollThreshold===0;if(isEnable)this.enableScrollWatch();};InfiniteScroll.destroy.scrollWatch=function(){this.disableScrollWatch();};proto.enableScrollWatch=function(){if(this.isScrollWatching)return;this.isScrollWatching=true;this.updateMeasurements();this.updateScroller();this.on('last',this.disableScrollWatch);this.bindScrollWatchEvents(true);};proto.disableScrollWatch=function(){if(!this.isScrollWatching)return;this.bindScrollWatchEvents(false);delete this.isScrollWatching;};proto.bindScrollWatchEvents=function(isBind){let addRemove=isBind?'addEventListener':'removeEventListener';this.scroller[addRemove]('scroll',this.pageScrollHandler);window[addRemove]('resize',this.resizeHandler);};proto.onPageScroll=InfiniteScroll.throttle(function(){let distance=this.getBottomDistance();if(distance<=this.options.scrollThreshold){this.dispatchEvent('scrollThreshold');}});proto.getBottomDistance=function(){var scrollPosition=window.pageYOffset;var windowSize=window.innerHeight;var bodyHeight=document.body.offsetHeight;var distance=Math.max(bodyHeight-(scrollPosition+windowSize),0);return distance;};proto.onResize=function(){this.updateMeasurements();};utils.debounceMethod(InfiniteScroll,'onResize',150);return InfiniteScroll;}));(function(window,factory){if(typeof module=='object'&&module.exports){module.exports=factory(window,require('./core'),require('fizzy-ui-utils'),);}else{factory(window,window.InfiniteScroll,window.fizzyUIUtils,);}}(window,function factory(window,InfiniteScroll,utils){let proto=InfiniteScroll.prototype;Object.assign(InfiniteScroll.defaults,{history:'replace',});let link=document.createElement('a');InfiniteScroll.create.history=function(){if(!this.options.history)return;link.href=this.getAbsolutePath();let linkOrigin=link.origin||link.protocol+'//'+link.host;let isSameOrigin=linkOrigin==location.origin;if(!isSameOrigin){console.error('[InfiniteScroll] cannot set history with different origin: '+`${link.origin}on ${location.origin}.History behavior disabled.`);return;}
if(this.options.append){this.createHistoryAppend();}else{this.createHistoryPageLoad();}};proto.createHistoryAppend=function(){this.updateMeasurements();this.updateScroller();this.scrollPages=[{top:0,path:location.href,title:document.title,},];this.scrollPage=this.scrollPages[0];this.scrollHistoryHandler=this.onScrollHistory.bind(this);this.unloadHandler=this.onUnload.bind(this);this.scroller.addEventListener('scroll',this.scrollHistoryHandler);this.on('append',this.onAppendHistory);this.bindHistoryAppendEvents(true);};proto.bindHistoryAppendEvents=function(isBind){let addRemove=isBind?'addEventListener':'removeEventListener';this.scroller[addRemove]('scroll',this.scrollHistoryHandler);window[addRemove]('unload',this.unloadHandler);};proto.createHistoryPageLoad=function(){this.on('load',this.onPageLoadHistory);};InfiniteScroll.destroy.history=proto.destroyHistory=function(){let isHistoryAppend=this.options.history&&this.options.append;if(isHistoryAppend){this.bindHistoryAppendEvents(false);}};proto.onAppendHistory=function(response,path,items){if(!items||!items.length)return;let firstItem=items[0];let elemScrollY=this.getElementScrollY(firstItem);link.href=path;this.scrollPages.push({top:elemScrollY,path:link.href,title:response.title,});};proto.getElementScrollY=function(elem){if(this.options.elementScroll){return elem.offsetTop-this.top;}else{let rect=elem.getBoundingClientRect();return rect.top+window.scrollY;}};proto.onScrollHistory=function(){let scrollPage=this.getClosestScrollPage();if(scrollPage!=this.scrollPage){this.scrollPage=scrollPage;this.setHistory(scrollPage.title,scrollPage.path);}};utils.debounceMethod(InfiniteScroll,'onScrollHistory',150);proto.getClosestScrollPage=function(){let scrollViewY;if(this.options.elementScroll){scrollViewY=this.scroller.scrollTop+this.scroller.clientHeight/2;}else{scrollViewY=window.scrollY+this.windowHeight/2;}
let scrollPage;for(let page of this.scrollPages){if(page.top>=scrollViewY)break;scrollPage=page;}
return scrollPage;};proto.setHistory=function(title,path){let optHistory=this.options.history;let historyMethod=optHistory&&history[optHistory+'State'];if(!historyMethod)return;history[optHistory+'State'](null,title,path);if(this.options.historyTitle)document.title=title;this.dispatchEvent('history',null,[title,path]);};proto.onUnload=function(){if(this.scrollPage.top===0)return;let scrollY=window.scrollY-this.scrollPage.top+this.top;this.destroyHistory();scrollTo(0,scrollY);};proto.onPageLoadHistory=function(response,path){this.setHistory(response.title,path);};return InfiniteScroll;}));(function(window,factory){if(typeof module=='object'&&module.exports){module.exports=factory(window,require('./core'),require('fizzy-ui-utils'),);}else{factory(window,window.InfiniteScroll,window.fizzyUIUtils,);}}(window,function factory(window,InfiniteScroll,utils){class InfiniteScrollButton{constructor(element,infScroll){this.element=element;this.infScroll=infScroll;this.clickHandler=this.onClick.bind(this);this.element.addEventListener('click',this.clickHandler);infScroll.on('request',this.disable.bind(this));infScroll.on('load',this.enable.bind(this));infScroll.on('error',this.hide.bind(this));infScroll.on('last',this.hide.bind(this));}
onClick(event){event.preventDefault();this.infScroll.loadNextPage();}
enable(){this.element.removeAttribute('disabled');}
disable(){this.element.disabled='disabled';}
hide(){this.element.style.display='none';}
destroy(){this.element.removeEventListener('click',this.clickHandler);}}
InfiniteScroll.create.button=function(){let buttonElem=utils.getQueryElement(this.options.button);if(buttonElem){this.button=new InfiniteScrollButton(buttonElem,this);}};InfiniteScroll.destroy.button=function(){if(this.button)this.button.destroy();};InfiniteScroll.Button=InfiniteScrollButton;return InfiniteScroll;}));(function(window,factory){if(typeof module=='object'&&module.exports){module.exports=factory(window,require('./core'),require('fizzy-ui-utils'),);}else{factory(window,window.InfiniteScroll,window.fizzyUIUtils,);}}(window,function factory(window,InfiniteScroll,utils){let proto=InfiniteScroll.prototype;InfiniteScroll.create.status=function(){let statusElem=utils.getQueryElement(this.options.status);if(!statusElem)return;this.statusElement=statusElem;this.statusEventElements={request:statusElem.querySelector('.infinite-scroll-request'),error:statusElem.querySelector('.infinite-scroll-error'),last:statusElem.querySelector('.infinite-scroll-last'),};this.on('request',this.showRequestStatus);this.on('error',this.showErrorStatus);this.on('last',this.showLastStatus);this.bindHideStatus('on');};proto.bindHideStatus=function(bindMethod){let hideEvent=this.options.append?'append':'load';this[bindMethod](hideEvent,this.hideAllStatus);};proto.showRequestStatus=function(){this.showStatus('request');};proto.showErrorStatus=function(){this.showStatus('error');};proto.showLastStatus=function(){this.showStatus('last');this.bindHideStatus('off');};proto.showStatus=function(eventName){show(this.statusElement);this.hideStatusEventElements();let eventElem=this.statusEventElements[eventName];show(eventElem);};proto.hideAllStatus=function(){hide(this.statusElement);this.hideStatusEventElements();};proto.hideStatusEventElements=function(){for(let type in this.statusEventElements){let eventElem=this.statusEventElements[type];hide(eventElem);}};function hide(elem){setDisplay(elem,'none');}
function show(elem){setDisplay(elem,'block');}
function setDisplay(elem,value){if(elem){elem.style.display=value;}}
return InfiniteScroll;}));
(function(window,factory){'use strict';if(typeof define=='function'&&define.amd){define(['ev-emitter/ev-emitter'],function(EvEmitter){return factory(window,EvEmitter);});}else if(typeof module=='object'&&module.exports){module.exports=factory(window,require('ev-emitter'));}else{window.imagesLoaded=factory(window,window.EvEmitter);}})(typeof window!=='undefined'?window:this,function factory(window,EvEmitter){'use strict';var $=window.jQuery;var console=window.console;function extend(a,b){for(var prop in b){a[prop]=b[prop];}
return a;}
var arraySlice=Array.prototype.slice;function makeArray(obj){if(Array.isArray(obj)){return obj;}
var isArrayLike=typeof obj=='object'&&typeof obj.length=='number';if(isArrayLike){return arraySlice.call(obj);}
return[obj];}
function ImagesLoaded(elem,options,onAlways){if(!(this instanceof ImagesLoaded)){return new ImagesLoaded(elem,options,onAlways);}
var queryElem=elem;if(typeof elem=='string'){queryElem=document.querySelectorAll(elem);}
if(!queryElem){console.error('Bad element for imagesLoaded '+(queryElem||elem));return;}
this.elements=makeArray(queryElem);this.options=extend({},this.options);if(typeof options=='function'){onAlways=options;}else{extend(this.options,options);}
if(onAlways){this.on('always',onAlways);}
this.getImages();if($){this.jqDeferred=new $.Deferred();}
setTimeout(this.check.bind(this));}
ImagesLoaded.prototype=Object.create(EvEmitter.prototype);ImagesLoaded.prototype.options={};ImagesLoaded.prototype.getImages=function(){this.images=[];this.elements.forEach(this.addElementImages,this);};ImagesLoaded.prototype.addElementImages=function(elem){if(elem.nodeName=='IMG'){this.addImage(elem);}
if(this.options.background===true){this.addElementBackgroundImages(elem);}
var nodeType=elem.nodeType;if(!nodeType||!elementNodeTypes[nodeType]){return;}
var childImgs=elem.querySelectorAll('img');for(var i=0;i<childImgs.length;i++){var img=childImgs[i];this.addImage(img);}
if(typeof this.options.background=='string'){var children=elem.querySelectorAll(this.options.background);for(i=0;i<children.length;i++){var child=children[i];this.addElementBackgroundImages(child);}}};var elementNodeTypes={1:true,9:true,11:true};ImagesLoaded.prototype.addElementBackgroundImages=function(elem){var style=getComputedStyle(elem);if(!style){return;}
var reURL=/url\((['"])?(.*?)\1\)/gi;var matches=reURL.exec(style.backgroundImage);while(matches!==null){var url=matches&&matches[2];if(url){this.addBackground(url,elem);}
matches=reURL.exec(style.backgroundImage);}};ImagesLoaded.prototype.addImage=function(img){var loadingImage=new LoadingImage(img);this.images.push(loadingImage);};ImagesLoaded.prototype.addBackground=function(url,elem){var background=new Background(url,elem);this.images.push(background);};ImagesLoaded.prototype.check=function(){var _this=this;this.progressedCount=0;this.hasAnyBroken=false;if(!this.images.length){this.complete();return;}
function onProgress(image,elem,message){setTimeout(function(){_this.progress(image,elem,message);});}
this.images.forEach(function(loadingImage){loadingImage.once('progress',onProgress);loadingImage.check();});};ImagesLoaded.prototype.progress=function(image,elem,message){this.progressedCount++;this.hasAnyBroken=this.hasAnyBroken||!image.isLoaded;this.emitEvent('progress',[this,image,elem]);if(this.jqDeferred&&this.jqDeferred.notify){this.jqDeferred.notify(this,image);}
if(this.progressedCount==this.images.length){this.complete();}
if(this.options.debug&&console){console.log('progress: '+message,image,elem);}};ImagesLoaded.prototype.complete=function(){var eventName=this.hasAnyBroken?'fail':'done';this.isComplete=true;this.emitEvent(eventName,[this]);this.emitEvent('always',[this]);if(this.jqDeferred){var jqMethod=this.hasAnyBroken?'reject':'resolve';this.jqDeferred[jqMethod](this);}};function LoadingImage(img){this.img=img;}
LoadingImage.prototype=Object.create(EvEmitter.prototype);LoadingImage.prototype.check=function(){var isComplete=this.getIsImageComplete();if(isComplete){this.confirm(this.img.naturalWidth!==0,'naturalWidth');return;}
this.proxyImage=new Image();this.proxyImage.addEventListener('load',this);this.proxyImage.addEventListener('error',this);this.img.addEventListener('load',this);this.img.addEventListener('error',this);this.proxyImage.src=this.img.src;};LoadingImage.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth;};LoadingImage.prototype.confirm=function(isLoaded,message){this.isLoaded=isLoaded;this.emitEvent('progress',[this,this.img,message]);};LoadingImage.prototype.handleEvent=function(event){var method='on'+event.type;if(this[method]){this[method](event);}};LoadingImage.prototype.onload=function(){this.confirm(true,'onload');this.unbindEvents();};LoadingImage.prototype.onerror=function(){this.confirm(false,'onerror');this.unbindEvents();};LoadingImage.prototype.unbindEvents=function(){this.proxyImage.removeEventListener('load',this);this.proxyImage.removeEventListener('error',this);this.img.removeEventListener('load',this);this.img.removeEventListener('error',this);};function Background(url,element){this.url=url;this.element=element;this.img=new Image();}
Background.prototype=Object.create(LoadingImage.prototype);Background.prototype.check=function(){this.img.addEventListener('load',this);this.img.addEventListener('error',this);this.img.src=this.url;var isComplete=this.getIsImageComplete();if(isComplete){this.confirm(this.img.naturalWidth!==0,'naturalWidth');this.unbindEvents();}};Background.prototype.unbindEvents=function(){this.img.removeEventListener('load',this);this.img.removeEventListener('error',this);};Background.prototype.confirm=function(isLoaded,message){this.isLoaded=isLoaded;this.emitEvent('progress',[this,this.element,message]);};ImagesLoaded.makeJQueryPlugin=function(jQuery){jQuery=jQuery||window.jQuery;if(!jQuery){return;}
$=jQuery;$.fn.imagesLoaded=function(options,callback){var instance=new ImagesLoaded(this,options,callback);return instance.jqDeferred.promise($(this));};};ImagesLoaded.makeJQueryPlugin();return ImagesLoaded;});;
(function(factory){var registeredInModuleLoader;if(typeof define==='function'&&define.amd){define(factory);registeredInModuleLoader=true;}
if(typeof exports==='object'){module.exports=factory();registeredInModuleLoader=true;}
if(!registeredInModuleLoader){var OldCookies=window.Cookies;var api=window.Cookies=factory();api.noConflict=function(){window.Cookies=OldCookies;return api;};}}(function(){function extend(){var i=0;var result={};for(;i<arguments.length;i++){var attributes=arguments[i];for(var key in attributes){result[key]=attributes[key];}}
return result;}
function init(converter){function api(key,value,attributes){if(typeof document==='undefined'){return;}
if(arguments.length>1){attributes=extend({path:'/'},api.defaults,attributes);if(typeof attributes.expires==='number'){attributes.expires=new Date(new Date()*1+attributes.expires*864e+5);}
attributes.expires=attributes.expires?attributes.expires.toUTCString():'';try{var result=JSON.stringify(value);if(/^[\{\[]/.test(result)){value=result;}}catch(e){}
value=converter.write?converter.write(value,key):encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);key=encodeURIComponent(String(key)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var stringifiedAttributes='';for(var attributeName in attributes){if(!attributes[attributeName]){continue;}
stringifiedAttributes+='; '+attributeName;if(attributes[attributeName]===true){continue;}
stringifiedAttributes+='='+attributes[attributeName].split(';')[0];}
return(document.cookie=key+'='+value+stringifiedAttributes);}
var jar={};var decode=function(s){return s.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent);};var cookies=document.cookie?document.cookie.split('; '):[];var i=0;for(;i<cookies.length;i++){var parts=cookies[i].split('=');var cookie=parts.slice(1).join('=');if(!this.json&&cookie.charAt(0)==='"'){cookie=cookie.slice(1,-1);}
try{var name=decode(parts[0]);cookie=(converter.read||converter)(cookie,name)||decode(cookie);if(this.json){try{cookie=JSON.parse(cookie);}catch(e){}}
jar[name]=cookie;if(key===name){break;}}catch(e){}}
return key?jar[key]:jar;}
api.set=api;api.get=function(key){return api.call(api,key);};api.getJSON=function(){return api.apply({json:true},arguments);};api.remove=function(key,attributes){api(key,'',extend(attributes,{expires:-1}));};api.defaults={};api.withConverter=init;return api;}
return init(function(){});}));Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,o){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),i=e.length>>>0;if(0===i)return!1;var a,n,s=0|o,p=Math.max(s>=0?s:i-Math.abs(s),0);for(;p<i;){if((a=e[p])===(n=t)||"number"==typeof a&&"number"==typeof n&&isNaN(a)&&isNaN(n))return!0;p++}return!1}}),$(function(){$("#form-currency .currency-select").unbind().on("click",function(t){t.preventDefault(),$("#form-currency input[name='code']").val($(this).data("name")),$("#form-currency").submit()}),$("#form-language .language-select").unbind().on("click",function(t){t.preventDefault(),$("#form-language input[name='code']").val($(this).data("name")),$("#form-language").submit()})}),window.cart.add=function(t,o,e){o=o||1,$.ajax({url:"index.php?route=checkout/cart/add",type:"post",data:"product_id="+t+"&quantity="+o,dataType:"json",beforeSend:function(){$('[data-toggle="tooltip"]').tooltip("hide"),$("[onclick*=\"cart.add('"+t+"'\"]").button("loading")},complete:function(){$("[onclick*=\"cart.add('"+t+"'\"]").button("reset")},success:function(i){if($(".alert, .text-danger").remove(),i.redirect)if(i.options_popup){($("html").hasClass("iphone")||$("html").hasClass("ipad"))&&iNoBounce.enable();var a="";a+='<div class="popup-wrapper popup-options">',a+='\t<div class="popup-container">',a+='\t\t<button class="btn popup-close"></button>',a+='\t\t<div class="popup-body">',a+='\t\t<div class="popup-inner-body">',a+='\t\t\t<div class="istanbul-loading"><i class="fa fa-spinner fa-spin"></i></div>',a+='\t\t\t<iframe src="index.php?route=istanbul3/product&product_id='+t+"&popup=options&product_quantity="+o+"&"+(e?"quick_buy=true":"")+'" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.istanbul-loading\').fadeOut();"></iframe>',a+="\t\t</div>",a+="\t\t</div>",a+="\t</div>",a+='\t<div class="popup-bg popup-bg-closable"></div>',a+="</div>",$(".popup-wrapper").remove(),$("body").append(a),setTimeout(function(){$("html").addClass("popup-open popup-center")},10)}else location=i.redirect;if(i.success){if(i.options_popup){($("html").hasClass("iphone")||$("html").hasClass("ipad"))&&iNoBounce.enable();a="";a+='<div class="popup-wrapper popup-options">',a+='\t<div class="popup-container">',a+='\t\t<button class="btn popup-close"></button>',a+='\t\t<div class="popup-body">',a+='\t\t<div class="popup-inner-body">',a+='\t\t\t<div class="istanbul-loading"><i class="fa fa-spinner fa-spin"></i></div>',a+='\t\t\t<iframe src="index.php?route=istanbul3/product&product_id='+t+"&popup=options&"+(e?"quick_buy=true":"")+'" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.istanbul-loading\').fadeOut();"></iframe>',a+="\t\t</div>",a+="\t\t</div>",a+="\t</div>",a+='\t<div class="popup-bg popup-bg-closable"></div>',a+="</div>",$(".popup-wrapper").remove(),$("body").append(a),setTimeout(function(){$("html").addClass("popup-open popup-center")},10)}else i.notification?(show_notification(i.notification),e&&(location=Istanbul.checkoutUrl)):$("header").after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> '+i.success+' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');setTimeout(function(){$("#cart-total").html(i.total),$("#cart-items").html(i.items_count),i.items_count?$("#cart-items").removeClass("count-zero"):$("#cart-items").addClass("count-zero")},100),Istanbul.scrollToTop&&$("html, body").animate({scrollTop:0},"slow"),$(".cart-content ul").load("index.php?route=common/cart/info ul li"),parent.window._QuickCheckout&&parent.window._QuickCheckout.save()}},error:function(t,o,e){alert(e+"\r\n"+t.statusText+"\r\n"+t.responseText)}})},window.cart.remove=function(t){$.ajax({url:"index.php?route=checkout/cart/remove",type:"post",data:"key="+t,dataType:"json",beforeSend:function(){$("#cart > button").button("loading")},complete:function(){$("#cart > button").button("reset")},success:function(t){setTimeout(function(){$("#cart-total").html(t.total),$("#cart-items").html(t.items_count),t.items_count?$("#cart-items").removeClass("count-zero"):$("#cart-items").addClass("count-zero")},100),$("html").hasClass("route-checkout-cart")||$("html").hasClass("route-checkout-checkout")?location="index.php?route=checkout/cart":$(".cart-content ul").load("index.php?route=common/cart/info ul li")},error:function(t,o,e){alert(e+"\r\n"+t.statusText+"\r\n"+t.responseText)}})},window.cart.update=function(t,o){$.ajax({url:"index.php?route=checkout/cart/edit",type:"post",data:"key="+t+"&quantity="+(void 0!==o?o:1),dataType:"json",beforeSend:function(){$("#cart > button").button("loading")},complete:function(){$("#cart > button").button("reset")},success:function(t){setTimeout(function(){$("#cart-total").html(t.total),$("#cart-items").html(t.items_count),t.items_count?$("#cart-items").removeClass("count-zero"):$("#cart-items").addClass("count-zero")},100),$("html").hasClass("route-checkout-cart")||$("html").hasClass("route-checkout-checkout")?location="index.php?route=checkout/cart":$(".cart-content ul").load("index.php?route=common/cart/info ul li")},error:function(t,o,e){alert(e+"\r\n"+t.statusText+"\r\n"+t.responseText)}})},window.wishlist.add=function(t){$.ajax({url:"index.php?route=account/wishlist/add",type:"post",data:"product_id="+t,dataType:"json",success:function(t){$(".alert").remove(),t.redirect&&(location=t.redirect),t.success&&($('[data-toggle="tooltip"]').tooltip("hide"),t.notification?show_notification(t.notification):$("header").after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> '+t.success+' <button type="button" class="close" data-dismiss="alert">&times;</button></div>')),$("#wishlist-total span").html(t.total),$("#wishlist-total").attr("title",t.total),$(".wishlist-badge").text(t.count),t.count?$(".wishlist-badge").removeClass("count-zero"):$(".wishlist-badge").addClass("count-zero"),Istanbul.scrollToTop&&$("html, body").animate({scrollTop:0},"slow")},error:function(t,o,e){alert(e+"\r\n"+t.statusText+"\r\n"+t.responseText)}})},window.compare.add=function(t){$.ajax({url:"index.php?route=product/compare/add",type:"post",data:"product_id="+t,dataType:"json",success:function(t){$(".alert").remove(),t.success&&($('[data-toggle="tooltip"]').tooltip("hide"),t.notification?show_notification(t.notification):$("header").after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> '+t.success+' <button type="button" class="close" data-dismiss="alert">&times;</button></div>'),$("#compare-total").html(t.total),$(".compare-badge").text(t.count),t.count?$(".compare-badge").removeClass("count-zero"):$(".compare-badge").addClass("count-zero"),Istanbul.scrollToTop&&$("html, body").animate({scrollTop:0},"slow"))},error:function(t,o,e){alert(e+"\r\n"+t.statusText+"\r\n"+t.responseText)}})},window.quickview=function(t){t=parseInt(t,10),$('[data-toggle="tooltip"]').tooltip("hide");var o="";o+='<div class="popup-wrapper popup-quickview">',o+='\t<div class="popup-container">',o+='\t\t<button class="btn popup-close"></button>',o+='\t\t<div class="popup-body">',o+='\t\t\t<div class="popup-inner-body">',o+='\t\t\t\t<div class="istanbul-loading"><i class="fa fa-spinner fa-spin"></i></div>',o+='\t\t\t\t<iframe src="index.php?route=istanbul3/product&product_id='+t+'&popup=quickview" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.istanbul-loading\').hide();"></iframe>',o+="\t\t\t</div>",o+="\t\t</div>",o+="\t</div>",o+='\t<div class="popup-bg popup-bg-closable"></div>',o+="</div>",$(".popup-wrapper").remove(),$("body").append(o),setTimeout(function(){$("html").addClass("popup-open popup-center")},10)},window.open_popup=function(t){($("html").hasClass("iphone")||$("html").hasClass("ipad"))&&iNoBounce.enable(),t=parseInt(t,10);$(".popup-wrapper").remove(),$("body").append('<div class="popup-wrapper popup-module">\t<div class="popup-container">\t\t<button class="btn popup-close"></button>\t\t<div class="popup-body">\t\t<div class="popup-inner-body">\t\t</div>\t\t</div>\t</div>\t<div class="popup-bg popup-bg-closable"></div></div>'),setTimeout(function(){$("html").addClass("popup-open popup-center")},10),$(".popup-container").css("visibility","hidden"),$.ajax({url:"index.php?route=istanbul3/popup/get&module_id="+t+"&popup=module",success:function(o){var e=$(o),i=e.siblings(".module-popup"),a=e.siblings("style"),n=i.find(".popup-container");$("#popup-style-"+t).remove(),$("head").append(a.attr("id","popup-style-"+t)),$(".popup-wrapper").attr("class",i.attr("class")),$(".popup-container").html(n.html()),$(".popup-container").css("visibility","visible")},error:function(t,o,e){alert(e+"\r\n"+t.statusText+"\r\n"+t.responseText)}})},window.open_login_popup=function(){($("html").hasClass("iphone")||$("html").hasClass("ipad"))&&iNoBounce.enable();$(".popup-wrapper").remove(),$("body").append('<div class="popup-wrapper popup-login">\t<div class="popup-container">\t\t<button class="btn popup-close"></button>\t\t<div class="popup-body">\t\t<div class="popup-inner-body">\t\t\t<div class="istanbul-loading"><i class="fa fa-spinner fa-spin"></i></div>\t\t\t<iframe src="index.php?route=account/login&popup=login" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.istanbul-loading\').fadeOut();"></iframe>\t\t</div>\t\t</div>\t</div>\t<div class="popup-bg popup-bg-closable"></div></div>'),setTimeout(function(){$("html").addClass("popup-open popup-center")},10)},window.open_register_popup=function(){($("html").hasClass("iphone")||$("html").hasClass("ipad"))&&iNoBounce.enable();$(".popup-wrapper").remove(),$("body").append('<div class="popup-wrapper popup-register">\t<div class="popup-container">\t\t<button class="btn popup-close"></button>\t\t<div class="popup-body">\t\t<div class="popup-inner-body">\t\t\t<div class="istanbul-loading"><i class="fa fa-spinner fa-spin"></i></div>\t\t\t<iframe src="index.php?route=account/register&popup=register" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.istanbul-loading\').fadeOut();"></iframe>\t\t</div>\t\t</div>\t</div>\t<div class="popup-bg popup-bg-closable"></div></div>'),setTimeout(function(){$("html").addClass("popup-open popup-center")},10)},window.show_notification=function(t){t=$.extend({position:"center",className:"",title:"",image:"",message:"",buttons:[],timeout:Istanbul.notificationHideAfter},t),0===$(".notification-wrapper-"+t.position).length&&$("body").append('<div class="notification-wrapper notification-wrapper-'+t.position+'"></div>');var o="",e=$.map(t.buttons,function(t){return'<a class="'+t.className+'" href="'+t.href+'">'+t.name+"</a>"});o+='<div class="notification '+t.className+'">',o+='\t<button class="btn notification-close"></button>',o+='\t<div class="notification-content">',t.image&&(o+='\t\t<img src="'+t.image+'" srcset="'+t.image+" 1x, "+t.image2x+' 2x">'),o+="\t\t<div>",o+='\t\t\t<div class="notification-title">'+t.title+"</div>",o+='\t\t\t<div class="notification-text">'+t.message+"</div>",o+="\t\t</div>",o+="\t</div>",e&&e.length&&(o+='<div class="notification-buttons">'+e.join("\n")+"</div>"),o+="</div>";var i=$(o);return $(".notification-wrapper-"+t.position).append(i),t.timeout&&setTimeout(function(){i.find(".notification-close").trigger("click")},t.timeout),i},window.loader=function(t,o){var e=$(t);o?(e.attr("style","position: relative"),e.append('<div class="istanbul-loading-overlay"><div class="istanbul-loading"><i class="fa fa-spinner fa-spin"></i></div></div>')):(e.attr("style",""),e.find(".istanbul-loading-overlay").remove())},window.resize_iframe=function(t,o){$(".module-popup-"+t+" iframe").height(o)};function istanbul_enable_countdown(){$('.countdown').each(function(){var $this=$(this);if($this.data('_isEnabled')){return;}
$this.data('_isEnabled',true);$this.countdown({date:$this.data('date'),render:function(data){return $(this.el).html('<div>'+this.leadingZeros(data.days,2)+' <span>'+Istanbul['countdownDay']+'</span></div>'+'<div>'+this.leadingZeros(data.hours,2)+' <span>'+Istanbul['countdownHour']+'</span></div>'+'<div>'+this.leadingZeros(data.min,2)+' <span>'+Istanbul['countdownMin']+'</span></div>'+'<div>'+this.leadingZeros(data.sec,2)+' <span>'+Istanbul['countdownSec']+'</span></div>');}});});}
function istanbul_enable_stepper(){$('.stepper').each(function(){var $this=$(this);if($this.data('_isEnabled')){return;}
$this.data('_isEnabled',true);var $input=$this.find('input[name^="quantity"]');var value=$input.val();var minimum=parseInt($input.data('minimum'))||1;$this.find('.fa-angle-up').on('click',function(){$input.val(parseInt($input.val())+1);$input.trigger('change');});$this.find('.fa-angle-down').on('click',function(){if(parseInt($input.val())>minimum){$input.val(parseInt($input.val())-1);$input.trigger('change');}});$input.on('keypress',function(e){if((e.which<48||e.which>57)&&[8].indexOf(e.which)===-1){e.preventDefault();}});$input.on('keydown',function(e){if(e.which===38){e.preventDefault();$input.val(parseInt($input.val())+1);$input.trigger('change');}
if(e.which===40){e.preventDefault();if(parseInt($input.val())>minimum){$input.val(parseInt($input.val())-1);$input.trigger('change');}}});$input.on('blur',function(){if($('html').hasClass('firefox')){}
if((parseInt($input.val())||0)<minimum){$input.val(value);$input.trigger('change');}});});}
jQuery(function($){var $html=$('html');var $body=$('body');var $content=$('#content');var $column_left=$('#column-left');var $column_right=$('#column-right');var $panel_group=$('.panel-group');var $main_products=$('.main-products');$(document).on('show.bs.tooltip',function(e){if($html.hasClass('touchevents')){e.preventDefault();}
var $target=$(e.target);var cls=$target.data('tooltipClass');if(cls){$target.data('bs.tooltip').$tip.addClass(cls);}});$(document).on('show.bs.popover',function(e){if($html.hasClass('touchevents')){e.preventDefault();}
var $target=$(e.target);var cls=$target.data('popoverClass');if(cls){$target.data('bs.popover').$tip.addClass(cls);}});$(document).on('dp.show',function(e){var $target=$(e.target);var cls=$target.data('pickerClass');if(cls){$target.data('DateTimePicker').widget.addClass(cls);}});$(document).on('shown.bs.dropdown',function(e){var $target=$(e.target);var $toggle=$target.find('> .dropdown-toggle');$toggle.addClass('disabled');$target.outerWidth();$target.addClass('animating');});$(document).on('hide.bs.dropdown',function(e){var $target=$(e.target);var $toggle=$target.find('> .dropdown-toggle');$target.removeClass('animating');$toggle.removeClass('disabled');$('html.search-page').removeClass('search-page-open');});if('ontouchstart'in document){$('.main-menu .dropdown .dropdown > .dropdown-toggle, .flyout-menu .dropdown .dropdown > .dropdown-toggle, .mini-search .search-categories-button').on('click',function(e){var $this=$(this);var $parent=$this.parent();var isOpen=$parent.hasClass('open');var isLink=false;$parent.parent().find('.open').removeClass('open');if(isOpen){if($this.attr('href')){isLink=true;}else{$parent.removeClass('open').trigger('hide.bs.dropdown');}}else{$parent.addClass('open').trigger('shown.bs.dropdown');}
if(!isLink){return false;}});}else{hover_active=0;function mouseOver(){if(hover_active==0){hover_active=1;setTimeout(()=>{var $this=$(this);var $trigger=$('> .dropdown-toggle',this);clearTimeout(this.__timeout);$trigger.attr('aria-expanded','true').attr('data-toggle','');$this.addClass('open');$this.outerWidth();$this.addClass('animating');hover_active=0;},1);}}
function mouseOut(){var $this=$(this);var $trigger=$('> .dropdown-toggle',this);$this.removeClass('animating');clearTimeout(this.__timeout);this.__timeout=setTimeout(function(){$this.removeClass('open');$trigger.attr('aria-expanded','false');},1);}
$('.dropdown').each(function(){var $this=$(this);if($this.is($('.search-page #search'))){$('> .dropdown-toggle',this).on('click',function(){$('html.search-page').addClass('search-page-open');var $this=$(this);var $parent=$this.parent();var isOpen=$parent.hasClass('open');var isLink=false;$parent.parent().find('.open').removeClass('open');if(isOpen){if($this.attr('href')){isLink=true;}else{$parent.removeClass('open').trigger('hide.bs.dropdown');}}else{$parent.addClass('open').trigger('shown.bs.dropdown');}
if(!isLink){return false;}});}else if($this.hasClass('main-menu-item')){$this.hover(mouseOver,mouseOut);}else{$this.hover(mouseOver,mouseOut);}});}
$panel_group.on('show.bs.collapse',function(e){$(e.target).parent().addClass('panel-active');$(e.target).parent().removeClass('panel-collapsed');});$panel_group.on('hide.bs.collapse',function(e){$(e.target).parent().removeClass('panel-active');$(e.target).parent().addClass('panel-collapsing');});$panel_group.on('hidden.bs.collapse',function(e){$(e.target).parent().removeClass('panel-collapsing');$(e.target).parent().addClass('panel-collapsed');});$(document).delegate('.accordion-menu span[data-toggle="collapse"]','click',function(e){e.preventDefault();$(this).closest('.menu-item').toggleClass('open');});$(document).delegate('.mobile .accordion-menu li > a','click',function(e){var $this=$(this);var $trigger=$this.find('.open-menu');if(!$trigger.length){return;}
if($trigger.attr('aria-expanded')==='true'&&$this.attr('href')){return;}
e.preventDefault();$($trigger.data('target')).collapse('toggle');});if(Istanbul['infiniteScrollStatus']){var $container=$('.categorys').infiniteScroll({path:'.pagination a.next',append:'.product-layout',status:'.scroller-status',hideNav:'.pagination-results',});$container.on('load.infiniteScroll',function(event,response){try{var u=new URL(event.url);u.host=window.location.host;u.hostname=window.location.hostname;u.protocol=window.location.protocol;event.url=u.toString();}catch(e){}});$container.on('loaded.infiniteScroll',function(data){$('.pagination-results').html($(data).find('.pagination-results'));});}
$('.revolution').each(function(){var $this=$(this);var $img=$('>img',this);$this.css('height',$img.height());var options=$.extend(true,{spinner:'off',sliderType:'standard',sliderLayout:'auto',autoHeight:'on',navigation:{arrows:{enable:true}}},$this.data('options'));var $slider=$('.rev_slider',this).revolution(options);$slider.on('revolution.slide.onloaded',function(){$img.remove();$this.removeClass('rev_hide_navigation');$this.find('.tp-caption-hotspot').popover({container:'body',trigger:'hover',html:true,template:'<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>'});});$slider.on('revolution.slide.onchange',function(){$this.removeAttr('style');});$this.data('slider',$slider);});$('.layerslider').each(function(){var $this=$(this);var $img=$('>img',this);$this.css({width:$this.width(),height:$this.height()});var options=$.extend(true,{sliderVersion:'6.1.0',skin:'v6',maxRatio:1,navStartStop:false,showCircleTimer:false,tnContainerWidth:'100%',skinsPath:'catalog/view/theme/Istanbul3/lib/layerslider/skins/'},$this.data('options'));$this.on('sliderDidLoad',function(){$img.remove();});var $slider=$this.layerSlider(options);$slider.on('slideTimelineDidCreate',function(){$this.find('.ls-layer-hotspot').each(function(){var $this=$(this);if(!$this.data('bs.popover')){$this.popover({container:'body',trigger:'hover',html:true,template:'<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>'});}});});});$('.master-slider').each(function(){var $this=$(this);var options=$.extend(true,{loop:true,mobileBGVideo:true},$this.data('options'));var $slider=$this.masterslider(options);var $img=$('>img',$(this).parent());$slider.masterslider('slider').api.addEventListener(MSSliderEvent.INIT,function(){$slider.parent().find('.Istanbul-loading').remove();$img.css({position:'absolute','z-index':-1});setTimeout(function(){$img.remove();$this.parent().css('background-image','none');},1500);});$slider.masterslider('slider').api.addEventListener(MSSliderEvent.CHANGE_START,function(){$this.find('video').each(function(){$(this)[0].pause();});});if($this.data('parallax')){MSScrollParallax.setup($slider.masterslider('slider'),0,$this.data('parallax'),false);}});$('.isotope').each(function(){var $this=$(this);var filter=$this.find('ul .active a').attr('data-filter')||null;var $isotope=$this.find('.isotope-grid').isotope({itemSelector:'.isotope-item',filter:filter});$this.find('ul a').on('click',function(){var $this2=$(this);$this.find('ul li').removeClass('active');$this2.closest('li').addClass('active');$isotope.isotope({filter:$this2.attr('data-filter')});});});$('.swiper').each(function(){var $this=$(this);var c='c0';if($content.has($this).length){c='c'+window['Istanbul']['columnsCount'];}else if($column_left.has($this).length||$column_right.has($this).length){c='sc';}
var itemsPerRow=$this.data('items-per-row')?$this.data('items-per-row')[c]:{0:{items:1,spacing:0}};var breakpoints={};$.each(itemsPerRow,function(v,k){breakpoints[v]={slidesPerView:parseInt(k.items,10),slidesPerGroup:parseInt(k.items,10),spaceBetween:parseInt(k.spacing,10)}});var options=$.extend({init:false,slidesPerView:parseInt(itemsPerRow[0].items,10),slidesPerGroup:parseInt(itemsPerRow[0].items,10),spaceBetween:parseInt(itemsPerRow[0].spacing,10),breakpoints:breakpoints,observer:true,observeParents:true,paginationClickable:true,preventClicks:false,preventClicksPropagation:false,simulateTouch:true,watchSlidesProgress:true,watchSlidesVisibility:true,navigation:{nextEl:$this.find('.swiper-button-next'),prevEl:$this.find('.swiper-button-prev')},pagination:{el:$this.find('.swiper-pagination'),type:'bullets',clickable:true},scrollbar:$this.find('.swiper-scrollbar'),scrollbarHide:false,scrollbarDraggable:true},$this.data('options'));if(options.loop&&($(this).find('.swiper-slide').length<2)){options.loop=false;}
if(!Istanbul.isDesktop){options.a11y=false;}
var swiper=new Swiper($('.swiper-container',this),options);function checkPages(){if($('.product-image').hasClass('direction-vertical')&&$this.hasClass('additional-images')){var height=Istanbul['isPopup']?Istanbul['quickviewPageStyleAdditionalImagesHeightAdjustment']:Istanbul['productPageStyleAdditionalImagesHeightAdjustment'];var interval=setInterval(function(){var imageHeight=$('.main-image .swiper-slide-visible img').outerHeight();if(imageHeight){$this.css('height',imageHeight+(parseInt(height,10)||0));swiper.update();clearInterval(interval);$('.product-image').addClass('additional-images-loaded');}},1000);}
if(swiper.isBeginning&&swiper.isEnd){$this.removeClass('swiper-has-pages');}else{$this.addClass('swiper-has-pages');}}
swiper.on('init',checkPages);swiper.on('resize',checkPages);swiper.init();if(options.autoplay){if(options.pauseOnHover){$('.swiper-container',this).hover(function(){swiper.autoplay.stop();},function(){swiper.autoplay.start();});}
swiper.on('observerUpdate',function(){var visible=$(swiper.$el).is(':visible');var running=swiper.autoplay.running;if(visible&&!running){swiper.autoplay.start();}
if(!visible&&running){swiper.autoplay.stop();}});}
$this.data('swiper',swiper);});$(document).delegate('[data-gallery]','click',function(){var $this=$(this);var $gallery=$($this.data('gallery'));var index=parseInt($this.data('index'),10)||0;if($gallery.data('lightGallery')){$gallery.data('lightGallery').s.index=index;}
$gallery.lightGallery($.extend({dynamic:true,dynamicEl:$gallery.data('images'),index:index,download:false,loadYoutubeThumbnail:false,loadVimeoThumbnail:false,share:false,pager:false,fullScreen:false,autoplay:false,autoplayControls:false,thumbWidth:100,thumbContHeight:100,thumbMargin:0,showThumbByDefault:true,hash:false},$gallery.data('options')));$gallery.on('onAfterOpen.lg',function(){$('.lg-backdrop').addClass($gallery.data('lightGallery').s.addClass);});return false;});$('.module-catalog.image-on-hover .subitem').hover(function(){var $this=$(this);var $img=$this.closest('.item-content').find('.catalog-image img');if($img.length){$img[0]._src=$img.attr('src');$img[0]._srcSet=$img.attr('srcset');$img.attr('src',$this.data('image'));$img.attr('srcset',$this.data('image2x'));}},function(){var $this=$(this);var $img=$this.closest('.item-content').find('.catalog-image img');if($img.length){$img.attr('src',$img[0]._src);$img.attr('srcset',$img[0]._srcSet);}});$('.block-expand').on('click',function(){$(this).closest('.expand-block').find('.expand-content').toggleClass('block-expanded');});$('.search-input').focus(function(){$(this).closest('.header-search').addClass('focused');}).blur(function(){$(this).closest('.header-search').removeClass('focused');});istanbul_enable_stepper();istanbul_enable_countdown();$('.module-blog_search').each(function(){var $this=$(this);var $input=$this.find('input');var $button=$this.find('button');$button.on('click',function(){var search=$input.val().trim();if(search){parent.window.location=$this.data('url')+encodeURIComponent(search);}});$input.on('keydown',function(e){if(e.keyCode===13){var search=$input.val().trim();if(search){parent.window.location=$this.data('url')+encodeURIComponent(search);}}});});$(document).delegate('.module-newsletter .btn-primary','click',function(e){e.preventDefault();var $this=$(this);var $form=$this.closest('form');function ajax(unsubscribe){$.ajax({url:$form.attr('action')+(unsubscribe?'&unsubscribe=1':''),type:'post',dataType:'json',data:$form.serialize(),beforeSend:function(){$this.button('loading');},complete:function(){$this.button('reset');},success:function(json){if(json.status==='success'){if(json.response.unsubscribe){if(confirm(json.response.message)){ajax(true);}}else{alert(json.response.message);}}else{alert(json.response);}},error:function(xhr,ajaxOptions,thrownError){alert(thrownError+'\r\n'+xhr.statusText+'\r\n'+xhr.responseText);}})}
ajax();});$('.module-header_notice').each(function(){var $this=$(this);var options=$this.data('options');var cookie='hn-'+options['cookie'];if(!Cookies.get(cookie)){$this.slideDown();}
$this.find('.header-notice-close-button button').on('click',function(){anime({targets:$this[0],height:0,duration:parseInt(options['duration']),easing:options['ease'],complete:function(){$this.remove();}});Cookies.set(cookie,'1',{expires:365});});});$('.module-layout_notice').each(function(){var $this=$(this);var options=$this.data('options');var cookie='ln-'+options['cookie'];if(!Cookies.get(cookie)){$this.slideDown();}
$this.find('.layout-notice-close-button button').on('click',function(){anime({targets:$this[0],height:0,duration:parseInt(options['duration']),easing:options['ease'],complete:function(){$this.remove();}});Cookies.set(cookie,'1',{expires:365});});});$('.module-notification').each(function(){var $this=$(this);var options=$this.data('options');var cookie='n-'+options['cookie'];if(!Cookies.get(cookie)){$this.find('.notification-close').on('click',function(){Cookies.set(cookie,'1',{expires:365});});}});$(document).delegate('.notification-close','click',function(){var $this=$(this);var height=$this.parent().outerHeight();$this.parent().next('div').css('margin-top',-height);$('.removed').removeClass('removed');$this.parent().addClass('fade-out').on('transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd',function(){$(this).next('div').addClass('removed').css('margin-top','');$(this).remove();});});$('.module-popup').each(function(){var $this=$(this);var options=$.extend({message:$this.html(),timeout:0},$this.data('options'));var cookie='p-'+options['cookie'];if(!Cookies.get(cookie)){setTimeout(function(){$('html').addClass('popup-open popup-center');var $checkbox=$this.find('.popup-dont-show input[type="checkbox"]');$checkbox.on('change',function(){if($(this).is(':checked')){Cookies.set(cookie,'1',{expires:365});}else{Cookies.remove(cookie);}});if($checkbox.is(':checked')){Cookies.set(cookie,'1',{expires:365});}},parseInt(options['showAfter'],10)||1);}
var hideAfter=parseInt(options['hideAfter'],10)||0;if(hideAfter){setTimeout(function(){$html.removeClass('popup-open popup-center');if($html.hasClass('iphone')||$html.hasClass('ipad')){iNoBounce.disable();}
$('.popup-wrapper').attr('removing',true);setTimeout(function(){if($('.popup-wrapper').attr('removing')){$('.popup-wrapper').remove();}},5000);},hideAfter);}});$(document).delegate('.popup-close, .popup-bg-closable, .btn-popup:not([href])','click',function(){$html.removeClass('popup-open popup-center');if($html.hasClass('iphone')||$html.hasClass('ipad')){iNoBounce.disable();}
$('.popup-wrapper').attr('removing',true);setTimeout(function(){if($('.popup-wrapper').attr('removing')){$('.popup-wrapper').remove();}},5000);});$(document).on('keydown',function(e){if(e.keyCode===27){parent.$('.popup-bg-closable').trigger('click');}});$(document).delegate('html.popup-login .login-form button, html.popup-register .register-form .buttons button','click',function(e){e.preventDefault();var $this=$(this);var $form=$this.closest('form');$form.find('.has-error').removeClass('has-error');$form.find('.text-danger').remove();$this.button('loading');$.ajax({url:$form.attr('action').replace('https:',location.protocol),type:'post',data:$form.serialize(),dataType:'json',error:function(){$this.button('reset');},success:function(json){if(json.status==='success'){if($form.hasClass('login-form')){if(parent.$('html').hasClass('route-account-logout')){parent.window.location=$('base').attr('href');}else{parent.window.location.reload();}}else{if(json.customer){parent.window.location=$('base').attr('href');}else{parent.window.location='index.php?route=account/success';}}}else{$this.button('reset');$.each(json.response,function(field,value){if(field==='custom_field'){$.each(value,function(key,val){$('#custom-field'+key).addClass('has-error').find('input').after('<div class="text-danger">'+val+'</div>');});}else{$form.find('[name="'+field+'"]').closest('.form-group').addClass('has-error').after('<div class="text-danger">'+value+'</div>');}});if(json.response.warning){var $span=$('<span style="display: none !important;"></span>').html(json.response.warning);$span.appendTo($('body'));var msg=$span.html();$span.remove();alert(msg);}}}});});$('.module-form').each(function(){if($.fn.datetimepicker){$('.date',this).datetimepicker({pickTime:false});$('.datetime',this).datetimepicker({pickDate:true,pickTime:true});$('.time',this).datetimepicker({pickDate:false});}
$('.upload-btn',this).on('click',function(){var node=this;$('#form-upload').remove();$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');$('#form-upload input[name=\'file\']').trigger('click');if(typeof timer!='undefined'){clearInterval(timer);}
timer=setInterval(function(){if($('#form-upload input[name=\'file\']').val()!=''){clearInterval(timer);$.ajax({url:'index.php?route=tool/upload',type:'post',dataType:'json',data:new FormData($('#form-upload')[0]),cache:false,contentType:false,processData:false,beforeSend:function(){$(node).button('loading');},complete:function(){$(node).button('reset');},success:function(json){$('.text-danger').remove();if(json['error']){$(node).parent().find('input').after('<div class="text-danger">'+json['error']+'</div>');}
if(json['success']){alert(json['success']);$(node).parent().find('input').val(json['code']);}},error:function(xhr,ajaxOptions,thrownError){alert(thrownError+'\r\n'+xhr.statusText+'\r\n'+xhr.responseText);}});}},500);});});$(document).delegate('.btn-extra','click',function(){parent.window.__popup_url=$(this).data('product_url')||'';});$(document).delegate('.module-form .btn-primary','click',function(e){e.preventDefault();var $this=$(this);var $form=$this.closest('.module-form').find('form');$form.find('.has-error').removeClass('has-error');$form.find('.text-danger').remove();var data=$form.serializeArray();data.push({name:'url',value:parent.window.__popup_url||parent.window.location.toString()});$.ajax({url:$form.attr('action'),type:'post',data:data,dataType:'json',beforeSend:function(){$this.button('loading');},complete:function(){$this.button('reset');},success:function(response){if(response.status==='success'){alert(response.response.message);$form[0].reset();parent.window.__popup_url=undefined;parent.$('.module-popup-'+Istanbul['modulePopupId']+' .popup-close').trigger('click');}
if(response.status==='error'){$.each(response.response.errors,function(field,error){if(field==='agree'){alert(error);}else if(field==='captcha'){$form.find('.captcha').addClass('has-error');}else{$form.find('[name^="'+field+'"]').closest('.form-group').addClass('has-error').after('<div class="text-danger">'+error+'</div>');}});}},error:function(xhr,ajaxOptions,thrownError){alert(thrownError+'\r\n'+xhr.statusText+'\r\n'+xhr.responseText);}});});$(document).delegate('.grid-list .view-btn','click',function(){var $this=$(this);var $products=$('.main-products');var view=$this.data('view');var current=$products.hasClass('product-grid')?'grid':'list';$this.tooltip('hide');if(view!==current){$products.addClass('no-transitions').removeClass('product-'+current).addClass('product-'+view);setTimeout(function(){$products.removeClass('no-transitions');},1);Cookies.set('view',view,{expires:365});}
$('.grid-list .view-btn').removeClass('active');$this.addClass('active');});$('.desktop-main-menu-wrapper #main-menu > .j-menu > .main-menu-item').first().addClass('first-dropdown');var $desktop_main_menu_wrapper=$('.desktop-main-menu-wrapper');$desktop_main_menu_wrapper.delegate('.main-menu > .j-menu > .menu-item:not(.dropdown)','mouseover',function(){$body.addClass('menu-hover');});$desktop_main_menu_wrapper.delegate('.main-menu > .j-menu > .menu-item:not(.dropdown)','mouseleave',function(){$body.removeClass('menu-hover');});$desktop_main_menu_wrapper.delegate('.main-menu > .j-menu > .dropdown','mouseover',function(){$body.addClass('menu-open');});$desktop_main_menu_wrapper.delegate('.main-menu','mouseleave',function(){$body.removeClass('menu-open');});if(($html.hasClass('iphone')||$html.hasClass('ipad'))&&!$html.hasClass('popup-open')){iNoBounce.disable();}
$(document).delegate('.menu-trigger','click',function(e){e.stopPropagation();$html.addClass('mobile-overlay mobile-main-menu-container-open');if($html.hasClass('mobile-menu-active')){$('[data-is-open]').each(function(){$('> a > .open-menu',this).trigger('click');$(this).removeAttr('data-is-open');});}
var $container=$('.mobile-main-menu-container');$container.outerWidth();$container.addClass('animating');if($html.hasClass('iphone')||$html.hasClass('ipad')){iNoBounce.enable();}});if($html.hasClass('mobile-header-active')){$('.cart-content > ul').appendTo('.mobile-cart-content-wrapper');}
$(document).delegate('.mobile-header-active .cart-heading','click',function(e){e.stopPropagation();$html.addClass('mobile-overlay mobile-cart-content-container-open');var $totals=$('.cart-totals').outerHeight();$('.cart-products').css('padding-bottom',$totals-1);var $container=$('.mobile-cart-content-container');$container.outerWidth();$container.addClass('animating');if($html.hasClass('iphone')||$html.hasClass('ipad')){iNoBounce.enable();}
return false;});if(Istanbul['isPhone']||(Istanbul['isTablet']&&(!Istanbul['globalPageColumnLeftTabletStatus']||!Istanbul['globalPageColumnRightTabletStatus']))){if($('.module-filter').length){$('.module-filter h3 > *').prependTo('.mobile-filter-container .mobile-wrapper-header');$('.module-filter').appendTo('.mobile-filter-wrapper');$('<a class="mobile-filter-trigger btn">'+Istanbul['mobileFilterButtonText']+'</a>').appendTo('body');}}
$(document).delegate('.mobile-header-active .mobile-filter-trigger','click',function(e){e.stopPropagation();$html.addClass('mobile-overlay mobile-filter-container-open');var $container=$('.mobile-filter-container');$container.outerWidth();$container.addClass('animating');if($html.hasClass('iphone')||$html.hasClass('ipad')){iNoBounce.enable();}
return false;});$(document).delegate('.x, .site-wrapper, .close-filter','click',function(){$('.mobile-container.animating').removeClass('animating');$html.removeClass('mobile-overlay');setTimeout(function(){$html.removeClass('mobile-main-menu-container-open mobile-cart-content-container-open mobile-filter-container-open');},300);if($html.hasClass('iphone')||$html.hasClass('ipad')){iNoBounce.disable();}});if($html.hasClass('route-product-product')){$(document).delegate('.additional-image','click',function(){$('.additional-image').removeClass('swiper-slide-active');$(this).addClass('swiper-slide-active');var $s=$('.main-image').data('swiper');if($s.params.loop){$s.slideToLoop($(this).data('index'),0);}else{$s.slideTo($(this).data('index'),0);}});if(!('ontouchstart'in document)){if(Istanbul['isPopup']?Istanbul['quickviewPageStyleCloudZoomStatus']:Istanbul['productPageStyleCloudZoomStatus']){$('.main-image img').each(function(){var $this=$(this);$this.ImageZoom({type:Istanbul['isPopup']?Istanbul['quickviewPageStyleCloudZoomPosition']:Istanbul['productPageStyleCloudZoomPosition'],showDescription:false,offset:[0,0],zoomSize:[$this.width(),$this.height()],bigImageSrc:$this.data('largeimg')});});$('.product-image').mouseover(function(){$('.zm-viewer').delay(200).queue(function(next){$(this).css('opacity','1');next();});}).mouseleave(function(){$('.zm-viewer').css('opacity','0');});}}
if((Istanbul['isPopup']?Istanbul['quickviewPageStyleOptionsSelect']:Istanbul['productPageStyleOptionsSelect'])==='all'){$('.product-options .form-group .radio:first-child input, .product-options .form-group .checkbox:first-child input').prop('checked',true);$('.product-options .form-group select').each(function(){$(this).find('option').eq(1).prop('selected',true);});}
if((Istanbul['isPopup']?Istanbul['quickviewPageStyleOptionsSelect']:Istanbul['productPageStyleOptionsSelect'])==='required'){$('.product-options .form-group.required .radio:first-child input, .product-options .form-group.required .checkbox:first-child input').prop('checked',true);$('.product-options .form-group.required select').each(function(){$(this).find('option').eq(1).prop('selected',true);});}
if(Istanbul['isPopup']?Istanbul['quickviewPageStylePriceUpdate']:Istanbul['productPageStylePriceUpdate']){function autoUpdatePrice(){$.ajax({url:'index.php?route=istanbul3/price',type:'post',data:$('#product-id, #product-quantity, #product input[type="radio"]:checked, #product input[type="checkbox"]:checked, #product select'),dataType:'json',beforeSend:function(){},complete:function(){},success:function(json){if(json['response']['status']==='error'){alert(json['response']['message']);}else{if(json['response']['tax']){$('.product-tax').html(json['response']['tax']);}
if(json['response']['price']){if(json['response']['special']){$('.product-price-group .product-price-old').html(json['response']['price']);$('.product-price-group .product-price-new').html(json['response']['special']);}else{$('.product-price-group .product-price').html(json['response']['price']);}}
if(json['response']['discounts']){$('.product-discount').each(function(index){$(this).html(json['response']['discounts'][index]);});}
if(json['response']['weight']){$('.product-stats .product-weight span').html(json['response']['weight']);}}}});}
$('.product-options input[type="radio"], .product-options input[type="checkbox"], .product-options select, #product-quantity').on('change',autoUpdatePrice);autoUpdatePrice();}}
if($html.hasClass('route-Istanbul3-popup-page')){$(document).on('click',function(){parent.resize_iframe(Istanbul['popupModuleId'],$('.popup-content').height());});}
$('.links-menu .module-title').addClass('closed');$('.links-menu .module-title').click(function(){$(this).toggleClass('closed');});if(Istanbul.isPopup){$('a[href]').each(function(){var $this=$(this);if(!$this.attr('target')){$this.attr('target','_blank');}
if(Istanbul.isPhone||Istanbul.isTablet){$this.removeClass('agree');}});}});$(window).on('load',function(){var $html=$('html');var $body=$('body');var $search=$('#search').find('input[name=\'search\']');$('.search-button').on('click',function(){var url=$(this).data('search-url');var value=$search.val();var category_id=parseInt($search.attr('data-category_id'));if(value){url+=encodeURIComponent(value);}
if(Istanbul['searchStyleSearchAutoSuggestDescription']){url+='&description=true';}
if(category_id){url+='&category_id='+category_id;}
location=url;});$search.on('keydown',function(e){if(e.keyCode===13){$('.search-button').trigger('click');}});$('.search-categories li').on('click',function(e){e.stopPropagation();var $this=$(this);$('.search-categories-button').html($this.html());$search.attr('data-category_id',$this.attr('data-category_id'))});if(!Istanbul.isPopup&&Istanbul['isDesktop']&&Istanbul['stickyStatus']&&(['classic','mega','default'].includes(Istanbul['headerType']))){var holder=document.body;var headerHeightOffset=$('.desktop-main-menu-wrapper').offset().top+(parseInt(Istanbul['stickyAt'],10)||100);var menuHeight=$('.desktop-main-menu-wrapper').outerHeight();function enableSticky(){if(Istanbul['headerType']==='classic'||Istanbul['headerType']==='mega'){$body.css('padding-top',menuHeight);}}
function disableSticky(){if(Istanbul['headerType']==='classic'||Istanbul['headerType']==='mega'){$body.css('padding-top','');}}
function checkStickyOffset(){return headerHeightOffset<=window.scrollY;}
function checkSticky(){var old=holder.classList.contains('is-sticky');holder.classList.toggle('is-sticky',checkStickyOffset());var current=holder.classList.contains('is-sticky');if(current!==old){if(current){enableSticky();}else{disableSticky();}}}
function checkStickyListener(){requestAnimationFrame(checkSticky)}
window.addEventListener('scroll',checkStickyListener,false);}
if(!Istanbul.isPopup&&Istanbul['isDesktop']&&Istanbul['stickyStatus']&&Istanbul['topBarStatus']&&(['compact','slim'].includes(Istanbul['headerType']))){var compact=$('.mid-bar');if(compact.length){$(window).on('scroll',function(){var compactOffset=compact.offset().top;var scroll=$(this)[0].scrollY
if(scroll>=compactOffset){$('body').addClass('sticky-compact');}else{$('body').removeClass('sticky-compact');}});}}
if(!Istanbul.isPopup&&Istanbul['isDesktop']&&Istanbul['stickyStatus']&&!Istanbul['topBarStatus']&&!Istanbul['stickyFullHomePadding']&&(['compact','slim'].includes(Istanbul['headerType']))){var site=$('.site-wrapper');var header=$('.mid-bar').outerHeight();if(site.length){$(window).on('scroll',function(){var siteOffset=site.offset().top-header+1;var scroll=$(this)[0].scrollY
if(scroll>=siteOffset){$('body').addClass('sticky-compact');}else{$('body').removeClass('sticky-compact');}});}}
if(!Istanbul.isPopup&&Istanbul['isDesktop']&&Istanbul['stickyStatus']&&!Istanbul['topBarStatus']&&Istanbul['stickyFullHomePadding']&&(['compact','slim'].includes(Istanbul['headerType']))){var site=$('.site-wrapper');var header=$('html:not(.route-common-home) .mid-bar').outerHeight();if(site.length){$(window).on('scroll',function(){var siteOffset=site.offset().top-header+1;var scroll=$(this)[0].scrollY
if(scroll>=siteOffset){$('body').addClass('sticky-compact');}else{$('body').removeClass('sticky-compact');}});}}
if(!Istanbul['isDesktop']&&Istanbul['headerMobileStickyStatus']&&$html.hasClass('mobile-header-active')){var mobileBar=$('.mobile-header .sticky-bar');if(mobileBar.length){var mobileBarSticky=mobileBar.offset().top;var mobileBarHeight=mobileBar.outerHeight();$(window).on('scroll',function(){var scroll=$(this)[0].scrollY
if(scroll>=mobileBarSticky){mobileBar.addClass('mobile-bar-sticky');$body.css('padding-top',mobileBarHeight);}else{mobileBar.removeClass('mobile-bar-sticky');$body.css('padding-top','');}});}}
if(Istanbul['isDesktop']&&(Istanbul['headerMiniSearchDisplay']==='page')){$('.search-trigger, .desktop .search-categories .j-menu > li > a').click(function(){$('.header-search input').focus();});}
if(Istanbul['scrollTop']){var scrollTopTimeout;$(window).on('scroll',function(){clearTimeout(scrollTopTimeout);var scroll=$(this)[0].scrollY
if(scroll>500){$('.scroll-top').addClass('scroll-top-active');scrollTopTimeout=setTimeout(function(){$('.scroll-top').removeClass('scroll-top-active');},3000);}else{$('.scroll-top').removeClass('scroll-top-active');}});$('.scroll-top').click(function(){anime({targets:'html, body',scrollTop:0,duration:750,easing:'easeInOutQuad'});});}
if($html.hasClass('footer-reveal')){var footerHeight=$('.desktop.footer-reveal footer').outerHeight();$('.desktop body').css('padding-bottom',footerHeight);}});$('.block-map iframe').on('load',function(){$('.block-map .Istanbul-loading').hide();});$('script[type="text/javascript/defer"]').each(function(){$(this).after($('<script type="text/javascript"/>').text($(this).clone().text())).remove()});