PageSourceSearch

https://janssencosmetics.ru/bitrix/cache/js/s1/aspro_max/template_…a62cb4b0c6f276d21ff_v1.js?17900720201548367

js janssencosmetics.ru collected 2026-10-04 23:28:31 UTC 1,548,367 bytes, 39,136 lines download raw bytes

vendor: 32,507 bytes, lines 1-6
1
2; /* Start:"a:4:{s:4:"full";s:73:"/local/templates/aspro_max/vendor/js/velocity/velocity.js?166601759344791";s:6:"source";s:57:"/local/templates/aspro_max/vendor/js/velocity/velocity.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3/*! VelocityJS.org (1.5.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
4/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
5!function(a){"use strict";function b(a){var b=a.length,d=c.type(a);return"function"!==d&&!c.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===d||0===b||"number"==typeof b&&b>0&&b-1 in a))}if(!a.jQuery){var c=function(a,b){return new c.fn.init(a,b)};c.isWindow=function(a){return a&&a===a.window},c.type=function(a){return a?"object"==typeof a||"function"==typeof a?e[g.call(a)]||"object":typeof a:a+""},c.isArray=Array.isArray||function(a){return"array"===c.type(a)},c.isPlainObject=function(a){var b;if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!f.call(a,"constructor")&&!f.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}for(b in a);return b===undefined||f.call(a,b)},c.each=function(a,c,d){var e=0,f=a.length,g=b(a);if(d){if(g)for(;e<f&&c.apply(a[e],d)!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&&c.apply(a[e],d)===!1)break}else if(g)for(;e<f&&c.call(a[e],e,a[e])!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&&c.call(a[e],e,a[e])===!1)break;return a},c.data=function(a,b,e){if(e===undefined){var f=a[c.expando],g=f&&d[f];if(b===undefined)return g;if(g&&b in g)return g[b]}else if(b!==undefined){var h=a[c.expando]||(a[c.expando]=++c.uuid);return d[h]=d[h]||{},d[h][b]=e,e}},c.removeData=function(a,b){var e=a[c.expando],f=e&&d[e];f&&(b?c.each(b,function(a,b){delete f[b]}):delete d[e])},c.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[i]||{},i++),"object"!=typeof h&&"function"!==c.type(h)&&(h={}),i===j&&(h=this,i--);i<j;i++)if(f=arguments[i])for(e in f)f.hasOwnProperty(e)&&(a=h[e],d=f[e],h!==d&&(k&&d&&(c.isPlainObject(d)||(b=c.isArray(d)))?(b?(b=!1,g=a&&c.isArray(a)?a:[]):g=a&&c.isPlainObject(a)?a:{},h[e]=c.extend(k,g,d)):d!==undefined&&(h[e]=d)));return h},c.queue=function(a,d,e){if(a){d=(d||"fx")+"queue";var f=c.data(a,d);return e?(!f||c.isArray(e)?f=c.data(a,d,function(a,c){var d=c||[];return a&&(b(Object(a))?function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;)a[e++]=b[d++];if(c!==c)for(;b[d]!==undefined;)a[e++]=b[d++];a.length=e,a}(d,"string"==typeof a?[a]:a):[].push.call(d,a)),d}(e)):f.push(e),f):f||[]}},c.dequeue=function(a,b){c.each(a.nodeType?[a]:a,function(a,d){b=b||"fx";var e=c.queue(d,b),f=e.shift();"inprogress"===f&&(f=e.shift()),f&&("fx"===b&&e.unshift("inprogress"),f.call(d,function(){c.dequeue(d,b)}))})},c.fn=c.prototype={init:function(a){if(a.nodeType)return this[0]=a,this;throw new Error("Not a DOM node.")},offset:function(){var b=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:b.top+(a.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:b.left+(a.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){var a=this[0],b=function(a){for(var b=a.offsetParent;b&&"html"!==b.nodeName.toLowerCase()&&b.style&&"static"===b.style.position;)b=b.offsetParent;return b||document}(a),d=this.offset(),e=/^(?:body|html)$/i.test(b.nodeName)?{top:0,left:0}:c(b).offset();return d.top-=parseFloat(a.style.marginTop)||0,d.left-=parseFloat(a.style.marginLeft)||0,b.style&&(e.top+=parseFloat(b.style.borderTopWidth)||0,e.left+=parseFloat(b.style.borderLeftWidth)||0),{top:d.top-e.top,left:d.left-e.left}}};var d={};c.expando="velocity"+(new Date).getTime(),c.uuid=0;for(var e={},f=e.hasOwnProperty,g=e.toString,h="Boolean Number String Function Array Date RegExp Object Error".split(" "),i=0;i<h.length;i++)e["[object "+h[i]+"]"]=h[i].toLowerCase();c.fn.init.prototype=c.fn,a.Velocity={Utilities:c}}}(window),function(a){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a():"function"==typeof define&&define.amd?define(a):a()}(function(){"use strict";return function(a,b,c,d){function e(a){for(var b=-1,c=a?a.length:0,d=[];++b<c;){var e=a[b];e&&d.push(e)}return d}function f(a){return u.isWrapped(a)?a=s.call(a):u.isNode(a)&&(a=[a]),a}function g(a){var b=o.data(a,"velocity");return null===b?d:b}function h(a,b){var c=g(a);c&&c.delayTimer&&!c.delayPaused&&(c.delayRemaining=c.delay-b+c.delayBegin,c.delayPaused=!0,clearTimeout(c.delayTimer.setTimeout))}function i(a,b){var c=g(a);c&&c.delayTimer&&c.delayPaused&&(c.delayPaused=!1,c.delayTimer.setTimeout=setTimeout(c.delayTimer.next,c.delayRemaining))}function j(a){return function(b){return Math.round(b*a)*(1/a)}}function k(a,c,d,e){function f(a,b){return 1-3*b+3*a}function g(a,b){return 3*b-6*a}function h(a){return 3*a}function i(a,b,c){return((f(b,c)*a+g(b,c))*a+h(b))*a}function j(a,b,c){return 3*f(b,c)*a*a+2*g(b,c)*a+h(b)}function k(b,c){for(var e=0;e<p;++e){var f=j(c,a,d);if(0===f)return c;c-=(i(c,a,d)-b)/f}return c}function l(){for(var b=0;b<t;++b)x[b]=i(b*u,a,d)}function m(b,c,e){var f,g,h=0;do{g=c+(e-c)/2,f=i(g,a,d)-b,f>0?e=g:c=g}while(Math.abs(f)>r&&++h<s);return g}function n(b){for(var c=0,e=1,f=t-1;e!==f&&x[e]<=b;++e)c+=u;--e;var g=(b-x[e])/(x[e+1]-x[e]),h=c+g*u,i=j(h,a,d);return i>=q?k(b,h):0===i?h:m(b,c,c+u)}function o(){y=!0,a===c&&d===e||l()}var p=4,q=.001,r=1e-7,s=10,t=11,u=1/(t-1),v="Float32Array"in b;if(4!==arguments.length)return!1;for(var w=0;w<4;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))return!1;a=Math.min(a,1),d=Math.min(d,1),a=Math.max(a,0),d=Math.max(d,0);var x=v?new Float32Array(t):new Array(t),y=!1,z=function(b){return y||o(),a===c&&d===e?b:0===b?0:1===b?1:i(n(b),c,e)};z.getControlPoints=function(){return[{x:a,y:c},{x:d,y:e}]};var A="generateBezier("+[a,c,d,e]+")";return z.toString=function(){return A},z}function l(a,b){var c=a;return u.isString(a)?y.Easings[a]||(c=!1):c=u.isArray(a)&&1===a.length?j.apply(null,a):u.isArray(a)&&2===a.length?z.apply(null,a.concat([b])):!(!u.isArray(a)||4!==a.length)&&k.apply(null,a),c===!1&&(c=y.Easings[y.defaults.easing]?y.defaults.easing:x),c}function m(a){if(a){var b=y.timestamp&&a!==!0?a:r.now(),c=y.State.calls.length;c>1e4&&(y.State.calls=e(y.State.calls),c=y.State.calls.length);for(var f=0;f<c;f++)if(y.State.calls[f]){var h=y.State.calls[f],i=h[0],j=h[2],k=h[3],l=!!k,q=null,s=h[5],t=h[6];if(k||(k=y.State.calls[f][3]=b-16),s){if(s.resume!==!0)continue;k=h[3]=Math.round(b-t-16),h[5]=null}t=h[6]=b-k;for(var v=Math.min(t/j.duration,1),w=0,x=i.length;w<x;w++){var z=i[w],B=z.element;if(g(B)){var D=!1;if(j.display!==d&&null!==j.display&&"none"!==j.display){if("flex"===j.display){var E=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];o.each(E,function(a,b){A.setPropertyValue(B,"display",b)})}A.setPropertyValue(B,"display",j.display)}j.visibility!==d&&"hidden"!==j.visibility&&A.setPropertyValue(B,"visibility",j.visibility);for(var F in z)if(z.hasOwnProperty(F)&&"element"!==F){var G,H=z[F],I=u.isString(H.easing)?y.Easings[H.easing]:H.easing;if(u.isString(H.pattern)){var J=1===v?function(a,b,c){var d=H.endValue[b];return c?Math.round(d):d}:function(a,b,c){var d=H.startValue[b],e=H.endValue[b]-d,f=d+e*I(v,j,e);return c?Math.round(f):f};G=H.pattern.replace(/{(\d+)(!)?}/g,J)}else if(1===v)G=H.endValue;else{var K=H.endValue-H.startValue;G=H.startValue+K*I(v,j,K)}if(!l&&G===H.currentValue)continue;if(H.currentValue=G,"tween"===F)q=G;else{var L;if(A.Hooks.registered[F]){L=A.Hooks.getRoot(F);var M=g(B).rootPropertyValueCache[L];M&&(H.rootPropertyValue=M)}var N=A.setPropertyValue(B,F,H.currentValue+(p<9&&0===parseFloat(G)?"":H.unitType),H.rootPropertyValue,H.scrollData);A.Hooks.registered[F]&&(A.Normalizations.registered[L]?g(B).rootPropertyValueCache[L]=A.Normalizations.registered[L]("extract",null,N[1]):g(B).rootPropertyValueCache[L]=N[1]),"transform"===N[0]&&(D=!0)}}j.mobileHA&&g(B).transformCache.translate3d===d&&(g(B).transformCache.translate3d="(0px, 0px, 0px)",D=!0),D&&A.flushTransformCache(B)}}j.display!==d&&"none"!==j.display&&(y.State.calls[f][2].display=!1),j.visibility!==d&&"hidden"!==j.visibility&&(y.State.calls[f][2].visibility=!1),j.progress&&j.progress.call(h[1],h[1],v,Math.max(0,k+j.duration-b),k,q),1===v&&n(f)}}y.State.isTicking&&C(m)}function n(a,b){if(!y.State.calls[a])return!1;for(var c=y.State.calls[a][0],e=y.State.calls[a][1],f=y.State.calls[a][2],h=y.State.calls[a][4],i=!1,j=0,k=c.length;j<k;j++){var l=c[j].element;b||f.loop||("none"===f.display&&A.setPropertyValue(l,"display",f.display),"hidden"===f.visibility&&A.setPropertyValue(l,"visibility",f.visibility));var m=g(l);if(f.loop!==!0&&(o.queue(l)[1]===d||!/\.velocityQueueEntryFlag/i.test(o.queue(l)[1]))&&m){m.isAnimating=!1,m.rootPropertyValueCache={};var n=!1;o.each(A.Lists.transforms3D,function(a,b){var c=/^scale/.test(b)?1:0,e=m.transformCache[b];m.transformCache[b]!==d&&new RegExp("^\\("+c+"[^.]").test(e)&&(n=!0,delete m.transformCache[b])}),f.mobileHA&&(n=!0,delete m.transformCache.translate3d),n&&A.flushTransformCache(l),A.Values.removeClass(l,"velocity-animating")}if(!b&&f.complete&&!f.loop&&j===k-1)try{f.complete.call(e,e)}catch(r){setTimeout(function(){throw r},1)}h&&f.loop!==!0&&h(e),m&&f.loop===!0&&!b&&(o.each(m.tweensContainer,function(a,b){if(/^rotate/.test(a)&&(parseFloat(b.startValue)-parseFloat(b.endValue))%360==0){var c=b.startValue;b.startValue=b.endValue,b.endValue=c}/^backgroundPosition/.test(a)&&100===parseFloat(b.endValue)&&"%"===b.unitType&&(b.endValue=0,b.startValue=100)}),y(l,"reverse",{loop:!0,delay:f.delay})),f.queue!==!1&&o.dequeue(l,f.queue)}y.State.calls[a]=!1;for(var p=0,q=y.State.calls.length;p<q;p++)if(y.State.calls[p]!==!1){i=!0;break}i===!1&&(y.State.isTicking=!1,delete y.State.calls,y.State.calls=[])}var o,p=function(){if(c.documentMode)return c.documentMode;for(var a=7;a>4;a--){var b=c.createElement("div");if(b.innerHTML="<!--[if IE "+a+"]><span></span><![endif]-->",b.getElementsByTagName("span").length)return b=null,a}return d}(),q=function(){var a=0;return b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||function(b){var c,d=(new Date).getTime();return c=Math.max(0,16-(d-a)),a=d+c,setTimeout(function(){b(d+c)},c)}}(),r=function(){var a=b.performance||{};if("function"!=typeof a.now){var c=a.timing&&a.timing.navigationStart?a.timing.navigationStart:(new Date).getTime();a.now=function(){return(new Date).getTime()-c}}return a}(),s=function(){var a=Array.prototype.slice;try{return a.call(c.documentElement),a}catch(b){return function(b,c){var d=this.length;if("number"!=typeof b&&(b=0),"number"!=typeof c&&(c=d),this.slice)return a.call(this,b,c);var e,f=[],g=b>=0?b:Math.max(0,d+b),h=c<0?d+c:Math.min(c,d),i=h-g;if(i>0)if(f=new Array(i),this.charAt)for(e=0;e<i;e++)f[e]=this.charAt(g+e);else for(e=0;e<i;e++)f[e]=this[g+e];return f}}}(),t=function(){return Array.prototype.includes?function(a,b){return a.includes(b)}:Array.prototype.indexOf?function(a,b){return a.indexOf(b)>=0}:function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return!0;return!1}},u={isNumber:function(a){return"number"==typeof a},isString:function(a){return"string"==typeof a},isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},isFunction:function(a){return"[object Function]"===Object.prototype.toString.call(a)},isNode:function(a){return a&&a.nodeType},isWrapped:function(a){return a&&a!==b&&u.isNumber(a.length)&&!u.isString(a)&&!u.isFunction(a)&&!u.isNode(a)&&(0===a.length||u.isNode(a[0]))},isSVG:function(a){return b.SVGElement&&a instanceof b.SVGElement},isEmptyObject:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}},v=!1;if(a.fn&&a.fn.jquery?(o=a,v=!0):o=b.Velocity.Utilities,p<=8&&!v)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(p<=7)return void(jQuery.fn.velocity=jQuery.fn.animate);var w=400,x="swing",y={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:b.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:c.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[],delayedElements:{count:0}},CSS:{},Utilities:o,Redirects:{},Easings:{},Promise:b.Promise,defaults:{queue:"",duration:w,easing:x,begin:d,complete:d,progress:d,display:d,visibility:d,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0,promiseRejectEmpty:!0},init:function(a){o.data(a,"velocity",{isSVG:u.isSVG(a),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:5,patch:0},debug:!1,timestamp:!0,pauseAll:function(a){var b=(new Date).getTime();o.each(y.State.calls,function(b,c){if(c){if(a!==d&&(c[2].queue!==a||c[2].queue===!1))return!0;c[5]={resume:!1}}}),o.each(y.State.delayedElements,function(a,c){c&&h(c,b)})},resumeAll:function(a){var b=(new Date).getTime();o.each(y.State.calls,function(b,c){if(c){if(a!==d&&(c[2].queue!==a||c[2].queue===!1))return!0;c[5]&&(c[5].resume=!0)}}),o.each(y.State.delayedElements,function(a,c){c&&i(c,b)})}};b.pageYOffset!==d?(y.State.scrollAnchor=b,y.State.scrollPropertyLeft="pageXOffset",y.State.scrollPropertyTop="pageYOffset"):(y.State.scrollAnchor=c.documentElement||c.body.parentNode||c.body,y.State.scrollPropertyLeft="scrollLeft",y.State.scrollPropertyTop="scrollTop");var z=function(){function a(a){return-a.tension*a.x-a.friction*a.v}function b(b,c,d){var e={x:b.x+d.dx*c,v:b.v+d.dv*c,tension:b.tension,friction:b.friction};return{dx:e.v,dv:a(e)}}function c(c,d){var e={dx:c.v,dv:a(c)},f=b(c,.5*d,e),g=b(c,.5*d,f),h=b(c,d,g),i=1/6*(e.dx+2*(f.dx+g.dx)+h.dx),j=1/6*(e.dv+2*(f.dv+g.dv)+h.dv);return c.x=c.x+i*d,c.v=c.v+j*d,c}return function d(a,b,e){var f,g,h,i={x:-1,v:0,tension:null,friction:null},j=[0],k=0;for(a=parseFloat(a)||500,b=parseFloat(b)||20,e=e||null,i.tension=a,i.friction=b,f=null!==e,f?(k=d(a,b),g=k/e*.016):g=.016;;)if(h=c(h||i,g),j.push(1+h.x),k+=16,!(Math.abs(h.x)>1e-4&&Math.abs(h.v)>1e-4))break;return f?function(a){return j[a*(j.length-1)|0]}:k}}();y.Easings={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},spring:function(a){return 1-Math.cos(4.5*a*Math.PI)*Math.exp(6*-a)}},o.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(a,b){y.Easings[b[0]]=k.apply(null,b[1])});var A=y.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"],units:["%","em","ex","ch","rem","vw","vh","vmin","vmax","cm","mm","Q","in","pc","pt","px","deg","grad","rad","turn","s","ms"],colorNames:{aliceblue:"240,248,255",antiquewhite:"250,235,215",aquamarine:"127,255,212",aqua:"0,255,255",azure:"240,255,255",beige:"245,245,220",bisque:"255,228,196",black:"0,0,0",blanchedalmond:"255,235,205",blueviolet:"138,43,226",blue:"0,0,255",brown:"165,42,42",burlywood:"222,184,135",cadetblue:"95,158,160",chartreuse:"127,255,0",chocolate:"210,105,30",coral:"255,127,80",cornflowerblue:"100,149,237",cornsilk:"255,248,220",crimson:"220,20,60",cyan:"0,255,255",darkblue:"0,0,139",darkcyan:"0,139,139",darkgoldenrod:"184,134,11",darkgray:"169,169,169",darkgrey:"169,169,169",darkgreen:"0,100,0",darkkhaki:"189,183,107",darkmagenta:"139,0,139",darkolivegreen:"85,107,47",darkorange:"255,140,0",darkorchid:"153,50,204",darkred:"139,0,0",darksalmon:"233,150,122",darkseagreen:"143,188,143",darkslateblue:"72,61,139",darkslategray:"47,79,79",darkturquoise:"0,206,209",darkviolet:"148,0,211",deeppink:"255,20,147",deepskyblue:"0,191,255",dimgray:"105,105,105",dimgrey:"105,105,105",dodgerblue:"30,144,255",firebrick:"178,34,34",floralwhite:"255,250,240",forestgreen:"34,139,34",fuchsia:"255,0,255",gainsboro:"220,220,220",ghostwhite:"248,248,255",gold:"255,215,0",goldenrod:"218,165,32",gray:"128,128,128",grey:"128,128,128",greenyellow:"173,255,47",green:"0,128,0",honeydew:"240,255,240",hotpink:"255,105,180",indianred:"205,92,92",indigo:"75,0,130",ivory:"255,255,240",khaki:"240,230,140",lavenderblush:"255,240,245",lavender:"230,230,250",lawngreen:"124,252,0",lemonchiffon:"255,250,205",lightblue:"173,216,230",lightcoral:"240,128,128",lightcyan:"224,255,255",lightgoldenrodyellow:"250,250,210",lightgray:"211,211,211",lightgrey:"211,211,211",lightgreen:"144,238,144",lightpink:"255,182,193",lightsalmon:"255,160,122",lightseagreen:"32,178,170",lightskyblue:"135,206,250",lightslategray:"119,136,153",lightsteelblue:"176,196,222",lightyellow:"255,255,224",limegreen:"50,205,50",lime:"0,255,0",linen:"250,240,230",magenta:"255,0,255",maroon:"128,0,0",mediumaquamarine:"102,205,170",mediumblue:"0,0,205",mediumorchid:"186,85,211",mediumpurple:"147,112,219",mediumseagreen:"60,179,113",mediumslateblue:"123,104,238",mediumspringgreen:"0,250,154",mediumturquoise:"72,209,204",mediumvioletred:"199,21,133",midnightblue:"25,25,112",mintcream:"245,255,250",mistyrose:"255,228,225",moccasin:"255,228,181",navajowhite:"255,222,173",navy:"0,0,128",oldlace:"253,245,230",olivedrab:"107,142,35",olive:"128,128,0",orangered:"255,69,0",orange:"255,165,0",orchid:"218,112,214",palegoldenrod:"238,232,170",palegreen:"152,251,152",paleturquoise:"175,238,238",palevioletred:"219,112,147",papayawhip:"255,239,213",peachpuff:"255,218,185",peru:"205,133,63",pink:"255,192,203",plum:"221,160,221",powderblue:"176,224,230",purple:"128,0,128",red:"255,0,0",rosybrown:"188,143,143",royalblue:"65,105,225",saddlebrown:"139,69,19",salmon:"250,128,114",sandybrown:"244,164,96",seagreen:"46,139,87",seashell:"255,245,238",sienna:"160,82,45",silver:"192,192,192",skyblue:"135,206,235",slateblue:"106,90,205",slategray:"112,128,144",snow:"255,250,250",springgreen:"0,255,127",steelblue:"70,130,180",tan:"210,180,140",teal:"0,128,128",thistle:"216,191,216",tomato:"255,99,71",turquoise:"64,224,208",violet:"238,130,238",wheat:"245,222,179",whitesmoke:"245,245,245",white:"255,255,255",yellowgreen:"154,205,50",yellow:"255,255,0"}},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var a=0;a<A.Lists.colors.length;a++){var b="color"===A.Lists.colors[a]?"0 0 0 1":"255 255 255 1";A.Hooks.templates[A.Lists.colors[a]]=["Red Green Blue Alpha",b]}var c,d,e;if(p)for(c in A.Hooks.templates)if(A.Hooks.templates.hasOwnProperty(c)){d=A.Hooks.templates[c],e=d[0].split(" ");var f=d[1].match(A.RegEx.valueSplit);"Color"===e[0]&&(e.push(e.shift()),f.push(f.shift()),A.Hooks.templates[c]=[e.join(" "),f.join(" ")])}for(c in A.Hooks.templates)if(A.Hooks.templates.hasOwnProperty(c)){d=A.Hooks.templates[c],e=d[0].split(" ");for(var g in e)if(e.hasOwnProperty(g)){var h=c+e[g],i=g;A.Hooks.registered[h]=[c,i]}}},getRoot:function(a){var b=A.Hooks.registered[a];return b?b[0]:a},getUnit:function(a,b){var c=(a.substr(b||0,5).match(/^[a-z%]+/)||[])[0]||"";return c&&t(A.Lists.units,c)?c:""},fixColors:function(a){return a.replace(/(rgba?\(\s*)?(\b[a-z]+\b)/g,function(a,b,c){return A.Lists.colorNames.hasOwnProperty(c)?(b?b:"rgba(")+A.Lists.colorNames[c]+(b?"":",1)"):b+c})},cleanRootPropertyValue:function(a,b){return A.RegEx.valueUnwrap.test(b)&&(b=b.match(A.RegEx.valueUnwrap)[1]),A.Values.isCSSNullValue(b)&&(b=A.Hooks.templates[a][1]),b},extractValue:function(a,b){var c=A.Hooks.registered[a];if(c){var d=c[0],e=c[1];return b=A.Hooks.cleanRootPropertyValue(d,b),b.toString().match(A.RegEx.valueSplit)[e]}return b},injectValue:function(a,b,c){var d=A.Hooks.registered[a];if(d){var e,f=d[0],g=d[1];return c=A.Hooks.cleanRootPropertyValue(f,c),e=c.toString().match(A.RegEx.valueSplit),e[g]=b,e.join(" ")}return c}},Normalizations:{registered:{clip:function(a,b,c){switch(a){case"name":return"clip";case"extract":var d;return A.RegEx.wrappedValueAlreadyExtracted.test(c)?d=c:(d=c.toString().match(A.RegEx.valueUnwrap),d=d?d[1].replace(/,(\s+)?/g," "):c),d;case"inject":return"rect("+c+")"}},blur:function(a,b,c){switch(a){case"name":return y.State.isFirefox?"filter":"-webkit-filter";case"extract":var d=parseFloat(c);if(!d&&0!==d){var e=c.toString().match(/blur\(([0-9]+[A-z]+)\)/i);d=e?e[1]:0}return d;case"inject":return parseFloat(c)?"blur("+c+")":"none"}},opacity:function(a,b,c){if(p<=8)switch(a){case"name":return"filter";case"extract":var d=c.toString().match(/alpha\(opacity=(.*)\)/i);return c=d?d[1]/100:1;case"inject":return b.style.zoom=1,parseFloat(c)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(c),10)+")"}else switch(a){case"name":return"opacity";case"extract":return c;case"inject":return c}}},register:function(){function a(a,b,c){if("border-box"===A.getPropertyValue(b,"boxSizing").toString().toLowerCase()===(c||!1)){var d,e,f=0,g="width"===a?["Left","Right"]:["Top","Bottom"],h=["padding"+g[0],"padding"+g[1],"border"+g[0]+"Width","border"+g[1]+"Width"];for(d=0;d<h.length;d++)e=parseFloat(A.getPropertyValue(b,h[d])),isNaN(e)||(f+=e);return c?-f:f}return 0}function b(b,c){return function(d,e,f){switch(d){case"name":return b;case"extract":return parseFloat(f)+a(b,e,c);case"inject":return parseFloat(f)-a(b,e,c)+"px"}}}p&&!(p>9)||y.State.isGingerbread||(A.Lists.transformsBase=A.Lists.transformsBase.concat(A.Lists.transforms3D));for(var c=0;c<A.Lists.transformsBase.length;c++)!function(){var a=A.Lists.transformsBase[c];A.Normalizations.registered[a]=function(b,c,e){switch(b){case"name":return"transform";case"extract":return g(c)===d||g(c).transformCache[a]===d?/^scale/i.test(a)?1:0:g(c).transformCache[a].replace(/[()]/g,"");case"inject":var f=!1;switch(a.substr(0,a.length-1)){case"translate":f=!/(%|px|em|rem|vw|vh|\d)$/i.test(e);break;case"scal":case"scale":y.State.isAndroid&&g(c).transformCache[a]===d&&e<1&&(e=1),f=!/(\d)$/i.test(e);break;case"skew":f=!/(deg|\d)$/i.test(e);break;case"rotate":f=!/(deg|\d)$/i.test(e)}return f||(g(c).transformCache[a]="("+e+")"),g(c).transformCache[a]}}}();for(var e=0;e<A.Lists.colors.length;e++)!function(){var a=A.Lists.colors[e];A.Normalizations.registered[a]=function(b,c,e){switch(b){case"name":return a;case"extract":var f;if(A.RegEx.wrappedValueAlreadyExtracted.test(e))f=e;else{var g,h={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(e)?g=h[e]!==d?h[e]:h.black:A.RegEx.isHex.test(e)?g="rgb("+A.Values.hexToRgb(e).join(" ")+")":/^rgba?\(/i.test(e)||(g=h.black),f=(g||e).toString().match(A.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return(!p||p>8)&&3===f.split(" ").length&&(f+=" 1"),f;case"inject":return/^rgb/.test(e)?e:(p<=8?4===e.split(" ").length&&(e=e.split(/\s+/).slice(0,3).join(" ")):3===e.split(" ").length&&(e+=" 1"),(p<=8?"rgb":"rgba")+"("+e.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")")}}}();A.Normalizations.registered.innerWidth=b("width",!0),A.Normalizations.registered.innerHeight=b("height",!0),A.Normalizations.registered.outerWidth=b("width"),A.Normalizations.registered.outerHeight=b("height")}},Names:{camelCase:function(a){return a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()})},SVGAttribute:function(a){var b="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(p||y.State.isAndroid&&!y.State.isChrome)&&(b+="|transform"),new RegExp("^("+b+")$","i").test(a)},prefixCheck:function(a){if(y.State.prefixMatches[a])return[y.State.prefixMatches[a],!0];for(var b=["","Webkit","Moz","ms","O"],c=0,d=b.length;c<d;c++){var e;if(e=0===c?a:b[c]+a.replace(/^\w/,function(a){return a.toUpperCase()}),u.isString(y.State.prefixElement.style[e]))return y.State.prefixMatches[a]=e,[e,!0]}return[a,!1]}},Values:{hexToRgb:function(a){var b,c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d}),b=c.exec(a),b?[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]:[0,0,0]},isCSSNullValue:function(a){return!a||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(a)},getUnitType:function(a){return/^(rotate|skew)/i.test(a)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(a)?"":"px"},getDisplayType:function(a){var b=a&&a.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(b)?"inline":/^(li)$/i.test(b)?"list-item":/^(tr)$/i.test(b)?"table-row":/^(table)$/i.test(b)?"table":/^(tbody)$/i.test(b)?"table-row-group":"block"},addClass:function(a,b){if(a)if(a.classList)a.classList.add(b);else if(u.isString(a.className))a.className+=(a.className.length?" ":"")+b;else{var c=a.getAttribute(p<=7?"className":"class")||"";a.setAttribute("class",c+(c?" ":"")+b)}},removeClass:function(a,b){if(a)if(a.classList)a.classList.remove(b);else if(u.isString(a.className))a.className=a.className.toString().replace(new RegExp("(^|\\s)"+b.split(" ").join("|")+"(\\s|$)","gi")," ");else{var c=a.getAttribute(p<=7?"className":"class")||"";a.setAttribute("class",c.replace(new RegExp("(^|s)"+b.split(" ").join("|")+"(s|$)","gi")," "))}}},getPropertyValue:function(a,c,e,f){function h(a,c){var e=0;if(p<=8)e=o.css(a,c);else{var i=!1;/^(width|height)$/.test(c)&&0===A.getPropertyValue(a,"display")&&(i=!0,A.setPropertyValue(a,"display",A.Values.getDisplayType(a)));var j=function(){i&&A.setPropertyValue(a,"display","none")};if(!f){if("height"===c&&"border-box"!==A.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var k=a.offsetHeight-(parseFloat(A.getPropertyValue(a,"borderTopWidth"))||0)-(parseFloat(A.getPropertyValue(a,"borderBottomWidth"))||0)-(parseFloat(A.getPropertyValue(a,"paddingTop"))||0)-(parseFloat(A.getPropertyValue(a,"paddingBottom"))||0);return j(),k}if("width"===c&&"border-box"!==A.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var l=a.offsetWidth-(parseFloat(A.getPropertyValue(a,"borderLeftWidth"))||0)-(parseFloat(A.getPropertyValue(a,"borderRightWidth"))||0)-(parseFloat(A.getPropertyValue(a,"paddingLeft"))||0)-(parseFloat(A.getPropertyValue(a,"paddingRight"))||0);return j(),l}}var m;m=g(a)===d?b.getComputedStyle(a,null):g(a).computedStyle?g(a).computedStyle:g(a).computedStyle=b.getComputedStyle(a,null),"borderColor"===c&&(c="borderTopColor"),e=9===p&&"filter"===c?m.getPropertyValue(c):m[c],""!==e&&null!==e||(e=a.style[c]),j()}if("auto"===e&&/^(top|right|bottom|left)$/i.test(c)){var n=h(a,"position");("fixed"===n||"absolute"===n&&/top|left/i.test(c))&&(e=o(a).position()[c]+"px")}return e}var i;if(A.Hooks.registered[c]){var j=c,k=A.Hooks.getRoot(j);e===d&&(e=A.getPropertyValue(a,A.Names.prefixCheck(k)[0])),A.Normalizations.registered[k]&&(e=A.Normalizations.registered[k]("extract",a,e)),i=A.Hooks.extractValue(j,e)}else if(A.Normalizations.registered[c]){var l,m;l=A.Normalizations.registered[c]("name",a),"transform"!==l&&(m=h(a,A.Names.prefixCheck(l)[0]),A.Values.isCSSNullValue(m)&&A.Hooks.templates[c]&&(m=A.Hooks.templates[c][1])),i=A.Normalizations.registered[c]("extract",a,m)}if(!/^[\d-]/.test(i)){var n=g(a);if(n&&n.isSVG&&A.Names.SVGAttribute(c))if(/^(height|width)$/i.test(c))try{i=a.getBBox()[c]}catch(q){i=0}else i=a.getAttribute(c);else i=h(a,A.Names.prefixCheck(c)[0])}return A.Values.isCSSNullValue(i)&&(i=0),y.debug>=2&&console.log("Get "+c+": "+i),i},setPropertyValue:function(a,c,d,e,f){var h=c;if("scroll"===c)f.container?f.container["scroll"+f.direction]=d:"Left"===f.direction?b.scrollTo(d,f.alternateValue):b.scrollTo(f.alternateValue,d);else if(A.Normalizations.registered[c]&&"transform"===A.Normalizations.registered[c]("name",a))A.Normalizations.registered[c]("inject",a,d),h="transform",d=g(a).transformCache[c];else{if(A.Hooks.registered[c]){var i=c,j=A.Hooks.getRoot(c);e=e||A.getPropertyValue(a,j),d=A.Hooks.injectValue(i,d,e),c=j}if(A.Normalizations.registered[c]&&(d=A.Normalizations.registered[c]("inject",a,d),c=A.Normalizations.registered[c]("name",a)),h=A.Names.prefixCheck(c)[0],p<=8)try{a.style[h]=d}catch(l){y.debug&&console.log("Browser does not support ["+d+"] for ["+h+"]")}else{var k=g(a);k&&k.isSVG&&A.Names.SVGAttribute(c)?a.setAttribute(c,d):a.style[h]=d}y.debug>=2&&console.log("Set "+c+" ("+h+"): "+d)}return[h,d]},flushTransformCache:function(a){var b="",c=g(a);if((p||y.State.isAndroid&&!y.State.isChrome)&&c&&c.isSVG){var d=function(b){return parseFloat(A.getPropertyValue(a,b))},e={translate:[d("translateX"),d("translateY")],skewX:[d("skewX")],skewY:[d("skewY")],scale:1!==d("scale")?[d("scale"),d("scale")]:[d("scaleX"),d("scaleY")],rotate:[d("rotateZ"),0,0]};o.each(g(a).transformCache,function(a){/^translate/i.test(a)?a="translate":/^scale/i.test(a)?a="scale":/^rotate/i.test(a)&&(a="rotate"),e[a]&&(b+=a+"("+e[a].join(" ")+") ",delete e[a])})}else{var f,h;o.each(g(a).transformCache,function(c){if(f=g(a).transformCache[c],"transformPerspective"===c)return h=f,!0;9===p&&"rotateZ"===c&&(c="rotate"),b+=c+f+" "}),h&&(b="perspective"+h+" "+b)}A.setPropertyValue(a,"transform",b)}};A.Hooks.register(),A.Normalizations.register(),y.hook=function(a,b,c){var e;return a=f(a),o.each(a,function(a,f){if(g(f)===d&&y.init(f),c===d)e===d&&(e=A.getPropertyValue(f,b));else{var h=A.setPropertyValue(f,b,c);"transform"===h[0]&&y.CSS.flushTransformCache(f),e=h}}),e};var B=function(){function a(){return k?z.promise||null:p}function e(a,e){function f(f){var k,n;if(i.begin&&0===D)try{i.begin.call(r,r)}catch(V){setTimeout(function(){throw V},1)}if("scroll"===G){var p,q,w,x=/^x$/i.test(i.axis)?"Left":"Top",B=parseFloat(i.offset)||0;i.container?u.isWrapped(i.container)||u.isNode(i.container)?(i.container=i.container[0]||i.container,p=i.container["scroll"+x],w=p+o(a).position()[x.toLowerCase()]+B):i.container=null:(p=y.State.scrollAnchor[y.State["scrollProperty"+x]],q=y.State.scrollAnchor[y.State["scrollProperty"+("Left"===x?"Top":"Left")]],w=o(a).offset()[x.toLowerCase()]+B),j={scroll:{rootPropertyValue:!1,startValue:p,currentValue:p,endValue:w,unitType:"",easing:i.easing,scrollData:{container:i.container,direction:x,alternateValue:q}},element:a},y.debug&&console.log("tweensContainer (scroll): ",j.scroll,a)}else if("reverse"===G){if(!(k=g(a)))return;if(!k.tweensContainer)return void o.dequeue(a,i.queue);"none"===k.opts.display&&(k.opts.display="auto"),"hidden"===k.opts.visibility&&(k.opts.visibility="visible"),k.opts.loop=!1,k.opts.begin=null,k.opts.complete=null,v.easing||delete i.easing,v.duration||delete i.duration,i=o.extend({},k.opts,i),n=o.extend(!0,{},k?k.tweensContainer:null);for(var E in n)if(n.hasOwnProperty(E)&&"element"!==E){var F=n[E].startValue;n[E].startValue=n[E].currentValue=n[E].endValue,n[E].endValue=F,u.isEmptyObject(v)||(n[E].easing=i.easing),y.debug&&console.log("reverse tweensContainer ("+E+"): "+JSON.stringify(n[E]),a)}j=n}else if("start"===G){k=g(a),k&&k.tweensContainer&&k.isAnimating===!0&&(n=k.tweensContainer);var H=function(e,f){var g,l=A.Hooks.getRoot(e),m=!1,p=f[0],q=f[1],r=f[2]
6;if(!(k&&k.isSVG||"tween"===l||A.Names.prefixCheck(l)[1]!==!1
vendor: 5,506 bytes, line 6
6||A.Normalizations.registered[l]!==d))return void(y.debug&&console.log("Skipping ["+l+"] due to a lack of browser support."));(i.display!==d&&null!==i.display&&"none"!==i.display||i.visibility!==d&&"hidden"!==i.visibility)&&/opacity|filter/.test(e)&&!r&&0!==p&&(r=0),i._cacheValues&&n&&n[e]?(r===d&&(r=n[e].endValue+n[e].unitType),m=k.rootPropertyValueCache[l]):A.Hooks.registered[e]?r===d?(m=A.getPropertyValue(a,l),r=A.getPropertyValue(a,e,m)):m=A.Hooks.templates[l][1]:r===d&&(r=A.getPropertyValue(a,e));var s,t,v,w=!1,x=function(a,b){var c,d;return d=(b||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(a){return c=a,""}),c||(c=A.Values.getUnitType(a)),[d,c]};if(r!==p&&u.isString(r)&&u.isString(p)){g="";var z=0,B=0,C=[],D=[],E=0,F=0,G=0;for(r=A.Hooks.fixColors(r),p=A.Hooks.fixColors(p);z<r.length&&B<p.length;){var H=r[z],I=p[B];if(/[\d\.-]/.test(H)&&/[\d\.-]/.test(I)){for(var J=H,K=I,L=".",N=".";++z<r.length;){if((H=r[z])===L)L="..";else if(!/\d/.test(H))break;J+=H}for(;++B<p.length;){if((I=p[B])===N)N="..";else if(!/\d/.test(I))break;K+=I}var O=A.Hooks.getUnit(r,z),P=A.Hooks.getUnit(p,B);if(z+=O.length,B+=P.length,O===P)J===K?g+=J+O:(g+="{"+C.length+(F?"!":"")+"}"+O,C.push(parseFloat(J)),D.push(parseFloat(K)));else{var Q=parseFloat(J),R=parseFloat(K);g+=(E<5?"calc":"")+"("+(Q?"{"+C.length+(F?"!":"")+"}":"0")+O+" + "+(R?"{"+(C.length+(Q?1:0))+(F?"!":"")+"}":"0")+P+")",Q&&(C.push(Q),D.push(0)),R&&(C.push(0),D.push(R))}}else{if(H!==I){E=0;break}g+=H,z++,B++,0===E&&"c"===H||1===E&&"a"===H||2===E&&"l"===H||3===E&&"c"===H||E>=4&&"("===H?E++:(E&&E<5||E>=4&&")"===H&&--E<5)&&(E=0),0===F&&"r"===H||1===F&&"g"===H||2===F&&"b"===H||3===F&&"a"===H||F>=3&&"("===H?(3===F&&"a"===H&&(G=1),F++):G&&","===H?++G>3&&(F=G=0):(G&&F<(G?5:4)||F>=(G?4:3)&&")"===H&&--F<(G?5:4))&&(F=G=0)}}z===r.length&&B===p.length||(y.debug&&console.error('Trying to pattern match mis-matched strings ["'+p+'", "'+r+'"]'),g=d),g&&(C.length?(y.debug&&console.log('Pattern found "'+g+'" -> ',C,D,"["+r+","+p+"]"),r=C,p=D,t=v=""):g=d)}g||(s=x(e,r),r=s[0],v=s[1],s=x(e,p),p=s[0].replace(/^([+-\/*])=/,function(a,b){return w=b,""}),t=s[1],r=parseFloat(r)||0,p=parseFloat(p)||0,"%"===t&&(/^(fontSize|lineHeight)$/.test(e)?(p/=100,t="em"):/^scale/.test(e)?(p/=100,t=""):/(Red|Green|Blue)$/i.test(e)&&(p=p/100*255,t="")));if(/[\/*]/.test(w))t=v;else if(v!==t&&0!==r)if(0===p)t=v;else{h=h||function(){var d={myParent:a.parentNode||c.body,position:A.getPropertyValue(a,"position"),fontSize:A.getPropertyValue(a,"fontSize")},e=d.position===M.lastPosition&&d.myParent===M.lastParent,f=d.fontSize===M.lastFontSize;M.lastParent=d.myParent,M.lastPosition=d.position,M.lastFontSize=d.fontSize;var g={};if(f&&e)g.emToPx=M.lastEmToPx,g.percentToPxWidth=M.lastPercentToPxWidth,g.percentToPxHeight=M.lastPercentToPxHeight;else{var h=k&&k.isSVG?c.createElementNS("http://www.w3.org/2000/svg","rect"):c.createElement("div");y.init(h),d.myParent.appendChild(h),o.each(["overflow","overflowX","overflowY"],function(a,b){y.CSS.setPropertyValue(h,b,"hidden")}),y.CSS.setPropertyValue(h,"position",d.position),y.CSS.setPropertyValue(h,"fontSize",d.fontSize),y.CSS.setPropertyValue(h,"boxSizing","content-box"),o.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(a,b){y.CSS.setPropertyValue(h,b,"100%")}),y.CSS.setPropertyValue(h,"paddingLeft","100em"),g.percentToPxWidth=M.lastPercentToPxWidth=(parseFloat(A.getPropertyValue(h,"width",null,!0))||1)/100,g.percentToPxHeight=M.lastPercentToPxHeight=(parseFloat(A.getPropertyValue(h,"height",null,!0))||1)/100,g.emToPx=M.lastEmToPx=(parseFloat(A.getPropertyValue(h,"paddingLeft"))||1)/100,d.myParent.removeChild(h)}return null===M.remToPx&&(M.remToPx=parseFloat(A.getPropertyValue(c.body,"fontSize"))||16),null===M.vwToPx&&(M.vwToPx=parseFloat(b.innerWidth)/100,M.vhToPx=parseFloat(b.innerHeight)/100),g.remToPx=M.remToPx,g.vwToPx=M.vwToPx,g.vhToPx=M.vhToPx,y.debug>=1&&console.log("Unit ratios: "+JSON.stringify(g),a),g}();var S=/margin|padding|left|right|width|text|word|letter/i.test(e)||/X$/.test(e)||"x"===e?"x":"y";switch(v){case"%":r*="x"===S?h.percentToPxWidth:h.percentToPxHeight;break;case"px":break;default:r*=h[v+"ToPx"]}switch(t){case"%":r*=1/("x"===S?h.percentToPxWidth:h.percentToPxHeight);break;case"px":break;default:r*=1/h[t+"ToPx"]}}switch(w){case"+":p=r+p;break;case"-":p=r-p;break;case"*":p*=r;break;case"/":p=r/p}j[e]={rootPropertyValue:m,startValue:r,currentValue:r,endValue:p,unitType:t,easing:q},g&&(j[e].pattern=g),y.debug&&console.log("tweensContainer ("+e+"): "+JSON.stringify(j[e]),a)};for(var I in s)if(s.hasOwnProperty(I)){var J=A.Names.camelCase(I),K=function(b,c){var d,f,g;return u.isFunction(b)&&(b=b.call(a,e,C)),u.isArray(b)?(d=b[0],!u.isArray(b[1])&&/^[\d-]/.test(b[1])||u.isFunction(b[1])||A.RegEx.isHex.test(b[1])?g=b[1]:u.isString(b[1])&&!A.RegEx.isHex.test(b[1])&&y.Easings[b[1]]||u.isArray(b[1])?(f=c?b[1]:l(b[1],i.duration),g=b[2]):g=b[1]||b[2]):d=b,c||(f=f||i.easing),u.isFunction(d)&&(d=d.call(a,e,C)),u.isFunction(g)&&(g=g.call(a,e,C)),[d||0,f,g]}(s[I]);if(t(A.Lists.colors,J)){var L=K[0],O=K[1],P=K[2];if(A.RegEx.isHex.test(L)){for(var Q=["Red","Green","Blue"],R=A.Values.hexToRgb(L),S=P?A.Values.hexToRgb(P):d,T=0;T<Q.length;T++){var U=[R[T]];O&&U.push(O),S!==d&&U.push(S[T]),H(J+Q[T],U)}continue}}H(J,K)}j.element=a}j.element&&(A.Values.addClass(a,"velocity-animating"),N.push(j),k=g(a),k&&(""===i.queue&&(k.tweensContainer=j,k.opts=i),k.isAnimating=!0),D===C-1?(y.State.calls.push([N,r,i,null,z.resolver,null,0]),
6y.State.isTicking===!1&&(y.State.isTicking=!0,m())):D++)}var h,i=o.extend({},y.defaults,v),j={};switch(g(a)===d&&y.init(a),parseFloat(i.delay)&&i.queue!==!1&&o.queue(a,i.queue,function(b){y.velocityQueueEntryFlag=!0;var c=y.State.delayedElements.count++;y.State.delayedElements[c]=a;var d=function(a){return function(){y.State.delayedElements[a]=!1,b()}}(c);g(a).delayBegin=(new Date).getTime(),g(a).delay=parseFloat(i.delay),g(a).delayTimer={setTimeout:setTimeout(b,parseFloat(i.delay)),next:d}}),i.duration.toString().toLowerCase()){case"fast":i.duration=200;break;case"normal":i.duration=w;break;case"slow":i.duration=600;break;default:i.duration=parseFloat(i.duration)||1}if(y.mock!==!1&&(y.mock===!0?i.duration=i.delay=1:(i.duration*=parseFloat(y.mock)||1,i.delay*=parseFloat(y.mock)||1)),i.easing=l(i.easing,i.duration),i.begin&&!u.isFunction(i.begin)&&(i.begin=null),i.progress&&!u.isFunction(i.progress)&&(i.progress=null),i.complete&&!u.isFunction(i.complete)&&(i.complete=null),i.display!==d&&null!==i.display&&(i.display=i.display.toString().toLowerCase(),"auto"===i.display&&(i.display=y.CSS.Values.getDisplayType(a))),i.visibility!==d&&null!==i.visibility&&(i.visibility=i.visibility.toString().toLowerCase()),i.mobileHA=i.mobileHA&&y.State.isMobile&&!y.State.isGingerbread,i.queue===!1)if(i.delay){var k=y.State.delayedElements.count++;y.State.delayedElements[k]=a;var n=function(a){return function(){y.State.delayedElements[a]=!1,f()}}(k);g(a).delayBegin=(new Date).getTime(),g(a).delay=parseFloat(i.delay),g(a).delayTimer={setTimeout:setTimeout(f,parseFloat(i.delay)),next:n}}else f();else o.queue(a,i.queue,function(a,b){if(b===!0)return z.promise&&z.resolver(r),!0;y.velocityQueueEntryFlag=!0,f(a)});""!==i.queue&&"fx"!==i.queue||"inprogress"===o.queue(a)[0]||o.dequeue(a)}var j,k,p,q,r,s,v,x=arguments[0]&&(arguments[0].p||o.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||u.isString(arguments[0].properties));u.isWrapped(this)?(k=!1,q=0,r=this,p=this):(k=!0,q=1,r=x?arguments[0].elements||arguments[0].e:arguments[0]);var z={promise:null,resolver:null,rejecter:null};if(k&&y.Promise&&(z.promise=new y.Promise(function(a,b){z.resolver=a,z.rejecter=b})),x?(s=arguments[0].properties||arguments[0].p,v=arguments[0].options||arguments[0].o):(s=arguments[q],v=arguments[q+1]),!(r=f(r)))return void(z.promise&&(s&&v&&v.promiseRejectEmpty===!1?z.resolver():z.rejecter()));var C=r.length,D=0;if(!/^(stop|finish|finishAll|pause|resume)$/i.test(s)&&!o.isPlainObject(v)){var E=q+1;v={};for(var F=E;F<arguments.length;F++)u.isArray(arguments[F])||!/^(fast|normal|slow)$/i.test(arguments[F])&&!/^\d/.test(arguments[F])?u.isString(arguments[F])||u.isArray(arguments[F])?v.easing=arguments[F]:u.isFunction(arguments[F])&&(v.complete=arguments[F]):v.duration=arguments[F]}var G;switch(s){case"scroll":G="scroll";break;case"reverse":G="reverse";break;case"pause":var H=(new Date).getTime();return o.each(r,function(a,b){h(b,H)}),o.each(y.State.calls,function(a,b){var c=!1;b&&o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1)||(o.each(r,function(a,d){if(d===e)return b[5]={resume:!1},c=!0,!1}),!c&&void 0)})}),a();case"resume":return o.each(r,function(a,b){i(b,H)}),o.each(y.State.calls,function(a,b){var c=!1;b&&o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1)||(!b[5]||(o.each(r,function(a,d){if(d===e)return b[5].resume=!0,c=!0,!1}),!c&&void 0))})}),a();case"finish":case"finishAll":case"stop":o.each(r,function(a,b){g(b)&&g(b).delayTimer&&(clearTimeout(g(b).delayTimer.setTimeout),g(b).delayTimer.next&&g(b).delayTimer.next(),delete g(b).delayTimer),"finishAll"!==s||v!==!0&&!u.isString(v)||(o.each(o.queue(b,u.isString(v)?v:""),function(a,b){u.isFunction(b)&&b()}),o.queue(b,u.isString(v)?v:"",[]))});var I=[];return o.each(y.State.calls,function(a,b){b&&o.each(b[1],function(c,e){var f=v===d?"":v;if(f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1))return!0;o.each(r,function(c,d){if(d===e)if((v===!0||u.isString(v))&&(o.each(o.queue(d,u.isString(v)?v:""),function(a,b){u.is
6Function(b)&&b(null,!0)}),o.queue(d,u.isString(v)?v:"",[])),"stop"===s){var h=g(d);h&&h.tweensContainer&&f!==!1&&o.each(h.tweensContainer,function(a,b){b.endValue=b.currentValue}),I.push(a)}else"finish"!==s&&"finishAll"!==s||(b[2].duration=1)})})}),"stop"===s&&(o.each(I,function(a,b){n(b,!0)}),z.promise&&z.resolver(r)),a();default:if(!o.isPlainObject(s)||u.isEmptyObject(s)){if(u.isString(s)&&y.Redirects[s]){j=o.extend({},v);var J=j.duration,K=j.delay||0;return j.backwards===!0&&(r=o.extend(!0,[],r).reverse()),o.each(r,function(a,b){parseFloat(j.stagger)?j.delay=K+parseFloat(j.stagger)*a:u.isFunction(j.stagger)&&(j.delay=K+j.stagger.call(b,a,C)),j.drag&&(j.duration=parseFloat(J)||(/^(callout|transition)/.test(s)?1e3:w),j.duration=Math.max(j.duration*(j.backwards?1-a/C:(a+1)/C),.75*j.duration,200)),y.Redirects[s].call(b,b,j||{},a,C,r,z.promise?z:d)}),a()}var L="Velocity: First argument ("+s+") was not a property map, a known action, or a registered redirect. Aborting.";return z.promise?z.rejecter(new Error(L)):b.console&&console.log(L),a()}G="start"}var M={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},N=[];o.each(r,function(a,b){u.isNode(b)&&e(b,a)}),j=o.extend({},y.defaults,v),j.loop=parseInt(j.loop,10);var O=2*j.loop-1;if(j.loop)for(var P=0;P<O;P++){var Q={delay:j.delay,progress:j.progress};P===O-1&&(Q.display=j.display,Q.visibility=j.visibility,Q.complete=j.complete),B(r,"reverse",Q)}return a()};y=o.extend(B,y),y.animate=B;var C=b.requestAnimationFrame||q;if(!y.State.isMobile&&c.hidden!==d){var D=function(){c.hidden?(C=function(a){return setTimeout(function(){a(!0)},16)},m()):C=b.requestAnimationFrame||q};D(),c.addEventListener("visibilitychange",D)}return a.Velocity=y,a!==b&&(a.fn.velocity=B,a.fn.velocity.defaults=y.defaults),o.each(["Down","Up"],function(a,b){y.Redirects["slide"+b]=function(a,c,e,f,g,h){var i=o.extend({},c),j=i.begin,k=i.complete,l={},m={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""};i.display===d&&(i.display="Down"===b?"inline"===y.CSS.Values.getDisplayType(a)?"inline-block":"block":"none"),i.begin=function(){0===e&&j&&j.call(g,g);for(var c in m)if(m.hasOwnProperty(c)){l[c]=a.style[c];var d=A.getPropertyValue(a,c);m[c]="Down"===b?[d,0]:[0,d]}l.overflow=a.style.overflow,a.style.overflow="hidden"},i.complete=function(){for(var b in l)l.hasOwnProperty(b)&&(a.style[b]=l[b]);e===f-1&&(k&&k.call(g,g),h&&h.resolver(g))},y(a,m,i)}}),o.each(["In","Out"],function(a,b){y.Redirects["fade"+b]=function(a,c,e,f,g,h){var i=o.extend({},c),j=i.complete,k={opacity:"In"===b?1:0};0!==e&&(i.begin=null),i.complete=e!==f-1?null:function(){j&&j.call(g,g),h&&h.resolver(g)},i.display===d&&(i.display="In"===b?"auto":"none"),y(this,k,i)}}),y}(window.jQuery||window.Zepto||window,window,window?window.document:undefined)});
7/* End */
8;
9; /* Start:"a:4:{s:4:"full";s:76:"/local/templates/aspro_max/vendor/js/velocity/velocity.ui.js?166601759313257";s:6:"source";s:60:"/local/templates/aspro_max/vendor/js/velocity/velocity.ui.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
10/* VelocityJS.org UI Pack (5.0.4). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License. Portions copyright Daniel Eden, Christian Pucci. */
11!function(t){"function"==typeof require&&"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(["velocity"],t):t()}(function(){return function(t,a,e,r){function n(t,a){var e=[];return t&&a?($.each([t,a],function(t,a){var r=[];$.each(a,function(t,a){for(;a.toString().length<5;)a="0"+a;r.push(a)}),e.push(r.join(""))}),parseFloat(e[0])>parseFloat(e[1])):!1}if(!t.Velocity||!t.Velocity.Utilities)return void(a.console&&console.log("Velocity UI Pack: Velocity must be loaded first. Aborting."));var i=t.Velocity,$=i.Utilities,s=i.version,o={major:1,minor:1,patch:0};if(n(o,s)){var l="Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.";throw alert(l),new Error(l)}i.RegisterEffect=i.RegisterUI=function(t,a){function e(t,a,e,r){var n=0,s;$.each(t.nodeType?[t]:t,function(t,a){r&&(e+=t*r),s=a.parentNode,$.each(["height","paddingTop","paddingBottom","marginTop","marginBottom"],function(t,e){n+=parseFloat(i.CSS.getPropertyValue(a,e))})}),i.animate(s,{height:("In"===a?"+":"-")+"="+n},{queue:!1,easing:"ease-in-out",duration:e*("In"===a?.6:1)})}return i.Redirects[t]=function(n,s,o,l,c,u){function f(){s.display!==r&&"none"!==s.display||!/Out$/.test(t)||$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"display","none")}),s.complete&&s.complete.call(c,c),u&&u.resolver(c||n)}var p=o===l-1;a.defaultDuration="function"==typeof a.defaultDuration?a.defaultDuration.call(c,c):parseFloat(a.defaultDuration);for(var d=0;d<a.calls.length;d++){var g=a.calls[d],y=g[0],m=s.duration||a.defaultDuration||1e3,X=g[1],Y=g[2]||{},O={};if(O.duration=m*(X||1),O.queue=s.queue||"",O.easing=Y.easing||"ease",O.delay=parseFloat(Y.delay)||0,O._cacheValues=Y._cacheValues||!0,0===d){if(O.delay+=parseFloat(s.delay)||0,0===o&&(O.begin=function(){s.begin&&s.begin.call(c,c);var a=t.match(/(In|Out)$/);a&&"In"===a[0]&&y.opacity!==r&&$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"opacity",0)}),s.animateParentHeight&&a&&e(c,a[0],m+O.delay,s.stagger)}),null!==s.display)if(s.display!==r&&"none"!==s.display)O.display=s.display;else if(/In$/.test(t)){var v=i.CSS.Values.getDisplayType(n);O.display="inline"===v?"inline-block":v}
vendor: 6,420 bytes, line 11
11s.visibility&&"hidden"!==s.visibility&&(O.visibility=s.visibility)}d===a.calls.length-1&&(O.complete=function(){if(a.reset){for(var t in a.reset){var e=a.reset[t];i.CSS.Hooks.registered[t]!==r||"string"!=typeof e&&"number"!=typeof e||(a.reset[t]=[a.reset[t],a.reset[t]])}var s={duration:0,queue:!1};p&&(s.complete=f),i.animate(n,a.reset,s)}else p&&f()},"hidden"===s.visibility&&(O.visibility=s.visibility)),i.animate(n,y,O)}},i},i.RegisterEffect.packagedEffects={"callout.bounce":{defaultDuration:550,calls:[[{translateY:-30},.25],[{translateY:0},.125],[{translateY:-15},.125],[{translateY:0},.25]]},"callout.shake":{defaultDuration:800,calls:[[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:0},.125]]},"callout.flash":{defaultDuration:1100,calls:[[{opacity:[0,"easeInOutQuad",1]},.25],[{opacity:[1,"easeInOutQuad"]},.25],[{opacity:[0,"easeInOutQuad"]},.25],[{opacity:[1,"easeInOutQuad"]},.25]]},"callout.pulse":{defaultDuration:825,calls:[[{scaleX:1.1,scaleY:1.1},.5,{easing:"easeInExpo"}],[{scaleX:1,scaleY:1},.5]]},"callout.swing":{defaultDuration:950,calls:[[{rotateZ:15},.2],[{rotateZ:-10},.2],[{rotateZ:5},.2],[{rotateZ:-5},.2],[{rotateZ:0},.2]]},"callout.tada":{defaultDuration:1e3,calls:[[{scaleX:.9,scaleY:.9,rotateZ:-3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:-3},.1],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],[{scaleX:1,scaleY:1,rotateZ:0},.2]]},"transition.fadeIn":{defaultDuration:500,calls:[[{opacity:[1,0]}]]},"transition.fadeOut":{defaultDuration:500,calls:[[{opacity:[0,1]}]]},"transition.flipXIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateY:[0,-55]}]],reset:{transformPerspective:0}},"transition.flipXOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateY:55}]],reset:{transformPerspective:0,rotateY:0}},"transition.flipYIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateX:[0,-45]}]],reset:{transformPerspective:0}},"transition.flipYOut":{defaultDuration:800,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateX:25}]],reset:{transformPerspective:0,rotateX:0}},"transition.flipBounceXIn":{defaultDuration:900,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateY:[-10,90]},.5],[{opacity:.8,rotateY:10},.25],[{opacity:1,rotateY:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceXOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateY:-10},.5],[{opacity:0,rotateY:90},.5]],reset:{transformPerspective:0,rotateY:0}},"transition.flipBounceYIn":{defaultDuration:850,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateX:[-10,90]},.5],[{opacity:.8,rotateX:10},.25],[{opacity:1,rotateX:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceYOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateX:-15},.5],[{opacity:0,rotateX:90},.5]],reset:{transformPerspective:0,rotateX:0}},"transition.swoopIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["100%","50%"],transformOriginY:["100%","100%"],scaleX:[1,0],scaleY:[1,0],translateX:[0,-700],translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%"}},"transition.swoopOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformOriginX:["50%","100%"],transformOriginY:["100%","100%"],scaleX:0,scaleY:0,translateX:-700,translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%",scaleX:1,scaleY:1,translateX:0}},"transition.whirlIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,0],scaleY:[1,0],rotateY:[0,160]},1,{easing:"easeInOutSine"}]]},"transition.whirlOut":{defaultDuration:750,calls:[[{opacity:[0,"easeInOutQuint",1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:0,scaleY:0,rotateY:160},1,{easing:"swing"}]],reset:{scaleX:1,scaleY:1,rotateY:0}},"transition.shrinkIn":{defaultDuration:750,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,1.5],scaleY:[1,1.5],translateZ:0}]]},"transition.shrinkOut":{defaultDuration:600,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:1.3,scaleY:1.3,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.expandIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,.625],scaleY:[1,.625],translateZ:0}]]},"transition.expandOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:.5,scaleY:.5,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.bounceIn":{defaultDuration:800,calls:[[{opacity:[1,0],scaleX:[1.05,.3],scaleY:[1.05,.3]},.4],[{scaleX:.9,scaleY:.9,translateZ:0},.2],[{scaleX:1,scaleY:1},.5]]},"transition.bounceOut":{defaultDuration:800,calls:[[{scaleX:.95,scaleY:.95},.35],[{scaleX:1.1,scaleY:1.1,translateZ:0},.35],[{opacity:[0,1],scaleX:.3,scaleY:.3},.3]],reset:{scaleX:1,scaleY:1}},"transition.bounceUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[-30,1e3]},.6,{easing:"easeOutCirc"}],[{translateY:10},.2],[{translateY:0},.2]]},"transition.bounceUpOut":{defaultDuration:1e3,calls:[[{translateY:20},.2],[{opacity:[0,"easeInCirc",1],translateY:-1e3},.8]],reset:{translateY:0}},"transition.bounceDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[30,-1e3]},.6,{easing:"easeOutCirc"}],[{translateY:-10},.2],[{translateY:0},.2]]},"transition.bounceDownOut":{defaultDuration:1e3,calls:[[{translateY:-20},.2],[{opacity:[0,"easeInCirc",1],translateY:1e3},.8]],reset:{translateY:0}},"transition.bounceLeftIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[30,-1250]},.6,{easing:"easeOutCirc"}],[{translateX:-10},.2],[{translateX:0},.2]]},"transition.bounceLeftOut":{defaultDuration:750,calls:[[{translateX:30},.2],[{opacity:[0,"easeInCirc",1],translateX:-1250},.8]],reset:{translateX:0}},"transition.bounceRightIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[-30,1250]},.6,{easing:"easeOutCirc"}],[{translateX:10},.2],[{translateX:0},.2]]},"transition.bounceRightOut":{defaultDuration:750,calls:[[{translateX:-30},.2],[{opacity:[0,"easeInCirc",1],translateX:1250},.8]],reset:{translateX:0}}
11,"transition.slideUpIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,20],translateZ:0}]]},"transition.slideUpOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:-20,translateZ:0}]],reset:{translateY:0}},"transition.slideDownIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,-20],translateZ:0}]]},"transition.slideDownOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:20,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,-20],translateZ:0}]]},"transition.slideLeftOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:-20,translateZ:0}]],reset:{translateX:0}},"transition.slideRightIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,20],translateZ:0}]]},"transition.slideRightOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:20,translateZ:0}]],reset:{translateX:0}},"transition.slideUpBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,75],translateZ:0}]]},"transition.slideUpBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:-75,translateZ:0}]],reset:{translateY:0}},"transition.slideDownBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,-75],translateZ:0}]]},"transition.slideDownBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:75,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,-75],translateZ:0}]]},"transition.slideLeftBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:-75,translateZ:0}]],reset:{translateX:0}},"transition.slideRightBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,75],translateZ:0}]]},"transition.slideRightBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:75,translateZ:0}]],reset:{translateX:0}},"transition.perspectiveUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:[0,-180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveUpOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveDownOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveLeftIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:[0,-180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveLeftOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}},"transition.perspectiveRightIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveRightOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}}};for(var c in i.RegisterEffect.packagedEffects)i.RegisterEffect(c,i.RegisterEffect.packagedEffects[c]);i.RunSequence=function(t){var a=$.extend(!0,[],t);a.length>1&&($.each(a.reverse(),function(t,e){var r=a[t+1];if(r){var n=e.o||e.options,s=r.o||r.options,o=n&&n.sequenceQueue===!1?"begin":"complete",l=s&&s[o],c={};c[o]=function(){var t=r.e||r.elements,a=t.nodeType?[t]:t;l&&l.call(a,a),i(e)},r.o?r.o=$.extend({},s,c):r.options=$.extend({},s,c)}}),a.reverse()),i(a[0])}}(window.jQuery||window.Zepto||window,window,document)});
12/* End */
13;
14; /* Start:"a:4:{s:4:"full";s:64:"/local/templates/aspro_max/js/jquery.dotdotdot.js?16660175935908";s:6:"source";s:49:"/local/templates/aspro_max/js/jquery.dotdotdot.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
15!function(t,e){function n(t,e,n){var r=t.children(),o=!1;t.empty();for(var i=0,d=r.length;d>i;i++){var l=r.eq(i);if(t.append(l),n&&t.append(n),a(t,e)){l.remove(),o=!0;break}n&&n.detach()}return o}function r(e,n,i,d,l){var s=!1,c="a table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",u="script, .dotdotdot-keep";return e.contents().detach().each(function(){var f=this,h=t(f);if("undefined"==typeof f||3==f.nodeType&&0==t.trim(f.data).length)return!0;
vendor: 5,916 bytes, lines 15-33
15if(h.is(u))e.append(h);else{if(s)return!0;e.append(h),!l||h.is(d.after)||h.find(d.after).length||e[e.is(c)?"after":"append"](l),a(i,d)&&(s=3==f.nodeType?o(h,n,i,d,l):r(h,n,i,d,l),s||(h.detach(),s=!0)),s||l&&l.detach()}}),s}function o(e,n,r,o,d){var c=e[0];if(!c)return!1;var f=s(c),h=-1!==f.indexOf(" ")?" ":" ",p="letter"==o.wrap?"":h,g=f.split(p),v=-1,w=-1,y=0,b=g.length-1;for(o.fallbackToLetter&&0==y&&0==b&&(p="",g=f.split(p),b=g.length-1);b>=y&&(0!=y||0!=b);){var m=Math.floor((y+b)/2);if(m==w)break;w=m,l(c,g.slice(0,w+1).join(p)+o.ellipsis),a(r,o)?(b=w,o.fallbackToLetter&&0==y&&0==b&&(p="",g=g[0].split(p),v=-1,w=-1,y=0,b=g.length-1)):(v=w,y=w)}if(-1==v||1==g.length&&0==g[0].length){var T=e.parent();e.detach();var x=d&&d.closest(T).length?d.length:0;T.contents().length>x?c=u(T.contents().eq(-1-x),n):(c=u(T,n,!0),x||T.detach()),c&&(f=i(s(c),o),l(c,f),x&&d&&t(c).parent().append(d))}else f=i(g.slice(0,v+1).join(p),o),l(c,f);return!0}function a(t,e){return t.innerHeight()>e.maxHeight}function i(e,n){for(;t.inArray(e.slice(-1),n.lastCharacter.remove)>-1;)e=e.slice(0,-1);return t.inArray(e.slice(-1),n.lastCharacter.noEllipsis)<0&&(e+=n.ellipsis),e}function d(t){return{width:t.innerWidth(),height:t.innerHeight()}}function l(t,e){t.innerText?t.innerText=e:t.nodeValue?t.nodeValue=e:t.textContent&&(t.textContent=e)}function s(t){return t.innerText?t.innerText:t.nodeValue?t.nodeValue:t.textContent?t.textContent:""}function c(t){do t=t.previousSibling;while(t&&1!==t.nodeType&&3!==t.nodeType);return t}function u(e,n,r){var o,a=e&&e[0];if(a){if(!r){if(3===a.nodeType)return a;if(t.trim(e.text()))return u(e.contents().last(),n)}for(o=c(a);!o;){if(e=e.parent(),e.is(n)||!e.length)return!1;o=c(e[0])}if(o)return u(t(o),n)}return!1}function f(e,n){return e?"string"==typeof e?(e=t(e,n),e.length?e:!1):e.jquery?e:!1:!1}function h(t){for(var e=t.innerHeight(),n=["paddingTop","paddingBottom"],r=0,o=n.length;o>r;r++){var a=parseInt(t.css(n[r]),10);isNaN(a)&&(a=0),e-=a}return e}if(!t.fn.dotdotdot){t.fn.dotdotdot=function(e){if(0==this.length)return t.fn.dotdotdot.debug('No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){t(this).dotdotdot(e)});var o=this;o.data("dotdotdot")&&o.trigger("destroy.dot"),o.data("dotdotdot-style",o.attr("style")||""),o.css("word-wrap","break-word"),"nowrap"===o.css("white-space")&&o.css("white-space","normal"),o.bind_events=function(){return o.bind("update.dot",function(e,d){e.preventDefault(),e.stopPropagation(),l.maxHeight="number"==typeof l.height?l.height:h(o),l.maxHeight+=l.tolerance,"undefined"!=typeof d&&(("string"==typeof d||"nodeType"in d&&1===d.nodeType)&&(d=t("<div />").append(d).contents()),d instanceof t&&(i=d)),g=o.wrapInner('<div class="dotdotdot" />').children(),g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith("  <br />  ").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var c=!1,u=!1;return s.afterElement&&(c=s.afterElement.clone(!0),c.show(),s.afterElement.detach()),a(g,l)&&(u="children"==l.wrap?n(g,l,c):r(g,o,g,l,c)),g.replaceWith(g.contents()),g=null,t.isFunction(l.callback)&&l.callback.call(o[0],u,i),s.isTruncated=u,u}).bind("isTruncated.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],s.isTruncated),s.isTruncated}).bind("originalContent.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],i),i}).bind("destroy.dot",function(t){t.preventDefault(),t.stopPropagation(),o.unwatch().unbind_events().contents().detach().end().append(i).attr("style",o.data("dotdotdot-style")||"").data("dotdotdot",!1)}),o},o.unbind_events=function(){return o.unbind(".dot"),o},o.watch=function(){if(o.unwatch(),"window"==l.watch){var e=t(window),n=e.width(),r=e.height();e.bind("resize.dot"+s.dotId,function(){n==e.width()&&r==e.height()&&l.windowResizeFix||(n=e.width(),r=e.height(),u&&clearInterval(u),u=setTimeout(function(){o.trigger("update.dot")},100))})}else c=d(o),u=setInterval(function(){if(o.is(":visible")){var t=d(o);(c.width!=t.width||c.height!=t.height)&&(o.trigger("update.dot"),c=t)}},500);return o},o.unwatch=function(){return t(window).unbind("resize.dot"+s.dotId),u&&clearInterval(u),o};var i=o.contents(),l=t.extend(!0,{},t.fn.dotdotdot.defaults,e),s={},c={},u=null,g=null;return l.lastCharacter.remove instanceof Array||(l.lastCharacter.remove=t.fn.dotdotdot.defaultArrays.lastCharacter.remove),l.lastCharacter.noEllipsis instanceof Array||(l.lastCharacter.noEllipsis=t.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),s.afterElement=f(l.after,o),s.isTruncated=!1,s.dotId=p++,o.data("dotdotdot",!0).bind_events().trigger("update.dot"),l.watch&&o.watch(),o},t.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0},t.fn.dotdotdot.defaultArrays={lastCharacter:{remove:[" "," ",",",";",".","!","?"],noEllipsis:[]}},t.fn.dotdotdot.debug=function(t){};var p=1,g=t.fn.html;t.fn.html=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?this.trigger("update",[n]):g.apply(this,arguments)};var v=t.fn.text;t.fn.text=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?(n=t("<div />").text(n).html(),this.trigger("update",[n])):v.apply(this,arguments)}}}(jQuery);
16/* End */
17;
18; /* Start:"a:4:{s:4:"full";s:56:"/local/templates/aspro_max/js/jqModal.js?166601759311178";s:6:"source";s:40:"/local/templates/aspro_max/js/jqModal.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
19/*
20 * jqModal - Minimalist Modaling with jQuery
21 *
22 * Copyright (c) 2007-2014 Brice Burgess @iceburg_net
23 * Dual licensed under the MIT and GPL licenses:
24 *   http://www.opensource.org/licenses/mit-license.php
25 *   http://www.gnu.org/licenses/gpl.html
26 *
27 * $Version: 1.0.2 (2014.04.10 +r19)
28 * Requires: jQuery 1.2.3+
29 */
30
31(function($) {
32
33	/**
34	 * Initialize a set of elements as "modals". Modals typically are popup dialogs,
35	 * notices, modal windows, &c.
36	 *
37	 * @name jqm
38	 * @param options user defined options, augments defaults.
39	 * @type jQuery
40	 * @cat Plugins/jqModal
41	 */
42
43	$.fn.jqm=function(options){
44
45		var o = $.extend({}, $.jqm.params, options);
46
47		return this.each(function(){
48			var e = $(this),
49				jqm = $(this).data('jqm');
50
51			if(!jqm) jqm = {ID: I++};
52
53			// add/extend options to modal and mark as initialized
54			e.data('jqm',$.extend(o,jqm)).addClass('jqm-init');
55
56			// ... Attach events to trigger showing of this modal
57			o.trigger&&$(this).jqmAddTrigger(o.trigger);
58		});
59	};
60
61
62	/**
63	 * Matching modals will have their jqmShow() method fired by attaching a
64	 *   onClick event to elements matching `trigger`.
65	 *
66	 * @name jqmAddTrigger
67	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
68	 */
69	$.fn.jqmAddTrigger=function(trigger){
70		return this.each(function(){
71			if(!addTrigger($(this), 'jqmShow', trigger))
72				err("jqmAddTrigger must be called on initialized modals")
73		});
74	};
75
76
77	/**
78	 * Matching modals will have their jqmHide() method fired by attaching an
79	 *   onClick event to elements matching `trigger`.
80	 *
81	 * @name jqmAddClose
82	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
83	 */
84	$.fn.jqmAddClose=function(trigger){
85		return this.each(function(){
86			if(!addTrigger($(this), 'jqmHide', trigger))
87				err("jqmAddClose must be called on initialized modals")
88		});
89	};
90
91
92	/**
93	 * Open matching modals (if not shown)
94	 */
95	$.fn.jqmShow=function(trigger){
96		return this.each(function(){ !this._jqmShown&&show($(this), trigger); });
97	};
98
99	/**
100	 * Close matching modals
101	 */
102	$.fn.jqmHide=function(trigger){
103		return this.each(function(){ this._jqmShown&&hide($(this), trigger); });
104	};
105
106
107	// utility functions
108
109	var
110		err = function(msg){
111			if(window.console && window.console.error) window.console.error(msg);
112
113
114	}, show = function(e, t){
115		/**
116		 * e = modal element (as jQuery object)
117		 * t = triggering element
118		 *
119		 * o = options
120		 * z = z-index of modal
121		 * v = overlay element (as jQuery object)
122		 * h = hash (for jqModal <= r15 compatibility)
123		 */
124
125		var o = e.data('jqm'),
126			t = t || window.event,
127			z = (parseInt(e.css('z-index')));
128
129			if(o.noOverlay === undefined || (o.noOverlay !== undefined && !o.noOverlay) ) {
130				if( isNaN(z) ) {
131					if( window['lastJqmZindex'] ) {
132						window['lastJqmZindex'] = z = window['lastJqmZindex'] + 2;
133					} else {
134						z = 3000;
135					}
136				}
137				window['lastJqmZindex'] = z;
138				var	v = $('<div></div>').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100});
139				e.css('z-index',z);
140			} else {
141				var	v = $('');
142				e.css('z-index',2999);
143			}
144		
145			// maintain legacy "hash" construct
146			h = {w: e, c: o, o: v, t: t};
147
148
149		if(o.ajax){
150			var target = o.target || e,
151				url = o.ajax;
152
153			target = (typeof target == 'string') ? $(target,e) : $(target);
154			if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1));
155
156			 // Load the Ajax Content (and once loaded);
157			   // Fire the onLoad callback (if exists),
158			   // Attach closing events to elements inside the modal that match the closingClass,
159			   // and Execute the jqModal default Open Callback
160			target.html(o.ajaxText).load(url,function(){
161				o.onLoad && o.onLoad.call(this,h);
162				open(h);
163			});
164		}
165		else { open(h); }
166
167	}, hide = function(e, t){
168		/**
169		 * e = modal element (as jQuery object)
170		 * t = triggering element
171		 *
172		 * o = options
173		 * h = hash (for jqModal <= r15 compatibility)
174		 */
175
176		var o = e.data('jqm'),
177			t = t || window.event,
178
179		// maintain legacy "hash" construct
180		h = {w: e, c: o, o: e.data('jqmv'), t: t};
181
182		close(h);
183
184	}, onShow = function(hash){
185		// onShow callback. Responsible for showing a modal and overlay.
186		//  return false to stop opening modal.
187
188		// hash object;
189	    //  w: (jQuery object) The modal element
190	    //  c: (object) The modal's options object
191	    //  o: (jQuery object) The overlay element
192	    //  t: (DOM object) The triggering element
193
194		// display the overlay (prepend to body) if not disabled
195
196		// prevent double click
197		if( hash.w[0]._jqmShown )
198			return false;
199		
200		if(hash.c.overlay > 0)
201			hash.o.prependTo('#popup_iframe_wrapper');
202
203		// make modal visible
204		hash.w.show();
205
206		// call focusFunc (attempts to focus on first input in modal)
207		$.jqm.focusFunc(hash.w);
208
209		return true;
210
211
212	}, onHide = function(hash){
213		// onHide callback. Responsible for hiding a modal and overlay.
214		//  return false to stop closing modal.
215
216		// hash object;
217	    //  w: (jQuery object) The modal element
218	    //  c: (object) The modal's options object
219	    //  o: (jQuery object) The overlay element
220	    //  t: (DOM object) The triggering element
221
222		// hide modal and if overlay, remove overlay.
223		hash.w.hide() && hash.o && hash.o.remove();
224
225		return true;
226
227
228	},  addTrigger = function(e, key, trigger){
229		// addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e)
230		//  all elements that match trigger string (trigger)\
231
232		// return false if e is not an initialized modal element
233		if(!e.data('jqm')) return false;
234
235		return $(trigger).each(function(){
236			// register modal to trigger elements
237			this[key] = this[key] || [];
238			this[key].push(e);
239
240		}).click(function(){
241
242			var trigger = this;
243
244			// foreadh modal registered to this trigger, call jqmShow ||
245			//   jqmHide (key) on modal passing trigger element (e)
246			$.each(this[key], function(i, e){ e[key](trigger); });
247
248			// stop trigger click event from bubbling
249			return false;
250		});
251
252
253	},  open = function(h){
254		// open: executes the onOpen callback + performs common tasks if successful
255
256		// transform legacy hash into new var shortcuts
257		 var e = h.w,
258		 	v = h.o,
259		 	o = h.c;
260
261		// execute onShow callback
262		if(o.onShow(h) !== false){
263			// mark modal as shown
264			e[0]._jqmShown = true;
265
266			// if modal dialog
267			//
268			// Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) +
269			// Add this modal to the opened modals stack (A) for nested modal support
270			//
271			// else, close dialog when overlay is clicked
272			if(o.modal){ !A[0]&&F('bind'); A.push(e); }
273            else e.jqmAddClose(v);
274
275			//  Attach closing events to elements inside the modal that match the closingClass
276			o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e));
277
278			// IF toTop is true and overlay exists;
279			//  Add placeholder element <span id="jqmP#ID_of_modal"/> before modal to
280			//  remember it's position in the DOM and move it to a child of the body tag (after overlay)
281			o.toTop&&v&&e.before('<span id="jqmP'+o.ID+'"></span>').insertAfter(v);
282
283			// remember overlay (for closing function)
284			e.data('jqmv',v);
285		}
286
287
288	},  close = function(h){
289		// close: executes the onHide callback + performs common tasks if successful
290
291		// transform legacy hash into new var shortcuts
292		 var e = h.w,
293		 	v = h.o,
294		 	o = h.c;
295
296		// execute onShow callback
297		if(o.onHide(h) !== false){
298			// mark modal as !shown
299			e[0]._jqmShown = false;
300
301			 // If modal, remove from modal stack.
302			 // If no modals in modal stack, unbind the Keep Focus Function
303			 if(o.modal){A.pop();!A[0]&&F('unbind');}
304
305			 // IF toTop was passed and an overlay exists;
306			 //  Move modal back to its "remembered" position.
307			 o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove();
308		}
309
310
311	},  F = function(t){
312		// F: The Keep Focus Function (for modal: true dialos)
313		// Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks
314
315		$(document)[t]("keypress keydown mousedown",X);
316
317
318	}, X = function(e){
319		// X: The Focus Examination Function (for modal: true dialogs)
320
321		var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'),
322			activeModal = A[A.length-1].data('jqm');
323
324		// allow bubbling if event target is within active modal dialog
325		if(modal && modal.ID == activeModal.ID) return true;
326
327		// else, trigger focusFunc (focus on first input element and halt bubbling)
328		return $.jqm.focusFunc(activeModal);
329	},
330
331	I = 0,   // modal ID increment (for nested modals)
332	A = [];  // array of active modals (used to lock interactivity to appropriate modal)
333
334
335	// $.jqm, overridable defaults
336	$.jqm = {
337		/**
338		 *  default options
339		 *
340		 * (Integer)   overlay      - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay.
341		 * (String)    overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS.
342		 * (String)    closeClass   - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal).
343		 * (Mixed)     trigger      - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean.
344		 * (String)    ajax         - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; <a href="#" class="jqModal" data-url="modal.html">...)
345		 * (Mixed)     target       - Children of the modal element to load the aja
345x response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design.
346		 *                            Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element.
347		 * (String)    ajaxText     - Text shown while waiting for ajax return. Replaces HTML content of `target` element.
348		 * (Boolean)   modal        - If true, user interactivity will be locked to the modal window until closed.
349		 * (Boolean)   toTop        - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues.
350		 * (Function)  onShow       - User defined callback function fired when modal opened.
351		 * (Function)  onHide       - User defined callback function fired when modal closed.
352		 * (Function)  onLoad       - User defined callback function fired when ajax content loads.
353		 */
354		params: {
355			overlay: 50,
356			overlayClass: 'jqmOverlay',
357			closeClass: 'jqmClose',
358			trigger: '.jqModal',
359			ajax: false,
360			target: false,
361			ajaxText: '',
362			modal: false,
363			toTop: false,
364			onShow: onShow,
365			onHide: onHide,
366			onLoad: false
367		},
368
369		// focusFunc is fired when a modal is shown, or when interaction occurs outside
370		// a modal enabled dialog. Passed the modal element.
371		focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; }
372	};
373
374})( jQuery );
375/* End */
376;
377; /* Start:"a:4:{s:4:"full";s:64:"/local/templates/aspro_max/js/jquery.ikSelect.js?166609357332265";s:6:"source";s:48:"/local/templates/aspro_max/js/jquery.ikSelect.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
378/*! ikSelect 1.0.3
379	Copyright (c) 2013 Igor Kozlov
380	http://igorkozlov.me */
381
382;(function ($, window, document, undefined) {
383	var $window = $(window);
384	var defaults = {
385		syntax: '<div class="ik_select_link"><div class="ik_select_link_text"></div></div><div class="ik_select_dropdown"><div class="ik_select_list"></div></div>',
386		autoWidth: true, // set select width according to the longest option
387		ddFullWidth: true, // set dropdown width according to the longest option
388		equalWidths: true, // include scrollbar width in fake select calculations
389		dynamicWidth: false, // change fake select's width according to it's contents
390		extractLink: false,
391		customClass: '',
392		linkCustomClass: '',
393		ddCustomClass: '',
394		ddMaxHeight: 200,
395		filter: false,
396		nothingFoundText: 'Nothing found',
397		isDisabled: false,
398		onInit: function() {},
399		onShow: function () {},
400		onHide: function () {},
401		onKeyUp: function () {},
402		onKeyDown: function () {},
403		onHoverMove: function () {}
404	};
405
406	var instOpened; // instance of the currently opened select
407
408	// browser detection part was taken from jQuery migrate
409	// https://github.com/jquery/jquery-migrate/blob/e6bda6a84c294eb1319fceb48c09f51042c80892/src/core.js
410	var uaMatch = function (ua) {
411		ua = ua.toLowerCase();
412
413		var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
414			/(webkit)[ \/]([\w.]+)/.exec(ua) ||
415			/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
416			/(msie) ([\w.]+)/.exec(ua) ||
417			ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
418			[];
419
420		return {
421			browser: match[1] || '',
422			version: match[2] || '0'
423		};
424	};
425
426	if (! $.browser) {
427		var matched = uaMatch(navigator.userAgent);
428		var browser = {};
429
430		if (matched.browser) {
431			browser[matched.browser] = true;
432			browser.version = matched.version;
433		}
434
435		if (browser.chrome) {
436			browser.webkit = true;
437		} else if (browser.webkit) {
438			browser.safari = true;
439		}
440
441		$.browser = browser;
442	}
443
444	$.browser.mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent);
445	$.browser.operamini = Object.prototype.toString.call(window.operamini) === "[object OperaMini]";
446
447	function IkSelect(element, options) {
448		var dataOptions = {}; // parsed data- attributes
449
450		this.el = element;
451		this.$el = $(element); // original select
452
453		for (var key in defaults) {
454			dataOptions[key] = this.$el.data(key.toLowerCase());
455		}
456
457		this.options = $.extend({}, defaults, options, dataOptions);
458
459		if ($.browser.mobile) {
460			this.options.filter = false;
461		}
462
463		this.init();
464	}
465
466	$.extend(IkSelect.prototype, {
467		init: function () {
468			this.$wrapper = $('<div class="ik_select">' + this.options.syntax + '</div>'); // wrapper for the fake select and the fake dropdown
469			this.$link = $('.ik_select_link', this.$wrapper); // fake select
470			this.$linkText = $('.ik_select_link_text', this.$wrapper); // fake select's text
471			this.$dropdown = $('.ik_select_dropdown', this.$wrapper); // fake dropdown
472			this.$list = $('.ik_select_list', this.$wrapper); // options list inside the fake dropdown
473			this.$listInner = $('<div class="ik_select_list_inner"/>'); // support dropdown for scrolling
474			this.$active = $([]); // active fake option
475			this.$hover = $([]); // hovered fake option
476			this.hoverIndex = 0; // hovered fake option's index
477
478			this.$optionSet = $([]);
479			this.$optgroupSet = $([]);
480
481			this.$list.append(this.$listInner);
482
483			if (this.options.filter) {
484				this.$filter = $([]); // filter text input
485				this.$optionSetOriginal = $([]); // contains original list items when filtering
486				this.$nothingFoundText = $('<div class="ik_select_nothing_found"/>').html(this.options.nothingFoundText);
487				this.$filterWrap = $('.ik_select_filter_wrap', this.$wrapper);
488
489				if (! this.$filterWrap.length) {
490					this.$filterWrap = $('<div class="ik_select_filter_wrap"/>');
491				}
492
493				this.$filter = $('<input type="text" class="ik_select_filter">');
494
495				this.$filterWrap.append(this.$filter);
496				this.$list.prepend(this.$filterWrap);
497
498				this.$filter.on({
499					// keyboard controls should work even if the filter is in focus
500					'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown'),
501					// actual filtering happens on keyup
502					'keyup.ikSelect': $.proxy(this, '_filterKeyup')
503				});
504			}
505
506			this.$wrapper.addClass(this.options.customClass);
507			this.$link.addClass(this.options.linkCustomClass || (this.options.customClass && this.options.customClass + '-link'));
508			this.$dropdown.addClass(this.options.ddCustomClass || (this.options.customClass && this.options.customClass + '-dd'));
509
510			// creating fake option list
511			this.reset();
512
513			// disable select if an option or attribute are truthy
514			this.toggle(!(this.options.isDisabled || this.$el.prop('disabled') || this.$el.hasClass('hidden')));
515
516			// click event for fake select
517			this.$link.on('click.ikSelect', $.proxy(this, '_linkClick'));
518
519			this.$el.on({
520				// when focus is on the original select add a focus class to the fake one
521				'focus.ikSelect': $.proxy(this, '_elFocus'),
522				// when focus lost remove the focus class from the fake one
523				'blur.ikSelect': $.proxy(this, '_elBlur'),
524				// make sure that the fake select shows correct data
525				'change.ikSelect': $.proxy(this, '_syncOriginalOption'),
526				// keyboard controls for the fake select
527				'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown')
528			});
529
530			this.$list.on({
531				'click.ikSelect': $.proxy(this, '_optionClick'),
532				'mouseover.ikSelect': $.proxy(this, '_optionMouseover')
533			}, '.ik_select_option');
534
535			// stop propagation of click events on the wrapper
536			this.$wrapper.on('click', function () {
537				return false;
538			});
539
540			// appending the fake select right after the original one
541			this.$el.after(this.$wrapper);
542
543			// set correct dimensions
544			this.redraw();
545
546			// move original select inside the wrapper
547			this.$el.appendTo(this.$wrapper);
548
549			this.options.onInit(this);
550			this.$el.trigger('ikinit', this);
551		},
552
553		// click listener for fake select
554		_linkClick: function () {
555			if (this.isDisabled) {
556				return;
557			}
558			if (this === instOpened) {
559				this.hideDropdown();
560			} else {
561				this.showDropdown();
562			}
563
564		},
565
566		// click listener for the fake options
567		_optionClick: function () {
568			this._makeOptionActive(this.searchIndexes ? this.$optionSetOriginal.index(this.$hover) : this.hoverIndex, true);
569			this.hideDropdown();
570			this.$el.change().focus();
571		},
572
573		// hover listener for the fake options
574		_optionMouseover: function (event) {
575			var $option = $(event.currentTarget);
576			if ($option.hasClass('ik_select_option_disabled')) {
577				return;
578			}
579			this.$hover.removeClass('ik_select_hover');
580			this.$hover = $option.addClass('ik_select_hover');
581			this.hoverIndex = this.$optionSet.index(this.$hover);
582		},
583
584		// makes fake option active without syncing the original select
585		_makeOptionActive: function (index, shouldSync) {
586			var $option = $(this.el.options[index]),
587				text='';
588			if($option.data('img_src')){
589				//aspro fix data-missing 
590				console.log();
591
592				text+='<span class="icon_color ' + ($option.data('missing') ? 'missing' : '') + '" style="background: url('+$option.data('img_src')+')"></span>';
593				this.$link.addClass('img');
594			}
595			if($option.attr('title')){
596				this.$link.attr('title', $option.attr('title'));
597			}
598			text+=$option.text();
599			this.$linkText.html(text);
600
601			this.$link.toggleClass('ik_select_link_novalue', !$option.attr('value'));
602
603			this.$hover.removeClass('ik_select_hover');
604			this.$active.removeClass('ik_select_active');
605			this.$hover = this.$active = this.$optionSet.eq(index).addClass('ik_select_hover ik_select_active');
606			this.hoverIndex = index;
607
608			if (shouldSync) {
609				this._syncFakeOption();
610			}
611		},
612
613		// keyboard controls for the fake select
614		_elKeyUpDown: function (event) {
615			var $handle = $(event.currentTarget);
616			var type = event.type;
617			var keycode = event.which;
618			var newTop;
619
620			switch (keycode) {
621			case 38: // up
622				if (type === 'keydown') {
623					event.preventDefault();
624					this._moveToPrevActive();
625				}
626				break;
627			case 40: // down
628				if (type === 'keydown') {
629					event.preventDefault();
630					this._moveToNextActive();
631				}
632				break;
633			case 33: // page up
634				if (type === 'keydown') {
635					event.preventDefault();
636					newTop = this.$hover.position().top - this.$listInner.height();
637					this._moveToPrevActive(function (optionTop) {
638						return optionTop <= newTop;
639					});
640				}
641				break;
642			case 34: // page down
643				if (type === 'keydown') {
644					event.preventDefault();
645					newTop = this.$hover.position().top + this.$listInner.height();
646					this._moveToNextActive(function (optionTop) {
647						return optionTop >= newTop;
648					});
649				}
650				break;
651			case 36: // home
652				if (type === 'keydown' && $handle.is(this.$el)) {
653					event.preventDefault();
654					this._moveToFirstActive();
655				}
656				break;
657			case 35: // end
658				if (type === 'keydown' && $handle.is(this.$el)) {
659					event.preventDefault();
660					this._moveToLastActive();
661				}
662				break;
663			case 32: // space
664				if (type === 'keydown' && $handle.is(this.$el)) {
665					event.preventDefault();
666					if (! this.$dropdown.is(':visible')) {
667						this._linkClick();
668					} else {
669						this.$hover.click();
670					}
671				}
672				break;
673			case 13: // enter
674				if (type === 'keydown' && this.$dropdown.is(':visible')) {
675					event.preventDefault();
676					this.$hover.click();
677				}
678				break;
679			case 27: // esc
680				if (type === 'keydown' && this.$dropdown.is(':visible')) {
681					event.preventDefault();
682					this.hideDropdown();
683				}
684				break;
685			case 9: // tab
686				if (type === 'keydown') {
687					if ($.browser.webkit && this.$dropdown.is(':visible')) {
688						event.preventDefault();
689					} else {
690						this.hideDropdown();
691					}
692				}
693				break;
694			default:
695				if (type === 'keyup' && $handle.is(this.$el)) {
696					this._syncOriginalOption();
697				}
698				break;
699			}
700
701			// mozilla ignores preventDefault for select navigation
702			// this ensures that original select is in sync
703			if (type === 'keyup' && $.browser.mozilla) {
704				this._syncFakeOption();
705			}
706
707			if (type === 'keydown') {
708				this.options.onKeyDown(this, keycode);
709				this.$el.trigger('ikkeydown', [this, keycode]);
710			}
711			if (type === 'keyup') {
712				this.options.onKeyUp(this, keycode);
713				this.$el.trigger('ikkeyup', [this, keycode]);
714			}
715		},
716
717		// controls hover/active states for options and makes selected with keyboard options fully visible
718		_moveTo: function (index) {
719			var optionTopLine, optionBottomLine;
720			var $optgroup;
721
722			if (!this.$dropdown.is(':visible') && $.browser.webkit) {
723				this.showDropdown();
724				return this;
725			}
726
727			if (!this.$dropdown.is(':visible') || $.browser.mozilla) {
728				this._makeOptionActive(index, true);
729			} else {
730				this.$hover.removeClass('ik_select_hover');
731				this.$hover = this.$optionSet.eq(index).addClass('ik_select_hover');
732				this.hoverIndex = index;
733			}
734
735			// make option fully visible
736			optionTopLine = this.$hover.position().top;
737			optionBottomLine = optionTopLine + this.$active.outerHeight();
738			// make optgroup label visible if first option witin this optgroup is hovered
739			if (!this.$hover.index()) {
740				$optgroup = this.$hover.closest('.ik_select_optgroup');
741				if ($optgroup.length) {
742					optionTopLine = $optgroup.position().top;
743				}
744			}
745			if (optionBottomLine > this.$listInner.height()) {
746				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionBottomLine - this.$listInner.height());
747			} else if (optionTopLine < 0) {
748				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionTopLine);
749			}
750
751			this.options.onHoverMove(this);
752			this.$el.trigger('ikhovermove', this);
753		},
754
755		_moveToFirstActive: function () {
756			for (var i = 0; i < this.$optionSet.length; i++) {
757				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
758					this._moveTo(i);
759					break;
760				}
761			}
762		},
763
764		_moveToLastActive: function () {
765			for (var i = this.$optionSet.length - 1; i >= 0; i++) {
766				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
767					this._moveTo(i);
768					break;
769				}
770			}
771		},
772
773		_moveToPrevActive: function (condition) {
774			var $option;
775			for (var i = this.hoverIndex - 1; i >= 0; i--) {
776				$option = this.$optionSet.eq(i);
777				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
778					this._moveTo(i);
779					break;
780				}
781			}
782		},
783
784		_moveToNextActive: function (condition) {
785			var $option;
786			for (var i = this.hoverIndex + 1; i < this.$optionSet.length; i++) {
787				$option = this.$optionSet.eq(i);
788				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
789					this._moveTo(i);
790					break;
791				}
792			}
793		},
794
795		// when focus is on the original select add a focus class to the fake one
796		_elFocus:  function () {
797			var wrapperOffsetTop, wrapperHeight, windowScrollTop, windowHeight;
798			if (this.isDisabled) {
799				return this;
800			}
801			this.$link.addClass('ik_select_link_focus');
802
803			// scroll the window so that focused select is visible
804			wrapperOffsetTop = this.$wrapper.offset().top;
805			wrapperHeight = this.$wrapper.height();
806			windowScrollTop = $window.scrollTop();
807			windowHeight = $window.height();
808			if ((wrapperOffsetTop + wrapperHeight > windowScrollTop + windowHeight) ||
809				(wrapperOffsetTop < windowScrollTop)) {
810				$window.scrollTop(wrapperOffsetTop - windowHeight / 2);
811			}
812		},
813
814		// when focus lost remove the focus class from the fake one
815		_elBlur: function () {
816			this.$link.removeClass('ik_select_link_focus');
817		},
818
819		// filtering on key up
820		_filterKeyup: function () {
821			var filterVal = $.trim(this.$filter.val());
822			var filterValOld;
823			this.$listInner.show();
824
825			if (typeof this.searchIndexes === 'undefined') {
826				this.$optionSetOriginal = this.$optionSet;
827				this.searchIndexes = $.makeArray(this.$optionSet.map(function (optionIndex, option) {
828					return $(option).text().toLowerCase();
829				}));
830			}
831
832			if (filterVal !== filterValOld) {
833				if (filterVal === '') {
834					this.$optionSet = this.$optionSetOriginal.show();
835					this.$optgroupSet.show();
836					this.$nothingFoundText.remove();
837				} else {
838					this.$optionSet = $([]);
839					this.$optgroupSet.show();
840					this.$optionSetOriginal.each($.proxy(function (optionIndex, option) {
841						var $option = $(option);
842						if (this.searchIndexes[optionIndex].indexOf(filterVal.toLowerCase()) >= 0) {
843							this.$optionSet = this.$optionSet.add($option);
844							$option.show();
845						} else {
846							$option.hide();
847						}
848					}, this));
849
850					if (this.$optionSet.length) {
851						this.$nothingFoundText.remove();
852						this.$optgroupSet.each(function (optgroupIndex, optgroup) {
853							var $optgroup = $(optgroup);
854							if (!$('.ik_select_option:visible', $optgroup).length) {
855								$optgroup.hide();
856							}
857						});
858
859						if (!this.$hover.is(':visible')) {
860							this._moveToFirstActive();
861						}
862					} else {
863						this.$listInner.hide();
864						this.$list.append(this.$nothingFoundText);
865					}
866				}
867
868				filterValOld = filterVal;
869			}
870		},
871
872		// sync selected option in the fake select with the original one
873		_syncFakeOption: function () {
874			this.el.selectedIndex = this.hoverIndex;
875		},
876
877		// sync selected option in the original select with the fake one
878		_syncOriginalOption: function () {
879			this._makeOptionActive(this.el.selectedIndex);
880		},
881
882		// sets fixed height to dropdown if it's bigger than ddMaxHeight
883		_fixHeight: function () {
884			this.$dropdown.show();
885			this.$listInner.css('height', 'auto');
886			if (this.$listInner.height() > this.options.ddMaxHeight) {
887				this.$listInner.css({
888					overflow: 'auto',
889					height: this.options.ddMaxHeight,
890					position: 'relative'
891				});
892			}
893			this.$dropdown.hide();
894		},
895
896		// calculates the needed data for showing the dropdown
897		redraw: function () {
898			var maxWidthOuter, scrollbarWidth, wrapperParentWidth;
899
900			if (this.options.filter) {
901				this.$filter.hide();
902			}
903
904			this.$wrapper.css({
905				position: 'relative'
906			});
907			this.$dropdown.css({
908				position: 'absolute',
909				zIndex: 9998,
910				width: '100%'
911			});
912			this.$list.css({
913				position: 'relative'
914			});
915
916			this._fixHeight();
917
918			// width calculations for the fake select when "autoWidth" is "true"
919			if (this.options.dynamicWidth || this.options.autoWidth || this.options.ddFullWidth) {
920				this.$wrapper.width('');
921
922				this.$dropdown.show().width(9999);
923				this.$listInner.css('float', 'left');
924				this.$list.css('float', 'left');
925				maxWidthOuter = this.$list.outerWidth(true);
926				scrollbarWidth = this.$listInner.width() - this.$listInnerUl.width();
927				this.$list.css('float', '');
928				this.$listInner.css('float', '');
929				this.$dropdown.css('width', '100%');
930
931				if (this.options.ddFullWidth) {
932					this.$dropdown.width(maxWidthOuter + scrollbarWidth);
933				}
934
935				if (this.options.dynamicWidth) {
936					this.$wrapper.css({
937						display: 'inline-block',
938						width: 'auto',
939						verticalAlign: 'top'
940					});
941				} else if (this.options.autoWidth) {
942					this.$wrapper.width(maxWidthOuter + (this.options.equalWidths ? scrollbarWidth : 0)).addClass('ik_select_autowidth');
943				}
944
945				wrapperParentWidth = this.$wrapper.parent().width();
946				if (this.$wrapper.width() > wrapperParentWidth) {
947					this.$wrapper.width(wrapperParentWidth);
948				}
949			}
950
951			if (this.options.filter) {
952				this.$filter.show().outerWidth(this.$filterWrap.width());
953			}
954
955			this.$dropdown.hide();
956
957			// hide the original select
958			this.$el.css({
959				position: 'absolute',
960				margin: 0,
961				padding: 0,
962				top: 0,
963				left: -9999
964			});
965
966			// show the original select in mobile browsers
967			if ($.browser.mobile) {
968				this.$el.css({
969					opacity: 0,
970					left: 0,
971					height: this.$wrapper.height(),
972					width: this.$wrapper.width()
973				});
974			}
975		},
976
977		// creates or recreates dropdown and sets selected options's text into fake select
978		reset: function () {
979			var html = '';
980
981			// init fake select's text
982			this.$linkText.html(this.$el.val());
983
984			this.$listInner.empty();
985
986			// creating an ul>li list identical to the original dropdown
987			html = '<ul>';
988			this.$el.children().each($.proxy(function (childIndex, child) {
989				var $child = $(child);
990				var tagName = child.tagName.toLowerCase();
991				var options;
992				if (tagName === 'optgroup') {
993					options = $child.children().map($.proxy(function (optionIndex, option) {
994						return this._generateOptionObject($(option));
995					}, this));
996					options = $.makeArray(options);
997					html += this._renderListOptgroup({
998						label: $child.attr('label') || '&nbsp;',
999						isDisabled: $child.is(':disabled'),
1000						options: options
1001					});
1002				} else if (tagName === 'option') {
1003					html += this._renderListOption(this._generateOptionObject($child));
1004				}
1005			}, this));
1006			html += '</ul>';
1007			this.$listInner.append(html);
1008			this._syncOriginalOption();
1009
1010			this.$listInnerUl = $('> ul', this.$listInner);
1011			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
1012			this.$optionSet = $('.ik_select_option', this.$listInner);
1013		},
1014
1015		// hides dropdown
1016		hideDropdown: function () {
1017			if (this.options.filter) {
1018				this.$filter.val('');
1019				this._filterKeyup();
1020			}
1021
1022			this.$dropdown.hide().appendTo(this.$wrapper).css({
1023				'left': '',
1024				'top': ''
1025			});
1026			if (this.options.extractLink) {
1027				this.$wrapper.outerWidth(this.$wrapper.data('outerWidth'));
1028				this.$wrapper.height('');
1029				this.$link.removeClass('ik_select_link_extracted').css({
1030					position: '',
1031					top: '',
1032					left: '',
1033					zIndex: ''
1034				}).prependTo(this.$wrapper);
1035			}
1036			instOpened = null;
1037			this.$el.focus();
1038
1039			this.options.onHide(this);
1040			this.$el.trigger('ikhide', this);
1041		},
1042
1043		// shows dropdown
1044		showDropdown: function () {
1045			var dropdownOffset, dropdownOuterWidth, dropdownOuterHeight;
1046			var wrapperOffset, wrapperOuterWidth;
1047			var windowWidth, windowHeight, windowScroll;
1048			var linkOffset;
1049
1050			if (instOpened === this || !this.$optionSet.length) {
1051				return;
1052			} else if (instOpened) {
1053				instOpened.hideDropdown();
1054			}
1055
1056			this._syncOriginalOption();
1057			if($('.show_un_props').length)
1058				this.$dropdown.addClass('show_un_props');
1059			else if($('.unshow_un_props').length)
1060				this.$dropdown.addClass('unshow_un_props');
1061			this.$dropdown.show();
1062
1063			dropdownOffset = this.$dropdown.offset();
1064			dropdownOuterWidth = this.$dropdown.outerWidth(true);
1065			dropdownOuterHeight = this.$dropdown.outerHeight(true);
1066			wrapperOffset = this.$wrapper.offset();
1067			windowWidth = $window.width();
1068			windowHeight = $window.height();
1069			windowScroll = $window.scrollTop();
1070
1071			// if the dropdown's right border is beyond window's edge then move the dropdown to the left so that it fits
1072			if (this.options.ddFullWidth && wrapperOffset.left + dropdownOuterWidth > windowWidth) {
1073				dropdownOffset.left = windowWidth - dropdownOuterWidth;
1074			}
1075
1076			// if the dropdown's bottom border is beyond window's edge then move the dropdown to the top so that it fits
1077			if (dropdownOffset.top + dropdownOuterHeight > windowScroll + windowHeight) {
1078				dropdownOffset.top = windowScroll + windowHeight - dropdownOuterHeight;
1079			}
1080
1081			this.$dropdown.css({
1082				left: dropdownOffset.left,
1083				top: dropdownOffset.top,
1084				width: this.$dropdown.width()
1085			}).appendTo('body');
1086
1087			if (this.options.extractLink) {
1088				linkOffset = this.$link.offset();
1089				wrapperOuterWidth = this.$wrapper.outerWidth();
1090				this.$wrapper.data('outerWidth', wrapperOuterWidth);
1091				this.$wrapper.outerWidth(wrapperOuterWidth);
1092				this.$wrapper.outerHeight(this.$wrapper.outerHeight());
1093				this.$link.outerWidth(this.$link.outerWidth());
1094				this.$link.addClass('ik_select_link_extracted').css({
1095					position: 'absolute',
1096					top: linkOffset.top,
1097					left: linkOffset.left,
1098					zIndex: 9999
1099				}).appendTo('body');
1100			}
1101
1102			this.$listInner.scrollTop(this.$active.position().top - this.$list.height() / 2);
1103
1104			if (this.options.filter) {
1105				this.$filter.focus();
1106			} else {
1107				this.$el.focus();
1108			}
1109
1110			instOpened = this;
1111
1112			this.options.onShow(this);
1113			this.$el.trigger('ikshow', this);
1114		},
1115
1116		_generateOptionObject: function ($option) {
1117			
1118			return {
1119				value: $option.val(),
1120				label: $option.html() || '&nbsp;',
1121				isDisabled: $option.is(':disabled'),
1122				dataParam: $option.data(),
1123				className: $option.attr('class'),
1124				title: $option.attr('title')
1125			};
1126		},
1127
1128		// generates option code for the fake dropdown
1129		_renderListOption: function (option) {
1130			var html;
1131			var imgClass = '';
1132			var disabledClass = option.isDisabled ? ' ik_select_option_disabled' : '';
1133			if(!$.isEmptyObject(option.dataParam)) {
1134				imgClass = option.dataParam.img_src ? ' img' : '';
1135			} 
1136			var missingClass = option.className=='hidden' ? ' missing' : '';
1137			var title = option.title;
1138			html = '<li class="ik_select_option' + disabledClass + imgClass + missingClass + '" title="'+title+'" data-value="' + option.value + '">';
1139			html += '<span class="ik_select_option_label" title="'+title+'">';
1140			if(imgClass){
1141				//aspro fix data-missing
1142				html += '<span class="icon_color ' + (option.dataParam.missing ? 'missing' : '') + '" style="background: url('+option.dataParam.img_src+')"></span>';
1143			}
1144			html += option.label;
1145			html += '</span>';
1146			html += '</li>';
1147			return html;
1148		},
1149
1150		// generates optgroup code for the fake dropdown
1151		_renderListOptgroup: function (optgroup) {
1152			var html;
1153			var disabledClass = optgroup.isDisabled ? ' ik_select_optgroup_disabled' : '';
1154			html = '<li class="ik_select_optgroup' + disabledClass + '">';
1155			html += '<div class="ik_select_optgroup_label">' + optgroup.label + '</div>';
1156			html += '<ul>';
1157			if ($.isArray(optgroup.options)) {
1158				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
1159					html += this._renderListOption({
1160						value: option.value,
1161						label: option.label || '&nbsp;',
1162						isDisabled: option.isDisabled
1163					});
1164				}, this));
1165			}
1166			html += '</ul>';
1167			html += '</li>';
1168			return html;
1169		},
1170
1171		// generates option code for the select
1172		_renderOption: function (option) {
1173			return '<option value="' + option.value + '">' + option.label + '</option>';
1174		},
1175
1176		// generates optgroup code for the select
1177		_renderOptgroup: function (optgroup) {
1178			var html;
1179			html = '<optgroup label="' + optgroup.label + '">';
1180			if ($.isArray(optgroup.options)) {
1181				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
1182					html += this._renderOption(option);
1183				}, this));
1184			}
1185			html += '</option>';
1186			return html;
1187		},
1188
1189		addOptions: function (options, optionIndex, optgroupIndex) {
1190			var listHtml = '', selectHtml = '';
1191			var $destinationUl = this.$listInnerUl;
1192			var $destinationOptgroup = this.$el;
1193			var $ulOptions, $optgroupOptions;
1194
1195			options = $.isArray(options) ? options : [options];
1196
1197			$.each(options, $.proxy(function (index, option) {
1198				listHtml += this._renderListOption(option);
1199				selectHtml += this._renderOption(option);
1200			}, this));
1201
1202			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
1203				$destinationUl = this.$optgroupSet.eq(optgroupIndex);
1204				$destinationOptgroup = $('optgroup', this.$el).eq(optgroupIndex);
1205			}
1206			if ($.isNumeric(optionIndex)) {
1207				$ulOptions = $('.ik_select_option', $destinationUl);
1208				if (optionIndex < $ulOptions.length) {
1209					$ulOptions.eq(optionIndex).before(listHtml);
1210					$optgroupOptions = $('option', $destinationOptgroup);
1211					$optgroupOptions.eq(optionIndex).before(selectHtml);
1212				}
1213			}
1214			if (!$optgroupOptions) {
1215				$destinationUl.append(listHtml);
1216				$destinationOptgroup.append(selectHtml);
1217			}
1218
1219			this.$optionSet = $('.ik_select_option', this.$listInner);
1220			this._fixHeight();
1221		},
1222
1223		addOptgroups: function (optgroups, optgroupIndex) {
1224			var listHtml = '', selectHtml = '';
1225			if (!optgroups) {
1226				return;
1227			}
1228			optgroups = $.isArray(optgroups) ? optgroups : [optgroups];
1229
1230			$.each(optgroups, $.proxy(function (optgroupIndex, optgroup) {
1231				listHtml += this._renderListOptgroup(optgroup);
1232				selectHtml += this._renderOptgroup(optgroup);
1233			}, this));
1234
1235			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
1236				this.$optgroupSet.eq(optgroupIndex).before(listHtml);
1237				$('optgroup', this.$el).eq(optgroupIndex).before(selectHtml);
1238			} else {
1239				this.$listInnerUl.append(listHtml);
1240				this.$el.append(selectHtml);
1241			}
1242
1243			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
1244			this.$optionSet = $('.ik_select_option', this.$listInner);
1245			this._fixHeight();
1246		},
1247
1248		removeOptions: function (optionIndexes, optgroupIndex) {
1249			var $removeList = $([]);
1250			var $listContext;
1251			var $selectContext;
1252
1253			if ($.isNumeric(optgroupIndex)) {
1254				if (optgroupIndex < 0) {
1255					$listContext = $('> .ik_select_option', this.$listInnerUl);
1256					$selectContext = $('> option', this.$el);
1257				} else if (optgroupIndex < this.$optgroupSet.length) {
1258					$listContext = $('.ik_select_option', this.$optgroupSet.eq(optgroupIndex));
1259					$selectContext = $('optgroup', this.$el).eq(optgroupIndex).find('option');
1260				}
1261			}
1262			if (!$listContext) {
1263				$listContext = this.$optionSet;
1264				$selectContext = $(this.el.options);
1265			}
1266
1267			if (!$.isArray(optionIndexes)) {
1268				optionIndexes = [optionIndexes];
1269			}
1270
1271			$.each(optionIndexes, $.proxy(function (index, optionIndex) {
1272				if (optionIndex < $listContext.length) {
1273					$removeList = $removeList.add($listContext.eq(optionIndex)).add($selectContext.eq(optionIndex));
1274				}
1275			}, this));
1276
1277			$removeList.remove();
1278			this.$optionSet = $('.ik_select_option', this.$listInner);
1279			this._syncOriginalOption();
1280			this._fixHeight();
1281		},
1282
1283		removeOptgroups: function (optgroupIndexes) {
1284			var $removeList = $([]);
1285			var $selectOptgroupSet = $('optgroup', this.el);
1286
1287			if (!$.isArray(optgroupIndexes)) {
1288				optgroupIndexes = [optgroupIndexes];
1289			}
1290
1291			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
1292				if (optgroupIndex < this.$optgroupSet.length) {
1293					$removeList = $removeList.add(this.$optgroupSet.eq(optgroupIndex)).add($selectOptgroupSet.eq(optgroupIndex));
1294				}
1295			}, this));
1296
1297			$removeList.remove();
1298			this.$optionSet = $('.ik_select_option', this.$listInner);
1299			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
1300			this._syncOriginalOption();
1301			this._fixHeight();
1302		},
1303
1304		// disable select
1305		disable: function () {
1306			this.toggle(false);
1307		},
1308
1309		// enable select
1310		enable: function () {
1311			this.toggle(true);
1312		},
1313
1314		// toggle select
1315		toggle: function (bool) {
1316			this.isDisabled = typeof bool !== 'undefined' ? !bool : !this.isDisabled;
1317			this.$el.prop('disabled', this.isDisabled);
1318			this.$link.toggleClass('ik_select_link_disabled', this.isDisabled);
1319		},
1320
1321		// make option selected by value
1322		select: function (value, isIndex) {
1323			if (!isIndex) {
1324				this.$el.val(value);
1325			} else {
1326				this.el.selectedIndex = value;
1327			}
1328			this._syncOriginalOption();
1329		},
1330
1331		disableOptgroups: function (optgroupIndexes) {
1332			this.toggleOptgroups(optgroupIndexes, false);
1333		},
1334
1335		enableOptgroups: function (optgroupIndexes) {
1336			this.toggleOptgroups(optgroupIndexes, true);
1337		},
1338
1339		toggleOptgroups: function (optgroupIndexes, bool) {
1340			if (!$.isArray(optgroupIndexes)) {
1341				optgroupIndexes = [optgroupIndexes];
1342			}
1343
1344			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
1345				var isDisabled;
1346				var $optionSet, indexes = [], indexFirst;
1347				var $optgroup = $('optgroup', this.$el).eq(optgroupIndex);
1348				isDisabled = typeof bool !== 'undefined' ? bool : $optgroup.prop('disabled');
1349				$optgroup.prop('disabled', !isDisabled);
1350				this.$optgroupSet.eq(optgroupIndex).toggleClass('ik_select_optgroup_disabled', !isDisabled);
1351
1352				$optionSet = $('option', $optgroup);
1353				indexFirst = $(this.el.options).index($optionSet.eq(0));
1354				for (var i = indexFirst; i < indexFirst + $optionSet.length; i++) {
1355					indexes.push(i);
1356				}
1357				this.toggleOptions(indexes, true, isDisabled);
1358			}, this));
1359
1360			this._syncOriginalOption();
1361		},
1362
1363		disableOptions: function (lookupValues, isIndex) {
1364			this.toggleOptions(lookupValues, isIndex, false);
1365		},
1366
1367		enableOptions: function (lookupValues, isIndex) {
1368			this.toggleOptions(lookupValues, isIndex, true);
1369		},
1370
1371		toggleOptions: function (lookupValues, isIndex, bool) {
1372			var $selectOptionSet = $('option', this.el);
1373			if (!$.isArray(lookupValues)) {
1374				lookupValues = [lookupValues];
1375			}
1376
1377			var toggleOption = $.proxy(function ($option, optionIndex) {
1378				var isDisabled = typeof bool !== 'undefined' ? bool : $option.prop('disabled');
1379				$option.prop('disabled', !isDisabled);
1380				this.$optionSet.eq(optionIndex).toggleClass('ik_select_option_disabled', !isDisabled);
1381			}, this);
1382
1383			$.each(lookupValues, function (index, lookupValue) {
1384				if (!isIndex) {
1385					$selectOptionSet.each(function (optionIndex, option) {
1386						var $option = $(option);
1387						if ($option.val() === lookupValue) {
1388							toggleOption($option, optionIndex);
1389							return this;
1390						}
1391					});
1392				} else {
1393					toggleOption($selectOptionSet.eq(lookupValue), lookupValue);
1394				}
1395			});
1396
1397			this._syncOriginalOption();
1398		},
1399
1400		// detach plugin from the orignal select
1401		detach: function () {
1402			this.$el.off('.ikSelect').css({
1403				width: '',
1404				height: '',
1405				left: '',
1406				top: '',
1407				position: '',
1408				margin: '',
1409				padding: ''
1410			});
1411
1412			this.$wrapper.before(this.$el);
1413			this.$wrapper.remove();
1414			this.$el.removeData('plugin_ikSelect');
1415		}
1416	});
1417
1418	$.fn.ikSelect = function (options) {
1419		var args;
1420		//do nothing if opera mini
1421		if ($.browser.operamini) {
1422			return this;
1423		}
1424
1425		args = Array.prototype.slice.call(arguments, 1);
1426
1427		return this.each(function () {
1428			var plugin;
1429			if (!$.data(this, 'plugin_ikSelect')) {
1430				$.data(this, 'plugin_ikSelect', new IkSelect(this, options));
1431			} else if (typeof options === 'string') {
1432				plugin = $.data(this, 'plugin_ikSelect');
1433				if (typeof plugin[options] === 'function') {
1434					plugin[options].apply(plugin, args);
1435				}
1436			}
1437		});
1438	};
1439
1440	$.ikSelect = {
1441		extendDefaults: function (options) {
1442			$.extend(defaults, options);
1443		}
1444	};
1445
1446	$(document).bind('click.ikSelect', function () {
1447		if (instOpened) {
1448			instOpened.hideDropdown();
1449		}
1450	});
1451})(jQuery, window, document);
1452
1453/* End */
1454;
1455; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/vendor/js/bootstrap.js?166601759327908";s:6:"source";s:49:"/local/templates/aspro_max/vendor/js/bootstrap.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1456/*!
1457 * Bootstrap v3.0.0
1458 *
1459 * Copyright 2013 Twitter, Inc
1460 * Licensed under the Apache License v2.0
1461 * http://www.apache.org/licenses/LICENSE-2.0
1462 *
1463 * Designed and built with all the love in the world @twitter by @mdo and @fat.
1464 */
1465
1466+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed.bs.alert").remove()}var c=a(this),d=c.attr("data-target");d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));var e=a(d);b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close.bs.alert"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.one(a.support.transition.end,f).emulateTransitionEnd(150):f()};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");b.prop("type")==="radio"&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f=typeof c=="object"&&c;
1466e||d.data("bs.button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();if(b>this.$items.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){if(this.sliding)return;return this.slide("next")},b.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(e.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")}));if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),typeof c=="object"&&c),g=typeof c=="string"?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),typeof c=="number"?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),c.data()),g=c.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=c.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){function e(){a(b).remove(),a(c).each(function(b){var c=f(a(this));if(!c.hasClass("open"))return;c.trigger(b=a.Event("hide.bs.dropdown"));if(b.isDefaultPrevented())return;c.removeClass("open").trigger("hidden.bs.dropdown")})}function f(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}"use strict";var b=".dropdown-backdrop",c="[data-toggle=dropdown]",d=function(b){var c=a(b).on("click.bs.dropdown",this.toggle)};d.prototype.toggle=function(b){var c=a(this);if(c.is(".disabled, :disabled"))return;var d=f(c),g=d.hasClass("open");e();
1466if(!g){"ontouchstart"in document.documentElement&&!d.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",e),d.trigger(b=a.Event("show.bs.dropdown"));if(b.isDefaultPrevented())return;d.toggleClass("open").trigger("shown.bs.dropdown"),c.focus()}return!1},d.prototype.keydown=function(b){if(!/(38|40|27)/.test(b.keyCode))return;var d=a(this);b.preventDefault(),b.stopPropagation();if(d.is(".disabled, :disabled"))return;var e=f(d),g=e.hasClass("open");if(!g||g&&b.keyCode==27)return b.which==27&&e.find(c).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",e);if(!h.length)return;var i=h.index(h.filter(":focus"));b.keyCode==38&&i>0&&i--,b.keyCode==40&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),e=c.data("dropdown");e||c.data("dropdown",e=new d(this)),typeof b=="string"&&e[b].call(c)})},a.fn.dropdown.Constructor=d,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",e).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",c,d.prototype.toggle).on("keydown.bs.dropdown.data-api",c+", [role=menu]",d.prototype.keydown)}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d);if(this.isShown||d.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)})},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]!==a.target&&!this.$element.has(a.target).length&&this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){a.which==27&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){if(a.target!==a.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus.call(this.$element[0]):this.hide.call(this)},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!b)return;e?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),typeof c=="object"&&c);f||e.data("bs.modal",f=new b(this,g)),typeof c=="string"?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);var e=this.options.trigger.split(" ");for(var f=e.length;f--;){var g=e[f];if(g=="click")this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if(g!="manual"){var h=g=="hover"?"mouseenter":"focus",i=g=="hover"?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="in";if(!c.options.delay||!c.options.delay.show)return c.show();c.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="out";if(!c.options.delay||!c.options.delay.hide)return c.hide();c.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d=typeof this.options.placement=="function"?this.options.placement.call(this,c[
14660],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m=this.options.container=="body"?window.innerWidth:j.outerWidth(),n=this.options.container=="body"?window.innerHeight:j.outerHeight(),o=this.options.container=="body"?0:j.offset().left;d=d=="bottom"&&g.top+g.height+i-l>n?"top":d=="top"&&g.top-l-i<0?"bottom":d=="right"&&g.right+h>m?"left":d=="left"&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;b=="top"&&j!=f&&(c=!0,a.top=a.top+f-j);if(/bottom|top/.test(b)){var k=0;a.left<0&&(k=a.left*-2,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function e(){b.hoverState!="in"&&c.detach()}var b=this,c=this.tip(),d=a.Event("hide.bs."+this.type);this.$element.trigger(d);if(d.isDefaultPrevented())return;return c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?c.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),this.$element.trigger("hidden.bs."+this.type),this},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},typeof b.getBoundingClientRect=="function"?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return a=="bottom"?{top:b.top+b.height,left:b.left+b.width/2-c/2}:a=="top"?{top:b.top-d,left:b.left+b.width/2-c/2}:a=="left"?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f=typeof c=="object"&&c;e||d.data("bs.tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||(typeof b.content=="function"?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f=typeof c=="object"&&c;e||d.data("bs.popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});b.trigger(f);if(f.isDefaultPrevented())return;var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})},b.prototype.activate=function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g).emulateTransitionEnd(150):g(),e.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;typeof f!="object"&&(h=g=f),typeof g=="function"&&(g=f.top()),typeof h=="function"&&(h=f.bottom());var i=this.unpin!=null&&d+this.unpin<=e.top?!1:h!=null&&e.top+this.$element.height()>=c-h?"bottom":g!=null&&d<=g?"top":!1;if(this.affixed===i)return;this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin=i=="bottom"?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),i=="bottom"&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()})};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f=typeof c=="object"&&c;
1466e||d.data("bs.affix",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var b=a.Event("show.bs.collapse");this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])},b.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var b=a.Event("hide.bs.collapse");this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};if(!a.support.transition)return d.call(this);this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350)},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),typeof c=="object"&&c);e||d.data("bs.collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":c.data(),i=c.attr("data-parent"),j=i&&a(i);if(!g||!g.transitioning)j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(c).addClass("collapsed"),c[f.hasClass("in")?"addClass":"removeClass"]("collapsed");f.collapse(h)})}(window.jQuery),+function(a){function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}"use strict",b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this,d=this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,c=b-this.$scrollElement.height(),d=this.offsets,e=this.targets,f=this.activeTarget,g;if(a>=c)return f!=(g=e.last()[0])&&this.activate(g);for(g=d.length;g--;)f!=e[g]&&a>=d[g]&&(!d[g+1]||a<=d[g+1])&&this.activate(e[g])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f=typeof c=="object"&&c;e||d.data("bs.scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(a.style[c]!==undefined)return{end:b[c]}}"use strict",a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery)
1467/* End */
1468;
1469; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/js/jquery.actual.min.js?16660175931238";s:6:"source";s:50:"/local/templates/aspro_max/js/jquery.actual.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1470/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
1471 * Licensed under the MIT License (LICENSE.txt).
1472 *
1473 * Version: 1.0.18
1474 *
1475 * Requires: jQuery >= 1.2.3
1476 */
1477(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a);
1478}else{a(jQuery);}}(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf;a.fn.extend({actual:function(b,l){if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';
1479}var f={absolute:false,clone:false,includeMargin:false,display:"block"};var i=a.extend(f,l);var e=this.eq(0);var h,j;if(i.clone===true){h=function(){var m="position: absolute !important; top: -1000 !important; ";
1480e=e.clone().attr("style",m).appendTo("body");};j=function(){e.remove();};}else{var g=[];var d="";var c;h=function(){c=e.parents().addBack().filter(":hidden");
1481d+="visibility: hidden !important; display: "+i.display+" !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);
1482var n=m.attr("style");g.push(n);m.attr("style",n?n+";"+d:d);});};j=function(){c.each(function(m){var o=a(this);var n=g[m];if(n===undefined){o.removeAttr("style");
1483}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});}));
1484/* End */
1485;
1486; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max/vendor/js/jquery.bxslider.js?166601759366080";s:6:"source";s:55:"/local/templates/aspro_max/vendor/js/jquery.bxslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1487/**
1488 * bxSlider v4.2.12
1489 * Copyright 2013-2015 Steven Wanderski
1490 * Written while drinking Belgian ales and listening to jazz
1491 * Licensed under MIT (http://opensource.org/licenses/MIT)
1492 */
1493
1494;(function($) {
1495
1496  var defaults = {
1497
1498    // GENERAL
1499    mode: 'horizontal',
1500    slideSelector: '',
1501    infiniteLoop: true,
1502    hideControlOnEnd: false,
1503    speed: 500,
1504    easing: null,
1505    slideMargin: 0,
1506    startSlide: 0,
1507    randomStart: false,
1508    captions: false,
1509    ticker: false,
1510    tickerHover: false,
1511    adaptiveHeight: false,
1512    adaptiveHeightSpeed: 500,
1513    video: false,
1514    useCSS: true,
1515    preloadImages: 'visible',
1516    responsive: true,
1517    slideZIndex: 50,
1518    wrapperClass: 'bx-wrapper',
1519
1520    // TOUCH
1521    touchEnabled: true,
1522    swipeThreshold: 50,
1523    oneToOneTouch: true,
1524    preventDefaultSwipeX: true,
1525    preventDefaultSwipeY: false,
1526
1527    // ACCESSIBILITY
1528    ariaLive: true,
1529    ariaHidden: true,
1530
1531    // KEYBOARD
1532    keyboardEnabled: false,
1533
1534    // PAGER
1535    pager: true,
1536    pagerType: 'full',
1537    pagerShortSeparator: ' / ',
1538    pagerSelector: null,
1539    buildPager: null,
1540    pagerCustom: null,
1541
1542    // CONTROLS
1543    controls: true,
1544    nextText: 'Next',
1545    prevText: 'Prev',
1546    nextSelector: null,
1547    prevSelector: null,
1548    autoControls: false,
1549    startText: 'Start',
1550    stopText: 'Stop',
1551    autoControlsCombine: false,
1552    autoControlsSelector: null,
1553
1554    // AUTO
1555    auto: false,
1556    pause: 4000,
1557    autoStart: true,
1558    autoDirection: 'next',
1559    stopAutoOnClick: false,
1560    autoHover: false,
1561    autoDelay: 0,
1562    autoSlideForOnePage: false,
1563
1564    // CAROUSEL
1565    minSlides: 1,
1566    maxSlides: 1,
1567    moveSlides: 0,
1568    slideWidth: 0,
1569    shrinkItems: false,
1570
1571    // CALLBACKS
1572    onSliderLoad: function() { return true; },
1573    onSlideBefore: function() { return true; },
1574    onSlideAfter: function() { return true; },
1575    onSlideNext: function() { return true; },
1576    onSlidePrev: function() { return true; },
1577    onSliderResize: function() { return true; },
1578	onAutoChange: function() { return true; } //calls when auto slides starts and stops
1579  };
1580
1581  $.fn.bxSlider = function(options) {
1582
1583    if (this.length === 0) {
1584      return this;
1585    }
1586
1587    // support multiple elements
1588    if (this.length > 1) {
1589      this.each(function() {
1590        $(this).bxSlider(options);
1591      });
1592      return this;
1593    }
1594
1595    // create a namespace to be used throughout the plugin
1596    var slider = {},
1597    // set a reference to our slider element
1598    el = this,
1599    // get the original window dimens (thanks a lot IE)
1600    windowWidth = $(window).width(),
1601    windowHeight = $(window).height();
1602
1603    // Return if slider is already initialized
1604    if ($(el).data('bxSlider')) { return; }
1605
1606    /**
1607     * ===================================================================================
1608     * = PRIVATE FUNCTIONS
1609     * ===================================================================================
1610     */
1611
1612    /**
1613     * Initializes namespace settings to be used throughout plugin
1614     */
1615    var init = function() {
1616      // Return if slider is already initialized
1617      if ($(el).data('bxSlider')) { return; }
1618      // merge user-supplied options with the defaults
1619      slider.settings = $.extend({}, defaults, options);
1620      // parse slideWidth setting
1621      slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
1622      // store the original children
1623      slider.children = el.children(slider.settings.slideSelector);
1624      // check if actual number of slides is less than minSlides / maxSlides
1625      if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; }
1626      if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; }
1627      // if random start, set the startSlide setting to random number
1628      if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); }
1629      // store active slide information
1630      slider.active = { index: slider.settings.startSlide };
vendor: 8,753 bytes, lines 1631-1809
1631      // store if the slider is in carousel mode (displaying / moving multiple slides)
1632      slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false;
1633      // if carousel, force preloadImages = 'all'
1634      if (slider.carousel) { slider.settings.preloadImages = 'all'; }
1635      // calculate the min / max width thresholds based on min / max number of slides
1636      // used to setup and update carousel slides dimensions
1637      slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
1638      slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
1639      // store the current state of the slider (if currently animating, working is true)
1640      slider.working = false;
1641      // initialize the controls object
1642      slider.controls = {};
1643      // initialize an auto interval
1644      slider.interval = null;
1645      // determine which property to use for transitions
1646      slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left';
1647      // determine if hardware acceleration can be used
1648      slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() {
1649        // create our test div element
1650        var div = document.createElement('div'),
1651        // css transition properties
1652        props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
1653        // test for each property
1654        for (var i = 0; i < props.length; i++) {
1655          if (div.style[props[i]] !== undefined) {
1656            slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
1657            slider.animProp = '-' + slider.cssPrefix + '-transform';
1658            return true;
1659          }
1660        }
1661        return false;
1662      }());
1663      // if vertical mode always make maxSlides and minSlides equal
1664      if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; }
1665      // save original style data
1666      el.data('origStyle', el.attr('style'));
1667      el.children(slider.settings.slideSelector).each(function() {
1668        $(this).data('origStyle', $(this).attr('style'));
1669      });
1670
1671      // perform all DOM / CSS modifications
1672      setup();
1673    };
1674
1675    /**
1676     * Performs all DOM and CSS modifications
1677     */
1678    var setup = function() {
1679      var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible)
1680
1681      // wrap el in a wrapper
1682      el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
1683      // store a namespace reference to .bx-viewport
1684      slider.viewport = el.parent();
1685
1686      // add aria-live if the setting is enabled and ticker mode is disabled
1687      if (slider.settings.ariaLive && !slider.settings.ticker) {
1688        slider.viewport.attr('aria-live', 'polite');
1689      }
1690      // add a loading div to display while images are loading
1691      slider.loader = $('<div class="bx-loading" />');
1692      slider.viewport.prepend(slider.loader);
1693      // set el to a massive width, to hold any needed slides
1694      // also strip any margin and padding from el
1695      el.css({
1696        width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto',
1697        position: 'relative'
1698      });
1699      // if using CSS, add the easing property
1700      if (slider.usingCSS && slider.settings.easing) {
1701        el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
1702      // if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
1703      } else if (!slider.settings.easing) {
1704        slider.settings.easing = 'swing';
1705      }
1706      // make modifications to the viewport (.bx-viewport)
1707      slider.viewport.css({
1708        width: '100%',
1709        overflow: 'hidden',
1710        position: 'relative'
1711      });
1712      slider.viewport.parent().css({
1713        maxWidth: getViewportMaxWidth()
1714      });
1715      // apply css to all slider children
1716      slider.children.css({
1717        // the float attribute is a reserved word in compressors like YUI compressor and need to be quoted #48
1718        'float': slider.settings.mode === 'horizontal' ? 'left' : 'none',
1719        listStyle: 'none',
1720        position: 'relative'
1721      });
1722      // apply the calculated width after the float is applied to prevent scrollbar interference
1723      slider.children.css('width', getSlideWidth());
1724      // if slideMargin is supplied, add the css
1725      if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); }
1726      if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); }
1727      // if "fade" mode, add positioning and z-index CSS
1728      if (slider.settings.mode === 'fade') {
1729        slider.children.css({
1730          position: 'absolute',
1731          zIndex: 0,
1732          display: 'none'
1733        });
1734        // prepare the z-index on the showing element
1735        slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
1736      }
1737      // create an element to contain all slider controls (pager, start / stop, etc)
1738      slider.controls.el = $('<div class="bx-controls" />');
1739      // if captions are requested, add them
1740      if (slider.settings.captions) { appendCaptions(); }
1741      // check if startSlide is last slide
1742      slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
1743      // if video is true, set up the fitVids plugin
1744      if (slider.settings.video) { el.fitVids(); }
1745      if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; }
1746      // only check for control addition if not in "ticker" mode
1747      if (!slider.settings.ticker) {
1748        // if controls are requested, add them
1749        if (slider.settings.controls) { appendControls(); }
1750        // if auto is true, and auto controls are requested, add them
1751        if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); }
1752        // if pager is requested, add it
1753        if (slider.settings.pager) { appendPager(); }
1754        // if any control option is requested, add the controls wrapper
1755        if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); }
1756      // if ticker mode, do not allow a pager
1757      } else {
1758        slider.settings.pager = false;
1759      }
1760      loadElements(preloadSelector, start);
1761    };
1762
1763    var loadElements = function(selector, callback) {
1764      var total = selector.find('img:not([src=""]), iframe').length,
1765      count = 0;
1766      if (total === 0) {
1767        callback();
1768        return;
1769      }
1770      selector.find('img:not([src=""]), iframe').each(function() {
1771        $(this).one('load error', function() {
1772          if (++count === total) { callback(); }
1773        }).each(function() {
1774          if (this.complete || this.src == '') { $(this).trigger('load'); }
1775        });
1776      });
1777    };
1778
1779    /**
1780     * Start the slider
1781     */
1782    var start = function() {
1783      // if infinite loop, prepare additional slides
1784      if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) {
1785        var slice    = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides,
1786        sliceAppend  = slider.children.slice(0, slice).clone(true).addClass('bx-clone'),
1787        slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone');
1788        if (slider.settings.ariaHidden) {
1789          sliceAppend.attr('aria-hidden', true);
1790          slicePrepend.attr('aria-hidden', true);
1791        }
1792        el.append(sliceAppend).prepend(slicePrepend);
1793      }
1794      // remove the loading DOM element
1795      slider.loader.remove();
1796      // set the left / top position of "el"
1797      setSlidePosition();
1798      // if "vertical" mode, always use adaptiveHeight to prevent odd behavior
1799      if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; }
1800      // set the viewport height
1801      slider.viewport.height(getViewportHeight());
1802      // make sure everything is positioned just right (same as a window resize)
1803      el.redrawSlider();
1804      // onSliderLoad callback
1805      slider.settings.onSliderLoad.call(el, slider.active.index);
1806      // slider has been fully initialized
1807      slider.initialized = true;
1808      // bind the resize call to the window
1809      if (slider.settings.responsive) { $(window).bind
vendor: 11,109 bytes, lines 1809-2049
1809('resize', resizeWindow); }
1810      // if auto is true and has more than 1 page, start the show
1811      if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); }
1812      // if ticker is true, start the ticker
1813      if (slider.settings.ticker) { initTicker(); }
1814      // if pager is requested, make the appropriate pager link active
1815      if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); }
1816      // check for any updates to the controls (like hideControlOnEnd updates)
1817      if (slider.settings.controls) { updateDirectionControls(); }
1818      // if touchEnabled is true, setup the touch events
1819      if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); }
1820      // if keyboardEnabled is true, setup the keyboard events
1821      if (slider.settings.keyboardEnabled && !slider.settings.ticker) {
1822        $(document).keydown(keyPress);
1823      }
1824    };
1825
1826    /**
1827     * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
1828     */
1829    var getViewportHeight = function() {
1830      var height = 0;
1831      // first determine which children (slides) should be used in our height calculation
1832      var children = $();
1833      // if mode is not "vertical" and adaptiveHeight is false, include all children
1834      if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
1835        children = slider.children;
1836      } else {
1837        // if not carousel, return the single active child
1838        if (!slider.carousel) {
1839          children = slider.children.eq(slider.active.index);
1840        // if carousel, return a slice of children
1841        } else {
1842          // get the individual slide index
1843          var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
1844          // add the current slide to the children
1845          children = slider.children.eq(currentIndex);
1846          // cycle through the remaining "showing" slides
1847          for (i = 1; i <= slider.settings.maxSlides - 1; i++) {
1848            // if looped back to the start
1849            if (currentIndex + i >= slider.children.length) {
1850              children = children.add(slider.children.eq(i - 1));
1851            } else {
1852              children = children.add(slider.children.eq(currentIndex + i));
1853            }
1854          }
1855        }
1856      }
1857      // if "vertical" mode, calculate the sum of the heights of the children
1858      if (slider.settings.mode === 'vertical') {
1859        children.each(function(index) {
1860          height += $(this).outerHeight();
1861        });
1862        // add user-supplied margins
1863        if (slider.settings.slideMargin > 0) {
1864          height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
1865        }
1866      // if not "vertical" mode, calculate the max height of the children
1867      } else {
1868        height = Math.max.apply(Math, children.map(function() {
1869          return $(this).outerHeight(false);
1870        }).get());
1871      }
1872
1873      if (slider.viewport.css('box-sizing') === 'border-box') {
1874        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
1875              parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
1876      } else if (slider.viewport.css('box-sizing') === 'padding-box') {
1877        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
1878      }
1879
1880      return height;
1881    };
1882
1883    /**
1884     * Returns the calculated width to be used for the outer wrapper / viewport
1885     */
1886    var getViewportMaxWidth = function() {
1887      var width = '100%';
1888      if (slider.settings.slideWidth > 0) {
1889        if (slider.settings.mode === 'horizontal') {
1890          width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
1891        } else {
1892          width = slider.settings.slideWidth;
1893        }
1894      }
1895      return width;
1896    };
1897
1898    /**
1899     * Returns the calculated width to be applied to each slide
1900     */
1901    var getSlideWidth = function() {
1902      var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width
1903      wrapWidth      = slider.viewport.width();    // get the current viewport width
1904      // if slide width was not supplied, or is larger than the viewport use the viewport width
1905      if (slider.settings.slideWidth === 0 ||
1906        (slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
1907        slider.settings.mode === 'vertical') {
1908        newElWidth = wrapWidth;
1909      // if carousel, use the thresholds to determine the width
1910      } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') {
1911        if (wrapWidth > slider.maxThreshold) {
1912          return newElWidth;
1913        } else if (wrapWidth < slider.minThreshold) {
1914          newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
1915        } else if (slider.settings.shrinkItems) {
1916          newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin);
1917        }
1918      }
1919      return newElWidth;
1920    };
1921
1922    /**
1923     * Returns the number of slides currently visible in the viewport (includes partially visible slides)
1924     */
1925    var getNumberSlidesShowing = function() {
1926      var slidesShowing = 1,
1927      childWidth = null;
1928      if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) {
1929        // if viewport is smaller than minThreshold, return minSlides
1930        if (slider.viewport.width() < slider.minThreshold) {
1931          slidesShowing = slider.settings.minSlides;
1932        // if viewport is larger than maxThreshold, return maxSlides
1933        } else if (slider.viewport.width() > slider.maxThreshold) {
1934          slidesShowing = slider.settings.maxSlides;
1935        // if viewport is between min / max thresholds, divide viewport width by first child width
1936        } else {
1937          childWidth = slider.children.first().width() + slider.settings.slideMargin;
1938          slidesShowing = Math.floor((slider.viewport.width() +
1939            slider.settings.slideMargin) / childWidth) || 1;
1940        }
1941      // if "vertical" mode, slides showing will always be minSlides
1942      } else if (slider.settings.mode === 'vertical') {
1943        slidesShowing = slider.settings.minSlides;
1944      }
1945      return slidesShowing;
1946    };
1947
1948    /**
1949     * Returns the number of pages (one full viewport of slides is one "page")
1950     */
1951    var getPagerQty = function() {
1952      var pagerQty = 0,
1953      breakPoint = 0,
1954      counter = 0;
1955      // if moveSlides is specified by the user
1956      if (slider.settings.moveSlides > 0) {
1957        if (slider.settings.infiniteLoop) {
1958          pagerQty = Math.ceil(slider.children.length / getMoveBy());
1959        } else {
1960          // when breakpoint goes above children length, counter is the number of pages
1961          while (breakPoint < slider.children.length) {
1962            ++pagerQty;
1963            breakPoint = counter + getNumberSlidesShowing();
1964            counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
1965          }
1966		  return counter;
1967        }
1968      // if moveSlides is 0 (auto) divide children length by sides showing, then round up
1969      } else {
1970        pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
1971      }
1972      return pagerQty;
1973    };
1974
1975    /**
1976     * Returns the number of individual slides by which to shift the slider
1977     */
1978    var getMoveBy = function() {
1979      // if moveSlides was set by the user and moveSlides is less than number of slides showing
1980      if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) {
1981        return slider.settings.moveSlides;
1982      }
1983      // if moveSlides is 0 (auto)
1984      return getNumberSlidesShowing();
1985    };
1986
1987    /**
1988     * Sets the slider's (el) left or top position
1989     */
1990    var setSlidePosition = function() {
1991      var position, lastChild, lastShowingIndex;
1992      // if last slide, not infinite loop, and number of children is larger than specified maxSlides
1993      if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) {
1994        if (slider.settings.mode === 'horizontal') {
1995          // get the last child's position
1996          lastChild = slider.children.last();
1997          position = lastChild.position();
1998          // set the left position
1999          setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
2000        } else if (slider.settings.mode === 'vertical') {
2001          // get the last showing index's position
2002          lastShowingIndex = slider.children.length - slider.settings.minSlides;
2003          position = slider.children.eq(lastShowingIndex).position();
2004          // set the top position
2005          setPositionProperty(-position.top, 'reset', 0);
2006        }
2007      // if not last slide
2008      } else {
2009        // get the position of the first showing slide
2010        position = slider.children.eq(slider.active.index * getMoveBy()).position();
2011        // check for last slide
2012        if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; }
2013        // set the respective position
2014        if (position !== undefined) {
2015          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
2016          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
2017        }
2018      }
2019    };
2020
2021    /**
2022     * Sets the el's animating property position (which in turn will sometimes animate el).
2023     * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
2024     *
2025     * @param value (int)
2026     *  - the animating property's value
2027     *
2028     * @param type (string) 'slide', 'reset', 'ticker'
2029     *  - the type of instance for which the function is being
2030     *
2031     * @param duration (int)
2032     *  - the amount of time (in ms) the transition should occupy
2033     *
2034     * @param params (array) optional
2035     *  - an optional parameter containing any variables that need to be passed in
2036     */
2037    var setPositionProperty = function(value, type, duration, params) {
2038      var animateObj, propValue;
2039      // use CSS transform
2040      if (slider.usingCSS) {
2041        // determine the translate3d value
2042        propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
2043        // add the CSS transition-duration
2044        el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
2045        if (type === 'slide') {
2046          // set the property value
2047          el.css(slider.animProp, propValue);
2048          if (duration !== 0) {
2049            // 
vendor: 3,149 bytes, lines 2049-2122
2049bind a callback method - executes when CSS transition completes
2050            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
2051              //make sure it's the correct one
2052              if (!$(e.target).is(el)) { return; }
2053              // unbind the callback
2054              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
2055              updateAfterSlideTransition();
2056            });
2057          } else { //duration = 0
2058            updateAfterSlideTransition();
2059          }
2060        } else if (type === 'reset') {
2061          el.css(slider.animProp, propValue);
2062        } else if (type === 'ticker') {
2063          // make the transition use 'linear'
2064          el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
2065          el.css(slider.animProp, propValue);
2066          if (duration !== 0) {
2067            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
2068              //make sure it's the correct one
2069              if (!$(e.target).is(el)) { return; }
2070              // unbind the callback
2071              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
2072              // reset the position
2073              setPositionProperty(params.resetValue, 'reset', 0);
2074              // start the loop again
2075              tickerLoop();
2076            });
2077          } else { //duration = 0
2078            setPositionProperty(params.resetValue, 'reset', 0);
2079            tickerLoop();
2080          }
2081        }
2082      // use JS animate
2083      } else {
2084        animateObj = {};
2085        animateObj[slider.animProp] = value;
2086        if (type === 'slide') {
2087          el.animate(animateObj, duration, slider.settings.easing, function() {
2088            updateAfterSlideTransition();
2089          });
2090        } else if (type === 'reset') {
2091          el.css(slider.animProp, value);
2092        } else if (type === 'ticker') {
2093          el.animate(animateObj, duration, 'linear', function() {
2094            setPositionProperty(params.resetValue, 'reset', 0);
2095            // run the recursive loop after animation
2096            tickerLoop();
2097          });
2098        }
2099      }
2100    };
2101
2102    /**
2103     * Populates the pager with proper amount of pages
2104     */
2105    var populatePager = function() {
2106      var pagerHtml = '',
2107      linkContent = '',
2108      pagerQty = getPagerQty();
2109      // loop through each pager item
2110      for (var i = 0; i < pagerQty; i++) {
2111        linkContent = '';
2112        // if a buildPager function is supplied, use it to get pager link value, else use index + 1
2113        if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) {
2114          linkContent = slider.settings.buildPager(i);
2115          slider.pagerEl.addClass('bx-custom-pager');
2116        } else {
2117          linkContent = i + 1;
2118          slider.pagerEl.addClass('bx-default-pager');
2119        }
2120        // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
2121        // add the markup to the string
2122        pagerHtml += '<div class="bx-pager-item">
2122<a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
2123      }
2124      // populate the pager element with pager links
2125      slider.pagerEl.html(pagerHtml);
2126    };
2127
2128    /**
2129     * Appends the pager to the controls element
2130     */
2131    var appendPager = function() {
2132      if (!slider.settings.pagerCustom) {
2133        // create the pager DOM element
2134        slider.pagerEl = $('<div class="bx-pager" />');
2135        // if a pager selector was supplied, populate it with the pager
2136        if (slider.settings.pagerSelector) {
2137          $(slider.settings.pagerSelector).html(slider.pagerEl);
2138        // if no pager selector was supplied, add it after the wrapper
2139        } else {
2140          slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
2141        }
2142        // populate the pager
2143        populatePager();
2144      } else {
2145        slider.pagerEl = $(slider.settings.pagerCustom);
2146      }
2147      // assign the pager click binding
2148      slider.pagerEl.on('click touchend', 'a', clickPagerBind);
2149    };
2150
2151    /**
2152     * Appends prev / next controls to the controls element
2153     */
2154    var appendControls = function() {
2155      slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
2156      slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
2157      // bind click actions to the controls
2158      slider.controls.next.bind('click touchend', clickNextBind);
2159      slider.controls.prev.bind('click touchend', clickPrevBind);
2160      // if nextSelector was supplied, populate it
2161      if (slider.settings.nextSelector) {
2162        $(slider.settings.nextSelector).append(slider.controls.next);
2163      }
2164      // if prevSelector was supplied, populate it
2165      if (slider.settings.prevSelector) {
2166        $(slider.settings.prevSelector).append(slider.controls.prev);
2167      }
2168      // if no custom selectors were supplied
2169      if (!slider.settings.nextSelector && !slider.settings.prevSelector) {
2170        // add the controls to the DOM
2171        slider.controls.directionEl = $('<div class="bx-controls-direction" />');
2172        // add the control elements to the directionEl
2173        slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
2174        // slider.viewport.append(slider.controls.directionEl);
2175        slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
2176      }
2177    };
2178
2179    /**
2180     * Appends start / stop auto controls to the controls element
2181     */
2182    var appendControlsAuto = function() {
2183      slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
2184      slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
2185      // add the controls to the DOM
2186      slider.controls.autoEl = $('<div class="bx-controls-auto" />');
2187      // bind
vendor: 7,523 bytes, lines 2187-2395
2187 click actions to the controls
2188      slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
2189      slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
2190      // if autoControlsCombine, insert only the "start" control
2191      if (slider.settings.autoControlsCombine) {
2192        slider.controls.autoEl.append(slider.controls.start);
2193      // if autoControlsCombine is false, insert both controls
2194      } else {
2195        slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
2196      }
2197      // if auto controls selector was supplied, populate it with the controls
2198      if (slider.settings.autoControlsSelector) {
2199        $(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
2200      // if auto controls selector was not supplied, add it after the wrapper
2201      } else {
2202        slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
2203      }
2204      // update the auto controls
2205      updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
2206    };
2207
2208    /**
2209     * Appends image captions to the DOM
2210     */
2211    var appendCaptions = function() {
2212      // cycle through each child
2213      slider.children.each(function(index) {
2214        // get the image title attribute
2215        var title = $(this).find('img:first').attr('title');
2216        // append the caption
2217        if (title !== undefined && ('' + title).length) {
2218          $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
2219        }
2220      });
2221    };
2222
2223    /**
2224     * Click next binding
2225     *
2226     * @param e (event)
2227     *  - DOM event object
2228     */
2229    var clickNextBind = function(e) {
2230      e.preventDefault();
2231      if (slider.controls.el.hasClass('disabled')) { return; }
2232      // if auto show is running, stop it
2233      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
2234      el.goToNextSlide();
2235    };
2236
2237    /**
2238     * Click prev binding
2239     *
2240     * @param e (event)
2241     *  - DOM event object
2242     */
2243    var clickPrevBind = function(e) {
2244      e.preventDefault();
2245      if (slider.controls.el.hasClass('disabled')) { return; }
2246      // if auto show is running, stop it
2247      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
2248      el.goToPrevSlide();
2249    };
2250
2251    /**
2252     * Click start binding
2253     *
2254     * @param e (event)
2255     *  - DOM event object
2256     */
2257    var clickStartBind = function(e) {
2258      el.startAuto();
2259      e.preventDefault();
2260    };
2261
2262    /**
2263     * Click stop binding
2264     *
2265     * @param e (event)
2266     *  - DOM event object
2267     */
2268    var clickStopBind = function(e) {
2269      el.stopAuto();
2270      e.preventDefault();
2271    };
2272
2273    /**
2274     * Click pager binding
2275     *
2276     * @param e (event)
2277     *  - DOM event object
2278     */
2279    var clickPagerBind = function(e) {
2280      var pagerLink, pagerIndex;
2281      e.preventDefault();
2282      if (slider.controls.el.hasClass('disabled')) {
2283        return;
2284      }
2285      // if auto show is running, stop it
2286      if (slider.settings.auto  && slider.settings.stopAutoOnClick) { el.stopAuto(); }
2287      pagerLink = $(e.currentTarget);
2288      if (pagerLink.attr('data-slide-index') !== undefined) {
2289        pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
2290        // if clicked pager link is not active, continue with the goToSlide call
2291        if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); }
2292      }
2293    };
2294
2295    /**
2296     * Updates the pager links with an active class
2297     *
2298     * @param slideIndex (int)
2299     *  - index of slide to make active
2300     */
2301    var updatePagerActive = function(slideIndex) {
2302      // if "short" pager type
2303      var len = slider.children.length; // nb of children
2304      if (slider.settings.pagerType === 'short') {
2305        if (slider.settings.maxSlides > 1) {
2306          len = Math.ceil(slider.children.length / slider.settings.maxSlides);
2307        }
2308        slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len);
2309        return;
2310      }
2311      // remove all pager active classes
2312      slider.pagerEl.find('a').removeClass('active');
2313      // apply the active class for all pagers
2314      slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
2315    };
2316
2317    /**
2318     * Performs needed actions after a slide transition
2319     */
2320    var updateAfterSlideTransition = function() {
2321      // if infinite loop is true
2322      if (slider.settings.infiniteLoop) {
2323        var position = '';
2324        // first slide
2325        if (slider.active.index === 0) {
2326          // set the new position
2327          position = slider.children.eq(0).position();
2328        // carousel, last slide
2329        } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) {
2330          position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
2331        // last slide
2332        } else if (slider.active.index === slider.children.length - 1) {
2333          position = slider.children.eq(slider.children.length - 1).position();
2334        }
2335        if (position) {
2336          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
2337          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
2338        }
2339      }
2340      // declare that the transition is complete
2341      slider.working = false;
2342      // onSlideAfter callback
2343      slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
2344    };
2345
2346    /**
2347     * Updates the auto controls state (either active, or combined switch)
2348     *
2349     * @param state (string) "start", "stop"
2350     *  - the new state of the auto show
2351     */
2352    var updateAutoControls = function(state) {
2353      // if autoControlsCombine is true, replace the current control with the new state
2354      if (slider.settings.autoControlsCombine) {
2355        slider.controls.autoEl.html(slider.controls[state]);
2356      // if autoControlsCombine is false, apply the "active" class to the appropriate control
2357      } else {
2358        slider.controls.autoEl.find('a').removeClass('active');
2359        slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
2360      }
2361    };
2362
2363    /**
2364     * Updates the direction controls (checks if either should be hidden)
2365     */
2366    var updateDirectionControls = function() {
2367      if (getPagerQty() === 1) {
2368        slider.controls.prev.addClass('disabled');
2369        slider.controls.next.addClass('disabled');
2370      } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) {
2371        // if first slide
2372        if (slider.active.index === 0) {
2373          slider.controls.prev.addClass('disabled');
2374          slider.controls.next.removeClass('disabled');
2375        // if last slide
2376        } else if (slider.active.index === getPagerQty() - 1) {
2377          slider.controls.next.addClass('disabled');
2378          slider.controls.prev.removeClass('disabled');
2379        // if any slide in the middle
2380        } else {
2381          slider.controls.prev.removeClass('disabled');
2382          slider.controls.next.removeClass('disabled');
2383        }
2384      }
2385    };
2386	/* auto start and stop functions */
2387	var windowFocusHandler = function() { el.startAuto(); };
2388	var windowBlurHandler = function() { el.stopAuto(); };
2389    /**
2390     * Initializes the auto process
2391     */
2392    var initAuto = function() {
2393      // if autoDelay was supplied, launch the auto show using a setTimeout() call
2394      if (slider.settings.autoDelay > 0) {
2395        
2395var timeout =
vendor: 6,544 bytes, lines 2395-2561
2395 setTimeout(el.startAuto, slider.settings.autoDelay);
2396      // if autoDelay was not supplied, start the auto show normally
2397      } else {
2398        el.startAuto();
2399
2400        //add focus and blur events to ensure its running if timeout gets paused
2401        $(window).focus(windowFocusHandler).blur(windowBlurHandler);
2402      }
2403      // if autoHover is requested
2404      if (slider.settings.autoHover) {
2405        // on el hover
2406        el.hover(function() {
2407          // if the auto show is currently playing (has an active interval)
2408          if (slider.interval) {
2409            // stop the auto show and pass true argument which will prevent control update
2410            el.stopAuto(true);
2411            // create a new autoPaused value which will be used by the relative "mouseout" event
2412            slider.autoPaused = true;
2413          }
2414        }, function() {
2415          // if the autoPaused value was created be the prior "mouseover" event
2416          if (slider.autoPaused) {
2417            // start the auto show and pass true argument which will prevent control update
2418            el.startAuto(true);
2419            // reset the autoPaused value
2420            slider.autoPaused = null;
2421          }
2422        });
2423      }
2424    };
2425
2426    /**
2427     * Initializes the ticker process
2428     */
2429    var initTicker = function() {
2430      var startPosition = 0,
2431      position, transform, value, idx, ratio, property, newSpeed, totalDimens;
2432      // if autoDirection is "next", append a clone of the entire slider
2433      if (slider.settings.autoDirection === 'next') {
2434        el.append(slider.children.clone().addClass('bx-clone'));
2435      // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
2436      } else {
2437        el.prepend(slider.children.clone().addClass('bx-clone'));
2438        position = slider.children.first().position();
2439        startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
2440      }
2441      setPositionProperty(startPosition, 'reset', 0);
2442      // do not allow controls in ticker mode
2443      slider.settings.pager = false;
2444      slider.settings.controls = false;
2445      slider.settings.autoControls = false;
2446      // if autoHover is requested
2447      if (slider.settings.tickerHover) {
2448        if (slider.usingCSS) {
2449          idx = slider.settings.mode === 'horizontal' ? 4 : 5;
2450          slider.viewport.hover(function() {
2451            transform = el.css('-' + slider.cssPrefix + '-transform');
2452            value = parseFloat(transform.split(',')[idx]);
2453            setPositionProperty(value, 'reset', 0);
2454          }, function() {
2455            totalDimens = 0;
2456            slider.children.each(function(index) {
2457              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
2458            });
2459            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
2460            ratio = slider.settings.speed / totalDimens;
2461            // determine which property to use
2462            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
2463            // calculate the new speed
2464            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value))));
2465            tickerLoop(newSpeed);
2466          });
2467        } else {
2468          // on el hover
2469          slider.viewport.hover(function() {
2470            el.stop();
2471          }, function() {
2472            // calculate the total width of children (used to calculate the speed ratio)
2473            totalDimens = 0;
2474            slider.children.each(function(index) {
2475              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
2476            });
2477            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
2478            ratio = slider.settings.speed / totalDimens;
2479            // determine which property to use
2480            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
2481            // calculate the new speed
2482            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
2483            tickerLoop(newSpeed);
2484          });
2485        }
2486      }
2487      // start the ticker loop
2488      tickerLoop();
2489    };
2490
2491    /**
2492     * Runs a continuous loop, news ticker-style
2493     */
2494    var tickerLoop = function(resumeSpeed) {
2495      var speed = resumeSpeed ? resumeSpeed : slider.settings.speed,
2496      position = {left: 0, top: 0},
2497      reset = {left: 0, top: 0},
2498      animateProperty, resetValue, params;
2499
2500      // if "next" animate left position to last child, then reset left to 0
2501      if (slider.settings.autoDirection === 'next') {
2502        position = el.find('.bx-clone').first().position();
2503      // if "prev" animate left position to 0, then reset left to first non-clone child
2504      } else {
2505        reset = slider.children.first().position();
2506      }
2507      animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
2508      resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top;
2509      params = {resetValue: resetValue};
2510      setPositionProperty(animateProperty, 'ticker', speed, params);
2511    };
2512
2513    /**
2514     * Check if el is on screen
2515     */
2516    var isOnScreen = function(el) {
2517      var win = $(window),
2518      viewport = {
2519        top: win.scrollTop(),
2520        left: win.scrollLeft()
2521      },
2522      bounds = el.offset();
2523
2524      viewport.right = viewport.left + win.width();
2525      viewport.bottom = viewport.top + win.height();
2526      bounds.right = bounds.left + el.outerWidth();
2527      bounds.bottom = bounds.top + el.outerHeight();
2528
2529      return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
2530    };
2531
2532    /**
2533     * Initializes keyboard events
2534     */
2535    var keyPress = function(e) {
2536      var activeElementTag = document.activeElement.tagName.toLowerCase(),
2537      tagFilters = 'input|textarea',
2538      p = new RegExp(activeElementTag,['i']),
2539      result = p.exec(tagFilters);
2540
2541      if (result == null && isOnScreen(el)) {
2542        if (e.keyCode === 39) {
2543          clickNextBind(e);
2544          return false;
2545        } else if (e.keyCode === 37) {
2546          clickPrevBind(e);
2547          return false;
2548        }
2549      }
2550    };
2551
2552    /**
2553     * Initializes touch events
2554     */
2555    var initTouch = function() {
2556      // initialize object to contain all touch values
2557      slider.touch = {
2558        start: {x: 0, y: 0},
2559        end: {x: 0, y: 0}
2560      };
2561      slider.viewport.
vendor: 6,703 bytes, lines 2561-2723
2561bind('touchstart MSPointerDown pointerdown', onTouchStart);
2562
2563      //for browsers that have implemented pointer events and fire a click after
2564      //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not
2565      slider.viewport.on('click', '.bxslider a', function(e) {
2566        if (slider.viewport.hasClass('click-disabled')) {
2567          e.preventDefault();
2568          slider.viewport.removeClass('click-disabled');
2569        }
2570      });
2571    };
2572
2573    /**
2574     * Event handler for "touchstart"
2575     *
2576     * @param e (event)
2577     *  - DOM event object
2578     */
2579    var onTouchStart = function(e) {
2580      //disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls
2581      slider.controls.el.addClass('disabled');
2582
2583      if (slider.working) {
2584        e.preventDefault();
2585        slider.controls.el.removeClass('disabled');
2586      } else {
2587        // record the original position when touch starts
2588        slider.touch.originalPos = el.position();
2589        var orig = e.originalEvent,
2590        touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
2591        // record the starting touch x, y coordinates
2592        slider.touch.start.x = touchPoints[0].pageX;
2593        slider.touch.start.y = touchPoints[0].pageY;
2594
2595        var chromePointerEvents = typeof PointerEvent === 'function'; if (chromePointerEvents) { if (orig.pointerId === undefined) { return; } }
2596        if (slider.viewport.get(0).setPointerCapture) {
2597          slider.pointerId = orig.pointerId;
2598          slider.viewport.get(0).setPointerCapture(slider.pointerId);
2599        }
2600        // bind a "touchmove" event to the viewport
2601        slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove);
2602        // bind a "touchend" event to the viewport
2603        slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd);
2604        slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel);
2605      }
2606    };
2607
2608    /**
2609     * Cancel Pointer for Windows Phone
2610     *
2611     * @param e (event)
2612     *  - DOM event object
2613     */
2614    var onPointerCancel = function(e) {
2615      /* onPointerCancel handler is needed to deal with situations when a touchend
2616      doesn't fire after a touchstart (this happens on windows phones only) */
2617      setPositionProperty(slider.touch.originalPos.left, 'reset', 0);
2618
2619      //remove handlers
2620      slider.controls.el.removeClass('disabled');
2621      slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel);
2622      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
2623      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
2624      if (slider.viewport.get(0).releasePointerCapture) {
2625        slider.viewport.get(0).releasePointerCapture(slider.pointerId);
2626      }
2627    };
2628
2629    /**
2630     * Event handler for "touchmove"
2631     *
2632     * @param e (event)
2633     *  - DOM event object
2634     */
2635    var onTouchMove = function(e) {
2636      var orig = e.originalEvent,
2637      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
2638      // if scrolling on y axis, do not prevent default
2639      xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x),
2640      yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y),
2641      value = 0,
2642      change = 0;
2643
2644      // x axis swipe
2645      if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) {
2646        e.preventDefault();
2647      // y axis swipe
2648      } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) {
2649        e.preventDefault();
2650      }
2651      if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) {
2652        // if horizontal, drag along x axis
2653        if (slider.settings.mode === 'horizontal') {
2654          change = touchPoints[0].pageX - slider.touch.start.x;
2655          value = slider.touch.originalPos.left + change;
2656        // if vertical, drag along y axis
2657        } else {
2658          change = touchPoints[0].pageY - slider.touch.start.y;
2659          value = slider.touch.originalPos.top + change;
2660        }
2661        setPositionProperty(value, 'reset', 0);
2662      }
2663    };
2664
2665    /**
2666     * Event handler for "touchend"
2667     *
2668     * @param e (event)
2669     *  - DOM event object
2670     */
2671    var onTouchEnd = function(e) {
2672      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
2673      //enable slider controls as soon as user stops interacing with slides
2674      slider.controls.el.removeClass('disabled');
2675      var orig    = e.originalEvent,
2676      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
2677      value       = 0,
2678      distance    = 0;
2679      // record end x, y positions
2680      slider.touch.end.x = touchPoints[0].pageX;
2681      slider.touch.end.y = touchPoints[0].pageY;
2682      // if fade mode, check if absolute x distance clears the threshold
2683      if (slider.settings.mode === 'fade') {
2684        distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
2685        if (distance >= slider.settings.swipeThreshold) {
2686          if (slider.touch.start.x > slider.touch.end.x) {
2687            el.goToNextSlide();
2688          } else {
2689            el.goToPrevSlide();
2690          }
2691          el.stopAuto();
2692        }
2693      // not fade mode
2694      } else {
2695        // calculate distance and el's animate property
2696        if (slider.settings.mode === 'horizontal') {
2697          distance = slider.touch.end.x - slider.touch.start.x;
2698          value = slider.touch.originalPos.left;
2699        } else {
2700          distance = slider.touch.end.y - slider.touch.start.y;
2701          value = slider.touch.originalPos.top;
2702        }
2703        // if not infinite loop and first / last slide, do not attempt a slide transition
2704        if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) {
2705          setPositionProperty(value, 'reset', 200);
2706        } else {
2707          // check if distance clears threshold
2708          if (Math.abs(distance) >= slider.settings.swipeThreshold) {
2709            if (distance < 0) {
2710              el.goToNextSlide();
2711            } else {
2712              el.goToPrevSlide();
2713            }
2714            el.stopAuto();
2715          } else {
2716            // el.animate(property, 200);
2717            setPositionProperty(value, 'reset', 200);
2718          }
2719        }
2720      }
2721      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
2722      if (slider.viewport.get(0).releasePointerCapture) {
2723        slider.viewport.get(0).releasePointerCapture(slider.pointerId
vendor: 9,203 bytes, lines 2723-2930
2723);
2724      }
2725    };
2726
2727    /**
2728     * Window resize event callback
2729     */
2730    var resizeWindow = function(e) {
2731      // don't do anything if slider isn't initialized.
2732      if (!slider.initialized) { return; }
2733      // Delay if slider working.
2734      if (slider.working) {
2735        window.setTimeout(resizeWindow, 10);
2736      } else {
2737        // get the new window dimens (again, thank you IE)
2738        var windowWidthNew = $(window).width(),
2739        windowHeightNew = $(window).height();
2740        // make sure that it is a true window resize
2741        // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
2742        // are resized. Can you just die already?*
2743        if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) {
2744          // set the new window dimens
2745          windowWidth = windowWidthNew;
2746          windowHeight = windowHeightNew;
2747          // update all dynamic elements
2748          el.redrawSlider();
2749          // Call user resize handler
2750          slider.settings.onSliderResize.call(el, slider.active.index);
2751        }
2752      }
2753    };
2754
2755    /**
2756     * Adds an aria-hidden=true attribute to each element
2757     *
2758     * @param startVisibleIndex (int)
2759     *  - the first visible element's index
2760     */
2761    var applyAriaHiddenAttributes = function(startVisibleIndex) {
2762      var numberOfSlidesShowing = getNumberSlidesShowing();
2763      // only apply attributes if the setting is enabled and not in ticker mode
2764      if (slider.settings.ariaHidden && !slider.settings.ticker) {
2765        // add aria-hidden=true to all elements
2766        slider.children.attr('aria-hidden', 'true');
2767        // get the visible elements and change to aria-hidden=false
2768        slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false');
2769      }
2770    };
2771
2772    /**
2773     * Returns index according to present page range
2774     *
2775     * @param slideOndex (int)
2776     *  - the desired slide index
2777     */
2778    var setSlideIndex = function(slideIndex) {
2779      if (slideIndex < 0) {
2780        if (slider.settings.infiniteLoop) {
2781          return getPagerQty() - 1;
2782        }else {
2783          //we don't go to undefined slides
2784          return slider.active.index;
2785        }
2786      // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
2787      } else if (slideIndex >= getPagerQty()) {
2788        if (slider.settings.infiniteLoop) {
2789          return 0;
2790        } else {
2791          //we don't move to undefined pages
2792          return slider.active.index;
2793        }
2794      // set active index to requested slide
2795      } else {
2796        return slideIndex;
2797      }
2798    };
2799
2800    /**
2801     * ===================================================================================
2802     * = PUBLIC FUNCTIONS
2803     * ===================================================================================
2804     */
2805
2806    /**
2807     * Performs slide transition to the specified slide
2808     *
2809     * @param slideIndex (int)
2810     *  - the destination slide's index (zero-based)
2811     *
2812     * @param direction (string)
2813     *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
2814     */
2815    el.goToSlide = function(slideIndex, direction) {
2816      // onSlideBefore, onSlideNext, onSlidePrev callbacks
2817      // Allow transition canceling based on returned value
2818      var performTransition = true,
2819      moveBy = 0,
2820      position = {left: 0, top: 0},
2821      lastChild = null,
2822      lastShowingIndex, eq, value, requestEl;
2823      // store the old index
2824      slider.oldIndex = slider.active.index;
2825      //set new index
2826      slider.active.index = setSlideIndex(slideIndex);
2827
2828      // if plugin is currently in motion, ignore request
2829      if (slider.working || slider.active.index === slider.oldIndex) { return; }
2830      // declare that plugin is in motion
2831      slider.working = true;
2832
2833      performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
2834
2835      // If transitions canceled, reset and return
2836      if (typeof (performTransition) !== 'undefined' && !performTransition) {
2837        slider.active.index = slider.oldIndex; // restore old index
2838        slider.working = false; // is not in motion
2839        return;
2840      }
2841
2842      if (direction === 'next') {
2843        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
2844        if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
2845          performTransition = false;
2846        }
2847      } else if (direction === 'prev') {
2848        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
2849        if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
2850          performTransition = false;
2851        }
2852      }
2853
2854      // check if last slide
2855      slider.active.last = slider.active.index >= getPagerQty() - 1;
2856      // update the pager with active class
2857      if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); }
2858      // // check for direction control update
2859      if (slider.settings.controls) { updateDirectionControls(); }
2860      // if slider is set to mode: "fade"
2861      if (slider.settings.mode === 'fade') {
2862        // if adaptiveHeight is true and next height is different from current height, animate to the new height
2863        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
2864          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
2865        }
2866        // fade out the visible child and reset its z-index value
2867        slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
2868        // fade in the newly requested slide
2869        slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() {
2870          $(this).css('zIndex', slider.settings.slideZIndex);
2871          updateAfterSlideTransition();
2872        });
2873      // slider mode is not "fade"
2874      } else {
2875        // if adaptiveHeight is true and next height is different from current height, animate to the new height
2876        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
2877          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
2878        }
2879        // if carousel and not infinite loop
2880        if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
2881          if (slider.settings.mode === 'horizontal') {
2882            // get the last child position
2883            lastChild = slider.children.eq(slider.children.length - 1);
2884            position = lastChild.position();
2885            // calculate the position of the last slide
2886            moveBy = slider.viewport.width() - lastChild.outerWidth();
2887          } else {
2888            // get last showing index position
2889            lastShowingIndex = slider.children.length - slider.settings.minSlides;
2890            position = slider.children.eq(lastShowingIndex).position();
2891          }
2892          // horizontal carousel, going previous while on first slide (infiniteLoop mode)
2893        } else if (slider.carousel && slider.active.last && direction === 'prev') {
2894          // get the last child position
2895          eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
2896          lastChild = el.children('.bx-clone').eq(eq);
2897          position = lastChild.position();
2898        // if infinite loop and "Next" is clicked on the last slide
2899        } else if (direction === 'next' && slider.active.index === 0) {
2900          // get the last clone position
2901          position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
2902          slider.active.last = false;
2903        // normal non-zero requests
2904        } else if (slideIndex >= 0) {
2905          //parseInt is applied to allow floats for slides/page
2906          requestEl = slideIndex * parseInt(getMoveBy());
2907          position = slider.children.eq(requestEl).position();
2908        }
2909
2910        /* If the position doesn't exist
2911         * (e.g. if you destroy the slider on a next click),
2912         * it doesn't throw an error.
2913         */
2914        if (typeof (position) !== 'undefined') {
2915          value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
2916          // plugin values to be animated
2917          setPositionProperty(value, 'slide', slider.settings.speed);
2918        }
2919        slider.working = false;
2920      }
2921      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
2922    };
2923
2924    /**
2925     * Transitions to the next slide in the show
2926     */
2927    el.goToNextSlide = function() {
2928      // if infiniteLoop is false and last page is showing, disregard call
2929      if (!slider.settings.infiniteLoop && slider.active.last) { return; }
2930	  if (slider.working ==
vendor: 3,105 bytes, lines 2930-3030
2930 true){ return ;}
2931      var pagerIndex = parseInt(slider.active.index) + 1;
2932      el.goToSlide(pagerIndex, 'next');
2933    };
2934
2935    /**
2936     * Transitions to the prev slide in the show
2937     */
2938    el.goToPrevSlide = function() {
2939      // if infiniteLoop is false and last page is showing, disregard call
2940      if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; }
2941	  if (slider.working == true){ return ;}
2942      var pagerIndex = parseInt(slider.active.index) - 1;
2943      el.goToSlide(pagerIndex, 'prev');
2944    };
2945
2946    /**
2947     * Starts the auto show
2948     *
2949     * @param preventControlUpdate (boolean)
2950     *  - if true, auto controls state will not be updated
2951     */
2952    el.startAuto = function(preventControlUpdate) {
2953      // if an interval already exists, disregard call
2954      if (slider.interval) { return; }
2955      // create an interval
2956      slider.interval = setInterval(function() {
2957        if (slider.settings.autoDirection === 'next') {
2958          el.goToNextSlide();
2959        } else {
2960          el.goToPrevSlide();
2961        }
2962      }, slider.settings.pause);
2963	  //allback for when the auto rotate status changes
2964	  slider.settings.onAutoChange.call(el, true);
2965      // if auto controls are displayed and preventControlUpdate is not true
2966      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); }
2967    };
2968
2969    /**
2970     * Stops the auto show
2971     *
2972     * @param preventControlUpdate (boolean)
2973     *  - if true, auto controls state will not be updated
2974     */
2975    el.stopAuto = function(preventControlUpdate) {
2976      // if no interval exists, disregard call
2977      if (!slider.interval) { return; }
2978      // clear the interval
2979      clearInterval(slider.interval);
2980      slider.interval = null;
2981	  //allback for when the auto rotate status changes
2982	  slider.settings.onAutoChange.call(el, false);
2983      // if auto controls are displayed and preventControlUpdate is not true
2984      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); }
2985    };
2986
2987    /**
2988     * Returns current slide index (zero-based)
2989     */
2990    el.getCurrentSlide = function() {
2991      return slider.active.index;
2992    };
2993
2994    /**
2995     * Returns current slide element
2996     */
2997    el.getCurrentSlideElement = function() {
2998      return slider.children.eq(slider.active.index);
2999    };
3000
3001    /**
3002     * Returns a slide element
3003     * @param index (int)
3004     *  - The index (zero-based) of the element you want returned.
3005     */
3006    el.getSlideElement = function(index) {
3007      return slider.children.eq(index);
3008    };
3009
3010    /**
3011     * Returns number of slides in show
3012     */
3013    el.getSlideCount = function() {
3014      return slider.children.length;
3015    };
3016
3017    /**
3018     * Return slider.working variable
3019     */
3020    el.isWorking = function() {
3021      return slider.working;
3022    };
3023
3024    /**
3025     * Update all dynamic slider elements
3026     */
3027    el.redrawSlider = function() {
3028      // resize all children in ratio to new screen size
3029      slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth());
3030      // adjust the height
3031      slider.viewport.css('height', getViewportHeight());
3032      // update the slide position
3033      if (!slider.settings.ticker) { setSlidePosition(); }
3034      // if active.last was true before the screen resize, we want
3035      // to keep it last no matter what screen size we end on
3036      if (slider.active.last) { slider.active.index = getPagerQty() - 1; }
3037      // if the active index (page) no longer exists due to the resize, simply set the index as last
3038      if (slider.active.index >= getPagerQty()) { slider.active.last = true; }
3039      // if a pager is being displayed and a custom pager is not being used, update it
3040      if (slider.settings.pager && !slider.settings.pagerCustom) {
3041        populatePager();
3042        updatePagerActive(slider.active.index);
3043      }
3044      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
3045    };
3046
3047    /**
3048     * Destroy the current instance of the slider (revert everything back to original state)
3049     */
3050    el.destroySlider = function() {
3051      // don't do anything if slider has already been destroyed
3052      if (!slider.initialized) { return; }
3053      slider.initialized = false;
3054      $('.bx-clone', this).remove();
3055      slider.children.each(function() {
3056        if ($(this).data('origStyle') !== undefined) {
3057          $(this).attr('style', $(this).data('origStyle'));
3058        } else {
3059          $(this).removeAttr('style');
3060        }
3061      });
3062      if ($(this).data('origStyle') !== undefined) {
3063        this.attr('style', $(this).data('origStyle'));
3064      } else {
3065        $(this).removeAttr('style');
3066      }
3067      $(this).unwrap().unwrap();
3068      if (slider.controls.el) { slider.controls.el.remove(); }
3069      if (slider.controls.next) { slider.controls.next.remove(); }
3070      if (slider.controls.prev) { slider.controls.prev.remove(); }
3071      if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); }
3072      $('.bx-caption', this).remove();
3073      if (slider.controls.autoEl) { slider.controls.autoEl.remove(); }
3074      clearInterval(slider.interval);
3075      if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); }
3076      if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); }
3077      //remove self reference in data
3078      $(this).removeData('bxSlider');
3079	  // remove global window handlers
3080	  $(window).off('blur', windowBlurHandler).off('focus', windowFocusHandler);
3081    };
3082
3083    /**
3084     * Reload the slider (revert all DOM changes, and re-initialize)
3085     */
3086    el.reloadSlider = function(settings) {
3087      if (settings !== undefined) { options = settings; }
3088      el.destroySlider();
3089      init();
3090      //store reference to self in order to access public functions later
3091      $(el).data('bxSlider', this);
3092    };
3093
3094    init();
3095
3096    $(el).data('bxSlider', this);
3097
3098    // returns the current jQuery object
3099    return this;
3100  };
3101
3102})(jQuery);
3103
3104/* End */
3105;
3106; /* Start:"a:4:{s:4:"full";s:61:"/local/templates/aspro_max/vendor/js/ripple.js?16660175934702";s:6:"source";s:46:"/local/templates/aspro_max/vendor/js/ripple.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3107;(function($, document, Math){
3108    $.ripple = function(selector, options) {
3109
3110        var self = this;
3111
3112        var _log = self.log = function() {
3113            if(self.defaults.debug && console && console.log) {
3114                console.log.apply(console, arguments);
3115            }
3116        };
3117
3118        self.selector = selector;
3119        self.defaults = {
3120            debug: false,
3121            on: 'mousedown',
3122
3123            opacity: 0.4,
3124            color: "auto",
3125            multi: false,
3126
3127            duration: 0.7,
3128            rate: function(pxPerSecond) {
3129                return pxPerSecond;
3130            },
3131
3132            easing: 'linear'
3133        };
3134
3135        self.defaults = $.extend({}, self.defaults, options);
3136
3137        var Trigger = function(e) {
3138
3139            var $this = $(this);
3140            var $ripple;
3141            var settings;
3142
3143            $this.addClass('has-ripple');
3144
3145            // This instances settings
3146            settings = $.extend({}, self.defaults, $this.data());
3147
3148            // Create the ripple element
3149            if ( settings.multi || (!settings.multi && $this.find(".ripple").length === 0) ) {
3150                $ripple = $("<span></span>").addClass("ripple");
3151                $ripple.appendTo($this);
3152
3153                _log('Create: Ripple');
3154
3155                // Set ripple size
3156                if (!$ripple.height() && !$ripple.width()) {
3157                    var size = Math.max($this.outerWidth(), $this.outerHeight());
3158                    $ripple.css({
3159                        height: size,
3160                        width: size
3161                    });
3162                    _log('Set: Ripple size');
3163                }
3164
3165                // Give the user the ability to change the rate of the animation
3166                // based on element width
3167                if(settings.rate && typeof settings.rate == "function") {
3168
3169                    // rate = pixels per second
3170                    var rate = Math.round( $ripple.width() / settings.duration );
3171
3172                    // new amount of pixels per second
3173                    var filteredRate = settings.rate(rate);
3174
3175                    // Determine the new duration for the animation
3176                    var newDuration = ( $ripple.width() / filteredRate);
3177
3178                    // Set the new duration if it has not changed
3179                    if(settings.duration.toFixed(2) !== newDuration.toFixed(2)) {
3180                        _log('Update: Ripple Duration', {
3181                            from: settings.duration,
3182                            to: newDuration
3183                        });
3184                        settings.duration = newDuration;
3185                    }
3186                }
3187
3188                // Set the color and opacity
3189                var color = (settings.color == "auto") ? $this.css('color') : settings.color;
3190                var css = {
3191                    animationDuration: (settings.duration).toString() + 's',
3192                    animationTimingFunction: settings.easing,
3193                    background: color,
3194                    opacity: settings.opacity
3195                };
3196
3197                _log('Set: Ripple CSS', css);
3198                $ripple.css(css);
3199            }
3200
3201            // Ensure we always have the ripple element
3202            if(!settings.multi) {
3203                _log('Set: Ripple Element');
3204                $ripple = $this.find(".ripple");
3205            }
3206
3207            // Kill animation
3208            _log('Destroy: Ripple Animation');
3209            $ripple.removeClass("ripple-animate");
3210
3211
3212            // Retrieve coordinates
3213            var x = e.pageX - $this.offset().left - $ripple.width() / 2;
3214            var y = e.pageY - $this.offset().top - $ripple.height() / 2;
3215
3216            /**
3217             * We want to delete the ripple elements if we allow multiple so we dont sacrifice any page
3218             * performance. We don't do this on single ripples because once it has rendered, we only
3219             * need to trigger paints thereafter.
3220             */
3221            if(settings.multi) {
3222                _log('Set: Ripple animationend event');
3223                $ripple.one('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function() {
3224                    _log('Note: Ripple animation ended');
3225                    _log('Destroy: Ripple');
3226                    $(this).remove();
3227                });
3228            }
3229
3230            // Set position and animate
3231            _log('Set: Ripple location');
3232            _log('Set: Ripple animation');
3233            $ripple.css({
3234                top: y + 'px',
3235                left: x + 'px'
3236            }).addClass("ripple-animate");
3237        };
3238
3239        $(document).on(self.defaults.on, self.selector, Trigger);
3240    };
3241})(jQuery, document, Math);
3242
3243/* End */
3244;
3245; /* Start:"a:4:{s:4:"full";s:54:"/local/templates/aspro_max/js/browser.js?1666017593996";s:6:"source";s:40:"/local/templates/aspro_max/js/browser.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3246var matched, browser;
3247
3248jQuery.uaMatch = function( ua ) {
3249    ua = ua.toLowerCase();
3250
3251    var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
3252        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
3253        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
3254        /(msie)[\s?]([\w.]+)/.exec( ua ) ||       
3255        /(trident)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
3256        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
3257        [];
3258
3259    return {
3260        browser: match[ 1 ] || "",
3261        version: match[ 2 ] || "0"
3262    };
3263};
3264
3265matched = jQuery.uaMatch( navigator.userAgent );
3266//IE 11+ fix (Trident) 
3267matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
3268browser = {};
3269
3270if ( matched.browser ) {
3271    browser[ matched.browser ] = true;
3272    browser.version = matched.version;
3273}
3274
3275// Chrome is Webkit, but Webkit is also Safari.
3276if ( browser.chrome ) {
3277    browser.webkit = true;
3278} else if ( browser.webkit ) {
3279    browser.safari = true;
3280}
3281
3282jQuery.browser = browser;
vendor: 6,069 bytes, lines 3283-3286
3283/* End */
3284;
3285; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_max/js/jquery.uniform.min.js?16660175938308";s:6:"source";s:51:"/local/templates/aspro_max/js/jquery.uniform.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3286(function(e,t){"use strict";function n(e){var t=Array.prototype.slice.call(arguments,1);return e.prop?e.prop.apply(e,t):e.attr.apply(e,t)}function s(e,t,n){var s,a;for(s in n)n.hasOwnProperty(s)&&(a=s.replace(/ |$/g,t.eventNamespace),e.bind(a,n[s]))}function a(e,t,n){s(e,n,{focus:function(){t.addClass(n.focusClass)},blur:function(){t.removeClass(n.focusClass),t.removeClass(n.activeClass)},mouseenter:function(){t.addClass(n.hoverClass)},mouseleave:function(){t.removeClass(n.hoverClass),t.removeClass(n.activeClass)},"mousedown touchbegin":function(){e.is(":disabled")||t.addClass(n.activeClass)},"mouseup touchend":function(){t.removeClass(n.activeClass)}})}function i(e,t){e.removeClass(t.hoverClass+" "+t.focusClass+" "+t.activeClass)}function r(e,t,n){n?e.addClass(t):e.removeClass(t)}function l(e,t,n){var s="checked",a=t.is(":"+s);t.prop?t.prop(s,a):a?t.attr(s,s):t.removeAttr(s),r(e,n.checkedClass,a)}function u(e,t,n){r(e,n.disabledClass,t.is(":disabled"))}function o(e,t,n){switch(n){case"after":return e.after(t),e.next();case"before":return e.before(t),e.prev();case"wrap":return e.wrap(t),e.parent()}return null}function c(t,s,a){var i,r,l;return a||(a={}),a=e.extend({bind:{},divClass:null,divWrap:"wrap",spanClass:null,spanHtml:null,spanWrap:"wrap"},a),i=e("<div />"),r=e("<span />"),s.autoHide&&t.is(":hidden")&&"none"===t.css("display")&&i.hide(),a.divClass&&i.addClass(a.divClass),s.wrapperClass&&i.addClass(s.wrapperClass),a.spanClass&&r.addClass(a.spanClass),l=n(t,"id"),s.useID&&l&&n(i,"id",s.idPrefix+"-"+l),a.spanHtml&&r.html(a.spanHtml),i=o(t,i,a.divWrap),r=o(t,r,a.spanWrap),u(i,t,s),{div:i,span:r}}function d(t,n){var s;return n.wrapperClass?(s=e("<span />").addClass(n.wrapperClass),s=o(t,s,"wrap")):null}function f(){var t,n,s,a;return a="rgb(120,2,153)",n=e('<div style="width:0;height:0;color:'+a+'">'),e("body").append(n),s=n.get(0),t=window.getComputedStyle?window.getComputedStyle(s,"").color:(s.currentStyle||s.style||{}).color,n.remove(),t.replace(/ /g,"")!==a}function p(t){return t?e("<span />").text(t).html():""}function m(){return navigator.cpuClass&&!navigator.product}function v(){return window.XMLHttpRequest!==void 0?!0:!1}function h(e){var t;return e[0].multiple?!0:(t=n(e,"size"),!t||1>=t?!1:!0)}function C(){return!1}function w(e,t){var n="none";s(e,t,{"selectstart dragstart mousedown":C}),e.css({MozUserSelect:n,msUserSelect:n,webkitUserSelect:n,userSelect:n})}function b(e,t,n){var s=e.val();""===s?s=n.fileDefaultHtml:(s=s.split(/[\/\\]+/),s=s[s.length-1]),t.text(s)}function y(e,t,n){var s,a;for(s=[],e.each(function(){var e;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s.push({el:this,name:e,old:this.style[e]}),this.style[e]=t[e])}),n();s.length;)a=s.pop(),a.el.style[a.name]=a.old}function g(e,t){var n;n=e.parents(),n.push(e[0]),n=n.not(":visible"),y(n,{visibility:"hidden",display:"block",position:"absolute"},t)}function k(e,t){return function(){e.unwrap().unwrap().unbind(t.eventNamespace)}}var H=!0,x=!1,A=[{match:function(e){return e.is("a, button, :submit, :reset, input[type='button']")},apply:function(e,t){var r,l,o,d,f;return l=t.submitDefaultHtml,e.is(":reset")&&(l=t.resetDefaultHtml),d=e.is("a, button")?function(){return e.html()||l}:function(){return p(n(e,"value"))||l},o=c(e,t,{divClass:t.buttonClass,spanHtml:d()}),r=o.div,a(e,r,t),f=!1,s(r,t,{"click touchend":function(){var t,s,a,i;f||e.is(":disabled")||(f=!0,e[0].dispatchEvent?(t=document.createEvent("MouseEvents"),t.initEvent("click",!0,!0),s=e[0].dispatchEvent(t),e.is("a")&&s&&(a=n(e,"target"),i=n(e,"href"),a&&"_self"!==a?window.open(i,a):document.location.href=i)):e.click(),f=!1)}}),w(r,t),{remove:function(){return r.after(e),r.remove(),e.unbind(t.eventNamespace),e},update:function(){i(r,t),u(r,e,t),e.detach(),o.span.html(d()).append(e)}}}},{match:function(e){return e.is(":checkbox")},apply:function(e,t){var n,r,o;return n=c(e,t,{divClass:t.checkboxClass}),r=n.div,o=n.span,a(e,r,t),s(e,t,{"click touchend":function(){l(o,e,t)}}),l(o,e,t),{remove:k(e,t),update:function(){i(r,t),o.removeClass(t.checkedClass),l(o,e,t),u(r,e,t)}}}},{match:function(e){return e.is(":file")},apply:function(t,r){function l(){b(t,p,r)}var d,f,p,v;return d=c(t,r,{divClass:r.fileClass,spanClass:r.fileButtonClass,spanHtml:r.fileButtonHtml,spanWrap:"after"}),f=d.div,v=d.span,p=e("<span />").html(r.fileDefaultHtml),p.addClass(r.filenameClass),p=o(t,p,"after"),n(t,"size")||n(t,"size",f.width()/10),a(t,f,r),l(),m()?s(t,r,{click:function(){t.trigger("change"),setTimeout(l,0)}}):s(t,r,{change:l}),w(p,r),w(v,r),{remove:function(){return p.remove(),v.remove(),t.unwrap().unbind(r.eventNamespace)},update:function(){i(f,r),b(t,p,r),u(f,t,r)}}}},{match:function(e){if(e.is("input")){var t=(" "+n(e,"type")+" ").toLowerCase(),s=" color date datetime datetime-local email month number password search tel text time url week ";return s.indexOf(t)>=0}return!1},apply:function(e,t){var s,i;return s=n(e,"type"),e.addClass(t.inputClass),i=d(e,t),a(e,e,t),t.inputAddTypeAsClass&&e.addClass(s),{remove:function(){e.removeClass(t.inputClass),t.inputAddTypeAsClass&&e.removeClass(s),i&&e.unwrap()},update:C}}},{match:function(e){return e.is(":radio")},apply:function(t,r){var o,d,f;return o=c(t,r,{divClass:r.radioClass}),d=o.div,f=o.span,a(t,d,r),s(t,r,{"click touchend":function(){e.uniform.update(e(':radio[name="'+n(t,"name")+'"]'))}}),l(f,t,r),{remove:k(t,r),update:function(){i(d,r),l(f,t,r),u(d,t,r)}}}},{match:function(e){return e.is("select")&&!h(e)?!0:!1},apply:function(t,n){var r,l,o,d;return n.selectAutoWidth&&g(t,function(){d=t.width()}),r=c(t,n,{divClass:n.selectClass,spanHtml:(t.find(":selected:first")||t.find("option:first")).html(),spanWrap:"before"}),l=r.div,o=r.span,n.selectAutoWidth?g(t,function(){y(e([o[0],l[0]]),{display:"block"},function(){var e;e=o.outerWidth()-o.width(),l.width(d+e),o.width(d)})}
3286):l.addClass("fixedWidth"),a(t,l,n),s(t,n,{change:function(){o.html(t.find(":selected").html()),l.removeClass(n.activeClass)},"click touchend":function(){var e=t.find(":selected").html();o.html()!==e&&t.trigger("change")},keyup:function(){o.html(t.find(":selected").html())}}),w(o,n),{remove:function(){return o.remove(),t.unwrap().unbind(n.eventNamespace),t},update:function(){n.selectAutoWidth?(e.uniform.restore(t),t.uniform(n)):(i(l,n),o.html(t.find(":selected").html()),u(l,t,n))}}}},{match:function(e){return e.is("select")&&h(e)?!0:!1},apply:function(e,t){var n;return e.addClass(t.selectMultiClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.selectMultiClass),n&&e.unwrap()},update:C}}},{match:function(e){return e.is("textarea")},apply:function(e,t){var n;return e.addClass(t.textareaClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.textareaClass),n&&e.unwrap()},update:C}}}];m()&&!v()&&(H=!1),e.uniform={defaults:{activeClass:"active",autoHide:!0,buttonClass:"button",checkboxClass:"checker",checkedClass:"checked",disabledClass:"disabled",eventNamespace:".uniform",fileButtonClass:"action",fileButtonHtml:"Choose File",fileClass:"uploader",fileDefaultHtml:"No file selected",filenameClass:"filename",focusClass:"focus",hoverClass:"hover",idPrefix:"uniform",inputAddTypeAsClass:!0,inputClass:"uniform-input",radioClass:"radio",resetDefaultHtml:"Reset",resetSelector:!1,selectAutoWidth:!0,selectClass:"selector",selectMultiClass:"uniform-multiselect",submitDefaultHtml:"Submit",textareaClass:"uniform",useID:!0,wrapperClass:null},elements:[]},e.fn.uniform=function(t){var n=this;return t=e.extend({},e.uniform.defaults,t),x||(x=!0,f()&&(H=!1)),H?(t.resetSelector&&e(t.resetSelector).mouseup(function(){window.setTimeout(function(){e.uniform.update(n)},10)}),this.each(function(){var n,s,a,i=e(this);if(i.data("uniformed"))return e.uniform.update(i),void 0;for(n=0;A.length>n;n+=1)if(s=A[n],s.match(i,t))return a=s.apply(i,t),i.data("uniformed",a),e.uniform.elements.push(i.get(0)),void 0})):this},e.uniform.restore=e.fn.uniform.restore=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n,s=e(this);n=s.data("uniformed"),n&&(n.remove(),t=e.inArray(this,e.uniform.elements),t>=0&&e.uniform.elements.splice(t,1),s.removeData("uniformed"))})},e.uniform.update=e.fn.uniform.update=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n=e(this);t=n.data("uniformed"),t&&t.update(n,t.options)})}})(jQuery);
3287/* End */
3288;
3289; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_max/vendor/js/moment.min.js?166601759334436";s:6:"source";s:50:"/local/templates/aspro_max/vendor/js/moment.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3290//! moment.js
3291//! version : 2.10.3
3292//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
3293//! license : MIT
3294//! momentjs.com
3295!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Dc.apply(null,arguments)}function b(a){Dc=a}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b){for(var c in b)f(b,c)&&(a[c]=b[c]);return f(b,"toString")&&(a.toString=b.toString),f(b,"valueOf")&&(a.valueOf=b.valueOf),a}function h(a,b,c,d){return za(a,b,c,d,!0).utc()}function i(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function j(a){return null==a._pf&&(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a);a._isValid=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour)}return a._isValid}function l(a){var b=h(0/0);return null!=a?g(j(b),a):j(b).userInvalidated=!0,b}function m(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(
3295a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=j(b)),"undefined"!=typeof b._locale&&(a._locale=b._locale),Fc.length>0)for(c in Fc)d=Fc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(+b._d),Gc===!1&&(Gc=!0,a.updateOffset(this),Gc=!1)}function o(a){return a instanceof n||null!=a&&null!=a._isAMomentObject}function p(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function q(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&p(a[d])!==p(b[d]))&&g++;return g+f}function r(){}function s(a){return a?a.toLowerCase().replace("_","-"):a}function t(a){for(var b,c,d,e,f=0;f<a.length;){for(e=s(a[f]).split("-"),b=e.length,c=s(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=u(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&q(e,c,!0)>=b-1)break;b--}f++}return null}function u(a){var b=null;if(!Hc[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Ec._abbr,require("./locale/"+a),v(b)}catch(c){}return Hc[a]}function v(a,b){var c;return a&&(c="undefined"==typeof b?x(a):w(a,b),c&&(Ec=c)),Ec._abbr}function w(a,b){return null!==b?(b.abbr=a,Hc[a]||(Hc[a]=new r),Hc[a].set(b),v(a),Hc[a]):(delete Hc[a],null)}function x(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Ec;if(!c(a)){if(b=u(a))return b;a=[a]}return t(a)}function y(a,b){var c=a.toLowerCase();Ic[c]=Ic[c+"s"]=Ic[b]=a}function z(a){return"string"==typeof a?Ic[a]||Ic[a.toLowerCase()]:void 0}function A(a){var b,c,d={};for(c in a)f(a,c)&&(b=z(c),b&&(d[b]=a[c]));return d}function B(b,c){return function(d){return null!=d?(D(this,b,d),a.updateOffset(this,c),this):C(this,b)}}function C(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function D(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function E(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=z(a),"function"==typeof this[a])return this[a](b);return this}function F(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function G(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Mc[a]=e),b&&(Mc[b[0]]=function(){return F(e.apply(this,arguments),b[1],b[2])}),c&&(Mc[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function H(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function I(a){var b,c,d=a.match(Jc);for(b=0,c=d.length;c>b;b++)Mc[d[b]]?d[b]=Mc[d[b]]:d[b]=H(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function J(a,b){return a.isValid()?(b=K(b,a.localeData()),Lc[b]||(Lc[b]=I(b)),Lc[b](a)):a.localeData().invalidDate()}function K(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Kc.lastIndex=0;d>=0&&Kc.test(a);)a=a.replace(Kc,c),Kc.lastIndex=0,d-=1;return a}function L(a,b,c){_c[a]="function"==typeof b?b:function(a){return a&&c?c:b}}function M(a,b){return f(_c,a)?_c[a](b._strict,b._locale):new RegExp(N(a))}function N(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function O(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=p(a)}),c=0;c<a.length;c++)ad[a[c]]=d}function P(a,b){O(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function Q(a,b,c){null!=b&&f(ad,a)&&ad[a](b,c._a,c,a)}function R(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function S(a){return this._months[a.month()]}function T(a){return this._monthsShort[a.month()]}function U(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function V(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),R(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function W(b){return null!=b?(V(this,b),a.updateOffset(this,!0),this):C(this,"Month")}function X(){return R(this.year(),this.month())}function Y(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[cd]<0||c[cd]>11?cd:c[dd]<1||c[dd]>R(c[bd],c[cd])?dd:c[ed]<0||c[ed]>24||24===c[ed]&&(0!==c[fd]||0!==c[gd]||0!==c[hd])?ed:c[fd]<0||c[fd]>59?fd:c[gd]<0||c[gd]>59?gd:c[hd]<0||c[hd]>999?hd:-1,j(a)._overflowDayOfYear&&(bd>b||b>dd)&&(b=dd),j(a).overflow=b),a}function Z(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function $(a,b){var c=!0,d=a+"\n"+(new Error).stack;return g(function(){return c&&(Z(d),c=!1),b.apply(this,arguments)},b)}
3295function _(a,b){kd[a]||(Z(b),kd[a]=!0)}function aa(a){var b,c,d=a._i,e=ld.exec(d);if(e){for(j(a).iso=!0,b=0,c=md.length;c>b;b++)if(md[b][1].exec(d)){a._f=md[b][0]+(e[6]||" ");break}for(b=0,c=nd.length;c>b;b++)if(nd[b][1].exec(d)){a._f+=nd[b][0];break}d.match(Yc)&&(a._f+="Z"),ta(a)}else a._isValid=!1}function ba(b){var c=od.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(aa(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ca(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function da(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ea(a){return fa(a)?366:365}function fa(a){return a%4===0&&a%100!==0||a%400===0}function ga(){return fa(this.year())}function ha(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=Aa(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ia(a){return ha(a,this._week.dow,this._week.doy).week}function ja(){return this._week.dow}function ka(){return this._week.doy}function la(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function ma(a){var b=ha(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function na(a,b,c,d,e){var f,g,h=da(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:ea(a-1)+g}}function oa(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function pa(a,b,c){return null!=a?a:null!=b?b:c}function qa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function ra(a){var b,c,d,e,f=[];if(!a._d){for(d=qa(a),a._w&&null==a._a[dd]&&null==a._a[cd]&&sa(a),a._dayOfYear&&(e=pa(a._a[bd],d[bd]),a._dayOfYear>ea(e)&&(j(a)._overflowDayOfYear=!0),c=da(e,0,a._dayOfYear),a._a[cd]=c.getUTCMonth(),a._a[dd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[ed]&&0===a._a[fd]&&0===a._a[gd]&&0===a._a[hd]&&(a._nextDay=!0,a._a[ed]=0),a._d=(a._useUTC?da:ca).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[ed]=24)}}function sa(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=pa(b.GG,a._a[bd],ha(Aa(),1,4).year),d=pa(b.W,1),e=pa(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=pa(b.gg,a._a[bd],ha(Aa(),f,g).year),d=pa(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=na(c,d,e,g,f),a._a[bd]=h.year,a._dayOfYear=h.dayOfYear}function ta(b){if(b._f===a.ISO_8601)return void aa(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=K(b._f,b._locale).match(Jc)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(M(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),Mc[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),Q(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[ed]<=12&&b._a[ed]>0&&(j(b).bigHour=void 0),b._a[ed]=ua(b._locale,b._a[ed],b._meridiem),ra(b),Y(b)}function ua(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function va(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(0/0));for(e=0;e<a._f.length;e++)f=0,b=m({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],ta(b),k(b)&&(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function wa(a){if(!a._d){var b=A(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],ra(a)}}function xa(a){var b,e=a._i,f=a._f;return a._locale=a._locale||x(a._l),null===e||void 0===f&&""===e?l({nullInput:!0}):("string"==typeof e&&(a._i=e=a._locale.preparse(e)),o(e)?new n(Y(e)):(c(f)?va(a):f?ta(a):d(e)?a._d=e:ya(a),b=new n(Y(a)),b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b))}function ya(b){var f=b._i;void 0===f?b._d=new Date:d(f)?b._d=new Date(+f):"string"==typeof f?ba(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),ra(b)):"object"==typeof f?wa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function za(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,xa(f)}function Aa(a,b,c,d){return za(a,b,c,d,!1)}function Ba(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Aa();for(d=b[0],e=1;e<b.length;++e)b[e][a](d)&&(d=b[e]);return d}function Ca(){var a=[].slice.call(arguments,0);return Ba("isBefore",a)}function Da(){var a=[].slice.call(arguments,0);return Ba("isAfter",a)}function Ea(a){var b=A(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=x(),this._bubble()}function Fa(a){return a instanceof Ea}function Ga(a,b){G(a,0,0,function(){var a=this.utcOffset(),c="+";return 0>a&&(a=-a,c="-"),c+F(~~(a/60),2)+b+F(~~a%60,2)})}function Ha(a){var b=(a||"").match(Yc)||[],c=b[b.length-1]||[],d=(c+"").match(td)||["-",0,0],e=+(60*d[1])+p(d[2]);return"+"===d[0]?e:-e}function Ia(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(o(b)||d(b)?+b:+Aa(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Aa(b).local();return c._isUTC?Aa(b).zone(c._offset||0):Aa(b).local()}
3295function Ja(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ka(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ha(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ja(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?$a(this,Va(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ja(this)}function La(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Ma(a){return this.utcOffset(0,a)}function Na(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ja(this),"m")),this}function Oa(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ha(this._i)),this}function Pa(a){return a=a?Aa(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Qa(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ra(){if(this._a){var a=this._isUTC?h(this._a):Aa(this._a);return this.isValid()&&q(this._a,a.toArray())>0}return!1}function Sa(){return!this._isUTC}function Ta(){return this._isUTC}function Ua(){return this._isUTC&&0===this._offset}function Va(a,b){var c,d,e,g=a,h=null;return Fa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=ud.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:p(h[dd])*c,h:p(h[ed])*c,m:p(h[fd])*c,s:p(h[gd])*c,ms:p(h[hd])*c}):(h=vd.exec(a))?(c="-"===h[1]?-1:1,g={y:Wa(h[2],c),M:Wa(h[3],c),d:Wa(h[4],c),h:Wa(h[5],c),m:Wa(h[6],c),s:Wa(h[7],c),w:Wa(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Ya(Aa(g.from),Aa(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ea(g),Fa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function Wa(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Xa(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Ya(a,b){var c;return b=Ia(b,a),a.isBefore(b)?c=Xa(a,b):(c=Xa(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function Za(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(_(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Va(c,d),$a(this,e,a),this}}function $a(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&D(b,"Date",C(b,"Date")+g*d),h&&V(b,C(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function _a(a){var b=a||Aa(),c=Ia(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,Aa(b)))}function ab(){return new n(this)}function bb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+this>+a):(c=o(a)?+a:+Aa(a),c<+this.clone().startOf(b))}function cb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+a>+this):(c=o(a)?+a:+Aa(a),+this.clone().endOf(b)<c)}function db(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)}function eb(a,b){var c;return b=z(b||"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+this===+a):(c=+Aa(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))}function fb(a){return 0>a?Math.ceil(a):Math.floor(a)}function gb(a,b,c){var d,e,f=Ia(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=z(b),"year"===b||"month"===b||"quarter"===b?(e=hb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:fb(e)}function hb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function ib(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function jb(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():J(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):J(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function kb(b){var c=J(this,b||a.defaultFormat);return this.localeData().postformat(c)}function lb(a,b){return this.isValid()?Va({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function mb(a){return this.from(Aa(),a)}function nb(a,b){return this.isValid()?Va({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ob(a){return this.to(Aa(),a)}function pb(a){var b;return void 0===a?this._locale._abbr:(b=x(a),null!=b&&(this._locale=b),this)}function qb(){return this._locale}function rb(a){switch(a=z(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}
3295function sb(a){return a=z(a),void 0===a||"millisecond"===a?this:this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms")}function tb(){return+this._d-6e4*(this._offset||0)}function ub(){return Math.floor(+this/1e3)}function vb(){return this._offset?new Date(+this):this._d}function wb(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function xb(){return k(this)}function yb(){return g({},j(this))}function zb(){return j(this).overflow}function Ab(a,b){G(0,[a,a.length],0,b)}function Bb(a,b,c){return ha(Aa([a,11,31+b-c]),b,c).week}function Cb(a){var b=ha(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")}function Db(a){var b=ha(this,1,4).year;return null==a?b:this.add(a-b,"y")}function Eb(){return Bb(this.year(),1,4)}function Fb(){var a=this.localeData()._week;return Bb(this.year(),a.dow,a.doy)}function Gb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Hb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function Ib(a){return this._weekdays[a.day()]}function Jb(a){return this._weekdaysShort[a.day()]}function Kb(a){return this._weekdaysMin[a.day()]}function Lb(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=Aa([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Mb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Hb(a,this.localeData()),this.add(a-b,"d")):b}function Nb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ob(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Pb(a,b){G(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Qb(a,b){return b._meridiemParse}function Rb(a){return"p"===(a+"").toLowerCase().charAt(0)}function Sb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Tb(a){G(0,[a,3],0,"millisecond")}function Ub(){return this._isUTC?"UTC":""}function Vb(){return this._isUTC?"Coordinated Universal Time":""}function Wb(a){return Aa(1e3*a)}function Xb(){return Aa.apply(null,arguments).parseZone()}function Yb(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function Zb(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b}function $b(){return this._invalidDate}function _b(a){return this._ordinal.replace("%d",a)}function ac(a){return a}function bc(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function cc(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function dc(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function ec(a,b,c,d){var e=x(),f=h().set(d,b);return e[c](f,a)}function fc(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return ec(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=ec(a,f,c,e);return g}function gc(a,b){return fc(a,b,"months",12,"month")}function hc(a,b){return fc(a,b,"monthsShort",12,"month")}function ic(a,b){return fc(a,b,"weekdays",7,"day")}function jc(a,b){return fc(a,b,"weekdaysShort",7,"day")}function kc(a,b){return fc(a,b,"weekdaysMin",7,"day")}function lc(){var a=this._data;return this._milliseconds=Rd(this._milliseconds),this._days=Rd(this._days),this._months=Rd(this._months),a.milliseconds=Rd(a.milliseconds),a.seconds=Rd(a.seconds),a.minutes=Rd(a.minutes),a.hours=Rd(a.hours),a.months=Rd(a.months),a.years=Rd(a.years),this}function mc(a,b,c,d){var e=Va(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function nc(a,b){return mc(this,a,b,1)}function oc(a,b){return mc(this,a,b,-1)}function pc(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;return g.milliseconds=d%1e3,a=fb(d/1e3),g.seconds=a%60,b=fb(a/60),g.minutes=b%60,c=fb(b/60),g.hours=c%24,e+=fb(c/24),h=fb(qc(e)),e-=fb(rc(h)),f+=fb(e/30),e%=30,h+=fb(f/12),f%=12,g.days=e,g.months=f,g.years=h,this}function qc(a){return 400*a/146097}function rc(a){return 146097*a/400}function sc(a){var b,c,d=this._milliseconds;if(a=z(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+12*qc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(rc(this._months/12)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function tc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*p(this._months/12)}function uc(a){return function(){return this.as(a)}}function vc(a){return a=z(a),this[a+"s"]()}function wc(a){return function(){return this._data[a]}}function xc(){return fb(this.days()/7)}function yc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function zc(a,b,c){var d=Va(a).abs(),e=fe(d.as("s")),f=fe(d.as("m")),g=fe(d.as("h")),h=fe(d.as("d")),i=fe(d.as("M")),j=fe(d.as("y")),k=e<ge.s&&["s",e]||1===f&&["m"]||f<ge.m&&["mm",f]||1===g&&["h"]||g<ge.h&&["hh",g]||1===h&&["d"]||h<ge.d&&["dd",h]||1===i&&["M"]||i<ge.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,yc.apply(null,k)}function Ac(a,b){return void 0===ge[a]?!1:void 0===b?ge[a]:(ge[a]=b,!0)}function Bc(a){var b=this.localeData(),c=zc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Cc(){var a=he(this.years()),b=he(this.months()),c=he(this.days()),d=he(this.hours()),e=he(this.minutes()),f=he(this.seconds()+this.milliseconds()/1e3),g=this.asSeconds();return g?(0>g?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}var Dc,Ec,Fc=a.momentProperties=[],Gc=!1,Hc={},Ic={},Jc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}
3295|x|X|zz?|ZZ?|.)/g,Kc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Lc={},Mc={},Nc=/\d/,Oc=/\d\d/,Pc=/\d{3}/,Qc=/\d{4}/,Rc=/[+-]?\d{6}/,Sc=/\d\d?/,Tc=/\d{1,3}/,Uc=/\d{1,4}/,Vc=/[+-]?\d{1,6}/,Wc=/\d+/,Xc=/[+-]?\d+/,Yc=/Z|[+-]\d\d:?\d\d/gi,Zc=/[+-]?\d+(\.\d{1,3})?/,$c=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,_c={},ad={},bd=0,cd=1,dd=2,ed=3,fd=4,gd=5,hd=6;G("M",["MM",2],"Mo",function(){return this.month()+1}),G("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),G("MMMM",0,0,function(a){return this.localeData().months(this,a)}),y("month","M"),L("M",Sc),L("MM",Sc,Oc),L("MMM",$c),L("MMMM",$c),O(["M","MM"],function(a,b){b[cd]=p(a)-1}),O(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[cd]=e:j(c).invalidMonth=a});var id="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),jd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),kd={};a.suppressDeprecationWarnings=!1;var ld=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,md=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],nd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],od=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=$("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),G(0,["YY",2],0,function(){return this.year()%100}),G(0,["YYYY",4],0,"year"),G(0,["YYYYY",5],0,"year"),G(0,["YYYYYY",6,!0],0,"year"),y("year","y"),L("Y",Xc),L("YY",Sc,Oc),L("YYYY",Uc,Qc),L("YYYYY",Vc,Rc),L("YYYYYY",Vc,Rc),O(["YYYY","YYYYY","YYYYYY"],bd),O("YY",function(b,c){c[bd]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return p(a)+(p(a)>68?1900:2e3)};var pd=B("FullYear",!1);G("w",["ww",2],"wo","week"),G("W",["WW",2],"Wo","isoWeek"),y("week","w"),y("isoWeek","W"),L("w",Sc),L("ww",Sc,Oc),L("W",Sc),L("WW",Sc,Oc),P(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=p(a)});var qd={dow:0,doy:6};G("DDD",["DDDD",3],"DDDo","dayOfYear"),y("dayOfYear","DDD"),L("DDD",Tc),L("DDDD",Pc),O(["DDD","DDDD"],function(a,b,c){c._dayOfYear=p(a)}),a.ISO_8601=function(){};var rd=$("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return this>a?this:a}),sd=$("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return a>this?this:a});Ga("Z",":"),Ga("ZZ",""),L("Z",Yc),L("ZZ",Yc),O(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ha(a)});var td=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var ud=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,vd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Va.fn=Ea.prototype;var wd=Za(1,"add"),xd=Za(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var yd=$("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});G(0,["gg",2],0,function(){return this.weekYear()%100}),G(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ab("gggg","weekYear"),Ab("ggggg","weekYear"),Ab("GGGG","isoWeekYear"),Ab("GGGGG","isoWeekYear"),y("weekYear","gg"),y("isoWeekYear","GG"),L("G",Xc),L("g",Xc),L("GG",Sc,Oc),L("gg",Sc,Oc),L("GGGG",Uc,Qc),L("gggg",Uc,Qc),L("GGGGG",Vc,Rc),L("ggggg",Vc,Rc),P(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=p(a)}),P(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),G("Q",0,0,"quarter"),y("quarter","Q"),L("Q",Nc),O("Q",function(a,b){b[cd]=3*(p(a)-1)}),G("D",["DD",2],"Do","date"),y("date","D"),L("D",Sc),L("DD",Sc,Oc),L("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),O(["D","DD"],dd),O("Do",function(a,b){b[dd]=p(a.match(Sc)[0],10)});var zd=B("Date",!0);G("d",0,"do","day"),G("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),G("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),G("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),G("e",0,0,"weekday"),G("E",0,0,"isoWeekday"),y("day","d"),y("weekday","e"),y("isoWeekday","E"),L("d",Sc),L("e",Sc),L("E",Sc),L("dd",$c),L("ddd",$c),L("dddd",$c),P(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:j(c).invalidWeekday=a}),P(["d","e","E"],function(a,b,c,d){b[d]=p(a)});var Ad="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Bd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Cd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");G("H",["HH",2],0,"hour"),G("h",["hh",2],0,function(){return this.hours()%12||12}),Pb("a",!0),Pb("A",!1),y("hour","h"),L("a",Qb),L("A",Qb),L("H",Sc),L("h",Sc),L("HH",Sc,Oc),L("hh",Sc,Oc),O(["H","HH"],ed),O(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),O(["h","hh"],function(a,b,c){b[ed]=p(a),j(c).bigHour=!0});var Dd=/[ap]\.?m?\.?/i,Ed=B("Hours",!0);G("m",["mm",2],0,"minute"),y("minute","m"),L("m",Sc),L("mm",Sc,Oc),O(["m","mm"],fd);var Fd=B("Minutes",!1);G("s",["ss",2],0,"second"),y("second","s"),L("s",Sc),L("ss",Sc,Oc),O(["s","ss"],gd);var Gd=B("Seconds",!1);G("S",0,0,function(){return~~(this.millisecond()/100)}),G(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Tb("SSS"),Tb("SSSS"),y("millisecond","ms"),L("S",Tc,Nc),L("SS",Tc,Oc),L("SSS",Tc,Pc),L("SSSS",Wc),O(["S","SS","SSS","SSSS"],function(a,b){b[hd]=p(1e3*("0."+a))});var Hd=B("Milliseconds",!1);G("z",0,0,"zoneAbbr"),G("zz",0,0,"zoneName");var Id=n.prototype;Id.add=wd,Id.calendar=_a,Id.clone=ab,Id.diff=gb,Id.endOf=sb,Id.format=kb,Id.from=lb,Id.fromNow=mb,Id.to=nb,Id.toNow=ob,Id.get=E,Id.invalidAt=zb,Id.isAfter=bb,Id.isBefore=cb,Id.isBetween=db,Id.isSame=eb,Id.isValid=xb,Id.lang=yd,Id.locale=pb,Id.localeData=qb,Id.max=sd,Id.min=rd,Id.parsingFlags=yb,Id.set=E,Id.startOf=rb,Id.subtract=
3295xd,Id.toArray=wb,Id.toDate=vb,Id.toISOString=jb,Id.toJSON=jb,Id.toString=ib,Id.unix=ub,Id.valueOf=tb,Id.year=pd,Id.isLeapYear=ga,Id.weekYear=Cb,Id.isoWeekYear=Db,Id.quarter=Id.quarters=Gb,Id.month=W,Id.daysInMonth=X,Id.week=Id.weeks=la,Id.isoWeek=Id.isoWeeks=ma,Id.weeksInYear=Fb,Id.isoWeeksInYear=Eb,Id.date=zd,Id.day=Id.days=Mb,Id.weekday=Nb,Id.isoWeekday=Ob,Id.dayOfYear=oa,Id.hour=Id.hours=Ed,Id.minute=Id.minutes=Fd,Id.second=Id.seconds=Gd,Id.millisecond=Id.milliseconds=Hd,Id.utcOffset=Ka,Id.utc=Ma,Id.local=Na,Id.parseZone=Oa,Id.hasAlignedHourOffset=Pa,Id.isDST=Qa,Id.isDSTShifted=Ra,Id.isLocal=Sa,Id.isUtcOffset=Ta,Id.isUtc=Ua,Id.isUTC=Ua,Id.zoneAbbr=Ub,Id.zoneName=Vb,Id.dates=$("dates accessor is deprecated. Use date instead.",zd),Id.months=$("months accessor is deprecated. Use month instead",W),Id.years=$("years accessor is deprecated. Use year instead",pd),Id.zone=$("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",La);var Jd=Id,Kd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ld={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},Md="Invalid date",Nd="%d",Od=/\d{1,2}/,Pd={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",
3296hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Qd=r.prototype;Qd._calendar=Kd,Qd.calendar=Yb,Qd._longDateFormat=Ld,Qd.longDateFormat=Zb,Qd._invalidDate=Md,Qd.invalidDate=$b,Qd._ordinal=Nd,Qd.ordinal=_b,Qd._ordinalParse=Od,Qd.preparse=ac,Qd.postformat=ac,Qd._relativeTime=Pd,Qd.relativeTime=bc,Qd.pastFuture=cc,Qd.set=dc,Qd.months=S,Qd._months=id,Qd.monthsShort=T,Qd._monthsShort=jd,Qd.monthsParse=U,Qd.week=ia,Qd._week=qd,Qd.firstDayOfYear=ka,Qd.firstDayOfWeek=ja,Qd.weekdays=Ib,Qd._weekdays=Ad,Qd.weekdaysMin=Kb,Qd._weekdaysMin=Cd,Qd.weekdaysShort=Jb,Qd._weekdaysShort=Bd,Qd.weekdaysParse=Lb,Qd.isPM=Rb,Qd._meridiemParse=Dd,Qd.meridiem=Sb,v("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===p(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=$("moment.lang is deprecated. Use moment.locale instead.",v),a.langData=$("moment.langData is deprecated. Use moment.localeData instead.",x);var Rd=Math.abs,Sd=uc("ms"),Td=uc("s"),Ud=uc("m"),Vd=uc("h"),Wd=uc("d"),Xd=uc("w"),Yd=uc("M"),Zd=uc("y"),$d=wc("milliseconds"),_d=wc("seconds"),ae=wc("minutes"),be=wc("hours"),ce=wc("days"),de=wc("months"),ee=wc("years"),fe=Math.round,ge={s:45,m:45,h:22,d:26,M:11},he=Math.abs,ie=Ea.prototype;ie.abs=lc,ie.add=nc,ie.subtract=oc,ie.as=sc,ie.asMilliseconds=Sd,ie.asSeconds=Td,ie.asMinutes=Ud,ie.asHours=Vd,ie.asDays=Wd,ie.asWeeks=Xd,ie.asMonths=Yd,ie.asYears=Zd,ie.valueOf=tc,ie._bubble=pc,ie.get=vc,ie.milliseconds=$d,ie.seconds=_d,ie.minutes=ae,ie.hours=be,ie.days=ce,ie.weeks=xc,ie.months=de,ie.years=ee,ie.humanize=Bc,ie.toISOString=Cc,ie.toString=Cc,ie.toJSON=Cc,ie.locale=pb,ie.localeData=qb,ie.toIsoString=$("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Cc),ie.lang=yd,G("X",0,0,"unix"),G("x",0,0,"valueOf"),L("x",Xc),L("X",Zc),O("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),O("x",function(a,b,c){c._d=new Date(p(a))}),a.version="2.10.3",b(Aa),a.fn=Jd,a.min=Ca,a.max=Da,a.utc=h,a.unix=Wb,a.months=gc,a.isDate=d,a.locale=v,a.invalid=l,a.duration=Va,a.isMoment=o,a.weekdays=ic,a.parseZone=Xb,a.localeData=x,a.isDuration=Fa,a.monthsShort=hc,a.weekdaysMin=kc,a.defineLocale=w,a.weekdaysShort=jc,a.normalizeUnits=z,a.relativeTimeThreshold=Ac;var je=a;return je});
3297/* End */
3298;
3299; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/vendor/js/footable.js?1666017593268108";s:6:"source";s:48:"/local/templates/aspro_max/vendor/js/footable.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3300/*
3301* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
3302* @version 3.1.5
3303* @link http://fooplugins.com
3304* @copyright Steven Usher & Brad Vincent 2015
3305* @license Released under the GPLv3 license.
3306*/
3307(function($, F){
3308	// add in console we use in case it's missing
3309	window.console = window.console || { log:function(){}, error:function(){} };
3310
3311	/**
3312	 * The jQuery plugin initializer.
3313	 * @function jQuery.fn.footable
3314	 * @param {(object|FooTable.Defaults)} [options] - The options to initialize the plugin with.
3315	 * @param {function} [ready] - A callback function to execute for each initialized plugin.
3316	 * @returns {jQuery}
3317	 */
3318	$.fn.footable = function (options, ready) {
3319		options = options || {};
3320		// make sure we only work with tables
3321		return this.filter('table').each(function (i, tbl) {
3322			F.init(tbl, options, ready);
3323		});
3324	};
3325
3326	var debug_defaults = {
3327		events: []
3328	};
3329	F.__debug__ = JSON.parse(localStorage.getItem('footable_debug')) || false;
3330	F.__debug_options__ = JSON.parse(localStorage.getItem('footable_debug_options')) || debug_defaults;
3331
3332	/**
3333	 * Gets or sets the internal debug variable which enables some additional logging to the console.
3334	 * When enabled this value is stored in the localStorage so it can persist across page reloads.
3335	 * @param {boolean} value - Whether or not to enable additional logging.
3336	 * @param {object} [options] - Any debug specific options.
3337	 * @returns {(boolean|undefined)}
3338	 */
3339	F.debug = function(value, options){
3340		if (!F.is.boolean(value)) return F.__debug__;
3341		F.__debug__ = value;
3342		if (F.__debug__){
3343			localStorage.setItem('footable_debug', JSON.stringify(F.__debug__));
3344			F.__debug_options__ = $.extend(true, {}, debug_defaults, options || {});
3345			if (F.is.hash(options)){
3346				localStorage.setItem('footable_debug_options', JSON.stringify(F.__debug_options__));
3347			}
3348		} else {
3349			localStorage.removeItem('footable_debug');
3350			localStorage.removeItem('footable_debug_options');
3351		}
3352	};
3353
3354	/**
3355	 * Gets the FooTable instance of the supplied table if one exists.
3356	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to retrieve FooTable from.
3357	 * @returns {(FooTable.Table|undefined)}
3358	 */
3359	F.get = function(table){
3360		return $(table).first().data('__FooTable__');
3361	};
3362
3363	/**
3364	 * Initializes a new instance of FooTable on the supplied table.
3365	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to initialize FooTable on.
3366	 * @param {object} options - The options to initialize FooTable with.
3367	 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
3368	 * @returns {FooTable.Table}
3369	 */
3370	F.init = function(table, options, ready){
3371		var ft = F.get(table);
3372		if (ft instanceof F.Table) ft.destroy();
3373		return new F.Table(table, options, ready);
3374	};
3375
3376	/**
3377	 * Gets the FooTable.Row instance for the supplied element.
3378	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} element - A jQuery object, selector or the HTMLElement of an element to retrieve the FooTable.Row for.
3379	 * @returns {FooTable.Row}
3380	 */
3381	F.getRow = function(element){
3382		// to get the FooTable.Row object simply walk up the DOM, find the TR and grab the __FooTableRow__ data value
3383		var $row = $(element).closest('tr');
3384		// if this is a detail row get the previous row in the table to get the main TR element
3385		if ($row.hasClass('footable-detail-row')){
3386			$row = $row.prev();
3387		}
3388		// grab the row object
3389		return $row.data('__FooTableRow__');
3390	};
3391
3392	// The below are external type definitions mainly used as pointers to jQuery docs for important information
3393	/**
3394	 * jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API
3395	 * that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
3396	 * @name jQuery
3397	 * @constructor
3398	 * @returns {jQuery}
3399	 * @see {@link http://api.jquery.com/}
3400	 */
3401
3402	/**
3403	 * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, and state) to prevent users from changing the state of the Deferred.
3404	 * @typedef {object} jQuery.Promise
3405	 * @see {@link http://api.jquery.com/Types/#Promise}
3406	 */
3407
3408	/**
3409	 * As of jQuery 1.5, the Deferred object provides a way to register multiple callbacks into self-managed callback queues, invoke callback queues as appropriate,
3410	 * and relay the success or failure state of any synchronous or asynchronous function.
3411	 * @typedef {object} jQuery.Deferred
3412	 * @see {@link http://api.jquery.com/Types/#Deferred}
3413	 */
3414
3415	/**
3416	 * jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler. Most properties from
3417	 * the original event are copied over and normalized to the new event object.
3418	 * @typedef {object} jQuery.Event
3419	 * @see {@link http://api.jquery.com/category/events/event-object/}
3420	 */
3421
3422	/**
3423	 * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
3424	 * @memberof jQuery
3425	 * @function when
3426	 * @param {...jQuery.Deferred} deferreds - Any number of deferred objects to wait for.
3427	 * @returns {jQuery.Promise}
3428	 * @see {@link http://api.jquery.com/jQuery.when/}
3429	 */
3430
3431	/**
3432	 * The jQuery.fn namespace used to register plugins with jQuery.
3433	 * @memberof jQuery
3434	 * @namespace fn
3435	 * @see {@link http://learn.jquery.com/plugins/basic-plugin-creation/}
3436	 */
3437})(
3438	jQuery,
3439	/**
3440	 * The core FooTable namespace containing all the plugin code.
3441	 * @namespace
3442	 */
3443	FooTable = window.FooTable || {}
3444);
3445(function(F){
3446	var returnTrue = function(){ return true; };
3447
3448	/**
3449	 * This namespace contains commonly used array utility methods.
3450	 * @namespace {object} FooTable.arr
3451	 */
3452	F.arr = {};
3453
3454	/**
3455	 * Iterates over each item in the supplied array and performs the supplied function passing in the current item as the first argument.
3456	 * @memberof FooTable.arr
3457	 * @function each
3458	 * @param {Array} array - The array to iterate
3459	 * @param {function} func - The function to execute for each item. The first argument supplied to this function is the current item and the second is the current index.
3460	 */
3461	F.arr.each = function (array, func) {
3462		if (!F.is.array(array) || !F.is.fn(func)) return;
3463		for (var i = 0, len = array.length; i < len; i++) {
3464			if (func(array[i], i) === false) break;
3465		}
3466	};
3467
3468	/**
3469	 * Get all items in the supplied array that optionally matches the supplied where function. If no items are found an empty array is returned.
3470	 * @memberof FooTable.arr
3471	 * @function get
3472	 * @param {Array} array - The array to get items from.
3473	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
3474	 * @returns {Array}
3475	 */
3476	F.arr.get = function (array, where) {
3477		var result = [];
3478		if (!F.is.array(array)) return result;
3479		if (!F.is.fn(where)) return array;
3480		for (var i = 0, len = array.length; i < len; i++) {
3481			if (where(array[i], i)) result.push(array[i]);
3482		}
3483		return result;
3484	};
3485
3486	/**
3487	 * Get a boolean value indicating if any item exists in the supplied array that optionally matches the supplied where function.
3488	 * @memberof FooTable.arr
3489	 * @function any
3490	 * @param {Array} array - The array to check.
3491	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item is a valid match.
3492	 * @returns {boolean}
3493	 */
3494	F.arr.any = function (array, where) {
3495		if (!F.is.array(array)) return false;
3496		where = F.is.fn(where) ? where : returnTrue;
3497		for (var i = 0, len = array.length; i < len; i++) {
3498			if (where(array[i], i)) return true;
3499		}
3500		return false;
3501	};
3502
3503	/**
3504	 * Checks if the supplied value exists in the array.
3505	 * @memberof FooTable.arr
3506	 * @function contains
3507	 * @param {Array} array - The array to check.
3508	 * @param {*} value - The value to check for.
3509	 * @returns {boolean}
3510	 */
3511	F.arr.contains = function(array, value){
3512		if (!F.is.array(array) || F.is.undef(value)) return false;
3513		for (var i = 0, len = array.length; i < len; i++) {
3514			if (array[i] == value) return true;
3515		}
3516		return false;
3517	};
3518
3519	/**
3520	 * Get the first item in the supplied array that optionally matches the supplied where function. If no item is found null is returned.
3521	 * @memberof FooTable.arr
3522	 * @function first
3523	 * @param {Array} array - The array to get the item from.
3524	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item can be returned.
3525	 * @returns {(*|null)}
3526	 */
3527	F.arr.first = function (array, where) {
3528		if (!F.is.array(array)) return null;
3529		where = F.is.fn(where) ? where : returnTrue;
3530		for (var i = 0, len = array.length; i < len; i++) {
3531			if (where(array[i], i)) return array[i];
3532		}
3533		return null;
3534	};
3535
3536	/**
3537	 * Creates a new array from the results of the supplied getter function. If no items are found an empty array is returned, to exclude an item from the results return null.
3538	 * @memberof FooTable.arr
3539	 * @function map
3540	 * @param {Array} array - The array to iterate.
3541	 * @param {function} getter - This function must return either a new value or null.
3542	 * The first argument is the result being returned at this point in the iteration. The second argument is the current item being iterated.
3543	 * @returns {(*|null)}
3544	 */
3545	F.arr.map = function (array, getter) {
3546		var result = [], returned = null;
3547		if (!F.is.array(array) || !F.is.fn(getter)) return result;
3548		for (var i = 0, len = array.length; i < len; i++) {
3549			if ((returned = getter(array[i], i)) != null) result.push(returned);
3550		}
3551		return result;
3552	};
3553
3554	/**
3555	 * Removes items from the array matching the supplied where function. All removed items are returned in a new array.
3556	 * @memberof FooTable.arr
3557	 * @function remove
3558	 * @param {Array} array - The array to iterate and remove items from.
3559	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
3560	 * @returns {*}
3561	 */
3562	F.arr.remove = function (array, where) {
3563		var remove = [], removed = [];
3564		if (!F.is.array(array) || !F.is.fn(where)) return removed;
3565		var i = 0, len = array.length;
3566		for (; i < len; i++) {
3567			if (where(array[i], i, removed)){
3568				remove.push(i);
3569				removed.push(array[i]);
3570			}
3571		}
3572		// sort the indexes to be removed from largest to smallest
3573		remove.sort(function(a, b){ return b - a; });
3574		i = 0; len = remove.length;
3575		for(; i < len; i++){
3576			var index = remove[i] - i;
3577			array.splice(index, 1);
3578		}
3579		return removed;
3580	};
3581
3582	/**
3583	 * Deletes a single item from the array. The item if removed is returned.
3584	 * @memberof FooTable.arr
3585	 * @function delete
3586	 * @param {Array} array - The array to iterate and delete the item from.
3587	 * @param {*} item - The item to find and delete.
3588	 * @returns {(*|null)}
3589	 */
3590	F.arr.delete = function(array, item){
3591		var remove = -1, removed = null;
3592		if (!F.is.array(array) || F.is.undef(item)) return removed;
3593		var i = 0, len = array.length;
3594		for (; i < len; i++) {
3595			if (array[i] == item){
3596				remove = i;
3597				removed = array[i];
3598				break;
3599			}
3600		}
3601		if (remove != -1) array.splice(remove, 1);
3602		return removed;
3603	};
3604
3605	/**
3606	 * Replaces a single item in the array with a new one.
3607	 * @memberof FooTable.arr
3608	 * @function replace
3609	 * @param {Array} array - The array to iterate and replace the item in.
3610	 * @param {*} oldItem - The item to be replaced.
3611	 * @param {*} newItem - The item to be inserted.
3612	 */
3613	F.arr.replace = function(array, oldItem, newItem){
3614		var index = array.indexOf(oldItem);
3615		if (index !== -1) array[index] = newItem;
3616	};
3617
3618})(FooTable);
3619(function (F) {
3620
3621	/**
3622	 * This namespace contains commonly used 'is' type methods that return boolean values.
3623	 * @namespace FooTable.is
3624	 */
3625	F.is = {};
3626
3627	/**
3628	 * Checks if the type of the value is the same as that supplied.
3629	 * @memberof FooTable.is
3630	 * @function type
3631	 * @param {*} value - The value to check the type of.
3632	 * @param {string} type - The type to check for.
3633	 * @returns {boolean}
3634	 */
3635	F.is.type = function (value, type) {
3636		return typeof value === type;
3637	};
3638
3639	/**
3640	 * Checks if the value is defined.
3641	 * @memberof FooTable.is
3642	 * @function defined
3643	 * @param {*} value - The value to check is defined.
3644	 * @returns {boolean}
3645	 */
3646	F.is.defined = function (value) {
3647		return typeof value !== 'undefined';
3648	};
3649
3650	/**
3651	 * Checks if the value is undefined.
3652	 * @memberof FooTable.is
3653	 * @function undef
3654	 * @param {*} value - The value to check is undefined.
3655	 * @returns {boolean}
3656	 */
3657	F.is.undef = function (value) {
3658		return typeof value === 'undefined';
3659	};
3660
3661	/**
3662	 * Checks if the value is an array.
3663	 * @memberof FooTable.is
3664	 * @function array
3665	 * @param {*} value - The value to check.
3666	 * @returns {boolean}
3667	 */
3668	F.is.array = function (value) {
3669		return '[object Array]' === Object.prototype.toString.call(value);
3670	};
3671
3672	/**
3673	 * Checks if the value is a date.
3674	 * @memberof FooTable.is
3675	 * @function date
3676	 * @param {*} value - The value to check.
3677	 * @returns {boolean}
3678	 */
3679	F.is.date = function (value) {
3680		return '[object Date]' === Object.prototype.toString.call(value) && !isNaN(value.getTime());
3681	};
3682
3683	/**
3684	 * Checks if the value is a boolean.
3685	 * @memberof FooTable.is
3686	 * @function boolean
3687	 * @param {*} value - The value to check.
3688	 * @returns {boolean}
3689	 */
3690	F.is.boolean = function (value) {
3691		return '[object Boolean]' === Object.prototype.toString.call(value);
3692	};
3693
3694	/**
3695	 * Checks if the value is a string.
3696	 * @memberof FooTable.is
3697	 * @function string
3698	 * @param {*} value - The value to check.
3699	 * @returns {boolean}
3700	 */
3701	F.is.string = function (value) {
3702		return '[object String]' === Object.prototype.toString.call(value);
3703	};
3704
3705	/**
3706	 * Checks if the value is a number.
3707	 * @memberof FooTable.is
3708	 * @function number
3709	 * @param {*} value - The value to check.
3710	 * @returns {boolean}
3711	 */
3712	F.is.number = function (value) {
3713		return '[object Number]' === Object.prototype.toString.call(value) && !isNaN(value);
3714	};
3715
3716	/**
3717	 * Checks if the value is a function.
3718	 * @memberof FooTable.is
3719	 * @function fn
3720	 * @param {*} value - The value to check.
3721	 * @returns {boolean}
3722	 */
3723	F.is.fn = function (value) {
3724		return (F.is.defined(window) && value === window.alert) || '[object Function]' === Object.prototype.toString.call(value);
3725	};
3726
3727	/**
3728	 * Checks if the value is an error.
3729	 * @memberof FooTable.is
3730	 * @function error
3731	 * @param {*} value - The value to check.
3732	 * @returns {boolean}
3733	 */
3734	F.is.error = function (value) {
3735		return '[object Error]' === Object.prototype.toString.call(value);
3736	};
3737
3738	/**
3739	 * Checks if the value is an object.
3740	 * @memberof FooTable.is
3741	 * @function object
3742	 * @param {*} value - The value to check.
3743	 * @returns {boolean}
3744	 */
3745	F.is.object = function (value) {
3746		return '[object Object]' === Object.prototype.toString.call(value);
3747	};
3748
3749	/**
3750	 * Checks if the value is a hash.
3751	 * @memberof FooTable.is
3752	 * @function hash
3753	 * @param {*} value - The value to check.
3754	 * @returns {boolean}
3755	 */
3756	F.is.hash = function (value) {
3757		return F.is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
3758	};
3759
3760	/**
3761	 * Checks if the supplied object is an HTMLElement
3762	 * @memberof FooTable.is
3763	 * @function element
3764	 * @param {object} obj - The object to check.
3765	 * @returns {boolean}
3766	 */
3767	F.is.element = function (obj) {
3768		return typeof HTMLElement === 'object'
3769			? obj instanceof HTMLElement
3770			: obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string';
3771	};
3772
3773	/**
3774	 * This is a simple check to determine if an object is a jQuery promise object. It simply checks the object has a "then" and "promise" function defined.
3775	 * The promise object is created as an object literal inside of jQuery.Deferred.
3776	 * It has no prototype, nor any other truly unique properties that could be used to distinguish it.
3777	 * This method should be a little more accurate than the internal jQuery one that simply checks for a "promise" method.
3778	 * @memberof FooTable.is
3779	 * @function promise
3780	 * @param {object} obj - The object to check.
3781	 * @returns {boolean}
3782	 */
3783	F.is.promise = function(obj){
3784		return F.is.object(obj) && F.is.fn(obj.then) && F.is.fn(obj.promise);
3785	};
3786
3787	/**
3788	 * Checks if the supplied object is an instance of a jQuery object.
3789	 * @memberof FooTable.is
3790	 * @function jq
3791	 * @param {object} obj - The object to check.
3792	 * @returns {boolean}
3793	 */
3794	F.is.jq = function(obj){
3795		return F.is.defined(window.jQuery) && obj instanceof jQuery && obj.length > 0;
3796	};
3797
3798	/**
3799	 * Checks if the supplied object is a moment.js date object.
3800	 * @memberof FooTable.is
3801	 * @function moment
3802	 * @param {object} obj - The object to check.
3803	 * @returns {boolean}
3804	 */
3805	F.is.moment = function(obj){
3806		return F.is.defined(window.moment) && F.is.object(obj) && F.is.boolean(obj._isAMomentObject)
3807	};
3808
3809	/**
3810	 * Checks if the supplied value is an object and if it is empty.
3811	 * @memberof FooTable.is
3812	 * @function emptyObject
3813	 * @param {*} value - The value to check.
3814	 * @returns {boolean}
3815	 */
3816	F.is.emptyObject = function(value){
3817		if (!F.is.hash(value)) return false;
3818		for(var prop in value) {
3819			if(value.hasOwnProperty(prop))
3820				return false;
3821		}
3822		return true;
3823	};
3824
3825	/**
3826	 * Checks if the supplied value is an array and if it is empty.
3827	 * @memberof FooTable.is
3828	 * @function emptyArray
3829	 * @param {*} value - The value to check.
3830	 * @returns {boolean}
3831	 */
3832	F.is.emptyArray = function(value){
3833		return F.is.array(value) ? value.length === 0 : true;
3834	};
3835
3836	/**
3837	 * Checks if the supplied value is a string and if it is empty.
3838	 * @memberof FooTable.is
3839	 * @function emptyString
3840	 * @param {*} value - The value to check.
3841	 * @returns {boolean}
3842	 */
3843	F.is.emptyString = function(value){
3844		return F.is.string(value) ? value.length === 0 : true;
3845	};
3846
3847})(FooTable);
3848(function (F) {
3849	/**
3850	 * This namespace contains commonly used string utility methods.
3851	 * @namespace FooTable.str
3852	 */
3853	F.str = {};
3854
3855	/**
3856	 * Checks if the supplied string contains the given substring.
3857	 * @memberof FooTable.str
3858	 * @function contains
3859	 * @param {string} str - The string to check.
3860	 * @param {string} contains - The string to check for.
3861	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
3862	 * @returns {boolean}
3863	 */
3864	F.str.contains = function (str, contains, ignoreCase) {
3865		if (F.is.emptyString(str) || F.is.emptyString(contains)) return false;
3866		return contains.length <= str.length
3867			&& (ignoreCase ? str.toUpperCase().indexOf(contains.toUpperCase()) : str.indexOf(contains)) !== -1;
3868	};
3869
3870	/**
3871	 * Checks if the supplied string contains the exact given substring.
3872	 * @memberof FooTable.str
3873	 * @function contains
3874	 * @param {string} str - The string to check.
3875	 * @param {string} contains - The string to check for.
3876	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
3877	 * @returns {boolean}
3878	 */
3879	F.str.containsExact = function (str, contains, ignoreCase) {
3880		if (F.is.emptyString(str) || F.is.emptyString(contains) || contains.length > str.length) return false;
3881		return new RegExp('\\b'+ F.str.escapeRegExp(contains)+'\\b', ignoreCase ? 'i' : '').test(str);
3882	};
3883
3884	/**
3885	 * Checks if the supplied string contains the given word.
3886	 * @memberof FooTable.str
3887	 * @function containsWord
3888	 * @param {string} str - The string to check.
3889	 * @param {string} word - The word to check for.
3890	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
3891	 * @returns {boolean}
3892	 */
3893	F.str.containsWord = function(str, word, ignoreCase){
3894		if (F.is.emptyString(str) || F.is.emptyString(word) || str.length < word.length)
3895			return false;
3896		var parts = str.split(/\W/);
3897		for (var i = 0, len = parts.length; i < len; i++){
3898			if (ignoreCase ? parts[i].toUpperCase() == word.toUpperCase() : parts[i] == word) return true;
3899		}
3900		return false;
3901	};
3902
3903	/**
3904	 * Returns the remainder of a string split on the first index of the given substring.
3905	 * @memberof FooTable.str
3906	 * @function from
3907	 * @param {string} str - The string to split.
3908	 * @param {string} from - The substring to split on.
3909	 * @returns {string}
3910	 */
3911	F.str.from = function (str, from) {
3912		if (F.is.emptyString(str)) return str;
3913		return F.str.contains(str, from) ? str.substring(str.indexOf(from) + 1) : str;
3914	};
3915
3916	/**
3917	 * Checks if a string starts with the supplied prefix.
3918	 * @memberof FooTable.str
3919	 * @function startsWith
3920	 * @param {string} str - The string to check.
3921	 * @param {string} prefix - The prefix to check for.
3922	 * @returns {boolean}
3923	 */
3924	F.str.startsWith = function (str, prefix) {
3925		if (F.is.emptyString(str)) return str == prefix;
3926		return str.slice(0, prefix.length) == prefix;
3927	};
3928
3929	/**
3930	 * Takes the supplied string and converts it to camel case.
3931	 * @memberof FooTable.str
3932	 * @function toCamelCase
3933	 * @param {string} str - The string to camel case.
3934	 * @returns {string}
3935	 */
3936	F.str.toCamelCase = function (str) {
3937		if (F.is.emptyString(str)) return str;
3938		if (str.toUpperCase() === str) return str.toLowerCase();
3939		return str.replace(/^([A-Z])|[-\s_](\w)/g, function (match, p1, p2) {
3940			if (F.is.string(p2)) return p2.toUpperCase();
3941			return p1.toLowerCase();
3942		});
3943	};
3944
3945	/**
3946	 * Generates a random string 9 characters long using the optional prefix if supplied.
3947	 * @memberof FooTable.str
3948	 * @function random
3949	 * @param {string} [prefix] - The prefix to append to the 9 random characters.
3950	 * @returns {string}
3951	 */
3952	F.str.random = function(prefix){
3953		prefix = F.is.emptyString(prefix) ? '' : prefix;
3954		return prefix + Math.random().toString(36).substr(2, 9);
3955	};
3956
3957	/**
3958	 * Escapes a string for use in a regular expression.
3959	 * @memberof FooTable.str
3960	 * @function escapeRegExp
3961	 * @param {string} str - The string to escape.
3962	 * @returns {string}
3963	 */
3964	F.str.escapeRegExp = function(str){
3965		if (F.is.emptyString(str)) return str;
3966		return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3967	};
3968
3969})(FooTable);
3970(function (F) {
3971	"use strict";
3972
3973	if (!Object.create) {
3974		Object.create = (function () {
3975			var Object = function () {};
3976			return function (prototype) {
3977				if (arguments.length > 1)
3978					throw Error('Second argument not supported');
3979
3980				if (!F.is.object(prototype))
3981					throw TypeError('Argument must be an object');
3982
3983				Object.prototype = prototype;
3984				var result = new Object();
3985				Object.prototype = null;
3986				return result;
3987			};
3988		})();
3989	}
3990
3991	/**
3992	 * This base implementation does nothing except provide access to the {@link FooTable.Class#extend} method.
3993	 * @constructs FooTable.Class
3994	 * @classdesc This class is based off of John Resig's [Simple JavaScript Inheritance]{@link http://ejohn.org/blog/simple-javascript-inheritance} but it has been updated to be ES 5.1
3995	 * compatible by implementing an [Object.create polyfill]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
3996	 * for older browsers.
3997	 * @see {@link http://ejohn.org/blog/simple-javascript-inheritance}
3998	 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
3999	 * @returns {FooTable.Class}
4000	 */
4001	function Class() {}
4002
4003	var __extendable__ = /xyz/.test(function () {xyz;}) ? /\b_super\b/ : /.*/;
4004
4005	// this._super() within the context of the new function is a pointer to the original function
4006	// except if the hook param is specified then the this._super variable is the result of the original function
4007	Class.__extend__ = function(proto, name, func, original){
4008		// to all who venture here, here be dragons!
4009		proto[name] = F.is.fn(original) && __extendable__.test(func) ?
4010			(function (name, fn) {
4011				return function () {
4012					var tmp, ret;
4013					tmp = this._super;
4014					this._super = original;
4015					ret = fn.apply(this, arguments);
4016					this._super = tmp;
4017					return ret;
4018				};
4019			})(name, func) : func;
4020	};
4021
4022	/**
4023	 * Creates a new class that inherits from this class which in turn allows itself to be extended or if a name and function is supplied extends only that specific function on the class.
4024	 * @param {(object|string)} arg1 - An object containing any new methods/members to implement or the name of the method to extend.
4025	 * @param {function} arg2 - If the first argument is a method name then this is the new function to replace it with.
4026	 * @returns {FooTable.Class} A new class that inherits from the base class.
4027	 * @example <caption>The below shows an example of how to implement inheritance using this method.</caption>
4028	 * var Person = FooTable.Class.extend({
4029	 *   construct: function(isDancing){
4030	 *     this.dancing = isDancing;
4031	 *   },
4032	 *   dance: function(){
4033	 *     return this.dancing;
4034	 *   }
4035	 * });
4036	 *
4037	 * var Ninja = Person.extend({
4038	 *   construct: function(){
4039	 *     this._super( false );
4040	 *   },
4041	 *   dance: function(){
4042	 *     // Call the inherited version of dance()
4043	 *     return this._super();
4044	 *   },
4045	 *   swingSword: function(){
4046	 *     return true;
4047	 *   }
4048	 * });
4049	 *
4050	 * var p = new Person(true);
4051	 * p.dance(); // => true
4052	 *
4053	 * var n = new Ninja();
4054	 * n.dance(); // => false
4055	 * n.swingSword(); // => true
4056	 *
4057	 * // Should all be true
4058	 * p instanceof Person && p instanceof FooTable.Class &&
4059	 * n instanceof Ninja && n instanceof Person && n instanceof FooTable.Class
4060	 */
4061	Class.extend = function (arg1 , arg2) {
4062		var args = Array.prototype.slice.call(arguments);
4063		arg1 = args.shift();
4064		arg2 = args.shift();
4065
4066		function __extend__(proto, name, func, original){
4067			// to all who venture here, here be dragons!
4068			proto[name] = F.is.fn(original) && __extendable__.test(func) ?
4069				(function (name, fn, ofn) {
4070					return function () {
4071						var tmp, ret;
4072						tmp = this._super;
4073						this._super = ofn;
4074						ret = fn.apply(this, arguments);
4075						this._super = tmp;
4076						return ret;
4077					};
4078				})(name, func, original) : func;
4079		}
4080
4081		if (F.is.hash(arg1)){
4082			var proto = Object.create(this.prototype),
4083				_super = this.prototype;
4084			for (var name in arg1) {
4085				if (name === '__ctor__') continue;
4086				__extend__(proto, name, arg1[name], _super[name]);
4087			}
4088			var obj = F.is.fn(proto.__ctor__) ? proto.__ctor__ : function () {
4089				if (!F.is.fn(this.construct))
4090					throw new SyntaxError('FooTable class objects must be constructed with the "new" keyword.');
4091				this.construct.apply(this, arguments);
4092			};
4093			proto.construct = F.is.fn(proto.construct) ? proto.construct : function(){};
4094			obj.prototype = proto;
4095			proto.constructor = obj;
4096			obj.extend = Class.extend;
4097			return obj;
4098		} else if (F.is.string(arg1) && F.is.fn(arg2)) {
4099			__extend__(this.prototype, arg1, arg2, this.prototype[arg1]);
4100		}
4101	};
4102
4103	F.Class = Class;
4104
4105	F.ClassFactory = F.Class.extend(/** @lends FooTable.ClassFactory */{
4106		/**
4107		 * This is a simple factory for {@link FooTable.Class} objects allowing them to be registered using a friendly name
4108		 * and then new instances can be created using this friendly name.
4109		 * @constructs
4110		 * @extends FooTable.Class
4111		 * @returns {FooTable.ClassFactory}
4112		 * @this FooTable.ClassFactory
4113		 */
4114		construct: function(){
4115			/**
4116			 * An object containing all registered classes.
4117			 * @type {{}}
4118			 */
4119			this.registered = {};
4120		},
4121		/**
4122		 * Checks if the factory contains a class registered using the supplied name.
4123		 * @instance
4124		 * @param {string} name - The name of the class to check.
4125		 * @returns {boolean}
4126		 * @this FooTable.ClassFactory
4127		 */
4128		contains: function(name){
4129			return F.is.defined(this.registered[name]);
4130		},
4131		/**
4132		 * Gets an array of all registered names.
4133		 * @instance
4134		 * @returns {Array.<string>}
4135		 * @this FooTable.ClassFactory
4136		 */
4137		names: function(){
4138			var names = [], name;
4139			for (name in this.registered){
4140				if (!this.registered.hasOwnProperty(name)) continue;
4141				names.push(name);
4142			}
4143			return names;
4144		},
4145		/**
4146		 * Registers a class object using the supplied friendly name and priority. The priority is only taken into account when loading all registered classes
4147		 * using the {@link FooTable.ClassFactory#load} method.
4148		 * @instance
4149		 * @param {string} name - The friendly name of the class.
4150		 * @param {function} klass - The class to register.
4151		 * @param {number} priority - This determines the order that the class is created when using the {@link FooTable.ClassFactory#load} method, higher values are loaded first.
4152		 * @this FooTable.ClassFactory
4153		 */
4154		register: function(name, klass, priority){
4155			if (!F.is.string(name) || !F.is.fn(klass)) return;
4156			var current = this.registered[name];
4157			this.registered[name] = {
4158				name: name,
4159				klass: klass,
4160				priority: F.is.number(priority) ? priority : (F.is.defined(current) ? current.priority : 0)
4161			};
4162		},
4163		/**
4164		 * Creates new instances of all registered classes using there priority and the supplied arguments to return them in an array.
4165		 * @instance
4166		 * @param {object} subs - An object containing classes to substitute on load.
4167		 * @param {*} arg1 - The first argument to supply when creating new instances of all registered classes.
4168		 * @param {*} [argN...] - Any number of additional arguments to supply when creating new instances of all registered classes.
4169		 * @returns {Array.<FooTable.Class>}
4170		 * @this FooTable.ClassFactory
4171		 */
4172		load: function(subs, arg1, argN){
4173			var self = this, args = Array.prototype.slice.call(arguments), reg = [], loaded = [], name, klass;
4174			subs = args.shift() || {};
4175			for (name in self.registered){
4176				if (!self.registered.hasOwnProperty(name)) continue;
4177				var component = self.registered[name];
4178				if (subs.hasOwnProperty(name)){
4179					klass = subs[name];
4180					if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
4181					if (F.is.fn(klass)){
4182						component = {name: name, klass: klass, priority: self.registered[name].priority};
4183					}
4184				}
4185				reg.push(component);
4186			}
4187			for (name in subs){
4188				if (!subs.hasOwnProperty(name) || self.registered.hasOwnProperty(name)) continue;
4189				klass = subs[name];
4190				if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
4191				if (F.is.fn(klass)){
4192					reg.push({name: name, klass: klass, priority: 0});
4193				}
4194			}
4195			reg.sort(function(a, b){ return b.priority - a.priority; });
4196			F.arr.each(reg, function(r){
4197				if (F.is.fn(r.klass)){
4198					loaded.push(self._make(r.klass, args));
4199				}
4200			});
4201			return loaded;
4202		},
4203		/**
4204		 * Create a new instance of a single class using the supplied name and arguments.
4205		 * @instance
4206		 * @param {string} name - The name of the class to create.
4207		 * @param {*} arg1 - The first argument to supply to the new instance.
4208		 * @param {*} [argN...] - Any number of additional arguments to supply to the new instance.
4209		 * @returns {FooTable.Class}
4210		 * @this FooTable.ClassFactory
4211		 */
4212		make: function(name, arg1, argN){
4213			var self = this, args = Array.prototype.slice.call(arguments), reg;
4214			name = args.shift();
4215			reg = self.registered[name];
4216			if (F.is.fn(reg.klass)){
4217				return self._make(reg.klass, args);
4218			}
4219			return null;
4220		},
4221		/**
4222		 * This in effect lets us use the "apply" method on a function using the "new" keyword.
4223		 * @instance
4224		 * @private
4225		 * @param {function} klass
4226		 * @param args
4227		 * @returns {FooTable.Class}
4228		 * @this FooTable.ClassFactory
4229		 */
4230		_make: function(klass, args){
4231			function Class() {
4232				return klass.apply(this, args);
4233			}
4234			Class.prototype = klass.prototype;
4235			return new Class();
4236		}
4237	});
4238
4239})(FooTable);
4240(function($, F){
4241
4242	/**
4243	 * Converts the supplied cssText string into JSON object.
4244	 * @param {string} cssText - The cssText to convert to a JSON object.
4245	 * @returns {object}
4246	 */
4247	F.css2json = function(cssText){
4248		if (F.is.emptyString(cssText)) return {};
4249		var json = {}, props = cssText.split(';'), pair, key, value;
4250		for (var i = 0, i_len = props.length; i < i_len; i++){
4251			if (F.is.emptyString(props[i])) continue;
4252			pair = props[i].split(':');
4253			if (F.is.emptyString(pair[0]) || F.is.emptyString(pair[1])) continue;
4254			key = F.str.toCamelCase($.trim(pair[0]));
4255			value = $.trim(pair[1]);
4256			json[key] = value;
4257		}
4258		return json;
4259	};
4260
4261	/**
4262	 * Attempts to retrieve a function pointer using the given name.
4263	 * @param {string} functionName - The name of the function to fetch a pointer to.
4264	 * @returns {(function|object|null)}
4265	 */
4266	F.getFnPointer = function(functionName){
4267		if (F.is.emptyString(functionName)) return null;
4268		var pointer = window,
4269			parts = functionName.split('.');
4270		F.arr.each(parts, function(part){
4271			if (pointer[part]) pointer = pointer[part];
4272		});
4273		return F.is.fn(pointer) ? pointer : null;
4274	};
4275
4276	/**
4277	 * Checks the value for function properties such as the {@link FooTable.Column#formatter} option which could also be specified using just the name
4278	 * and attempts to return the correct function pointer or null if none was found matching the value.
4279	 * @param {FooTable.Class} self - The class to use as the 'this' keyword within the context of the function.
4280	 * @param {(function|string)} value - The actual function or the name of the function for the property.
4281	 * @param {function} [def] - A default function to return if none is found.
4282	 * @returns {(function|null)}
4283	 */
4284	F.checkFnValue = function(self, value, def){
4285		def = F.is.fn(def) ? def : null;
4286		function wrap(t, fn, d){
4287			if (!F.is.fn(fn)) return d;
4288			return function(){
4289				return fn.apply(t, arguments);
4290			};
4291		}
4292		return F.is.fn(value) ? wrap(self, value, def) : (F.is.type(value, 'string') ? wrap(self, F.getFnPointer(value), def) : def);
4293	};
4294
4295})(jQuery, FooTable);
4296(function($, F){
4297
4298	F.Cell = F.Class.extend(/** @lends FooTable.Cell */{
4299		/**
4300		 * The cell class containing all the properties for cells.
4301		 * @constructs
4302		 * @extends FooTable.Class
4303		 * @param {FooTable.Table} table -  The root {@link FooTable.Table} this cell belongs to.
4304		 * @param {FooTable.Row} row - The parent {@link FooTable.Row} this cell belongs to.
4305		 * @param {FooTable.Column} column - The {@link FooTable.Column} this cell falls under.
4306		 * @param {(*|HTMLElement|jQuery)} valueOrElement - Either the value or the element for the cell.
4307		 * @returns {FooTable.Cell}
4308		 * @this FooTable.Cell
4309		 */
4310		construct: function (table, row, column, valueOrElement) {
4311			/**
4312			 * The root {@link FooTable.Table} for the cell.
4313			 * @instance
4314			 * @readonly
4315			 * @type {FooTable.Table}
4316			 */
4317			this.ft = table;
4318			/**
4319			 * The parent {@link FooTable.Row} for the cell.
4320			 * @instance
4321			 * @readonly
4322			 * @type {FooTable.Row}
4323			 */
4324			this.row = row;
4325			/**
4326			 * The {@link FooTable.Column} this cell falls under.
4327			 * @instance
4328			 * @readonly
4329			 * @type {FooTable.Column}
4330			 */
4331			this.column = column;
4332			this.created = false;
4333			this.define(valueOrElement);
4334		},
4335		/**
4336		 * This is supplied either the value or the cell element/jQuery object if it exists.
4337		 * If supplied the element we need set the $el property and parse the value from it.
4338		 * @instance
4339		 * @protected
4340		 * @param {(*|jQuery)} valueOrElement - The value or element to define the cell.
4341		 * @this FooTable.Cell
4342		 */
4343		define: function(valueOrElement){
4344			/**
4345			 * The jQuery table cell object this instance wraps.
4346			 * @instance
4347			 * @type {jQuery}
4348			 */
4349			this.$el = F.is.element(valueOrElement) || F.is.jq(valueOrElement) ? $(valueOrElement) : null;
4350			/**
4351			 * The jQuery row object that represents this cell in the details table.
4352			 * @type {jQuery}
4353			 */
4354			this.$detail = null;
4355
4356			var hasOptions = F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options) && F.is.defined(valueOrElement.value);
4357
4358			/**
4359			 * The value of the cell.
4360			 * @instance
4361			 * @type {*}
4362			 */
4363			this.value = this.column.parser.call(this.column, F.is.jq(this.$el) ? this.$el : (hasOptions ? valueOrElement.value : valueOrElement), this.ft.o);
4364
4365			/**
4366			 * Contains any options for the cell. These are the options supplied through the plugin constructor as part of the row object itself.
4367			 * @type {object}
4368			 */
4369			this.o = $.extend(true, {
4370				classes: null,
4371				style: null
4372			}, hasOptions ? valueOrElement.options : {});
4373			/**
4374			 * An array of CSS classes for the cell.
4375			 * @instance
4376			 * @protected
4377			 * @type {Array.<string>}
4378			 */
4379			this.classes = F.is.jq(this.$el) && this.$el.attr('class') ? this.$el.attr('class').match(/\S+/g) : (F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []));
4380			/**
4381			 * The inline styles for the cell.
4382			 * @instance
4383			 * @protected
4384			 * @type {object}
4385			 */
4386			this.style = F.is.jq(this.$el) && this.$el.attr('style') ? F.css2json(this.$el.attr('style')) : (F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {}));
4387		},
4388		/**
4389		 * After the cell has been defined this ensures that the $el and #detail properties are jQuery objects by either creating or updating them.
4390		 * @instance
4391		 * @protected
4392		 * @this FooTable.Cell
4393		 */
4394		$create: function(){
4395			if (this.created) return;
4396			/*if(F.is.jq(this.$el))
4397			{*/
4398			(this.$el = F.is.jq(this.$el) ? this.$el : $('<td/>'))
4399				.data('value', this.value)
4400				.contents().detach().end()
4401				.append(this.format(this.value));
4402
4403			this._setClasses(this.$el);
4404			this._setStyle(this.$el);
4405
4406			this.$detail = $('<tr/>').addClass(this.row.classes.join(' '))
4407				.data('__FooTableCell__', this)
4408				.append($('<th/>'))
4409				.append($('<td/>'));
4410			// }
4411			this.created = true;
4412		},
4413		/**
4414		 * Collapses this cell and displays it in the details row.
4415		 * @instance
4416		 * @protected
4417		 */
4418		collapse: function(){
4419			if (!this.created) return;
4420			this.$detail.children('th').html(this.column.title);
4421			this.$el.clone()
4422				.attr('id', this.$el.attr('id') ? this.$el.attr('id') + '-detail' : undefined)
4423				.css('display', 'table-cell')
4424				.html('')
4425				.append(this.$el.contents().detach())
4426				.replaceAll(this.$detail.children('td').first());
4427
4428			if (!F.is.jq(this.$detail.parent()))
4429				this.$detail.appendTo(this.row.$details.find('.footable-details > tbody'));
4430		},
4431		/**
4432		 * Restores this cell from a detail row back into the normal row.
4433		 * @instance
4434		 * @protected
4435		 */
4436		restore: function(){
4437			if (!this.created) return;
4438			if (F.is.jq(this.$detail.parent())){
4439				var $cell = this.$detail.children('td').first();
4440				this.$el
4441					.attr('class', $cell.attr('class'))
4442					.attr('style', $cell.attr('style'))
4443					.css('display', (this.column.hidden || !this.column.visible) ? 'none' : 'table-cell')
4444					.append($cell.contents().detach());
4445			}
4446			this.$detail.detach();
4447		},
4448		/**
4449		 * Helper method to call this cell's column parser function supplying the required parameters.
4450		 * @instance
4451		 * @protected
4452		 * @returns {*}
4453		 * @see FooTable.Column#parser
4454		 * @this FooTable.Cell
4455		 */
4456		parse: function(){
4457			return this.column.parser.call(this.column, this.$el, this.ft.o);
4458		},
4459		/**
4460		 * Helper method to call this cell's column formatter function using the supplied value and any additional required parameters.
4461		 * @instance
4462		 * @protected
4463		 * @param {*} value - The value to format.
4464		 * @returns {(string|HTMLElement|jQuery)}
4465		 * @see FooTable.Column#formatter
4466		 * @this FooTable.Cell
4467		 */
4468		format: function(value){
4469			return this.column.formatter.call(this.column, value, this.ft.o, this.row.value);
4470		},
4471		/**
4472		 * Allows easy access to getting or setting the cell's value. If the value is set all associated properties are also updated along with the actual element.
4473		 * Using this method also allows us to supply an object containing options and the value for the cell.
4474		 * @instance
4475		 * @param {*} [value] - The value to set for the cell. If not supplied the current value of the cell is returned.
4476		 * @param {boolean} [redraw=true] - Whether or not to redraw the row once the value has been set.
4477		 * @param {boolean} [redrawSelf=true] - Whether or not to redraw the cell itself once the value has been set, if `false` this will override the supplied `redraw` value and prevent the row from redrawing as well.
4478		 * @returns {(*|undefined)}
4479		 * @this FooTable.Cell
4480		 */
4481		val: function(value, redraw, redrawSelf){
4482			if (F.is.undef(value)){
4483				// get
4484				return this.value;
4485			}
4486			// set
4487			var self = this, hasOptions = F.is.hash(value) && F.is.hash(value.options) && F.is.defined(value.value);
4488			this.o = $.extend(true, {
4489				classes: self.classes,
4490				style: self.style
4491			}, hasOptions ? value.options : {});
4492
4493			this.value = hasOptions ? value.value : value;
4494			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
4495			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});
4496
4497			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
4498			if (this.created && redrawSelf){
4499				this.$el.data('value', this.value).empty();
4500
4501				var $detail = this.$detail.children('td').first().empty(),
4502					$target = F.is.jq(this.$detail.parent()) ? $detail : this.$el;
4503
4504				$target.append(this.format(this.value));
4505
4506				this._setClasses($target);
4507				this._setStyle($target);
4508
4509				if (F.is.boolean(redraw) ? redraw : true) this.row.draw();
4510			}
4511		},
4512		_setClasses: function($el){
4513			var hasColClasses = !F.is.emptyArray(this.column.classes),
4514				hasClasses = !F.is.emptyArray(this.classes),
4515				classes = null;
4516			$el.removeAttr('class');
4517			if (!hasColClasses && !hasClasses) return;
4518			if (hasColClasses && hasClasses){
4519				classes = this.classes.concat(this.column.classes).join(' ');
4520			} else if (hasColClasses) {
4521				classes = this.column.classes.join(' ');
4522			} else if (hasClasses){
4523				classes = this.classes.join(' ');
4524			}
4525			if (!F.is.emptyString(classes)){
4526				$el.addClass(classes);
4527			}
4528		},
4529		_setStyle: function($el){
4530			var hasColStyle = !F.is.emptyObject(this.column.style),
4531				hasStyle = !F.is.emptyObject(this.style),
4532				style = null;
4533			$el.removeAttr('style');
4534			if (!hasColStyle && !hasStyle) return;
4535			if (hasColStyle && hasStyle){
4536				style = $.extend({}, this.column.style, this.style);
4537			} else if (hasColStyle) {
4538				style = this.column.style;
4539			} else if (hasStyle){
4540				style = this.style;
4541			}
4542			if (F.is.hash(style)){
4543				$el.css(style);
4544			}
4545		}
4546	});
4547
4548})(jQuery, FooTable);
4549(function($, F){
4550
4551	F.Column = F.Class.extend(/** @lends FooTable.Column */{
4552		/**
4553		 * The column class containing all the properties for columns. All members marked as "readonly" should not be used when defining {@link FooTable.Defaults#columns}.
4554		 * @constructs
4555		 * @extends FooTable.Class
4556		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this component belongs to.
4557		 * @param {object} definition - An object containing all the properties to set for the column.
4558		 * @param {string} [type] - The type of column, "text" by default.
4559		 * @returns {FooTable.Column}
4560		 * @this FooTable.Column
4561		 */
4562		construct: function(instance, definition, type){
4563			/**
4564			 * The root {@link FooTable.Table} for the column.
4565			 * @instance
4566			 * @readonly
4567			 * @type {FooTable.Table}
4568			 */
4569			this.ft = instance;
4570			/**
4571			 * The type of data displayed by the column.
4572			 * @instance
4573			 * @readonly
4574			 * @type {string}
4575			 */
4576			this.type = F.is.emptyString(type) ? 'text' : type;
4577			/**
4578			 * Whether or not the column was parsed from a standard table row containing data instead of from an actual header row.
4579			 * @instance
4580			 * @readonly
4581			 * @type {boolean}
4582			 */
4583			this.virtual = F.is.boolean(definition.virtual) ? definition.virtual : false;
4584			/**
4585			 * The jQuery cell object for the column header.
4586			 * @instance
4587			 * @readonly
4588			 * @type {jQuery}
4589			 */
4590			this.$el = F.is.jq(definition.$el) ? definition.$el : null;
4591			/**
4592			 * The index of the column in the table. This is set by the plugin during initialization.
4593			 * @instance
4594			 * @readonly
4595			 * @type {number}
4596			 * @default -1
4597			 */
4598			this.index = F.is.number(definition.index) ? definition.index : -1;
4599			/**
4600			 * Whether or not this in an internal only column.
4601			 * @instance
4602			 * @readonly
4603			 * @type {boolean}
4604			 * @description Internal columns or there cells will not be returned when calling methods such as `FooTable.Row#val`.
4605			 */
4606			this.internal = false;
4607			this.define(definition);
4608			this.$create();
4609		},
4610		/**
4611		 * This is supplied the column definition in the form of a simple object created by merging options supplied via the plugin constructor with those parsed from the DOM.
4612		 * @instance
4613		 * @protected
4614		 * @param {object} definition - The object containing the column definition.
4615		 * @this FooTable.Column
4616		 */
4617		define: function(definition){
4618			/**
4619			 * Whether or not this column is hidden from view and appears in the details row.
4620			 * @type {boolean}
4621			 * @default false
4622			 */
4623			this.hidden = F.is.boolean(definition.hidden) ? definition.hidden : false;
4624			/**
4625			 * Whether or not this column is completely hidden from view and will not appear in the details row.
4626			 * @type {boolean}
4627			 * @default true
4628			 */
4629			this.visible = F.is.boolean(definition.visible) ? definition.visible : true;
4630
4631			/**
4632			 * The name of the column. This name must correspond to the property name of the JSON row data.
4633			 * @type {string}
4634			 * @default null
4635			 */
4636			this.name = F.is.string(definition.name) ? definition.name : null;
4637			if (this.name == null) this.name = 'col'+(definition.index+1);
4638			/**
4639			 * The title to display in the column header, this can be HTML.
4640			 * @type {string}
4641			 * @default null
4642			 */
4643			this.title = F.is.string(definition.title) ? definition.title : null;
4644			if (!this.virtual && this.title == null && F.is.jq(this.$el)) this.title = this.$el.html();
4645			if (this.title == null) this.title = 'Column '+(definition.index+1);
4646			/**
4647			 * The styles to apply to all cells in this column.
4648			 * @type {object}
4649			 */
4650			this.style = F.is.hash(definition.style) ? definition.style : (F.is.string(definition.style) ? F.css2json(definition.style) : {});
4651			/**
4652			 * The classes to apply to all cells in this column.
4653			 * @type {Array.<string>}
4654			 */
4655			this.classes = F.is.array(definition.classes) ? definition.classes : (F.is.string(definition.classes) ? definition.classes.match(/\S+/g) : []);
4656
4657			// override any default functions ensuring when they are executed "this" within the context of the function points to the instance of this object.
4658			this.parser = F.checkFnValue(this, definition.parser, this.parser);
4659			this.formatter = F.checkFnValue(this, definition.formatter, this.formatter);
4660		},
4661		/**
4662		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
4663		 * @instance
4664		 * @protected
4665		 * @this FooTable.Column
4666		 */
4667		$create: function(){
4668			(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>')).html(this.title).addClass(this.classes.join(' ')).css(this.style);
4669		},
4670		/**
4671		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.Column#format} function
4672		 * to generate the cell contents.
4673		 * @instance
4674		 * @protected
4675		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
4676		 * @returns {string}
4677		 * @this FooTable.Column
4678		 */
4679		parser: function(valueOrElement){
4680			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
4681				var data = $(valueOrElement).data('value');
4682				return F.is.defined(data) ? data : $(valueOrElement).html();
4683			}
4684			if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+''; // use the native toString of the value
4685			return null; // otherwise we have no value so return null
4686		},
4687		/**
4688		 * This is supplied the value retrieved from the {@link FooTable.Column#parse} function and must return a string, HTMLElement or jQuery object.
4689		 * The return value from this function is what is displayed in the cell in the table.
4690		 * @instance
4691		 * @protected
4692		 * @param {string} value - The value to format.
4693		 * @param {object} options - The current plugin options.
4694		 * @param {object} rowData - An object containing the current row data.
4695		 * @returns {(string|HTMLElement|jQuery)}
4696		 * @this FooTable.Column
4697		 */
4698		formatter: function(value, options, rowData){
4699			return value == null ? '' : value;
4700		},
4701		/**
4702		 * Creates a cell for this column from the supplied {@link FooTable.Row} object. This allows different column types to return different types of cells.
4703		 * @instance
4704		 * @protected
4705		 * @param {FooTable.Row} row - The row to create the cell from.
4706		 * @returns {FooTable.Cell}
4707		 * @this FooTable.Column
4708		 */
4709		createCell: function(row){
4710			var element = F.is.jq(row.$el) ? row.$el.children('td,th').get(this.index) : null,
4711				data = F.is.hash(row.value) ? row.value[this.name] : null;
4712			return new F.Cell(this.ft, row, this, element || data);
4713		}
4714	});
4715
4716	F.columns = new F.ClassFactory();
4717
4718	F.columns.register('text', F.Column);
4719
4720})(jQuery, FooTable);
4721(function ($, F) {
4722
4723	F.Component = F.Class.extend(/** @lends FooTable.Component */{
4724		/**
4725		 * The base class for all FooTable components.
4726		 * @constructs
4727		 * @extends FooTable.Class
4728		 * @param {FooTable.Table} instance - The parent {@link FooTable.Table} object for the component.
4729		 * @param {boolean} enabled - Whether or not the component is enabled.
4730		 * @throws {TypeError} The instance parameter must be an instance of {@link FooTable.Table}.
4731		 * @returns {FooTable.Component}
4732		 */
4733		construct: function (instance, enabled) {
4734			if (!(instance instanceof F.Table))
4735				throw new TypeError('The instance parameter must be an instance of FooTable.Table.');
4736
4737			/**
4738			 * The parent {@link FooTable.Table} for the component.
4739			 * @type {FooTable.Table}
4740			 */
4741			this.ft = instance;
4742			/**
4743			 * Whether or not this component is enabled. Disabled components only have there preinit method called allowing for this value to be overridden.
4744			 * @type {boolean}
4745			 */
4746			this.enabled = F.is.boolean(enabled) ? enabled : false;
4747		},
4748		/**
4749		 * The preinit method is called during the parent {@link FooTable.Table} constructor call.
4750		 * @param {object} data - The jQuery.data() object of the root table.
4751		 * @instance
4752		 * @protected
4753		 * @function
4754		 */
4755		preinit: function(data){},
4756		/**
4757		 * The init method is called during the parent {@link FooTable.Table} constructor call.
4758		 * @instance
4759		 * @protected
4760		 * @function
4761		 */
4762		init: function(){},
4763		/**
4764		 * This method is called from the {@link FooTable.Table#destroy} method.
4765		 * @instance
4766		 * @protected
4767		 * @function
4768		 */
4769		destroy: function(){},
4770		/**
4771		 * This method is called from the {@link FooTable.Table#draw} method.
4772		 * @instance
4773		 * @protected
4774		 * @function
4775		 */
4776		predraw: function(){},
4777		/**
4778		 * This method is called from the {@link FooTable.Table#draw} method.
4779		 * @instance
4780		 * @protected
4781		 * @function
4782		 */
4783		draw: function(){},
4784		/**
4785		 * This method is called from the {@link FooTable.Table#draw} method.
4786		 * @instance
4787		 * @protected
4788		 * @function
4789		 */
4790		postdraw: function(){}
4791	});
4792
4793	F.components = new F.ClassFactory();
4794
4795})(jQuery, FooTable);
4796(function ($, F) {
4797	/**
4798	 * Contains all the available options for the FooTable plugin.
4799	 * @name FooTable.Defaults
4800	 * @function
4801	 * @constructor
4802	 * @returns {FooTable.Defaults}
4803	 */
4804	F.Defaults = function () {
4805		/**
4806		 * Whether or not events raised using the {@link FooTable.Table#raise} method are propagated up the DOM. By default this is set to false and all events bubble up the DOM as per usual
4807		 * however the reason for this option is if we have nested tables. If false the parent table would receive all the events raised by it's children and any handlers bound to both the
4808		 * parent and child would be triggered which is not the desired behavior.
4809		 * @type {boolean}
4810		 * @default false
4811		 */
4812		this.stopPropagation = false;
4813		/**
4814		 * An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
4815		 * @type {object.<string, function>}
4816		 * @default NULL
4817		 * @example <caption>
4817This example shows how to pass an object containing the events and handlers.</caption>
4818		 * "on": {
4819		 * 	"click": function(e){
4820		 * 		// bind a custom click event to do something whenever the table is clicked
4821		 * 	},
4822		 * 	"init.ft.table": function(e, ft){
4823		 * 		// bind to the FooTable initialize event to do something
4824		 * 	}
4825		 * }
4826		 */
4827		this.on = null;
4828	};
4829
4830	/**
4831	 * Contains all the default options for the plugin.
4832	 * @type {FooTable.Defaults}
4833	 */
4834	F.defaults = new F.Defaults();
4835
4836})(jQuery, FooTable);
4837(function($, F){
4838
4839	F.Row = F.Class.extend(/** @lends FooTable.Row */{
4840		/**
4841		 * The row class containing all the properties for a row and its' cells.
4842		 * @constructs
4843		 * @extends FooTable.Class
4844		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
4845		 * @param {Array.<FooTable.Column>} columns - The array of {@link FooTable.Column} for this row.
4846		 * @param {(*|HTMLElement|jQuery)} dataOrElement - Either the data for the row (create) or the element (parse) for the row.
4847		 * @returns {FooTable.Row}
4848		 */
4849		construct: function (table, columns, dataOrElement) {
4850			/**
4851			 * The {@link FooTable.Table} for the row.
4852			 * @type {FooTable.Table}
4853			 */
4854			this.ft = table;
4855			/**
4856			 * The array of {@link FooTable.Column} for this row.
4857			 * @type {Array.<FooTable.Column>}
4858			 */
4859			this.columns = columns;
4860
4861			this.created = false;
4862			this.define(dataOrElement);
4863		},
4864		/**
4865		 * This is supplied either the object containing the values for the row or the row element/jQuery object if it exists.
4866		 * If supplied the element we need to set the $el property and parse the cells from it using the column index.
4867		 * If we have an object we parse the cells from it using the column name.
4868		 * @param {(object|jQuery)} dataOrElement - The row object or element to define the row.
4869		 */
4870		define: function(dataOrElement){
4871			/**
4872			 * The jQuery table row object this instance wraps.
4873			 * @instance
4874			 * @protected
4875			 * @type {jQuery}
4876			 */
4877			this.$el = F.is.element(dataOrElement) || F.is.jq(dataOrElement) ? $(dataOrElement) : null;
4878			/**
4879			 * The jQuery toggle element for the row.
4880			 * @instance
4881			 * @protected
4882			 * @type {jQuery}
4883			 */
4884			this.$toggle = $('<span/>', {'class': 'footable-toggle fooicon fooicon-plus'});
4885
4886			var isObj = F.is.hash(dataOrElement),
4887				hasOptions = isObj && F.is.hash(dataOrElement.options) && F.is.hash(dataOrElement.value);
4888
4889			/**
4890			 * The value of the row.
4891			 * @instance
4892			 * @protected
4893			 * @type {Object}
4894			 */
4895			this.value = isObj ? (hasOptions ? dataOrElement.value : dataOrElement) : null;
4896
4897			/**
4898			 * Contains any options for the row.
4899			 * @type {object}
4900			 */
4901			this.o = $.extend(true, {
4902				expanded: false,
4903				classes: null,
4904				style: null
4905			}, hasOptions ? dataOrElement.options : {});
4906
4907			/**
4908			 * Whether or not this row is expanded and will display it's detail row when there are any hidden columns.
4909			 * @instance
4910			 * @protected
4911			 * @type {boolean}
4912			 */
4913			this.expanded = F.is.jq(this.$el) ? (this.$el.data('expanded') || this.o.expanded) : this.o.expanded;
4914			/**
4915			 * An array of CSS classes for the row.
4916			 * @instance
4917			 * @protected
4918			 * @type {Array.<string>}
4919			 */
4920			this.classes = F.is.jq(this.$el) && this.$el.attr('class') ? this.$el.attr('class').match(/\S+/g) : (F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []));
4921			/**
4922			 * The inline styles for the row.
4923			 * @instance
4924			 * @protected
4925			 * @type {object}
4926			 */
4927			this.style = F.is.jq(this.$el) && this.$el.attr('style') ? F.css2json(this.$el.attr('style')) : (F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {}));
4928
4929			/**
4930			 * The cells array. This is populated before the call to the {@link FooTable.Row#$create} method.
4931			 * @instance
4932			 * @type {Array.<FooTable.Cell>}
4933			 */
4934			this.cells = this.createCells();
4935
4936			// this ensures the value contains the parsed cell values and not the supplied values
4937			var self = this;
4938			self.value = {};
4939			F.arr.each(self.cells, function(cell){
4940				self.value[cell.column.name] = cell.val();
4941			});
4942		},
4943		/**
4944		 * After the row has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
4945		 * @instance
4946		 * @protected
4947		 * @this FooTable.Row
4948		 */
4949		$create: function(){
4950			if (this.created) return;
4951			(this.$el = F.is.jq(this.$el) ? this.$el : $('<tr/>'))
4952				.data('__FooTableRow__', this);
4953
4954			this._setClasses(this.$el);
4955			this._setStyle(this.$el);
4956
4957			if (this.ft.rows.toggleColumn == 'last') this.$toggle.addClass('last-column');
4958
4959			this.$details = $('<tr/>', { 'class': 'footable-detail-row' })
4960				.append($('<td/>', { colspan: this.ft.columns.visibleColspan })
4961					.append($('<table/>', { 'class': 'footable-details ' + this.ft.classes.join(' ') })
4962						.append('<tbody/>')));
4963
4964			var self = this;
4965			F.arr.each(self.cells, function(cell){
4966				if (!cell.created) cell.$create();
4967				self.$el.append(cell.$el);
4968			});
4969			self.$el.off('click.ft.row').on('click.ft.row', { self: self }, self._onToggle);
4970			this.created = true;
4971		},
4972		/**
4973		 * This is called during the construct method and uses the current column definitions to create an array of {@link FooTable.Cell} objects for the row.
4974		 * @instance
4975		 * @protected
4976		 * @returns {Array.<FooTable.Cell>}
4977		 * @this FooTable.Row
4978		 */
4979		createCells: function(){
4980			var self = this;
4981			return F.arr.map(self.columns, function(col){
4982				return col.createCell(self);
4983			});
4984		},
4985		/**
4986		 * Allows easy access to getting or setting the row's data. If the data is set all associated properties are also updated along with the actual element.
4987		 * Using this method also allows us to supply an object containing options and the data for the row at the same time.
4988		 * @instance
4989		 * @param {object} [data] - The data to set for the row. If not supplied the current value of the row is returned.
4990		 * @param {boolean} [redraw=true] - Whether or not to redraw the table once the value has been set.
4991		 * @param {boolean} [redrawSelf=true] - Whether or not to redraw the row itself once the value has been set, if `false` this will override the supplied `redraw` value and prevent the table from redrawing as well.
4992		 * @returns {(*|undefined)}
4993		 */
4994		val: function(data, redraw, redrawSelf){
4995			var self = this;
4996			if (!F.is.hash(data)){
4997				// get - check the value property and build it from the cells if required.
4998				if (!F.is.hash(this.value) || F.is.emptyObject(this.value)){
4999					this.value = {};
5000					F.arr.each(this.cells, function(cell){
5001						if (!cell.column.internal){
5002							self.value[cell.column.name] = cell.val();
5003						}
5004					});
5005				}
5006				return this.value;
5007			}
5008			// set
5009			this.collapse(false);
5010			var isObj = F.is.hash(data),
5011				hasOptions = isObj && F.is.hash(data.options) && F.is.hash(data.value);
5012
5013			this.o = $.extend(true, {
5014				expanded: self.expanded,
5015				classes: self.classes,
5016				style: self.style
5017			}, hasOptions ? data.options : {});
5018
5019			this.expanded = this.o.expanded;
5020			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
5021			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});
5022			if (isObj) {
5023				if ( hasOptions ) data = data.value;
5024				if (F.is.hash(this.value)){
5025					for (var prop in data) {
5026						if (!data.hasOwnProperty(prop)) continue;
5027						this.value[prop] = data[prop];
5028					}
5029				} else {
5030					this.value = data;
5031				}
5032			} else {
5033				this.value = null;
5034			}
5035
5036			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
5037			F.arr.each(this.cells, function(cell){
5038				if (!cell.column.internal && F.is.defined(self.value[cell.column.name])){
5039					cell.val(self.value[cell.column.name], false, redrawSelf);
5040				}
5041			});
5042
5043			if (this.created && redrawSelf){
5044				this._setClasses(this.$el);
5045				this._setStyle(this.$el);
5046				if (F.is.boolean(redraw) ? redraw : true) this.draw();
5047			}
5048		},
5049		_setClasses: function($el){
5050			var hasClasses = !F.is.emptyArray(this.classes),
5051				classes = null;
5052			$el.removeAttr('class');
5053			if (!hasClasses) return;
5054			else classes = this.classes.join(' ');
5055			if (!F.is.emptyString(classes)){
5056				$el.addClass(classes);
5057			}
5058		},
5059		_setStyle: function($el){
5060			var hasStyle = !F.is.emptyObject(this.style),
5061				style = null;
5062			$el.removeAttr('style');
5063			if (!hasStyle) return;
5064			else style = this.style;
5065			if (F.is.hash(style)){
5066				$el.css(style);
5067			}
5068		},
5069		/**
5070		 * Sets the current row to an expanded state displaying any hidden columns in a detail row just below it.
5071		 * @instance
5072		 * @fires FooTable.Row#"expand.ft.row"
5073		 */
5074		expand: function(){
5075			if (!this.created) return;
5076			var self = this;
5077			/**
5078			 * The expand.ft.row event is raised before the the row is expanded.
5079			 * Calling preventDefault on this event will stop the row being expanded.
5080			 * @event FooTable.Row#"expand.ft.row"
5081			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5082			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5083			 * @param {FooTable.Row} row - The row about to be expanded.
5084			 */
5085			self.ft.raise('expand.ft.row',[self]).then(function(){
5086				self.__hidden__ = F.arr.map(self.cells, function(cell){
5087					return cell.column.hidden && cell.column.visible ? cell : null;
5088				});
5089
5090				if (self.__hidden__.length > 0){
5091					self.$details.insertAfter(self.$el)
5092						.children('td').first()
5093						.attr('colspan', self.ft.columns.visibleColspan);
5094
5095					F.arr.each(self.__hidden__, function(cell){
5096						cell.collapse();
5097					});
5098				}
5099				self.$el.attr('data-expanded', true);
5100				self.$toggle.removeClass('fooicon-plus').addClass('fooicon-minus');
5101				self.expanded = true;
5102				self.ft.raise('expanded.ft.row', [self]);
5103			});
5104		},
5105		/**
5106		 * Sets the current row to a collapsed state removing the detail row if it exists.
5107		 * @instance
5108		 * @param {boolean} [setExpanded] - Whether or not to set the {@link FooTable.Row#expanded} property to false.
5109		 * @fires FooTable.Row#"collapse.ft.row"
5110		 */
5111		collapse: function(setExpanded){
5112			if (!this.created) return;
5113			var self = this;
5114			/**
5115			 * The collapse.ft.row event is raised before the the row is collapsed.
5116			 * Calling preventDefault on this event will stop the row being collapsed.
5117			 * @event FooTable.Row#"collapse.ft.row"
5118			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5119			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5120			 * @param {FooTable.Row} row - The row about to be expanded.
5121			 */
5122			self.ft.raise('collapse.ft.row',[self]).then(function(){
5123				F.arr.each(self.__hidden__, function(cell){
5124					cell.restore();
5125				});
5126				self.$details.detach();
5127				self.$el.removeAttr('data-expanded');
5128				self.$toggle.removeClass('fooicon-minus').addClass('fooicon-plus');
5129				if (F.is.boolean(setExpanded) ? setExpanded : true) self.expanded = false;
5130				self.ft.raise('collapsed.ft.row', [self]);
5131			});
5132		},
5133		/**
5134		 * Prior to drawing this moves the details contents back to there original cells and detaches the toggle element from the row.
5135		 * @instance
5136		 * @param {boolean} [detach] - Whether or not to detach the row.
5137		 * @this FooTable.Row
5138		 */
5139		predraw: function(detach){
5140			if (this.created){
5141				if (this.expanded){
5142					this.collapse(false);
5143				}
5144				this.$toggle.detach();
5145				detach = F.is.boolean(detach) ? detach : true;
5146				if (detach) this.$el.detach();
5147			}
5148		},
5149		/**
5150		 * Draws the current row and cells.
5151		 * @instance
5152		 * @this FooTable.Row
5153		 */
5154		draw: function($parent){
5155			if (!this.created) this.$create();
5156			if (F.is.jq($parent)) $parent.append(this.$el);
5157			var self = this;
5158			F.arr.each(self.cells, function(cell){
5159				cell.$el.css('display', (cell.column.hidden || !cell.column.visible  ? 'none' : 'table-cell'));
5160				if (self.ft.rows.showToggle && self.ft.columns.hasHidden){
5161					if ((self.ft.rows.toggleColumn == 'first' && cell.column.index == self.ft.columns.firstVisibleIndex)
5162						|| (self.ft.rows.toggleColumn == 'last' && cell.column.index == self.ft.columns.lastVisibleIndex)) {
5163						cell.$el.prepend(self.$toggle);
5164					}
5165				}
5166				cell.$el.add(cell.column.$el).removeClass('footable-first-visible footable-last-visible');
5167				if (cell.column.index == self.ft.columns.firstVisibleIndex){
5168					cell.$el.add(cell.column.$el).addClass('footable-first-visible');
5169				}
5170				if (cell.column.index == self.ft.columns.lastVisibleIndex){
5171					cell.$el.add(cell.column.$el).addClass('footable-last-visible');
5172				}
5173			});
5174			if (this.expanded){
5175				this.expand();
5176			}
5177		},
5178		/**
5179		 * Toggles the row between it's expanded and collapsed state if there are hidden columns.
5180		 * @instance
5181		 * @this FooTable.Row
5182		 */
5183		toggle: function(){
5184			if (this.created && this.ft.columns.hasHidden){
5185				if (this.expanded) this.collapse();
5186				else this.expand();
5187			}
5188		},
5189		/**
5190		 * Handles the toggle click event for rows.
5191		 * @instance
5192		 * @param {jQuery.Event} e - The jQuery.Event object for the click event.
5193		 * @private
5194		 * @this jQuery
5195		 */
5196		_onToggle: function (e) {
5197			var self = e.data.self;
5198			// only execute the toggle if the event.target is one of the approved initiators
5199			if ($(e.target).is(self.ft.rows.toggleSelector)){
5200				self.toggle();
5201			}
5202		}
5203	});
5204
5205})(jQuery, FooTable);
5206
5207(function ($, F) {
5208
5209	/**
5210	 * An array of all currently loaded instances of the plugin.
5211	 * @protected
5212	 * @readonly
5213	 * @type {Array.<FooTable.Table>}
5214	 */
5215	F.instances = [];
5216
5217	F.Table = F.Class.extend(/** @lends FooTable.Table */{
5218		/**
5219		 * This class is the core of the plugin and drives the logic of all components.
5220		 * @constructs
5221		 * @this FooTable.Table
5222		 * @extends FooTable.Class
5223		 * @param {(HTMLTableElement|jQuery)} element - The element or jQuery table object to bind the plugin to.
5224		 * @param {object} options - The options to initialize the plugin with.
5225		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
5226		 * @returns {FooTable.Table}
5227		 */
5228		construct: function (element, options, ready) {
5229			//BEGIN MEMBERS
5230			/**
5231			 * The timeout ID for the resize event.
5232			 * @instance
5233			 * @private
5234			 * @type {?number}
5235			 */
5236			this._resizeTimeout = null;
5237			/**
5238			 * The ID of the FooTable instance.
5239			 * @instance
5240			 * @type {number}
5241			 */
5242			this.id = F.instances.push(this);
5243			/**
5244			 * Whether or not the plugin and all components and add-ons are fully initialized.
5245			 * @instance
5246			 * @type {boolean}
5247			 */
5248			this.initialized = false;
5249			/**
5250			 * The jQuery table object the plugin is bound to.
5251			 * @instance
5252			 * @type {jQuery}
5253			 */
5254			this.$el = (F.is.jq(element) ? element : $(element)).first(); // ensure one table, one instance
5255			/**
5256			 * A loader jQuery instance
5257			 * @instance
5258			 * @type {jQuery}
5259			 */
5260			this.$loader = $('<div/>', { 'class': 'footable-loader' }).append($('<span/>', {'class': 'fooicon fooicon-loader'}));
5261			/**
5262			 * The options for the plugin. This is a merge of user defined options and the default options.
5263			 * @instance
5264			 * @type {object}
5265			 */
5266			this.o = $.extend(true, {}, F.defaults, options);
5267			/**
5268			 * The jQuery data object for the table at initialization.
5269			 * @instance
5270			 * @type {object}
5271			 */
5272			this.data = this.$el.data() || {};
5273			/**
5274			 * An array of all CSS classes on the table that do not start with "footable".
5275			 * @instance
5276			 * @protected
5277			 * @type {Array.<string>}
5278			 */
5279			this.classes = [];
5280			/**
5281			 * All components for this instance of the plugin. These are executed in the order they appear in the array for the initialize phase and in reverse order for the destroy phase of the plugin.
5282			 * @instance
5283			 * @protected
5284			 * @type {object}
5285			 * @prop {Array.<FooTable.Component>} internal - The internal components for the plugin. These are executed either before all other components in the initialize phase or after them in the destroy phase of the plugin.
5286			 * @prop {Array.<FooTable.Component>} core - The core components for the plugin. These are executed either after the internal components in the initialize phase or before them in the destroy phase of the plugin.
5287			 * @prop {Array.<FooTable.Component>} custom - The custom components for the plugin. These are executed either after the core components in the initialize phase or before them in the destroy phase of the plugin.
5288			 */
5289			this.components = F.components.load((F.is.hash(this.data.components) ? this.data.components : this.o.components), this);
5290			/**
5291			 * The breakpoints component for this instance of the plugin.
5292			 * @instance
5293			 * @type {FooTable.Breakpoints}
5294			 */
5295			this.breakpoints = this.use(FooTable.Breakpoints);
5296			/**
5297			 * The columns component for this instance of the plugin.
5298			 * @instance
5299			 * @type {FooTable.Columns}
5300			 */
5301			this.columns = this.use(FooTable.Columns);
5302			/**
5303			 * The rows component for this instance of the plugin.
5304			 * @instance
5305			 * @type {FooTable.Rows}
5306			 */
5307			this.rows = this.use(FooTable.Rows);
5308
5309			//END MEMBERS
5310			this._construct(ready);
5311		},
5312		/**
5313		 * Once all properties are set this performs the actual initialization of the plugin calling the {@link FooTable.Table#_preinit} and
5314		 * {@link FooTable.Table#_init} methods as well as raising the {@link FooTable.Table#"ready.ft.table"} event.
5315		 * @this FooTable.Table
5316		 * @instance
5317		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
5318		 * @private
5319		 * @returns {jQuery.Promise}
5320		 * @fires FooTable.Table#"ready.ft.table"
5321		 */
5322		_construct: function(ready){
5323			var self = this;
5324			return this._preinit().then(function(){
5325				return self._init().then(function(){
5326					/**
5327					 * The ready.ft.table event is raised after the plugin has been initialized and the table drawn.
5328					 * Calling preventDefault on this event will stop the ready callback being executed.
5329					 * @event FooTable.Table#"ready.ft.table"
5330					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5331					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5332					 */
5333					return self.raise('ready.ft.table').then(function(){
5334						if (F.is.fn(ready)) ready.call(self, self);
5335					});
5336				});
5337			}).always(function(arg){
5338				self.$el.show();
5339				if (F.is.error(arg)){
5340					console.error('FooTable: unhandled error thrown during initialization.', arg);
5341				}
5342			});
5343		},
5344		/**
5345		 * The preinit method is called prior to the plugins actual initialization and provides itself and it's components an opportunity to parse any additional option values.
5346		 * @instance
5347		 * @private
5348		 * @returns {jQuery.Promise}
5349		 * @fires FooTable.Table#"preinit.ft.table"
5350		 */
5351		_preinit: function(){
5352			var self = this;
5353			/**
5354			 * The preinit.ft.table event is raised before any components.
5355			 * Calling preventDefault on this event will disable the entire plugin.
5356			 * @event FooTable.Table#"preinit.ft.table"
5357			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5358			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5359			 * @param {object} data - The jQuery data object from the root table element.
5360			 */
5361			return this.raise('preinit.ft.table', [self.data]).then(function(){
5362				var classes = (self.$el.attr('class') || '').match(/\S+/g) || [];
5363
5364				self.o.ajax = F.checkFnValue(self, self.data.ajax, self.o.ajax);
5365				self.o.stopPropagation = F.is.boolean(self.data.stopPropagation)
5366					? self.data.stopPropagation
5367					: self.o.stopPropagation;
5368
5369				for (var i = 0, len = classes.length; i < len; i++){
5370					if (!F.str.startsWith(classes[i], 'footable')) self.classes.push(classes[i]);
5371				}
5372
5373				self.$el.hide().after(self.$loader);
5374				return self.execute(false, false, 'preinit', self.data);
5375			});
5376		},
5377		/**
5378		 * Initializes this instance of the plugin and calls the callback function if one is supplied once complete.
5379		 * @this FooTable.Table
5380		 * @instance
5381		 * @private
5382		 * @return {jQuery.Promise}
5383		 * @fires FooTable.Table#"init.ft.table"
5384		 */
5385		_init: function(){
5386			var self = this;
5387			/**
5388			 * The init.ft.table event is raised before any components are initialized.
5389			 * Calling preventDefault on this event will disable the entire plugin.
5390			 * @event FooTable.Table#"init.ft.table"
5391			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5392			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5393			 */
5394			return self.raise('init.ft.table').then(function(){
5395				var $thead = self.$el.children('thead'),
5396					$tbody = self.$el.children('tbody'),
5397					$tfoot = self.$el.children('tfoot');
5398				self.$el.addClass('footable footable-' + self.id);
5399				if (F.is.hash(self.o.on)) self.$el.on(self.o.on);
5400				if ($tfoot.length == 0) self.$el.append($tfoot = $('<tfoot/>'));
5401				if ($tbody.length == 0) self.$el.append('<tbody/>');
5402				if ($thead.length == 0) self.$el.prepend($thead = $('<thead/>'));
5403				return self.execute(false, true, 'init').then(function(){
5404					self.$el.data('__FooTable__', self);
5405					if ($tfoot.children('tr').length == 0) $tfoot.remove();
5406					if ($thead.children('tr').length == 0) $thead.remove();
5407
5408					/**
5409					 * The postinit.ft.table event is raised after any components are initialized but before the table is
5410					 * drawn for the first time.
5411					 * Calling preventDefault on this event will disable the initial drawing of the table.
5412					 * @event FooTable.Table#"postinit.ft.table"
5413					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5414					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5415					 */
5416					return self.raise('postinit.ft.table').then(function(){
5417						return self.draw();
5418					}).always(function(){
5419						$(window).off('resize.ft'+self.id, self._onWindowResize)
5420							.on('resize.ft'+self.id, { self: self }, self._onWindowResize);
5421						self.initialized = true;
5422					});
5423				});
5424			});
5425		},
5426		/**
5427		 * Destroys this plugin removing it from the table.
5428		 * @this FooTable.Table
5429		 * @instance
5430		 * @fires FooTable.Table#"destroy.ft.table"
5431		 */
5432		destroy: function () {
5433			var self = this;
5434			/**
5435			 * The destroy.ft.table event is called before all core components.
5436			 * Calling preventDefault on this event will prevent the entire plugin from being destroyed.
5437			 * @event FooTable.Table#"destroy.ft.table"
5438			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5439			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5440			 */
5441			return self.raise('destroy.ft.table').then(function(){
5442				return self.execute(true, true, 'destroy').then(function () {
5443					self.$el.removeData('__FooTable__').removeClass('footable-' + self.id);
5444					if (F.is.hash(self.o.on)) self.$el.off(self.o.on);
5445					$(window).off('resize.ft'+self.id, self._onWindowResize);
5446					self.initialized = false;
5447					F.instances[self.id] = null;
5448				});
5449			}).fail(function(err){
5450				if (F.is.error(err)){
5451					console.error('FooTable: unhandled error thrown while destroying the plugin.', err);
5452				}
5453			});
5454		},
5455		/**
5456		 * Raises an event on this instance supplying the args array as additional parameters to the handlers.
5457		 * @this FooTable.Table
5458		 * @instance
5459		 * @param {string} eventName - The name of the event to raise, this can include namespaces.
5460		 * @param {Array} [args] - An array containing additional parameters to be passed to any boun
5460d handlers.
5461		 * @returns {jQuery.Event}
5462		 */
5463		raise: function(eventName, args){
5464			var self = this,
5465				debug = F.__debug__ && (F.is.emptyArray(F.__debug_options__.events) || F.arr.any(F.__debug_options__.events, function(name){ return F.str.contains(eventName, name); }));
5466			args = args || [];
5467			args.unshift(this);
5468			return $.Deferred(function(d){
5469				var evt = $.Event(eventName);
5470				if (self.o.stopPropagation == true){
5471					self.$el.one(eventName, function (e) {e.stopPropagation();});
5472				}
5473				if (debug) console.log('FooTable:'+eventName+': ', args);
5474				self.$el.trigger(evt, args);
5475				if (evt.isDefaultPrevented()){
5476					if (debug) console.log('FooTable: default prevented for the "'+eventName+'" event.');
5477					d.reject(evt);
5478				}	else d.resolve(evt);
5479			});
5480		},
5481		/**
5482		 * Attempts to retrieve the instance of the supplied component type for this instance.
5483		 * @this FooTable.Table
5484		 * @instance
5485		 * @param {object} type - The content type to retrieve for this instance.
5486		 * @returns {(*|null)}
5487		 */
5488		use: function(type){
5489			for (var i = 0, len = this.components.length; i < len; i++){
5490				if (this.components[i] instanceof type) return this.components[i];
5491			}
5492			return null;
5493		},
5494		/**
5495		 * Performs the drawing of the table.
5496		 * @this FooTable.Table
5497		 * @instance
5498		 * @protected
5499		 * @returns {jQuery.Promise}
5500		 * @fires FooTable.Table#"predraw.ft.table"
5501		 * @fires FooTable.Table#"draw.ft.table"
5502		 * @fires FooTable.Table#"postdraw.ft.table"
5503		 */
5504		draw: function () {
5505			var self = this;
5506
5507			// Clone the current table and insert it into the original's place
5508			var $elCopy = self.$el.clone().insertBefore(self.$el);
5509
5510			// Detach `self.$el` from the DOM, retaining its event handlers
5511			self.$el.detach();
5512
5513			// when drawing the order that the components are executed is important so chain the methods but use promises to retain async safety.
5514			return self.execute(false, true, 'predraw').then(function(){
5515				/**
5516				 * The predraw.ft.table event is raised after all core components and add-ons have executed there predraw functions but before they execute there draw functions.
5517				 * @event FooTable.Table#"predraw.ft.table"
5518				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5519				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5520				 */
5521				return self.raise('predraw.ft.table').then(function(){
5522					return self.execute(false, true, 'draw').then(function(){
5523						/**
5524						 * The draw.ft.table event is raised after all core components and add-ons have executed there draw functions.
5525						 * @event FooTable.Table#"draw.ft.table"
5526						 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5527						 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5528						 */
5529						return self.raise('draw.ft.table').then(function(){
5530							return self.execute(false, true, 'postdraw').then(function(){
5531								/**
5532								 * The postdraw.ft.table event is raised after all core components and add-ons have executed there postdraw functions.
5533								 * @event FooTable.Table#"postdraw.ft.table"
5534								 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5535								 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5536								 */
5537								return self.raise('postdraw.ft.table');
5538							});
5539						});
5540					});
5541				});
5542			}).fail(function(err){
5543				if (F.is.error(err)){
5544					console.error('FooTable: unhandled error thrown during a draw operation.', err);
5545				}
5546			}).always(function(){
5547				// Replace the copy that we added above with the modified `self.$el`
5548				$elCopy.replaceWith(self.$el);
5549				self.$loader.remove();
5550			});
5551		},
5552		/**
5553		 * Executes the specified method with the optional number of parameters on all components and waits for the promise from each to be resolved before executing the next.
5554		 * @this FooTable.Table
5555		 * @instance
5556		 * @protected
5557		 * @param {boolean} reverse - Whether or not to execute the component methods in the reverse order to what they were registered in.
5558		 * @param {boolean} enabled - Whether or not to execute the method on enabled components only.
5559		 * @param {string} methodName - The name of the method to execute.
5560		 * @param {*} [param1] - The first parameter for the method.
5561		 * @param {...*} [paramN] - Any number of additional parameters for the method.
5562		 * @returns {jQuery.Promise}
5563		 */
5564		execute: function(reverse, enabled, methodName, param1, paramN){
5565			var self = this, args = Array.prototype.slice.call(arguments);
5566			reverse = args.shift();
5567			enabled = args.shift();
5568			var components = enabled ? F.arr.get(self.components, function(c){ return c.enabled; }) : self.components.slice(0);
5569			args.unshift(reverse ? components.reverse() : components);
5570			return self._execute.apply(self, args);
5571		},
5572		/**
5573		 * Executes the specified method with the optional number of parameters on all supplied components waiting for the result of each before executing the next.
5574		 * @this FooTable.Table
5575		 * @instance
5576		 * @private
5577		 * @param {Array.<FooTable.Component>} components - The components to call the method on.
5578		 * @param {string} methodName - The name of the method to execute
5579		 * @param {*} [param1] - The first parameter for the method.
5580		 * @param {...*} [paramN] - Any additional parameters for the method.
5581		 * @returns {jQuery.Promise}
5582		 */
5583		_execute: function(components, methodName, param1, paramN){
5584			if (!components || !components.length) return $.when();
5585			var self = this, args = Array.prototype.slice.call(arguments),
5586				component;
5587			components = args.shift();
5588			methodName = args.shift();
5589			component = components.shift();
5590
5591			if (!F.is.fn(component[methodName]))
5592				return self._execute.apply(self, [components, methodName].concat(args));
5593
5594			return $.Deferred(function(d){
5595				try {
5596					var result = component[methodName].apply(component, args);
5597					if (F.is.promise(result)){
5598						return result.then(d.resolve, d.reject);
5599					} else {
5600						d.resolve(result);
5601					}
5602				} catch (err) {
5603					d.reject(err);
5604				}
5605			}).then(function(){
5606				return self._execute.apply(self, [components, methodName].concat(args));
5607			});
5608		},
5609		/**
5610		 * Listens to the window resize event and performs a check to see if the breakpoint has changed.
5611		 * @this window
5612		 * @instance
5613		 * @private
5614		 * @fires FooTable.Table#"resize.ft.table"
5615		 */
5616		_onWindowResize: function (e) {
5617			var self = e.data.self;
5618			if (self._resizeTimeout != null) { clearTimeout(self._resizeTimeout); }
5619			self._resizeTimeout = setTimeout(function () {
5620				self._resizeTimeout = null;
5621				/**
5622				 * The resize event is raised a short time after window resize operations cease.
5623				 * @event FooTable.Table#"resize.ft.table"
5624				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
5625				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
5626				 */
5627				self.raise('resize.ft.table').then(function(){
5628					self.breakpoints.check();
5629				});
5630			}, 300);
5631		}
5632	});
5633
5634})(jQuery, FooTable);
5635(function($, F){
5636
5637	F.ArrayColumn = F.Column.extend(/** @lends FooTable.ArrayColumn */{
5638		/**
5639		 * @summary A column to handle Array values.
5640		 * @constructs
5641		 * @extends FooTable.Column
5642		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
5643		 * @param {object} definition - An object containing all the properties to set for the column.
5644		 */
5645		construct: function(instance, definition) {
5646			this._super(instance, definition, 'array');
5647		},
5648		/**
5649		 * @summary Parses the supplied value or element to retrieve a column value.
5650		 * @description This is supplied either the cell value or jQuery object to parse. This method will return either the Array containing the values or null.
5651		 * @instance
5652		 * @protected
5653		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
5654		 * @returns {(array|null)}
5655		 */
5656		parser: function(valueOrElement){
5657			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
5658				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an array
5659				if (F.is.array(data)) return data;
5660				data = $el.html();
5661				try {
5662					data = JSON.parse(data);
5663				} catch(err) {
5664					data = null;
5665				}
5666				return F.is.array(data) ? data : null; // if we have an array return it
5667			}
5668			if (F.is.array(valueOrElement)) return valueOrElement; // if we have an array return it
5669			return null; // otherwise we have no value so return null
5670		},
5671		/**
5672		 * @summary Formats the column value and creates the HTML seen within a cell.
5673		 * @description This is supplied the value retrieved from the {@link FooTable.ArrayColumn#parser} function and must return a string, HTMLElement or jQuery object.
5674		 * The return value from this function is what is displayed in the cell in the table.
5675		 * @instance
5676		 * @protected
5677		 * @param {?Array} value - The value to format.
5678		 * @param {object} options - The current plugin options.
5679		 * @param {object} rowData - An object containing the current row data.
5680		 * @returns {(string|HTMLElement|jQuery)}
5681		 */
5682		formatter: function(value, options, rowData){
5683			return F.is.array(value) ? JSON.stringify(value) : '';
5684		}
5685	});
5686
5687	F.columns.register('array', F.ArrayColumn);
5688
5689})(jQuery, FooTable);
5690(function($, F){
5691
5692	if (F.is.undef(window.moment)){
5693		// The DateColumn requires moment.js to parse and format date values. Goto http://momentjs.com/ to get it.
5694		return;
5695	}
5696
5697	F.DateColumn = F.Column.extend(/** @lends FooTable.DateColumn */{
5698		/**
5699		 * The date column class is used to handle date values. This column is dependent on [moment.js]{@link http://momentjs.com/} to provide date parsing and formatting functionality.
5700		 * @constructs
5701		 * @extends FooTable.Column
5702		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
5703		 * @param {object}
5703 definition - An object containing all the properties to set for the column.
5704		 * @returns {FooTable.DateColumn}
5705		 */
5706		construct: function(instance, definition){
5707			this._super(instance, definition, 'date');
5708			/**
5709			 * The format string to use when parsing and formatting dates.
5710			 * @instance
5711			 * @type {string}
5712			 */
5713			this.formatString = F.is.string(definition.formatString) ? definition.formatString : 'MM-DD-YYYY';
5714		},
5715		/**
5716		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.DateColumn#format} function
5717		 * to generate the cell contents.
5718		 * @instance
5719		 * @protected
5720		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
5721		 * @returns {(moment|null)}
5722		 * @this FooTable.DateColumn
5723		 */
5724		parser: function(valueOrElement){
5725			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
5726				var data = $(valueOrElement).data('value');
5727				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text();
5728				if (F.is.string(valueOrElement)) valueOrElement = isNaN(valueOrElement) ? valueOrElement : +valueOrElement;
5729			}
5730			if (F.is.date(valueOrElement)) return moment(valueOrElement);
5731			if (F.is.object(valueOrElement) && F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement;
5732			if (F.is.string(valueOrElement)){
5733				// if it looks like a number convert it and do nothing else otherwise create a new moment using the string value and formatString
5734				if (isNaN(valueOrElement)){
5735					return moment(valueOrElement, this.formatString);
5736				} else {
5737					valueOrElement = +valueOrElement;
5738				}
5739			}
5740			if (F.is.number(valueOrElement)){
5741				return moment(valueOrElement);
5742			}
5743			return null;
5744		},
5745		/**
5746		 * This is supplied the value retrieved from the {@link FooTable.DateColumn#parser} function and must return a string, HTMLElement or jQuery object.
5747		 * The return value from this function is what is displayed in the cell in the table.
5748		 * @instance
5749		 * @protected
5750		 * @param {*} value - The value to format.
5751		 * @param {object} options - The current plugin options.
5752		 * @param {object} rowData - An object containing the current row data.
5753		 * @returns {(string|HTMLElement|jQuery)}
5754		 * @this FooTable.DateColumn
5755		 */
5756		formatter: function(value, options, rowData){
5757			return F.is.object(value) && F.is.boolean(value._isAMomentObject) && value.isValid() ? value.format(this.formatString) : '';
5758		},
5759		/**
5760		 * This is supplied either the cell value or jQuery object to parse. A string value must be returned from this method and will be used during filtering operations.
5761		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
5762		 * @returns {string}
5763		 * @this FooTable.DateColumn
5764		 */
5765		filterValue: function(valueOrElement){
5766			// if we have an element or a jQuery object use jQuery to get the value
5767			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)) valueOrElement = $(valueOrElement).data('filterValue') || $(valueOrElement).text();
5768			// if options are supplied with the value
5769			if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
5770				if (F.is.string(valueOrElement.options.filterValue)) valueOrElement = valueOrElement.options.filterValue;
5771				if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
5772			}
5773			// if the value is a moment object just return the formatted value
5774			if (F.is.object(valueOrElement) && F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement.format(this.formatString);
5775			// if its a string
5776			if (F.is.string(valueOrElement)){
5777				// if its not a number return it
5778				if (isNaN(valueOrElement)){
5779					return valueOrElement;
5780				} else { // otherwise convert it and carry on
5781					valueOrElement = +valueOrElement;
5782				}
5783			}
5784			// if the value is a number or date convert to a moment object and return the formatted result.
5785			if (F.is.number(valueOrElement) || F.is.date(valueOrElement)){
5786				return moment(valueOrElement).format(this.formatString);
5787			}
5788			// try use the native toString of the value if its not undefined or null
5789			if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+'';
5790			return ''; // otherwise we have no value so return an empty string
5791		}
5792	});
5793
5794	F.columns.register('date', F.DateColumn);
5795
5796})(jQuery, FooTable);
5797
5798(function($, F){
5799
5800	F.HTMLColumn = F.Column.extend(/** @lends FooTable.HTMLColumn */{
5801		/**
5802		 * The HTML column class is used to handle any raw HTML columns.
5803		 * @constructs
5804		 * @extends FooTable.Column
5805		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
5806		 * @param {object}
5806 definition - An object containing all the properties to set for the column.
5807		 * @returns {FooTable.HTMLColumn}
5808		 */
5809		construct: function(instance, definition){
5810			this._super(instance, definition, 'html');
5811		},
5812		/**
5813		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.HTMLColumn#format} function
5814		 * to generate the cell contents.
5815		 * @instance
5816		 * @protected
5817		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
5818		 * @returns {(jQuery|null)}
5819		 * @this FooTable.HTMLColumn
5820		 */
5821		parser: function(valueOrElement){
5822			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
5823			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
5824			if (F.is.jq(valueOrElement)){
5825				var tagName = valueOrElement.prop('tagName').toLowerCase();
5826				if (tagName == 'td' || tagName == 'th'){
5827					var data = valueOrElement.data('value');
5828					return F.is.defined(data) ? data : valueOrElement.contents();
5829				}
5830				return valueOrElement;
5831			}
5832			return null;
5833		}
5834	});
5835
5836	F.columns.register('html', F.HTMLColumn);
5837
5838})(jQuery, FooTable);
5839(function($, F){
5840
5841	F.NumberColumn = F.Column.extend(/** @lends FooTable.NumberColumn */{
5842		/**
5843		 * The number column class is used to handle simple number columns.
5844		 * @constructs
5845		 * @extends FooTable.Column
5846		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
5847		 * @param {object} definition - An object containing all the properties to set for the column.
5848		 * @returns {FooTable.NumberColumn}
5849		 */
5850		construct: function(instance, definition){
5851			this._super(instance, definition, 'number');
5852			this.decimalSeparator = F.is.string(definition.decimalSeparator) ? definition.decimalSeparator : '.';
5853			this.thousandSeparator = F.is.string(definition.thousandSeparator) ? definition.thousandSeparator : ',';
5854			this.decimalSeparatorRegex = new RegExp(F.str.escapeRegExp(this.decimalSeparator), 'g');
5855			this.thousandSeparatorRegex = new RegExp(F.str.escapeRegExp(this.thousandSeparator), 'g');
5856			this.cleanRegex = new RegExp('[^\-0-9' + F.str.escapeRegExp(this.decimalSeparator) + ']', 'g');
5857		},
5858		/**
5859		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.Column#formatter} function
5860		 * to generate the cell contents.
5861		 * @instance
5862		 * @protected
5863		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
5864		 * @returns {(number|null)}
5865		 * @this FooTable.NumberColumn
5866		 */
5867		parser: function(valueOrElement){
5868			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
5869				var data = $(valueOrElement).data('value');
5870				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text().replace(this.cleanRegex, '');
5871			}
5872			if (F.is.string(valueOrElement)){
5873				valueOrElement = valueOrElement.replace(this.thousandSeparatorRegex, '').replace(this.decimalSeparatorRegex, '.');
5874				valueOrElement = parseFloat(valueOrElement);
5875			}
5876			if (F.is.number(valueOrElement)) return valueOrElement;
5877			return null;
5878		},
5879		/**
5880		 * This is supplied the value retrieved from the {@link FooTable.NumberColumn#parse} function and must return a string, HTMLElement or jQuery object.
5881		 * The return value from this function is what is displayed in the cell in the table.
5882		 * @instance
5883		 * @protected
5884		 * @param {number} value - The value to format.
5885		 * @param {object} options - The current plugin options.
5886		 * @param {object} rowData - An object containing the current row data.
5887		 * @returns {(string|HTMLElement|jQuery)}
5888		 * @this FooTable.NumberColumn
5889		 */
5890		formatter: function(value, options, rowData){
5891			if (value == null) return '';
5892			var s = (value + '').split('.');
5893			if (s.length == 2 && s[0].length > 3) {
5894				s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, this.thousandSeparator);
5895			}
5896			return s.join(this.decimalSeparator);
5897		}
5898	});
5899
5900	F.columns.register('number', F.NumberColumn);
5901
5902})(jQuery, FooTable);
5903(function($, F){
5904
5905	F.ObjectColumn = F.Column.extend(/** @lends FooTable.ObjectColumn */{
5906		/**
5907		 * @summary A column to handle Object values.
5908		 * @constructs
5909		 * @extends FooTable.Column
5910		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
5911		 * @param {object}
5911 definition - An object containing all the properties to set for the column.
5912		 */
5913		construct: function(instance, definition) {
5914			this._super(instance, definition, 'object');
5915		},
5916		/**
5917		 * @summary Parses the supplied value or element to retrieve a column value.
5918		 * @description This is supplied either the cell value or jQuery object to parse. This method will return either the Object containing the values or null.
5919		 * @instance
5920		 * @protected
5921		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
5922		 * @returns {(object|null)}
5923		 */
5924		parser: function(valueOrElement){
5925			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
5926				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an object
5927				if (F.is.object(data)) return data;
5928				data = $el.html();
5929				try {
5930					data = JSON.parse(data);
5931				} catch(err) {
5932					data = null;
5933				}
5934				return F.is.object(data) ? data : null; // if we have an object return it
5935			}
5936			if (F.is.object(valueOrElement)) return valueOrElement; // if we have an object return it
5937			return null; // otherwise we have no value so return null
5938		},
5939		/**
5940		 * @summary Formats the column value and creates the HTML seen within a cell.
5941		 * @description This is supplied the value retrieved from the {@link FooTable.ObjectColumn#parser} function and must return a string, HTMLElement or jQuery object.
5942		 * The return value from this function is what is displayed in the cell in the table.
5943		 * @instance
5944		 * @protected
5945		 * @param {*} value - The value to format.
5946		 * @param {object} options - The current plugin options.
5947		 * @param {object} rowData - An object containing the current row data.
5948		 * @returns {(string|HTMLElement|jQuery)}
5949		 */
5950		formatter: function(value, options, rowData){
5951			return F.is.object(value) ? JSON.stringify(value) : '';
5952		}
5953	});
5954
5955	F.columns.register('object', F.ObjectColumn);
5956
5957})(jQuery, FooTable);
5958(function($, F){
5959
5960	F.Breakpoint = F.Class.extend(/** @lends FooTable.Breakpoint */{
5961		/**
5962		 * The breakpoint class containing the name and maximum width for the breakpoint.
5963		 * @constructs
5964		 * @extends FooTable.Class
5965		 * @param {string} name - The name of the breakpoint. Must contain no spaces or special characters.
5966		 * @param {number} width - The width of the breakpoint in pixels.
5967		 * @returns {FooTable.Breakpoint}
5968		 */
5969		construct: function(name, width){
5970			/**
5971			 * The name of the breakpoint.
5972			 * @type {string}
5973			 */
5974			this.name = name;
5975			/**
5976			 * The maximum width of the breakpoint in pixels.
5977			 * @type {number}
5978			 */
5979			this.width = width;
5980		}
5981	});
5982
5983})(jQuery, FooTable);
5984(function($, F){
5985	F.Breakpoints = F.Component.extend(/** @lends FooTable.Breakpoints */{
5986		/**
5987		 * Contains the logic to calculate and apply breakpoints for the plugin.
5988		 * @constructs
5989		 * @extends FooTable.Component
5990		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
5991		 * @returns {FooTable.Breakpoints}
5992		 */
5993		construct: function(table){
5994			// call the base class constructor
5995			this._super(table, true);
5996
5997			/* PROTECTED */
5998			/**
5999			 * This provides a shortcut to the {@link FooTable.Table#options} object.
6000			 * @protected
6001			 * @type {FooTable.Table#options}
6002			 */
6003			this.o = table.o;
6004
6005			/* PUBLIC */
6006			/**
6007			 * The current breakpoint.
6008			 * @type {FooTable.Breakpoint}
6009			 */
6010			this.current = null;
6011			/**
6012			 * An array of {@link FooTable.Breakpoint} objects created from parsing the options.
6013			 * @type {Array.<FooTable.Breakpoint>}
6014			 */
6015			this.array = [];
6016			/**
6017			 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will be hidden along with it.
6018			 * @type {boolean}
6019			 */
6020			this.cascade = this.o.cascade;
6021			/**
6022			 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
6023			 * @type {boolean}
6024			 */
6025			this.useParentWidth = this.o.useParentWidth;
6026			/**
6027			 * This value is updated each time the current breakpoint changes and contains a space delimited string of the names of the current breakpoint and all those smaller than it.
6028			 * @type {string}
6029			 */
6030			this.hidden = null;
6031
6032			/* PRIVATE */
6033			/**
6034			 * This value is set once when the {@link FooTable.Breakpoints#array} is generated and contains a space delimited string of all the breakpoint class names.
6035			 * @type {string}
6036			 * @private
6037			 */
6038			this._classNames = '';
6039
6040			// check if a function was supplied to override the default getWidth
6041			this.getWidth = F.checkFnValue(this, this.o.getWidth, this.getWidth);
6042		},
6043
6044		/* PROTECTED */
6045		/**
6046		 * Checks the supplied data and options for the breakpoints component.
6047		 * @instance
6048		 * @protected
6049		 * @param {object} data - The jQuery data object from the parent table.
6050		 * @fires FooTable.Breakpoints#"preinit.ft.breakpoints"
6051		 */
6052		preinit: function(data){
6053			var self = this;
6054			/**
6055			 * The preinit.ft.breakpoints event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
6056			 * Calling preventDefault on this event will disable the entire plugin.
6057			 * @event FooTable.Breakpoints#"preinit.ft.breakpoints"
6058			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6059			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6060			 * @param {object} data - The jQuery data object of the table raising the event.
6061			 */
6062			return this.ft.raise('preinit.ft.breakpoints', [data]).then(function(){
6063				self.cascade = F.is.boolean(data.cascade) ? data.cascade : self.cascade;
6064				self.o.breakpoints = F.is.hash(data.breakpoints) ? data.breakpoints : self.o.breakpoints;
6065				self.getWidth = F.checkFnValue(self, data.getWidth, self.getWidth);
6066				if (self.o.breakpoints == null) self.o.breakpoints = { "xs": 480, "sm": 768, "md": 992, "lg": 1200 };
6067				// Create a nice friendly array to work with out of the breakpoints object.
6068				for (var name in self.o.breakpoints) {
6069					if (!self.o.breakpoints.hasOwnProperty(name)) continue;
6070					self.array.push(new F.Breakpoint(name, self.o.breakpoints[name]));
6071					self._classNames += 'breakpoint-' + name + ' ';
6072				}
6073				// Sort the breakpoints so the largest is checked first
6074				self.array.sort(function (a, b) {
6075					return b.width - a.width;
6076				});
6077			});
6078		},
6079		/**
6080		 * Initializes the class parsing the options into a sorted array of {@link FooTable.Breakpoint} objects.
6081		 * @instance
6082		 * @protected
6083		 * @fires FooTable.Breakpoints#"init.ft.breakpoints"
6084		 */
6085		init: function(){
6086			var self = this;
6087			/**
6088			 * The init.ft.breakpoints event is raised before any UI is generated.
6089			 * Calling preventDefault on this event will disable the entire plugin.
6090			 * @event FooTable.Breakpoints#"init.ft.breakpoints"
6091			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6092			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6093			 */
6094			return this.ft.raise('init.ft.breakpoints').then(function(){
6095				self.current = self.get();
6096			});
6097		},
6098		/**
6099		 * Whenever the table is drawn this ensures the correct breakpoint class is applied to the table.
6100		 * @instance
6101		 * @protected
6102		 */
6103		draw: function(){
6104			this.ft.$el.removeClass(this._classNames).addClass('breakpoint-' + this.current.name);
6105		},
6106
6107		/* PUBLIC */
6108		/**
6109		 * Calculates the current breakpoint from the {@link FooTable.Breakpoints#array} and sets the {@link FooTable.Breakpoints#current} property.
6110		 * @instance
6111		 * @returns {FooTable.Breakpoint}
6112		 */
6113		calculate: function(){
6114			var self = this, current = null, hidden = [], breakpoint, prev = null, width = self.getWidth();
6115			for (var i = 0, len = self.array.length; i < len; i++) {
6116				breakpoint = self.array[i];
6117				// if the width is smaller than the smallest breakpoint set the smallest as the current.
6118				// if the width is larger than the largest breakpoint set the largest as the current.
6119				// otherwise if the width is somewhere in between check all breakpoints testing if the width
6120				// is greater than the current but smaller than the previous.
6121				if ((!current && i == len -1)
6122					|| (width >= breakpoint.width && (prev instanceof F.Breakpoint ? width < prev.width : true))) {
6123					current = breakpoint;
6124				}
6125				if (!current) hidden.push(breakpoint.name);
6126				prev = breakpoint;
6127			}
6128			hidden.push(current.name);
6129			self.hidden = hidden.join(' ');
6130			return current;
6131		},
6132		/**
6133		 * Supplied a columns breakpoints this returns a boolean value indicating whether or not the column is visible.
6134		 * @param {string} breakpoints - A space separated string of breakpoint names.
6135		 * @returns {boolean}
6136		 */
6137		visible: function(breakpoints){
6138			if (F.is.emptyString(breakpoints)) return true;
6139			if (breakpoints === 'all') return false;
6140			var parts = breakpoints.split(' '), i = 0, len = parts.length;
6141			for (; i < len; i++){
6142				if (this.cascade ? F.str.containsWord(this.hidden, parts[i]) : parts[i] == this.current.name) return false;
6143			}
6144			return true;
6145		},
6146		/**
6147		 * Performs a check between the current breakpoint and the previous breakpoint and performs a redraw if they differ.
6148		 * @instance
6149		 * @fires FooTable.Breakpoints#"before.ft.breakpoints"
6150		 * @fires FooTable.Breakpoints#"after.ft.breakpoints"
6151		 */
6152		check: function(){
6153			var self = this, bp = self.get();
6154			if (!(bp instanceof F.Breakpoint)
6155				|| bp == self.current)
6156				return;
6157
6158			/**
6159			 * The before.ft.breakpoints event is raised if the breakpoint has changed but before the UI is redrawn and is supplied both the current breakpoint
6160			 * and the next "new" one that is about to be applied.
6161			 * Calling preventDefault on this event will prevent the next breakpoint from being applied.
6162			 * @event FooTable.Breakpoints#"before.ft.breakpoints"
6163			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6164			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6165			 * @param {FooTable.Breakpoint} current - The current breakpoint.
6166			 * @param {FooTable.Breakpoint} next - The breakpoint that is about to be applied.
6167			 */
6168			self.ft.raise('before.ft.breakpoints', [self.current, bp]).then(function(){
6169				var previous = self.current;
6170				self.current = bp;
6171				return self.ft.draw().then(function(){
6172					/**
6173					 * The after.ft.breakpoints event is raised after the breakpoint has changed and the UI is redrawn and is supplied both the "new" current breakpoint
6174					 * and the previous one that was replaced.
6175					 * @event FooTable.Breakpoints#"after.ft.breakpoints"
6176					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6177					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6178					 * @param {FooTable.Breakpoint} current - The current breakpoint.
6179					 * @param {FooTable.Breakpoint} previous - The breakpoint that was just replaced.
6180					 */
6181					self.ft.raise('after.ft.breakpoints', [self.current, previous]);
6182				});
6183			});
6184		},
6185		/**
6186		 * Attempts to return a {@link FooTable.Breakpoint} instance when passed a {@link FooTable.Breakpoint},
6187		 * the {@link FooTable.Breakpoint#name} string or if nothing is supplied the current breakpoint.
6188		 * @instance
6189		 * @param {(FooTable.Breakpoint|string|number)} [breakpoint] - The breakpoint to retrieve.
6190		 * @returns {FooTable.Breakpoint}
6191		 */
6192		get: function(breakpoint){
6193			if (F.is.undef(breakpoint)) return this.calculate();
6194			if (breakpoint instanceof F.Breakpoint) return breakpoint;
6195			if (F.is.string(breakpoint)) return F.arr.first(this.array, function (bp) { return bp.name == breakpoint; });
6196			if (F.is.number(breakpoint)) return breakpoint >= 0 && breakpoint < this.array.length ? this.array[breakpoint] : null;
6197			return null;
6198		},
6199		/**
6200		 * Gets the width used to determine breakpoints whether it be from the viewport, parent or a custom function.
6201		 * @instance
6202		 * @returns {number}
6203		 */
6204		getWidth: function(){
6205			if (F.is.fn(this.o.getWidth)) return this.o.getWidth(this.ft);
6206			if (this.useParentWidth == true) return this.getParentWidth();
6207			return this.getViewportWidth();
6208		},
6209		/**
6210		 * Gets the tables direct parents width.
6211		 * @instance
6212		 * @returns {number}
6213		 */
6214		getParentWidth: function(){
6215			return this.ft.$el.parent().width();
6216		},
6217		/**
6218		 * Gets the current viewport width.
6219		 * @instance
6220		 * @returns {number}
6221		 */
6222		getViewportWidth: function(){
6223			return Math.max(document.documentElement.clientWidth, window.innerWidth, 0);
6224		}
6225	});
6226
6227	F.components.register('breakpoints', F.Breakpoints, 1000);
6228
6229})(jQuery, FooTable);
6230(function(F){
6231	/**
6232	 * A space delimited string of breakpoint names that specify when the column will be hidden. You can also specify "all" to make a column permanently display in an expandable detail row.
6233	 * @type {string}
6234	 * @default null
6235	 * @example <caption>The below shows how this value would be set</caption>
6236	 * breakpoints: "md"
6237	 */
6238	F.Column.prototype.breakpoints = null;
6239
6240	F.Column.prototype.__breakpoints_define__ = function(definition){
6241		this.breakpoints = F.is.emptyString(definition.breakpoints) ? null : definition.breakpoints;
6242	};
6243
6244	F.Column.extend('define', function(definition){
6245		this._super(definition);
6246		this.__breakpoints_define__(definition);
6247	});
6248})(FooTable);
6249(function(F){
6250	/**
6251	 * An object containing the breakpoints for the plugin.
6252	 * @type {object.<string, number>}
6253	 * @default { "xs": 480, "sm": 768, "md": 992, "lg": 1200 }
6254	 */
6255	F.Defaults.prototype.breakpoints = null;
6256
6257	/**
6258	 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will also be hidden along with it.
6259	 * @type {boolean}
6260	 * @default false
6261	 */
6262	F.Defaults.prototype.cascade = false;
6263
6264	/**
6265	 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
6266	 * @type {boolean}
6267	 * @default false
6268	 */
6269	F.Defaults.prototype.useParentWidth = false;
6270
6271	/**
6272	 * A function used to override the default getWidth function with a custom one.
6273	 * @type {function}
6274	 * @default null
6275	 * @example <caption>The below shows what the default getWidth function would look like.</caption>
6276	 * getWidth: function(instance){
6277	 * 	if (instance.o.useParentWidth == true) return instance.$el.parent().width();
6278	 * 	return instance.breakpoints.getViewportWidth();
6279	 * }
6280	 */
6281	F.Defaults.prototype.getWidth = null;
6282})(FooTable);
6283(function($, F){
6284	F.Columns = F.Component.extend(/** @lends FooTable.Columns */{
6285		/**
6286		 * The columns class contains all the logic for handling columns.
6287		 * @constructs
6288		 * @extends FooTable.Component
6289		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
6290		 * @returns {FooTable.Columns}
6291		 */
6292		construct: function(table){
6293			// call the base class constructor
6294			this._super(table, true);
6295
6296			/* PROTECTED */
6297			/**
6298			 * This provides a shortcut to the {@link FooTable.Table#options} object.
6299			 * @protected
6300			 * @type {FooTable.Table#options}
6301			 */
6302			this.o = table.o;
6303
6304			/* PUBLIC */
6305			/**
6306			 * An array of {@link FooTable.Column} objects created from parsing the options and/or DOM.
6307			 * @type {Array.<FooTable.Column>}
6308			 */
6309			this.array = [];
6310			/**
6311			 * The jQuery header row object.
6312			 * @type {jQuery}
6313			 */
6314			this.$header = null;
6315			/**
6316			 * Whether or not to display the header row.
6317			 * @type {boolean}
6318			 */
6319			this.showHeader = table.o.showHeader;
6320
6321			this._fromHTML = F.is.emptyArray(table.o.columns) && !F.is.promise(table.o.columns);
6322		},
6323
6324		/* PROTECTED */
6325		/**
6326		 * This parses the columns from either the tables rows or the supplied options.
6327		 * @instance
6328		 * @protected
6329		 * @param {object} data - The tables jQuery data object.
6330		 * @returns {jQuery.Promise}
6331		 * @this FooTable.Columns
6332		 */
6333		parse: function(data){
6334			var self = this;
6335			return $.Deferred(function(d){
6336				function merge(cols1, cols2){
6337					var merged = [];
6338					// check if either of the arrays is empty as it can save us having to merge them by index.
6339					if (cols1.length == 0 || cols2.length == 0){
6340						merged = cols1.concat(cols2);
6341					} else {
6342						// at this point we have two arrays of column definitions, we now need to merge them based on there index properties
6343						// first figure out the highest column index provided so we can loop that many times to merge all columns and provide
6344						// defaults where nothing was specified (fill in the gaps in the array as it were).
6345						var highest = 0;
6346						F.arr.each(cols1.concat(cols2), function(c){
6347							if (c.index > highest) highest = c.index;
6348						});
6349						highest++;
6350						for (var i = 0, cols1_c, cols2_c; i < highest; i++){
6351							cols1_c = {};
6352							F.arr.each(cols1, function(c){
6353								if (c.index == i){
6354									cols1_c = c;
6355									return false;
6356								}
6357							});
6358							cols2_c = {};
6359							F.arr.each(cols2, function(c){
6360								if (c.index == i){
6361									cols2_c = c;
6362									return false;
6363								}
6364							});
6365							merged.push($.extend(true, {}, cols1_c, cols2_c));
6366						}
6367					}
6368					return merged;
6369				}
6370
6371				var json = [], html = [];
6372				// get the column options from the content
6373				var $header = self.ft.$el.find('tr.footable-header, thead > tr:last:has([data-breakpoints]), tbody > tr:first:has([data-breakpoints]), thead > tr:last, tbody > tr:first').first(), $cell, cdata;
6374				if ($header.length > 0){
6375					var virtual = $header.parent().is('tbody') && $header.children().length == $header.children('td').length;
6376					if (!virtual) self.$header = $header.addClass('footable-header');
6377					$header.children('td,th').each(function(i, cell){
6378						$cell = $(cell);
6379						cdata = $cell.data();
6380						cdata.index = i;
6381						cdata.$el = $cell;
6382						cdata.virtual = virtual;
6383						html.push(cdata);
6384					});
6385					if (virtual) self.showHeader = false;
6386				}
6387				// get the supplied column options
6388				if (F.is.array(self.o.columns) && !F.is.emptyArray(self.o.columns)){
6389					F.arr.each(self.o.columns, function(c, i){
6390						c.index = i;
6391						json.push(c);
6392					});
6393					self.parseFinalize(d, merge(json, html));
6394				} else if (F.is.promise(self.o.columns)){
6395					self.o.columns.then(function(cols){
6396						F.arr.each(cols, function(c, i){
6397							c.index = i;
6398							json.push(c);
6399						});
6400						self.parseFinalize(d, merge(json, html));
6401					}, function(xhr){
6402						d.reject(Error('Columns ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
6403					});
6404				} else {
6405					self.parseFinalize(d, merge(json, html));
6406				}
6407			});
6408		},
6409		/**
6410		 * Used to finalize the parsing of columns it is supplied the parse deferred object which must be resolved with an array of {@link FooTable.Column} objects
6411		 * or rejected with an error.
6412		 * @instance
6413		 * @protected
6414		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
6415		 * @param {Array.<object>} cols - An array of all merged column definitions.
6416		 */
6417		parseFinalize: function(deferred, cols){
6418			// we now have a merged array of all column definitions supplied to the plugin, time to make the objects.
6419			var self = this, columns = [], column;
6420			F.arr.each(cols, function(def){
6421				// if we have a column registered using the definition type then create an instance of that column otherwise just create a default text column.
6422				if (column = F.columns.contains(def.type) ? F.columns.make(def.type, self.ft, def) : new F.Column(self.ft, def))
6423					columns.push(column);
6424			});
6425			if (F.is.emptyArray(columns)){
6426				deferred.reject(Error("No columns supplied."));
6427			} else {
6428				// make sure to sort by the column index as the merge process may have mixed them up
6429				columns.sort(function(a, b){ return a.index - b.index; });
6430				deferred.resolve(columns);
6431			}
6432		},
6433		/**
6434		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
6435		 * @instance
6436		 * @protected
6437		 * @param {object} data - The jQuery data object from the root table element.
6438		 * @this FooTable.Columns
6439		 */
6440		preinit: function(data){
6441			var self = this;
6442			/**
6443			 * The preinit.ft.columns event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
6444			 * Calling preventDefault on this event will disable the entire plugin.
6445			 * @event FooTable.Columns#"preinit.ft.columns"
6446			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6447			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6448			 * @param {object} data - The jQuery data object of the table raising the event.
6449			 */
6450			return self.ft.raise('preinit.ft.columns', [data]).then(function(){
6451				return self.parse(data).then(function(columns){
6452					self.array = columns;
6453					self.showHeader = F.is.boolean(data.showHeader) ? data.showHeader : self.showHeader;
6454				});
6455			});
6456		},
6457		/**
6458		 * Initializes the columns creating the table header if required.
6459		 * @instance
6460		 * @protected
6461		 * @fires FooTable.Columns#"init.ft.columns"
6462		 * @this FooTable.Columns
6463		 */
6464		init: function(){
6465			var self = this;
6466			/**
6467			 * The init.ft.columns event is raised after the header row is created/parsed for column data.
6468			 * @event FooTable.Columns#"init.ft.columns"
6469			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6470			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
6471			 * @param {Array.<FooTable.Column>} columns - The array of {@link FooTable.Column} objects parsed from the options and/or DOM.
6472			 */
6473			return this.ft.raise('init.ft.columns', [ self.array ]).then(function(){
6474				self.$create();
6475			});
6476		},
6477		/**
6478		 * Destroys the columns component removing any UI generated from the table.
6479		 * @instance
6480		 * @protected
6481		 * @fires FooTable.Columns#"destroy.ft.columns"
6482		 */
6483		destroy: function(){
6484			/**
6485			 * The destroy.ft.columns event is raised before its UI is removed.
6486			 * Calling preventDefault on this event will prevent the component from being destroyed.
6487			 * @event FooTable.Columns#"destroy.ft.columns"
6488			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6489			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6490			 */
6491			var self = this;
6492			this.ft.raise('destroy.ft.columns').then(function(){
6493				if (!self._fromHTML) self.$header.remove();
6494			});
6495		},
6496		/**
6497		 * The predraw method called from within the {@link FooTable.Table#draw} method.
6498		 * @instance
6499		 * @protected
6500		 * @this FooTable.Columns
6501		 */
6502		predraw: function(){
6503			var self = this, first = true;
6504			self.visibleColspan = 0;
6505			self.firstVisibleIndex = 0;
6506			self.lastVisibleIndex = 0;
6507			self.hasHidden = false;
6508			F.arr.each(self.array, function(col){
6509				col.hidden = !self.ft.breakpoints.visible(col.breakpoints);
6510				if (!col.hidden && col.visible){
6511					if (first){
6512						self.firstVisibleIndex = col.index;
6513						first = false;
6514					}
6515					self.lastVisibleIndex = col.index;
6516					self.visibleColspan++;
6517				}
6518				if (col.hidden) self.hasHidden = true;
6519			});
6520			self.ft.$el.toggleClass('breakpoint', self.hasHidden);
6521		},
6522		/**
6523		 * Performs the actual drawing of the columns, hiding or displaying them depending on there breakpoints.
6524		 * @instance
6525		 * @protected
6526		 * @this FooTable.Columns
6527		 */
6528		draw: function(){
6529			F.arr.each(this.array, function(col){
6530				col.$el.css('display', (col.hidden || !col.visible  ? 'none' : 'table-cell'));
6531			});
6532			if (!this.showHeader && F.is.jq(this.$header.parent())){
6533				this.$header.detach();
6534			}
6535		},
6536		/**
6537		 * Creates the header row for the table from the parsed column definitions.
6538		 * @instance
6539		 * @protected
6540		 * @this FooTable.Columns
6541		 */
6542		$create: function(){
6543			var self = this;
6544			self.$header = F.is.jq(self.$header) ? self.$header : $('<tr/>', {'class': 'footable-header'});
6545			self.$header.children('th,td').detach();
6546			F.arr.each(self.array, function(col){
6547				self.$header.append(col.$el);
6548			});
6549			if (self.showHeader && !F.is.jq(self.$header.parent())){
6550				self.ft.$el.children('thead').append(self.$header);
6551			}
6552		},
6553		/**
6554		 * Attempts to return a {@link FooTable.Column} instance when passed the {@link FooTable.Column} instance, the {@link FooTable.Column#name} string or the {@link FooTable.Column#index} number.
6555		 * If supplied a function this will return an array by iterating all columns passing the index and column itself to the supplied callback as arguments.
6556		 * Returning true in the callback will include the column in the result.
6557		 * @instance
6558		 * @param {(FooTable.Column|string|number|function)} column - The column to retrieve.
6559		 * @returns {(Array.<FooTable.Column>|FooTable.Column|null)} The column if one is found otherwise it returns NULL.
6560		 * @example <caption>This example shows retrieving a column by name assuming a column called "id" exists. The <code>columns</code> object is an instance of {@link FooTable.Columns}.</caption>
6561		 * var column = columns.get('id');
6562		 * if (column instanceof FooTable.Column){
6563		 * 	// found the "id" column
6564		 * } else {
6565		 * 	// no column with a name of "id" exists
6566		 * }
6567		 * // to get an array of all hidden columns
6568		 * var columns = columns.get(function(col){
6569		 *  return col.hidden;
6570		 * });
6571		 */
6572		get: function(column){
6573			if (column instanceof F.Column) return column;
6574			if (F.is.string(column)) return F.arr.first(this.array, function (col) { return col.name == column; });
6575			if (F.is.number(column)) return F.arr.first(this.array, function (col) { return col.index == column; });
6576			if (F.is.fn(column)) return F.arr.get(this.array, column);
6577			return null;
6578		},
6579		/**
6580		 * Takes an array of column names, index's or actual {@link FooTable.Column} and ensures that an array of only {@link FooTable.Column} is returned.
6581		 * @instance
6582		 * @param {(Array.<string>|Array.<number>|Array.<FooTable.Column>)} columns - The array of column names, index's or {@link FooTable.Column} to check.
6583		 * @returns {Array.<FooTable.Column>}
6584		 */
6585		ensure: function(columns){
6586			var self = this, result = [];
6587			if (!F.is.array(columns)) return result;
6588			F.arr.each(columns, function(name){
6589				result.push(self.get(name));
6590			});
6591			return result;
6592		}
6593	});
6594
6595	F.components.register('columns', F.Columns, 900);
6596
6597})(jQuery, FooTable);
6598(function(F){
6599	/**
6600	 * An array containing the column options or a jQuery promise that resolves returning the columns. The index of the definitions must match the index of each column as it should appear in the table. For more information on the options available see the {@link FooTable.Column} object.
6601	 * @type {(Array.<object>|jQuery.Promise)}
6602	 * @default []
6603	 * @example <caption>The below shows column definitions for a row defined as <code>{ id: Number, name: String, age: Number }</code>. The ID column has a fixed width, the table is initially sorted on the Name column and the Age column will be hidden on phones.</caption>
6604	 * columns: [
6605	 * 	{ name: 'id', title: 'ID', type: 'number' },
6606	 *	{ name: 'name', title: 'Name', sorted: true, direction: 'ASC' }
6607	 *	{ name: 'age', title: 'Age', type: 'number', breakpoints: 'xs' }
6608	 * ]
6609	 */
6610	F.Defaults.prototype.columns = [];
6611
6612	/**
6613	 * Specifies whether or not the column headers should be displayed.
6614	 * @type {boolean}
6615	 * @default true
6616	 */
6617	F.Defaults.prototype.showHeader = true;
6618})(FooTable);
6619(function ($, F) {
6620	F.Rows = F.Component.extend(/** @lends FooTable.Rows */{
6621		/**
6622		 * The rows class contains all the logic for handling rows.
6623		 * @constructs
6624		 * @extends FooTable.Component
6625		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
6626		 * @returns {FooTable.Rows}
6627		 */
6628		construct: function (table) {
6629			// call the base class constructor
6630			this._super(table, true);
6631
6632			/**
6633			 * This provides a shortcut to the {@link FooTable.Table#options} object.
6634			 * @instance
6635			 * @protected
6636			 * @type {FooTable.Table#options}
6637			 */
6638			this.o = table.o;
6639			/**
6640			 * The current working array of {@link FooTable.Row} objects.
6641			 * @instance
6642			 * @protected
6643			 * @type {Array.<FooTable.Row>}
6644			 * @default []
6645			 */
6646			this.array = [];
6647			/**
6648			 * The base array of rows parsed from either the DOM or the constructor options.
6649			 * The {@link FooTable.Rows#current} member is populated with a shallow clone of this array
6650			 * during the predraw operation before any core or custom components are executed.
6651			 * @instance
6652			 * @protected
6653			 * @type {Array.<FooTable.Row>}
6654			 * @default []
6655			 */
6656			this.all = [];
6657			/**
6658			 * Whether or not to display a toggle in each row when it contains hidden columns.
6659			 * @type {boolean}
6660			 * @default true
6661			 */
6662			this.showToggle = table.o.showToggle;
6663			/**
6664			 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
6665			 * @type {string}
6666			 * @default "tr,td,.footable-toggle"
6667			 */
6668			this.toggleSelector = table.o.toggleSelector;
6669			/**
6670			 * Specifies which column the row toggle is appended to. Supports only two values; "first" and "last"
6671			 * @type {string}
6672			 */
6673			this.toggleColumn = table.o.toggleColumn;
6674			/**
6675			 * The text to display when the table has no rows.
6676			 * @type {string}
6677			 */
6678			this.emptyString = table.o.empty;
6679			/**
6680			 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
6681			 * @type {boolean}
6682			 */
6683			this.expandFirst = table.o.expandFirst;
6684			/**
6685			 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
6686			 * @type {boolean}
6687			 */
6688			this.expandAll = table.o.expandAll;
6689			/**
6690			 * The jQuery object that contains the empty row control.
6691			 * @type {jQuery}
6692			 */
6693			this.$empty = null;
6694			this._fromHTML = F.is.emptyArray(table.o.rows) && !F.is.promise(table.o.rows);
6695		},
6696		/**
6697		 * This parses the rows from either the tables rows or the supplied options.
6698		 * @instance
6699		 * @protected
6700		 * @returns {jQuery.Promise}
6701		 */
6702		parse: function(){
6703			var self = this;
6704			return $.Deferred(function(d){
6705				var $rows = self.ft.$el.children('tbody').children('tr');
6706				if (F.is.array(self.o.rows) && self.o.rows.length > 0){
6707					self.parseFinalize(d, self.o.rows);
6708				} else if (F.is.promise(self.o.rows)){
6709					self.o.rows.then(function(rows){
6710						self.parseFinalize(d, rows);
6711					}, function(xhr){
6712						d.reject(Error('Rows ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
6713					});
6714				} else if (F.is.jq($rows)){
6715					self.parseFinalize(d, $rows);
6716					$rows.detach();
6717				} else {
6718					self.parseFinalize(d, []);
6719				}
6720			});
6721		},
6722		/**
6723		 * Used to finalize the parsing of rows it is supplied the parse deferred object which must be resolved with an array of {@link FooTable.Row} objects
6724		 * or rejected with an error.
6725		 * @instance
6726		 * @protected
6727		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
6728		 * @param {(Array.<object>|jQuery)} rows - An array of row values and options or the jQuery object c
6728ontaining all rows.
6729		 */
6730		parseFinalize: function(deferred, rows){
6731			var self = this, result = $.map(rows, function(r){
6732				return new F.Row(self.ft, self.ft.columns.array, r);
6733			});
6734			deferred.resolve(result);
6735		},
6736		/**
6737		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
6738		 * @instance
6739		 * @protected
6740		 * @param {object} data - The jQuery data object from the root table element.
6741		 * @fires FooTable.Rows#"preinit.ft.rows"
6742		 */
6743		preinit: function(data){
6744			var self = this;
6745			/**
6746			 * The preinit.ft.rows event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
6747			 * Calling preventDefault on this event will disable the entire plugin.
6748			 * @event FooTable.Rows#"preinit.ft.rows"
6749			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6750			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6751			 * @param {object} data - The jQuery data object of the table raising the event.
6752			 */
6753			return self.ft.raise('preinit.ft.rows', [data]).then(function(){
6754				return self.parse().then(function(rows){
6755					self.all = rows;
6756					self.array = self.all.slice(0);
6757					self.showToggle = F.is.boolean(data.showToggle) ? data.showToggle : self.showToggle;
6758					self.toggleSelector = F.is.string(data.toggleSelector) ? data.toggleSelector : self.toggleSelector;
6759					self.toggleColumn = F.is.string(data.toggleColumn) ? data.toggleColumn : self.toggleColumn;
6760					if (self.toggleColumn != "first" && self.toggleColumn != "last") self.toggleColumn = "first";
6761					self.emptyString = F.is.string(data.empty) ? data.empty : self.emptyString;
6762					self.expandFirst = F.is.boolean(data.expandFirst) ? data.expandFirst : self.expandFirst;
6763					self.expandAll = F.is.boolean(data.expandAll) ? data.expandAll : self.expandAll;
6764				});
6765			});
6766		},
6767		/**
6768		 * Initializes the rows class using the supplied table and options.
6769		 * @instance
6770		 * @protected
6771		 * @fires FooTable.Rows#"init.ft.rows"
6772		 */
6773		init: function () {
6774			var self = this;
6775			/**
6776			 * The init.ft.rows event is raised after the the rows are parsed from either the DOM or the options.
6777			 * Calling preventDefault on this event will disable the entire plugin.
6778			 * @event FooTable.Rows#"init.ft.rows"
6779			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6780			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
6781			 * @param {Array.<FooTable.Row>} rows - The array of {@link FooTable.Row} objects parsed from the DOM or the options.
6782			 */
6783			return self.ft.raise('init.ft.rows', [self.all]).then(function(){
6784				self.$create();
6785			});
6786		},
6787		/**
6788		 * Destroys the rows component removing any UI generated from the table.
6789		 * @instance
6790		 * @protected
6791		 * @fires FooTable.Rows#"destroy.ft.rows"
6792		 */
6793		destroy: function(){
6794			/**
6795			 * The destroy.ft.rows event is raised before its UI is removed.
6796			 * Calling preventDefault on this event will prevent the component from being destroyed.
6797			 * @event FooTable.Rows#"destroy.ft.rows"
6798			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
6799			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
6800			 */
6801			var self = this;
6802			this.ft.raise('destroy.ft.rows').then(function(){
6803				F.arr.each(self.array, function(row){
6804					row.predraw(!self._fromHTML);
6805				});
6806				self.all = self.array = [];
6807			});
6808		},
6809		/**
6810		 * Performs the predraw operations that are required including creating the shallow clone of the {@link FooTable.Rows#array} to work with.
6811		 * @instance
6812		 * @protected
6813		 */
6814		predraw: function(){
6815			F.arr.each(this.array, function(row){
6816				row.predraw();
6817			});
6818			this.array = this.all.slice(0);
6819		},
6820		$create: function(){
6821			this.$empty = $('<tr/>', { 'class': 'footable-empty' }).append($('<td/>').text(this.emptyString));
6822		},
6823		/**
6824		 * Performs the actual drawing of the table rows.
6825		 * @instance
6826		 * @protected
6827		 */
6828		draw: function(){
6829			var self = this, $tbody = self.ft.$el.children('tbody'), first = true;
6830			// if we have rows
6831			if (self.array.length > 0){
6832				self.$empty.detach();
6833				// loop through them appending to the tbody and then drawing
6834				F.arr.each(self.array, function(row){
6835					if ((self.expandFirst && first) || self.expandAll){
6836						row.expanded = true;
6837						first = false;
6838					}
6839					row.draw($tbody);
6840				});
6841			} else {
6842				// otherwise display the $empty row
6843				self.$empty.children('td').attr('colspan', self.ft.columns.visibleColspan);
6844				$tbody.append(self.$empty);
6845			}
6846		},
6847		/**
6848		 * Loads a JSON array of row objects into the table
6849		 * @instance
6850		 * @param {Array.<object>} data - An array of row objects to load.
6851		 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
6852		 */
6853		load: function(data, append){
6854			var self = this, rows = $.map(data, function(r){
6855				return new F.Row(self.ft, self.ft.columns.array, r);
6856			});
6857			F.arr.each(this.array, function(row){
6858				row.predraw();
6859			});
6860			this.all = (F.is.boolean(append) ? append : false) ? this.all.concat(rows) : rows;
6861			this.array = this.all.slice(0);
6862			this.ft.draw();
6863		},
6864		/**
6865		 * Expands all visible rows.
6866		 * @instance
6867		 */
6868		expand: function(){
6869			F.arr.each(this.array, function(row){
6870				row.expand();
6871			});
6872		},
6873		/**
6874		 * Collapses all visible rows.
6875		 * @instance
6876		 */
6877		collapse: function(){
6878			F.arr.each(this.array, function(row){
6879				row.collapse();
6880			});
6881		}
6882	});
6883
6884	F.components.register('rows', F.Rows, 800);
6885
6886})(jQuery, FooTable);
6887(function(F){
6888	/**
6889	 * An array of JSON objects containing the row data or a jQuery promise that resolves returning the row data.
6890	 * @type {(Array.<object>|jQuery.Promise)}
6891	 * @default []
6892	 */
6893	F.Defaults.prototype.rows = [];
6894
6895	/**
6896	 * A string to display when there are no rows in the table.
6897	 * @type {string}
6898	 * @default "No results"
6899	 */
6900	F.Defaults.prototype.empty = 'No results';
6901
6902	/**
6903	 * Whether or not the toggle is appended to each row.
6904	 * @type {boolean}
6905	 * @default true
6906	 */
6907	F.Defaults.prototype.showToggle = true;
6908
6909	/**
6910	 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
6911	 * @type {string}
6912	 * @default "tr,td,.footable-toggle"
6913	 */
6914	F.Defaults.prototype.toggleSelector = 'tr,td,.footable-toggle';
6915
6916	/**
6917	 * Specifies which column to display the row toggle in. The only supported values are "first" or "last".
6918	 * @type {string}
6919	 * @default "first"
6920	 */
6921	F.Defaults.prototype.toggleColumn = 'first';
6922
6923	/**
6924	 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
6925	 * @type {boolean}
6926	 */
6927	F.Defaults.prototype.expandFirst = false;
6928
6929	/**
6930	 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
6931	 * @type {boolean}
6932	 */
6933	F.Defaults.prototype.expandAll = false;
6934})(FooTable);
6935(function(F){
6936	/**
6937	 * Loads a JSON array of row objects into the table
6938	 * @param {Array.<object>} data - An array of row objects to load.
6939	 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
6940	 */
6941	F.Table.prototype.loadRows = function(data, append){
6942		this.rows.load(data, append);
6943	};
6944})(FooTable);
6945(function(F){
6946	F.Filter = F.Class.extend(/** @lends FooTable.Filter */{
6947		/**
6948		 * The filter object contains the query to filter by and the columns to apply it to.
6949		 * @constructs
6950		 * @extends FooTable.Class
6951		 * @param {string} name - The name for the filter.
6952		 * @param {(string|FooTable.Query)} query - The query for the filter.
6953		 * @param {Array.<FooTable.Column>} columns - The columns to apply the query to.
6954		 * @param {string} [space="AND"] - How the query treats space chars.
6955		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
6956		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
6957		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
6958		 * @returns {FooTable.Filter}
6959		 */
6960		construct: function(name, query, columns, space, connectors, ignoreCase, hidden){
6961			/**
6962			 * The name of the filter.
6963			 * @instance
6964			 * @type {string}
6965			 */
6966			this.name = name;
6967			/**
6968			 * A string specifying how the filter treats space characters. Can be either "OR" or "AND".
6969			 * @instance
6970			 * @type {string}
6971			 */
6972			this.space = F.is.string(space) && (space == 'OR' || space == 'AND') ? space : 'AND';
6973			/**
6974			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
6975			 * @instance
6976			 * @type {boolean}
6977			 */
6978			this.connectors = F.is.boolean(connectors) ? connectors : true;
6979			/**
6980			 * Whether or not ignore case when matching.
6981			 * @instance
6982			 * @type {boolean}
6983			 */
6984			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
6985			/**
6986			 * Whether or not this is a hidden filter.
6987			 * @instance
6988			 * @type {boolean}
6989			 */
6990			this.hidden = F.is.boolean(hidden) ? hidden : false;
6991			/**
6992			 * The query for the filter.
6993			 * @instance
6994			 * @type {(string|FooTable.Query)}
6995			 */
6996			this.query = query instanceof F.Query ? query : new F.Query(query, this.space, this.connectors, this.ignoreCase);
6997			/**
6998			 * The columns to apply the query to.
6999			 * @instance
7000			 * @type {Array.<FooTable.Column>}
7001			 */
7002			this.columns = columns;
7003		},
7004		/**
7005		 * Checks if the current filter matches the supplied string.
7006		 * If the current query property is a string it will be auto converted to a {@link FooTable.Query} object to perform the match.
7007		 * @instance
7008		 * @param {string} str - The string to check.
7009		 * @returns {boolean}
7010		 */
7011		match: function(str){
7012			if (!F.is.string(str)) return false;
7013			if (F.is.string(this.query)){
7014				this.query = new F.Query(this.query, this.space, this.connectors, this.ignoreCase);
7015			}
7016			return this.query instanceof F.Query ? this.query.match(str) : false;
7017		},
7018		/**
7019		 * Checks if the current filter matches the supplied {@link FooTable.Row}.
7020		 * @instance
7021		 * @param {FooTable.Row} row - The row to check.
7022		 * @returns {boolean}
7023		 */
7024		matchRow: function(row){
7025			var self = this, text = F.arr.map(row.cells, function(cell){
7026				return F.arr.contains(self.columns, cell.column) ? cell.filterValue : null;
7027			}).join(' ');
7028			return self.match(text);
7029		}
7030	});
7031
7032})(FooTable);
7033(function ($, F) {
7034	F.Filtering = F.Component.extend(/** @lends FooTable.Filtering */{
7035		/**
7036		 * The filtering component adds a search input and column selector dropdown to the table allowing users to filter the using space delimited queries.
7037		 * @constructs
7038		 * @extends FooTable.Component
7039		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
7040		 * @returns {FooTable.Filtering}
7041		 */
7042		construct: function (table) {
7043			// call the constructor of the base class
7044			this._super(table, table.o.filtering.enabled);
7045
7046			/* PUBLIC */
7047			/**
7048			 * The filters to apply to the current {@link FooTable.Rows#array}.
7049			 * @instance
7050			 * @type {Array.<FooTable.Filter>}
7051			 */
7052			this.filters = table.o.filtering.filters;
7053			/**
7054			 * The delay in milliseconds before the query is auto applied after a change.
7055			 * @instance
7056			 * @type {number}
7057			 */
7058			this.delay = table.o.filtering.delay;
7059			/**
7060			 * The minimum number of characters allowed in the search input before it is auto applied.
7061			 * @instance
7062			 * @type {number}
7063			 */
7064			this.min = table.o.filtering.min;
7065			/**
7066			 * Specifies how whitespace in a filter query is handled.
7067			 * @instance
7068			 * @type {string}
7069			 */
7070			this.space = table.o.filtering.space;
7071			/**
7072			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
7073			 * @instance
7074			 * @type {boolean}
7075			 */
7076			this.connectors = table.o.filtering.connectors;
7077			/**
7078			 * Whether or not ignore case when matching.
7079			 * @instance
7080			 * @type {boolean}
7081			 */
7082			this.ignoreCase = table.o.filtering.ignoreCase;
7083			/**
7084			 * Whether or not search queries are treated as phrases when matching.
7085			 * @instance
7086			 * @type {boolean}
7087			 */
7088			this.exactMatch = table.o.filtering.exactMatch;
7089			/**
7090			 * The placeholder text to display within the search $input.
7091			 * @instance
7092			 * @type {string}
7093			 */
7094			this.placeholder = table.o.filtering.placeholder;
7095			/**
7096			 * The title to display at the top of the search input column select.
7097			 * @type {string}
7098			 */
7099			this.dropdownTitle = table.o.filtering.dropdownTitle;
7100			/**
7101			 * The position of the $search input within the filtering rows cell.
7102			 * @type {string}
7103			 */
7104			this.position = table.o.filtering.position;
7105			/**
7106			 * Whether or not to focus the search input after the search/clear button is clicked or after auto applying the search input query.
7107			 * @type {boolean}
7108			 */
7109			this.focus = table.o.filtering.focus;
7110			/**
7111			 * A selector specifying where to place the filtering components form, if null the form is displayed within a row in the head of the table.
7112			 * @type {string}
7113			 */
7114			this.container = table.o.filtering.container;
7115			/**
7116			 * The jQuery object of the element containing the entire filtering form.
7117			 * @instance
7118			 * @type {jQuery}
7119			 */
7120			this.$container = null;
7121			/**
7122			 * The jQuery row object that contains all the filtering specific elements.
7123			 * @instance
7124			 * @type {jQuery}
7125			 */
7126			this.$row = null;
7127			/**
7128			 * The jQuery cell object that contains the search input and column selector.
7129			 * @instance
7130			 * @type {jQuery}
7131			 */
7132			this.$cell = null;
7133			/**
7134			 * The jQuery form object of the form that contains the search input and column selector.
7135			 * @instance
7136			 * @type {jQuery}
7137			 */
7138			this.$form = null;
7139			/**
7140			 * The jQuery object of the column selector dropdown.
7141			 * @instance
7142			 * @type {jQuery}
7143			 */
7144			this.$dropdown = null;
7145			/**
7146			 * The jQuery object of the search input.
7147			 * @instance
7148			 * @type {jQuery}
7149			 */
7150			this.$input = null;
7151			/**
7152			 * The jQuery object of the search button.
7153			 * @instance
7154			 * @type {jQuery}
7155			 */
7156			this.$button = null;
7157
7158			/* PRIVATE */
7159			/**
7160			 * The timeout ID for the filter changed event.
7161			 * @instance
7162			 * @private
7163			 * @type {?number}
7164			 */
7165			this._filterTimeout = null;
7166			/**
7167			 * The regular expression used to check for encapsulating quotations.
7168			 * @instance
7169			 * @private
7170			 * @type {RegExp}
7171			 */
7172			this._exactRegExp = /^"(.*?)"$/;
7173		},
7174
7175		/* PROTECTED */
7176		/**
7177		 * Checks the supplied data and options for the filtering component.
7178		 * @instance
7179		 * @protected
7180		 * @param {object} data - The jQuery data object from the parent table.
7181		 * @fires FooTable.Filtering#"preinit.ft.filtering"
7182		 */
7183		preinit: function(data){
7184			var self = this;
7185			/**
7186			 * The preinit.ft.filtering event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
7187			 * Calling preventDefault on this event will disable the component.
7188			 * @event FooTable.Filtering#"preinit.ft.filtering"
7189			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7190			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7191			 * @param {object} data - The jQuery data object of the table raising the event.
7192			 */
7193			return self.ft.raise('preinit.ft.filtering').then(function(){
7194				// first check if filtering is enabled via the class being applied
7195				if (self.ft.$el.hasClass('footable-filtering'))
7196					self.enabled = true;
7197				// then check if the data-filtering-enabled attribute has been set
7198				self.enabled = F.is.boolean(data.filtering)
7199					? data.filtering
7200					: self.enabled;
7201
7202				// if filtering is not enabled exit early as we don't need to do anything else
7203				if (!self.enabled) return;
7204
7205				self.space = F.is.string(data.filterSpace)
7206					? data.filterSpace
7207					: self.space;
7208
7209				self.min = F.is.number(data.filterMin)
7210					? data.filterMin
7211					: self.min;
7212
7213				self.connectors = F.is.boolean(data.filterConnectors)
7214					? data.filterConnectors
7215					: self.connectors;
7216
7217				self.ignoreCase = F.is.boolean(data.filterIgnoreCase)
7218					? data.filterIgnoreCase
7219					: self.ignoreCase;
7220
7221				self.exactMatch = F.is.boolean(data.filterExactMatch)
7222					? data.filterExactMatch
7223					: self.exactMatch;
7224
7225				self.focus = F.is.boolean(data.filterFocus)
7226					? data.filterFocus
7227					: self.focus;
7228
7229				self.delay = F.is.number(data.filterDelay)
7230					? data.filterDelay
7231					: self.delay;
7232
7233				self.placeholder = F.is.string(data.filterPlaceholder)
7234					? data.filterPlaceholder
7235					: self.placeholder;
7236
7237				self.dropdownTitle = F.is.string(data.filterDropdownTitle)
7238					? data.filterDropdownTitle
7239					: self.dropdownTitle;
7240
7241				self.container = F.is.string(data.filterContainer)
7242					? data.filterContainer
7243					: self.container;
7244
7245				self.filters = F.is.array(data.filterFilters)
7246					? self.ensure(data.filterFilters)
7247					: self.ensure(self.filters);
7248
7249				if (self.ft.$el.hasClass('footable-filtering-left'))
7250					self.position = 'left';
7251				if (self.ft.$el.hasClass('footable-filtering-center'))
7252					self.position = 'center';
7253				if (self.ft.$el.hasClass('footable-filtering-right'))
7254					self.position = 'right';
7255
7256				self.position = F.is.string(data.filterPosition)
7257					? data.filterPosition
7258					: self.position;
7259			},function(){
7260				self.enabled = false;
7261			});
7262		},
7263		/**
7264		 * Initializes the filtering component for the plugin.
7265		 * @instance
7266		 * @protected
7267		 * @fires FooTable.Filtering#"init.ft.filtering"
7268		 */
7269		init: function () {
7270			var self = this;
7271			/**
7272			 * The init.ft.filtering event is raised before its UI is generated.
7273			 * Calling preventDefault on this event will disable the component.
7274			 * @event FooTable.Filtering#"init.ft.filtering"
7275			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7276			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7277			 */
7278			return self.ft.raise('init.ft.filtering').then(function(){
7279				self.$create();
7280			}, function(){
7281				self.enabled = false;
7282			});
7283		},
7284		/**
7285		 * Destroys the filtering component removing any UI from the table.
7286		 * @instance
7287		 * @protected
7288		 * @fires FooTable.Filtering#"destroy.ft.filtering"
7289		 */
7290		destroy: function () {
7291			var self = this;
7292			/**
7293			 * The destroy.ft.filtering event is raised before its UI is removed.
7294			 * Calling preventDefault on this event will prevent the component from being destroyed.
7295			 * @event FooTable.Filtering#"destroy.ft.filtering"
7296			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7297			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7298			 */
7299			return self.ft.raise('destroy.ft.filtering').then(function(){
7300				self.ft.$el.removeClass('footable-filtering')
7301					.find('thead > tr.footable-filtering').remove();
7302			});
7303		},
7304		/**
7305		 * Creates the filtering UI from the current options setting the various jQuery properties of this component.
7306		 * @instance
7307		 * @protected
7308		 * @this FooTable.Filtering
7309		 */
7310		$create: function () {
7311			var self = this;
7312			// generate the cell that actually contains all the UI.
7313			var $form_grp = $('<div/>', {'class': 'form-group footable-filtering-search'})
7314					.append($('<label/>', {'class': 'sr-only', text: 'Search'})),
7315				$input_grp = $('<div/>', {'class': 'input-group'}).appendTo($form_grp),
7316				$input_grp_btn = $('<div/>', {'class': 'input-group-btn'}),
7317				$dropdown_toggle = $('<button/>', {type: 'button', 'class': 'btn btn-default dropdown-toggle'})
7318					.on('click', { self: self }, self._onDropdownToggleClicked)
7319					.append($('<span/>', {'class': 'caret'})),
7320				position;
7321
7322			switch (self.position){
7323				case 'left': position = 'footable-filtering-left'; break;
7324				case 'center': position = 'footable-filtering-center'; break;
7325				default: position = 'footable-filtering-right'; break;
7326			}
7327			self.ft.$el.addClass('footable-filtering').addClass(position);
7328
7329			self.$container = self.container === null ? $() : $(self.container).first();
7330			if (!self.$container.length){
7331				// add it to a row and then populate it with the search input and column selector dropdown.
7332				self.$row = $('<tr/>', {'class': 'footable-filtering'}).prependTo(self.ft.$el.children('thead'));
7333				self.$cell = $('<th/>').attr('colspan', self.ft.columns.visibleColspan).appendTo(self.$row);
7334				self.$container = self.$cell;
7335			} else {
7336				self.$container.addClass('footable-filtering-external').addClass(position);
7337			}
7338			self.$form = $('<form/>', {'class': 'form-inline'}).append($form_grp).appendTo(self.$container);
7339
7340			self.$input = $('<input/>', {type: 'text', 'class': 'form-control', placeholder: self.placeholder});
7341
7342			self.$button = $('<button/>', {type: 'button', 'class': 'btn btn-primary'})
7343				.on('click', { self: self }, self._onSearchButtonClicked)
7344				.append($('<span/>', {'class': 'fooicon fooicon-search'}));
7345
7346			self.$dropdown = $('<ul/>', {'class': 'dropdown-menu dropdown-menu-right'});
7347			if (!F.is.emptyString(self.dropdownTitle)){
7348				self.$dropdown.append($('<li/>', {'class': 'dropdown-header','text': self.dropdownTitle}));
7349			}
7350			self.$dropdown.append(
7351				F.arr.map(self.ft.columns.array, function (col) {
7352					return col.filterable ? $('<li/>').append(
7353						$('<a/>', {'class': 'checkbox'}).append(
7354							$('<label/>', {html: col.title}).prepend(
7355								$('<input/>', {type: 'checkbox', checked: true}).data('__FooTableColumn__', col)
7356							)
7357						)
7358					) : null;
7359				})
7360			);
7361
7362			if (self.delay > 0){
7363				self.$input.on('keypress keyup paste', { self: self }, self._onSearchInputChanged);
7364				self.$dropdown.on('click', 'input[type="checkbox"]', {self: self}, self._onSearchColumnClicked);
7365			}
7366
7367			$input_grp_btn.append(self.$button, $dropdown_toggle, self.$dropdown);
7368			$input_grp.append(self.$input, $input_grp_btn);
7369		},
7370		/**
7371		 * Performs the filtering of rows before they are appended to the page.
7372		 * @instance
7373		 * @protected
7374		 */
7375		predraw: function(){
7376			if (F.is.emptyArray(this.filters))
7377				return;
7378
7379			var self = this;
7380			self.ft.rows.array = $.grep(self.ft.rows.array, function(r){
7381				return r.filtered(self.filters);
7382			});
7383		},
7384		/**
7385		 * As the rows are drawn by the {@link FooTable.Rows#draw}
7385 method this simply updates the colspan for the UI.
7386		 * @instance
7387		 * @protected
7388		 */
7389		draw: function(){
7390			if (F.is.jq(this.$cell)){
7391				this.$cell.attr('colspan', this.ft.columns.visibleColspan);
7392			}
7393			var search = this.find('search');
7394			if (search instanceof F.Filter){
7395				var query = search.query.val();
7396				if (this.exactMatch && this._exactRegExp.test(query)){
7397					query = query.replace(this._exactRegExp, '$1');
7398				}
7399				this.$input.val(query);
7400			} else {
7401				this.$input.val(null);
7402			}
7403			this.setButton(!F.arr.any(this.filters, function(f){ return !f.hidden; }));
7404		},
7405
7406		/* PUBLIC */
7407		/**
7408		 * Adds or updates the filter using the supplied name, query and columns.
7409		 * @instance
7410		 * @param {(string|FooTable.Filter|object)} nameOrFilter - The name for the filter or the actual filter object itself.
7411		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
7412		 * @param {(Array.<number>|Array.<string>|Array.<FooTable.Column>)} [columns] - The columns to apply the filter to.
7413		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
7414		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
7415		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
7416		 * @param {string} [space="AND"] - How the query treats space chars.
7417		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
7418		 */
7419		addFilter: function(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden){
7420			var f = this.createFilter(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden);
7421			if (f instanceof F.Filter){
7422				this.removeFilter(f.name);
7423				this.filters.push(f);
7424			}
7425		},
7426		/**
7427		 * Removes the filter using the supplied name if it exists.
7428		 * @instance
7429		 * @param {string} name - The name of the filter to remove.
7430		 */
7431		removeFilter: function(name){
7432			F.arr.remove(this.filters, function(f){ return f.name == name; });
7433		},
7434		/**
7435		 * Performs the required steps to handle filtering including the raising of the {@link FooTable.Filtering#"before.ft.filtering"} and {@link FooTable.Filtering#"after.ft.filtering"} events.
7436		 * @instance
7437		 * @param {boolean} [focus=false] - Whether or not to set the focus to the input once filtering is complete.
7438		 * @returns {jQuery.Promise}
7439		 * @fires FooTable.Filtering#"before.ft.filtering"
7440		 * @fires FooTable.Filtering#"after.ft.filtering"
7441		 */
7442		filter: function(focus){
7443			var self = this;
7444			self.filters = self.ensure(self.filters);
7445			/**
7446			 * The before.ft.filtering event is raised before a filter is applied and allows listeners to modify the filter or cancel it completely by calling preventDefault on the jQuery.Event object.
7447			 * @event FooTable.Filtering#"before.ft.filtering"
7448			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7449			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7450			 * @param {Array.<FooTable.Filter>} filters - The filters that are about to be applied.
7451			 */
7452			return self.ft.raise('before.ft.filtering', [self.filters]).then(function(){
7453				self.filters = self.ensure(self.filters);
7454				if (focus){
7455					var start = self.$input.prop('selectionStart'),
7456						end = self.$input.prop('selectionEnd');
7457				}
7458				return self.ft.draw().then(function(){
7459					if (focus){
7460						self.$input.focus().prop({
7461							selectionStart: start,
7462							selectionEnd: end
7463						});
7464					}
7465					/**
7466					 * The after.ft.filtering event is raised after a filter has been applied.
7467					 * @event FooTable.Filtering#"after.ft.filtering"
7468					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7469					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7470					 * @param {FooTable.Filter} filter - The filters that were applied.
7471					 */
7472					self.ft.raise('after.ft.filtering', [self.filters]);
7473				});
7474			});
7475		},
7476		/**
7477		 * Removes the current search filter.
7478		 * @instance
7479		 * @returns {jQuery.Promise}
7480		 * @fires FooTable.Filtering#"before.ft.filtering"
7481		 * @fires FooTable.Filtering#"after.ft.filtering"
7482		 */
7483		clear: function(){
7484			this.filters = F.arr.get(this.filters, function(f){ return f.hidden; });
7485			return this.filter(this.focus);
7486		},
7487		/**
7488		 * Toggles the button icon between the search and clear icons based on the supplied value.
7489		 * @instance
7490		 * @param {boolean} search - Whether or not to display the search icon.
7491		 */
7492		setButton: function(search){
7493			if (!search){
7494				this.$button.children('.fooicon').removeClass('fooicon-search').addClass('fooicon-remove');
7495			} else {
7496				this.$button.children('.fooicon').removeClass('fooicon-remove').addClass('fooicon-search');
7497			}
7498		},
7499		/**
7500		 * Finds a filter by name.
7501		 * @param {string} name - The name of the filter to find.
7502		 * @returns {(FooTable.Filter|null)}
7503		 */
7504		find: function(name){
7505			return F.arr.first(this.filters, function(f){ return f.name == name; });
7506		},
7507		/**
7508		 * Gets an array of {@link FooTable.Column}
7508 to apply the search filter to. This also doubles as the default columns for filters which do not specify any columns.
7509		 * @instance
7510		 * @returns {Array.<FooTable.Column>}
7511		 */
7512		columns: function(){
7513			if (F.is.jq(this.$dropdown)){
7514				// if we have a dropdown containing the column names get the selected columns from there
7515				return this.$dropdown.find('input:checked').map(function(){
7516					return $(this).data('__FooTableColumn__');
7517				}).get();
7518			} else {
7519				// otherwise find all columns that are set to be filterable.
7520				return this.ft.columns.get(function(c){ return c.filterable; });
7521			}
7522		},
7523		/**
7524		 * Takes an array of plain objects containing the filter values or actual {@link FooTable.Filter} objects and ensures that an array of only {@link FooTable.Filter} is returned.
7525		 * If supplied a plain object that object must contain a name, query and columns properties which are used to create a new {@link FooTable.Filter}.
7526		 * @instance
7527		 * @param {({name: string, query: (string|FooTable.Query), columns: (Array.<string>|Array.<number>|Array.<FooTable.Column>)}|Array.<FooTable.Filter>)} filters - The array of filters to check.
7528		 * @returns {Array.<FooTable.Filter>}
7529		 */
7530		ensure: function(filters){
7531			var self = this, parsed = [], filterable = self.columns();
7532			if (!F.is.emptyArray(filters)){
7533				F.arr.each(filters, function(f){
7534					f = self._ensure(f, filterable);
7535					if (f instanceof F.Filter) parsed.push(f);
7536				});
7537			}
7538			return parsed;
7539		},
7540
7541		/**
7542		 * Creates a new filter using the supplied object or individual parameters to populate it.
7543		 * @instance
7544		 * @param {(string|FooTable.Filter|object)} nameOrObject - The name for the filter or the actual filter object itself.
7545		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
7546		 * @param {(Array.<number>|Array.<string>|Array.<FooTable.Column>)} [columns] - The columns to apply the filter to.
7547		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
7548		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
7549		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
7550		 * @param {string} [space="AND"] - How the query treats space chars.
7551		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
7552		 * @returns {*}
7553		 */
7554		createFilter: function(nameOrObject, query, columns, ignoreCase, connectors, space, hidden){
7555			if (F.is.string(nameOrObject)){
7556				nameOrObject = {name: nameOrObject, query: query, columns: columns, ignoreCase: ignoreCase, connectors: connectors, space: space, hidden: hidden};
7557			}
7558			return this._ensure(nameOrObject, this.columns());
7559		},
7560
7561		/* PRIVATE */
7562		_ensure: function(filter, selectedColumns){
7563			if ((F.is.hash(filter) || filter instanceof F.Filter) && !F.is.emptyString(filter.name) && (!F.is.emptyString(filter.query) || filter.query instanceof F.Query)){
7564				filter.columns = F.is.emptyArray(filter.columns) ? selectedColumns : this.ft.columns.ensure(filter.columns);
7565				filter.ignoreCase = F.is.boolean(filter.ignoreCase) ? filter.ignoreCase : this.ignoreCase;
7566				filter.connectors = F.is.boolean(filter.connectors) ? filter.connectors : this.connectors;
7567				filter.hidden = F.is.boolean(filter.hidden) ? filter.hidden : false;
7568				filter.space = F.is.string(filter.space) && (filter.space === 'AND' || filter.space === 'OR') ? filter.space : this.space;
7569				filter.query = F.is.string(filter.query) ? new F.Query(filter.query, filter.space, filter.connectors, filter.ignoreCase) : filter.query;
7570				return (filter instanceof F.Filter)
7571					? filter
7572					: new F.Filter(filter.name, filter.query, filter.columns, filter.space, filter.connectors, filter.ignoreCase, filter.hidden);
7573			}
7574			return null;
7575		},
7576		/**
7577		 * Handles the change event for the {@link FooTable.Filtering#$input}.
7578		 * @instance
7579		 * @private
7580		 * @param {jQuery.Event} e - The event object for the event.
7581		 */
7582		_onSearchInputChanged: function (e) {
7583			var self = e.data.self;
7584			var alpha = e.type == 'keypress' && !F.is.emptyString(String.fromCharCode(e.charCode)),
7585				ctrl = e.type == 'keyup' && (e.which == 8 || e.which == 46),
7586				paste = e.type == 'paste'; // backspace & delete
7587
7588			// if alphanumeric characters or specific control characters
7589			if(alpha || ctrl || paste) {
7590				if (e.which == 13) e.preventDefault();
7591				if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
7592				self._filterTimeout = setTimeout(function(){
7593					self._filterTimeout = null;
7594					var query = self.$input.val();
7595					if (query.length >= self.min){
7596						if (self.exactMatch && !self._exactRegExp.test(query)){
7597							query = '"' + query + '"';
7598						}
7599						self.addFilter('search', query);
7600						self.filter(self.focus);
7601					} else if (F.is.emptyString(query)){
7602						self.clear();
7603					}
7604				}, self.delay);
7605			}
7606		},
7607		/**
7608		 * Handles the click event for the {@link FooTable.Filtering#$button}.
7609		 * @instance
7610		 * @private
7611		 * @param {jQuery.Event} e - The event object for the event.
7612		 */
7613		_onSearchButtonClicked: function (e) {
7614			e.preventDefault();
7615			var self = e.data.self;
7616			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
7617			var $icon = self.$button.children('.fooicon');
7618			if ($icon.hasClass('fooicon-remove')) self.clear();
7619			else {
7620				var query = self.$input.val();
7621				if (query.length >= self.min){
7622					if (self.exactMatch && !self._exactRegExp.test(query)){
7623						query = '"' + query + '"';
7624					}
7625					self.addFilter('search', query);
7626					self.filter(self.focus);
7627				}
7628			}
7629		},
7630		/**
7631		 * Handles the click event for the column checkboxes in the {@link FooTable.Filtering#$dropdown}.
7632		 * @instance
7633		 * @private
7634		 * @param {jQuery.Event} e - The event object for the event.
7635		 */
7636		_onSearchColumnClicked: function (e) {
7637			var self = e.data.self;
7638			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
7639			self._filterTimeout = setTimeout(function(){
7640				self._filterTimeout = null;
7641				var $icon = self.$button.children('.fooicon');
7642				if ($icon.hasClass('fooicon-remove')){
7643					$icon.removeClass('fooicon-remove').addClass('fooicon-search');
7644					self.addFilter('search', self.$input.val());
7645					self.filter();
7646				}
7647			}, self.delay);
7648		},
7649		/**
7650		 * Handles the click event for the {@link FooTable.Filtering#$dropdown} toggle.
7651		 * @instance
7652		 * @private
7653		 * @param {jQuery.Event} e - The event object for the event.
7654		 */
7655		_onDropdownToggleClicked: function (e) {
7656			e.preventDefault();
7657			e.stopPropagation();
7658			var self = e.data.self;
7659			self.$dropdown.parent().toggleClass('open');
7660			if (self.$dropdown.parent().hasClass('open')) $(document).on('click.footable', { self: self }, self._onDocumentClicked);
7661			else $(document).off('click.footable', self._onDocumentClicked);
7662		},
7663		/**
7664		 * Checks all click events when the dropdown is visible and closes the menu if the target is not the dropdown.
7665		 * @instance
7666		 * @private
7667		 * @param {jQuery.Event} e - The event object for the event.
7668		 */
7669		_onDocumentClicked: function(e){
7670			if ($(e.target).closest('.dropdown-menu').length == 0){
7671				e.preventDefault();
7672				var self = e.data.self;
7673				self.$dropdown.parent().removeClass('open');
7674				$(document).off('click.footable', self._onDocumentClicked);
7675			}
7676		}
7677	});
7678
7679	F.components.register('filtering', F.Filtering, 500);
7680
7681})(jQuery, FooTable);
7682
7683(function(F){
7684	F.Query = F.Class.extend(/** @lends FooTable.Query */{
7685		/**
7686		 * The query object is used to parse and test the filtering component's queries
7687		 * @constructs
7688		 * @extends FooTable.Class
7689		 * @param {string} query - The string value of the query.
7690		 * @param {string} [space="AND"] - How the query treats whitespace.
7691		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
7692		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
7693		 * @returns {FooTable.Query}
7694		 */
7695		construct: function(query, space, connectors, ignoreCase){
7696			/* PRIVATE */
7697			/**
7698			 * Holds the previous value of the query and is used internally in the {@link FooTable.Query#val} method.
7699			 * @type {string}
7700			 * @private
7701			 */
7702			this._original = null;
7703			/**
7704			 * Holds the value for the query. Access to this variable is provided through the {@link FooTable.Query#val} method.
7705			 * @type {string}
7706			 * @private
7707			 */
7708			this._value = null;
7709			/* PUBLIC */
7710			/**
7711			 * A string specifying how the query treats whitespace. Can be either "OR" or "AND".
7712			 * @type {string}
7713			 */
7714			this.space = F.is.string(space) && (space == 'OR' || space == 'AND') ? space : 'AND';
7715			/**
7716			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
7717			 * @instance
7718			 * @type {boolean}
7719			 */
7720			this.connectors = F.is.boolean(connectors) ? connectors : true;
7721			/**
7722			 * Whether or not ignore case when matching.
7723			 * @instance
7724			 * @type {boolean}
7725			 */
7726			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
7727			/**
7728			 * The left side of the query if one exists. OR takes precedence over AND.
7729			 * @type {FooTable.Query}
7730			 * @example <caption>
7730The below shows what is meant by the "left" side of a query</caption>
7731			 * query = "Dave AND Mary" - "Dave" is the left side of the query.
7732			 * query = "Dave AND Mary OR John" - "Dave and Mary" is the left side of the query.
7733			 */
7734			this.left = null;
7735			/**
7736			 * The right side of the query if one exists. OR takes precedence over AND.
7737			 * @type {FooTable.Query}
7738			 * @example <caption>The below shows what is meant by the "right" side of a query</caption>
7739			 * query = "Dave AND Mary" - "Mary" is the right side of the query.
7740			 * query = "Dave AND Mary OR John" - "John" is the right side of the query.
7741			 */
7742			this.right = null;
7743			/**
7744			 * The parsed parts of the query. This contains the information used to actually perform a match against a string.
7745			 * @type {Array}
7746			 */
7747			this.parts = [];
7748			/**
7749			 * The type of operand to apply to the results of the individual parts of the query.
7750			 * @type {string}
7751			 */
7752			this.operator = null;
7753			this.val(query);
7754		},
7755		/**
7756		 * Gets or sets the value for the query. During set the value is parsed setting all properties as required.
7757		 * @param {string} [value] - If supplied the value to set for this query.
7758		 * @returns {(string|undefined)}
7759		 */
7760		val: function(value){
7761			// get
7762			if (F.is.emptyString(value)) return this._value;
7763
7764			// set
7765			if (F.is.emptyString(this._original)) this._original = value;
7766			else if (this._original == value) return;
7767
7768			this._value = value;
7769			this._parse();
7770		},
7771		/**
7772		 * Tests the supplied string against the query.
7773		 * @param {string} str - The string to test.
7774		 * @returns {boolean}
7775		 */
7776		match: function(str){
7777			if (F.is.emptyString(this.operator) || this.operator === 'OR')
7778				return this._left(str, false) || this._match(str, false) || this._right(str, false);
7779			if (this.operator === 'AND')
7780				return this._left(str, true) && this._match(str, true) && this._right(str, true);
7781		},
7782		/**
7783		 * Matches this queries parts array against the supplied string.
7784		 * @param {string} str - The string to test.
7785		 * @param {boolean} def - The default value to return based on the operand.
7786		 * @returns {boolean}
7787		 * @private
7788		 */
7789		_match: function(str, def){
7790			var self = this, result = false, empty = F.is.emptyString(str);
7791			if (F.is.emptyArray(self.parts) && self.left instanceof F.Query) return def;
7792			if (F.is.emptyArray(self.parts)) return result;
7793			if (self.space === 'OR'){
7794				// with OR we give the str every part to test and if any match it is a success, we do exit early if a negated match occurs
7795				F.arr.each(self.parts, function(p){
7796					if (p.empty && empty){
7797						result = true;
7798						if (p.negate){
7799							result = false;
7800							return result;
7801						}
7802					} else {
7803						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
7804						if (match && !p.negate) result = true;
7805						if (match && p.negate) {
7806							result = false;
7807							return result;
7808						}
7809					}
7810				});
7811			} else {
7812				// otherwise with AND we check until the first failure and then exit
7813				result = true;
7814				F.arr.each(self.parts, function(p){
7815					if (p.empty){
7816						if ((!empty && !p.negate) || (empty && p.negate)) result = false;
7817						return result;
7818					} else {
7819						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
7820						if ((!match && !p.negate) || (match && p.negate)) result = false;
7821						return result;
7822					}
7823				});
7824			}
7825			return result;
7826		},
7827		/**
7828		 * Matches the left side of the query if one exists with the supplied string.
7829		 * @param {string} str - The string to test.
7830		 * @param {boolean} def - The default value to return based on the operand.
7831		 * @returns {boolean}
7832		 * @private
7833		 */
7834		_left: function(str, def){
7835			return (this.left instanceof F.Query) ? this.left.match(str) : def;
7836		},
7837		/**
7838		 * Matches the right side of the query if one exists with the supplied string.
7839		 * @param {string} str - The string to test.
7840		 * @param {boolean} def - The default value to return based on the operand.
7841		 * @returns {boolean}
7842		 * @private
7843		 */
7844		_right: function(str, def){
7845			return (this.right instanceof F.Query) ? this.right.match(str) : def;
7846		},
7847		/**
7848		 * Parses the private {@link FooTable.Query#_value} property and populates the object.
7849		 * @private
7850		 */
7851		_parse: function(){
7852			if (F.is.emptyString(this._value)) return;
7853			// OR takes precedence so test for it first
7854			if (/\sOR\s/.test(this._value)){
7855				// we have an OR so split the value on the first occurrence of OR to get the left and right sides of the statement
7856				this.operator = 'OR';
7857				var or = this._value.split(/(?:\sOR\s)(.*)?/);
7858				this.left = new F.Query(or[0], this.space, this.connectors, this.ignoreCase);
7859				this.right = new F.Query(or[1], this.space, this.connectors, this.ignoreCase);
7860			} else if (/\sAND\s/.test(this._value)) {
7861				// there are no more OR's so start with AND
7862				this.operator = 'AND';
7863				var and = this._value.split(/(?:\sAND\s)(.*)?/);
7864				this.left = new F.Query(and[0], this.space, this.connectors, this.ignoreCase);
7865				this.right = new F.Query(and[1], this.space, this.connectors, this.ignoreCase);
7866			} else {
7867				// we have no more statements to parse so set the parts array by parsing each part of the remaining query
7868				var self = this;
7869				this.parts = F.arr.map(this._value.match(/(?:[^\s"]+|"[^"]*")+/g), function(str){
7870					return self._part(str);
7871				});
7872			}
7873		},
7874		/**
7875		 * Parses a single part of a query into an object to use during matching.
7876		 * @param {string} str - The string representation of the part.
7877		 * @returns {{query: string, negate: boolean, phrase: boolean, exact: boolean}}
7878		 * @private
7879		 */
7880		_part: function(str){
7881			var p = {
7882				query: str,
7883				negate: false,
7884				phrase: false,
7885				exact: false,
7886				empty: false
7887			};
7888			// support for NEGATE operand - (minus sign). Remove this first so we can get onto phrase checking
7889			if (F.str.startsWith(p.query, '-')){
7890				p.query = F.str.from(p.query, '-');
7891				p.negate = true;
7892			}
7893			// support for PHRASES (exact matches)
7894			if (/^"(.*?)"$/.test(p.query)){ // if surrounded in quotes strip them and nothing else
7895				p.query = p.query.replace(/^"(.*?)"$/, '$1');
7896				p.phrase = true;
7897				p.exact = true;
7898			} else if (this.connectors && /(?:\w)+?([-_\+\.])(?:\w)+?/.test(p.query)) { // otherwise replace supported phrase connectors (-_+.) with spaces
7899				p.query = p.query.replace(/(?:\w)+?([-_\+\.])(?:\w)+?/g, function(match, p1){
7900					return match.replace(p1, ' ');
7901				});
7902				p.phrase = true;
7903			}
7904			p.empty = p.phrase && F.is.emptyString(p.query);
7905			return p;
7906		}
7907	});
7908
7909})(FooTable);
7910(function(F){
7911
7912	/**
7913	 * The value used by the filtering component during filter operations. Must be a string and can be set using the data-filter-value attribute on the cell itself.
7914	 * If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Filtering} component.
7915	 * @type {string}
7916	 * @default null
7917	 */
7918	F.Cell.prototype.filterValue = null;
7919
7920	// this is used to define the filtering specific properties on cell creation
7921	F.Cell.prototype.__filtering_define__ = function(valueOrElement){
7922		this.filterValue = this.column.filterValue.call(this.column, valueOrElement);
7923	};
7924
7925	// this is used to update the filterValue property whenever the cell value is changed
7926	F.Cell.prototype.__filtering_val__ = function(value){
7927		if (F.is.defined(value)){
7928			// set only
7929			this.filterValue = this.column.filterValue.call(this.column, value);
7930		}
7931	};
7932
7933	// overrides the public define method and replaces it with our own
7934	F.Cell.extend('define', function(valueOrElement){
7935		this._super(valueOrElement);
7936		this.__filtering_define__(valueOrElement);
7937	});
7938	// overrides the public val method and replaces it with our own
7939	F.Cell.extend('val', function(value, redraw, redrawSelf){
7940		var val = this._super(value, redraw, redrawSelf);
7941		this.__filtering_val__(value);
7942		return val;
7943	});
7944})(FooTable);
7945(function($, F){
7946	/**
7947	 * Whether or not the column can be used during filtering. Added by the {@link FooTable.Filtering} component.
7948	 * @type {boolean}
7949	 * @default true
7950	 */
7951	F.Column.prototype.filterable = true;
7952
7953	/**
7954	 * This is supplied either the cell value or jQuery object to parse. A str
7954ing value must be returned from this method and will be used during filtering operations.
7955	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
7956	 * @returns {string}
7957	 * @this FooTable.Column
7958	 */
7959	F.Column.prototype.filterValue = function(valueOrElement){
7960		// if we have an element or a jQuery object use jQuery to get the value
7961		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
7962			var data = $(valueOrElement).data('filterValue');
7963			return F.is.defined(data) ? ''+data : $(valueOrElement).text();
7964		}
7965		// if options are supplied with the value
7966		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
7967			if (F.is.string(valueOrElement.options.filterValue)) return valueOrElement.options.filterValue;
7968			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
7969		}
7970		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+''; // use the native toString of the value
7971		return ''; // otherwise we have no value so return an empty string
7972	};
7973
7974	// this is used to define the filtering specific properties on column creation
7975	F.Column.prototype.__filtering_define__ = function(definition){
7976		this.filterable = F.is.boolean(definition.filterable) ? definition.filterable : this.filterable;
7977		this.filterValue = F.checkFnValue(this, definition.filterValue, this.filterValue);
7978	};
7979
7980	// overrides the public define method and replaces it with our own
7981	F.Column.extend('define', function(definition){
7982		this._super(definition); // call the base so we don't have to redefine any previously set properties
7983		this.__filtering_define__(definition); // then call our own
7984	});
7985})(jQuery, FooTable);
7986(function(F){
7987	/**
7988	 * An object containing the filtering options for the plugin. Added by the {@link FooTable.Filtering} component.
7989	 * @type {object}
7990	 * @prop {boolean} enabled=false - Whether or not to allow filtering on the table.
7991	 * @prop {({name: string, query: (string|FooTable.Query), columns: (Array.<string>|Array.<number>|Array.<FooTable.Column>)}|Array.<FooTable.Filter>)} filters - The filters to apply to the current {@link FooTable.Rows#array}.
7992	 * @prop {number} delay=1200 - The delay in milliseconds before the query is auto applied after a change (any value equal to or less than zero will disable this).
7993	 * @prop {number} min=1 - The minimum number of characters allowed in the search input before it is auto applied.
7994	 * @prop {string} space="AND" - Specifies how whitespace in a filter query is handled.
7995	 * @prop {string} placeholder="Search" - The string used as the placeholder for the search input.
7996	 * @prop {string} dropdownTitle=null - The title to display at the top of the search input column select.
7997	 * @prop {string} position="right" - The string used to specify the alignment of the search input.
7998	 * @prop {string} connectors=true - Whether or not to replace phrase connectors (+.-_) with space before executing the query.
7999	 * @prop {boolean} ignoreCase=true - Whether or not ignore case when matching.
8000	 * @prop {boolean} exactMatch=false - Whether or not search queries are treated as phrases when matching.
8001	 * @prop {boolean} focus=true - Whether or not to focus the search input after the search/clear button is clicked or after auto applying the search input query.
8002	 * @prop {string} container=null - A selector specifying where to place the filtering components form, if null the form is displayed within a row in the head of the table.
8003	 */
8004	F.Defaults.prototype.filtering = {
8005		enabled: false,
8006		filters: [],
8007		delay: 1200,
8008		min: 1,
8009		space: 'AND',
8010		placeholder: 'Search',
8011		dropdownTitle: null,
8012		position: 'right',
8013		connectors: true,
8014		ignoreCase: true,
8015		exactMatch: false,
8016		focus: true,
8017		container: null
8018	};
8019})(FooTable);
8020(function(F){
8021	/**
8022	 * Checks if the row is filtered using the supplied filters.
8023	 * @this FooTable.Row
8024	 * @param {Array.<FooTable.Filter>} filters - The filters to apply.
8025	 * @returns {boolean}
8026	 */
8027	F.Row.prototype.filtered = function(filters){
8028		var result = true, self = this;
8029		F.arr.each(filters, function(f){
8030			if ((result = f.matchRow(self)) == false) return false;
8031		});
8032		return result;
8033	};
8034})(FooTable);
8035(function($, F){
8036
8037	F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
8038		/**
8039		 * The sorter object contains the column and direction to sort by.
8040		 * @constructs
8041		 * @extends FooTable.Class
8042		 * @param {FooTable.Column} column - The column to sort.
8043		 * @param {string} direction - The direction to sort by.
8044		 * @returns {FooTable.Sorter}
8045		 */
8046		construct: function(column, direction){
8047			/**
8048			 * The column to sort.
8049			 * @type {FooTable.Column}
8050			 */
8051			this.column = column;
8052			/**
8053			 * The direction to sort by.
8054			 * @type {string}
8055			 */
8056			this.direction = direction;
8057		}
8058	});
8059
8060})(jQuery, FooTable);
8061(function ($, F) {
8062	F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
8063		/**
8064		 * The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
8065		 * @constructs
8066		 * @extends FooTable.Component
8067		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
8068		 * @returns {FooTable.Sorting}
8069		 */
8070		construct: function (table) {
8071			// call the constructor of the base class
8072			this._super(table, table.o.sorting.enabled);
8073
8074			/* PROTECTED */
8075			/**
8076			 * This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
8077			 * @instance
8078			 * @protected
8079			 * @type {object}
8080			 */
8081			this.o = table.o.sorting;
8082			/**
8083			 * The current sorted column.
8084			 * @instance
8085			 * @type {FooTable.Column}
8086			 */
8087			this.column = null;
8088			/**
8089			 * Whether or not to allow sorting to occur, should be set using the {@link FooTable.Sorting#toggleAllowed} method.
8090			 * @instance
8091			 * @type {boolean}
8092			 */
8093			this.allowed = true;
8094			/**
8095			 * The initial sort state of the table, this value is used for determining if the sorting has occurred or to reset the state to default.
8096			 * @instance
8097			 * @type {{isset: boolean, rows: Array.<FooTable.Row>, column: string, direction: ?string}}
8098			 */
8099			this.initial = null;
8100		},
8101
8102		/* PROTECTED */
8103		/**
8104		 * Checks the supplied data and options for the sorting component.
8105		 * @instance
8106		 * @protected
8107		 * @param {object} data - The jQuery data object from the parent table.
8108		 * @fires FooTable.Sorting#"preinit.ft.sorting"
8109		 * @this FooTable.Sorting
8110		 */
8111		preinit: function(data){
8112			var self = this;
8113			/**
8114			 * The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
8115			 * Calling preventDefault on this event will disable the component.
8116			 * @event FooTable.Sorting#"preinit.ft.sorting"
8117			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8118			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8119			 * @param {object} data - The jQuery data object of the table raising the event.
8120			 */
8121			this.ft.raise('preinit.ft.sorting', [data]).then(function(){
8122				if (self.ft.$el.hasClass('footable-sorting'))
8123					self.enabled = true;
8124				self.enabled = F.is.boolean(data.sorting)
8125					? data.sorting
8126					: self.enabled;
8127				if (!self.enabled) return;
8128				self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
8129			}, function(){
8130				self.enabled = false;
8131			});
8132		},
8133		/**
8134		 * Initializes the sorting component for the plugin using the supplied table and options.
8135		 * @instance
8136		 * @protected
8137		 * @fires FooTable.Sorting#"init.ft.sorting"
8138		 * @this FooTable.Sorting
8139		 */
8140		init: function () {
8141			/**
8142			 * The init.ft.sorting event is raised before its UI is generated.
8143			 * Calling preventDefault on this event will disable the component.
8144			 * @event FooTable.Sorting#"init.ft.sorting"
8145			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8146			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8147			 */
8148			var self = this;
8149			this.ft.raise('init.ft.sorting').then(function(){
8150				if (!self.initial){
8151					var isset = !!self.column;
8152					self.initial = {
8153						isset: isset,
8154						// grab a shallow copy of the rows array prior to sorting - allows us to reset without an initial sort
8155						rows: self.ft.rows.all.slice(0),
8156						// if there is a sorted column store its name and direction
8157						column: isset ? self.column.name : null,
8158						direction: isset ? self.column.direction : null
8159					}
8160				}
8161				F.arr.each(self.ft.columns.array, function(col){
8162					if (col.sortable){
8163						col.$el.addClass('footable-sortable').append($('<span/>', {'class': 'fooicon fooicon-sort'}));
8164					}
8165				});
8166				self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
8167			}, function(){
8168				self.enabled = false;
8169			});
8170		},
8171		/**
8172		 * Destroys the sorting component removing any UI generated from the table.
8173		 * @instance
8174		 * @protected
8175		 * @fires FooTable.Sorting#"destroy.ft.sorting"
8176		 */
8177		destroy: function () {
8178			/**
8179			 * The destroy.ft.sorting event is raised before its UI is removed.
8180			 * Calling preventDefault on this event will prevent the component from being destroyed.
8181			 * @event FooTable.Sorting#"destroy.ft.sorting"
8182			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8183			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8184			 */
8185			var self = this;
8186			this.ft.raise('destroy.ft.paging').then(function(){
8187				self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
8188				self.ft.$el.children('thead').children('tr.footable-header')
8189					.children('.footable-sortable').removeClass('footable-sortable footable-asc footable-desc')
8190					.find('span.fooicon').remove();
8191			});
8192		},
8193		/**
8194		 * Performs the actual sorting against the {@link FooTable.Rows#current} array.
8195		 * @instance
8196		 * @protected
8197		 */
8198		predraw: function () {
8199			if (!this.column) return;
8200			var self = this, col = self.column;
8201			self.ft.rows.array.sort(function (a, b) {
8202				return col.direction == 'DESC'
8203						? col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue)
8204						: col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue);
8205			});
8206		},
8207		/**
8208		 * Updates the sorting UI setting the state of the sort buttons.
8209		 * @instance
8210		 * @protected
8211		 */
8212		draw: function () {
8213			if (!this.column) return;
8214			var self = this,
8215				$sortable = self.ft.$el.find('thead > tr > .footable-sortable'),
8216				$active = self.column.$el;
8217
8218			$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
8219			$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
8220			$active.addClass(self.column.direction == 'DESC' ? 'footable-desc' : 'footable-asc')
8221				.children('.fooicon').addClass(self.column.direction == 'DESC' ? 'fooicon-sort-desc' : 'fooicon-sort-asc');
8222		},
8223
8224		/* PUBLIC */
8225		/**
8226		 * Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
8227		 * @instance
8228		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
8229		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
8230		 * @returns {jQuery.Promise}
8231		 * @fires FooTable.Sorting#"before.ft.sorting"
8232		 * @fires FooTable.Sorting#"after.ft.sorting"
8233		 */
8234		sort: function(column, direction){
8235			return this._sort(column, direction);
8236		},
8237		/**
8238		 * Toggles whether or not sorting is currently allowed.
8239		 * @param {boolean} [state] - You can optionally specify the state you want it to be, if not supplied the current value is flipped.
8240		 */
8241		toggleAllowed: function(state){
8242			state = F.is.boolean(state) ? state : !this.allowed;
8243			this.allowed = state;
8244			this.ft.$el.toggleClass('footable-sorting-disabled', !this.allowed);
8245		},
8246		/**
8247		 * Checks whether any sorting has occurred for the table.
8248		 * @returns {boolean}
8249		 */
8250		hasChanged: function(){
8251			return !(!this.initial || !this.column ||
8252				(this.column.name === this.initial.column &&
8253					(this.column.direction === this.initial.direction || (this.initial.direction === null && this.column.direction === 'ASC')))
8254			);
8255		},
8256		/**
8257		 * Resets the table sorting to the initial state recorded in the components init method.
8258		 */
8259		reset: function(){
8260			if (!!this.initial){
8261				if (this.initial.isset){
8262					// if the initial value specified a column, sort by it
8263					this.sort(this.initial.column, this.initial.direction);
8264				} else {
8265					// if there was no initial column then we need to reset the rows to there original order
8266					if (!!this.column){
8267						// if there is a currently sorted column remove the asc/desc classes and set it to null.
8268						this.column.$el.removeClass('footable-asc footable-desc');
8269						this.column = null;
8270					}
8271					// replace the current all rows array with the one stored in the initial value
8272					this.ft.rows.all = this.initial.rows;
8273					// force the table to redraw itself using the updated rows array
8274					this.ft.draw();
8275				}
8276			}
8277		},
8278
8279		/* PRIVATE */
8280		/**
8281		 * Performs the required steps to handle sorting including the raising of the {@link FooTable.Sorting#"before.ft.sorting"} and {@link FooTable.Sorting#"after.ft.sorting"} events.
8282		 * @instance
8283		 * @private
8284		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
8285		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
8286		 * @returns {jQuery.Promise}
8287		 * @fires FooTable.Sorting#"before.ft.sorting"
8288		 * @fires FooTable.Sorting#"after.ft.sorting"
8289		 */
8290		_sort: function(column, direction){
8291			if (!this.allowed) return $.Deferred().reject('sorting disabled');
8292			var self = this;
8293			var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
8294			/**
8295			 * The before.ft.sorting event is raised before a sort is applied and allows listeners to modify the sorter or cancel it completely by calling preventDefault on the jQuery.Event object.
8296			 * @event FooTable.Sorting#"before.ft.sorting"
8297			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8298			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8299			 * @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
8300			 */
8301			return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
8302				F.arr.each(self.ft.columns.array, function(col){
8303					if (col != self.column) col.direction = null;
8304				});
8305				self.column = self.ft.columns.get(sorter.column);
8306				if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
8307				return self.ft.draw().then(function(){
8308					/**
8309					 * The after.ft.sorting event is raised after a sorter has been applied.
8310					 * @event FooTable.Sorting#"after.ft.sorting"
8311					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8312					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8313					 * @param {FooTable.Sorter} sorter - The sorter that has been applied.
8314					 */
8315					self.ft.raise('after.ft.sorting', [sorter]);
8316				});
8317			});
8318		},
8319		/**
8320		 * Handles the sort button clicked event.
8321		 * @instance
8322		 * @private
8323		 * @param {jQuery.Event} e - The event object for the event.
8324		 */
8325		_onSortClicked: function (e) {
8326			var self = e.data.self, $header = $(this).closest('th,td'),
8327				direction = $header.is('.footable-asc, .footable-desc')
8328					? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
8329					: 'ASC';
8330			self._sort($header.index(), direction);
8331		}
8332	});
8333
8334	/**
8335	 * Checks the supplied string is a valid direction and if not returns ASC as default.
8336	 * @static
8337	 * @protected
8338	 * @param {string} str - The string to check.
8339	 */
8340	F.Sorting.dir = function(str){
8341		return F.is.string(str) && (str == 'ASC' || str == 'DESC') ? str : 'ASC';
8342	};
8343
8344	F.components.register('sorting', F.Sorting, 600);
8345
8346})(jQuery, FooTable);
8347(function(F){
8348
8349	/**
8350	 * The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
8351	 * If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Sorting} component.
8352	 * @type {string}
8353	 * @default null
8354	 */
8355	F.Cell.prototype.sortValue = null;
8356
8357	// this is used to define the sorting specific properties on cell creation
8358	F.Cell.prototype.__sorting_define__ = function(valueOrElement){
8359		this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
8360	};
8361
8362	// this is used to update the sortValue property whenever the cell value is changed
8363	F.Cell.prototype.__sorting_val__ = function(value){
8364		if (F.is.defined(value)){
8365			// set only
8366			this.sortValue = this.column.sortValue.call(this.column, value);
8367		}
8368	};
8369
8370	// overrides the public define method and replaces it with our own
8371	F.Cell.extend('define', function(valueOrElement){
8372		this._super(valueOrElement);
8373		this.__sorting_define__(valueOrElement);
8374	});
8375	// overrides the public val method and replaces it with our own
8376	F.Cell.extend('val', function(value, redraw, redrawSelf){
8377		var val = this._super(value, redraw, redrawSelf);
8378		this.__sorting_val__(value);
8379		return val;
8380	});
8381})(FooTable);
8382(function($, F){
8383	/**
8384	 * The direction to sort if the {@link FooTable.Column#sorted} property is set to true. Can be "ASC", "DESC" or NULL. Added by the {@link FooTable.Sorting} component.
8385	 * @type {string}
8386	 * @default null
8387	 */
8388	F.Column.prototype.direction = null;
8389	/**
8390	 * Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
8391	 * @type {boolean}
8392	 * @default true
8393	 */
8394	F.Column.prototype.sortable = true;
8395	/**
8396	 * Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
8397	 * @type {boolean}
8398	 * @default false
8399	 */
8400	F.Column.prototype.sorted = false;
8401
8402	/**
8403	 * This is supplied two values from the column for a comparison to be made and the result returned. Added by the {@link FooTable.Sorting} component.
8404	 * @param {*} a - The first value to be compared.
8405	 * @param {*} b - The second value to compare to the first.
8406	 * @returns {number}
8407	 * @example <caption>This example shows using pseudo code what a sort function would look like.</caption>
8408	 * "sorter": function(a, b){
8409	 * 	if (a is less than b by some ordering criterion) {
8410	 * 		return -1;
8411	 * 	}
8412	 * 	if (a is greater than b by the ordering criterion) {
8413	 * 		return 1;
8414	 * 	}
8415	 * 	// a must be equal to b
8416	 * 	return 0;
8417	 * }
8418	 */
8419	F.Column.prototype.sorter = function(a, b){
8420		if (typeof a === 'string') a = a.toLowerCase();
8421		if (typeof b === 'string') b = b.toLowerCase();
8422		if (a === b) return 0;
8423		if (a < b) return -1;
8424		return 1;
8425	};
8426
8427	/**
8428	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
8429	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
8430	 * @returns {*}
8431	 * @this FooTable.Column
8432	 */
8433	F.Column.prototype.sortValue = function(valueOrElement){
8434		// if we have an element or a jQuery object use jQuery to get the value
8435		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
8436			var data = $(valueOrElement).data('sortValue');
8437			return F.is.defined(data) ? data : this.parser(valueOrElement);
8438		}
8439		// if options are supplied with the value
8440		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
8441			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
8442			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
8443		}
8444		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
8445		return null;
8446	};
8447
8448	// this is used to define the sorting specific properties on column creation
8449	F.Column.prototype.__sorting_define__ = function(definition){
8450		this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
8451		this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
8452		this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
8453		this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
8454		this.sortValue = F.checkFnValue(this, definition.sortValue, this.sortValue);
8455	};
8456
8457	// overrides the public define method and replaces it with our own
8458	F.Column.extend('define', function(definition){
8459		this._super(definition);
8460		this.__sorting_define__(definition);
8461	});
8462
8463})(jQuery, FooTable);
8464(function(F){
8465	/**
8466	 * An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
8467	 * @type {object}
8468	 * @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
8469	 */
8470	F.Defaults.prototype.sorting = {
8471		enabled: false
8472	};
8473})(FooTable);
8474(function($, F){
8475
8476	F.HTMLColumn.extend('__sorting_define__', function(definition){
8477		this._super(definition);
8478		this.sortUse = F.is.string(definition.sortUse) && $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
8479	});
8480
8481	/**
8482	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
8483	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
8484	 * @returns {*}
8485	 * @this FooTable.HTMLColumn
8486	 */
8487	F.HTMLColumn.prototype.sortValue = function(valueOrElement){
8488		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
8489		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
8490			var data = $(valueOrElement).data('sortValue');
8491			return F.is.defined(data) ? data : this.parser(valueOrElement);
8492		}
8493		// if options are supplied with the value
8494		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
8495			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
8496			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
8497		}
8498		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
8499		return null;
8500	};
8501
8502})(jQuery, FooTable);
8503(function($, F){
8504
8505	/**
8506	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
8507	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
8508	 * @returns {*}
8509	 */
8510	F.NumberColumn.prototype.sortValue = function(valueOrElement){
8511		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
8512		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
8513			var data = $(valueOrElement).data('sortValue');
8514			return F.is.number(data) ? data : this.parser(valueOrElement);
8515		}
8516		// if options are supplied with the value
8517		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
8518			if (F.is.string(valueOrElement.options.sortValue)) return this.parser(valueOrElement);
8519			if (F.is.number(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
8520			if (F.is.number(valueOrElement.value)) return valueOrElement.value;
8521		}
8522		if (F.is.string(valueOrElement)) return this.parser(valueOrElement);
8523		if (F.is.number(valueOrElement)) return valueOrElement;
8524		return null;
8525	};
8526
8527})(jQuery, FooTable);
8528(function(F){
8529	/**
8530	 * Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
8531	 * @instance
8532	 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
8533	 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
8534	 * @returns {jQuery.Promise}
8535	 * @fires FooTable.Sorting#"change.ft.sorting"
8536	 * @fires FooTable.Sorting#"changed.ft.sorting"
8537	 * @see FooTable.Sorting#sort
8538	 */
8539	F.Table.prototype.sort = function(column, direction){
8540		return this.use(F.Sorting).sort(column, direction);
8541	};
8542})(FooTable);
8543(function($, F){
8544
8545	F.Pager = F.Class.extend(/** @lends FooTable.Pager */{
8546		/**
8547		 * The pager object contains the page number and direction to page to.
8548		 * @constructs
8549		 * @extends FooTable.Class
8550		 * @param {number} total - The total number of pages available.
8551		 * @param {number} current - The current page number.
8552		 * @param {number} size - The number of rows per page.
8553		 * @param {number} page - The page number to goto.
8554		 * @param {boolean} forward - A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
8555		 * @returns {FooTable.Pager}
8556		 */
8557		construct: function(total, current, size, page, forward){
8558			/**
8559			 * The total number of pages available.
8560			 * @type {number}
8561			 */
8562			this.total = total;
8563			/**
8564			 * The current page number.
8565			 * @type {number}
8566			 */
8567			this.current = current;
8568			/**
8569			 * The number of rows per page.
8570			 * @type {number}
8571			 */
8572			this.size = size;
8573			/**
8574			 * The page number to goto.
8575			 * @type {number}
8576			 */
8577			this.page = page;
8578			/**
8579			 * A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
8580			 * @type {boolean}
8581			 */
8582			this.forward = forward;
8583		}
8584	});
8585
8586})(jQuery, FooTable);
8587(function($, F){
8588	F.Paging = F.Component.extend(/** @lends FooTable.Paging */{
8589		/**
8590		 * The paging component adds a pagination control to the table allowing users to navigate table rows via pages.
8591		 * @constructs
8592		 * @extends FooTable.Component
8593		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
8594		 * @returns {FooTable.Filtering}
8595		 */
8596		construct: function(table){
8597			// call the base constructor
8598			this._super(table, table.o.paging.enabled);
8599
8600			/* PROTECTED */
8601			/**
8602			 * An object containing the strings used by the paging buttons.
8603			 * @type {{ first: string, prev: string, next: string, last: string }}
8604			 */
8605			this.strings = table.o.paging.strings;
8606
8607			/* PUBLIC */
8608			/**
8609			 * The current page number to display.
8610			 * @instance
8611			 * @type {number}
8612			 */
8613			this.current = table.o.paging.current;
8614			/**
8615			 * The number of rows to display per page.
8616			 * @instance
8617			 * @type {number}
8618			 */
8619			this.size = table.o.paging.size;
8620			/**
8621			 * The maximum number of page links to display at once.
8622			 * @instance
8623			 * @type {number}
8624			 */
8625			this.limit = table.o.paging.limit;
8626			/**
8627			 * The position of the pagination control within the paging rows cell.
8628			 * @instance
8629			 * @type {string}
8630			 */
8631			this.position = table.o.paging.position;
8632			/**
8633			 * The format string used to generate the text displayed under the pagination control.
8634			 * @instance
8635			 * @type {string}
8636			 */
8637			this.countFormat = table.o.paging.countFormat;
8638			/**
8639			 * A selector specifying where to place the paging components UI, if null the UI is displayed within a row in the foot of the table.
8640			 * @instance
8641			 * @type {string}
8642			 */
8643			this.container = table.o.paging.container;
8644				/**
8645			 * The total number of pages.
8646			 * @instance
8647			 * @type {number}
8648			 */
8649			this.total = -1;
8650			/**
8651			 * The number of rows in the {@link FooTable.Rows#array} before paging is applied.
8652			 * @instance
8653			 * @type {number}
8654			 */
8655			this.totalRows = 0;
8656			/**
8657			 * A number indicating the previous page displayed.
8658			 * @instance
8659			 * @type {number}
8660			 */
8661			this.previous = -1;
8662			/**
8663			 * The count string generated using the {@link FooTable.Filtering#countFormat} option. This value is only set after the first call to the {@link FooTable.Filtering#predraw} method.
8664			 * @instance
8665			 * @type {string}
8666			 */
8667			this.formattedCount = null;
8668			/**
8669			 * The jQuery object of the element containing the entire paging UI.
8670			 * @instance
8671			 * @type {jQuery}
8672			 */
8673			this.$container = null;
8674			/**
8675			 * The jQuery object of the element wrapping all the paging UI elements.
8676			 * @instance
8677			 * @type {jQuery}
8678			 */
8679			this.$wrapper = null;
8680			/** +
8681			 * The jQuery row object that contains all the paging specific elements.
8682			 * @instance
8683			 * @type {jQuery}
8684			 */
8685			this.$row = null;
8686			/**
8687			 * The jQuery cell object that contains the pagination control and total count.
8688			 * @instance
8689			 * @type {jQuery}
8690			 */
8691			this.$cell = null;
8692			/**
8693			 * The jQuery object that contains the links for the pagination control.
8694			 * @instance
8695			 * @type {jQuery}
8696			 */
8697			this.$pagination = null;
8698			/**
8699			 * The jQuery object that contains the row count.
8700			 * @instance
8701			 * @type {jQuery}
8702			 */
8703			this.$count = null;
8704			/**
8705			 * Whether or not the pagination row is detached from the table.
8706			 * @instance
8707			 * @type {boolean}
8708			 */
8709			this.detached = true;
8710
8711			/* PRIVATE */
8712			/**
8713			 * Used to hold the number of page links created.
8714			 * @instance
8715			 * @type {number}
8716			 * @private
8717			 */
8718			this._createdLinks = 0;
8719		},
8720
8721		/* PROTECTED */
8722		/**
8723		 * Checks the supplied data and options for the paging component.
8724		 * @instance
8725		 * @protected
8726		 * @param {object} data - The jQuery data object from the parent table.
8727		 * @fires FooTable.Paging#"preinit.ft.paging"
8728		 */
8729		preinit: function(data){
8730			var self = this;
8731			/**
8732			 * The preinit.ft.paging event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
8733			 * Calling preventDefault on this event will disable the component.
8734			 * @event FooTable.Paging#"preinit.ft.paging"
8735			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8736			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8737			 * @param {object} data - The jQuery data object of the table raising the event.
8738			 */
8739			this.ft.raise('preinit.ft.paging', [data]).then(function(){
8740				if (self.ft.$el.hasClass('footable-paging'))
8741					self.enabled = true;
8742				self.enabled = F.is.boolean(data.paging)
8743					? data.paging
8744					: self.enabled;
8745
8746				if (!self.enabled) return;
8747
8748				self.size = F.is.number(data.pagingSize)
8749					? data.pagingSize
8750					: self.size;
8751
8752				self.current = F.is.number(data.pagingCurrent)
8753					? data.pagingCurrent
8754					: self.current;
8755
8756				self.limit = F.is.number(data.pagingLimit)
8757					? data.pagingLimit
8758					: self.limit;
8759
8760				if (self.ft.$el.hasClass('footable-paging-left'))
8761					self.position = 'left';
8762				if (self.ft.$el.hasClass('footable-paging-center'))
8763					self.position = 'center';
8764				if (self.ft.$el.hasClass('footable-paging-right'))
8765					self.position = 'right';
8766
8767				self.position = F.is.string(data.pagingPosition)
8768					? data.pagingPosition
8769					: self.position;
8770
8771				self.countFormat = F.is.string(data.pagingCountFormat)
8772					? data.pagingCountFormat
8773					: self.countFormat;
8774
8775				self.container = F.is.string(data.pagingContainer)
8776					? data.pagingContainer
8777					: self.container;
8778
8779				self.total = Math.ceil(self.ft.rows.all.length / self.size);
8780			}, function(){
8781				self.enabled = false;
8782			});
8783		},
8784		/**
8785		 * Initializes the paging component for the plugin using the supplied table and options.
8786		 * @instance
8787		 * @protected
8788		 * @fires FooTable.Paging#"init.ft.paging"
8789		 */
8790		init: function(){
8791			/**
8792			 * The init.ft.paging event is raised before its UI is generated.
8793			 * Calling preventDefault on this event will disable the component.
8794			 * @event FooTable.Paging#"init.ft.paging"
8795			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8796			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8797			 */
8798			var self = this;
8799			this.ft.raise('init.ft.paging').then(function(){
8800				self.$create();
8801			}, function(){
8802				self.enabled = false;
8803			});
8804		},
8805		/**
8806		 * Destroys the paging component removing any UI generated from the table.
8807		 * @instance
8808		 * @protected
8809		 * @fires FooTable.Paging#"destroy.ft.paging"
8810		 */
8811		destroy: function () {
8812			/**
8813			 * The destroy.ft.paging event is raised before its UI is removed.
8814			 * Calling preventDefault on this event will prevent the component from being destroyed.
8815			 * @event FooTable.Paging#"destroy.ft.paging"
8816			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8817			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8818			 */
8819			var self = this;
8820			this.ft.raise('destroy.ft.paging').then(function(){
8821				self.ft.$el.removeClass('footable-paging')
8822					.find('tfoot > tr.footable-paging').remove();
8823				self.detached = true;
8824				self._createdLinks = 0;
8825			});
8826		},
8827		/**
8828		 * Performs the actual paging against the {@link FooTable.Rows#current} array removing all rows that are not on the current visible page.
8829		 * @instance
8830		 * @protected
8831		 */
8832		predraw: function(){
8833			this.total = Math.ceil(this.ft.rows.array.length / this.size);
8834			this.current = this.current > this.total ? this.total : (this.current < 1 ? 1 : this.current);
8835			this.totalRows = this.ft.rows.array.length;
8836			if (this.totalRows > this.size){
8837				this.ft.rows.array = this.ft.rows.array.splice((this.current - 1) * this.size, this.size);
8838			}
8839			this.formattedCount = this.format(this.countFormat);
8840		},
8841		/**
8842		 * Updates the paging UI setting the state of the pagination control.
8843		 * @instance
8844		 * @protected
8845		 */
8846		draw: function(){
8847			if (this.total <= 1){
8848				if (!this.detached){
8849					if (this.$row){
8850						this.$row.detach();
8851					} else {
8852						this.$wrapper.detach();
8853					}
8854					this.detached = true;
8855				}
8856			} else {
8857				if (this.detached){
8858					if (this.$row){
8859						var $tfoot = this.ft.$el.children('tfoot');
8860						if ($tfoot.length == 0){
8861							$tfoot = $('<tfoot/>');
8862							this.ft.$el.append($tfoot);
8863						}
8864						this.$row.appendTo($tfoot);
8865					} else {
8866						this.$wrapper.appendTo(this.$container);
8867					}
8868					this.detached = false;
8869				}
8870				if (F.is.jq(this.$cell)){
8871					this.$cell.attr('colspan', this.ft.columns.visibleColspan);
8872				}
8873				this._createLinks();
8874				this._setVisible(this.current, this.current > this.previous);
8875				this._setNavigation(true);
8876				this.$count.text(this.formattedCount);
8877			}
8878		},
8879		/**
8880		 * Creates the paging UI from the current options setting the various jQuery properties of this component.
8881		 * @instance
8882		 * @protected
8883		 */
8884		$create: function(){
8885			this._createdLinks = 0;
8886			var position = 'footable-paging-center';
8887			switch (this.position){
8888				case 'left': position = 'footable-paging-left'; break;
8889				case 'right': position = 'footable-paging-right'; break;
8890			}
8891			this.ft.$el.addClass('footable-paging').addClass(position);
8892
8893			this.$container = this.container === null ? null : $(this.container).first();
8894			if (!F.is.jq(this.$container)){
8895				var $tfoot = this.ft.$el.children('tfoot');
8896				if ($tfoot.length == 0){
8897					$tfoot = $('<tfoot/>');
8898					this.ft.$el.append($tfoot);
8899				}
8900				// add it to a row and then populate it with the search input and column selector dropdown.
8901				this.$row = $('<tr/>', {'class': 'footable-paging'}).prependTo($tfoot);
8902				this.$container = this.$cell = $('<td/>').attr('colspan', this.ft.columns.visibleColspan).appendTo(this.$row);
8903			} else {
8904				this.$container.addClass('footable-paging-external').addClass(position);
8905			}
8906			this.$wrapper = $('<div/>', {'class': 'footable-pagination-wrapper'}).appendTo(this.$container);
8907			this.$pagination = $('<ul/>', { 'class': 'pagination' }).on('click.footable', 'a.footable-page-link', { self: this }, this._onPageClicked);
8908			this.$count = $('<span/>', { 'class': 'label label-default' });
8909			this.$wrapper.append(this.$pagination, $('<div/>', {'class': 'divider'}), this.$count);
8910			this.detached = false;
8911		},
8912
8913		/* PUBLIC */
8914		/**
8915		 * @summary Uses the supplied format string and replaces the placeholder strings with the current values.
8916		 * @description This method is used to generate the short description label for the pagination control. i.e. Showing X of Y records. The placeholders for this string are the following:
8917		 * * {CP} - The current page number.
8918		 * * {TP} - The total number of pages.
8919		 * * {PF} - The first row of the current page.
8920		 * * {PL} - The last row of the current page.
8921		 * * {TR} - The total rows available.
8922		 * These placeholders can be supplied in a string like; "Showing {PF} to {PL} of {TR} rows."
8923		 * @param {string} formatString - The string to be formatted with the paging specific variables.
8924		 * @returns {string}
8925		 */
8926		format: function(formatString){
8927			var firstRow = (this.size * (this.current - 1)) + 1,
8928				lastRow = this.size * this.current;
8929			if (this.ft.rows.array.length == 0){
8930				firstRow = 0;
8931				lastRow = 0;
8932			} else {
8933				lastRow = lastRow > this.totalRows ? this.totalRows : lastRow;
8934			}
8935			return formatString.replace(/\{CP}/g, this.current)
8936				.replace(/\{TP}/g, this.total)
8937				.replace(/\{PF}/g, firstRow)
8938				.replace(/\{PL}/g, lastRow)
8939				.replace(/\{TR}/g, this.totalRows);
8940		},
8941		/**
8942		 * Pages to the first page.
8943		 * @instance
8944		 * @returns {jQuery.Promise}
8945		 * @fires FooTable.Paging#"before.ft.paging"
8946		 * @fires FooTable.Paging#"after.ft.paging"
8947		 */
8948		first: function(){
8949			return this._set(1);
8950		},
8951		/**
8952		 * Pages to the previous page.
8953		 * @instance
8954		 * @returns {jQuery.Promise}
8955		 * @fires FooTable.Paging#"before.ft.paging"
8956		 * @fires FooTable.Paging#"after.ft.paging"
8957		 */
8958		prev: function(){
8959			return this._set(this.current - 1 > 0 ? this.current - 1 : 1);
8960		},
8961		/**
8962		 * Pages to the next page.
8963		 * @instance
8964		 * @returns {jQuery.Promise}
8965		 * @fires FooTable.Paging#"before.ft.paging"
8966		 * @fires FooTable.Paging#"after.ft.paging"
8967		 */
8968		next: function(){
8969			return this._set(this.current + 1 < this.total ? this.current + 1 : this.total);
8970		},
8971		/**
8972		 * Pages to the last page.
8973		 * @instance
8974		 * @returns {jQuery.Promise}
8975		 * @fires FooTable.Paging#"before.ft.paging"
8976		 * @fires FooTable.Paging#"after.ft.paging"
8977		 */
8978		last: function(){
8979			return this._set(this.total);
8980		},
8981		/**
8982		 * Pages to the specified page.
8983		 * @instance
8984		 * @param {number} page - The page number to go to.
8985		 * @returns {jQuery.Promise}
8986		 * @fires FooTable.Paging#"before.ft.paging"
8987		 * @fires FooTable.Paging#"after.ft.paging"
8988		 */
8989		goto: function(page){
8990			return this._set(page > this.total ? this.total : (page < 1 ? 1 : page));
8991		},
8992		/**
8993		 * Shows the previous X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit option value.
8994		 * @instance
8995		 */
8996		prevPages: function(){
8997			var page = this.$pagination.children('li.footable-page.visible:first').data('page') - 1;
8998			this._setVisible(page, true);
8999			this._setNavigation(false);
9000		},
9001		/**
9002		 * Shows the next X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit option value.
9003		 * @instance
9004		 */
9005		nextPages: function(){
9006			var page = this.$pagination.children('li.footable-page.visible:last').data('page') + 1;
9007			this._setVisible(page, false);
9008			this._setNavigation(false);
9009		},
9010		/**
9011		 * Gets or sets the current page size.
9012		 * @instance
9013		 * @param {(number|string)} [value] - The new page size to use, this value is supplied to `parseInt` so strings can be used. If not supplied or an invalid valid the current page size is returned.
9014		 * @returns {(number|undefined)}
9015		 */
9016		pageSize: function(value){
9017			value = parseInt(value);
9018			if (isNaN(value)){
9019				return this.size;
9020			}
9021			this.size = value;
9022			this.total = Math.ceil(this.ft.rows.all.length / this.size);
9023			if (F.is.jq(this.$wrapper)){
9024				if (this.$container.is("td")){
9025					this.$row.remove();
9026				} else {
9027					this.$wrapper.remove();
9028				}
9029			}
9030			this.$create();
9031			this.ft.draw();
9032		},
9033
9034		/* PRIVATE */
9035		/**
9036		 * Performs the required steps to handle paging including the raising of the {@link FooTable.Paging#"before.ft.paging"} and {@link FooTable.Paging#"after.ft.paging"} events.
9037		 * @instance
9038		 * @private
9039		 * @param {number} page - The page to set.
9040		 * @returns {jQuery.Promise}
9041		 * @fires FooTable.Paging#"before.ft.paging"
9042		 * @fires FooTable.Paging#"after.ft.paging"
9043		 */
9044		_set: function(page){
9045			var self = this,
9046				pager = new F.Pager(self.total, self.current, self.size, page, page > self.current);
9047			/**
9048			 * The before.ft.paging event is raised before a sort is applied and allows listeners to modify the pager or cancel it completely by calling preventDefault on the jQuery.Event object.
9049			 * @event FooTable.Paging#"before.ft.paging"
9050			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9051			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9052			 * @param {FooTable.Pager} pager - The pager that is about to be applied.
9053			 */
9054			return self.ft.raise('before.ft.paging', [pager]).then(function(){
9055				pager.page = pager.page > pager.total ? pager.total	: pager.page;
9056				pager.page = pager.page < 1 ? 1 : pager.page;
9057				if (self.current == page) return $.when();
9058				self.previous = self.current;
9059				self.current = pager.page;
9060				return self.ft.draw().then(function(){
9061					/**
9062					 * The after.ft.paging event is raised after a pager has been applied.
9063					 * @event FooTable.Paging#"after.ft.paging"
9064					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9065					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9066					 * @param {FooTable.Pager} pager - The pager that has been applied.
9067					 */
9068					self.ft.raise('after.ft.paging', [pager]);
9069				});
9070			});
9071		},
9072		/**
9073		 * Creates the pagination links using the current state of the plugin. If the total number of pages is the same as
9074		 * the last time this function was executed it does nothing.
9075		 * @instance
9076		 * @private
9077		 */
9078		_createLinks: function(){
9079			if (this._createdLinks === this.total) return;
9080			var self = this,
9081				multiple = self.total > 1,
9082				link = function(attr, html, klass){
9083					return $('<li/>', {
9084						'class': klass
9085					}).attr('data-page', attr)
9086						.append($('<a/>', {
9087							'class': 'footable-page-link',
9088							href: '#'
9089						}).data('page', attr).html(html));
9090				};
9091			self.$pagination.empty();
9092			if (multiple) {
9093				self.$pagination.append(link('first', self.strings.first, 'footable-page-nav'));
9094				self.$pagination.append(link('prev', self.strings.prev, 'footable-page-nav'));
9095				if (self.limit > 0 && self.limit < self.total){
9096					self.$pagination.append(link('prev-limit', self.strings.prevPages, 'footable-page-nav'));
9097				}
9098			}
9099			for (var i = 0, $li; i < self.total; i++){
9100				$li = link(i + 1, i + 1, 'footable-page');
9101				self.$pagination.append($li);
9102			}
9103			if (multiple){
9104				if (self.limit > 0 && self.limit < self.total){
9105					self.$pagination.append(link('next-limit', self.strings.nextPages, 'footable-page-nav'));
9106				}
9107				self.$pagination.append(link('next', self.strings.next, 'footable-page-nav'));
9108				self.$pagination.append(link('last', self.strings.last, 'footable-page-nav'));
9109			}
9110			self._createdLinks = self.total;
9111		},
9112		/**
9113		 * Sets the state for the navigation links of the pagination control and optionally sets the active class state on the current page link.
9114		 * @instance
9115		 * @private
9116		 * @param {boolean} active - Whether or not to set the active class state on the individual page links.
9117		 */
9118		_setNavigation: function(active){
9119			if (this.current == 1) {
9120				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').addClass('disabled');
9121			} else {
9122				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').removeClass('disabled');
9123			}
9124
9125			if (this.current == this.total) {
9126				this.$pagination.children('li[data-page="next"],li[data-page="last"]').addClass('disabled');
9127			} else {
9128				this.$pagination.children('li[data-page="next"],li[data-page="last"]').removeClass('disabled');
9129			}
9130
9131			if ((this.$pagination.children('li.footable-page.visible:first').data('page') || 1) == 1) {
9132				this.$pagination.children('li[data-page="prev-limit"]').addClass('disabled');
9133			} else {
9134				this.$pagination.children('li[data-page="prev-limit"]').removeClass('disabled');
9135			}
9136
9137			if ((this.$pagination.children('li.footable-page.visible:last').data('page') || this.limit) == this.total) {
9138				this.$pagination.children('li[data-page="next-limit"]').addClass('disabled');
9139			} else {
9140				this.$pagination.children('li[data-page="next-limit"]').removeClass('disabled');
9141			}
9142
9143			if (this.limit > 0 && this.total < this.limit){
9144				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', 'none');
9145			} else {
9146				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', '');
9147			}
9148
9149			if (active){
9150				this.$pagination.children('li.footable-page').removeClass('active').filter('li[data-page="' + this.current + '"]').addClass('active');
9151			}
9152		},
9153		/**
9154		 * Sets the visible page using the supplied parameters.
9155		 * @instance
9156		 * @private
9157		 * @param {number} page - The page to make visible.
9158		 * @param {boolean} right - If set to true the supplied page will be the right most visible pagination link.
9159		 */
9160		_setVisible: function(page, right){
9161			if (this.limit > 0 && this.total > this.limit){
9162				if (!this.$pagination.children('li.footable-page[data-page="'+page+'"]').hasClass('visible')){
9163					var start = 0, end = 0;
9164					if (right == true){
9165						end = page > this.total ? this.total : page;
9166						start = end - this.limit;
9167					} else {
9168						start = page < 1 ? 0 : page - 1;
9169						end = start + this.limit;
9170					}
9171					if (start < 0){
9172						start = 0;
9173						end = this.limit > this.total ? this.total : this.limit;
9174					}
9175					if (end > this.total){
9176						end = this.total;
9177						start = this.total - this.limit < 0 ? 0 : this.total - this.limit;
9178					}
9179					this.$pagination.children('li.footable-page').removeClass('visible').slice(start, end).addClass('visible');
9180				}
9181			} else {
9182				this.$pagination.children('li.footable-page').removeClass('visible').slice(0, this.total).addClass('visible');
9183			}
9184		},
9185		/**
9186		 * Handles the click event for all links in the pagination control.
9187		 * @instance
9188		 * @private
9189		 * @param {jQuery.Event} e - The event object for the event.
9190		 */
9191		_onPageClicked: function(e){
9192			e.preventDefault();
9193			if ($(e.target).closest('li').is('.active,.disabled')) return;
9194
9195			var self = e.data.self, page = $(this).data('page');
9196			switch(page){
9197				case 'first': self.first();
9198					return;
9199				case 'prev': self.prev();
9200					return;
9201				case 'next': self.next();
9202					return;
9203				case 'last': self.last();
9204					return;
9205				case 'prev-limit': self.prevPages();
9206					return;
9207				case 'next-limit': self.nextPages();
9208					return;
9209				default: self._set(page);
9210					return;
9211			}
9212		}
9213	});
9214
9215	F.components.register('paging', F.Paging, 400);
9216
9217})(jQuery, FooTable);
9218(function(F){
9219	/**
9220	 * An object containing the paging options for the plugin. Added by the {@link FooTable.Paging} component.
9221	 * @type {object}
9222	 * @prop {boolean} enabled=false - Whether or not to allow paging on the table.
9223	 * @prop {string} countFormat="{CP} of {TP}" - A string format used to generate the page count text.
9224	 * @prop {number} current=1 - The page number to display.
9225	 * @prop {number} limit=5 - The maximum number of page links to display at once.
9226	 * @prop {string} position="center" - The string used to specify the alignment of the pagination control.
9227	 * @prop {number} size=10 - The number of rows displayed per page.
9228	 * @prop {string} container=null - A selector specifying where to place the paging components UI, if null the UI is displayed within a row in the foot of the table.
9229	 * @prop {object} strings - An object containing the strings used by the paging buttons.
9230	 * @prop {string} strings.first="&laquo;" - The string used for the 'first' button.
9231	 * @prop {string} strings.prev="&lsaquo;" - The string used for the 'previous' button.
9232	 * @prop {string} strings.next="&rsaquo;" - The string used for the 'next' button.
9233	 * @prop {string} strings.last="&raquo;" - The string used for the 'last' button.
9234	 * @prop {string} strings.prevPages="..." - The string used for the 'previous X pages' button.
9235	 * @prop {string} strings.nextPages="..." - The string used for the 'next X pages' button.
9236	 */
9237	F.Defaults.prototype.paging = {
9238		enabled: false,
9239		countFormat: '{CP} of {TP}',
9240		current: 1,
9241		limit: 5,
9242		position: 'center',
9243		size: 10,
9244		container: null,
9245		strings: {
9246			first: '&laquo;',
9247			prev: '&lsaquo;',
9248			next: '&rsaquo;',
9249			last: '&raquo;',
9250			prevPages: '...',
9251			nextPages: '...'
9252		}
9253	};
9254})(FooTable);
9255(function(F){
9256	/**
9257	 * Navigates to the specified page number. Added by the {@link FooTable.Paging} component.
9258	 * @instance
9259	 * @param {number} num - The page number to go to.
9260	 * @returns {jQuery.Promise}
9261	 * @fires FooTable.Paging#paging_changing
9262	 * @fires FooTable.Paging#paging_changed
9263	 * @see FooTable.Paging#goto
9264	 */
9265	F.Table.prototype.gotoPage = function(num){
9266		return this.use(F.Paging).goto(num);
9267	};
9268
9269	/**
9270	 * Navigates to the next page. Added by the {@link FooTable.Paging} component.
9271	 * @instance
9272	 * @returns {jQuery.Promise}
9273	 * @fires FooTable.Paging#paging_changing
9274	 * @fires FooTable.Paging#paging_changed
9275	 * @see FooTable.Paging#next
9276	 */
9277	F.Table.prototype.nextPage = function(){
9278		return this.use(F.Paging).next();
9279	};
9280
9281	/**
9282	 * Navigates to the previous page. Added by the {@link FooTable.Paging} component.
9283	 * @instance
9284	 * @returns {jQuery.Promise}
9285	 * @fires FooTable.Paging#paging_changing
9286	 * @fires FooTable.Paging#paging_changed
9287	 * @see FooTable.Paging#prev
9288	 */
9289	F.Table.prototype.prevPage = function(){
9290		return this.use(F.Paging).prev();
9291	};
9292
9293	/**
9294	 * Navigates to the first page. Added by the {@link FooTable.Paging} component.
9295	 * @instance
9296	 * @returns {jQuery.Promise}
9297	 * @fires FooTable.Paging#paging_changing
9298	 * @fires FooTable.Paging#paging_changed
9299	 * @see FooTable.Paging#first
9300	 */
9301	F.Table.prototype.firstPage = function(){
9302		return this.use(F.Paging).first();
9303	};
9304
9305	/**
9306	 * Navigates to the last page. Added by the {@link FooTable.Paging} component.
9307	 * @instance
9308	 * @returns {jQuery.Promise}
9309	 * @fires FooTable.Paging#paging_changing
9310	 * @fires FooTable.Paging#paging_changed
9311	 * @see FooTable.Paging#last
9312	 */
9313	F.Table.prototype.lastPage = function(){
9314		return this.use(F.Paging).last();
9315	};
9316
9317	/**
9318	 * Shows the next X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit.size option value. Added by the {@link FooTable.Paging} component.
9319	 * @instance
9320	 * @see FooTable.Paging#nextPages
9321	 */
9322	F.Table.prototype.nextPages = function(){
9323		return this.use(F.Paging).nextPages();
9324	};
9325
9326	/**
9327	 * Shows the previous X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit.size option value. Added by the {@link FooTable.Paging} component.
9328	 * @instance
9329	 * @see FooTable.Paging#prevPages
9330	 */
9331	F.Table.prototype.prevPages = function(){
9332		return this.use(F.Paging).prevPages();
9333	};
9334
9335	/**
9336	 * Gets or sets the current page size
9337	 * @instance
9338	 * @param {number} [value] - The new page size to use.
9339	 * @returns {(number|undefined)}
9340	 * @see FooTable.Paging#pageSize
9341	 */
9342	F.Table.prototype.pageSize = function(value){
9343		return this.use(F.Paging).pageSize(value);
9344	};
9345})(FooTable);
9346(function($, F){
9347
9348	F.Editing = F.Component.extend(/** @lends FooTable.Editing */{
9349		/**
9350		 * The editing component adds a column with edit and delete buttons to each row as well as a single add row button in the footer.
9351		 * @constructs
9352		 * @extends FooTable.Component
9353		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
9354		 * @returns {FooTable.Editing}
9355		 */
9356		construct: function(table){
9357			// call the base constructor
9358			this._super(table, table.o.editing.enabled);
9359
9360			/**
9361			 * Whether or not to automatically page to a new row when it is added to the table.
9362			 * @type {boolean}
9363			 */
9364			this.pageToNew = table.o.editing.pageToNew;
9365
9366			/**
9367			 * Whether or not the editing column and add row button are always visible.
9368			 * @type {boolean}
9369			 */
9370			this.alwaysShow = table.o.editing.alwaysShow;
9371
9372			/**
9373			 * The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
9374			 * @type {object}
9375			 * @prop {string} classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
9376			 * @prop {string} name="editing" - The name of the column.
9377			 * @prop {string} title="" - The title displayed in the header row of the table for the column.
9378			 * @prop {boolean} filterable=false - Whether or not the column should be filterable when using the filtering component.
9379			 * @prop {boolean} sortable=false - Whether or not the column should be sortable when using the sorting component.
9380			 */
9381			this.column = $.extend(true, {}, table.o.editing.column, {visible: this.alwaysShow});
9382
9383			/**
9384			 * The position of the editing column in the table as well as the alignment of the buttons.
9385			 * @type {string}
9386			 */
9387			this.position = table.o.editing.position;
9388
9389
9390			/**
9391			 * The text that appears in the show button. This can contain HTML.
9392			 * @type {string}
9393			 */
9394			this.showText = table.o.editing.showText;
9395
9396			/**
9397			 * The text that appears in the hide button. This can contain HTML.
9398			 * @type {string}
9399			 */
9400			this.hideText = table.o.editing.hideText;
9401
9402			/**
9403			 * The text that appears in the add button. This can contain HTML.
9404			 * @type {string}
9405			 */
9406			this.addText = table.o.editing.addText;
9407
9408			/**
9409			 * The text that appears in the edit button. This can contain HTML.
9410			 * @type {string}
9411			 */
9412			this.editText = table.o.editing.editText;
9413
9414			/**
9415			 * The text that appears in the delete button. This can contain HTML.
9416			 * @type {string}
9417			 */
9418			this.deleteText = table.o.editing.deleteText;
9419			
9420			/**
9421			 * The text that appears in the view button. This can contain HTML.
9422			 * @type {string}
9423			 */
9424			this.viewText = table.o.editing.viewText;
9425
9426			/**
9427			 * Whether or not to show the Add Row button.
9428			 * @type {boolean}
9429			 */
9430			this.allowAdd = table.o.editing.allowAdd;
9431
9432			/**
9433			 * Whether or not to show the Edit Row button.
9434			 * @type {boolean}
9435			 */
9436			this.allowEdit = table.o.editing.allowEdit;
9437
9438			/**
9439			 * Whether or not to show the Delete Row button.
9440			 * @type {boolean}
9441			 */
9442			this.allowDelete = table.o.editing.allowDelete;
9443
9444			/**
9445			 * Whether or not to show the View Row button.
9446			 * @type {boolean}
9447			 */
9448			this.allowView = table.o.editing.allowView;
9449
9450			/**
9451			 * Caches the row button elements to help with performance.
9452			 * @type {(null|jQuery)}
9453			 * @private
9454			 */
9455			this._$buttons = null;
9456
9457			/**
9458			 * This object is used to contain the callbacks for the add, edit and delete row buttons.
9459			 * @type {object}
9460			 * @prop {function} addRow
9461			 * @prop {function} editRow
9462			 * @prop {function} deleteRow
9463			 * @prop {function} viewRow
9464			 */
9465			this.callbacks = {
9466				addRow: F.checkFnValue(this, table.o.editing.addRow),
9467				editRow: F.checkFnValue(this, table.o.editing.editRow),
9468				deleteRow: F.checkFnValue(this, table.o.editing.deleteRow),
9469				viewRow: F.checkFnValue(this, table.o.editing.viewRow)
9470			};
9471		},
9472		/* PROTECTED */
9473		/**
9474		 * Checks the supplied data and options for the editing component.
9475		 * @instance
9476		 * @protected
9477		 * @param {object} data - The jQuery data object from the parent table.
9478		 * @fires FooTable.Editing#"preinit.ft.editing"
9479		 */
9480		preinit: function(data){
9481			var self = this;
9482			/**
9483			 * The preinit.ft.editing event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
9484			 * Calling preventDefault on this event will disable the component.
9485			 * @event FooTable.Editing#"preinit.ft.editing"
9486			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9487			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9488			 * @param {object} data - The jQuery data object of the table raising the event.
9489			 */
9490			this.ft.raise('preinit.ft.editing', [data]).then(function(){
9491				if (self.ft.$el.hasClass('footable-editing'))
9492					self.enabled = true;
9493
9494				self.enabled = F.is.boolean(data.editing)
9495					? data.editing
9496					: self.enabled;
9497
9498				if (!self.enabled) return;
9499
9500				self.pageToNew = F.is.boolean(data.editingPageToNew) ? data.editingPageToNew : self.pageToNew;
9501
9502				self.alwaysShow = F.is.boolean(data.editingAlwaysShow) ? data.editingAlwaysShow : self.alwaysShow;
9503
9504				self.position = F.is.string(data.editingPosition) ? data.editingPosition : self.position;
9505
9506				self.showText = F.is.string(data.editingShowText) ? data.editingShowText : self.showText;
9507
9508				self.hideText = F.is.string(data.editingHideText) ? data.editingHideText : self.hideText;
9509
9510				self.addText = F.is.string(data.editingAddText) ? data.editingAddText : self.addText;
9511
9512				self.editText = F.is.string(data.editingEditText) ? data.editingEditText : self.editText;
9513
9514				self.deleteText = F.is.string(data.editingDeleteText) ? data.editingDeleteText : self.deleteText;
9515
9516				self.viewText = F.is.string(data.editingViewText) ? data.editingViewText : self.viewText;
9517
9518				self.allowAdd = F.is.boolean(data.editingAllowAdd) ? data.editingAllowAdd : self.allowAdd;
9519
9520				self.allowEdit = F.is.boolean(data.editingAllowEdit) ? data.editingAllowEdit : self.allowEdit;
9521
9522				self.allowDelete = F.is.boolean(data.editingAllowDelete) ? data.editingAllowDelete : self.allowDelete;
9523
9524				self.allowView = F.is.boolean(data.editingAllowView) ? data.editingAllowView : self.allowView;
9525
9526				self.column = new F.EditingColumn(self.ft, self, $.extend(true, {}, self.column, data.editingColumn, {visible: self.alwaysShow}));
9527
9528				if (self.ft.$el.hasClass('footable-editing-left'))
9529					self.position = 'left';
9530
9531				if (self.ft.$el.hasClass('footable-editing-right'))
9532					self.position = 'right';
9533
9534				if (self.position === 'right'){
9535					self.column.index = self.ft.columns.array.length;
9536				} else {
9537					self.column.index = 0;
9538					for (var i = 0, len = self.ft.columns.array.length; i < len; i++){
9539						self.ft.columns.array[i].index += 1;
9540					}
9541				}
9542				self.ft.columns.array.push(self.column);
9543				self.ft.columns.array.sort(function(a, b){ return a.index - b.index; });
9544
9545				self.callbacks.addRow = F.checkFnValue(self, data.editingAddRow, self.callbacks.addRow);
9546				self.callbacks.editRow = F.checkFnValue(self, data.editingEditRow, self.callbacks.editRow);
9547				self.callbacks.deleteRow = F.checkFnValue(self, data.editingDeleteRow, self.callbacks.deleteRow);
9548				self.callbacks.viewRow = F.checkFnValue(self, data.editingViewRow, self.callbacks.viewRow);
9549			}, function(){
9550				self.enabled = false;
9551			});
9552		},
9553		/**
9554		 * Initializes the editing component for the plugin using the supplied table and options.
9555		 * @instance
9556		 * @protected
9557		 * @fires FooTable.Editing#"init.ft.editing"
9558		 */
9559		init: function(){
9560			/**
9561			 * The init.ft.editing event is raised before its UI is generated.
9562			 * Calling preventDefault on this event will disable the component.
9563			 * @event FooTable.Editing#"init.ft.editing"
9564			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9565			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9566			 */
9567			var self = this;
9568			this.ft.raise('init.ft.editing').then(function(){
9569				self.$create();
9570			}, function(){
9571				self.enabled = false;
9572			});
9573		},
9574		/**
9575		 * Destroys the editing component removing any UI generated from the table.
9576		 * @instance
9577		 * @protected
9578		 * @fires FooTable.Editing#"destroy.ft.editing"
9579		 */
9580		destroy: function () {
9581			/**
9582			 * The destroy.ft.editing event is raised before its UI is removed.
9583			 * Calling preventDefault on this event will prevent the component from being destroyed.
9584			 * @event FooTable.Editing#"destroy.ft.editing"
9585			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9586			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9587			 */
9588			var self = this;
9589			this.ft.raise('destroy.ft.editing').then(function(){
9590				self.ft.$el.removeClass('footable-editing footable-editing-always-show footable-editing-no-add footable-editing-no-edit footable-editing-no-delete footable-editing-no-view')
9591					.off('click.ft.editing').find('tfoot > tr.footable-editing').remove();
9592			});
9593		},
9594		/**
9595		 * Creates the editing UI from the current options setting the various jQuery properties of this component.
9596		 * @instance
9597		 * @protected
9598		 */
9599		$create: function(){
9600			var self = this, position = self.position === 'right' ? 'footable-editing-right' : 'footable-editing-left';
9601			self.ft.$el.addClass('footable-editing').addClass(position)
9602				.on('click.ft.editing', '.footable-show', {self: self}, self._onShowClick)
9603				.on('click.ft.editing', '.footable-hide', {self: self}, self._onHideClick)
9604				.on('click.ft.editing', '.footable-edit', {self: self}, self._onEditClick)
9605				.on('click.ft.editing', '.footable-delete', {self: self}, self._onDeleteClick)
9606				.on('click.ft.editing', '.footable-view', {self: self}, self._onViewClick)
9607				.on('click.ft.editing', '.footable-add', {self: self}, self._onAddClick);
9608
9609			self.$cell = $('<td/>').attr('colspan', self.ft.columns.visibleColspan).append(self.$buttonShow());
9610			if (self.allowAdd){
9611				self.$cell.append(self.$buttonAdd());
9612			}
9613			self.$cell.append(self.$buttonHide());
9614
9615			if (self.alwaysShow){
9616				self.ft.$el.addClass('footable-editing-always-show');
9617			}
9618
9619			if (!self.allowAdd) self.ft.$el.addClass('footable-editing-no-add');
9620			if (!self.allowEdit) self.ft.$el.addClass('footable-editing-no-edit');
9621			if (!self.allowDelete) self.ft.$el.addClass('footable-editing-no-delete');
9622			if (!self.allowView) self.ft.$el.addClass('footable-editing-no-view');
9623
9624			var $tfoot = self.ft.$el.children('tfoot');
9625			if ($tfoot.length == 0){
9626				$tfoot = $('<tfoot/>');
9627				self.ft.$el.append($tfoot);
9628			}
9629			self.$row = $('<tr/>', { 'class': 'footable-editing' }).append(self.$cell).appendTo($tfoot);
9630		},
9631		/**
9632		 * Creates the show button for the editing component.
9633		 * @instance
9634		 * @protected
9635		 * @returns {(string|HTMLElement|jQuery)}
9636		 */
9637		$buttonShow: function(){
9638			return '<button type="button" class="btn btn-primary footable-show">' + this.showText + '</button>';
9639		},
9640		/**
9641		 * Creates the hide button for the editing component.
9642		 * @instance
9643		 * @protected
9644		 * @returns {(string|HTMLElement|jQuery)}
9645		 */
9646		$buttonHide: function(){
9647			return '<button type="button" class="btn btn-default footable-hide">' + this.hideText + '</button>';
9648		},
9649		/**
9650		 * Creates the add button for the editing component.
9651		 * @instance
9652		 * @protected
9653		 * @returns {(string|HTMLElement|jQuery)}
9654		 */
9655		$buttonAdd: function(){
9656			return '<button type="button" class="btn btn-primary footable-add">' + this.addText + '</button> ';
9657		},
9658		/**
9659		 * Creates the edit button for the editing component.
9660		 * @instance
9661		 * @protected
9662		 * @returns {(string|HTMLElement|jQuery)}
9663		 */
9664		$buttonEdit: function(){
9665			return '<button type="button" class="btn btn-default footable-edit">' + this.editText + '</button> ';
9666		},
9667		/**
9668		 * Creates the delete button for the editing component.
9669		 * @instance
9670		 * @protected
9671		 * @returns {(string|HTMLElement|jQuery)}
9672		 */
9673		$buttonDelete: function(){
9674			return '<button type="button" class="btn btn-default footable-delete">' + this.deleteText + '</button>';
9675		},
9676		/**
9677		 * Creates the view button for the editing component.
9678		 * @instance
9679		 * @protected
9680		 * @returns {(string|HTMLElement|jQuery)}
9681		 */
9682		$buttonView: function(){
9683			return '<button type="button" class="btn btn-default footable-view">' + this.viewText + '</button> ';
9684		},
9685		/**
9686		 * Creates the button group for the row buttons.
9687		 * @instance
9688		 * @protected
9689		 * @returns {(string|HTMLElement|jQuery)}
9690		 */
9691		$rowButtons: function(){
9692			if (F.is.jq(this._$buttons)) return this._$buttons.clone();
9693			this._$buttons = $('<div class="btn-group btn-group-xs" role="group"></div>');
9694			if (this.allowView) this._$buttons.append(this.$buttonView());
9695			if (this.allowEdit) this._$buttons.append(this.$buttonEdit());
9696			if (this.allowDelete) this._$buttons.append(this.$buttonDelete());
9697			return this._$buttons;
9698		},
9699		/**
9700		 * Performs the drawing of the component.
9701		 */
9702		draw: function(){
9703			this.$cell.attr('colspan', this.ft.columns.visibleColspan);
9704		},
9705		/**
9706		 * Handles the edit button click event.
9707		 * @instance
9708		 * @private
9709		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9710		 * @fires FooTable.Editing#"edit.ft.editing"
9711		 */
9712		_onEditClick: function(e){
9713			e.preventDefault();
9714			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
9715			if (row instanceof F.Row){
9716				/**
9717				 * The edit.ft.editing event is raised before its callback is executed.
9718				 * Calling preventDefault on this event will prevent the callback from being executed.
9719				 * @event FooTable.Editing#"edit.ft.editing"
9720				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9721				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9722				 * @param {FooTable.Row} row - The row to be edited.
9723				 */
9724				self.ft.raise('edit.ft.editing', [row]).then(function(){
9725					self.callbacks.editRow.call(self.ft, row);
9726				});
9727			}
9728		},
9729		/**
9730		 * Handles the delete button click event.
9731		 * @instance
9732		 * @private
9733		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9734		 * @fires FooTable.Editing#"delete.ft.editing"
9735		 */
9736		_onDeleteClick: function(e){
9737			e.preventDefault();
9738			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
9739			if (row instanceof F.Row){
9740				/**
9741				 * The delete.ft.editing event is raised before its callback is executed.
9742				 * Calling preventDefault on this event will prevent the callback from being executed.
9743				 * @event FooTable.Editing#"delete.ft.editing"
9744				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9745				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9746				 * @param {FooTable.Row} row - The row to be deleted.
9747				 */
9748				self.ft.raise('delete.ft.editing', [row]).then(function(){
9749					self.callbacks.deleteRow.call(self.ft, row);
9750				});
9751			}
9752		},
9753		/**
9754		 * Handles the view button click event.
9755		 * @instance
9756		 * @private
9757		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9758		 * @fires FooTable.Editing#"view.ft.editing"
9759		 */
9760		_onViewClick: function(e){
9761			e.preventDefault();
9762			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
9763			if (row instanceof F.Row){
9764				/**
9765				 * The view.ft.editing event is raised before its callback is executed.
9766				 * Calling preventDefault on this event will prevent the callback from being executed.
9767				 * @event FooTable.Editing#"view.ft.editing"
9768				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9769				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9770				 * @param {FooTable.Row} row - The row to be viewed.
9771				 */
9772				self.ft.raise('view.ft.editing', [row]).then(function(){
9773					self.callbacks.viewRow.call(self.ft, row);
9774				});
9775			}
9776		},
9777		/**
9778		 * Handles the add button click event.
9779		 * @instance
9780		 * @private
9781		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9782		 * @fires FooTable.Editing#"add.ft.editing"
9783		 */
9784		_onAddClick: function(e){
9785			e.preventDefault();
9786			var self = e.data.self;
9787			/**
9788			 * The add.ft.editing event is raised before its callback is executed.
9789			 * Calling preventDefault on this event will prevent the callback from being executed.
9790			 * @event FooTable.Editing#"add.ft.editing"
9791			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9792			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9793			 */
9794			self.ft.raise('add.ft.editing').then(function(){
9795				self.callbacks.addRow.call(self.ft);
9796			});
9797		},
9798		/**
9799		 * Handles the show button click event.
9800		 * @instance
9801		 * @private
9802		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9803		 * @fires FooTable.Editing#"show.ft.editing"
9804		 */
9805		_onShowClick: function(e){
9806			e.preventDefault();
9807			var self = e.data.self;
9808			/**
9809			 * The show.ft.editing event is raised before its callback is executed.
9810			 * Calling preventDefault on this event will prevent the callback from being executed.
9811			 * @event FooTable.Editing#"show.ft.editing"
9812			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9813			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9814			 */
9815			self.ft.raise('show.ft.editing').then(function(){
9816				self.ft.$el.addClass('footable-editing-show');
9817				self.column.visible = true;
9818				self.ft.draw();
9819			});
9820		},
9821		/**
9822		 * Handles the hide button click event.
9823		 * @instance
9824		 * @private
9825		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9826		 * @fires FooTable.Editing#"show.ft.editing"
9827		 */
9828		_onHideClick: function(e){
9829			e.preventDefault();
9830			var self = e.data.self;
9831			/**
9832			 * The hide.ft.editing event is raised before its callback is executed.
9833			 * Calling preventDefault on this event will prevent the callback from being executed.
9834			 * @event FooTable.Editing#"hide.ft.editing"
9835			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9836			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9837			 */
9838			self.ft.raise('hide.ft.editing').then(function(){
9839				self.ft.$el.removeClass('footable-editing-show');
9840				self.column.visible = false;
9841				self.ft.draw();
9842			});
9843		}
9844	});
9845
9846	F.components.register('editing', F.Editing, 850);
9847
9848})(jQuery, FooTable);
9849
9850(function($, F){
9851
9852	F.EditingColumn = F.Column.extend(/** @lends FooTable.EditingColumn */{
9853		/**
9854		 * The Editing column class is used to create the column containing the editing buttons.
9855		 * @constructs
9856		 * @extends FooTable.Column
9857		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
9858		 * @param {FooTable.Editing} editing - The parent {@link FooTable.Editing} component this column is used with.
9859		 * @param {object} definition - An object containing all the properties to set for the column.
9860		 * @returns {FooTable.EditingColumn}
9861		 */
9862		construct: function(instance, editing, definition){
9863			this._super(instance, definition, 'editing');
9864			this.editing = editing;
9865			this.internal = true;
9866		},
9867		/**
9868		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
9869		 * @instance
9870		 * @protected
9871		 * @this FooTable.Column
9872		 */
9873		$create: function(){
9874			(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>', {'class': 'footable-editing'})).html(this.title);
9875		},
9876		/**
9877		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and
9878		 * will be provided to the {@link FooTable.EditingColumn#format} function
9879		 * to generate the cell contents.
9880		 * @instance
9881		 * @protected
9882		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
9883		 * @returns {(jQuery)}
9884		 */
9885		parser: function(valueOrElement){
9886			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
9887			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
9888			if (F.is.jq(valueOrElement)){
9889				var tagName = valueOrElement.prop('tagName').toLowerCase();
9890				if (tagName == 'td' || tagName == 'th') return valueOrElement.data('value') || valueOrElement.contents();
9891				return valueOrElement;
9892			}
9893			return null;
9894		},
9895		/**
9896		 * Creates a cell to be used in the supplied row for this column.
9897		 * @param {FooTable.Row} row - The row to create the cell for.
9898		 * @returns {FooTable.Cell}
9899		 */
9900		createCell: function(row){
9901			var $buttons = this.editing.$rowButtons(), $cell = $('<td/>').append($buttons);
9902			if (F.is.jq(row.$el)){
9903				if (this.index === 0){
9904					$cell.prependTo(row.$el);
9905				} else {
9906					$cell.insertAfter(row.$el.children().eq(this.index-1));
9907				}
9908			}
9909			return new F.Cell(this.ft, row, this, $cell || $cell.html());
9910		}
9911	});
9912
9913	F.columns.register('editing', F.EditingColumn);
9914
9915})(jQuery, FooTable);
9916(function($, F) {
9917
9918	/**
9919	 * An object containing the editing options for the plugin. Added by the {@link FooTable.Editing} component.
9920	 * @type {object}
9921	 * @prop {boolean} enabled=false - Whether or not to allow editing on the table.
9922	 * @prop {boolean} pageToNew=true - Whether or not to automatically page to a new row when it is added to the table.
9923	 * @prop {string} position="right" - The position of the editing column in the table as well as the alignment of the buttons.
9924	 * @prop {boolean} alwaysShow=false - Whether or not the editing column and add row button are always visible.
9925	 * @prop {function} addRow - The callback function to execute when the add row button is clicked.
9926	 * @prop {function} editRow - The callback function to execute when the edit row button is clicked.
9927	 * @prop {function} deleteRow - The callback function to execute when the delete row button is clicked.
9928	 * @prop {function} viewRow - The callback function to execute when the view row button is clicked.
9929	 * @prop {string} showText - The text that appears in the show button. This can contain HTML.
9930	 * @prop {string} hideText - The text that appears in the hide button. This can contain HTML.
9931	 * @prop {string} addText - The text that appears in the add button. This can contain HTML.
9932	 * @prop {string} editText - The text that appears in the edit button. This can contain HTML.
9933	 * @prop {string} deleteText - The text that appears in the delete button. This can contain HTML.
9934	 * @prop {string} viewText - The text that appears in the view button. This can contain HTML.
9935	 * @prop {boolean} allowAdd - Whether or not to show the Add Row button.
9936	 * @prop {boolean} allowEdit - Whether or not to show the Edit Row button.
9937	 * @prop {boolean} allowDelete - Whether or not to show the Delete Row button.
9938	 * @prop {boolean} allowView - Whether or not to show the View Row button.
9939	 * @prop {object} column - The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
9940	 * @prop {string} column.classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
9941	 * @prop {string} column.name="editing" - The name of the column.
9942	 * @prop {string} column.title="" - The title displayed in the header row of the table for the column.
9943	 * @prop {boolean} column.filterable=false - Whether or not the column should be filterable when using the filtering component.
9944	 * @prop {boolean} column.sortable=false - Whether or not the column should be sortable when using the sorting component.
9945	 */
9946	F.Defaults.prototype.editing = {
9947		enabled: false,
9948		pageToNew: true,
9949		position: 'right',
9950		alwaysShow: false,
9951		addRow: function(){},
9952		editRow: function(row){},
9953		deleteRow: function(row){},
9954		viewRow: function(row){},
9955		showText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span> Edit rows',
9956		hideText: 'Cancel',
9957		addText: 'New row',
9958		editText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span>',
9959		deleteText: '<span class="fooicon fooicon-trash" aria-hidden="true"></span>',
9960		viewText: '<span class="fooicon fooicon-stats" aria-hidden="true"></span>',
9961		allowAdd: true,
9962		allowEdit: true,
9963		allowDelete: true,
9964		allowView: false,
9965		column: {
9966			classes: 'footable-editing',
9967			name: 'editing',
9968			title: '',
9969			filterable: false,
9970			sortable: false
9971		}
9972	};
9973
9974})(jQuery, FooTable);
9975
9976(function($, F){
9977
9978	if (F.is.defined(F.Paging)){
9979		/**
9980		 * Holds a shallow clone of the un-paged {@link FooTable.Rows#array} value before paging occurs and superfluous rows are removed. Added by the {@link FooTable.Editing} component.
9981		 * @instance
9982		 * @public
9983		 * @type {Array<FooTable.Row>}
9984		 */
9985		F.Paging.prototype.unpaged = [];
9986
9987		// override the default predraw method with one that sets the unpaged property.
9988		F.Paging.extend('predraw', function(){
9989			this.unpaged = this.ft.rows.array.slice(0); // create a shallow clone for later use
9990			this._super(); // call the original method
9991		});
9992	}
9993
9994})(jQuery, FooTable);
9995(function($, F){
9996
9997	/**
9998	 * Adds the row to the table.
9999	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
10000	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
10001	 * @returns {jQuery.Deferred}
10002	 */
10003	F.Row.prototype.add = function(redraw){
10004		redraw = F.is.boolean(redraw) ? redraw : true;
10005		var self = this;
10006		return $.Deferred(function(d){
10007			var index = self.ft.rows.all.push(self) - 1;
10008			if (redraw){
10009				return self.ft.draw().then(function(){
10010					d.resolve(index);
10011				});
10012			} else {
10013				d.resolve(index);
10014			}
10015		});
10016	};
10017
10018	/**
10019	 * Removes the row from the table.
10020	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
10021	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
10022	 * @returns {jQuery.Deferred}
10023	 */
10024	F.Row.prototype.delete = function(redraw){
10025		redraw = F.is.boolean(redraw) ? redraw : true;
10026		var self = this;
10027		return $.Deferred(function(d){
10028			var index = self.ft.rows.all.indexOf(self);
10029			if (F.is.number(index) && index >= 0 && index < self.ft.rows.all.length){
10030				self.ft.rows.all.splice(index, 1);
10031				if (redraw){
10032					return self.ft.draw().then(function(){
10033						d.resolve(self);
10034					});
10035				}
10036			}
10037			d.resolve(self);
10038		});
10039	};
10040
10041	if (F.is.defined(F.Paging)){
10042		// override the default add method with one that supports paging
10043		F.Row.extend('add', function(redraw){
10044			redraw = F.is.boolean(redraw) ? redraw : true;
10045			var self = this,
10046				added = this._super(redraw),
10047				editing = self.ft.use(F.Editing),
10048				paging;
10049			if (editing && editing.pageToNew && (paging = self.ft.use(F.Paging)) && redraw){
10050				return added.then(function(){
10051					var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
10052					var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
10053					if (paging.current !== page){ // goto the page if we need to
10054						return paging.goto(page);
10055					}
10056				});
10057			}
10058			return added;
10059		});
10060	}
10061
10062	if (F.is.defined(F.Sorting)){
10063		// override the default val method with one that supports sorting and paging
10064		F.Row.extend('val', function(data, redraw){
10065			redraw = F.is.boolean(redraw) ? redraw : true;
10066			var result = this._super(data);
10067			if (!F.is.hash(data)){
10068				return result;
10069			}
10070			var self = this;
10071			if (redraw){
10072				self.ft.draw().then(function(){
10073					var editing = self.ft.use(F.Editing), paging;
10074					if (F.is.defined(F.Paging) && editing && editing.pageToNew && (paging = self.ft.use(F.Paging))){
10075						var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
10076						var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
10077						if (paging.current !== page){ // goto the page if we need to
10078							return paging.goto(page);
10079						}
10080					}
10081				});
10082			}
10083			return result;
10084		});
10085	}
10086
10087})(jQuery, FooTable);
10088(function(F){
10089
10090	/**
10091	 * Adds a row to the underlying {@link FooTable.Rows#all} array.
10092	 * @param {(object|FooTable.Row)} dataOrRow - A hash containing the row values or an actual {@link FooTable.Row} object.
10093	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
10094	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
10095	 */
10096	F.Rows.prototype.add = function(dataOrRow, redraw){
10097		var row = dataOrRow;
10098		if (F.is.hash(dataOrRow)){
10099			row = new FooTable.Row(this.ft, this.ft.columns.array, dataOrRow);
10100		}
10101		if (row instanceof FooTable.Row){
10102			row.add(redraw);
10103		}
10104	};
10105
10106	/**
10107	 * Updates a row in the underlying {@link FooTable.Rows#all} array.
10108	 * @param {(number|FooTable.Row)} indexOrRow - The index to update or the actual {@link FooTable.Row} object.
10109	 * @param {object} data - A hash containing the new row values.
10110	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
10111	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
10112	 */
10113	F.Rows.prototype.update = function(indexOrRow, data, redraw){
10114		var len = this.ft.rows.all.length, 
10115			row = indexOrRow;
10116		if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
10117			row = this.ft.rows.all[indexOrRow];
10118		}
10119		if (row instanceof FooTable.Row && F.is.hash(data)){
10120			row.val(data, redraw);
10121		}
10122	};
10123
10124	/**
10125	 * Deletes a row from the underlying {@link FooTable.Rows#all} array.
10126	 * @param {(number|FooTable.Row)} indexOrRow - The index to delete or the actual {@link FooTable.Row} object.
10127	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
10128	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
10129	 */
10130	F.Rows.prototype.delete = function(indexOrRow, redraw){
10131		var len = this.ft.rows.all.length, 
10132			row = indexOrRow;
10133		if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
10134			row = this.ft.rows.all[indexOrRow];
10135		}
10136		if (row instanceof FooTable.Row){
10137			row.delete(redraw);
10138		}
10139	};
10140
10141})(FooTable);
10142
10143(function($, F){
10144
10145	// global int to use if the table has no ID
10146	var _uid = 0,
10147	// a hash value for the current url
10148		_url_hash = (function(str){
10149			var i, l, hval = 0x811c9dc5;
10150			for (i = 0, l = str.length; i < l; i++) {
10151				hval ^= str.charCodeAt(i);
10152				hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
10153			}
10154			return hval >>> 0;
10155		})(location.origin + location.pathname);
10156
10157	F.State = F.Component.extend(/** @lends FooTable.State */{
10158		/**
10159		 * The state component adds the ability for the table to remember its basic state for filtering, paging and sorting.
10160		 * @constructs
10161		 * @extends FooTable.Component
10162		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
10163		 * @returns {FooTable.State}
10164		 */
10165		construct: function(table){
10166			// call the constructor of the base class
10167			this._super(table, table.o.state.enabled);
10168			// Change this value if an update to this component requires any stored data to be reset
10169			this._key = '1';
10170			/**
10171			 * The key to use to store the state for this table.
10172			 * @type {(null|string)}
10173			 */
10174			this.key = this._key + (F.is.string(table.o.state.key) ? table.o.state.key : this._uid());
10175			/**
10176			 * Whether or not to allow the filtering component to store it's state.
10177			 * @type {boolean}
10178			 */
10179			this.filtering = F.is.boolean(table.o.state.filtering) ? table.o.state.filtering : true;
10180			/**
10181			 * Whether or not to allow the paging component to store it's state.
10182			 * @type {boolean}
10183			 */
10184			this.paging = F.is.boolean(table.o.state.paging) ? table.o.state.paging : true;
10185			/**
10186			 * Whether or not to allow the sorting component to store it's state.
10187			 * @type {boolean}
10188			 */
10189			this.sorting = F.is.boolean(table.o.state.sorting) ? table.o.state.sorting : true;
10190		},
10191		/* PROTECTED */
10192		/**
10193		 * Checks the supplied data and options for the state component.
10194		 * @instance
10195		 * @protected
10196		 * @param {object} data - The jQuery data object from the parent table.
10197		 * @fires FooTable.State#"preinit.ft.state"
10198		 * @this FooTable.State
10199		 */
10200		preinit: function(data){
10201			var self = this;
10202			/**
10203			 * The preinit.ft.state event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
10204			 * Calling preventDefault on this event will disable the component.
10205			 * @event FooTable.State#"preinit.ft.state"
10206			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10207			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10208			 * @param {object} data - The jQuery data object of the table raising the event.
10209			 */
10210			this.ft.raise('preinit.ft.state', [data]).then(function(){
10211
10212				self.enabled = F.is.boolean(data.state)
10213					? data.state
10214					: self.enabled;
10215
10216				if (!self.enabled) return;
10217
10218				self.key = self._key + (F.is.string(data.stateKey) ? data.stateKey : self.key);
10219
10220				self.filtering = F.is.boolean(data.stateFiltering) ? data.stateFiltering : self.filtering;
10221
10222				self.paging = F.is.boolean(data.statePaging) ? data.statePaging : self.paging;
10223
10224				self.sorting = F.is.boolean(data.stateSorting) ? data.stateSorting : self.sorting;
10225
10226			}, function(){
10227				self.enabled = false;
10228			});
10229		},
10230		/**
10231		 * Gets the state value for the specified key for this table.
10232		 * @instance
10233		 * @param {string} key - The key to get the value for.
10234		 * @returns {(*|null)}
10235		 */
10236		get: function(key){
10237			return JSON.parse(localStorage.getItem(this.key + ':' + key));
10238		},
10239		/**
10240		 * Sets the state value for the specified key for this table.
10241		 * @instance
10242		 * @param {string} key - The key to set the value for.
10243		 * @param {*} data - The value to store for the key. This value must be JSON.stringify friendly.
10244		 */
10245		set: function(key, data){
10246			localStorage.setItem(this.key + ':' + key, JSON.stringify(data));
10247		},
10248		/**
10249		 * Clears the state value for the specified key for this table.
10250		 * @instance
10251		 * @param {string} key - The key to clear the value for.
10252		 */
10253		remove: function(key){
10254			localStorage.removeItem(this.key + ':' + key);
10255		},
10256		/**
10257		 * Executes the {@link FooTable.Component#readState} function on all components.
10258		 * @instance
10259		 */
10260		read: function(){
10261			this.ft.execute(false, true, 'readState');
10262		},
10263		/**
10264		 * Executes the {@link FooTable.Component#writeState} function on all components.
10265		 * @instance
10266		 */
10267		write: function(){
10268			this.ft.execute(false, true, 'writeState');
10269		},
10270		/**
10271		 * Executes the {@link FooTable.Component#clearState} function on all components.
10272		 * @instance
10273		 */
10274		clear: function(){
10275			this.ft.execute(false, true, 'clearState');
10276		},
10277		/**
10278		 * Generates a unique identifier for the current {@link FooTable.Table} if one is not supplied through the options.
10279		 * This value is a combination of the url hash and either the element ID or an incremented global int value.
10280		 * @instance
10281		 * @returns {*}
10282		 * @private
10283		 */
10284		_uid: function(){
10285			var id = this.ft.$el.attr('id');
10286			return _url_hash + '_' + (F.is.string(id) ? id : ++_uid);
10287		}
10288	});
10289
10290	F.components.register('state', F.State, 700);
10291
10292})(jQuery, FooTable);
10293(function(F){
10294
10295	/**
10296	 * This method is called from the {@link FooTable.State#read} method and allows a component to retrieve its' stored state.
10297	 * @instance
10298	 * @protected
10299	 * @function
10300	 */
10301	F.Component.prototype.readState = function(){};
10302
10303	/**
10304	 * This method is called from the {@link FooTable.State#write} method and allows a component to write its' current state to the store.
10305	 * @instance
10306	 * @protected
10307	 * @function
10308	 */
10309	F.Component.prototype.writeState = function(){};
10310
10311	/**
10312	 * This method is called from the {@link FooTable.State#clear} method and allows a component to clear any stored state.
10313	 * @instance
10314	 * @protected
10315	 * @function
10316	 */
10317	F.Component.prototype.clearState = function(){};
10318
10319})(FooTable);
10320(function(F){
10321
10322	/**
10323	 * An object containing the state options for the plugin. Added by the {@link FooTable.State} component.
10324	 * @type {object}
10325	 * @prop {boolean} enabled=false - Whether or not to allow state to be stored for the table. This overrides the individual component enable options.
10326	 * @prop {boolean} filtering=true - Whether or not to allow the filtering state to be stored.
10327	 * @prop {boolean} paging=true - Whether or not to allow the filtering state to be stored.
10328	 * @prop {boolean} sorting=true - Whether or not to allow the filtering state to be stored.
10329	 * @prop {string} key=null - The unique key to use to store the table's data.
10330	 */
10331	F.Defaults.prototype.state = {
10332		enabled: false,
10333		filtering: true,
10334		paging: true,
10335		sorting: true,
10336		key: null
10337	};
10338
10339})(FooTable);
10340(function(F){
10341
10342	if (!F.Filtering) return;
10343
10344	/**
10345	 * Allows the filtering component to retrieve its' stored state.
10346	 */
10347	F.Filtering.prototype.readState = function(){
10348		if (this.ft.state.filtering){
10349			var state = this.ft.state.get('filtering');
10350			if (F.is.hash(state) && !F.is.emptyArray(state.filters)){
10351				this.filters = this.ensure(state.filters);
10352			}
10353		}
10354	};
10355
10356	/**
10357	 * Allows the filtering component to write its' current state to the store.
10358	 */
10359	F.Filtering.prototype.writeState = function(){
10360		if (this.ft.state.filtering) {
10361			var filters = F.arr.map(this.filters, function (f) {
10362				return {
10363					name: f.name,
10364					query: f.query instanceof F.Query ? f.query.val() : f.query,
10365					columns: F.arr.map(f.columns, function (c) {
10366						return c.name;
10367					}),
10368					hidden: f.hidden,
10369					space: f.space,
10370					connectors: f.connectors,
10371					ignoreCase: f.ignoreCase
10372				};
10373			});
10374			this.ft.state.set('filtering', {filters: filters});
10375		}
10376	};
10377
10378	/**
10379	 * Allows the filtering component to clear any stored state.
10380	 */
10381	F.Filtering.prototype.clearState = function(){
10382		if (this.ft.state.filtering) {
10383			this.ft.state.remove('filtering');
10384		}
10385	};
10386
10387})(FooTable);
10388(function(F){
10389
10390	if (!F.Paging) return;
10391
10392	/**
10393	 * Allows the paging component to retrieve its' stored state.
10394	 */
10395	F.Paging.prototype.readState = function(){
10396		if (this.ft.state.paging) {
10397			var state = this.ft.state.get('paging');
10398			if (F.is.hash(state)) {
10399				this.current = state.current;
10400				this.size = state.size;
10401			}
10402		}
10403	};
10404
10405	/**
10406	 * Allows the paging component to write its' current state to the store.
10407	 */
10408	F.Paging.prototype.writeState = function(){
10409		if (this.ft.state.paging) {
10410			this.ft.state.set('paging', {
10411				current: this.current,
10412				size: this.size
10413			});
10414		}
10415	};
10416
10417	/**
10418	 * Allows the paging component to clear any stored state.
10419	 */
10420	F.Paging.prototype.clearState = function(){
10421		if (this.ft.state.paging) {
10422			this.ft.state.remove('paging');
10423		}
10424	};
10425
10426})(FooTable);
10427(function(F){
10428
10429	if (!F.Sorting) return;
10430
10431	/**
10432	 * Allows the sorting component to retrieve its' stored state.
10433	 */
10434	F.Sorting.prototype.readState = function(){
10435		if (this.ft.state.sorting) {
10436			var state = this.ft.state.get('sorting');
10437			if (F.is.hash(state)) {
10438				var column = this.ft.columns.get(state.column);
10439				if (column instanceof F.Column) {
10440					this.column = column;
10441					this.column.direction = state.direction;
10442				}
10443			}
10444		}
10445	};
10446
10447	/**
10448	 * Allows the sorting component to write its' current state to the store.
10449	 */
10450	F.Sorting.prototype.writeState = function(){
10451		if (this.ft.state.sorting && this.column instanceof F.Column){
10452			this.ft.state.set('sorting', {
10453				column: this.column.name,
10454				direction: this.column.direction
10455			});
10456		}
10457	};
10458
10459	/**
10460	 * Allows the sorting component to clear any stored state.
10461	 */
10462	F.Sorting.prototype.clearState = function(){
10463		if (this.ft.state.sorting) {
10464			this.ft.state.remove('sorting');
10465		}
10466	};
10467
10468})(FooTable);
10469(function(F){
10470
10471	// hook into the _construct method so we can add the state property to the table.
10472	F.Table.extend('_construct', function(ready){
10473		this.state = this.use(FooTable.State);
10474		return this._super(ready);
10475	});
10476
10477	// hook into the _preinit method so we can trigger a plugin wide read state operation.
10478	F.Table.extend('_preinit', function(){
10479		var self = this;
10480		return self._super().then(function(){
10481			if (self.state.enabled){
10482				self.state.read();
10483			}
10484		});
10485	});
10486
10487	// hook into the draw method so we can trigger a plugin wide write state operation.
10488	F.Table.extend('draw', function(){
10489		var self = this;
10490		return self._super().then(function(){
10491			if (self.state.enabled){
10492				self.state.write();
10493			}
10494		});
10495	});
10496
10497})(FooTable);
10498(function($, F){
10499
10500	F.Export = F.Component.extend(/** @lends FooTable.Export */{
10501		/**
10502		 * @summary This component provides some basic export functionality.
10503		 * @memberof FooTable
10504		 * @constructs Export
10505		 * @param {FooTable.Table} table - The current instance of the plugin.
10506		 */
10507		construct: function(table){
10508			// call the constructor of the base class
10509			this._super(table, true);
10510			/**
10511			 * @summary A snapshot of the working set of rows prior to being trimmed by the paging component.
10512			 * @memberof FooTable.Export#
10513			 * @name snapshot
10514			 * @type {FooTable.Row[]}
10515			 */
10516			this.snapshot = [];
10517		},
10518		/**
10519		 * @summary Hooks into the predraw pipeline after sorting and filtering have taken place but prior to paging.
10520		 * @memberof FooTable.Export#
10521		 * @function predraw
10522		 * @description This method allows us to take a snapshot of the working set of rows before they are trimmed by the paging component and is called by the plugin instance.
10523		 */
10524		predraw: function(){
10525			this.snapshot = this.ft.rows.array.slice(0);
10526		},
10527		/**
10528		 * @summary Return the columns as simple JavaScript objects in an array.
10529		 * @memberof FooTable.Export#
10530		 * @function columns
10531		 * @returns {Object[]}
10532		 */
10533		columns: function(){
10534			var result = [];
10535			F.arr.each(this.ft.columns.array, function(column){
10536				if (!column.internal){
10537					result.push({
10538						type: column.type,
10539						name: column.name,
10540						title: column.title,
10541						visible: column.visible,
10542						hidden: column.hidden,
10543						classes: column.classes,
10544						style: column.style
10545					});
10546				}
10547			});
10548			return result;
10549		},
10550		/**
10551		 * @summary Return the rows as simple JavaScript objects in an array.
10552		 * @memberof FooTable.Export#
10553		 * @function rows
10554		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
10555		 * @returns {Object[]}
10556		 */
10557		rows: function(filtered){
10558			filtered = F.is.boolean(filtered) ? filtered : false;
10559			var rows = filtered ? this.ft.rows.all : this.snapshot, result = [];
10560			F.arr.each(rows, function(row){
10561				result.push(row.val());
10562			});
10563			return result;
10564		},
10565		/**
10566		 * @summary Return the columns and rows as a properly formatted JSON object.
10567		 * @memberof FooTable.Export#
10568		 * @function json
10569		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
10570		 * @returns {Object}
10571		 */
10572		json: function(filtered){
10573			return JSON.parse(JSON.stringify({columns: this.columns(),rows: this.rows(filtered)}));
10574		},
10575		/**
10576		 * @summary Return the columns and rows as a properly formatted CSV value.
10577		 * @memberof FooTable.Export#
10578		 * @function csv
10579		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
10580		 * @returns {string}
10581		 */
10582		csv: function(filtered){
10583			var csv = "", columns = this.columns(), value, escaped;
10584			F.arr.each(columns, function(column, i){
10585				escaped = '"' + column.title.replace(/"/g, '""') + '"';
10586				csv += (i === 0 ? escaped : "," + escaped);
10587			});
10588			csv += "\n";
10589
10590			var rows = filtered ? this.ft.rows.all : this.snapshot;
10591			F.arr.each(rows, function(row){
10592				F.arr.each(row.cells, function(cell, i){
10593					if (!cell.column.internal){
10594						value = cell.column.stringify.call(cell.column, cell.value, cell.ft.o, cell.row.value);
10595						escaped = '"' + value.replace(/"/g, '""') + '"';
10596						csv += (i === 0 ? escaped : "," + escaped);
10597					}
10598				});
10599				csv += "\n";
10600			});
10601			return csv;
10602		}
10603	});
10604
10605	// register the component using a priority of 490 which falls just after filtering (500) and before paging (400).
10606	F.components.register("export", F.Export, 490);
10607
10608})(jQuery, FooTable);
10609(function(F){
10610	// this is used to define the filtering specific properties on column creation
10611	F.Column.prototype.__export_define__ = function(definition){
10612		this.stringify = F.checkFnValue(this, definition.stringify, this.stringify);
10613	};
10614
10615	// overrides the public define method and replaces it with our own
10616	F.Column.extend('define', function(definition){
10617		this._super(definition); // call the base so we don't have to redefine any previously set properties
10618		this.__export_define__(definition); // then call our own
10619	});
10620
10621	/**
10622	 * @summary Return the supplied value as a string.
10623	 * @memberof FooTable.Column#
10624	 * @function stringify
10625	 * @returns {string}
10626	 */
10627	F.Column.prototype.stringify = function(value, options, rowData){
10628		return value + "";
10629	};
10630
10631	// override the base method for DateColumns
10632	F.DateColumn.prototype.stringify = function(value, options, rowData){
10633		return F.is.object(value) && F.is.boolean(value._isAMomentObject) && value.isValid() ? value.format(this.formatString) : '';
10634	};
10635
10636	// override the base method for ObjectColumns
10637	F.ObjectColumn.prototype.stringify = function(value, options, rowData){
10638		return F.is.object(value) ? JSON.stringify(value) : "";
10639	};
10640
10641	// override the base method for ArrayColumns
10642	F.ArrayColumn.prototype.stringify = function(value, options, rowData){
10643		return F.is.array(value) ? JSON.stringify(value) : "";
10644	};
10645
10646})(FooTable);
10647(function(F){
10648	/**
10649	 * @summary Return the columns and rows as a properly formatted JSON object.
10650	 * @memberof FooTable.Table#
10651	 * @function toJSON
10652	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
10653	 * @returns {Object}
10654	 */
10655	F.Table.prototype.toJSON = function(filtered){
10656		return this.use(F.Export).json(filtered);
10657	};
10658
10659	/**
10660	 * @summary Return the columns and rows as a properly formatted CSV value.
10661	 * @memberof FooTable.Table#
10662	 * @function toCSV
10663	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
10664	 * @returns {string}
10665	 */
10666	F.Table.prototype.toCSV = function(filtered){
10667		return this.use(F.Export).csv(filtered);
10668	};
10669
10670})(FooTable);
10671/* End */
10672;
10673; /* Start:"a:4:{s:4:"full";s:70:"/local/templates/aspro_max/vendor/js/sticky-sidebar.js?166601759325989";s:6:"source";s:54:"/local/templates/aspro_max/vendor/js/sticky-sidebar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
10674(function (global, factory) {
10675	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
10676	typeof define === 'function' && define.amd ? define(['exports'], factory) :
10677	(factory((global.StickySidebar = {})));
10678}(this, (function (exports) { 'use strict';
10679
10680var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10681
10682
10683
10684function unwrapExports (x) {
10685	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
10686}
10687
10688function createCommonjsModule(fn, module) {
10689	return module = { exports: {} }, fn(module, module.exports), module.exports;
10690}
10691
10692var stickySidebar = createCommonjsModule(function (module, exports
10692) {
10693(function (global, factory) {
10694  if (typeof undefined === "function" && undefined.amd) {
10695    undefined(['exports'], factory);
10696  } else {
10697    factory(exports);
10698  }
10699})(commonjsGlobal, function (exports) {
10700  Object.defineProperty(exports, "__esModule", {
10701    value: true
10702  });
10703
10704  function _classCallCheck(instance, Constructor) {
10705    if (!(instance instanceof Constructor)) {
10706      throw new TypeError("Cannot call a class as a function");
10707    }
10708  }
10709
10710  var _createClass = function () {
10711    function defineProperties(target, props) {
10712      for (var i = 0; i < props.length; i++) {
10713        var descriptor = props[i];
10714        descriptor.enumerable = descriptor.enumerable || false;
10715        descriptor.configurable = true;
10716        if ("value" in descriptor) descriptor.writable = true;
10717        Object.defineProperty(target, descriptor.key, descriptor);
10718      }
10719    }
10720
10721    return function (Constructor, protoProps, staticProps) {
10722      if (protoProps) defineProperties(Constructor.prototype, protoProps);
10723      if (staticProps) defineProperties(Constructor, staticProps);
10724      return Constructor;
10725    };
10726  }();
10727
10728  /**
10729   * Sticky Sidebar JavaScript Plugin.
10730   * @version 3.3.4
10731   * @author Ahmed Bouhuolia <[email protected]>
10732   * @license The MIT License (MIT)
10733   */
10734  var StickySidebar = function () {
10735
10736    // ---------------------------------
10737    // # Define Constants
10738    // ---------------------------------
10739    //
10740    var EVENT_KEY = '.stickySidebar';
10741    var DEFAULTS = {
10742      /**
10743       * Additional top spacing of the element when it becomes sticky.
10744       * @type {Numeric|Function}
10745       */
10746      topSpacing: 0,
10747
10748      /**
10749       * Additional bottom spacing of the element when it becomes sticky.
10750       * @type {Numeric|Function}
10751       */
10752      bottomSpacing: 0,
10753
10754      /**
10755       * Container sidebar selector to know what the beginning and end of sticky element.
10756       * @type {String|False}
10757       */
10758      containerSelector: false,
10759
10760      /**
10761       * Inner wrapper selector.
10762       * @type {String}
10763       */
10764      innerWrapperSelector: '.inner-wrapper-sticky',
10765
10766      /**
10767       * The name of CSS class to apply to elements when they have become stuck.
10768       * @type {String|False}
10769       */
10770      stickyClass: 'is-affixed',
10771
10772      /**
10773       * Detect when sidebar and its container change height so re-calculate their dimensions.
10774       * @type {Boolean}
10775       */
10776      resizeSensor: true,
10777
10778      /**
10779       * The sidebar returns to its normal position if its width below this value.
10780       * @type {Numeric}
10781       */
10782      minWidth: false
10783    };
10784
10785    // ---------------------------------
10786    // # Class Definition
10787    // ---------------------------------
10788    //
10789    /**
10790     * Sticky Sidebar Class.
10791     * @public
10792     */
10793
10794    var StickySidebar = function () {
10795
10796      /**
10797       * Sticky Sidebar Constructor.
10798       * @constructor
10799       * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
10800       * @param {Object} options - The options of sticky sidebar.
10801       */
10802      function StickySidebar(sidebar) {
10803        var _this = this;
10804
10805        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10806
10807        _classCallCheck(this, StickySidebar);
10808
10809        this.options = StickySidebar.extend(DEFAULTS, options);
10810
10811        // Sidebar element query if there's no one, throw error.
10812        this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
10813        if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
10814
10815        this.sidebarInner = false;
10816        this.container = this.sidebar.parentElement;
10817
10818        // Current Affix Type of sidebar element.
10819        this.affixedType = 'STATIC';
10820        this.direction = 'down';
10821        this.support = {
10822          transform: false,
10823          transform3d: false
10824        };
10825
10826        this._initialized = false;
10827        this._reStyle = false;
10828        this._breakpoint = false;
10829
10830        // Dimensions of sidebar, container and screen viewport.
10831        this.dimensions = {
10832          translateY: 0,
10833          maxTranslateY: 0,
10834          topSpacing: 0,
10835          lastTopSpacing: 0,
10836          bottomSpacing: 0,
10837          lastBottomSpacing: 0,
10838          sidebarHeight: 0,
10839          sidebarWidth: 0,
10840          containerTop: 0,
10841          containerHeight: 0,
vendor: 1,666 bytes, lines 10842-10889
10842          viewportHeight: 0,
10843          viewportTop: 0,
10844          lastViewportTop: 0
10845        };
10846
10847        // Bind event handlers for referencability.
10848        ['handleEvent'].forEach(function (method) {
10849          _this[method] = _this[method].bind(_this);
10850        });
10851
10852        // Initialize sticky sidebar for first time.
10853        this.initialize();
10854      }
10855
10856      /**
10857       * Initializes the sticky sidebar by adding inner wrapper, define its container, 
10858       * min-width breakpoint, calculating dimensions, adding helper classes and inline style.
10859       * @private
10860       */
10861
10862
10863      _createClass(StickySidebar, [{
10864        key: 'initialize',
10865        value: function initialize() {
10866          var _this2 = this;
10867
10868          this._setSupportFeatures();
10869
10870          // Get sticky sidebar inner wrapper, if not found, will create one.
10871          if (this.options.innerWrapperSelector) {
10872            this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
10873
10874            if (null === this.sidebarInner) this.sidebarInner = false;
10875          }
10876
10877          if (!this.sidebarInner) {
10878            var wrapper = document.createElement('div');
10879            wrapper.setAttribute('class', 'inner-wrapper-sticky');
10880            this.sidebar.appendChild(wrapper);
10881
10882            while (this.sidebar.firstChild != wrapper) {
10883              wrapper.appendChild(this.sidebar.firstChild);
10884            }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
10885          }
10886
10887          // Container wrapper of the sidebar.
10888          if (this.options.containerSelector) {
10889            var containers = document.querySelectorAll(this.options.containerSelector);
10890            containers = Array.prototype.slice.call(containers);
10891
10892            containers.forEach(function (container, item) {
10893              if (!container.contains(_this2.sidebar)) return;
10894              _this2.container = container;
10895            });
10896
10897            if (!containers.length) throw new Error("The container does not contains on the sidebar.");
10898          }
10899
10900          // If top/bottom spacing is not function parse value to integer.
10901          if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
10902
10903          if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
10904
10905          // Breakdown sticky sidebar if screen width below `options.minWidth`.
10906          this._widthBreakpoint();
10907
10908          // Calculate dimensions of sidebar, container and viewport.
10909          this.calcDimensions();
10910
10911          // Affix sidebar in proper position.
10912          this.stickyPosition();
10913
10914          // Bind all events.
10915          this.bindEvents();
10916
vendor: 4,110 bytes, lines 10917-11014
10917          // Inform other properties the sticky sidebar is initialized.
10918          this._initialized = true;
10919        }
10920      }, {
10921        key: 'bindEvents',
10922        value: function bindEvents() {
10923          window.addEventListener('resize', this, { passive: true, capture: false });
10924          window.addEventListener('scroll', this, { passive: true, capture: false });
10925
10926          this.sidebar.addEventListener('update' + EVENT_KEY, this);
10927
10928          if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
10929            new ResizeSensor(this.sidebarInner, this.handleEvent);
10930            new ResizeSensor(this.container, this.handleEvent);
10931          }
10932        }
10933      }, {
10934        key: 'handleEvent',
10935        value: function handleEvent(event) {
10936          this.updateSticky(event);
10937        }
10938      }, {
10939        key: 'calcDimensions',
10940        value: function calcDimensions() {
10941          if (this._breakpoint) return;
10942          var dims = this.dimensions;
10943
10944          // Container of sticky sidebar dimensions.
10945          dims.containerTop = StickySidebar.offsetRelative(this.container).top;
10946          dims.containerHeight = this.container.clientHeight;
10947          dims.containerBottom = dims.containerTop + dims.containerHeight;
10948
10949          // Sidebar dimensions.
10950          dims.sidebarHeight = this.sidebarInner.offsetHeight;
10951          dims.sidebarWidth = this.sidebarInner.offsetWidth;
10952
10953          // Screen viewport dimensions.
10954          dims.viewportHeight = window.innerHeight;
10955
10956          // Maximum sidebar translate Y.
10957          dims.maxTranslateY = dims.containerHeight - dims.sidebarHeight;
10958
10959          this._calcDimensionsWithScroll();
10960        }
10961      }, {
10962        key: '_calcDimensionsWithScroll',
10963        value: function _calcDimensionsWithScroll() {
10964          var dims = this.dimensions;
10965
10966          dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
10967
10968          dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
10969          dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
10970          dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
10971
10972          dims.topSpacing = this.options.topSpacing;
10973          dims.bottomSpacing = this.options.bottomSpacing;
10974
10975          if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
10976
10977          if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
10978
10979          if ('VIEWPORT-TOP' === this.affixedType) {
10980            // Adjust translate Y in the case decrease top spacing value.
10981            if (dims.topSpacing < dims.lastTopSpacing) {
10982              dims.translateY += dims.lastTopSpacing - dims.topSpacing;
10983              this._reStyle = true;
10984            }
10985          } else if ('VIEWPORT-BOTTOM' === this.affixedType) {
10986            // Adjust translate Y in the case decrease bottom spacing value.
10987            if (dims.bottomSpacing < dims.lastBottomSpacing) {
10988              dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing;
10989              this._reStyle = true;
10990            }
10991          }
10992
10993          dims.lastTopSpacing = dims.topSpacing;
10994          dims.lastBottomSpacing = dims.bottomSpacing;
10995        }
10996      }, {
10997        key: 'isSidebarFitsViewport',
10998        value: function isSidebarFitsViewport() {
10999          var dims = this.dimensions;
11000          var offset = this.scrollDirection === 'down' ? dims.lastBottomSpacing : dims.lastTopSpacing;
11001          return this.dimensions.sidebarHeight + offset < this.dimensions.viewportHeight;
11002        }
11003      }, {
11004        key: 'observeScrollDir',
11005        value: function observeScrollDir() {
11006          var dims = this.dimensions;
11007          if (dims.lastViewportTop === dims.viewportTop) return;
11008
11009          var furthest = 'down' === this.direction ? Math.min : Math.max;
11010
11011          // If the browser is scrolling not in the same direction.
11012          if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
11013        }
11014      }, {
vendor: 5,814 bytes, lines 11015-11158
11015        key: 'getAffixType',
11016        value: function getAffixType() {
11017          this._calcDimensionsWithScroll();
11018          var dims = this.dimensions;
11019          var colliderTop = dims.viewportTop + dims.topSpacing;
11020          var affixType = this.affixedType;
11021
11022
11023          if (colliderTop <= dims.containerTop || dims.containerHeight < dims.sidebarHeight) {
11024            dims.translateY = 0;
11025            affixType = 'STATIC';
11026          } else {
11027            affixType = 'up' === this.direction ? this._getAffixTypeScrollingUp() : this._getAffixTypeScrollingDown();
11028          }
11029
11030          // Make sure the translate Y is not bigger than container height.
11031          dims.translateY = Math.max(0, dims.translateY);
11032          dims.translateY = Math.min(dims.containerHeight, dims.translateY);
11033          dims.translateY = Math.round(dims.translateY);
11034
11035          dims.lastViewportTop = dims.viewportTop;
11036          return affixType;
11037        }
11038      }, {
11039        key: '_getAffixTypeScrollingDown',
11040        value: function _getAffixTypeScrollingDown() {
11041
11042          //recalculate when height was changed
11043          if(this.dimensions.containerHeight != this.container.clientHeight){
11044            this.calcDimensions();
11045            //console.log('upd');
11046          }
11047          
11048          var dims = this.dimensions;
11049          var sidebarBottom = dims.sidebarHeight + dims.containerTop;
11050          var colliderTop = dims.viewportTop + dims.topSpacing;
11051          var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
11052          var affixType = this.affixedType;
11053
11054
11055
11056          if (this.isSidebarFitsViewport()) {
11057            if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
11058              dims.translateY = dims.containerBottom - sidebarBottom;
11059              affixType = 'CONTAINER-BOTTOM';
11060            } else if (colliderTop >= dims.containerTop) {
11061              dims.translateY = colliderTop - dims.containerTop;
11062              affixType = 'VIEWPORT-TOP';
11063            }
11064          } else {            
11065            if (dims.containerBottom <= colliderBottom) {
11066              dims.translateY = dims.containerBottom - sidebarBottom;
11067              affixType = 'CONTAINER-BOTTOM';
11068            } else if (sidebarBottom + dims.translateY <= colliderBottom) {
11069              dims.translateY = colliderBottom - sidebarBottom;
11070              affixType = 'VIEWPORT-BOTTOM';
11071            } else if (dims.containerTop + dims.translateY <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
11072              affixType = 'VIEWPORT-UNBOTTOM';
11073            }
11074          }
11075          
11076          return affixType;
11077        }
11078      }, {
11079        key: '_getAffixTypeScrollingUp',
11080        value: function _getAffixTypeScrollingUp() {
11081          var dims = this.dimensions;
11082          var sidebarBottom = dims.sidebarHeight + dims.containerTop;
11083          var colliderTop = dims.viewportTop + dims.topSpacing;
11084          var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
11085          var affixType = this.affixedType;
11086
11087          if (colliderTop <= dims.translateY + dims.containerTop) {
11088            dims.translateY = colliderTop - dims.containerTop;
11089            affixType = 'VIEWPORT-TOP';
11090          } else if (dims.containerBottom <= colliderBottom) {
11091            dims.translateY = dims.containerBottom - sidebarBottom;
11092            affixType = 'CONTAINER-BOTTOM';
11093          } else if (!this.isSidebarFitsViewport()) {
11094
11095            if (dims.containerTop <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
11096              affixType = 'VIEWPORT-UNBOTTOM';
11097            }
11098          }
11099
11100          return affixType;
11101        }
11102      }, {
11103        key: '_getStyle',
11104        value: function _getStyle(affixType) {
11105          if ('undefined' === typeof affixType) return;
11106
11107          var style = { inner: {}, outer: {} };
11108          var dims = this.dimensions;
11109
11110          switch (affixType) {
11111            case 'VIEWPORT-TOP':
11112              style.inner = { position: 'fixed', top: dims.topSpacing,
11113                left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
11114              break;
11115            case 'VIEWPORT-BOTTOM':
11116              style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
11117                bottom: dims.bottomSpacing, width: dims.sidebarWidth };
11118              break;
11119            case 'CONTAINER-BOTTOM':
11120            case 'VIEWPORT-UNBOTTOM':
11121              var translate = this._getTranslate(0, dims.translateY + 'px');
11122
11123              if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
11124              break;
11125          }
11126
11127          switch (affixType) {
11128            case 'VIEWPORT-TOP':
11129            case 'VIEWPORT-BOTTOM':
11130            case 'VIEWPORT-UNBOTTOM':
11131            case 'CONTAINER-BOTTOM':
11132              style.outer = { height: dims.sidebarHeight, position: 'relative' };
11133              break;
11134          }
11135
11136          style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
11137          style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
11138            bottom: '', width: '', transform: '' }, style.inner);
11139
11140          return style;
11141        }
11142      }, {
11143        key: 'stickyPosition',
11144        value: function stickyPosition(force) {
11145          if (this._breakpoint) return;
11146
11147          force = this._reStyle || force || false;
11148
11149          var offsetTop = this.options.topSpacing;
11150          var offsetBottom = this.options.bottomSpacing;
11151
11152
11153          //for actual sidebar height, cause height can change after document load
11154          if(this.sidebarInner.offsetHeight > this.dimensions.sidebarHeight){            
11155            this.dimensions.sidebarHeight = this.sidebarInner.offsetHeight;
11156          }
11157
11158
vendor: 5,484 bytes, lines 11159-11290
11159          var affixType = this.getAffixType();
11160          var style = this._getStyle(affixType);
11161
11162          if ((this.affixedType != affixType || force) && affixType) {
11163            var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
11164            StickySidebar.eventTrigger(this.sidebar, affixEvent);
11165
11166            if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
11167
11168            for (var key in style.outer) {
11169              var unit = 'number' === typeof style.outer[key] ? 'px' : '';
11170              this.sidebar.style[key] = style.outer[key] + unit;
11171            }
11172
11173            for (var _key in style.inner) {
11174              var _unit = 'number' === typeof style.inner[_key] ? 'px' : '';
11175              this.sidebarInner.style[_key] = style.inner[_key] + _unit;
11176            }
11177
11178            var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
11179            StickySidebar.eventTrigger(this.sidebar, affixedEvent);
11180          } else {
11181            if (this._initialized) this.sidebarInner.style.left = style.inner.left;
11182          }
11183
11184          this.affixedType = affixType;
11185        }
11186      }, {
11187        key: '_widthBreakpoint',
11188        value: function _widthBreakpoint() {
11189
11190          if (window.innerWidth <= this.options.minWidth) {
11191            this._breakpoint = true;
11192            this.affixedType = 'STATIC';
11193
11194            this.sidebar.removeAttribute('style');
11195            StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
11196            this.sidebarInner.removeAttribute('style');
11197          } else {
11198            this._breakpoint = false;
11199          }
11200        }
11201      }, {
11202        key: 'updateSticky',
11203        value: function updateSticky() {
11204          var _this3 = this;
11205
11206          var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11207
11208          if (this._running) return;
11209          this._running = true;
11210
11211          (function (eventType) {
11212            requestAnimationFrame(function () {
11213              switch (eventType) {
11214                // When browser is scrolling and re-calculate just dimensions
11215                // within scroll. 
11216                case 'scroll':
11217                  _this3._calcDimensionsWithScroll();
11218                  _this3.observeScrollDir();
11219                  _this3.stickyPosition();
11220                  break;
11221
11222                // When browser is resizing or there's no event, observe width
11223                // breakpoint and re-calculate dimensions.
11224                case 'resize':
11225                default:
11226                  _this3._widthBreakpoint();
11227                  _this3.calcDimensions();
11228                  _this3.stickyPosition(true);
11229                  break;
11230              }
11231              _this3._running = false;
11232            });
11233          })(event.type);
11234        }
11235      }, {
11236        key: '_setSupportFeatures',
11237        value: function _setSupportFeatures() {
11238          var support = this.support;
11239
11240          support.transform = StickySidebar.supportTransform();
11241          support.transform3d = StickySidebar.supportTransform(true);
11242        }
11243      }, {
11244        key: '_getTranslate',
11245        value: function _getTranslate() {
11246          var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
11247          var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
11248          var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
11249
11250          if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
11251        }
11252      }, {
11253        key: 'destroy',
11254        value: function destroy() {
11255          window.removeEventListener('resize', this, { capture: false });
11256          window.removeEventListener('scroll', this, { capture: false });
11257
11258          this.sidebar.classList.remove(this.options.stickyClass);
11259          this.sidebar.style.minHeight = '';
11260
11261          this.sidebar.removeEventListener('update' + EVENT_KEY, this);
11262
11263          var styleReset = { inner: {}, outer: {} };
11264
11265          styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
11266          styleReset.outer = { height: '', position: '' };
11267
11268          for (var key in styleReset.outer) {
11269            this.sidebar.style[key] = styleReset.outer[key];
11270          }for (var _key2 in styleReset.inner) {
11271            this.sidebarInner.style[_key2] = styleReset.inner[_key2];
11272          }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
11273            ResizeSensor.detach(this.sidebarInner, this.handleEvent);
11274            ResizeSensor.detach(this.container, this.handleEvent);
11275          }
11276        }
11277      }], [{
11278        key: 'supportTransform',
11279        value: function supportTransform(transform3d) {
11280          var result = false,
11281              property = transform3d ? 'perspective' : 'transform',
11282              upper = property.charAt(0).toUpperCase() + property.slice(1),
11283              prefixes = ['Webkit', 'Moz', 'O', 'ms'],
11284              support = document.createElement('support'),
11285              style = support.style;
11286
11287          (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
11288            if (style[property] !== undefined) {
11289              result = property;
11290              return false;
11291            }
11292          });
11293          return result;
11294        }
11295      }, {
11296        key: 'eventTrigger',
11297        value: function eventTrigger(element, eventName, data) {
11298          try {
11299            var event = new CustomEvent(eventName, { detail: data });
11300          } catch (e) {
11301            var event = document.createEvent('CustomEvent');
11302            event.initCustomEvent(eventName, true, true, data);
11303          }
11304          element.dispatchEvent(event);
11305        }
11306      }, {
11307        key: 'extend',
11308        value: function extend(defaults, options) {
11309          var results = {};
11310          for (var key in defaults) {
11311            if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
11312          }
11313          return results;
11314        }
11315      }, {
11316        key: 'offsetRelative',
11317        value: function offsetRelative(element) {
11318          var result = { left: 0, top: 0 };
11319
11320          do {
11321            var offsetTop = element.offsetTop;
11322            var offsetLeft = element.offsetLeft;
11323
11324            if (!isNaN(offsetTop)) result.top += offsetTop;
11325
11326            if (!isNaN(offsetLeft)) result.left += offsetLeft;
11327
11328            element = 'BODY' === element.tagName ? element.parentElement : element.offsetParent;
11329          } while (element);
11330          return result;
11331        }
11332      }, {
11333        key: 'addClass',
11334        value: function addClass(element, className) {
11335          if (!StickySidebar.hasClass(element, className)) {
11336            if (element.classList) element.classList.add(className);else element.className += ' ' + className;
11337          }
11338        }
11339      }, {
11340        key: 'removeClass',
11341        value: function removeClass(element, className) {
11342          if (StickySidebar.hasClass(element, className)) {
11343            if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
11344          }
11345        }
11346      }, {
11347        key: 'hasClass',
11348        value: function hasClass(element, className) {
11349          if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
11350        }
11351      }, {
11352        key: 'defaults',
11353        get: function () {
11354          return DEFAULTS;
11355        }
11356      }]);
11357
11358      return StickySidebar;
11359    }();
11360
11361    return StickySidebar;
11362  }();
11363
11364  exports.default = StickySidebar;
11365
11366
11367  // Global
11368  // -------------------------
11369  window.StickySidebar = StickySidebar;
11370});
11371});
11372
11373var stickySidebar$1 = unwrapExports(stickySidebar);
11374
11375exports['default'] = stickySidebar$1;
11376exports.__moduleExports = stickySidebar;
11377
11378Object.defineProperty(exports, '__esModule', { value: true });
11379
11380})));
11381/* End */
11382;
11383; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_max/js/jquery.validate.min.js?166601759322254";s:6:"source";s:52:"/local/templates/aspro_max/js/jquery.validate.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
11384/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
11385 * http://jqueryvalidation.org/
11386 * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
11387!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element
11387(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers
11387)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a];return void 0},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.val
11387idClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.n
11387ame],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);
11387return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){/*return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())*/ /*customized!!!*/ var check = false,re=new RegExp((typeof(VALIDATE_DATE_MASK)!=='undefined'?VALIDATE_DATE_MASK:'^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}$')),adata,gg,mm,aaaa,xdata;if(re.test(a)){adata=a.split('.');if(adata.length===1){adata=a.split('-');if(adata.length===1){adata=a.split(' ');
11387if(adata.length===1){adata=a.split('/');if(adata.length===1){adata=a.split(':');}}}}gg=parseInt(adata[0],10);mm=parseInt(adata[1],10);aaaa=parseInt(adata[2],10);xdata=new Date(aaaa,mm-1,gg,12,0,0,0);if((xdata.getUTCFullYear()===aaaa)&&(xdata.getUTCMonth()===mm-1)&&(xdata.getUTCDate()===gg)){check = true;}else{check = false;}}else{check = false;}return this.optional(b)||check;},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})});
11388/* End */
11389;
11390; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max/js/jquery.alphanumeric.js?16660175931901";s:6:"source";s:52:"/local/templates/aspro_max/js/jquery.alphanumeric.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
11391(function ($) {
11392    $.fn.alphanumeric = function (p) {
11393        var input = $(this),
11394            az = "abcdefghijklmnopqrstuvwxyz",
11395            options = $.extend({
11396                ichars: '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.- _',
11397                nchars: '',
11398                allow: ''
11399            }, p),
11400            s = options.allow.split(''),
11401            i = 0,
11402            ch,
11403            regex;
11404
11405        for (i; i < s.length; i++) {
11406            if (options.ichars.indexOf(s[i]) != -1) {
11407                s[i] = '\\' + s[i];
11408            }
11409        }
11410
11411        if (options.nocaps) {
11412            options.nchars += az.toUpperCase();
11413        }
11414        if (options.allcaps) {
11415            options.nchars += az;
11416        }
11417
11418        options.allow = s.join('|');
11419
11420        regex = new RegExp(options.allow, 'gi');
11421        ch = (options.ichars + options.nchars).replace(regex, '');
11422
11423        input.keypress(function (e) {
11424            var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
11425
11426            if (ch.indexOf(key) != -1 && !e.ctrlKey) {
11427                e.preventDefault();
11428            }
11429        });
11430
11431        input.blur(function () {
11432            var value = input.val(),
11433                j = 0;
11434
11435            for (j; j < value.length; j++) {
11436                if (ch.indexOf(value[j]) != -1) {
11437                    input.val('');
11438                    return false;
11439                }
11440            }
11441            return false;
11442        });
11443
11444        return input;
11445    };
11446
11447    $.fn.numeric = function (p) {
11448        var az = 'abcdefghijklmnopqrstuvwxyz',
11449            aZ = az.toUpperCase();
11450
11451        return this.each(function () {
11452            $(this).alphanumeric($.extend({ nchars: az + aZ }, p));
11453        });
11454    };
11455
11456    $.fn.alpha = function (p) {
11457        var nm = '1234567890';
11458        return this.each(function () {
11459            $(this).alphanumeric($.extend({ nchars: nm }, p));
11460        });
11461    };
11462})(jQuery);
11463/* End */
11464;
11465; /* Start:"a:4:{s:4:"full";s:61:"/local/templates/aspro_max/js/jquery.cookie.js?16660175933066";s:6:"source";s:46:"/local/templates/aspro_max/js/jquery.cookie.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
11466/*!
11467 * jQuery Cookie Plugin v1.4.0
11468 * https://github.com/carhartl/jquery-cookie
11469 *
11470 * Copyright 2013 Klaus Hartl
11471 * Released under the MIT license
11472 */
11473(function (factory) {
11474	if (typeof define === 'function' && define.amd) {
11475		// AMD. Register as anonymous module.
11476		define(['jquery'], factory);
11477	} else {
11478		// Browser globals.
11479		factory(jQuery);
11480	}
11481}(function ($) {
11482
11483	var pluses = /\+/g;
11484
11485	function encode(s) {
11486		return config.raw ? s : encodeURIComponent(s);
11487	}
11488
11489	function decode(s) {
11490		return config.raw ? s : decodeURIComponent(s);
11491	}
11492
11493	function stringifyCookieValue(value) {
11494		return encode(config.json ? JSON.stringify(value) : String(value));
11495	}
11496
11497	function parseCookieValue(s) {
11498		if (s.indexOf('"') === 0) {
11499			// This is a quoted cookie as according to RFC2068, unescape...
11500			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
11501		}
11502
11503		try {
11504			// Replace server-side written pluses with spaces.
11505			// If we can't decode the cookie, ignore it, it's unusable.
11506			// If we can't parse the cookie, ignore it, it's unusable.
11507			s = decodeURIComponent(s.replace(pluses, ' '));
11508			return config.json ? JSON.parse(s) : s;
11509		} catch(e) {}
11510	}
11511
11512	function read(s, converter) {
11513		var value = config.raw ? s : parseCookieValue(s);
11514		return $.isFunction(converter) ? converter(value) : value;
11515	}
11516
11517	var config = $.cookie = function (key, value, options) {
11518
11519		// Write
11520
11521		if (value !== undefined && !$.isFunction(value)) {
11522			options = $.extend({}, config.defaults, options);
11523
11524			if (typeof options.expires === 'number') {
11525				var days = options.expires, t = options.expires = new Date();
11526				t.setTime(+t + days * 864e+5);
11527			}
11528
11529			return (document.cookie = [
11530				encode(key), '=', stringifyCookieValue(value),
11531				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
11532				options.path    ? '; path=' + options.path : '',
11533				options.domain  ? '; domain=' + options.domain : '',
11534				options.secure  ? '; secure' : ''
11535			].join(''));
11536		}
11537
11538		// Read
11539
11540		var result = key ? undefined : {};
11541
11542		// To prevent the for loop in the first place assign an empty array
11543		// in case there are no cookies at all. Also prevents odd result when
11544		// calling $.cookie().
11545		var cookies = document.cookie ? document.cookie.split('; ') : [];
11546
11547		for (var i = 0, l = cookies.length; i < l; i++) {
11548			var parts = cookies[i].split('=');
11549			var name = decode(parts.shift());
11550			var cookie = parts.join('=');
11551
11552			if (key && key === name) {
11553				// If second argument (value) is a function it's a converter...
11554				result = read(cookie, value);
11555				break;
11556			}
11557
11558			// Prevent storing a cookie that we couldn't decode.
11559			if (!key && (cookie = read(cookie)) !== undefined) {
11560				result[name] = cookie;
11561			}
11562		}
11563
11564		return result;
11565	};
11566
11567	config.defaults = {};
11568
11569	$.removeCookie = function (key, options) {
11570		if ($.cookie(key) === undefined) {
11571			return false;
11572		}
11573
11574		// Must not alter options, thus extending a fresh object...
11575		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
11576		return !$.cookie(key);
11577	};
11578
11579}));
11580
11581/* End */
11582;
11583; /* Start:"a:4:{s:4:"full";s:55:"/local/templates/aspro_max/js/mobile.js?169745415728345";s:6:"source";s:39:"/local/templates/aspro_max/js/mobile.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
11584$(document).ready(function () {
11585  /*  --- Bind mobile menu  --- */
11586  var $mobileMenu = $("#mobilemenu");
11587  if ($mobileMenu.length) {
11588    $mobileMenu.isLeftSide = $mobileMenu.hasClass("leftside");
11589    $mobileMenu.isOpen = $mobileMenu.hasClass("show");
11590    $mobileMenu.isDowndrop = $mobileMenu.find(">.scroller").hasClass("downdrop");
11591    $mobileMenuNlo = $mobileMenu.find("[data-nlo]");
11592
11593    $("#mobileheader .burger").click(function () {
11594      SwipeMobileMenu();
11595
11596      // Closing hint list of items after the burger icon clicked
11597      if (typeof jsControlMobile === "object" && jsControlMobile && "onFocusLost" in jsControlMobile) {
11598        jsControlMobile.onFocusLost();
11599      }
11600    });
11601
11602    if ($mobileMenu.isLeftSide) {
11603      $mobileMenu.parent().append('<div id="mobilemenu-overlay"></div>');
11604      var $mobileMenuOverlay = $("#mobilemenu-overlay");
11605
11606      $mobileMenuOverlay.click(function () {
11607        if ($mobileMenu.isOpen) {
11608          CloseMobileMenu();
11609          $mobileMenu.find('.expanded').removeClass("expanded");
11610        }
11611      });
11612
11613      $(document).on('swiperight', function (e) {
11614        if (
11615          !$(e.target).closest(".flexslider").length &&
11616          !$(e.target).closest(".swipeignore").length &&
11617          !$(e.target).closest(".jqmWindow.popup").length
11618        ) {
11619          var partWindowWidth = document.documentElement.clientWidth / 3;
11620          var swipeStart = e.swipestart.coords[0];
11621          if (swipeStart <= partWindowWidth) {
11622            OpenMobileMenu();
11623          }
11624        }
11625      });
11626
11627      $(document).on('swipeleft', function (e) {
11628        if (
11629          !$(e.target).closest(".flexslider").length &&
11630          !$(e.target).closest(".swipeignore").length &&
11631          !$(e.target).closest(".jqmWindow.popup").length
11632        ) {
11633          CloseMobileMenu();
11634        }
11635      });
11636    } else {
11637      $(document).on("click", "#mobileheader", function (e) {
11638        if (
11639          !$(e.target).closest("#mobilemenu").length &&
11640          !$(e.target).closest(".burger").length &&
11641          $mobileMenu.isOpen
11642        ) {
11643          CloseMobileMenu();
11644        }
11645      });
11646    }
11647
11648    $(document).on("click", "#mobilemenu .menu a,#mobilemenu .social-icons a", function (e) {
11649      var $this = $(this);
11650      if ($this.hasClass("parent")) {
11651        e.preventDefault();
11652
11653        if (!$mobileMenu.isDowndrop) {
11654          $this.closest("li").addClass("expanded");
11655          MoveMobileMenuWrapNext();
11656        } else {
11657          if (!$this.closest("li").hasClass("expanded")) {
11658            $this.closest("li").addClass("expanded");
11659          } else {
11660            $this.closest("li").removeClass("expanded");
11661          }
11662          initMobileRegions();
11663        }
11664      } else {
11665        if ($this.closest("li").hasClass("counters")) {
11666          var href = $this.attr("href");
11667          if (typeof href !== "undefined") {
11668            if (href !== "javascript:void(0)") {
11669              window.location.href = href;
11670              window.location.reload();
11671            } else {
11672              return
11673            }
11674          }
11675        }
11676
11677        if (!$this.closest(".menu_back").length) {
11678          CloseMobileMenu();
11679        }
11680      }
11681    });
11682
11683    $(document).on("click", "#mobilemenu .dropdown .menu_back", function (e) {
11684      e.preventDefault();
11685      var $this = $(this);
11686      MoveMobileMenuWrapPrev();
11687      setTimeout(function () {
11688        $this.closest(".expanded").removeClass("expanded");
11689      }, 400);
11690    });
11691
11692    $(document).on('click', '#mobilemenu .menu.mobile_regions .menu_autocomplete .clean_icon', function (e) {
11693      $(this).closest('.wrapper').find('input[type=text]').val('').trigger('change');
11694      $(this).hide();
11695    });
11696
11697    $(document).on('keyup change paste', '#mobilemenu .menu.mobile_regions .menu_autocomplete input[type=text]', function (e) {
11698      let $btn = $(this).closest('.wrapper').find('.clean_icon');
11699
11700      if ($(this).val().length) {
11701        $btn.show();
11702      }
11703      else {
11704        $btn.hide();
11705
11706        // hide finded cities
11707        $(this).closest('.dropdown').find('.mobile-cities').show().siblings().hide().empty();
11708      }
11709    });
11710
11711    OpenMobileMenu = function () {
11712      CloseMobilePhone();
11713
11714      if (!$mobileMenu.isOpen) {
11715        // hide styleswitcher
11716        if ($(".style-switcher").hasClass("active")) {
11717          $(".style-switcher .switch").trigger("click");
11718        }
11719        $(".style-switcher .switch").hide();
11720
11721        if ($mobileMenu.isLeftSide) {
11722          // show overlay
11723          setTimeout(function () {
11724            $mobileMenuOverlay.fadeIn("fast");
11725          }, 100);
11726        } else {
11727          // scroll body to top & set fixed
11728          $("body").scrollTop(0).css({ position: "fixed" });
11729
11730          // set menu top = bottom of header
11731          $mobileMenu.css({ top: +($("#mobileheader").height() + $("#mobileheader").offset().top) + "px" });
11732
11733          // change burger icon
11734          $("#mobileheader .burger").addClass("c");
11735        }
11736
11737        // show menu
11738        $mobileMenu.addClass("show");
11739        $mobileMenu.isOpen = true;
11740
11741        if (!$mobileMenu.isDowndrop) {
11742          var $wrap = $mobileMenu.find(".wrap").first();
11743          var params = $wrap.data("params");
11744          if (typeof params === "undefined") {
11745            params = {
11746              depth: 0,
11747              scroll: {},
11748              height: {},
11749            };
11750          }
11751          $wrap.data("params", params);
11752        }
11753
11754        if ($mobileMenuNlo.length) {
11755          if (!$mobileMenuNlo.hasClass("nlo-loadings")) {
11756            $mobileMenuNlo.addClass("nlo-loadings");
11757            setTimeout(function () {
11758              $.ajax({
11759                data: { nlo: $mobileMenuNlo.attr("data-nlo") },
11760                success: function (response) {
11761                  $mobileMenuNlo[0].insertAdjacentHTML("beforebegin", $.trim(response));
11762                  $mobileMenuNlo.remove();
11763                },
11764                error: function () {
11765                  $mobileMenuNlo.removeClass("nlo-loadings");
11766                },
11767              });
11768            }, 300);
11769          }
11770        }
11771      }
11772    };
11773
11774    CloseMobileMenu = function () {
11775      if ($mobileMenu.isOpen) {
11776        // hide menu
11777        $mobileMenu.removeClass("show");
11778        $mobileMenu.isOpen = false;
11779
11780        // show styleswitcher
11781        $(".style-switcher .switch").show();
11782
11783        if ($mobileMenu.isLeftSide) {
11784          // hide overlay
11785          setTimeout(function () {
11786            $mobileMenuOverlay.fadeOut("fast");
11787          }, 100);
11788        } else {
11789          // change burger icon
11790          $("#mobileheader .burger").removeClass("c");
11791
11792          // body unset fixed
11793          $("body").css({ position: "" });
11794        }
11795
11796        if (!$mobileMenu.isDowndrop) {
11797          setTimeout(function () {
11798            var $scroller = $mobileMenu.find(".scroller").first();
11799            var $wrap = $mobileMenu.find(".wrap").first();
11800            var params = $wrap.data("params");
11801            params.depth = 0;
11802            $wrap.data("params", params).attr("style", "");
11803            $mobileMenu.scrollTop(0);
11804            $scroller.css("height", "");
11805          }, 400);
11806        }
11807      }
11808    };
11809
11810    SwipeMobileMenu = function () {
11811      if ($mobileMenu.isOpen) {
11812        CloseMobileMenu();
11813      } else {
11814        OpenMobileMenu();
11815      }
11816    };
11817
11818    function MoveMobileMenuWrapNext() {
11819      if (!$mobileMenu.isDowndrop) {
11820        var $scroller = $mobileMenu.find(".scroller").first();
11821        var $wrap = $mobileMenu.find(".wrap").first();
11822        if ($wrap.length) {
11823          var params = $wrap.data("params");
11824          var $dropdownNext = $mobileMenu.find(".expanded>.dropdown").eq(params.depth);
11825          if ($dropdownNext.length) {
11826
11827            var bMobileRegions = $dropdownNext.closest('.mobile_regions').length;
11828            if (bMobileRegions) {
11829              var $fixedCities = $dropdownNext.find('.menu-item-fixed');
11830            }
11831
11832            // save scroll position
11833            params.scroll[params.depth] = parseInt($mobileMenu.scrollTop());
11834
11835            // height while move animating
11836            params.height[params.depth + 1] = Math.max(
11837              $dropdownNext.height(),
11838              !params.depth
11839                ? $wrap.height()
11840                : $mobileMenu
11841                    .find(".expanded>.dropdown")
11842                    .eq(params.depth - 1)
11843                    .height()
11844            );
11845            $scroller.css("height", params.height[params.depth + 1] + "px");
11846
11847            // inc depth
11848            ++params.depth;
11849
11850            // translateX for move
11851            $wrap.css("transform", "translateX(" + -100 * params.depth + "%)");
11852
11853            // scroll to top
11854            setTimeout(function () {
11855              $mobileMenu.animate({ scrollTop: 0 }, 200);
11856            }, 100);
11857
11858            if (bMobileRegions) {
11859              $fixedCities.css('height', ($mobileMenu.height() - $fixedCities.position().top) + 'px');
11860            }
11861
11862            // height on enimating end
11863            var h = $dropdownNext.height();
11864            setTimeout(function () {
11865              if (h) {
11866                $scroller.css("height", h + "px");
11867              } else {
11868                $scroller.css("height", "");
11869              }
11870              if (bMobileRegions) {
11871                setTimeout(function () {
11872                  // show cities scroll
11873                  $fixedCities.css('overflow', '');
11874                }, 200);
11875
11876                initMobileRegions();
11877              }
11878            }, 200);
11879          }
11880
11881          $wrap.data("params", params);
11882        }
11883      }
11884    }
11885
11886    function MoveMobileMenuWrapPrev() {
11887      if (!$mobileMenu.isDowndrop) {
11888        var $scroller = $mobileMenu.find(".scroller").first();
11889        var $wrap = $mobileMenu.find(".wrap").first();
11890        if ($wrap.length) {
11891          var params = $wrap.data("params");
11892          if (params.depth > 0) {
11893            var $dropdown = $mobileMenu.find(".expanded>.dropdown").eq(params.depth - 1);
11894            if ($dropdown.length) {
11895              // height while move animating
11896              $scroller.css("height", params.height[params.depth] + "px");
11897
11898              // dec depth
11899              --params.depth;
11900
11901              // translateX for move
11902              $wrap.css("transform", "translateX(" + -100 * params.depth + "%)");
11903
11904              // restore scroll position
11905              setTimeout(function () {
11906                $mobileMenu.animate({ scrollTop: params.scroll[params.depth] }, 200);
11907              }, 100);
11908
11909              if ($dropdown.closest('.mobile_regions').length) {
11910                // hide cities scroll
11911                $dropdown.find('.menu-item-fixed').css('overflow', 'hidden');
11912
11913                // scroll cities to top
11914                setTimeout(function () {
11915                  $dropdown.find('.menu-item-fixed').animate({ scrollTop: 0 }, 200);
11916                }, 100);
11917              }
11918
11919              // height on enimating end
11920              var h = !params.depth
11921                ? false
11922                : $mobileMenu
11923                    .find(".expanded>.dropdown")
11924                    .eq(params.depth - 1)
11925                    .height();
11926              setTimeout(function () {
11927                if (h) {
11928                  $scroller.css("height", h + "px");
11929                } else {
11930                  $scroller.css("height", "");
11931                }
11932              }, 200);
11933            }
11934          }
11935
11936          $wrap.data("params", params);
11937        }
11938      }
11939    }
11940    function initMobileRegions() {
11941      if (!initMobileRegions.inited) {
11942        initMobileRegions.inited = true;
11943
11944        if ($('.mobile_regions .dropdown .loadings').length) {
11945          getMainCities();
11946        }
11947
11948        BX.loadScript(arAsproOptions.SITE_TEMPLATE_PATH + '/js/jquery-ui.min.js', autocompleteMobileRegionsHandler);
11949      }
11950    }
11951
11952    initMobileRegions.inited = false;
11953
11954    function autocompleteMobileRegionsHandler(){
11955      $("#mobile-region-search").autocomplete({
11956        minLength: 2,
11957        appendTo : $('.mobile_regions .dropdown .mobile-cities').closest('.menu-item-fixed'),
11958        source: function(request, callback){
11959          let componentAction = 'searchCities';
11960          let componentName = 'aspro:regionality.list.max';
11961          let sessid = BX.message('bitrix_sessid');
11962          let lang = BX.message('LANGUAGE_ID');
11963          let siteId = BX.message('SITE_ID');
11964          let url = location.pathname + location.search;
11965
11966          BX.ajax({
11967            url: '/bitrix/services/main/ajax.php?mode=ajax&c=' + encodeURIComponent(componentName) +'&action=' + componentAction + '&sessid=' + sessid + '&SITE_ID=' + siteId + '&siteId=' + siteId + '&url=' + encodeURIComponent(url) + '&term=' + encodeURIComponent(request.term) + '&lang=' + lang,
11968            method: 'POST',
11969            async: true,
11970            processData: true,
11971            scriptsRunFirst: true,
11972            emulateOnload: true,
11973            start: true,
11974            cache: false,
11975            dataType: 'json',
11976            onsuccess: function(response){
11977              if (
11978                  typeof response === 'object' &&
11979                  response &&
11980                  typeof response.data === 'object' &&
11981                  response.data
11982              ) {
11983                if (Object.values(response.data.cities).length) {
11984                  callback(response.data.cities);
11985                }
11986                else {
11987                  $('.mobile_regions .dropdown .mobile-cities').hide().siblings().empty().show();
11988                }
11989              }
11990            },
11991            onfailure: function(){
11992            }
11993          });
11994        },
11995        select: function(event, ui) {
11996          let regionId = ui.item.ID;
11997          if (regionId) {
11998            $.cookie('current_region', regionId, {
11999              path: '/',
12000              domain: arAsproOptions['SITE_ADDRESS'],
12001            });
12002
12003            let locationId = ui.item.LOCATION_ID;
12004            if (locationId) {
12005              $.cookie('current_location', locationId, {
12006                path: '/',
12007                domain: arAsproOptions['SITE_ADDRESS'],
12008              });
12009            }
12010            else {
12011              $.cookie('current_location', '', {
12012                expires: -1,
12013                path: '/',
12014                domain: arAsproOptions['SITE_ADDRESS'],
12015              });
12016            }
12017          }
12018
12019          $('#mobile-region-search').val(ui.item.label);
12020
12021          return false;
12022        },
12023        open: function(event, ui) {
12024          $('.mobile_regions .dropdown .mobile-cities').hide().siblings().show();
12025        },
12026        close: function(event, ui) {
12027          // do not hide finded citties! Hide it only on empty phrase!
12028          $('.mobile_regions .dropdown .mobile-cities').siblings().show();
12029        }
12030      }).data('ui-autocomplete')._renderItem = function(ul, item){
12031        let html = `
12032          <li class="mobile-city">
12033            <a href="` + item.URL + `" data-id="` + item.ID + `" data-locid="` + (item.LOCATION_ID ? item.LOCATION_ID : '') + `" class="dark-color"><span>` + item.NAME + `</span>` + (item.PATH ? '<div class="muted">' + item.PATH + '</div>' : '') + `</a>
12034          </li>
12035        `;
12036
12037        return $(html).appendTo(ul);
12038      }
12039    }
12040
12041    function getMainCities() {
12042      let componentAction = 'getMainCities';
12043      let componentName = 'aspro:regionality.list.max';
12044      let sessid = BX.message('bitrix_sessid');
12045      let lang = BX.message('LANGUAGE_ID');
12046      let siteId = BX.message('SITE_ID');
12047      let url = location.pathname + location.search;
12048      let lastId = getMainCities.lastId;
12049      let $loadings = $('.mobile_regions .dropdown .loadings').closest('li');
12050
12051      BX.ajax({
12052        url: '/bitrix/services/main/ajax.php?mode=ajax&c=' + encodeURIComponent(componentName) +'&action=' + componentAction + '&sessid=' + sessid + '&SITE_ID=' + siteId + '&siteId=' + siteId + '&url=' + encodeURIComponent(url) + '&lastId=' + lastId + '&lang=' + lang,
12053        method: 'POST',
12054        async: true,
12055        processData: true,
12056        scriptsRunFirst: true,
12057        emulateOnload: true,
12058        start: true,
12059        cache: false,
12060        dataType: 'json',
12061        onsuccess: function(response){
12062          if (
12063              typeof response === 'object' &&
12064              response &&
12065              typeof response.data === 'object' &&
12066              response.data
12067          ) {
12068            if (typeof response.data.lastId !== 'undefined') {
12069              getMainCities.lastId = response.data.lastId;
12070            }
12071
12072            if (
12073                response.data.cities &&
12074                Object.values(response.data.cities).length
12075            ) {
12076              let itemsHtml = '';
12077
12078              for (let i in response.data.cities) {
12079                let item = response.data.cities[i];
12080                let bCurrent = item.CURRENT == 1;
12081
12082                itemsHtml += `
12083									<li class="mobile-city main-city` + (bCurrent ? ' selected' : '') + `">
12084										<a href="` + item.URL + `" data-id="` + item.ID + `" data-locid="` + (item.LOCATION_ID ? item.LOCATION_ID : '') + `" class="dark-color"><span>` + item.NAME + `</span>` + (item.PATH ? '<div class="muted">' + item.PATH + '</div>' : '') + `</a>
12085									</li>
12086								`;
12087              }
12088
12089              $(itemsHtml).insertBefore($loadings);
12090
12091              if (response.data.more) {
12092                getMainCities.observer.observe($loadings[0]);
12093              }
12094              else {
12095                $loadings.remove();
12096              }
12097            }
12098          }
12099        },
12100        onfailure: function(){
12101          $loadings.remove();
12102        }
12103      });
12104    }
12105
12106    getMainCities.lastId = 0;
12107    getMainCities.observer = new IntersectionObserver((entries, observer) => {
12108      entries.forEach(entry => {
12109        if (entry.isIntersecting) {
12110          getMainCities.observer.unobserve(entry.target);
12111          getMainCities();
12112        }
12113      })
12114    }, {
12115      root: null,
12116      rootMargin: '0px',
12117      threshold: 0.5,
12118    });
12119  }
12120  /*  --- END Bind mobile menu  --- */
12121
12122  /*  --- Bind mobile phone  --- */
12123  var $mobileHeader = $("#mobileheader");
12124  var $simpleHeader = $("body.simple_basket_mode #header");
12125  var $mobilePhone = $("#mobilePhone");
12126  $mobilePhone.isOpen = false;
12127  if ($mobilePhone.length) {
12128    $mobilePhone.isOpen = $mobilePhone.hasClass("show");
12129
12130    $(document).on("click", ".wrap_phones .svg-inline-phone", function (e) {
12131      SwipeMobilePhone();
12132      e.stopPropagation();
12133    });
12134
12135    $(document).on("click", ".wrap_phones .svg-inline-close", function (e) {
12136      CloseMobilePhone();
12137      e.stopPropagation();
12138    });
12139  }
12140
12141  SwipeMobilePhone = function () {
12142    if ($mobilePhone.isOpen) {
12143      CloseMobilePhone();
12144    } else {
12145      OpenMobilePhone();
12146    }
12147  };
12148
12149  OpenMobilePhone = function () {
12150    if (!$mobilePhone.isOpen) {
12151      CloseMobileMenu();
12152
12153      // show overlay
12154      var isSimple = Boolean($simpleHeader.length);
12155      var positionOffset = isSimple
12156        ? $simpleHeader[0].getBoundingClientRect()
12157        : $mobileHeader[0].getBoundingClientRect();
12158      var position = positionOffset.top + positionOffset.height + pageYOffset;
12159
12160      $('<div class="jqmOverlay mobp" style="top:' + position + 'px;position:absolute"></div>').appendTo("body");
12161
12162      // toggle phones
12163      setTimeout(function () {
12164        $mobilePhone.slideDown("fast", function () {
12165          $mobilePhone.addClass("show");
12166          $mobilePhone.isOpen = true;
12167        });
12168      }, 100);
12169    }
12170  };
12171
12172  CloseMobilePhone = function () {
12173    if ($mobilePhone.isOpen) {
12174      // toggle phones
12175      setTimeout(function () {
12176        $mobilePhone.slideUp("fast", function () {
12177          $mobilePhone.removeClass("show");
12178          $mobilePhone.isOpen = false;
12179
12180          // hide overlay
12181          $(".jqmOverlay.mobp").remove();
12182        });
12183      }, 100);
12184    }
12185  };
12186
12187  checkMobilePhone = function () {
12188    if (!window.matchMedia("(max-width: 991px)").matches) {
12189      CloseMobilePhone();
12190    }
12191  };
12192  $(document).on("click", "body.simple_basket_mode .back-mobile-arrow .arrow-back", function () {
12193    if (document.referrer && document.referrer != location.href) {
12194      window.history.back();
12195    } else {
12196      location.href = "/";
12197    }
12198  });
12199  /*  --- END Bind mobile phone  --- */
12200
12201  /*  --- Bind mobile filter  --- */
12202  var $mobilefilter = $("#mobilefilter");
12203  if ($mobilefilter.length) {
12204    $mobilefilter.isOpen = $mobileMenu.hasClass("show");
12205    $mobilefilter.isAppendLeft = false;
12206    $mobilefilter.isWrapFilter = false;
12207    $mobilefilter.isHorizontalOrCompact = $(".filter_horizontal").length || $(".bx_filter_vertical.compact").length;
12208    $mobilefilter.close = '<i class="svg svg-close close-icons"></i>';
12209
12210    $(document).on("click", ".bx-filter-title", function () {
12211      OpenMobileFilter();
12212    });
12213
12214    $(document).on("click", "#mobilefilter .svg-close.close-icons", function () {
12215      CloseMobileFilter();
12216    });
12217
12218    $(document).on("click", ".bx_filter_select_block", function (e) {
12219      var bx_filter_select_container = $(e.target).parents(".bx_filter_select_container");
12220      if (bx_filter_select_container.length) {
12221        var prop_id = bx_filter_select_container.closest(".bx_filter_parameters_box").attr("data-property_id");
12222        if ($("#smartFilterDropDown" + prop_id).length) {
12223          $("#smartFilterDropDown" + prop_id).css({
12224            "max-width": bx_filter_select_container.width(),
12225            "z-index": "3020",
12226          });
12227        }
12228      }
12229    });
12230
12231    $(document).on("mouseup", ".bx_filter_section", function (e) {
12232      if ($(e.target).hasClass("bx_filter_search_button")) {
12233        CloseMobileFilter();
12234      }
12235    });
12236
12237    $(document).on("mouseup", ".bx_filter_parameters_box_title", function (e) {
12238      $("[id^='smartFilterDropDown']").hide();
12239      if ($(e.target).hasClass("close-icons")) {
12240        CloseMobileFilter();
12241      }
12242    });
12243
12244    /*$(document).on('DOMSubtreeModified', "#mobilefilter #modef_num_mobile", function() {
12245                mobileFilterNum($(this));
12246            });
12247
12248            $(document).on('DOMSubtreeModified', "#mobilefilter .bx_filter_container_modef", function() {
12249                mobileFilterNum($(this));
12250            });*/
12251
12252    $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>');
12253    var $mobilefilterOverlay = $("#mobilefilter-overlay");
12254
12255    $mobilefilterOverlay.click(function () {
12256      if ($mobilefilter.isOpen) {
12257        CloseMobileFilter();
12258        //e.stopPropagation();
12259      }
12260    });
12261
12262    mobileFilterNum = function (num, def) {
12263      if (def) {
12264        $(".bx_filter_search_button").text(num.data("f"));
12265      } else {
12266        var str = "";
12267        var $prosLeng = $(".bx_filter_parameters_box > span");
12268
12269        str +=
12270          $prosLeng.data("f") +
12271          " " +
12272          num +
12273          " " +
12274          declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm")]);
12275        $(".bx_filter_search_button").text(str);
12276      }
12277    };
12278
12279    declOfNumFilter = function (number, titles) {
12280      cases = [2, 0, 1, 1, 1, 2];
12281      return titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[number % 10 < 5 ? number % 10 : 5]];
12282    };
12283
12284    OpenMobileFilter = function () {
12285      if (!$mobilefilter.isOpen) {
12286        $("body").addClass("jqm-initied wf");
12287
12288        $(".bx_filter_vertical .slide-block__head.filter_title").removeClass("closed");
12289
12290        $(".bx_filter_vertical .slide-block__head.filter_title + .slide-block__body").show();
12291
12292        if (!$mobilefilter.isAppendLeft) {
12293          if (!$mobilefilter.isWrapFilter) {
12294            $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>");
12295            $mobilefilter.isWrapFilter = true;
12296          }
12297          $(".bx_filter").appendTo($("#mobilefilter"));
12298          var helper = $("#filter-helper");
12299          if (helper.length) {
12300            helper.prependTo($("#mobilefilter .bx_filter_parameters"));
12301          }
12302          $mobilefilter.isAppendLeft = true;
12303        }
12304        if (typeof checkFilterLandgings === "function") {
12305          checkFilterLandgings();
12306        }
12307
12308        $("#mobilefilter .bx_filter_parameters").addClass("scrollbar");
12309        $("#mobilefilter .slide-block .filter_title").addClass("ignore");
12310        $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass(
12311          "colored_theme_hover_bg-block"
12312        );
12313
12314        /*if (window.matchMedia('(max-width: 767px)').matches) {
12315                        $('#mobilefilter .bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
12316                        if($('#mobilefilter .bx_filter .mobile-scroll.scrollbar').length)
12317                            $('#mobilefilter .bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
12318                        if($('#mobilefilter .bx_filter .mobile-scroll.srollbar-custom').length)
12319                            $('#mobilefilter .bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
12320                    }*/
12321
12322        $(".bx_filter_button_box.ajax-btns").addClass("colored_theme_bg");
12323        $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass("hidden");
12324        InitCustomScrollBar();
12325
12326        // show overlay
12327        setTimeout(function () {
12328          $mobilefilterOverlay.fadeIn("fast");
12329        }, 100);
12330
12331        // fix body
12332        $("body").css({ overflow: "hidden", height: "100vh" });
12333
12334        // show mobile filter
12335        $mobilefilter.addClass("show");
12336        $mobilefilter.find(".bx_filter").css({ display: "block" });
12337        $mobilefilter.isOpen = true;
12338
12339        $("#mobilefilter .bx_filter_button_box.btns.ajax-btns").removeClass("hidden");
12340
12341        var init = $mobilefilter.data("init");
12342        if (typeof init === "undefined") {
12343          $mobilefilter.scroll(function () {
12344            $(".bx_filter_section .bx_filter_select_container").each(function () {
12345              var prop_id = $(this).closest(".bx_filter_parameters_box").attr("data-property_id");
12346              if ($("#smartFilterDropDown" + prop_id).length) {
12347                $("#smartFilterDropDown" + prop_id).hide();
12348              }
12349            });
12350          });
12351
12352          $mobilefilter.data("init", "Y");
12353        }
12354      }
12355    };
12356
12357    CloseMobileFilter = function (append) {
12358      $mobilefilter.find(".bx_filter_parameters").removeClass("scrollbar");
12359
12360      if ($("#mobilefilter .bx_filter_parameters").length) $("body").removeClass("jqm-initied wf");
12361
12362      $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").removeClass(
12363        "colored_theme_hover_bg-block"
12364      );
12365      $(".slide-block .filter_title").removeClass("ignore");
12366      $(".bx_filter_button_box.ajax-btns").removeClass("colored_theme_bg");
12367
12368      $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass("hidden");
12369
12370      if ($mobilefilter.isOpen) {
12371        // scroll to top
12372        $mobilefilter.find(".bx_filter_parameters").scrollTop(0);
12373
12374        // unfix body
12375        $("body").css({ overflow: "", height: "" });
12376
12377        // hide overlay
12378        setTimeout(function () {
12379          $mobilefilterOverlay.fadeOut("fast");
12380        }, 100);
12381
12382        // hide mobile filter
12383        $mobilefilter.removeClass("show");
12384        $mobilefilter.isOpen = false;
12385      }
12386
12387      if (append && $mobilefilter.isAppendLeft) {
12388        $(".bx_filter").appendTo($("#wrapInlineFilter")).show();
12389        var helper = $("#filter-helper");
12390        if (helper.length) {
12391          helper.appendTo($("#filter-helper-wrapper"));
12392        }
12393        $mobilefilter.isAppendLeft = false;
12394        $mobilefilter.removeData("init");
12395        mobileFilterNum($("#modef_num_mobile"), true);
12396      }
12397    };
12398
12399    checkMobileFilter = function () {
12400      if (
12401        (!window.matchMedia("(max-width: 991px)").matches && !$mobilefilter.isHorizontalOrCompact) ||
12402        (!window.matchMedia("(max-width: 767px)").matches && $mobilefilter.isHorizontalOrCompact)
12403      ) {
12404        CloseMobileFilter(true);
12405      }
12406    };
12407  } else {
12408    checkTopFilter();
12409    $(document).on("click", ".bx-filter-title", function () {
12410      $(this).toggleClass("opened");
12411      if ($(".visible_mobile_filter").length) {
12412        $(".visible_mobile_filter").show();
12413        $(".bx_filter_vertical, .bx_filter").slideToggle(333);
12414      } else {
12415        $(".bx_filter_vertical").closest("div[id^=bx_incl]").show();
12416        $(".bx_filter_vertical, .bx_filter").slideToggle(333);
12417      }
12418    });
12419  }
12420  /*  --- END Bind mobile filter  --- */
12421});
12422
12423/* End */
12424;
12425; /* Start:"a:4:{s:4:"full";s:54:"/local/templates/aspro_max/js/main.js?1790072018399787";s:6:"source";s:37:"/local/templates/aspro_max/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12426var basketTimeoutSlide;
12427var resizeEventTimer;
12428
12429var clicked_tab = 0;
12430
12431if (typeof arAsproOptions === "undefined") {
12432  var arAsproOptions = {
12433    SITE_DIR: "/",
12434  };
12435  if ($("body").data("site") !== undefined) arAsproOptions["SITE_DIR"] = $("body").data("site");
12436}
12437
12438function readyDOM(callback) {
12439  if (document.readyState !== "loading") callback();
12440  else document.addEventListener("DOMContentLoaded", callback);
12441}
12442
12443var typeofExt = function (item) {
12444  const _toString = Object.prototype.toString;
12445  return _toString.call(item).slice(8, -1).toLowerCase();
12446};
12447
12448var InitLazyLoad = function () { };
12449
12450$(document).on("change", ".uploader input[type=file]", function () {
12451  if (!$(this).next().length || !$(this).next().hasClass("resetfile")) {
12452    $(
12453      '<span class="resetfile"><svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewB
12453ox="0 0 11 11"><path d="M1345.19,376.484l4.66,4.659a0.492,0.492,0,0,1,0,.707,0.5,0.5,0,0,1-.71,0l-4.66-4.659-4.65,4.659a0.5,0.5,0,0,1-.71,0,0.492,0.492,0,0,1,0-.707l4.66-4.659-4.66-4.659a0.492,0.492,0,0,1,0-.707,0.5,0.5,0,0,1,.71,0l4.65,4.659,4.66-4.659a0.5,0.5,0,0,1,.71,0,0.492,0.492,0,0,1,0,.707Z" transform="translate(-1339 -371)"/></svg></span>'
12454    ).insertAfter($(this));
12455  }
12456});
12457
12458$(document).on("click", ".uploader.files_add input[type=file] + .resetfile", function () {
12459  var $input = $(this).prev();
12460  $input.val("");
12461  $.uniform.update($input);
12462  $(this).remove();
12463});
12464
12465$(document).on("click", ".top_block h3", function () {
12466  if (window.matchMedia("(max-width: 550px)").matches) {
12467    var $this = $(this);
12468    var a = $this.siblings("a");
12469    if (a.length) {
12470      a[0].click();
12471    }
12472  }
12473});
12474
12475$(document).on("click", ".bx-yandex-view-layout .yandex-map__mobile-opener", function () {
12476  if ($(this).hasClass("closer")) {
12477    closeYandexMap();
12478  } else {
12479    openYandexMap(this);
12480  }
12481});
12482
12483function openYandexMap(element) {
12484  var $this = $(element);
12485  if ($this.hasClass("closer")) return;
12486  var currentMap = $this.parents(".bx-yandex-view-layout");
12487  var mapId = currentMap.find(".bx-yandex-map").attr("id");
12488  window.openedYandexMapFrame = mapId;
12489  var mapContainer = $('<div data-mapId="' + mapId + '"></div>');
12490  if (!$("div[data-mapId=" + mapId + "]").length) {
12491    currentMap.after(mapContainer);
12492  }
12493  var yandexMapFrame = $('<div class="yandex-map__frame"></div>');
12494  $("body .wrapper1").append(yandexMapFrame);
12495  currentMap.appendTo(yandexMapFrame);
12496  currentMap.find(".yandex-map__mobile-opener").addClass("closer");
12497  window.map.container.fitToViewport();
12498}
12499
12500function closeYandexMap() {
12501  var yandexMapFrame = $(".yandex-map__frame");
12502  if (yandexMapFrame.length) {
12503    var currentMap = yandexMapFrame.find(".bx-yandex-view-layout");
12504    var yandexMapContainer = $("div[data-mapId=" + window.openedYandexMapFrame + "]");
12505
12506    currentMap.appendTo(yandexMapContainer);
12507    yandexMapFrame.remove();
12508    currentMap.find(".yandex-map__mobile-opener").removeClass("closer");
12509    if (window.map) {
12510      window.map.container.fitToViewport();
12511    }
12512  }
12513}
12514
12515function throttle(f, t) {
12516  let throttled, saveThis, saveArgs;
12517  const wrapper = function () {
12518    if (throttled) {
12519      saveThis = this;
12520      saveArgs = arguments;
12521      return;
12522    }
12523    throttled = true;
12524    f.apply(this, arguments);
12525    setTimeout(function () {
12526      throttled = false;
12527      if (saveArgs) {
12528        wrapper.apply(saveThis, saveArgs);
12529        saveThis = saveArgs = null;
12530      }
12531    }, t);
12532  };
12533  return wrapper;
12534}
12535
12536function debounce(f, t) {
12537  return function (args) {
12538    var previousCall = this.lastCall;
12539    this.lastCall = Date.now();
12540    if (previousCall && this.lastCall - previousCall <= t) {
12541      clearTimeout(this.lastCallTimer);
12542    }
12543    this.lastCallTimer = setTimeout(function () {
12544      f(args);
12545    }, t);
12546  };
12547}
12548
12549$(document).on("click", ".flex-control-nav.flex-control-js-click li a:not(.flex-active)", function (e) {
12550  var _this = $(this);
12551  var itemIndex = _this.data("index") ? _this.data("index") : _this.closest("li").index();
12552
12553  var block = "";
12554  var blocks = _this.closest(".items").find("> .item");
12555  var activeBlock = _this.closest(".items").find(".item.active");
12556
12557  var activeLi = _this.closest(".flex-control-nav").find(".flex-active");
12558
12559  activeBlock.fadeOut(function () {
12560    activeBlock.removeClass("active");
12561
12562    block = blocks.eq(itemIndex);
12563    if (block.length) {
12564      block.fadeIn(function () {
12565        block.addClass("active");
12566      });
12567    }
12568
12569    _this.addClass("flex-active");
12570    activeLi.removeClass("flex-active");
12571  });
12572
12573  e.preventDefault();
12574});
12575
12576$(document).on("mouseenter", "#headerfixed .menu-item.wide_menu", function () {
12577  var _this = $(this);
12578  setTimeout(function () {
12579    var dropdownMenu = _this.find(".wrap > .dropdown-menu");
12580    var menuOffset = dropdownMenu[0].getBoundingClientRect();
12581    var headerOffset = document.getElementById("headerfixed").getBoundingClientRect();
12582    var windowHeight = document.documentElement.clientHeight;
12583
12584    if (menuOffset.height + headerOffset.height > windowHeight) {
12585      var maxHeight = windowHeight - headerOffset.height;
12586      dropdownMenu.css({
12587        "max-height": maxHeight,
12588      });
12589      dropdownMenu.find(".menu-navigation").css({ "max-height": maxHeight });
12590      dropdownMenu.find(".customScrollbar").css({ "max-height": maxHeight });
12591      dropdownMenu.find(".menu-wrapper.menu-type-4 > li").css({ "min-height": "auto" });
12592    } else {
12593      dropdownMenu.css({
12594        "max-height": "",
12595      });
12596      dropdownMenu.find(".menu-navigation").css({ "max-height": "" });
12597      dropdownMenu.find(".customScrollbar").css({ "max-height": "" });
12598      dropdownMenu.find(".menu-wrapper.menu-type-4 > li").css({ "min-height": "" });
12599    }
12600  }, 300);
12601});
12602
12603BX.addCustomEvent("onAjaxSuccess", function (data) {
12604  if (typeof data === "object" && data !== null) {
12605    if (
12606      typeof data.BASKET_REFRESHED !== undefined &&
12607      data.BASKET_REFRESHED === true &&
12608      typeof data.BASKET_DATA === "object" &&
12609      data.BASKET_DATA
12610    ) {
12611      var basketCounts = data.BASKET_DATA.BASKET_ITEMS_COUNT;
12612      reloadBasketCounters(basketCounts);
12613    }
12614  }
12615});
12616
12617BX.addCustomEvent("onHeaderProgressBarChange", function (data) {
12618  if (typeof updateProgressBar === "function") {
12619    updateProgressBar();
12620  }
12621});
12622
12623if (!funcDefined("parseUrlQuery")) {
12624  parseUrlQuery = function () {
12625    var data = {};
12626    if (location.search) {
12627      var pair = location.search.substr(1).split("&");
12628      for (var i = 0; i < pair.length; i++) {
12629        var param = pair[i].split("=");
12630        data[param[0]] = param[1];
12631      }
12632    }
12633    return data;
12634  };
12635}
12636
12637if (!funcDefined("setLocationSKU")) {
12638  function setLocationSKU(ID, urlParam) {
12639    if (urlParam === undefined) urlParam = "oid";
12640
12641    var objUrl = parseUrlQuery(),
12642      j = 0,
12643      prefix = "",
12644      query_string = "",
12645      url = "";
12646
12647    objUrl[urlParam] = ID;
12648
12649    for (var i in objUrl) {
12650      if (parseInt(j) > 0) prefix = "&";
12651      query_string = query_string + prefix + i + "=" + objUrl[i];
12652      j++;
12653    }
12654    if (query_string) {
12655      url = location.pathname + "?" + query_string + location.hash;
12656    }
12657    try {
12658      //history.pushState(null, null, url);
12659      history.replaceState(null, null, url);
12660      return;
12661    } catch (e) { }
12662    location.hash = "#" + url.substr(1);
12663  }
12664}
12665
12666if (!funcDefined("ShowOverlay")) {
12667  ShowOverlay = function () {
12668    $('<div class="jqmOverlay waiting"></div>').appendTo("body");
12669  };
12670}
12671
12672if (!funcDefined("HideOverlay")) {
12673  HideOverlay = function () {
12674    $(".jqmOverlay").detach();
12675  };
12676}
12677
12678if (!funcDefined("trimPrice")) {
12679  var trimPrice = function trimPrice(s) {
12680    s = s.split(" ").join("");
12681    s = s.split("&nbsp;").join("");
12682    return s;
12683  };
12684}
12685
12686if (!funcDefined("pauseYmObserver")) {
12687  // pause ya metrika webvisor MutationObserver callback (DOM indexer)
12688  // use before insert html with some animation
12689  pauseYmObserver = function () {
12690    if (
12691      typeof MutationObserver === "function" &&
12692      typeof MutationObserver.observers === "object" &&
12693      typeof MutationObserver.observers.ym === "object"
12694    ) {
12695      if (typeof pauseYmObserver.cnt === "undefined") {
12696        pauseYmObserver.cnt = 0;
12697      }
12698
12699      ++pauseYmObserver.cnt;
12700
12701      if (!MutationObserver.observers.ym.paused) {
12702        MutationObserver.observers.ym.pause();
12703      }
12704    }
12705  };
12706}
12707
12708if (!funcDefined("resumeYmObserver")) {
12709  // resume ya metrika webvisor MutationObserver callback
12710  // use when animation finished
12711  resumeYmObserver = function () {
12712    if (
12713      typeof MutationObserver === "function" &&
12714      typeof MutationObserver.observers === "object" &&
12715      typeof MutationObserver.observers.ym === "object"
12716    ) {
12717      if (typeof pauseYmObserver.cnt === "undefined") {
12718        pauseYmObserver.cnt = 1;
12719      }
12720
12721      pauseYmObserver.cnt -= pauseYmObserver.cnt > 0 ? 1 : 0;
12722
12723      if (!pauseYmObserver.cnt && MutationObserver.observers.ym.paused) {
12724        MutationObserver.observers.ym.resume();
12725      }
12726    }
12727  };
12728}
12729
12730if (!funcDefined("markProductRemoveBasket")) {
12731  var markProductRemoveBasket = function markProductRemoveBasket(id) {
12732    $(".in-cart[data-item=" + id + "]").hide();
12733    $(".to-cart[data-item=" + id + "]").show();
12734    if (
12735      $(".to-cart[data-item=" + id + "]")
12736        .closest(".counter_wrapp")
12737        .find(".counter_block").length
12738    ) {
12739      $(".to-cart[data-item=" + id + "]")
12740        .closest(".button_block")
12741        .removeClass("wide");
12742    }
12743    $(".to-cart[data-item=" + id + "]")
12744      .closest(".counter_wrapp")
12745      .find(".counter_block")
12746      .show();
12747    $(".counter_block[data-item=" + id + "]")
12748      .closest(".counter_block_inner")
12749      .show();
12750    $(".counter_block[data-item=" + id + "]").show();
12751    $(".in-subscribe[data-item=" + id + "]").hide();
12752    $(".to-subscribe[data-item=" + id + "]").show();
12753    //$('.wish_item[data-item='+id+']').removeClass("added");
12754    $(".wish_item[data-item=" + id + "] .value:not(.added)").show();
12755    $(".wish_item[data-item=" + id + "] .value.added").hide();
12756    $(".wish_item.to[data-item=" + id + "]").show();
12757    $(".wish_item.in[data-item=" + id + "]").hide();
12758    $(".banner_buttons.with_actions .wraps_buttons[data-id=" + id + "] .basket_item_add").removeClass("added");
12759    $(".banner_buttons.with_actions .wraps_buttons[data-id=" + id + "] .wish_item_add").removeClass("added");
12760
12761    if ($("#headerfixed .but-cell .type_block").length) {
12762      $("#headerfixed .but-cell .type_block span").text(BX.message("MORE_INFO_SKU"));
12763      $("#headerfixed .but-cell .type_block .svg-inline-fw").remove();
12764    }
12765  };
12766}
12767
12768if (!funcDefined("markProductAddBasket")) {
12769  var markProductAddBasket = function markProductAddBasket(id) {
12770    $(".to-cart[data-item=" + id + "]").hide();
12771    $(".to-cart[data-item=" + id + "]")
12772      .closest(".counter_wrapp")
12773      .find(".counter_block_inner")
12774      .hide();
12775    $(".to-cart[data-item=" + id + "]")
12776      .closest(".counter_wrapp")
12777      .find(".counter_block")
12778      .hide();
12779    $(".to-cart[data-item=" + id + "]")
12780      .closest(".button_block")
12781      .addClass("wide");
12782    $(".in-cart[data-item=" + id + "]").show();
12783    //$('.wish_item[data-item='+id+']').removeClass("added");
12784    $(".wish_item[data-item=" + id + "] .value:not(.added)").show();
12785    $(".wish_item[data-item=" + id + "] .value.added").hide();
12786
12787    $(".wish_item.to[data-item=" + id + "]").show();
12788    $(".wish_item.in[data-item=" + id + "]").hide();
12789    $(".banner_buttons.with_actions .wraps_buttons[data-id=" + id + "] .basket_item_add").addClass("added");
12790
12791    if ($("#headerfixed .but-cell .type_block").length) {
12792      $("#headerfixed .but-cell .type_block").html($(".in-cart[data-item=" + id + "]").html());
12793    }
12794  };
12795}
12796
12797if (!funcDefined("markProductDelay")) {
12798  var markProductDelay = function markProductDelay(id) {
12799    $(".in-cart[data-item=" + id + "]").hide();
12800    $(".to-cart[data-item=" + id + "]").show();
12801    $(".to-cart[data-item=" + id + "]")
12802      .closest(".counter_wrapp")
12803      .find(".counter_block_inner")
12804      .show();
12805    $(".to-cart[data-item=" + id + "]")
12806      .closest(".counter_wrapp")
12807      .find(".counter_block")
12808      .show();
12809    if (
12810      $(".to-cart[data-item=" + id + "]")
12811        .closest(".counter_wrapp")
12812        .find(".counter_block").length
12813    ) {
12814      $(".to-cart[data-item=" + id + "]")
12815        .closest(".button_block")
12816        .removeClass("wide");
12817    }
12818    //$('.wish_item[data-item='+id+']').addClass("added");
12819    $(".wish_item[data-item=" + id + "] .value:not(.added)").hide();
12820    $(".wish_item[data-item=" + id + "] .value.added").css("display", "block");
12821
12822    $(".wish_item.to[data-item=" + id + "]").hide();
12823    $(".wish_item.in[data-item=" + id + "]").show();
12824
12825    $(".banner_buttons.with_actions .wraps_buttons[data-id=" + id + "] .wish_item_add").addClass("added");
12826
12827    if ($("#headerfixed .but-cell .type_block").length) {
12828      $("#headerfixed .but-cell .type_block span").text(BX.message("MORE_INFO_SKU"));
12829      $("#headerfixed .but-cell .type_block .svg-inline-fw").remove();
12830    }
12831  };
12832}
12833
12834if (!funcDefined("markProductSubscribe")) {
12835  var markProductSubscribe = function markProductSubscribe(id) {
12836    $(".to-subscribe[data-item=" + id + "]").hide();
12837    $(".in-subscribe[data-item=" + id + "]").css("display", "block");
12838  };
12839}
12840
12841if (!funcDefined("updateBottomIconsPanel")) {
12842  var updateBottomIconsPanel = function updateBottomIconsPanel(options) {
12843    if (options && $(".bottom-icons-panel").length) {
12844      var bBasketUpdate = "READY" in options || "BASKET_COUNT" in options;
12845      var basketCount = "READY" in options ? options.READY.COUNT : "BASKET_COUNT" in options ? options.BASKET_COUNT : 0;
12846      var basketTitle =
12847        "READY" in options ? options.READY.TITLE : "BASKET_SUMM_TITLE" in options ? options.BASKET_SUMM_TITLE : "";
12848      var bDelayUpdate = "DELAY" in options || "DELAY_COUNT" in options;
12849      var delayCount = "DELAY" in options ? options.DELAY.COUNT : "DELAY_COUNT" in options ? options.DELAY_COUNT : 0;
12850      var delayTitle =
12851        "DELAY" in options ? options.DELAY.TITLE : "DELAY_SUMM_TITLE" in options ? options.DELAY_SUMM_TITLE : "";
12852      var bCompareUpdate = "COMPARE" in options;
12853      var compareCount =
12854        "COMPARE" in options
12855          ? typeof options.COMPARE === "object" && "COUNT" in options.COMPARE
12856            ? options.COMPARE.COUNT
12857            : Object.keys(options.COMPARE).length
12858          : 0;
12859
12860      //basket
12861      if (bBasketUpdate) {
12862        if (+basketCount > 0) {
12863          $(".bottom-icons-panel .basket.counter-state").removeClass("counter-state--empty");
12864        } else {
12865          $(".bottom-icons-panel .basket.counter-state").addClass("counter-state--empty");
12866        }
12867        $(".bottom-icons-panel .basket .counter-state__content-item-value").text(basketCount);
12868        $(".bottom-icons-panel .basket")
12869          .closest(".bottom-icons-panel__content-link")
12870          .attr("title", $("<div/>").html(basketTitle).text());
12871      }
12872      //
12873
12874      //delay
12875      if (bDelayUpdate && bBasketUpdate) {
12876        if (+delayCount > 0) {
12877          $(".bottom-icons-panel .delay.counter-state").removeClass("counter-state--empty");
12878          $(".bottom-icons-panel-item_delay").attr("href", $(".bottom-icons-panel-item_delay").data("href"));
12879        } else {
12880          $(".bottom-icons-panel .delay.counter-state").addClass("counter-state--empty");
12881          $(".bottom-icons-panel-item_delay").attr("href", 'javascript:void(0)');
12882        }
12883        $(".bottom-icons-panel .delay .counter-state__content-item-value").text(delayCount);
12884        $(".bottom-icons-panel .delay")
12885          .closest(".bottom-icons-panel__content-link")
12886          .attr("title", $("<div/>").html(delayTitle).text());
12887      }
12888      //
12889
12890      //compare
12891      if (bCompareUpdate) {
12892        if (compareCount > 0) {
12893          $(".bottom-icons-panel .compare.counter-state").removeClass("counter-state--empty");
12894        } else {
12895          $(".bottom-icons-panel .compare.counter-state").addClass("counter-state--empty");
12896        }
12897        $(".bottom-icons-panel .compare .counter-state__content-item-value").text(compareCount);
12898      }
12899    }
12900  };
12901}
12902if (!funcDefined("basketFly")) {
12903  var basketFly = function basketFly(action, opener) {
12904    if (typeof obMaxPredictions === "object") {
12905      obMaxPredictions.updateAll();
12906    }
12907
12908    /*if(arAsproOptions['PAGES']['BASKET_PAGE'])
12909      return;*/
12910    $.post(
12911      arAsproOptions["SITE_DIR"] + "ajax/basket_fly.php",
12912      "PARAMS=" + $("#basket_form").find("input#fly_basket_params").val(),
12913      $.proxy(function (data) {
12914        var small = $(".opener .basket_count").hasClass("small"),
12915          basket_count = $(data).find(".basket_count").find(".items div").text();
12916        $("#basket_line .basket_fly").addClass("loaded").html(data);
12917
12918        if (action == "refresh") $("li[data-type=AnDelCanBuy]").trigger("click");
12919
12920        if (typeof opener == "undefined" || $("#basket_line .basket_fly").hasClass("loading")) {
12921          if (window.matchMedia("(min-width: 769px)").matches) {
12922            if (action == "open") {
12923              if (small) {
12924                if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") {
12925                  $(".opener .basket_count").click();
12926                }
12927              } else {
12928                $(".opener .basket_count").removeClass("small");
12929                $('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass("cur");
12930                $('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass("cur");
12931
12932                $("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
12933              }
12934            } else if (action == "wish") {
12935              if (small) {
12936                if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") $(".opener .wish_count").click();
12937              } else {
12938                $(".opener .wish_count").removeClass("small");
12939                $('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass("cur");
12940                $('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass("cur");
12941              }
12942            } else {
12943              if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") {
12944                $(".opener .basket_count").click();
12945              }
12946            }
12947          }
12948        } else if (opener === "SHOW") {
12949          if (window.matchMedia("(min-width: 769px)").matches) {
12950            $(".opener .basket_count").removeClass("small");
12951            $('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass("cur");
12952            $('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass("cur");
12953            $("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
12954          }
12955        }
12956      })
12957    );
12958  };
12959}
12960
12961if (!funcDefined("basketTop")) {
12962  var basketTop = function basketTop(action, hoverBlock) {
12963    if (action == "reload") {
12964      if ($(".basket_hover_block:hover").length) {
12965        hoverBlock = $(".basket_hover_block:hover");
12966      }
12967    }
12968
12969    if (action == "open") {
12970      if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") {
12971        if ($("#headerfixed").hasClass("fixed")) {
12972          hoverBlock = $("#headerfixed .basket_hover_block");
12973        } else {
12974          hoverBlock = $(".top_basket .basket_hover_block");
12975        }
12976      }
12977    }
12978
12979    if (hoverBlock === undefined) {
12980      console.log("Undefined hoverBlock");
12981      console.trace();
12982      return false;
12983    }
12984
12985    if (action == "close") {
12986      if (hoverBlock.length) {
12987        hoverBlock.css({
12988          opacity: "",
12989          visibility: "",
12990        });
12991        return true;
12992      }
12993    }
12994
12995    hoverBlock.removeClass("loaded");
12996    var firstTime = hoverBlock.find("div").length ? "false" : "true";
12997    var params = $("#basket_form").find("input#fly_basket_params").val();
12998    var postData = {
12999      firstTime: firstTime,
13000    };
13001    if (params !== undefined) {
13002      postData.PARAMS = params;
13003    }
13004
13005    $.post(
13006      arAsproOptions["SITE_DIR"] + "ajax/showBasketHover.php",
13007      postData,
13008      $.proxy(function (data) {
13009        var ob = BX.processHTML(data);
13010
13011        // inject
13012        $("#headerfixed .basket_hover_block, .top_basket .basket_hover_block").html(ob.HTML);
13013        BX.ajax.processScripts(ob.SCRIPT);
13014
13015        if (window.matchMedia("(min-width: 992px)").matches) {
13016          hoverBlock.addClass("loaded");
13017
13018          if (action == "open") {
13019            if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") {
13020              if ($("#headerfixed").hasClass("fixed")) {
13021                hoverBlock = $("#headerfixed .basket_hover_block");
13022              } else {
13023                hoverBlock = $(".top_basket .basket_hover_block");
13024              }
13025
13026              hoverBlock.css({
13027                opacity: "1",
13028                visibility: "visible",
13029              });
13030
13031              setTimeout(function () {
13032                hoverBlock.css({
13033                  opacity: "",
13034                  visibility: "",
13035                });
13036              }, 2000);
13037            }
13038          }
13039        }
13040      })
13041    );
13042  };
13043}
13044
13045//work with hash start
13046var lastHash = location.hash;
13047if ("onhashchange" in window) {
13048  $(window).bind("hashchange", function () {
13049    var newHash = location.hash;
13050    if (newHash == "#delayed") {
13051      if ($("#basket_toolbar_button_delayed").length) $("#basket_toolbar_button_delayed").trigger("click");
13052    } else {
13053      if ($("#basket_toolbar_button").length) $("#basket_toolbar_button").trigger("click");
13054    }
13055    // Do something
13056    var diff = compareHash(newHash, lastHash);
13057    // alert("Difference between old and new hash:\n"+diff[0]+"\n\n"+diff[1]);
13058    //At the end of the func:
13059    lastHash = newHash;
13060
13061    if (lastHash) {
13062      if ("scrollRestoration" in history) {
13063        history.scrollRestoration = "manual";
13064      }
13065      if ($('.ordered-block .tabs .nav a[href="' + lastHash + '"]').length) {
13066        $('.ordered-block .tabs .nav a[href="' + lastHash + '"]').trigger("click");
13067        var content_offset = $(".ordered-block .tabs").offset();
13068        $("html, body").animate({ scrollTop: content_offset.top - 90 }, 400);
13069      }
13070    }
13071  });
13072
13073  function compareHash(current, previous) {
13074    for (var i = 0, len = Math.min(current.length, previous.length); i < len; i++) {
13075      if (current.charAt(0) != previous.charAt(0)) break;
13076    }
13077    current = current.substr(i);
13078    previous = previous.substr(i);
13079    for (var i = 0, len = Math.min(current.length, previous.length); i < len; i++) {
13080      if (current.substr(-1) != previous.substr(-1)) break;
13081    }
13082
13083    //Array: Current = New hash, previous = old hash
13084    return [current, previous];
13085  }
13086}
13087
13088$(document).on("click", "#basket_toolbar_button", function () {
13089  if (lastHash) location.hash = "cart";
13090});
13091$(document).on("click", "#basket_toolbar_button_delayed", function () {
13092  if (lastHash) location.hash = "delayed";
13093});
13094if (location.hash) {
13095  var hash = location.hash;
13096}
13097//work with hash end
13098
13099$(document).on("click", "#basket_line .basket_fly .opener > div.clicked", function () {
13100  if (arAsproOptions["PAGES"]["BASKET_PAGE"]) return;
13101  function onOpenFlyBasket(_this) {
13102    $("#basket_line .basket_fly .tabs li").removeClass("cur");
13103    $("#basket_line .basket_fly .tabs_content li").removeClass("cur");
13104    // $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
13105    if (!$(_this).is(".wish_count.empty")) {
13106      $("#basket_line .basket_fly .tabs_content li[item-section=" + $(_this).data("type") + "]").addClass("cur");
13107      $("#basket_line .basket_fly .tabs li:eq(" + $(_this).index() + ")").addClass("cur");
13108      // $("#basket_line .basket_fly .remove_all_basket."+$(_this).data("type")).addClass("cur");
13109    } else {
13110      $("#basket_line .basket_fly .tabs li").first().addClass("cur").siblings().removeClass("cur");
13111      $("#basket_line .basket_fly .tabs_content li").first().addClass("cur").siblings().removeClass("cur");
13112      // $("#basket_line .basket_fly .remove_all_basket").first().addClass("cur");
13113    }
13114    $("#basket_line .basket_fly .opener > div.clicked").removeClass("small");
13115
13116    $("#basket_line .basket_fly .opener > div").siblings().removeClass("cur");
13117    $("#basket_line .basket_fly .opener > div:eq(" + $(_this).index() + ")").addClass("cur");
13118  }
13119
13120  if (window.matchMedia("(min-width: 769px)").matches) {
13121    var _this = this;
13122
13123    $(_this).siblings().removeClass("cur");
13124    $(_this).addClass("cur");
13125
13126    if (parseInt($("#basket_line .basket_fly").css("right")) < 0) {
13127      $("#basket_line .basket_fly")
13128        .stop()
13129        .addClass("loading")
13130        .animate({ right: "0" }, 333, function () {
13131          if ($(_this).closest(".basket_fly.loaded").length) {
13132            onOpenFlyBasket(_this);
13133          } else {
13134            $.ajax({
13135              url: arAsproOptions["SITE_DIR"] + "ajax/basket_fly.php",
13136              type: "post",
13137              success: function (html) {
13138                $("#basket_line .basket_fly").removeClass("loading").addClass("loaded").html(html);
13139                onOpenFlyBasket(_this);
13140              },
13141            });
13142          }
13143        });
13144      $("#basket_line .basket_fly").addClass("swiped");
13145    } else if (
13146      $(this).is(".wish_count:not(.empty)") &&
13147      !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=DelDelCanBuy]")
13148    ) {
13149      $("#basket_line .basket_fly .tabs li").removeClass("cur");
13150      $("#basket_line .basket_fly .tabs_content li").removeClass("cur");
13151      // $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
13152      $("#basket_line .basket_fly .tabs_content li[item-section=" + $(this).data("type") + "]").addClass("cur");
13153      $("#basket_line  .basket_fly .tabs li:eq(" + $(this).index() + ")")
13154        .first()
13155        .addClass("cur");
13156      // $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
13157    } else if (
13158      $(this).is(".basket_count") &&
13159      $("#basket_line .basket_fly .basket_sort ul.tabs li.cur").length &&
13160      !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=AnDelCanBuy]")
13161    ) {
13162      $("#basket_line .basket_fly .tabs li").removeClass("cur");
13163      $("#basket_line .basket_fly .tabs_content li").removeClass("cur");
13164      // $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
13165      $("#basket_line  .basket_fly .tabs_content li:eq(" + $(this).index() + ")").addClass("cur");
13166      $("#basket_line  .basket_fly .tabs li:eq(" + $(this).index() + ")")
13167        .first()
13168        .addClass("cur");
13169      // $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
13170    } else {
13171      $("#basket_line .basket_fly")
13172        .stop()
13173        .animate({ right: -$("#basket_line .basket_fly").outerWidth() }, 150);
13174      $("#basket_line .basket_fly .opener > div.clicked").addClass("small");
13175      $("#basket_line .basket_fly").removeClass("swiped");
13176      $("#basket_line .basket_fly .opener > div").removeClass("cur");
13177    }
13178  }
13179});
13180
13181if (!funcDefined("clearViewedProduct")) {
13182  function clearViewedProduct() {
13183    try {
13184      var siteID = arAsproOptions.SITE_ID;
13185      var localKey = "MAX_VIEWED_ITEMS_" + siteID;
13186      var cookieParams = { path: "/", expires: 30 };
13187      if (typeof BX.localStorage !== "undefined") {
13188        // remove local storage
13189        BX.localStorage.set(localKey, {}, 0);
13190      }
13191      // remove cookie
13192      $.removeCookie(localKey, cookieParams);
13193    } catch (e) {
13194      console.error(e);
13195    }
13196  }
13197}
13198
13199if (!funcDefined("setViewedProduct")) {
13200  function setViewedProduct(id, arData) {
13201    try {
13202      // save $.cookie option
13203      var bCookieJson = $.cookie.json;
13204      $.cookie.json = true;
13205
13206      var siteID = arAsproOptions.SITE_ID;
13207      var localKey = "MAX_VIEWED_ITEMS_" + siteID;
13208      var cookieParams = { path: "/", expires: 30 };
13209
13210      if (typeof BX.localStorage !== "undefined" && typeof id !== "undefined" && typeof arData !== "undefined") {
13211        var PRODUCT_ID = typeof arData.PRODUCT_ID !== "undefined" ? arData.PRODUCT_ID : id;
13212        var arViewedLocal = BX.localStorage.get(localKey) ? BX.localStorage.get(localKey) : {};
13213        var arViewedCookie = $.cookie(localKey) ? $.cookie(localKey) : {};
13214        var count = 0;
13215
13216        // delete some items (sync cookie & local storage)
13217        for (var _id in arViewedLocal) {
13218          arViewedLocal[_id].IS_LAST = false;
13219          if (typeof arViewedCookie[_id] === "undefined") {
13220            delete arViewedLocal[_id];
13221          }
13222        }
13223        for (var _id in arViewedCookie) {
13224          if (typeof arViewedLocal[_id] === "undefined") {
13225            delete arViewedCookie[_id];
13226          }
13227        }
13228
13229        for (var _id in arViewedCookie) {
13230          count++;
13231        }
13232
13233        // delete item if other item (offer) of that PRODUCT_ID is exists
13234        if (typeof arViewedLocal[PRODUCT_ID] !== "undefined") {
13235          if (arViewedLocal[PRODUCT_ID].ID != id) {
13236            delete arViewedLocal[PRODUCT_ID];
13237            delete arViewedCookie[PRODUCT_ID];
13238          }
13239        }
13240
13241        var time = new Date().getTime();
13242        arData.ID = id;
13243        arData.ACTIVE_FROM = time;
13244        arData.IS_LAST = true;
13245        arViewedLocal[PRODUCT_ID] = arData;
13246        arViewedCookie[PRODUCT_ID] = [time.toString(), arData.PICTURE_ID];
13247
13248        $.cookie(localKey, arViewedCookie, cookieParams);
13249        BX.localStorage.set(localKey, arViewedLocal, 2592000); // 30 days
13250      }
13251    } catch (e) {
13252      console.error(e);
13253    } finally {
13254      // restore $.cookie option
13255      $.cookie.json = bCookieJson;
13256    }
13257  }
13258}
13259
13260if (!funcDefined("initSelects")) {
13261  function initSelects(target) {
13262    var iOS = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false;
13263    if (iOS && !$(".wrapper1.iks-on-ios").length) return;
13264    if ($("#bx-soa-order").length || $("#bx-soa-order-main").length) return;
13265
13266    if (!$(".wrapper1.iks-ignore").length) {
13267      const $target = $(target).find(
13268        ".wrapper1 select:visible:not(.iks-ignore), .jqmWindow select:visible:not(.iks-ignore)"
13269      );
13270
13271      if ($target.length) {
13272        // SELECT STYLING
13273        $target.ikSelect({
13274          syntax:
13275            '<div class="ik_select_link"> \
13276              <span class="ik_select_link_text"></span> \
13277              <div class="trigger"></div> \
13278            </div> \
13279            <div class="ik_select_dropdown"> \
13280              <div class="ik_select_list"> \
13281              </div> \
13282            </div>',
13283          dynamicWidth: true,
13284          ddMaxHeight: 112,
13285          customClass: "common_select",
13286          //equalWidths: true,
13287          onShow: function (inst) {
13288            inst.$dropdown.css("top", parseFloat(inst.$dropdown.css("top")) - 5 + "px");
13289            if (inst.$dropdown.outerWidth() < inst.$link.outerWidth()) {
13290              inst.$dropdown.css("width", inst.$link.outerWidth());
13291            }
13292            if (inst.$dropdown.outerWidth() > inst.$link.outerWidth()) {
13293              inst.$dropdown.css("width", inst.$link.outerWidth());
13294            }
13295            var count = 0,
13296              client_height = 0;
13297            inst.$dropdown.css("left", inst.$link.offset().left);
13298            $(inst.$listInnerUl)
13299              .find("li")
13300              .each(function () {
13301                if (!$(this).hasClass("ik_select_option_disabled")) {
13302                  ++count;
13303                  client_height += $(this).outerHeight();
13304                }
13305              });
13306            if (client_height < 112) {
13307              inst.$listInner.css("height", "auto");
13308            } else {
13309              inst.$listInner.css("height", "112px");
13310            }
13311            inst.$link.addClass("opened");
13312            inst.$listInner.addClass("scroller scrollblock");
13313            if ($(".confirm_region").length) $(".confirm_region").remove();
13314          },
13315          onHide: function (inst) {
13316            inst.$link.removeClass("opened");
13317          },
13318        });
13319        // END OF SELECT STYLING
13320
13321        var timeout;
13322        $(window).on("resize", function () {
13323          ignoreResize.push(true);
13324          clearTimeout(timeout);
13325          timeout = setTimeout(function () {
13326            //$('select:visible').ikSelect('redraw');
13327            var inst = "";
13328            if ((inst = $(".common_select-link.opened + select").ikSelect().data("plugin_ikSelect"))) {
13329              inst.$dropdown.css("left", inst.$link.offset().left + "px");
13330            }
13331          }, 20);
13332          ignoreResize.pop();
13333        });
13334      }
13335    }
13336  }
13337}
13338
13339if (!funcDefined("CheckTopMenuFullCatalogSubmenu")) {
13340  CheckTopMenuFullCatalogSubmenu = function () {
13341    if (arAsproOptions["THEME"] && arAsproOptions["THEME"]["MENU_TYPE_VIEW"] != "HOVER") return;
13342
13343    var $menu = $(".left_block .menu_top_block");
13344    if ($menu.length) {
13345      var $wrapmenu = $menu.parents(".wrap_menu");
13346
13347      var wrapMenuWidth = $menu.closest(".wrapper_inner").actual("width");
13348      if (!wrapMenuWidth) wrapMenuWidth = $menu.closest(".wraps").actual("width");
13349
13350      var bCatalogFirst = $menu.hasClass("catalogfirst");
13351      var findMenuLi = $(".left_block .menu_top_block:visible li.full");
13352      var parentSubmenuWidth = $menu.actual("outerWidth");
13353      var wrapMenuLeft = 0;
13354      var wrapMenuRight = 0;
13355
13356      if ($wrapmenu.length) {
13357        wrapMenuWidth = $wrapmenu.actual("outerWidth");
13358        wrapMenuLeft = $wrapmenu.offset().left;
13359        wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
13360      }
13361
13362      if ($(".left_block .catalog_block.menu_top_block").length) {
13363        if ($(".left_block .catalog_block.menu_top_block").is(":visible"))
13364          findMenuLi = $(".left_block .menu_top_block.catalog_block li.full");
13365      }
13366      findMenuLi.each(function () {
13367        var $this = $(this);
13368        var $submenu = $this.find(">.dropdown");
13369
13370        if ($submenu.length) {
13371          // $submenu.css({left: parentSubmenuWidth + 'px', width: (wrapMenuWidth - parentSubmenuWidth) + 'px', 'padding-left': '0px', 'padding-right': '0px', 'opacity': 1});
13372          $submenu.css({ width: wrapMenuWidth - parentSubmenuWidth + "px" });
13373
13374          if (!isOnceInited && arAsproOptions["THEME"]["MENU_POSITION"] == "TOP") {
13375            $this.on("mouseenter", function () {
13376              $submenu.css("min-height", $this.closest(".dropdown").actual("outerHeight") + "px");
13377            });
13378          }
13379        }
13380      });
13381    }
13382  };
13383}
13384
13385$.fn.getMaxHeights = function (outer, classNull, minHeight) {
13386  var maxHeight = this.map(function (i, e) {
13387    var calc_height = 0;
13388    $(e).css("height", "");
13389
13390    if (outer == true) calc_height = $(e).actual("outerHeight");
13391    else calc_height = $(e).actual("height");
13392
13393    return calc_height;
13394  }).get();
13395  for (var i = 0, c = maxHeight.length; i < c; ++i) {
13396    if (maxHeight[i] % 2) --maxHeight[i];
13397  }
13398  return Math.max.apply(this, maxHeight);
13399};
13400
13401$.fn.equalizeHeights = function (outer, classNull, options) {
13402  var maxHeight = [];
13403  var items = [];
13404
13405  for (var i = 0, itemKey = 0; i < this.length; itemKey++) {
13406    var item = this[itemKey],
13407      _item = $(item),
13408      minus_height = 0,
13409      calc_height = 0;
13410
13411    i++;
13412
13413    if (options.blockNull !== undefined) {
13414      if (options.blockNull.class !== undefined) {
13415        if (_item.hasClass(options.blockNull.class) || _item.closest("." + options.blockNull.class).length) {
13416          continue;
13417        }
13418      }
13419    }
13420
13421    items.push(this[itemKey]);
13422
13423    if (classNull !== false) {
13424      if (!isMobile) {
13425        var nulled = _item.find(classNull);
13426        if (nulled.length) {
13427          minus_height = parseInt(nulled[0].offsetHeight);
13428          //minus_height=parseInt(_item.find(classNull).outerHeight(false));
13429          //minus_height=parseInt(_item.find(classNull).actual('outerHeight'));
13430        }
13431      }
13432    }
13433
13434    if (minus_height) minus_height += 12;
13435
13436    _item.css("height", "");
13437
13438    calc_height = item.offsetHeight - minus_height;
13439
13440    if (options.minHeight !== false) {
13441      if (calc_height < options.minHeight) calc_height += options.minHeight - calc_height;
13442
13443      if (window.matchMedia("(max-width: 520px)").matches) calc_height = 300;
13444
13445      if (window.matchMedia("(max-width: 400px)").matches) calc_height = 200;
13446    }
13447
13448    if (!calc_height) calc_height = 0;
13449
13450    maxHeight.push(calc_height);
13451  }
13452
13453  for (var i = 0, c = maxHeight.length; i < c; ++i) {
13454    if (maxHeight[i] % 2) {
13455      --maxHeight[i];
13456    }
13457  }
13458
13459  var result = $(items).height(Math.max.apply(this, maxHeight));
13460
13461  return result;
13462};
13463
13464$.fn.getFloatWidth = function () {
13465  var width = 0;
13466  if ($(this).length) {
13467    var rect = $(this)[0].getBoundingClientRect();
13468    if (!(width = rect.width)) width = rect.right - rect.left;
13469  }
13470
13471  $(this).data("floatWidth", width);
13472
13473  return width;
13474};
13475
13476function extendDepthObject(target, FromObj) {
13477  var to = Object.assign({}, target);
13478  for (var key in FromObj) {
13479    if (typeof FromObj[key] == "object") {
13480      to[key] = extendDepthObject(to[key], FromObj[key]);
13481    } else {
13482      to[key] = FromObj[key];
13483    }
13484  }
13485
13486  return to;
13487}
13488
13489$.fn.sliceHeight = function (options) {
13490  function _slice(el) {
13491    var arBreakpoints = Object.keys(options.breakpoint);
13492    var resizeOptionsTmp = {};
13493    if (arBreakpoints.length) {
13494      for (var key in arBreakpoints) {
13495        if (window.matchMedia(arBreakpoints[key].toString()).matches) {
13496          resizeOptionsTmp = options.breakpoint[arBreakpoints[key]];
13497        }
13498      }
13499    }
13500
13501    var resizeOptions = extendDepthObject(options, resizeOptionsTmp);
13502
13503    var blockNullClass =
13504      resizeOptions.blockNull !== undefined && resizeOptions.blockNull.class !== undefined
13505        ? resizeOptions.blockNull.class
13506        : false;
13507    var parent =
13508      typeof resizeOptions.row !== "undefined" && resizeOptions.row.length
13509        ? el.first().parents(resizeOptions.row)
13510        : el.first().parents(".items");
13511    var item = "";
13512
13513    if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length) {
13514      if (blockNullClass) {
13515        $(resizeOptions.item).each(function (i, element) {
13516          _element = $(element);
13517          if (!_element.hasClass(blockNullClass)) {
13518            item = _element;
13519          }
13520        });
13521        if (!item)
13522          // if only ignored blocks
13523          return false;
13524      } else {
13525        item = $(resizeOptions.item).first();
13526      }
13527    } else {
13528      if (el.first().hasClass("item")) {
13529        item = el.first();
13530      } else {
13531        item = el.first().parents(".item");
13532      }
13533    }
13534
13535    if (typeof resizeOptions.autoslicecount == "undefined" || resizeOptions.autoslicecount !== false) {
13536      var elsw = parent.getFloatWidth(),
13537        elw = item.getFloatWidth();
13538      if (!elsw) {
13539        elsw = el.first().parents(".row").getFloatWidth();
13540      }
13541      if (!elw) {
13542        if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length)
13543          elw = $(resizeOptions.item + ":eq(1)").getFloatWidth()
13544            ? $(resizeOptions.item + ":eq(1)").getFloatWidth()
13545            : $(resizeOptions.item + ":eq(2)").getFloatWidth();
13546        else elw = $(el[1]).getFloatWidth() ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth();
13547      }
13548      if (elw && resizeOptions.fixWidth) elw -= resizeOptions.fixWidth;
13549
13550      elw = parseInt(elw * 100) / 100;
13551
13552      if (elsw && elw) {
13553        resizeOptions.slice = Math.floor(elsw / elw);
13554      }
13555    }
13556
13557    if (resizeOptions.customSlice) {
13558      //manual slice count
13559      var bSliceNext = false;
13560      if (resizeOptions.length) {
13561        elw =
13562          typeof resizeOptions.item !== "undefined" && resizeOptions.item.length
13563            ? $(resizeOptions.item).last().getFloatWidth()
13564            : el.last().hasClass("item")
13565              ? el.last().getFloatWidth()
13566              : el.last().parents(".item").getFloatWidth();
13567        if (elw) resizeOptions.sliceNext = Math.floor(elsw / elw);
13568
13569        bSliceNext = true;
13570      }
13571    }
13572
13573    elements = [];
13574    if (resizeOptions.classes !== undefined && resizeOptions.classes.length) {
13575      for (var i = 0; i < resizeOptions.classes.length; i++) {
13576        var items = $(resizeOptions.item).find(resizeOptions.classes[i]);
13577        elements.push(items);
13578      }
13579    }
13580    var elIndex = elements.push(el) - 1;
13581
13582    if (resizeOptions.mobile == true) {
13583      if (window.matchMedia("(max-width: 500px)").matches) {
13584        for (var block = 0; block < elements.length; block++) {
13585          var items = $(elements[block]);
13586          items.css({
13587            "line-height": "",
13588            height: "",
13589          });
13590        }
13591        return;
13592      }
13593    }
13594
13595    if (typeof resizeOptions.typeResize == "undefined" || resizeOptions.typeResize == false) {
13596      if (resizeOptions.slice) {
13597        for (var block = 0; block < elements.length; block++) {
13598          if (resizeOptions.currentRow) {
13599            var itemNumber = el.index(resizeOptions.currentItem);
13600            var rowCount = resizeOptions.slice;
13601            var rowNumber = Math.floor(itemNumber / rowCount);
13602
13603            var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount));
13604            var classNull = block == elIndex ? resizeOptions.classNull : false;
13605            items.css({
13606              "line-height": "",
13607              height: "",
13608            });
13609            items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
13610          } else {
13611            for (var i = 0; i < elements[block].length;) {
13612              if (resizeOptions.customSlice && resizeOptions.sliceNext && bSliceNext && i)
13613                //manual slice count
13614                resizeOptions.slice = resizeOptions.sliceNext;
13615
13616              var slice = resizeOptions.slice;
13617              var items = $(elements[block].slice(i, i + slice));
13618              if (resizeOptions.blockNull !== undefined) {
13619                if (resizeOptions.blockNull.class !== undefined) {
13620                  var counts = 0;
13621                  items.each(function (i, item) {
13622                    var _item = $(item);
13623                    if (
13624                      _item.hasClass(resizeOptions.blockNull.class) ||
13625                      _item.closest("." + resizeOptions.blockNull.class).length
13626                    ) {
13627                      counts++;
13628                    }
13629                  });
13630                }
13631              }
13632              if (counts) {
13633                slice -= (resizeOptions.blockNull.width - 1) * counts;
13634              }
13635
13636              items = $(elements[block].slice(i, i + slice));
13637              if (items) {
13638                var classNull = block == elIndex ? resizeOptions.classNull : false;
13639
13640                items.css({
13641                  "line-height": "",
13642                  height: "",
13643                });
13644                items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
13645              }
13646              i += slice || 1;
13647            }
13648          }
13649        }
13650      }
13651      if (resizeOptions.lineheight) {
13652        var lineheightAdd = parseInt(resizeOptions.lineheight);
13653        if (isNaN(lineheightAdd)) {
13654          lineheightAdd = 0;
13655        }
13656        el.each(function () {
13657          $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px");
13658        });
13659      }
13660    }
13661  }
13662  var options = $.extend(
13663    {
13664      slice: null,
13665      sliceNext: null,
13666      outer: false,
13667      lineheight: false,
13668      autoslicecount: true,
13669      classNull: false,
13670      minHeight: false,
13671      row: false,
13672      item: false,
13673      typeResize: false,
13674      typeValue: false,
13675      fixWidth: 0,
13676      resize: true,
13677      mobile: false,
13678      customSlice: false,
13679      breakpoint: {},
13680      classes: [],
13681    },
13682    options
13683  );
13684
13685  var el = $(this);
13686
13687  ignoreResize.push(true);
13688  _slice(el);
13689  ignoreResize.pop();
13690
13691  if (options.resize) {
13692    BX.addCustomEvent("onWindowResize", function (eventdata) {
13693      try {
13694        ignoreResize.push(true);
13695        _slice(el);
13696      } catch (e) {
13697      } finally {
13698        ignoreResize.pop();
13699      }
13700    });
13701  } else {
13702    if (!ignoreResize.length) {
13703      // ignoreResize.push(true);
13704      _slice(el);
13705      // ignoreResize.pop();
13706    }
13707  }
13708};
13709
13710$.fn.sliceHeightNoResize = function (options) {
13711  function _slice(el) {
13712    el.each(function () {
13713      $(this).css("line-height", "");
13714      $(this).css("height", "");
13715    });
13716    if (options.mobile == true) {
13717      if (window.matchMedia("(max-width: 550px)").matches) return;
13718    }
13719    if (typeof options.autoslicecount == "undefined" || options.autoslicecount !== false) {
13720      var elsw =
13721        typeof options.row !== "undefined" && options.row.length
13722          ? el.first().parents(options.row).getFloatWidth()
13723          : el.first().parents(".items").getFloatWidth(),
13724        elw =
13725          typeof options.item !== "undefined" && options.item.length
13726            ? $(options.item).first().getFloatWidth()
13727            : el.first().hasClass("item")
13728              ? el.first().getFloatWidth()
13729              : el.first().parents(".item").getFloatWidth();
13730
13731      if (!elsw) {
13732        elsw = el.first().parents(".row").getFloatWidth();
13733      }
13734      if (elw && options.fixWidth) elw -= options.fixWidth;
13735
13736      if (elsw && elw) {
13737        options.slice = Math.floor(elsw / elw);
13738      }
13739    }
13740    if (options.customSlice) {
13741      //manual slice count
13742      var arBreakpoints = Object.keys(options.breakpoint),
13743        bSliceNext = false;
13744      if (arBreakpoints.length) {
13745        elw =
13746          typeof options.item !== "undefined" && options.item.length
13747            ? $(options.item).last().getFloatWidth()
13748            : el.last().hasClass("item")
13749              ? el.last().getFloatWidth()
13750              : el.last().parents(".item").getFloatWidth();
13751        if (elw) options.sliceNext = Math.floor(elsw / elw);
13752        for (var key in arBreakpoints) {
13753          if (window.matchMedia(arBreakpoints[key].toString()).matches) {
13754            bSliceNext = true;
13755            options.slice = options.breakpoint[arBreakpoints[key]];
13756          }
13757        }
13758      }
13759    }
13760    if (typeof options.typeResize == "undefined" || options.typeResize == false) {
13761      if (options.slice) {
13762        for (var i = 0; i < el.length; i += options.slice) {
13763          if (options.customSlice && options.sliceNext && bSliceNext && i)
13764            //manual slice count
13765            options.slice = options.sliceNext;
13766          $(el.slice(i, i + options.slice)).equalizeHeights(
13767            options.outer,
13768            options.classNull,
13769            options.minHeight,
13770            options.typeResize,
13771            options.typeValue
13772          );
13773        }
13774      }
13775      if (options.lineheight) {
13776        var lineheightAdd = parseInt(options.lineheight);
13777        if (isNaN(lineheightAdd)) {
13778          lineheightAdd = 0;
13779        }
13780        el.each(function () {
13781          $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px");
13782        });
13783      }
13784    }
13785  }
13786  var options = $.extend(
13787    {
13788      slice: null,
13789      sliceNext: null,
13790      outer: false,
13791      lineheight: false,
13792      autoslicecount: true,
13793      classNull: false,
13794      minHeight: false,
13795      row: false,
13796      item: false,
13797      typeResize: false,
13798      typeValue: false,
13799      fixWidth: 0,
13800      resize: true,
13801      mobile: false,
13802      customSlice: false,
13803      breakpoint: {},
13804    },
13805    options
13806  );
13807
13808  var el = $(this);
13809
13810  ignoreResize.push(true);
13811  _slice(el);
13812  ignoreResize.pop();
13813};
13814
13815if (!funcDefined("initHoverBlock")) {
13816  function initHoverBlock(target) {
13817    /*$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){
13818      $(this).addClass('hover');
13819    })
13820    $(target).find('.catalog_item.item_wrap').on('mouseleave', function(){
13821      $(this).removeClass('hover');
13822    })*/
13823  }
13824}
13825if (!funcDefined("setStatusButton")) {
13826  function setStatusButton() {
13827    if (!funcDefined("setItemButtonStatus")) {
13828      setItemButtonStatus = function (data) {
13829        if (data.BASKET) {
13830          for (var i in data.BASKET) {
13831            var id = data.BASKET[i];
13832            if (typeof id === "number" || typeof id === "string") {
13833              $(".to-cart[data-item=" + id + "]").hide();
13834              $(".counter_block[data-item=" + id + "]")
13835                .closest(".counter_block_inner")
13836                .hide();
13837              $(".counter_block[data-item=" + id + "]").hide();
13838              $(".in-cart[data-item=" + id + "]").show();
13839              $(".in-cart[data-item=" + id + "]")
13840                .closest(".button_block")
13841                .addClass("wide");
13842            }
13843          }
13844        }
13845        if (data.DELAY) {
13846          for (var i in data.DELAY) {
13847            var id = data.DELAY[i];
13848            if (typeof id === "number" || typeof id === "string") {
13849              $(".wish_item.to[data-item=" + id + "]").hide();
13850              $(".wish_item.in[data-item=" + id + "]").show();
13851              if ($(".wish_item[data-item=" + id + "]").find(".value.added").length) {
13852                //$('.wish_item[data-item='+id+']').addClass("added");
13853                $(".wish_item[data-item=" + id + "]")
13854                  .find(".value")
13855                  .hide();
13856                $(".wish_item[data-item=" + id + "]")
13857                  .find(".value.added")
13858                  .show();
13859              }
13860            }
13861          }
13862        }
13863        if (data.SUBSCRIBE) {
13864          for (var i in data.SUBSCRIBE) {
13865            var id = data.SUBSCRIBE[i];
13866            if (typeof id === "number" || typeof id === "string") {
13867              $(".to-subscribe[data-item=" + id + "]").hide();
13868              $(".in-subscribe[data-item=" + id + "]").show();
13869            }
13870          }
13871        }
13872        if (data.COMPARE) {
13873          for (var i in data.COMPARE) {
13874            var id = data.COMPARE[i];
13875            if (typeof id === "number" || typeof id === "string") {
13876              $(".compare_item.to[data-item=" + id + "]").hide();
13877              $(".compare_item.in[data-item=" + id + "]").show();
13878              if ($(".compare_item[data-item=" + id + "]").find(".value.added").length) {
13879                $(".compare_item[data-item=" + id + "]")
13880                  .find(".value")
13881                  .hide();
13882                $(".compare_item[data-item=" + id + "]")
13883                  .find(".value.added")
13884                  .show();
13885              }
13886            }
13887          }
13888        }
13889      };
13890    }
13891    if (!Object.keys(arStatusBasketAspro).length) {
13892      if (typeof arAsproOptions === "undefined") {
13893        var arAsproOptions = {
13894          SITE_DIR: "/",
13895        };
13896        if ($("body").data("site") !== undefined) arAsproOptions["SITE_DIR"] = $("body").data("site");
13897      }
13898      $.ajax({
13899        url: arAsproOptions["SITE_DIR"] + "ajax/getAjaxBasket.php",
13900        type: "POST",
13901        success: function (data) {
13902          arStatusBasketAspro = data;
13903          setItemButtonStatus(arStatusBasketAspro);
13904        },
13905      });
13906    } else setItemButtonStatus(arStatusBasketAspro);
13907  }
13908}
13909
13910if (!funcDefined("onLoadjqm")) {
13911  var onLoadjqm = function (name, hash, requestData, selector, requestTitle, isButton, thButton) {
13912    if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
13913      $("body").addClass("jqm-initied");
13914    }
13915    if (window.matchMedia("(min-width: 768px)").matches) {
13916      $("body").addClass("swipeignore");
13917    }
13918
13919    if (typeof $(hash.t).data("ls") !== " undefined" && $(hash.t).data("ls")) {
13920      var ls = $(hash.t).data("ls"),
13921        ls_timeout = 0,
13922        v = "";
13923
13924      if ($(hash.t).data("ls_timeout")) ls_timeout = $(hash.t).data("ls_timeout");
13925
13926      ls_timeout = ls_timeout ? Date.now() + ls_timeout * 1000 : "";
13927
13928      if (typeof localStorage !== "undefined") {
13929        var val = localStorage.getItem(ls);
13930        try {
13931          v = JSON.parse(val);
13932        } catch (e) {
13933          v = val;
13934        }
13935        if (v != null) {
13936          localStorage.removeItem(ls);
13937        }
13938        v = {};
13939        v["VALUE"] = "Y";
13940        v["TIMESTAMP"] = ls_timeout; // default: seconds for 1 day
13941
13942        localStorage.setItem(ls, JSON.stringify(v));
13943      } else {
13944        var val = $.cookie(ls);
13945        if (!val) $.cookie(ls, "Y", { expires: ls_timeout }); // default: seconds for 1 day
13946      }
13947
13948      var dopClasses = hash.w.find(".marketing-popup").data("classes");
13949      if (dopClasses) {
13950        hash.w.addClass(dopClasses);
13951      }
13952    }
13953
13954    //show password eye
13955    if (hash.w.hasClass("auth_frame")) {
13956      hash.w.find(".form-control:not(.eye-password-ignore) [type=password]").each(function (item) {
13957        $(this).closest(".form-control").addClass("eye-password");
13958      });
13959    }
13960
13961    $.each($(hash.t).get(0).attributes, function (index, attr) {
13962      if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) {
13963        var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
13964        var el = $('input[data-sid="' + key.toUpperCase() + '"]');
13965        var value = $(hash.t).data("autoload-" + key);
13966        value = String(value).replace(/%99/g, "\\"); // replace symbol \
13967        el.val(BX.util.htmlspecialcharsback(value)).attr("readonly", "readonly");
13968        el.closest(".form-group").addClass("input-filed");
13969        el.attr("title", el.val());
13970      }
13971    });
13972
13973    //show gift block
13974    if (hash.w.hasClass("send_gift_frame")) {
13975      var imgHtml = (priceHtml = propsHtml = "");
13976      if ($(".offers_img a").length) imgHtml = $(".offers_img a").html();
13977      else if ($(".product-detail-gallery__container .first_sku_picture").length)
13978        imgHtml = "<img src=" + $(".product-detail-gallery__container link.first_sku_picture").attr("href") + " />";
13979      else if ($(".product-detail-gallery__container").length)
13980        imgHtml = "<img src=" + $('.product-detail-gallery__container link[itemprop="image"]').attr("href") + " />";
13981
13982      if ($('.product-container *[itemprop="offers"]').length) {
13983        //show price
13984        if ($(".sku-view").length) {
13985          if ($(".prices_block .price").length)
13986            priceHtml = $(".prices_block .cost.prices").html().replace("id", "data-id");
13987        } else {
13988          var mainContainer = $(hash.t).closest(".product-main");
13989          if (mainContainer.find(".prices_block .js_price_wrapper").length) {
13990            if (mainContainer.find(".prices_block .js_price_wrapper .with_matrix").length) {
13991              priceHtml =
13992                '<div class="with_matrix">' +
13993                mainContainer.find(".prices_block .js_price_wrapper .with_matrix").html() +
13994                "</div>";
13995            } else if (mainContainer.find(".prices_block .with_matrix:visible").length) {
13996              priceHtml =
13997                '<div class="with_matrix">' + mainContainer.find(".prices_block .with_matrix").html() + "</div>";
13998            } else if (mainContainer.find(".prices_block .price_group.min").length) {
13999              priceHtml =
14000                '<div class="with_matrix">' + mainContainer.find(".prices_block .price_group.min").html() + "</div>";
14001            } else {
14002              priceHtml =
14003                '<div class="with_matrix">' + mainContainer.find(".prices_block .js_price_wrapper").html() + "</div>";
14004            }
14005          } else if (mainContainer.find(".prices_block .with_matrix").length)
14006            priceHtml =
14007              '<div class="with_matrix">' + mainContainer.find(".prices_block .with_matrix").html() + "</div>";
14008          else if (mainContainer.find(".prices_block .price_group.min").length)
14009            priceHtml = mainContainer.find(".prices_block .price_group.min").html();
14010          else if (mainContainer.find(".prices_block .price_matrix_wrapper").length)
14011            priceHtml = mainContainer.find(".prices_block .price_matrix_wrapper").html();
14012        }
14013      }
14014
14015      if ($(".buy_block .sku_props").length) {
14016        propsHtml = '<div class="props_item">';
14017        $(".buy_block .sku_props .bx_catalog_item_scu > div").each(function () {
14018          var title = $(this).find(".bx_item_section_name > span").html();
14019          var props = "";
14020          var ikSelect = $(this).find(".ik_select_link_text");
14021          if (ikSelect.length) {
14022            props = ikSelect.text();
14023          } else {
14024            var activeSku = $(this).find("ul li.active");
14025            var isPicture = activeSku.find(" > i");
14026            if (isPicture.length && isPicture.attr("title")) {
14027              var propTitle = isPicture.attr("title").split(":");
14028              if (propTitle.length) {
14029                propTitle = propTitle[1].trim();
14030              } else {
14031                propTitle = isPicture.attr("title");
14032              }
14033              props = propTitle;
14034            } else {
14035              props = activeSku.find(" > span").text();
14036            }
14037          }
14038
14039          propsHtml +=
14040            '<div class="prop_item">' +
14041            "<span>" +
14042            title +
14043            // '<span class="val">
14043' +
14044            // props +
14045            // "</span>" +
14046            "</span>" +
14047            "</div>";
14048        });
14049        propsHtml += "</div>";
14050      }
14051      $(
14052        '<div class="custom_block">' +
14053        '<div class="title">' +
14054        BX.message("POPUP_GIFT_TEXT") +
14055        "</div>" +
14056        '<div class="item_block">' +
14057        '<table class="item_list"><tr>' +
14058        '<td class="image">' +
14059        "<div>" +
14060        imgHtml +
14061        "</div>" +
14062        "</td>" +
14063        '<td class="text">' +
14064        '<div class="name">' +
14065        $("h1").text() +
14066        "</div>" +
14067        priceHtml +
14068        propsHtml +
14069        "</td>" +
14070        "</tr></table>" +
14071        "</div>" +
14072        "</div>"
14073      ).prependTo(hash.w.find(".form_body"));
14074    }
14075
14076    if (
14077      arAsproOptions["THEME"]["REGIONALITY_SEARCH_ROW"] == "Y" &&
14078      (hash.w.hasClass("city_chooser_frame ") || hash.w.hasClass("city_chooser_small_frame"))
14079    ) {
14080      hash.w.addClass("small_popup_regions");
14081      hash.w.addClass("no_scroll");
14082    }
14083
14084    /*if (hash.w.hasClass("city_chooser_frame ") || hash.w.hasClass("city_chooser_small_frame ")) {
14085      $(".popup_regions .items .items_block").mCustomScrollbar({
14086        mouseWheel: {
14087          scrollAmount: 150,
14088          preventDefault: true,
14089        },
14090      });
14091    }*/
14092
14093    if (name == "fast_view" && $(".smart-filter-filter").length) {
14094      var navButtons =
14095        '<div class="navigation-wrapper-fast-view">' +
14096        '<div class="fast-view-nav prev colored_theme_hover_bg" data-fast-nav="prev">' +
14097        '<i class="svg left">' +
14098        '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' +
14099        "</i>" +
14100        "</div>" +
14101        '<div class="fast-view-nav next colored_theme_hover_bg" data-fast-nav="next">' +
14102        '<i class="svg right">' +
14103        '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' +
14104        "</i>" +
14105        "</div>" +
14106        "</div>";
14107
14108      hash.w.closest("#popup_iframe_wrapper").append(navButtons);
14109    }
14110
14111    hash.w.addClass("scrollblock");
14112    hash.w.addClass("show").css({
14113      // 'top': (($(window).height() > hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px',
14114      // 'margin-left': ($(window).width() > hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
14115      opacity: 1,
14116    });
14117
14118    /*if (!hash.w.hasClass("no_custom_scroll")) {
14119      hash.w.mCustomScrollbar({
14120        mouseWheel: {
14121          scrollAmount: 150,
14122          preventDefault: true,
14123        },
14124      });
14125    }*/
14126
14127    if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
14128      $("body").css({ overflow: "hidden", height: "100vh" });
14129      hash.w.closest("#popup_iframe_wrapper").css({ "z-index": 3000, display: "flex" });
14130    }
14131
14132    var eventdata = { action: "loadForm" };
14133    BX.onCustomEvent("onCompleteAction", [eventdata, $(hash.t)[0]]);
14134
14135    if (typeof requestData == "undefined") {
14136      requestData = "";
14137    }
14138    if (typeof selector == "undefined") {
14139      selector = false;
14140    }
14141
14142    var width = $("." + name + "_frame").width();
14143    //$('.'+name+'_frame').css('margin-left', '-'+width/2+'px');
14144
14145    if (name == "order-popup-call") {
14146    } else if (name == "order-button") {
14147      $(".order-button_frame")
14148        .find("div[product_name]")
14149        .find("input")
14150        .val(hash.t.title)
14151        .attr("readonly", "readonly")
14152        .css({ overflow: "hidden", "text-overflow": "ellipsis" });
14153    } else if (name == "basket_error") {
14154      $(".basket_error_frame .pop-up-title").text(requestTitle);
14155      $(".basket_error_frame .ajax_text").html(requestData);
14156
14157      if (window.matchMedia("(max-width: 991px)").matches) {
14158        $("body").addClass("all_viewed");
14159      }
14160
14161      initSelects(document);
14162      if (isButton == "Y" && thButton)
14163        $(
14164          "<div class='popup_button_basket_wr'>
14164<span class='popup_button_basket big_btn button' data-item=" +
14165          thButton.data("item") +
14166          "><span class='btn btn-default'>" +
14167          BX.message("ERROR_BASKET_BUTTON") +
14168          "</span></span></div>"
14169        ).insertAfter($(".basket_error_frame .ajax_text"));
14170    } else if (name === "fast_view") {
14171      initSelects(document);
14172    }
14173
14174    $("." + name + "_frame").show();
14175  };
14176}
14177
14178if (!funcDefined("onHidejqm")) {
14179  var onHidejqm = function (name, hash) {
14180    if (hash.w.find(".one_click_buy_result_success").is(":visible") && name == "one_click_buy_basket") {
14181      window.location.href = window.location.href;
14182    }
14183
14184    if ($(".xzoom-source").length) $(".xzoom-source").remove();
14185    if ($(".xzoom-preview").length) $(".xzoom-preview").remove();
14186
14187    // hash.w.css('opacity', 0).hide();
14188    hash.w.animate({ opacity: 0 }, 200, function () {
14189      // hash.w.removeClass("scroll-init").mCustomScrollbar("destroy");
14190      hash.w.hide();
14191      hash.w.empty();
14192      hash.o.remove();
14193      hash.w.removeClass("show");
14194
14195      $("body").css({ overflow: "", height: "" });
14196
14197      if (!hash.w.closest("#popup_iframe_wrapper").find(".jqmOverlay").length) {
14198        hash.w.closest("#popup_iframe_wrapper").css({ "z-index": "", display: "" });
14199      }
14200
14201      if (window.matchMedia("(max-width: 991px)").matches) {
14202        $("body").removeClass("all_viewed");
14203      }
14204      if (!$(".jqmOverlay:not(.mobp)").length || $(".jqmOverlay.waiting").length) {
14205        $("body").removeClass("jqm-initied");
14206      }
14207
14208      if (window.matchMedia("(min-width: 768px)").matches) {
14209        $("body").removeClass("swipeignore");
14210      }
14211
14212      if (name == "fast_view") {
14213        $(".fast_view_popup").remove();
14214
14215        var navButtons = hash.w.closest("#popup_iframe_wrapper").find(".navigation-wrapper-fast-view");
14216        navButtons.remove();
14217      }
14218    });
14219
14220    window.b24form = false;
14221  };
14222}
14223
14224$.fn.jqmEx = function () {
14225  // $(this).each(function(){
14226  var _this = $(this);
14227  var name = _this.data("name");
14228
14229  if (name.length && _this.attr("disabled") != "disabled") {
14230    var extClass = "",
14231      paramsStr = "",
14232      trigger = "",
14233      arTriggerAttrs = {};
14234
14235    // call counter
14236    if (typeof $.fn.jqmEx.counter === "undefined") {
14237      $.fn.jqmEx.counter = 0;
14238    } else {
14239      ++$.fn.jqmEx.counter;
14240    }
14241
14242    // trigger attrs and params
14243    $.each(_this.get(0).attributes, function (index, attr) {
14244      var attrName = attr.nodeName;
14245      var attrValue = _this.attr(attrName);
14246      if (attrName !== "onclick") {
14247        trigger += "[" + attrName + '="' + attrValue + '"]';
14248        arTriggerAttrs[attrName] = attrValue;
14249      }
14250      if (/^data\-param\-(.+)$/.test(attrName)) {
14251        var key = attrName.match(/^data\-param\-(.+)$/)[1];
14252        paramsStr += key + "=" + attrValue + "&";
14253      }
14254    });
14255    var triggerAttrs = JSON.stringify(arTriggerAttrs);
14256    var encTriggerAttrs = encodeURIComponent(triggerAttrs);
14257
14258    // popup url
14259    var script = arAsproOptions["SITE_DIR"] + "ajax/form.php";
14260    if (name == "auth") {
14261      script += "?" + paramsStr + "auth=Y";
14262    } else {
14263      script += "?" + paramsStr + "data-trigger=" + encTriggerAttrs;
14264    }
14265
14266    // ext frame class
14267    if (_this.closest("#fast_view_item").length) {
14268      extClass = "fast_view_popup";
14269    }
14270
14271    // use overlay?
14272    var noOverlay = _this.data("noOverlay") == "Y";
14273
14274    // unique frame to each trigger
14275    if (noOverlay) {
14276      var frame = $(
14277        '<div class="' +
14278        name +
14279        "_frame " +
14280        extClass +
14281        ' jqmWindow popup" data-popup="' +
14282        $.fn.jqmEx.counter +
14283        '" data-trigger="' +
14284        encTriggerAttrs +
14285        '"></div>'
14286      ).appendTo("body");
14287    } else {
14288      var frame = $(
14289        '<div class="' +
14290        name +
14291        "_frame " +
14292        extClass +
14293        ' jqmWindow popup" data-popup="' +
14294        $.fn.jqmEx.counter +
14295        '" data-trigger="' +
14296        encTriggerAttrs +
14297        '"></div>'
14298      ).appendTo("#popup_iframe_wrapper");
14299    }
14300
14301    frame.jqm({
14302      ajax: script,
14303      trigger: trigger,
14304      noOverlay: noOverlay,
14305      onLoad: function (hash) {
14306        onLoadjqm(name, hash);
14307      },
14308      onHide: function (hash) {
14309        onHidejqm(name, hash);
14310      },
14311    });
14312  }
14313  // });
14314};
14315
14316window.addEventListener("keydown", function (e) {
14317  if (e.keyCode == 27) {
14318    $(".jqm-init.show").last().jqmHide();
14319
14320    // hide fixed search panel with overlay
14321    if ($(".inline-search-block.show").length) {
14322      $(".inline-search-block").toggleClass("show");
14323      $(".jqmOverlay.search").detach();
14324    }
14325
14326    // hide already visible search results
14327    $('.title-search-result').hide();
14328
14329    // unfocus title.search input
14330    $('.search .search-input').trigger('blur');
14331
14332    $(".mega_fixed_menu").fadeOut(animationTime);
14333  }
14334});
14335
14336if (!funcDefined("scroll_block")) {
14337  function scroll_block(block, clickedItem) {
14338    if (block.length) {
14339      if (clickedItem !== undefined && clickedItem.length) {
14340        clickedItem.trigger("click");
14341      } else {
14342        $(".prices_tab").addClass("active").siblings().removeClass("active");
14343        if ($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length) {
14344          var item = $(".prices_tab .opener").first();
14345          item.find(".opener_icon").addClass("opened");
14346          item.parents("tr").addClass("nb");
14347          item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
14348        }
14349      }
14350      var topPos = block.offset().top,
14351        headerH = $("header").outerHeight(true, true);
14352
14353      $("html,body").animate({ scrollTop: topPos - 88 }, 150);
14354    }
14355  }
14356}
14357
14358if (!funcDefined("jqmEd")) {
14359  var jqmEd = function (name, form_id, open_trigger, requestData, selector, requestTitle, isButton, thButton) {
14360    if (typeof requestData == "undefined") {
14361      requestData = "";
14362    }
14363    if (typeof selector == "undefined") {
14364      selector = false;
14365    }
14366    $("body #popup_iframe_wrapper")
14367      .find("." + name + "_frame")
14368      .remove();
14369    $("body #popup_iframe_wrapper").append('<div class="' + name + '_frame jqmWindow popup"></div>');
14370    if (typeof open_trigger == "undefined") {
14371      $("." + name + "_frame").jqm({
14372        trigger: "." + name + "_frame.popup",
14373        onHide: function (hash) {
14374          onHidejqm(name, hash);
14375        },
14376        onLoad: function (hash) {
14377          onLoadjqm(name, hash, requestData, selector);
14378        },
14379        ajax:
14380          arAsproOptions["SITE_DIR"] +
14381          "ajax/form.php?form_id=" +
14382          form_id +
14383          (requestData.length ? "&" + requestData : ""),
14384      });
14385    } else {
14386      if (name == "enter") {
14387        $("." + name + "_frame").jqm({
14388          trigger: open_trigger,
14389          onHide: function (hash) {
14390            onHidejqm(name, hash);
14391          },
14392          onLoad: function (hash) {
14393            onLoadjqm(name, hash, requestData, selector);
14394          },
14395          ajax: arAsproOptions["SITE_DIR"] + "ajax/auth.php",
14396        });
14397      } else if (name == "basket_error") {
14398        $("." + name + "_frame").jqm({
14399          trigger: open_trigger,
14400          onHide: function (hash) {
14401            onHidejqm(name, hash);
14402          },
14403          onLoad: function (hash) {
14404            onLoadjqm(name, hash, requestData, selector, requestTitle, isButton, thButton);
14405          },
14406          ajax: arAsproOptions["SITE_DIR"] + "ajax/basket_error.php",
14407        });
14408      } else {
14409        $("." + name + "_frame").jqm({
14410          trigger: open_trigger,
14411          onHide: function (hash) {
14412            onHidejqm(name, hash);
14413          },
14414          onLoad: function (hash) {
14415            onLoadjqm(name, hash, requestData, selector);
14416          },
14417          ajax:
14418            arAsproOptions["SITE_DIR"] +
14419            "ajax/form.php?form_id=" +
14420            form_id +
14421            (requestData.length ? "&" + requestData : ""),
14422        });
14423      }
14424      $(open_trigger).dblclick(function () {
14425        return false;
14426      });
14427    }
14428    return true;
14429  };
14430}
14431
14432if (!funcDefined("replaceBasketPopup")) {
14433  function replaceBasketPopup(hash) {
14434    if (typeof hash != "undefined") {
14435      hash.w.hide();
14436      hash.o.hide();
14437    }
14438  }
14439}
14440
14441if (!funcDefined("waitLayer")) {
14442  function waitLayer(delay, callback) {
14443    if (typeof dataLayer !== "undefined" && typeof callback === "function") {
14444      callback();
14445    } else {
14446      setTimeout(function () {
14447        waitLayer(delay, callback);
14448      }, delay);
14449    }
14450  }
14451}
14452
14453if (!funcDefined("checkCounters")) {
14454  function checkCounters(name) {
14455    if (typeof name !== "undefined") {
14456      if (
14457        name == "google" &&
14458        arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" &&
14459        arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0
14460      ) {
14461        return true;
14462      } else if (
14463        name == "yandex" &&
14464        arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" &&
14465        arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0
14466      ) {
14467        return true;
14468      } else {
14469        return false;
14470      }
14471    } else if (
14472      (arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0) ||
14473      (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)
14474    ) {
14475      return true;
14476    } else {
14477      return false;
14478    }
14479  }
14480}
14481
14482if (!funcDefined("addBasketCounter")) {
14483  function addBasketCounter(id, count) {
14484    if (arAsproOptions["COUNTERS"]["USE_BASKET_GOALS"] !== "N") {
14485      var eventdata = { goal: "goal_basket_add", params: { id: id } };
14486      BX.onCustomEvent("onCounterGoals", [eventdata]);
14487    }
14488    if (checkCounters()) {
14489      $.ajax({
14490        url: arAsproOptions["SITE_DIR"] + "ajax/goals.php",
14491        dataType: "json",
14492        type: "POST",
14493        data: { ID: id, TYPE: "addBasket" },
14494        success: function (item) {
14495          if (!!item && !!item.ID) {
14496            let ecommerce = {
14497              items: [
14498                {
14499                  item_name: item.NAME, // Name or ID is required.
14500                  item_id: item.ID,
14501                  price: parseFloat(item.PRICE),
14502                  item_brand: item.BRAND,
14503                  item_category: item.CATEGORY,
14504                  item_list_name: "List Results",
14505                  item_list_id: item.IBLOCK_SECTION_ID,
14506                  affiliation: item.SHOP_NAME,
14507                  index: 1,
14508                  quantity: parseFloat(item.QUANTITY),
14509                },
14510              ],
14511            };
14512            if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") {
14513              ecommerce = {
14514                currencyCode: item.CURRENCY,
14515                add: {
14516                  products: [
14517                    {
14518                      id: item.ID,
14519                      name: item.NAME,
14520                      price: parseFloat(item.PRICE),
14521                      brand: item.BRAND,
14522                      category: item.CATEGORY,
14523                      quantity: parseFloat(item.QUANTITY),
14524                    },
14525                  ],
14526                },
14527              };
14528            } else {
14529              if (arAsproOptions["COUNTERS"]["GA_VERSION"] === 'v4') {
14530                console.log(item);
14531
14532              }
14533            }
14534            waitLayer(100, function () {
14535              dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
14536              dataLayer.push({
14537                // event: 'add_to_cart',
14538                event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["ADD2BASKET"],
14539                currency: item.CURRENCY,
14540                value: parseFloat(item.PRICE),
14541                ecommerce: ecommerce,
14542              });
14543            });
14544          }
14545        },
14546      });
14547    }
14548  }
14549}
14550
14551if (!funcDefined("purchaseCounter")) {
14552  function purchaseCounter(order_id, type, callback) {
14553    if (checkCounters()) {
14554      $.ajax({
14555        url: arAsproOptions["SITE_DIR"] + "ajax/goals.php",
14556        dataType: "json",
14557        type: "POST",
14558        data: { ORDER_ID: order_id, TYPE: type },
14559        success: function (order) {
14560          var products = [];
14561          const items = [];
14562          if (order.ITEMS) {
14563            for (var i in order.ITEMS) {
14564              products.push({
14565                id: order.ITEMS[i].ID,
14566                sku: order.ITEMS[i].ID,
14567                name: order.ITEMS[i].NAME,
14568                price: order.ITEMS[i].PRICE,
14569                brand: order.ITEMS[i].BRAND,
14570                category: order.ITEMS[i].CATEGORY,
14571                quantity: order.ITEMS[i].QUANTITY,
14572              });
14573              items.push({
14574                item_id: order.ITEMS[i].ID,
14575                item_name: order.ITEMS[i].NAME,
14576                price: parseFloat(order.ITEMS[i].PRICE),
14577                item_brand: order.ITEMS[i].BRAND,
14578                item_category: order.ITEMS[i].CATEGORY,
14579                affiliation: order.SHOP_NAME,
14580                quantity: parseFloat(order.ITEMS[i].QUANTITY),
14581              });
14582            }
14583          }
14584          if (order.ID) {
14585            let ecommerce = {
14586              transaction_id: order.ACCOUNT_NUMBER,
14587              affiliation: order.SHOP_NAME,
14588              value: order.PRICE,
14589              tax: order.TAX_VALUE,
14590              shipping: order.PRICE_DELIVERY,
14591              currency: order.CURRENCY,
14592              items: items,
14593            };
14594            if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") {
14595              ecommerce = {
14596                purchase: {
14597                  actionField: {
14598                    id: order.ACCOUNT_NUMBER,
14599                    shipping: order.PRICE_DELIVERY,
14600                    tax: order.TAX_VALUE,
14601                    list: type,
14602                    revenue: order.PRICE,
14603                  },
14604                  products: products,
14605                },
14606              };
14607            }
14608            waitLayer(100, function () {
14609              dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
14610              dataLayer.push({
14611                event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["PURCHASE"],
14612                ecommerce: ecommerce,
14613              });
14614
14615              if (typeof callback !== "undefined") {
14616                callback(ecommerce);
14617              }
14618            });
14619          } else {
14620            if (typeof callback !== "undefined") {
14621              callback();
14622            }
14623          }
14624        },
14625        error: function () {
14626          if (typeof callback !== "undefined") {
14627            callback();
14628          }
14629        },
14630      });
14631    }
14632  }
14633}
14634
14635if (!funcDefined("viewItemCounter")) {
14636  function viewItemCounter(id, price_id) {
14637    if (checkCounters()) {
14638      $.ajax({
14639        url: arAsproOptions["SITE_DIR"] + "ajax/goals.php",
14640        dataType: "json",
14641        type: "POST",
14642        data: { PRODUCT_ID: id, PRICE_ID: price_id },
14643        success: function (item) {
14644          if (item.ID) {
14645            let ecommerce = {
14646              items: [
14647                {
14648                  item_name: item.NAME, // Name or ID is required.
14649                  item_id: item.ID,
14650                  price: parseFloat(item.PRICE),
14651                  item_brand: item.BRAND,
14652                  item_category: item.CATEGORY,
14653                  item_list_name: "List Results",
14654                  item_list_id: item.IBLOCK_SECTION_ID,
14655                  affiliation: item.SHOP_NAME,
14656                  index: 1,
14657                  quantity: parseFloat(item.QUANTITY),
14658                },
14659              ],
14660            };
14661            if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") {
14662              ecommerce = {
14663                detail: {
14664                  products: [
14665                    {
14666                      id: item.ID,
14667                      name: item.NAME,
14668                      price: parseFloat(item.PRICE),
14669                      brand: item.BRAND,
14670                      category: item.CATEGORY,
14671                    },
14672                  ],
14673                },
14674              };
14675            }
14676            waitLayer(100, function () {
14677              dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
14678              dataLayer.push({
14679                event: "view_item",
14680                currency: item.CURRENCY,
14681                value: parseFloat(item.PRICE),
14682                ecommerce: ecommerce,
14683              });
14684            });
14685          }
14686        },
14687      });
14688    }
14689  }
14690}
14691
14692if (!funcDefined("checkoutCounter")) {
14693  function checkoutCounter(step, option, callback) {
14694    if (checkCounters("google")) {
14695
14696      var itemsBasket = [];
14697      for (var key in BX.Sale.BasketComponent.items) {
14698        if (!BX.Sale.BasketComponent.items[key].DELAYED) {
14699          var variant = '';
14700          if (BX.Sale.BasketComponent.items[key].PROPS_ALL.IM_OBYEM) {
14701            variant = BX.Sale.BasketComponent.items[key].PROPS_ALL.IM_OBYEM.VALUE;
14702          }
14703          var itemBasket = {
14704            item_id: BX.Sale.BasketComponent.items[key].PRODUCT_ID,
14705            item_name: BX.Sale.BasketComponent.items[key].PRODUCT_ID,
14706            coupon: BX.Sale.BasketComponent.items[key].DISCOUNT_COUPON,
14707            discount: BX.Sale.BasketComponent.items[key].FULL_PRICE - BX.Sale.BasketComponent.items[key].PRICE,
14708            item_variant: variant,
14709            item_brand: 'Janssen Cosmetics',
14710            price: BX.Sale.BasketComponent.items[key].FULL_PRICE,
14711            quantity: BX.Sale.BasketComponent.items[key].QUANTITY
14712          };
14713          itemsBasket.push(itemBasket);
14714        }
14715      }
14716
14717
14718      $.ajax({
14719        url: arAsproOptions["SITE_DIR"] + "ajax/goals.php",
14720        dataType: "json",
14721        type: "POST",
14722        data: { BASKET: "Y" },
14723        success: function (basket) {
14724          var products = [];
14725          const items = [];
14726          let summ = 0;
14727          let currency = "RUB";
14728          if (basket.ITEMS) {
14729            for (var i in basket.ITEMS) {
14730              products.push({
14731                id: basket.ITEMS[i].ID,
14732                name: basket.ITEMS[i].NAME,
14733                price: basket.ITEMS[i].PRICE,
14734                brand: basket.ITEMS[i].BRAND,
14735                category: basket.ITEMS[i].CATEGORY,
14736                quantity: basket.ITEMS[i].QUANTITY,
14737              });
14738              items.push({
14739                item_id: basket.ITEMS[i].ID,
14740                item_name: basket.ITEMS[i].NAME,
14741                price: parseFloat(basket.ITEMS[i].PRICE),
14742                item_brand: basket.ITEMS[i].BRAND,
14743                item_category: basket.ITEMS[i].CATEGORY,
14744                affiliation: basket.SHOP_NAME,
14745                quantity: parseFloat(basket.ITEMS[i].QUANTITY),
14746              });
14747              summ += basket.ITEMS[i].PRICE;
14748              currency = basket.ITEMS[i].CURRENCY;
14749            }
14750          }
14751          if (products) {
14752            let ecommerce = {
14753              items: items,
14754            };
14755            if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") {
14756              ecommerce = {
14757                checkout: {
14758                  actionField: {
14759                    step: step,
14760                    option: option,
14761                  },
14762                  products: products,
14763                },
14764              };
14765            }
14766            waitLayer(100, function () {
14767              dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
14768              dataLayer.push({
14769                event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["CHECKOUT_ORDER"],
14770                currency: currency,
14771                value: parseFloat(summ),
14772                ecommerce: ecommerce,
14773                /*"eventCallback": function() {
14774                    if((typeof callback !== 'undefined') && (typeof callback === 'function')){
14775                      callback();
14776                    }
14777                 }*/
14778              });
14779              if (typeof callback !== "undefined" && typeof callback === "function") {
14780                callback();
14781              }
14782            });
14783          }
14784        },
14785      });
14786    }
14787  }
14788}
14789
14790if (!funcDefined("delFromBasketCounter")) {
14791  function delFromBasketCounter(id, callback) {
14792    if (checkCounters()) {
14793      $.ajax({
14794        url: arAsproOptions["SITE_DIR"] + "ajax/goals.php",
14795        dataType: "json",
14796        type: "POST",
14797        data: { ID: id },
14798        success: function (item) {
14799          if (item.ID) {
14800            let ecommerce = {
14801              items: [
14802                {
14803                  item_name: item.NAME, // Name or ID is required.
14804                  item_id: item.ID,
14805                  price: parseFloat(item.PRICE),
14806                  item_brand: item.BRAND,
14807                  item_category: item.CATEGORY,
14808                  affiliation: item.SHOP_NAME,
14809                  item_list_name: "List Results",
14810                },
14811              ],
14812            };
14813            if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") {
14814              ecommerce = {
14815                remove: {
14816                  products: [
14817                    {
14818                      id: item.ID,
14819                      name: item.NAME,
14820                      category: item.CATEGORY,
14821                    },
14822                  ],
14823                },
14824              };
14825            }
14826            waitLayer(100, function () {
14827              dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
14828              dataLayer.push({
14829                event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["REMOVE_BASKET"],
14830                currency: item.CURRENCY,
14831                value: parseFloat(item.PRICE),
14832                ecommerce: ecommerce,
14833              });
14834              if (typeof callback == "function") {
14835                callback();
14836              }
14837            });
14838          }
14839        },
14840      });
14841    }
14842  }
14843}
14844
14845if (!funcDefined("setHeightCompany")) {
14846  function setHeightCompany() {
14847    $(".md-50.img").height($(".md-50.big").outerHeight() - 35);
14848  }
14849}
14850
14851if (!funcDefined("initSly")) {
14852  function initSly() {
14853    /*var $frame  = $(document).find('.frame');
14854    var $slidee = $frame.children('ul').eq(0);
14855    var $wrap   = $frame.parent();
14856
14857    if(arAsproOptions["PAGES"]["CATALOG_PAGE"] && $frame.length){
14858      $frame.sly({
14859        horizontal: 1,
14860        itemNav: 'basic',
14861        smart: 1,
14862        mouseDragging: 0,
14863        touchDragging: 0,
14864        releaseSwing: 0,
14865        startAt: 0,
14866        scrollBar: $wrap.find('.scrollbar'),
14867        scrollBy: 1,
14868        speed: 300,
14869        elasticBounds: 0,
14870        easing: 'swing',
14871        dragHandle: 1,
14872        dynamicHandle: 1,
14873        clickBar: 1,
14874
14875        // Buttons
14876        forward: $wrap.find('.forward'),
14877        backward: $wrap.find('.backward'),
14878      });
14879      $frame.sly('reload');
14880    }*/
14881  }
14882}
14883
14884if (!funcDefined("createTableCompare")) {
14885  function createTableCompare(originalTable, appendDiv, cloneTable) {
14886    try {
14887      var clone = originalTable.clone().removeAttr("id").addClass("clone");
14888      if (cloneTable.length) {
14889        cloneTable.remove();
14890        appendDiv.html("");
14891        appendDiv.html(clone);
14892      } else {
14893        appendDiv.append(clone);
14894      }
14895    } catch (e) {
14896    } finally {
14897    }
14898  }
14899}
14900
14901if (!funcDefined("fillBasketPropsExt")) {
14902  fillBasketPropsExt = function (that, prop_code, basket_prop_div) {
14903    var i = 0,
14904      propCollection = null,
14905      foundValues = false,
14906      basketParams = {},
14907      obBasketProps = null;
14907
14908
14909    obBasketProps = BX(basket_prop_div);
14910    if (!obBasketProps && that.closest(".item").find(".basket_props_block").length && that.data("offers") !== "Y")
14911      obBasketProps = that.closest(".item").find(".basket_props_block")[0];
14912
14913    if (!!obBasketProps) {
14914      propCollection = obBasketProps.getElementsByTagName("select");
14915      if (!!propCollection && !!propCollection.length) {
14916        for (i = 0; i < propCollection.length; i++) {
14917          if (!propCollection[i].disabled) {
14918            switch (propCollection[i].type.toLowerCase()) {
14919              case "select-one":
14920                basketParams[propCollection[i].name] = propCollection[i].value;
14921                foundValues = true;
14922                break;
14923              default:
14924                break;
14925            }
14926          }
14927        }
14928      }
14929      propCollection = obBasketProps.getElementsByTagName("input");
14930      if (!!propCollection && !!propCollection.length) {
14931        for (i = 0; i < propCollection.length; i++) {
14932          if (!propCollection[i].disabled) {
14933            switch (propCollection[i].type.toLowerCase()) {
14934              case "hidden":
14935                basketParams[propCollection[i].name] = propCollection[i].value;
14936                foundValues = true;
14937                break;
14938              case "radio":
14939                if (propCollection[i].checked) {
14940                  basketParams[propCollection[i].name] = propCollection[i].value;
14941                  foundValues = true;
14942                }
14943                break;
14944              default:
14945                break;
14946            }
14947          }
14948        }
14949      }
14950    }
14951    if (!foundValues) {
14952      basketParams[prop_code] = [];
14953      basketParams[prop_code][0] = 0;
14954    }
14955    return basketParams;
14956  };
14957}
14958if (!funcDefined("showBasketError")) {
14959  showBasketError = function (mess, title, addButton, th, callback) {
14960    var title_set = title ? title : BX.message("ERROR_BASKET_TITLE"),
14961      isButton = "N",
14962      thButton = "";
14963    if (typeof addButton !== undefined) {
14964      isButton = "Y";
14965    }
14966    if (typeof th !== undefined) {
14967      thButton = th;
14968    }
14969    $("body").append("<span class='add-error-bakset' style='display:none;'></span>");
14970    jqmEd("basket_error", "error-bakset", ".add-error-bakset", mess, this, title_set, isButton, thButton);
14971    $("body .add-error-bakset").click();
14972    $("body .add-error-bakset").remove();
14973
14974    if (typeof callback === "function") {
14975      callback();
14976    }
14977  };
14978}
14979
14980CheckTopVisibleMenu = function (that) {
14981  var dropdownMenu = $(".dropdown-menu:visible");
14982  if (that !== undefined) {
14983    dropdownMenu.push(that);
14984  }
14985
14986  if (dropdownMenu.length) {
14987    dropdownMenu.each(function (i, el) {
14988      var dropdownMenuCurrent = $(el);
14989      dropdownMenuCurrent.find("a").css("white-space", "");
14990      dropdownMenuCurrent.css("left", "");
14991      dropdownMenuCurrent.css("right", "");
14992      dropdownMenuCurrent.removeClass("toright");
14993
14994      var dropdownMenuCurrent_left = dropdownMenuCurrent.offset().left;
14995
14996      if (typeof dropdownMenuCurrent_left != "undefined") {
14997        var menu = dropdownMenuCurrent.parents(".mega-menu");
14998        if (!menu.length) menu = dropdownMenuCurrent.closest(".logo-row");
14999        var menu_width = menu.outerWidth();
15000        var menu_left = menu.offset().left;
15001        var menu_right = menu_left + menu_width;
15002        var isToRight = dropdownMenuCurrent.parents(".toright").length > 0;
15003        var parentsdropdownMenuCurrents = dropdownMenuCurrent.parents(".dropdown-menu");
15004        var isHasParentdropdownMenuCurrent = parentsdropdownMenuCurrents.length > 0;
15005        if (isHasParentdropdownMenuCurrent) {
15006          var parentdropdownMenuCurrent_width = parentsdropdownMenuCurrents.first().outerWidth();
15007          var parentdropdownMenuCurrent_left = parentsdropdownMenuCurrents.first().offset().left;
15008          var parentdropdownMenuCurrent_right = parentdropdownMenuCurrent_width + parentdropdownMenuCurrent_left;
15009        }
15010
15011        if (parentdropdownMenuCurrent_right + dropdownMenuCurrent.outerWidth() > menu_right) {
15012          dropdownMenuCurrent.find("a").css("white-space", "normal");
15013        }
15014
15015        var dropdownMenuCurrent_width = dropdownMenuCurrent.outerWidth();
15016        var dropdownMenuCurrent_right = dropdownMenuCurrent_left + dropdownMenuCurrent_width;
15017
15018        if (dropdownMenuCurrent_right > menu_right || isToRight) {
15019          var addleft = 0;
15020          addleft = menu_right - dropdownMenuCurrent_right;
15021          if (isHasParentdropdownMenuCurrent || isToRight) {
15022            dropdownMenuCurrent.css("left", "auto");
15023            dropdownMenuCurrent.css("right", "100%");
15024            dropdownMenuCurrent.addClass("toright");
15025          } else {
15026            var dropdownMenuCurrent_curLeft = parseInt(dropdownMenuCurrent.css("left"));
15027            dropdownMenuCurrent.css("left", dropdownMenuCurrent_curLeft + addleft + "px");
15028          }
15029        }
15030      }
15031    });
15032  }
15033};
15034
15035if (!funcDefined("isRealValue")) {
15036  function isRealValue(obj) {
15037    return obj && obj !== "null" && obj !== "undefined";
15038  }
15039}
15040
15041if (!funcDefined("rightScroll")) {
15042  function rightScroll(prop, id) {
15043    var el = BX("prop_" + prop + "_" + id);
15044    if (el) {
15045      var curVal = parseInt(el.style.marginLeft);
15046      if (curVal >= 0) el.style.marginLeft = curVal - 20 + "%";
15047    }
15048  }
15049}
15050
15051if (!funcDefined("leftScroll")) {
15052  function leftScroll(prop, id) {
15053    var el = BX("prop_" + prop + "_" + id);
15054    if (el) {
15055      var curVal = parseInt(el.style.marginLeft);
15056      if (curVal < 0) el.style.marginLeft = curVal + 20 + "%";
15057    }
15058  }
15059}
15060
15061if (!funcDefined("InitOrderCustom")) {
15062  InitOrderCustom = function () {
15063    $(".ps_logo img").wrap('<div class="image"></div>');
15064
15065    $("#bx-soa-order .radio-inline").each(function () {
15066      if ($(this).find("input").attr("checked") == "checked") {
15067        $(this).addClass("checked");
15068      }
15069    });
15070
15071    $("#bx-soa-order .checkbox input[type=checkbox]").each(function () {
15072      if ($(this).attr("checked") == "checked") $(this).parent().addClass("checked");
15073    });
15074
15075    $("#bx-soa-order .bx-authform-starrequired").each(function () {
15076      var html = $(this).html();
15077      $(this)
15078        .closest("label")
15079        .append('<span class="bx-authform-starrequired"> ' + html + "</span>");
15080      $(this).detach();
15081    });
15082    $(".bx_ordercart_coupon").each(function () {
15083      if ($(this).find(".bad").length) $(this).addClass("bad");
15084      else if ($(this).find(".good").length) $(this).addClass("good");
15085    });
15086    /*if (typeof(propsMap) !== 'undefined') {
15087      $(propsMap).on('click', function () {
15088        var value = $('#orderDescription').val();
15089        if ($('#orderDescription')) {
15090          if (value != '') {
15091            $('#orderDescription').closest('.form-group').addClass('value_y');
15092          }
15093        }
15094      });
15095    }*/
15096  };
15097}
15098
15099if (!funcDefined("InitLabelAnimation")) {
15100  InitLabelAnimation = function (className) {
15101    // Fix order labels
15102    if (!$(className).length) {
15103      return;
15104    }
15105    $(className)
15106      .find(".form-group")
15107      .each(function () {
15108        if (
15109          $(this).find("input[type=text], textarea").length &&
15110          !$(this).find(".dropdown-block").length &&
15111          $(this).find("input[type=text], textarea").val() != ""
15112        ) {
15113          $(this).addClass("value_y");
15114        }
15115      });
15116
15117    $(document).on("click", className + " .form-group:not(.bx-soa-pp-field) label", function () {
15118      $(this).parent().find("input, textarea").focus();
15119    });
15120
15121    $(document).on(
15122      "focusout",
15123      className +
15124      " .form-group:not(.bx-soa-pp-field) input, " +
15125      className +
15126      " .form-group:not(.bx-soa-pp-field) textarea",
15127      function () {
15128        var value = $(this).val();
15129        if (
15130          value != "" &&
15131          !$(this).closest(".form-group").find(".dropdown-block").length &&
15132          !$(this).closest(".form-group").find("#profile_change").length
15133        ) {
15134          $(this).closest(".form-group").addClass("value_y");
15135        } else {
15136          $(this).closest(".form-group").removeClass("value_y");
15137        }
15138      }
15139    );
15140
15141    $(document).on(
15142      "focus",
15143      className +
15144      " .form-group:not(.bx-soa-pp-field) input, " +
15145      className +
15146      " .form-group:not(.bx-soa-pp-field) textarea",
15147      function () {
15148        if (
15149          !$(this).closest(".form-group").find(".dropdown-block").length &&
15150          !$(this).closest(".form-group").find("#profile_change").length &&
15151          !$(this).closest(".form-group").find("[name=PERSON_TYPE_OLD]").length
15152        ) {
15153          $(this).closest(".form-group").addClass("value_y");
15154        }
15155      }
15156    );
15157  };
15158}
15159
15160checkPopupWidth = function () {
15161  $(".popup.show").each(function () {
15162    var width_form = $(this).actual("width");
15163    $(this).css({
15164      "margin-left": $(window).width() > width_form ? "-" + width_form / 2 + "px" : "-" + $(window).width() / 2 + "px",
15165    });
15166  });
15167};
15168
15169checkCaptchaWidth = function () {
15170  $(".captcha-row").each(function () {
15171    var width = $(this).actual("width");
15172    if ($(this).hasClass("b")) {
15173      if (width > 320) {
15174        $(this).removeClass("b");
15175      }
15176    } else {
15177      if (width <= 320) {
15178        $(this).addClass("b");
15179      }
15180    }
15181  });
15182};
15183
15184checkFormWidth = function () {
15185  $(".form .form_left").each(function () {
15186    var form = $(this).parents(".form");
15187    var width = form.actual("width");
15188    if (form.hasClass("b")) {
15189      if (width > 417) {
15190        form.removeClass("b");
15191      }
15192    } else {
15193      if (width <= 417) {
15194        form.addClass("b");
15195      }
15196    }
15197  });
15198};
15199
15200checkFormControlWidth = function () {
15201  $(".form-control").each(function () {
15202    var width = $(this).actual("width");
15203    var labelWidth = $(this).find("label:not(.error) > span").actual("width");
15204    var errorWidth = $(this).find("label.error").actual("width");
15205    if (errorWidth > 0) {
15206      if ($(this).hasClass("h")) {
15207        if (width > labelWidth + errorWidth + 5) {
15208          $(this).removeClass("h");
15209        }
15210      } else {
15211        if (width <= labelWidth + errorWidth + 5) {
15212          $(this).addClass("h");
15213        }
15214      }
15215    } else {
15216      $(this).removeClass("h");
15217    }
15218  });
15219};
15220
15221scrollToTop = function () {
15222  if (arAsproOptions["THEME"]["SCROLLTOTOP_TYPE"] !== "NONE") {
15223    var _isScrolling = false;
15224    // Append Button
15225    $("body").append(
15226      $("<a />")
15227        .addClass(
15228          "scroll-to-top " +
15229          arAsproOptions["THEME"]["SCROLLTOTOP_TYPE"] +
15230          " " +
15231          arAsproOptions["THEME"]["SCROLLTOTOP_POSITION"]
15232        )
15233        .attr({ href: "#", id: "scrollToTop" })
15234    );
15235
15236    if (arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"]) {
15237      $("#scrollToTop").css("bottom", +arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"] + "px");
15238    }
15239
15240    if (arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_RIGHT"]) {
15241      $("#scrollToTop").css("right", +arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_RIGHT"] + "px");
15242    }
15243
15244    $("#scrollToTop").click(function (e) {
15245      e.preventDefault();
15246      $("body, html").animate({ scrollTop: 0 }, 500);
15247      return false;
15248    });
15249    // Show/Hide Button on Window Scroll event.
15250    $(window).scroll(function () {
15251      if (!_isScrolling) {
15252        _isScrolling = true;
15253        if ($(window).scrollTop() > 150) {
15254          $("#scrollToTop").stop(true, true).addClass("visible");
15255          _isScrolling = false;
15256        } else {
15257          $("#scrollToTop").stop(true, true).removeClass("visible");
15258          _isScrolling = false;
15259        }
15260        checkScrollToTop();
15261      }
15262    });
15263  }
15264};
15265
15266checkScrollToTop = function () {
15267  if (arAsproOptions["THEME"] && arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"])
15268    var bottom = +arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"];
15269  else var bottom = 55;
15270
15271  var scrollVal = $(window).scrollTop(),
15272    windowHeight = $(window).height(),
15273    footerOffset = 0;
15274  if ($("footer").length) footerOffset = $("footer").offset().top;
15275
15276  if (arAsproOptions["THEME"] && arAsproOptions["THEME"]["SCROLLTOTOP_POSITION"] == "CONTENT") {
15277    warpperWidth = $("body > .wrapper > .wrapper_inner").width();
15278    $("#scrollToTop").css("margin-left", Math.ceil(warpperWidth / 2) + 23);
15279  }
15280
15281  $("#scrollToTop").css("bottom", Math.round(bottom));
15282
15283};
15284
15285CheckObjectsSizes = function () {
15286  $(".container iframe,.container object,.container video").each(function () {
15287    var height_attr = $(this).attr("height");
15288    var width_attr = $(this).attr("width");
15289    if (height_attr && width_attr) {
15290      $(this).css("height", ($(this).outerWidth() * height_attr) / width_attr);
15291    }
15292  });
15293};
15294
15295if (!funcDefined("reloadTopBasket")) {
15296  var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item, sync) {
15297    var obj = {
15298      PARAMS: $("#top_basket_params").val(),
15299      ACTION: action,
15300    };
15301    if (typeof item !== "undefined" && item) {
15302      obj.delete_top_item = "Y";
15303      obj.delete_top_item_id = item.data("id");
15304    }
15305    // $.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){
15306    $.post(
15307      arAsproOptions["SITE_DIR"] + "ajax/show_basket_actual.php",
15308      obj,
15309      $.proxy(function (data) {
15310        $(basketWindow).html(data);
15311
15312        //getActualBasket('', '', sync);
15313
15314        getActualBasket("", "Compare", sync); //need for actual compare count when do opt action
15315
15316        var eventdata = { action: "loadBasket" };
15317        BX.onCustomEvent("onCompleteAction", [eventdata]);
15318
15319        /*if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
15320        if($(window).outerWidth() > 520){
15321          if(slideDown=="Y")
15322            $(basketWindow).find('.basket_popup_wrapp').stop(true,true).slideDown(speed);
15323          clearTimeout(basketTimeoutSlide);
15324          basketTimeoutSlide = setTimeout(function() {
15325            var _this = $('#basket_line').find('.basket_popup_wrapp');
15326            if (_this.is(':hover')) {
15327              _this.show();
15328            }else{
15329              $('#basket_line').find('.basket_popup_wrapp').slideUp(speed);
15330            }
15331          },delay);
15332        }
15333      }*/
15334      })
15335    );
15336  };
15337}
15338
15339CheckTabActive = function () {
15340  if (typeof clicked_tab && clicked_tab) {
15341    if (window.matchMedia("(min-width: 768px)").matches) {
15342      clicked_tab--;
15343      $(".nav.nav-tabs li").each(function () {
15344        if ($(this).index() == clicked_tab) $(this).addClass("active");
15345      });
15346      // $('.nav.nav-tabs li:eq('+clicked_tab+')').addClass('active');
15347      $(".catalog_detail .tab-content .tab-pane:eq(" + clicked_tab 
15347+ ")").addClass("active");
15348      $(".catalog_detail .tab-content .tab-pane .title-tab-heading").next().removeAttr("style");
15349      clicked_tab = 0;
15350    }
15351  }
15352};
15353
15354/*countdown start*/
15355if (!funcDefined("initCountdown")) {
15356  var initCountdown = function initCountdown() {
15357    if ($(".view_sale_block").length) {
15358
15359      $(".view_sale_block").each(function () {
15360        return;
15361        var _this = $(this);
15362        if (_this.hasClass("init-if-visible") && !_this.is(":visible")) return;
15363
15364        var activeTo = _this.find(".active_to").text(),
15365          dateTo = new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1"));
15366        if (_this.hasClass("compact"))
15367          _this.find(".countdown").countdown(
15368            {
15369              until: dateTo,
15370              format: "dHMS",
15371              compact: true,
15372              padZeroes: true,
15373              layout:
15374                '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>',
15375            },
15376            $.countdown.regionalOptions["ru"]
15377          );
15378        else
15379          _this.find(".countdown").countdown(
15380            {
15381              until: dateTo,
15382              format: "dHMS",
15383              padZeroes: true,
15384              layout:
15385                '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>',
15386            },
15387            $.countdown.regionalOptions["ru"]
15388          );
15389      });
15390    }
15391  };
15392}
15393
15394if (!funcDefined("initCountdownTime")) {
15395  var initCountdownTime = function initCountdownTime(block, time) {
15396    if (time) {
15397      var dateTo = new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1"));
15398      block.find(".countdown").countdown("destroy");
15399      if (block.hasClass("compact"))
15400        block.find(".countdown").countdown(
15401          {
15402            until: dateTo,
15403            format: "dHM",
15404            compact: true,
15405            padZeroes: true,
15406            layout:
15407              '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>',
15408          },
15409          $.countdown.regionalOptions["ru"]
15410        );
15411      else
15412        block.find(".countdown").countdown(
15413          {
15414            until: dateTo,
15415            format: "dHMS",
15416            padZeroes: true,
15417            layout:
15418              '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>',
15419          },
15420          $.countdown.regionalOptions["ru"]
15421        );
15422      block.find(".view_sale_block").show();
15423    } else {
15424      block.find(".view_sale_block").hide();
15425    }
15426  };
15427}
15428/*countdown end*/
15429
15430waitCounter = function (idCounter, delay, callback) {
15431  var obCounter = window["yaCounter" + idCounter];
15432  if (typeof obCounter == "object") {
15433    if (typeof callback == "function") callback();
15434  } else {
15435    setTimeout(function () {
15436      waitCounter(idCounter, delay, callback);
15437    }, delay);
15438  }
15439};
15440
15441var isOnceInited = (insertFilter = false);
15442var animationTime = 200;
15443var delayTime = 200;
15444var topMenuEnterTimer = false;
15445var previewMode = window != window.top;
15446var isMobile =
15447  ((jQuery.browser.mobile || previewMode) && window.matchMedia("(max-width:767px)").matches) ||
15448  window.matchMedia("(max-width:400px)").matches;
15449
15450if (isMobile) document.documentElement.className += " mobile";
15451if (previewMode) document.documentElement.className += " previewMode";
15452
15453if (navigator.userAgent.indexOf("Edge") != -1) document.documentElement.className += " bx-ie-edge";
15454
15455/*filter start*/
15456if (!funcDefined("checkVerticalMobileFilter")) {
15457  var checkVerticalMobileFilter = function checkVerticalMobileFilter() {
15458    /*if($('.right_block1.catalog.vertical').length && !$('.left_block.filter_aja
15458x').length)
15459    {
15460      if(typeof window['trackBarOptions'] !== 'undefined')
15461      {
15462        window['trackBarValues'] = {}
15463        for(key in window['trackBarOptions'])
15464        {
15465          window['trackBarValues'][key] = {
15466            'leftPercent': window['trackBar' + key].leftPercent,
15467            'leftValue': window['trackBar' + key].minInput.value,
15468            'rightPercent': window['trackBar' + key].rightPercent,
15469            'rightValue': window['trackBar' + key].maxInput.value,
15470          }
15471        }
15472      }
15473
15474      if(window.matchMedia('(max-width: 991px)').matches)
15475      {
15476        if(!insertFilter)
15477        {
15478          $('.js_filter .bx_filter.bx_filter_vertical').html($('.left_block .bx_filter.bx_filter_vertical').html());
15479          $('.left_block .bx_filter.bx_filter_vertical .bx_filter_section').remove();
15480          insertFilter=true;
15481        }
15482      }
15483      else
15484      {
15485        if(insertFilter)
15486        {
15487          $('.left_block .bx_filter.bx_filter_vertical').html($('.js_filter .bx_filter.bx_filter_vertical').html());
15488          $('.js_filter .bx_filter.bx_filter_vertical .bx_filter_section').remove();
15489          insertFilter=false;
15490        }
15491      }
15492
15493      if(typeof window['trackBarOptions'] !== 'undefined')
15494      {
15495        for(key in window['trackBarOptions'])
15496        {
15497          window['trackBarOptions'][key].leftPercent = window['trackBarValues'][key].leftPercent;
15498          window['trackBarOptions'][key].rightPercent = window['trackBarValues'][key].rightPercent;
15499          window['trackBarOptions'][key].curMinPrice = window['trackBarValues'][key].leftValue;
15500          window['trackBarOptions'][key].curMaxPrice = window['trackBarValues'][key].rightValue;
15501          window['trackBar' + key] = new BX.Iblock.SmartFilter(window['trackBarOptions'][key]);
15502          window['trackBar' + key].minInput.value = window['trackBarValues'][key].leftValue;
15503          window['trackBar' + key].maxInput.value = window['trackBarValues'][key].rightValue;
15504        }
15505      }
15506    }
15507    else if($('.visible_mobile_filter').length)
15508    {
15509      var posTopBlock = BX.pos($('.detail.partners')[0]),
15510        posBlock = $('.ajax_load').position();
15511      // $('.visible_mobile_filter').css('top', posBottomBlock.top-posTopBlock.top);
15512      $('.visible_mobile_filter').css('top', posBlock.top);
15513
15514    }*/
15515  };
15516}
15517/*filter end*/
15518
15519// ONE CLICK
15520if (!funcDefined("oneClickBuy")) {
15521  var oneClickBuy = function (elementID, iblockID, that) {
15522    var name = "one_click_buy";
15523    var elementQuantity = 1;
15524    var offerProps = false;
15525    var buy_btn = $(that).closest(".buy_block").find(".to-cart");
15526    var buy_btn2 = $(that).closest("tr").find(".to-cart");
15527    var buy_btn3 = $(that).closest('.item').find('.to-cart');
15528    debugger
15529
15530    if (typeof that !== "undefined") {
15531      elementQuantity = $(that).attr("data-quantity");
15532      offerProps = $(that).attr("data-props");
15533    }
15534
15535    if (elementQuantity < 0) {
15536      elementQuantity = 1;
15537    }
15538
15539    var tmp_props = buy_btn.data("props") || buy_btn2.data("props") || buy_btn3.data("props"),
15540      props = "",
15541      part_props = "",
15542      add_props = "N",
15543      fill_prop = {},
15544      iblockid = buy_btn.data("iblockid"),
15545      item = buy_btn.attr("data-item");
15546
15547    if (tmp_props) {
15548      props = tmp_props.split(";");
15549    }
15550    if (buy_btn.data("part_props")) {
15551      part_props = buy_btn.data("part_props");
15552    }
15553    if (buy_btn.data("add_props")) {
15554      add_props = buy_btn.data("add_props");
15555    }
15556
15557    fill_prop = fillBasketPropsExt(buy_btn, "prop", buy_btn.data("bakset_div"));
15558    fill_prop.iblockID = iblockid;
15559    fill_prop.part_props = part_props;
15560    fill_prop.add_props = add_props;
15561    fill_prop.props = JSON.stringify(props);
15562    fill_prop.item = item;
15563    fill_prop.ocb_item = "Y";
15564
15565    // if (!isMobile) {
15566    if (!$(that).hasClass("clicked")) {
15567      $(that).addClass("clicked");
15568      $("body")
15569        .find("." + name + "_frame")
15570        .remove();
15571      $("body")
15572        .find("." + name + "_trigger")
15573        .remove();
15574      $("body #popup_iframe_wrapper").append('<div class="' + name + '_frame popup"></div>');
15575      $("body #popup_iframe_wrapper").append('<div class="' + name + '_trigger"></div>');
15576      $("." + name + "_frame").jqm({
15577        trigger: "." + name + "_trigger",
15578        onHide: function (hash) {
15579          onHidejqm(name, hash);
15580        },
15581        toTop: false,
15582        onLoad: function (hash) {
15583          onLoadjqm(name, hash);
15584        },
15585        ajax:
15586          arAsproOptions["SITE_DIR"] +
15587          "ajax/one_click_buy.php?ELEMENT_ID=" +
15588          item +
15589          "&IBLOCK_ID=" +
15590          iblockid +
15591          "&ELEMENT_QUANTITY=" +
15592          elementQuantity +
15593          "&OFFER_PROPS=" +
15594          fill_prop.props,
15595      });
15596      $("." + name + "_trigger").click();
15597    }
15598    // } else {
15599    //   var script = arAsproOptions["SITE_DIR"] + "form/";
15600    //   script +=
15601    //     "?name=" +
15602    //     name +
15603    //     "&form_id=ocb&path=" +
15604    //     window.location.pathname +
15605    //     "&ELEMENT_ID=" +
15606    //     elementID +
15607    //     "&IBLOCK_ID=" +
15608    //     iblockID +
15609    //     "&ELEMENT_QUANTITY=" +
15610    //     elementQuantity +
15611    //     "&OFFER_PROPS=" +
15612    //     fill_prop.props;
15613    //   location.href = script;
15614    // }
15615  };
15616}
15617
15618if (!funcDefined("oneClickBuyBasket")) {
15619  var oneClickBuyBasket = function () {
15620    name = "one_click_buy_basket";
15621    if (true) { //!isMobile
15622      if (!$(".fast_order").hasClass("clicked")) {
15623        $(".fast_order").addClass("clicked");
15624        $("body")
15625          .find("." + name + "_frame")
15626          .remove();
15627        $("body")
15628          .find("." + name + "_trigger")
15629          .remove();
15630        $("body #popup_iframe_wrapper").append('<div class="' + name + '_frame popup"></div>');
15631        $("body #popup_iframe_wrapper").append('<div class="' + name + '_trigger"></div>');
15632        $("." + name + "_frame").jqm({
15633          trigger: "." + name + "_trigger",
15634          onHide: function (hash) {
15635            onHidejqm(name, hash);
15636          },
15637          onLoad: function (hash) {
15638            onLoadjqm(name, hash);
15639          },
15640          ajax: arAsproOptions["SITE_DIR"] + "ajax/one_click_buy_basket.php",
15641        });
15642        $("." + name + "_trigger").click();
15643      }
15644    } else {
15645      var script = arAsproOptions["SITE_DIR"] + "form/";
15646      script += "?name=" + name + "&form_id=ocb&path=" + window.location.pathname + "&buy_basket=y";
15647      location.href = script;
15648    }
15649  };
15650}
15651
15652// TOP MENU ANIMATION
15653$(document).on("click", ".menu_top_block>li .more a", function () {
15654  $this = $(this);
15655  $this.parents(".dropdown").first().find(">.hidden").removeClass("hidden");
15656  $this.parent().addClass("hidden");
15657  setTimeout(function () {
15658    $this.parent().remove();
15659  }, 500);
15660});
15661
15662$(document).on("mouseenter", ".menu_top_block.catalogfirst>li>.dropdown>li.full", function () {
15663  var $submenu = $(this).find(">.dropdown");
15664
15665  if ($submenu.length) {
15666    if (topMenuEnterTimer) {
15667      clearTimeout(topMenuEnterTimer);
15668      topMenuEnterTimer = false;
15669    }
15670  }
15671});
15672
15673$(document).on("mouseenter", ".menu_top_block>li:not(.full)", function () {
15674  var $submenu = $(this).find(">.dropdown");
15675
15676  if ($submenu.length && !$submenu.hasClass("visible")) {
15677    var $menu = $(this).parents(".menu");
15678    var $wrapmenu = $menu.parents(".wrap_menu");
15679    var wrapMenuWidth = $wrapmenu.actual("outerWidth");
15680    var wrapMenuLeft = $wrapmenu.offset().left;
15681    var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
15682    var left = wrapMenuRight - ($(this).offset().left + $submenu.actual("outerWidth"));
15683    if (
15684      window.matchMedia("(min-width: 951px)").matches &&
15685      $(this).hasClass("catalog") &&
15686      ($(".banner_auto").hasClass("catalog_page") || $(".banner_auto").hasClass("front_page"))
15687    ) {
15688      return;
15689    }
15690    if (left < 0) {
15691      $submenu.css({ left: left + "px" });
15692    }
15693    $submenu.stop().slideDown(animationTime, function () {
15694      $submenu.css({ height: "", overflow: "visible" });
15695    });
15696
15697    $(this).on("mouseleave", function () {
15698      var leaveTimer = setTimeout(function () {
15699        $submenu.stop().slideUp(animationTime, function () {
15700          $submenu.css({ left: "" });
15701        });
15702      }, delayTime);
15703
15704      $(this).on("mouseenter", function () {
15705        if (leaveTimer) {
15706          clearTimeout(leaveTimer);
15707          leaveTimer = false;
15708        }
15709      });
15710    });
15711  }
15712});
15713
15714$(document).on("mouseenter", ".menu_top_block>li .dropdown>li", function () {
15715  var $this = $(this);
15716  var $submenu = $this.find(">.dropdown");
15717
15718  if (
15719    $submenu.length &&
15720    ((!$this.parents(".full").length && !$this.hasClass("full")) || $this.parents(".more").length)
15721  ) {
15722    var $menu = $this.parents(".menu");
15723    var $wrapmenu = $menu.parents(".wrap_menu");
15724    var arParentSubmenuForOpacity = [];
15725    topMenuEnterTimer = setTimeout(function () {
15726      var wrapMenuWidth = $wrapmenu.actual("outerWidth");
15727      var wrapMenuLeft = $wrapmenu.offset().left;
15728      var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
15729      var $parentSubmenu = $this.parent();
15730      var bToLeft = $parentSubmenu.hasClass("toleft") ? true : false;
15731      if (!bToLeft) {
15732        bToLeft = $this.offset().left + $this.actual("outerWidth") + $submenu.actual("outerWidth") > wrapMenuRight;
15733      } else {
15734        bToLeft = $this.offset().left + $this.actual("outerWidth") - $submenu.actual("outerWidth") < wrapMenuLeft;
15735      }
15736
15737      if (bToLeft) {
15738        $this.find(">.dropdown").addClass("toleft").show();
15739      } else {
15740        $this.find(">.dropdown").removeClass("toleft").show();
15741      }
15742      var submenuLeft = $submenu.offset().left;
15743      var submenuRight = submenuLeft + $submenu.actual("outerWidth");
15744
15745      $this.parents(".dropdown").each(function () {
15746        var $this = $(this);
15747        var leftOffset = $this.offset().left;
15748        var rightOffset = leftOffset + $this.actual("outerWidth");
15749        if (
15750          (leftOffset >= submenuLeft && leftOffset < submenuRight - 1) ||
15751          (rightOffset > submenuLeft + 1 && rightOffset <= submenuRight)
15752        ) {
15753          arParentSubmenuForOpacity.push($this);
15754          $this.find(">li>a").css({ opacity: "0.1" });
15755        }
15756      });
15757    }, delayTime);
15758
15759    $this.unbind("mouseleave");
15760    $this.on("mouseleave", function () {
15761      var leaveTimer = setTimeout(function () {
15762        $this.find(".dropdown").removeClass("toleft").hide();
15763        if (arParentSubmenuForOpacity.length) {
15764          for (i in arParentSubmenuForOpacity) {
15765            arParentSubmenuForOpacity[i].find(">li>a").css({ opacity: "" });
15766          }
15767        }
15768      }, delayTime);
15769
15770      $this.unbind("mouseenter");
15771      $this.on("mouseenter", function () {
15772        if (leaveTimer) {
15773          clearTimeout(leaveTimer);
15774          leaveTimer = false;
15775        }
15776      });
15777    });
15778  }
15779});
15780
15781/*hover animate*/
15782//breadcrumbs
15783$(document).on("mouseenter", ".breadcrumbs .breadcrumbs__item, .hover-block .hover-block__item", function () {
15784  var _this = $(this),
15785    menu = _this.find("> .breadcrumbs__dropdown-wrapper, > .hover-block__item-wrapper");
15786
15787  menu.velocity("stop").velocity("transition.slideUpIn", {
15788    duration: 300,
15789    delay: 100,
15790  });
15791
15792  _this.one("mouseleave", function () {
15793    menu.velocity("stop").velocity("fadeOut", {
15794      duration: 100,
15795      // delay: 0
15796    });
15797  });
15798});
15799
15800//top menu
15801$(document).on("mouseenter", ".menu .mega-menu table td, .menu-row .mega-menu table td", function () {
15802  var _this = $(this),
15803    menu = _this.find("> .wrap > .dropdown-menu");
15804
15805  if (!_this.hasClass("wide_menu")) {
15806    menu.show();
15807    CheckTopVisibleMenu();
15808  }
15809
15810  var bDarkness = $(".wrapper1.dark-hover-overlay").length > 0;
15811
15812  menu.velocity("stop");
15813
15814  if (menu.css("opacity") != 0) {
15815    menu.css("opacity", "1");
15816    if (bDarkness) {
15817      $(".shadow-block").css("opacity", "1");
15818    }
15819  } else {
15820    // menu.velocity('stop').velocity('transition.perspectiveDownIn', {
15821    // menu.velocity('stop').velocity('transition.slideUpBigIn', {
15822    // menu.velocity('transition.expandIn', {
15823    menu.velocity("fadeIn", {
15824      begin: function (elements) {
15825        InitMenuNavigationAim();
15826        CheckTopVisibleMenu();
15827      },
15828      duration: 150,
15829      delay: 250,
15830      complete: function () {
15831        if (bDarkness) {
15832          $("body").addClass("menu-hovered");
15833          if (!$(".shadow-block").length) $('<div class="shadow-block"></div>').appendTo($("body"));
15834          $(".shadow-block").velocity("stop").velocity("fadeIn", 200);
15835        }
15836
15837        var bannerMenu = $(".dropdown-menu.with_right_block .owl-carousel-hover");
15838        if (bannerMenu.length) {
15839          bannerMenu.removeClass("owl-carousel-hover").addClass("owl-carousel");
15840          setTimeout(function () {
15841            InitOwlSlider();
15842            bannerMenu.removeClass("loader_circle");
15843          }, 1);
15844        }
15845      },
15846    });
15847  }
15848
15849  _this.one("mouseleave", function () {
15850    menu.velocity("stop").velocity("fadeOut", {
15851      duration: 50,
15852      delay: 300,
15853      complete: function () {
15854        if (bDarkness) {
15855          $(".shadow-block")
15856            .velocity("stop")
15857            .velocity("fadeOut", {
15858              duration: 200,
15859              // delay: 100,
15860              complete: function () {
15861                $("body").removeClass("menu-hovered");
15862              },
15863            });
15864        }
15865      },
15866    });
15867  });
15868});
15869/**/
15870
15871$(document).on("mouseenter", ".menu-item:not(.wide_menu) .dropdown-menu .dropdown-submenu", function () {
15872  var _this = $(this),
15873    menu = _this.find("> .dropdown-menu");
15874
15875  menu.velocity("stop");
15876
15877  if (menu.css("opacity") != 0) {
15878    menu.css("opacity", "1");
15879  } else {
15880    menu.velocity("transition.fadeIn", {
15881      begin: function (element) {
15882        $(element).css("display", "block");
15883        CheckTopVisibleMenu();
15884      },
15885      duration: 300,
15886      delay: 250,
15887    });
15888  }
15889
15890  _this.one("mouseleave", function () {
15891    menu.velocity("stop").velocity("fadeOut", {
15892      duration: 150,
15893      delay: 300,
15894    });
15895  });
15896});
15897
15898/*register custom velocity animate*/
15899if (typeof $.Velocity !== undefined && "RegisterEffect" in $.Velocity) {
15900  var effects = {
15901    "transition.slideDownFullIn": {
15902      defaultDuration: 900,
15903      calls: [[{ opacity: [1, 0], translateY: [0, "-100%"], translateZ: 0 }]],
15904    },
15905    "transition.slideDownFullOut": {
15906      defaultDuration: 900,
15907      calls: [[{ opacity: [0.4, 1], translateY: ["-100%", 0], translateZ: 0 }]],
15908    },
15909  };
15910
15911  for (var effectName in effects) {
15912    if (effects.hasOwnProperty(effectName)) {
15913      $.Velocity.RegisterEffect(effectName, effects[effectName]);
15914    }
15915  }
15916}
15917/**/
15918
15919getGridSize = function (counts, slider) {
15920  var counts_item = 1;
15921  //wide
15922  if (window.matchMedia("(min-width: 1200px)").matches) {
15923    counts_item = counts[0];
15924    if (typeof slider.data("lg_count") !== "undefined" && slider.data("lg_count") && $(".front.wide_page").length)
15925      counts_item = slider.data("lg_count");
15926  }
15927
15928  //large
15929  if (window.matchMedia("(max-width: 1200px)").matches) {
15930    counts_item = counts[1];
15931  }
15932
15933  //middle
15934  if (window.matchMedia("(max-width: 992px)").matches) {
15935    counts_item = counts[2];
15936  }
15937
15938  //small
15939  if (counts[3]) {
15940    if (window.matchMedia("(max-width: 600px)").matches) {
15941      counts_item = counts[3];
15942    }
15943  }
15944
15945  //exsmall
15946  if (counts[4]) {
15947    if (window.matchMedia("(max-width: 400px)").matches) {
15948      counts_item = counts[4];
15949    }
15950  }
15951  return counts_item;
15952};
15953
15954CheckFlexSlider = function () {
15955  $(".flexslider:not(.thmb)").each(function () {
15956    var slider = $(this);
15957    if (typeof slider.data("flexslider") != "undefined") {
15958      if ("vars" in slider.data("flexslider")) {
15959        slider.resize();
15960
15961        var counts = slider.data("flexslider").vars.counts;
15962        if (typeof counts != "undefined" && slider.is(":visible")) {
15963          var cnt = getGridSize(counts, slider);
15964          var to0 =
15965            cnt != slider.data("flexslider").vars.minItems ||
15966            cnt != slider.data("flexslider").vars.maxItems ||
15967            cnt != slider.data("flexslider").vars.move;
15968          if (to0) {
15969            slider.data("flexslider").vars.minItems = cnt;
15970            slider.data("flexslider").vars.maxItems = cnt;
15971            slider.data("flexslider").vars.move = cnt;
15972            slider.flexslider(0);
15973            slider.resize();
15974            slider.resize(); // twise!
15975          }
15976        }
15977      }
15978    }
15979  });
15980};
15981
15982$.fn.mCustomScrollbarDeferred = function (config) {
15983  $(this).addClass("scroll-init");
15984
15985  if ($(this).hasClass("destroyed")) {
15986    return;
15987  }
15988
15989  $(this).hover(
15990    function (e) {
15991      var $this = $(this);
15992      if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed") && !$(this).hasClass("mobile-scroll")) {
15993        $this.data(
15994          "scrollTimer",
15995          setTimeout(function () {
15996            $this.mCustomScrollbar(config);
15997            $this.off("touchstart touchmove touchend mousewheel mouseenter mouseleave");
15998          }, 200)
15999        );
16000      }
16001    },
16002    function (e) {
16003      clearTimeout($(this).data("scrollTimer"));
16004    }
16005  );
16006
16007  $(this).on("touchstart touchmove", function (e) {
16008    var $this = $(this);
16009    if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed") && !$(this).hasClass("mobile-scroll")) {
16010      $this.mCustomScrollbar(config);
16011    }
16012
16013    var $scrollContainer = $this.find(">.mCustomScrollBox>.mCSB_container");
16014    if ($scrollContainer.length) {
16015      var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
16016
16017      var newTouch = new Touch({
16018        identifier: 42,
16019        target: $scrollContainer[0],
16020        clientX: touch.clientX,
16021        clientY: touch.clientY,
16022        screenX: touch.screenX,
16023        screenY: touch.screenY,
16024        pageX: touch.pageX,
16025        pageY: touch.pageY,
16026        radiusX: 1,
16027        radiusY: 1,
16028      });
16029
16030      var newEvent = new TouchEvent(e.type, {
16031        cancelable: true,
16032        bubbles: false,
16033        composed: true,
16034        touches: [newTouch],
16035        targetTouches: [newTouch],
16036        changedTouches: [newTouch],
16037      });
16038
16039      $scrollContainer[0].dispatchEvent(newEvent);
16040    }
16041  });
16042
16043  $(this).on("touchend", function (e) {
16044    $(this).off("touchstart touchmove touchend mousewheel mouseenter mouseleave");
16045  });
16046
16047  if ($.event.special.mousewheel) {
16048    $(this).on("mousewheel", function (e) {
16049      var $this = $(this);
16050      if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed") && !$(this).hasClass("mobile-scroll")) {
16051        $this.mCustomScrollbar(config);
16052        $this.off("touchstart touchmove touchend mousewheel mouseenter mouseleave");
16053      }
16054    });
16055  }
16056};
16057
16058InitScrollBar = function (el, initOptions) {
16059  var block;
16060  if (typeof el === "undefined") {
16061    block = $(".srollbar-custom:not(.mobile-scroll):not(.scroll-init)");
16062  } else {
16063    block = el.filter(":not(.scroll-init)");
16064  }
16065
16066  if (block.length) {
16067    block.addClass("scroll-init");
16068
16069    var options,
16070      defaults = {
16071        mouseWheel: {
16072          scrollAmount: 150,
16073          preventDefault: true,
16074        },
16075      };
16076    var config = $.extend({}, defaults, options, block.data("plugin-options"), initOptions);
16077
16078    config.callbacks = {
16079      onScroll: function () {
16080        if ($(this).find(".mCSB_buttonLeft").hasClass("disabled"))
16081          $(this).find(".mCSB_buttonLeft").removeClass("disabled");
16082        if ($(this).find(".mCSB_buttonRight").hasClass("disabled"))
16083          $(this).find(".mCSB_buttonRight").removeClass("disabled");
16084      },
16085      onTotalScrollBack: function () {
16086        $(this).find(".mCSB_buttonLeft").addClass("disabled");
16087      },
16088      onTotalScroll: function () {
16089        $(this).find(".mCSB_buttonRight").addClass("disabled");
16090      },
16091      onInit: function () {
16092        $(this).find(".mCSB_buttonLeft").addClass("disabled");
16093      },
16094    };
16095
16096    block.filter(":not(.scroll-deferred)").mCustomScrollbar(config);
16097    block.filter(".scroll-deferred").mCustomScrollbarDeferred(config);
16098  }
16099};
16100
16101InitCustomScrollBar = function (el) {
16102  var block;
16103  if (typeof el === "undefined") {
16104    block = $(".scrollbar:not(.mobile-scroll):not(.scroll-init)");
16105  } else {
16106    block = el.filter(":not(.scroll-init)");
16107  }
16108
16109  if (block.length) {
16110    block.addClass("scroll-init");
16111
16112    var options,
16113      defaults = {
16114        effect: "fadeIn",
16115        effectTime: 300,
16116        threshold: 0,
16117        // threshold: 30
16118      };
16119
16120    var config = $.extend({}, defaults, options, block.data("plugin-options"));
16121
16122    block.filter(":not(.scroll-deferred)").mCustomScrollbar(config);
16123    block.filter(".scroll-deferred").mCustomScrollbarDeferred(config);
16124  }
16125};
16126
16127/* slider gallery for fancybox */
16128const InitFancyboxThumbnailsGallery = function (instance) {
16129  if (
16130    $(".fancybox-thumbs") &&
16131    $(".fancybox-thumbs__list a").length > 1 &&
16132    !$(".fancybox-thumbs .swiper-container").length &&
16133    typeof initSwiperSlider === "function"
16134  ) {
16135    // update preview when lazyloaded
16136
16137    instance.Thumbs.$grid.find(".fancybox-thumbs__list a").each(function (i, el) {
16138      const path = instance.group[i].thumb || instance.group[i].src;
16139
16140      $(el).css("background-image", "url('" + encodeURI(path) + "')");
16141    });
16142    const SLIDER_RESIZE_BREAKPOINT = 600;
16143    const $swiperSlides = $(".fancybox-thumbs__list a");
16144    const $swiperWrapper = $(".fancybox-thumbs__list");
16145    const sliderDirection = (window.innerWidth >= SLIDER_RESIZE_BREAKPOINT ? 'vertical' : 'horizontal');
16146
16147    const options = {
16148      centerInsufficientSlides: true,
16149      direction: sliderDirection,
16150      mousewheelControl: true,
16151      setWrapperSize: true,
16152      slidesPerView: 3,
16153      spaceBetween: 16,
16154      breakpoints: {
16155        400: {
16156          slidesPerView: 5
16157        },
16158      },
16159    };
16160
16161    if ($swiperSlides.length > 5) {
16162      options.navigation = {
16163        nextEl: ".fancybox-thumbs__wrapper .swiper-button-next",
16164        prevEl: ".fancybox-thumbs__wrapper .swiper-button-prev",
16165      };
16166    }
16167
16168    $(".fancybox-thumbs").wrapInner(
16169      "<div class='fancybox-thumbs__wrapper'><div class='swiper-container' data-plugin-options='" +
16170      JSON.stringify(options) +
16171      "' /></div>"
16172    );
16173    const $swiperContainerWrapper = $(".fancybox-thumbs__wrapper");
16174
16175    if ($swiperSlides.length > 5) {
16176      $swiperContainerWrapper.append(
16177        "<div class='swiper-button-next'><i class='svg right'><svg xmlns='http://www.w3.org/2000/svg' width='12' height='6.969' viewBox='0 0 12 6.969'><path id='Rounded_Rectangle_702_copy_24' data-name='Rounded Rectangle 702 copy 24' class='cls-1' d='M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.99
161771,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z' transform='translate(-350 -395.031)'></path></svg></i></div>"
16178      );
16179      $swiperContainerWrapper.prepend(
16180        "<div class='swiper-button-prev'><i class='svg left'><svg xmlns='http://www.w3.org/2000/svg' width='12' height='6.969' viewBox='0 0 12 6.969'><path id='Rounded_Rectangle_702_copy_24' data-name='Rounded Rectangle 702 copy 24' class='cls-1' d='M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z' transform='translate(-350 -395.031)'></path></svg></i></div>"
16181      );
16182    }
16183    $swiperWrapper.addClass("swiper-wrapper");
16184    $swiperSlides.addClass("swiper-slide");
16185
16186    initSwiperSlider(".fancybox-thumbs .swiper-container");
16187
16188    const swiper = $(".fancybox-thumbs .swiper-container").data("swiper");
16189
16190    swiper.slideTo(instance.curPos, 10);
16191    swiper.on('resize', function () {
16192      if (window.innerWidth >= SLIDER_RESIZE_BREAKPOINT && options.direction === 'horizontal') {
16193        options.direction = 'vertical';
16194        swiper.changeDirection(options.direction, false);
16195        $swiperWrapper.css('width', 'auto');
16196        swiper.update();
16197      } else if (window.innerWidth < SLIDER_RESIZE_BREAKPOINT && options.direction === 'vertical') {
16198        options.direction = 'horizontal';
16199        swiper.changeDirection(options.direction, false);
16200        $swiperWrapper.css('height', 'auto');
16201        swiper.update();
16202      }
16203    })
16204  }
16205}
16206/** */
16207InitFancyBox = function () {
16208  if (typeof $.fn.fancybox !== "function") {
16209    return;
16210  }
16211
16212  if (!$(".fancy").length) {
16213    return;
16214  }
16215  $(".fancy").fancybox({
16216    padding: [40, 40, 64, 40],
16217    openEffect: "fade",
16218    closeEffect: "fade",
16219    nextEffect: "fade",
16220    prevEffect: "fade",
16221    opacity: true,
16222    tpl: {
16223      closeBtn:
16224        '<span title="' +
16225        BX.message("FANCY_CLOSE") +
16226        '" class="fancybox-item fancybox-close inline svg"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg></span>',
16227      next:
16228        '<a title="' +
16229        BX.message("FANCY_NEXT") +
16230        '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
16231      prev:
16232        '<a title="' +
16233        BX.message("FANCY_PREV") +
16234        '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
16235    },
16236    btnTpl: {
16237      close:
16238        '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
16239        '<i class="svg"><svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" /></svg></i>' +
16240        "</button>",
16241
16242      arrowLeft:
16243        '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
16244        '<div><i class="svg left"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 13L0.585787 14.4142C-0.195262 13.6332 -0.195262 12.3668 0.585787 11.5858L2 13ZM11.5858 0.585786C12.3668 -0.195262 13.6332 -0.195262 14.4142 0.585786C15.1953 1.36683 15.1953 2.63317 14.4142 3.41421L11.5858 0.585786ZM14.4142 22.5858C15.1953 23.3668 15.1953 24.6332 14.4142 25.4142C13.6332 26.1953 12.3668 26.1953 11.5858 25.4142L14.4142 22.5858ZM0.585787 11.5858L11.5858 0.585786L14.4142 3.41421L3.41421 14.4142L0.585787 11.5858ZM3.41421 11.5858L14.4142 22.5858L11.5858 25.4142L0.585787 14.4142L3.41421 11.5858Z" fill="#999999"/></svg></i></div>' +
16245        "</button>",
16246
16247      arrowRight:
16248        '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
16249        '<div><i class="svg right"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 13L14.4142 14.4142C15.1953 13.6332 15.1953 12.3668 14.4142 11.5858L13 13ZM3.41421 0.585786C2.63317 -0.195262 1.36683 -0.195262 0.585786 0.585786C-0.195262 1.36683 -0.195262 2.63317 0.585786 3.41421L3.41421 0.585786ZM0.585786 22.5858C-0.195262 23.3668 -0.195262 24.6332 0.585786 25.4142C1.36683 26.1953 2.63317 26.1953 3.41421 25.4142L0.585786 22.5858ZM14.4142 11.5858L3.41421 0.585786L0.585786 3.41421L11.5858 14.4142L14.4142 11.5858ZM11.5858 11.5858L0.585786 22.5858L3.41421 25.4142L14.4142 14.4142L11.5858 11.5858Z" fill="white"/></svg></i></div>' +
16250        "</button>",
16251    },
16252    touch: "enabled",
16253    buttons: [
16254      // "zoom",
16255      //"share",
16256      // "slideShow",
16257      //"fullScreen",
16258      //"download",
16259      // "thumbs",
16260      "close",
16261    ],
16262    thumbs: {
16263      autoStart: true,
16264    },
16265    backFocus: false,
16266    onActivate: function (instance) {
16267      InitFancyboxThumbnailsGallery(instance);
16268    },
16269    beforeShow: function (instance, current) {
16270      if ($(".fancybox-thumbs .swiper-container").length) {
16271        const swiper = $(".fancybox-thumbs .swiper-container").data("swiper");
16272
16273        swiper.slideTo(current.index);
16274      }
16275      if (!$(".cd-modal-bg").hasClass("is-visible")) {
16276        BX.loadScript(arAsproOptions["SITE_TEMPLATE_PATH"] + "/js/aspro_animate_open_fancy.js", function () {
16277          var scaleValue = retrieveScale($(".cd-modal-bg"));
16278
16279          $(".cd-modal-bg")
16280            .show()
16281            .addClass("is-visible")
16282            .one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function () {
16283              animateLayer($(".cd-modal-bg"), scaleValue, true);
16284            });
16285        });
16286      }
16287      var video_block = $(".company-block source.video-block");
16288      if (video_block.length) {
16289        if (video_block.attr("src") == "#") {
16290          var video_block_wrapper = video_block.closest("video");
16291          var video_block_clone = video_block_wrapper.clone();
16292
16293          video_block_clone.find("source").attr("src", video_block_clone.find("source").data("src"));
16294          video_block.attr("src", video_block.data("src"));
16295          video_block_clone.insertAfter(video_block_wrapper);
16296          video_block_clone.siblings("video").remove();
16297        }
16298      }
16299      var video_block_frame = $(".company-block #company_video_iframe");
16300      if (video_block_frame.length) {
16301        var data_src_iframe = video_block_frame.attr("data-src");
16302        video_block_frame.attr("src", data_src_iframe);
16303        video_block_frame.attr("allow", "autoplay");
16304      }
16305      // $('.detail .galery .overlay_form').hide();
16306    },
16307    afterShow: function () {
16308      if ($(".fancybox-overlay").css("opacity") == 0) {
16309        setTimeout(function () {
16310          $(".fancybox-overlay").css("opacity", 1);
16311          $("html").addClass("overflow_html");
16312        }, 200);
16313      }
16314
16315      $(".fancybox-nav").css("opacity", 0);
16316      setTimeout(function () {
16317        $(".fancybox-nav").css("opacity", 1);
16318      }, 150);
16319      if ($(".fancybox-inner #company_video").length) {
16320        // var fancyHeight = $('.fancybox-wrap').height();
16321        // $('.fancybox-inner').height(fancyHeight);
16322        setTimeout(function () {
16323          $(".fancybox-wrap video").resize();
16324          setTimeout(function () {
16325            $(".fancybox-wrap").addClass("show_video");
16326            document.getElementById("company_video").currentTime = 0;
16327            document.getElementById("company_video").play();
16328          }, 300);
16329        }, 150);
16330      } else if ($(".fancybox-wrap iframe").length) {
16331        $(".fancybox-inner").height("100%");
16332      }
16333    },
16334    beforeClose: function () {
16335      InitFancyBox()
16336      BX.loadScript(arAsproOptions["SITE_TEMPLATE_PATH"] + "/js/aspro_animate_open_fancy.js", function () {
16337        closeModal();
16338        $(".fancybox-overlay").fadeOut();
16339        if ($("#company_video").length) {
16340          document.getElementById("company_video").currentTime = 0;
16341        }
16342        $("html").removeClass("overflow_html");
16343        var video_block_frame = $(".company-block .video-block");
16344        if (video_block_frame.length) {
16345          $("#company_video_iframe").attr("src", "");
16346        }
16347      });
16348    },
16349    onClosed: function () {
16350      if ($(".fancybox-wrap #company_video").length) {
16351        document.getElementById("company_video").pause();
16352      }
16353    },
16354  });
16355};
16356
16357InitFancyBoxVideo = function () {
16358  if (typeof $.fn.fancybox !== "function") {
16359    return;
16360  }
16361
16362  if (!$(".video_link").length) {
16363    return;
16364  }
16365  $(".video_link").fancybox({
16366    type: "iframe",
16367    maxWidth: 800,
16368    maxHeight: 600,
16369    fitToView: false,
16370    width: "70%",
16371    height: "70%",
16372    autoSize: false,
16373    closeClick: false,
16374    opacity: true,
16375    iframe: { "preload": false },
16376    tpl: {
16377      closeBtn:
16378        '<span title="' +
16379        BX.message("FANCY_CLOSE") +
16380        '" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>',
16381      next:
16382        '<a title="' +
16383        BX.message("FANCY_NEXT") +
16384        '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
16385      prev:
16386        '<a title="' +
16387        BX.message("FANCY_PREV") +
16388        '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
16389    },
16390    beforeShow: function (event) {
16391      if (!$(".cd-modal-bg").hasClass("is-visible")) {
16392        BX.loadScript(arAsproOptions["SITE_TEMPLATE_PATH"] + "/js/aspro_animate_open_fancy.js", function () {
16393          var scaleValue = retrieveScale($(".cd-modal-bg"));
16394
16395          $(".cd-modal-bg")
16396            .show()
16397            .addClass("is-visible")
16398            .one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function () {
16399              animateLayer($(".cd-modal-bg"), scaleValue, true);
16400            });
16401        });
16402      }
16403    },
16404    afterShow: function () {
16405      if ($(".fancybox-overlay").css("opacity") == 0) {
16406        setTimeout(function () {
16407          $(".fancybox-overlay").css("opacity", 1);
16408          $("html").addClass("overflow_html");
16409        }, 200);
16410      }
16411
16412      $(".fancybox-nav").css("opacity", 0);
16413      setTimeout(function () {
16414        $(".fancybox-nav").css("opacity", 1);
16415      }, 150);
16416      if ($(".fancybox-wrap iframe").length) {
16417        $(".fancybox-inner").height("100%");
16418      }
16419    },
16420    beforeClose: function () {
16421      InitFancyBoxVideo()
16422      BX.loadScript(arAsproOptions["SITE_TEMPLATE_PATH"] + "/js/aspro_animate_open_fancy.js", function () {
16423        closeModal();
16424        $(".fancybox-overlay").fadeOut();
16425        $("html").removeClass("overflow_html");
16426      });
16427    },
16428  });
16429};
16430
16431InitStickySideBar = function (el, container_el) {
16432  var block = ".sticky-sidebar",
16433    container_catalog = ".wraps .wrapper_inner .container_inner .main-catalog-wrapper",
16434    container = ".wraps .container";
16435  if (typeof el !== "undefined") block = el;
16436
16437  if ($(container_catalog).length) container = container_catalog;
16438
16439  if (typeof container_el !== "undefined") container = container_el;
16440
16441  if ($(block).length && arAsproOptions["THEME"]["STICKY_SIDEBAR"] != "N") {
16442    if (typeof window["stickySidebar"] !== "undefined") {
16443      window["stickySidebar"].destroy();
16444    }
16445
16446    window["stickySidebar"] = new StickySidebar(block, {
16447      topSpacing: 60,
16448      bottomSpacing: 20,
16449      containerSelector: container,
16450      resizeSensor: true,
16451      innerWrapperSelector: ".sticky-sidebar__inner",
16452    });
16453
16454    if ($(".sticky-sidebar .sticky-sidebar__inner .banner img").length) {
16455      $(".sticky-sidebar .sticky-sidebar__inner .banner img").load(function () {
16456        if (typeof window["stickySidebar"] !== "undefined") {
16457          window["stickySidebar"].updateSticky();
16458        }
16459      });
16460    }
16461  }
16462};
16463
16464InitOwlSlider = function () {
16465  if (typeof $.fn.owlCarousel !== "function") {
16466    return;
16467  }
16468
16469  $(".owl-carousel:not(.owl-loaded):not(.appear-block)").each(function () {
16470    var slider = $(this);
16471    var options;
16472    var svg =
16473      '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>';
16474    var defaults = {
16475      navText: [
16476        '<i class="svg left colored_theme_hover_text">' + svg + "</i>",
16477        '<i class="svg right colored_theme_hover_text">' + svg + "</i>",
16478      ],
16479    };
16480    var config = $.extend({}, defaults, options, slider.data("plugin-options"));
16481
16482    slider.on("initialized.owl.carousel", function (event) {
16483      var eventdata = { slider: event };
16484      BX.onCustomEvent("onSliderInitialized", [eventdata]);
16485
16486      $(event.target).removeClass("loading-state");
16487      $(event.target).find(".owl-item:first").addClass("current");
16488
16489      if ($(event.target).hasClass("catalog_block")) {
16490        if (typeof sliceItemBlockSlide === "function") {
16491          sliceItemBlockSlide();
16492        }
16493      }
16494
16495      if (typeof window["stickySidebar"] !== "undefined") {
16496        window["stickySidebar"].updateSticky();
16497      }
16498    });
16499    slider.owlCarousel(config);
16500
16501    slider.on("change.owl.carousel", function (event) {
16502      var eventdata = { slider: event };
16503      BX.onCustomEvent("onSlideChange", [eventdata]);
16504    });
16505    slider.on("resized.owl.carousel", function (event) {
16506      if (typeof sliceItemBlockSlide === "function") {
16507        sliceItemBlockSlide({ resize: false });
16508      }
16509    });
16510
16511    slider.on("changed.owl.carousel", function (event) {
16512      var eventdata = { slider: event };
16513      BX.onCustomEvent("onSlideChanged", [eventdata]);
16514
16515      if ($(event.target).data("pluginOptions")) {
16516        if ("index" in $(event.target).data("pluginOptions")) {
16517          if ($(".switch-item-block").length) {
16518            $(".switch-item-block__count-wrapper--big .switch-item-block__count-value").text(
16519              event.item.index + 1 + "/" + event.item.count
16520            );
16521          }
16522        }
16523
16524        if ("relatedTo" in $(event.target).data("pluginOptions")) {
16525          var relatedClass = $(event.target).data("pluginOptions").relatedTo,
16526            relatedBlock = $(relatedClass);
16527
16528          if (relatedBlock.length && $(event.target).data("owl.carousel")) {
16529            if (!$(event.target).data("owl.carousel").loop) {
16530              var current = event.item.index;
16531            } else {
16532              var count = event.item.count - 1;
16533              var current = Math.round(event.item.index - event.item.count / 2 - 0.5);
16534
16535              if (current < 0) current = count;
16536
16537              if (current > count) current = 0;
16538            }
16539
16540            relatedBlock.find(".owl-item").removeClass("current").eq(current).addClass("current");
16541
16542            var onscreen = relatedBlock.find(".owl-item.active").length - 1;
16543            var start = relatedBlock.find(".owl-item.active").first().index();
16544            var end = relatedBlock.find(".owl-item.active").last().index();
16545
16546            if (current > end) relatedBlock.data("owl.carousel").to(current, 100, true);
16547
16548            if (current < start) relatedBlock.data("owl.carousel").to(current - onscreen, 100, true);
16549            // $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel])
16550          }
16551        }
16552      }
16553    });
16554
16555    slider.on("translated.owl.carousel", function (event) { });
16556
16557    if ("clickTo" in config) {
16558      var relatedClass = config.clickTo,
16559        magnifier = "magnifier" in config;
16560
16561      slider.on("click", ".owl-item", function (e) {
16562        e.preventDefault();
16563        var _this = $(this),
16564          number = _this.index();
16565
16566        if (magnifier) {
16567          const $parent = $(relatedClass).closest(".product-container");
16568          if ($parent.find(".zoom_picture").length) {
16569            const $zoomImg = $parent.find(".zoom_picture");
16570            const $galleryImg = _this.find(".product-detail-gallery__item img");
16571
16572            const bigImage = _this.find(".product-detail-gallery__item").data("big"),
16573              srcImage = $galleryImg.attr("src");
16574
16575            $zoomImg.attr("data-large", bigImage || srcImage);
16576            $zoomImg.attr("xoriginal", bigImage || srcImage);
16577            $zoomImg.attr("src", bigImage || srcImage);
16578            $zoomImg.attr("data-xoriginalwidth", $galleryImg.attr("data-xoriginalwidth"));
16579            $zoomImg.attr("data-xoriginalheight", $galleryImg.attr("data-xoriginalheight"));
16580            $parent
16581              .find(".product-detail-gallery__link")
16582              .attr("href", srcImage);
16583          }
16584          _this.siblings("").removeClass("current");
16585          _this.addClass("current");
16586        } else {
16587          $(relatedClass).data("owl.carousel").to(number, 300, true);
16588        }
16589      });
16590    }
16591  });
16592};
16593
16594InitFlexSlider = function () {
16595  if (typeof $.fn.flexslider !== "function") {
16596    return;
16597  }
16598  $(".flexslider:not(.thmb):not(.flexslider-init):not(.appear-block)").each(function () {
16599    var slider = $(this);
16600    var options;
16601    var defaults = {
16602      animationLoop: false,
16603      controlNav: false,
16604      keyboard: false,
16605      pauseOnAction: false,
16606      pauseInvisible: false,
16607      directionNav: true,
16608      useCSS: false,
16609      animation: "slide",
16610    };
16611    var config = $.extend({}, defaults, options, slider.data("plugin-options"));
16612    if (!slider.parent().hasClass("top_slider_wrapp") && slider.is(":visible")) {
16613      if (typeof config.counts != "undefined" && config.direction !== "vertical") {
16614        config.maxItems = getGridSize(config.counts, slider);
16615        config.minItems = getGridSize(config.counts, slider);
16616        config.itemWidth = 200;
16617      }
16618      if (typeof config.move == "undefined") config.move = 1;
16619
16620      config.start = function (slider) {
16621        var eventdata = { slider: slider };
16622        BX.onCustomEvent("onSlideInit", [eventdata]);
16623      };
16624
16625      config.after = function (slider) {
16626        var eventdata = { slider: slider };
16627        BX.onCustomEvent("onSlideComplete", [eventdata]);
16628      };
16629
16630      config.end = function (slider) {
16631        var eventdata = { slider: slider };
16632        BX.onCustomEvent("onSlideEnd", [eventdata]);
16633      };
16634      slider.flexslider(config).addClass("flexslider-init");
16635      if (config.controlNav) slider.addClass("flexslider-control-nav");
16636      if (config.directionNav) slider.addClass("flexslider-direction-nav");
16637    }
16638  });
16639};
16640
16641InitFlexSliderByClass = function ($class) {
16642  if ($class.hasClass("flexslider-init")) return;
16643  var slider = $class;
16644  var options;
16645  var defaults = {
16646    animationLoop: false,
16647    controlNav: false,
16648    keyboard: false,
16649    pauseOnAction: false,
16650    pauseInvisible: false,
16651    directionNav: true,
16652    useCSS: false,
16653    animation: "slide",
16654  };
16655  var config = $.extend({}, defaults, options, slider.data("plugin-options"));
16656  if (!slider.parent().hasClass("top_slider_wrapp") && slider.is(":visible")) {
16657    if (typeof config.counts != "undefined" && config.direction !== "vertical") {
16658      config.maxItems = getGridSize(config.counts, slider);
16659      config.minItems = getGridSize(config.counts, slider);
16660      config.itemWidth = 200;
16661    }
16662    if (typeof config.move == "undefined") config.move = 1;
16663
16664    config.start = function (slider) {
16665      var eventdata = { slider: slider };
16666      BX.onCustomEvent("onSlideInit", [eventdata]);
16667    };
16668
16669    config.after = function (slider) {
16670      var eventdata = { slider: slider };
16671      BX.onCustomEvent("onSlideComplete", [eventdata]);
16672    };
16673
16674    config.end = function (slider) {
16675      var eventdata = { slider: slider };
16676      BX.onCustomEvent("onSlideEnd", [eventdata]);
16677    };
16678
16679    slider.flexslider(config).addClass("flexslider-init");
16680    if (config.controlNav) slider.addClass("flexslider-control-nav");
16681    if (config.directionNav) slider.addClass("flexslider-direction-nav");
16682  }
16683};
16684
16685inIframe = function () {
16686  try {
16687    return window.self !== window.top;
16688  } catch (e) {
16689    return true;
16690  }
16691};
16692
16693InitZoomPict = function (el) {
16694  const zoomer = typeof el !== "undefined" ? el : $(".zoom_picture");
16695
16696  if (zoomer.length) {
16697    var options;
16698    const defaults = {
16699      title: true,
16700      scroll: false,
16701      Xoffset: 15,
16702      tint: "#333",
16703      defaultScale: -1,
16704    };
16705
16706    const config = $.extend({}, defaults, options, zoomer.data("plugin-options"));
16707    zoomer.xzoom(config);
16708
16709    // checks if zoomer doesn't have the event listenners
16710    const zoomerEventsListeners = $._data(zoomer.get(0), "events");
16711
16712    if (!zoomerEventsListeners.mouseout && !zoomerEventsListeners.load) {
16713      zoomer.on("mouseleave", function () {
16714        zoomer.data("xzoom").movezoom;
16715        let mObjWidth = parseInt(zoomer.attr("data-xoriginalwidth"));
16716        let mObHeight = parseInt(zoomer.attr("data-xoriginalheight"));
16717        let imgObjWidth = zoomer.width();
16718        let imgObjheight = zoomer.height();
16719        if (mObjWidth === imgObjWidth && imgObjheight === mObHeight) {
16720          $('.xzoom-preview').addClass('hidden');
16721          $('.xzoom-source > div').addClass('hidden');
16722        }
16723        else {
16724          $('.xzoom-preview').removeClass('hidden');
16725          $('.xzoom-source > div').removeClass('hidden');
16726        }
16727      });
16728
16729      zoomer.on("load", function () {
16730        const zoomerParentWidth = zoomer.parent().width();
16731        const zoomerHeight = zoomer.height();
16732        const zoomerWidth = zoomer.width();
16733        const sizeMultiplier = 1.5;
16734
16735        const zoomWidth =
16736          zoomerWidth < zoomerParentWidth / 2 && zoomerHeight > zoomerWidth ? zoomerWidth * sizeMultiplier : "auto";
16737
16738        zoomer.data("xzoom").destroy();
16739        zoomer.removeData("xzoom");
16740        zoomer.width("auto");
16741
16742        config.zoomWidth = zoomWidth;
16743        zoomer.xzoom(config);
16744      });
16745    }
16746  }
16747};
16748
16749var arBasketAsproCounters = (arStatusBasketAspro = arBasketPrices = {});
16750SetActualBasketFlyCounters = function (sync) {
16751  if (arBasketAsproCounters.DEFAULT == true) {
16752    $.ajax({
16753      url: arAsproOptions["SITE_DIR"] + "ajax/basket_fly.php",
16754      type: "post",
16755      success: function (html) {
16756        $("#basket_line .basket_fly").removeClass("loaded").html(html);
16757
16758        if (typeof sync !== "undefined") {
16759          $.ajax({
16760            type: "GET",
16761            url: arAsproOptions["SITE_DIR"] + "ajax/actualBasket.php",
16762            // data:data,
16763            success: function (data) {
16764              if (!$(".js_ajax").length) $("body").append('<div class="js_ajax"></div>');
16765              $(".js_ajax").html(data);
16766
16767              setBasketStatusBtn(true);
16768            },
16769          });
16770        }
16771      },
16772    });
16773  } else {
16774    // insert currency &#8381; by this hack!: $('<div/>').html(arBasketAsproCounters.READY.TITLE).text()
16775    $(".basket_fly .opener .basket_count .count")
16776      .attr("class", "count" + (arBasketAsproCounters.READY.COUNT > 0 ? "" : " empty_items"))
16777      .find(".items span")
16778      .text(arBasketAsproCounters.READY.COUNT);
16779    $(".basket_fly .opener .basket_count + a").attr("href", arBasketAsproCounters["READY"]["HREF"]);
16780    $(".basket_fly .opener .basket_count")
16781      .attr("title", $("<div/>").html(arBasketAsproCounters.READY.TITLE).text())
16782      .attr(
16783        "class",
16784        "colored_theme_hover_text basket_count small clicked" + (arBasketAsproCounters.READY.COUNT > 0 ? "" : " empty")
16785      );
16786
16787    $(".basket_fly .opener .wish_count .count")
16788      .attr("class", "count" + (arBasketAsproCounters.DELAY.COUNT > 0 ? "" : " empty_items"))
16789      .find(".items span")
16790      .text(arBasketAsproCounters.DELAY.COUNT);
16791    $(".basket_fly .opener .wish_count + a").attr("href", arBasketAsproCounters.DELAY.HREF);
16792    $(".basket_fly .opener .wish_count")
16793      .attr("title", $("<div/>").html(arBasketAsproCounters.DELAY.TITLE).text())
16794      .attr(
16795        "class",
16796        "colored_theme_hover_text wish_count small clicked" + (arBasketAsproCounters.DELAY.COUNT > 0 ? "" : " empty")
16797      );
16798
16799    $(".basket_fly .opener .compare_count .wraps_icon_block").attr(
16800      "class",
16801      "wraps_icon_block compare" + (arBasketAsproCounters.COMPARE.COUNT > 0 ? "" : " empty_block")
16802    );
16803    $(".basket_fly .opener .compare_count .count")
16804      .attr("class", "count" + (arBasketAsproCounters.COMPARE.COUNT > 0 ? "" : " empty_items"))
16805      .find(".items span")
16806      .text(arBasketAsproCounters.COMPARE.COUNT);
16807    $(".basket_fly .opener .compare_count + a").attr("href", arBasketAsproCounters.COMPARE.HREF);
16808
16809    updateBottomIconsPanel(arBasketAsproCounters);
16810  }
16811};
16812
16813CheckHeaderFixed = function () {
16814  var header = $("header, body.simple_basket_mode #header").first(),
16815    header_fixed = $("#headerfixed, body.simple_basket_mode #header"),
16816    header_simple = $("body.simple_basket_mode #header");
16817
16818  if (header_fixed.length) {
16819    if (header.length) {
16820      var isHeaderFixed = false,
16821        isTabsFixed = false,
16822        headerCanFix = true,
16823        headerFixedHeight = header_fixed.actual("outerHeight"),
16824        headerNormalHeight = header.actual("outerHeight"),
16825        headerDiffHeight = headerNormalHeight - headerFixedHeight,
16826        mobileBtnMenu = $(".btn.btn-responsive-nav"),
16827        headerTop = $("#panel:visible").actual("outerHeight"),
16828        topBlock = $(".TOP_HEADER").first(),
16829        $headerFixedNlo = header_fixed.find("[data-nlo]"),
16830        isNloLoaded = !$headerFixedNlo.length,
16831        OnHeaderFixedScrollHandler;
16832
16833      if (headerDiffHeight <= 0) headerDiffHeight = 0;
16834
16835      if (topBlock.length) headerTop += topBlock.actual("outerHeight");
16836
16837      $(window).scroll(
16838        (OnHeaderFixedScrollHandler = function () {
16839          var tabs_fixed = $(".product-item-detail-tabs-container-fixed");
16840
16841          if (window.matchMedia("(min-width:992px)").matches) {
16842            var scrollTop = $(window).scrollTop(),
16843              current_is = $(".search-wrapper .search-input:visible"),
16844              tabs = $(".ordered-block .nav.nav-tabs"),
16845              headerCanFix = !mobileBtnMenu.is(":visible"); /* && !$('.dropdown-menu:visible').length*/
16846
16847            if (!isHeaderFixed) {
16848              if (headerCanFix && scrollTop > headerNormalHeight + headerTop) {
16849                if (!isNloLoaded) {
16850                  if (!$headerFixedNlo.hasClass("nlo-loadings")) {
16851                    $headerFixedNlo.addClass("nlo-loadings");
16852                    setTimeout(function () {
16853                      $.ajax({
16854                        data: { nlo: $headerFixedNlo.attr("data-nlo") },
16855                        success: function (response) {
16856                          // stop ya metrika webvisor DOM indexer
16857                          pauseYmObserver();
16858
16859                          isNloLoaded = true;
16860                          $headerFixedNlo[0].insertAdjacentHTML("beforebegin", $.trim(response));
16861                          $headerFixedNlo.remove();
16862
16863                          InitMenuNavigationAim();
16864                          OnHeaderFixedScrollHandler();
16865
16866                          // init custom scroll
16867                          /*$("#headerfixed .mega-menu table td.wide_menu .customScrollbar").mCustomScrollbarDeferred({
16868                            mouseWheel: {
16869                              scrollAmount: 150,
16870                              preventDefault: true,
16871                            },
16872                          });*/
16873
16874                          // resume ya metrika webvisor
16875                          // (300ms transition) + (100ms scroll handler)
16876                          setTimeout(resumeYmObserver, 400);
16877                        },
16878                        error: function () {
16879                          $headerFixedNlo.removeClass("nlo-loadings");
16880                        },
16881                      });
16882                    }, 300);
16883                  }
16884                } else {
16885                  isHeaderFixed = true;
16886                  if (header_simple.length) {
16887                    headerSimpleHeight = header_simple.actual("outerHeight");
16888                    header_simple.closest(".header_wrap").css({ "margin-top": headerSimpleHeight });
16889                  }
16890                  header_fixed.addClass("fixed");
16891
16892                  $("nav.mega-menu.sliced.initied").removeClass("initied");
16893                  CheckTopMenuDotted();
16894                }
16895              }
16896            }
16897            if (isHeaderFixed || !headerCanFix) {
16898              if (!headerCanFix || scrollTop <= headerDiffHeight + headerTop) {
16899                isHeaderFixed = false;
16900                header_fixed.removeClass("fixed");
16901                if (header_simple.length) {
16902                  header_simple.closest(".header_wrap").css({ "margin-top": "" });
16903                }
16904              }
16905            }
16906
16907            //fixed tabs
16908            if (tabs_fixed.length && tabs.length) {
16909              var tabs_offset = $(".ordered-block .nav.nav-tabs").offset();
16910              if (scrollTop + headerFixedHeight > tabs_offset.top) {
16911                tabs_fixed.css({ top: header_fixed.actual("outerHeight") });
16912                tabs_fixed.addClass("fixed");
16913
16914                header_fixed.addClass("tabs-fixed");
16915              } else if (tabs_fixed.hasClass("fixed")) {
16916                tabs_fixed.removeAttr("style");
16917                tabs_fixed.removeClass("fixed");
16918
16919                header_fixed.removeClass("tabs-fixed");
16920              }
16921            }
16922          }
16923        })
16924      );
16925    }
16926  }
16927
16928  //mobile fixed
16929  var headerSimple = $("body.simple_basket_mode .wrapper1.mfixed_Y #header");
16930  var mfixed = headerSimple.length ? headerSimple : $(".wrapper1.mfixed_Y #mobileheader");
16931  if (mfixed.length && isMobile) {
16932    var isMHeaderFixed = false,
16933      mheaderCanFix = true,
16934      mheaderFixedHeight = mfixed.actual("outerHeight"),
16935      // mheaderFixedHeight = 0,
16936      mheaderTop = $("#panel:visible").actual("outerHeight"),
16937      mHeaderScrollTop = $(".wrapper1").hasClass("mfixed_view_scroll_top");
16938    $(window).scroll(function () {
16939      var scrollTop = $(window).scrollTop();
16940      if (window.matchMedia("(max-width:991px)").matches) {
16941        if (mHeaderScrollTop) {
16942          if (scrollTop > startScroll) {
16943            if (!$("#mobilePhone.show").length) {
16944              mfixed.removeClass("fixed");
16945              if (headerSimple.length) {
16946                headerSimple.closest(".header_wrap").css({ "margin-top": "" });
16947              }
16948            }
16949          } else if (scrollTop > mheaderFixedHeight + mheaderTop) {
16950            mfixed.addClass("fixed");
16951            if (headerSimple.length) {
16952              headerSimple.closest(".header_wrap").css({ "margin-top": mheaderFixedHeight });
16953            }
16954          } else if (scrollTop <= mheaderFixedHeight + mheaderTop) {
16955            mfixed.removeClass("fixed");
16956            if (headerSimple.length) {
16957              headerSimple.closest(".header_wrap").css({ "margin-top": "" });
16958            }
16959          }
16960          startScroll = scrollTop;
16961        } else {
16962          if (!isMHeaderFixed) {
16963            if (scrollTop > mheaderFixedHeight + mheaderTop) {
16964              isMHeaderFixed = true;
16965              mfixed.addClass("fixed");
16966              if (headerSimple.length) {
16967                headerSimple.closest(".header_wrap").css({ "margin-top": mheaderFixedHeight });
16968              }
16969            }
16970          } else if (isMHeaderFixed) {
16971            if (scrollTop <= mheaderFixedHeight + mheaderTop) {
16972              isMHeaderFixed = false;
16973              mfixed.removeClass("fixed");
16974              if (headerSimple.length) {
16975                headerSimple.closest(".header_wrap").css({ "margin-top": "" });
16976              }
16977            }
16978          }
16979        }
16980      } else {
16981        mfixed.removeClass("fixed");
16982        if (headerSimple.length) {
16983          headerSimple.closest(".header_wrap").css({ "margin-top": "" });
16984        }
16985      }
16986    });
16987  }
16988};
16989
16990CheckHeaderFixedMenu = function () {
16991  if (
16992    arAsproOptions["THEME"] &&
16993    arAsproOptions["THEME"]["HEADER_FIXED"] == 2 &&
16994    $("#headerfixed .js-nav").length &&
16995    window.matchMedia("(min-width: 992px)").matches
16996  ) {
16997    $("#headerfixed .js-nav").css("width", "0");
16998    var all_width = 0,
16999      cont_width = $("#headerfixed .maxwidth-theme").actual("width"),
17000      padding_menu =
17001        $("#headerfixed .logo-row.v2 .menu-block").actual("outerWidth") -
17002        $("#headerfixed .logo-row.v2 .menu-block").actual("width");
17003    $("#headerfixed .logo-row.v2 > .inner-table-block").each(function () {
17004      if (!$(this).hasClass("menu-block")) all_width += $(this).actual("outerWidth");
17005    });
17006    $("#headerfixed .js-nav").width(cont_width - all_width - padding_menu);
17007  }
17008};
17009
17010CheckSearchWidth = function () {
17011  if ($(".logo_and_menu-row .search_wrap").length) {
17012    var searchPosition = $(".logo_and_menu-row .search_wrap").position().left,
17013      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 2;
17014    width = 0;
17015    if ($(".logo_and_menu-row .subtop .search_wrap").length) {
17016      maxWidth = $(".logo_and_menu-row .subtop").width() - 2;
17017      $(".logo_and_menu-row .subtop > .row >div >div")
17018        .each(function () {
17019          if (!$(this).hasClass("search_wrap")) {
17020            var elementWidth = $(this).outerWidth();
17021            if (!$(this).is(":visible") || !$(this).height()) elementWidth = 0;
17022            width = width ? width - elementWidth : maxWidth - elementWidth;
17023          }
17024        })
17025        .promise()
17026        .done(function () {
17027          if ($(".logo_and_menu-row .search_wrap.wide_search").length)
17028            $(".logo_and_menu-row .search_wrap .search-block").outerWidth(width);
17029          else $(".logo_and_menu-row .search_wrap").outerWidth(width);
17030          $(".logo_and_menu-row .search_wrap").css({ opacity: 1, visibility: "visible" });
17031        });
17032    } else {
17033      if ($(".logo_and_menu-row .subbottom .search_wrap").length) {
17034        maxWidth = $(".logo_and_menu-row .subbottom").width() - 2;
17035        $(".logo_and_menu-row .subbottom >div")
17036          .each(function () {
17037            if (!$(this).hasClass("search_wrap")) {
17038              var elementWidth = $(this).outerWidth();
17039              if (!$(this).is(":visible") || !$(this).height()) elementWidth = 0;
17040              width = width ? width - elementWidth : maxWidth - elementWidth;
17041            }
17042          })
17043          .promise()
17044          .done(function () {
17045            if ($(".logo_and_menu-row .search_wrap.wide_search").length)
17046              $(".logo_and_menu-row .search_wrap .search-block").outerWidth(width);
17047            else $(".logo_and_menu-row .search_wrap").outerWidth(width);
17048            $(".logo_and_menu-row .search_wrap").css({ opacity: 1, visibility: "visible" });
17049          });
17050      } else {
17051        $(".logo_and_menu-row .maxwidth-theme > .row >div >div")
17052          .each(function () {
17053            if (!$(this).hasClass("search_wrap")) {
17054              var elementWidth = $(this).outerWidth();
17055              if (!$(this).is(":visible") || !$(this).height()) elementWidth = 0;
17056              width = width ? width - elementWidth : maxWidth - elementWidth;
17057            }
17058          })
17059          .promise()
17060          .done(function () {
17061            if ($(".logo_and_menu-row .search_wrap.wide_search").length)
17062              $(".logo_and_menu-row .search_wrap .search-block").outerWidth(width);
17063            else $(".logo_and_menu-row .search_wrap").outerWidth(width);
17064            $(".logo_and_menu-row .search_wrap").css({ opacity: 1, visibility: "visible" });
17065          });
17066      }
17067    }
17068  }
17069};
17070
17071if (!funcDefined("showItemStoresAmount")) {
17072  var showItemStoresAmount = function () {
17073
17074    let blocks = $('.item-stock .status-amount--stores:not(.status-amount--loaded)');
17075    if (blocks.length) {
17076      let stores = [];
17077      let ids = [];
17078
17079      for (let i = 0, cnt = blocks.length; i < cnt; ++i) {
17080        $(blocks[i]).addClass('status-amount--loaded');
17081
17082        var data = $(blocks[i]).data('param-amount');
17083        if (
17084          typeof data === 'object' &&
17085          data
17086        ) {
17087          ids.push(data.ID);
17088          stores = data.STORES;
17089        }
17090      }
17091
17092      if (ids) {
17093        let data = {
17094          ids: ids,
17095          stores: stores,
17096        };
17097
17098        $.ajax({
17099          url: arAsproOptions.SITE_DIR + 'ajax/amount.php',
17100          type: 'POST',
17101          data: data,
17102          dataType: 'json',
17103          success: function (result) {
17104            if (
17105              typeof result === 'object' &&
17106              result &&
17107              result.success &&
17108              result.amount
17109            ) {
17110              for (let i = 0, cnt = blocks.length; i < cnt; ++i) {
17111                var data = $(blocks[i]).data('param-amount');
17112                if (
17113                  typeof data === 'object' &&
17114                  data
17115                ) {
17116                  if (result.amount[data.ID]) {
17117                    $(blocks[i]).html(result.amount[data.ID]);
17118                  }
17119
17120                  $(blocks[i]).addClass('status-amount--visible');
17121                }
17122              }
17123            }
17124          },
17125        });
17126      }
17127    }
17128  }
17129}
17130
17131lazyLoadPagenBlock = function () {
17132  setTimeout(function () {
17133    if ($(".with-load-block .ajax_load_btn:not(.appear-block)").length) {
17134      $(".with-load-block .ajax_load_btn:not(.appear-block)").appear(
17135        function () {
17136          var $this = $(this);
17137          $this.addClass("appear-block").trigger("click");
17138        },
17139        { accX: 0, accY: 200 }
17140      );
17141    }
17142  }, 200);
17143};
17144
17145scrollPreviewBlock = function () {
17146  if (typeof $.cookie("scroll_block") != "undefined" && $.cookie("scroll_block")) {
17147    var scroll_block = $($.cookie("scroll_block"));
17148    if (scroll_block.length) {
17149      $("body, html").animate({ scrollTop: scroll_block.offset().top }, 500);
17150    }
17151    $.cookie("scroll_block", null);
17152  }
17153};
17154
17155scrollToBlock = function (block) {
17156  if ($(block).length) {
17157    var offset = $(block).offset().top;
17158    if (typeof $(block).data("toggle") != "undefined") $(block).click();
17159
17160    if (typeof $(block).data("offset") != "undefined") offset += $(block).data("offset");
17161
17162    $("body, html").animate({ scrollTop: offset }, 500);
17163  }
17164};
17165
17166checkMenuLines = function () {
17167  if ($(".front_page .menu-row .left_border").length || $(".front_page .menu-row .right_border").length) {
17168    var positionMenu = $(".centered .menu-row .mega-menu table").length
17169      ? $(".centered .menu-row .mega-menu table").offset().left
17170      : 0,
17171      varFixLineWidth =
17172        $("body").hasClass("with_decorate") && window.matchMedia("(min-width: 1100px)").matches ? 126 : 7;
17173
17174    $(".menu-row .left_border, .menu-row .right_border").css("width", positionMenu - varFixLineWidth);
17175  }
17176};
17177
17178SetFixedAskBlock = function () {
17179  if ($(".ask_a_question_wrapper").length) {
17180    var offset = $(".ask_a_question_wrapper").offset(),
17181      footer_offset = 0,
17182      block = $(".ask_a_question_wrapper").find(".ask_a_question"),
17183      block_offset = BX.pos(block[0]),
17184      block_height = block_offset.bottom - block_offset.top,
17185      diff_top_scroll = $("#headerfixed").height() + 20;
17186
17187    if ($("footer").length) footer_offset = $("footer").offset().top;
17188
17189    if ($(".banner.CONTENT_BOTTOM").length) footer_offset = $(".banner.CONTENT_BOTTOM").offset().top;
17190
17191    /* removed for ISSUE NEXT-414
17192    if(block_height+130 > block.closest('.fixed_wrapper').height())
17193      block.addClass('nonfixed');
17194    else
17195      block.removeClass('nonfixed');
17196    */
17197
17198    if (block_height + diff_top_scroll + documentScrollTopLast + 130 > footer_offset) {
17199      block.removeClass("fixed").css({ top: "auto", width: "auto", bottom: 0 });
17200      block.parent().css("position", "static");
17201      block.parent().parent().css("position", "static");
17202    } else {
17203      block.parent().removeAttr("style");
17204      block.parent().parent().removeAttr("style");
17205
17206      if (documentScrollTopLast + diff_top_scroll > offset.top) {
17207        var fixed_width = $(".fixed_block_fix").width();
17208        block.addClass("fixed").css({ top: diff_top_scroll, bottom: "auto" });
17209        if (fixed_width) block.css({ width: $(".fixed_block_fix").width() });
17210      } else block.removeClass("fixed").css({ top: 0, width: "auto" });
17211    }
17212  }
17213};
17214
17215MegaMenuFixed = function () {
17216  var animationTime = 150,
17217    $megaFixedNlo = $(".mega_fixed_menu").find("[data-nlo]");
17218
17219  $("header .burger, #headerfixed .burger").on("click", function () {
17220    if ($megaFixedNlo.length) {
17221      if (!$megaFixedNlo.hasClass("nlo-loadings")) {
17222        $megaFixedNlo.addClass("nlo-loadings");
17223        setTimeout(function () {
17224          $.ajax({
17225            data: { nlo: $megaFixedNlo.attr("data-nlo") },
17226            success: function (response) {
17227              $megaFixedNlo[0].insertAdjacentHTML("beforebegin", $.trim(response));
17228              $megaFixedNlo.remove();
17229            },
17230            error: function () {
17231              $megaFixedNlo.removeClass("nlo-loadings");
17232            },
17233          });
17234        }, 300);
17235      }
17236    }
17237
17238    $(".mega_fixed_menu").fadeIn(animationTime);
17239    //$('.header_wrap').toggleClass('zindexed');
17240    /*$(".mega_fixed_menu").mCustomScrollbarDeferred({
17241      mouseWheel: {
17242        scrollAmount: 150,
17243        preventDefault: true,
17244      },
17245    });*/
17246  });
17247
17248  $(".mega_fixed_menu .svg.svg-close").on("click", function () {
17249    $(this).closest(".mega_fixed_menu").fadeOut(animationTime);
17250    //$('.header_wrap').toggleClass('zindexed');
17251  });
17252
17253  $(".mega_fixed_menu .dropdown-menu .arrow").on("click", function (e) {
17254    e.preventDefault();
17255    e.stopPropagation();
17256    $(this).closest(".dropdown-submenu").find(".dropdown-menu").slideToggle(animationTime);
17257    $(this).closest(".dropdown-submenu").addClass("opened");
17258  });
17259};
17260
17261CheckPopupTop = function () {
17262  // var popup = $('.jqmWindow.show:last');
17263  // if(!popup.length)
17264  // 	popup = $('.jqmWindow.show');
17265  // if(!popup.length)
17266  // 	popup = $('.jqm-init.show');
17267  // if(popup.length){
17268  // 	var documentScollTop = $(document).scrollTop();
17269  // 	var windowHeight = $(window).height();
17270  // 	var popupTop = parseInt(popup.css('top'));
17271  // 	var popupHeight = popup.height();
17272  // 	if(windowHeight >= popupHeight){
17273  // 		// center
17274  // 		popupTop = (windowHeight - popupHeight) / 2;
17275  // 	}
17276  // 	else{
17277  // 		if(documentScollTop > documentScrollTopLast){
17278  // 			// up
17279  // 			popupTop -= documentScollTop - documentScrollTopLast;
17280  // 		}
17281  // 		else if(documentScollTop < documentScrollTopLast){
17282  // 			// down
17283  // 			popupTop += documentScrollTopLast - documentScollTop;
17284  // 		}
17285  // 		if(popupTop + popupHeight < windowHeight){
17286  // 			// bottom
17287  // 			popupTop = windowHeight - popupHeight;
17288  // 		}
17289  // 		else if(popupTop > 0){
17290  // 			// top
17291  // 			popupTop = 0;
17292  // 		}
17293  // 	}
17294  // 	popup.css('top', popupTop + 'px');
17295  // }
17296};
17297
17298AjaxClickLink = function (e) {
17299  var _this = "",
17300    container = $(".js-load-wrapper"),
17301    container_inner = $(".js-load-wrapper").find(".ajax_load"),
17302    dopAction = "";
17303  url = "";
17304  if ("preventDefault" in e) {
17305    e.preventDefault();
17306    _this = $(e.target).hasClass("js-load-link") ? $(e.target) : $(e.target).closest(".js-load-link");
17307  } else {
17308    _this = $(e);
17309    dopAction = "Y";
17310  }
17311
17312  if (container.length) {
17313    var objUrl = parseUrlQuery(),
17314      obGetData = { ajax_get_filter: "Y", control_ajax: "Y" };
17315
17316    obGetData.bitrix_include_areas = "N";
17317
17318    if ("clear_cache" in objUrl) {
17319      if (objUrl.clear_cache == "Y") {
17320        obGetData.clear_cache = "Y";
17321      }
17322    }
17323
17324    if (container_inner.length) {
17325      container_inner.addClass("loading-state");
17326    } else {
17327      container.addClass("loading-state");
17328    }
17329
17330    if (_this.data("url")) {
17331      url = _this.data("url");
17332    }
17333
17334    if (_this.data("click_block") && $(_this.data("click_block")).length) {
17335      if ($(_this.data("click_block")).data("url")) {
17336        url = $(_this.data("click_block")).data("url");
17337      }
17338    }
17339
17340    if (dopAction) {
17341      BX.PopupWindowManager.getCurrentPopup().close();
17342      $(".bx_filter_select_popup ul li .sort_btn").removeClass("current");
17343      _this.addClass("current");
17344      _this.closest(".bx_filter_block").find(".bx_filter_select_text").text(_this.text());
17345    }
17346
17347    $(".bx_filter .bx_sort_filter .bx_filter_select_text").text(_this.text());
17348    $(".bx_filter .bx_sort_filter .bx_filter_select_popup ul li span.current").removeClass("current");
17349    $(".bx_filter .bx_sort_filter .bx_filter_select_popup ul li")
17350      .eq(_this.parent().index())
17351      .find("span")
17352      .addClass("current");
17353
17354    $.ajax({
17355      url: url,
17356      data: obGetData,
17357      success: function (html) {
17358        container.html(html);
17359
17360        if (container_inner.length) container_inner.removeClass("loading-state");
17361        else container.removeClass("loading-state");
17362
17363        initAnimateLoad();
17364
17365        var eventdata = { action: "jsLoadBlock" };
17366        BX.onCustomEvent("onCompleteAction", [eventdata, _this]);
17367
17368        BX.onCustomEvent("onHeaderProgressBarChange", [{}]);
17369
17370        initSelects(document);
17371        InitCustomScrollBar();
17372        InitScrollBar();
17373
17374        if (window.FilterHelper !== undefined) {
17375          FilterHelper.resultDiv = $("#filter-helper");
17376          FilterHelper.show();
17377        }
17378      },
17379    });
17380  }
17381};
17382
17383initCalculatePreview = function () {
17384  $(".calculate-delivery.with_preview:not(.inited)").each(function () {
17385    var $this = $(this);
17386    var $calculateSpan = $this.find("span[data-event=jqm]");
17387    var $preview = $this.find(".calculate-delivery-preview");
17388
17389    $this.addClass("inited");
17390    $this.appear(
17391      function () {
17392        if ($calculateSpan.length) {
17393          if (typeof window["calculate-delivery-preview-index"] === "undefined") {
17394            window["calculate-delivery-preview-index"] = 1001;
17395          } else {
17396            ++window["calculate-delivery-preview-index"];
17397          }
17398
17399          var productId = $calculateSpan.attr("data-param-product_id") * 1;
17400          var quantity = $calculateSpan.attr("data-param-quantity") * 1;
17401
17402          if (productId > 0) {
17403            var areaIndexSended = window["calculate-delivery-preview-index"];
17404            $calculateSpan.data({ areaIndex: areaIndexSended });
17405
17406            $.ajax({
17407              url: arAsproOptions["SITE_DIR"] + "ajax/delivery.php",
17408              type: "POST",
17409              data: {
17410                is_preview: "Y",
17411                index: areaIndexSended,
17412                product_id: productId,
17413                quantity: quantity,
17414              },
17415              beforeSend: function () {
17416                $this.addClass("loadings");
17417              },
17418              success: function (response) {
17419                var areaIndex = $calculateSpan.data("areaIndex");
17420                if (typeof areaIndex !== "undefined" && areaIndex == areaIndexSended) {
17421                  $calculateSpan.hide();
17422                  $preview.html(response);
17423                  if (!$preview.find(".catalog-delivery-preview").length) {
17424                    $preview.empty();
17425                    $calculateSpan.show();
17426                  }
17427                }
17428              },
17429              error: function (xhr, ajaxOptions, thrownError) { },
17430              complete: function () {
17431                var areaIndex = $calculateSpan.data("areaIndex");
17432                if (typeof areaIndex !== "undefined" && areaIndex == areaIndexSended) {
17433                  $this.removeClass("loadings");
17434                }
17435              },
17436            });
17437          }
17438        }
17439      },
17440      { accX: 0, accY: 0 }
17441    );
17442  });
17443};
17444
17445/*set price item*/
17446if (!funcDefined("setPriceItem")) {
17447  var setPriceItem = function setPriceItem(
17448    main_block,
17449    quantity,
17450    rewrite_price,
17451    check_quantity,
17452    is_sku,
17453    show_percent,
17454    percent
17455  ) {
17456    var old_quantity = main_block.find(".to-cart").attr("data-ratio"),
17457      value =
17458        typeof rewrite_price !== "undefined" && rewrite_price
17459          ? rewrite_price
17460          : main_block.find(".to-cart").attr("data-value"),
17461      currency = main_block.find(".to-cart").attr("data-currency"),
17462      total_block =
17463        '<div class="total_summ" style="display:none;"><div>' +
17464        BX.message("TOTAL_SUMM_ITEM") +
17465        "<span></span></div></div>",
17466      price_block = main_block.find(".cost.prices"),
17467      use_percent = typeof show_percent !== "undefined" && show_percent == "Y",
17468      percent_number = typeof percent !== "undefined" && percent,
17469      sku_checked = main_block.find(".has_offer_prop").length ? "Y" : "N",
17470      check = typeof check_quantity !== "undefined" && check_quantity;
17471
17472    if (main_block.find(".counter_wrapp + .wrapp-one-click").length) {
17473      if (!main_block.find(".wrapp-one-click .total_summ").length && !is_sku)
17474        $(total_block).appendTo(main_block.find(".counter_wrapp + .wrapp-one-click"));
17475    } else if (main_block.find(".buy_block").length) {
17476      if (!main_block.find(".buy_block .total_summ").length && !is_sku)
17477        $(total_block).appendTo(main_block.find(".buy_block"));
17478    } else if (main_block.find(".counter_wrapp").length) {
17479      if (!main_block.find(".counter_wrapp .total_summ").length && !is_sku)
17480        $(total_block).appendTo(main_block.find(".counter_wrapp:first"));
17481    }
17482    if (main_block.find(".total_summ").length) {
17483      if (value && currency) {
17484        if ((1 == quantity && old_quantity == quantity) || (typeof is_sku !== "undefined" && is_sku && !check)) {
17485          main_block.find(".total_summ").slideUp(50);
17486        } else {
17487          main_block.find(".total_summ span").html(BX.Currency.currencyFormat(value * quantity, currency, true));
17488          if (main_block.find(".total_summ").is(":hidden") /* || sku_checked == 'Y'*/)
17489            main_block.find(".total_summ").slideDown(100);
17490        }
17491      } else {
17492        main_block.find(".total_summ").slideUp(100);
17493      }
17494    }
17495  };
17496}
17497
17498if (!funcDefined("getCurrentPrice")) {
17499  var getCurrentPrice = function getCurrentPrice(price, currency, print_price) {
17500    var val = "";
17501    var format_value = BX.Currency.currencyFormat(price, currency);
17502    if (print_price.indexOf(format_value) >= 0) {
17503      val = print_price.replace(
17504        format_value,
17505        '<span class="price_value">' + format_value + '</span><span class="price_currency">'
17506      );
17507      val += "</span>";
17508    } else {
17509      val = print_price;
17510    }
17511
17512    return val;
17513  };
17514}
17515
17516if (!funcDefined("initAnimateLoad")) {
17517  var initAnimateLoad = function initAnimateLoad() {
17518    $(".animate-load").click(function () {
17519      if (!jQuery.browser.mobile) {
17520        $(this).parent().addClass("loadings");
17521      }
17522    });
17523  };
17524}
17525
17526if (!funcDefined("showBasketShareBtn")) {
17527  var showBasketShareBtn = function () {
17528    if (arAsproOptions["THEME"]["SHOW_SHARE_BASKET"] === "Y") {
17529      if (!document.querySelector(".basket-checkout-block-btns")) {
17530        var checkout = document.querySelector(".basket-checkout-section-inner");
17531        if (checkout) {
17532          var btns = BX.create({
17533            tag: "div",
17534            attrs: {
17535              class: "basket-checkout-block basket-checkout-block-btns",
17536            },
17537            html: '<div class="basket-checkout-block-btns-wrap"></div>',
17538          });
17539
17540          BX.insertAfter(btns, BX.lastChild(checkout));
17541          var btnsWrap = btns.querySelector(".basket-checkout-block-btns-wrap");
17542
17543          var btnCheckout = checkout.querySelector(".basket-checkout-block-btn");
17544          if (btnCheckout) {
17545            btnsWrap.appendChild(btnCheckout);
17546          }
17547
17548          var btnFastOrder = checkout.querySelector(".fastorder");
17549          if (btnFastOrder) {
17550            btnsWrap.appendChild(btnFastOrder);
17551          }
17552
17553          if ($(".basket-btn-checkout").length && !$(".basket-btn-checkout").hasClass("disabled")) {
17554            var btnShareBasket = BX.create({
17555              tag: "div",
17556              attrs: {
17557                class: "basket-checkout-block basket-checkout-block-share colored_theme_hover_bg-block",
17558                title: arAsproOptions["THEME"]["EXPRESSION_FOR_SHARE_BASKET"],
17559              },
17560              html:
17561                '<span class="animate-load" data-event="jqm" data-param-form_id="share_basket" data-name="share_basket"><i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-share" xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewB
17561ox="0 0 14 16"><path data-name="Ellipse 223 copy 8" d="M1613,203a2.967,2.967,0,0,1-1.86-.661l-3.22,2.01a2.689,2.689,0,0,1,0,1.3l3.22,2.01A2.961,2.961,0,0,1,1613,207a3,3,0,1,1-3,3,3.47,3.47,0,0,1,.07-0.651l-3.21-2.01a3,3,0,1,1,0-4.678l3.21-2.01A3.472,3.472,0,0,1,1610,200,3,3,0,1,1,1613,203Zm0,8a1,1,0,1,0-1-1A1,1,0,0,0,1613,211Zm-8-7a1,1,0,1,0,1,1A1,1,0,0,0,1605,204Zm8-5a1,1,0,1,0,1,1A1,1,0,0,0,1613,199Z" transform="translate(-1602 -197)" fill="#B8B8B8"></path></svg></i><span class="title">' +
17562                arAsproOptions["THEME"]["EXPRESSION_FOR_SHARE_BASKET"] +
17563                "</span></span>",
17564            });
17565
17566            btnsWrap.appendChild(btnShareBasket);
17567            initAnimateLoad();
17568          }
17569        }
17570      }
17571    }
17572  };
17573}
17574
17575if (!funcDefined("showBasketHeadingBtn")) {
17576  var showBasketHeadingBtn = function () {
17577    if (document.querySelector(".page-top h1")) {
17578      var topicHeading = document.querySelector(".page-top .topic .topic__heading");
17579      if (topicHeading) {
17580        if (arAsproOptions["THEME"]["SHOW_BASKET_PRINT"] === "Y") {
17581          if (!document.querySelector(".btn_basket_heading--print")) {
17582            var btnPrintBasket = BX.create({
17583              tag: "div",
17584              attrs: {
17585                class: "btn_basket_heading btn_basket_heading--print print-link colored_theme_hover_bg-block",
17586                title: arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"],
17587              },
17588              html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i>',
17589            });
17590            BX.insertBefore(btnPrintBasket, topicHeading);
17591          }
17592        }
17593
17594        if ($(".basket-btn-checkout").length && !$(".basket-btn-checkout").hasClass("disabled")) {
17595          // if(arAsproOptions['THEME']['SHOW_SEND_BASKET_2EMAIL'] === 'Y'){
17596          // if(!document.querySelector('.btn_basket_heading--send2email')){
17597          // 	var btnSendBasket2Email = BX.create({
17598          // 		tag: 'div',
17599          // 		attrs: {
17600          // 			class: 'btn_basket_heading btn_basket_heading--with_title btn_basket_heading--send2email colored_theme_hover_bg-block',
17601          // 			title: arAsproOptions['THEME']["EXPRESSION_FOR_SEND_BASKET_2EMAIL"],
17602          // 		},
17603          // 		html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 0H4H12H13V1V3.125L15.06 4.4125C15.6448 4.77798 16 5.41892 16 6.1085V6.98162C16.0002 6.99325 16.0002 7.00488 16 7.01649V14C16 15.1046 15.1046 16 14 16H2C0.895429 16 -1.43918e-06 15.1046 -1.43918e-06 14V7.01644C-0.000202747 7.00486 -0.000203195 6.99327 -1.43918e-06 6.98167V6.1085C-1.43918e-06 5.41892 0.355238 4.77798 0.940001 4.4125L3 3.125V1V0ZM5 4.2335L5 2H11V7L11 8.23381L9.62943 9.05615L8.64018 8.23178C8.26934 7.92274 7.73066 7.92274 7.35981 8.23178L6.37057 9.05615L5 8.23381V4.2335ZM2 6.1085L3 5.4835V7.03381L2 6.43381V6.1085ZM14 6.1085L13 5.4835V7.03381L14 6.43381V6.1085ZM12.4379 14L8 10.3017L3.56205 14H12.4379ZM14 12.6983V8.76619L11.2567 10.4122L14 12.6983ZM2 8.76619V12.6983L4.74333 10.4122L2 8.76619Z" fill="#B8B8B8"/></svg></i><span class="title">' + arAsproOptions['THEME']["EXPRESSION_FOR_SEND_BASKET_2EMAIL"] + '</span>',
17604          // 	});
17605          // 	BX.insertBefore(btnSendBasket2Email, topicHeading);
17606          // }
17607          // }
17608
17609          if (arAsproOptions["THEME"]["SHOW_DOWNLOAD_BASKET"] === "Y") {
17610            if (!document.querySelector(".btn_basket_heading--download")) {
17611              var btnDownloadBasket = BX.create({
17612                tag: "div",
17613                attrs: {
17614                  class:
17615                    "btn_basket_heading btn_basket_heading--with_title btn_basket_heading--download colored_theme_hover_bg-block",
17616                  title: arAsproOptions["THEME"]["EXPRESSION_FOR_DOWNLOAD_BASKET"],
17617                },
17618                events: {
17619                  click: BX.proxy(function (e) {
17620                    if (!e) {
17621                      e = window.event;
17622                    }
17623
17624                    BX.PreventDefault(e);
17625
17626                    var button = e.target.closest(".btn_basket_heading");
17627                    if (button) {
17628                      if (BX.hasClass(button, "loadings")) {
17629                        return;
17630                      }
17631
17632                      BX.addClass(button, "loadings");
17633                      setTimeout(function () {
17634                        BX.removeClass(button, "loadings");
17635                      }, 2000);
17636                    }
17637
17638                    location.href =
17639                      "/ajax/download_basket.php?params[type]=" +
17640                      arAsproOptions["THEME"]["BASKET_FILE_DOWNLOAD_TEMPLATE"];
17641                  }, this),
17642                },
17643                html:
17644                  '<i class="svg colored_theme_hover_bg-el-svg">
17644<svg class="svg" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 14H14L14 6H11H10V5V2H5V6H7H9V8V10V12H7H5V14ZM13.6716 4L12 2.32843V4H13.6716ZM6 8H7V10H6H5H3H2V8H3H5H6ZM3 6H2H0V8V10V12H2H3V14V16H5H14H16V14V4.32843C16 3.79799 15.7893 3.28929 15.4142 2.91421L13.0858 0.585786C12.7107 0.210714 12.202 0 11.6716 0H5H3V2V6Z" fill="#B8B8B8"/></svg></i><span class="title">' +
17645                  arAsproOptions["THEME"]["EXPRESSION_FOR_DOWNLOAD_BASKET"] +
17646                  "</span>",
17647              });
17648              BX.insertBefore(btnDownloadBasket, topicHeading);
17649            }
17650          }
17651        } else {
17652          BX.remove(document.querySelector(".btn_basket_heading--send2email"));
17653          BX.remove(document.querySelector(".btn_basket_heading--download"));
17654        }
17655
17656        var eventdata = { parent: topicHeading };
17657        BX.onCustomEvent("onShowBasketHeadingBtn", [eventdata]);
17658      }
17659    }
17660  };
17661}
17662
17663$(window).on("load", function () {
17664  //check width for menu and search
17665  //CheckSearchWidth();
17666});
17667
17668$(document).ready(function () {
17669  MegaMenuFixed();
17670  InitScrollBar();
17671
17672  /*ripple effect for buttons*/
17673  $.ripple(".btn", {
17674    debug: false, // Turn Ripple.js logging on/off
17675    on: "mouseenter", // The event to trigger a ripple effect
17676
17677    opacity: 0.4, // The opacity of the ripple
17678    color: "auto", // Set the background color. If set to "auto", it will use the text color
17679    multi: true, // Allow multiple ripples per element
17680
17681    duration: 0.6, // The duration of the ripple
17682
17683    easing: "linear", // The CSS3 easing function of the ripple
17684  });
17685  /**/
17686
17687  //ecommerce order
17688  if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
17689    var arUrl = parseUrlQuery();
17690    if ("ORDER_ID" in arUrl) {
17691      var _id = arUrl["ORDER_ID"];
17692      if (arAsproOptions["COUNTERS"]["USE_FULLORDER_GOALS"] !== "N") {
17693        var eventdata = { goal: "goal_order_success", result: _id };
17694        BX.onCustomEvent("onCounterGoals", [eventdata]);
17695      }
17696      if (checkCounters()) {
17697        if (typeof localStorage !== "undefined") {
17698          var val = localStorage.getItem("gtm_e_" + _id),
17699            d = "";
17700          try {
17701            d = JSON.parse(val);
17702          } catch (e) {
17703            d = val;
17704          }
17705          if (typeof d === "object") {
17706            window.dataLayer = window.dataLayer || [];
17707            dataLayer.push({ event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["PURCHASE"], ecommerce: d });
17708          }
17709
17710          if (typeof localStorage !== "undefined") {
17711            localStorage.removeItem("gtm_e_" + _id);
17712          }
17713        }
17714      }
17715    }
17716  }
17717  var bSafary = false;
17718  if (typeof jQuery.browser == "object") bSafary = jQuery.browser.safari;
17719  else if (typeof browser == "object") bSafary = browser.safari;
17720  if (!bSafary) {
17721    //CheckTopMenuPadding();
17722    //CheckTopMenuOncePadding();
17723    CheckTopMenuDotted();
17724    CheckHeaderFixed();
17725    checkMenuLines();
17726    //setTimeout(function() {$(window).resize();}, 150); // need to check resize flexslider & menu
17727    //setTimeout(function() {$(window).scroll();}, 250); // need to check position fixed ask block
17728  } else {
17729    setTimeout(function () {
17730      $(window).resize(); // need to check resize flexslider & menu
17731      setTimeout(function () {
17732        //CheckTopMenuPadding();
17733        //CheckTopMenuOncePadding();
17734        CheckTopMenuDotted();
17735        CheckHeaderFixed();
17736        checkMenuLines();
17737
17738        setTimeout(function () {
17739          $(window).scroll();
17740        }, 50);
17741      }, 50);
17742    }, 350);
17743  }
17744
17745  showItemStoresAmount();
17746
17747  /*for filter scrol in mobile*/
17748  if (window.matchMedia("(max-width: 767px)").matches) {
17749    $(".bx_filter .scrollbar").addClass("mobile-scroll").removeClass("scroll-init");
17750    $(".bx_filter .srollbar-custom").addClass("mobile-scroll").removeClass("scroll-init");
17751    $(".bx_filter .bx_filter_section form .bx_filter_parameters").addClass("mobile-scroll").removeClass("scroll-init");
17752    if ($(".bx_filter .mobile-scroll.scrollbar").length)
17753      $(".bx_filter .mobile-scroll.scrollbar").mCustomScrollbar("destroy");
17754    if ($(".bx_filter .mobile-scroll.srollbar-custom").length)
17755      $(".bx_filter .mobile-scroll.srollbar-custom").mCustomScrollbar("destroy");
17756  }
17757  /**/
17758
17759  if (arAsproOptions["THEME"]["USE_DEBUG_GOALS"] === "Y") $.cookie("_ym_debug", 1, { path: "/" });
17760  else $.cookie("_ym_debug", null, { path: "/" });
17761
17762  /* change type2 menu for fixed */
17763  if ($("#headerfixed .js-nav").length) {
17764    //if (arAsproOptions["THEME"]["HEADER_FIXED"] == 2) CheckHeaderFixedMenu();
17765
17766    setTimeout(function () {
17767      $("#headerfixed .js-nav").addClass("opacity1");
17768    }, 350);
17769  }
17770
17771  // -- scroll after apply option
17772  if ($(".instagram_ajax").length) {
17773    BX.addCustomEvent("onCompleteAction", function (eventdata) {
17774      if (eventdata.action === "instagrammLoaded") scrollPreviewBlock();
17775    });
17776  } else scrollPreviewBlock();
17777
17778  scrollToTop();
17779  checkVerticalMobileFilter();
17780
17781  $("[data-scroll-block]").click(function () {
17782    var _this = $(this);
17783    if (_this.data("scrollBlock")) {
17784      var target = $(_this.data("scrollBlock"));
17785      if (target.length) {
17786        scroll_block(target);
17787      }
17788    }
17789  });
17790
17791  $.extend($.validator.messages, {
17792    required: BX.message("JS_REQUIRED"),
17793    email: BX.message("JS_FORMAT"),
17794    equalTo: BX.message("JS_PASSWORD_COPY"),
17795    minlength: BX.message("JS_PASSWORD_LENGTH"),
17796    remote: BX.message("JS_ERROR"),
17797  });
17798
17799  $.validator.addMethod(
17800    "regexp",
17801    function (value, element, regexp) {
17802      var re = new RegExp(regexp);
17803      console.log(value);
17804      return this.optional(element) || re.test(value);
17805    },
17806    BX.message("JS_FORMAT")
17807  );
17808
17809  $.validator.addMethod(
17810    "filesize",
17811    function (value, element, param) {
17812      return this.optional(element) || element.files[0].size <= param;
17813    },
17814    BX.message("JS_FILE_SIZE")
17815  );
17816
17817  $.validator.addMethod(
17818    "date",
17819    function (value, element, param) {
17820      var status = false;
17821      if (!value || value.length <= 0) {
17822        status = false;
17823      } else {
17824        // html5 date allways yyyy-mm-dd
17825        var re = new RegExp("^([0-9]{4})(.)([0-9]{2})(.)([0-9]{2})$");
17826        var matches = re.exec(value);
17827        if (matches) {
17828          var composedDate = new Date(matches[1], matches[3] - 1, matches[5]);
17829          status =
17830            composedDate.getMonth() == matches[3] - 1 &&
17831            composedDate.getDate() == matches[5] &&
17832            composedDate.getFullYear() == matches[1];
17833        } else {
17834          // firefox
17835          var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$");
17836          var matches = re.exec(value);
17837          if (matches) {
17838            var composedDate = new Date(matches[5], matches[3] - 1, matches[1]);
17839            status =
17840              composedDate.getMonth() == matches[3] - 1 &&
17841              composedDate.getDate() == matches[1] &&
17842              composedDate.getFullYear() == matches[5];
17843          }
17844        }
17845      }
17846      return status;
17847    },
17848    BX.message("JS_DATE")
17849  );
17850
17851  $.validator.addMethod(
17852    "extension",
17853    function (value, element, param) {
17854      param = typeof param === "string" ? param.replace(/,/g, "|") : "png|jpe?g|gif";
17855      return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
17856    },
17857    BX.message("JS_FILE_EXT")
17858  );
17859
17860  $.validator.addMethod(
17861    "captcha",
17862    function (value, element, params) {
17863      return $.validator.methods.remote.call(this, value, element, {
17864        url: arAsproOptions["SITE_DIR"] + "ajax/check-captcha.php",
17865        type: "post",
17866        data: {
17867          captcha_word: value,
17868          captcha_sid: function () {
17869            return $(element).closest("form").find('input[name="captcha_sid"]').val();
17870          },
17871        },
17872      });
17873    },
17874    BX.message("JS_ERROR")
17875  );
17876
17877  $.validator.addMethod(
17878    "recaptcha",
17879    function (value, element, param) {
17880      var id = $(element).closest("form").find(".g-recaptcha").attr("data-widgetid");
17881      if (typeof id !== "undefined") {
17882        return grecaptcha.getResponse(id) != "";
17883      } else {
17884        return true;
17885      }
17886    },
17887    BX.message("JS_RECAPTCHA_ERROR")
17888  );
17889
17890  $.validator.addClassRules({
17891    /*phone: {
17892      regexp: arAsproOptions["THEME"]["VALIDATE_PHONE_MASK"],
17893    },*/
17894    confirm_password: {
17895      equalTo: 'input[name="REGISTER[PASSWORD]"]',
17896      minlength: 6,
17897    },
17898    password: {
17899      minlength: 6,
17900    },
17901    inputfile: {
17902      extension: arAsproOptions["THEME"]["VALIDATE_FILE_EXT"],
17903      filesize: 5000000,
17904    },
17905    captcha: {
17906      captcha: "",
17907    },
17908    recaptcha: {
17909      recaptcha: "",
17910    },
17911  });
17912
17913  // if (arAsproOptions["THEME"]["PHONE_MASK"]) {
17914  //   $("input.phone").inputmask("mask", { mask: arAsproOptions["THEME"]["PHONE_MASK"] });
17915  // }
17916
17917  // init calculate delivery with preview
17918  initCalculatePreview();
17919
17920  /*city*/
17921  $("select.region").on("change", function () {
17922    var val = parseInt($(this).val());
17923    if ($("select.city").length) {
17924      if (val) {
17925        $("select.city option").hide();
17926        $("select.city option").prop("disabled", "disabled");
17927        $("select.city option[data-parent_section=" + val + "]").prop("disabled", "");
17928        $("select.city option:eq(0)").prop("disabled", "");
17929        $("select.city").ikSelect("reset");
17930        $("select.city option[data-parent_section=" + val + "]").show();
17931      } else $("select.city option").prop("disabled", "disabled");
17932      $("select.city option:eq(0)").prop("disabled", "");
17933      $("select.city").ikSelect("reset");
17934    }
17935  });
17936
17937  $("select.city, select.region").on("change", function () {
17938    var _this = $(this),
17939      val = parseInt(_this.val());
17940    if (_this.hasClass("region")) {
17941      $("select.city option:eq(0)").show();
17942      $("select.city").val(0);
17943    }
17944
17945    if ((_this.hasClass("region") && !val) || _this.hasClass("city")) {
17946      $.ajax({
17947        type: "POST",
17948        data: { ID: val },
17949      }).success(function (html) {
17950        var ob = BX.processHTML(html);
17951        $(".ajax_items")[0].innerHTML = ob.HTML;
17952        BX.ajax.processScripts(ob.SCRIPT);
17953      });
17954    }
17955  });
17956
17957  $(document).on("mouseenter", ".section-gallery-wrapper .section-gallery-wrapper__item", function () {
17958    $(this).siblings().removeClass("_active");
17959    $(this).addClass("_active");
17960  });
17961
17962  $(document).on("mouseleave", ".image_wrapper_block", function () {
17963    const $elements = $(this).find(".section-gallery-wrapper .section-gallery-wrapper__item");
17964    if ($elements.length) {
17965      $elements.removeClass("_active");
17966      $($elements[0]).addClass("_active");
17967    }
17968  });
17969
17970  $(document).on("click", ".hint .icon", function (e) {
17971    var tooltipWrapp = $(this).closest(".hint");
17972
17973    if (tooltipWrapp.hasClass("active")) {
17974      tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200);
17975    } else {
17976      tooltipWrapp.addClass("active");
17977      tooltipWrapp.find(".tooltip").slideDown(200);
17978      tooltipWrapp.find(".tooltip_close").click(function (e) {
17979        e.stopPropagation();
17980        tooltipWrapp.removeClass("active").find(".tooltip").slideUp(100);
17981      });
17982    }
17983    e.stopPropagation();
17984  });
17985
17986  $(document).on("click", ".mobile_regions .mobile-city a", function (e) {
17987    e.preventDefault();
17988
17989    let $this = $(this);
17990    let regionId = $this.data("id");
17991
17992    if (regionId) {
17993      $.cookie("current_region", regionId, {
17994        path: "/",
17995        domain: arAsproOptions["SITE_ADDRESS"],
17996      });
17997
17998      let locationId = $this.data("locid");
17999      if (locationId) {
18000        $.cookie("current_location", locationId, {
18001          path: "/",
18002          domain: arAsproOptions["SITE_ADDRESS"],
18003        });
18004      } else {
18005        $.cookie("current_location", "", {
18006          expires: -1,
18007          path: "/",
18008          domain: arAsproOptions["SITE_ADDRESS"],
18009        });
18010      }
18011
18012      let href = $this.attr("href");
18013      location.href = href;
18014    }
18015  });
18016
18017  /* toggle */
18018  var $this = this,
18019    previewParClosedHeight = 25;
18020
18021  $("section.toggle > label").prepend($("<i />").addClass("fa fa-plus"));
18022  $("section.toggle > label").prepend($("<i />").addClass("fa fa-minus"));
18023  $("section.toggle.active > p").addClass("preview-active");
18024  $("section.toggle.active > div.toggle-content").slideDown(350, function () { });
18025
18026  $("section.toggle > label").click(function (e) {
18027    var parentSection = $(this).parent(),
18028      parentWrapper = $(this).parents("div.toogle"),
18029      previewPar = false,
18030      isAccordion = parentWrapper.hasClass("toogle-accordion");
18031
18032    if (isAccordion && typeof e.originalEvent != "undefined") {
18033      parentWrapper.find("section.toggle.active > label").trigger("click");
18034    }
18035
18036    parentSection.toggleClass("active");
18037
18038    // Preview Paragraph
18039    if (parentSection.find("> p").get(0)) {
18040      previewPar = parentSection.find("> p");
18041      var previewParCurrentHeight = previewPar.css("height");
18042      previewPar.css("height", "auto");
18043      var previewParAnimateHeight = previewPar.css("height");
18044      previewPar.css("height", previewParCurrentHeight);
18045    }
18046
18047    // Content
18048    var toggleContent = parentSection.find("> div.toggle-content");
18049
18050    if (parentSection.hasClass("active")) {
18051      $(previewPar).animate(
18052        {
18053          height: previewParAnimateHeight,
18054        },
18055        350,
18056        function () {
18057          $(this).addClass("preview-active");
18058        }
18059      );
18060      toggleContent.slideDown(350, function () { });
18061    } else {
18062      $(previewPar).animate(
18063        {
18064          height: previewParClosedHeight,
18065        },
18066        350,
18067        function () {
18068          $(this).removeClass("preview-active");
18069        }
18070      );
18071      toggleContent.slideUp(350, function () { });
18072    }
18073  });
18074
18075  if (typeof $.fn.footable == "function") {
18076    $(".tables-responsive .responsive").footable(); //responsive table
18077  }
18078
18079  $("a[rel=tooltip]").tooltip();
18080  $("span[data-toggle=tooltip]").tooltip();
18081
18082  $(".toggle .more_items").on("click", function () {
18083    $(this).closest(".toggle").find(".collapsed").css("display", "inline-block").removeClass("collapsed");
18084    $(this).remove();
18085    if (typeof $(this).data("resize") !== "undefined" && $(this).data("resize")) $(window).resize();
18086  });
18087  $(".toggle_menu .more_items").on("click", function () {
18088    $(this).closest(".toggle_menu").find(".collapsed").addClass("clicked_exp");
18089    $(this).remove();
18090  });
18091
18092  /* search sync */
18093  $(document).on("keyup", ".search-input-div input", function (e) {
18094    var inputValue = $(this).val();
18095    $(".search-input-div input:not(:focus").val(inputValue);
18096
18097    if ($(this).closest("#headerfixed").length) {
18098      if (e.keyCode == 13) $(".search form").submit();
18099    }
18100  });
18101  $(document).on("click", ".search-button-div button", function (e) {
18102    if ($(this).closest("#headerfixed").length) $(".search form").submit();
18103  });
18104
18105  $(".inline-search-show, .inline-search-hide").on("click", function (e) {
18106    CloseMobilePhone();
18107    // if(window.matchMedia('(min-width: 600px)').matches)
18108    // {
18109    if (typeof $(this).data("type_search") != "undefined" && $(this).data("type_search") == "fixed")
18110      $(".inline-search-block").addClass("fixed");
18111
18112    if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") {
18113      /*setTimeout(function(){
18114          $('.inline-search-block.fixed.big .search-input').focus();
18115        }, 200);*/
18116      $(".inline-search-block.fixed.big .search-input").focus();
18117    }
18118    if (arAsproOptions["THEME"]["TYPE_SEARCH"] != "fixed") {
18119      $("#title-search-input").focus();
18120    }
18121
18122    $(".inline-search-block").toggleClass("show");
18123    if ($(".top-block").length) {
18124      if ($(".inline-search-block").hasClass("show"))
18125        $(".inline-search-block").css("background", $(".top-block").css("background-color"));
18126      else $(".inline-search-block").css("background", "#fff");
18127    }
18128    if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") {
18129      if ($(".inline-search-block").hasClass("show")) $('<div class="jqmOverlay search"></div>').appendTo("body");
18130      else {
18131        $("#title-search-input").blur();
18132        $(".jqmOverlay").detach();
18133      }
18134    }
18135    // }
18136    // else
18137    // 	location.href = arAsproOptions['PAGES']['CATALOG_PAGE_URL']+'?q';
18138  });
18139
18140  /* close search block */
18141  $("html, body").on("mousedown", function (e) {
18142    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
18143      e.stopPropagation();
18144
18145      var search_target = $(e.target).closest(".title-search-result");
18146      if (
18147        !$(e.target).closest("inline-search-block").length
18148        && !$(e.target).closest(".dropdown-select.searchtype").length
18149        && !$(e.target).hasClass("svg")
18150        && !search_target.length
18151      ) {
18152        $(".inline-search-block").removeClass("show");
18153        $(".title-search-result").hide();
18154        if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") $(".jqmOverlay.search").detach();
18155      }
18156
18157      if ($("#mobilePhone").length) {
18158        CloseMobilePhone();
18159      }
18160
18161      if ($("#basket_line .basket_fly").length && parseInt($("#basket_line .basket_fly").css("right")) >= 0) {
18162        if (!$(e.target).closest(".basket_wrapp").length) {
18163          $("#basket_line .basket_fly")
18164            .stop()
18165            .animate({ right: -$("#basket_line .basket_fly").outerWidth() }, 150);
18166          $("#basket_line .basket_fly .opener > div").removeClass("cur");
18167          $("#basket_line .basket_fly").removeClass("swiped");
18168        }
18169      }
18170
18171      if (isMobile) {
18172        if (search_target.length) location.href = search_target.attr("href");
18173      }
18174
18175      if (!$(e.target).closest(".js-info-block").length && !$(e.target).closest(".js-show-info-block").length) {
18176        $(".js-show-info-block").removeClass("opened");
18177        $(".js-info-block").fadeOut();
18178      }
18179
18180      if (!$(e.target).closest(".hint.active").length) {
18181        $(".hint.active .icon").trigger("click");
18182      }
18183
18184      var class_name = $(e.target).attr("class");
18185      if (typeof class_name == "undefined" || class_name.indexOf("tooltip") < 0)
18186        //tooltip link
18187        $(".tooltip-link").tooltip("hide");
18188    }
18189  });
18190  $(".inline-search-block")
18191    .find("*")
18192    .on("mousedown", function (e) {
18193      e.stopPropagation();
18194    });
18195
18196  initAnimateLoad();
18197
18198  /*check all opt table items*/
18199  $(document).on("change", "input#select_all_items", function () {
18200    var _this = $(this);
18201    var notOfferCount = 0;
18202    var bComplect = _this.closest(".complect_main_wrap").length;
18203    if (bComplect) {
18204      notOfferCount = _this
18205        .closest(".complect_main_wrap")
18206        .find(".catalog-block-view__item .counter_wrapp:not(.ce_cmp_visible) .button_block .to-cart").length;
18207    } else {
18208      notOfferCount = $(
18209        ".table-view__item:not([data-product_type=3]), .table-view-offer-tree .table-view__item[data-product_type=3] .counter_wrapp:not(.ce_cmp_visible)"
18210      ).find(".button_block .to-cart").length;
18211    }
18212    var wishCount = $(
18213      ".table-view__item:not([data-product_type=3]), .table-view-offer-tree .table-view__item[data-product_type=3]"
18214    ).find(".item-icons .wish_item_button .wish_item.to").length;
18215    var allGoodsCount = $(".table-view__item").length;
18216
18217    if (_this.is(":checked")) {
18218      //buy && wish
18219      if (notOfferCount != 0) {
18220        $(".opt_action:not([data-action=compare])").removeClass("no-action");
18221      }
18222
18223      //compare
18224      $(".opt_action[data-action=compare]").removeClass("no-action");
18225
18226      $(".opt_action").addClass("animate-load");
18227      $(".opt_action .text").remove();
18228
18229      //buy
18230      $('<div class="text">(<span>' + notOfferCount + "</span>)</div>").appendTo($(".opt_action[data-action=buy]"));
18231
18232      //wish
18233      $('<div class="text muted">(<span>' + wishCount + "</span>)</div>").appendTo($(".opt_action[data-action=wish]"));
18234
18235      //compare
18236      $('<div class="text muted">(<span>' + allGoodsCount + "</span>)</div>").appendTo(
18237        $(".opt_action[data-action=compare]")
18238      );
18239
18240      $('input[name="chec_item"]').prop("checked", "checked");
18241    } else {
18242      $(".opt_action").addClass("no-action");
18243      $(".opt_action").removeClass("animate-load");
18244      $(".opt_action .text").remove();
18245
18246      $('input[name="chec_item"]').removeAttr("checked");
18247    }
18248
18249    if (_this.closest(".complect_header_block").length && typeof setNewPriceComplect === "function") {
18250      setNewPriceComplect();
18251    }
18252  });
18253
18254  /*check opt table item*/
18255  $(document).on("change", "input[name='chec_item']", function () {
18256    var _this = $(this);
18257
18258    var canBuy =
18259      _this.closest(".table-view__item").find(".button_block .to-cart").length ||
18260      _this.closest(".catalog-block-view__item").find(".button_block .to-cart").length;
18261    var isOffer = _this.closest(".main_item_wrapper").attr("data-product_type") == "3" && !canBuy;
18262
18263    if (_this.is(":checked")) {
18264      $(".opt_action").each(function () {
18265        var _this = $(this);
18266
18267        var isBuyAction = _this.attr("data-action") == "buy";
18268        var isWishAction = _this.attr("data-action") == "wish";
18269
18270        if (isOffer && (isBuyAction || isWishAction)) {
18271          return true;
18272        }
18273
18274        if (isBuyAction && !canBuy) {
18275          return true;
18276        }
18277
18278        if (_this.find(".text").length) {
18279          var count = parseInt(_this.find(".text span").text());
18280          _this.find(".text span").text(++count);
18281        } else {
18282          _this.removeClass("no-action");
18283          _this.addClass("animate-load");
18284          $('<div class="text muted">(<span>1</span>)</div>').appendTo(_this);
18285        }
18286      });
18287    } else {
18288      $(".opt_action").each(function () {
18289        var _this = $(this);
18290
18291        var isBuyAction = _this.attr("data-action") == "buy";
18292        var isWishAction = _this.attr("data-action") == "wish";
18293
18294        if (isOffer && (isBuyAction || isWishAction)) {
18295          return true;
18296        }
18297
18298        if (isBuyAction && !canBuy) {
18299          return true;
18300        }
18301
18302        if (_this.find(".text").length) {
18303          var count = parseInt(_this.find(".text span").text());
18304          --count;
18305          _this.find(".text span").text(count);
18306
18307          if (!count) {
18308            _this.addClass("no-action");
18309            _this.removeClass("animate-load");
18310            _this.find(".text").remove();
18311          }
18312        }
18313      });
18314    }
18315  });
18316
18317  /*buy|wish|compare opt table items*/
18318  $(document).on("click", ".opt_action", function () {
18319    var _this = $(this),
18320      action = _this.data("action"),
18321      itemsAll = [],
18322      basketParams = {
18323        type: "multiple",
18324        iblock_id: _this.data("iblock_id"),
18325        action: action,
18326        items: {},
18327      };
18328
18329    if (!_this.hasClass("no-action")) {
18330      $(".opt_action").addClass("no-action");
18331      _this.removeClass("no-action");
18332
18333      $(".table-view__item, .catalog-block-view__item").each(function () {
18334        var _this = $(this);
18335        var canBuy = _this.find(".button_block .to-cart").length;
18336        var add = _this.find('input[name="chec_item"]').is(":checked") && (canBuy || action != "buy");
18337        var addOffer = _this.data("product_type") == "3" && _this.find(".button_block .to-cart").length;
18338        if (add) {
18339          var itemId = addOffer ? _this.find(".button_block .to-cart").data("item") : _this.data("id");
18340          itemsAll.push(_this[0]);
18341          basketParams["items"][itemId] = {};
18342          basketParams["items"][itemId]["id"] = itemId;
18343          basketParams["items"][itemId]["product_type"] = _this.data("product_type");
18344          basketParams["items"][itemId]["quantity"] = _this.find('input[name="quantity"]').val();
18345          if (addOffer) {
18346            basketParams["items"][itemId]["add_offer"] = "Y";
18347          }
18348        }
18349      });
18350      $.ajax({
18351        type: "POST",
18352        url: arAsproOptions["SITE_DIR"] + "ajax/item.php",
18353        data: basketParams,
18354        dataType: "json",
18355        success: function (data) {
18356          if ("STATUS" in data) {
18357            if (data.STATUS !== "OK") {
18358              showBasketError(BX.message(data.MESSAGE) + " <br/>" + data.MESSAGE_EXT);
18359            }
18360
18361            //js notice
18362            if (typeof JNoticeSurface !== "undefined") {
18363              switch (action) {
18364                case "buy":
18365                  JNoticeSurface.get().onAdd2cart(itemsAll);
18366                  break;
18367                case "wish":
18368                  JNoticeSurface.get().onAdd2Delay(itemsAll);
18369                  break;
18370                case "compare":
18371                  JNoticeSurface.get().onAdd2Compare(itemsAll);
18372                  break;
18373                default:
18374                  console.log("nothing");
18375              }
18376            }
18377            //
18378
18379            if ($(".header-cart.fly").length) {
18380              arBasketAsproCounters.DEFAULT = true;
18381              SetActualBasketFlyCounters(true);
18382            } else {
18383              if ($("#ajax_basket").length) {
18384                reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "N", "", true);
18385              } else {
18386                reloadBasketCounters("", true);
18387              }
18388            }
18389          }
18390          _this.parent().removeClass("loadings");
18391          $(".opt_action").removeClass("no-action");
18392        },
18393      });
18394    }
18395  });
18396
18397  //fix opt checked for back in browser
18398  setTimeout(function () {
18399    if ($('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').length) {
18400      $('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').prop("checked", false);
18401    }
18402  }, 1);
18403
18404  /*check mobile device*/
18405  // if (isMobile) {
18406  //   $(document).on("click", '*[data-event="jqm"]', function (e) {
18407  //     e.preventDefault();
18408  //     e.stopPropagation();
18409  //     var _this = $(this);
18410  //     var name = _this.data("name");
18411
18412  //     if (
18413  //       window.matchMedia("(min-width:768px)").matches ||
18414  //       (typeof _this.data("no-mobile") !== "undefinde" && _this.data("no-mobile") == "Y")
18415  //     ) {
18416  //       if (!$(this).hasClass("clicked")) {
18417  //         $(this).addClass("clicked");
18418  //         $(this).jqmEx();
18419  //         $(this).trigger("click");
18420  //       }
18421  //       return false;
18422  //     } else if (name.length) {
18423  //       var script = arAsproOptions["SITE_DIR"] + "form/";
18424  //       var paramsStr = "";
18425  //       var arTriggerAttrs = {};
18426  //       $.each(_this.get(0).attributes, function (index, attr) {
18427  //         var attrName = attr.nodeName;
18428  //         var attrValue = _this.attr(attrName);
18429  //         arTriggerAttrs[attrName] = attrValue;
18430  //         if (/^data\-param\-(.+)$/.test(attrName)) {
18431  //           var key = attrName.match(/^data\-param\-(.+)$/)[1];
18432  //           paramsStr += key + "=" + attrValue + "&";
18433  //         }
18434  //       });
18435
18436  //       var triggerAttrs = JSON.stringify(arTriggerAttrs);
18437  //       var encTriggerAttrs = encodeURIComponent(triggerAttrs);
18438  //       script += "?name=" + name + "&" + paramsStr + "data-trigger=" + encTriggerAttrs;
18439
18440  //       if (previewMode && _this.attr("href") !== undefined) {
18441  //         script = _this.attr("href");
18442  //       }
18443
18444  //       location.href = script;
18445  //     }
18446  //   });
18447
18448  //   $(".fancybox").removeClass("fancybox");
18449  // } else {
18450  $(document).on("click", '*[data-event="jqm"]', function (e) {
18451    e.preventDefault();
18452    e.stopPropagation();
18453
18454    var _this = $(this);
18455    var name = _this.data("name");
18456    if (previewMode && ((name.length && name == "auth") || window.matchMedia("(max-width:400px)").matches)) {
18457      var script = arAsproOptions["SITE_DIR"] + "form/";
18458      var paramsStr = "";
18459      var arTriggerAttrs = {};
18460      $.each(_this.get(0).attributes, function (index, attr) {
18461        var attrName = attr.nodeName;
18462        var attrValue = _this.attr(attrName);
18463        arTriggerAttrs[attrName] = attrValue;
18464        if (/^data\-param\-(.+)$/.test(attrName)) {
18465          var key = attrName.match(/^data\-param\-(.+)$/)[1];
18466          paramsStr += key + "=" + attrValue + "&";
18467        }
18468      });
18469
18470      var triggerAttrs = JSON.stringify(arTriggerAttrs);
18471      var encTriggerAttrs = encodeURIComponent(triggerAttrs);
18472      script += "?name=" + name + "&" + paramsStr + "data-trigger=" + encTriggerAttrs;
18473
18474      if (_this.attr("href") !== undefined) {
18475        script = _this.attr("href");
18476      }
18477
18478      location.href = script;
18479    } else {
18480      if (!$(this).hasClass("clicked")) {
18481        $(this).addClass("clicked");
18482        $(this).jqmEx();
18483        $(this).trigger("click");
18484      }
18485    }
18486
18487    return false;
18488  });
18489  // }
18490
18491  BX.addCustomEvent("onCompleteAction", function (eventdata, _this) {
18492    try {
18493      if (eventdata.action === "loadForm") {
18494        $(_this).parent().removeClass("loadings");
18495        $(_this).removeClass("clicked");
18496
18497        if ($(_this).hasClass("one_click_buy_trigger")) {
18498          $(".wrapp_one_click > span").removeClass("clicked");
18499          $(".one_click").removeClass("clicked");
18500        } else if ($(_this).hasClass("one_click_buy_basket_trigger")) {
18501          $(".fast_order").removeClass("clicked");
18502        }
18503      } else if (eventdata.action === "loadBasket") {
18504        $(".basket-link.basket").attr("title", $("<div/>").html(arBasketPrices.BASKET_SUMM_TITLE).text());
18505        $(".basket-link.delay").attr("title", $("<div/>").html(arBasketPrices.DELAY_SUMM_TITLE).text());
18506
18507        if (arBasketPrices.BASKET_COUNT > 0) {
18508          $(".basket-link.basket").addClass("basket-count");
18509          $(".basket-link.basket .count").removeClass("empted");
18510          if ($(".basket-link.basket .prices").length)
18511            $(".basket-link.basket .prices").html(arBasketPrices.BASKET_SUMM);
18512        } else {
18513          $(".basket-link.basket").removeClass("basket-count");
18514          $(".basket-link.basket .count").addClass("empted");
18515          if ($(".basket-link.basket .prices").length)
18516            $(".basket-link.basket .prices").html(arBasketPrices.BASKET_SUMM_TITLE_SMALL);
18517        }
18518        $(".basket-link.basket .count").text(arBasketPrices.BASKET_COUNT);
18519        if (arBasketPrices.DELAY_COUNT > 0) {
18520          $(".basket-link.delay").addClass("basket-count");
18521          $(".basket-link.delay .count").removeClass("empted");
18522          $(".basket-link.delay[data-href]").attr("href", $(".basket-link.delay[data-href]").data("href"));
18523        } else {
18524          $(".basket-link.delay").removeClass("basket-count");
18525          $(".basket-link.delay .count").addClass("empted");
18526          $(".basket-link.delay[data-href]").attr("href", "javascript:void(0)")
18527        }
18528        $(".basket-link.delay .count").text(arBasketPrices.DELAY_COUNT);
18529
18530        updateBottomIconsPanel(arBasketPrices);
18531      } else if (eventdata.action === "loadActualBasketCompare") {
18532        var compare_count = Object.keys(arBasketAspro.COMPARE).length;
18533        if (compare_count > 0) {
18534          $(".basket-link.compare").addClass("basket-count");
18535          $(".basket-link.compare .count").removeClass("empted");
18536          if ($("#compare_fly").length) $("#compare_fly").removeClass("empty_block");
18537        } else {
18538          $(".basket-link.compare").removeClass("basket-count");
18539          $(".basket-link.compare .count").addClass("empted");
18540          if ($("#compare_fly").length) $("#compare_fly").addClass("empty_block");
18541        }
18542        $(".basket-link.compare .count").text(compare_count);
18543
18544        updateBottomIconsPanel(arBasketAspro);
18545      } else if (eventdata.action === "loadRSS") {
18546      } else if (eventdata.action === "ajaxContentLoaded") {
18547      } else if (eventdata.action === "jsLoadBlock") {
18548        initCountdown();
18549        setStatusButton();
18550        InitFlexSlider();
18551        setTimeout(function () {
18552          InitOwlSlider();
18553        }, 200);
18554        InitFancyBox();
18555
18556        checkLinkedArticles();
18557        checkLinkedBlocks(".linked-banners-list");
18558        lazyLoadPagenBlock();
18559
18560        if (typeof window["stickySidebar"] !== "undefined") {
18561          window["stickySidebar"].updateSticky();
18562        }
18563      }
18564    } catch (e) {
18565      console.error(e);
18566    }
18567  });
18568
18569  /*slices*/
18570  if ($(".banners-small .item.normal-block").length) $(".banners-small .item.normal-block").sliceHeight();
18571  if ($(".teasers .item").length) $(".teasers .item").sliceHeight();
18572  if ($(".wrap-portfolio-front .row.items > div").length)
18573    $(".wrap-portfolio-front .row.items > div").sliceHeight({ row: ".row.items", item: ".item1" });
18574
18575  /* bug fix in ff*/
18576  $("img").removeAttr("draggable");
18577
18578  $(".title-tab-heading").on("click", function () {
18579    var container = $(this).parent(),
18580      slide_block = $(this).next(),
18581      bReviewTab = container.hasClass("media_review");
18582
18583    clicked_tab = container.index() + 1;
18584
18585    container.siblings().removeClass("active");
18586
18587    $(".nav.nav-tabs li").removeClass("active");
18588
18589    if (container.hasClass("active")) {
18590      if (bReviewTab) {
18591        $("#reviews_content").slideUp(200, function () {
18592          container.removeClass("active");
18593        });
18594      } else {
18595        slide_block.slideUp(200, function () {
18596          container.removeClass("active");
18597        });
18598      }
18599    } else {
18600      container.addClass("active");
18601      if (bReviewTab) {
18602        $("#reviews_content").slideDown();
18603      } else {
18604        if ($(".tabs_section + #reviews_content").length) $(".tabs_section + #reviews_content").slideUp();
18605        slide_block.slideDown();
18606        if (typeof container.attr("id") !== "undefined" && container.attr("id") == "descr") {
18607          var $gallery = $(".galerys-block");
18608          if ($gallery.length) {
18609            var bTypeBig = $gallery.find(".big_slider").length;
18610            var $slider = bTypeBig ? $gallery.find(".big_slider") : $gallery.find(".small_slider");
18611            InitFlexSlider();
18612            var interval = setInterval(function () {
18613              if ($slider.find(".slides .item").attr("style").indexOf("height") === -1) {
18614                $(window).resize();
18615              } else {
18616                clearInterval(interval);
18617              }
18618            }, 100);
18619          }
18620        }
18621      }
18622    }
18623  });
18624
18625  InitFlexSlider();
18626  InitOwlSlider();
18627  InitStickySideBar();
18628  InitFancyBox();
18629  InitFancyBoxVideo();
18630
18631  setTimeout(function () {
18632    InitTopestMenuGummi();
18633    isOnceInited = true;
18634    $('.menu.topest').closest('.dotted-flex-1').addClass('dotted-complete');
18635  }, 50);
18636
18637  InitZoomPict();
18638
18639  $(document).on("click", ".captcha_reload", function (e) {
18640    var captcha = $(this).parents(".captcha-row");
18641    e.preventDefault();
18642    $.ajax({
18643      url: arAsproOptions["SITE_DIR"] + "ajax/captcha.php",
18644    }).done(function (text) {
18645      captcha.find("input[name=captcha_sid],input[name=captcha_code]").val(text);
18646      captcha.find("img").attr("src", "/bitrix/tools/captcha.php?captcha_sid=" + text);
18647      captcha.find("input[name=captcha_word]").val("").removeClass("error");
18648      captcha.find(".captcha_input").removeClass("error").find(".error").remove();
18649    });
18650  });
18651
18652  /* show print */
18653  if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
18654    showBasketHeadingBtn();
18655  } else {
18656    if (arAsproOptions["THEME"]["PRINT_BUTTON"] === "Y") {
18657      setTimeout(function () {
18658        var topicHeading = document.querySelector(".period_wrapper.in-detail-news1 .period_wrapper_inner")
18659          ? document.querySelector(".detail-news1 .period_wrapper .period_wrapper_inner")
18660          : document.querySelector(".page-top .topic .topic__heading")
18661            ? document.querySelector(".page-top .topic .topic__heading")
18662            : null;
18663        if (topicHeading) {
18664          var btnPrint = BX.create({
18665            tag: "div",
18666            attrs: {
18667              class: "print-link colored_theme_hover_bg-block",
18668              title: arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"],
18669            },
18670            html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i>',
18671          });
18672          BX.insertBefore(btnPrint, topicHeading);
18673        }
18674      }, 150);
18675    }
18676  }
18677
18678  $(document).on("click", ".print-link", function () {
18679    window.print();
18680  });
18681
18682  $(".head-block .item-link").on("click", function () {
18683    var _this = $(this);
18684    _this.siblings().removeClass("active");
18685    _this.addClass("active");
18686  });
18687
18688  $("table.table").each(function () {
18689    var _this = $(this),
18690      first_td = _this.find("thead tr th");
18691    if (!first_td.length) first_td = _this.find("thead tr td");
18692    if (first_td.length) {
18693      var j = 0;
18694      _this.find("tbody tr td").each(function (i) {
18695        if (j > first_td.length - 1) j = 0;
18696        $('<div class="th-mobile">' + first_td[j].textContent + "</div>").appendTo($(this));
18697        j++;
18698      });
18699    }
18700  });
18701
18702  if (window.matchMedia("(min-width: 768px)").matches) $(".wrapper_middle_menu.wrap_menu").removeClass("mobile");
18703
18704  if (window.matchMedia("(max-width: 767px)").matches) $(".wrapper_middle_menu.wrap_menu").addClass("mobile");
18705
18706  $(".menu_top_block .v_bottom a").on("click", function (e) {
18707    if ($(e.target).hasClass("toggle_block")) e.preventDefault();
18708  });
18709  $(".menu_top_block .v_bottom a .toggle_block").click(function (e) {
18710    var _this = $(this),
18711      menu = _this.closest(".has-child").find("> .dropdown"),
18712      bVisibleMeu = menu.is(":visible"),
18713      animate = bVisibleMeu ? "slideUp" : "slideDown";
18714
18715    if (!_this.hasClass("clicked")) {
18716      _this.addClass("clicked");
18717
18718      menu.velocity("stop").velocity(animate, {
18719        duration: 150,
18720        // delay: 250,
18721        begin: function () {
18722          _this.toggleClass("closed");
18723        },
18724        complete: function () {
18725          _this.removeClass("clicked");
18726
18727          if (typeof window["stickySidebar"] !== "undefined") window["stickySidebar"].updateSticky();
18728        },
18729      });
18730    }
18731
18732    $(this).closest(".has-child").toggleClass("opened");
18733  });
18734
18735  $(document).on("click", ".show_props", function () {
18736    $(this).prev().stop().slideToggle(333);
18737    $(this).find(".char_title").toggleClass("opened");
18738  });
18739
18740  $(".see_more").on("click", function (e) {
18741    e.preventDefault();
18742    var see_more = $(this).is(".see_more") ? $(this) : $(this).parents(".see_more").first();
18743    var see_moreText = see_more.find("> a").length ? see_more.find("> a") : see_more;
18744    var see_moreHiden = see_more.parent().find("> .d");
18745    if (see_more.hasClass("open")) {
18746      see_moreText.text(BX.message("CATALOG_VIEW_MORE"));
18747      see_more.removeClass("open");
18748      see_moreHiden.hide();
18749    } else {
18750      see_moreText.text(BX.message("CATALOG_VIEW_LESS"));
18751      see_more.addClass("open");
18752      see_moreHiden.show();
18753    }
18754    return false;
18755  });
18756
18757  $(".button.faq_button").click(function (e) {
18758    e.preventDefault();
18759    $(this).toggleClass("opened");
18760    $(".faq_ask .form").slideToggle();
18761  });
18762
18763  $(".staff.list .staff_section .staff_section_title a").click(function (e) {
18764    e.preventDefault();
18765    $(this).parents(".staff_section").toggleClass("opened");
18766    $(this).parents(".staff_section").find(".staff_section_items").stop().slideToggle(600);
18767    $(this).parents(".staff_section_title").find(".opener_icon").toggleClass("opened");
18768  });
18769
18770  $(".jobs_wrapp .item .name").click(function (e) {
18771    $(this).closest(".item").toggleClass("opened");
18772    $(this).closest(".item").find(".description_wrapp").stop().slideToggle(600);
18773    $(this).closest(".item").find(".opener_icon").toggleClass("opened");
18774  });
18775
18776  $(".faq.list .item .q a").on("click", function (e) {
18777    e.preventDefault();
18778    $(this).parents(".item").toggleClass("opened");
18779    $(this).parents(".item").find(".a").stop().slideToggle();
18780    $(this).parents(".item").find(".q .opener_icon").toggleClass("opened");
18781  });
18782
18783  $(".opener_icon").click(function (e) {
18784    e.preventDefault();
18785    $(this).parent().find("a").trigger("click");
18786  });
18787
18788  $(".dotdot").dotdotdot();
18789
18790  $(".more_block span").on("click", function () {
18791    var content_offset = $(".catalog_detail .tabs_section").offset();
18792    $("html, body").animate({ scrollTop: content_offset.top - 43 }, 400);
18793  });
18794
18795  $(document).on("click", ".counter_block:not(.basket) .plus", function () {
18796    if (!$(this).parents(".basket_wrapp").length || $(this).parents(".services_in_basket").length) {
18797      if ($(this).parent().data("offers") != "Y") {
18798        var isDetailSKU2 = $(this).parents(".counter_block_wr").length;
18799        input = $(this).parents(".counter_block").find("input[type=text]");
18800        (tmp_ratio = !isDetailSKU2
18801          ? $(this).parents(".counter_wrapp").find(".to-cart").data("ratio")
18802          : $(this).parents("tr").first().find("td.buy .to-cart").data("ratio")),
18803          (isDblQuantity = !isDetailSKU2
18804            ? $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio")
18805            : $(this).parents("tr").first().find("td.buy .to-cart").data("float_ratio")),
18806          (ratio = isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
18807          (max_value = "");
18808        currentValue = input.val();
18809
18810        if (isDblQuantity)
18811          ratio =
18812            Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) /
18813            arAsproOptions.JS_ITEM_CLICK.precisionFactor;
18814
18815        curValue = isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10);
18816
18817        curValue += ratio;
18818        if (isDblQuantity) {
18819          curValue =
18820            Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) /
18821            arAsproOptions.JS_ITEM_CLICK.precisionFactor;
18822        }
18823
18824        if (parseFloat($(this).data("max")) > 0) {
18825          if (input.val() < $(this).data("max")) {
18826            if (curValue <= $(this).data("max")) input.val(curValue);
18827
18828            input.change();
18829          }
18830        } else {
18831          input.val(curValue);
18832          input.change();
18833        }
18834      }
18835    }
18836  });
18837  $(document).on("click", ".counter_block:not(.basket) .minus", function () {
18838    if (!$(this).parents(".basket_wrapp").length || $(this).parents(".services_in_basket").length) {
18839      if ($(this).parent().data("offers") != "Y") {
18840        var isDetailSKU2 = $(this).parents(".counter_block_wr").length;
18841        input = $(this).parents(".counter_block").find("input[type=text]");
18842        (tmp_ratio = !isDetailSKU2
18843          ? $(this).parents(".counter_wrapp").find(".to-cart").data("ratio")
18844          : $(this).parents("tr").first().find("td.buy .to-cart").data("ratio")),
18845          (isDblQuantity = !isDetailSKU2
18846            ? $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio")
18847            : $(this).parents("tr").first().find("td.buy .to-cart").data("float_ratio")),
18848          (ratio = isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
18849          (max_value = "");
18850        currentValue = input.val();
18851
18852        if (isDblQuantity)
18853          ratio =
18854            Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) /
18855            arAsproOptions.JS_ITEM_CLICK.precisionFactor;
18856
18857        curValue = isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10);
18858
18859        curValue -= ratio;
18860        if (isDblQuantity) {
18861          curValue =
18862            Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) /
18863            arAsproOptions.JS_ITEM_CLICK.precisionFactor;
18864        }
18865        const minValue = parseFloat($(this).parents(".counter_block").find(".minus").data("min"));
18866        if (minValue) {
18867          ratio = minValue;
18868        }
18869
18870        if (parseFloat($(this).parents(".counter_block").find(".plus").data("max")) > 0) {
18871          if (currentValue > ratio) {
18872            if (curValue < ratio) {
18873              input.val(ratio);
18874            } else {
18875              input.val(curValue);
18876            }
18877            input.change();
18878          }
18879        } else {
18880          if (curValue > ratio) {
18881            input.val(curValue);
18882          } else {
18883            if (ratio) {
18884              input.val(ratio);
18885            } else if (currentValue > 1) {
18886              input.val(curValue);
18887            }
18888          }
18889          input.change();
18890        }
18891      }
18892    }
18893  });
18894
18895  $(".counter_block input[type=text]").numeric({ allow: "." });
18896
18897  $(document).on("focus", ".counter_block input[type=text]", function (e) {
18898    $(this).addClass("focus");
18899  });
18900
18901  $(document).on("blur", ".counter_block input[type=text]", function (e) {
18902    $(this).removeClass("focus");
18903  });
18904
18905  var timerInitCalculateDelivery = false;
18906  $(document).on("change", ".counter_block input[type=text]", function (e) {
18907    if (!$(this).parents(".basket_wrapp").length) {
18908      var val = $(this).val(),
18909        tmp_ratio = $(this).parents(".counter_wrapp").find(".to-cart").data("ratio")
18910          ? $(this).parents(".counter_wrapp").find(".to-cart").data("ratio")
18911          : $(this).parents("tr").first().find("td.buy .to-cart").data("ratio"),
18912        isDblQuantity = $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio")
18913          ? $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio")
18914          : $(this).parents("tr").first().find("td.buy .to-cart").data("float_ratio"),
18915        ratio = isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10),
18916        diff = val % ratio;
18917
18918      if (isDblQuantity) {
18919        ratio =
18920          Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) /
18921          arAsproOptions.JS_ITEM_CLICK.precisionFactor;
18922        if (
18923          Math.round(diff * arAsproOptions.JS_ITEM_CLICK.precisionFactor) /
18924          arAsproOptions.JS_ITEM_CLICK.precisionFactor ==
18925          ratio
18926        )
18927          diff = 0;
18928      }
18929
18930      if ($(this).hasClass("focus")) {
18931        intCount =
18932          Math.round(
18933            Math.round((val * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / ratio) /
18934            arAsproOptions.JS_ITEM_CLICK.precisionFactor
18935          ) || 1;
18936        val = intCount <= 1 ? ratio : intCount * ratio;
18937        // val -= diff;
18938        val =
18939          Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
18940      }
18941
18942      if (parseFloat($(this).parents(".counter_block").find(".plus").data("max")) > 0) {
18943        if (val > parseFloat($(this).parents(".counter_block").find(".plus").data("max"))) {
18944          val = parseFloat($(this).parents(".counter_block").find(".plus").data("max"));
18945          // val -= (val % ratio);
18946        }
18947      }
18948      if (parseFloat($(this).parents(".counter_block").find(".minus").data("min")) > 0) {
18949        if (val < parseFloat($(this).parents(".counter_block").find(".minus").data("min"))) {
18950          val = parseFloat($(this).parents(".counter_block").find(".minus").data("min"));
18951          // val -= (val % ratio);
18952        }
18953      }
18954      if (val < ratio) {
18955        val = ratio;
18956      } else if (!parseFloat(val)) {
18957        val = 1;
18958      }
18959
18960      $(this).parents(".counter_block").parent().parent().find(".to-cart").attr("data-quantity", val);
18961      $(this).parents(".counter_block").parent().parent().parent().find(".one_click").attr("data-quantity", val);
18962      $(this)
18963        .parents(".counter_block")
18964        .parent()
18965        .parent()
18966        .parent()
18967        .parent()
18968        .find(".one_click")
18969        .attr("data-quantity", val); //for offers in list
18970      $(this).parents(".catalog_item_wrapp").find(".inner_wrap.TYPE_1 .one_click").attr("data-quantity", val); //for first type buttons in catalog_block
18971
18972      $(this).val(val);
18973
18974      var $calculate = $(this).closest(".item").length
18975        ? $(this).closest(".item").find(".calculate-delivery")
18976        : $(this).closest(".catalog_detail").find(".calculate-delivery");
18977      if ($calculate.length && !$(this).closest(".buy_services_wrap").length) {
18978        $calculate.each(function () {
18979          var $calculateSpan = $(this).find("span[data-event=jqm]").first();
18980
18981          if ($calculateSpan.length) {
18982            var $clone = $calculateSpan.clone();
18983            $clone.attr("data-param-quantity", val).removeClass("clicked");
18984            $clone.insertAfter($calculateSpan).on("click", function () {
18985              if (!jQuery.browser.mobile) {
18986                $(this).parent().addClass("loadings");
18987              }
18988            });
18989            $calculateSpan.remove();
18990          }
18991
18992          if ($(this).hasClass("with_preview")) {
18993            $(this).removeClass("inited");
18994
18995            if (timerInitCalculateDelivery) {
18996              clearTimeout(timerInitCalculateDelivery);
18997            }
18998
18999            timerInitCalculateDelivery = setTimeout(function () {
19000              initCalculatePreview();
19001              timerInitCalculateDelivery = false;
19002            }, 1000);
19003          }
19004        });
19005      }
19006
19007      var eventdata = { type: "change", params: { id: $(this), value: val } };
19008      BX.onCustomEvent("onCounterProductAction", [eventdata]);
19009
19010      if ($(this).closest(".complect-block").length && typeof setNewPriceComplect === "function") {
19011        setNewPriceComplect();
19012      }
19013    }
19014  });
19015
19016  BX.addCustomEvent("onCounterProductAction", function (eventdata) {
19017    if (typeof eventdata != "object") {
19018      eventdata = { type: "undefined" };
19019    }
19020    try {
19021      if (typeof eventdata.type != "undefined") {
19022        if (!eventdata.params.id.closest(".gifts").length) {
19023          // no gift
19024          var obProduct = eventdata.params.id.data("product");
19025          if (eventdata.params.id.closest(".has_offer_prop").length) {
19026            // type1 for offers in element list
19027            if (typeof window["obSkuQuantys"] === "undefined") window["obSkuQuantys"] = {};
19028
19029            // if(typeof window['obOffers'] === 'undefined')
19030            window["obSkuQuantys"][eventdata.params.id.closest(".offer_buy_block").find(".to-cart").data("item")] =
19031              eventdata.params.value;
19032          }
19033          if (typeof window[obProduct] == "object") {
19034            if (obProduct == "obOffers") setPriceAction("", "", "Y");
19035            else window[obProduct].setPriceAction("Y");
19036            if ($(".detail_page").length) {
19037              setNewHeader();
19038            }
19039          } else if (eventdata.params.id.length) {
19040            if (
19041              eventdata.params.id.closest(".main_item_wrapper").length &&
19042              !eventdata.params.id.closest(".services-item__buy").length &&
19043              arAsproOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y"
19044            ) {
19045              setPriceItem(eventdata.params.id.closest(".main_item_wrapper"), eventdata.params.value);
19046            }
19047          }
19048          BX.onCustomEvent("onCounterProductActionResize");
19049        }
19050      }
19051    } catch (e) {
19052      console.error(e);
19053    }
19054  });
19055
19056  /*show basket on hover */
19057  $(document).on("mouseenter", ".wrap_icon.top_basket, #headerfixed .basket-link.basket", function () {
19058    var _this = $(this);
19059    var parent = _this.closest("header, #headerfixed");
19060    var hover_block = parent.find(".basket_hover_block");
19061
19062    if (!hover_block.hasClass("loaded")) {
19063      basketTop("", hover_block);
19064    }
19065  });
19066
19067  /*show basket on click mobile */
19068  $(document).on("click", ".wrap_icon.wrap_basket.top_basket, #headerfixed .basket-link.basket", function (e) {
19069    var _this = $(this);
19070    if (isMobile) {
19071      if (!_this.hasClass("clicked")) {
19072        e.preventDefault();
19073        _this.addClass("clicked");
19074        setTimeout(function () {
19075          _this.removeClass("clicked");
19076        }, 3000);
19077      }
19078    }
19079  });
19080
19081  /*slide cart*/
19082  $(document).on("mouseenter", "#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ", function () {
19083    $(this).closest(".basket_normal").find(".popup").addClass("block");
19084    $(this).closest(".basket_normal").find(".basket_popup_wrapp").stop(true, true).slideDown(150);
19085  });
19086  $(document).on("mouseleave", "#basket_line .basket_normal .basket_block ", function () {
19087    var th = $(this);
19088    $(this)
19089      .closest(".basket_normal")
19090      .find(".basket_popup_wrapp")
19091      .stop(true, true)
19092      .slideUp(150, function () {
19093        th.closest(".basket_normal").find(".popup").removeClass("block");
19094      });
19095  });
19096
19097  $(document).on("click", ".popup_button_basket", function () {
19098    var th = $(".to-cart[data-item=" + $(this).data("item") + "]");
19099
19100    var val = th.attr("data-quantity");
19101
19102    if (!val) $val = 1;
19103
19104    var tmp_props = th.data("props"),
19105      props = "",
19106      part_props = "",
19107      add_props = "N",
19108      fill_prop = {},
19109      iblockid = th.data("iblockid"),
19110      offer = th.data("offers"),
19111      rid = "",
19112      basket_props = "",
19113      item = th.attr("data-item");
19114
19115    if (offer != "Y") {
19116      offer = "N";
19117    } else {
19118      basket_props = th.closest(".prices_tab").find(".bx_sku_props input").val();
19119    }
19120    if (tmp_props) {
19121      props = tmp_props.split(";");
19122    }
19123    if (th.data("part_props")) {
19124      part_props = th.data("part_props");
19125    }
19126    if (th.data("add_props")) {
19127      add_props = th.data("add_props");
19128    }
19129    if ($(".rid_item").length) {
19130      rid = $(".rid_item").data("rid");
19131    } else if (th.data("rid")) {
19132      rid = th.data("rid");
19133    }
19134
19135    fill_prop = fillBasketPropsExt(th, "prop", "bx_ajax_text");
19136
19137    fill_prop.quantity = val;
19138    fill_prop.add_item = "Y";
19139    fill_prop.rid = rid;
19140    fill_prop.offers = offer;
19141    fill_prop.iblockID = iblockid;
19142    fill_prop.part_props = part_props;
19143    fill_prop.add_props = add_props;
19144    fill_prop.props = JSON.stringify(props);
19145    fill_prop.item = item;
19146    fill_prop.basket_props = basket_props;
19147
19148    var isDetail = th.closest(".product-action").length || th.closest("#headerfixed.with-product");
19149    var isSku2 = th.closest(".list-offers").length;
19150    var bIsService = th.closest(".buy_services_wrap").length;
19151
19152    if (!bIsService && (isDetail || isSku2)) {
19153      //var allServicesOn = th.closest('.product-container').find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked');
19154      var allServicesOn = [];
19155      if (isSku2) {
19156        allServicesOn = th
19157          .closest(".product-container")
19158          .find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked');
19159      } else {
19160        allServicesOn = $(".product-container").find(
19161          '.buy_services_wrap[data-parent_product="' + item + '"] .services-item [name="buy_switch_services"]:checked'
19162        );
19163      }
19164      var servicesNeedAdd = [];
19165      allServicesOn.each(function () {
19166        var _this = $(this);
19167        var buttonCart = _this.closest(".services-item").find(".to-cart");
19168
19169        servicesNeedAdd[buttonCart.data("item")] = {};
19170        servicesNeedAdd[buttonCart.data("item")]["id"] = buttonCart.data("item");
19171        servicesNeedAdd[buttonCart.data("item")]["quantity"] = buttonCart.attr("data-quantity");
19172        servicesNeedAdd[buttonCart.data("item")]["iblock_id"] = buttonCart.data("iblockid");
19173      });
19174      servicesNeedAdd = array_values_js(servicesNeedAdd);
19175      fill_prop.services = servicesNeedAdd;
19176    }
19177
19178    $.ajax({
19179      type: "POST",
19180      url: arAsproOptions["SITE_DIR"] + "ajax/item.php",
19181      data: fill_prop,
19182      dataType: "json",
19183      success: function (data) {
19184        $(".basket_error_frame").jqmHide();
19185        if ("STATUS" in data) {
19186          getActualBasket(fill_prop.iblockID);
19187          if (data.STATUS === "OK") {
19188            th.hide();
19189            th.closest(".counter_wrapp").find(".counter_block_inner").hide();
19190            th.closest(".counter_wrapp").find(".counter_block").hide();
19191            th.parents("tr").find(".counter_block_wr .counter_block").hide();
19192            th.closest(".button_block").addClass("wide");
19193            th.parent().find(".in-cart").show();
19194
19195            addBasketCounter(item);
19196            //$('.wish_item[data-item='+item+']').removeClass("added");
19197            $(".wish_item[data-item=" + item + "]")
19198              .find(".value")
19199              .show();
19200            $(".wish_item[data-item=" + item + "]")
19201              .find(".value.added")
19202              .hide();
19203
19204            if ($("#ajax_basket").length) reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y");
19205
19206            if ($("#basket_line .basket_fly").length) {
19207              if (th.closest(".fast_view_frame").length || window.matchMedia("(max-width: 767px)").matches)
19208                basketFly("open", "N");
19209              else basketFly("open");
19210            }
19211          } else {
19212            showBasketError(BX.message(data.MESSAGE));
19213          }
19214        } else {
19215          showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
19216        }
19217      },
19218    });
19219  });
19220
19221  $(document).on("click", ".to-cart:not(.read_more), .basket_item_add", function (e) {
19222    e.preventDefault();
19223    var th = $(this);
19224    if (!th.hasClass("clicked")) {
19225      th.addClass("clicked");
19226      var val = $(this).attr("data-quantity");
19227      var tmp_props = $(this).data("props"),
19228        props = "",
19229        part_props = "",
19230        add_props = "N",
19231        fill_prop = {},
19232        iblockid = $(this).data("iblockid"),
19233        offer = $(this).data("offers"),
19234        rid = "",
19235        bBannerAction = false,
19236        basket_props = "",
19237        item = $(this).attr("data-item");
19238      if (th.closest(".but-cell").length) {
19239        if ($('.counter_block[data-item="' + item + '"]').length)
19240          val = $('.counter_block[data-item="' + item + '"] input').val();
19241      }
19242
19243      if (th.closest(".banner_buttons.with_actions").length) {
19244        //banner action
19245        var wrapper_btns = th.closest(".wraps_buttons");
19246        item = wrapper_btns.data("id");
19247        bBannerAction = true;
19248      }
19249
19250      if (!val) val = 1;
19251      if (offer != "Y") {
19252        offer = "N";
19253      } else {
19254        basket_props = $(this).closest(".prices_tab").find(".bx_sku_props input").val();
19255      }
19256      if (tmp_props) {
19257        props = tmp_props.split(";");
19258      }
19259      if ($(this).data("part_props")) {
19260        part_props = $(this).data("part_props");
19261      }
19262      if ($(this).data("add_props")) {
19263        add_props = $(this).data("add_props");
19264      }
19265      if ($(".rid_item").length) {
19266        rid = $(".rid_item").data("rid");
19267      } else if ($(this).data("rid")) {
19268        rid = $(this).data("rid");
19269      }
19270
19271      fill_prop = fillBasketPropsExt(th, "prop", th.data("bakset_div"));
19272
19273      fill_prop.quantity = val;
19274      fill_prop.add_item = "Y";
19275      fill_prop.rid = rid;
19276      fill_prop.offers = offer;
19277      fill_prop.iblockID = iblockid;
19278      fill_prop.part_props = part_props;
19279      fill_prop.add_props = add_props;
19280      fill_prop.props = JSON.stringify(props);
19281      fill_prop.item = item;
19282      fill_prop.basket_props = basket_props;
19283
19284      var isDetail = th.closest(".product-action").length || th.closest("#headerfixed.with-product");
19285      var isSku2 = th.closest(".list-offers").length;
19286      var bIsService = th.closest(".buy_services_wrap").length;
19287
19288      if (!bIsService && (isDetail || isSku2)) {
19289        var allServicesOn = [];
19290        if (isSku2) {
19291          allServicesOn = th
19292            .closest(".product-container")
19293            .find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked');
19294        } else {
19295          allServicesOn = $(".product-container").find(
19296            '.buy_services_wrap[data-parent_product="' + item + '"] .services-item [name="buy_switch_services"]:checked'
19297          );
19298        }
19299        var servicesNeedAdd = [];
19300        allServicesOn.each(function () {
19301          var _this = $(this);
19302          var buttonCart = _this.closest(".services-item").find(".to-cart");
19303          servicesNeedAdd[buttonCart.data("item")] = {};
19304          servicesNeedAdd[buttonCart.data("item")]["id"] = buttonCart.data("item");
19305          servicesNeedAdd[buttonCart.data("item")]["quantity"] = buttonCart.attr("data-quantity");
19306          servicesNeedAdd[buttonCart.data("item")]["iblock_id"] = buttonCart.data("iblockid");
19307        });
19308        servicesNeedAdd = array_values_js(servicesNeedAdd);
19309        fill_prop.services = servicesNeedAdd;
19310      }
19311
19312      var servicesWrap = $(this).closest(".buy_services_wrap");
19313      if (bIsService) {
19314        var parent_product = servicesWrap.attr("data-parent_product");
19315        fill_prop["prop[BUY_PRODUCT_PROP]"] = parent_product;
19316        fill_prop["prop[ASPRO_BUY_PRODUCT_ID]"] = parent_product;
19317      }
19318
19319      if (bBannerAction) {
19320        if (th.hasClass("added")) {
19321          location.href = th.data("href");
19322          return false;
19323        } else {
19324          th.attr("title", th.data("title2"));
19325          th.toggleClass("added");
19326        }
19327
19328        if (wrapper_btns.find(".wish_item_add").length) wrapper_btns.find(".wish_item_add").removeClass("added");
19329      }
19330
19331      if (th.data("empty_props") == "N" /* && fill_prop.part_props != 'Y'*/) {
19332        var basket_popup_html = $("#" + th.data("bakset_div")).html();
19333        if (!basket_popup_html && th.closest(".item").find(".basket_props_block").length)
19334          basket_popup_html = th.closest(".item").find(".basket_props_block").html();
19335
19336        showBasketError(basket_popup_html, BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th);
19337        BX.addCustomEvent("onCompleteAction", function (e) {
19338          if (!e.ignoreSelf) {
19339            var eventdata = { action: "loadForm", ignoreSelf: true };
19340            BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]);
19341          }
19342        });
19343      } else {
19344        $.ajax({
19345          type: "POST",
19346          url: arAsproOptions["SITE_DIR"] + "ajax/item.php",
19347          data: fill_prop,
19348          dataType: "json",
19349          success: function (data) {
19350            getActualBasket(fill_prop.iblockID);
19351
19352            var eventdata = { action: "loadForm" };
19353            BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]);
19354            arStatusBasketAspro = {};
19355
19356            if (data !== null) {
19357              if ("STATUS" in data) {
19358                if (data.MESSAGE_EXT === null) data.MESSAGE_EXT = "";
19359                if (data.STATUS === "OK") {
19360                  // th.hide();
19361                  $(".to-cart[data-item=" + item + "]").hide();
19362                  $(".to-cart[data-item=" + item + "]")
19363                    .closest(".counter_wrapp")
19364                    .find(".counter_block_inner")
19365                    .hide();
19366                  $(".to-cart[data-item=" + item + "]")
19367                    .closest(".counter_wrapp")
19368                    .find(".counter_block")
19369                    .hide();
19370                  $(".to-cart[data-item=" + item + "]")
19371                    .parents("tr")
19372                    .find(".counter_block_wr .counter_block")
19373                    .hide();
19374                  $(".to-cart[data-item=" + item + "]")
19375                    .closest(".button_block")
19376                    .addClass("wide");
19377                  // th.parent().find('.in-cart').show();
19378                  $(".in-cart[data-item=" + item + "]").show();
19379
19380                  addBasketCounter(item, fill_prop.quantity);
19381                  //$('.wish_item[data-item='+item+']').removeClass("added");
19382                  $(".wish_item[data-item=" + item + "]")
19383                    .find(".value")
19384                    .show();
19385                  $(".wish_item[data-item=" + item + "]")
19386                    .find(".value.added")
19387                    .hide();
19388                  $(".wish_item.to[data-item=" + item + "]").show();
19389                  $(".wish_item.in[data-item=" + item + "]").hide();
19390
19391                  //js notice
19392                  $bDontOpenBasket = false;
19393                  if (typeof JNoticeSurface !== "undefined") {
19394                    JNoticeSurface.get().onAdd2cart([th[0]]);
19395                    $bDontOpenBasket = true;
19396                  }
19397                  //
19398
19399                  if ($("#ajax_basket").length) reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y");
19400
19401                  if ($("#basket_line .basket_fly").length) {
19402                    if (th.closest(".services_in_basket").length && !window.matchMedia("(max-width: 767px)").matches) {
19403                      basketFly("open", "SHOW"); //need for buy services in basket_fly
19404                    } else if (
19405                      th.closest(".fast_view_frame").length ||
19406                      window.matchMedia("(max-width: 767px)").matches ||
19407                      $("#basket_line .basket_fly.loaded").length
19408                    )
19409                      basketFly("open", "N");
19410                    else {
19411                      if ($bDontOpenBasket) basketFly("open", "N");
19412                      else basketFly("open");
19413                    }
19414                  }
19415
19416                  //need for services on basket_page
19417                  if (th.closest(".services_in_basket_page").length) {
19418                    BX.Sale.BasketComponent.sendRequest("refreshAjax", {
19419                      fullRecalculation: "Y",
19420                      otherParams: {
19421                        param: "N",
19422                      },
19423                    });
19424                  }
19425
19426                  if ($(".top_basket").length) {
19427                    basketTop($bDontOpenBasket ? "" : "open", $(".top_basket").find(".basket_hover_block"));
19428                  }
19429
19430                  if (
19431                    $("#headerfixed .wproducts .ajax_load .btn").length &&
19432                    th.closest(".product-action").length &&
19433                    !th.closest('.js-item-analog').length &&
19434                    th.next(".in-cart").length
19435                  ) {
19436                    var buttonHtml =
19437                      //'<span class="buy_block"><span class="btn btn-default btn-sm slide_offer more type_block">' +
19438                      '<span class="buy_block"><span class="btn btn-default btn-sm more type_block">' +
19439                      th.next(".in-cart").html() +
19440                      "</span></span>";
19441                    $("#headerfixed .wproducts .ajax_load .item-buttons .but-cell").html(buttonHtml);
19442                  }
19443                } else {
19444                  showBasketError(BX.message(data.MESSAGE) + " <br/>" + data.MESSAGE_EXT);
19445                }
19446              } else {
19447                showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
19448              }
19449            } else {
19450              // th.hide();
19451              $(".to-cart[data-item=" + item + "]").hide();
19452              $(".to-cart[data-item=" + item + "]")
19453                .closest(".counter_wrapp")
19454                .find(".counter_block_inner")
19455                .hide();
19456              $(".to-cart[data-item=" + item + "]")
19457                .closest(".counter_wrapp")
19458                .find(".counter_block")
19459                .hide();
19460              $(".to-cart[data-item=" + item + "]")
19461                .parents("tr")
19462                .find(".counter_block_wr .counter_block")
19463                .hide();
19464              $(".to-cart[data-item=" + item + "]")
19465                .closest(".button_block")
19466                .addClass("wide");
19467              // th.parent().find('.in-cart').show();
19468              $(".in-cart[data-item=" + item + "]").show();
19469
19470              addBasketCounter(item);
19471              //$('.wish_item[data-item='+item+']').removeClass("added");
19472              $(".wish_item[data-item=" + item + "]")
19473                .find(".value")
19474                .show();
19475              $(".wish_item[data-item=" + item + "]")
19476                .find(".value.added")
19477                .hide();
19478
19479              if ($("#ajax_basket").length) reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y");
19480
19481              if ($("#basket_line .basket_fly").length) {
19482                if (
19483                  th.closest(".fast_view_frame").length ||
19484                  window.matchMedia("(max-width: 767px)").matches ||
19485                  $("#basket_line .basket_fly.loaded").length
19486                )
19487                  basketFly("open", "N");
19488                else basketFly("open");
19489              }
19490            }
19491          },
19492        });
19493      }
19494    }
19495  });
19496
19497  $(document).on("click", ".to-subscribe", function (e) {
19498    e.preventDefault();
19499    var th = $(this);
19500    if (!th.hasClass("clicked")) {
19501      th.addClass("clicked");
19502      if ($(this).is(".auth")) {
19503        if ($(this).hasClass("nsubsc")) {
19504          $(this).jqmEx();
19505          $(this).trigger("click");
19506        } else {
19507          location.href = arAsproOptions["SITE_DIR"] + "auth/?backurl=" + location.pathname;
19508        }
19509      } else {
19510        var item = $(this).attr("data-item"),
19511          iblockid = $(this).attr("data-iblockid");
19512        // $(this).hide();
19513        $(".to-subscribe[data-item=" + item + "]").hide();
19514        $(".to-subscribe[data-item=" + item + "]")
19515          .parent()
19516          .find(".in-subscribe")
19517          .show();
19518        $.get(
19519          arAsproOptions["SITE_DIR"] + "ajax/item.php?item=" + item + "&subscribe_item=Y",
19520          $.proxy(function (data) {
19521            arStatusBasketAspro = {};
19522            getActualBasket(iblockid);
19523          })
19524        );
19525        th.removeClass("clicked");
19526      }
19527    }
19528  });
19529
19530  $(document).on("click", ".in-subscribe", function (e) {
19531    e.preventDefault();
19532    var item = $(this).attr("data-item"),
19533      iblockid = $(this).attr("data-iblockid");
19534    // $(this).hide();
19535    $(".in-subscribe[data-item=" + item + "]").hide();
19536    $(".in-subscribe[data-item=" + item + "]")
19537      .parent()
19538      .find(".to-subscribe")
19539      .removeClass("clicked");
19540    $(".in-subscribe[data-item=" + item + "]")
19541      .parent()
19542      .find(".to-subscribe")
19543      .show();
19544    $.get(
19545      arAsproOptions["SITE_DIR"] + "ajax/item.php?item=" + item + "&subscribe_item=Y",
19546      $.proxy(function (data) {
19547        getActualBasket(iblockid);
19548        arStatusBasketAspro = {};
19549      })
19550    );
19551  });
19552
19553  $(document).on("click", ".js_clear_favorits", function (e) {
19554    e.preventDefault();
19555    $.ajax({
19556      type: "GET",
19557      url: arAsproOptions["SITE_DIR"] + "ajax/item.php",
19558      data:
19559        "delete_items=Y" +
19560        "&wish_item=Y",
19561      dataType: "json",
19562      success: function (data) {
19563        if (data !== null) {
19564          if (data.MESSAGE_EXT === null) data.MESSAGE_EXT = "";
19565          if ("STATUS" in data) {
19566            if (data.STATUS === "OK") {
19567              document.querySelector('#header .favorite-link .count').innerHTML = data.COUNT;
19568              document.querySelector('#headerfixed .favorite-link .count').innerHTML = data.COUNT;
19569              document.querySelector('#mobileheader .favorite-link .count').innerHTML = data.COUNT;
19570              document.querySelector('.element-count').innerHTML = data.COUNT;
19571
19572              $.ajax({
19573                type: "POST",
19574                url: location.href,
19575                data: {
19576                  is_ajax: "Y"
19577                },
19578                dataType: "html",
19579                success: function (response) {
19580                  let responseData = BX.processHTML(response);
19581                  $(document).find('.wrapper1 .container .right_block .ajax_load').html(responseData.HTML);
19582                  BX.ajax.processScripts(responseData.SCRIPT);
19583                  InitStickySideBar();
19584                },
19585              });
19586
19587            }
19588          }
19589        }
19590      },
19591    });
19592  });
19593
19594  $(document).on("click", ".wish_item, .wish_item_add", function (e) {
19595    e.preventDefault();
19596    let item = $(this).attr("data-item"),
19597      iblockid = $(this).data("iblock"),
19598      needReload = $(this).closest('.like_icons').hasClass('favorite_page');
19599    if ($(this).hasClass('added')) {
19600      $(".like_icons").each(function () {
19601        if ($(this).find(".wish_item_button").length) {
19602          $(this)
19603            .find(".wish_item_button")
19604            .find('.wish_item[data-item="' + item + '"]')
19605            .removeClass("added");
19606        }
19607      });
19608
19609      $(".catalog_detail").find('.wish_item[data-item="' + item + '"]').removeClass("added");
19610    } else {
19611      $(".like_icons").each(function () {
19612        if ($(this).find(".wish_item_button").length) {
19613          $(this)
19614            .find(".wish_item_button")
19615            .find('.wish_item[data-item="' + item + '"]')
19616            .addClass("added");
19617        }
19618      });
19619
19620      $(".catalog_detail").find('.wish_item[data-item="' + item + '"]').addClass("added");
19621    }
19622
19623    $.ajax({
19624      type: "GET",
19625      url: arAsproOptions["SITE_DIR"] + "ajax/item.php",
19626      data:
19627        "item=" +
19628        item +
19629        "&wish_item=Y" +
19630        "&iblockID=" +
19631        iblockid,
19632      dataType: "json",
19633      success: function (data) {
19634        if (data !== null) {
19635          if (data.MESSAGE_EXT === null) data.MESSAGE_EXT = "";
19636          if ("STATUS" in data) {
19637            if (data.STATUS === "OK") {
19638              if (arAsproOptions["COUNTERS"]["USE_BASKET_GOALS"] !== "N") {
19639                var eventdata = { goal: "goal_wish_add", params: { id: item } };
19640                BX.onCustomEvent("onCounterGoals", [eventdata]);
19641              }
19642              document.querySelector('#header .favorite-link .count').innerHTML = data.COUNT;
19643              document.querySelector('#headerfixed .favorite-link .count').innerHTML = data.COUNT;
19644              document.querySelector('#mobileheader .favorite-link .count').innerHTML = data.COUNT;
19645
19646              if (needReload) {
19647                document.querySelector('.element-count').innerHTML = data.COUNT;
19648                $.ajax({
19649                  type: "POST",
19650                  url: location.href,
19651                  data: {
19652                    is_ajax: "Y"
19653                  },
19654                  dataType: "html",
19655                  success: function (response) {
19656                    let responseData = BX.processHTML(response);
19657                    let items = [];
19658                    $.each($(responseData.HTML), function (i, el) {
19659                      if ($(el).hasClass('item')) {
19660                        items.push($(el));
19661                      }
19662                    });
19663
19664                    if (items.length) {
19665                      $(document).find('.wrapper1 .container .right_block .ajax_load .catalog_block.items').html(items);
19666                    } else {
19667                      $(document).find('.wrapper1 .container .right_block .ajax_load').html(responseData.HTML);
19668                    }
19669
19670                    BX.ajax.processScripts(responseData.SCRIPT);
19671
19672                    InitStickySideBar();
19673                  },
19674                });
19675              }
19676            }
19677          }
19678        }
19679        // _this.removeClass("clicked");
19680      },
19681    });
19682
19683    return;
19684    /*
19685    var val = $(this).attr("data-quantity"),
19686      _this = $(this),
19687      offer = $(this).data("offers"),
19688      iblockid = $(this).data("iblock"),
19689      tmp_props = $(this).data("props"),
19690      props = "",
19691      bBannerAction = false,
19692      item = $(this).attr("data-item"),
19693      item2 = $(this).attr("data-item");
19694
19695    if (_this.closest(".banner_buttons.with_actions").length) {
19696      //banner action
19697      var wrapper_btns = _this.closest(".wraps_buttons");
19698      item = item2 = wrapper_btns.data("id");
19699      bBannerAction = true;
19700    }
19701
19702    if (!_this.hasClass("clicked")) {
19703      _this.addClass("clicked");
19704      if (!val) val = 1;
19705      if (offer != "Y") offer = "N";
19706      if (tmp_props) {
19707        props = tmp_props.split(";");
19708      }
19709      if (!$(this).hasClass("text")) {
19710        if ($(this).hasClass("added")) {
19711          if (!bBannerAction) {
19712            $(this).hide();
19713            $(this).closest(".wish_item_button").find(".to").show();
19714          }
19715          $(".like_icons").each(function () {
19716            if ($(this).find('.wish_item.text[data-item="' + item + '"]').length) {
19717              $(this)
19718                .find('.wish_item.text[data-item="' + item + '"]')
19719                .removeClass("added");
19720              $(this)
19721                .find('.wish_item.text[data-item="' + item + '"]')
19722                .find(".value")
19723                .show();
19724              $(this)
19725                .find('.wish_item.text[data-item="' + item + '"]')
19726                .find(".value.added")
19727                .hide();
19728            }
19729            if ($(this).find(".wish_item_button").length) {
19730              $(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
19731              $(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
19732              $(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();
19733              $(this)
19734                .find(".wish_item_button")
19735                .find('.wish_item[data-item="' + item + '"].to')
19736                .show();
19737              $(this)
19738                .find(".wish_item_button")
19739                .find('.wish_item[data-item="' + item + '"].in')
19740                .hide();
19741            }
19742          });
19743        } else {
19744          if (!bBannerAction) {
19745            $(this).hide();
19746            $(this).closest(".wish_item_button").find(".in").addClass("added").show();
19747          }
19748
19749          $(".like_icons").each(function () {
19750            if ($(this).find('.wish_item.text[data-item="' + item + '"]').length) {
19751              $(this)
19752                .find('.wish_item.text[data-item="' + item + '"]')
19753                .addClass("added");
19754              $(this)
19755                .find('.wish_item.text[data-item="' + item + '"]')
19756                .find(".value")
19757                .hide();
19758              $(this)
19759                .find('.wish_item.text[data-item="' + item + '"]')
19760                .find(".value.added")
19761                .css({ display: "block" });
19762            }
19763            if ($(this).find(".wish_item_button").length) {
19764              $(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
19765              $(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
19766              $(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();
19767              $(this)
19768                .find(".wish_item_button")
19769                .find('.wish_item[data-item="' + item + '"].to')
19770                .hide();
19771              $(this)
19772                .find(".wish_item_button")
19773                .find('.wish_item[data-item="' + item + '"].in')
19774                .show();
19775            }
19776          });
19777        }
19778      } else {
19779        if (!$(this).hasClass("added")) {
19780          $(".wish_item[data-item=" + item + "]").addClass("added");
19781          $(".wish_item[data-item=" + item + "]")
19782            .find(".value")
19783            .hide();
19784          $(".wish_item[data-item=" + item + "]")
19785            .find(".value.added")
19786            .css("display", "block");
19787
19788          $(".wish_item.to[data-item=" + item + "]").hide();
19789          $(".wish_item.in[data-item=" + item + "]").show();
19790
19791          $(".like_icons").each(function () {
19792            if ($(this).find(".wish_item_button").length) {
19793              $(this)
19794                .find(".wish_item_button")
19795                .find('.wish_item[data-item="' + item + '"]')
19796                .addClass("added");
19797              $(this)
19798                .find(".wish_item_button")
19799                .find('.wish_item[data-item="' + item + '"]')
19800                .find(".value")
19801                .hide();
19802              $(this)
19803                .find(".wish_item_button")
19804                .find('.wish_item[data-item="' + item + '"]')
19805                .find(".value.added")
19806                .show();
19807            }
19808          });
19809        } else {
19810          $(".wish_item[data-item=" + item + "]").removeClass("added");
19811          $(".wish_item[data-item=" + item + "]")
19812            .find(".value")
19813            .show();
19814          $(".wish_item[data-item=" + item + "]")
19815            .find(".value.added")
19816            .hide();
19817
19818          $(".wish_item.to[data-item=" + item + "]").show();
19819          $(".wish_item.in[data-item=" + item + "]").hide();
19820
19821          $(".like_icons").each(function () {
19822            if ($(this).find(".wish_item_button").length) {
19823              $(this)
19824                .find(".wish_item_button")
19825                .find('.wish_item[data-item="' + item + '"]')
19826                .removeClass("added");
19827              $(this)
19828                .find(".wish_item_button")
19829                .find('.wish_item[data-item="' + item + '"]')
19830                .find(".value")
19831                .show();
19832              $(this)
19833                .find(".wish_item_button")
19834                .find('.wish_item[data-item="' + item + '"]')
19835                .find(".value.added")
19836                .hide();
19837            }
19838          });
19839        }
19840      }
19841
19842      $(".in-cart[data-item=" + item + "]").hide();
19843      $(".to-cart[data-item=" + item + "]").removeClass("clicked");
19844      if (
19845        $(".to-cart[data-item=" + item + "]")
19846          .closest(".counter_wrapp")
19847          .find(".counter_block").length
19848      ) {
19849        $(".to-cart[data-item=" + item + "]")
19850          .parent()
19851          .removeClass("wide");
19852      }
19853      if (
19854        !$(".counter_block[data-item=" + item + "]")
19855          .closest(".counter_wrapp")
19856          .find(".to-order").length
19857      ) {
19858        $(".to-cart[data-item=" + item + "]").show();
19859        $(".counter_block[data-item=" + item + "]")
19860          .closest(".counter_block_inner")
19861          .show();
19862        $(".counter_block[data-item=" + item + "]").show();
19863      }
19864
19865      if (bBannerAction) {
19866        _this.toggleClass("added");
19867
19868        if (_this.hasClass("added")) _this.attr("title", _this.data("title2"));
19869        else _this.attr("title", _this.data("title"));
19870
19871        if (wrapper_btns.find(".basket_item_add").length) wrapper_btns.find(".basket_item_add").removeClass("added");
19872      }
19873
19874      if (!$(this).closest(".module-cart").size()) {
19875        $.ajax({
19876          type: "GET",
19877          url: arAsproOptions["SITE_DIR"] + "ajax/item.php",
19878          data:
19879            "item=" +
19880            item2 +
19881            "&quantity=" +
19882            val +
19883            "&wish_item=Y" +
19884            "&offers=" +
19885            offer +
19886            "&iblockID=" +
19887            iblockid +
19888            "&props=" +
19889            JSON.stringify(props),
19890          dataType: "json",
19891          success: function (data) {
19892            getActualBasket(iblockid);
19893            arStatusBasketAspro = {};
19894            if (data !== null) {
19895              if (data.MESSAGE_EXT === null) data.MESSAGE_EXT = "";
19896              if ("STATUS" in data) {
19897                if (data.STATUS === "OK") {
19898                  // js notice
19899                  $bDontOpenBasket = false;
19900                  if (
19901                    typeof JNoticeSurface !== "undefined" &&
19902                    ((!bBannerAction && !_this.hasClass("added")) || (bBannerAction && _this.hasClass("added")))
19903                  ) {
19904                    JNoticeSurface.get().onAdd2Delay([_this[0]]);
19905                    $bDontOpenBasket = true;
19906                  }
19907                  //
19908
19909                  if (arAsproOptions["COUNTERS"]["USE_BASKET_GOALS"] !== "N") {
19910                    var eventdata = { goal: "goal_wish_add", params: { id: item2 } };
19911                    BX.onCustomEvent("onCounterGoals", [eventdata]);
19912                  }
19913                  if ($("#ajax_basket").length) reloadTopBasket("wish", $("#ajax_basket"), 200, 5000, "N");
19914
19915                  if ($("#basket_line .basket_fly").length) {
19916                    if (
19917                      _this.closest(".fast_view_frame").length ||
19918                      window.matchMedia("(max-width: 767px)").matches ||
19919                      $("#basket_line .basket_fly.loaded").length
19920                    )
19921                      basketFly("wish", "N");
19922                    else {
19923                      if ($bDontOpenBasket) basketFly("wish", "N");
19924                      else basketFly("wish");
19925                    }
19926                  }
19927                } else {
19928                  showBasketError(
19929                    BX.message(data.MESSAGE) + " <br/>" + data.MESSAGE_EXT,
19930                    BX.message("ERROR_ADD_DELAY_ITEM")
19931                  );
19932                }
19933              } else {
19934                showBasketError(
19935                  BX.message(data.MESSAGE) + " <br/>" + data.MESSAGE_EXT,
19936                  BX.message("ERROR_ADD_DELAY_ITEM")
19937                );
19938              }
19939            } else {
19940              if ($("#ajax_basket").length) reloadTopBasket("wish", $("#ajax_basket"), 200, 5000, "N");
19941
19942              if ($("#basket_line .basket_fly").length) {
19943                if (
19944                  _this.closest(".fast_view_frame").length ||
19945                  window.matchMedia("(max-width: 767px)").matches ||
19946                  $("#basket_line .basket_fly.loaded").length
19947                )
19948                  basketFly("wish", "N");
19949                else basketFly("wish");
19950              }
19951            }
19952            _this.removeClass("clicked");
19953          },
19954        });
19955      }
19956    }
19957    */
19958  });
19959
19960  $(document).on("click", ".item_main_info .item_slider .flex-direction-nav li span", function (e) {
19961    if ($(".inner_slider .slides_block").length) {
19962      if ($(this).parent().hasClass("flex-nav-next")) $(".inner_slider .slides_block li.current").next().click();
19963      else $(".inner_slider .slides_block li.current").prev().click();
19964    }
19965  });
19966
19967  $(document).on("click", ".compare_item, .compare_item_add", function (e) {
19968    e.preventDefault();
19969    var item = $(this).attr("data-item");
19970    var iblockID = $(this).attr("data-iblock"),
19971      bBannerAction = false,
19972      th = $(this);
19973
19974    if (th.closest(".banner_buttons.with_actions").length) {
19975      //banner action
19976      var wrapper_btns = th.closest(".wraps_buttons");
19977      item = wrapper_btns.data("id");
19978      iblockID = wrapper_btns.data("iblockid");
19979      bBannerAction = true;
19980
19981      th.toggleClass("added");
19982
19983      if (th.hasClass("added")) th.attr("title", th.data("title2"));
19984      else th.attr("title", th.data("title"));
19985    }
19986
19987    if (!th.hasClass("clicked")) {
19988      th.addClass("clicked");
19989      if (!$(this).hasClass("text")) {
19990        if ($(this).hasClass("added")) {
19991          if (!bBannerAction) {
19992            $(this).hide();
19993            $(this).closest(".compare_item_button").find(".to").show();
19994          }
19995
19996          /*sync other button*/
19997          $(".like_icons").each(function () {
19998            if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) {
19999              $(this)
20000                .find('.compare_item.text[data-item="' + item + '"]')
20001                .removeClass("added");
20002              $(this)
20003                .find('.compare_item.text[data-item="' + item + '"]')
20004                .find(".value")
20005                .show();
20006              $(this)
20007                .find('.compare_item.text[data-item="' + item + '"]')
20008                .find(".value.added")
20009                .hide();
20010            }
20011            if ($(this).find(".compare_item_button").length) {
20012              /*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
20013              $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
20014              $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();*/
20015              $(this)
20016                .find(".compare_item_button")
20017                .find('.compare_item[data-item="' + item + '"].in')
20018                .hide();
20019              $(this)
20020                .find(".compare_item_button")
20021                .find('.compare_item[data-item="' + item + '"].to')
20022                .show();
20023            }
20024          });
20025        } else {
20026          if (!bBannerAction) {
20027            $(this).hide();
20028            $(this).closest(".compare_item_button").find(".in").show();
20029          }
20030
20031          /*sync other button*/
20032          $(".like_icons").each(function () {
20033            if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) {
20034              $(this)
20035                .find('.compare_item.text[data-item="' + item + '"]')
20036                .addClass("added");
20037              $(this)
20038                .find('.compare_item.text[data-item="' + item + '"]')
20039                .find(".value")
20040                .hide();
20041              $(this)
20042                .find('.compare_item.text[data-item="' + item + '"]')
20043                .find(".value.added")
20044                .css({ display: "block" });
20045            }
20046            if ($(this).find(".compare_item_button").length) {
20047              /*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
20048              $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
20049              $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();*/
20050              $(this)
20051                .find(".compare_item_button")
20052                .find('.compare_item[data-item="' + item + '"].to')
20053                .hide();
20054              $(this)
20055                .find(".compare_item_button")
20056                .find('.compare_item[data-item="' + item + '"].in')
20057                .show();
20058            }
20059          });
20060        }
20061      } else {
20062        if (!$(this).hasClass("added")) {
20063          $(".compare_item[data-item=" + item + "]").addClass("added");
20064          $(".compare_item[data-item=" + item + "]")
20065            .find(".value")
20066            .hide();
20067          $(".compare_item[data-item=" + item + "]")
20068            .find(".value.added")
20069            .css("display", "block");
20070
20071          /*sync other button*/
20072          $(".like_icons").each(function () {
20073            if ($(this).find(".compare_item_button").length) {
20074              $(this)
20075                .find(".compare_item_button")
20076                .find('.compare_item[data-item="' + item + '"]')
20077                .addClass("added");
20078              $(this)
20079                .find(".compare_item_button")
20080                .find('.compare_item[data-item="' + item + '"]')
20081                .find(".value.added")
20082                .show();
20083              $(this)
20084                .find(".compare_item_button")
20085                .find('.compare_item[data-item="' + item + '"]')
20086                .find(".value")
20087                .hide();
20088            }
20089          });
20090        } else {
20091          $(".compare_item[data-item=" + item + "]").removeClass("added");
20092          $(".compare_item[data-item=" + item + "]")
20093            .find(".value")
20094            .show();
20095          $(".compare_item[data-item=" + item + "]")
20096            .find(".value.added")
20097            .hide();
20098
20099          /*sync other button*/
20100          $(".like_icons").each(function () {
20101            if ($(this).find(".compare_item_button").length) {
20102              $(this)
20103                .find(".compare_item_button")
20104                .find('.compare_item[data-item="' + item + '"]')
20105                .removeClass("added");
20106              $(this)
20107                .find(".compare_item_button")
20108                .find('.compare_item[data-item="' + item + '"]')
20109                .find(".value")
20110                .show();
20111              $(this)
20112                .find(".compare_item_button")
20113                .find('.compare_item[data-item="' + item + '"]')
20114                .find(".value.added")
20115                .hide();
20116            }
20117          });
20118        }
20119      }
20120
20121      $.get(
20122        arAsproOptions["SITE_DIR"] + "ajax/item.php?item=" + item + "&compare_item=Y&iblock_id=" + iblockID,
20123        $.proxy(function (data) {
20124          getActualBasket(iblockID, "Compare");
20125          arStatusBasketAspro = {};
20126
20127          // js notice
20128          if (
20129            typeof JNoticeSurface !== "undefined" &&
20130            ((!bBannerAction && !th.hasClass("added")) || (bBannerAction && th.hasClass("added")))
20131          ) {
20132            JNoticeSurface.get().onAdd2Compare([th[0]]);
20133          }
20134          //
20135
20136          if ($("#compare_fly").length) {
20137            jsAjaxUtil.InsertDataToNode(
20138              arAsproOptions["SITE_DIR"] + "ajax/show_compare_preview_fly.php",
20139              "compare_fly",
20140              false
20141            );
20142          }
20143          th.removeClass("clicked");
20144        })
20145      );
20146    }
20147  });
20148
20149  /*
20150  $(".fancybox").fancybox({
20151    backFocus: false,
20152  });
20153  */
20154
20155  $(document).on("click", ".tabs>li", function () {
20156    var parent = $(this).parent();
20157    if (!$(this).hasClass("active")) {
20158      var sliderIndex = $(this).index(),
20159        curLiNav = $(this)
20160          .closest(".top_block")
20161          .find(".slider_navigation")
20162          .find(">li:eq(" + sliderIndex + ")"),
20163        curLi = $(this)
20164          .closest(".top_block")
20165          .siblings(".tabs_content")
20166          .find(">li:eq(" + sliderIndex + ")");
20167      $(this).addClass("active").addClass("cur").siblings().removeClass("active").removeClass("cur");
20168      curLi.addClass("cur").siblings().removeClass("cur");
20169      curLiNav.addClass("cur").siblings().removeClass("cur");
20170
20171      if (parent.hasClass("ajax")) {
20172        // front tabs
20173        if (!$(this).hasClass("clicked")) {
20174          $.ajax({
20175            url: arAsproOptions["SITE_DIR"] + "include/mainpage/comp_catalog_ajax.php",
20176            type: "POST",
20177            data: {
20178              AJAX_POST: "Y",
20179              FILTER_HIT_PROP: $(this).data("code"),
20180              AJAX_PARAMS: $(this).closest(".tab_slider_wrapp").find(".request-data").data("value"),
20181              GLOBAL_FILTER: curLi.data("filter"),
20182            },
20183          }).success(function (html) {
20184            curLi.find(".tabs_slider").html(html);
20185            var container = curLi.closest(".content_wrapper_block");
20186            if (container.length) {
20187              var bNav = curLi.find(".bottom_nav .module-pagination").length > 0;
20188              if (bNav) {
20189                container.removeClass("without-border");
20190              } else {
20191                container.addClass("without-borded");
20192              }
20193            }
20194            setTimeout(function () {
20195              curLi.addClass("opacity1");
20196            }, 100);
20197
20198            /*equal height*/
20199            // curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible .item-title').sliceHeight({item:'.catalog_item:visible', mobile: true});
20200            // curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible').sliceHeight({item:'.catalog_item:visible', mobile: true});
20201            // curLi.find('.catalog_block .catalog_item_wrapp .catalog_item:visible').sliceHeight({classNull: '.footer_button', item:'.catalog_item:visible', mobile: true});
20202
20203            initCountdown();
20204          });
20205          $(this).addClass("clicked");
20206        } else {
20207          var container = curLi.closest(".content_wrapper_block");
20208          if (container.length) {
20209            var bNav = curLi.find(".bottom_nav .module-pagination").length > 0;
20210            if (bNav) {
20211              container.removeClass("without-border");
20212            } else {
20213              container.addClass("without-borded");
20214            }
20215          }
20216          /*$('.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible').sliceHeight({
20217            classNull: '.footer_button',
20218            item:'.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible',
20219            classes: [
20220              '.item_info .item-title',
20221              '.item_info .sa_block',
20222              '.item_info .cost.prices',
20223            ],
20224            mobile: true,
20225          });*/
20226        }
20227      }
20228
20229      var eventdata = { index: sliderIndex, target: $(this) };
20230      BX.onCustomEvent("clickedTabsLi", [eventdata]);
20231    }
20232  });
20233
20234  /*search click*/
20235  $(".search_block .icon").on("click", function () {
20236    var th = $(this);
20237    if ($(this).hasClass("open")) {
20238      $(this).closest(".center_block").find(".search_middle_block").removeClass("active");
20239      $(this).removeClass("open");
20240      $(this).closest(".center_block").find(".search_middle_block").find(".noborder").hide();
20241    } else {
20242      setTimeout(function () {
20243        th.closest(".center_block").find(".search_middle_block").find(".noborder").show();
20244      }, 100);
20245      $(this).closest(".center_block").find(".search_middle_block").addClass("active");
20246      $(this).addClass("open");
20247    }
20248  });
20249
20250  $(document).on("click", ".no_goods .button", function () {
20251    $(".bx_filter .smartfilter .bx_filter_search_reset").trigger("click");
20252  });
20253
20254  $(document).on("click", ".js-load-link", function (e) {
20255    AjaxClickLink(e);
20256  });
20257
20258  $(document).on("click", ".svg-inline-bottom_nav-icon", function () {
20259    $(this).next().trigger("click");
20260  });
20261  $(document).on("click", ".ajax_load_btn", function () {
20262    var _this = $(this),
20263      url = _this.closest(".container").find(".module-pagination .flex-direction-nav .flex-next").attr("href"),
20264      th = _this.find(".more_text_ajax"),
20265      bottom_nav = _this.closest(".bottom_nav"),
20266      mobileBottomNav = bottom_nav.hasClass("mobile_slider"),
20267      bLoadingState = _this.closest(".animate-load-state").length;
20268
20269    if (!th.hasClass("loading")) {
20270      th.addClass("loading");
20271      if (mobileBottomNav) {
20272        var icon = bottom_nav.find(".svg-inline-bottom_nav-icon");
20273        icon.css("display", "none");
20274      }
20275      if (bLoadingState) _this.addClass("loadings");
20276
20277      var objUrl = parseUrlQuery(),
20278        add_url = "";
20279      obGetData = { ajax_get: "Y", AJAX_REQUEST: "Y" };
20280
20281      if (_this.closest(".wrapper_inner.front").length) {
20282        //index page
20283        var class_block = th.closest(".drag-block").data("class").replace("_drag", "");
20284        class_block = class_block.replace(/\s/g, "");
20285        obGetData.BLOCK = class_block;
20286      }
20287
20288      if (_this.closest(".tab").length) {
20289        //tabs block
20290        var parentTab = th.closest(".tab");
20291        obGetData.FILTER_HIT_PROP = parentTab.data("code");
20292        obGetData.GLOBAL_FILTER = parentTab.data("filter");
20293        url = _this.closest(".bottom_nav").find(".module-pagination .flex-direction-nav .flex-next").attr("href");
20294      }
20295
20296      if (_this.closest(".content_linked_goods").length) {
20297        //linked_goods block in content
20298        var filterSections = th.closest(".content_linked_goods").attr("data-sections-ids");
20299        obGetData.ajax_section_id = decodeURIComponent(filterSections);
20300
20301        url = _this.closest(".bottom_nav").find(".module-pagination .flex-direction-nav .flex-next").attr("href");
20302      }
20303
20304      if ("clear_cache" in objUrl) {
20305        if (objUrl.clear_cache == "Y") add_url = "&clear_cache=Y";
20306      }
20307      if (_this.hasClass("ajax")) obGetData.ajax = "y";
20308
20309      if (th.closest(".goods-block.ajax_load")) obGetData.bitrix_include_areas = "N";
20310
20311      if (_this.closest(".nav-data_block").length) {
20312        //need data-block
20313        obGetData.data_block = _this.closest(".nav-data_block").attr("data-block");
20314        obGetData.pagen_data_block = "Y";
20315        url = _this.closest(".bottom_nav").find(".module-pagination .flex-direction-nav .flex-next").attr("href");
20316      }
20317
20318      $.ajax({
20319        url: url + add_url,
20320        data: obGetData,
20321        success: function (html) {
20322          pasteAjaxPagination(html, th, bottom_nav, bLoadingState, _this);
20323        },
20324        error: function (html) {
20325          pasteAjaxPagination(html.responseText, th, bottom_nav, bLoadingState, _this);
20326        },
20327      });
20328    }
20329  });
20330
20331  function pasteAjaxPagination(html, th, bottom_nav, bLoadingState, _this) {
20332    var mobileBottomClicked = bottom_nav.hasClass("mobile_slider");
20333    var hasMobileBottomNav = $(html).find(".bottom_nav.mobile_slider");
20334    var bottomNav = hasMobileBottomNav.length ? hasMobileBottomNav : $(html).find(".bottom_nav");
20335    var bottomNavHtml = bottomNav.html();
20336    var bottomNavScrollClass = bottomNav.data("scroll-class");
20337    var hasBottomNav = $(html).find(".ajax_load_btn").length;
20338
20339    if (th.closest(".ajax_load").length && !mobileBottomClicked) {
20340      th.removeClass("loading");
20341      if (th.closest(".ajax_load").find(".js_append").length) {
20342        if (_this.closest(".catalog_in_content").length) {
20343          th.closest(".ajax_load").find(".js_append").append($(".inner_wrapper .js_wrapper_items>", html)); //need for brands & landings
20344        } else if (_this.closest(".catalog.search").length) {
20345          th.closest(".ajax_load").find(".js_append").append($(".js_append>", html));
20346        } else {
20347          th.closest(".ajax_load").find(".js_append").append(html);
20348        }
20349        th.closest(".ajax_load").find(".bottom_nav_wrapper").remove();
20350      } else {
20351        if ($(".display_list").length) {
20352          $(".display_list").append(html);
20353          th.closest(".display_list").find(".bottom_nav_wrapper").remove();
20354        } else if ($(".block_list").length) {
20355          $(".block_list").append(html);
20356          touchItemBlock(".catalog_item a");
20357          th.closest(".block_list").find(".bottom_nav_wrapper").remove();
20358        } else if ($(".module_products_list").length) {
20359          $(".module_products_list > tbody").append(html);
20360          th.closest(".module_products_list > tbody").find(".bottom_nav_wrapper").remove();
20361        }
20362      }
20363
20364      setStatusButton();
20365      checkLinkedArticles();
20366      checkLinkedBlocks(".linked-banners-list");
20367
20368      var eventdata = { action: "ajaxContentLoadedTab" };
20369      BX.onCustomEvent("onAjaxSuccess", [eventdata]);
20370      _this.closest(".bottom_nav").html(bottomNavHtml);
20371    } else {
20372      var eventdata = { action: "ajaxContentLoaded" };
20373
20374      if ($(".banners-small.front").length) {
20375        $(".banners-small .items.row").append(html);
20376        $(".bottom_nav").html($(".banners-small .items.row .bottom_nav").html());
20377        $(".banners-small .items.row .bottom_nav").remove();
20378        if (hasBottomNav) {
20379          $(".banners-small .items.row").addClass("has-bottom-nav");
20380        } else {
20381          $(".banners-small .items.row").removeClass("has-bottom-nav");
20382        }
20383      } else {
20384        if (bottom_nav.data("append") !== undefined && bottom_nav.data("parent") !== undefined) {
20385          var target = html;
20386          if (bottom_nav.data("target") !== undefined) {
20387            target = $(html).find(bottom_nav.data("target"));
20388          }
20389          if (mobileBottomClicked || hasMobileBottomNav.length) {
20390            var mobileSliderNav = th.closest(bottom_nav.data("parent")).find(".bottom_nav.mobile_slider");
20391            if (mobileSliderNav.length) {
20392              mobileSliderNav.before(target);
20393            } else {
20394              bottom_nav.before(target);
20395            }
20396          } else {
20397            th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).append(target);
20398          }
20399          th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).find(".bottom_nav_wrapper").remove();
20400
20401          if (hasBottomNav) {
20402            if (bottomNavScrollClass !== undefined) {
20403              th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).addClass("has-bottom-nav");
20404            }
20405            th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).addClass("has-bottom-nav");
20406          } else {
20407            if (bottomNavScrollClass !== undefined) {
20408              th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).removeClass("has-bottom-nav");
20409            }
20410            th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).removeClass("has-bottom-nav");
20411          }
20412
20413          bottom_nav = th.closest(bottom_nav.data("parent")).find(".bottom_nav");
20414          bottom_nav.html(bottomNavHtml);
20415          var icon = bottom_nav.find(".svg-inline-bottom_nav-icon");
20416          icon.css("display", "");
20417
20418          eventdata.container = th.closest(bottom_nav.data("parent"));
20419        } else {
20420          if (th.closest(".item-views").find(".items").length) {
20421            th.closest(".item-views").find(".items").append(html);
20422          } else {
20423            $(html).insertBefore($(".blog .bottom_nav"));
20424          }
20425
20426          bottom_nav.html($(".bottom_nav:hidden").html());
20427          if (hasBottomNav) {
20428            th.closest(".item-views").find(".items").addClass("has-bottom-nav");
20429          } else {
20430            th.closest(".item-views").find(".items").removeClass("has-bottom-nav");
20431          }
20432          _this.closest(".item-views").find(".bottom_nav:hidden").remove();
20433        }
20434      }
20435
20436      eventdata.content = html;
20437      eventdata.container = th;
20438      BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]);
20439
20440      setTimeout(function () {
20441        $(".banners-small .item.normal-block").sliceHeight({ resize: false });
20442        if ($(".item.slice-item").length) {
20443          $(".item.slice-item .title").sliceHeight({ resize: false });
20444          $(".item.slice-item").sliceHeight({ resize: false });
20445        }
20446        th.removeClass("loading");
20447        if (bLoadingState) _this.removeClass("loadings");
20448      }, 100);
20449    }
20450    BX.onCustomEvent("onHeaderProgressBarChange", [{}]);
20451    initCountdown();
20452  }
20453
20454  // form rating
20455  $(document).on("mouseenter", ".form .votes_block.with-text .item-rating", function () {
20456    var $this = $(this),
20457      index = $this.index(),
20458      ratingValue = $this.data("rating_value"),
20459      ratingMessage = $this.data("message");
20460
20461    $(this).addClass("filed");
20462    $this.siblings().each(function () {
20463      if ($(this).index() <= index) $(this).addClass("filed");
20464      else $(this).removeClass("filed");
20465    });
20466    $this.closest(".votes_block").find(".rating_message").text(ratingMessage);
20467  });
20468
20469  $(document).on("mouseleave", ".form .votes_block.with-text", function () {
20470    var $this = $(this),
20471      index = $this.data("rating"),
20472      ratingMessage = $this.closest(".votes_block").find(".rating_message").data("message");
20473
20474    $this.find(".item-rating").each(function () {
20475      if ($(this).index() < index && index !== undefined) $(this).addClass("filed");
20476      else $(this).removeClass("filed");
20477    });
20478    $this.closest(".votes_block").find(".rating_message").text(ratingMessage);
20479  });
20480
20481  $(document).on("click", ".form .votes_block.with-text .item-rating", function () {
20482    var $this = $(this),
20483      rating = $this.closest(".votes_block").data("rating"),
20484      index = $this.index() + 1,
20485      ratingMessage = $this.data("message");
20486
20487    $this.closest(".votes_block").data("rating", index);
20488    if ($this.closest(".form-control").find("input[name=RATING]").length) {
20489      $this.closest(".form-control").find("input[name=RATING]").val(index);
20490    } else {
20491      $this.closest(".form-control").find("input[data-sid=RATING]").val(index);
20492    }
20493    $this.closest(".votes_block").find(".rating_message").data("message", ratingMessage);
20494  });
20495
20496  //set cookie for basket link click
20497  $(document).on(
20498    "click",
20499    ".bx_ordercart_order_table_container .control > a, .basket-item-actions-remove, a[data-entity=basket-item-remove-delayed]",
20500    function (e) {
20501      $.removeCookie("click_basket", { path: "/" });
20502      $.cookie("click_basket", "Y", { path: "/" });
20503    }
20504  );
20505
20506  $(document).on("click", ".bx_compare .tabs-head li", function () {
20507    var url = $(this).find(".sortbutton").data("href");
20508    BX.showWait(BX("bx_catalog_compare_block"));
20509    $.ajax({
20510      url: url,
20511      data: { ajax_action: "Y" },
20512      success: function (html) {
20513        history.pushState(null, null, url);
20514        $("#bx_catalog_compare_block").html(html);
20515        BX.closeWait();
20516      },
20517    });
20518  });
20519  var hoveredTrs;
20520  $(document).on(
20521    {
20522      mouseover: function (e) {
20523        var _ = $(this);
20524        var tbodyIndex = _.closest("tbody").index() + 1; //+1 for nth-child
20525        var trIndex = _.index() + 1; // +1 for nth-child
20526        hoveredTrs = $(e.delegateTarget)
20527          .find(".data_table_props")
20528          .children(":nth-child(" + tbodyIndex + ")")
20529          .children(":nth-child(" + trIndex + ")")
20530          .addClass("hovered");
20531      },
20532      mouseleave: function (e) {
20533        if (hoveredTrs) hoveredTrs.removeClass("hovered");
20534      },
20535    },
20536    ".bx_compare .data_table_props tbody>tr"
20537  );
20538  $(document).on("click", ".fancy_zoom", function (e) {
20539    e.preventDefault();
20540    var arPict = [],
20541      index = 0;
20542    $(this)
20543      .closest(".product-detail-gallery__container")
20544      .find(".product-detail-gallery__thmb-container .product-detail-gallery__item")
20545      .each(function () {
20546        var obImg = {};
20547        obImg = {
20548          src: $(this).data("big"),
20549          thumb: $(this).find('img').data('src') || $(this).find('.img').attr('src')
20550          // opts: {
20551          //   caption: $(this).find("img").attr("alt"),
20552          // },
20553        };
20554        if ($(this).parent().hasClass("current")) {
20555          index = $(this).parent().index();
20556        }
20557        arPict.push(obImg);
20558      });
20559    if (!arPict.length) {
20560      arPict.push({
20561        src: $(this).closest(".product-detail-gallery__container").find(".zoom_picture").data("xoriginal"),
20562      });
20563    }
20564    if (typeof $.fn.fancybox !== "function") {
20565      return;
20566    }
20567    $.fancybox.open(
20568      arPict,
20569      {
20570        tpl: {
20571          closeBtn:
20572            '<span title="' +
20573            BX.message("FANCY_CLOSE") +
20574            '" class="fancybox-item fancybox-close inline svg"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg></span>',
20575          next:
20576            '<a title="' +
20577            BX.message("FANCY_NEXT") +
20578            '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
20579          prev:
20580            '<a title="' +
20581            BX.message("FANCY_PREV") +
20582            '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
20583        },
20584        btnTpl: {
20585          close:
20586            '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
20587            '<i class="svg"><svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" /></svg></i>' +
20588            "</button>",
20589
20590          arrowLeft:
20591            '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
20592            '<div><i class="svg left"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 13L0.585787 14.4142C-0.195262 13.6332 -0.195262 12.3668 0.585787 11.5858L2 13ZM11.5858 0.585786C12.3668 -0.195262 13.6332 -0.195262 14.4142 0.585786C15.1953 1.36683 15.1953 2.63317 14.4142 3.41421L11.5858 0.585786ZM14.4142 22.5858C15.1953 23.3668 15.1953 24.6332 14.4142 25.4142C13.6332 26.1953 12.3668 26.1953 11.5858 25.4142L14.4142 22.5858ZM0.585787 11.5858L11.5858 0.585786L14.4142 3.41421L3.41421 14.4142L0.585787 11.5858ZM3.41421 11.5858L14.4142 22.5858L11.5858 25.4142L0.585787 14.4142L3.41421 11.5858Z" fill="#999999"/></svg></i></div>' +
20593            "</button>",
20594
20595          arrowRight:
20596            '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
20597            '<div><i class="svg right"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 13L14.4142 14.4142C15.1953 13.6332 15.1953 12.3668 14.4142 11.5858L13 13ZM3.41421 0.585786C2.63317 -0.195262 1.36683 -0.195262 0.585786 0.585786C-0.195262 1.36683 -0.195262 2.63317 0.585786 3.41421L3.41421 0.585786ZM0.585786 22.5858C-0.195262 23.3668 -0.195262 24.6332 0.585786 25.4142C1.36683 26.1953 2.63317 26.1953 3.41421 25.4142L0.585786 22.5858ZM14.4142 11.5858L3.41421 0.585786L0.585786 3.41421L11.5858 14.4142L14.4142 11.5858ZM11.5858 11.5858L0.585786 22.5858L3.41421 25.4142L14.4142 14.4142L11.5858 11.5858Z" fill="white"/></svg></i></div>' +
20598            "</button>",
20599        },
20600        touch: "enabled",
20601        loop: false,
20602        buttons: [
20603          // "zoom",
20604          //"share",
20605          // "slideShow",
20606          //"fullScreen",
20607          //"download",
20608          // "thumbs",
20609          "close",
20610        ],
20611        thumbs: {
20612          autoStart: true,
20613        },
20614        onActivate: function (instance) {
20615          InitFancyboxThumbnailsGallery(instance);
20616        },
20617        beforeShow: function (instance, current) {
20618          if ($(".fancybox-thumbs .swiper-container").length) {
20619            const swiper = $(".fancybox-thumbs .swiper-container").data("swiper");
20620            swiper.slideTo(current.index);
20621          }
20622        },
20623      },
20624      index
20625    );
20626  });
20627
20628  /*tabs*/
20629  $(".tabs_section .tabs-head li").on("click", function () {
20630    if (!$(this).is(".current")) {
20631      $(".tabs_section .tabs-head li").removeClass("current");
20632      $(this).addClass("current");
20633      $(".tabs_section ul.tabs_content li").removeClass("current");
20634      if ($(this).attr("id") == "product_reviews_tab") {
20635        $(".shadow.common").hide();
20636        $("#reviews_content").show();
20637      } else {
20638        $(".shadow.common").show();
20639        $("#reviews_content").hide();
20640        $(".tabs_section ul.tabs_content > li:eq(" + $(this).index() + ")").addClass("current");
20641      }
20642    }
20643  });
20644
20645  /*open first section slide*/
20646  setTimeout(function () {
20647    $(".jobs_wrapp .item:first .name tr").trigger("click");
20648  }, 300);
20649
20650  $(".choise").on("click", function () {
20651    var _this = $(this);
20652    if (typeof _this.attr("data-block") != "undefined") {
20653      if ($(_this.attr("data-block")).closest(".tab-pane").length) {
20654        $('.ordered-block a[href="#' + $(_this.attr("data-block")).closest(".tab-pane").attr("id") + '"]').click();
20655        _this.data("block", ".ordered-block.tabs-block");
20656        $(_this.data("block")).data("offset", -100);
20657      } else {
20658        $(_this.data("block")).data("offset", -100);
20659      }
20660      scrollToBlock(_this.data("block"));
20661    }
20662  });
20663
20664  $(document).on("click", ".buy_block .slide_offer", function () {
20665    scroll_block($(".js-offers-scroll"));
20666  });
20667  $(".share  > .share_wrapp .text").on("click", function () {
20668    var block = $(this).parent().find(".shares");
20669    if (!block.is(":visible") && !$(this).closest(".share.top").length) $("#content").css("z-index", 3);
20670    block.fadeToggle(100, function () {
20671      if (!block.is(":visible")) $("#content").css("z-index", 2);
20672    });
20673  });
20674  $("html, body").on("mousedown", function (e) {
20675    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
20676      e.stopPropagation();
20677      $("div.shares").fadeOut(100, function () {
20678        $("#content").css("z-index", 2);
20679        $(".price_txt .share_wrapp").removeClass("opened");
20680      });
20681      $(".search_middle_block").removeClass("active_wide");
20682    }
20683  });
20684  $(".share_wrapp")
20685    .find("*")
20686    .on("mousedown", function (e) {
20687      e.stopPropagation();
20688    });
20689
20690  $(".price_txt .share_wrapp .text").click(function () {
20691    $(this).parent().toggleClass("opened");
20692    $(this).parent().find(".shares").fadeToggle();
20693  });
20694
20695  $(document).on("click", ".reviews-collapse-link", function () {
20696    $(".reviews-reply-form").slideToggle();
20697  });
20698
20699  /* accordion action*/
20700  $(".panel-collapse").on("hidden.bs.collapse", function () {
20701    $(this).parent().toggleClass("opened");
20702  });
20703  $(".panel-collapse").on("show.bs.collapse", function () {
20704    $(this).parent().toggleClass("opened");
20705  });
20706
20707  /* accordion */
20708  $(".accordion-head").on("click", function (e) {
20709    e.preventDefault();
20710    if (!$(this).next().hasClass("collapsing")) {
20711      $(this).toggleClass("accordion-open");
20712      $(this).toggleClass("accordion-close");
20713    }
20714  });
20715
20716  /* progress bar */
20717  $("[data-appear-progress-animation]").each(function () {
20718    var $this = $(this);
20719    $this.appear(
20720      function () {
20721        var delay = $this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1;
20722        if (delay > 1) $this.css("animation-delay", delay + "ms");
20723        $this.addClass($this.attr("data-appear-animation"));
20724
20725        setTimeout(function () {
20726          $this.animate(
20727            {
20728              width: $this.attr("data-appear-progress-animation"),
20729            },
20730            1500,
20731            "easeOutQuad",
20732            function () {
20733              $this.find(".progress-bar-tooltip").animate(
20734                {
20735                  opacity: 1,
20736                },
20737                500,
20738                "easeOutQuad"
20739              );
20740            }
20741          );
20742        }, delay);
20743      },
20744      { accX: 0, accY: -50 }
20745    );
20746  });
20747
20748  initCountdown();
20749
20750  /* portfolio item */
20751  if ($(".item.animated-block").length) {
20752    $(".item.animated-block").appear(
20753      function () {
20754        var $this = $(this);
20755
20756        $this.addClass($this.data("animation")).addClass("visible");
20757      },
20758      { accX: 0, accY: 150 }
20759    );
20760  }
20761
20762  /* flexslider appear */
20763  if ($(".appear-block").length) {
20764    $(".appear-block").appear(
20765      function () {
20766        var $this = $(this);
20767        $this.removeClass("appear-block");
20768        $this.find('.appear-block').removeClass("appear-block");
20769        CheckFlexSlider();
20770        InitFlexSlider();
20771        InitOwlSlider();
20772      },
20773      { accX: 0, accY: 150 }
20774    );
20775  }
20776
20777  /* js-load-block appear */
20778  if ($(".js-load-block").length) {
20779    var objUrl = parseUrlQuery();
20780    var bClearCache = false;
20781    if ("clear_cache" in objUrl) {
20782      if (objUrl.clear_cache == "Y") {
20783        bClearCache = true;
20784      }
20785    }
20786
20787    var items = [];
20788    var bIdle = true;
20789    var insertNextBlockContent = function () {
20790      if (bIdle && items.length) {
20791        bIdle = false;
20792        const item = items.pop();
20793
20794        // get content
20795        $.get(item.url).done(function (html) {
20796          item.content = html;
20797          item.content = $.trim(item.content);
20798
20799          // remove /bitrix/js/main/core/core_window.js if it was loaded already
20800          if (item.content.indexOf("/bitrix/js/main/core/core_window.") !== -1 && BX.WindowManager) {
20801            item.content = item.content.replace(
20802              /<script src="\/bitrix\/js\/main\/core\/core_window\.[^>]*><\/script>/gm,
20803              ""
20804            );
20805          }
20806
20807          // remove /bitrix/js/currency/core_currency.js if it was loaded already
20808          if (
20809            item.content.indexOf("/bitrix/js/currency/core_currency.") !== -1 &&
20810            typeof BX.Currency === "object" &&
20811            BX.Currency.defaultFormat
20812          ) {
20813            item.content = item.content.replace(
20814              /<script src="\/bitrix\/js\/currency\/core_currency\.[^>]*><\/script>/gm,
20815              ""
20816            );
20817          }
20818
20819          // remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already
20820          if (item.content.indexOf("/bitrix/js/main/pageobject/pageobject.") !== -1 && BX.PageObject) {
20821            item.content = item.content.replace(
20822              /<script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^>]*><\/script>/gm,
20823              ""
20824            );
20825          }
20826
20827          // remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need
20828          if (
20829            item.content.indexOf("/bitrix/js/main/polyfill/promise/js/promise.") !== -1 &&
20830            typeof window.Promise !== "undefined" &&
20831            window.Promise.toString().indexOf("[native code]") !== -1
20832          ) {
20833            item.content = item.content.replace(
20834              /<script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^>]*><\/script>/gm,
20835              ""
20836            );
20837          }
20838
20839          if (typeof MutationObserver === 'function' && document.querySelector('body').classList.contains('detail_page')) {
20840            const observer = new MutationObserver(function (list, observer) {
20841              const $curBlock = list[0].target;
20842              const curBlockBounds = $curBlock.getBoundingClientRect();
20843
20844              if ($curBlock.parentElement.classList.contains('complect-block')) {
20845                $curBlock.parentElement.classList.add('loaded')
20846              }
20847
20848              if (curBlockBounds.top < 0 && curBlockBounds.bottom >= 0) {
20849                const offsetTop = window.scrollY + Math.round($curBlock.offsetHeight) - 100;
20850                window.scrollTo(0, offsetTop);
20851              }
20852
20853              observer.disconnect();
20854            });
20855
20856            observer.observe(item.$context[0], {
20857              childList: true,
20858            });
20859          }
20860
20861          const ob = BX.processHTML(item.content);
20862
20863          // stop ya metrika webvisor DOM indexer
20864          pauseYmObserver();
20865
20866          item.$context.removeAttr("data-file").removeClass("loader_circle");
20867          item.$target.innerHTML = ob.HTML;
20868
20869          BX.ajax.processScripts(ob.SCRIPT);
20870
20871          var eventdata = { action: "jsLoadBlock" };
20872          BX.onCustomEvent("onCompleteAction", [eventdata, item.$context]);
20873
20874          BX.onCustomEvent("onHeaderProgressBarChange", [{}]);
20875
20876          // resume ya metrika webvisor
20877          // 500ms
20878          setTimeout(resumeYmObserver, 500);
20879
20880          bIdle = true;
20881          insertNextBlockContent();
20882        });
20883      }
20884    };
20885
20886    $(".js-load-block").appear(
20887      function () {
20888        var $this = $(this);
20889
20890        if ($this.data("file")) {
20891          const add_url = new URL(location.origin + $this.data('file'));
20892
20893          if (bClearCache)
20894            add_url.searchParams.set('clear_cache', 'Y');
20895          if ($this.data("block"))
20896            add_url.searchParams.set('BLOCK', $this.data("block"));
20897          if ($this.data('show_all'))
20898            add_url.searchParams.set('SHOW_ALL', 'Y');
20899
20900          const $target = $this.data("appendTo")
20901            ? $this.find($this.data("appendTo"))[0]
20902            : $this.find('> div[id*="bx_incl_"]').length
20903              ? $this.find('> div[id*="bx_incl_"]')[0]
20904              : $this[0];
20905
20906          items.unshift({
20907            $target: $target,
20908            $context: $this,
20909            url: add_url,
20910          });
20911          insertNextBlockContent()
20912        }
20913      },
20914      { accX: 0, accY: isMobile ? 300 : 150 }
20915    );
20916  }
20917
20918  /*show ajax store amount product*/
20919  $(document).on("click", ".js-show-info-block", function (e) {
20920    var $this = $(this);
20921
20922    //check on ".cost.prices" need for popup price in mobile
20923    if (window.matchMedia("(max-width: 500px)").matches && !$this.closest(".cost.prices").length) {
20924      return;
20925    }
20926
20927    e.stopPropagation();
20928    $(".js-info-block").fadeOut();
20929
20930    if ($this.hasClass("opened")) {
20931      $(".js-show-info-block").removeClass("opened");
20932    } else {
20933      $(".js-show-info-block").removeClass("opened");
20934      $this.addClass("opened");
20935    }
20936
20937    if (!$this.siblings(".js-info-block").length) {
20938      var dataFields = $this.closest(".sa_block").data("fields");
20939      dataFields = dataFields == "null" || dataFields === undefined ? "" : dataFields;
20940      var dataUserFields = $this.closest(".sa_block").data("user-fields");
20941      dataUserFields = dataUserFields == "null" || dataUserFields === undefined ? "" : dataUserFields;
20942      var objUrl = parseUrlQuery(),
20943        add_url = "";
20944      if ("clear_cache" in objUrl) {
20945        if (objUrl.clear_cache == "Y") add_url += "?clear_cache=Y";
20946      }
20947
20948      var obPostParams = {
20949        ajax: "Y",
20950        ELEMENT_ID: $this.data("id"),
20951        FIELDS: dataFields,
20952        USER_FIELDS: dataUserFields,
20953        STORES: $this.closest(".sa_block").data("stores") || "",
20954      };
20955
20956      $this.addClass("loadings");
20957      $.post(arAsproOptions["SITE_DIR"] + "ajax/productStoreAmountCompact.php" + add_url, obPostParams).done(function (
20958        html
20959      ) {
20960        $this.removeClass("loadings");
20961        $(html).appendTo($this.closest(".sa_block"));
20962
20963        $this
20964          .siblings(".js-info-block")
20965          .find(".more-btn a")
20966          .attr("href", $this.closest(".item_info").find("a").attr("href"));
20967        InitScrollBar();
20968
20969        var eventdata = { action: "jsShowStores" };
20970        BX.onCustomEvent("onCompleteAction", [eventdata, $this]);
20971      });
20972    } else {
20973      if ($this.hasClass("opened")) {
20974        $this
20975          .siblings(".js-info-block")
20976          .find(".more-btn a")
20977          .attr("href", $this.closest(".item_info").find("a").attr("href"));
20978        $this.siblings(".js-info-block").fadeIn();
20979        InitScrollBar();
20980      } else {
20981        $this.siblings(".js-info-block").fadeOut();
20982      }
20983    }
20984  });
20985  $(document).on("click", ".js-info-block .svg-inline-close", function () {
20986    $(".js-show-info-block").removeClass("opened");
20987    $(this).closest(".js-info-block").fadeOut();
20988  });
20989  /**/
20990
20991  /*adaptive menu start*/
20992  $(".menu.adaptive").on("click", function () {
20993    $(this).toggleClass("opened");
20994    if ($(this).hasClass("opened")) {
20995      $(".mobile_menu").toggleClass("opened").slideDown();
20996    } else {
20997      $(".mobile_menu").toggleClass("opened").slideUp();
20998    }
20999  });
21000  $(".mobile_menu .has-child >a").on("click", function (e) {
21001    var parentLi = $(this).parent();
21002    e.preventDefault();
21003    parentLi.toggleClass("opened");
21004    parentLi.find(".dropdown").slideToggle();
21005  });
21006
21007  $(".mobile_menu .search-input-div input").on("keyup", function (e) {
21008    var inputValue = $(this).val();
21009    $(".center_block .stitle_form input").val(inputValue);
21010    if (e.keyCode == 13) {
21011      $(".center_block .stitle_form form").submit();
21012    }
21013  });
21014
21015  $(".center_block .stitle_form input").on("keyup", function (e) {
21016    var inputValue = $(this).val();
21017    $(".mobile_menu .search-input-div input").val(inputValue);
21018    if (e.keyCode == 13) {
21019      $(".center_block .stitle_form form").submit();
21020    }
21021  });
21022
21023  $(".mobile_menu .search-button-div button").on("click", function (e) {
21024    e.preventDefault();
21025    var inputValue = $(this).parents().find("input").val();
21026    $(".center_block .stitle_form input").val(inputValue);
21027    $(".center_block .stitle_form form").submit();
21028  });
21029  /*adaptive menu end*/
21030
21031  $(document).on("click", ".mega-menu .dropdown-menu", function (e) {
21032    e.stopPropagation();
21033  });
21034
21035  $(document).on("click", ".mega-menu .dropdown-toggle.more-items", function (e) {
21036    e.preventDefault();
21037  });
21038
21039  $(document).on(
21040    "mouseenter",
21041    ".table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle",
21042    function () {
21043      // setTimeout(
21044      // 	function() {
21045      // 		CheckTopVisibleMenu();
21046      // 	}, 275);
21047    }
21048  );
21049  $(document).on("mouseenter", "#headerfixed .table-menu .dropdown-menu .dropdown-submenu", function () {
21050    setTimeout(function () {
21051      CheckTopVisibleMenu();
21052    }, 275);
21053  });
21054
21055  $(".mega-menu .search-item .search-icon, .menu-row #title-search .fa-close").on("click", function (e) {
21056    e.preventDefault();
21057    $(".menu-row #title-search").toggleClass("hide");
21058  });
21059
21060  $(".mega-menu ul.nav .search input").on("keyup", function (e) {
21061    var inputValue = $(this).val();
21062    $(".menu-row > .search input").val(inputValue);
21063    if (e.keyCode == 13) {
21064      $(".menu-row > .search form").submit();
21065    }
21066  });
21067
21068  $(".menu-row > .search input").on("keyup", function (e) {
21069    var inputValue = $(this).val();
21070    $(".mega-menu ul.nav .search input").val(inputValue);
21071    if (e.keyCode == 13) {
21072      $(".menu-row > .search form").submit();
21073    }
21074  });
21075
21076  $(".mega-menu ul.nav .search button").on("click", function (e) {
21077    e.preventDefault();
21078    var inputValue = $(this).parents(".search").find("input").val();
21079    $(".menu-and-search .search input").val(inputValue);
21080    $(".menu-row > .search form").submit();
21081  });
21082
21083  $(".btn.btn-add").on("click", function () {
21084    $.ajax({
21085      type: "GET",
21086      url: arAsproOptions["SITE_DIR"] + "ajax/clearBasket.php",
21087      success: function (data) { },
21088    });
21089  });
21090
21091  $(".sort_display a").on("click", function () {
21092    $(this).siblings().removeClass("current");
21093    $(this).addClass("current");
21094  });
21095
21096  /*detail order show payments*/
21097  $(".sale-order-detail-payment-options-methods-info-change-link").on("click", function () {
21098    $(this).closest(".sale-order-detail-payment-options-methods-info").addClass("opened").siblings().addClass("opened");
21099  });
21100
21101  /*expand/hide filter values*/
21102  $(document).on("click", ".expand_block", function () {
21103    togglePropBlock($(this));
21104  });
21105
21106  /*touch event*/
21107  document.addEventListener(
21108    "touchend",
21109    function (event) {
21110      if (!$(event.target).closest(".menu-item").length && !$(event.target).hasClass("menu-item")) {
21111        $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 });
21112        $(".menu-item").removeClass("hover");
21113        $(".bx-breadcrumb-item.drop").removeClass("hover");
21114      }
21115      if (!$(event.target).closest(".menu.topest").length) {
21116        if (window.matchMedia("(max-width: 991px)").matches) {
21117          $(".menu.topest").css({ overflow: "hidden" });
21118        }
21119        $(".menu.topest > li").removeClass("hover");
21120      }
21121      if (!$(event.target).closest(".full.has-child").length) {
21122        $(".menu_top_block.catalog_block li").removeClass("hover");
21123      }
21124      if (!$(event.target).closest(".basket_block").length) {
21125        $(".basket_block .link").removeClass("hover");
21126        $(".basket_block .basket_popup_wrapp").slideUp();
21127      }
21128      if (!$(event.target).closest(".catalog_item").length) {
21129        var tabsContentUnhoverHover = $(".tab:visible").attr("data-unhover") * 1;
21130        $(".tab:visible").stop().animate({ height: tabsContentUnhoverHover }, 100);
21131        $(".tab:visible").find(".catalog_item").removeClass("hover");
21132        $(".tab:visible").find(".catalog_item .buttons_block").stop().fadeOut(233);
21133        if ($(".catalog_block").length) {
21134          $(".catalog_block").find(".catalog_item_wrapp").removeClass("hover");
21135          $(".catalog_block").find(".catalog_item").removeClass("hover");
21136        }
21137      }
21138      //togglePropBlock($(event.target));
21139    },
21140    false
21141  );
21142
21143  touchMenu(".menu-row .menu-item");
21144  touchTopMenu(".menu.topest li");
21145  touchLeftMenu(".menu_top_block:not(.in-search) li.full");
21146  touchBreadcrumbs(".bx-breadcrumb-item.drop");
21147
21148  $(document).on("keyup", ".coupon .input_coupon input", function () {
21149    if ($(this).val().length) {
21150      $(this).removeClass("error");
21151      $(this).closest(".input_coupon").find(".error").remove();
21152    } else {
21153      $(this).addClass("error");
21154      $("<label class='error'>" + BX.message("INPUT_COUPON") + "</label>").insertBefore($(this));
21155    }
21156  });
21157  // showPhoneMask("input[autocomplete=tel]");
21158  BX.addCustomEvent(window, "onAjaxSuccessFilter", function (e) {
21159    setBasketStatusBtn();
21160    checkLinkedArticles();
21161    checkLinkedBlocks(".linked-banners-list");
21162  });
21163
21164  $(document).on("click", ".block_container .items .item.initied", function () {
21165    var _this = $(this),
21166      itemID = _this.data("id"),
21167      animationTime = 200;
21168
21169    _this.closest(".items").fadeOut(animationTime, function () {
21170      _this.closest(".block_container").find(".detail_items").fadeIn(animationTime);
21171      _this
21172        .closest(".block_container")
21173        .find(".detail_items .item[data-id=" + itemID + "]")
21174        .fadeIn(animationTime);
21175
21176      var arCoordinates = _this.data("coordinates").split(",");
21177
21178      if (typeof map !== "undefined") map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
21179    });
21180  });
21181
21182  $(document).on("click", ".block_container .top-close", function () {
21183    var _this = $(this).closest(".block_container").find(".detail_items .item:visible"),
21184      animationTime = 200;
21185    _this.fadeOut(animationTime);
21186    _this
21187      .closest(".block_container")
21188      .find(".detail_items")
21189      .fadeOut(animationTime, function () {
21190        _this.closest(".block_container").find(".items").fadeIn(animationTime);
21191
21192        if (typeof map !== "undefined" && typeof clusterer !== "undefined") {
21193          map.setBounds(clusterer.getBounds(), {
21194            zoomMargin: 40,
21195            // checkZoomRange: true
21196          });
21197        }
21198      });
21199  });
21200
21201  BX.addCustomEvent(window, "onAjaxSuccess", function (e) {
21202    if (e != "OK") {
21203      initSelects(document);
21204      InitOrderCustom();
21205      // showPhoneMask("input[autocomplete=tel]");
21206
21207      if (arAsproOptions["PAGES"]["CATALOG_PAGE"] && $(".catalog_detail").length && !$(".fast_view_frame").length) {
21208        const leftBlock = $(".main-catalog-wrapper > .left_block");
21209        const rightBlock = $(".right_block");
21210
21211        if (!leftBlock.length && rightBlock.hasClass("wide_N")) {
21212          rightBlock.removeClass("wide_N").addClass("wide_Y");
21213        } else if (leftBlock.length && rightBlock.hasClass("wide_Y")) {
21214          rightBlock.removeClass("wide_Y").addClass("wide_N");
21215        }
21216
21217        $(".bx_filter").remove();
21218        InitFlexSlider();
21219        InitOwlSlider();
21220      }
21221
21222      if (arAsproOptions["PAGES"]["CATALOG_PAGE"]) {
21223        initCountdown();
21224
21225        if (typeof window["stickySidebar"] !== "undefined") window["stickySidebar"].updateSticky();
21226      }
21227
21228      if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
21229        orderActions(e);
21230      }
21231
21232      if (e && typeof e === "object" && "action" in e && e.action === "ajaxContentLoadedTab") {
21233        lazyLoadPagenBlock();
21234      }
21235
21236      InitStickySideBar();
21237    }
21238  });
21239
21240  //event for default basket quantity change
21241  BX.addCustomEvent(window, "OnBasketChange", function (e) {
21242    if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
21243      var summ = 0,
21244        title = "";
21245
21246      if (typeof BX.Sale !== "undefined") {
21247        if (typeof BX.Sale.BasketComponent !== "undefined") {
21248          summ = BX.Sale.BasketComponent.result.allSum;
21249          title = BX.message("JS_BASKET_COUNT_TITLE").replace("SUMM", summ);
21250        }
21251      } else {
21252        summ = $("#allSum_FORMATED")
21253          .html()
21254          .replace(/&nbsp;/g, " ");
21255        title = BX.message("JS_BASKET_COUNT_TITLE").replace("SUMM", summ);
21256      }
21257
21258      if ($(".js-basket-block .wrap .prices").length) $(".js-basket-block .wrap .prices").html(summ);
21259      if ($("a.basket-link.basket").length) $("a.basket-link.basket").attr("title", title);
21260      if ($(".basket_fly .opener .basket_count").length) $(".basket_fly .opener .basket_count").attr("title", title);
21261    }
21262  });
21263});
21264
21265if (!funcDefined("setBasketStatusBtn")) {
21266  setBasketStatusBtn = function (type) {
21267    var bSync = typeof type !== undefined;
21268    if (typeof arBasketAspro !== "undefined") {
21269      if ("BASKET" in arBasketAspro) {
21270        // basket items
21271        if (arBasketAspro.BASKET) {
21272          for (var i in arBasketAspro.BASKET) {
21273            $(".to-cart[data-item=" + i + "]").hide();
21274            $(".counter_block[data-item=" + i + "]")
21275              .closest(".counter_block_inner")
21276              .hide();
21277            $(".counter_block[data-item=" + i + "]").hide();
21278            $(".in-cart[data-item=" + i + "]").show();
21279            $(".in-cart[data-item=" + i + "]")
21280              .closest(".button_block")
21281              .addClass("wide");
21282
21283            $(".wish_item.to[data-item=" + i + "]").show();
21284            $(".wish_item.in[data-item=" + i + "]").hide();
21285
21286            if ($(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").length) {
21287              $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").addClass("added");
21288              $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").attr(
21289                "title",
21290                $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").data("title2")
21291              );
21292            }
21293          }
21294        }
21295      }
21296
21297      /*services*/
21298      if ("SERVICES" in arBasketAspro) {
21299        // services items
21300        $needFillServices = $(".buy_services_wrap[data-parent_product]").length;
21301        if (arBasketAspro.SERVICES && $needFillServices) {
21302          for (var i in arBasketAspro.SERVICES) {
21303            var serviceItem = $(
21304              ".buy_services_wrap[data-parent_product=" +
21305              arBasketAspro.SERVICES[i].link_id +
21306              "] .services-item[data-item_id=" +
21307              arBasketAspro.SERVICES[i].item_id +
21308              "]"
21309            );
21310            serviceItem.find('input[name="buy_switch_services"]').prop("checked", true);
21311            serviceItem.find('.counter_block input[name="quantity"]').val(arBasketAspro.SERVICES[i].quantity);
21312            serviceItem.addClass("services_on");
21313          }
21314        }
21315      }
21316      /**/
21317
21318      if ("DELAY" in arBasketAspro) {
21319        // delay items
21320        if (arBasketAspro.DELAY) {
21321          for (var i in arBasketAspro.DELAY) {
21322            $(".wish_item.to[data-item=" + i + "]").hide();
21323            $(".wish_item.in[data-item=" + i + "]").show();
21324            if ($(".wish_item[data-item=" + i + "]").find(".value.added").length) {
21325              //$('.wish_item[data-item='+i+']').addClass("added");
21326              $(".wish_item[data-item=" + i + "]")
21327                .find(".value")
21328                .hide();
21329              $(".wish_item[data-item=" + i + "]")
21330                .find(".value.added")
21331                .css("display", "block");
21332            }
21333
21334            $(".in-cart[data-item=" + i + "]").hide();
21335            $(".to-cart[data-item=" + i + "]").show();
21336            $(".to-cart[data-item=" + i + "]")
21337              .closest(".counter_wrapp")
21338              .find(".counter_block_inner")
21339              .show();
21340            $(".to-cart[data-item=" + i + "]")
21341              .closest(".counter_wrapp")
21342              .find(".counter_block")
21343              .show();
21344            $(".to-cart[data-item=" + i + "]")
21345              .closest(".button_block")
21346              .removeClass("wide");
21347
21348            if ($(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .wish_item_add").length) {
21349              $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .wish_item_add").addClass("added");
21350              $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .wish_item_add").attr(
21351                "title",
21352                $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .wish_item_add").data("title2")
21353              );
21354            }
21355          }
21356        }
21357      }
21358
21359      if ("SUBSCRIBE" in arBasketAspro) {
21360        // subscribe items
21361        if (arBasketAspro.SUBSCRIBE) {
21362          for (var i in arBasketAspro.SUBSCRIBE) {
21363            $(".to-subscribe[data-item=" + i + "]").hide();
21364            $(".in-subscribe[data-item=" + i + "]").show();
21365          }
21366        }
21367      }
21368
21369      if ("COMPARE" in arBasketAspro) {
21370        // compare items
21371        if (arBasketAspro.COMPARE) {
21372          for (var i in arBasketAspro.COMPARE) {
21373            $(".compare_item.to[data-item=" + i + "]").hide();
21374            $(".compare_item.in[data-item=" + i + "]").show();
21375            if ($(".compare_item[data-item=" + i + "]").find(".value.added").length) {
21376              //$('.compare_item[data-item='+i+']').addClass("added");
21377              $(".compare_item[data-item=" + i + "]")
21378                .find(".value")
21379                .hide();
21380              $(".compare_item[data-item=" + i + "]")
21381                .find(".value.added")
21382                .css("display", "block");
21383            }
21384
21385            if ($(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").length) {
21386              $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").addClass("added");
21387              $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").attr(
21388                "title",
21389                $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").data("title2")
21390              );
21391            }
21392          }
21393        }
21394      }
21395    }
21396  };
21397}
21398
21399if (!funcDefined("togglePropBlock")) {
21400  togglePropBlock = function (className) {
21401    var all_props_block = className.closest(".bx_filter_parameters_box_container").find(".hidden_values");
21402    if (all_props_block.length && (className.hasClass("inner_text") || className.hasClass("expand_block"))) {
21403      if (all_props_block.is(":visible")) {
21404        className.text(BX.message("FILTER_EXPAND_VALUES"));
21405        all_props_block.hide();
21406      } else {
21407        className.text(BX.message("FILTER_HIDE_VALUES"));
21408        all_props_block.show();
21409      }
21410    }
21411  };
21412}
21413
21414if (!funcDefined("showPhoneMask")) {
21415  showPhoneMask = function (className) {
21416    if (typeof appAspro === 'object' && appAspro && appAspro.phone) {
21417      appAspro.phone.init($(className))
21418    }
21419    // $(className).inputmask("mask", { mask: arAsproOptions["THEME"]["PHONE_MASK"], showMaskOnHover: false });
21420  };
21421}
21422
21423if (!funcDefined("getActualBasket")) {
21424  getActualBasket = function (iblockID, type, sync) {
21425    var data = "";
21426    if (typeof iblockID !== "undefined" && iblockID) {
21427      data = { iblockID: iblockID };
21428    }
21429    $.ajax({
21430      type: "GET",
21431      url: arAsproOptions["SITE_DIR"] + "ajax/actualBasket.php",
21432      data: data,
21433      success: function (data) {
21434        if (!$(".js_ajax").length) $("body").append('<div class="js_ajax"></div>');
21435        $(".js_ajax").html(data);
21436
21437        if (typeof sync !== "undefined") {
21438          setBasketStatusBtn(true);
21439        }
21440
21441        if (typeof type !== undefined) {
21442          var eventdata = { action: "loadActualBasket" + type };
21443          BX.onCustomEvent("onCompleteAction", [eventdata]);
21444        }
21445      },
21446    });
21447  };
21448}
21449
21450if (!funcDefined("reloadBasketCounters")) {
21451  reloadBasketCounters = function (count, sync) {
21452    var data = "";
21453    if (count) {
21454      $(".basket-link.basket .count, .wraps_icon_block.basket .count .items > span").text(count);
21455    } else {
21456      $.ajax({
21457        type: "GET",
21458        url: arAsproOptions["SITE_DIR"] + "ajax/actualBasket.php",
21459        data: data,
21460        success: function (data) {
21461          if (!$(".js_ajax").length) $("body").append('<div class="js_ajax"></div>');
21462          $(".js_ajax").html(data);
21463          var countServices =
21464            typeof arBasketAspro.SERVICES !== "undefined" ? Object.keys(arBasketAspro.SERVICES).length : 0;
21465          $(".basket-link.basket .count, .wraps_icon_block.basket .count .items > span").text(
21466            Object.keys(arBasketAspro.BASKET).length + countServices
21467          );
21468          $(".basket-link.delay .count, .wraps_icon_block.delay .count .items > span").text(
21469            // Object.keys(arBasketAspro.DELAY).length
21470          );
21471          $(".basket-link.compare .count, .wraps_icon_block.compare .count .items > span").text(
21472            Object.keys(arBasketAspro.COMPARE).length
21473          );
21474
21475          if (typeof sync !== "undefined") {
21476            setBasketStatusBtn(true);
21477          }
21478        },
21479      });
21480    }
21481  };
21482}
21483
21484function touchMenu(selector) {
21485  if (isMobile) {
21486    if ($(selector).length) {
21487      $(selector).each(function () {
21488        var th = $(this);
21489        th.on("touchend", function (e) {
21490          var _th = $(e.target).closest(".menu-item");
21491
21492          $(".menu.topest > li").removeClass("hover");
21493          $(".menu_top_block.catalog_block li").removeClass("hover");
21494          $(".bx-breadcrumb-item.drop").removeClass("hover");
21495
21496          if (_th.find(".dropdown-menu").length && !_th.hasClass("hover")) {
21497            e.preventDefault();
21498            e.stopPropagation();
21499            _th.siblings().removeClass("hover");
21500            _th.addClass("hover");
21501            $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 });
21502            if (_th.hasClass("menu-item")) {
21503              _th.closest(".dropdown-menu").css({ display: "block", opacity: 1 });
21504            }
21505            if (_th.find("> .wrap > .dropdown-menu")) {
21506              _th.find("> .wrap > .dropdown-menu").css({ display: "block", opacity: 1 });
21507            } else if (_th.find("> .dropdown-menu")) {
21508              _th.find("> .dropdown-menu").css({ display: "block", opacity: 1 });
21509            }
21510            CheckTopVisibleMenu();
21511          } else {
21512            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
21513            if (href && href !== "undefined") location.href = href;
21514          }
21515        });
21516      });
21517    }
21518  } else {
21519    $(selector).off();
21520  }
21521}
21522
21523function touchTopMenu(selector) {
21524  if (isMobile) {
21525    if ($(selector).length) {
21526      $(selector).each(function () {
21527        var th = $(this);
21528        th.on("touchend", function (e) {
21529          var _th = $(e.target).closest("li");
21530
21531          $(".menu-item").removeClass("hover");
21532          $(".menu_top_block.catalog_block li").removeClass("hover");
21533          $(".bx-breadcrumb-item.drop").removeClass("hover");
21534
21535          if (_th.hasClass("more") && !_th.hasClass("hover")) {
21536            e.preventDefault();
21537            e.stopPropagation();
21538            _th.siblings().removeClass("hover");
21539            _th.addClass("hover");
21540            $(".menu.topest").css({ overflow: "visible" });
21541          } else {
21542            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
21543            if (href && href !== "undefined") location.href = href;
21544          }
21545        });
21546      });
21547    }
21548  } else {
21549    $(selector).off();
21550  }
21551}
21552
21553function touchLeftMenu(selector) {
21554  if (isMobile) {
21555    if ($(selector).length) {
21556      $(selector).each(function () {
21557        var th = $(this);
21558        th.on("touchend", function (e) {
21559          var _th = $(e.target).closest("li");
21560
21561          $(".menu-item").removeClass("hover");
21562          $(".bx-breadcrumb-item.drop").removeClass("hover");
21563          $(".menu.topest > li").removeClass("hover");
21564
21565          if (_th.hasClass("has-child") && !_th.hasClass("hover")) {
21566          
21566  e.preventDefault();
21567            e.stopPropagation();
21568            _th.siblings().removeClass("hover");
21569            _th.addClass("hover");
21570          } else {
21571            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
21572            if (href && href !== "undefined") location.href = href;
21573          }
21574        });
21575      });
21576    }
21577  } else {
21578    $(selector).off();
21579  }
21580}
21581
21582function touchBreadcrumbs(selector) {
21583  if (isMobile) {
21584    if ($(selector).length) {
21585      $(selector).each(function () {
21586        var th = $(this);
21587        th.on("touchend", function (e) {
21588          var _th = $(e.target).closest(".bx-breadcrumb-item");
21589
21590          $(".menu-item").removeClass("hover");
21591          $(".menu.topest > li").removeClass("hover");
21592          $(".menu_top_block.catalog_block li").removeClass("hover");
21593
21594          if (!_th.hasClass("hover")) {
21595            e.preventDefault();
21596            e.stopPropagation();
21597            _th.siblings().removeClass("hover");
21598            _th.addClass("hover");
21599          } else {
21600            _th.removeClass("hover");
21601            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
21602            if (href && href !== "undefined") location.href = href;
21603          }
21604        });
21605      });
21606    }
21607  } else {
21608    $(selector).off();
21609  }
21610}
21611
21612function touchItemBlock(selector) {
21613  /*if(isMobile){
21614    if($(selector).length)
21615    {
21616      $(selector).each(function(){
21617        var th=$(this),
21618          item=th.closest('.catalog_item');
21619        th.on('touchend', function(e) {
21620          if (!item.hasClass('hover')) {
21621            e.preventDefault();
21622            // e.stopPropagation();
21623            item.siblings().removeClass('hover');
21624            item.siblings().blur();
21625            item.closest('.catalog_block').find('.catalog_item').removeClass('hover');
21626            item.addClass('hover');
21627            item.addClass('touch');
21628
21629            var tabsContentHover = th.closest('.tab').attr('data-hover') * 1,
21630              tabsContentUnhoverHover = th.closest('.tab').attr('data-unhover') * 1;
21631
21632            th.closest('.tab').stop().animate({'height': tabsContentUnhoverHover}, 100);
21633            th.closest('.catalog_item').siblings().find('.buttons_block').stop().fadeOut(233)
21634
21635            th.closest('.tab').fadeTo(100, 1);
21636            th.closest('.tab').stop().css({'height': tabsContentHover});
21637            th.closest('.catalog_item').find('.buttons_block').fadeIn(450, 'easeOutCirc');
21638          }
21639        })
21640      })
21641    }
21642  }else{
21643    $(selector).off();
21644  }*/
21645}
21646function touchBasket(selector) {
21647  if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") {
21648    if ($(window).outerWidth() > 600) {
21649      $(document)
21650        .find(selector)
21651        .on("touchend", function (e) {
21652          if ($(this).parent().find(".basket_popup_wrapp").length && !$(this).hasClass("hover")) {
21653            e.preventDefault();
21654            e.stopPropagation();
21655            $(this).addClass("hover");
21656            $(this).parent().find(".basket_popup_wrapp").slideDown();
21657          }
21658        });
21659    } else {
21660      $(selector).off();
21661    }
21662  }
21663}
21664
21665function showTotalSummItem(popup) {
21666  //show total summ
21667  if (
21668    arAsproOptions["THEME"]["SHOW_TOTAL_SUMM_TYPE"] == "ALWAYS" &&
21669    arAsproOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y"
21670  ) {
21671    var parent = "body ";
21672    if (typeof popup === "string" && popup == "Y") parent = ".popup ";
21673    $(parent + ".counter_wrapp .counter_block input.text").each(function () {
21674      var _th = $(this);
21675      if (_th.data("product")) {
21676        var obProduct = _th.data("product");
21677        if (typeof window[obProduct] == "object") window[obProduct].setPriceAction("Y");
21678        else setPriceItem(_th.closest(".main_item_wrapper"), _th.val());
21679      } else setPriceItem(_th.closest(".main_item_wrapper"), _th.val());
21680    });
21681  }
21682}
21683
21684function initFull() {
21685  initSelects(document);
21686  initHoverBlock(document);
21687  touchItemBlock(".catalog_item a");
21688  InitOrderCustom();
21689  showTotalSummItem();
21690  basketActions();
21691  orderActions();
21692
21693  checkMobileRegion();
21694}
21695
21696checkMobileRegion = function () {
21697  if ($(".confirm_region").length) {
21698    if (!$(".top_mobile_region").length)
21699      $(
21700        '<div class="top_mobile_region"><div class="confirm_wrapper"><div class="confirm_region"></div></div></div>'
21701      ).insertBefore($("#mobileheader"));
21702    $(".top_mobile_region .confirm_region").html($(".confirm_region").html());
21703
21704    /*$('.top_mobile_region .close_popup').click(function(){
21705      $(this).remove();
21706      $('.confirm_region').remove();
21707    })*/
21708  }
21709};
21710if (!funcDefined("orderActions")) {
21711  orderActions = function (e) {
21712    if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
21713      //phone
21714      if ($("#bx-soa-order input[autocomplete=tel]").length) {
21715        // get property phone
21716        for (var i = 0; i < BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties.length; ++i) {
21717          if (BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i].IS_PHONE == "Y") {
21718            var arPropertyPhone = BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i];
21719          }
21720        }
21721
21722        // validate input type=tel
21723        if (
21724          typeof BX.Sale.OrderAjaxComponent !== "undefined" &&
21725          typeof BX.Sale.OrderAjaxComponent === "object" &&
21726          typeof arPropertyPhone == "object" &&
21727          arPropertyPhone &&
21728          (typeof appAspro === 'object' && appAspro && appAspro.phone)
21729        ) {
21730          BX.Sale.OrderAjaxComponent.validatePhone = function (input, arProperty, fieldName) {
21731            if (!input || !arProperty) return [];
21732
21733            var value = input.value,
21734              errors = [],
21735              name = BX.util.htmlspecialchars(arProperty.NAME),
21736              field = BX.message("SOA_FIELD") + ' "' + name + '"',
21737              re;
21738
21739            if (arProperty.REQUIRED == "Y" && value.length == 0) {
21740              errors.push(field + " " + BX.message("SOA_REQUIRED"));
21741            }
21742
21743            if (arProperty.IS_PHONE == "Y"
21744              && value.length > 0) {
21745              this.validateNormalPhone(input, errors, field)
21746              this.validateIntlPhone(input, errors, field)
21747            }
21748
21749            return errors;
21750          };
21751
21752          BX.Sale.OrderAjaxComponent.validateNormalPhone = function (input, errors, field) {
21753            if (arAsproOptions["THEME"]["PHONE_MASK"]
21754              && arAsproOptions["THEME"]["VALIDATE_PHONE_MASK"]
21755              && !appAspro.phone.checkIntlPhone
21756            ) {
21757              var validPhone = new RegExp(arAsproOptions["THEME"]["VALIDATE_PHONE_MASK"]).test($(input).val());
21758
21759              if (!validPhone) {
21760                errors.push(field + " " + BX.message("JS_FORMAT_ORDER"));
21761              }
21762            }
21763          },
21764            BX.Sale.OrderAjaxComponent.validateIntlPhone = function (input, errors, field) {
21765              if (appAspro.phone.checkIntlPhone) {
21766                const telInput = $(input).data('iti');
21767                const validPhone = telInput.isValidNumber()
21768                if (!validPhone) {
21769                  errors.push(BX.message(appAspro.phone.errorMap[telInput.getValidationError()]));
21770                }
21771
21772              }
21773            },
21774
21775            BX.Sale.OrderAjaxComponent.getValidationDataPhone = function (arProperty, propContainer) {
21776              var data = {},
21777                inputs;
21778              switch (arProperty.TYPE) {
21779                case "STRING":
21780                  data.action = "blur";
21781                  data.func = BX.delegate(function (input, fieldName) {
21782                    return this.validatePhone(input, arProperty, fieldName);
21783                  }, this);
21784
21785                  inputs = propContainer.querySelectorAll("input[type=tel]");
21786                  if ($(inputs).length) {
21787                    data.inputs = inputs;
21788                    break;
21789                  }
21790              }
21791
21792              return data;
21793            };
21794
21795          BX.Sale.OrderAjaxComponent.bindValidationPhone = function (id, propContainer) {
21796            if (!this.validation.properties || !this.validation.properties[id]) return;
21797
21798            var arProperty = this.validation.properties[id],
21799              data = this.getValidationDataPhone(arProperty, propContainer),
21800              i,
21801              k;
21802            if (data && data.inputs && data.action) {
21803              for (i = 0; i < $(data.inputs).length; i++) {
21804                if (BX.type.isElementNode(data.inputs[i])) {
21805                  appAspro.phone.init($(data.inputs[i]))
21806                  BX.bind(
21807                    data.inputs[i],
21808                    data.action,
21809                    BX.delegate(function () {
21810                      this.isValidProperty(data);
21811                    }, this)
21812                  );
21813                }
21814              }
21815            }
21816          };
21817
21818          BX.Sale.OrderAjaxComponent.isValidPropertiesBlock = function (excludeLocation) {
21819            if (!this.options.propertyValidation) return [];
21820
21821            var props = this.orderBlockNode.querySelectorAll(".bx-soa-customer-field[data-property-id-row]"),
21822              propsErrors = [],
21823              id,
21824              propContainer,
21825              arProperty,
21826              data,
21827              i;
21828
21829            for (i = 0; i < props.length; i++) {
21830              id = props[i].getAttribute("data-property-id-row");
21831
21832              if (!!excludeLocation && this.locations[id]) continue;
21833
21834              propContainer = props[i].querySelector(".soa-property-container");
21835              if (propContainer) {
21836                arProperty = this.validation.properties[id];
21837                data = this.getValidationData(arProperty, propContainer);
21838                dataPhone = this.getValidationDataPhone(arProperty, propContainer);
21839                data = $.extend({}, data, dataPhone);
21840
21841                propsErrors = propsErrors.concat(this.isValidProperty(data, true));
21842              }
21843            }
21844
21845            return propsErrors;
21846          };
21847
21848          // create input type=tel
21849          var input = $("input[autocomplete=tel]"),
21850            inputHTML = input[0].outerHTML,
21851            value = input.val(),
21852            newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="' + value + '"');
21853
21854          if ($(input).length < 2) {
21855            input.hide();
21856            $(newInput).insertAfter(input);
21857          }
21858          // showPhoneMask("input[type=tel]");
21859
21860          // change value input type=text when change input type=tel
21861          $("input[autocomplete=tel][type=tel]").on("blur", function () {
21862            var $this = $(this);
21863
21864            var value = $this.val();
21865            /*if (!$this.data('intl-tel-input-id')) {
21866              $this.parent().find("input[name=PHONE_NUMBER][type=text]").val(value);
21867            } else {*/
21868            $this.closest('.soa-property-container').find("input[autocomplete=tel][type=text]").val(value);
21869            //}
21870          });
21871          console.log(arPropertyPhone);
21872          BX.Sale.OrderAjaxComponent.bindValidationPhone(arPropertyPhone.ID, $("input[autocomplete=tel]").parent()[0]);
21873        }
21874      }
21875
21876      if ($(".bx-soa-cart-total").length) {
21877        if (!$(".change_basket").length)
21878          $(".bx-soa-cart-total").prepend(
21879            '<div class="change_basket">
21879' +
21880            BX.message("BASKET_CHANGE_TITLE") +
21881            '<a href="' +
21882            arAsproOptions["SITE_DIR"] +
21883            'basket/" class="change_link">' +
21884            BX.message("BASKET_CHANGE_LINK") +
21885            "</a></div>"
21886          );
21887
21888        if (typeof BX.Sale.OrderAjaxComponent == "object") {
21889          if (arAsproOptions["COUNTERS"]["USE_FULLORDER_GOALS"] !== "N") {
21890            if (typeof BX.Sale.OrderAjaxComponent.reachgoalbegin === "undefined") {
21891              BX.Sale.OrderAjaxComponent.reachgoalbegin = true;
21892              var eventdata = { goal: "goal_order_begin" };
21893              BX.onCustomEvent("onCounterGoals", [eventdata]);
21894            }
21895          }
21896
21897          if (BX.Sale.OrderAjaxComponent.hasOwnProperty("params")) {
21898            $(".bx-soa-cart-total .change_link").attr("href", BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET);
21899            if (arAsproOptions["PRICES"]["MIN_PRICE"] && BX.Sale.OrderAjaxComponent.result.GIFT_CERTIFICATE_APPLIED === 'N') {
21900              if (arAsproOptions["PRICES"]["MIN_PRICE"] > Number(BX.Sale.OrderAjaxComponent.result.TOTAL.ORDER_PRICE)) {
21901                $('<div class="fademask_ext"></div>').appendTo($("body"));
21902                location.href = BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET;
21903              }
21904            }
21905          }
21906
21907          // update oreder auth form
21908          if ($("#bx-soa-auth").length && !$("#bx-soa-auth .redisigned").length) {
21909            // update input USER_LOGIN
21910            if ($('input[name="USER_LOGIN"]').length) {
21911              var $label = $('input[name="USER_LOGIN"]')
21912                .closest(".bx-authform-formgroup-container")
21913                .find(".bx-authform-label-container");
21914              if (!$label.find(".bx-authform-starrequired").length) {
21915                $label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
21916              }
21917            }
21918
21919            // update input USER_PASSWORD
21920            if ($('input[name="USER_PASSWORD"]').length) {
21921              var $label = $('input[name="USER_PASSWORD"]')
21922                .closest(".bx-authform-formgroup-container")
21923                .find(".bx-authform-label-container");
21924              if (!$label.find(".bx-authform-starrequired").length) {
21925                $label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
21926              }
21927            }
21928
21929            if ($('input[name="USER_REMEMBER"]').length) {
21930              var $label = $('input[name="USER_REMEMBER"]')
21931                .attr("id", "ORDER_AUTH_USER_REMEMBER")
21932                .closest("label")
21933                .attr("for", "ORDER_AUTH_USER_REMEMBER");
21934              var html = $('input[name="USER_REMEMBER"]')
21935                .attr("id", "ORDER_AUTH_USER_REMEMBER")
21936                .wrap('<div id="trem_"></div>')
21937                .parent()
21938                .html();
21939              $("#trem_").remove();
21940              $label.html($label.text());
21941              $(html).insertBefore($label).closest(".bx-authform-formgroup-container").addClass("filter");
21942              var html = $("#bx-soa-auth .bx-authform>a")
21943                .addClass("pull-right")
21944                .addClass("forgot")
21945                .wrap('<div id="trem_"></div>')
21946                .parent()
21947                .html();
21948              $("#trem_").remove();
21949              $(html).insertAfter($label.closest(".checkbox"));
21950            }
21951
21952            $("#bx-soa-auth .bx-soa-reg-block .btn")
21953              .removeClass("btn-default")
21954              .removeClass("btn-lg")
21955              .addClass("transparent")
21956              .addClass("btn-lg")
21957              .text(BX.message("ORDER_REGISTER_BUTTON"));
21958
21959            $("#bx-soa-auth").append('<div class="redisigned hidden></div>');
21960          }
21961
21962          // update oreder register form
21963          if ($(".bx-authform").length && !$(".bx-soa-section-content.reg .redisigned").length) {
21964            var bRebindRegSubmit = false;
21965
21966            if (arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === "Y") {
21967              bRebindRegSubmit = true;
21968
21969              // update input NEW_LOGIN
21970              if ($('input[name="NEW_LOGIN"]').length) {
21971                $('input[name="NEW_LOGIN"]').closest(".bx-authform-formgroup-container").hide();
21972              }
21973            }
21974
21975            if (arAsproOptions.THEME.PERSONAL_ONEFIO === "Y") {
21976              bRebindRegSubmit = true;
21977
21978              // update input NEW_NAME
21979              if ($('input[name="NEW_NAME"]').length) {
21980                $('input[name="NEW_NAME"]')
21981                  .closest(".bx-authform-formgroup-container")
21982                  .find(".bx-authform-label-container")
21983                  .html(BX.message("ORDER_FIO_LABEL") + '<span class="bx-authform-starrequired"> *</span>');
21984              }
21985
21986              // update input NEW_LAST_NAME
21987              if ($('input[name="NEW_LAST_NAME"]').length) {
21988                $('input[name="NEW_LAST_NAME"]').closest(".bx-authform-formgroup-container").hide();
21989                $('input[name="NEW_LAST_NAME"]').val(" ");
21990              }
21991            }
21992
21993            if (bRebindRegSubmit) {
21994              // bind new handler for submit button
21995              var $regSubmit = $("#do_register~input[type=submit]");
21996              if ($regSubmit.length) {
21997                BX.unbindAll($regSubmit[0]);
21998                $(document).on("click", "#do_register~input[type=submit]", function (e) {
21999                  e.preventDefault();
22000                  e.stopImmediatePropagation();
22001
22002                  if (arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === "Y") {
22003                    var email = BX.findChild(BX("bx-soa-auth"), { attribute: { name: "NEW_EMAIL" } }, true, false);
22004                    var login = BX.findChild(BX("bx-soa-auth"), { attribute: { name: "NEW_LOGIN" } }, true, false);
22005
22006                    if (login && email) {
22007                      login.value = email.value;
22008                    }
22009                  }
22010
22011                  BX("do_register").value = "Y";
22012                  BX.Sale.OrderAjaxComponent.sendRequest("showAuthForm");
22013                });
22014              }
22015            }
22016
22017            // update captcha
22018            var $captcha = $(".bx-soa-section-content.reg").find(".bx-captcha");
22019            if ($captcha.length) {
22020              $captcha.addClass("captcha_image");
22021              $captcha.append('<div class="captcha_reload"></div>');
22022              $captcha
22023                .closest(".bx-authform-formgroup-container")
22024                .addClass("captcha-row")
22025                .find("input[name=captcha_word]")
22026                .closest(".bx-authform-input-container")
22027                .addClass("captcha_input");
22028            }
22029
22030            //update show password
22031            $(".bx-authform-input-container:not(.eye-password-ignore) [type=password]").each(function (item) {
22032              $(this).closest(".bx-authform-input-container").addClass("eye-password");
22033            });
22034
22035            // update input NEW_NAME && NEW_LAST_NAME
22036            if (
22037              $("input[name=NEW_NAME]").length &&
22038              $("input[name=NEW_LAST_NAME]").length &&
22039              arAsproOptions.THEME.PERSONAL_ONEFIO !== "Y"
22040            ) {
22041              if (!$("input[name=NEW_NAME]").closest(".bx-authform-formgroup-container.col-md-6").length) {
22042                $("input[name=NEW_NAME],input[name=NEW_LAST_NAME]")
22043                  .closest(".bx-authform-formgroup-container")
22044                  .addClass("col-md-6");
22045                var html = $("input[name=NEW_LAST_NAME]")
22046                  .closest(".bx-authform-formgroup-container")
22047                  .wrap('<div id="trem_"></div>')
22048                  .parent()
22049                  .html();
22050                $("#trem_").remove();
22051                $(html).insertAfter(
22052                  $("input[name=NEW_NAME]").closest(".bx-authform-formgroup-container").wrap('<div class="row"></div>')
22053                );
22054              }
22055            }
22056
22057            // update input NEW_EMAIL && PHONE_NUMBER
22058            if ($("input[name=NEW_EMAIL]").length && $("input[name=PHONE_NUMBER]").length) {
22059              if (!$("input[name=PHONE_NUMBER]").closest(".bx-authform-formgroup-container.col
22059-md-6").length) {
22060                $("input[name=NEW_EMAIL],input[name=PHONE_NUMBER]")
22061                  .closest(".bx-authform-formgroup-container")
22062                  .addClass("col-md-6");
22063                var html = $("input[name=PHONE_NUMBER]")
22064                  .closest(".bx-authform-formgroup-container")
22065                  .wrap('<div id="trem_"></div>')
22066                  .parent()
22067                  .html();
22068                $("#trem_").remove();
22069                $(html).insertAfter(
22070                  $("input[name=NEW_EMAIL]").closest(".bx-authform-formgroup-container").wrap('<div class="row"></div>')
22071                );
22072              }
22073            }
22074
22075            // update input NEW_PASSWORD && NEW_PASSWORD_CONFIRM
22076            if ($("input[name=NEW_PASSWORD]").length && $("input[name=NEW_PASSWORD_CONFIRM]").length) {
22077              if (!$("input[name=NEW_PASSWORD]").closest(".bx-authform-formgroup-container.col-md-6").length) {
22078                $("input[name=NEW_PASSWORD],input[name=NEW_PASSWORD_CONFIRM]")
22079                  .closest(".bx-authform-formgroup-container")
22080                  .addClass("col-md-6");
22081                var html = $("input[name=NEW_PASSWORD_CONFIRM]")
22082                  .closest(".bx-authform-formgroup-container")
22083                  .wrap('<div id="trem_"></div>')
22084                  .parent()
22085                  .html();
22086                $("#trem_").remove();
22087                $(html).insertAfter(
22088                  $("input[name=NEW_PASSWORD]")
22089                    .closest(".bx-authform-formgroup-container")
22090                    .wrap('<div class="row"></div>')
22091                );
22092              }
22093            }
22094
22095            // update input PHONE_NUMBER
22096            if ($("input[name=PHONE_NUMBER]").length) {
22097              var input = $("input[name=PHONE_NUMBER]"),
22098                inputHTML = input[0].outerHTML,
22099                value = input.val(),
22100                newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="' + value + '"');
22101
22102              if ($(input).length < 2) {
22103                input.hide();
22104                $(newInput).insertAfter(input);
22105
22106                showPhoneMask("input[name=PHONE_NUMBER][type=tel]");
22107
22108                $("input[name=PHONE_NUMBER][type=tel]").on("blur", function () {
22109                  var $this = $(this);
22110                  var value = $this.val();
22111                  if (!$this.data('intl-tel-input-id')) {
22112                    $this.parent().find("input[name=PHONE_NUMBER][type=text]").val(value);
22113                  } else {
22114                    $this.closest('.bx-authform-input-container').find("input[name=PHONE_NUMBER][type=text]").val(value);
22115                  }
22116                });
22117
22118                var $label = $("input[name=PHONE_NUMBER][type=tel]")
22119                  .closest(".bx-authform-formgroup-container")
22120                  .find(".bx-authform-label-container");
22121                $label.html(
22122                  BX.message("ORDER_PHONE_LABEL") +
22123                  ($label.find(".bx-authform-starrequired").length
22124                    ? '<span class="bx-authform-starrequired"> *</span>'
22125                    : "")
22126                );
22127              }
22128            }
22129
22130            $(".bx-soa-section-content.reg").append('<div class="redisigned hidden></div>');
22131          }
22132
22133          var asproShowLicence = arAsproOptions["THEME"]["SHOW_LICENCE"] == "Y";
22134          var asproShowOffer = arAsproOptions["THEME"]["SHOW_OFFER"] == "Y";
22135
22136          if ($(".bx-soa-cart-total-line-total").length && (asproShowLicence || asproShowOffer)) {
22137            if (typeof e === "undefined") {
22138              BX.Sale.OrderAjaxComponent.state_licence =
22139                arAsproOptions["THEME"]["LICENCE_CHECKED"] == "Y" ? "checked" : "";
22140              BX.Sale.OrderAjaxComponent.state_offer = arAsproOptions["THEME"]["OFFER_CHECKED"] == "Y" ? "checked" : "";
22141            }
22142
22143            if (
22144              (!$(".licence_block.filter").length && asproShowLicence) ||
22145              (!$(".offer_block.filter").length && asproShowOffer)
22146            ) {
22147              $('<div class="form"><div class="license_order_wrap"></div></div>').insertBefore($("#bx-soa-orderSave"));
22148
22149              if (!$(".licence_block.filter").length && asproShowLicence)
22150                $(
22151                  '<div class="licence_block filter label_block onoff"><label data-for="licenses_order" class="hidden error">' +
22152                  BX.message("JS_REQUIRED_LICENSES") +
22153                  '</label><input type="checkbox" name="licenses_order" required ' +
22154                  BX.Sale.OrderAjaxComponent.state_licence +
22155                  ' value="Y"><label data-for="licenses_order" class="license">' +
22156                  BX.message("LICENSES_TEXT") +
22157                  "</label></div>"
22158                ).appendTo($(".license_order_wrap"));
22159
22160              if (!$(".offer_block.filter").length && asproShowOffer)
22161                $(
22162                  '<div class="offer_block filter label_block onoff"><label data-for="offer_order" class="hidden error">' +
22163                  BX.message("JS_REQUIRED_OFFER") +
22164                  '</label><input type="checkbox" name="offer_order" required ' +
22165                  BX.Sale.OrderAjaxComponent.state_offer +
22166                  ' value="Y"><label data-for="offer_order" class="offer_pub">' +
22167                  BX.message("OFFER_TEXT") +
22168                  "</label></div>"
22169                ).appendTo($(".license_order_wrap"));
22170
22171              if (asproShowLicence) {
22172                $(document).on("click", ".bx-soa .licence_block label.license", function () {
22173                  var id = $(this).data("for");
22174                  $(".bx-soa .licence_block label.error").addClass("hidden");
22175                  if (!$("input[name=" + id + "]").prop("checked")) {
22176                    $("input[name=" + id + "]").prop("checked", "checked");
22177                    BX.Sale.OrderAjaxComponent.state_licence = "checked";
22178                  } else {
22179                    $("input[name=" + id + "]").prop("checked", "");
22180                    BX.Sale.OrderAjaxComponent.state_licence = "";
22181                  }
22182                });
22183              }
22184
22185              if (asproShowOffer) {
22186                $(document).on("click", ".bx-soa .offer_block label.offer_pub", function () {
22187                  var id = $(this).data("for");
22188                  $(".bx-soa .offer_block label.error").addClass("hidden");
22189                  if (!$("input[name=" + id + "]").prop("checked")) {
22190                    $("input[name=" + id + "]").prop("checked", "checked");
22191                    BX.Sale.OrderAjaxComponent.state_offer = "checked";
22192                  } else {
22193                    $("input[name=" + id + "]").prop("checked", "");
22194                    BX.Sale.OrderAjaxComponent.state_offer = "";
22195                  }
22196                });
22197              }
22198
22199              $(document).on("click", ".lic_condition a", function () {
22200                if (BX.hasClass(BX("bx-soa-order"), "orderform--v1")) {
22201                  if (BX.Sale.OrderAjaxComponent.isValidForm()) {
22202                    BX.Sale.OrderAjaxComponent.animateScrollTo($(".licence_block, .offer_block")[0], 800, 50);
22203                  }
22204                } else {
22205                  var iCountErrors = BX.Sale.OrderAjaxComponent.isValidPropertiesBlock().length;
22206                  if (!BX.Sale.OrderAjaxComponent.activeSectionId || !iCountErrors) {
22207                    BX.Sale.OrderAjaxComponent.animateScrollTo($(".licence_block, .offer_block")[0], 800, 50);
22208                  }
22209                }
22210              });
22211            }
22212
22213            $("#bx-soa-orderSave, .bx-soa-cart-total-button-container").addClass("lic_condition");
22214
22215            if (
22216              typeof BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction === "undefined" &&
22217              typeof BX.Sale.OrderAjaxComponent.clickOrderSaveAction !== "undefined"
22218            ) {
22219              BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction = BX.Sale.OrderAjaxComponent.clickOrderSaveAction;
22220              BX.Sale.OrderAjaxComponent.clickOrderSaveAction = function (event) {
22221                if (
22222                  ($('input[name="licenses_order"]').prop("checked") || !asproShowLicence) &&
22223                  ($('input[name="offer_order"]').prop("checked") || !asproShowOffer)
22224                ) {
22225                  $(".bx-soa .licence_block label.error").addClass("hidden");
22226                  $(".bx-soa .offer_block label.error").addClass("hidden");
22227
22228                  if (BX.Sale.OrderAjaxComponent.isValidForm()) {
22229                    if (typeof BX.Sale.OrderAjaxComponent.allowOrderSave == "function")
22230                      BX.Sale.OrderAjaxComponent.allowOrderSave();
22231                    if (typeof BX.Sale.OrderAjaxComponent.doSaveAction == "function")
22232                      BX.Sale.OrderAjaxComponent.doSaveAction();
22233                    else BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction(event);
22234                  }
22235                } else {
22236                  if (!$('input[name="licenses_order"]').prop("checked"))
22237                    $(".bx-soa .licence_block label.error").removeClass("hidden");
22238
22239                  if (!$('input[name="offer_order"]').prop("checked"))
22240                    $(".bx-soa .offer_block label.error").removeClass("hidden");
22241                }
22242              };
22243              if (BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector(".checkbox")) {
22244                if (typeof browser == "object") {
22245                  if ("msie" in browser && browser.msie)
22246                    $(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector(".checkbox")).remove();
22247                  else BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector(".checkbox").remove();
22248                }
22249              }
22250              BX.unbindAll(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector("a.btn-order-save"));
22251              BX.unbindAll(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector("a.btn-order-save"));
22252              BX.unbindAll(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector("a"));
22253              BX.bind(
22254                BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector("a.btn-order-save"),
22255                "click",
22256                BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent)
22257              );
22258              BX.bind(
22259                BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector("a.btn-order-save"),
22260                "click",
22261                BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent)
22262              );
22263              BX.bind(
22264                BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector("a"),
22265                "click",
22266                BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent)
22267              );
22268            }
22269          }
22270
22271          // fix hide total block
22272          $(window).scroll();
22273
22274          if (checkCounters() && typeof BX.Sale.OrderAjaxComponent.oldSaveOrder === "undefined") {
22275            var saveFunc =
22276              typeof BX.Sale.OrderAjaxComponent.saveOrder !== "undefined" ? "saveOrder" : "saveOrderWithJson";
22277            if (typeof BX.Sale.OrderAjaxComponent[saveFunc] !== "undefined") {
22278              BX.Sale.OrderAjaxComponent.oldSaveOrder = BX.Sale.OrderAjaxComponent[saveFunc];
22279              BX.Sale.OrderAjaxComponent[saveFunc] = function (result) {
22280                var res = BX.parseJSON(result);
22281                if (res && res.order) {
22282                  if (!res.order.SHOW_AUTH) {
22283                    if (
22284                      res.order.REDIRECT_URL &&
22285                      res.order.REDIRECT_URL.length &&
22286                      (!res.order.ERROR || BX.util.object_keys(res.order.ERROR).length < 1)
22287                    ) {
22288                      if (
22289                        (arMatch = res.order.REDIRECT_URL.match(/ORDER_ID\=[^&=]*/g)) &&
22290                        arMatch.length &&
22291                        (_id = arMatch[0].replace(/ORDER_ID\=/g, "", arMatch[0]))
22292                      ) {
22293                        $.ajax({
22294                          url: arAsproOptions["SITE_DIR"] + "ajax/check_order.php",
22295                          dataType: "json",
22296                          type: "POST",
22297                          data: { ID: _id },
22298                          success: function (id) {
22299                            if (parseInt(id)) {
22300                              purchaseCounter(parseInt(id), BX.message("FULL_ORDER"), function (d) {
22301                                if (typeof localStorage !== "undefined" && typeof d === "object") {
22302                                  localStorage.setItem("gtm_e_" + _id, JSON.stringify(d));
22303                                }
22304                                BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
22305                              });
22306                            } else {
22307                              BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
22308                            }
22309                          },
22310                          error: function () {
22311                            BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
22312                          },
22313                        });
22314                      } else {
22315                        BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
22316                      }
22317                    } else {
22318                      BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
22319                    }
22320                  } else {
22321                    BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
22322                  }
22323                } else {
22324                  BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
22325                }
22326              };
22327            }
22328          }
22329
22330          if ($("#bx-soa-order-form .captcha-row").length) {
22331            if (
22332              window.asproRecaptcha &&
22333              window.asproRecaptcha.key &&
22334              window.asproRecaptcha.params.recaptchaSize == "invisible"
22335            ) {
22336              $("#bx-soa-order-form .captcha-row").addClass("invisible");
22337              if (asproRecaptcha.params.recaptchaLogoShow === "n") {
22338                $("#bx-soa-order-form .captcha-row").addClass("logo_captcha_n");
22339              }
22340            }
22341          }
22342
22343          if ($("#bx-soa-order-form .captcha-row.invisible").length) {
22344            if (
22345              typeof BX.Sale.OrderAjaxComponent.oldSendRequest === "undefined" &&
22346              typeof BX.Sale.OrderAjaxComponent.sendRequest !== "undefined"
22347            ) {
22348              var tmpAction, tmpActionData;
22349              BX.Sale.OrderAjaxComponent.oldSendRequest = BX.Sale.OrderAjaxComponent.sendRequest;
22350              BX.Sale.OrderAjaxComponent.sendRequest = function (action, actionData) {
22351                var bSend = true;
22352
22353                if ($("#bx-soa-order-form .captcha-row.invisible").length) {
22354                  if (window.renderRecaptchaById && window.asproRecaptcha && window.asproRecaptcha.key) {
22355                    if (window.asproRecaptcha.params.recaptchaSize == "invisible") {
22356                      var form = BX("bx-soa-order-form");
22357                      if ($(form).find(".g-recaptcha").length) {
22358                        if ($(form).find(".g-recaptcha-response").val()) {
22359                          bSend = true;
22360                        } else {
22361                          if (typeof grecaptcha != "undefined") {
22362                            grecaptcha.execute($(form).find(".g-recaptcha").data("widgetid"));
22363                            bSend = false;
22364                          } else {
22365                            bSend = false;
22366                          }
22367                        }
22368                      }
22369                    }
22370                  }
22371                }
22372
22373                if (bSend) {
22374                  BX.Sale.OrderAjaxComponent.oldSendRequest(action, actionData);
22375                } else {
22376                  tmpAction = action;
22377                  tmpActionData = actionData;
22378                }
22379              };
22380
22381              $(document).on("submit", "#bx-soa-order-form", function (e) {
22382                e.preventDefault();
22383
22384                if (typeof tmpAction !== "undefined" || typeof tmpActionData !== "undefined") {
22385                  BX.Sale.OrderAjaxComponent.sendRequest(tmpAction, tmpActionData);
22386                  tmpAction = undefined;
22387                  tmpActionData = undefined;
22388                }
22389              });
22390            }
22391          }
22392        }
22393
22394        $(".bx-ui-sls-quick-locations.quick-locations").on("click", function () {
22395          $(this).siblings().removeClass("active");
22396          $(this).addClass("active");
22397        });
22398      }
22399    }
22400  };
22401}
22402
22403if (!funcDefined("basketActions")) {
22404  basketActions = function () {
22405    if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
22406      checkMinPrice();
22407
22408      //remove4Cart
22409      if (typeof BX.Sale !== "undefined" && typeof BX.Sale === "object") {
22410        if (typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent === "object") {
22411          $(document).on("click", ".basket-item-actions-remove", function () {
22412            var basketID = $(this).closest(".basket-items-list-item-wrapper").data("id");
22413            if (BX.Sale.BasketComponent.items && BX.Sale.BasketComponent.items[basketID]) {
22414              //delFromBasketCounter(BX.Sale.BasketComponent.items[basketID].PRODUCT_ID);
22415
22416              var item_variantGa4 = '';
22417              if (BX.Sale.BasketComponent.items[basketID].PROPS_ALL.IM_OBYEM && BX.Sale.BasketComponent.items[basketID].PROPS_ALL.IM_OBYEM.VALUE) {
22418                item_variantGa4 = BX.Sale.BasketComponent.items[basketID].PROPS_ALL.IM_OBYEM.VALUE;
22419              }
22420
22421            }
22422          });
22423        }
22424      }
22425
22426      if (location.hash) {
22427        var hash = location.hash.substring(1);
22428        if ($("#basket_toolbar_button_" + hash).length) $("#basket_toolbar_button_" + hash).trigger("click");
22429
22430        if ($('.basket-items-list-header-filter a[data-filter="' + hash + '"]').length)
22431          $('.basket-items-list-header-filter a[data-filter="' + hash + '"]')[0].click();
22432      }
22433      var svg_cross =
22434        '<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><path id="Rounded_Rectangle_568_copy_13" data-name="Rounded Rectangle 568 copy 13" class="cls-1" d="M1615.4,589l2.32,2.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1614,590.4l-2.31,2.315a1,1,0,0,1-1.41,0,0.987,0.987,0,0,1,0-1.4L1612.6,589l-2.32-2.314a0.989,0.989,0,0,1,0-1.4,1,1,0,0,1,1.41,0l2.31,2.315,2.31-2.315a1,1,0,0,1,1.41,0,0.989,0.989,0,0,1,0,1.4Z" transform="translate(-1610 -585)"/></svg>';
22435
22436      $(".bx_sort_container").append(
22437        '<div class="top_control basket_action"><span style="opacity:0;" class="delete_all colored_theme_hover_text remove_all_basket">' +
22438        svg_cross +
22439        BX.message("BASKET_CLEAR_ALL_BUTTON") +
22440        "</span></div>"
22441      );
22442      if ($(".basket-items-list-header-filter").length) {
22443        $(".basket-items-list-header-filter").append(
22444          '<div class="top_control basket_action"><span style="opacity:1;" class="delete_all colored_theme_hover_text remove_all_basket">' +
22445          svg_cross +
22446          BX.message("BASKET_CLEAR_ALL_BUTTON") +
22447          "</span></div>"
22448        );
22449
22450        var cur_index = $(".basket-items-list-header-filter > a.active").index();
22451        //fix delayed
22452        if (cur_index == 3) cur_index = 2;
22453
22454        if ($(".basket-items-list-header-filter > a.active").data("filter") == "all") cur_index = "all";
22455
22456        $(".basket-items-list-header-filter .top_control .delete_all").data("type", cur_index);
22457
22458        $(".basket-items-list-header-filter > a").on("click", function () {
22459          var index = $(this).index();
22460
22461          //fix delayed
22462          if (index == 3) index = 2;
22463
22464          if ($(this).data("filter") == "all") index = "all";
22465
22466          $(".basket-items-list-header-filter .top_control .delete_all").data("type", index);
22467        });
22468      } else {
22469        var cur_index = $(".bx_sort_container a.current").index();
22470        $(".bx_sort_container .top_control .delete_all").data("type", cur_index);
22471        if ($(".bx_ordercart > div:eq(" + cur_index + ") table tbody tr td.item").length)
22472          $(".bx_sort_container .top_control .delete_all").css("opacity", 1);
22473
22474        $(".bx_ordercart .bx_ordercart_coupon #coupon").wrap('<div class="input"></div>');
22475
22476        $(".bx_sort_container > a").on("click", function () {
22477          var index = $(this).index();
22478          $(".bx_sort_container .top_control .delete_all").data("type", index);
22479
22480          if ($(".bx_ordercart > div:eq(" + index + ") table tbody tr td.item").length)
22481            $(".bx_sort_container .top_control .delete_all").css("opacity", 1);
22482          else $(".bx_sort_container .top_control .delete_all").css("opacity", 0);
22483        });
22484      }
22485
22486      $(".basket_print").on("click", function () {
22487        // window.open(location.pathname+"?print=Y",'_blank');
22488        window.print();
22489      });
22490
22491      $(".delete_all").on("click", function () {
22492        if (arAsproOptions["COUNTERS"]["USE_BASKET_GOALS"] !== "N") {
22493          var eventdata = { goal: "goal_basket_clear", params: { type: $(this).data("type") } };
22494          BX.onCustomEvent("onCounterGoals", [eventdata]);
22495        }
22496        $.post(
22497          arAsproOptions["SITE_DIR"] + "ajax/action_basket.php",
22498          "TYPE=" + $(this).data("type") + "&CLEAR_ALL=Y",
22499          $.proxy(function (data) {
22500            location.reload();
22501          })
22502        );
22503      });
22504
22505      $(".bx_item_list_section .bx_catalog_item").sliceHeight({ row: ".bx_item_list_slide", item: ".bx_catalog_item" });
22506
22507      BX.addCustomEvent("onAjaxSuccess", function (e) {
22508        checkMinPrice();
22509
22510        var errorText = $.trim($("#warning_message").text());
22511        $("#basket_items_list .error_text").detach();
22512        if (errorText != "") {
22513          $("#warning_message").hide().text("");
22514          $("#basket_items_list").prepend('<div class="error_text">' + errorText + "</div>");
22515        }
22516
22517        if (typeof e === "object" && e && "BASKET_DATA" in e) {
22518          if ($("#ajax_basket").length) {
22519            reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y");
22520          }
22521          if ($("#basket_line .basket_fly").length) {
22522            basketFly("open", "N");
22523          }
22524        }
22525        if (checkCounters("google")) {
22526          BX.unbindAll(
22527            BX.Sale.BasketComponent.getEntity(
22528              BX.Sale.BasketComponent.getCacheNode(BX.Sale.BasketComponent.ids.basketRoot),
22529              "basket-checkout-button"
22530            )
22531          );
22532        }
22533      });
22534      if (checkCounters("google")) {
22535        BX.unbindAll(
22536          BX.Sale.BasketComponent.getEntity(
22537            BX.Sale.BasketComponent.getCacheNode(BX.Sale.BasketComponent.ids.basketRoot),
22538            "basket-checkout-button"
22539          )
22540        );
22541      }
22542      $(document).on(
22543        "click",
22544        ".bx_ordercart_order_pay_center .checkout, .basket-checkout-section-inner .basket-btn-checkout",
22545        function () {
22546          if (checkCounters("google")) {
22547            const gotoOrder = function () {
22548              BX.Sale.BasketComponent.checkOutAction();
22549            };
22550            checkoutCounter(1, "start order", gotoOrder);
22551          }
22552        }
22553      );
22554    }
22555  };
22556}
22557
22558if (!funcDefined("checkMinPrice")) {
22559  checkMinPrice = function () {
22560    if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
22561      var summ_raw = 0,
22562        summ = 0;
22563      if ($("#allSum_FORMATED").length) {
22564        summ_raw = $("#allSum_FORMATED")
22565          .text()
22566          .replace(/[^0-9\.,]/g, "");
22567        summ = parseFloat(summ_raw);
22568        if ($("#basket_items").length) {
22569          var summ = 0;
22570          $("#basket_items tr").each(function () {
22571            if (typeof $(this).data("item-price") !== "undefined" && $(this).data("item-price"))
22572              summ +=
22573                $(this).data("item-price") *
22574                $(this)
22575                  .find("#QUANTITY_INPUT_" + $(this).attr("id"))
22576                  .val();
22577          });
22578        }
22579        if (!$(".catalog_back").length)
22580          $(".bx_ordercart_order_pay_center").prepend(
22581            '<a href="' +
22582            arAsproOptions["PAGES"]["CATALOG_PAGE_URL"] +
22583            '" class="catalog_back btn btn-default btn-lg white grey">' +
22584            BX.message("BASKET_CONTINUE_BUTTON") +
22585            "</a>"
22586          );
22587      }
22588
22589      if (arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
22590        $(".basket-coupon-section").addClass("smallest");
22591
22592      if (typeof BX.Sale !== "undefined") {
22593        if (typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent.result !== "undefined")
22594          summ = BX.Sale.BasketComponent.result.allSum;
22595      }
22596
22597      if (arAsproOptions["PRICES"]["MIN_PRICE"]) {
22598        if (arAsproOptions["PRICES"]["MIN_PRICE"] > summ) {
22599          var svgMinPrice =
22600            '<i class="svg  svg-inline-price colored_theme_svg" aria-hidden="true"><svg id="Group_278_copy" data-name="Group 278 copy" xmlns="http://www.w3.org/2000/svg" width="38" height="38" viewBox="0 0 38 38"><path id="Ellipse_305_copy_2" data-name="Ellipse 305 copy 2" class="clswm-1" d="M1851,561a19,19,0,1,1,19-19A19,19,0,0,1,1851,561Zm0-36a17,17,0,1,0,17,17A17,17,0,0,0,1851,525Zm3.97,10.375-0.03.266c-0.01.062-.02,0.127-0.03,0.188l-0.94,7.515h0a2.988,2.988,0,0,1-5.94,0H1848l-0.91-7.525c-0.01-.041-0.01-0.086-0.02-0.128l-0.04-.316h0.01c-0.01-.
22600125-0.04-0.246-0.04-0.375a4,4,0,0,1,8,0c0,0.129-.03.25-0.04,0.375h0.01ZM1851,533a2,2,0,0,0-2,2,1.723,1.723,0,0,0,.06.456L1850,543a1,1,0,0,0,2,0l0.94-7.544A1.723,1.723,0,0,0,1853,535,2,2,0,0,0,1851,533Zm0,14a3,3,0,1,1-3,3A3,3,0,0,1,1851,547Zm0,4a1,1,0,1,0-1-1A1,1,0,0,0,1851,551Z" transform="translate(-1832 -523)"></path>  <path class="clswm-2 op-cls" d="M1853,543l-1,1h-2l-1-1-1-8,1-2,1-1h2l1,1,1,2Zm-1,5,1,1v2l-1,1h-2l-1-1v-2l1-1h2Z" transform="translate(-1832 -523)"></path></svg></i>';
22601          if ($(".oneclickbuy.fast_order").length) $(".oneclickbuy.fast_order").remove();
22602
22603          if ($(".basket-checkout-container").length) {
22604            if (!$(".icon_error_wrapper").length) {
22605              $(".basket-checkout-block.basket-checkout-block-btn").html(
22606                '<div class="icon_error_wrapper"><div class="icon_error_block">' +
22607                svgMinPrice +
22608                BX.message("MIN_ORDER_PRICE_TEXT").replace(
22609                  "#PRICE#",
22610                  jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"])
22611                ) +
22612                "</div></div>"
22613              );
22614            }
22615          } else {
22616            if (!$(".icon_error_wrapper").length && typeof jsPriceFormat !== "undefined") {
22617              $(".bx_ordercart_order_pay_center").prepend(
22618                '<div class="icon_error_wrapper"><div class="icon_error_block">' +
22619                svgMinPrice +
22620                BX.message("MIN_ORDER_PRICE_TEXT").replace(
22621                  "#PRICE#",
22622                  jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"])
22623                ) +
22624                "</div></div>"
22625              );
22626            }
22627            if ($(".bx_ordercart_order_pay .checkout").length) $(".bx_ordercart_order_pay .checkout").remove();
22628          }
22629        } else {
22630          if ($(".icon_error_wrapper").length) $(".icon_error_wrapper").remove();
22631
22632          if ($(".basket-checkout-container").length) {
22633            if (
22634              !$(".oneclickbuy.fast_order").length &&
22635              arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" &&
22636              !$(".basket-btn-checkout.disabled").length
22637            )
22638              $(".basket-checkout-section-inner").append(
22639                '<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' +
22640                BX.message("BASKET_QUICK_ORDER_BUTTON") +
22641                "</span></div>"
22642              );
22643          } else {
22644            if ($(".bx_ordercart_order_pay .checkout").length)
22645              $(".bx_ordercart .bx_ordercart_order_pay .checkout").css("opacity", "1");
22646            else
22647              $(".bx_ordercart_order_pay_center").append(
22648                '<a href="javascript:void(0)" onclick="checkOut();" class="checkout" style="opacity: 1;">' +
22649                BX.message("BASKET_ORDER_BUTTON") +
22650                "</a>"
22651              );
22652            if (
22653              !$(".oneclickbuy.fast_order").length &&
22654              arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y"
22655            )
22656              $(".bx_ordercart_order_pay_center").append(
22657                '<span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' +
22658                BX.message("BASKET_QUICK_ORDER_BUTTON") +
22659                "</span>"
22660              );
22661          }
22662        }
22663      } else {
22664        if ($(".basket-checkout-container").length) {
22665          if (
22666            !$(".oneclickbuy.fast_order").length &&
22667            arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" &&
22668            !$(".basket-btn-checkout.disabled").length
22669          )
22670            $(".basket-checkout-section-inner").append(
22671              '<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' +
22672              BX.message("BASKET_QUICK_ORDER_BUTTON") +
22673              "</span></div>"
22674            );
22675        } else {
22676          $(".bx_ordercart .bx_ordercart_order_pay .checkout").css("opacity", "1");
22677          if (!$(".oneclickbuy.fast_order").length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
22678            $(".bx_ordercart_order_pay_center").append(
22679              '<span class="oneclickbuy btn btn-lg fast_order btn-trans
22679parent-border-color" onclick="oneClickBuyBasket()">' +
22680              BX.message("BASKET_QUICK_ORDER_BUTTON") +
22681              "</span>"
22682            );
22683        }
22684      }
22685
22686      showBasketShareBtn();
22687      showBasketHeadingBtn();
22688
22689      $("#basket-root .basket-checkout-container .basket-checkout-section .basket-checkout-block .basket-btn-checkout");
22690      $("#basket-root .basket-checkout-container").addClass("visible");
22691    }
22692  };
22693}
22694
22695var isFrameDataReceived = false;
22696if (typeof window.frameCacheVars !== "undefined") {
22697  BX.addCustomEvent(window, "onFrameDataRequestFail", function (response) {
22698    console.log(response);
22699  });
22700
22701  BX.addCustomEvent("onFrameDataReceivedBefore", function () {
22702    // stop ya metrika webvisor DOM indexer
22703    pauseYmObserver();
22704  });
22705
22706  BX.addCustomEvent("onFrameDataReceived", function (json) {
22707    initFull();
22708
22709    //CheckTopMenuPadding();
22710    //CheckTopMenuOncePadding();
22711    CheckTopMenuDotted();
22712
22713    // CheckSearchWidth();
22714
22715    checkLinkedArticles();
22716    checkLinkedBlocks(".linked-banners-list");
22717
22718    if ($(".logo-row.v2").length) {
22719      $(window).resize(); // need to check resize flexslider & menu
22720      setTimeout(function () {
22721        CheckTopMenuDotted();
22722      }, 100);
22723    }
22724
22725    if (funcDefined("setNewHeader")) {
22726      if (typeof BX === "object" && (BX.message("TYPE_SKU") != "TYPE_1" || BX.message("HAS_SKU_PROPS") != "Y")) {
22727        setNewHeader();
22728      } else {
22729        var objNameWrapper = $(".bx_catalog_item_scu[id]");
22730        if (objNameWrapper.length) {
22731          var id = "ob" + objNameWrapper.attr("id").replace("_skudiv", "");
22732          if (id && window[id] !== undefined) {
22733            var obj = window[id].offers[window[id].offerNum];
22734            if (obj !== undefined) {
22735              setNewHeader(obj);
22736            }
22737          }
22738        }
22739      }
22740    }
22741
22742    // resume ya metrika webvisor
22743    // (100ms sliceHeight) + (200ms mCustomScroll) + (100ms lazyload)
22744    setTimeout(resumeYmObserver, 400);
22745
22746    isFrameDataReceived = true;
22747  });
22748} else {
22749  $(document).ready(initFull);
22750}
22751
22752if (!funcDefined("setHeightBlockSlider")) {
22753  setHeightBlockSlider = function () {
22754    $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").equalize({ children: ".item-title" });
22755    $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").equalize({ children: ".item_info" });
22756    $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").equalize({ children: ".catalog_item" });
22757
22758    var sliderWidth = $(document).find(".specials.tab_slider_wrapp").outerWidth();
22759
22760    var iCountTabs = $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").length;
22761
22762    if (iCountTabs <= 1) {
22763      $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").css("height", "");
22764
22765      var itemsButtonsHeight = 0;
22766      if ($(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button").length) {
22767        $(document)
22768          .find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button")
22769          .css("height", "auto");
22770        itemsButtonsHeight = $(document)
22771          .find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button")
22772          .height();
22773        $(document)
22774          .find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button")
22775          .css("height", "");
22776      }
22777      var tabsContentUnhover = $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur").height() * 1;
22778      var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50;
22779      $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur").attr("data-unhover", tabsContentUnhover);
22780      $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur").attr("data-hover", tabsContentHover);
22781      $(document).find(".specials.tab_slider_wrapp .tabs_content").height(tabsContentUnhover);
22782      $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur .flex-viewport").height(tabsContentUnhover);
22783    } else {
22784      $(document)
22785        .find(".specials.tab_slider_wrapp .tabs_content > li.cur")
22786        .each(function () {
22787          var _th = $(this);
22788          _th.css("height", "");
22789
22790          var itemsButtonsHeight = 0;
22791          if (_th.find(".tabs_slider li .footer_button").length) {
22792            _th.find(".tabs_slider li .footer_button").css("height", "auto");
22793            itemsButtonsHeight = _th.find(".tabs_slider li .footer_button").height();
22794            _th.find(".tabs_slider li .footer_button").css("height", "");
22795          }
22796
22797          var tabsContentUnhover = _th.height() * 1;
22798          var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50;
22799          _th.attr("data-unhover", tabsContentUnhover);
22800          _th.attr("data-hover", tabsContentHover);
22801          _th.parent().height(tabsContentUnhover);
22802          _th.find(".flex-viewport").height(tabsContentUnhover);
22803        });
22804    }
22805  };
22806}
22807
22808if (!funcDefined("checkTopFilter")) {
22809  checkTopFilter = function () {
22810    /*if(window.matchMedia('(max-width: 991px)').matches){
22811      //if($('.group_description_block.top').length){
22812        var top_pos=$('.adaptive_filter').position().top;
22813        $('.bx_filter.bx_filter_vertical').css({'top':top_pos+43});
22814      //}
22815    }*/
22816  };
22817}
22818
22819if (!funcDefined("checkStickyFooter")) {
22820  checkStickyFooter = function () {
22821    try {
22822      ignoreResize.push(true);
22823      $("#content").css("min-height", "");
22824      var contentTop = $("#content").offset().top;
22825      var contentBottom = contentTop + $("#content").outerHeight();
22826      var footerTop = 0;
22827      if ($("footer").length) footerOffset = $("footer").offset().top;
22828
22829      $("#content").css(
22830        "min-height",
22831        $(window).height() - contentTop - (footerTop - contentBottom) - $("footer").outerHeight() + "px"
22832      );
22833      ignoreResize.pop();
22834    } catch (e) {
22835      console.error(e);
22836    }
22837  };
22838}
22839
22840if (!funcDefined("checkLinkedArticles")) {
22841  checkLinkedArticles = function () {
22842    try {
22843      if ($(".linked-blog-list.content .item-views").length) {
22844        var mobileRow = $(".linked-blog-list").data("mobile_row"),
22845          desktopRow = $(".linked-blog-list").data("desktop_row"),
22846          parentBlock = $(".ajax_load .js_append"),
22847          widthRow = parentBlock.getFloatWidth(),
22848          elementWidthRow = parentBlock.find("> .item:eq(0)").getFloatWidth(),
22849          elementsCount = parentBlock.find("> .item").length,
22850          slice = Math.floor(widthRow / elementWidthRow),
22851          rowInsertCount = Math.floor(elementsCount / slice),
22852          bCalculateRows = false;
22853        if (window.matchMedia("(max-width: 767px)").matches) {
22854          if (!mobileRow && desktopRow) {
22855            mobileRow = desktopRow;
22856          }
22857          if (mobileRow && mobileRow <= rowInsertCount) {
22858            rowInsertCount = slice * mobileRow;
22859            bCalculateRows = true;
22860          }
22861        } else {
22862          if (desktopRow && desktopRow <= rowInsertCount) {
22863            rowInsertCount = slice * desktopRow;
22864            bCalculateRows = true;
22865          }
22866        }
22867        if (!bCalculateRows) {
22868          rowInsertCount = elementsCount;
22869        }
22870
22871        var linkedBlock = ".linked-blog-list";
22872        var blockInItems = parentBlock.find(linkedBlock);
22873        if (blockInItems.length) {
22874          $(blockInItems).insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")"));
22875          setTimeout(function () {
22876            $(blockInItems).addClass("visible");
22877          }, 0);
22878        } else {
22879          var cloneBlock = $(linkedBlock).clone();
22880          var owlBlock = cloneBlock.find(".owl-carousel-wait");
22881          cloneBlock.insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")"));
22882          owlBlock.removeClass("owl-carousel-wait").addClass("owl-carousel");
22883          setTimeout(function () {
22884            cloneBlock.addClass("visible");
22885            InitOwlSlider();
22886            owlBlock.removeClass("loader_circle");
22887          }, 1);
22888        }
22889
22890        // $('.linked-blog-list').insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
22891        // setTimeout(function(){
22892        // 	$('.linked-blog-list').addClass('visible');
22893        // }, 0);
22894      }
22895    } catch (e) {
22896      console.error(e);
22897    }
22898  };
22899}
22900
22901if (!funcDefined("checkLinkedBlocks")) {
22902  checkLinkedBlocks = function (linkedBlock) {
22903    if (!linkedBlock) linkedBlock = ".linked-banners-list";
22904
22905    try {
22906      if ($(linkedBlock + ".content" + " div").length) {
22907        var mobileRow = $(linkedBlock).data("mobile_row"),
22908          desktopRow = $(linkedBlock).data("desktop_row"),
22909          parentBlock = $(".ajax_load .js_append"),
22910          widthRow = parentBlock.getFloatWidth(),
22911          elementWidthRow = parentBlock.find("> .item:eq(0)").getFloatWidth(),
22912          elementsCount = parentBlock.find("> .item").length,
22913          slice = Math.floor(widthRow / elementWidthRow),
22914          rowInsertCount = Math.floor(elementsCount / slice),
22915          bCalculateRows = false;
22916        if (window.matchMedia("(max-width: 767px)").matches) {
22917          if (!mobileRow && desktopRow) {
22918            mobileRow = desktopRow;
22919          }
22920          if (mobileRow && mobileRow <= rowInsertCount) {
22921            rowInsertCount = slice * mobileRow;
22922            bCalculateRows = true;
22923          }
22924        } else {
22925          if (desktopRow && desktopRow <= rowInsertCount) {
22926            rowInsertCount = slice * desktopRow;
22927            bCalculateRows = true;
22928          }
22929        }
22930        if (!bCalculateRows) {
22931          rowInsertCount = elementsCount;
22932        }
22933        var blockInItems = parentBlock.find(linkedBlock);
22934        if (blockInItems.length) {
22935          $(blockInItems).insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")"));
22936          setTimeout(function () {
22937            $(blockInItems).addClass("visible");
22938          }, 0);
22939        } else {
22940          var cloneBlock = $(linkedBlock).clone();
22941          var owlBlock = cloneBlock.find(".owl-carousel-wait");
22942          cloneBlock.insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")"));
22943          owlBlock.removeClass("owl-carousel-wait").addClass("owl-carousel");
22944          setTimeout(function () {
22945            cloneBlock.addClass("visible");
22946            InitOwlSlider();
22947            owlBlock.removeClass("loader_circle");
22948          }, 1);
22949        }
22950
22951        // $(linkedBlock).insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
22952        // setTimeout(function(){
22953        // 	$(linkedBlock).addClass('visible');
22954        // }, 0);
22955      }
22956    } catch (e) {
22957      console.error(e);
22958    }
22959  };
22960}
22961
22962/* EVENTS */
22963var timerResize = false,
22964  ignoreResize = [];
22965$(window).resize(function () {
22966  CheckPopupTop();
22967  checkLinkedArticles();
22968  checkLinkedBlocks(".linked-banners-list");
22969
22970  // here immediate functions
22971  if (!ignoreResize.length) {
22972    if (timerResize) {
22973      clearTimeout(timerResize);
22974      timerResize = false;
22975    }
22976    timerResize = setTimeout(function () {
22977      // here delayed functions in event
22978      BX.onCustomEvent("onWindowResize", false);
22979    }, 50);
22980  }
22981});
22982
22983var timerScroll = false,
22984  ignoreScroll = [],
22985  documentScrollTopLast = $(document).scrollTop(),
22986  startScroll = 0;
22987$(window).scroll(function () {
22988  CheckPopupTop();
22989  // here immediate functions
22990  documentScrollTopLast = $(document).scrollTop();
22991  SetFixedAskBlock();
22992
22993  if (!ignoreScroll.length) {
22994    if (timerScroll) {
22995      clearTimeout(timerScroll);
22996      timerScroll = false;
22997    }
22998    timerScroll = setTimeout(function () {
22999      // here delayed functions in event
23000      BX.onCustomEvent("onWindowScroll", false);
23001    }, 50);
23002  }
23003});
23004
23005BX.addCustomEvent("onWindowResize", function (eventdata) {
23006  try {
23007    ignoreResize.push(true);
23008
23009    // CheckTopMenuPadding();
23010    // CheckTopMenuOncePadding();
23011    //CheckSearchWidth();
23012
23013    CheckTabActive();
23014    CheckTopMenuFullCatalogSubmenu();
23015    //CheckHeaderFixedMenu();
23016
23017    if (window.matchMedia("(min-width:768px)").matches) {
23018      closeYandexMap();
23019    }
23020
23021    if ($("nav.mega-menu.sliced").length) $("nav.mega-menu.sliced").removeClass("initied");
23022    CheckTopMenuDotted();
23023
23024    CheckTopVisibleMenu();
23025
23026    checkScrollToTop();
23027    CheckObjectsSizes();
23028
23029    CheckFlexSlider();
23030    initSly();
23031
23032    // checkVerticalMobileFilter();
23033    if (typeof checkMobilePhone === "function") {
23034      checkMobilePhone();
23035    }
23036    checkTopFilter();
23037    if (typeof checkMobileFilter === "function") {
23038      checkMobileFilter();
23039    }
23040
23041    if (typeof window["stickySidebar"] !== "undefined") {
23042      if (window.matchMedia("(max-width: 991px)").matches) {
23043        window["stickySidebar"].destroy();
23044      } else {
23045        window["stickySidebar"].bindEvents();
23046      }
23047    }
23048
23049    if ($(".flexslider.wsmooth").length) {
23050      $(".flexslider.wsmooth").each(function () {
23051        $(this).data("flexslider").smoothHeight();
23052      });
23053    }
23054
23055    if (window.matchMedia("(min-width: 767px)").matches) $(".wrapper_middle_menu.wrap_menu").removeClass("mobile");
23056
23057    if (window.matchMedia("(max-width: 767px)").matches) $(".wrapper_middle_menu.wrap_menu").addClass("mobile");
23058
23059    if ($("#basket_form").length && $(window).outerWidth() <= 600) {
23060      $("#basket_form .tabs_content.basket > li.cur td").each(function () {
23061        $(this).css("width", "");
23062      });
23063    }
23064
23065    $(".bx_filter_section .bx_filter_select_container").each(function () {
23066      var prop_id = $(this).closest(".bx_filter_parameters_box").attr("property_id");
23067      if ($("#smartFilterDropDown" + prop_id).length) {
23068        $("#smartFilterDropDown" + prop_id).css("max-width", $(this).width());
23069      }
23070    });
23071
23072    if (window.matchMedia("(min-width: 768px)").matches) {
23073      // min-width: 768px
23074      $(".bx_filter .scrollbar").removeClass("mobile-scroll");
23075      $(".bx_filter .srollbar-custom").removeClass("mobile-scroll");
23076      $(".bx_filter .bx_filter_section form .bx_filter_parameters").removeClass("mobile-scroll");
23077      InitScrollBar();
23078      InitCustomScrollBar();
23079    } else {
23080      // max-width: 767px
23081      $(".bx_filter .scrollbar").addClass("mobile-scroll").removeClass("scroll-init");
23082      $(".bx_filter .srollbar-custom").addClass("mobile-scroll").removeClass("scroll-init");
23083      $(".bx_filter .bx_filter_section form .bx_filter_parameters")
23084        .addClass("mobile-scroll")
23085        .removeClass("scroll-init");
23086      if ($(".bx_filter .mobile-scroll.scrollbar").length)
23087        $(".bx_filter .mobile-scroll.scrollbar").mCustomScrollbar("destroy");
23088      if ($(".bx_filter .mobile-scroll.srollbar-custom").length)
23089        $(".bx_filter .mobile-scroll.srollbar-custom").mCustomScrollbar("destroy");
23090    }
23091  } catch (e) {
23092    console.log(e);
23093  } finally {
23094    ignoreResize.pop();
23095  }
23096});
23097
23098BX.addCustomEvent("onWindowScroll", function (eventdata) {
23099  try {
23100    ignoreScroll.push(true);
23101  } catch (e) {
23102  } finally {
23103    ignoreScroll.pop();
23104  }
23105});
23106
23107BX.addCustomEvent("onSlideInit", function (eventdata) {
23108  try {
23109    ignoreResize.push(true);
23110    if (eventdata) {
23111      var slider = eventdata.slider;
23112      if (slider) {
23113        if (slider.hasClass("small-gallery")) $(window).resize();
23114        // add classes .curent & .shown to slide
23115        slider.find(".item").removeClass("current");
23116        var curSlide = slider.find(".item.flex-active-slide"),
23117          curSlideId = curSlide.attr("id"),
23118          nav = slider.find(".flex-direction-nav");
23119
23120        curSlide.addClass("current");
23121
23122        slider.find(".visible").css("opacity", "1");
23123        slider.find(".height0").css("height", "auto");
23124
23125        if (curSlide.hasClass("shown")) {
23126          slider.find(".item.clone[id=" + curSlideId + "_clone]").addClass("shown");
23127        }
23128
23129        curSlide.addClass("shown");
23130      }
23131    }
23132  } catch (e) {
23133  } finally {
23134    ignoreResize.pop();
23135  }
23136});
23137
23138BX.addCustomEvent("onCounterGoals", function (eventdata) {
23139  if (arAsproOptions["THEME"]["YA_GOALS"] == "Y" && arAsproOptions["THEME"]["YA_COUNTER_ID"]) {
23140    var idCounter = arAsproOptions["THEME"]["YA_COUNTER_ID"];
23141    idCounter = parseInt(idCounter);
23142
23143    if (typeof eventdata != "object") eventdata = { goal: "undefined" };
23144
23145    if (typeof eventdata.goal != "string") eventdata.goal = "undefined";
23146
23147    if (idCounter) {
23148      try {
23149        waitCounter(idCounter, 50, function () {
23150          var obCounter = window["yaCounter" + idCounter];
23151          if (typeof obCounter == "object") {
23152            obCounter.reachGoal(eventdata.goal);
23153          }
23154        });
23155      } catch (e) {
23156        console.error(e);
23157      }
23158    } else {
23159      console.info("Bad counter id!", idCounter);
23160    }
23161  }
23162});
23163
23164var onCaptchaVerifyinvisible = function (response) {
23165  $(".g-recaptcha:last").each(function () {
23166    var id = $(this).attr("data-widgetid");
23167    if (typeof id !== "undefined" && response) {
23168      if (!$(this).closest("form").find(".g-recaptcha-response").val())
23169        $(this).closest("form").find(".g-recaptcha-response").val(response);
23170      if ($("iframe[src*=recaptcha]").length) {
23171        $("iframe[src*=recaptcha]").each(function () {
23172          var block = $(this).parent().parent();
23173          if (!block.hasClass("grecaptcha-badge")) block.css("width", "100%");
23174        });
23175      }
23176      $(this).closest("form").submit();
23177    }
23178  });
23179};
23180
23181var onCaptchaVerifynormal = function (response) {
23182  $(".g-recaptcha").each(function () {
23183    var id = $(this).attr("data-widgetid");
23184    if (typeof id !== "undefined") {
23185      if (grecaptcha.getResponse(id) != "") {
23186        $(this).closest("form").find(".recaptcha").valid();
23187      }
23188    }
23189  });
23190};
23191
23192BX.addCustomEvent("onSubmitForm", function (eventdata) {
23193  try {
23194    if (
23195      !window.renderRecaptchaById ||
23196      !window.asproRecaptcha ||
23197      !window.asproRecaptcha.key
23198    ) {
23199      eventdata.form.submit();
23200      $(eventdata.form).closest(".form").addClass("sending");
23201      return true;
23202    }
23203    if (
23204      window.asproRecaptcha.params.recaptchaSize == "invisible" &&
23205      $(eventdata.form).find(".g-recaptcha").length
23206    ) {
23207      if ($(eventdata.form).find(".g-recaptcha-response").val()) {
23208        eventdata.form.submit();
23209        $(eventdata.form).closest(".form").addClass("sending");
23210        return true;
23211      } else {
23212        if (typeof grecaptcha != "undefined") {
23213          grecaptcha.execute(
23214            $(eventdata.form).find(".g-recaptcha").data("widgetid")
23215          );
23216        } else {
23217          return false;
23218        }
23219      }
23220    } else if (window.asproRecaptcha.ver === "3" && typeof grecaptcha != "undefined") {
23221      grecaptcha
23222        .execute(window.asproRecaptcha.key, { action: "maxscore" })
23223        .then(function (token) {
23224          $(eventdata.form).find(".g-recaptcha-response").html(token);
23225          eventdata.form.submit();
23226          $(eventdata.form).closest(".form").addClass("sending");
23227
23228          return true;
23229        });
23230    } else {
23231      eventdata.form.submit();
23232      $(eventdata.form).closest(".form").addClass("sending");
23233      return true;
23234    }
23235  } catch (e) {
23236    console.error(e);
23237    return true;
23238  }
23239});
23240
23241$(document).on("click", ".catalog_reviews_extended span.dropdown-select__list-link", function () {
23242  var _this = $(this);
23243  var ajaxData = _this.data("review_sort_ajax");
23244  var container = _this.closest(".blog-comments");
23245  containerId = container.attr("id");
23246  if (containerId !== undefined && containerId) {
23247    ajaxData.containerId = containerId;
23248  }
23249  if (ajaxData !== undefined) {
23250    container.addClass("blur");
23251    $.ajax({
23252      type: "post",
23253      data: ajaxData,
23254      success: function (html) {
23255        $("#reviews_sort_continer").html(html);
23256        container.removeClass("blur");
23257      },
23258    });
23259  }
23260});
23261
23262$(document).on('change', ".filter-panel__sort-form input", function () {
23263  const _this = $(this);
23264  const $form = _this.closest('form')[0];
23265  const $container = _this.closest(".blog-comments");
23266  const method = $form.method;
23267  const formData = new FormData($form);
23268
23269  if ($container.length) {
23270    $container.addClass("blur");
23271    formData.append('containerId', $container.attr('id'));
23272  }
23273
23274  $.ajax({
23275    data: formData,
23276    type: method,
23277    processData: false,
23278    contentType: false,
23279    success: function (html) {
23280      $("#reviews_sort_continer").html(html);
23281      $container.removeClass("blur");
23282    },
23283  })
23284})
23285
23286$(document).on("click", ".rating_vote:not(.disable)", function () {
23287  var _this = $(this);
23288  var action = _this.data("action");
23289  var parent = _this.closest(".rating-vote");
23290  var commentId = parent.data("comment_id");
23291  var userId = parent.data("user_id");
23292  var ajaxUrl = parent.data("ajax_url");
23293  $.ajax({
23294    url: ajaxUrl,
23295    dataType: "json",
23296    data: { commentId: commentId, action: action, userId: userId },
23297    success: function (data) {
23298      if (data.LIKE !== undefined) {
23299        _this.siblings(".rating-vote-result.like").text(data.LIKE);
23300      }
23301      if (data.DISLIKE !== undefined) {
23302        _this.siblings(".rating-vote-result.dislike").text(data.DISLIKE);
23303      }
23304      if (data.SET_ACTIVE_LIKE !== undefined) {
23305        parent.find(".rating_vote.plus").toggleClass("active");
23306      }
23307      if (data.SET_ACTIVE_DISLIKE !== undefined) {
23308        parent.find(".rating_vote.minus").toggleClass("active");
23309      }
23310    },
23311  });
23312});
23313
23314function fileInputInit(message, reviews = 'N') {
23315  $('input[type=file]:not(".uniform-ignore")').uniform({ fileButtonHtml: BX.message("JS_FILE_BUTTON_NAME"), fileDefaultHtml: message });
23316  $(document).on("change", "input[type=file]", function () {
23317    if ($(this).val()) {
23318      $(this).closest(".uploader").addClass("files_add");
23319    } else {
23320      $(this).closest(".uploader").removeClass("files_add");
23321    }
23322  });
23323  $(".form .add_file").on("click", function () {
23324    var index = $(this).closest(".form-group").find("input[type=file]").length;
23325    let inputFormGroup = $(this).closest(".form-group").find(".input");
23326    if (reviews === 'Y') {
23327      inputFormGroup.append('<input type="file" class="form-control" tabindex="3" id="comment_images" name="comment_images[]" value=""  />');
23328    }
23329    else {
23330      inputFormGroup.append('<input type="file" id="POPUP_FILE' + index + '" name="FILE_n' + index + '"   class="inputfile" value="" />');
23331    }
23332
23333    $("input[type=file]").uniform({ fileButtonHtml: BX.message("JS_FILE_BUTTON_NAME"), fileDefaultHtml: message });
23334  });
23335}
23336
23337/*custom event for sku prices*/
23338
23339/*BX.addCustomEvent('onAsproSkuSetPrice', function(eventdata){
23340  console.log(eventdata);
23341})*/
23342
23343/*BX.addCustomEvent('onAsproSkuSetPriceMatrix', function(eventdata){
23344  console.log(eventdata);
23345})*/
23346
23347function declOfNum(number, titles) {
23348  var cases = [2, 0, 1, 1, 1, 2];
23349  return number + " " + titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[Math.min(number % 10, 5)]];
23350}
23351
23352function array_values_js(input) {
23353  var tmp_arr = new Array(),
23354    cnt = 0;
23355  for (key in input) {
23356    tmp_arr[cnt] = input[key];
23357    cnt++;
23358  }
23359
23360  return tmp_arr;
23361}
23362
23363/* End */
23364;
23365; /* Start:"a:4:{s:4:"full";s:61:"/local/templates/aspro_max/js/blocks/blocks.js?16660175939271";s:6:"source";s:46:"/local/templates/aspro_max/js/blocks/blocks.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23366InitMenuNavigationAim = function () {
23367  var $block = $(".menu-navigation__sections-wrapper .menu-navigation__sections:not(.aim-init)");
23368  if ($block.length) {
23369    $block.addClass("aim-init");
23370    BX.loadScript(arAsproOptions["SITE_TEMPLATE_PATH"] + "/vendor/js/jquery.menu-aim.js", function () {
23371      $block.menuAim({
23372        firstActiveRow: true,
23373        rowSelector: "> .menu-navigation__sections-item",
23374        activate: function activate(a) {
23375          var _this = $(a),
23376              index = _this.index(),
23377              items = _this.closest(".menu-navigation__sections-wrapper").next(),
23378              link = _this.find("> a");
23379
23380          _this.siblings().find("> a").addClass("dark_link");
23381          link.addClass("colored_theme_text").removeClass("dark_link");
23382          items.find(".parent-items").siblings().hide();
23383          items.find(".parent-items").eq(index).show();
23384        },
23385        deactivate: function deactivate(a) {
23386          var _this = $(a),
23387              index = _this.index(),
23388              items = _this.closest(".menu-navigation__sections-wrapper").next(),
23389              link = _this.find("> a");
23390
23391          link.removeClass("colored_theme_text").addClass("dark_link");
23392          items.find(".parent-items").siblings().hide();
23393        },
23394      });
23395    });
23396  }
23397};
23398
23399$(document).ready(function () {
23400  //dropdown-select
23401  $(document).on("click", ".dropdown-select .dropdown-select__title", function () {
23402    var _this = $(this),
23403        menu = _this.parent().find("> .dropdown-select__list"),
23404        bVisibleMeu = menu.is(":visible"),
23405        animate = !bVisibleMeu ? "transition.slideUpIn" : "fadeOut";
23406
23407    if (!_this.hasClass("clicked")) {
23408      _this.addClass("clicked");
23409
23410      menu.velocity("stop").velocity(animate, {
23411        duration: 300,
23412        // delay: 250,
23413        begin: function () {
23414          _this.toggleClass("opened");
23415        },
23416        complete: function () {
23417          _this.removeClass("clicked");
23418        },
23419      });
23420    }
23421  });
23422
23423  // close select
23424  $("html, body").on("mousedown", function (e) {
23425    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
23426      e.stopPropagation();
23427
23428      if (!$(e.target).closest(".dropdown-select").length) {
23429        $(".dropdown-select .dropdown-select__title.opened").click();
23430      }
23431    }
23432  });
23433  /**/
23434
23435  /*side head block*/
23436  $(document).on("click", ".slide-block .slide-block__head", function (e) {
23437    var _this = $(this),
23438        menu = _this.siblings(".slide-block__body"),
23439        bVisibleMeu = menu.is(":visible"),
23440        animate = bVisibleMeu ? "slideUp" : "slideDown";
23441
23442    if (!_this.hasClass("clicked") && menu.length && !_this.hasClass("ignore") && !$(e.target).attr("href")) {
23443      var type = _this.data("id");
23444      _this.addClass("clicked");
23445
23446      if (bVisibleMeu) $.cookie(type + "_CLOSED", "Y");
23447      else $.removeCookie(type + "_CLOSED");
23448
23449      menu.velocity("stop").velocity(animate, {
23450        duration: 150,
23451        // delay: 250,
23452        begin: function () {
23453          _this.toggleClass("closed");
23454        },
23455        complete: function () {
23456          _this.removeClass("clicked");
23457
23458          if (typeof window["stickySidebar"] !== "undefined") {
23459            window["stickySidebar"].updateSticky();
23460          }
23461        },
23462      });
23463    }
23464  });
23465  /**/
23466
23467  /*sku change props*/
23468  if (!("SelectOfferProp" in window) && typeof window.SelectOfferProp != "function") {
23469    SelectOfferProp = function () {
23470      // return false;
23471      var _this = $(this),
23472          obParams = {},
23473          obSelect = {},
23474          objUrl = parseUrlQuery(),
23475          add_url = "",
23476          selectMode = _this.hasClass("list_values_wrapper") ? true : false,
23477          container = _this.closest(".bx_catalog_item_scu"),
23478          img = _this.closest(".item-parent").find(".thumb img");
23479
23480      /* request params */
23481      obParams = {
23482        PARAMS: _this.closest(".js_wrapper_items").data("params"),
23483        ID: container.data("offer_id"),
23484        SITE_ID: container.data("site_id"),
23485        LINK_ID: container.data("id") + "_" + _this.closest(".cur").data("code"),
23486        IBLOCK_ID: container.data("offer_iblockid"),
23487        IBLOCK_ID_PARENT: container.data("iblockid"),
23488        PROPERTY_ID: container.data("propertyid"),
23489        DEPTH: _this.closest(".item_wrapper").index(),
23490        VALUE: selectMode ? _this.find("option:selected").data("onevalue") : _this.data("onevalue"),
23491        CLASS: "inner_content",
23492        PICTURE: img.data("src") ? img.data("src") : img.attr("src"),
23493        ARTICLE_NAME: _this.closest(".item-parent").find(".article_block").data("name"),
23494        ARTICLE_VALUE: _this.closest(".item-parent").find(".article_block").data("value"),
23495      };
23496      /**/
23497
23498      if ("clear_cache" in objUrl) {
23499        if (objUrl.clear_cache == "Y") add_url += "?clear_cache=Y";
23500      }
23501
23502      /* save selected values */
23503      for (i = 0; i < obParams.DEPTH + 1; i++) {
23504        strName = "PROP_" + container.find(".item_wrapper:eq(" + i + ") > div").data("id");
23505        if (container.find(".item_wrapper:eq(" + i + ") select").length) {
23506          obSelect[strName] = container.find(".item_wrapper:eq(" + i + ") select option:selected").data("onevalue");
23507          obParams[strName] = container.find(".item_wrapper:eq(" + i + ") select option:selected").data("onevalue");
23508        } else {
23509          obSelect[strName] = container.find(".item_wrapper:eq(" + i + ") li.item.active").data("onevalue");
23510          obParams[strName] = container.find(".item_wrapper:eq(" + i + ") li.item.active").data("onevalue");
23511        }
23512      }
23513
23514      // obParams.SELECTED = JSON.stringify(obSelect);
23515      /**/
23516
23517      if (!selectMode) {
23518        _this.siblings().removeClass("active");
23519        _this.addClass("active");
23520      }
23521
23522      if (_this.attr("title")) {
23523        var skuVal = _this.attr("title").split(":")[1];
23524        _this.closest(".item_wrapper").find(".show_class .val").text(skuVal);
23525      } else {
23526        var img_row = _this.find(" > i");
23527        if (img_row.length && img_row.attr("title")) {
23528          var skuVal = img_row.attr("title").split(":")[1];
23529          _this.closest(".item_wrapper").find(".show_class .val").text(skuVal);
23530        }
23531      }
23532
23533      /* get sku */
23534      $.ajax({
23535        url: arMaxOptions["SITE_DIR"] + "ajax/js_item_detail.php" + add_url,
23536        type: "POST",
23537        data: obParams,
23538      }).success(function (html) {
23539        var ob = BX.processHTML(html);
23540        BX.ajax.processScripts(ob.SCRIPT);
23541        if ($(".counter_wrapp.list")) {
23542          $(".counter_wrapp.list .counter_block.big").removeClass("big");
23543        }
23544
23545        var sku_props = _this.closest(".sku_props").find(".item_wrapper .item.active");
23546        $.each(sku_props, function (index, value) {
23547          value = $(value);
23548          if (value.attr("title")) {
23549            var skuVal = value.attr("title").split(":")[1];
23550            value.closest(".item_wrapper").find(".show_class .val").text(skuVal);
23551          } else {
23552            var img_row = value.find(" > i");
23553            if (img_row.length && img_row.attr("title")) {
23554              var skuVal = img_row.attr("title").split(":")[1];
23555              value.closest(".item_wrapper").find(".show_class .val").text(skuVal);
23556            }
23557          }
23558        });
23559      });
23560    };
23561    $(document).on("click", ".ajax_load .bx_catalog_item_scu li.item", SelectOfferProp);
23562    $(document).on("change", ".ajax_load .bx_catalog_item_scu select.list_values_wrapper", SelectOfferProp);
23563  }
23564
23565  /**/
23566
23567  /**/
23568  $(".switch-item-block .switch-item-block__icons").on("click", function () {
23569    var $this = $(this),
23570        animationTime = 200;
23571
23572    if ($this.hasClass("switch-item-block__icons--small") && !$this.hasClass("active")) {
23573      $this.addClass("active");
23574      $this.siblings(".switch-item-block__icons--big").removeClass("active");
23575      $this
23576          .closest(".switch-item-block")
23577          .find(".switch-item-block__count-wrapper--big")
23578          .fadeOut(animationTime, function () {
23579            $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--small").fadeIn(animationTime);
23580          });
23581
23582      $this
23583          .closest(".switch-item-block")
23584          .siblings(".big-gallery-block")
23585          .fadeOut(animationTime, function () {
23586            $this.closest(".switch-item-block").siblings(".small-gallery-block").fadeIn(animationTime);
23587          });
23588    } else if ($this.hasClass("switch-item-block__icons--big") && !$this.hasClass("active")) {
23589      $this.addClass("active");
23590      $this.siblings(".switch-item-block__icons--small").removeClass("active");
23591      $this
23592          .closest(".switch-item-block")
23593          .find(".switch-item-block__count-wrapper--small")
23594          .fadeOut(animationTime, function () {
23595            $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--big").fadeIn(animationTime);
23596          });
23597
23598      $this
23599          .closest(".switch-item-block")
23600          .siblings(".small-gallery-block")
23601          .fadeOut(animationTime, function () {
23602            $this.closest(".switch-item-block").siblings(".big-gallery-block").fadeIn(animationTime);
23603          });
23604    }
23605    setTimeout(function () {
23606      InitLazyLoad();
23607    }, 300);
23608  });
23609  /**/
23610
23611  /*many items menu*/
23612
23613  //   InitMenuNavigationAim();
23614  /**/
23615});
23616
23617/* End */
23618;
23619; /* Start:"a:4:{s:4:"full";s:56:"/local/templates/aspro_max/js/swiper.js?1679582531325175";s:6:"source";s:39:"/local/templates/aspro_max/js/swiper.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23620/**
23621 * Swiper 6.8.4
23622 * Most modern mobile touch slider and framework with hardware accelerated transitions
23623 * https://swiperjs.com
23624 *
23625 * Copyright 2014-2021 Vladimir Kharlampidi
23626 *
23627 * Released under the MIT License
23628 *
23629 * Released on: August 23, 2021
23630 */
23631
23632(function (global, factory) {
23633  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
23634  typeof define === 'function' && define.amd ? define(factory) :
23635  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Swiper = factory());
23636}(this, (function () { 'use strict';
23637
23638  function _defineProperties(target, props) {
23639    for (var i = 0; i < props.length; i++) {
23640      var descriptor = props[i];
23641      descriptor.enumerable = descriptor.enumerable || false;
23642      descriptor.configurable = true;
23643      if ("value" in descriptor) descriptor.writable = true;
23644      Object.defineProperty(target, descriptor.key, descriptor);
23645    }
23646  }
23647
23648  function _createClass(Constructor, protoProps, staticProps) {
23649    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23650    if (staticProps) _defineProperties(Constructor, staticProps);
23651    return Constructor;
23652  }
23653
23654  function _extends() {
23655    _extends = Object.assign || function (target) {
23656      for (var i = 1; i < arguments.length; i++) {
23657        var source = arguments[i];
23658
23659        for (var key in source) {
23660          if (Object.prototype.hasOwnProperty.call(source, key)) {
23661            target[key] = source[key];
23662          }
23663        }
23664      }
23665
23666      return target;
23667    };
23668
23669    return _extends.apply(this, arguments);
23670  }
23671
23672  /**
23673   * SSR Window 3.0.0
23674   * Better handling for window object in SSR environment
23675   * https://github.com/nolimits4web/ssr-window
23676   *
23677   * Copyright 2020, Vladimir Kharlampidi
23678   *
23679   * Licensed under MIT
23680   *
23681   * Released on: November 9, 2020
23682   */
23683
23684  /* eslint-disable no-param-reassign */
23685  function isObject$1(obj) {
23686    return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;
23687  }
23688
23689  function extend$1(target, src) {
23690    if (target === void 0) {
23691      target = {};
23692    }
23693
23694    if (src === void 0) {
23695      src = {};
23696    }
23697
23698    Object.keys(src).forEach(function (key) {
23699      if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) {
23700        extend$1(target[key], src[key]);
23701      }
23702    });
23703  }
23704
23705  var ssrDocument = {
23706    body: {},
23707    addEventListener: function addEventListener() {},
23708    removeEventListener: function removeEventListener() {},
23709    activeElement: {
23710      blur: function blur() {},
23711      nodeName: ''
23712    },
23713    querySelector: function querySelector() {
23714      return null;
23715    },
23716    querySelectorAll: function querySelectorAll() {
23717      return [];
23718    },
23719    getElementById: function getElementById() {
23720      return null;
23721    },
23722    createEvent: function createEvent() {
23723      return {
23724        initEvent: function initEvent() {}
23725      };
23726    },
23727    createElement: function createElement() {
23728      return {
23729        children: [],
23730        childNodes: [],
23731        style: {},
23732        setAttribute: function setAttribute() {},
23733        getElementsByTagName: function getElementsByTagName() {
23734          return [];
23735        }
23736      };
23737    },
23738    createElementNS: function createElementNS() {
23739      return {};
23740    },
23741    importNode: function importNode() {
23742      return null;
23743    },
23744    location: {
23745      hash: '',
23746      host: '',
23747      hostname: '',
23748      href: '',
23749      origin: '',
23750      pathname: '',
23751      protocol: '',
23752      search: ''
23753    }
23754  };
23755
23756  function getDocument() {
23757    var doc = typeof document !== 'undefined' ? document : {};
23758    extend$1(doc, ssrDocument);
23759    return doc;
23760  }
23761
23762  var ssrWindow = {
23763    document: ssrDocument,
23764    navigator: {
23765      userAgent: ''
23766    },
23767    location: {
23768      hash: '',
23769      host: '',
23770      hostname: '',
23771      href: '',
23772      origin: '',
23773      pathname: '',
23774      protocol: '',
23775      search: ''
23776    },
23777    history: {
23778      replaceState: function replaceState() {},
23779      pushState: function pushState() {},
23780      go: function go() {},
23781      back: function back() {}
23782    },
23783    CustomEvent: function CustomEvent() {
23784      return this;
23785    },
23786    addEventListener: function addEventListener() {},
23787    removeEventListener: function removeEventListener() {},
23788    getComputedStyle: function getComputedStyle() {
23789      return {
23790        getPropertyValue: function getPropertyValue() {
23791          return '';
23792        }
23793      };
23794    },
23795    Image: function Image() {},
23796    Date: function Date() {},
23797    screen: {},
23798    setTimeout: function setTimeout() {},
23799    clearTimeout: function clearTimeout() {},
23800    matchMedia: function matchMedia() {
23801      return {};
23802    },
23803    requestAnimationFrame: function requestAnimationFrame(callback) {
23804      if (typeof setTimeout === 'undefined') {
23805        callback();
23806        return null;
23807      }
23808
23809      return setTimeout(callback, 0);
23810    },
23811    cancelAnimationFrame: function cancelAnimationFrame(id) {
23812      if (typeof setTimeout === 'undefined') {
23813        return;
23814      }
23815
23816      clearTimeout(id);
23817    }
23818  };
23819
23820  function getWindow() {
23821    var win = typeof window !== 'undefined' ? window : {};
23822    extend$1(win, ssrWindow);
23823    return win;
23824  }
23825
23826  /**
23827   * Dom7 3.0.0
23828   * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
23829   * https://framework7.io/docs/dom7.html
23830   *
23831   * Copyright 2020, Vladimir Kharlampidi
23832   *
23833   * Licensed under MIT
23834   *
23835   * Released on: November 9, 2020
23836   */
23837
23838  function _inheritsLoose(subClass, superClass) {
23839    subClass.prototype = Object.create(superClass.prototype);
23840    subClass.prototype.constructor = subClass;
23841    subClass.__proto__ = superClass;
23842  }
23843
23844  function _getPrototypeOf(o) {
23845    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
23846      return o.__proto__ || Object.getPrototypeOf(o);
23847    };
23848    return _getPrototypeOf(o);
23849  }
23850
23851  function _setPrototypeOf(o, p) {
23852    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
23853      o.__proto__ = p;
23854      return o;
23855    };
23856
23857    return _setPrototypeOf(o, p);
23858  }
23859
23860  function _isNativeReflectConstruct() {
23861    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
vendor: 21,490 bytes, lines 23862-24721
23862    if (Reflect.construct.sham) return false;
23863    if (typeof Proxy === "function") return true;
23864
23865    try {
23866      Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
23867      return true;
23868    } catch (e) {
23869      return false;
23870    }
23871  }
23872
23873  function _construct(Parent, args, Class) {
23874    if (_isNativeReflectConstruct()) {
23875      _construct = Reflect.construct;
23876    } else {
23877      _construct = function _construct(Parent, args, Class) {
23878        var a = [null];
23879        a.push.apply(a, args);
23880        var Constructor = Function.bind.apply(Parent, a);
23881        var instance = new Constructor();
23882        if (Class) _setPrototypeOf(instance, Class.prototype);
23883        return instance;
23884      };
23885    }
23886
23887    return _construct.apply(null, arguments);
23888  }
23889
23890  function _isNativeFunction(fn) {
23891    return Function.toString.call(fn).indexOf("[native code]") !== -1;
23892  }
23893
23894  function _wrapNativeSuper(Class) {
23895    var _cache = typeof Map === "function" ? new Map() : undefined;
23896
23897    _wrapNativeSuper = function _wrapNativeSuper(Class) {
23898      if (Class === null || !_isNativeFunction(Class)) return Class;
23899
23900      if (typeof Class !== "function") {
23901        throw new TypeError("Super expression must either be null or a function");
23902      }
23903
23904      if (typeof _cache !== "undefined") {
23905        if (_cache.has(Class)) return _cache.get(Class);
23906
23907        _cache.set(Class, Wrapper);
23908      }
23909
23910      function Wrapper() {
23911        return _construct(Class, arguments, _getPrototypeOf(this).constructor);
23912      }
23913
23914      Wrapper.prototype = Object.create(Class.prototype, {
23915        constructor: {
23916          value: Wrapper,
23917          enumerable: false,
23918          writable: true,
23919          configurable: true
23920        }
23921      });
23922      return _setPrototypeOf(Wrapper, Class);
23923    };
23924
23925    return _wrapNativeSuper(Class);
23926  }
23927
23928  function _assertThisInitialized(self) {
23929    if (self === void 0) {
23930      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
23931    }
23932
23933    return self;
23934  }
23935  /* eslint-disable no-proto */
23936
23937
23938  function makeReactive(obj) {
23939    var proto = obj.__proto__;
23940    Object.defineProperty(obj, '__proto__', {
23941      get: function get() {
23942        return proto;
23943      },
23944      set: function set(value) {
23945        proto.__proto__ = value;
23946      }
23947    });
23948  }
23949
23950  var Dom7 = /*#__PURE__*/function (_Array) {
23951    _inheritsLoose(Dom7, _Array);
23952
23953    function Dom7(items) {
23954      var _this;
23955
23956      _this = _Array.call.apply(_Array, [this].concat(items)) || this;
23957      makeReactive(_assertThisInitialized(_this));
23958      return _this;
23959    }
23960
23961    return Dom7;
23962  }( /*#__PURE__*/_wrapNativeSuper(Array));
23963
23964  function arrayFlat(arr) {
23965    if (arr === void 0) {
23966      arr = [];
23967    }
23968
23969    var res = [];
23970    arr.forEach(function (el) {
23971      if (Array.isArray(el)) {
23972        res.push.apply(res, arrayFlat(el));
23973      } else {
23974        res.push(el);
23975      }
23976    });
23977    return res;
23978  }
23979
23980  function arrayFilter(arr, callback) {
23981    return Array.prototype.filter.call(arr, callback);
23982  }
23983
23984  function arrayUnique(arr) {
23985    var uniqueArray = [];
23986
23987    for (var i = 0; i < arr.length; i += 1) {
23988      if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
23989    }
23990
23991    return uniqueArray;
23992  }
23993
23994  function qsa(selector, context) {
23995    if (typeof selector !== 'string') {
23996      return [selector];
23997    }
23998
23999    var a = [];
24000    var res = context.querySelectorAll(selector);
24001
24002    for (var i = 0; i < res.length; i += 1) {
24003      a.push(res[i]);
24004    }
24005
24006    return a;
24007  }
24008
24009  function $(selector, context) {
24010    var window = getWindow();
24011    var document = getDocument();
24012    var arr = [];
24013
24014    if (!context && selector instanceof Dom7) {
24015      return selector;
24016    }
24017
24018    if (!selector) {
24019      return new Dom7(arr);
24020    }
24021
24022    if (typeof selector === 'string') {
24023      var html = selector.trim();
24024
24025      if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
24026        var toCreate = 'div';
24027        if (html.indexOf('<li') === 0) toCreate = 'ul';
24028        if (html.indexOf('<tr') === 0) toCreate = 'tbody';
24029        if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
24030        if (html.indexOf('<tbody') === 0) toCreate = 'table';
24031        if (html.indexOf('<option') === 0) toCreate = 'select';
24032        var tempParent = document.createElement(toCreate);
24033        tempParent.innerHTML = html;
24034
24035        for (var i = 0; i < tempParent.childNodes.length; i += 1) {
24036          arr.push(tempParent.childNodes[i]);
24037        }
24038      } else {
24039        arr = qsa(selector.trim(), context || document);
24040      } // arr = qsa(selector, document);
24041
24042    } else if (selector.nodeType || selector === window || selector === document) {
24043      arr.push(selector);
24044    } else if (Array.isArray(selector)) {
24045      if (selector instanceof Dom7) return selector;
24046      arr = selector;
24047    }
24048
24049    return new Dom7(arrayUnique(arr));
24050  }
24051
24052  $.fn = Dom7.prototype;
24053
24054  function addClass() {
24055    for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
24056      classes[_key] = arguments[_key];
24057    }
24058
24059    var classNames = arrayFlat(classes.map(function (c) {
24060      return c.split(' ');
24061    }));
24062    this.forEach(function (el) {
24063      var _el$classList;
24064
24065      (_el$classList = el.classList).add.apply(_el$classList, classNames);
24066    });
24067    return this;
24068  }
24069
24070  function removeClass() {
24071    for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
24072      classes[_key2] = arguments[_key2];
24073    }
24074
24075    var classNames = arrayFlat(classes.map(function (c) {
24076      return c.split(' ');
24077    }));
24078    this.forEach(function (el) {
24079      var _el$classList2;
24080
24081      (_el$classList2 = el.classList).remove.apply(_el$classList2, classNames);
24082    });
24083    return this;
24084  }
24085
24086  function toggleClass() {
24087    for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
24088      classes[_key3] = arguments[_key3];
24089    }
24090
24091    var classNames = arrayFlat(classes.map(function (c) {
24092      return c.split(' ');
24093    }));
24094    this.forEach(function (el) {
24095      classNames.forEach(function (className) {
24096        el.classList.toggle(className);
24097      });
24098    });
24099  }
24100
24101  function hasClass() {
24102    for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
24103      classes[_key4] = arguments[_key4];
24104    }
24105
24106    var classNames = arrayFlat(classes.map(function (c) {
24107      return c.split(' ');
24108    }));
24109    return arrayFilter(this, function (el) {
24110      return classNames.filter(function (className) {
24111        return el.classList.contains(className);
24112      }).length > 0;
24113    }).length > 0;
24114  }
24115
24116  function attr(attrs, value) {
24117    if (arguments.length === 1 && typeof attrs === 'string') {
24118      // Get attr
24119      if (this[0]) return this[0].getAttribute(attrs);
24120      return undefined;
24121    } // Set attrs
24122
24123
24124    for (var i = 0; i < this.length; i += 1) {
24125      if (arguments.length === 2) {
24126        // String
24127        this[i].setAttribute(attrs, value);
24128      } else {
24129        // Object
24130        for (var attrName in attrs) {
24131          this[i][attrName] = attrs[attrName];
24132          this[i].setAttribute(attrName, attrs[attrName]);
24133        }
24134      }
24135    }
24136
24137    return this;
24138  }
24139
24140  function removeAttr(attr) {
24141    for (var i = 0; i < this.length; i += 1) {
24142      this[i].removeAttribute(attr);
24143    }
24144
24145    return this;
24146  }
24147
24148  function transform(transform) {
24149    for (var i = 0; i < this.length; i += 1) {
24150      this[i].style.transform = transform;
24151    }
24152
24153    return this;
24154  }
24155
24156  function transition$1(duration) {
24157    for (var i = 0; i < this.length; i += 1) {
24158      this[i].style.transitionDuration = typeof duration !== 'string' ? duration + "ms" : duration;
24159    }
24160
24161    return this;
24162  }
24163
24164  function on() {
24165    for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
24166      args[_key5] = arguments[_key5];
24167    }
24168
24169    var eventType = args[0],
24170        targetSelector = args[1],
24171        listener = args[2],
24172        capture = args[3];
24173
24174    if (typeof args[1] === 'function') {
24175      eventType = args[0];
24176      listener = args[1];
24177      capture = args[2];
24178      targetSelector = undefined;
24179    }
24180
24181    if (!capture) capture = false;
24182
24183    function handleLiveEvent(e) {
24184      var target = e.target;
24185      if (!target) return;
24186      var eventData = e.target.dom7EventData || [];
24187
24188      if (eventData.indexOf(e) < 0) {
24189        eventData.unshift(e);
24190      }
24191
24192      if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
24193        var _parents = $(target).parents(); // eslint-disable-line
24194
24195
24196        for (var k = 0; k < _parents.length; k += 1) {
24197          if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
24198        }
24199      }
24200    }
24201
24202    function handleEvent(e) {
24203      var eventData = e && e.target ? e.target.dom7EventData || [] : [];
24204
24205      if (eventData.indexOf(e) < 0) {
24206        eventData.unshift(e);
24207      }
24208
24209      listener.apply(this, eventData);
24210    }
24211
24212    var events = eventType.split(' ');
24213    var j;
24214
24215    for (var i = 0; i < this.length; i += 1) {
24216      var el = this[i];
24217
24218      if (!targetSelector) {
24219        for (j = 0; j < events.length; j += 1) {
24220          var event = events[j];
24221          if (!el.dom7Listeners) el.dom7Listeners = {};
24222          if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
24223          el.dom7Listeners[event].push({
24224            listener: listener,
24225            proxyListener: handleEvent
24226          });
24227          el.addEventListener(event, handleEvent, capture);
24228        }
24229      } else {
24230        // Live events
24231        for (j = 0; j < events.length; j += 1) {
24232          var _event = events[j];
24233          if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
24234          if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];
24235
24236          el.dom7LiveListeners[_event].push({
24237            listener: listener,
24238            proxyListener: handleLiveEvent
24239          });
24240
24241          el.addEventListener(_event, handleLiveEvent, capture);
24242        }
24243      }
24244    }
24245
24246    return this;
24247  }
24248
24249  function off() {
24250    for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
24251      args[_key6] = arguments[_key6];
24252    }
24253
24254    var eventType = args[0],
24255        targetSelector = args[1],
24256        listener = args[2],
24257        capture = args[3];
24258
24259    if (typeof args[1] === 'function') {
24260      eventType = args[0];
24261      listener = args[1];
24262      capture = args[2];
24263      targetSelector = undefined;
24264    }
24265
24266    if (!capture) capture = false;
24267    var events = eventType.split(' ');
24268
24269    for (var i = 0; i < events.length; i += 1) {
24270      var event = events[i];
24271
24272      for (var j = 0; j < this.length; j += 1) {
24273        var el = this[j];
24274        var handlers = void 0;
24275
24276        if (!targetSelector && el.dom7Listeners) {
24277          handlers = el.dom7Listeners[event];
24278        } else if (targetSelector && el.dom7LiveListeners) {
24279          handlers = el.dom7LiveListeners[event];
24280        }
24281
24282        if (handlers && handlers.length) {
24283          for (var k = handlers.length - 1; k >= 0; k -= 1) {
24284            var handler = handlers[k];
24285
24286            if (listener && handler.listener === listener) {
24287              el.removeEventListener(event, handler.proxyListener, capture);
24288              handlers.splice(k, 1);
24289            } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
24290              el.removeEventListener(event, handler.proxyListener, capture);
24291              handlers.splice(k, 1);
24292            } else if (!listener) {
24293              el.removeEventListener(event, handler.proxyListener, capture);
24294              handlers.splice(k, 1);
24295            }
24296          }
24297        }
24298      }
24299    }
24300
24301    return this;
24302  }
24303
24304  function trigger() {
24305    var window = getWindow();
24306
24307    for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
24308      args[_key9] = arguments[_key9];
24309    }
24310
24311    var events = args[0].split(' ');
24312    var eventData = args[1];
24313
24314    for (var i = 0; i < events.length; i += 1) {
24315      var event = events[i];
24316
24317      for (var j = 0; j < this.length; j += 1) {
24318        var el = this[j];
24319
24320        if (window.CustomEvent) {
24321          var evt = new window.CustomEvent(event, {
24322            detail: eventData,
24323            bubbles: true,
24324            cancelable: true
24325          });
24326          el.dom7EventData = args.filter(function (data, dataIndex) {
24327            return dataIndex > 0;
24328          });
24329          el.dispatchEvent(evt);
24330          el.dom7EventData = [];
24331          delete el.dom7EventData;
24332        }
24333      }
24334    }
24335
24336    return this;
24337  }
24338
24339  function transitionEnd$1(callback) {
24340    var dom = this;
24341
24342    function fireCallBack(e) {
24343      if (e.target !== this) return;
24344      callback.call(this, e);
24345      dom.off('transitionend', fireCallBack);
24346    }
24347
24348    if (callback) {
24349      dom.on('transitionend', fireCallBack);
24350    }
24351
24352    return this;
24353  }
24354
24355  function outerWidth(includeMargins) {
24356    if (this.length > 0) {
24357      if (includeMargins) {
24358        var _styles = this.styles();
24359
24360        return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
24361      }
24362
24363      return this[0].offsetWidth;
24364    }
24365
24366    return null;
24367  }
24368
24369  function outerHeight(includeMargins) {
24370    if (this.length > 0) {
24371      if (includeMargins) {
24372        var _styles2 = this.styles();
24373
24374        return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
24375      }
24376
24377      return this[0].offsetHeight;
24378    }
24379
24380    return null;
24381  }
24382
24383  function offset() {
24384    if (this.length > 0) {
24385      var window = getWindow();
24386      var document = getDocument();
24387      var el = this[0];
24388      var box = el.getBoundingClientRect();
24389      var body = document.body;
24390      var clientTop = el.clientTop || body.clientTop || 0;
24391      var clientLeft = el.clientLeft || body.clientLeft || 0;
24392      var scrollTop = el === window ? window.scrollY : el.scrollTop;
24393      var scrollLeft = el === window ? window.scrollX : el.scrollLeft;
24394      return {
24395        top: box.top + scrollTop - clientTop,
24396        left: box.left + scrollLeft - clientLeft
24397      };
24398    }
24399
24400    return null;
24401  }
24402
24403  function styles() {
24404    var window = getWindow();
24405    if (this[0]) return window.getComputedStyle(this[0], null);
24406    return {};
24407  }
24408
24409  function css(props, value) {
24410    var window = getWindow();
24411    var i;
24412
24413    if (arguments.length === 1) {
24414      if (typeof props === 'string') {
24415        // .css('width')
24416        if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
24417      } else {
24418        // .css({ width: '100px' })
24419        for (i = 0; i < this.length; i += 1) {
24420          for (var _prop in props) {
24421            this[i].style[_prop] = props[_prop];
24422          }
24423        }
24424
24425        return this;
24426      }
24427    }
24428
24429    if (arguments.length === 2 && typeof props === 'string') {
24430      // .css('width', '100px')
24431      for (i = 0; i < this.length; i += 1) {
24432        this[i].style[props] = value;
24433      }
24434
24435      return this;
24436    }
24437
24438    return this;
24439  }
24440
24441  function each(callback) {
24442    if (!callback) return this;
24443    this.forEach(function (el, index) {
24444      callback.apply(el, [el, index]);
24445    });
24446    return this;
24447  }
24448
24449  function filter(callback) {
24450    var result = arrayFilter(this, callback);
24451    return $(result);
24452  }
24453
24454  function html(html) {
24455    if (typeof html === 'undefined') {
24456      return this[0] ? this[0].innerHTML : null;
24457    }
24458
24459    for (var i = 0; i < this.length; i += 1) {
24460      this[i].innerHTML = html;
24461    }
24462
24463    return this;
24464  }
24465
24466  function text(text) {
24467    if (typeof text === 'undefined') {
24468      return this[0] ? this[0].textContent.trim() : null;
24469    }
24470
24471    for (var i = 0; i < this.length; i += 1) {
24472      this[i].textContent = text;
24473    }
24474
24475    return this;
24476  }
24477
24478  function is(selector) {
24479    var window = getWindow();
24480    var document = getDocument();
24481    var el = this[0];
24482    var compareWith;
24483    var i;
24484    if (!el || typeof selector === 'undefined') return false;
24485
24486    if (typeof selector === 'string') {
24487      if (el.matches) return el.matches(selector);
24488      if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
24489      if (el.msMatchesSelector) return el.msMatchesSelector(selector);
24490      compareWith = $(selector);
24491
24492      for (i = 0; i < compareWith.length; i += 1) {
24493        if (compareWith[i] === el) return true;
24494      }
24495
24496      return false;
24497    }
24498
24499    if (selector === document) {
24500      return el === document;
24501    }
24502
24503    if (selector === window) {
24504      return el === window;
24505    }
24506
24507    if (selector.nodeType || selector instanceof Dom7) {
24508      compareWith = selector.nodeType ? [selector] : selector;
24509
24510      for (i = 0; i < compareWith.length; i += 1) {
24511        if (compareWith[i] === el) return true;
24512      }
24513
24514      return false;
24515    }
24516
24517    return false;
24518  }
24519
24520  function index() {
24521    var child = this[0];
24522    var i;
24523
24524    if (child) {
24525      i = 0; // eslint-disable-next-line
24526
24527      while ((child = child.previousSibling) !== null) {
24528        if (child.nodeType === 1) i += 1;
24529      }
24530
24531      return i;
24532    }
24533
24534    return undefined;
24535  }
24536
24537  function eq(index) {
24538    if (typeof index === 'undefined') return this;
24539    var length = this.length;
24540
24541    if (index > length - 1) {
24542      return $([]);
24543    }
24544
24545    if (index < 0) {
24546      var returnIndex = length + index;
24547      if (returnIndex < 0) return $([]);
24548      return $([this[returnIndex]]);
24549    }
24550
24551    return $([this[index]]);
24552  }
24553
24554  function append() {
24555    var newChild;
24556    var document = getDocument();
24557
24558    for (var k = 0; k < arguments.length; k += 1) {
24559      newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];
24560
24561      for (var i = 0; i < this.length; i += 1) {
24562        if (typeof newChild === 'string') {
24563          var tempDiv = document.createElement('div');
24564          tempDiv.innerHTML = newChild;
24565
24566          while (tempDiv.firstChild) {
24567            this[i].appendChild(tempDiv.firstChild);
24568          }
24569        } else if (newChild instanceof Dom7) {
24570          for (var j = 0; j < newChild.length; j += 1) {
24571            this[i].appendChild(newChild[j]);
24572          }
24573        } else {
24574          this[i].appendChild(newChild);
24575        }
24576      }
24577    }
24578
24579    return this;
24580  }
24581
24582  function prepend(newChild) {
24583    var document = getDocument();
24584    var i;
24585    var j;
24586
24587    for (i = 0; i < this.length; i += 1) {
24588      if (typeof newChild === 'string') {
24589        var tempDiv = document.createElement('div');
24590        tempDiv.innerHTML = newChild;
24591
24592        for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
24593          this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
24594        }
24595      } else if (newChild instanceof Dom7) {
24596        for (j = 0; j < newChild.length; j += 1) {
24597          this[i].insertBefore(newChild[j], this[i].childNodes[0]);
24598        }
24599      } else {
24600        this[i].insertBefore(newChild, this[i].childNodes[0]);
24601      }
24602    }
24603
24604    return this;
24605  }
24606
24607  function next(selector) {
24608    if (this.length > 0) {
24609      if (selector) {
24610        if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
24611          return $([this[0].nextElementSibling]);
24612        }
24613
24614        return $([]);
24615      }
24616
24617      if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
24618      return $([]);
24619    }
24620
24621    return $([]);
24622  }
24623
24624  function nextAll(selector) {
24625    var nextEls = [];
24626    var el = this[0];
24627    if (!el) return $([]);
24628
24629    while (el.nextElementSibling) {
24630      var _next = el.nextElementSibling; // eslint-disable-line
24631
24632      if (selector) {
24633        if ($(_next).is(selector)) nextEls.push(_next);
24634      } else nextEls.push(_next);
24635
24636      el = _next;
24637    }
24638
24639    return $(nextEls);
24640  }
24641
24642  function prev(selector) {
24643    if (this.length > 0) {
24644      var el = this[0];
24645
24646      if (selector) {
24647        if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
24648          return $([el.previousElementSibling]);
24649        }
24650
24651        return $([]);
24652      }
24653
24654      if (el.previousElementSibling) return $([el.previousElementSibling]);
24655      return $([]);
24656    }
24657
24658    return $([]);
24659  }
24660
24661  function prevAll(selector) {
24662    var prevEls = [];
24663    var el = this[0];
24664    if (!el) return $([]);
24665
24666    while (el.previousElementSibling) {
24667      var _prev = el.previousElementSibling; // eslint-disable-line
24668
24669      if (selector) {
24670        if ($(_prev).is(selector)) prevEls.push(_prev);
24671      } else prevEls.push(_prev);
24672
24673      el = _prev;
24674    }
24675
24676    return $(prevEls);
24677  }
24678
24679  function parent(selector) {
24680    var parents = []; // eslint-disable-line
24681
24682    for (var i = 0; i < this.length; i += 1) {
24683      if (this[i].parentNode !== null) {
24684        if (selector) {
24685          if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
24686        } else {
24687          parents.push(this[i].parentNode);
24688        }
24689      }
24690    }
24691
24692    return $(parents);
24693  }
24694
24695  function parents(selector) {
24696    var parents = []; // eslint-disable-line
24697
24698    for (var i = 0; i < this.length; i += 1) {
24699      var _parent = this[i].parentNode; // eslint-disable-line
24700
24701      while (_parent) {
24702        if (selector) {
24703          if ($(_parent).is(selector)) parents.push(_parent);
24704        } else {
24705          parents.push(_parent);
24706        }
24707
24708        _parent = _parent.parentNode;
24709      }
24710    }
24711
24712    return $(parents);
24713  }
24714
24715  function closest(selector) {
24716    var closest = this; // eslint-disable-line
24717
24718    if (typeof selector === 'undefined') {
24719      return $([]);
24720    }
24721
24722    if (!closest.is(selector)) {
24723      closest = closest.parents(selector).eq(0);
24724    }
24725
24726    return closest;
24727  }
24728
24729  function find(selector) {
24730    var foundElements = [];
24731
24732    for (var i = 0; i < this.length; i += 1) {
24733      var found = this[i].querySelectorAll(selector);
24734
24735      for (var j = 0; j < found.length; j += 1) {
24736        foundElements.push(found[j]);
24737      }
24738    }
24739
24740    return $(foundElements);
24741  }
24742
24743  function children(selector) {
24744    var children = []; // eslint-disable-line
24745
24746    for (var i = 0; i < this.length; i += 1) {
24747      var childNodes = this[i].children;
24748
24749      for (var j = 0; j < childNodes.length; j += 1) {
24750        if (!selector || $(childNodes[j]).is(selector)) {
24751          children.push(childNodes[j]);
24752        }
24753      }
24754    }
24755
24756    return $(children);
24757  }
24758
24759  function remove() {
24760    for (var i = 0; i < this.length; i += 1) {
24761      if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
24762    }
24763
24764    return this;
24765  }
24766
24767  var Methods = {
24768    addClass: addClass,
24769    removeClass: removeClass,
24770    hasClass: hasClass,
24771    toggleClass: toggleClass,
24772    attr: attr,
24773    removeAttr: removeAttr,
24774    transform: transform,
24775    transition: transition$1,
24776    on: on,
24777    off: off,
24778    trigger: trigger,
24779    transitionEnd: transitionEnd$1,
24780    outerWidth: outerWidth,
24781    outerHeight: outerHeight,
24782    styles: styles,
24783    offset: offset,
24784    css: css,
24785    each: each,
24786    html: html,
24787    text: text,
24788    is: is,
24789    index: index,
24790    eq: eq,
24791    append: append,
24792    prepend: prepend,
24793    next: next,
24794    nextAll: nextAll,
24795    prev: prev,
24796    prevAll: prevAll,
24797    parent: parent,
24798    parents: parents,
24799    closest: closest,
24800    find: find,
24801    children: children,
24802    filter: filter,
24803    remove: remove
24804  };
24805  Object.keys(Methods).forEach(function (methodName) {
24806    Object.defineProperty($.fn, methodName, {
24807      value: Methods[methodName],
24808      writable: true
24809    });
24810  });
24811
24812  function deleteProps(obj) {
24813    var object = obj;
24814    Object.keys(object).forEach(function (key) {
24815      try {
24816        object[key] = null;
24817      } catch (e) {// no getter for object
24818      }
24819
24820      try {
24821        delete object[key];
24822      } catch (e) {// something got wrong
24823      }
24824    });
24825  }
24826
24827  function nextTick(callback, delay) {
24828    if (delay === void 0) {
24829      delay = 0;
24830    }
24831
24832    return setTimeout(callback, delay);
24833  }
24834
24835  function now() {
24836    return Date.now();
24837  }
24838
24839  function getComputedStyle$1(el) {
24840    var window = getWindow();
24841    var style;
24842
24843    if (window.getComputedStyle) {
24844      style = window.getComputedStyle(el, null);
24845    }
24846
24847    if (!style && el.currentStyle) {
24848      style = el.currentStyle;
24849    }
24850
24851    if (!style) {
24852      style = el.style;
24853    }
24854
24855    return style;
24856  }
24857
24858  function getTranslate(el, axis) {
24859    if (axis === void 0) {
24860      axis = 'x';
24861    }
24862
24863    var window = getWindow();
24864    var matrix;
24865    var curTransform;
24866    var transformMatrix;
24867    var curStyle = getComputedStyle$1(el);
24868
24869    if (window.WebKitCSSMatrix) {
24870      curTransform = curStyle.transform || curStyle.webkitTransform;
24871
24872      if (curTransform.split(',').length > 6) {
24873        curTransform = curTransform.split(', ').map(function (a) {
24874          return a.replace(',', '.');
24875        }).join(', ');
24876      } // Some old versions of Webkit choke when 'none' is passed; pass
24877      // empty string instead in this case
24878
24879
24880      transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
24881    } else {
24882      transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
24883      matrix = transformMatrix.toString().split(',');
24884    }
24885
24886    if (axis === 'x') {
24887      // Latest Chrome and webkits Fix
24888      if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix
24889      else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers
24890        else curTransform = parseFloat(matrix[4]);
24891    }
24892
24893    if (axis === 'y') {
24894      // Latest Chrome and webkits Fix
24895      if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix
24896      else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers
24897        else curTransform = parseFloat(matrix[5]);
24898    }
24899
24900    return curTransform || 0;
24901  }
24902
24903  function isObject(o) {
24904    return typeof o === 'object' && o !== null && o.constructor && Ob
24904ject.prototype.toString.call(o).slice(8, -1) === 'Object';
24905  }
24906
24907  function isNode(node) {
24908    // eslint-disable-next-line
24909    if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
24910      return node instanceof HTMLElement;
24911    }
24912
24913    return node && (node.nodeType === 1 || node.nodeType === 11);
24914  }
24915
24916  function extend() {
24917    var to = Object(arguments.length <= 0 ? undefined : arguments[0]);
24918    var noExtend = ['__proto__', 'constructor', 'prototype'];
24919
24920    for (var i = 1; i < arguments.length; i += 1) {
24921      var nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
24922
24923      if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
24924        var keysArray = Object.keys(Object(nextSource)).filter(function (key) {
24925          return noExtend.indexOf(key) < 0;
24926        });
24927
24928        for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
24929          var nextKey = keysArray[nextIndex];
24930          var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
24931
24932          if (desc !== undefined && desc.enumerable) {
24933            if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
24934              if (nextSource[nextKey].__swiper__) {
24935                to[nextKey] = nextSource[nextKey];
24936              } else {
24937                extend(to[nextKey], nextSource[nextKey]);
24938              }
24939            } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
24940              to[nextKey] = {};
24941
24942              if (nextSource[nextKey].__swiper__) {
24943                to[nextKey] = nextSource[nextKey];
24944              } else {
24945                extend(to[nextKey], nextSource[nextKey]);
24946              }
24947            } else {
24948              to[nextKey] = nextSource[nextKey];
24949            }
24950          }
24951        }
24952      }
24953    }
24954
24955    return to;
24956  }
24957
24958  function bindModuleMethods(instance, obj) {
24959    Object.keys(obj).forEach(function (key) {
24960      if (isObject(obj[key])) {
24961        Object.keys(obj[key]).forEach(function (subKey) {
24962          if (typeof obj[key][subKey] === 'function') {
24963            obj[key][subKey] = obj[key][subKey].bind(instance);
24964          }
24965        });
24966      }
24967
24968      instance[key] = obj[key];
24969    });
24970  }
24971
24972  function classesToSelector(classes) {
24973    if (classes === void 0) {
24974      classes = '';
24975    }
24976
24977    return "." + classes.trim().replace(/([\.:!\/])/g, '\\$1') // eslint-disable-line
24978    .replace(/ /g, '.');
24979  }
24980
24981  function createElementIfNotDefined($container, params, createElements, checkProps) {
24982    var document = getDocument();
24983
24984    if (createElements) {
24985      Object.keys(checkProps).forEach(function (key) {
24986        if (!params[key] && params.auto === true) {
24987          var element = document.createElement('div');
24988          element.className = checkProps[key];
24989          $container.append(element);
24990          params[key] = element;
24991        }
24992      });
24993    }
24994
24995    return params;
24996  }
24997
24998  var support;
24999
25000  function calcSupport() {
25001    var window = getWindow();
25002    var document = getDocument();
25003    return {
25004      touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),
25005      pointerEvents: !!window.PointerEvent && 'maxTouchPoints' in window.navigator && window.navigator.maxTouchPoints >= 0,
25006      observer: function checkObserver() {
25007        return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
25008      }(),
25009      passiveListener: function checkPassiveListener() {
25010        var supportsPassive = false;
25011
25012        try {
25013          var opts = Object.defineProperty({}, 'passive', {
25014            // eslint-disable-next-line
25015            get: function get() {
25016              supportsPassive = true;
25017            }
25018          });
25019          window.addEventListener('testPassiveListener', null, opts);
25020        } catch (e) {// No support
25021        }
25022
25023        return supportsPassive;
25024      }(),
25025      gestures: function checkGestures() {
25026        return 'ongesturestart' in window;
25027      }()
25028    };
25029  }
25030
25031  function getSupport() {
25032    if (!support) {
25033      support = calcSupport();
25034    }
25035
25036    return support;
25037  }
25038
25039  var device;
25040
25041  function calcDevice(_temp) {
25042    var _ref = _temp === void 0 ? {}
25042 : _temp,
25043        userAgent = _ref.userAgent;
25044
25045    var support = getSupport();
25046    var window = getWindow();
25047    var platform = window.navigator.platform;
25048    var ua = userAgent || window.navigator.userAgent;
25049    var device = {
25050      ios: false,
25051      android: false
25052    };
25053    var screenWidth = window.screen.width;
25054    var screenHeight = window.screen.height;
25055    var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
25056
25057    var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
25058    var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
25059    var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
25060    var windows = platform === 'Win32';
25061    var macos = platform === 'MacIntel'; // iPadOs 13 fix
25062
25063    var iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
25064
25065    if (!ipad && macos && support.touch && iPadScreens.indexOf(screenWidth + "x" + screenHeight) >= 0) {
25066      ipad = ua.match(/(Version)\/([\d.]+)/);
25067      if (!ipad) ipad = [0, 1, '13_0_0'];
25068      macos = false;
25069    } // Android
25070
25071
25072    if (android && !windows) {
25073      device.os = 'android';
25074      device.android = true;
25075    }
25076
25077    if (ipad || iphone || ipod) {
25078      device.os = 'ios';
25079      device.ios = true;
25080    } // Export object
25081
25082
25083    return device;
25084  }
25085
25086  function getDevice(overrides) {
25087    if (overrides === void 0) {
25088      overrides = {};
25089    }
25090
25091    if (!device) {
25092      device = calcDevice(overrides);
25093    }
25094
25095    return device;
25096  }
25097
25098  var browser;
25099
25100  function calcBrowser() {
25101    var window = getWindow();
25102
25103    function isSafari() {
25104      var ua = window.navigator.userAgent.toLowerCase();
25105      return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
25106    }
25107
25108    return {
25109      isEdge: !!window.navigator.userAgent.match(/Edge/g),
25110      isSafari: isSafari(),
25111      isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
25112    };
25113  }
25114
25115  function getBrowser() {
25116    if (!browser) {
25117      browser = calcBrowser();
25118    }
25119
25120    return browser;
25121  }
25122
25123  var supportsResizeObserver = function supportsResizeObserver() {
25124    var window = getWindow();
25125    return typeof window.ResizeObserver !== 'undefined';
25126  };
25127
25128  var Resize = {
25129    name: 'resize',
25130    create: function create() {
25131      var swiper = this;
25132      extend(swiper, {
25133        resize: {
25134          observer: null,
25135          createObserver: function createObserver() {
25136            if (!swiper || swiper.destroyed || !swiper.initialized) return;
25137            swiper.resize.observer = new ResizeObserver(function (entries) {
25138              var width = swiper.width,
25139                  height = swiper.height;
25140              var newWidth = width;
25141              var newHeight = height;
25142              entries.forEach(function (_ref) {
25143                var contentBoxSize = _ref.contentBoxSize,
25144                    contentRect = _ref.contentRect,
25145                    target = _ref.target;
25146                if (target && target !== swiper.el) return;
25147                newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
25148                newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
25149              });
25150
25151              if (newWidth !== width || newHeight !== height) {
25152                swiper.resize.resizeHandler();
25153              }
25154            });
25155            swiper.resize.observer.observe(swiper.el);
25156          },
25157          removeObserver: function removeObserver() {
25158            if (swiper.resize.observer && swiper.resize.observer.unobserve && swiper.el) {
25159              swiper.resize.observer.unobserve(swiper.el);
25160              swiper.resize.observer = null;
25161            }
25162          },
25163          resizeHandler: function resizeHandler() {
25164            if (!swiper || swiper.destroyed || !swiper.initialized) return;
25165            swiper.emit('beforeResize');
25166            swiper.emit('resize');
25167          },
25168          orientationChangeHandler: function orientationChangeHandler() {
25169            if (!swiper || swiper.destroyed || !swiper.initialized) return;
25170            swiper.emit('orientationchange');
25171          }
25172        }
25173      });
25174    },
25175    on: {
25176      init: function init(swiper) {
25177        var window = getWindow();
25178
25179        if (swiper.params.resizeObserver && supportsResizeObserver()) {
25180          swiper.resize.createObserver();
25181          return;
25182        } // Emit resize
25183
25184
25185        window.addEventListener('resize', swiper.resize.resizeHandler); // Emit orientationchange
25186
25187        window.addEventListener('orientationchange', swiper.resize.orientationChangeHandler);
25188      },
25189      destroy: function destroy(swiper) {
25190        var window = getWindow();
25191        swiper.resize.removeObserver();
25192        window.removeEventListener('resize', swiper.resize.resizeHandler);
25193        window.removeEventListener('orientationchange', swiper.resize.orientationChangeHandler);
25194      }
25195    }
25196  };
25197
25198  var Observer = {
25199    attach: function attach(target, options) {
25200      if (options === void 0) {
25201        options = {};
25202      }
25203
25204      var window = getWindow();
25205      var swiper = this;
25206      var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
25207      var observer = new ObserverFunc(function (mutations) {
25208        // The observerUpdate event should only be triggered
25209        // once despite the number of mutations.  Additional
25210        // triggers are redundant and are very costly
25211        if (mutations.length === 1) {
25212          swiper.emit('observerUpdate', mutations[0]);
25213          return;
25214        }
25215
25216        var observerUpdate = function observerUpdate() {
25217          swiper.emit('observerUpdate', mutations[0]);
25218        };
25219
25220        if (window.requestAnimationFrame) {
25221          window.requestAnimationFrame(observerUpdate);
25222        } else {
25223          window.setTimeout(observerUpdate, 0);
25224        }
25225      });
25226      observer.observe(target, {
25227        attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
25228        childList: typeof options.childList === 'undefined' ? true : options.childList,
25229        characterData: typeof options.characterData === 'undefined' ? true : options.characterData
25230      });
25231      swiper.observer.observers.push(observer);
25232    },
25233    init: function init() {
25234      var swiper = this;
25235      if (!swiper.support.observer || !swiper.params.observer) return;
25236
25237      if (swiper.params.observeParents) {
25238        var containerParents = swiper.$el.parents();
25239
25240        for (var i = 0; i < containerParents.length; i += 1) {
25241          swiper.observer.attach(containerParents[i]);
25242        }
25243      } // Observe container
25244
25245
25246      swiper.observer.attach(swiper.$el[0], {
25247        childList: swiper.params.observeSlideChildren
25248      }); // Observe wrapper
25249
25250      swiper.observer.attach(swiper.$wrapperEl[0], {
25251        attributes: false
25252      });
25253    },
25254    destroy: function destroy() {
25255      var swiper = this;
25256      swiper.observer.observers.forEach(function (observer) {
25257        observer.disconnect();
25258      });
25259      swiper.observer.observers = [];
25260    }
25261  };
25262  var Observer$1 = {
25263    name: 'observer',
25264    params: {
25265      observer: false,
25266      observeParents: false,
25267      observeSlideChildren: false
25268    },
25269    create: function create() {
25270      var swiper = this;
25271      bindModuleMethods(swiper, {
25272        observer: _extends({}, Observer, {
25273          observers: []
25274        })
25275      });
25276    },
25277    on: {
25278      init: function init(swiper) {
25279        swiper.observer.init();
25280      },
25281      destroy: function destroy(swiper) {
25282        swiper.observer.destroy();
25283      }
25284    }
25285  };
25286
25287  var modular = {
25288    useParams: function useParams(instanceParams) {
25289      var instance = this;
25290      if (!instance.modules) return;
25291      Object.keys(instance.modules).forEach(function (moduleName) {
25292        var module = instance.modules[moduleName]; // Extend params
25293
25294        if (module.params) {
25295          extend(instanceParams, module.params);
25296        }
25297      });
25298    },
25299    useModules: function useModules(modulesParams) {
25300      if (modulesParams === void 0) {
25301        modulesParams = {};
25302      }
25303
25304      var instance = this;
25305      if (!instance.modules) return;
25306      Object.keys(instance.modules).forEach(function (moduleName) {
25307        var module = instance.modules[moduleName];
25308        var moduleParams = modulesParams[moduleName] || {}; // Add event listeners
25309
25310        if (module.on && instance.on) {
25311          Object.keys(module.on).forEach(function (moduleEventName) {
25312            instance.on(moduleEventName, module.on[moduleEventName]);
25313          });
25314        } // Module create callback
25315
25316
25317        if (module.create) {
25318          module.create.bind(instance)(moduleParams);
25319        }
25320      });
25321    }
25322  };
25323
25324  /* eslint-disable no-underscore-dangle */
25325  var eventsEmitter = {
25326    on: function on(events, handler, priority) {
25327      var self = this;
25328      if (typeof handler !== 'function') return self;
25329      var method = priority ? 'unshift' : 'push';
25330      events.split(' ').forEach(function (event) {
25331        if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
25332        self.eventsListeners[event][method](handler);
25333      });
25334      return self;
25335    },
25336    once: function once(events, handler, priority) {
25337      var self = this;
25338      if (typeof handler !== 'function') return self;
25339
25340      function onceHandler() {
25341        self.off(events, onceHandler);
25342
25343        if (onceHandler.__emitterProxy) {
25344          delete onceHandler.__emitterProxy;
25345        }
25346
25347        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25348          args[_key] = arguments[_key];
25349        }
25350
25351        handler.apply(self, args);
25352      }
25353
25354      onceHandler.__emitterProxy = handler;
25355      return self.on(events, onceHandler, priority);
25356    },
25357    onAny: function onAny(handler, priority) {
25358      var self = this;
25359      if (typeof handler !== 'function') return self;
25360      var method = priority ? 'unshift' : 'push';
25361
25362      if (self.eventsAnyListeners.indexOf(handler) < 0) {
25363        self.eventsAnyListeners[method](handler);
25364      }
25365
25366      return self;
25367    },
25368    offAny: function offAny(handler) {
25369      var self = this;
25370      if (!self.eventsAnyListeners) return self;
25371      var index = self.eventsAnyListeners.indexOf(handler);
25372
25373      if (index >= 0) {
25374        self.eventsAnyListeners.splice(index, 1);
25375      }
25376
25377      return self;
25378    },
25379    off: function off(events, handler) {
25380      var self = this;
25381      if (!self.eventsListeners) return self;
25382      events.split(' ').forEach(function (event) {
25383        if (typeof handler === 'undefined') {
25384          self.eventsListeners[event] = [];
25385        } else if (self.eventsListeners[event]) {
25386          self.eventsListeners[event].forEach(function (eventHandler, index) {
25387            if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
25388              self.eventsListeners[event].splice(index, 1);
25389            }
25390          });
25391        }
25392      });
25393      return self;
25394    },
25395    emit: function emit() {
25396      var self = this;
25397      if (!self.eventsListeners) return self;
25398      var events;
25399      var data;
25400      var context;
25401
25402      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
25403        args[_key2] = arguments[_key2];
25404      }
25405
25406      if (typeof args[0] === 'string' || Array.isArray(args[0])) {
25407        events = args[0];
25408        data = args.slice(1, args.length);
25409        context = self;
25410      } else {
25411        events = args[0].events;
25412        data = args[0].data;
25413        context = args[0].context || self;
25414      }
25415
25416      data.unshift(context);
25417      var eventsArray = Array.isArray(events) ? events : events.split(' ');
25418      eventsArray.forEach(function (event) {
25419        if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
25420          self.eventsAnyListeners.forEach(function (eventHandler) {
25421            eventHandler.apply(context, [event].concat(data));
25422          });
25423        }
25424
25425        if (self.eventsListeners && self.eventsListeners[event]) {
25426          self.eventsListeners[event].forEach(function (eventHandler) {
25427            eventHandler.apply(context, data);
25428          });
25429        }
25430      });
25431      return self;
25432    }
25433  };
25434
25435  function updateSize() {
25436    var swiper = this;
25437    var width;
25438    var height;
25439    var $el = swiper.$el;
25440
25441    if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
25442      width = swiper.params.width;
25443    } else {
25444      width = $el[0].clientWidth;
25445    }
25446
25447    if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
25448      height = swiper.params.height;
25449    } else {
25450      height = $el[0].clientHeight;
25451    }
25452
25453    if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
25454      return;
25455    } // Subtract paddings
25456
25457
25458    width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);
25459    height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);
25460    if (Number.isNaN(width)) width = 0;
25461    if (Number.isNaN(height)) height = 0;
25462    extend(swiper, {
25463      width: width,
25464      height: height,
25465      size: swiper.isHorizontal() ? width : height
25466    });
25467  }
25468
25469  function updateSlides() {
25470    var swiper = this;
25471
25472    function getDirectionLabel(property) {
25473      if (swiper.isHorizontal()) {
25474        return property;
25475      } // prettier-ignore
25476
25477
25478      return {
25479        'width': 'height',
25480        'margin-top': 'margin-left',
25481        'margin-bottom ': 'margin-right',
25482        'margin-left': 'margin-top',
25483        'margin-right': 'margin-bottom',
25484        'padding-left': 'padding-top',
25485        'padding-right': 'padding-bottom',
25486        'marginRight': 'marginBottom'
25487      }[property];
25488    }
25489
25490    function getDirectionPropertyValue(node, label) {
25491      return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
25492    }
25493
25494    var params = swiper.params;
25495    var $wrapperEl = swiper.$wrapperEl,
25496        swiperSize = swiper.size,
25497        rtl = swiper.rtlTranslate,
25498        wrongRTL = swiper.wrongRTL;
25499    var isVirtual = swiper.virtual && params.virtual.enabled;
25500    var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
25501    var slides = $wrapperEl.children("." + swiper.params.slideClass);
25502    var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
25503    var snapGrid = [];
25504    var slidesGrid = [];
25505    var slidesSizesGrid = [];
25506    var offsetBefore = params.slidesOffsetBefore;
25507
25508    if (typeof offsetBefore === 'function') {
25509      offsetBefore = params.slidesOffsetBefore.call(swiper);
25510    }
25511
25512    var offsetAfter = params.slidesOffsetAfter;
25513
25514    if (typeof offsetAfter === 'function') {
25515      offsetAfter = params.slidesOffsetAfter.call(swiper);
25516    }
25517
25518    var previousSnapGridLength = swiper.snapGrid.length;
25519    var previousSlidesGridLength = swiper.slidesGrid.length;
25520    var spaceBetween = params.spaceBetween;
25521    var slidePosition = -offsetBefore;
25522    var prevSlideSize = 0;
25523    var index = 0;
25524
25525    if (typeof swiperSize === 'undefined') {
25526      return;
25527    }
25528
25529    if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
25530      spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
25531    }
25532
25533    swiper.virtualSize = -spaceBetween; // reset margins
25534
25535    if (rtl) slides.css({
25536      marginLeft: '',
25537      marginBottom: '',
25538      marginTop: ''
25539    });else slides.css({
25540      marginRight: '',
25541      marginBottom: '',
25542      marginTop: ''
25543    });
25544    var slidesNumberEvenToRows;
25545
25546    if (params.slidesPerColumn > 1) {
25547      if (Math.floor(slidesLength / params.slidesPerColumn) === slidesLength / swiper.params.slidesPerColumn) {
25548        slidesNumberEvenToRows = slidesLength;
25549      } else {
25550        slidesNumberEvenToRows = Math.ceil(slidesLength / params.slidesPerColumn) * params.slidesPerColumn;
25551      }
25552
25553      if (params.slidesPerView !== 'auto' && params.slidesPerColumnFill === 'row') {
25554        slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, params.slidesPerView * params.slidesPerColumn);
25555      }
25556    } // Calc slides
25557
25558
25559    var slideSize;
25560    var slidesPerColumn = params.slidesPerColumn;
25561    var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
25562    var numFullColumns = Math.floor(slidesLength / params.slidesPerColumn);
25563
25564    for (var i = 0; i < slidesLength; i += 1) {
25565      slideSize = 0;
25566      var slide = slides.eq(i);
25567
25568      if (params.slidesPerColumn > 1) {
25569        // Set slides order
25570        var newSlideOrderIndex = void 0;
25571        var column = void 0;
25572        var row = void 0;
25573
25574        if (params.slidesPerColumnFill === 'row' && params.slidesPerGroup > 1) {
25575          var groupIndex = Math.floor(i / (params.slidesPerGroup * params.slidesPerColumn));
25576          var slideIndexInGroup = i - params.slidesPerColumn * params.slidesPerGroup * groupIndex;
25577          var columnsInGroup = groupIndex === 0 ? params.slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * slidesPerColumn * params.slidesPerGroup) / slidesPerColumn), params.slidesPerGroup);
25578          row = Math.floor(slideIndexInGroup / columnsInGroup);
25579          column = slideIndexInGroup - row * columnsInGroup + groupIndex * params.slidesPerGroup;
25580          newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
25581          slide.css({
25582            '-webkit-box-ordinal-group': newSlideOrderIndex,
25583            '-moz-box-ordinal-group': newSlideOrderIndex,
25584            '-ms-flex-order': newSlideOrderIndex,
25585            '-webkit-order': newSlideOrderIndex,
25586            order: newSlideOrderIndex
25587          });
25588        } else if (params.slidesPerColumnFill === 'column') {
25589          column = Math.floor(i / slidesPerColumn);
25590          row = i - column * slidesPerColumn;
25591
25592          if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {
25593            row += 1;
25594
25595            if (row >= slidesPerColumn) {
25596              row = 0;
25597              column += 1;
25598            }
25599          }
25600        } else {
25601          row = Math.floor(i / slidesPerRow);
25602          column = i - row * slidesPerRow;
25603        }
25604
25605        slide.css(getDirectionLabel('margin-top'), row !== 0 ? params.spaceBetween && params.spaceBetween + "px" : '');
25606      }
25607
25608      if (slide.css('display') === 'none') continue; // eslint-disable-line
25609
25610      if (params.slidesPerView === 'auto') {
25611        var slideStyles = getComputedStyle(slide[0]);
25612        var currentTransform = slide[0].style.transform;
25613        var currentWebKitTransform = slide[0].style.webkitTransform;
25614
25615        if (currentTransform) {
25616          slide[0].style.transform = 'none';
25617        }
25618
25619        if (currentWebKitTransform) {
25620          slide[0].style.webkitTransform = 'none';
25621        }
25622
25623        if (params.roundLengths) {
25624          slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
25625        } else {
25626          // eslint-disable-next-line
25627          var width = getDirectionPropertyValue(slideStyles, 'width');
25628          var paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
25629          var paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
25630          var marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
25631          var marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
25632          var boxSizing = slideStyles.getPropertyValue('box-sizing');
25633
25634          if (boxSizing && boxSizing === 'border-box') {
25635            slideSize = width + marginLeft + marginRight;
25636          } else {
25637            var _slide$ = slide[0],
25638                clientWidth = _slide$.clientWidth,
25639                offsetWidth = _slide$.offsetWidth;
25640            slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
25641          }
25642        }
25643
25644        if (currentTransform) {
25645          slide[0].style.transform = currentTransform;
25646        }
25647
25648        if (currentWebKitTransform) {
25649          slide[0].style.webkitTransform = currentWebKitTransform;
25650        }
25651
25652        if (params.roundLengths) slideSize = Math.floor(slideSize);
25653      } else {
25654        slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
25655        if (params.roundLengths) slideSize = Math.floor(slideSize);
25656
25657        if (slides[i]) {
25658          slides[i].style[getDirectionLabel('width')] = slideSize + "px";
25659        }
25660      }
25661
25662      if (slides[i]) {
25663        slides[i].swiperSlideSize = slideSize;
25664      }
25665
25666      slidesSizesGrid.push(slideSize);
25667
25668      if (params.centeredSlides) {
25669        slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
25670        if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
25671        if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
25672        if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
25673        if (params.roundLengths) slidePosition = Math.floor(slidePosition);
25674        if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
25675        slidesGrid.push(slidePosition);
25676      } else {
25677        if (params.roundLengths) slidePosition = Math.floor(slidePosition);
25678        if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
25679        slidesGrid.push(slidePosition);
25680        slidePosition = slidePosition + slideSize + spaceBetween;
25681      }
25682
25683      swiper.virtualSize += slideSize + spaceBetween;
25684      prevSlideSize = slideSize;
25685      index += 1;
25686    }
25687
25688    swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
25689    var newSlidesGrid;
25690
25691    if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
25692      $wrapperEl.css({
25693        width: swiper.virtualSize + params.spaceBetween + "px"
25694      });
25695    }
25696
25697    if (params.setWrapperSize) {
25698      var _$wrapperEl$css;
25699
25700      $wrapperEl.css((_$wrapperEl$css = {}, _$wrapperEl$css[getDirectionLabel('width')] = swiper.virtualSize + params.spaceBetween + "px", _$wrapperEl$css));
25701    }
25702
25703    if (params.slidesPerColumn > 1) {
25704      var _$wrapperEl$css2;
25705
25706      swiper.virtualSize = (slideSize + params.spaceBetween) * slidesNumber
25706EvenToRows;
25707      swiper.virtualSize = Math.ceil(swiper.virtualSize / params.slidesPerColumn) - params.spaceBetween;
25708      $wrapperEl.css((_$wrapperEl$css2 = {}, _$wrapperEl$css2[getDirectionLabel('width')] = swiper.virtualSize + params.spaceBetween + "px", _$wrapperEl$css2));
25709
25710      if (params.centeredSlides) {
25711        newSlidesGrid = [];
25712
25713        for (var _i = 0; _i < snapGrid.length; _i += 1) {
25714          var slidesGridItem = snapGrid[_i];
25715          if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
25716          if (snapGrid[_i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
25717        }
25718
25719        snapGrid = newSlidesGrid;
25720      }
25721    } // Remove last grid elements depending on width
25722
25723
25724    if (!params.centeredSlides) {
25725      newSlidesGrid = [];
25726
25727      for (var _i2 = 0; _i2 < snapGrid.length; _i2 += 1) {
25728        var _slidesGridItem = snapGrid[_i2];
25729        if (params.roundLengths) _slidesGridItem = Math.floor(_slidesGridItem);
25730
25731        if (snapGrid[_i2] <= swiper.virtualSize - swiperSize) {
25732          newSlidesGrid.push(_slidesGridItem);
25733        }
25734      }
25735
25736      snapGrid = newSlidesGrid;
25737
25738      if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
25739        snapGrid.push(swiper.virtualSize - swiperSize);
25740      }
25741    }
25742
25743    if (snapGrid.length === 0) snapGrid = [0];
25744
25745    if (params.spaceBetween !== 0) {
25746      var _slides$filter$css;
25747
25748      var key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
25749      slides.filter(function (_, slideIndex) {
25750        if (!params.cssMode) return true;
25751
25752        if (slideIndex === slides.length - 1) {
25753          return false;
25754        }
25755
25756        return true;
25757      }).css((_slides$filter$css = {}, _slides$filter$css[key] = spaceBetween + "px", _slides$filter$css));
25758    }
25759
25760    if (params.centeredSlides && params.centeredSlidesBounds) {
25761      var allSlidesSize = 0;
25762      slidesSizesGrid.forEach(function (slideSizeValue) {
25763        allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
25764      });
25765      allSlidesSize -= params.spaceBetween;
25766      var maxSnap = allSlidesSize - swiperSize;
25767      snapGrid = snapGrid.map(function (snap) {
25768        if (snap < 0) return -offsetBefore;
25769        if (snap > maxSnap) return maxSnap + offsetAfter;
25770        return snap;
25771      });
25772    }
25773
25774    if (params.centerInsufficientSlides) {
25775      var _allSlidesSize = 0;
25776      slidesSizesGrid.forEach(function (slideSizeValue) {
25777        _allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
25778      });
25779      _allSlidesSize -= params.spaceBetween;
25780
25781      if (_allSlidesSize < swiperSize) {
25782        var allSlidesOffset = (swiperSize - _allSlidesSize) / 2;
25783        snapGrid.forEach(function (snap, snapIndex) {
25784          snapGrid[snapIndex] = snap - allSlidesOffset;
25785        });
25786        slidesGrid.forEach(function (snap, snapIndex) {
25787          slidesGrid[snapIndex] = snap + allSlidesOffset;
25788        });
25789      }
25790    }
25791
25792    extend(swiper, {
25793      slides: slides,
25794      snapGrid: snapGrid,
25795      slidesGrid: slidesGrid,
25796      slidesSizesGrid: slidesSizesGrid
25797    });
25798
25799    if (slidesLength !== previousSlidesLength) {
25800      swiper.emit('slidesLengthChange');
25801    }
25802
25803    if (snapGrid.length !== previousSnapGridLength) {
25804      if (swiper.params.watchOverflow) swiper.checkOverflow();
25805      swiper.emit('snapGridLengthChange');
25806    }
25807
25808    if (slidesGrid.length !== previousSlidesGridLength) {
25809      swiper.emit('slidesGridLengthChange');
25810    }
25811
25812    if (params.watchSlidesProgress || params.watchSlidesVisibility) {
25813      swiper.updateSlidesOffset();
25814    }
25815  }
25816
25817  function updateAutoHeight(speed) {
25818    var swiper = this;
25819    var activeSlides = [];
25820    var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
25821    var newHeight = 0;
25822    var i;
25823
25824    if (typeof speed === 'number') {
25825      swiper.setTransition(speed);
25826    } else if (speed === true) {
25827      swiper.setTransition(swiper.params.speed);
25828    }
25829
25830    var getSlideByIndex = function getSlideByIndex(index) {
25831      if (isVirtual) {
25832        return swiper.slides.filter(function (el) {
25833          return parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index;
25834        })[0];
25835      }
25836
25837      return swiper.slides.eq(index)[0];
25838    }; // Find slides currently in view
25839
25840
25841    if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
25842      if (swiper.params.centeredSlides) {
25843        swiper.visibleSlides.each(function (slide) {
25844          activeSlides.push(slide);
25845        });
25846      } else {
25847        for (i = 0;
25847 i < Math.ceil(swiper.params.slidesPerView); i += 1) {
25848          var index = swiper.activeIndex + i;
25849          if (index > swiper.slides.length && !isVirtual) break;
25850          activeSlides.push(getSlideByIndex(index));
25851        }
25852      }
25853    } else {
25854      activeSlides.push(getSlideByIndex(swiper.activeIndex));
25855    } // Find new height from highest slide in view
25856
25857
25858    for (i = 0; i < activeSlides.length; i += 1) {
25859      if (typeof activeSlides[i] !== 'undefined') {
25860        var height = activeSlides[i].offsetHeight;
25861        newHeight = height > newHeight ? height : newHeight;
25862      }
25863    } // Update Height
25864
25865
25866    if (newHeight) swiper.$wrapperEl.css('height', newHeight + "px");
25867  }
25868
25869  function updateSlidesOffset() {
25870    var swiper = this;
25871    var slides = swiper.slides;
25872
25873    for (var i = 0; i < slides.length; i += 1) {
25874      slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
25875    }
25876  }
25877
25878  function updateSlidesProgress(translate) {
25879    if (translate === void 0) {
25880      translate = this && this.translate || 0;
25881    }
25882
25883    var swiper = this;
25884    var params = swiper.params;
25885    var slides = swiper.slides,
25886        rtl = swiper.rtlTranslate;
25887    if (slides.length === 0) return;
25888    if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
25889    var offsetCenter = -translate;
25890    if (rtl) offsetCenter = translate; // Visible Slides
25891
25892    slides.removeClass(params.slideVisibleClass);
25893    swiper.visibleSlidesIndexes = [];
25894    swiper.visibleSlides = [];
25895
25896    for (var i = 0; i < slides.length; i += 1) {
25897      var slide = slides[i];
25898      var slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + params.spaceBetween);
25899
25900      if (params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) {
25901        var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
25902        var slideAfter = slideBefore + swiper.slidesSizesGrid[i];
25903        var isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
25904
25905        if (isVisible) {
25906          swiper.visibleSlides.push(slide);
25907          swiper.visibleSlidesIndexes.push(i);
25908          slides.eq(i).addClass(params.slideVisibleClass);
25909        }
25910      }
25911
25912      slide.progress = rtl ? -slideProgress : slideProgress;
25913    }
25914
25915    swiper.visibleSlides = $(swiper.visibleSlides);
25916  }
25917
25918  function updateProgress(translate) {
25919    var swiper = this;
25920
25921    if (typeof translate === 'undefined') {
25922      var multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line
25923
25924      translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
25925    }
25926
25927    var params = swiper.params;
25928    var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
25929    var progress = swiper.progress,
25930        isBeginning = swiper.isBeginning,
25931        isEnd = swiper.isEnd;
25932    var wasBeginning = isBeginning;
25933    var wasEnd = isEnd;
25934
25935    if (translatesDiff === 0) {
25936      progress = 0;
25937      isBeginning = true;
25938      isEnd = true;
25939    } else {
25940      progress = (translate - swiper.minTranslate()) / translatesDiff;
25941      isBeginning = progress <= 0;
25942      isEnd = progress >= 1;
25943    }
25944
25945    extend(swiper, {
25946      progress: progress,
25947      isBeginning: isBeginning,
25948      isEnd: isEnd
25949    });
25950    if (params.watchSlidesProgress || params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
25951
25952    if (isBeginning && !wasBeginning) {
25953      swiper.emit('reachBeginning toEdge');
25954    }
25955
25956    if (isEnd && !wasEnd) {
25957      swiper.emit('reachEnd toEdge');
25958    }
25959
25960    if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
25961      swiper.emit('fromEdge');
25962    }
25963
25964    swiper.emit('progress', progress);
25965  }
25966
25967  function updateSlidesClasses() {
25968    var swiper = this;
25969    var slides = swiper.slides,
25970        params = swiper.params,
25971        $wrapperEl = swiper.$wrapperEl,
25972        activeIndex = swiper.activeIndex,
25973        realIndex = swiper.realIndex;
25974    var isVirtual = swiper.virtual && params.virtual.enabled;
25975    slides.removeClass(params.slideActiveClass + " " + params.slideNextClass + " " + params.slidePrevClass + " " + params.slideDuplicateActiveClass + " " + params.slideDuplicateNextClass + " " + params.slideDuplicatePrevClass);
25976    var activeSlide;
25977
25978    if (isVirtual) {
25979      activeSlide = swiper.$wrapperEl.find("." + params.slideClass + "[data-swiper-slide-index=\"" + activeIndex + "\"]");
25980    } else {
25981      activeSlide = slides.eq(activeIndex);
25982    } // Active classes
25983
25984
25985    activeSlide.addClass(params.slideActiveClass);
25986
25987    if (params.loop) {
25988      // Duplicate to all looped slides
25989      if (activeSlide.hasClass(params.slideDuplicateClass)) {
25990        $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + realIndex + "\"]").addClass(params.slideDuplicateActiveClass);
25991      } else {
25992        $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + realIndex + "\"]").addClass(params.slideDuplicateActiveClass);
25993      }
25994    } // Next Slide
25995
25996
25997    var nextSlide = activeSlide.nextAll("." + params.slideClass).eq(0).addClass(params.slideNextClass);
25998
25999    if (params.loop && nextSlide.length === 0) {
26000      nextSlide = slides.eq(0);
26001      nextSlide.addClass(params.slideNextClass);
26002    } // Prev Slide
26003
26004
26005    var prevSlide = activeSlide.prevAll("." + params.slideClass).eq(0).addClass(params.slidePrevClass);
26006
26007    if (params.loop && prevSlide.length === 0) {
26008      prevSlide = slides.eq(-1);
26009      prevSlide.addClass(params.slidePrevClass);
26010    }
26011
26012    if (params.loop) {
26013      // Duplicate to all looped slides
26014      if (nextSlide.hasClass(params.slideDuplicateClass)) {
26015        $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + nextSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicateNextClass);
26016      } else {
26017        $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + nextSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicateNextClass);
26018      }
26019
26020      if (prevSlide.hasClass(params.slideDuplicateClass)) {
26021        $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + prevSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicatePrevClass);
26022      } else {
26023        $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + prevSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicatePrevClass);
26024      }
26025    }
26026
26027    swiper.emitSlidesClasses();
26028  }
26029
26030  function updateActiveIndex(newActiveIndex) {
26031    var swiper = this;
26032    var translate = swiper.rtlTranslate ? swiper.translate : -swi
26032per.translate;
26033    var slidesGrid = swiper.slidesGrid,
26034        snapGrid = swiper.snapGrid,
26035        params = swiper.params,
26036        previousIndex = swiper.activeIndex,
26037        previousRealIndex = swiper.realIndex,
26038        previousSnapIndex = swiper.snapIndex;
26039    var activeIndex = newActiveIndex;
26040    var snapIndex;
26041
26042    if (typeof activeIndex === 'undefined') {
26043      for (var i = 0; i < slidesGrid.length; i += 1) {
26044        if (typeof slidesGrid[i + 1] !== 'undefined') {
26045          if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
26046            activeIndex = i;
26047          } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
26048            activeIndex = i + 1;
26049          }
26050        } else if (translate >= slidesGrid[i]) {
26051          activeIndex = i;
26052        }
26053      } // Normalize slideIndex
26054
26055
26056      if (params.normalizeSlideIndex) {
26057        if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
26058      }
26059    }
26060
26061    if (snapGrid.indexOf(translate) >= 0) {
26062      snapIndex = snapGrid.indexOf(translate);
26063    } else {
26064      var skip = Math.min(params.slidesPerGroupSkip, activeIndex);
26065      snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
26066    }
26067
26068    if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
26069
26070    if (activeIndex === previousIndex) {
26071      if (snapIndex !== previousSnapIndex) {
26072        swiper.snapIndex = snapIndex;
26073        swiper.emit('snapIndexChange');
26074      }
26075
26076      return;
26077    } // Get real index
26078
26079
26080    var realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
26081    extend(swiper, {
26082      snapIndex: snapIndex,
26083      realIndex: realIndex,
26084      previousIndex: previousIndex,
26085      activeIndex: activeIndex
26086    });
26087    swiper.emit('activeIndexChange');
26088    swiper.emit('snapIndexChange');
26089
26090    if (previousRealIndex !== realIndex) {
26091      swiper.emit('realIndexChange');
26092    }
26093
26094    if (swiper.initialized || swiper.params.runCallbacksOnInit) {
26095      swiper.emit('slideChange');
26096    }
26097  }
26098
26099  function updateClickedSlide(e) {
26100    var swiper = this;
26101    var params = swiper.params;
26102    var slide = $(e.target).closest("." + params.slideClass)[0];
26103    var slideFound = false;
26104    var slideIndex;
26105
26106    if (slide) {
26107      for (var i = 0; i < swiper.slides.length; i += 1) {
26108        if (swiper.slides[i] === slide) {
26109          slideFound = true;
26110          slideIndex = i;
26111          break;
26112        }
26113      }
26114    }
26115
26116    if (slide && slideFound) {
26117      swiper.clickedSlide = slide;
26118
26119      if (swiper.virtual && swiper.params.virtual.enabled) {
26120        swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10);
26121      } else {
26122        swiper.clickedIndex = slideIndex;
26123      }
26124    } else {
26125      swiper.clickedSlide = undefined;
26126      swiper.clickedIndex = undefined;
26127      return;
26128    }
26129
26130    if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
26131      swiper.slideToClickedSlide();
26132    }
26133  }
26134
26135  var update = {
26136    updateSize: updateSize,
26137    updateSlides: updateSlides,
26138    updateAutoHeight: updateAutoHeight,
26139    updateSlidesOffset: updateSlidesOffset,
26140    updateSlidesProgress: updateSlidesProgress,
26141    updateProgress: updateProgress,
26142    updateSlidesClasses: updateSlidesClasses,
26143    updateActiveIndex: updateActiveIndex,
26144    updateClickedSlide: updateClickedSlide
26145  };
26146
26147  function getSwiperTranslate(axis) {
26148    if (axis === void 0) {
26149      axis = this.isHorizontal() ? 'x' : 'y';
26150    }
26151
26152    var swiper = this;
26153    var params = swiper.params,
26154        rtl = swiper.rtlTranslate,
26155        translate = swiper.translate,
26156        $wrapperEl = swiper.$wrapperEl;
26157
26158    if (params.virtualTranslate) {
26159      return rtl ? -translate : translate;
26160    }
26161
26162    if (params.cssMode) {
26163      return translate;
26164    }
26165
26166    var currentTranslate = getTranslate($wrapperEl[0], axis);
26167    if (rtl) currentTranslate = -currentTranslate;
26168    return currentTranslate || 0;
26169  }
26170
26171  function setTranslate(translate, byController) {
26172    var swiper = this;
26173    var rtl = swiper.rtlTranslate,
26174        params = swiper.params,
26175        $wrapperEl = swiper.$wrapperEl,
26176        wrapperEl = swiper.wrapperEl,
26177        progress = swiper.progress;
26178    var x = 0;
26179    var y = 0;
26180    var z = 0;
26181
26182    if (swiper.isHorizontal()) {
26183      x = rtl ? -translate : translate;
26184    } else {
26185      y = translate;
26186    }
26187
26188    if (params.roundLengths) {
26189      x = Math.floor(x);
26190      y = Math.floor(y);
26191    }
26192
26193    if (params.cssMode) {
26194      wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
26195    } else if (!params.virtualTranslate) {
26196      $wrapperEl.transform("translate3d(" + x + "px, " + y + "px, " + z + "px)");
26197    }
26198
26199    swiper.previousTranslate = swiper.translate;
26200    swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress
26201
26202    var newProgress;
26203    var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
26204
26205    if (translatesDiff === 0) {
26206      newProgress = 0;
26207    } else {
26208      newProgress = (translate - swiper.minTranslate()) / translatesDiff;
26209    }
26210
26211    if (newProgress !== progress) {
26212      swiper.updateProgress(translate);
26213    }
26214
26215    swiper.emit('setTranslate', swiper.translate, byController);
26216  }
26217
26218  function minTranslate() {
26219    return -this.snapGrid[0];
26220  }
26221
26222  function maxTranslate() {
26223    return -this.snapGrid[this.snapGrid.length - 1];
26224  }
26225
26226  function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
26227    if (translate === void 0) {
26228      translate = 0;
26229    }
26230
26231    if (speed === void 0) {
26232      speed = this.params.speed;
26233    }
26234
26235    if (runCallbacks === void 0) {
26236      runCallbacks = true;
26237    }
26238
26239    if (translateBounds === void 0) {
26240      translateBounds = true;
26241    }
26242
26243    var swiper = this;
26244    var params = swiper.params,
26245        wrapperEl = swiper.wrapperEl;
26246
26247    if (swiper.animating && params.preventInteractionOnTransition) {
26248      return false;
26249    }
26250
26251    var minTranslate = swiper.minTranslate();
26252    var maxTranslate = swiper.maxTranslate();
26253    var newTranslate;
26254    if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress
26255
26256    swiper.updateProgress(newTranslate);
26257
26258    if (params.cssMode) {
26259      var isH = swiper.isHorizontal();
26260
26261      if (speed === 0) {
26262        wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
26263      } else {
26264        // eslint-disable-next-line
26265        if (wrapperEl.scrollTo) {
26266          var _wrapperEl$scrollTo;
26267
26268          wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = -newTranslate, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));
26269        } else {
26270          wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
26271        }
26272      }
26273
26274      return true;
26275    }
26276
26277    if (speed === 0) {
26278      swiper.setTransition(0);
26279      swiper.setTranslate(newTranslate);
26280
26281      if (runCallbacks) {
26282        swiper.emit('beforeTransitionStart', speed, internal);
26283        swiper.emit('transitionEnd');
26284      }
26285    } else {
26286      swiper.setTransition(speed);
26287      swiper.setTranslate(newTranslate);
26288
26289      if (runCallbacks) {
26290        swiper.emit('beforeTransitionStart', speed, internal);
26291        swiper.emit('transitionStart');
26292      }
26293
26294      if (!swiper.animating) {
26295        swiper.animating = true;
26296
26297        if (!swiper.onTranslateToWrapperTransitionEnd) {
26298          swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
26299            if (!swiper || swiper.destroyed) return;
26300            if (e.target !== this) return;
26301            swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
26302            swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
26303            swiper.onTranslateToWrapperTransitionEnd = null;
26304            delete swiper.onTranslateToWrapperTransitionEnd;
26305
26306            if (runCallbacks) {
26307              swiper.emit('transitionEnd');
26308            }
26309          };
26310        }
26311
26312        swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
26313        swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
26314      }
26315    }
26316
26317    return true;
26318  }
26319
26320  var translate = {
26321    getTranslate: getSwiperTranslate,
26322    setTranslate: setTranslate,
26323    minTranslate: minTranslate,
26324    maxTranslate: maxTranslate,
26325    translateTo: translateTo
26326  };
26327
26328  function setTransition(duration, byController) {
26329    var swiper = this;
26330
26331    if (!swiper.params.cssMode) {
26332      swiper.$wrapperEl.transition(duration);
26333    }
26334
26335    swiper.emit('setTransition', duration, byController);
26336  }
26337
26338  function transitionStart(runCallbacks, direction) {
26339    if (runCallbacks === void 0) {
26340      runCallbacks = true;
26341    }
26342
26343    var swiper = this;
26344    var activeIndex = swiper.activeIndex,
26345        params = swiper.params,
26346        previousIndex = swiper.previousIndex;
26347    if (params.cssMode) return;
26348
26349    if (params.autoHeight) {
26350      swiper.updateAutoHeight();
26351    }
26352
26353    var dir = direction;
26354
26355    if (!dir) {
26356      if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
26357    }
26358
26359    swiper.emit('transitionStart');
26360
26361    if (runCallbacks && activeIndex !== previousIndex) {
26362      if (dir === 'reset') {
26363        swiper.emit('slideResetTransitionStart');
26364        return;
26365      }
26366
26367      swiper.emit('slideChangeTransitionStart');
26368
26369      if (dir === 'next') {
26370        swiper.emit('slideNextTransitionStart');
26371      } else {
26372        swiper.emit('slidePrevTransitionStart');
26373      }
26374    }
26375  }
26376
26377  function transitionEnd(runCallbacks, direction) {
26378    if (runCallbacks === void 0) {
26379      runCallbacks = true;
26380    }
26381
26382    var swiper = this;
26383    var activeIndex = swiper.activeIndex,
26384        previousIndex = swiper.previousIndex,
26385        params = swiper.params;
26386    swiper.animating = false;
26387    if (params.cssMode) return;
26388    swiper.setTransition(0);
26389    var dir = direction;
26390
26391    if (!dir) {
26392      if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
26393    }
26394
26395    swiper.emit('transitionEnd');
26396
26397    if (runCallbacks && activeIndex !== previousIndex) {
26398      if (dir === 'reset') {
26399        swiper.emit('slideResetTransitionEnd');
26400        return;
26401      }
26402
26403      swiper.emit('slideChangeTransitionEnd');
26404
26405      if (dir === 'next') {
26406        swiper.emit('slideNextTransitionEnd');
26407      } else {
26408        swiper.emit('slidePrevTransitionEnd');
26409      }
26410    }
26411  }
26412
26413  var transition = {
26414    setTransition: setTransition,
26415    transitionStart: transitionStart,
26416    transitionEnd: transitionEnd
26417  };
26418
26419  function slideTo(index, speed, runCallbacks, internal, initial) {
26420    if (index === void 0) {
26421      index = 0;
26422    }
26423
26424    if (speed === void 0) {
26425      speed = this.params.speed;
26426    }
26427
26428    if (runCallbacks === void 0) {
26429      runCallbacks = true;
26430    }
26431
26432    if (typeof index !== 'number' && typeof index !== 'string') {
26433      throw new Error("The 'index' argument cannot have type other than 'number' or 'string'. [" + typeof index + "] given.");
26434    }
26435
26436    if (typeof index === 'string') {
26437      /**
26438       * The `index` argument converted from `string` to `number`.
26439       * @type {number}
26440       */
26441      var indexAsNumber = parseInt(index, 10);
26442      /**
26443       * Determines whether the `index` argument is a valid `number`
26444       * after being converted from the `string` type.
26445       * @type {boolean}
26446       */
26447
26448      var isValidNumber = isFinite(indexAsNumber);
26449
26450      if (!isValidNumber) {
26451        throw new Error("The passed-in 'index' (string) couldn't be converted to 'number'. [" + index + "] given.");
26452      } // Knowing that the converted `index` is a valid number,
26453      // we can update the original argument's value.
26454
26455
26456      index = indexAsNumber;
26457    }
26458
26459    var swiper = this;
26460    var slideIndex = index;
26461    if (slideIndex < 0) slideIndex = 0;
26462    var params = swiper.params,
26463        snapGrid = swiper.snapGrid,
26464        slidesGrid = swiper.slidesGrid,
26465        previousIndex = swiper.previousIndex,
26466        activeIndex = swiper.activeIndex,
26467        rtl = swiper.rtlTranslate,
26468        wrapperEl = swiper.wrapperEl,
26469        enabled = swiper.enabled;
26470
26471    if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
26472      return false;
26473    }
26474
26475    var skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
26476    var snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
26477    if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
26478
26479    if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {
26480      swiper.emit('beforeSlideChangeStart');
26481    }
26482
26483    var translate = -snapGrid[snapIndex]; // Update progress
26484
26485    swiper.updateProgress(translate); // Normalize slideIndex
26486
26487    if (params.normalizeSlideIndex) {
26488      for (var i = 0; i < slidesGrid.length; i += 1) {
26489        var normalizedTranslate = -Math.floor(translate * 100);
26490        var normalizedGird = Math.floor(slidesGrid[i] * 100);
26491        var normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
26492
26493        if (typeof slidesGrid[i + 1] !== 'undefined') {
26494          if (normalizedTranslate >= normalizedGird && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGird) / 2) {
26495            slideIndex = i;
26496          } else if (normalizedTranslate >= normalizedGird && normalizedTranslate < normalizedGridNext) {
26497            slideIndex = i + 1;
26498          }
26499        } else if (normalizedTranslate >= normalizedGird) {
26500          slideIndex = i;
26501        }
26502      }
26503    } // Directions locks
26504
26505
26506    if (swiper.initialized && slideIndex !== activeIndex) {
26507      if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
26508        return false;
26509      }
26510
26511      if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
26512        if ((activeIndex || 0) !== slideIndex) return false;
26513      }
26514    }
26515
26516    var direction;
26517    if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index
26518
26519    if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
26520      swiper.updateActiveIndex(slideIndex); // Update Height
26521
26522      if (params.autoHeight) {
26523        swiper.updateAutoHeight();
26524      }
26525
26526      swiper.updateSlidesClasses();
26527
26528      if (params.effect !== 'slide') {
26529        swiper.setTranslate(translate);
26530      }
26531
26532      if (direction !== 'reset') {
26533        swiper.transitionStart(runCallbacks, direction);
26534        swiper.transitionEnd(runCallbacks, direction);
26535      }
26536
26537      return false;
26538    }
26539
26540    if (params.cssMode) {
26541      var isH = swiper.isHorizontal();
26542      var t = -translate;
26543
26544      if (rtl) {
26545        t = wrapperEl.scrollWidth - wrapperEl.offsetWidth - t;
26546      }
26547
26548      if (speed === 0) {
26549        wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
26550      } else {
26551        // eslint-disable-next-line
26552        if (wrapperEl.scrollTo) {
26553          var _wrapperEl$scrollTo;
26554
26555          wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = t, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));
26556        } else {
26557          wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
26558        }
26559      }
26560
26561      return true;
26562    }
26563
26564    if (speed === 0) {
26565      swiper.setTransition(0);
26566      swiper.setTranslate(translate);
26567      swiper.updateActiveIndex(slideIndex);
26568      swiper.updateSlidesClasses();
26569      swiper.emit('beforeTransitionStart', speed, internal);
26570      swiper.transitionStart(runCallbacks, direction);
26571      swiper.transitionEnd(runCallbacks, direction);
26572    } else {
26573      swiper.setTransition(speed);
26574      swiper.setTranslate(translate);
26575      swiper.updateActiveIndex(slideIndex);
26576      swiper.updateSlidesClasses();
26577      swiper.emit('beforeTransitionStart', speed, internal);
26578      swiper.transitionStart(runCallbacks, direction);
26579
26580      if (!swiper.animating) {
26581        swiper.animating = true;
26582
26583        if (!swiper.onSlideToWrapperTransitionEnd) {
26584          swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
26585            if (!swiper || swiper.destroyed) return;
26586            if (e.target !== this) return;
26587            swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
26588            swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
26589            swiper.onSlideToWrapperTransitionEnd = null;
26590            delete swiper.onSlideToWrapperTransitionEnd;
26591            swiper.transitionEnd(runCallbacks, direction);
26592          };
26593        }
26594
26595        swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
26596        swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
26597      }
26598    }
26599
26600    return true;
26601  }
26602
26603  function slideToLoop(index, speed, runCallbacks, internal) {
26604    if (index === void 0) {
26605      index = 0;
26606    }
26607
26608    if (speed === void 0) {
26609      speed = this.params.speed;
26610    }
26611
26612    if (runCallbacks === void 0) {
26613      runCallbacks = true;
26614    }
26615
26616    var swiper = this;
26617    var newIndex = index;
26618
26619    if (swiper.params.loop) {
26620      newIndex += swiper.loopedSlides;
26621    }
26622
26623    return swiper.slideTo(newIndex, speed, runCallbacks, internal);
26624  }
26625
26626  /* eslint no-unused-vars: "off" */
26627  function slideNext(speed, runCallbacks, internal) {
26628    if (speed === void 0) {
26629      speed = this.params.speed;
26630    }
26631
26632    if (runCallbacks === void 0) {
26633      runCallbacks = true;
26634    }
26635
26636    var swiper = this;
26637    var params = swiper.params,
26638        animating = swiper.animating,
26639        enabled = swiper.enabled;
26640    if (!enabled) return swiper;
26641    var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup;
26642
26643    if (params.loop) {
26644      if (animating && params.loopPreventsSlide) return false;
26645      swiper.loopFix(); // eslint-disable-next-line
26646
26647      swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
26648    }
26649
26650    return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
26651  }
26652
26653  /* eslint no-unused-vars: "off" */
26654  function slidePrev(speed, runCallbacks, internal) {
26655    if (speed === void 0) {
26656      speed = this.params.speed;
26657    }
26658
26659    if (runCallbacks === void 0) {
26660      runCallbacks = true;
26661    }
26662
26663    var swiper = this;
26664    var params = swiper.params,
26665        animating = swiper.animating,
26666        snapGrid = swiper.snapGrid,
26667        slidesGrid = swiper.slidesGrid,
26668        rtlTranslate = swiper.rtlTranslate,
26669        enabled = swiper.enabled;
26670    if (!enabled) return swiper;
26671
26672    if (params.loop) {
26673      if (animating && params.loopPreventsSlide) return false;
26674      swiper.loopFix(); // eslint-disable-next-line
26675
26676      swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
26677    }
26678
26679    var translate = rtlTranslate ? swiper.translate : -swiper.translate;
26680
26681    function normalize(val) {
26682      if (val < 0) return -Math.floor(Math.abs(val));
26683      return Math.floor(val);
26684    }
26685
26686    var normalizedTranslate = normalize(translate);
26687    var normalizedSnapGrid = snapGrid.map(function (val) {
26688      return normalize(val);
26689    });
26690    var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
26691
26692    if (typeof prevSnap === 'undefined' && params.cssMode) {
26693      snapGrid.forEach(function (snap) {
26694        if (!prevSnap && normalizedTranslate >= snap) prevSnap = snap;
26695      });
26696    }
26697
26698    var prevIndex;
26699
26700    if (typeof prevSnap !== 'undefined') {
26701      prevIndex = slidesGrid.indexOf(prevSnap);
26702      if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
26703    }
26704
26705    return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
26706  }
26707
26708  /* eslint no-unused-vars: "off" */
26709  function slideReset(speed, runCallbacks, internal) {
26710    if (speed === void 0) {
26711      speed = this.params.speed;
26712    }
26713
26714    if (runCallbacks === void 0) {
26715      runCallbacks = true;
26716    }
26717
26718    var swiper = this;
26719    return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
26720  }
26721
26722  /* eslint no-unused-vars: "off" */
26723  function slideToClosest(speed, runCallbacks, internal, threshold) {
26724    if (speed === void 0) {
26725      speed = this.params.speed;
26726    }
26727
26728    if (runCallbacks === void 0) {
26729      runCallbacks = true;
26730    }
26731
26732    if (threshold === void 0) {
26733      threshold = 0.5;
26734    }
26735
26736    var swiper = this;
26737    var index = swiper.activeIndex;
26738    var skip = Math.min(swiper.params.slidesPerGroupSkip, index);
26739    var snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
26740    var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
26741
26742    if (translate >= swiper.snapGrid[snapIndex]) {
26743      // The current translate is on or after the current snap index, so the choice
26744      // is between the current index and the one after it.
26745      var currentSnap = swiper.snapGrid[snapIndex];
26746      var nextSnap = swiper.snapGrid[snapIndex + 1];
26747
26748      if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
26749        index += swiper.params.slidesPerGroup;
26750      }
26751    } else {
26752      // The current translate is before the current snap index, so the choice
26753      // is between the current index and the one before it.
26754      var prevSnap = swiper.snapGrid[snapIndex - 1];
26755      var _currentSnap = swiper.snapGrid[snapIndex];
26756
26757      if (translate - prevSnap <= (_currentSnap - prevSnap) * threshold) {
26758        index -= swiper.params.slidesPerGroup;
26759      }
26760    }
26761
26762    index = Math.max(index, 0);
26763    index = Math.min(index, swiper.slidesGrid.length - 1);
26764    return swiper.slideTo(index, speed, runCallbacks, internal);
26765  }
26766
26767  function slideToClickedSlide() {
26768    var swiper = this;
26769    var params = swiper.params,
26770        $wrapperEl = swiper.$wrapperEl;
26771    var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
26772    var slideToIndex = swiper.clickedIndex;
26773    var realIndex;
26774
26775    if (params.loop) {
26776      if (swiper.animating) return;
26777      realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
26778
26779      if (params.centeredSlides) {
26780        if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
26781          swiper.loopFix();
26782          slideToIndex = $wrapperEl.children("." + params.slideClass + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + params.slideDuplicateClass + ")").eq(0).index();
26783          nextTick(function () {
26784            swiper.slideTo(slideToIndex);
26785          });
26786        } else {
26787          swiper.slideTo(slideToIndex);
26788        }
26789      } else if (slideToIndex > swiper.slides.length - slidesPerView) {
26790        swiper.loopFix();
26791        slideToIndex = $wrapperEl.children("." + params.slideClass + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + params.slideDuplicateClass + ")").eq(0).index();
26792        nextTick(function () {
26793          swiper.slideTo(slideToIndex);
26794        });
26795      } else {
26796        swiper.slideTo(slideToIndex);
26797      }
26798    } else {
26799      swiper.slideTo(slideToIndex);
26800    }
26801  }
26802
26803  var slide = {
26804    slideTo: slideTo,
26805    slideToLoop: slideToLoop,
26806    slideNext: slideNext,
26807    slidePrev: slidePrev,
26808    slideReset: slideReset,
26809    slideToClosest: slideToClosest,
26810    slideToClickedSlide: slideToClickedSlide
26811  };
26812
26813  function loopCreate() {
26814    var swiper = this;
26815    var document = getDocument();
26816    var params = swiper.params,
26817        $wrapperEl = swiper.$wrapperEl; // Remove duplicated slides
26818
26819    $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass).remove();
26820    var slides = $wrapperEl.children("." + params.slideClass);
26821
26822    if (params.loopFillGroupWithBlank) {
26823      var blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;
26824
26825      if (blankSlidesNum !== params.slidesPerGroup) {
26826        for (var i = 0; i < blankSlidesNum; i += 1) {
26827          var blankNode = $(document.createElement('div')).addClass(params.slideClass + " " + params.slideBlankClass);
26828          $wrapperEl.append(blankNode);
26829        }
26830
26831        slides = $wrapperEl.children("." + params.slideClass);
26832      }
26833    }
26834
26835    if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
26836    swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
26837    swiper.loopedSlides += params.loopAdditionalSlides;
26838
26839    if (swiper.loopedSlides > slides.length) {
26840      swiper.loopedSlides = slides.length;
26841    }
26842
26843    var prependSlides = [];
26844    var appendSlides = [];
26845    slides.each(function (el, index) {
26846      var slide = $(el);
26847
26848      if (index < swiper.loopedSlides) {
26849        appendSlides.push(el);
26850      }
26851
26852      if (index < slides.length && index >= slides.length - swiper.loopedSlides) {
26853        prependSlides.push(el);
26854      }
26855
26856      slide.attr('data-swiper-slide-index', index);
26857    });
26858
26859    for (var _i = 0; _i < appendSlides.length; _i += 1) {
26860      $wrapperEl.append($(appendSlides[_i].cloneNode(true)).addClass(params.slideDuplicateClass));
26861    }
26862
26863    for (var _i2 = prependSlides.length - 1; _i2 >= 0; _i2 -= 1) {
26864      $wrapperEl.prepend($(prependSlides[_i2].cloneNode(true)).addClass(params.slideDuplicateClass));
26865    }
26866  }
26867
26868  function loopFix() {
26869    var swiper = this;
26870    swiper.emit('beforeLoopFix');
26871    var activeIndex = swiper.activeIndex,
26872        slides = swiper.slides,
26873        loopedSlides = swiper.loopedSlides,
26874        allowSlidePrev = swiper.allowSlidePrev,
26875        allowSlideNext = swiper.allowSlideNext,
26876        snapGrid = swiper.snapGrid,
26877        rtl = swiper.rtlTranslate;
26878    var newIndex;
26879    swiper.allowSlidePrev = true;
26880    swiper.allowSlideNext = true;
26881    var snapTranslate = -snapGrid[activeIndex];
26882    var diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding
26883
26884    if (activeIndex < loopedSlides) {
26885      newIndex = slides.length - loopedSlides * 3 + activeIndex;
26886      newIndex += loopedSlides;
26887      var slideChanged = swiper.slideTo(newIndex, 0, false, true);
26888
26889      if (slideChanged && diff !== 0) {
26890        swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
26891      }
26892    } else if (activeIndex >= slides.length - loopedSlides) {
26893      // Fix For Positive Oversliding
26894      newIndex = -slides.length + activeIndex + loopedSlides;
26895      newIndex += loopedSlides;
26896
26897      var _slideChanged = swiper.slideTo(newIndex, 0, false, true);
26898
26899      if (_slideChanged && diff !== 0) {
26900        swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
26901      }
26902    }
26903
26904    swiper.allowSlidePrev = allowSlidePrev;
26905    swiper.allowSlideNext = allowSlideNext;
26906    swiper.emit('loopFix');
26907  }
26908
26909  function loopDestroy() {
26910    var swiper = this;
26911    var $wrapperEl = swiper.$wrapperEl,
26912        params = swiper.params,
26913        slides = swiper.slides;
26914    $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + ",." + params.slideClass + "." + params.slideBlankClass).remove();
26915    slides.removeAttr('data-swiper-slide-index');
26916  }
26917
26918  var loop = {
26919    loopCreate: loopCreate,
26920    loopFix: loopFix,
26921    loopDestroy: loopDestroy
26922  };
26923
26924  function setGrabCursor(moving) {
26925    var swiper = this;
26926    if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
26927    var el = swiper.el;
26928    el.style.cursor = 'move';
26929    el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
26930    el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
26931    el.style.cursor = moving ? 'grabbing' : 'grab';
26932  }
26933
26934  function unsetGrabCursor() {
26935    var swiper = this;
26936
26937    if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
26938      return;
26939    }
26940
26941    swiper.el.style.cursor = '';
26942  }
26943
26944  var grabCursor = {
26945    setGrabCursor: setGrabCursor,
26946    unsetGrabCursor: unsetGrabCursor
26947  };
26948
26949  function appendSlide(slides) {
26950    var swiper = this;
26951    var $wrapperEl = swiper.$wrapperEl,
26952        params = swiper.params;
26953
26954    if (params.loop) {
26955      swiper.loopDestroy();
26956    }
26957
26958    if (typeof slides === 'object' && 'length' in slides) {
26959      for (var i = 0; i < slides.length; i += 1) {
26960        if (slides[i]) $wrapperEl.append(slides[i]);
26961      }
26962    } else {
26963      $wrapperEl.append(slides);
26964    }
26965
26966    if (params.loop) {
26967      swiper.loopCreate();
26968    }
26969
26970    if (!(params.observer && swiper.support.observer)) {
26971      swiper.update();
26972    }
26973  }
26974
26975  function prependSlide(slides) {
26976    var swiper = this;
26977    var params = swiper.params,
26978        $wrapperEl = swiper.$wrapperEl,
26979        activeIndex = swiper.activeIndex;
26980
26981    if (params.loop) {
26982      swiper.loopDestroy();
26983    }
26984
26985    var newActiveIndex = activeIndex + 1;
26986
26987    if (typeof slides === 'object' && 'length' in slides) {
26988      for (var i = 0; i < slides.length; i += 1) {
26989        if (slides[i]) $wrapperEl.prepend(slides[i]);
26990      }
26991
26992      newActiveIndex = activeIndex + slides.length;
26993    } else {
26994      $wrapperEl.prepend(slides);
26995    }
26996
26997    if (params.loop) {
26998      swiper.loopCreate();
26999    }
27000
27001    if (!(params.observer && swiper.support.observer)) {
27002      swiper.update();
27003    }
27004
27005    swiper.slideTo(newActiveIndex, 0, false);
27006  }
27007
27008  function addSlide(index, slides) {
27009    var swiper = this;
27010    var $wrapperEl = swiper.$wrapperEl,
27011        params = swiper.params,
27012        activeIndex = swiper.activeIndex;
27013    var activeIndexBuffer = activeIndex;
27014
27015    if (params.loop) {
27016      activeIndexBuffer -= swiper.loopedSlides;
27017      swiper.loopDestroy();
27018      swiper.slides = $wrapperEl.children("." + params.slideClass);
27019    }
27020
27021    var baseLength = swiper.slides.length;
27022
27023    if (index <= 0) {
27024      swiper.prependSlide(slides);
27025      return;
27026    }
27027
27028    if (index >= baseLength) {
27029      swiper.appendSlide(slides);
27030      return;
27031    }
27032
27033    var newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;
27034    var slidesBuffer = [];
27035
27036    for (var i = baseLength - 1; i >= index; i -= 1) {
27037      var currentSlide = swiper.slides.eq(i);
27038      currentSlide.remove();
27039      slidesBuffer.unshift(currentSlide);
27040    }
27041
27042    if (typeof slides === 'object' && 'length' in slides) {
27043      for (var _i = 0; _i < slides.length; _i += 1) {
27044        if (slides[_i]) $wrapperEl.append(slides[_i]);
27045      }
27046
27047      newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;
27048    } else {
27049      $wrapperEl.append(slides);
27050    }
27051
27052    for (var _i2 = 0; _i2 < slidesBuffer.length; _i2 += 1) {
27053      $wrapperEl.append(slidesBuffer[_i2]);
27054    }
27055
27056    if (params.loop) {
27057      swiper.loopCreate();
27058    }
27059
27060    if (!(params.observer && swiper.support.observer)) {
27061      swiper.update();
27062    }
27063
27064    if (params.loop) {
27065      swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
27066    } else {
27067      swiper.slideTo(newActiveIndex, 0, false);
27068    }
27069  }
27070
27071  function removeSlide(slidesIndexes) {
27072    var swiper = this;
27073    var params = swiper.params,
27074        $wrapperEl = swiper.$wrapperEl,
27075        activeIndex = swiper.activeIndex;
27076    var activeIndexBuffer = activeIndex;
27077
27078    if (params.loop) {
27079      activeIndexBuffer -= swiper.loopedSlides;
27080      swiper.loopDestroy();
27081      swiper.slides = $wrapperEl.children("." + params.slideClass);
27082    }
27083
27084    var newActiveIndex = activeIndexBuffer;
27085    var indexToRemove;
27086
27087    if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {
27088      for (var i = 0; i < slidesIndexes.length; i += 1) {
27089        indexToRemove = slidesIndexes[i];
27090        if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
27091        if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
27092      }
27093
27094      newActiveIndex = Math.max(newActiveIndex, 0);
27095    } else {
27096      indexToRemove = slidesIndexes;
27097      if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
27098      if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
27099      newActiveIndex = Math.max(newActiveIndex, 0);
27100    }
27101
27102    if (params.loop) {
27103      swiper.loopCreate();
27104    }
27105
27106    if (!(params.observer && swiper.support.observer)) {
27107      swiper.update();
27108    }
27109
27110    if (params.loop) {
27111      swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
27112    } else {
27113      swiper.slideTo(newActiveIndex, 0, false);
27114    }
27115  }
27116
27117  function removeAllSlides() {
27118    var swiper = this;
27119    var slidesIndexes = [];
27120
27121    for (var i = 0; i < swiper.slides.length; i += 1) {
27122      slidesIndexes.push(i);
27123    }
27124
27125    swiper.removeSlide(slidesIndexes);
27126  }
27127
27128  var manipulation = {
27129    appendSlide: appendSlide,
27130    prependSlide: prependSlide,
27131    addSlide: addSlide,
27132    removeSlide: removeSlide,
27133    removeAllSlides: removeAllSlides
27134  };
27135
27136  function closestElement(selector, base) {
27137    if (base === void 0) {
27138      base = this;
27139    }
27140
27141    function __closestFrom(el) {
27142      if (!el || el === getDocument() || el === getWindow()) return null;
27143      if (el.assignedSlot) el = el.assignedSlot;
27144      var found = el.closest(selector);
27145      return found || __closestFrom(el.getRootNode().host);
27146    }
27147
27148    return __closestFrom(base);
27149  }
27150
27151  function onTouchStart(event) {
27152    var swiper = this;
27153    var document = getDocument();
27154    var window = getWindow();
27155    var data = swiper.touchEventsData;
27156    var params = swiper.params,
27157        touches = swiper.touches,
27158        enabled = swiper.enabled;
27159    if (!enabled) return;
27160
27161    if (swiper.animating && params.preventInteractionOnTransition) {
27162      return;
27163    }
27164
27165    var e = event;
27166    if (e.originalEvent) e = e.originalEvent;
27167    var $targetEl = $(e.target);
27168
27169    if (params.touchEventsTarget === 'wrapper') {
27170      if (!$targetEl.closest(swiper.wrapperEl).length) return;
27171    }
27172
27173    data.isTouchEvent = e.type === 'touchstart';
27174    if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
27175    if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
27176    if (data.isTouched && data.isMoved) return; // change target el for shadow root component
27177
27178    var swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
27179
27180    if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) {
27181      $targetEl = $(event.path[0]);
27182    }
27183
27184    var noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : "." + params.noSwipingClass;
27185    var isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element
27186
27187    if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, e.target) : $targetEl.closest(noSwipingSelector)[0])) {
27188      swiper.allowClick = true;
27189      return;
27190    }
27191
27192    if (params.swipeHandler) {
27193      if (!$targetEl.closest(params.swipeHandler)[0]) return;
27194    }
27195
27196    touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
27197    touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
27198    var startX = touches.currentX;
27199    var startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
27200
27201    var edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
27202    var edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
27203
27204    if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
27205      if (edgeSwipeDetection === 'prevent') {
27206        event.preventDefault();
27207      } else {
27208        return;
27209      }
27210    }
27211
27212    extend(data, {
27213      isTouched: true,
27214      isMoved: false,
27215      allowTouchCallbacks: true,
27216      isScrolling: undefined,
27217      startMoving: undefined
27218    });
27219    touches.startX = startX;
27220    touches.startY = startY;
27221    data.touchStartTime = now();
27222    swiper.allowClick = true;
27223    swiper.updateSize();
27224    swiper.swipeDirection = undefined;
27225    if (params.threshold > 0) data.allowThresholdMove = false;
27226
27227    if (e.type !== 'touchstart') {
27228      var preventDefault = true;
27229      if ($targetEl.is(data.focusableElements)) preventDefault = false;
27230
27231      if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) {
27232        document.activeElement.blur();
27233      }
27234
27235      var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
27236
27237      if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) {
27238        e.preventDefault();
27239      }
27240    }
27241
27242    swiper.emit('touchStart', e);
27243  }
27244
27245  function onTouchMove(event) {
27246    var document = getDocument();
27247    var swiper = this;
27248    var data = swiper.touchEventsData;
27249    var params = swiper.params,
27250        touches = swiper.touches,
27251        rtl = swiper.rtlTranslate,
27252        enabled = swiper.enabled;
27253    if (!enabled) return;
27254    var e = event;
27255    if (e.originalEvent) e = e.originalEvent;
27256
27257    if (!data.isTouched) {
27258      if (data.startMoving && data.isScrolling) {
27259        swiper.emit('touchMoveOpposite', e);
27260      }
27261
27262      return;
27263    }
27264
27265    if (data.isTouchEvent && e.type !== 'touchmove') return;
27266    var targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
27267    var pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
27268    var pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;
27269
27270    if (e.preventedByNestedSwiper) {
27271      touches.startX = pageX;
27272      touches.startY = pageY;
27273      return;
27274    }
27275
27276    if (!swiper.allowTouchMove) {
27277      // isMoved = true;
27278      swiper.allowClick = false;
27279
27280      if (data.isTouched) {
27281        extend(touches, {
27282          startX: pageX,
27283          startY: pageY,
27284          currentX: pageX,
27285          currentY: pageY
27286        });
27287        data.touchStartTime = now();
27288      }
27289
27290      return;
27291    }
27292
27293    if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
27294      if (swiper.isVertical()) {
27295        // Vertical
27296        if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
27297          data.isTouched = false;
27298          data.isMoved = false;
27299          return;
27300        }
27301      } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
27302        return;
27303      }
27304    }
27305
27306    if (data.isTouchEvent && document.activeElement) {
27307      if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) {
27308        data.isMoved = true;
27309        swiper.allowClick = false;
27310        return;
27311      }
27312    }
27313
27314    if (data.allowTouchCallbacks) {
27315      swiper.emit('touchMove', e);
27316    }
27317
27318    if (e.targetTouches && e.targetTouches.length > 1) return;
27319    touches.currentX = pageX;
27320    touches.currentY = pageY;
27321    var diffX = touches.currentX - touches.startX;
27322    var diffY = touches.currentY - touches.startY;
27323    if (swiper.params.threshold && Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2)) < swiper.params.threshold) return;
27324
27325    if (typeof data.isScrolling === 'undefined') {
27326      var touchAngle;
27327
27328      if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
27329        data.isScrolling = false;
27330      } else {
27331        // eslint-disable-next-line
27332        if (diffX * diffX + diffY * diffY >= 25) {
27333          touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
27334          data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
27335        }
27336      }
27337    }
27338
27339    if (data.isScrolling) {
27340      swiper.emit('touchMoveOpposite', e);
27341    }
27342
27343    if (typeof data.startMoving === 'undefined') {
27344      if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
27345        data.startMoving = true;
27346      }
27347    }
27348
27349    if (data.isScrolling) {
27350      data.isTouched = false;
27351      return;
27352    }
27353
27354    if (!data.startMoving) {
27355      return;
27356    }
27357
27358    swiper.allowClick = false;
27359
27360    if (!params.cssMode && e.cancelable) {
27361      e.preventDefault();
27362    }
27363
27364    if (params.touchMoveStopPropagation && !params.nested) {
27365      e.stopPropagation();
27366    }
27367
27368    if (!data.isMoved) {
27369      if (params.loop) {
27370        swiper.loopFix();
27371      }
27372
27373      data.startTranslate = swiper.getTranslate();
27374      swiper.setTransition(0);
27375
27376      if (swiper.animating) {
27377        swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
27378      }
27379
27380      data.allowMomentumBounce = false; // Grab Cursor
27381
27382      if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
27383        swiper.setGrabCursor(true);
27384      }
27385
27386      swiper.emit('sliderFirstMove', e);
27387    }
27388
27389    swiper.emit('sliderMove', e);
27390    data.isMoved = true;
27391    var diff = swiper.isHorizontal() ? diffX : diffY;
27392    touches.diff = diff;
27393    diff *= params.touchRatio;
27394    if (rtl) diff = -diff;
27395    swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
27396    data.currentTranslate = diff + data.startTranslate;
27397    var disableParentSwiper = true;
27398    var resistanceRatio = params.resistanceRatio;
27399
27400    if (params.touchReleaseOnEdges) {
27401      resistanceRatio = 0;
27402    }
27403
27404    if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
27405      disableParentSwiper = false;
27406      if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + Math.pow(-swiper.minTranslate() + data.startTranslate + diff, resistanceRatio);
27407    } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
27408      disableParentSwiper = false;
27409      if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - Math.pow(swiper.maxTranslate() - data.startTranslate - diff, resistanceRatio);
27410    }
27411
27412    if (disableParentSwiper) {
27413      e.preventedByNestedSwiper = true;
27414    } // Directions locks
27415
27416
27417    if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
27418      data.currentTranslate = data.startTranslate;
27419    }
27420
27421    if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
27422      data.currentTranslate = data.startTranslate;
27423    }
27424
27425    if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
27426      data.currentTranslate = data.startTranslate;
27427    } // Threshold
27428
27429
27430    if (params.threshold > 0) {
27431      if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
27432        if (!data.allowThresholdMove) {
27433          data.allowThresholdMove = true;
27434          touches.startX = touches.currentX;
27435          touches.startY = touches.currentY;
27436          data.currentTranslate = data.startTranslate;
27437          touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
27438          return;
27439        }
27440      } else {
27441        data.currentTranslate = data.startTranslate;
27442        return;
27443      }
27444    }
27445
27446    if (!params.followFinger || params.cssMode) return; // Update active index in free mode
27447
27448    if (params.freeMode || params.watchSlidesProgress || params.watchSlidesVisibility) {
27449      swiper.updateActiveIndex();
27450      swiper.updateSlidesClasses();
27451    }
27452
27453    if (params.freeMode) {
27454      // Velocity
27455      if (data.velocities.length === 0) {
27456        data.velocities.push({
27457          position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
27458          time: data.touchStartTime
27459        });
27460      }
27461
27462      data.velocities.push({
27463        position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
27464        time: now()
27465      });
27466    } // Update progress
27467
27468
27469    swiper.updateProgress(data.currentTranslate); // Update translate
27470
27471    swiper.setTranslate(data.currentTranslate);
27472  }
27473
27474  function onTouchEnd(event) {
27475    var swiper = this;
27476    var data = swiper.touchEventsData;
27477    var params = swiper.params,
27478        touches = swiper.touches,
27479        rtl = swiper.rtlTranslate,
27480        $wrapperEl = swiper.$wrapperEl,
27481        slidesGrid = swiper.slidesGrid,
27482        snapGrid = swiper.snapGrid,
27483        enabled = swiper.enabled;
27484    if (!enabled) return;
27485    var e = event;
27486    if (e.originalEvent) e = e.originalEvent;
27487
27488    if (data.allowTouchCallbacks) {
27489      swiper.emit('touchEnd', e);
27490    }
27491
27492    data.allowTouchCallbacks = false;
27493
27494    if (!data.isTouched) {
27495      if (data.isMoved && params.grabCursor) {
27496        swiper.setGrabCursor(false);
27497      }
27498
27499      data.isMoved = false;
27500      data.startMoving = false;
27501      return;
27502    } // Return Grab Cursor
27503
27504
27505    if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
27506      swiper.setGrabCursor(false);
27507    } // Time diff
27508
27509
27510    var touchEndTime = now();
27511    var timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click
27512
27513    if (swiper.allowClick) {
27514      swiper.updateClickedSlide(e);
27515      swiper.emit('tap click', e);
27516
27517      if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
27518        swiper.emit('doubleTap doubleClick', e);
27519      }
27520    }
27521
27522    data.lastClickTime = now();
27523    nextTick(function () {
27524      if (!swiper.destroyed) swiper.allowClick = true;
27525    });
27526
27527    if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
27528      data.isTouched = false;
27529      data.isMoved = false;
27530      data.startMoving = false;
27531      return;
27532    }
27533
27534    data.isTouched = false;
27535    data.isMoved = false;
27536    data.startMoving = false;
27537    var currentPos;
27538
27539    if (params.followFinger) {
27540      currentPos = rtl ? swiper.translate : -swiper.translate;
27541    } else {
27542      currentPos = -data.currentTranslate;
27543    }
27544
27545    if (params.cssMode) {
27546      return;
27547    }
27548
27549    if (params.freeMode) {
27550      if (currentPos < -swiper.minTranslate()) {
27551        swiper.slideTo(swiper.activeIndex);
27552        return;
27553      }
27554
27555      if (currentPos > -swiper.maxTranslate()) {
27556        if (swiper.slides.length < snapGrid.length) {
27557          swiper.slideTo(snapGrid.length - 1);
27558        } else {
27559          swiper.slideTo(swiper.slides.length - 1);
27560        }
27561
27562        return;
27563      }
27564
27565      if (params.freeModeMomentum) {
27566        if (data.velocities.length > 1) {
27567          var lastMoveEvent = data.velocities.pop();
27568          var velocityEvent = data.velocities.pop();
27569          var distance = lastMoveEvent.position - velocityEvent.position;
27570          var time = lastMoveEvent.time - velocityEvent.time;
27571          swiper.velocity = distance / time;
27572          swiper.velocity /= 2;
27573
27574          if (Math.abs(swiper.velocity) < params.freeModeMinimumVelocity) {
27575            swiper.velocity = 0;
27576          } // this implies that the user stopped moving a finger then released.
27577          // There would be no events with distance zero, so the last event is stale.
27578
27579
27580          if (time > 150 || now() - lastMoveEvent.time > 300) {
27581            swiper.velocity = 0;
27582          }
27583        } else {
27584          swiper.velocity = 0;
27585        }
27586
27587        swiper.velocity *= params.freeModeMomentumVelocityRatio;
27588        data.velocities.length = 0;
27589        var momentumDuration = 1000 * params.freeModeMomentumRatio;
27590        var momentumDistance = swiper.velocity * momentumDuration;
27591        var newPosition = swiper.translate + momentumDistance;
27592        if (rtl) newPosition = -newPosition;
27593        var doBounce = false;
27594        var afterBouncePosition;
27595        var bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeModeMomentumBounceRatio;
27596        var needsLoopFix;
27597
27598        if (newPosition < swiper.maxTranslate()) {
27599          if (params.freeModeMomentumBounce) {
27600            if (newPosition + swiper.maxTranslate() < -bounceAmount) {
27601              newPosition = swiper.maxTranslate() - bounceAmount;
27602            }
27603
27604            afterBouncePosition = swiper.maxTranslate();
27605            doBounce = true;
27606            data.allowMomentumBounce = true;
27607          } else {
27608            newPosition = swiper.maxTranslate();
27609          }
27610
27611          if (params.loop && params.centeredSlides) needsLoopFix = true;
27612        } else if (newPosition > swiper.minTranslate()) {
27613          if (params.freeModeMomentumBounce) {
27614            if (newPosition - swiper.minTranslate() > bounceAmount) {
27615              newPosition = swiper.minTranslate() + bounceAmount;
27616            }
27617
27618            afterBouncePosition = swiper.minTranslate();
27619            doBounce = true;
27620            data.allowMomentumBounce = true;
27621          } else {
27622            newPosition = swiper.minTranslate();
27623          }
27624
27625          if (params.loop && params.centeredSlides) needsLoopFix = true;
27626        } else if (params.freeModeSticky) {
27627          var nextSlide;
27628
27629          for (var j = 0; j < snapGrid.length; j += 1) {
27630            if (snapGrid[j] > -newPosition) {
27631              nextSlide = j;
27632              break;
27633            }
27634          }
27635
27636          if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
27637            newPosition = snapGrid[nextSlide];
27638          } else {
27639            newPosition = snapGrid[nextSlide - 1];
27640          }
27641
27642          newPosition = -newPosition;
27643        }
27644
27645        if (needsLoopFix) {
27646          swiper.once('transitionEnd', function () {
27647            swiper.loopFix();
27648          });
27649        } // Fix duration
27650
27651
27652        if (swiper.velocity !== 0) {
27653          if (rtl) {
27654            momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
27655          } else {
27656            momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
27657          }
27658
27659          if (params.freeModeSticky) {
27660            // If freeModeSticky is active and the user ends a swipe with a slow-velocity
27661            // event, then durations can be 20+ seconds to slide one (or zero!) slides.
27662            // It's easy to see this when simulating touch with mouse events. To fix this,
27663            // limit single-slide swipes to the default slide duration. This also has the
27664            // nice side effect of matching slide speed if the user stopped moving before
27665            // lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
27666            // For faster swipes, also apply limits (albeit higher ones).
27667            var moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
27668            var currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
27669
27670            if (moveDistance < currentSlideSize) {
27671              momentumDuration = params.speed;
27672            } else if (moveDistance < 2 * currentSlideSize) {
27673              momentumDuration = params.speed * 1.5;
27674            } else {
27675              momentumDuration = params.speed * 2.5;
27676            }
27677          }
27678        } else if (params.freeModeSticky) {
27679          swiper.slideToClosest();
27680          return;
27681        }
27682
27683        if (params.freeModeMomentumBounce && doBounce) {
27684          swiper.updateProgress(afterBouncePosition);
27685          swiper.setTransition(momentumDuration);
27686          swiper.setTranslate(newPosition);
27687          swiper.transitionStart(true, swiper.swipeDirection);
27688          swiper.animating = true;
27689          $wrapperEl.transitionEnd(function () {
27690            if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
27691            swiper.emit('momentumBounce');
27692            swiper.setTransition(params.speed);
27693            setTimeout(function () {
27694              swiper.setTranslate(afterBouncePosition);
27695              $wrapperEl.transitionEnd(function () {
27696                if (!swiper || swiper.destroyed) return;
27697                swiper.transitionEnd();
27698              });
27699            }, 0);
27700          });
27701        } else if (swiper.velocity) {
27702          swiper.updateProgress(newPosition);
27703          swiper.setTransition(momentumDuration);
27704          swiper.setTranslate(newPosition);
27705          swiper.transitionStart(true, swiper.swipeDirection);
27706
27707          if (!swiper.animating) {
27708            swiper.animating = true;
27709            $wrapperEl.transitionEnd(function () {
27710              if (!swiper || swiper.destroyed) return;
27711              swiper.transitionEnd();
27712            });
27713          }
27714        } else {
27715          swiper.emit('_freeModeNoMomentumRelease');
27716          swiper.updateProgress(newPosition);
27717        }
27718
27719        swiper.updateActiveIndex();
27720        swiper.updateSlidesClasses();
27721      } else if (params.freeModeSticky) {
27722        swiper.slideToClosest();
27723        return;
27724      } else if (params.freeMode) {
27725        swiper.emit('_freeModeNoMomentumRelease');
27726      }
27727
27728      if (!params.freeModeMomentum || timeDiff >= params.longSwipesMs) {
27729        swiper.updateProgress();
27730        swiper.updateActiveIndex();
27731        swiper.updateSlidesClasses();
27732      }
27733
27734      return;
27735    } // Find current slide
27736
27737
27738    var stopIndex = 0;
27739    var groupSize = swiper.slidesSizesGrid[0];
27740
27741    for (var i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
27742      var _increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
27743
27744      if (typeof slidesGrid[i + _increment] !== 'undefined') {
27745        if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + _increment]) {
27746          stopIndex = i;
27747          groupSize = slidesGrid[i + _increment] - slidesGrid[i];
27748        }
27749      } else if (currentPos >= slidesGrid[i]) {
27750        stopIndex = i;
27751        groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
27752      }
27753    } // Find current slide size
27754
27755
27756    var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
27757    var increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
27758
27759    if (timeDiff > params.longSwipesMs) {
27760      // Long touches
27761      if (!params.longSwipes) {
27762        swiper.slideTo(swiper.activeIndex);
27763        return;
27764      }
27765
27766      if (swiper.swipeDirection === 'next') {
27767        if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
27768      }
27769
27770      if (swiper.swipeDirection === 'prev') {
27771        if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
27772      }
27773    } else {
27774      // Short swipes
27775      if (!params.shortSwipes) {
27776        swiper.slideTo(swiper.activeIndex);
27777        return;
27778      }
27779
27780      var isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
27781
27782      if (!isNavButtonTarget) {
27783        if (swiper.swipeDirection === 'next') {
27784          swiper.slideTo(stopIndex + increment);
27785        }
27786
27787        if (swiper.swipeDirection === 'prev') {
27788          swiper.slideTo(stopIndex);
27789        }
27790      } else if (e.target === swiper.navigation.nextEl) {
27791        swiper.slideTo(stopIndex + increment);
27792      } else {
27793        swiper.slideTo(stopIndex);
27794      }
27795    }
27796  }
27797
27798  function onResize() {
27799    var swiper = this;
27800    var params = swiper.params,
27801        el = swiper.el;
27802    if (el && el.offsetWidth === 0) return;
27802 // Breakpoints
27803
27804    if (params.breakpoints) {
27805      swiper.setBreakpoint();
27806    } // Save locks
27807
27808
27809    var allowSlideNext = swiper.allowSlideNext,
27810        allowSlidePrev = swiper.allowSlidePrev,
27811        snapGrid = swiper.snapGrid; // Disable locks on resize
27812
27813    swiper.allowSlideNext = true;
27814    swiper.allowSlidePrev = true;
27815    swiper.updateSize();
27816    swiper.updateSlides();
27817    swiper.updateSlidesClasses();
27818
27819    if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
27820      swiper.slideTo(swiper.slides.length - 1, 0, false, true);
27821    } else {
27822      swiper.slideTo(swiper.activeIndex, 0, false, true);
27823    }
27824
27825    if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
27826      swiper.autoplay.run();
27827    } // Return locks after resize
27828
27829
27830    swiper.allowSlidePrev = allowSlidePrev;
27831    swiper.allowSlideNext = allowSlideNext;
27832
27833    if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
27834      swiper.checkOverflow();
27835    }
27836  }
27837
27838  function onClick(e) {
27839    var swiper = this;
27840    if (!swiper.enabled) return;
27841
27842    if (!swiper.allowClick) {
27843      if (swiper.params.preventClicks) e.preventDefault();
27844
27845      if (swiper.params.preventClicksPropagation && swiper.animating) {
27846        e.stopPropagation();
27847        e.stopImmediatePropagation();
27848      }
27849    }
27850  }
27851
27852  function onScroll() {
27853    var swiper = this;
27854    var wrapperEl = swiper.wrapperEl,
27855        rtlTranslate = swiper.rtlTranslate,
27856        enabled = swiper.enabled;
27857    if (!enabled) return;
27858    swiper.previousTranslate = swiper.translate;
27859
27860    if (swiper.isHorizontal()) {
27861      if (rtlTranslate) {
27862        swiper.translate = wrapperEl.scrollWidth - wrapperEl.offsetWidth - wrapperEl.scrollLeft;
27863      } else {
27864        swiper.translate = -wrapperEl.scrollLeft;
27865      }
27866    } else {
27867      swiper.translate = -wrapperEl.scrollTop;
27868    } // eslint-disable-next-line
27869
27870
27871    if (swiper.translate === -0) swiper.translate = 0;
27872    swiper.updateActiveIndex();
27873    swiper.updateSlidesClasses();
27874    var newProgress;
27875    var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
27876
27877    if (translatesDiff === 0) {
27878      newProgress = 0;
27879    } else {
27880      newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
27881    }
27882
27883    if (newProgress !== swiper.progress) {
27884      swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
27885    }
27886
27887    swiper.emit('setTranslate', swiper.translate, false);
27888  }
27889
27890  var dummyEventAttached = false;
27891
27892  function dummyEventListener() {}
27893
27894  function attachEvents() {
27895    var swiper = this;
27896    var document = getDocument();
27897    var params = swiper.params,
27898        touchEvents = swiper.touchEvents,
27899        el = swiper.el,
27900        wrapperEl = swiper.wrapperEl,
27901        device = swiper.device,
27902        support = swiper.support;
27903    swiper.onTouchStart = onTouchStart.bind(swiper);
27904    swiper.onTouchMove = onTouchMove.bind(swiper);
27905    swiper.onTouchEnd = onTouchEnd.bind(swiper);
27906
27907    if (params.cssMode) {
27908      swiper.onScroll = onScroll.bind(swiper);
27909    }
27910
27911    swiper.onClick = onClick.bind(swiper);
27912    var capture = !!params.nested; // Touch Events
27913
27914    if (!support.touch && support.pointerEvents) {
27915      el.addEventListener(touchEvents.start, swiper.onTouchStart, false);
27916      document.addEventListener(touchEvents.move, swiper.onTouchMove, capture);
27917      document.addEventListener(touchEvents.end, swiper.onTouchEnd, false);
27918    } else {
27919      if (support.touch) {
27920        var passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
27921          passive: true,
27922          capture: false
27923        } : false;
27924        el.addEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
27925        el.addEventListener(touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
27926          passive: false,
27927          capture: capture
27928        } : capture);
27929        el.addEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
27930
27931        if (touchEvents.cancel) {
27932          el.addEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);
27933        }
27934
27935        if (!dummyEventAttached) {
27936          document.addEventListener('touchstart', dummyEventListener);
27937          dummyEventAttached = true;
27938        }
27939      }
27940
27941      if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {
27942        el.addEventListener('mousedown', swiper.onTouchStart, false);
27943        document.addEventListener('mousemove', swiper.onTouchMove, capture);
27944        document.addEventListener('mouseup', swiper.onTouchEnd, false);
27945      }
27946    } // Prevent Links Clicks
27947
27948
27949    if (params.preventClicks || params.preventClicksPropagation) {
27950      el.addEventListener('click', swiper.onClick, true);
27951    }
27952
27953    if (params.cssMode) {
27954      wrapperEl.addEventListener('scroll', swiper.onScroll);
27955    } // Resize handler
27956
27957
27958    if (params.updateOnWindowResize) {
27959      swiper.on(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
27960    } else {
27961      swiper.on('observerUpdate', onResize, true);
27962    }
27963  }
27964
27965  function detachEvents() {
27966    var swiper = this;
27967    var document = getDocument();
27968    var params = swiper.params,
27969        touchEvents = swiper.touchEvents,
27970        el = swiper.el,
27971        wrapperEl = swiper.wrapperEl,
27972        device = swiper.device,
27973        support = swiper.support;
27974    var capture = !!params.nested; // Touch Events
27975
27976    if (!support.touch && support.pointerEvents) {
27977      el.removeEventListener(touchEvents.start, swiper.onTouchStart, false);
27978      document.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
27979      document.removeEventListener(touchEvents.end, swiper.onTouchEnd, false);
27980    } else {
27981      if (support.touch) {
27982        var passiveListener = touchEvents.start === 'onTouchStart' && support.passiveListener && params.passiveListeners ? {
27983          passive: true,
27984          capture: false
27985        } : false;
27986        el.removeEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
27987        el.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
27988        el.removeEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
27989
27990        if (touchEvents.cancel) {
27991          el.removeEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);
27992        }
27993      }
27994
27995      if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {
27996        el.removeEventListener('mousedown', swiper.onTouchStart, false);
27997        document.removeEventListener('mousemove', swiper.onTouchMove, capture);
27998        document.removeEventListener('mouseup', swiper.onTouchEnd, false);
27999      }
28000    } // Prevent Links Clicks
28001
28002
28003    if (params.preventClicks || params.preventClicksPropagation) {
28004      el.removeEventListener('click', swiper.onClick, true);
28005    }
28006
28007    if (params.cssMode) {
28008      wrapperEl.removeEventListener('scroll', swiper.onScroll);
28009    } // Resize handler
28010
28011
28012    swiper.off(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize);
28013  }
28014
28015  var events = {
28016    attachEvents: attachEvents,
28017    detachEvents: detachEvents
28018  };
28019
28020  function setBreakpoint() {
28021    var swiper = this;
28022    var activeIndex = swiper.activeIndex,
28023        initialized = swiper.initialized,
28024        _swiper$loopedSlides = swiper.loopedSlides,
28025        loopedSlides = _swiper$loopedSlides === void 0 ? 0 : _swiper$loopedSlides,
28026        params = swiper.params,
28027        $el = swiper.$el;
28028    var breakpoints = params.breakpoints;
28029    if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters
28030
28031    var breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
28032    if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
28033    var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
28034
28035    if (breakpointOnlyParams) {
28036      ['slidesPerView', 'spaceBetween', 'slidesPerGroup', 'slidesPerGroupSkip', 'slidesPerColumn'].forEach(function (param) {
28037        var paramValue = breakpointOnlyParams[param];
28038        if (typeof paramValue === 'undefined') return;
28039
28040        if (param === 'slidesPerView' && (paramValue === 'AUTO' || paramValue === 'auto')) {
28041          breakpointOnlyParams[param] = 'auto';
28042        } else if (param === 'slidesPerView') {
28043          breakpointOnlyParams[param] = parseFloat(paramValue);
28044        } else {
28045          breakpointOnlyParams[param] = parseInt(paramValue, 10);
28046        }
28047      });
28048    }
28049
28050    var breakpointParams = breakpointOnlyParams || swiper.originalParams;
28051    var wasMultiRow = params.slidesPerColumn > 1;
28052    var isMultiRow = breakpointParams.slidesPerColumn > 1;
28053    var wasEnabled = params.enabled;
28054
28055    if (wasMultiRow && !isMultiRow) {
28056      $el.removeClass(params.containerModifierClass + "multirow " + params.containerModifierClass + "multirow-column");
28057      swiper.emitContainerClasses();
28058    } else if (!wasMultiRow && isMultiRow) {
28059      $el.addClass(params.containerModifierClass + "multirow");
28060
28061      if (breakpointParams.slidesPerColumnFill && breakpointParams.slidesPerColumnFill === 'column' || !breakpointParams.slidesPerColumnFill && params.slidesPerColumnFill === 'column') {
28062        $el.addClass(params.containerModifierClass + "multirow-column");
28063      }
28064
28065      swiper.emitContainerClasses();
28066    }
28067
28068    var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
28069    var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
28070
28071    if (directionChanged && initialized) {
28072      swiper.changeDirection();
28073    }
28074
28075    extend(swiper.params, breakpointParams);
28076    var isEnabled = swiper.params.enabled;
28077    extend(swiper, {
28078      allowTouchMove: swiper.params.allowTouchMove,
28079      allowSlideNext: swiper.params.allowSlideNext,
28080      allowSlidePrev: swiper.params.allowSlidePrev
28081    });
28082
28083    if (wasEnabled && !isEnabled) {
28084      swiper.disable();
28085    } else if (!wasEnabled && isEnabled) {
28086      swiper.enable();
28087    }
28088
28089    swiper.currentBreakpoint = breakpoint;
28090    swiper.emit('_beforeBreakpoint', breakpointParams);
28091
28092    if (needsReLoop && initialized) {
28093      swiper.loopDestroy();
28094      swiper.loopCreate();
28095      swiper.updateSlides();
28096      swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
28097    }
28098
28099    swiper.emit('breakpoint', breakpointParams);
28100  }
28101
28102  function getBreakpoint(breakpoints, base, containerEl) {
28103    if (base === void 0) {
28104      base = 'window';
28105    }
28106
28107    if (!breakpoints || base === 'container' && !containerEl) return undefined;
28108    var breakpoint = false;
28109    var window = getWindow();
28110    var currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
28111    var points = Object.keys(breakpoints).map(function (point) {
28112      if (typeof point === 'string' && point.indexOf('@') === 0) {
28113        var minRatio = parseFloat(point.substr(1));
28114        var value = currentHeight * minRatio;
28115        return {
28116          value: value,
28117          point: point
28118        };
28119      }
28120
28121      return {
28122        value: point,
28123        point: point
28124      };
28125    });
28126    points.sort(function (a, b) {
28127      return parseInt(a.value, 10) - parseInt(b.value, 10);
28128    });
28129
28130    for (var i = 0; i < points.length; i += 1) {
28131      var _points$i = points[i],
28132          point = _points$i.point,
28133          value = _points$i.value;
28134
28135      if (base === 'window') {
28136        if (window.matchMedia("(min-width: " + value + "px)").matches) {
28137          breakpoint = point;
28138        }
28139      } else if (value <= containerEl.clientWidth) {
28140        breakpoint = point;
28141      }
28142    }
28143
28144    return breakpoint || 'max';
28145  }
28146
28147  var breakpoints = {
28148    setBreakpoint: setBreakpoint,
28149    getBreakpoint: getBreakpoint
28150  };
28151
28152  function prepareClasses(entries, prefix) {
28153    var resultClasses = [];
28154    entries.forEach(function (item) {
28155      if (typeof item === 'object') {
28156        Object.keys(item).forEach(function (classNames) {
28157          if (item[classNames]) {
28158            resultClasses.push(prefix + classNames);
28159          }
28160        });
28161      } else if (typeof item === 'string') {
28162        resultClasses.push(prefix + item);
28163      }
28164    });
28165    return resultClasses;
28166  }
28167
28168  function addClasses() {
28169    var swiper = this;
28170    var classNames = swiper.classNames,
28171        params = swiper.params,
28172        rtl = swiper.rtl,
28173        $el = swiper.$el,
28174        device = swiper.device,
28175        support = swiper.support; // prettier-ignore
28176
28177    var suffixes = prepareClasses(['initialized', params.direction, {
28178      'pointer-events': support.pointerEvents && !support.touch
28179    }, {
28180      'free-mode': params.freeMode
28181    }, {
28182      'autoheight': params.autoHeight
28183    }, {
28184      'rtl': rtl
28185    }, {
28186      'multirow': params.slidesPerColumn > 1
28187    }, {
28188      'multirow-column': params.slidesPerColumn > 1 && params.slidesPerColumnFill === 'column'
28189    }, {
28190      'android': device.android
28191    }, {
28192      'ios': device.ios
28193    }, {
28194      'css-mode': params.cssMode
28195    }], params.containerModifierClass);
28196    classNames.push.apply(classNames, suffixes);
28197    $el.addClass([].concat(classNames).join(' '));
28198    swiper.emitContainerClasses();
28199  }
28200
28201  function removeClasses() {
28202    var swiper = this;
28203    var $el = swiper.$el,
28204        classNames = swiper.classNames;
28205    $el.removeClass(classNames.join(' '));
28206    swiper.emitContainerClasses();
28207  }
28208
28209  var classes = {
28210    addClasses: addClasses,
28211    removeClasses: removeClasses
28212  };
28213
28214  function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
28215    var window = getWindow();
28216    var image;
28217
28218    function onReady() {
28219      if (callback) callback();
28220    }
28221
28222    var isPicture = $(imageEl).parent('picture')[0];
28223
28224    if (!isPicture && (!imageEl.complete || !checkForComplete)) {
28225      if (src) {
28226        image = new window.Image();
28227        image.onload = onReady;
28228        image.onerror = onReady;
28229
28230        if (sizes) {
28231          image.sizes = sizes;
28232        }
28233
28234        if (srcset) {
28235          image.srcset = srcset;
28236        }
28237
28238        if (src) {
28239          image.src = src;
28240        }
28241      } else {
28242        onReady();
28243      }
28244    } else {
28245      // image already loaded...
28246      onReady();
28247    }
28248  }
28249
28250  function preloadImages() {
28251    var swiper = this;
28252    swiper.imagesToLoad = swiper.$el.find('img');
28253
28254    function onReady() {
28255      if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
28256      if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;
28257
28258      if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
28259        if (swiper.params.updateOnImagesReady) swiper.update();
28260        swiper.emit('imagesReady');
28261      }
28262    }
28263
28264    for (var i = 0; i < swiper.imagesToLoad.length; i += 1) {
28265      var imageEl = swiper.imagesToLoad[i];
28266      swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
28267    }
28268  }
28269
28270  var images = {
28271    loadImage: loadImage,
28272    preloadImages: preloadImages
28273  };
28274
28275  function checkOverflow() {
28276    var swiper = this;
28277    var params = swiper.params;
28278    var wasLocked = swiper.isLocked;
28279    var lastSlidePosition = swiper.slides.length > 0 && params.slidesOffsetBefore + params.spaceBetween * (swiper.slides.length - 1) + swiper.slides[0].offsetWidth * swiper.slides.length;
28280
28281    if (params.slidesOffsetBefore && params.slidesOffsetAfter && lastSlidePosition) {
28282      swiper.isLocked = lastSlidePosition <= swiper.size;
28283    } else {
28284      swiper.isLocked = swiper.snapGrid.length === 1;
28285    }
28286
28287    swiper.allowSlideNext = !swiper.isLocked;
28288    swiper.allowSlidePrev = !swiper.isLocked; // events
28289
28290    if (wasLocked !== swiper.isLocked) swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
28291
28292    if (wasLocked && wasLocked !== swiper.isLocked) {
28293      swiper.isEnd = false;
28294      if (swiper.navigation) swiper.navigation.update();
28295    }
28296  }
28297
28298  var checkOverflow$1 = {
28299    checkOverflow: checkOverflow
28300  };
28301
28302  var defaults = {
28303    init: true,
28304    direction: 'horizontal',
28305    touchEventsTarget: 'container',
28306    initialSlide: 0,
28307    speed: 300,
28308    cssMode: false,
28309    updateOnWindowResize: true,
28310    resizeObserver: false,
28311    nested: false,
28312    createElements: false,
28313    enabled: true,
28314    focusableElements: 'input, select, option, textarea, button, video, label',
28315    // Overrides
28316    width: null,
28317    height: null,
28318    //
28319    preventInteractionOnTransition: false,
28320    // ssr
28321    userAgent: null,
28322    url: null,
28323    // To support iOS's swipe-to-go-back gesture (when being used in-app).
28324    edgeSwipeDetection: false,
28325    edgeSwipeThreshold: 20,
28326    // Free mode
28327    freeMode: false,
28328    freeModeMomentum: true,
28329    freeModeMomentumRatio: 1,
28330    freeModeMomentumBounce: true,
28331    freeModeMomentumBounceRatio: 1,
28332    freeModeMomentumVelocityRatio: 1,
28333    freeModeSticky: false,
28334    freeModeMinimumVelocity: 0.02,
28335    // Autoheight
28336    autoHeight: false,
28337    // Set wrapper width
28338    setWrapperSize: false,
28339    // Virtual Translate
28340    virtualTranslate: false,
28341    // Effects
28342    effect: 'slide',
28343    // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
28344    // Breakpoints
28345    breakpoints: undefined,
28346    breakpointsBase: 'window',
28347    // Slides grid
28348    spaceBetween: 0,
28349    slidesPerView: 1,
28350    slidesPerColumn: 1,
28351    slidesPerColumnFill: 'column',
28352    slidesPerGroup: 1,
28353    slidesPerGroupSkip: 0,
28354    centeredSlides: false,
28355    centeredSlidesBounds: false,
28356    slidesOffsetBefore: 0,
28357    // in px
28358    slidesOffsetAfter: 0,
28359    // in px
28360    normalizeSlideIndex: true,
28361    centerInsufficientSlides: false,
28362    // Disable swiper and hide navigation when container not overflow
28363    watchOverflow: false,
28364    // Round length
28365    roundLengths: false,
28366    // Touches
28367    touchRatio: 1,
28368    touchAngle: 45,
28369    simulateTouch: true,
28370    shortSwipes: true,
28371    longSwipes: true,
28372    longSwipesRatio: 0.5,
28373    longSwipesMs: 300,
28374    followFinger: true,
28375    allowTouchMove: true,
28376    threshold: 0,
28377    touchMoveStopPropagation: false,
28378    touchStartPreventDefault: true,
28379    touchStartForcePreventDefault: false,
28380    touchReleaseOnEdges: false,
28381    // Unique Navigation Elements
28382    uniqueNavElements: true,
28383    // Resistance
28384    resistance: true,
28385    resistanceRatio: 0.85,
28386    // Progress
28387    watchSlidesProgress: false,
28388    watchSlidesVisibility: false,
28389    // Cursor
28390    grabCursor: false,
28391    // Clicks
28392    preventClicks: true,
28393    preventClicksPropagation: true,
28394    slideToClickedSlide: false,
28395    // Images
28396    preloadImages: true,
28397    updateOnImagesReady: true,
28398    // loop
28399    loop: false,
28400    loopAdditionalSlides: 0,
28401    loopedSlides: null,
28402    loopFillGroupWithBlank: false,
28403    loopPreventsSlide: true,
28404    // Swiping/no swiping
28405    allowSlidePrev: true,
28406    allowSlideNext: true,
28407    swipeHandler: null,
28408    // '.swipe-handler',
28409    noSwiping: true,
28410    noSwipingClass: 'swiper-no-swiping',
28411    noSwipingSelector: null,
28412    // Passive Listeners
28413    passiveListeners: true,
28414    // NS
28415    containerModifierClass: 'swiper-container-',
28416    // NEW
28417    slideClass: 'swiper-slide',
28418    slideBlankClass: 'swiper-slide-invisible-blank',
28419    slideActiveClass: 'swiper-slide-active',
28420    slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
28421    slideVisibleClass: 'swiper-slide-visible',
28422    slideDuplicateClass: 'swiper-slide-duplicate',
28423    slideNextClass: 'swiper-slide-next',
28424    slideDuplicateNextClass: 'swiper-slide-duplicate-next',
28425    slidePrevClass: 'swiper-slide-prev',
28426    slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
28427    wrapperClass: 'swiper-wrapper',
28428    // Callbacks
28429    runCallbacksOnInit: true,
28430    // Internals
28431    _emitClasses: false
28432  };
28433
28434  var prototypes = {
28435    modular: modular,
28436    eventsEmitter: eventsEmitter,
28437    update: update,
28438    translate: translate,
28439    transition: transition,
28440    slide: slide,
28441    loop: loop,
28442    grabCursor: grabCursor,
28443    manipulation: manipulation,
28444    events: events,
28445    breakpoints: breakpoints,
28446    checkOverflow: checkOverflow$1,
28447    classes: classes,
28448    images: images
28449  };
28450  var extendedDefaults = {};
28451
28452  var Swiper = /*#__PURE__*/function () {
28453    function Swiper() {
28454      var el;
28455      var params;
28456
28457      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28458        args[_key] = arguments[_key];
28459      }
28460
28461      if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
28462        params = args[0];
28463      } else {
28464        el = args[0];
28465        params = args[1];
28466      }
28467
28468      if (!params) params = {};
28469      params = extend({}, params);
28470      if (el && !params.el) params.el = el;
28471
28472      if (params.el && $(params.el).length > 1) {
28473        var swipers = [];
28474        $(params.el).each(function (containerEl) {
28475          var newParams = extend({}, params, {
28476            el: containerEl
28477          });
28478          swipers.push(new Swiper(newParams));
28479        });
28480        return swipers;
28481      } // Swiper Instance
28482
28483
28484      var swiper = this;
28485      swiper.__swiper__ = true;
28486      swiper.support = getSupport();
28487      swiper.device = getDevice({
28488        userAgent: params.userAgent
28489      });
28490      swiper.browser = getBrowser();
28491      swiper.eventsListeners = {};
28492      swiper.eventsAnyListeners = [];
28493
28494      if (typeof swiper.modules === 'undefined') {
28495        swiper.modules = {};
28496      }
28497
28498      Object.keys(swiper.modules).forEach(function (moduleName) {
28499        var module = swiper.modules[moduleName];
28500
28501        if (module.params) {
28502          var moduleParamName = Object.keys(module.params)[0];
28503          var moduleParams = module.params[moduleParamName];
28504          if (typeof moduleParams !== 'object' || moduleParams === null) return;
28505
28506          if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {
28507            params[moduleParamName] = {
28508              auto: true
28509            };
28510          }
28511
28512          if (!(moduleParamName in params && 'enabled' in moduleParams)) return;
28513
28514          if (params[moduleParamName] === true) {
28515            params[moduleParamName] = {
28516              enabled: true
28517            };
28518          }
28519
28520          if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
28521            params[moduleParamName].enabled = true;
28522          }
28523
28524          if (!params[moduleParamName]) params[moduleParamName] = {
28525            enabled: false
28526          };
28527        }
28528      }); // Extend defaults with modules params
28529
28530      var swiperParams = extend({}, defaults);
28531      swiper.useParams(swiperParams); // Extend defaults with passed params
28532
28533      swiper.params = extend({}, swiperParams, extendedDefaults, params);
28534      swiper.originalParams = extend({}, swiper.params);
28535      swiper.passedParams = extend({}, params); // add event listeners
28536
28537      if (swiper.params && swiper.params.on) {
28538        Object.keys(swiper.params.on).forEach(function (eventName) {
28539          swiper.on(eventName, swiper.params.on[eventName]);
28540        });
28541      }
28542
28543      if (swiper.params && swiper.params.onAny) {
28544        swiper.onAny(swiper.params.onAny);
28545      } // Save Dom lib
28546
28547
28548      swiper.$ = $; // Extend Swiper
28549
28550      extend(swiper, {
28551        enabled: swiper.params.enabled,
28552        el: el,
28553        // Classes
28554        classNames: [],
28555        // Slides
28556        slides: $(),
28557        slidesGrid: [],
28558        snapGrid: [],
28559        slidesSizesGrid: [],
28560        // isDirection
28561        isHorizontal: function isHorizontal() {
28562          return swiper.params.direction === 'horizontal';
28563        },
28564        isVertical: function isVertical() {
28565          return swiper.params.direction === 'vertical';
28566        },
28567        // Indexes
28568        activeIndex: 0,
28569        realIndex: 0,
28570        //
28571        isBeginning: true,
28572        isEnd: false,
28573        // Props
28574        translate: 0,
28575        previousTranslate: 0,
28576        progress: 0,
28577        velocity: 0,
28578        animating: false,
28579        // Locks
28580        allowSlideNext: swiper.params.allowSlideNext,
28581        allowSlidePrev: swiper.params.allowSlidePrev,
28582        // Touch Events
28583        touchEvents: function touchEvents() {
28584          var touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
28585          var desktop = ['mousedown', 'mousemove', 'mouseup'];
28586
28587          if (swiper.support.pointerEvents) {
28588            desktop = ['pointerdown', 'pointermove', 'pointerup'];
28589          }
28590
28591          swiper.touchEventsTouch = {
28592            start: touch[0],
28593            move: touch[1],
28594            end: touch[2],
28595            cancel: touch[3]
28596          };
28597          swiper.touchEventsDesktop = {
28598            start: desktop[0],
28599            move: desktop[1],
28600            end: desktop[2]
28601          };
28602          return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
28603        }(),
28604        touchEventsData: {
28605          isTouched: undefined,
28606          isMoved: undefined,
28607          allowTouchCallbacks: undefined,
28608          touchStartTime: undefined,
28609          isScrolling: undefined,
28610          currentTranslate: undefined,
28611          startTranslate: undefined,
28612          allowThresholdMove: undefined,
28613          // Form elements to match
28614          focusableElements: swiper.params.focusableElements,
28615          // Last click time
28616          lastClickTime: now(),
28617          clickTimeout: undefined,
28618          // Velocities
28619          velocities: [],
28620          allowMomentumBounce: undefined,
28621          isTouchEvent: undefined,
28622          startMoving: undefined
28623        },
28624        // Clicks
28625        allowClick: true,
28626        // Touches
28627        allowTouchMove: swiper.params.allowTouchMove,
28628        touches: {
28629          startX: 0,
28630          startY: 0,
28631          currentX: 0,
28632          currentY: 0,
28633          diff: 0
28634        },
28635        // Images
28636        imagesToLoad: [],
28637        imagesLoaded: 0
28638      }); // Install Modules
28639
28640      swiper.useModules();
28641      swiper.emit('_swiper'); // Init
28642
28643      if (swiper.params.init) {
28644        swiper.init();
28645      } // Return app instance
28646
28647
28648      return swiper;
28649    }
28650
28651    var _proto = Swiper.prototype;
28652
28653    _proto.enable = function enable() {
28654      var swiper = this;
28655      if (swiper.enabled) return;
28656      swiper.enabled = true;
28657
28658      if (swiper.params.grabCursor) {
28659        swiper.setGrabCursor();
28660      }
28661
28662      swiper.emit('enable');
28663    };
28664
28665    _proto.disable = function disable() {
28666      var swiper = this;
28667      if (!swiper.enabled) return;
28668      swiper.enabled = false;
28669
28670      if (swiper.params.grabCursor) {
28671        swiper.unsetGrabCursor();
28672      }
28673
28674      swiper.emit('disable');
28675    };
28676
28677    _proto.setProgress = function setProgress(progress, speed) {
28678      var swiper = this;
28679      progress = Math.min(Math.max(progress, 0), 1);
28680      var min = swiper.minTranslate();
28681      var max = swiper.maxTranslate();
28682      var current = (max - min) * progress + min;
28683      swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
28684      swiper.updateActiveIndex();
28685      swiper.updateSlidesClasses();
28686    };
28687
28688    _proto.emitContainerClasses = function emitContainerClasses() {
28689      var swiper = this;
28690      if (!swiper.params._emitClasses || !swiper.el) return;
28691      var classes = swiper.el.className.split(' ').filter(function (className) {
28692        return className.indexOf('swiper-container') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
28693      });
28694      swiper.emit('_containerClasses', classes.join(' '));
28695    };
28696
28697    _proto.getSlideClasses = function getSlideClasses(slideEl) {
28698      var swiper = this;
28699      return slideEl.className.split(' ').filter(function (className) {
28700        return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
28701      }).join(' ');
28702    };
28703
28704    _proto.emitSlidesClasses = function emitSlidesClasses() {
28705      var swiper = this;
28706      if (!swiper.params._emitClasses || !swiper.el) return;
28707      var updates = [];
28708      swiper.slides.each(function (slideEl) {
28709        var classNames = swiper.getSlideClasses(slideEl);
28710        updates.push({
28711          slideEl: slideEl,
28712          classNames: classNames
28713        });
28714        swiper.emit('_slideClass', slideEl, classNames);
28715      });
28716      swiper.emit('_slideClasses', updates);
28717    };
28718
28719    _proto.slidesPerViewDynamic = function slidesPerViewDynamic() {
28720      var swiper = this;
28721      var params = swiper.params,
28722          slides = swiper.slides,
28723          slidesGrid = swiper.slidesGrid,
28724          swiperSize = swiper.size,
28725          activeIndex = swiper.activeIndex;
28726      var spv = 1;
28727
28728      if (params.centeredSlides) {
28729        var slideSize = slides[activeIndex].swiperSlideSize;
28730        var breakLoop;
28731
28732        for (var i = activeIndex + 1; i < slides.length; i += 1) {
28733          if (slides[i] && !breakLoop) {
28734            slideSize += slides[i].swiperSlideSize;
28735            spv += 1;
28736            if (slideSize > swiperSize) breakLoop = true;
28737          }
28738        }
28739
28740        for (var _i = activeIndex - 1; _i >= 0; _i -= 1) {
28741          if (slides[_i] && !breakLoop) {
28742            slideSize += slides[_i].swiperSlideSize;
28743            spv += 1;
28744            if (slideSize > swiperSize) breakLoop = true;
28745          }
28746        }
28747      } else {
28748        for (var _i2 = activeIndex + 1; _i2 < slides.length; _i2 += 1) {
28749          if (slidesGrid[_i2] - slidesGrid[activeIndex] < swiperSize) {
28750            spv += 1;
28751          }
28752        }
28753      }
28754
28755      return spv;
28756    };
28757
28758    _proto.update = function update() {
28759      var swiper = this;
28760      if (!swiper || swiper.destroyed) return;
28761      var snapGrid = swiper.snapGrid,
28762          params = swiper.params; // Breakpoints
28763
28764      if (params.breakpoints) {
28765        swiper.setBreakpoint();
28766      }
28767
28768      swiper.updateSize();
28769      swiper.updateSlides();
28770      swiper.updateProgress();
28771      swiper.updateSlidesClasses();
28772
28773      function setTranslate() {
28774        var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
28775        var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
28776        swiper.setTranslate(newTranslate);
28777        swiper.updateActiveIndex();
28778        swiper.updateSlidesClasses();
28779      }
28780
28781      var translated;
28782
28783      if (swiper.params.freeMode) {
28784        setTranslate();
28785
28786        if (swiper.params.autoHeight) {
28787          swiper.updateAutoHeight();
28788        }
28789      } else {
28790        if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
28791          translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
28792        } else {
28793          translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
28794        }
28795
28796        if (!translated) {
28797          setTranslate();
28798        }
28799      }
28800
28801      if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
28802        swiper.checkOverflow();
28803      }
28804
28805      swiper.emit('update');
28806    };
28807
28808    _proto.changeDirection = function changeDirection(newDirection, needUpdate) {
28809      if (needUpdate === void 0) {
28810        needUpdate = true;
28811      }
28812
28813      var swiper = this;
28814      var currentDirection = swiper.params.direction;
28815
28816      if (!newDirection) {
28817        // eslint-disable-next-line
28818        newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
28819      }
28820
28821      if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
28822        return swiper;
28823      }
28824
28825      swiper.$el.removeClass("" + swiper.params.containerModifierClass + currentDirection).addClass("" + swiper.params.containerModifierClass + newDirection);
28826      swiper.emitContainerClasses();
28827      swiper.params.direction = newDirection;
28828      swiper.slides.each(function (slideEl) {
28829        if (newDirection === 'vertical') {
28830          slideEl.style.width = '';
28831        } else {
28832          slideEl.style.height = '';
28833        }
28834      });
28835      swiper.emit('changeDirection');
28836      if (needUpdate) swiper.update();
28837      return swiper;
28838    };
28839
28840    _proto.mount = function mount(el) {
28841      var swiper = this;
28842      if (swiper.mounted) return true; // Find el
28843
28844      var $el = $(el || swiper.params.el);
28845      el = $el[0];
28846
28847      if (!el) {
28848        return false;
28849      }
28850
28851      el.swiper = swiper;
28852
28853      var getWrapperSelector = function getWrapperSelector() {
28854        return "." + (swiper.params.wrapperClass || '').trim().split(' ').join('.');
28855      };
28856
28857      var getWrapper = function getWrapper() {
28858        if (el && el.shadowRoot && el.shadowRoot.querySelector) {
28859          var res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items
28860
28861          res.children = function (options) {
28862            return $el.children(options);
28863          };
28864
28865          return res;
28866        }
28867
28868        return $el.children(getWrapperSelector());
28869      }; // Find Wrapper
28870
28871
28872      var $wrapperEl = getWrapper();
28873
28874      if ($wrapperEl.length === 0 && swiper.params.createElements) {
28875        var document = getDocument();
28876        var wrapper = document.createElement('div');
28877        $wrapperEl = $(wrapper);
28878        wrapper.className = swiper.params.wrapperClass;
28879        $el.append(wrapper);
28880        $el.children("." + swiper.params.slideClass).each(function (slideEl) {
28881          $wrapperEl.append(slideEl);
28882        });
28883      }
28884
28885      extend(swiper, {
28886        $el: $el,
28887        el: el,
28888        $wrapperEl: $wrapperEl,
28889        wrapperEl: $wrapperEl[0],
28890        mounted: true,
28891        // RTL
28892        rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',
28893        rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
28894        wrongRTL: $wrapperEl.css('display') === '-webkit-box'
28895      });
28896      return true;
28897    };
28898
28899    _proto.init = function init(el) {
28900      var swiper = this;
28901      if (swiper.initialized) return swiper;
28902      var mounted = swiper.mount(el);
28903      if (mounted === false) return swiper;
28904      swiper.emit('beforeInit'); // Set breakpoint
28905
28906      if (swiper.params.breakpoints) {
28907        swiper.setBreakpoint();
28908      } // Add Classes
28909
28910
28911      swiper.addClasses(); // Create loop
28912
28913      if (swiper.params.loop) {
28914        swiper.loopCreate();
28915      } // Update size
28916
28917
28918      swiper.updateSize(); // Update slides
28919
28920      swiper.updateSlides();
28921
28922      if (swiper.params.watchOverflow) {
28923        swiper.checkOverflow();
28924      } // Set Grab Cursor
28925
28926
28927      if (swiper.params.grabCursor && swiper.enabled) {
28928        swiper.setGrabCursor();
28929      }
28930
28931      if (swiper.params.preloadImages) {
28932        swiper.preloadImages();
28933      } // Slide To Initial Slide
28934
28935
28936      if (swiper.params.loop) {
28937        swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true);
28938      } else {
28939        swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
28940      } // Attach events
28941
28942
28943      swiper.attachEvents(); // Init Flag
28944
28945      swiper.initialized = true; // Emit
28946
28947      swiper.emit('init');
28948      swiper.emit('afterInit');
28949      return swiper;
28950    };
28951
28952    _proto.destroy = function destroy(deleteInstance, cleanStyles) {
28953      if (deleteInstance === void 0) {
28954        deleteInstance = true;
28955      }
28956
28957      if (cleanStyles === void 0) {
28958        cleanStyles = true;
28959      }
28960
28961      var swiper = this;
28962      var params = swiper.params,
28963          $el = swiper.$el,
28964          $wrapperEl = swiper.$wrapperEl,
28965          slides = swiper.slides;
28966
28967      if (typeof swiper.params === 'undefined' || swiper.destroyed) {
28968        return null;
28969      }
28970
28971      swiper.emit('beforeDestroy'); // Init Flag
28972
28973      swiper.initialized = false; // Detach events
28974
28975      swiper.detachEvents(); // Destroy loop
28976
28977      if (params.loop) {
28978        swiper.loopDestroy();
28979      } // Cleanup styles
28980
28981
28982      if (cleanStyles) {
28983        swiper.removeClasses();
28984        $el.removeAttr('style');
28985        $wrapperEl.removeAttr('style');
28986
28987        if (slides && slides.length) {
28988          slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');
28989        }
28990      }
28991
28992      swiper.emit('destroy'); // Detach emitter events
28993
28994      Object.keys(swiper.eventsListeners).forEach(function (eventName) {
28995        swiper.off(eventName);
28996      });
28997
28998      if (deleteInstance !== false) {
28999        swiper.$el[0].swiper = null;
29000        deleteProps(swiper);
29001      }
29002
29003      swiper.destroyed = true;
29004      return null;
29005    };
29006
29007    Swiper.extendDefaults = function extendDefaults(newDefaults) {
29008      extend(extendedDefaults, newDefaults);
29009    };
29010
29011    Swiper.installModule = function installModule(module) {
29012      if (!Swiper.prototype.modules) Swiper.prototype.modules = {};
29013      var name = module.name || Object.keys(Swiper.prototype.modules).length + "_" + now();
29014      Swiper.prototype.modules[name] = module;
29015    };
29016
29017    Swiper.use = function use(module) {
29018      if (Array.isArray(module)) {
29019        module.forEach(function (m) {
29020          return Swiper.installModule(m);
29021        });
29022        return Swiper;
29023      }
29024
29025      Swiper.installModule(module);
29026      return Swiper;
29027    };
29028
29029    _createClass(Swiper, null, [{
29030      key: "extendedDefaults",
29031      get: function get() {
29032        return extendedDefaults;
29033      }
29034    }, {
29035      key: "defaults",
29036      get: function get() {
29037        return defaults;
29038      }
29039    }]);
29040
29041    return Swiper;
29042  }();
29043
29044  Object.keys(prototypes).forEach(function (prototypeGroup) {
29045    Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) {
29046      Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
29047    });
29048  });
29049  Swiper.use([Resize, Observer$1]);
29050
29051  var Virtual = {
29052    update: function update(force) {
29053      var swiper = this;
29054      var _swiper$params = swiper.params,
29055          slidesPerView = _swiper$params.slidesPerView,
29056          slidesPerGroup = _swiper$params.slidesPerGroup,
29057          centeredSlides = _swiper$params.centeredSlides;
29058      var _swiper$params$virtua = swiper.params.virtual,
29059          addSlidesBefore = _swiper$params$virtua.addSlidesBefore,
29060          addSlidesAfter = _swiper$params$virtua.addSlidesAfter;
29061      var _swiper$virtual = swiper.virtual,
29062          previousFrom = _swiper$virtual.from,
29063          previousTo = _swiper$virtual.to,
29064          slides = _swiper$virtual.slides,
29065          previousSlidesGrid = _swiper$virtual.slidesGrid,
29066          renderSlide = _swiper$virtual.renderSlide,
29067          previousOffset = _swiper$virtual.offset;
29068      swiper.updateActiveIndex();
29069      var activeIndex = swiper.activeIndex || 0;
29070      var offsetProp;
29071      if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top';
29072      var slidesAfter;
29073      var slidesBefore;
29074
29075      if (centeredSlides) {
29076        slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter;
29077        slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore;
29078      } else {
29079        slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter;
29080        slidesBefore = slidesPerGroup + addSlidesBefore;
29081      }
29082
29083      var from = Math.max((activeIndex || 0) - slidesBefore, 0);
29084      var to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1);
29085      var offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0);
29086      extend(swiper.virtual, {
29087        from: from,
29088        to: to,
29089        offset: offset,
29090        slidesGrid: swiper.slidesGrid
29091      });
29092
29093      function onRendered() {
29094        swiper.updateSlides();
29095        swiper.updateProgress();
29096        swiper.updateSlidesClasses();
29097
29098        if (swiper.lazy && swiper.params.lazy.enabled) {
29099          swiper.lazy.load();
29100        }
29101      }
29102
29103      if (previousFrom === from && previousTo === to && !force) {
29104        if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {
29105          swiper.slides.css(offsetProp, offset + "px");
29106        }
29107
29108        swiper.updateProgress();
29109        return;
29110      }
29111
29112      if (swiper.params.virtual.renderExternal) {
29113        swiper.params.virtual.renderExternal.call(swiper, {
29114          offset: offset,
29115          from: from,
29116          to: to,
29117          slides: function getSlides() {
29118            var slidesToRender = [];
29119
29120            for (var i = from; i <= to; i += 1) {
29121              slidesToRender.push(slides[i]);
29122            }
29123
29124            return slidesToRender;
29125          }()
29126        });
29127
29128        if (swiper.params.virtual.renderExternalUpdate) {
29129          onRendered();
29130        }
29131
29132        return;
29133      }
29134
29135      var prependIndexes = [];
29136      var appendIndexes = [];
29137
29138      if (force) {
29139        swiper.$wrapperEl.find("." + swiper.params.slideClass).remove();
29140      } else {
29141        for (var i = previousFrom; i <= previousTo; i += 1) {
29142          if (i < from || i > to) {
29143            swiper.$wrapperEl.find("." + swiper.params.slideClass + "[data-swiper-slide-index=\"" + i + "\"]").remove();
29144          }
29145        }
29146      }
29147
29148      for (var _i = 0; _i < slides.length; _i += 1) {
29149        if (_i >= from && _i <= to) {
29150          if (typeof previousTo === 'undefined' || force) {
29151            appendIndexes.push(_i);
29152          } else {
29153            if (_i > previousTo) appendIndexes.push(_i);
29154            if (_i < previousFrom) prependIndexes.push(_i);
29155          }
29156        }
29157      }
29158
29159      appendIndexes.forEach(function (index) {
29160        swiper.$wrapperEl.append(renderSlide(slides[index], index));
29161      });
29162      prependIndexes.sort(function (a, b) {
29163        return b - a;
29164      }).forEach(function (index) {
29165        swiper.$wrapperEl.prepend(renderSlide(slides[index], index));
29166      });
29167      swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, offset + "px");
29168      onRendered();
29169    },
29170    renderSlide: function renderSlide(slide, index) {
29171      var swiper = this;
29172      var params = swiper.params.virtual;
29173
29174      if (params.cache && swiper.virtual.cache[index]) {
29175        return swiper.virtual.cache[index];
29176      }
29177
29178      var $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $("<div class=\"" + swiper.params.slideClass + "\" data-swiper-slide-index=\"" + index + "\">" + slide + "</div>");
29179      if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index);
29180      if (params.cache) swiper.virtual.cache[index] = $slideEl;
29181      return $slideEl;
29182    },
29183    appendSlide: function appendSlide(slides) {
29184      var swiper = this;
29185
29186      if (typeof slides === 'object' && 'length' in slides) {
29187        for (var i = 0; i < slides.length; i += 1) {
29188          if (slides[i]) swiper.virtual.slides.push(slides[i]);
29189        }
29190      } else {
29191        swiper.virtual.slides.push(slides);
29192      }
29193
29194      swiper.virtual.update(true);
29195    },
29196    prependSlide: function prependSlide(slides) {
29197      var swiper = this;
29198      var activeIndex = swiper.activeIndex;
29199      var newActiveIndex = activeIndex + 1;
29200      var numberOfNewSlides = 1;
29201
29202      if (Array.isArray(slides)) {
29203        for (var i = 0; i < slides.length; i += 1) {
29204          if (slides[i]) swiper.virtual.slides.unshift(slides[i]);
29205        }
29206
29207        newActiveIndex = activeIndex + slides.length;
29208        numberOfNewSlides = slides.length;
29209      } else {
29210        swiper.virtual.slides.unshift(slides);
29211      }
29212
29213      if (swiper.params.virtual.cache) {
29214        var cache = swiper.virtual.cache;
29215        var newCache = {};
29216        Object.keys(cache).forEach(function (cachedIndex) {
29217          var $cachedEl = cache[cachedIndex];
29218          var cachedElIndex = $cachedEl.attr('data-swiper-slide-index');
29219
29220          if (cachedElIndex) {
29221            $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + 1);
29222          }
29223
29224          newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl;
29225        });
29226        swiper.virtual.cache = newCache;
29227      }
29228
29229      swiper.virtual.update(true);
29230      swiper.slideTo(newActiveIndex, 0);
29231    },
29232    removeSlide: function removeSlide(slidesIndexes) {
29233      var swiper = this;
29234      if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return;
29235      var activeIndex = swiper.activeIndex;
29236
29237      if (Array.isArray(slidesIndexes)) {
29238        for (var i = slidesIndexes.length - 1; i >= 0; i -= 1) {
29239          swiper.virtual.slides.splice(slidesIndexes[i], 1);
29240
29241          if (swiper.params.virtual.cache) {
29242            delete swiper.virtual.cache[slidesIndexes[i]];
29243          }
29244
29245          if (slidesIndexes[i] < activeIndex) activeIndex -= 1;
29246          activeIndex = Math.max(activeIndex, 0);
29247        }
29248      } else {
29249        swiper.virtual.slides.splice(slidesIndexes, 1);
29250
29251        if (swiper.params.virtual.cache) {
29252          delete swiper.virtual.cache[slidesIndexes];
29253        }
29254
29255        if (slidesIndexes < activeIndex) activeIndex -= 1;
29256        activeIndex = Math.max(activeIndex, 0);
29257      }
29258
29259      swiper.virtual.update(true);
29260      swiper.slideTo(activeIndex, 0);
29261    },
29262    removeAllSlides: function removeAllSlides() {
29263      var swiper = this;
29264      swiper.virtual.slides = [];
29265
29266      if (swiper.params.virtual.cache) {
29267        swiper.virtual.cache = {};
29268      }
29269
29270      swiper.virtual.update(true);
29271      swiper.slideTo(0, 0);
29272    }
29273  };
29274  var Virtual$1 = {
29275    name: 'virtual',
29276    params: {
29277      virtual: {
29278        enabled: false,
29279        slides: [],
29280        cache: true,
29281        renderSlide: null,
29282        renderExternal: null,
29283        renderExternalUpdate: true,
29284        addSlidesBefore: 0,
29285        addSlidesAfter: 0
29286      }
29287    },
29288    create: function create() {
29289      var swiper = this;
29290      bindModuleMethods(swiper, {
29291        virtual: _extends({}, Virtual, {
29292          slides: swiper.params.virtual.slides,
29293          cache: {}
29294        })
29295      });
29296    },
29297    on: {
29298      beforeInit: function beforeInit(swiper) {
29299        if (!swiper.params.virtual.enabled) return;
29300        swiper.classNames.push(swiper.params.containerModifierClass + "virtual");
29301        var overwriteParams = {
29302          watchSlidesProgress: true
29303        };
29304        extend(swiper.params, overwriteParams);
29305        extend(swiper.originalParams, overwriteParams);
29306
29307        if (!swiper.params.initialSlide) {
29308          swiper.virtual.update();
29309        }
29310      },
29311      setTranslate: function setTranslate(swiper) {
29312        if (!swiper.params.virtual.enabled) return;
29313        swiper.virtual.update();
29314      }
29315    }
29316  };
29317
29318  var Keyboard = {
29319    handle: function handle(event) {
29320      var swiper = this;
29321      if (!swiper.enabled) return;
29322      var window = getWindow();
29323      var document = getDocument();
29324      var rtl = swiper.rtlTranslate;
29325      var e = event;
29326      if (e.originalEvent) e = e.originalEvent; // jquery fix
29327
29328      var kc = e.keyCode || e.charCode;
29329      var pageUpDown = swiper.params.keyboard.pageUpDown;
29330      var isPageUp = pageUpDown && kc === 33;
29331      var isPageDown = pageUpDown && kc === 34;
29332      var isArrowLeft = kc === 37;
29333      var isArrowRight = kc === 39;
29334      var isArrowUp = kc === 38;
29335      var isArrowDown = kc === 40; // Directions locks
29336
29337      if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {
29338        return false;
29339      }
29340
29341      if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {
29342        return false;
29343      }
29344
29345      if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
29346        return undefined;
29347      }
29348
29349      if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
29350        return undefined;
29351      }
29352
29353      if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
29354        var inView = false; // Check that swiper should be inside of visible area of window
29355
29356        if (swiper.$el.parents("." + swiper.params.slideClass).length > 0 && swiper.$el.parents("." + swiper.params.slideActiveClass).length === 0) {
29357          return undefined;
29358        }
29359
29360        var $el = swiper.$el;
29361        var swiperWidth = $el[0].clientWidth;
29362        var swiperHeight = $el[0].clientHeight;
29363        var windowWidth = window.innerWidth;
29364        var windowHeight = window.innerHeight;
29365        var swiperOffset = swiper.$el.offset();
29366        if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft;
29367        var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]];
29368
29369        for (var i = 0; i < swiperCoord.length; i += 1) {
29370          var point = swiperCoord[i];
29371
29372          if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {
29373            if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
29374
29375            inView = true;
29376          }
29377        }
29378
29379        if (!inView) return undefined;
29380      }
29381
29382      if (swiper.isHorizontal()) {
29383        if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {
29384          if (e.preventDefault) e.preventDefault();else e.returnValue = false;
29385        }
29386
29387        if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();
29388        if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();
29389      } else {
29390        if (isPageUp || isPageDown || isArrowUp || isArrowDown) {
29391          if (e.preventDefault) e.preventDefault();else e.returnValue = false;
29392        }
29393
29394        if (isPageDown || isArrowDown) swiper.slideNext();
29395        if (isPageUp || isArrowUp) swiper.slidePrev();
29396      }
29397
29398      swiper.emit('keyPress', kc);
29399      return undefined;
29400    },
29401    enable: function enable() {
29402      var swiper = this;
29403      var document = getDocument();
29404      if (swiper.keyboard.enabled) return;
29405      $(document).on('keydown', swiper.keyboard.handle);
29406      swiper.keyboard.enabled = true;
29407    },
29408    disable: function disable() {
29409      var swiper = this;
29410      var document = getDocument();
29411      if (!swiper.keyboard.enabled) return;
29412      $(document).off('keydown', swiper.keyboard.handle);
29413      swiper.keyboard.enabled = false;
29414    }
29415  };
29416  var Keyboard$1 = {
29417    name: 'keyboard',
29418    params: {
29419      keyboard: {
29420        enabled: false,
29421        onlyInViewport: true,
29422        pageUpDown: true
29423      }
29424    },
29425    create: function create() {
29426      var swiper = this;
29427      bindModuleMethods(swiper, {
29428        keyboard: _extends({
29429          enabled: false
29430        }, Keyboard)
29431      });
29432    },
29433    on: {
29434      init: function init(swiper) {
29435        if (swiper.params.keyboard.enabled) {
29436          swiper.keyboard.enable();
29437        }
29438      },
29439      destroy: function destroy(swiper) {
29440        if (swiper.keyboard.enabled) {
29441          swiper.keyboard.disable();
29442        }
29443      }
29444    }
29445  };
29446
29447  /* eslint-disable consistent-return */
29448
29449  function isEventSupported() {
29450    var document = getDocument();
29451    var eventName = 'onwheel';
29452    var isSupported = (eventName in document);
29453
29454    if (!isSupported) {
29455      var element = document.createElement('div');
29456      element.setAttribute(eventName, 'return;');
29457      isSupported = typeof element[eventName] === 'function';
29458    }
29459
29460    if (!isSupported && document.implementation && document.implementation.hasFeature && // always returns true in newer browsers as per the standard.
29461    // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
29462    document.implementation.hasFeature('', '') !== true) {
29463      // This is the only way to test support for the `wheel` event in IE9+.
29464      isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
29465    }
29466
29467    return isSupported;
29468  }
29469
29470  var Mousewheel = {
29471    lastScrollTime: now(),
29472    lastEventBeforeSnap: undefined,
29473    recentWheelEvents: [],
29474    event: function event() {
29475      var window = getWindow();
29476      if (window.navigator.userAgent.indexOf('firefox') > -1) return 'DOMMouseScroll';
29477      return isEventSupported() ? 'wheel' : 'mousewheel';
29478    },
29479    normalize: function normalize(e) {
29480      // Reasonable defaults
29481      var PIXEL_STEP = 10;
29482      var LINE_HEIGHT = 40;
29483      var PAGE_HEIGHT = 800;
29484      var sX = 0;
29485      var sY = 0; // spinX, spinY
29486
29487      var pX = 0;
29488      var pY = 0; // pixelX, pixelY
29489      // Legacy
29490
29491      if ('detail' in e) {
29492        sY = e.detail;
29493      }
29494
29495      if ('wheelDelta' in e) {
29496        sY = -e.wheelDelta / 120;
29497      }
29498
29499      if ('wheelDeltaY' in e) {
29500        sY = -e.wheelDeltaY / 120;
29501      }
29502
29503      if ('wheelDeltaX' in e) {
29504        sX = -e.wheelDeltaX / 120;
29505      } // side scrolling on FF with DOMMouseScroll
29506
29507
29508      if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) {
29509        sX = sY;
29510        sY = 0;
29511      }
29512
29513      pX = sX * PIXEL_STEP;
29514      pY = sY * PIXEL_STEP;
29515
29516      if ('deltaY' in e) {
29517        pY = e.deltaY;
29518      }
29519
29520      if ('deltaX' in e) {
29521        pX = e.deltaX;
29522      }
29523
29524      if (e.shiftKey && !pX) {
29525        // if user scrolls with shift he wants horizontal scroll
29526        pX = pY;
29527        pY = 0;
29528      }
29529
29530      if ((pX || pY) && e.deltaMode) {
29531        if (e.deltaMode === 1) {
29532          // delta in LINE units
29533          pX *= LINE_HEIGHT;
29534          pY *= LINE_HEIGHT;
29535        } else {
29536          // delta in PAGE units
29537          pX *= PAGE_HEIGHT;
29538          pY *= PAGE_HEIGHT;
29539        }
29540      } // Fall-back if spin cannot be determined
29541
29542
29543      if (pX && !sX) {
29544        sX = pX < 1 ? -1 : 1;
29545      }
29546
29547      if (pY && !sY) {
29548        sY = pY < 1 ? -1 : 1;
29549      }
29550
29551      return {
29552        spinX: sX,
29553        spinY: sY,
29554        pixelX: pX,
29555        pixelY: pY
29556      };
29557    },
29558    handleMouseEnter: function handleMouseEnter() {
29559      var swiper = this;
29560      if (!swiper.enabled) return;
29561      swiper.mouseEntered = true;
29562    },
29563    handleMouseLeave: function handleMouseLeave() {
29564      var swiper = this;
29565      if (!swiper.enabled) return;
29566      swiper.mouseEntered = false;
29567    },
29568    handle: function handle(event) {
29569      var e = event;
29570      var disableParentSwiper = true;
29571      var swiper = this;
29572      if (!swiper.enabled) return;
29573      var params = swiper.params.mousewheel;
29574
29575      if (swiper.params.cssMode) {
29576        e.preventDefault();
29577      }
29578
29579      var target = swiper.$el;
29580
29581      if (swiper.params.mousewheel.eventsTarget !== 'container') {
29582        target = $(swiper.params.mousewheel.eventsTarget);
29583      }
29584
29585      if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true;
29586      if (e.originalEvent) e = e.originalEvent; // jquery fix
29587
29588      var delta = 0;
29589      var rtlFactor = swiper.rtlTranslate ? -1 : 1;
29590      var data = Mousewheel.normalize(e);
29591
29592      if (params.forceToAxis) {
29593        if (swiper.isHorizontal()) {
29594          if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true;
29595        } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true;
29596      } else {
29597        delta = Math.abs(data.pixelX) >
29597 Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
29598      }
29599
29600      if (delta === 0) return true;
29601      if (params.invert) delta = -delta; // Get the scroll positions
29602
29603      var positions = swiper.getTranslate() + delta * params.sensitivity;
29604      if (positions >= swiper.minTranslate()) positions = swiper.minTranslate();
29605      if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); // When loop is true:
29606      //     the disableParentSwiper will be true.
29607      // When loop is false:
29608      //     if the scroll positions is not on edge,
29609      //     then the disableParentSwiper will be true.
29610      //     if the scroll on edge positions,
29611      //     then the disableParentSwiper will be false.
29612
29613      disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate());
29614      if (disableParentSwiper && swiper.params.nested) e.stopPropagation();
29615
29616      if (!swiper.params.freeMode) {
29617        // Register the new event in a variable which stores the relevant data
29618        var newEvent = {
29619          time: now(),
29620          delta: Math.abs(delta),
29621          direction: Math.sign(delta),
29622          raw: event
29623        }; // Keep the most recent events
29624
29625        var recentWheelEvents = swiper.mousewheel.recentWheelEvents;
29626
29627        if (recentWheelEvents.length >= 2) {
29628          recentWheelEvents.shift(); // only store the last N events
29629        }
29630
29631        var prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;
29632        recentWheelEvents.push(newEvent); // If there is at least one previous recorded event:
29633        //   If direction has changed or
29634        //   if the scroll is quicker than the previous one:
29635        //     Animate the slider.
29636        // Else (this is the first time the wheel is moved):
29637        //     Animate the slider.
29638
29639        if (prevEvent) {
29640          if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) {
29641            swiper.mousewheel.animateSlider(newEvent);
29642          }
29643        } else {
29644          swiper.mousewheel.animateSlider(newEvent);
29645        } // If it's time to release the scroll:
29646        //   Return now so you don't hit the preventDefault.
29647
29648
29649        if (swiper.mousewheel.releaseScroll(newEvent)) {
29650          return true;
29651        }
29652      } else {
29653        // Freemode or scrollContainer:
29654        // If we recently snapped after a momentum scroll, then ignore wheel events
29655        // to give time for the deceleration to finish. Stop ignoring after 500 msecs
29656        // or if it's a new scroll (larger delta or inverse sign as last event before
29657        // an end-of-momentum snap).
29658        var _newEvent = {
29659          time: now(),
29660          delta: Math.abs(delta),
29661          direction: Math.sign(delta)
29662        };
29663        var lastEventBeforeSnap = swiper.mousewheel.lastEventBeforeSnap;
29664        var ignoreWheelEvents = lastEventBeforeSnap && _newEvent.time < lastEventBeforeSnap.time + 500 && _newEvent.delta <= lastEventBeforeSnap.delta && _newEvent.direction === lastEventBeforeSnap.direction;
29665
29666        if (!ignoreWheelEvents) {
29667          swiper.mousewheel.lastEventBeforeSnap = undefined;
29668
29669          if (swiper.params.loop) {
29670            swiper.loopFix();
29671          }
29672
29673          var position = swiper.getTranslate() + delta * params.sensitivity;
29674          var wasBeginning = swiper.isBeginning;
29675          var wasEnd = swiper.isEnd;
29676          if (position >= swiper.minTranslate()) position = swiper.minTranslate();
29677          if (position <= swiper.maxTranslate()) position = swiper.maxTranslate();
29678          swiper.setTransition(0);
29679          swiper.setTranslate(position);
29680          swiper.updateProgress();
29681          swiper.updateActiveIndex();
29682          swiper.updateSlidesClasses();
29683
29684          if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) {
29685            swiper.updateSlidesClasses();
29686          }
29687
29688          if (swiper.params.freeModeSticky) {
29689            // When wheel scrolling starts with sticky (aka snap) enabled, then detect
29690            // the end of a momentum scroll by storing recent (N=15?) wheel events.
29691            // 1. do all N events have decreasing or same (absolute value) delta?
29692            // 2. did all N events arrive in the last M (M=500?) msecs?
29693            // 3. does the earliest event have an (absolute value) delta that's
29694            //    at least P (P=1?) larger than the most recent event's delta?
29695            // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels?
29696            // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration.
29697            // Snap immediately and ignore remaining wheel events in this scroll.
29698            // See comment above for "remaining wheel events in this scroll" determination.
29699            // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event.
29700            clearTimeout(swiper.mousewheel.timeout);
29701            swiper.mousewheel.timeout = undefined;
29702            var _recentWheelEvents = swiper.mousewheel.recentWheelEvents;
29703
29704            if (_recentWheelEvents.length >= 15) {
29705              _recentWheelEvents.shift(); // only store the last N events
29706
29707            }
29708
29709            var _prevEvent = _recentWheelEvents.length ? _recentWheelEvents[_recentWheelEvents.length - 1] : undefined;
29710
29711            var firstEvent = _recentWheelEvents[0];
29712
29713            _recentWheelEvents.push(_newEvent);
29714
29715            if (_prevEvent && (_newEvent.delta > _prevEvent.delta || _newEvent.direction !== _prevEvent.direction)) {
29716              // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log.
29717              _recentWheelEvents.splice(0);
29718            } else if (_recentWheelEvents.length >= 15 && _newEvent.time - firstEvent.time < 500 && firstEvent.delta - _newEvent.delta >= 1 && _newEvent.delta <= 6) {
29719              // We're at the end of the deceleration of a momentum scroll, so there's no need
29720              // to wait for more events. Snap ASAP on the next tick.
29721              // Also, because there's some remaining momentum we'll bias the snap in the
29722              // direction of the ongoing scroll because it's better UX for the scroll to snap
29723              // in the same direction as the scroll instead of reversing to snap.  Therefore,
29724              // if it's already scrolled more than 20% in the current direction, keep going.
29725              var snapToThreshold = delta > 0 ? 0.8 : 0.2;
29726              swiper.mousewheel.lastEventBeforeSnap = _newEvent;
29727
29728              _recentWheelEvents.splice(0);
29729
29730              swiper.mousewheel.timeout = nextTick(function () {
29731                swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
29732              }, 0); // no delay; move on next tick
29733            }
29734
29735            if (!swiper.mousewheel.timeout) {
29736              // if we get here, then we haven't detected the end of a momentum scroll, so
29737              // we'll consider a scroll "complete" when there haven't been any wheel events
29738              // for 500ms.
29739              swiper.mousewheel.timeout = nextTick(function () {
29740                var snapToThreshold = 0.5;
29741                swiper.mousewheel.lastEventBeforeSnap = _newEvent;
29742
29743                _recentWheelEvents.splice(0);
29744
29745                swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
29746              }, 500);
29747            }
29748          } // Emit event
29749
29750
29751          if (!ignoreWheelEvents) swiper.emit('scroll', e); // Stop autoplay
29752
29753          if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions
29754
29755          if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true;
29756        }
29757      }
29758
29759      if (e.preventDefault) e.preventDefault();else e.returnValue = false;
29760      return false;
29761    },
29762    animateSlider: function animateSlider(newEvent) {
29763      var swiper = this;
29764      var window = getWindow();
29765
29766      if (this.params.mousewheel.thresholdDelta && newEvent.delta < this.params.mousewheel.thresholdDelta) {
29767        // Prevent if delta of wheel scroll delta is below configured threshold
29768        return false;
29769      }
29770
29771      if (this.params.mousewheel.thresholdTime && now() - swiper.mousewheel.lastScrollTime < this.params.mousewheel.thresholdTime) {
29772        // Prevent if time between scrolls is below configured threshold
29773        return false;
29774      } // If the movement is NOT big enough and
29775      // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider):
29776      //   Don't go any further (avoid insignificant scroll movement).
29777
29778
29779      if (newEvent.delta >= 6 && now() - swiper.mousewheel.lastScrollTime < 60) {
29780        // Return false as a default
29781        return true;
29782      } // If user is scrolling towards the end:
29783      //   If the slider hasn't hit the latest slide or
29784      //   if the slider is a loop and
29785      //   if the slider isn't moving right now:
29786      //     Go to next slide and
29787      //     emit a scroll event.
29788      // Else (the user is scrolling towards the beginning) and
29789      // if the slider hasn't hit the first slide or
29790      // if the slider is a loop and
29791      // if the slider isn't moving right now:
29792      //   Go to prev slide and
29793      //   emit a scroll event.
29794
29795
29796      if (newEvent.direction < 0) {
29797        if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) {
29798          swiper.slideNext();
29799          swiper.emit('scroll', newEvent.raw);
29800        }
29801      } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) {
29802        swiper.slidePrev();
29803        swiper.emit('scroll', newEvent.raw);
29804      } // If you got here is because an animation has been triggered so store the current time
29805
29806
29807      swiper.mousewheel.lastScrollTime = new window.Date().getTime(); // Return false as a default
29808
29809      return false;
29810    },
29811    releaseScroll: function releaseScroll(newEvent) {
29812      var swiper = this;
29813      var params = swiper.params.mousewheel;
29814
29815      if (newEvent.direction < 0) {
29816        if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) {
29817          // Return true to animate scroll on edges
29818          return true;
29819        }
29820      } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) {
29821        // Return true to animate scroll on edges
29822        return true;
29823      }
29824
29825      return false;
29826    },
29827    enable: function enable() {
29828      var swiper = this;
29829      var event = Mousewheel.event();
29830
29831      if (swiper.params.cssMode) {
29832        swiper.wrapperEl.removeEventListener(event, swiper.mousewheel.handle);
29833        return true;
29834      }
29835
29836      if (!event) return false;
29837      if (swiper.mousewheel.enabled) return false;
29838      var target = swiper.$el;
29839
29840      if (swiper.params.mousewheel.eventsTarget !== 'container') {
29841        target = $(swiper.params.mousewheel.eventsTarget);
29842      }
29843
29844      target.on('mouseenter', swiper.mousewheel.handleMouseEnter);
29845      target.on('mouseleave', swiper.mousewheel.handleMouseLeave);
29846      target.on(event, swiper.mousewheel.handle);
29847      swiper.mousewheel.enabled = true;
29848      return true;
29849    },
29850    disable: function disable() {
29851      var swiper = this;
29852      var event = Mousewheel.event();
29853
29854      if (swiper.params.cssMode) {
29855        swiper.wrapperEl.addEventListener(event, swiper.mousewheel.handle);
29856        return true;
29857      }
29858
29859      if (!event) return false;
29860      if (!swiper.mousewheel.enabled) return false;
29861      var target = swiper.$el;
29862
29863      if (swiper.params.mousewheel.eventsTarget !== 'container') {
29864        target = $(swiper.params.mousewheel.eventsTarget);
29865      }
29866
29867      target.off(event, swiper.mousewheel.handle);
29868      swiper.mousewheel.enabled = false;
29869      return true;
29870    }
29871  };
29872  var Mousewheel$1 = {
29873    name: 'mousewheel',
29874    params: {
29875      mousewheel: {
29876        enabled: false,
29877        releaseOnEdges: false,
29878        invert: false,
29879        forceToAxis: false,
29880        sensitivity: 1,
29881        eventsTarget: 'container',
29882        thresholdDelta: null,
29883        thresholdTime: null
29884      }
29885    },
29886    create: function create() {
29887      var swiper = this;
29888      bindModuleMethods(swiper, {
29889        mousewheel: {
29890          enabled: false,
29891          lastScrollTime: now(),
29892          lastEventBeforeSnap: undefined,
29893          recentWheelEvents: [],
29894          enable: Mousewheel.enable,
29895          disable: Mousewheel.disable,
29896          handle: Mousewheel.handle,
29897          handleMouseEnter: Mousewheel.handleMouseEnter,
29898          handleMouseLeave: Mousewheel.handleMouseLeave,
29899          animateSlider: Mousewheel.animateSlider,
29900          releaseScroll: Mousewheel.releaseScroll
29901        }
29902      });
29903    },
29904    on: {
29905      init: function init(swiper) {
29906        if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) {
29907          swiper.mousewheel.disable();
29908        }
29909
29910        if (swiper.params.mousewheel.enabled) swiper.mousewheel.enable();
29911      },
29912      destroy: function destroy(swiper) {
29913        if (swiper.params.cssMode) {
29914          swiper.mousewheel.enable();
29915        }
29916
29917        if (swiper.mousewheel.enabled) swiper.mousewheel.disable();
29918      }
29919    }
29920  };
29921
29922  var Navigation = {
29923    toggleEl: function toggleEl($el, disabled) {
29924      $el[disabled ? 'addClass' : 'removeClass'](this.params.navigation.disabledClass);
29925      if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled;
29926    },
29927    update: function update() {
29928      // Update Navigation Buttons
29929      var swiper = this;
29930      var params = swiper.params.navigation;
29931      var toggleEl = swiper.navigation.toggleEl;
29932      if (swiper.params.loop) return;
29933      var _swiper$navigation = swiper.navigation,
29934          $nextEl = _swiper$navigation.$nextEl,
29935          $prevEl = _swiper$navigation.$prevEl;
29936
29937      if ($prevEl && $prevEl.length > 0) {
29938        if (swiper.isBeginning) {
29939          toggleEl($prevEl, true);
29940        } else {
29941          toggleEl($prevEl, false);
29942        }
29943
29944        if (swiper.params.watchOverflow && swiper.enabled) {
29945          $prevEl[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
29946        }
29947      }
29948
29949      if ($nextEl && $nextEl.length > 0) {
29950        if (swiper.isEnd) {
29951          toggleEl($nextEl, true);
29952        } else {
29953          toggleEl($nextEl, false);
29954        }
29955
29956        if (swiper.params.watchOverflow && swiper.enabled) {
29957          $nextEl[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
29958        }
29959      }
29960    },
29961    onPrevClick: function onPrevClick(e) {
29962      var swiper = this;
29963      e.preventDefault();
29964      if (swiper.isBeginning && !swiper.params.loop) return;
29965      swiper.slidePrev();
29966    },
29967    onNextClick: function onNextClick(e) {
29968      var swiper = this;
29969      e.preventDefault();
29970      if (swiper.isEnd && !swiper.params.loop) return;
29971      swiper.slideNext();
29972    },
29973    init: function init() {
29974      var swiper = this;
29975      var params = swiper.params.navigation;
29976      swiper.params.navigation = createElementIfNotDefined(swiper.$el, swiper.params.navigation, swiper.params.createElements, {
29977        nextEl: 'swiper-button-next',
29978        prevEl: 'swiper-button-prev'
29979      });
29980      if (!(params.nextEl || params.prevEl)) return;
29981      var $nextEl;
29982      var $prevEl;
29983
29984      if (params.nextEl) {
29985        $nextEl = $(params.nextEl);
29986
29987        if (swiper.params.uniqueNavElements && typeof params.nextEl === 'string' && $nextEl.length > 1 && swiper.$el.find(params.nextEl).length === 1) {
29988          $nextEl = swiper.$el.find(params.nextEl);
29989        }
29990      }
29991
29992      if (params.prevEl) {
29993        $prevEl = $(params.prevEl);
29994
29995        if (swiper.params.uniqueNavElements && typeof params.prevEl === 'string' && $prevEl.length > 1 && swiper.$el.find(params.prevEl).length === 1) {
29996          $prevEl = swiper.$el.find(params.prevEl);
29997        }
29998      }
29999
30000      if ($nextEl && $nextEl.length > 0) {
30001        $nextEl.on('click', swiper.navigation.onNextClick);
30002      }
30003
30004      if ($prevEl && $prevEl.length > 0) {
30005        $prevEl.on('click', swiper.navigation.onPrevClick);
30006      }
30007
30008      extend(swiper.navigation, {
30009        $nextEl: $nextEl,
30010        nextEl: $nextEl && $nextEl[0],
30011        $prevEl: $prevEl,
30012        prevEl: $prevEl && $prevEl[0]
30013      });
30014
30015      if (!swiper.enabled) {
30016        if ($nextEl) $nextEl.addClass(params.lockClass);
30017        if ($prevEl) $prevEl.addClass(params.lockClass);
30018      }
30019    },
30020    destroy: function destroy() {
30021      var swiper = this;
30022      var _swiper$navigation2 = swiper.navigation,
30023          $nextEl = _swiper$navigation2.$nextEl,
30024          $prevEl = _swiper$navigation2.$prevEl;
30025
30026      if ($nextEl && $nextEl.length) {
30027        $nextEl.off('click', swiper.navigation.onNextClick);
30028        $nextEl.removeClass(swiper.params.navigation.disabledClass);
30029      }
30030
30031      if ($prevEl && $prevEl.length) {
30032        $prevEl.off('click', swiper.navigation.onPrevClick);
30033        $prevEl.removeClass(swiper.params.navigation.disabledClass);
30034      }
30035    }
30036  };
30037  var Navigation$1 = {
30038    name: 'navigation',
30039    params: {
30040      navigation: {
30041        nextEl: null,
30042        prevEl: null,
30043        hideOnClick: false,
30044        disabledClass: 'swiper-button-disabled',
30045        hiddenClass: 'swiper-button-hidden',
30046        lockClass: 'swiper-button-lock'
30047      }
30048    },
30049    create: function create() {
30050      var swiper = this;
30051      bindModuleMethods(swiper, {
30052        navigation: _extends({}, Navigation)
30053      });
30054    },
30055    on: {
30056      init: function init(swiper) {
30057        swiper.navigation.init();
30058        swiper.navigation.update();
30059      },
30060      toEdge: function toEdge(swiper) {
30061        swiper.navigation.update();
30062      },
30063      fromEdge: function fromEdge(swiper) {
30064        swiper.navigation.update();
30065      },
30066      destroy: function destroy(swiper) {
30067        swiper.navigation.destroy();
30068      },
30069      'enable disable': function enableDisable(swiper) {
30070        var _swiper$navigation3 = swiper.navigation,
30071            $nextEl = _swiper$navigation3.$nextEl,
30072            $prevEl = _swiper$navigation3.$prevEl;
30073
30074        if ($nextEl) {
30075          $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);
30076        }
30077
30078        if ($prevEl) {
30079          $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);
30080        }
30081      },
30082      click: function click(swiper, e) {
30083        var _swiper$navigation4 = swiper.navigation,
30084            $nextEl = _swiper$navigation4.$nextEl,
30085            $prevEl = _swiper$navigation4.$prevEl;
30086        var targetEl = e.target;
30087
30088        if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) {
30089          if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
30090          var isHidden;
30091
30092          if ($nextEl) {
30093            isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
30094          } else if ($prevEl) {
30095            isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
30096          }
30097
30098          if (isHidden === true) {
30099            swiper.emit('navigationShow');
30100          } else {
30101            swiper.emit('navigationHide');
30102          }
30103
30104          if ($nextEl) {
30105            $nextEl.toggleClass(swiper.params.navigation.hiddenClass);
30106          }
30107
30108          if ($prevEl) {
30109            $prevEl.toggleClass(swiper.params.navigation.hiddenClass);
30110          }
30111        }
30112      }
30113    }
30114  };
30115
30116  var Pagination = {
30117    update: function update() {
30118      // Render || Update Pagination bullets/items
30119      var swiper = this;
30120      var rtl = swiper.rtl;
30121      var params = swiper.params.pagination;
30122      if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
30123      var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
30124      var $el = swiper.pagination.$el; // Current/Total
30125
30126      var current;
30127      var total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
30128
30129      if (swiper.params.loop) {
30130        current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup);
30131
30132        if (current > slidesLength - 1 - swiper.loopedSlides * 2) {
30133          current -= slidesLength - swiper.loopedSlides * 2;
30134        }
30135
30136        if (current > total - 1) current -= total;
30137        if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current;
30138      } else if (typeof swiper.snapIndex !== 'undefined') {
30139        current = swiper.snapIndex;
30140      } else {
30141        current = swiper.activeIndex || 0;
30142      } // Types
30143
30144
30145      if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
30146        var bullets = swiper.pagination.bullets;
30147        var firstIndex;
30148        var lastIndex;
30149        var midIndex;
30150
30151        if (params.dynamicBullets) {
30152          swiper.pagination.bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true);
30153          $el.css(swiper.isHorizontal() ? 'width' : 'height', swiper.pagination.bulletSize * (params.dynamicMainBullets + 4) + "px");
30154
30155          if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) {
30156            swiper.pagination.dynamicBulletIndex += current - swiper.previousIndex;
30157
30158            if (swiper.pagination.dynamicBulletIndex > params.dynamicMainBullets - 1) {
30159              swiper.pagination.dynamicBulletIndex = params.dynamicMainBullets - 1;
30160            } else if (swiper.pagination.dynamicBulletIndex < 0) {
30161              swiper.pagination.dynamicBulletIndex = 0;
30162            }
30163          }
30164
30165          firstIndex = current - swiper.pagination.dynamicBulletIndex;
30166          lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
30167          midIndex = (lastIndex + firstIndex) / 2;
30168        }
30169
30170        bullets.removeClass(params.bulletActiveClass + " " + params.bulletActiveClass + "-next " + params.bulletActiveClass + "-next-next " + params.bulletActiveClass + "-prev " + params.bulletActiveClass + "-prev-prev " + params.bulletActiveClass + "-main");
30171
30172        if ($el.length > 1) {
30173          bullets.each(function (bullet) {
30174            var $bullet = $(bullet);
30175            var bulletIndex = $bullet.index();
30176
30177            if (bulletIndex === current) {
30178              $bullet.addClass(params.bulletActiveClass);
30179            }
30180
30181            if (params.dynamicBullets) {
30182              if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
30183                $bullet.addClass(params.bulletActiveClass + "-main");
30184              }
30185
30186              if (bulletIndex === firstIndex) {
30187                $bullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
30188              }
30189
30190              if (bulletIndex === lastIndex) {
30191                $bullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
30192              }
30193            }
30194          });
30195        } else {
30196          var $bullet = bullets.eq(current);
30197          var bulletIndex = $bullet.index();
30198          $bullet.addClass(params.bulletActiveClass);
30199
30200          if (params.dynamicBullets) {
30201            var $firstDisplayedBullet = bullets.eq(firstIndex);
30202            var $lastDisplayedBullet = bullets.eq(lastIndex);
30203
30204            for (var i = firstIndex; i <= lastIndex; i += 1) {
30205              bullets.eq(i).addClass(params.bulletActiveClass + "-main");
30206            }
30207
30208            if (swiper.params.loop) {
30209              if (bulletIndex >= bullets.length - params.dynamicMainBullets) {
30210                for (var _i = params.dynamicMainBullets; _i >= 0; _i -= 1) {
30211                  bullets.eq(bullets.length - _i).addClass(params.bulletActiveClass + "-main");
30212                }
30213
30214                bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(params.bulletActiveClass + "-prev");
30215              } else {
30216                $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
30217                $lastDisplayedBullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
30218              }
30219            } else {
30220              $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
30221              $lastDisplayedBullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
30222            }
30223          }
30224        }
30225
30226        if (params.dynamicBullets) {
30227          var dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
30228          var bulletsOffset = (swiper.pagination.bulletSize * dynamicBulletsLength - swiper.pagination.bulletSize) / 2 - midIndex * swiper.pagination.bulletSize;
30229          var offsetProp = rtl ? 'right' : 'left';
30230          bullets.css(swiper.isHorizontal() ? offsetProp : 'top', bulletsOffset + "px");
30231        }
30232      }
30233
30234      if (params.type === 'fraction') {
30235        $el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1));
30236        $el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total));
30237      }
30238
30239      if (params.type === 'progressbar') {
30240        var progressbarDirection;
30241
30242        if (params.progressbarOpposite) {
30243          progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
30244        } else {
30245          progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
30246        }
30247
30248        var scale = (current + 1) / total;
30249        var scaleX = 1;
30250        var scaleY = 1;
30251
30252        if (progressbarDirection === 'horizontal') {
30253          scaleX = scale;
30254        } else {
30255          scaleY = scale;
30256        }
30257
30258        $el.find(classesToSelector(params.progressbarFillClass)).transform("translate3d(0,
302580,0) scaleX(" + scaleX + ") scaleY(" + scaleY + ")").transition(swiper.params.speed);
30259      }
30260
30261      if (params.type === 'custom' && params.renderCustom) {
30262        $el.html(params.renderCustom(swiper, current + 1, total));
30263        swiper.emit('paginationRender', $el[0]);
30264      } else {
30265        swiper.emit('paginationUpdate', $el[0]);
30266      }
30267
30268      if (swiper.params.watchOverflow && swiper.enabled) {
30269        $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
30270      }
30271    },
30272    render: function render() {
30273      // Render Container
30274      var swiper = this;
30275      var params = swiper.params.pagination;
30276      if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
30277      var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
30278      var $el = swiper.pagination.$el;
30279      var paginationHTML = '';
30280
30281      if (params.type === 'bullets') {
30282        var numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
30283
30284        if (swiper.params.freeMode && !swiper.params.loop && numberOfBullets > slidesLength) {
30285          numberOfBullets = slidesLength;
30286        }
30287
30288        for (var i = 0; i < numberOfBullets; i += 1) {
30289          if (params.renderBullet) {
30290            paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
30291          } else {
30292            paginationHTML += "<" + params.bulletElement + " class=\"" + params.bulletClass + "\"></" + params.bulletElement + ">";
30293          }
30294        }
30295
30296        $el.html(paginationHTML);
30297        swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass));
30298      }
30299
30300      if (params.type === 'fraction') {
30301        if (params.renderFraction) {
30302          paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
30303        } else {
30304          paginationHTML = "<span class=\"" + params.currentClass + "\"></span>" + ' / ' + ("<span class=\"" + params.totalClass + "\"></span>");
30305        }
30306
30307        $el.html(paginationHTML);
30308      }
30309
30310      if (params.type === 'progressbar') {
30311        if (params.renderProgressbar) {
30312          paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
30313        } else {
30314          paginationHTML = "<span class=\"" + params.progressbarFillClass + "\"></span>";
30315        }
30316
30317        $el.html(paginationHTML);
30318      }
30319
30320      if (params.type !== 'custom') {
30321        swiper.emit('paginationRender', swiper.pagination.$el[0]);
30322      }
30323    },
30324    init: function init() {
30325      var swiper = this;
30326      swiper.params.pagination = createElementIfNotDefined(swiper.$el, swiper.params.pagination, swiper.params.createElements, {
30327        el: 'swiper-pagination'
30328      });
30329      var params = swiper.params.pagination;
30330      if (!params.el) return;
30331      var $el = $(params.el);
30332      if ($el.length === 0) return;
30333
30334      if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) {
30335        $el = swiper.$el.find(params.el);
30336      }
30337
30338      if (params.type === 'bullets' && params.clickable) {
30339        $el.addClass(params.clickableClass);
30340      }
30341
30342      $el.addClass(params.modifierClass + params.type);
30343
30344      if (params.type === 'bullets' && params.dynamicBullets) {
30345        $el.addClass("" + params.modifierClass + params.type + "-dynamic");
30346        swiper.pagination.dynamicBulletIndex = 0;
30347
30348        if (params.dynamicMainBullets < 1) {
30349          params.dynamicMainBullets = 1;
30350        }
30351      }
30352
30353      if (params.type === 'progressbar' && params.progressbarOpposite) {
30354        $el.addClass(params.progressbarOppositeClass);
30355      }
30356
30357      if (params.clickable) {
30358        $el.on('click', classesToSelector(params.bulletClass), function onClick(e) {
30359          e.preventDefault();
30360          var index = $(this).index() * swiper.params.slidesPerGroup;
30361          if (swiper.params.loop) index += swiper.loopedSlides;
30362          swiper.slideTo(index);
30363        });
30364      }
30365
30366      extend(swiper.pagination, {
30367        $el: $el,
30368        el: $el[0]
30369      });
30370
30371      if (!swiper.enabled) {
30372        $el.addClass(params.lockClass);
30373      }
30374    },
30375    destroy: function destroy() {
30376      var swiper = this;
30377      var params = swiper.params.pagination;
30378      if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
30379      var $el = swiper.pagination.$el;
30380      $el.removeClass(params.hiddenClass);
30381      $el.removeClass(params.modifierClass + params.type);
30382      if (swiper.pagination.bullets) swiper.pagination.bullets.removeClass(params.bulletActiveClass);
30383
30384      if (params.clickable) {
30385        $el.off('click', classesToSelector(params.bulletClass));
30386      }
30387    }
30388  };
30389  var Pagination$1 = {
30390    name: 'pagination',
30391    params: {
30392      pagination: {
30393        el: null,
30394        bulletElement: 'span',
30395        clickable: false,
30396        hideOnClick: false,
30397        renderBullet: null,
30398        renderProgressbar: null,
30399        renderFraction: null,
30400        renderCustom: null,
30401        progressbarOpposite: false,
30402        type: 'bullets',
30403        // 'bullets' or 'progressbar' or 'fraction' or 'custom'
30404        dynamicBullets: false,
30405        dynamicMainBullets: 1,
30406        formatFractionCurrent: function formatFractionCurrent(number) {
30407          return number;
30408        },
30409        formatFractionTotal: function formatFractionTotal(number) {
30410          return number;
30411        },
30412        bulletClass: 'swiper-pagination-bullet',
30413        bulletActiveClass: 'swiper-pagination-bullet-active',
30414        modifierClass: 'swiper-pagination-',
30415        // NEW
30416        currentClass: 'swiper-pagination-current',
30417        totalClass: 'swiper-pagination-total',
30418        hiddenClass: 'swiper-pagination-hidden',
30419        progressbarFillClass: 'swiper-pagination-progressbar-fill',
30420        progressbarOppositeClass: 'swiper-pagination-progressbar-opposite',
30421        clickableClass: 'swiper-pagination-clickable',
30422        // NEW
30423        lockClass: 'swiper-pagination-lock'
30424      }
30425    },
30426    create: function create() {
30427      var swiper = this;
30428      bindModuleMethods(swiper, {
30429        pagination: _extends({
30430          dynamicBulletIndex: 0
30431        }, Pagination)
30432      });
30433    },
30434    on: {
30435      init: function init(swiper) {
30436        swiper.pagination.init();
30437        swiper.pagination.render();
30438        swiper.pagination.update();
30439      },
30440      activeIndexChange: function activeIndexChange(swiper) {
30441        if (swiper.params.loop) {
30442          swiper.pagination.update();
30443        } else if (typeof swiper.snapIndex === 'undefined') {
30444          swiper.pagination.update();
30445        }
30446      },
30447      snapIndexChange: function snapIndexChange(swiper) {
30448        if (!swiper.params.loop) {
30449          swiper.pagination.update();
30450        }
30451      },
30452      slidesLengthChange: function slidesLengthChange(swiper) {
30453        if (swiper.params.loop) {
30454          swiper.pagination.render();
30455          swiper.pagination.update();
30456        }
30457      },
30458      snapGridLengthChange: function snapGridLengthChange(swiper) {
30459        if (!swiper.params.loop) {
30460          swiper.pagination.render();
30461          swiper.pagination.update();
30462        }
30463      },
30464      destroy: function destroy(swiper) {
30465        swiper.pagination.destroy();
30466      },
30467      'enable disable': function enableDisable(swiper) {
30468        var $el = swiper.pagination.$el;
30469
30470        if ($el) {
30471          $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass);
30472        }
30473      },
30474      click: function click(swiper, e) {
30475        var targetEl = e.target;
30476
30477        if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && swiper.pagination.$el.length > 0 && !$(targetEl).hasClass(swiper.params.pagination.bulletClass)) {
30478          if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
30479          var isHidden = swiper.pagination.$el.hasClass(swiper.params.pagination.hiddenClass);
30480
30481          if (isHidden === true) {
30482            swiper.emit('paginationShow');
30483          } else {
30484            swiper.emit('paginationHide');
30485          }
30486
30487          swiper.pagination.$el.toggleClass(swiper.params.pagination.hiddenClass);
30488        }
30489      }
30490    }
30491  };
30492
30493  var Scrollbar = {
30494    setTranslate: function setTranslate() {
30495      var swiper = this;
30496      if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
30497      var scrollbar = swiper.scrollbar,
30498          rtl = swiper.rtlTranslate,
30499          progress = swiper.progress;
30500      var dragSize = scrollbar.dragSize,
30501          trackSize = scrollbar.trackSize,
30502          $dragEl = scrollbar.$dragEl,
30503          $el = scrollbar.$el;
30504      var params = swiper.params.scrollbar;
30505      var newSize = dragSize;
30506      var newPos = (trackSize - dragSize) * progress;
30507
30508      if (rtl) {
30509        newPos = -newPos;
30510
30511        if (newPos > 0) {
30512          newSize = dragSize - newPos;
30513          newPos = 0;
30514        } else if (-newPos + dragSize > trackSize) {
30515          newSize = trackSize + newPos;
30516        }
30517      } else if (newPos < 0) {
30518        newSize = dragSize + newPos;
30519        newPos = 0;
30520      } else if (newPos + dragSize > trackSize) {
30521        newSize = trackSize - newPos;
30522      }
30523
30524      if (swiper.isHorizontal()) {
30525        $dragEl.transform("translate3d(" + newPos + "px, 0, 0)");
30526        $dragEl[0].style.width = newSize + "px";
30527      } else {
30528        $dragEl.transform("translate3d(0px, " + newPos + "px, 0)");
30529        $dragEl[0].style.height = newSize + "px";
30530      }
30531
30532      if (params.hide) {
30533        clearTimeout(swiper.scrollbar.timeout);
30534        $el[0].style.opacity = 1;
30535        swiper.scrollbar.timeout = setTimeout(function () {
30536          $el[0].style.opacity = 0;
30537          $el.transition(400);
30538        }, 1000);
30539      }
30540    },
30541    setTransition: function setTransition(duration) {
30542      var swiper = this;
30543      if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
30544      swiper.scrollbar.$dragEl.transition(duration);
30545    },
30546    updateSize: function updateSize() {
30547      var swiper = this;
30548      if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
30549      var scrollbar = swiper.scrollbar;
30550      var $dragEl = scrollbar.$dragEl,
30551          $el = scrollbar.$el;
30552      $dragEl[0].style.width = '';
30553      $dragEl[0].style.height = '';
30554      var trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight;
30555      var divider = swiper.size / swiper.virtualSize;
30556      var moveDivider = divider * (trackSize / swiper.size);
30557      var dragSize;
30558
30559      if (swiper.params.scrollbar.dragSize === 'auto') {
30560        dragSize = trackSize * divider;
30561      } else {
30562        dragSize = parseInt(swiper.params.scrollbar.dragSize, 10);
30563      }
30564
30565      if (swiper.isHorizontal()) {
30566        $dragEl[0].style.width = dragSize + "px";
30567      } else {
30568        $dragEl[0].style.height = dragSize + "px";
30569      }
30570
30571      if (divider >= 1) {
30572        $el[0].style.display = 'none';
30573      } else {
30574        $el[0].style.display = '';
30575      }
30576
30577      if (swiper.params.scrollbar.hide) {
30578        $el[0].style.opacity = 0;
30579      }
30580
30581      extend(scrollbar, {
30582        trackSize: trackSize,
30583        divider: divider,
30584        moveDivider: moveDivider,
30585        dragSize: dragSize
30586      });
30587
30588      if (swiper.params.watchOverflow && swiper.enabled) {
30589        scrollbar.$el[swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass);
30590      }
30591    },
30592    getPointerPosition: function getPointerPosition(e) {
30593      var swiper = this;
30594
30595      if (swiper.isHorizontal()) {
30596        return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX;
30597      }
30598
30599      return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY;
30600    },
30601    setDragPosition: function setDragPosition(e) {
30602      var swiper = this;
30603      var scrollbar = swiper.scrollbar,
30604          rtl = swiper.rtlTranslate;
30605      var $el = scrollbar.$el,
30606          dragSize = scrollbar.dragSize,
30607          trackSize = scrollbar.trackSize,
30608          dragStartPos = scrollbar.dragStartPos;
30609      var positionRatio;
30610      positionRatio = (scrollbar.getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize);
30611      positionRatio = Math.max(Math.min(positionRatio, 1), 0);
30612
30613      if (rtl) {
30614        positionRatio = 1 - positionRatio;
30615      }
30616
30617      var position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio;
30618      swiper.updateProgress(position);
30619      swiper.setTranslate(position);
30620      swiper.updateActiveIndex();
30621      swiper.updateSlidesClasses();
30622    },
30623    onDragStart: function onDragStart(e) {
30624      var swiper = this;
30625      var params = swiper.params.scrollbar;
30626      var scrollbar = swiper.scrollbar,
30627          $wrapperEl = swiper.$wrapperEl;
30628      var $el = scrollbar.$el,
30629          $dragEl = scrollbar.$dragEl;
30630      swiper.scrollbar.isTouched = true;
30631      swiper.scrollbar.dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? scrollbar.getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null;
30632      e.preventDefault();
30633      e.stopPropagation();
30634      $wrapperEl.transition(100);
30635      $dragEl.transition(100);
30636      scrollbar.setDragPosition(e);
30637      clearTimeout(swiper.scrollbar.dragTimeout);
30638      $el.transition(0);
30639
30640      if (params.hide) {
30641        $el.css('opacity', 1);
30642      }
30643
30644      if (swiper.params.cssMode) {
30645        swiper.$wrapperEl.css('scroll-snap-type', 'none');
30646      }
30647
30648      swiper.emit('scrollbarDragStart', e);
30649    },
30650    onDragMove: function onDragMove(e) {
30651      var swiper = this;
30652      var scrollbar = swiper.scrollbar,
30653          $wrapperEl = swiper.$wrapperEl;
30654      var $el = scrollbar.$el,
30655          $dragEl = scrollbar.$dragEl;
30656      if (!swiper.scrollbar.isTouched) return;
30657      if (e.preventDefault) e.preventDefault();else e.returnValue = false;
30658      scrollbar.setDragPosition(e);
30659      $wrapperEl.transition(0);
30660      $el.transition(0);
30661      $dragEl.transition(0);
30662      swiper.emit('scrollbarDragMove', e);
30663    },
30664    onDragEnd: function onDragEnd(e) {
30665      var swiper = this;
30666      var params = swiper.params.scrollbar;
30667      var scrollbar = swiper.scrollbar,
30668          $wrapperEl = swiper.$wrapperEl;
30669      var $el = scrollbar.$el;
30670      if (!swiper.scrollbar.isTouched) return;
30671      swiper.scrollbar.isTouched = false;
30672
30673      if (swiper.params.cssMode) {
30674        swiper.$wrapperEl.css('scroll-snap-type', '');
30675        $wrapperEl.transition('');
30676      }
30677
30678      if (params.hide) {
30679        clearTimeout(swiper.scrollbar.dragTimeout);
30680        swiper.scrollbar.dragTimeout = nextTick(function () {
30681          $el.css('opacity', 0);
30682          $el.transition(400);
30683        }, 1000);
30684      }
30685
30686      swiper.emit('scrollbarDragEnd', e);
30687
30688      if (params.snapOnRelease) {
30689        swiper.slideToClosest();
30690      }
30691    },
30692    enableDraggable: function enableDraggable() {
30693      var swiper = this;
30694      if (!swiper.params.scrollbar.el) return;
30695      var document = getDocument();
30696      var scrollbar = swiper.scrollbar,
30697          touchEventsTouch = swiper.touchEventsTouch,
30698          touchEventsDesktop = swiper.touchEventsDesktop,
30699          params = swiper.params,
30700          support = swiper.support;
30701      var $el = scrollbar.$el;
30702      var target = $el[0];
30703      var activeListener = support.passiveListener && params.passiveListeners ? {
30704        passive: false,
30705        capture: false
30706      } : false;
30707      var passiveListener = support.passiveListener && params.passiveListeners ? {
30708        passive: true,
30709        capture: false
30710      } : false;
30711      if (!target) return;
30712
30713      if (!support.touch) {
30714        target.addEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
30715        document.addEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
30716        document.addEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
30717      } else {
30718        target.addEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
30719        target.addEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
30720        target.addEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
30721      }
30722    },
30723    disableDraggable: function disableDraggable() {
30724      var swiper = this;
30725      if (!swiper.params.scrollbar.el) return;
30726      var document = getDocument();
30727      var scrollbar = swiper.scrollbar,
30728          touchEventsTouch = swiper.touchEventsTouch,
30729          touchEventsDesktop = swiper.touchEventsDesktop,
30730          params = swiper.params,
30731          support = swiper.support;
30732      var $el = scrollbar.$el;
30733      var target = $el[0];
30734      var activeListener = support.passiveListener && params.passiveListeners ? {
30735        passive: false,
30736        capture: false
30737      } : false;
30738      var passiveListener = support.passiveListener && params.passiveListeners ? {
30739        passive: true,
30740        capture: false
30741      } : false;
30742      if (!target) return;
30743
30744      if (!support.touch) {
30745        target.removeEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
30746        document.removeEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
30747        document.removeEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
30748      } else {
30749        target.removeEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
30750        target.removeEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
30751        target.removeEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
30752      }
30753    },
30754    init: function init() {
30755      var swiper = this;
30756      var scrollbar = swiper.scrollbar,
30757          $swiperEl = swiper.$el;
30758      swiper.params.scrollbar = createElementIfNotDefined($swiperEl, swiper.params.scrollbar, swiper.params.createElements, {
30759        el: 'swiper-scrollbar'
30760      });
30761      var params = swiper.params.scrollbar;
30762      if (!params.el) return;
30763      var $el = $(params.el);
30764
30765      if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) {
30766        $el = $swiperEl.find(params.el);
30767      }
30768
30769      var $dragEl = $el.find("." + swiper.params.scrollbar.dragClass);
30770
30771      if ($dragEl.length === 0) {
30772        $dragEl = $("<div class=\"" + swiper.params.scrollbar.dragClass + "\"></div>");
30773        $el.append($dragEl);
30774      }
30775
30776      extend(scrollbar, {
30777        $el: $el,
30778        el: $el[0],
30779        $dragEl: $dragEl,
30780        dragEl: $dragEl[0]
30781      });
30782
30783      if (params.draggable) {
30784        scrollbar.enableDraggable();
30785      }
30786
30787      if ($el) {
30788        $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass);
30789      }
30790    },
30791    destroy: function destroy() {
30792      var swiper = this;
30793      swiper.scrollbar.disableDraggable();
30794    }
30795  };
30796  var Scrollbar$1 = {
30797    name: 'scrollbar',
30798    params: {
30799      scrollbar: {
30800        el: null,
30801        dragSize: 'auto',
30802        hide: false,
30803        draggable: false,
30804        snapOnRelease: true,
30805        lockClass: 'swiper-scrollbar-lock',
30806        dragClass: 'swiper-scrollbar-drag'
30807      }
30808    },
30809    create: function create() {
30810      var swiper = this;
30811      bindModuleMethods(swiper, {
30812        scrollbar: _extends({
30813          isTouched: false,
30814          timeout: null,
30815          dragTimeout: null
30816        }, Scrollbar)
30817      });
30818    },
30819    on: {
30820      init: function init(swiper) {
30821        swiper.scrollbar.init();
30822        swiper.scrollbar.updateSize();
30823        swiper.scrollbar.setTranslate();
30824      },
30825      update: function update(swiper) {
30826        swiper.scrollbar.updateSize();
30827      },
30828      resize: function resize(swiper) {
30829        swiper.scrollbar.updateSize();
30830      },
30831      observerUpdate: function observerUpdate(swiper) {
30832        swiper.scrollbar.updateSize();
30833      },
30834      setTranslate: function setTranslate(swiper) {
30835        swiper.scrollbar.setTranslate();
30836      },
30837      setTransition: function setTransition(swiper, duration) {
30838        swiper.scrollbar.setTransition(duration);
30839      },
30840      'enable disable': function enableDisable(swiper) {
30841        var $el = swiper.scrollbar.$el;
30842
30843        if ($el) {
30844          $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass);
30845        }
30846      },
30847      destroy: function destroy(swiper) {
30848        swiper.scrollbar.destroy();
30849      }
30850    }
30851  };
30852
30853  var Parallax = {
30854    setTransform: function setTransform(el, progress) {
30855      var swiper = this;
30856      var rtl = swiper.rtl;
30857      var $el = $(el);
30858      var rtlFactor = rtl ? -1 : 1;
30859      var p = $el.attr('data-swiper-parallax') || '0';
30860      var x = $el.attr('data-swiper-parallax-x');
30861      var y = $el.attr('data-swiper-parallax-y');
30862      var scale = $el.attr('data-swiper-parallax-scale');
30863      var opacity = $el.attr('data-swiper-parallax-opacity');
30864
30865      if (x || y) {
30866        x = x || '0';
30867        y = y || '0';
30868      } else if (swiper.isHorizontal()) {
30869        x = p;
30870        y = '0';
30871      } else {
30872        y = p;
30873        x = '0';
30874      }
30875
30876      if (x.indexOf('%') >= 0) {
30877        x = parseInt(x, 10) * progress * rtlFactor + "%";
30878      } else {
30879        x = x * progress * rtlFactor + "px";
30880      }
30881
30882      if (y.indexOf('%') >= 0) {
30883        y = parseInt(y, 10) * progress + "%";
30884      } else {
30885        y = y * progress + "px";
30886      }
30887
30888      if (typeof opacity !== 'undefined' && opacity !== null) {
30889        var currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress));
30890        $el[0].style.opacity = currentOpacity;
30891      }
30892
30893      if (typeof scale === 'undefined' || scale === null) {
30894        $el.transform("translate3d(" + x + ", " + y + ", 0px)");
30895      } else {
30896        var currentScale = scale - (scale - 1) * (1 - Math.abs(progress));
30897        $el.transform("translate3d(" + x + ", " + y + ", 0px) scale(" + currentScale + ")");
30898      }
30899    },
30900    setTranslate: function setTranslate() {
30901      var swiper = this;
30902      var $el = swiper.$el,
30903          slides = swiper.slides,
30904          progress = swiper.progress,
30905          snapGrid = swiper.snapGrid;
30906      $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (el) {
30907        swiper.parallax.setTransform(el, progress);
30908      });
30909      slides.each(function (slideEl, slideIndex) {
30910        var slideProgress = slideEl.progress;
30911
30912        if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') {
30913          slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1);
30914        }
30915
30916        slideProgress = Math.min(Math.max(slideProgress, -1), 1);
30917        $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (el) {
30918          swiper.parallax.setTransform(el, slideProgress);
30919        });
30920      });
30921    },
30922    setTransition: function setTransition(duration) {
30923      if (duration === void 0) {
30924        duration = this.params.speed;
30925      }
30926
30927      var swiper = this;
30928      var $el = swiper.$el;
30929      $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (parallaxEl) {
30930        var $parallaxEl = $(parallaxEl);
30931        var parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration;
30932        if (duration === 0) parallaxDuration = 0;
30933        $parallaxEl.transition(parallaxDuration);
30934      });
30935    }
30936  };
30937  var Parallax$1 = {
30938    name: 'parallax',
30939    params: {
30940      parallax: {
30941        enabled: false
30942      }
30943    },
30944    create: function create() {
30945      var swiper = this;
30946      bindModuleMethods(swiper, {
30947        parallax: _extends({}, Parallax)
30948      });
30949    },
30950    on: {
30951      beforeInit: function beforeInit(swiper) {
30952        if (!swiper.params.parallax.enabled) return;
30953        swiper.params.watchSlidesProgress = true;
30954        swiper.originalParams.watchSlidesProgress = true;
30955      },
30956      init: function init(swiper) {
30957        if (!swiper.params.parallax.enabled) return;
30958        swiper.parallax.setTranslate();
30959      },
30960      setTranslate: function setTranslate(swiper) {
30961        if (!swiper.params.parallax.enabled) return;
30962        swiper.parallax.setTranslate();
30963      },
30964      setTransition: function setTransition(swiper, duration) {
30965        if (!swiper.params.parallax.enabled) return;
30966        swiper.parallax.setTransition(duration);
30967      }
30968    }
30969  };
30970
30971  var Zoom = {
30972    // Calc Scale From Multi-touches
30973    getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
30974      if (e.targetTouches.length < 2) return 1;
30975      var x1 = e.targetTouches[0].pageX;
30976      var y1 = e.targetTouches[0].pageY;
30977      var x2 = e.targetTouches[1].pageX;
30978      var y2 = e.targetTouches[1].pageY;
30979      var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
30980      return distance;
30981    },
30982    // Events
30983    onGestureStart: function onGestureStart(e) {
30984      var swiper = this;
30985      var support = swiper.support;
30986      var params = swiper.params.zoom;
30987      var zoom = swiper.zoom;
30988      var gesture = zoom.gesture;
30989      zoom.fakeGestureTouched = false;
30990      zoom.fakeGestureMoved = false;
30991
30992      if (!support.gestures) {
30993        if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {
30994          return;
30995        }
30996
30997        zoom.fakeGestureTouched = true;
30998        gesture.scaleStart = Zoom.getDistanceBetweenTouches(e);
30999      }
31000
31001      if (!gesture.$slideEl || !gesture.$slideEl.length) {
31002        gesture.$slideEl = $(e.target).closest("." + swiper.params.slideClass);
31003        if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
31004        gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
31005        gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
31006        gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
31007
31008        if (gesture.$imageWrapEl.length === 0) {
31009          gesture.$imageEl = undefined;
31010          return;
31011        }
31012      }
31013
31014      if (gesture.$imageEl) {
31015        gesture.$imageEl.transition(0);
31016      }
31017
31018      swiper.zoom.isScaling = true;
31019    },
31020    onGestureChange: function onGestureChange(e) {
31021      var swiper = this;
31022      var support = swiper.support;
31023      var params = swiper.params.zoom;
31024      var zoom = swiper.zoom;
31025      var gesture = zoom.gesture;
31026
31027      if (!support.gestures) {
31028        if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {
31029          return;
31030        }
31031
31032        zoom.fakeGestureMoved = true;
31033        gesture.scaleMove = Zoom.getDistanceBetweenTouches(e);
31034      }
31035
31036      if (!gesture.$imageEl || gesture.$imageEl.length === 0) {
31037        if (e.type === 'gesturechange') zoom.onGestureStart(e);
31038        return;
31039      }
31040
31041      if (support.gestures) {
31042        zoom.scale = e.scale * zoom.currentScale;
31043      } else {
31044        zoom.scale = gesture.scaleMove / gesture.scaleStart * zoom.currentScale;
31045      }
31046
31047      if (zoom.scale > gesture.maxRatio) {
31048        zoom.scale = gesture.maxRatio - 1 + Math.pow(zoom.scale - gesture.maxRatio + 1, 0.5);
31049      }
31050
31051      if (zoom.scale < params.minRatio) {
31052        zoom.scale = params.minRatio + 1 - Math.pow(params.minRatio - zoom.scale + 1, 0.5);
31053      }
31054
31055      gesture.$imageEl.transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
31056    },
31057    onGestureEnd: function onGestureEnd(e) {
31058      var swiper = this;
31059      var device = swiper.device;
31060      var support = swiper.support;
31061      var params = swiper.params.zoom;
31062      var zoom = swiper.zoom;
31063      var gesture = zoom.gesture;
31064
31065      if (!support.gestures) {
31066        if (!zoom.fakeGestureTouched || !zoom.fakeGestureMoved) {
31067          return;
31068        }
31069
31070        if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2 && !device.android) {
31071          return;
31072        }
31073
31074        zoom.fakeGestureTouched = false;
31075        zoom.fakeGestureMoved = false;
31076      }
31077
31078      if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
31079      zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio);
31080      gesture.$imageEl.transition(swiper.params.speed).transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
31081      zoom.currentScale = zoom.scale;
31082      zoom.isScaling = false;
31083      if (zoom.scale === 1) gesture.$slideEl = undefined;
31084    },
31085    onTouchStart: function onTouchStart(e) {
31086      var swiper = this;
31087      var device = swiper.device;
31088      var zoom = swiper.zoom;
31089      var gesture = zoom.gesture,
31090          image = zoom.image;
31091      if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
31092      if (image.isTouched) return;
31093      if (device.android && e.cancelable) e.preventDefault();
31094      image.isTouched = true;
31095      image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
31096      image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
31097    },
31098    onTouchMove: function onTouchMove(e) {
31099      var swiper = this;
31100      var zoom = swiper.zoom;
31101      var gesture = zoom.gesture,
31102          image = zoom.image,
31103          velocity = zoom.velocity;
31104      if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
31105      swiper.allowClick = false;
31106      if (!image.isTouched || !gesture.$slideEl) return;
31107
31108      if (!image.isMoved) {
31109        image.width = gesture.$imageEl[0].offsetWidth;
31110        image.height = gesture.$imageEl[0].offsetHeight;
31111        image.startX = getTranslate(gesture.$imageWrapEl[0], 'x') || 0;
31112        image.startY = getTranslate(gesture.$imageWrapEl[0], 'y') || 0;
31113        gesture.slideWidth = gesture.$slideEl[0].offsetWidth;
31114        gesture.slideHeight = gesture.$slideEl[0].offsetHeight;
31115        gesture.$imageWrapEl.transition(0);
31116      } // Define if we need image drag
31117
31118
31119      var scaledWidth = image.width * zoom.scale;
31120      var scaledHeight = image.height * zoom.scale;
31121      if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return;
31122      image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
31123      image.maxX = -image.minX;
31124      image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
31125      image.maxY = -image.minY;
31126      image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
31127      image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
31128
31129      if (!image.isMoved && !zoom.isScaling) {
31130        if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) {
31131          image.isTouched = false;
31132          return;
31133        }
31134
31135        if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) {
31136          image.isTouched = false;
31137          return;
31138        }
31139      }
31140
31141      if (e.cancelable) {
31142        e.preventDefault();
31143      }
31144
31145      e.stopPropagation();
31146      image.isMoved = true;
31147      image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX;
31148      image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY;
31149
31150      if (image.currentX < image.minX) {
31151        image.currentX = image.minX + 1 - Math.pow(image.minX - image.currentX + 1, 0.8);
31152      }
31153
31154      if (image.currentX > image.maxX) {
31155        image.currentX = image.maxX - 1 + Math.pow(image.currentX - image.maxX + 1, 0.8);
31156      }
31157
31158      if (image.currentY < image.minY) {
31159        image.currentY = image.minY + 1 - Math.pow(image.minY - image.currentY + 1, 0.8);
31160      }
31161
31162      if (image.currentY > image.maxY) {
31163        image.currentY = image.maxY - 1 + Math.pow(image.currentY - image.maxY + 1, 0.8);
31164      } // Velocity
31165
31166
31167      if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x;
31168      if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y;
31169      if (!velocity.prevTime) velocity.prevTime = Date.now();
31170      velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2;
31171      velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2;
31172      if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0;
31173      if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0;
31174      velocity.prevPositionX = image.touchesCurrent.x;
31175      velocity.prevPositionY = image.touchesCurrent.y;
31176      velocity.prevTime = Date.now();
31177      gesture.$imageWrapEl.transform("translate3d(" + image.currentX + "px, " + image.currentY + "px,0)");
31178    },
31179    onTouchEnd: function onTouchEnd() {
31180      var swiper = this;
31181      var zoom = swiper.zoom;
31182      var gesture = zoom.gesture,
31183          image = zoom.image,
31184          velocity = zoom.velocity;
31185      if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
31186
31187      if (!image.isTouched || !image.isMoved) {
31188        image.isTouched = false;
31189        image.isMoved = false;
31190        return;
31191      }
31192
31193      image.isTouched = false;
31194      image.isMoved = false;
31195      var momentumDurationX = 300;
31196      var momentumDurationY = 300;
31197      var momentumDistanceX = velocity.x * momentumDurationX;
31198      var newPositionX = image.currentX + momentumDistanceX;
31199      var momentumDistanceY = velocity.y * momentumDurationY;
31200      var newPositionY = image.currentY + momentumDistanceY; // Fix duration
31201
31202      if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x);
31203      if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y);
31204      var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
31205      image.currentX = newPositionX;
31206      image.currentY = newPositionY; // Define if we need image drag
31207
31208      var scaledWidth = image.width * zoom.scale;
31209      var scaledHeight = image.height * zoom.scale;
31210      image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
31211      image.maxX = -image.minX;
31212      image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
31213      image.maxY = -image.minY;
31214      image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX);
31215      image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY);
31216      gesture.$imageWrapEl.transition(momentumDuration).transform("translate3d(" + image.currentX + "px, " + image.currentY + "px,0
31216)");
31217    },
31218    onTransitionEnd: function onTransitionEnd() {
31219      var swiper = this;
31220      var zoom = swiper.zoom;
31221      var gesture = zoom.gesture;
31222
31223      if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) {
31224        if (gesture.$imageEl) {
31225          gesture.$imageEl.transform('translate3d(0,0,0) scale(1)');
31226        }
31227
31228        if (gesture.$imageWrapEl) {
31229          gesture.$imageWrapEl.transform('translate3d(0,0,0)');
31230        }
31231
31232        zoom.scale = 1;
31233        zoom.currentScale = 1;
31234        gesture.$slideEl = undefined;
31235        gesture.$imageEl = undefined;
31236        gesture.$imageWrapEl = undefined;
31237      }
31238    },
31239    // Toggle Zoom
31240    toggle: function toggle(e) {
31241      var swiper = this;
31242      var zoom = swiper.zoom;
31243
31244      if (zoom.scale && zoom.scale !== 1) {
31245        // Zoom Out
31246        zoom.out();
31247      } else {
31248        // Zoom In
31249        zoom.in(e);
31250      }
31251    },
31252    in: function _in(e) {
31253      var swiper = this;
31254      var window = getWindow();
31255      var zoom = swiper.zoom;
31256      var params = swiper.params.zoom;
31257      var gesture = zoom.gesture,
31258          image = zoom.image;
31259
31260      if (!gesture.$slideEl) {
31261        if (e && e.target) {
31262          gesture.$slideEl = $(e.target).closest("." + swiper.params.slideClass);
31263        }
31264
31265        if (!gesture.$slideEl) {
31266          if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
31267            gesture.$slideEl = swiper.$wrapperEl.children("." + swiper.params.slideActiveClass);
31268          } else {
31269            gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
31270          }
31271        }
31272
31273        gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
31274        gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
31275      }
31276
31277      if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return;
31278      gesture.$slideEl.addClass("" + params.zoomedSlideClass);
31279      var touchX;
31280      var touchY;
31281      var offsetX;
31282      var offsetY;
31283      var diffX;
31284      var diffY;
31285      var translateX;
31286      var translateY;
31287      var imageWidth;
31288      var imageHeight;
31289      var scaledWidth;
31290      var scaledHeight;
31291      var translateMinX;
31292      var translateMinY;
31293      var translateMaxX;
31294      var translateMaxY;
31295      var slideWidth;
31296      var slideHeight;
31297
31298      if (typeof image.touchesStart.x === 'undefined' && e) {
31299        touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
31300        touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
31301      } else {
31302        touchX = image.touchesStart.x;
31303        touchY = image.touchesStart.y;
31304      }
31305
31306      zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
31307      zoom.currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
31308
31309      if (e) {
31310        slideWidth = gesture.$slideEl[0].offsetWidth;
31311        slideHeight = gesture.$slideEl[0].offsetHeight;
31312        offsetX = gesture.$slideEl.offset().left + window.scrollX;
31313        offsetY = gesture.$slideEl.offset().top + window.scrollY;
31314        diffX = offsetX + slideWidth / 2 - touchX;
31315        diffY = offsetY + slideHeight / 2 - touchY;
31316        imageWidth = gesture.$imageEl[0].offsetWidth;
31317        imageHeight = gesture.$imageEl[0].offsetHeight;
31318        scaledWidth = imageWidth * zoom.scale;
31319        scaledHeight = imageHeight * zoom.scale;
31320        translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
31321        translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
31322        translateMaxX = -translateMinX;
31323        translateMaxY = -translateMinY;
31324        translateX = diffX * zoom.scale;
31325        translateY = diffY * zoom.scale;
31326
31327        if (translateX < translateMinX) {
31328          translateX = translateMinX;
31329        }
31330
31331        if (translateX > translateMaxX) {
31332          translateX = translateMaxX;
31333        }
31334
31335        if (translateY < translateMinY) {
31336          translateY = translateMinY;
31337        }
31338
31339        if (translateY > translateMaxY) {
31340          translateY = translateMaxY;
31341        }
31342      } else {
31343        translateX = 0;
31344        translateY = 0;
31345      }
31346
31347      gesture.$imageWrapEl.transition(300).transform("translate3d(" + translateX + "px, " + translateY + "px,0
31347)");
31348      gesture.$imageEl.transition(300).transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
31349    },
31350    out: function out() {
31351      var swiper = this;
31352      var zoom = swiper.zoom;
31353      var params = swiper.params.zoom;
31354      var gesture = zoom.gesture;
31355
31356      if (!gesture.$slideEl) {
31357        if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
31358          gesture.$slideEl = swiper.$wrapperEl.children("." + swiper.params.slideActiveClass);
31359        } else {
31360          gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
31361        }
31362
31363        gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
31364        gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
31365      }
31366
31367      if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return;
31368      zoom.scale = 1;
31369      zoom.currentScale = 1;
31370      gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)');
31371      gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)');
31372      gesture.$slideEl.removeClass("" + params.zoomedSlideClass);
31373      gesture.$slideEl = undefined;
31374    },
31375    toggleGestures: function toggleGestures(method) {
31376      var swiper = this;
31377      var zoom = swiper.zoom;
31378      var selector = zoom.slideSelector,
31379          passive = zoom.passiveListener;
31380      swiper.$wrapperEl[method]('gesturestart', selector, zoom.onGestureStart, passive);
31381      swiper.$wrapperEl[method]('gesturechange', selector, zoom.onGestureChange, passive);
31382      swiper.$wrapperEl[method]('gestureend', selector, zoom.onGestureEnd, passive);
31383    },
31384    enableGestures: function enableGestures() {
31385      if (this.zoom.gesturesEnabled) return;
31386      this.zoom.gesturesEnabled = true;
31387      this.zoom.toggleGestures('on');
31388    },
31389    disableGestures: function disableGestures() {
31390      if (!this.zoom.gesturesEnabled) return;
31391      this.zoom.gesturesEnabled = false;
31392      this.zoom.toggleGestures('off');
31393    },
31394    // Attach/Detach Events
31395    enable: function enable() {
31396      var swiper = this;
31397      var support = swiper.support;
31398      var zoom = swiper.zoom;
31399      if (zoom.enabled) return;
31400      zoom.enabled = true;
31401      var passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? {
31402        passive: true,
31403        capture: false
31404      } : false;
31405      var activeListenerWithCapture = support.passiveListener ? {
31406        passive: false,
31407        capture: true
31408      } : true;
31409      var slideSelector = "." + swiper.params.slideClass;
31410      swiper.zoom.passiveListener = passiveListener;
31411      swiper.zoom.slideSelector = slideSelector; // Scale image
31412
31413      if (support.gestures) {
31414        swiper.$wrapperEl.on(swiper.touchEvents.start, swiper.zoom.enableGestures, passiveListener);
31415        swiper.$wrapperEl.on(swiper.touchEvents.end, swiper.zoom.disableGestures, passiveListener);
31416      } else if (swiper.touchEvents.start === 'touchstart') {
31417        swiper.$wrapperEl.on(swiper.touchEvents.start, slideSelector, zoom.onGestureStart, passiveListener);
31418        swiper.$wrapperEl.on(swiper.touchEvents.move, slideSelector, zoom.onGestureChange, activeListenerWithCapture);
31419        swiper.$wrapperEl.on(swiper.touchEvents.end, slideSelector, zoom.onGestureEnd, passiveListener);
31420
31421        if (swiper.touchEvents.cancel) {
31422          swiper.$wrapperEl.on(swiper.touchEvents.cancel, slideSelector, zoom.onGestureEnd, passiveListener);
31423        }
31424      } // Move image
31425
31426
31427      swiper.$wrapperEl.on(swiper.touchEvents.move, "." + swiper.params.zoom.containerClass, zoom.onTouchMove, activeListenerWithCapture);
31428    },
31429    disable: function disable() {
31430      var swiper = this;
31431      var zoom = swiper.zoom;
31432      if (!zoom.enabled) return;
31433      var support = swiper.support;
31434      swiper.zoom.enabled = false;
31435      var passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? {
31436        passive: true,
31437        capture: false
31438      } : false;
31439      var activeListenerWithCapture = support.passiveListener ? {
31440        passive: false,
31441        capture: true
31442      } : true;
31443      var slideSelector = "." + swiper.params.slideClass; // Scale image
31444
31445      if (support.gestures) {
31446        swiper.$wrapperEl.off(swiper.touchEvents.start, swiper.zoom.enableGestures, passiveListener);
31447        swiper.$wrapperEl.off(swiper.touchEvents.end, swiper.zoom.disableGestures, passiveListener);
31448      } else if (swiper.touchEvents.start === 'touchstart') {
31449        swiper.$wrapperEl.off(swiper.touchEvents.start, slideSelector, zoom.onGestureStart, passiveListener);
31450        swiper.$wrapperEl.off(swiper.touchEvents.move, slideSelector, zoom.onGestureChange, activeListenerWithCapture);
31451        swiper.$wrapperEl.off(swiper.touchEvents.end, slideSelector, zoom.onGestureEnd, passiveListener);
31452
31453        if (swiper.touchEvents.cancel) {
31454          swiper.$wrapperEl.off(swiper.touchEvents.cancel, slideSelector, zoom.onGestureEnd, passiveListener);
31455        }
31456      } // Move image
31457
31458
31459      swiper.$wrapperEl.off(swiper.touchEvents.move, "." + swiper.params.zoom.containerClass, zoom.onTouchMove, activeListenerWithCapture);
31460    }
31461  };
31462  var Zoom$1 = {
31463    name: 'zoom',
31464    params: {
31465      zoom: {
31466        enabled: false,
31467        maxRatio: 3,
31468        minRatio: 1,
31469        toggle: true,
31470        containerClass: 'swiper-zoom-container',
31471        zoomedSlideClass: 'swiper-slide-zoomed'
31472      }
31473    },
31474    create: function create() {
31475      var swiper = this;
31476      bindModuleMethods(swiper, {
31477        zoom: _extends({
31478          enabled: false,
31479          scale: 1,
31480          currentScale: 1,
31481          isScaling: false,
31482          gesture: {
31483            $slideEl: undefined,
31484            slideWidth: undefined,
31485            slideHeight: undefined,
31486            $imageEl: undefined,
31487            $imageWrapEl: undefined,
31488            maxRatio: 3
31489          },
31490          image: {
31491            isTouched: undefined,
31492            isMoved: undefined,
31493            currentX: undefined,
31494            currentY: undefined,
31495            minX: undefined,
31496            minY: undefined,
31497            maxX: undefined,
31498            maxY: undefined,
31499            width: undefined,
31500            height: undefined,
31501            startX: undefined,
31502            startY: undefined,
31503            touchesStart: {},
31504            touchesCurrent: {}
31505          },
31506          velocity: {
31507            x: undefined,
31508            y: undefined,
31509            prevPositionX: undefined,
31510            prevPositionY: undefined,
31511            prevTime: undefined
31512          }
31513        }, Zoom)
31514      });
31515      var scale = 1;
31516      Object.defineProperty(swiper.zoom, 'scale', {
31517        get: function get() {
31518          return scale;
31519        },
31520        set: function set(value) {
31521          if (scale !== value) {
31522            var imageEl = swiper.zoom.gesture.$imageEl ? swiper.zoom.gesture.$imageEl[0] : undefined;
31523            var slideEl = swiper.zoom.gesture.$slideEl ? swiper.zoom.gesture.$slideEl[0] : undefined;
31524            swiper.emit('zoomChange', value, imageEl, slideEl);
31525          }
31526
31527          scale = value;
31528        }
31529      });
31530    },
31531    on: {
31532      init: function init(swiper) {
31533        if (swiper.params.zoom.enabled) {
31534          swiper.zoom.enable();
31535        }
31536      },
31537      destroy: function destroy(swiper) {
31538        swiper.zoom.disable();
31539      },
31540      touchStart: function touchStart(swiper, e) {
31541        if (!swiper.zoom.enabled) return;
31542        swiper.zoom.onTouchStart(e);
31543      },
31544      touchEnd: function touchEnd(swiper, e) {
31545        if (!swiper.zoom.enabled) return;
31546        swiper.zoom.onTouchEnd(e);
31547      },
31548      doubleTap: function doubleTap(swiper, e) {
31549        if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
31550          swiper.zoom.toggle(e);
31551        }
31552      },
31553      transitionEnd: function transitionEnd(swiper) {
31554        if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
31555          swiper.zoom.onTransitionEnd();
31556        }
31557      },
31558      slideChange: function slideChange(swiper) {
31559        if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) {
31560          swiper.zoom.onTransitionEnd();
31561        }
31562      }
31563    }
31564  };
31565
31566  var Lazy = {
31567    loadInSlide: function loadInSlide(index, loadInDuplicate) {
31568      if (loadInDuplicate === void 0) {
31569        loadInDuplicate = true;
31570      }
31571
31572      var swiper = this;
31573      var params = swiper.params.lazy;
31574      if (typeof index === 'undefined') return;
31575      if (swiper.slides.length === 0) return;
31576      var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
31577      var $slideEl = isVirtual ? swiper.$wrapperEl.children("." + swiper.params.slideClass + "[data-swiper-slide-index=\"" + index + "\"]") : swiper.slides.eq(index);
31578      var $images = $slideEl.find("." + params.elementClass + ":not(." + params.loadedClass + "):not(." + params.loadingClass + ")");
31579
31580      if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) {
31581        $images.push($slideEl[0]);
31582      }
31583
31584      if ($images.length === 0) return;
31585      $images.each(function (imageEl) {
31586        var $imageEl = $(imageEl);
31587        $imageEl.addClass(params.loadingClass);
31588        var background = $imageEl.attr('data-background');
31589        var src = $imageEl.attr('data-src');
31590        var srcset = $imageEl.attr('data-srcset');
31591        var sizes = $imageEl.attr('data-sizes');
31592        var $pictureEl = $imageEl.parent('picture');
31593        swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, function () {
31594          if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return;
31595
31596          if (background) {
31597            $imageEl.css('background-image', "url(\"" + background + "\")");
31598            $imageEl.removeAttr('data-background');
31599          } else {
31600            if (srcset) {
31601              $imageEl.attr('srcset', srcset);
31602              $imageEl.removeAttr('data-srcset');
31603            }
31604
31605            if (sizes) {
31606              $imageEl.attr('sizes', sizes);
31607              $imageEl.removeAttr('data-sizes');
31608            }
31609
31610            if ($pictureEl.length) {
31611              $pictureEl.children('source').each(function (sourceEl) {
31612                var $source = $(sourceEl);
31613
31614                if ($source.attr('data-srcset')) {
31615                  $source.attr('srcset', $source.attr('data-srcset'));
31616                  $source.removeAttr('data-srcset');
31617                }
31618              });
31619            }
31620
31621            if (src) {
31622              $imageEl.attr('src', src);
31623              $imageEl.removeAttr('data-src');
31624            }
31625          }
31626
31627          $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass);
31628          $slideEl.find("." + params.preloaderClass).remove();
31629
31630          if (swiper.params.loop && loadInDuplicate) {
31631            var slideOriginalIndex = $slideEl.attr('data-swiper-slide-index');
31632
31633            if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) {
31634              var originalSlide = swiper.$wrapperEl.children("[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]:not(." + swiper.params.slideDuplicateClass + ")");
31635              swiper.lazy.loadInSlide(originalSlide.index(), false);
31636            } else {
31637              var duplicatedSlide = swiper.$wrapperEl.children("." + swiper.params.slideDuplicateClass + "[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]");
31638              swiper.lazy.loadInSlide(duplicatedSlide.index(), false);
31639            }
31640          }
31641
31642          swiper.emit('lazyImageReady', $slideEl[0], $imageEl[0]);
31643
31644          if (swiper.params.autoHeight) {
31645            swiper.updateAutoHeight();
31646          }
31647        });
31648        swiper.emit('lazyImageLoad', $slideEl[0], $imageEl[0]);
31649      });
31650    },
31651    load: function load() {
31652      var swiper = this;
31653      var $wrapperEl = swiper.$wrapperEl,
31654          swiperParams = swiper.params,
31655          slides = swiper.slides,
31656          activeIndex = swiper.activeIndex;
31657      var isVirtual = swiper.virtual && swiperParams.virtual.enabled;
31658      var params = swiperParams.lazy;
31659      var slidesPerView = swiperParams.slidesPerView;
31660
31661      if (slidesPerView === 'auto') {
31662        slidesPerView = 0;
31663      }
31664
31665      function slideExist(index) {
31666        if (isVirtual) {
31667          if ($wrapperEl.children("." + swiperParams.slideClass + "[data-swiper-slide-index=\"" + index + "\"]").length) {
31668            return true;
31669          }
31670        } else if (slides[index]) return true;
31671
31672        return false;
31673      }
31674
31675      function slideIndex(slideEl) {
31676        if (isVirtual) {
31677          return $(slideEl).attr('data-swiper-slide-index');
31678        }
31679
31680        return $(slideEl).index();
31681      }
31682
31683      if (!swiper.lazy.initialImageLoaded) swiper.lazy.initialImageLoaded = true;
31684
31685      if (swiper.params.watchSlidesVisibility) {
31686        $wrapperEl.children("." + swiperParams.slideVisibleClass).each(function (slideEl) {
31687          var index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index();
31688          swiper.lazy.loadInSlide(index);
31689        });
31690      } else if (slidesPerView > 1) {
31691        for (var i = activeIndex; i < activeIndex + slidesPerView; i += 1) {
31692          if (slideExist(i)) swiper.lazy.loadInSlide(i);
31693        }
31694      } else {
31695        swiper.lazy.loadInSlide(activeIndex);
31696      }
31697
31698      if (params.loadPrevNext) {
31699        if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) {
31700          var amount = params.loadPrevNextAmount;
31701          var spv = slidesPerView;
31702          var maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length);
31703          var minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides
31704
31705          for (var _i = activeIndex + slidesPerView; _i < maxIndex; _i += 1) {
31706            if (slideExist(_i)) swiper.lazy.loadInSlide(_i);
31707          } // Prev Slides
31708
31709
31710          for (var _i2 = minIndex; _i2 < activeIndex; _i2 += 1) {
31711            if (slideExist(_i2)) swiper.lazy.loadInSlide(_i2);
31712          }
31713        } else {
31714          var nextSlide = $wrapperEl.children("." + swiperParams.slideNextClass);
31715          if (nextSlide.length > 0) swiper.lazy.loadInSlide(slideIndex(nextSlide));
31716          var prevSlide = $wrapperEl.children("." + swiperParams.slidePrevClass);
31717          if (prevSlide.length > 0) swiper.lazy.loadInSlide(slideIndex(prevSlide));
31718        }
31719      }
31720    },
31721    checkInViewOnLoad: function checkInViewOnLoad() {
31722      var window = getWindow();
31723      var swiper = this;
31724      if (!swiper || swiper.destroyed) return;
31725      var $scrollElement = swiper.params.lazy.scrollingElement ? $(swiper.params.lazy.scrollingElement) : $(window);
31726      var isWindow = $scrollElement[0] === window;
31727      var scrollElementWidth = isWindow ? window.innerWidth : $scrollElement[0].offsetWidth;
31728      var scrollElementHeight = isWindow ? window.innerHeight : $scrollElement[0].offsetHeight;
31729      var swiperOffset = swiper.$el.offset();
31730      var rtl = swiper.rtlTranslate;
31731      var inView = false;
31732      if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft;
31733      var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]];
31734
31735      for (var i = 0; i < swiperCoord.length; i += 1) {
31736        var point = swiperCoord[i];
31737
31738        if (point[0] >= 0 && point[0] <= scrollElementWidth && point[1] >= 0 && point[1] <= scrollElementHeight) {
31739          if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
31740
31741          inView = true;
31742        }
31743      }
31744
31745      var passiveListener = swiper.touchEvents.start === 'touchstart' && swiper.support.passiveListener && swiper.params.passiveListeners ? {
31746        passive: true,
31747        capture: false
31748      } : false;
31749
31750      if (inView) {
31751        swiper.lazy.load();
31752        $scrollElement.off('scroll', swiper.lazy.checkInViewOnLoad, passiveListener);
31753      } else if (!swiper.lazy.scrollHandlerAttached) {
31754        swiper.lazy.scrollHandlerAttached = true;
31755        $scrollElement.on('scroll', swiper.lazy.checkInViewOnLoad, passiveListener);
31756      }
31757    }
31758  };
31759  var Lazy$1 = {
31760    name: 'lazy',
31761    params: {
31762      lazy: {
31763        checkInView: false,
31764        enabled: false,
31765        loadPrevNext: false,
31766        loadPrevNextAmount: 1,
31767        loadOnTransitionStart: false,
31768        scrollingElement: '',
31769        elementClass: 'swiper-lazy',
31770        loadingClass: 'swiper-lazy-loading',
31771        loadedClass: 'swiper-lazy-loaded',
31772        preloaderClass: 'swiper-lazy-preloader'
31773      }
31774    },
31775    create: function create() {
31776      var swiper = this;
31777      bindModuleMethods(swiper, {
31778        lazy: _extends({
31779          initialImageLoaded: false
31780        }, Lazy)
31781      });
31782    },
31783    on: {
31784      beforeInit: function beforeInit(swiper) {
31785        if (swiper.params.lazy.enabled && swiper.params.preloadImages) {
31786          swiper.params.preloadImages = false;
31787        }
31788      },
31789      init: function init(swiper) {
31790        if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialSlide === 0) {
31791          if (swiper.params.lazy.checkInView) {
31792            swiper.lazy.checkInViewOnLoad();
31793          } else {
31794            swiper.lazy.load();
31795          }
31796        }
31797      },
31798      scroll: function scroll(swiper) {
31799        if (swiper.params.freeMode && !swiper.params.freeModeSticky) {
31800          swiper.lazy.load();
31801        }
31802      },
31803      'scrollbarDragMove resize _freeModeNoMomentumRelease': function lazyLoad(swiper) {
31804        if (swiper.params.lazy.enabled) {
31805          swiper.lazy.load();
31806        }
31807      },
31808      transitionStart: function transitionStart(swiper) {
31809        if (swiper.params.lazy.enabled) {
31810          if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !swiper.lazy.initialImageLoaded) {
31811            swiper.lazy.load();
31812          }
31813        }
31814      },
31815      transitionEnd: function transitionEnd(swiper) {
31816        if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) {
31817          swiper.lazy.load();
31818        }
31819      },
31820      slideChange: function slideChange(swiper) {
31821        var _swiper$params = swiper.params,
31822            lazy = _swiper$params.lazy,
31823            cssMode = _swiper$params.cssMode,
31824            watchSlidesVisibility = _swiper$params.watchSlidesVisibility,
31825            watchSlidesProgress = _swiper$params.watchSlidesProgress,
31826            touchReleaseOnEdges = _swiper$params.touchReleaseOnEdges,
31827            resistanceRatio = _swiper$params.resistanceRatio;
31828
31829        if (lazy.enabled && (cssMode || (watchSlidesVisibility || watchSlidesProgress) && (touchReleaseOnEdges || resistanceRatio === 0))) {
31830          swiper.lazy.load();
31831        }
31832      }
31833    }
31834  };
31835
31836  var Controller = {
31837    LinearSpline: function LinearSpline(x, y) {
31838      var binarySearch = function search() {
31839        var maxIndex;
31840        var minIndex;
31841        var guess;
31842        return function (array, val) {
31843          minIndex = -1;
31844          maxIndex = array.length;
31845
31846          while (maxIndex - minIndex > 1) {
31847            guess = maxIndex + minIndex >> 1;
31848
31849            if (array[guess] <= val) {
31850              minIndex = guess;
31851            } else {
31852              maxIndex = guess;
31853            }
31854          }
31855
31856          return maxIndex;
31857        };
31858      }();
31859
31860      this.x = x;
31861      this.y = y;
31862      this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value:
31863      // (x1,y1) is the known point before given value,
31864      // (x3,y3) is the known point after given value.
31865
31866      var i1;
31867      var i3;
31868
31869      this.interpolate = function interpolate(x2) {
31870        if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2):
31871
31872        i3 = binarySearch(this.x, x2);
31873        i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already:
31874        // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
31875
31876        return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
31877      };
31878
31879      return this;
31880    },
31881    // xxx: for now i will just save one spline function to to
31882    getInterpolateFunction: function getInterpolateFunction(c) {
31883      var swiper = this;
31884
31885      if (!swiper.controller.spline) {
31886        swiper.controller.spline = swiper.params.loop ? new Controller.LinearSpline(swiper.slidesGrid, c.slidesGrid) : new Controller.LinearSpline(swiper.snapGrid, c.snapGrid);
31887      }
31888    },
31889    setTranslate: function setTranslate(_setTranslate, byController) {
31890      var swiper = this;
31891      var controlled = swiper.controller.control;
31892      var multiplier;
31893      var controlledTranslate;
31894      var Swiper = swiper.constructor;
31895
31896      function setControlledTranslate(c) {
31897        // this will create an Interpolate function based on the snapGrids
31898        // x is the Grid of the scrolled scroller and y will be the controlled scroller
31899        // it makes sense to create this only once and recall it for the interpolation
31900        // the function does a lot of value caching for performance
31901        var translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;
31902
31903        if (swiper.params.controller.by === 'slide') {
31904          swiper.controller.getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
31905          // but it did not work out
31906
31907          controlledTranslate = -swiper.controller.spline.interpolate(-translate);
31908        }
31909
31910        if (!controlledTranslate || swiper.params.controller.by === 'container') {
31911          multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
31912          controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
31913        }
31914
31915        if (swiper.params.controller.inverse) {
31916          controlledTranslate = c.maxTranslate() - controlledTranslate;
31917        }
31918
31919        c.updateProgress(controlledTranslate);
31920        c.setTranslate(controlledTranslate, swiper);
31921        c.updateActiveIndex();
31922        c.updateSlidesClasses();
31923      }
31924
31925      if (Array.isArray(controlled)) {
31926        for (var i = 0; i < controlled.length; i += 1) {
31927          if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
31928            setControlledTranslate(controlled[i]);
31929          }
31930        }
31931      } else if (controlled instanceof Swiper && byController !== controlled) {
31932        setControlledTranslate(controlled);
31933      }
31934    },
31935    setTransition: function setTransition(duration, byController) {
31936      var swiper = this;
31937      var Swiper = swiper.constructor;
31938      var controlled = swiper.controller.control;
31939      var i;
31940
31941      function setControlledTransition(c) {
31942        c.setTransition(duration, swiper);
31943
31944        if (duration !== 0) {
31945          c.transitionStart();
31946
31947          if (c.params.autoHeight) {
31948            nextTick(function () {
31949              c.updateAutoHeight();
31950            });
31951          }
31952
31953          c.$wrapperEl.transitionEnd(function () {
31954            if (!controlled) return;
31955
31956            if (c.params.loop && swiper.params.controller.by === 'slide') {
31957              c.loopFix();
31958            }
31959
31960            c.transitionEnd();
31961          });
31962        }
31963      }
31964
31965      if (Array.isArray(controlled)) {
31966        for (i = 0; i < controlled.length; i += 1) {
31967          if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
31968            setControlledTransition(controlled[i]);
31969          }
31970        }
31971      } else if (controlled instanceof Swiper && byController !== controlled) {
31972        setControlledTransition(controlled);
31973      }
31974    }
31975  };
31976  var Controller$1 = {
31977    name: 'controller',
31978    params: {
31979      controller: {
31980        control: undefined,
31981        inverse: false,
31982        by: 'slide' // or 'container'
31983
31984      }
31985    },
31986    create: function create() {
31987      var swiper = this;
31988      bindModuleMethods(swiper, {
31989        controller: _extends({
31990          control: swiper.params.controller.control
31991        }, Controller)
31992      });
31993    },
31994    on: {
31995      update: function update(swiper) {
31996        if (!swiper.controller.control) return;
31997
31998        if (swiper.controller.spline) {
31999          swiper.controller.spline = undefined;
32000          delete swiper.controller.spline;
32001        }
32002      },
32003      resize: function resize(swiper) {
32004        if (!swiper.controller.control) return;
32005
32006        if (swiper.controller.spline) {
32007          swiper.controller.spline = undefined;
32008          delete swiper.controller.spline;
32009        }
32010      },
32011      observerUpdate: function observerUpdate(swiper) {
32012        if (!swiper.controller.control) return;
32013
32014        if (swiper.controller.spline) {
32015          swiper.controller.spline = undefined;
32016          delete swiper.controller.spline;
32017        }
32018      },
32019      setTranslate: function setTranslate(swiper, translate, byController) {
32020        if (!swiper.controller.control) return;
32021        swiper.controller.setTranslate(translate, byController);
32022      },
32023      setTransition: function setTransition(swiper, duration, byController) {
32024        if (!swiper.controller.control) return;
32025        swiper.controller.setTransition(duration, byController);
32026      }
32027    }
32028  };
32029
32030  var A11y = {
32031    getRandomNumber: function getRandomNumber(size) {
32032      if (size === void 0) {
32033        size = 16;
32034      }
32035
32036      var randomChar = function randomChar() {
32037        return Math.round(16 * Math.random()).toString(16);
32038      };
32039
32040      return 'x'.repeat(size).replace(/x/g, randomChar);
32041    },
32042    makeElFocusable: function makeElFocusable($el) {
32043      $el.attr('tabIndex', '0');
32044      return $el;
32045    },
32046    makeElNotFocusable: function makeElNotFocusable($el) {
32047      $el.attr('tabIndex', '-1');
32048      return $el;
32049    },
32050    addElRole: function addElRole($el, role) {
32051      $el.attr('role', role);
32052      return $el;
32053    },
32054    addElRoleDescription: function addElRoleDescription($el, description) {
32055      $el.attr('aria-roledescription', description);
32056      return $el;
32057    },
32058    addElControls: function addElControls($el, controls) {
32059      $el.attr('aria-controls', controls);
32060      return $el;
32061    },
32062    addElLabel: function addElLabel($el, label) {
32063      $el.attr('aria-label', label);
32064      return $el;
32065    },
32066    addElId: function addElId($el, id) {
32067      $el.attr('id', id);
32068      return $el;
32069    },
32070    addElLive: function addElLive($el, live) {
32071      $el.attr('aria-live', live);
32072      return $el;
32073    },
32074    disableEl: function disableEl($el) {
32075      $el.attr('aria-disabled', true);
32076      return $el;
32077    },
32078    enableEl: function enableEl($el) {
32079      $el.attr('aria-disabled', false);
32080      return $el;
32081    },
32082    onEnterOrSpaceKey: function onEnterOrSpaceKey(e) {
32083      if (e.keyCode !== 13 && e.keyCode !== 32) return;
32084      var swiper = this;
32085      var params = swiper.params.a11y;
32086      var $targetEl = $(e.target);
32087
32088      if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) {
32089        if (!(swiper.isEnd && !swiper.params.loop)) {
32090          swiper.slideNext();
32091        }
32092
32093        if (swiper.isEnd) {
32094          swiper.a11y.notify(params.lastSlideMessage);
32095        } else {
32096          swiper.a11y.notify(params.nextSlideMessage);
32097        }
32098      }
32099
32100      if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) {
32101        if (!(swiper.isBeginning && !swiper.params.loop)) {
32102          swiper.slidePrev();
32103        }
32104
32105        if (swiper.isBeginning) {
32106          swiper.a11y.notify(params.firstSlideMessage);
32107        } else {
32108          swiper.a11y.notify(params.prevSlideMessage);
32109        }
32110      }
32111
32112      if (swiper.pagination && $targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))) {
32113        $targetEl[0].click();
32114      }
32115    },
32116    notify: function notify(message) {
32117      var swiper = this;
32118      var notification = swiper.a11y.liveRegion;
32119      if (notification.length === 0) return;
32120      notification.html('');
32121      notification.html(message);
32122    },
32123    updateNavigation: function updateNavigation() {
32124      var swiper = this;
32125      if (swiper.params.loop || !swiper.navigation) return;
32126      var _swiper$navigation = swiper.navigation,
32127          $nextEl = _swiper$navigation.$nextEl,
32128          $prevEl = _swiper$navigation.$prevEl;
32129
32130      if ($prevEl && $prevEl.length > 0) {
32131        if (swiper.isBeginning) {
32132          swiper.a11y.disableEl($prevEl);
32133          swiper.a11y.makeElNotFocusable($prevEl);
32134        } else {
32135          swiper.a11y.enableEl($prevEl);
32136          swiper.a11y.makeElFocusable($prevEl);
32137        }
32138      }
32139
32140      if ($nextEl && $nextEl.length > 0) {
32141        if (swiper.isEnd) {
32142          swiper.a11y.disableEl($nextEl);
32143          swiper.a11y.makeElNotFocusable($nextEl);
32144        } else {
32145          swiper.a11y.enableEl($nextEl);
32146          swiper.a11y.makeElFocusable($nextEl);
32147        }
32148      }
32149    },
32150    updatePagination: function updatePagination() {
32151      var swiper = this;
32152      var params = swiper.params.a11y;
32153
32154      if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
32155        swiper.pagination.bullets.each(function (bulletEl) {
32156          var $bulletEl = $(bulletEl);
32157          swiper.a11y.makeElFocusable($bulletEl);
32158
32159          if (!swiper.params.pagination.renderBullet) {
32160            swiper.a11y.addElRole($bulletEl, 'button');
32161            swiper.a11y.addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1));
32162          }
32163        });
32164      }
32165    },
32166    init: function init() {
32167      var swiper = this;
32168      var params = swiper.params.a11y;
32169      swiper.$el.append(swiper.a11y.liveRegion); // Container
32170
32171      var $containerEl = swiper.$el;
32172
32173      if (params.containerRoleDescriptionMessage) {
32174        swiper.a11y.addElRoleDescription($containerEl, params.containerRoleDescriptionMessage);
32175      }
32176
32177      if (params.containerMessage) {
32178        swiper.a11y.addElLabel($containerEl, params.containerMessage);
32179      } // Wrapper
32180
32181
32182      var $wrapperEl = swiper.$wrapperEl;
32183      var wrapperId = $wrapperEl.attr('id') || "swiper-wrapper-" + swiper.a11y.getRandomNumber(16);
32184      var live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
32185      swiper.a11y.addElId($wrapperEl, wrapperId);
32186      swiper.a11y.addElLive($wrapperEl, live); // Slide
32187
32188      if (params.itemRoleDescriptionMessage) {
32189        swiper.a11y.addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage);
32190      }
32191
32192      swiper.a11y.addElRole($(swiper.slides), params.slideRole);
32193      var slidesLength = swiper.params.loop ? swiper.slides.filter(function (el) {
32194        return !el.classList.contains(swiper.params.slideDuplicateClass);
32195      }).length : swiper.slides.length;
32196      swiper.slides.each(function (slideEl, index) {
32197        var $slideEl = $(slideEl);
32198        var slideIndex = swiper.params.loop ? parseInt($slideEl.attr('data-swiper-slide-index'), 10) : index;
32199        var ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
32200        swiper.a11y.addElLabel($slideEl, ariaLabelMessage);
32201      }); // Navigation
32202
32203      var $nextEl;
32204      var $prevEl;
32205
32206      if (swiper.navigation && swiper.navigation.$nextEl) {
32207        $nextEl = swiper.navigation.$nextEl;
32208      }
32209
32210      if (swiper.navigation && swiper.navigation.$prevEl) {
32211        $prevEl = swiper.navigation.$prevEl;
32212      }
32213
32214      if ($nextEl && $nextEl.length) {
32215        swiper.a11y.makeElFocusable($nextEl);
32216
32217        if ($nextEl[0].tagName !== 'BUTTON') {
32218          swiper.a11y.addElRole($nextEl, 'button');
32219          $nextEl.on('keydown', swiper.a11y.onEnterOrSpaceKey);
32220        }
32221
32222        swiper.a11y.addElLabel($nextEl, params.nextSlideMessage);
32223        swiper.a11y.addElControls($nextEl, wrapperId);
32224      }
32225
32226      if ($prevEl && $prevEl.length) {
32227        swiper.a11y.makeElFocusable($prevEl);
32228
32229        if ($prevEl[0].tagName !== 'BUTTON') {
32230          swiper.a11y.addElRole($prevEl, 'button');
32231          $prevEl.on('keydown', swiper.a11y.onEnterOrSpaceKey);
32232        }
32233
32234        swiper.a11y.addElLabel($prevEl, params.prevSlideMessage);
32235        swiper.a11y.addElControls($prevEl, wrapperId);
32236      } // Pagination
32237
32238
32239      if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
32240        swiper.pagination.$el.on('keydown', classesToSelector(swiper.params.pagination.bulletClass), swiper.a11y.onEnterOrSpaceKey);
32241      }
32242    },
32243    destroy: function destroy() {
32244      var swiper = this;
32245      if (swiper.a11y.liveRegion && swiper.a11y.liveRegion.length > 0) swiper.a11y.liveRegion.remove();
32246      var $nextEl;
32247      var $prevEl;
32248
32249      if (swiper.navigation && swiper.navigation.$nextEl) {
32250        $nextEl = swiper.navigation.$nextEl;
32251      }
32252
32253      if (swiper.navigation && swiper.navigation.$prevEl) {
32254        $prevEl = swiper.navigation.$prevEl;
32255      }
32256
32257      if ($nextEl) {
32258        $nextEl.off('keydown', swiper.a11y.onEnterOrSpaceKey);
32259      }
32260
32261      if ($prevEl) {
32262        $prevEl.off('keydown', swiper.a11y.onEnterOrSpaceKey);
32263      } // Pagination
32264
32265
32266      if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
32267        swiper.pagination.$el.off('keydown', classesToSelector(swiper.params.pagination.bulletClass), swiper.a11y.onEnterOrSpaceKey);
32268      }
32269    }
32270  };
32271  var A11y$1 = {
32272    name: 'a11y',
32273    params: {
32274      a11y: {
32275        enabled: true,
32276        notificationClass: 'swiper-notification',
32277        prevSlideMessage: 'Previous slide',
32278        nextSlideMessage: 'Next slide',
32279        firstSlideMessage: 'This is the first slide',
32280        lastSlideMessage: 'This is the last slide',
32281        paginationBulletMessage: 'Go to slide {{index}}',
32282        slideLabelMessage: '{{index}} / {{slidesLength}}',
32283        containerMessage: null,
32284        containerRoleDescriptionMessage: null,
32285        itemRoleDescriptionMessage: null,
32286        slideRole: 'group'
32287      }
32288    },
32289    create: function create() {
32290      var swiper = this;
32291      bindModuleMethods(swiper, {
32292        a11y: _extends({}, A11y, {
32293          liveRegion: $("<span class=\"" + swiper.params.a11y.notificationClass + "\" aria-live=\"assertive\" aria-atomic=\"true\"></span>")
32294        })
32295      });
32296    },
32297    on: {
32298      afterInit: function afterInit(swiper) {
32299        if (!swiper.params.a11y.enabled) return;
32300        swiper.a11y.init();
32301        swiper.a11y.updateNavigation();
32302      },
32303      toEdge: function toEdge(swiper) {
32304        if (!swiper.params.a11y.enabled) return;
32305        swiper.a11y.updateNavigation();
32306      },
32307      fromEdge: function fromEdge(swiper) {
32308        if (!swiper.params.a11y.enabled) return;
32309        swiper.a11y.updateNavigation();
32310      },
32311      paginationUpdate: function paginationUpdate(swiper) {
32312        if (!swiper.params.a11y.enabled) return;
32313        swiper.a11y.updatePagination();
32314      },
32315      destroy: function destroy(swiper) {
32316        if (!swiper.params.a11y.enabled) return;
32317        swiper.a11y.destroy();
32318      }
32319    }
32320  };
32321
32322  var History = {
32323    init: function init() {
32324      var swiper = this;
32325      var window = getWindow();
32326      if (!swiper.params.history) return;
32327
32328      if (!window.history || !window.history.pushState) {
32329        swiper.params.history.enabled = false;
32330        swiper.params.hashNavigation.enabled = true;
32331        return;
32332      }
32333
32334      var history = swiper.history;
32335      history.initialized = true;
32336      history.paths = History.getPathValues(swiper.params.url);
32337      if (!history.paths.key && !history.paths.value) return;
32338      history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit);
32339
32340      if (!swiper.params.history.replaceState) {
32341        window.addEventListener('popstate', swiper.history.setHistoryPopState);
32342      }
32343    },
32344    destroy: function destroy() {
32345      var swiper = this;
32346      var window = getWindow();
32347
32348      if (!swiper.params.history.replaceState) {
32349        window.removeEventListener('popstate', swiper.history.setHistoryPopState);
32350      }
32351    },
32352    setHistoryPopState: function setHistoryPopState() {
32353      var swiper = this;
32354      swiper.history.paths = History.getPathValues(swiper.params.url);
32355      swiper.history.scrollToSlide(swiper.params.speed, swiper.history.paths.value, false);
32356    },
32357    getPathValues: function getPathValues(urlOverride) {
32358      var window = getWindow();
32359      var location;
32360
32361      if (urlOverride) {
32362        location = new URL(urlOverride);
32363      } else {
32364        location = window.location;
32365      }
32366
32367      var pathArray = location.pathname.slice(1).split('/').filter(function (part) {
32368        return part !== '';
32369      });
32370      var total = pathArray.length;
32371      var key = pathArray[total - 2];
32372      var value = pathArray[total - 1];
32373      return {
32374        key: key,
32375        value: value
32376      };
32377    },
32378    setHistory: function setHistory(key, index) {
32379      var swiper = this;
32380      var window = getWindow();
32381      if (!swiper.history.initialized || !swiper.params.history.enabled) return;
32382      var location;
32383
32384      if (swiper.params.url) {
32385        location = new URL(swiper.params.url);
32386      } else {
32387        location = window.location;
32388      }
32389
32390      var slide = swiper.slides.eq(index);
32391      var value = History.slugify(slide.attr('data-history'));
32392
32393      if (swiper.params.history.root.length > 0) {
32394        var root = swiper.params.history.root;
32395        if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);
32396        value = root + "/" + key + "/" + value;
32397      } else if (!location.pathname.includes(key)) {
32398        value = key + "/" + value;
32399      }
32400
32401      var currentState = window.history.state;
32402
32403      if (currentState && currentState.value === value) {
32404        return;
32405      }
32406
32407      if (swiper.params.history.replaceState) {
32408        window.history.replaceState({
32409          value: value
32410        }, null, value);
32411      } else {
32412        window.history.pushState({
32413          value: value
32414        }, null, value);
32415      }
32416    },
32417    slugify: function slugify(text) {
32418      return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
32419    },
32420    scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
32421      var swiper = this;
32422
32423      if (value) {
32424        for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
32425          var slide = swiper.slides.eq(i);
32426          var slideHistory = History.slugify(slide.attr('data-history'));
32427
32428          if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) {
32429            var index = slide.index();
32430            swiper.slideTo(index, speed, runCallbacks);
32431          }
32432        }
32433      } else {
32434        swiper.slideTo(0, speed, runCallbacks);
32435      }
32436    }
32437  };
32438  var History$1 = {
32439    name: 'history',
32440    params: {
32441      history: {
32442        enabled: false,
32443        root: '',
32444        replaceState: false,
32445        key: 'slides'
32446      }
32447    },
32448    create: function create() {
32449      var swiper = this;
32450      bindModuleMethods(swiper, {
32451        history: _extends({}, History)
32452      });
32453    },
32454    on: {
32455      init: function init(swiper) {
32456        if (swiper.params.history.enabled) {
32457          swiper.history.init();
32458        }
32459      },
32460      destroy: function destroy(swiper) {
32461        if (swiper.params.history.enabled) {
32462          swiper.history.destroy();
32463        }
32464      },
32465      'transitionEnd _freeModeNoMomentumRelease': function transitionEnd_freeModeNoMomentumRelease(swiper) {
32466        if (swiper.history.initialized) {
32467          swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex);
32468        }
32469      },
32470      slideChange: function slideChange(swiper) {
32471        if (swiper.history.initialized && swiper.params.cssMode) {
32472          swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex);
32473        }
32474      }
32475    }
32476  };
32477
32478  var HashNavigation = {
32479    onHashChange: function onHashChange() {
32480      var swiper = this;
32481      var document = getDocument();
32482      swiper.emit('hashChange');
32483      var newHash = document.location.hash.replace('#', '');
32484      var activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash');
32485
32486      if (newHash !== activeSlideHash) {
32487        var newIndex = swiper.$wrapperEl.children("." + swiper.params.slideClass + "[data-hash=\"" + newHash + "\"]").index();
32488        if (typeof newIndex === 'undefined') return;
32489        swiper.slideTo(newIndex);
32490      }
32491    },
32492    setHash: function setHash() {
32493      var swiper = this;
32494      var window = getWindow();
32495      var document = getDocument();
32496      if (!swiper.hashNavigation.initialized || !swiper.params.hashNavigation.enabled) return;
32497
32498      if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) {
32499        window.history.replaceState(null, null, "#" + swiper.slides.eq(swiper.activeIndex).attr('data-hash') || '');
32500        swiper.emit('hashSet');
32501      } else {
32502        var slide = swiper.slides.eq(swiper.activeIndex);
32503        var hash = slide.attr('data-hash') || slide.attr('data-history');
32504        document.location.hash = hash || '';
32505        swiper.emit('hashSet');
32506      }
32507    },
32508    init: function init() {
32509      var swiper = this;
32510      var document = getDocument();
32511      var window = getWindow();
32512      if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return;
32513      swiper.hashNavigation.initialized = true;
32514      var hash = document.location.hash.replace('#', '');
32515
32516      if (hash) {
32517        var speed = 0;
32518
32519        for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
32520          var slide = swiper.slides.eq(i);
32521          var slideHash = slide.attr('data-hash') || slide.attr('data-history');
32522
32523          if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) {
32524            var index = slide.index();
32525            swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true);
32526          }
32527        }
32528      }
32529
32530      if (swiper.params.hashNavigation.watchState) {
32531        $(window).on('hashchange', swiper.hashNavigation.onHashChange);
32532      }
32533    },
32534    destroy: function destroy() {
32535      var swiper = this;
32536      var window = getWindow();
32537
32538      if (swiper.params.hashNavigation.watchState) {
32539        $(window).off('hashchange', swiper.hashNavigation.onHashChange);
32540      }
32541    }
32542  };
32543  var HashNavigation$1 = {
32544    name: 'hash-navigation',
32545    params: {
32546      hashNavigation: {
32547        enabled: false,
32548        replaceState: false,
32549        watchState: false
32550      }
32551    },
32552    create: function create() {
32553      var swiper = this;
32554      bindModuleMethods(swiper, {
32555        hashNavigation: _extends({
32556          initialized: false
32557        }, HashNavigation)
32558      });
32559    },
32560    on: {
32561      init: function init(swiper) {
32562        if (swiper.params.hashNavigation.enabled) {
32563          swiper.hashNavigation.init();
32564        }
32565      },
32566      destroy: function destroy(swiper) {
32567        if (swiper.params.hashNavigation.enabled) {
32568          swiper.hashNavigation.destroy();
32569        }
32570      },
32571      'transitionEnd _freeModeNoMomentumRelease': function transitionEnd_freeModeNoMomentumRelease(swiper) {
32572        if (swiper.hashNavigation.initialized) {
32573          swiper.hashNavigation.setHash();
32574        }
32575      },
32576      slideChange: function slideChange(swiper) {
32577        if (swiper.hashNavigation.initialized && swiper.params.cssMode) {
32578          swiper.hashNavigation.setHash();
32579        }
32580      }
32581    }
32582  };
32583
32584  var Autoplay = {
32585    run: function run() {
32586      var swiper = this;
32587      var $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
32588      var delay = swiper.params.autoplay.delay;
32589
32590      if ($activeSlideEl.attr('data-swiper-autoplay')) {
32591        delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
32592      }
32593
32594      clearTimeout(swiper.autoplay.timeout);
32595      swiper.autoplay.timeout = nextTick(function () {
32596        var autoplayResult;
32597
32598        if (swiper.params.autoplay.reverseDirection) {
32599          if (swiper.params.loop) {
32600            swiper.loopFix();
32601            autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
32602            swiper.emit('autoplay');
32603          } else if (!swiper.isBeginning) {
32604            autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
32605            swiper.emit('autoplay');
32606          } else if (!swiper.params.autoplay.stopOnLastSlide) {
32607            autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
32608            swiper.emit('autoplay');
32609          } else {
32610            swiper.autoplay.stop();
32611          }
32612        } else if (swiper.params.loop) {
32613          swiper.loopFix();
32614          autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
32615          swiper.emit('autoplay');
32616        } else if (!swiper.isEnd) {
32617          autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
32618          swiper.emit('autoplay');
32619        } else if (!swiper.params.autoplay.stopOnLastSlide) {
32620          autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
32621          swiper.emit('autoplay');
32622        } else {
32623          swiper.autoplay.stop();
32624        }
32625
32626        if (swiper.params.cssMode && swiper.autoplay.running) swiper.autoplay.run();else if (autoplayResult === false) {
32627          swiper.autoplay.run();
32628        }
32629      }, delay);
32630    },
32631    start: function start() {
32632      var swiper = this;
32633      if (typeof swiper.autoplay.timeout !== 'undefined') return false;
32634      if (swiper.autoplay.running) return false;
32635      swiper.autoplay.running = true;
32636      swiper.emit('autoplayStart');
32637      swiper.autoplay.run();
32638      return true;
32639    },
32640    stop: function stop() {
32641      var swiper = this;
32642      if (!swiper.autoplay.running) return false;
32643      if (typeof swiper.autoplay.timeout === 'undefined') return false;
32644
32645      if (swiper.autoplay.timeout) {
32646        clearTimeout(swiper.autoplay.timeout);
32647        swiper.autoplay.timeout = undefined;
32648      }
32649
32650      swiper.autoplay.running = false;
32651      swiper.emit('autoplayStop');
32652      return true;
32653    },
32654    pause: function pause(speed) {
32655      var swiper = this;
32656      if (!swiper.autoplay.running) return;
32657      if (swiper.autoplay.paused) return;
32658      if (swiper.autoplay.timeout) clearTimeout(swiper.autoplay.timeout);
32659      swiper.autoplay.paused = true;
32660
32661      if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
32662        swiper.autoplay.paused = false;
32663        swiper.autoplay.run();
32664      } else {
32665        ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
32666          swiper.$wrapperEl[0].addEventListener(event, swiper.autoplay.onTransitionEnd);
32667        });
32668      }
32669    },
32670    onVisibilityChange: function onVisibilityChange() {
32671      var swiper = this;
32672      var document = getDocument();
32673
32674      if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
32675        swiper.autoplay.pause();
32676      }
32677
32678      if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
32679        swiper.autoplay.run();
32680        swiper.autoplay.paused = false;
32681      }
32682    },
32683    onTransitionEnd: function onTransitionEnd(e) {
32684      var swiper = this;
32685      if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
32686      if (e.target !== swiper.$wrapperEl[0]) return;
32687      ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
32688        swiper.$wrapperEl[0].removeEventListener(event, swiper.autoplay.onTransitionEnd);
32689      });
32690      swiper.autoplay.paused = false;
32691
32692      if (!swiper.autoplay.running) {
32693        swiper.autoplay.stop();
32694      } else {
32695        swiper.autoplay.run();
32696      }
32697    },
32698    onMouseEnter: function onMouseEnter() {
32699      var swiper = this;
32700
32701      if (swiper.params.autoplay.disableOnInteraction) {
32702        swiper.autoplay.stop();
32703      } else {
32704        swiper.autoplay.pause();
32705      }
32706
32707      ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
32708        swiper.$wrapperEl[0].removeEventListener(event, swiper.autoplay.onTransitionEnd);
32709      });
32710    },
32711    onMouseLeave: function onMouseLeave() {
32712      var swiper = this;
32713
32714      if (swiper.params.autoplay.disableOnInteraction) {
32715        return;
32716      }
32717
32718      swiper.autoplay.paused = false;
32719      swiper.autoplay.run();
32720    },
32721    attachMouseEvents: function attachMouseEvents() {
32722      var swiper = this;
32723
32724      if (swiper.params.autoplay.pauseOnMouseEnter) {
32725        swiper.$el.on('mouseenter', swiper.autoplay.onMouseEnter);
32726        swiper.$el.on('mouseleave', swiper.autoplay.onMouseLeave);
32727      }
32728    },
32729    detachMouseEvents: function detachMouseEvents() {
32730      var swiper = this;
32731      swiper.$el.off('mouseenter', swiper.autoplay.onMouseEnter);
32732      swiper.$el.off('mouseleave', swiper.autoplay.onMouseLeave);
32733    }
32734  };
32735  var Autoplay$1 = {
32736    name: 'autoplay',
32737    params: {
32738      autoplay: {
32739        enabled: false,
32740        delay: 3000,
32741        waitForTransition: true,
32742        disableOnInteraction: true,
32743        stopOnLastSlide: false,
32744        reverseDirection: false,
32745        pauseOnMouseEnter: false
32746      }
32747    },
32748    create: function create() {
32749      var swiper = this;
32750      bindModuleMethods(swiper, {
32751        autoplay: _extends({}, Autoplay, {
32752          running: false,
32753          paused: false
32754        })
32755      });
32756    },
32757    on: {
32758      init: function init(swiper) {
32759        if (swiper.params.autoplay.enabled) {
32760          swiper.autoplay.start();
32761          var document = getDocument();
32762          document.addEventListener('visibilitychange', swiper.autoplay.onVisibilityChange);
32763          swiper.autoplay.attachMouseEvents();
32764        }
32765      },
32766      beforeTransitionStart: function beforeTransitionStart(swiper, speed, internal) {
32767        if (swiper.autoplay.running) {
32768          if (internal || !swiper.params.autoplay.disableOnInteraction) {
32769            swiper.autoplay.pause(speed);
32770          } else {
32771            swiper.autoplay.stop();
32772          }
32773        }
32774      },
32775      sliderFirstMove: function sliderFirstMove(swiper) {
32776        if (swiper.autoplay.running) {
32777          if (swiper.params.autoplay.disableOnInteraction) {
32778            swiper.autoplay.stop();
32779          } else {
32780            swiper.autoplay.pause();
32781          }
32782        }
32783      },
32784      touchEnd: function touchEnd(swiper) {
32785        if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
32786          swiper.autoplay.run();
32787        }
32788      },
32789      destroy: function destroy(swiper) {
32790        swiper.autoplay.detachMouseEvents();
32791
32792        if (swiper.autoplay.running) {
32793          swiper.autoplay.stop();
32794        }
32795
32796        var document = getDocument();
32797        document.removeEventListener('visibilitychange', swiper.autoplay.onVisibilityChange);
32798      }
32799    }
32800  };
32801
32802  var Fade = {
32803    setTranslate: function setTranslate() {
32804      var swiper = this;
32805      var slides = swiper.slides;
32806
32807      for (var i = 0; i < slides.length; i += 1) {
32808        var $slideEl = swiper.slides.eq(i);
32809        var offset = $slideEl[0].swiperSlideOffset;
32810        var tx = -offset;
32811        if (!swiper.params.virtualTranslate) tx -= swiper.translate;
32812        var ty = 0;
32813
32814        if (!swiper.isHorizontal()) {
32815          ty = tx;
32816          tx = 0;
32817        }
32818
32819        var slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0);
32820        $slideEl.css({
32821          opacity: slideOpacity
32822        }).transform("translate3d(" + tx + "px, " + ty + "px, 0px)");
32823      }
32824    },
32825    setTransition: function setTransition(duration) {
32826      var swiper = this;
32827      var slides = swiper.slides,
32828          $wrapperEl = swiper.$wrapperEl;
32829      slides.transition(duration);
32830
32831      if (swiper.params.virtualTranslate && duration !== 0) {
32832        var eventTriggered = false;
32833        slides.transitionEnd(function () {
32834          if (eventTriggered) return;
32835          if (!swiper || swiper.destroyed) return;
32836          eventTriggered = true;
32837          swiper.animating = false;
32838          var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
32839
32840          for (var i = 0; i < triggerEvents.length; i += 1) {
32841            $wrapperEl.trigger(triggerEvents[i]);
32842          }
32843        });
32844      }
32845    }
32846  };
32847  var EffectFade = {
32848    name: 'effect-fade',
32849    params: {
32850      fadeEffect: {
32851        crossFade: false
32852      }
32853    },
32854    create: function create() {
32855      var swiper = this;
32856      bindModuleMethods(swiper, {
32857        fadeEffect: _extends({}, Fade)
32858      });
32859    },
32860    on: {
32861      beforeInit: function beforeInit(swiper) {
32862        if (swiper.params.effect !== 'fade') return;
32863        swiper.classNames.push(swiper.params.containerModifierClass + "fade");
32864        var overwriteParams = {
32865          slidesPerView: 1,
32866          slidesPerColumn: 1,
32867          slidesPerGroup: 1,
32868          watchSlidesProgress: true,
32869          spaceBetween: 0,
32870          virtualTranslate: true
32871        };
32872        extend(swiper.params, overwriteParams);
32873        extend(swiper.originalParams, overwriteParams);
32874      },
32875      setTranslate: function setTranslate(swiper) {
32876        if (swiper.params.effect !== 'fade') return;
32877        swiper.fadeEffect.setTranslate();
32878      },
32879      setTransition: function setTransition(swiper, duration) {
32880        if (swiper.params.effect !== 'fade') return;
32881        swiper.fadeEffect.setTransition(duration);
32882      }
32883    }
32884  };
32885
32886  var Cube = {
32887    setTranslate: function setTranslate() {
32888      var swiper = this;
32889      var $el = swiper.$el,
32890          $wrapperEl = swiper.$wrapperEl,
32891          slides = swiper.slides,
32892          swiperWidth = swiper.width,
32893          swiperHeight = swiper.height,
32894          rtl = swiper.rtlTranslate,
32895          swiperSize = swiper.size,
32896          browser = swiper.browser;
32897      var params = swiper.params.cubeEffect;
32898      var isHorizontal = swiper.isHorizontal();
32899      var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
32900      var wrapperRotate = 0;
32901      var $cubeShadowEl;
32902
32903      if (params.shadow) {
32904        if (isHorizontal) {
32905          $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow');
32906
32907          if ($cubeShadowEl.length === 0) {
32908            $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
32909            $wrapperEl.append($cubeShadowEl);
32910          }
32911
32912          $cubeShadowEl.css({
32913            height: swiperWidth + "px"
32914          });
32915        } else {
32916          $cubeShadowEl = $el.find('.swiper-cube-shadow');
32917
32918          if ($cubeShadowEl.length === 0) {
32919            $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
32920            $el.append($cubeShadowEl);
32921          }
32922        }
32923      }
32924
32925      for (var i = 0; i < slides.length; i += 1) {
32926        var $slideEl = slides.eq(i);
32927        var slideIndex = i;
32928
32929        if (isVirtual) {
32930          slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10);
32931        }
32932
32933        var slideAngle = slideIndex * 90;
32934        var round = Math.floor(slideAngle / 360);
32935
32936        if (rtl) {
32937          slideAngle = -slideAngle;
32938          round = Math.floor(-slideAngle / 360);
32939        }
32940
32941        var progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
32942        var tx = 0;
32943        var ty = 0;
32944        var tz = 0;
32945
32946        if (slideIndex % 4 === 0) {
32947          tx = -round * 4 * swiperSize;
32948          tz = 0;
32949        } else if ((slideIndex - 1) % 4 === 0) {
32950          tx = 0;
32951          tz = -round * 4 * swiperSize;
32952        } else if ((slideIndex - 2) % 4 === 0) {
32953          tx = swiperSize + round * 4 * swiperSize;
32954          tz = swiperSize;
32955        } else if ((slideIndex - 3) % 4 === 0) {
32956          tx = -swiperSize;
32957          tz = 3 * swiperSize + swiperSize * 4 * round;
32958        }
32959
32960        if (rtl) {
32961          tx = -tx;
32962        }
32963
32964        if (!isHorizontal) {
32965          ty = tx;
32966          tx = 0;
32967        }
32968
32969        var transform = "rotateX(" + (isHorizontal ? 0 : -slideAngle) + "deg) rotateY(" + (isHorizontal ? slideAngle : 0) + "deg) translate3d(" + tx + "px, " + ty + "px, " + tz + "px)";
32970
32971        if (progress <= 1 && progress > -1) {
32972          wrapperRotate = slideIndex * 90 + progress * 90;
32973          if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;
32974        }
32975
32976        $slideEl.transform(transform);
32977
32978        if (params.slideShadows) {
32979          // Set shadows
32980          var shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
32981          var shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
32982
32983          if (shadowBefore.length === 0) {
32984            shadowBefore = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>");
32985            $slideEl.append(shadowBefore);
32986          }
32987
32988          if (shadowAfter.length === 0) {
32989            shadowAfter = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>");
32990            $slideEl.append(shadowAfter);
32991          }
32992
32993          if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
32994          if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
32995        }
32996      }
32997
32998      $wrapperEl.css({
32999        '-webkit-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
33000        '-moz-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
33001        '-ms-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
33002        'transform-origin': "50% 50% -" + swiperSize / 2 + "px"
33003      });
33004
33005      if (params.shadow) {
33006        if (isHorizontal) {
33007          $cubeShadowEl.transform("translate3d(0px, " + (swiperWidth / 2 + params.shadowOffset) + "px, " + -swiperWidth / 2 + "px) rotateX(90deg) rotateZ(0deg) scale(" + params.shadowScale + ")");
33008        } else {
33009          var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
33010          var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
33011          var scale1 = params.shadowScale;
33012          var scale2 = params.shadowScale / multiplier;
33013          var offset = params.shadowOffset;
33014          $cubeShadowEl.transform("scale3d(" + scale1 + ", 1, " + scale2 + ") translate3d(0px, " + (swiperHeight / 2 + offset) + "px, " + -swiperHeight / 2 / scale2 + "px) rotateX(-90deg)");
33015        }
33016      }
33017
33018      var zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0;
33019      $wrapperEl.transform("translate3d(0px,0," + zFactor + "px) rotateX(" + (swiper.isHorizontal() ? 0 : wrapperRotate) + "deg) rotateY(" + (swiper.isHorizontal() ? -wrapperRotate : 0) + "deg)");
33020    },
33021    setTransition: function setTransition(duration) {
33022      var swiper = this;
33023      var $el = swiper.$el,
33024          slides = swiper.slides;
33025      slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
33026
33027      if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
33028        $el.find('.swiper-cube-shadow').transition(duration);
33029      }
33030    }
33031  };
33032  var EffectCube = {
33033    name: 'effect-cube',
33034    params: {
33035      cubeEffect: {
33036        slideShadows: true,
33037        shadow: true,
33038        shadowOffset: 20,
33039        shadowScale: 0.94
33040      }
33041    },
33042    create: function create() {
33043      var swiper = this;
33044      bindModuleMethods(swiper, {
33045        cubeEffect: _extends({}, Cube)
33046      });
33047    },
33048    on: {
33049      beforeInit: function beforeInit(swiper) {
33050        if (swiper.params.effect !== 'cube') return;
33051        swiper.classNames.push(swiper.params.containerModifierClass + "cube");
33052        swiper.classNames.push(swiper.params.containerModifierClass + "3d");
33053        var overwriteParams = {
33054          slidesPerView: 1,
33055          slidesPerColumn: 1,
33056          slidesPerGroup: 1,
33057          watchSlidesProgress: true,
33058          resistanceRatio: 0,
33059          spaceBetween: 0,
33060          centeredSlides: false,
33061          virtualTranslate: true
33062        };
33063        extend(swiper.params, overwriteParams);
33064        extend(swiper.originalParams, overwriteParams);
33065      },
33066      setTranslate: function setTranslate(swiper) {
33067        if (swiper.params.effect !== 'cube') return;
33068        swiper.cubeEffect.setTranslate();
33069      },
33070      setTransition: function setTransition(swiper, duration) {
33071        if (swiper.params.effect !== 'cube') return;
33072        swiper.cubeEffect.setTransition(duration);
33073      }
33074    }
33075  };
33076
33077  var Flip = {
33078    setTranslate: function setTranslate() {
33079      var swiper = this;
33080      var slides = swiper.slides,
33081          rtl = swiper.rtlTranslate;
33082
33083      for (var i = 0; i < slides.length; i += 1) {
33084        var $slideEl = slides.eq(i);
33085        var progress = $slideEl[0].progress;
33086
33087        if (swiper.params.flipEffect.limitRotation) {
33088          progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
33089        }
33090
33091        var offset = $slideEl[0].swiperSlideOffset;
33092        var rotate = -180 * progress;
33093        var rotateY = rotate;
33094        var rotateX = 0;
33095        var tx = -offset;
33096        var ty = 0;
33097
33098        if (!swiper.isHorizontal()) {
33099          ty = tx;
33100          tx = 0;
33101          rotateX = -rotateY;
33102          rotateY = 0;
33103        } else if (rtl) {
33104          rotateY = -rotateY;
33105        }
33106
33107        $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
33108
33109        if (swiper.params.flipEffect.slideShadows) {
33110          // Set shadows
33111          var shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
33112          var shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
33113
33114          if (shadowBefore.length === 0) {
33115            shadowBefore = $("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'left' : 'top') + "\"></div>");
33116            $slideEl.append(shadowBefore);
33117          }
33118
33119          if (shadowAfter.length === 0) {
33120            shadowAfter = $("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'right' : 'bottom') + "\"></div>");
33121            $slideEl.append(shadowAfter);
33122          }
33123
33124          if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
33125          if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
33126        }
33127
33128        $slideEl.transform("translate3d(" + tx + "px, " + ty + "px, 0px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg)");
33129      }
33130    },
33131    setTransition: function setTransition(duration) {
33132      var swiper = this;
33133      var slides = swiper.slides,
33134          activeIndex = swiper.activeIndex,
33135          $wrapperEl = swiper.$wrapperEl;
33136      slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
33137
33138      if (swiper.params.virtualTranslate && duration !== 0) {
33139        var eventTriggered = false; // eslint-disable-next-line
33140
33141        slides.eq(activeIndex).transitionEnd(function onTransitionEnd() {
33142          if (eventTriggered) return;
33143          if (!swiper || swiper.destroyed) return; // if (!$(this).hasClass(swiper.params.slideActiveClass)) return;
33144
33145          eventTriggered = true;
33146          swiper.animating = false;
33147          var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
33148
33149          for (var i = 0; i < triggerEvents.length; i += 1) {
33150            $wrapperEl.trigger(triggerEvents[i]);
33151          }
33152        });
33153      }
33154    }
33155  };
33156  var EffectFlip = {
33157    name: 'effect-flip',
33158    params: {
33159      flipEffect: {
33160        slideShadows: true,
33161        limitRotation: true
33162      }
33163    },
33164    create: function create() {
33165      var swiper = this;
33166      bindModuleMethods(swiper, {
33167        flipEffect: _extends({}, Flip)
33168      });
33169    },
33170    on: {
33171      beforeInit: function beforeInit(swiper) {
33172        if (swiper.params.effect !== 'flip') return;
33173        swiper.classNames.push(swiper.params.containerModifierClass + "flip");
33174        swiper.classNames.push(swiper.params.containerModifierClass + "3d");
33175        var overwriteParams = {
33176          slidesPerView: 1,
33177          slidesPerColumn: 1,
33178          slidesPerGroup: 1,
33179          watchSlidesProgress: true,
33180          spaceBetween: 0,
33181          virtualTranslate: true
33182        };
33183        extend(swiper.params, overwriteParams);
33184        extend(swiper.originalParams, overwriteParams);
33185      },
33186      setTranslate: function setTranslate(swiper) {
33187        if (swiper.params.effect !== 'flip') return;
33188        swiper.flipEffect.setTranslate();
33189      },
33190      setTransition: function setTransition(swiper, duration) {
33191        if (swiper.params.effect !== 'flip') return;
33192        swiper.flipEffect.setTransition(duration);
33193      }
33194    }
33195  };
33196
33197  var Coverflow = {
33198    setTranslate: function setTranslate() {
33199      var swiper = this;
33200      var swiperWidth = swiper.width,
33201          swiperHeight = swiper.height,
33202          slides = swiper.slides,
33203          slidesSizesGrid = swiper.slidesSizesGrid;
33204      var params = swiper.params.coverflowEffect;
33205      var isHorizontal = swiper.isHorizontal();
33206      var transform = swiper.translate;
33207      var center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;
33208      var rotate = isHorizontal ? params.rotate : -params.rotate;
33209      var translate = params.depth; // Each slide offset from center
33210
33211      for (var i = 0, length = slides.length; i < length; i += 1) {
33212        var $slideEl = slides.eq(i);
33213        var slideSize = slidesSizesGrid[i];
33214        var slideOffset = $slideEl[0].swiperSlideOffset;
33215        var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * params.modifier;
33216        var rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
33217        var rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0
33218
33219        var translateZ = -translate * Math.abs(offsetMultiplier);
33220        var stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders
33221
33222        if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {
33223          stretch = parseFloat(params.stretch) / 100 * slideSize;
33224        }
33225
33226        var translateY = isHorizontal ? 0 : stretch * offsetMultiplier;
33227        var translateX = isHorizontal ? stretch * offsetMultiplier : 0;
33228        var scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values
33229
33230        if (Math.abs(translateX) < 0.001) translateX = 0;
33231        if (Math.abs(translateY) < 0.001) translateY = 0;
33232        if (Math.abs(translateZ) < 0.001) translateZ = 0;
33233        if (Math.abs(rotateY) < 0.001) rotateY = 0;
33234        if (Math.abs(rotateX) < 0.001) rotateX = 0;
33235        if (Math.abs(scale) < 0.001) scale = 0;
33236        var slideTransform = "translate3d(" + translateX + "px," + translateY + "px," + translateZ + "px)  rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg) scale(" + scale + ")";
33237        $slideEl.transform(slideTransform);
33238        $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
33239
33240        if (params.slideShadows) {
33241          // Set shadows
33242          var $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
33243          var $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
33244
33245          if ($shadowBeforeEl.length === 0) {
33246            $shadowBeforeEl = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>");
33247            $slideEl.append($shadowBeforeEl);
33248          }
33249
33250          if ($shadowAfterEl.length === 0) {
33251            $shadowAfterEl = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>");
33252            $slideEl.append($shadowAfterEl);
33253          }
33254
33255          if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
33256          if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
33257        }
33258      }
33259    },
33260    setTransition: function setTransition(duration) {
33261      var swiper = this;
33262      swiper.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
33263    }
33264  };
33265  var EffectCoverflow = {
33266    name: 'effect-coverflow',
33267    params: {
33268      coverflowEffect: {
33269        rotate: 50,
33270        stretch: 0,
33271        depth: 100,
33272        scale: 1,
33273        modifier: 1,
33274        slideShadows: true
33275      }
33276    },
33277    create: function create() {
33278      var swiper = this;
33279      bindModuleMethods(swiper, {
33280        coverflowEffect: _extends({}
33280, Coverflow)
33281      });
33282    },
33283    on: {
33284      beforeInit: function beforeInit(swiper) {
33285        if (swiper.params.effect !== 'coverflow') return;
33286        swiper.classNames.push(swiper.params.containerModifierClass + "coverflow");
33287        swiper.classNames.push(swiper.params.containerModifierClass + "3d");
33288        swiper.params.watchSlidesProgress = true;
33289        swiper.originalParams.watchSlidesProgress = true;
33290      },
33291      setTranslate: function setTranslate(swiper) {
33292        if (swiper.params.effect !== 'coverflow') return;
33293        swiper.coverflowEffect.setTranslate();
33294      },
33295      setTransition: function setTransition(swiper, duration) {
33296        if (swiper.params.effect !== 'coverflow') return;
33297        swiper.coverflowEffect.setTransition(duration);
33298      }
33299    }
33300  };
33301
33302  var Thumbs = {
33303    init: function init() {
33304      var swiper = this;
33305      var thumbsParams = swiper.params.thumbs;
33306      if (swiper.thumbs.initialized) return false;
33307      swiper.thumbs.initialized = true;
33308      var SwiperClass = swiper.constructor;
33309
33310      if (thumbsParams.swiper instanceof SwiperClass) {
33311        swiper.thumbs.swiper = thumbsParams.swiper;
33312        extend(swiper.thumbs.swiper.originalParams, {
33313          watchSlidesProgress: true,
33314          slideToClickedSlide: false
33315        });
33316        extend(swiper.thumbs.swiper.params, {
33317          watchSlidesProgress: true,
33318          slideToClickedSlide: false
33319        });
33320      } else if (isObject(thumbsParams.swiper)) {
33321        swiper.thumbs.swiper = new SwiperClass(extend({}, thumbsParams.swiper, {
33322          watchSlidesVisibility: true,
33323          watchSlidesProgress: true,
33324          slideToClickedSlide: false
33325        }));
33326        swiper.thumbs.swiperCreated = true;
33327      }
33328
33329      swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass);
33330      swiper.thumbs.swiper.on('tap', swiper.thumbs.onThumbClick);
33331      return true;
33332    },
33333    onThumbClick: function onThumbClick() {
33334      var swiper = this;
33335      var thumbsSwiper = swiper.thumbs.swiper;
33336      if (!thumbsSwiper) return;
33337      var clickedIndex = thumbsSwiper.clickedIndex;
33338      var clickedSlide = thumbsSwiper.clickedSlide;
33339      if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return;
33340      if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
33341      var slideToIndex;
33342
33343      if (thumbsSwiper.params.loop) {
33344        slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10);
33345      } else {
33346        slideToIndex = clickedIndex;
33347      }
33348
33349      if (swiper.params.loop) {
33350        var currentIndex = swiper.activeIndex;
33351
33352        if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) {
33353          swiper.loopFix(); // eslint-disable-next-line
33354
33355          swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
33356          currentIndex = swiper.activeIndex;
33357        }
33358
33359        var prevIndex = swiper.slides.eq(currentIndex).prevAll("[data-swiper-slide-index=\"" + slideToIndex + "\"]").eq(0).index();
33360        var nextIndex = swiper.slides.eq(currentIndex).nextAll("[data-swiper-slide-index=\"" + slideToIndex + "\"]").eq(0).index();
33361        if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex;
33362      }
33363
33364      swiper.slideTo(slideToIndex);
33365    },
33366    update: function update(initial) {
33367      var swiper = this;
33368      var thumbsSwiper = swiper.thumbs.swiper;
33369      if (!thumbsSwiper) return;
33370      var slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;
33371      var autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
33372      var useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
33373
33374      if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
33375        var currentThumbsIndex = thumbsSwiper.activeIndex;
33376        var newThumbsIndex;
33377        var direction;
33378
33379        if (thumbsSwiper.params.loop) {
33380          if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) {
33381            thumbsSwiper.loopFix(); // eslint-disable-next-line
33382
33383            thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft;
33384            currentThumbsIndex = thumbsSwiper.activeIndex;
33385          } // Find actual thumbs index to slide to
33386
33387
33388          var prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll("[data-swiper-slide-index=\"" + swiper.realIndex + "\"]").eq(0).index();
33389          var nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll("[data-swiper-slide-index=\"" + swiper.realIndex + "\"]").eq(0).index();
33390
33391          if (typeof prevThumbsIndex === 'undefined') {
33392            newThumbsIndex = nextThumbsIndex;
33393          } else if (typeof nextThumbsIndex === 'undefined') {
33394            newThumbsIndex = prevThumbsIndex;
33395          } else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) {
33396            newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex;
33397          } else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) {
33398            newThumbsIndex = nextThumbsIndex;
33399          } else {
33400            newThumbsIndex = prevThumbsIndex;
33401          }
33402
33403          direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
33404        } else {
33405          newThumbsIndex = swiper.realIndex;
33406          direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
33407        }
33408
33409        if (useOffset) {
33410          newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
33411        }
33412
33413        if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
33414          if (thumbsSwiper.params.centeredSlides) {
33415            if (newThumbsIndex > currentThumbsIndex) {
33416              newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
33417            } else {
33418              newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
33419            }
33420          } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ;
33421
33422          thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
33423        }
33424      } // Activate thumbs
33425
33426
33427      var thumbsToActivate = 1;
33428      var thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
33429
33430      if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
33431        thumbsToActivate = swiper.params.slidesPerView;
33432      }
33433
33434      if (!swiper.params.thumbs.multipleActiveThumbs) {
33435        thumbsToActivate = 1;
33436      }
33437
33438      thumbsToActivate = Math.floor(thumbsToActivate);
33439      thumbsSwiper.slides.removeClass(thumbActiveClass);
33440
33441      if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
33442        for (var i = 0; i < thumbsToActivate; i += 1) {
33443          thumbsSwiper.$wrapperEl.children("[data-swiper-slide-index=\"" + (swiper.realIndex + i) + "\"]").addClass(thumbActiveClass);
33444        }
33445      } else {
33446        for (var _i = 0; _i < thumbsToActivate; _i += 1) {
33447          thumbsSwiper.slides.eq(swiper.realIndex + _i).addClass(thumbActiveClass);
33448        }
33449      }
33450    }
33451  };
33452  var Thumbs$1 = {
33453    name: 'thumbs',
33454    params: {
33455      thumbs: {
33456        swiper: null,
33457        multipleActiveThumbs: true,
33458        autoScrollOffset: 0,
33459        slideThumbActiveClass: 'swiper-slide-thumb-active',
33460        thumbsContainerClass: 'swiper-container-thumbs'
33461      }
33462    },
33463    create: function create() {
33464      var swiper = this;
33465      bindModuleMethods(swiper, {
33466        thumbs: _extends({
33467          swiper: null,
33468          initialized: false
33469        }, Thumbs)
33470      });
33471    },
33472    on: {
33473      beforeInit: function beforeInit(swiper) {
33474        var thumbs = swiper.params.thumbs;
33475        if (!thumbs || !thumbs.swiper) return;
33476        swiper.thumbs.init();
33477        swiper.thumbs.update(true);
33478      },
33479      slideChange: function slideChange(swiper) {
33480        if (!swiper.thumbs.swiper) return;
33481        swiper.thumbs.update();
33482      },
33483      update: function update(swiper) {
33484        if (!swiper.thumbs.swiper) return;
33485        swiper.thumbs.update();
33486      },
33487      resize: function resize(swiper) {
33488        if (!swiper.thumbs.swiper) return;
33489        swiper.thumbs.update();
33490      },
33491      observerUpdate: function observerUpdate(swiper) {
33492        if (!swiper.thumbs.swiper) return;
33493        swiper.thumbs.update();
33494      },
33495      setTransition: function setTransition(swiper, duration) {
33496        var thumbsSwiper = swiper.thumbs.swiper;
33497        if (!thumbsSwiper) return;
33498        thumbsSwiper.setTransition(duration);
33499      },
33500      beforeDestroy: function beforeDestroy(swiper) {
33501        var thumbsSwiper = swiper.thumbs.swiper;
33502        if (!thumbsSwiper) return;
33503
33504        if (swiper.thumbs.swiperCreated && thumbsSwiper) {
33505          thumbsSwiper.destroy();
33506        }
33507      }
33508    }
33509  };
33510
33511  // Swiper Class
33512  var components = [Virtual$1, Keyboard$1, Mousewheel$1, Navigation$1, Pagination$1, Scrollbar$1, Parallax$1, Zoom$1, Lazy$1, Controller$1, A11y$1, History$1, HashNavigation$1, Autoplay$1, EffectFade, EffectCube, EffectFlip, EffectCoverflow, Thumbs$1];
33513  Swiper.use(components);
33514
33515  return Swiper;
33516
33517})));
33518
33519/* End */
33520;
33521; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max/js/jQuery.Brazzers-Carousel.js?1666017593926";s:6:"source";s:57:"/local/templates/aspro_max/js/jQuery.Brazzers-Carousel.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
33522/*!
33523 * jQuery Brazzers Carousel v1.0.0 (http://webdesign-master.ru)
33524 * Copyright 2015 WebDesign Master.
33525 */
33526 (function($) {
33527
33528 	$.fn.brazzersCarousel = function() {
33529
33530 		return this.addClass("brazzers-daddy").append("<div class='tmb-wrap'><div class='tmb-wrap-table'>").append("<div class='image-wrap'>").each(function() {
33531 			var this_wrapper = $(this);
33532 			this_wrapper.find("img").appendTo(this_wrapper.find(".image-wrap")).each(function() {
33533 				this_wrapper.find(".tmb-wrap-table").append("<div>");
33534 			});
33535 		}).find(".tmb-wrap-table div").hover(function() {
33536 			var this_img = $(this).parent(".tmb-wrap-table").closest(".brazzers-daddy").find("img");
33537 			var all_thmbs = $(this).parent(".tmb-wrap-table").find("div");
33538 			this_img.hide().eq($(this).index()).css("display", "block");
33539 			all_thmbs.removeClass("active");
33540 			$(this).addClass("active");
33541 		}).parent().find(":first").addClass("active");
33542
33543 	};
33544
33545 })(jQuery);
33546/* End */
33547;
33548; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/aspro_max/js/main-custom.js?170608091114122";s:6:"source";s:44:"/local/templates/aspro_max/js/main-custom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
33549'use strict'
33550$(document).ready(function () {
33551  let headerStockSlider = new Swiper('.header-stock .swiper-container', {
33552    slidesPerView: 'auto',
33553    watchSlidesProgress: true,
33554    watchSlidesVisibility: true,
33555    watchOverflow: true,
33556  })
33557
33558  let sectionsLinksSlider = new Swiper('.sections-links__slider', {
33559    slidesPerView: 'auto',
33560    spaceBetween: 8,
33561    slidesPerColumn: 2,
33562    breakpoints: {
33563      640: {
33564        slidesPerView: 4,
33565      },
33566      1150: {
33567        slidesPerView: 5,
33568        spaceBetween: 32,
33569      },
33570    },
33571  });
33572
33573  let mainSlider = new Swiper('.main-slider .swiper-container', {
33574    slidesPerView: 1,
33575    pagination: {
33576      el: '.main-slider .swiper-pagination',
33577      type: "fraction",
33578    },
33579    autoplay: {
33580      delay: 5000,
33581    },
33582    navigation: {
33583      nextEl: '.main-slider .toggle-next',
33584      prevEl: '.main-slider .toggle-prev',
33585    },
33586  });
33587
33588  let bestsellerSlider = new Swiper('.bestseller-banner .swiper-container', {
33589    slidesPerView: 1,
33590    pagination: {
33591      el: '.bestseller-banner .swiper-pagination',
33592      type: "fraction",
33593    },
33594    navigation: {
33595      nextEl: '.bestseller-banner .toggle-next',
33596      prevEl: '.bestseller-banner .toggle-prev',
33597    },
33598    on: {
33599      init: function () {
33600        let sliderToggle = document.querySelectorAll('.bestseller-banner .desktop-toggle')
33601        sliderToggle.forEach(function (item) {
33602          item.addEventListener('click', function (elem) {
33603            let toggle = elem.target.closest('.desktop-toggle')
33604            if (toggle.classList.contains('toggle-next')) {
33605              bestsellerSlider.slideNext()
33606            } else {
33607              bestsellerSlider.slidePrev()
33608            }
33609          })
33610        })
33611      },
33612    },
33613  });
33614
33615
33616  let productSlider = new Swiper('.product-slider .swiper-container', {
33617    slidesPerView: 1,
33618    pagination: {
33619      el: '.product-slider .swiper-pagination',
33620      type: "fraction",
33621    },
33622    navigation: {
33623      nextEl: '.product-slider .toggle-next',
33624      prevEl: '.product-slider .toggle-prev',
33625    },
33626  });
33627
33628  let productsSliderArr = document.querySelectorAll('.products-slider');
33629  productsSliderArr.forEach(function (item) {
33630    let productsSlider = new Swiper(item.querySelector('.swiper-container'), {
33631      slidesPerView: 'auto',
33632      spaceBetween: 8,
33633      simulateTouch: false,
33634      navigation: {
33635        nextEl: item.querySelector('.toggle-next'),
33636        prevEl: item.querySelector('.toggle-prev'),
33637      },
33638      breakpoints: {
33639        601: {
33640          slidesPerView: 2,
33641          spaceBetween: 16,
33642        },
33643        768: {
33644          slidesPerView: 3,
33645          spaceBetween: 32,
33646        },
33647        1150: {
33648          slidesPerView: 4,
33649          spaceBetween: 32,
33650        },
33651      },
33652    });
33653  })
33654
33655  let reviewsInstaSlider = new Swiper('.reviews-insta .swiper-container', {
33656    slidesPerView: 'auto',
33657    spaceBetween: 8,
33658    breakpoints: {
33659      640: {
33660        slidesPerView: 3,
33661        spaceBetween: 16,
33662      },
33663      992: {
33664        slidesPerView: 4,
33665        spaceBetween: 32,
33666      },
33667    },
33668  });
33669
33670  let lineMonthSlider = new Swiper('.line-month__cards-slider .swiper-container', {
33671    slidesPerView: 1,
33672    spaceBetween: 16,
33673    loop: true,
33674    autoplay: {
33675      delay: 2000,
33676    },
33677    breakpoints: {
33678      992: {
33679        slidesPerView: 2,
33680        spaceBetween: 32,
33681      },
33682    },
33683  });
33684
33685  let mobileSectionsSlider = new Swiper('.mobile-sections .swiper-container', {
33686    slidesPerView: 'auto',
33687    spaceBetween: 32,
33688  });
33689
33690  $(".custom-product-item__img-wrapper").brazzersCarousel();
33691
33692  // возврат  к 1 изображению галереи в маленькой карточке товара
33693  $(".custom-product-item__img-wrapper").on('mouseleave', function (){
33694    let this_img = $(this).find("img");
33695    let all_thmbs = $(this).find(".tmb-wrap-table").find("div");
33696    this_img.hide().eq($(this).index()).css("display", "block");
33697    all_thmbs.removeClass("active").first().addClass("active");
33698  });
33699
33700  if ($('.video-block__wrapper').is('div')) {
33701    function playVideo() {
33702      let video = $('.video-block__video');
33703      let positionVideo = video.offset().top
33704      let height = $(video).height();
33705      $(window).scroll(function () {
33706        let positionScroll = $(window).scrollTop();
33707        if (positionScroll > positionVideo - height) {
33708          video[0].play()
33709        }
33710      })
33711    }
33712
33713    playVideo()
33714  }
33715
33716
33717  let productDetailsSliderThumbs = new Swiper('.product-details-slider--page .product-details-slider__thumbs .swiper-container',
33718      {
33719        slidesPerView: 4,
33720        spaceBetween: 10,
33721        freeMode: false,
33722        watchSlidesProgress: true,
33723        watchSlidesVisibility: true,
33724        watchOverflow: true,
33725        breakpointsInverse: true,
33726        mousewheel: {
33727          releaseOnEdges: true,
33728        },
33729        breakpoints: {
33730          0: {
33731            slidesPerView: 4,
33732          },
33733          992: {
33734            spaceBetween: 16,
33735            slidesPerView: 4,
33736            direction: "vertical",
33737            // autoHeight: true,
33738          },
33739        },
33740      }
33741  )
33742
33743  let productDetailsSlider = new Swiper('.product-details-slider--page .product-details-slider__wrapper .swiper-container', {
33744    slidesPerView: 1,
33745    mousewheel: {
33746      releaseOnEdges: true,
33747    },
33748    thumbs: {
33749      swiper: productDetailsSliderThumbs,
33750    }
33751  });
33752
33753
33754  function runSliderInPopupGallery(activeSlide) {
33755    let productDetailsSliderPopupThumbs = new Swiper('.product-details-slider--popup .product-details-slider__thumbs .swiper-container',
33756        {
33757          slidesPerView: 4,
33758          spaceBetween: 10,
33759          freeMode: false,
33760          watchSlidesProgress: true,
33761          watchSlidesVisibility: true,
33762          watchOverflow: true,
33763          breakpointsInverse: true,
33764          initialSlide: activeSlide,
33765          mousewheel: {
33766            releaseOnEdges: true,
33767          },
33768          breakpoints: {
33769            0: {
33770              slidesPerView: 4,
33771            },
33772            992: {
33773              spaceBetween: 16,
33774              slidesPerView: 5,
33775              direction: "vertical",
33776              // autoHeight: true,
33777            },
33778          },
33779        }
33780    )
33781
33782    let productDetailsSliderPopup = new Swiper('.product-details-slider--popup .product-details-slider__wrapper .swiper-container', {
33783      slidesPerView: 1,
33784      initialSlide: activeSlide,
33785      mousewheel: {
33786        releaseOnEdges: true,
33787      },
33788      navigation: {
33789        nextEl: '.product-details-slider--popup .toggle-next',
33790        prevEl: '.product-details-slider--popup .toggle-prev',
33791      },
33792      thumbs: {
33793        swiper: productDetailsSliderPopupThumbs,
33794      }
33795    });
33796  }
33797
33798
33799  $('.product-details-slider--page .product-details-slider__wrapper .swiper-wrapper').on('click', function (e) {
33800    e.preventDefault()
33801    let slideList = $(this).find('.swiper-slide')
33802    let activeElementIndex
33803    $.each(slideList, function (i, value) {
33804      if (value.classList.contains('swiper-slide-active')) {
33805        activeElementIndex = i
33806      }
33807    })
33808    $.magnificPopup.open({
33809      items: {src: '.gallery-popup'},
33810      type: 'inline',
33811      fixedContentPos: true,
33812      fixedBgPos: true,
33813      preloader: false,
33814      midClick: true,
33815      removalDelay: 300,
33816      mainClass: 'popup-gallery',
33817      callbacks: {
33818        open: function () {
33819          runSliderInPopupGallery(activeElementIndex)
33820        },
33821      },
33822    })
33823  })
33824
33825
33826  $('.custom-accordion__head').on('click', function () {
33827    let accordionContainer = $(this).closest('.custom-accordion');
33828    if (!accordionContainer.hasClass('open')) {
33829      let accordions = $('.custom-accordion');
33830      accordions.find('.custom-accordion__body').slideUp()
33831      accordions.removeClass('open');
33832    }
33833    accordionContainer.toggleClass('open')
33834    accordionContainer.find('.custom-accordion__body').slideToggle()
33835  })
33836
33837
33838  const selects = $('.custom-select').select2({
33839    minimumResultsForSearch: -1,
33840    dropdownCssClass: "custom-select"
33841  });
33842
33843  $('.custom-product-item').mouseenter(function (){
33844    if(!$('.custom-product-item.open').length == 1){
33845      $(this).addClass('open')
33846    }
33847  })
33848  $('.custom-product-item').mouseleave(function (evt){
33849    if (!evt.target.classList.contains ('select2-selection')){
33850      $(this).removeClass('open')
33851      selects.select2('close')
33852    }
33853  })
33854
33855  $('.custom-select').on('select2:open', function () {
33856    $(this).closest('.custom-product-item').addClass('open')
33857  })
33858
33859  $('.quantity div').click(function(){
33860    var idd = $(this).siblings('input').attr('id');
33861    var ths = $(this);
33862    setTimeout(function()
33863    {
33864      if(idd != 'quantity'){
33865        var input = ths.siblings('input'),
33866            val = input.val();
33867        ths.parent().parent().siblings('button').attr({
33868          'data-quantity': val,
33869        });
33870      }
33871    }, 50);
33872  });
33873
33874  jQuery('.popup-with-move-anim').magnificPopup({
33875    type: 'inline',
33876    fixedContentPos: true,
33877    fixedBgPos: true,
33878    preloader: false,
33879    midClick: true,
33880    removalDelay: 300,
33881    // mainClass: 'mp-popup-block',
33882  })
33883
33884
33885  $('.aside-filter-item__toggle').on('click', function () {
33886    let container = $(this).closest('.aside-filter-item')
33887    container.find('.aside-filter-item__body').slideToggle()
33888    container.toggleClass('open')
33889  })
33890
33891  $('.select--sort').select2({
33892    minimumResultsForSearch: -1,
33893    dropdownCssClass: "select--sort",
33894    selectionCssClass: "select--sort-selected"
33895  })
33896
33897  $('.select--sort').on('select2:open', function () {
33898    setTimeout(function () {
33899      $('.select--sort .select2-results__options').mCustomScrollbar();
33900    }, 100);
33901  })
33902
33903  $('.select--sort').on('select2:closing', function () {
33904    $('.select--sort .select2-results__options').mCustomScrollbar("destroy");
33905  })
33906
33907  $('.aside-filter__toggle').on('click', function () {
33908    let container = $(this).closest('.aside-filter')
33909    let body = container.find('.aside-filter__body')
33910    if (body.is(':visible')) {
33911      body.slideUp()
33912      container.addClass('closed')
33913    } else {
33914      body.slideDown()
33915      container.removeClass('closed')
33916    }
33917  })
33918
33919  function checkCatalogCheckbox() {
33920    let filterList = $('.catalog-filter-dropdown__body');
33921    filterList.each(function (index, value) {
33922      if ($(this).find('.custom-checkbox__input').is(':checked')) {
33923        $(this).closest('.catalog-filter-dropdown').addClass('checked')
33924      } else {
33925        $(this).closest('.catalog-filter-dropdown').removeClass('checked')
33926      }
33927    })
33928  }
33929
33930  checkCatalogCheckbox()
33931
33932
33933  $('.catalog-filter-dropdown__head').on('click', function (evt) {
33934    let container = $(this).closest('.catalog-filter-dropdown');
33935    let body = container.find('.catalog-filter-dropdown__body');
33936    let openDropdown = $('.catalog-filter-dropdown.open');
33937    if (evt.target.classList.contains('icon-close')) {
33938      return false
33939    } else if (body.is(':visible')) {
33940      body.slideUp()
33941      container.removeClass('open')
33942    } else {
33943      openDropdown.each(function (index, value) {
33944        $(this).removeClass('open').find('.catalog-filter-dropdown__body').slideUp()
33945      })
33946      body.slideDown()
33947      container.addClass('open')
33948    }
33949    checkCatalogCheckbox()
33950  })
33951
33952
33953  $('.catalog-top-filters__reset-filter').on('click', function () {
33954    let filterList = $('.catalog-filter-dropdown__body');
33955    filterList.each(function (index, value) {
33956      if ($(this).find('.custom-checkbox__input').is(':checked')) {
33957        $(this).find('.custom-checkbox__input').prop('checked', false)
33958      }
33959    })
33960    checkCatalogCheckbox()
33961  })
33962
33963  $('.catalog-filter-dropdown__head .icon-close').on('click', function (e) {
33964    e.preventDefault()
33965    let filterList = $(this).closest('.catalog-filter-dropdown');
33966    filterList.each(function (index, value) {
33967      if ($(this).find('.custom-checkbox__input').is(':checked')) {
33968        $(this).find('.custom-checkbox__input').prop('checked', false)
33969      }
33970    })
33971    checkCatalogCheckbox()
33972  })
33973
33974  $('.catalog-top-filters__filter-toggle, .close-filter').on('click', function () {
33975    $('.catalog-top-filters__list').toggleClass('catalog-top-filters__list--show')
33976  })
33977
33978  $('.custom-scroll').mCustomScrollbar();
33979
33980  $('.custom-product-item__add-basket').on('click', function (){
33981    if($(window).width() < 750){
33982      $(this).closest('.custom-product-item').toggleClass('custom-product-item--show')
33983    } else{
33984      $(this).text('в корзине')
33985    }
33986  })
33987
33988  // $('.products-slider.slick .products-slider__slider-list').slick({
33989  //   infinite: true,
33990  //   slidesToShow: 4,
33991  //   adaptiveHeight: true,
33992  //   slidesToScroll: 1,
33993  //   prevArrow: $('.products-slider.slick .toggle-prev'),
33994  //   nextArrow: $('.products-slider.slick .toggle-next'),
33995  // });
33996
33997
33998  $('.product-details-slider__sticker-gift').on('click', function (){
33999    $('.gift-popup').slideToggle()
34000  })
34001
34002  $('.gift-popup__close').on('click', function (){
34003    $('.gift-popup').slideUp()
34004  })
34005
34006  // анимация плавного скролла
34007  function animateScroll(positionToScroll, delay) {
34008    jQuery('html, body').animate(
34009        {
34010          scrollTop: positionToScroll,
34011        },
34012        delay
34013    )
34014  }
34015
34016  // Плавыйн сколл на якорь
34017  jQuery('.animate-scroll').click(function (e) {
34018    e.preventDefault()
34019    var elementClick = jQuery(this).attr('href')
34020    var destination = jQuery(elementClick).offset().top - 60
34021    animateScroll(destination, 600)
34022    return false
34023  })
34024
34025  // показать/скрыть текст в отзыве
34026  $(document).on('click', '.review__show-all-text', function (e){
34027    let buttonReedMore = $(this)
34028    let textContainer= $(this).closest('.review__body').find('.review__text-wrapper')
34029
34030    textContainer.toggleClass('review__text-wrapper--show')
34031    if (textContainer.hasClass('review__text-wrapper--show')) {
34032      buttonReedMore.text('Свернуть')
34033    } else {
34034      buttonReedMore.text('Развернуть')
34035    }
34036  })
34037
34038  // событие на закррытие попапа крестиком или кнопкой с классом .hide-popup
34039  jQuery(document).on('click','.hide-popup ', function (e) {
34040    e.preventDefault()
34041    $.magnificPopup.close()
34042  })
34043});
34044/* End */
34045;
34046; /* Start:"a:4:{s:4:"full";s:70:"/local/templates/aspro_max/js/jquery.magnific-popup.js?166601759341730";s:6:"source";s:54:"/local/templates/aspro_max/js/jquery.magnific-popup.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
34047/*! Magnific Popup - v1.1.0 - 2016-02-20
vendor: 27,164 bytes, lines 34048-35270
34048* http://dimsemenov.com/plugins/magnific-popup/
34049* Copyright (c) 2016 Dmitry Semenov; */
34050;(function (factory) { 
34051if (typeof define === 'function' && define.amd) { 
34052 // AMD. Register as an anonymous module. 
34053 define(['jquery'], factory); 
34054 } else if (typeof exports === 'object') { 
34055 // Node/CommonJS 
34056 factory(require('jquery')); 
34057 } else { 
34058 // Browser globals 
34059 factory(window.jQuery || window.Zepto); 
34060 } 
34061 }(function($) { 
34062
34063/*>>core*/
34064/**
34065 * 
34066 * Magnific Popup Core JS file
34067 * 
34068 */
34069
34070
34071/**
34072 * Private static constants
34073 */
34074var CLOSE_EVENT = 'Close',
34075	BEFORE_CLOSE_EVENT = 'BeforeClose',
34076	AFTER_CLOSE_EVENT = 'AfterClose',
34077	BEFORE_APPEND_EVENT = 'BeforeAppend',
34078	MARKUP_PARSE_EVENT = 'MarkupParse',
34079	OPEN_EVENT = 'Open',
34080	CHANGE_EVENT = 'Change',
34081	NS = 'mfp',
34082	EVENT_NS = '.' + NS,
34083	READY_CLASS = 'mfp-ready',
34084	REMOVING_CLASS = 'mfp-removing',
34085	PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
34086
34087
34088/**
34089 * Private vars 
34090 */
34091/*jshint -W079 */
34092var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
34093	MagnificPopup = function(){},
34094	_isJQ = !!(window.jQuery),
34095	_prevStatus,
34096	_window = $(window),
34097	_document,
34098	_prevContentType,
34099	_wrapClasses,
34100	_currPopupType;
34101
34102
34103/**
34104 * Private functions
34105 */
34106var _mfpOn = function(name, f) {
34107		mfp.ev.on(NS + name + EVENT_NS, f);
34108	},
34109	_getEl = function(className, appendTo, html, raw) {
34110		var el = document.createElement('div');
34111		el.className = 'mfp-'+className;
34112		if(html) {
34113			el.innerHTML = html;
34114		}
34115		if(!raw) {
34116			el = $(el);
34117			if(appendTo) {
34118				el.appendTo(appendTo);
34119			}
34120		} else if(appendTo) {
34121			appendTo.appendChild(el);
34122		}
34123		return el;
34124	},
34125	_mfpTrigger = function(e, data) {
34126		mfp.ev.triggerHandler(NS + e, data);
34127
34128		if(mfp.st.callbacks) {
34129			// converts "mfpEventName" to "eventName" callback and triggers it if it's present
34130			e = e.charAt(0).toLowerCase() + e.slice(1);
34131			if(mfp.st.callbacks[e]) {
34132				mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
34133			}
34134		}
34135	},
34136	_getCloseBtn = function(type) {
34137		if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
34138			mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
34139			_currPopupType = type;
34140		}
34141		return mfp.currTemplate.closeBtn;
34142	},
34143	// Initialize Magnific Popup only when called at least once
34144	_checkInstance = function() {
34145		if(!$.magnificPopup.instance) {
34146			/*jshint -W020 */
34147			mfp = new MagnificPopup();
34148			mfp.init();
34149			$.magnificPopup.instance = mfp;
34150		}
34151	},
34152	// CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
34153	supportsTransitions = function() {
34154		var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
34155			v = ['ms','O','Moz','Webkit']; // 'v' for vendor
34156
34157		if( s['transition'] !== undefined ) {
34158			return true; 
34159		}
34160			
34161		while( v.length ) {
34162			if( v.pop() + 'Transition' in s ) {
34163				return true;
34164			}
34165		}
34166				
34167		return false;
34168	};
34169
34170
34171
34172/**
34173 * Public functions
34174 */
34175MagnificPopup.prototype = {
34176
34177	constructor: MagnificPopup,
34178
34179	/**
34180	 * Initializes Magnific Popup plugin. 
34181	 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
34182	 */
34183	init: function() {
34184		var appVersion = navigator.appVersion;
34185		mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener;
34186		mfp.isAndroid = (/android/gi).test(appVersion);
34187		mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
34188		mfp.supportsTransition = supportsTransitions();
34189
34190		// We disable fixed positioned lightbox on devices that don't handle it nicely.
34191		// If you know a better way of detecting this - let me know.
34192		mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
34193		_document = $(document);
34194
34195		mfp.popupsCache = {};
34196	},
34197
34198	/**
34199	 * Opens popup
34200	 * @param  data [description]
34201	 */
34202	open: function(data) {
34203
34204		var i;
34205
34206		if(data.isObj === false) { 
34207			// convert jQuery collection to array to avoid conflicts later
34208			mfp.items = data.items.toArray();
34209
34210			mfp.index = 0;
34211			var items = data.items,
34212				item;
34213			for(i = 0; i < items.length; i++) {
34214				item = items[i];
34215				if(item.parsed) {
34216					item = item.el[0];
34217				}
34218				if(item === data.el[0]) {
34219					mfp.index = i;
34220					break;
34221				}
34222			}
34223		} else {
34224			mfp.items = $.isArray(data.items) ? data.items : [data.items];
34225			mfp.index = data.index || 0;
34226		}
34227
34228		// if popup is already opened - we just update the content
34229		if(mfp.isOpen) {
34230			mfp.updateItemHTML();
34231			return;
34232		}
34233		
34234		mfp.types = []; 
34235		_wrapClasses = '';
34236		if(data.mainEl && data.mainEl.length) {
34237			mfp.ev = data.mainEl.eq(0);
34238		} else {
34239			mfp.ev = _document;
34240		}
34241
34242		if(data.key) {
34243			if(!mfp.popupsCache[data.key]) {
34244				mfp.popupsCache[data.key] = {};
34245			}
34246			mfp.currTemplate = mfp.popupsCache[data.key];
34247		} else {
34248			mfp.currTemplate = {};
34249		}
34250
34251
34252
34253		mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 
34254		mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
34255
34256		if(mfp.st.modal) {
34257			mfp.st.closeOnContentClick = false;
34258			mfp.st.closeOnBgClick = false;
34259			mfp.st.showCloseBtn = false;
34260			mfp.st.enableEscapeKey = false;
34261		}
34262		
34263
34264		// Building markup
34265		// main containers are created only once
34266		if(!mfp.bgOverlay) {
34267
34268			// Dark overlay
34269			mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
34270				mfp.close();
34271			});
34272
34273			mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
34274				if(mfp._checkIfClose(e.target)) {
34275					mfp.close();
34276				}
34277			});
34278
34279			mfp.container = _getEl('container', mfp.wrap);
34280		}
34281
34282		mfp.contentContainer = _getEl('content');
34283		if(mfp.st.preloader) {
34284			mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
34285		}
34286
34287
34288		// Initializing modules
34289		var modules = $.magnificPopup.modules;
34290		for(i = 0; i < modules.length; i++) {
34291			var n = modules[i];
34292			n = n.charAt(0).toUpperCase() + n.slice(1);
34293			mfp['init'+n].call(mfp);
34294		}
34295		_mfpTrigger('BeforeOpen');
34296
34297
34298		if(mfp.st.showCloseBtn) {
34299			// Close button
34300			if(!mfp.st.closeBtnInside) {
34301				mfp.wrap.append( _getCloseBtn() );
34302			} else {
34303				_mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
34304					values.close_replaceWith = _getCloseBtn(item.type);
34305				});
34306				_wrapClasses += ' mfp-close-btn-in';
34307			}
34308		}
34309
34310		if(mfp.st.alignTop) {
34311			_wrapClasses += ' mfp-align-top';
34312		}
34313
34314	
34315
34316		if(mfp.fixedContentPos) {
34317			mfp.wrap.css({
34318				overflow: mfp.st.overflowY,
34319				overflowX: 'hidden',
34320				overflowY: mfp.st.overflowY
34321			});
34322		} else {
34323			mfp.wrap.css({ 
34324				top: _window.scrollTop(),
34325				position: 'absolute'
34326			});
34327		}
34328		if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
34329			mfp.bgOverlay.css({
34330				height: _document.height(),
34331				position: 'absolute'
34332			});
34333		}
34334
34335		
34336
34337		if(mfp.st.enableEscapeKey) {
34338			// Close on ESC key
34339			_document.on('keyup' + EVENT_NS, function(e) {
34340				if(e.keyCode === 27) {
34341					mfp.close();
34342				}
34343			});
34344		}
34345
34346		_window.on('resize' + EVENT_NS, function() {
34347			mfp.updateSize();
34348		});
34349
34350
34351		if(!mfp.st.closeOnContentClick) {
34352			_wrapClasses += ' mfp-auto-cursor';
34353		}
34354		
34355		if(_wrapClasses)
34356			mfp.wrap.addClass(_wrapClasses);
34357
34358
34359		// this triggers recalculation of layout, so we get it once to not to trigger twice
34360		var windowHeight = mfp.wH = _window.height();
34361
34362		
34363		var windowStyles = {};
34364
34365		if( mfp.fixedContentPos ) {
34366            if(mfp._hasScrollBar(windowHeight)){
34367                var s = mfp._getScrollbarSize();
34368                if(s) {
34369                    windowStyles.marginRight = s;
34370                }
34371            }
34372        }
34373
34374		if(mfp.fixedContentPos) {
34375			if(!mfp.isIE7) {
34376				windowStyles.overflow = 'hidden';
34377			} else {
34378				// ie7 double-scroll bug
34379				$('body, html').css('overflow', 'hidden');
34380			}
34381		}
34382
34383		
34384		
34385		var classesToadd = mfp.st.mainClass;
34386		if(mfp.isIE7) {
34387			classesToadd += ' mfp-ie7';
34388		}
34389		if(classesToadd) {
34390			mfp._addClassToMFP( classesToadd );
34391		}
34392
34393		// add content
34394		mfp.updateItemHTML();
34395
34396		_mfpTrigger('BuildControls');
34397
34398		// remove scrollbar, add margin e.t.c
34399		$('html').css(windowStyles);
34400		
34401		// add everything to DOM
34402		mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) );
34403
34404		// Save last focused element
34405		mfp._lastFocusedEl = document.activeElement;
34406		
34407		// Wait for next cycle to allow CSS transition
34408		setTimeout(function() {
34409			
34410			if(mfp.content) {
34411				mfp._addClassToMFP(READY_CLASS);
34412				mfp._setFocus();
34413			} else {
34414				// if content is not defined (not loaded e.t.c) we add class only for BG
34415				mfp.bgOverlay.addClass(READY_CLASS);
34416			}
34417			
34418			// Trap the focus in popup
34419			_document.on('focusin' + EVENT_NS, mfp._onFocusIn);
34420
34421		}, 16);
34422
34423		mfp.isOpen = true;
34424		mfp.updateSize(windowHeight);
34425		_mfpTrigger(OPEN_EVENT);
34426
34427		return data;
34428	},
34429
34430	/**
34431	 * Closes the popup
34432	 */
34433	close: function() {
34434		if(!mfp.isOpen) return;
34435		_mfpTrigger(BEFORE_CLOSE_EVENT);
34436
34437		mfp.isOpen = false;
34438		// for CSS3 animation
34439		if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition )  {
34440			mfp._addClassToMFP(REMOVING_CLASS);
34441			setTimeout(function() {
34442				mfp._close();
34443			}, mfp.st.removalDelay);
34444		} else {
34445			mfp._close();
34446		}
34447	},
34448
34449	/**
34450	 * Helper for close() function
34451	 */
34452	_close: function() {
34453		_mfpTrigger(CLOSE_EVENT);
34454
34455		var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
34456
34457		mfp.bgOverlay.detach();
34458		mfp.wrap.detach();
34459		mfp.container.empty();
34460
34461		if(mfp.st.mainClass) {
34462			classesToRemove += mfp.st.mainClass + ' ';
34463		}
34464
34465		mfp._removeClassFromMFP(classesToRemove);
34466
34467		if(mfp.fixedContentPos) {
34468			var windowStyles = {marginRight: ''};
34469			if(mfp.isIE7) {
34470				$('body, html').css('overflow', '');
34471			} else {
34472				windowStyles.overflow = '';
34473			}
34474			$('html').css(windowStyles);
34475		}
34476		
34477		_document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
34478		mfp.ev.off(EVENT_NS);
34479
34480		// clean up DOM elements that aren't removed
34481		mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
34482		mfp.bgOverlay.attr('class', 'mfp-bg');
34483		mfp.container.attr('class', 'mfp-container');
34484
34485		// remove close button from target element
34486		if(mfp.st.showCloseBtn &&
34487		(!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
34488			if(mfp.currTemplate.closeBtn)
34489				mfp.currTemplate.closeBtn.detach();
34490		}
34491
34492
34493		if(mfp.st.autoFocusLast && mfp._lastFocusedEl) {
34494			$(mfp._lastFocusedEl).focus(); // put tab focus back
34495		}
34496		mfp.currItem = null;	
34497		mfp.content = null;
34498		mfp.currTemplate = null;
34499		mfp.prevHeight = 0;
34500
34501		_mfpTrigger(AFTER_CLOSE_EVENT);
34502	},
34503	
34504	updateSize: function(winHeight) {
34505
34506		if(mfp.isIOS) {
34507			// fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
34508			var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
34509			var height = window.innerHeight * zoomLevel;
34510			mfp.wrap.css('height', height);
34511			mfp.wH = height;
34512		} else {
34513			mfp.wH = winHeight || _window.height();
34514		}
34515		// Fixes #84: popup incorrectly positioned with position:relative on body
34516		if(!mfp.fixedContentPos) {
34517			mfp.wrap.css('height', mfp.wH);
34518		}
34519
34520		_mfpTrigger('Resize');
34521
34522	},
34523
34524	/**
34525	 * Set content of popup based on current index
34526	 */
34527	updateItemHTML: function() {
34528		var item = mfp.items[mfp.index];
34529
34530		// Detach and perform modifications
34531		mfp.contentContainer.detach();
34532
34533		if(mfp.content)
34534			mfp.content.detach();
34535
34536		if(!item.parsed) {
34537			item = mfp.parseEl( mfp.index );
34538		}
34539
34540		var type = item.type;
34541
34542		_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
34543		// BeforeChange event works like so:
34544		// _mfpOn('BeforeChange', function(e, prevType, newType) { });
34545
34546		mfp.currItem = item;
34547
34548		if(!mfp.currTemplate[type]) {
34549			var markup = mfp.st[type] ? mfp.st[type].markup : false;
34550
34551			// allows to modify markup
34552			_mfpTrigger('FirstMarkupParse', markup);
34553
34554			if(markup) {
34555				mfp.currTemplate[type] = $(markup);
34556			} else {
34557				// if there is no markup found we just define that template is parsed
34558				mfp.currTemplate[type] = true;
34559			}
34560		}
34561
34562		if(_prevContentType && _prevContentType !== item.type) {
34563			mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
34564		}
34565
34566		var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
34567		mfp.appendContent(newContent, type);
34568
34569		item.preloaded = true;
34570
34571		_mfpTrigger(CHANGE_EVENT, item);
34572		_prevContentType = item.type;
34573
34574		// Append container back after its content changed
34575		mfp.container.prepend(mfp.contentContainer);
34576
34577		_mfpTrigger('AfterChange');
34578	},
34579
34580
34581	/**
34582	 * Set HTML content of popup
34583	 */
34584	appendContent: function(newContent, type) {
34585		mfp.content = newContent;
34586
34587		if(newContent) {
34588			if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
34589				mfp.currTemplate[type] === true) {
34590				// if there is no markup, we just append close button element inside
34591				if(!mfp.content.find('.mfp-close').length) {
34592					mfp.content.append(_getCloseBtn());
34593				}
34594			} else {
34595				mfp.content = newContent;
34596			}
34597		} else {
34598			mfp.content = '';
34599		}
34600
34601		_mfpTrigger(BEFORE_APPEND_EVENT);
34602		mfp.container.addClass('mfp-'+type+'-holder');
34603
34604		mfp.contentContainer.append(mfp.content);
34605	},
34606
34607
34608	/**
34609	 * Creates Magnific Popup data object based on given data
34610	 * @param  {int} index Index of item to parse
34611	 */
34612	parseEl: function(index) {
34613		var item = mfp.items[index],
34614			type;
34615
34616		if(item.tagName) {
34617			item = { el: $(item) };
34618		} else {
34619			type = item.type;
34620			item = { data: item, src: item.src };
34621		}
34622
34623		if(item.el) {
34624			var types = mfp.types;
34625
34626			// check for 'mfp-TYPE' class
34627			for(var i = 0; i < types.length; i++) {
34628				if( item.el.hasClass('mfp-'+types[i]) ) {
34629					type = types[i];
34630					break;
34631				}
34632			}
34633
34634			item.src = item.el.attr('data-mfp-src');
34635			if(!item.src) {
34636				item.src = item.el.attr('href');
34637			}
34638		}
34639
34640		item.type = type || mfp.st.type || 'inline';
34641		item.index = index;
34642		item.parsed = true;
34643		mfp.items[index] = item;
34644		_mfpTrigger('ElementParse', item);
34645
34646		return mfp.items[index];
34647	},
34648
34649
34650	/**
34651	 * Initializes single popup or a group of popups
34652	 */
34653	addGroup: function(el, options) {
34654		var eHandler = function(e) {
34655			e.mfpEl = this;
34656			mfp._openClick(e, el, options);
34657		};
34658
34659		if(!options) {
34660			options = {};
34661		}
34662
34663		var eName = 'click.magnificPopup';
34664		options.mainEl = el;
34665
34666		if(options.items) {
34667			options.isObj = true;
34668			el.off(eName).on(eName, eHandler);
34669		} else {
34670			options.isObj = false;
34671			if(options.delegate) {
34672				el.off(eName).on(eName, options.delegate , eHandler);
34673			} else {
34674				options.items = el;
34675				el.off(eName).on(eName, eHandler);
34676			}
34677		}
34678	},
34679	_openClick: function(e, el, options) {
34680		var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
34681
34682
34683		if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) {
34684			return;
34685		}
34686
34687		var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
34688
34689		if(disableOn) {
34690			if($.isFunction(disableOn)) {
34691				if( !disableOn.call(mfp) ) {
34692					return true;
34693				}
34694			} else { // else it's number
34695				if( _window.width() < disableOn ) {
34696					return true;
34697				}
34698			}
34699		}
34700
34701		if(e.type) {
34702			e.preventDefault();
34703
34704			// This will prevent popup from closing if element is inside and popup is already opened
34705			if(mfp.isOpen) {
34706				e.stopPropagation();
34707			}
34708		}
34709
34710		options.el = $(e.mfpEl);
34711		if(options.delegate) {
34712			options.items = el.find(options.delegate);
34713		}
34714		mfp.open(options);
34715	},
34716
34717
34718	/**
34719	 * Updates text on preloader
34720	 */
34721	updateStatus: function(status, text) {
34722
34723		if(mfp.preloader) {
34724			if(_prevStatus !== status) {
34725				mfp.container.removeClass('mfp-s-'+_prevStatus);
34726			}
34727
34728			if(!text && status === 'loading') {
34729				text = mfp.st.tLoading;
34730			}
34731
34732			var data = {
34733				status: status,
34734				text: text
34735			};
34736			// allows to modify status
34737			_mfpTrigger('UpdateStatus', data);
34738
34739			status = data.status;
34740			text = data.text;
34741
34742			mfp.preloader.html(text);
34743
34744			mfp.preloader.find('a').on('click', function(e) {
34745				e.stopImmediatePropagation();
34746			});
34747
34748			mfp.container.addClass('mfp-s-'+status);
34749			_prevStatus = status;
34750		}
34751	},
34752
34753
34754	/*
34755		"Private" helpers that aren't private at all
34756	 */
34757	// Check to close popup or not
34758	// "target" is an element that was clicked
34759	_checkIfClose: function(target) {
34760
34761		if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
34762			return;
34763		}
34764
34765		var closeOnContent = mfp.st.closeOnContentClick;
34766		var closeOnBg = mfp.st.closeOnBgClick;
34767
34768		if(closeOnContent && closeOnBg) {
34769			return true;
34770		} else {
34771
34772			// We close the popup if click is on close button or on preloader. Or if there is no content.
34773			if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
34774				return true;
34775			}
34776
34777			// if click is outside the content
34778			if(  (target !== mfp.content[0] && !$.contains(mfp.content[0], target))  ) {
34779				if(closeOnBg) {
34780					// last check, if the clicked element is in DOM, (in case it's removed onclick)
34781					if( $.contains(document, target) ) {
34782						return true;
34783					}
34784				}
34785			} else if(closeOnContent) {
34786				return true;
34787			}
34788
34789		}
34790		return false;
34791	},
34792	_addClassToMFP: function(cName) {
34793		mfp.bgOverlay.addClass(cName);
34794		mfp.wrap.addClass(cName);
34795	},
34796	_removeClassFromMFP: function(cName) {
34797		this.bgOverlay.removeClass(cName);
34798		mfp.wrap.removeClass(cName);
34799	},
34800	_hasScrollBar: function(winHeight) {
34801		return (  (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
34802	},
34803	_setFocus: function() {
34804		(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
34805	},
34806	_onFocusIn: function(e) {
34807		if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
34808			mfp._setFocus();
34809			return false;
34810		}
34811	},
34812	_parseMarkup: function(template, values, item) {
34813		var arr;
34814		if(item.data) {
34815			values = $.extend(item.data, values);
34816		}
34817		_mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
34818
34819		$.each(values, function(key, value) {
34820			if(value === undefined || value === false) {
34821				return true;
34822			}
34823			arr = key.split('_');
34824			if(arr.length > 1) {
34825				var el = template.find(EVENT_NS + '-'+arr[0]);
34826
34827				if(el.length > 0) {
34828					var attr = arr[1];
34829					if(attr === 'replaceWith') {
34830						if(el[0] !== value[0]) {
34831							el.replaceWith(value);
34832						}
34833					} else if(attr === 'img') {
34834						if(el.is('img')) {
34835							el.attr('src', value);
34836						} else {
34837							el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) );
34838						}
34839					} else {
34840						el.attr(arr[1], value);
34841					}
34842				}
34843
34844			} else {
34845				template.find(EVENT_NS + '-'+key).html(value);
34846			}
34847		});
34848	},
34849
34850	_getScrollbarSize: function() {
34851		// thx David
34852		if(mfp.scrollbarSize === undefined) {
34853			var scrollDiv = document.createElement("div");
34854			scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
34855			document.body.appendChild(scrollDiv);
34856			mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
34857			document.body.removeChild(scrollDiv);
34858		}
34859		return mfp.scrollbarSize;
34860	}
34861
34862}; /* MagnificPopup core prototype end */
34863
34864
34865
34866
34867/**
34868 * Public static functions
34869 */
34870$.magnificPopup = {
34871	instance: null,
34872	proto: MagnificPopup.prototype,
34873	modules: [],
34874
34875	open: function(options, index) {
34876		_checkInstance();
34877
34878		if(!options) {
34879			options = {};
34880		} else {
34881			options = $.extend(true, {}, options);
34882		}
34883
34884		options.isObj = true;
34885		options.index = index || 0;
34886		return this.instance.open(options);
34887	},
34888
34889	close: function() {
34890		return $.magnificPopup.instance && $.magnificPopup.instance.close();
34891	},
34892
34893	registerModule: function(name, module) {
34894		if(module.options) {
34895			$.magnificPopup.defaults[name] = module.options;
34896		}
34897		$.extend(this.proto, module.proto);
34898		this.modules.push(name);
34899	},
34900
34901	defaults: {
34902
34903		// Info about options is in docs:
34904		// http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
34905
34906		disableOn: 0,
34907
34908		key: null,
34909
34910		midClick: false,
34911
34912		mainClass: '',
34913
34914		preloader: true,
34915
34916		focus: '', // CSS selector of input to focus after popup is opened
34917
34918		closeOnContentClick: false,
34919
34920		closeOnBgClick: true,
34921
34922		closeBtnInside: true,
34923
34924		showCloseBtn: true,
34925
34926		enableEscapeKey: true,
34927
34928		modal: false,
34929
34930		alignTop: false,
34931
34932		removalDelay: 0,
34933
34934		prependTo: null,
34935
34936		fixedContentPos: 'auto',
34937
34938		fixedBgPos: 'auto',
34939
34940		overflowY: 'auto',
34941
34942		closeMarkup: '<button title="%title%" type="button" class="mfp-close">&#215;</button>',
34943
34944		tClose: 'Close (Esc)',
34945
34946		tLoading: 'Loading...',
34947
34948		autoFocusLast: true
34949
34950	}
34951};
34952
34953
34954
34955$.fn.magnificPopup = function(options) {
34956	_checkInstance();
34957
34958	var jqEl = $(this);
34959
34960	// We call some API method of first param is a string
34961	if (typeof options === "string" ) {
34962
34963		if(options === 'open') {
34964			var items,
34965				itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
34966				index = parseInt(arguments[1], 10) || 0;
34967
34968			if(itemOpts.items) {
34969				items = itemOpts.items[index];
34970			} else {
34971				items = jqEl;
34972				if(itemOpts.delegate) {
34973					items = items.find(itemOpts.delegate);
34974				}
34975				items = items.eq( index );
34976			}
34977			mfp._openClick({mfpEl:items}, jqEl, itemOpts);
34978		} else {
34979			if(mfp.isOpen)
34980				mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
34981		}
34982
34983	} else {
34984		// clone options obj
34985		options = $.extend(true, {}, options);
34986
34987		/*
34988		 * As Zepto doesn't support .data() method for objects
34989		 * and it works only in normal browsers
34990		 * we assign "options" object directly to the DOM element. FTW!
34991		 */
34992		if(_isJQ) {
34993			jqEl.data('magnificPopup', options);
34994		} else {
34995			jqEl[0].magnificPopup = options;
34996		}
34997
34998		mfp.addGroup(jqEl, options);
34999
35000	}
35001	return jqEl;
35002};
35003
35004/*>>core*/
35005
35006/*>>inline*/
35007
35008var INLINE_NS = 'inline',
35009	_hiddenClass,
35010	_inlinePlaceholder,
35011	_lastInlineElement,
35012	_putInlineElementsBack = function() {
35013		if(_lastInlineElement) {
35014			_inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach();
35015			_lastInlineElement = null;
35016		}
35017	};
35018
35019$.magnificPopup.registerModule(INLINE_NS, {
35020	options: {
35021		hiddenClass: 'hide', // will be appended with `mfp-` prefix
35022		markup: '',
35023		tNotFound: 'Content not found'
35024	},
35025	proto: {
35026
35027		initInline: function() {
35028			mfp.types.push(INLINE_NS);
35029
35030			_mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() {
35031				_putInlineElementsBack();
35032			});
35033		},
35034
35035		getInline: function(item, template) {
35036
35037			_putInlineElementsBack();
35038
35039			if(item.src) {
35040				var inlineSt = mfp.st.inline,
35041					el = $(item.src);
35042
35043				if(el.length) {
35044
35045					// If target element has parent - we replace it with placeholder and put it back after popup is closed
35046					var parent = el[0].parentNode;
35047					if(parent && parent.tagName) {
35048						if(!_inlinePlaceholder) {
35049							_hiddenClass = inlineSt.hiddenClass;
35050							_inlinePlaceholder = _getEl(_hiddenClass);
35051							_hiddenClass = 'mfp-'+_hiddenClass;
35052						}
35053						// replace target inline element with placeholder
35054						_lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);
35055					}
35056
35057					mfp.updateStatus('ready');
35058				} else {
35059					mfp.updateStatus('error', inlineSt.tNotFound);
35060					el = $('<div>');
35061				}
35062
35063				item.inlineElement = el;
35064				return el;
35065			}
35066
35067			mfp.updateStatus('ready');
35068			mfp._parseMarkup(template, {}, item);
35069			return template;
35070		}
35071	}
35072});
35073
35074/*>>inline*/
35075
35076/*>>ajax*/
35077var AJAX_NS = 'ajax',
35078	_ajaxCur,
35079	_removeAjaxCursor = function() {
35080		if(_ajaxCur) {
35081			$(document.body).removeClass(_ajaxCur);
35082		}
35083	},
35084	_destroyAjaxRequest = function() {
35085		_removeAjaxCursor();
35086		if(mfp.req) {
35087			mfp.req.abort();
35088		}
35089	};
35090
35091$.magnificPopup.registerModule(AJAX_NS, {
35092
35093	options: {
35094		settings: null,
35095		cursor: 'mfp-ajax-cur',
35096		tError: '<a href="%url%">The content</a> could not be loaded.'
35097	},
35098
35099	proto: {
35100		initAjax: function() {
35101			mfp.types.push(AJAX_NS);
35102			_ajaxCur = mfp.st.ajax.cursor;
35103
35104			_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
35105			_mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
35106		},
35107		getAjax: function(item) {
35108
35109			if(_ajaxCur) {
35110				$(document.body).addClass(_ajaxCur);
35111			}
35112
35113			mfp.updateStatus('loading');
35114
35115			var opts = $.extend({
35116				url: item.src,
35117				success: function(data, textStatus, jqXHR) {
35118					var temp = {
35119						data:data,
35120						xhr:jqXHR
35121					};
35122
35123					_mfpTrigger('ParseAjax', temp);
35124
35125					mfp.appendContent( $(temp.data), AJAX_NS );
35126
35127					item.finished = true;
35128
35129					_removeAjaxCursor();
35130
35131					mfp._setFocus();
35132
35133					setTimeout(function() {
35134						mfp.wrap.addClass(READY_CLASS);
35135					}, 16);
35136
35137					mfp.updateStatus('ready');
35138
35139					_mfpTrigger('AjaxContentAdded');
35140				},
35141				error: function() {
35142					_removeAjaxCursor();
35143					item.finished = item.loadError = true;
35144					mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
35145				}
35146			}, mfp.st.ajax.settings);
35147
35148			mfp.req = $.ajax(opts);
35149
35150			return '';
35151		}
35152	}
35153});
35154
35155/*>>ajax*/
35156
35157/*>>image*/
35158var _imgInterval,
35159	_getTitle = function(item) {
35160		if(item.data && item.data.title !== undefined)
35161			return item.data.title;
35162
35163		var src = mfp.st.image.titleSrc;
35164
35165		if(src) {
35166			if($.isFunction(src)) {
35167				return src.call(mfp, item);
35168			} else if(item.el) {
35169				return item.el.attr(src) || '';
35170			}
35171		}
35172		return '';
35173	};
35174
35175$.magnificPopup.registerModule('image', {
35176
35177	options: {
35178		markup: '<div class="mfp-figure">'+
35179					'<div class="mfp-close"></div>'+
35180					'<figure>'+
35181						'<div class="mfp-img"></div>'+
35182						'<figcaption>'+
35183							'<div class="mfp-bottom-bar">'+
35184								'<div class="mfp-title"></div>'+
35185								'<div class="mfp-counter"></div>'+
35186							'</div>'+
35187						'</figcaption>'+
35188					'</figure>'+
35189				'</div>',
35190		cursor: 'mfp-zoom-out-cur',
35191		titleSrc: 'title',
35192		verticalFit: true,
35193		tError: '<a href="%url%">The image</a> could not be loaded.'
35194	},
35195
35196	proto: {
35197		initImage: function() {
35198			var imgSt = mfp.st.image,
35199				ns = '.image';
35200
35201			mfp.types.push('image');
35202
35203			_mfpOn(OPEN_EVENT+ns, function() {
35204				if(mfp.currItem.type === 'image' && imgSt.cursor) {
35205					$(document.body).addClass(imgSt.cursor);
35206				}
35207			});
35208
35209			_mfpOn(CLOSE_EVENT+ns, function() {
35210				if(imgSt.cursor) {
35211					$(document.body).removeClass(imgSt.cursor);
35212				}
35213				_window.off('resize' + EVENT_NS);
35214			});
35215
35216			_mfpOn('Resize'+ns, mfp.resizeImage);
35217			if(mfp.isLowIE) {
35218				_mfpOn('AfterChange', mfp.resizeImage);
35219			}
35220		},
35221		resizeImage: function() {
35222			var item = mfp.currItem;
35223			if(!item || !item.img) return;
35224
35225			if(mfp.st.image.verticalFit) {
35226				var decr = 0;
35227				// fix box-sizing in ie7/8
35228				if(mfp.isLowIE) {
35229					decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
35230				}
35231				item.img.css('max-height', mfp.wH-decr);
35232			}
35233		},
35234		_onImageHasSize: function(item) {
35235			if(item.img) {
35236
35237				item.hasSize = true;
35238
35239				if(_imgInterval) {
35240					clearInterval(_imgInterval);
35241				}
35242
35243				item.isCheckingImgSize = false;
35244
35245				_mfpTrigger('ImageHasSize', item);
35246
35247				if(item.imgHidden) {
35248					if(mfp.content)
35249						mfp.content.removeClass('mfp-loading');
35250
35251					item.imgHidden = false;
35252				}
35253
35254			}
35255		},
35256
35257		/**
35258		 * Function that loops until the image has size to display elements that rely on it asap
35259		 */
35260		findImageSize: function(item) {
35261
35262			var counter = 0,
35263				img = item.img[0],
35264				mfpSetInterval = function(delay) {
35265
35266					if(_imgInterval) {
35267						clearInterval(_imgInterval);
35268					}
35269					// decelerating interval that checks for size of an image
35270					_imgInterval = setInterval(function() {
35271						if(img.naturalWidth > 0) {
35272							mfp._onImageHasSize(item);
35273							return;
35274						}
35275
35276						if(counter > 200) {
35277							clearInterval(_imgInterval);
35278						}
35279
35280						counter++;
35281						if(counter === 3) {
35282							mfpSetInterval(10);
35283						} else if(counter === 40) {
35284							mfpSetInterval(50);
35285						} else if(counter === 100) {
35286							mfpSetInterval(500);
35287						}
35288					}, delay);
35289				};
35290
35291			mfpSetInterval(1);
35292		},
35293
35294		getImage: function(item, template) {
35295
35296			var guard = 0,
35297
35298				// image load complete handler
35299				onLoadComplete = function() {
35300					if(item) {
35301						if (item.img[0].complete) {
35302							item.img.off('.mfploader');
35303
35304							if(item === mfp.currItem){
35305								mfp._onImageHasSize(item);
35306
35307								mfp.updateStatus('ready');
35308							}
35309
35310							item.hasSize = true;
35311							item.loaded = true;
35312
35313							_mfpTrigger('ImageLoadComplete');
35314
35315						}
35316						else {
35317							// if image complete check fails 200 times (20 sec), we assume that there was an error.
35318							guard++;
35319							if(guard < 200) {
35320								setTimeout(onLoadComplete,100);
35321							} else {
35322								onLoadError();
35323							}
35324						}
35325					}
35326				},
35327
35328				// image error handler
35329				onLoadError = function() {
35330					if(item) {
35331						item.img.off('.mfploader');
35332						if(item === mfp.currItem){
35333							mfp._onImageHasSize(item);
35334							mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
35335						}
35336
35337						item.hasSize = true;
35338						item.loaded = true;
35339						item.loadError = true;
35340					}
35341				},
35342				imgSt = mfp.st.image;
35343
35344
35345			var el = template.find('.mfp-img');
35346			if(el.length) {
35347				var img = document.createElement('img');
35348				img.className = 'mfp-img';
35349				if(item.el && item.el.find('img').length) {
35350					img.alt = item.el.find('img').attr('alt');
35351				}
35352				item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
35353				img.src = item.src;
35354
35355				// without clone() "error" event is not firing when IMG is replaced by new IMG
vendor: 8,584 bytes, lines 35356-35739
35356				// TODO: find a way to avoid such cloning
35357				if(el.is('img')) {
35358					item.img = item.img.clone();
35359				}
35360
35361				img = item.img[0];
35362				if(img.naturalWidth > 0) {
35363					item.hasSize = true;
35364				} else if(!img.width) {
35365					item.hasSize = false;
35366				}
35367			}
35368
35369			mfp._parseMarkup(template, {
35370				title: _getTitle(item),
35371				img_replaceWith: item.img
35372			}, item);
35373
35374			mfp.resizeImage();
35375
35376			if(item.hasSize) {
35377				if(_imgInterval) clearInterval(_imgInterval);
35378
35379				if(item.loadError) {
35380					template.addClass('mfp-loading');
35381					mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
35382				} else {
35383					template.removeClass('mfp-loading');
35384					mfp.updateStatus('ready');
35385				}
35386				return template;
35387			}
35388
35389			mfp.updateStatus('loading');
35390			item.loading = true;
35391
35392			if(!item.hasSize) {
35393				item.imgHidden = true;
35394				template.addClass('mfp-loading');
35395				mfp.findImageSize(item);
35396			}
35397
35398			return template;
35399		}
35400	}
35401});
35402
35403/*>>image*/
35404
35405/*>>zoom*/
35406var hasMozTransform,
35407	getHasMozTransform = function() {
35408		if(hasMozTransform === undefined) {
35409			hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
35410		}
35411		return hasMozTransform;
35412	};
35413
35414$.magnificPopup.registerModule('zoom', {
35415
35416	options: {
35417		enabled: false,
35418		easing: 'ease-in-out',
35419		duration: 300,
35420		opener: function(element) {
35421			return element.is('img') ? element : element.find('img');
35422		}
35423	},
35424
35425	proto: {
35426
35427		initZoom: function() {
35428			var zoomSt = mfp.st.zoom,
35429				ns = '.zoom',
35430				image;
35431
35432			if(!zoomSt.enabled || !mfp.supportsTransition) {
35433				return;
35434			}
35435
35436			var duration = zoomSt.duration,
35437				getElToAnimate = function(image) {
35438					var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),
35439						transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing,
35440						cssObj = {
35441							position: 'fixed',
35442							zIndex: 9999,
35443							left: 0,
35444							top: 0,
35445							'-webkit-backface-visibility': 'hidden'
35446						},
35447						t = 'transition';
35448
35449					cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition;
35450
35451					newImg.css(cssObj);
35452					return newImg;
35453				},
35454				showMainContent = function() {
35455					mfp.content.css('visibility', 'visible');
35456				},
35457				openTimeout,
35458				animatedImg;
35459
35460			_mfpOn('BuildControls'+ns, function() {
35461				if(mfp._allowZoom()) {
35462
35463					clearTimeout(openTimeout);
35464					mfp.content.css('visibility', 'hidden');
35465
35466					// Basically, all code below does is clones existing image, puts in on top of the current one and animated it
35467
35468					image = mfp._getItemToZoom();
35469
35470					if(!image) {
35471						showMainContent();
35472						return;
35473					}
35474
35475					animatedImg = getElToAnimate(image);
35476
35477					animatedImg.css( mfp._getOffset() );
35478
35479					mfp.wrap.append(animatedImg);
35480
35481					openTimeout = setTimeout(function() {
35482						animatedImg.css( mfp._getOffset( true ) );
35483						openTimeout = setTimeout(function() {
35484
35485							showMainContent();
35486
35487							setTimeout(function() {
35488								animatedImg.remove();
35489								image = animatedImg = null;
35490								_mfpTrigger('ZoomAnimationEnded');
35491							}, 16); // avoid blink when switching images
35492
35493						}, duration); // this timeout equals animation duration
35494
35495					}, 16); // by adding this timeout we avoid short glitch at the beginning of animation
35496
35497
35498					// Lots of timeouts...
35499				}
35500			});
35501			_mfpOn(BEFORE_CLOSE_EVENT+ns, function() {
35502				if(mfp._allowZoom()) {
35503
35504					clearTimeout(openTimeout);
35505
35506					mfp.st.removalDelay = duration;
35507
35508					if(!image) {
35509						image = mfp._getItemToZoom();
35510						if(!image) {
35511							return;
35512						}
35513						animatedImg = getElToAnimate(image);
35514					}
35515
35516					animatedImg.css( mfp._getOffset(true) );
35517					mfp.wrap.append(animatedImg);
35518					mfp.content.css('visibility', 'hidden');
35519
35520					setTimeout(function() {
35521						animatedImg.css( mfp._getOffset() );
35522					}, 16);
35523				}
35524
35525			});
35526
35527			_mfpOn(CLOSE_EVENT+ns, function() {
35528				if(mfp._allowZoom()) {
35529					showMainContent();
35530					if(animatedImg) {
35531						animatedImg.remove();
35532					}
35533					image = null;
35534				}
35535			});
35536		},
35537
35538		_allowZoom: function() {
35539			return mfp.currItem.type === 'image';
35540		},
35541
35542		_getItemToZoom: function() {
35543			if(mfp.currItem.hasSize) {
35544				return mfp.currItem.img;
35545			} else {
35546				return false;
35547			}
35548		},
35549
35550		// Get element postion relative to viewport
35551		_getOffset: function(isLarge) {
35552			var el;
35553			if(isLarge) {
35554				el = mfp.currItem.img;
35555			} else {
35556				el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
35557			}
35558
35559			var offset = el.offset();
35560			var paddingTop = parseInt(el.css('padding-top'),10);
35561			var paddingBottom = parseInt(el.css('padding-bottom'),10);
35562			offset.top -= ( $(window).scrollTop() - paddingTop );
35563
35564
35565			/*
35566
35567			Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
35568
35569			 */
35570			var obj = {
35571				width: el.width(),
35572				// fix Zepto height+padding issue
35573				height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop
35574			};
35575
35576			// I hate to do this, but there is no another option
35577			if( getHasMozTransform() ) {
35578				obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)';
35579			} else {
35580				obj.left = offset.left;
35581				obj.top = offset.top;
35582			}
35583			return obj;
35584		}
35585
35586	}
35587});
35588
35589
35590
35591/*>>zoom*/
35592
35593/*>>iframe*/
35594
35595var IFRAME_NS = 'iframe',
35596	_emptyPage = '//about:blank',
35597
35598	_fixIframeBugs = function(isShowing) {
35599		if(mfp.currTemplate[IFRAME_NS]) {
35600			var el = mfp.currTemplate[IFRAME_NS].find('iframe');
35601			if(el.length) {
35602				// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
35603				if(!isShowing) {
35604					el[0].src = _emptyPage;
35605				}
35606
35607				// IE8 black screen bug fix
35608				if(mfp.isIE8) {
35609					el.css('display', isShowing ? 'block' : 'none');
35610				}
35611			}
35612		}
35613	};
35614
35615$.magnificPopup.registerModule(IFRAME_NS, {
35616
35617	options: {
35618		markup: '<div class="mfp-iframe-scaler">'+
35619					'<div class="mfp-close"></div>'+
35620					'<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+
35621				'</div>',
35622
35623		srcAction: 'iframe_src',
35624
35625		// we don't care and support only one default type of URL by default
35626		patterns: {
35627			youtube: {
35628				index: 'youtube.com',
35629				id: 'v=',
35630				src: '//www.youtube.com/embed/%id%?autoplay=1'
35631			},
35632			vimeo: {
35633				index: 'vimeo.com/',
35634				id: '/',
35635				src: '//player.vimeo.com/video/%id%?autoplay=1'
35636			},
35637			gmaps: {
35638				index: '//maps.google.',
35639				src: '%id%&output=embed'
35640			}
35641		}
35642	},
35643
35644	proto: {
35645		initIframe: function() {
35646			mfp.types.push(IFRAME_NS);
35647
35648			_mfpOn('BeforeChange', function(e, prevType, newType) {
35649				if(prevType !== newType) {
35650					if(prevType === IFRAME_NS) {
35651						_fixIframeBugs(); // iframe if removed
35652					} else if(newType === IFRAME_NS) {
35653						_fixIframeBugs(true); // iframe is showing
35654					}
35655				}// else {
35656					// iframe source is switched, don't do anything
35657				//}
35658			});
35659
35660			_mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() {
35661				_fixIframeBugs();
35662			});
35663		},
35664
35665		getIframe: function(item, template) {
35666			var embedSrc = item.src;
35667			var iframeSt = mfp.st.iframe;
35668
35669			$.each(iframeSt.patterns, function() {
35670				if(embedSrc.indexOf( this.index ) > -1) {
35671					if(this.id) {
35672						if(typeof this.id === 'string') {
35673							embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
35674						} else {
35675							embedSrc = this.id.call( this, embedSrc );
35676						}
35677					}
35678					embedSrc = this.src.replace('%id%', embedSrc );
35679					return false; // break;
35680				}
35681			});
35682
35683			var dataObj = {};
35684			if(iframeSt.srcAction) {
35685				dataObj[iframeSt.srcAction] = embedSrc;
35686			}
35687			mfp._parseMarkup(template, dataObj, item);
35688
35689			mfp.updateStatus('ready');
35690
35691			return template;
35692		}
35693	}
35694});
35695
35696
35697
35698/*>>iframe*/
35699
35700/*>>gallery*/
35701/**
35702 * Get looped index depending on number of slides
35703 */
35704var _getLoopedId = function(index) {
35705		var numSlides = mfp.items.length;
35706		if(index > numSlides - 1) {
35707			return index - numSlides;
35708		} else  if(index < 0) {
35709			return numSlides + index;
35710		}
35711		return index;
35712	},
35713	_replaceCurrTotal = function(text, curr, total) {
35714		return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
35715	};
35716
35717$.magnificPopup.registerModule('gallery', {
35718
35719	options: {
35720		enabled: false,
35721		arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
35722		preload: [0,2],
35723		navigateByImgClick: true,
35724		arrows: true,
35725
35726		tPrev: 'Previous (Left arrow key)',
35727		tNext: 'Next (Right arrow key)',
35728		tCounter: '%curr% of %total%'
35729	},
35730
35731	proto: {
35732		initGallery: function() {
35733
35734			var gSt = mfp.st.gallery,
35735				ns = '.mfp-gallery';
35736
35737			mfp.direction = true; // true - next, false - prev
35738
35739			if(!gSt || !gSt.enabled ) return false;
35740
35741			_wrapClasses += ' mfp-gallery';
35742
35743			_mfpOn(OPEN_EVENT+ns, function() {
35744
35745				if(gSt.navigateByImgClick) {
35746					mfp.wrap.on('click'+ns, '.mfp-img', function() {
35747						if(mfp.items.length > 1) {
35748							mfp.next();
35749							return false;
35750						}
35751					});
35752				}
35753
35754				_document.on('keydown'+ns, function(e) {
35755					if (e.keyCode === 37) {
35756						mfp.prev();
35757					} else if (e.keyCode === 39) {
35758						mfp.next();
35759					}
35760				});
35761			});
35762
35763			_mfpOn('UpdateStatus'+ns, function(e, data) {
35764				if(data.text) {
35765					data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
35766				}
35767			});
35768
35769			_mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
35770				var l = mfp.items.length;
35771				values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
35772			});
35773
35774			_mfpOn('BuildControls' + ns, function() {
35775				if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
35776					var markup = gSt.arrowMarkup,
35777						arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
35778						arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
35779
35780					arrowLeft.click(function() {
35781						mfp.prev();
35782					});
35783					arrowRight.click(function() {
35784						mfp.next();
35785					});
35786
35787					mfp.container.append(arrowLeft.add(arrowRight));
35788				}
35789			});
35790
35791			_mfpOn(CHANGE_EVENT+ns, function() {
35792				if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
35793
35794				mfp._preloadTimeout = setTimeout(function() {
35795					mfp.preloadNearbyImages();
35796					mfp._preloadTimeout = null;
35797				}, 16);
35798			});
35799
35800
35801			_mfpOn(CLOSE_EVENT+ns, function() {
35802				_document.off(ns);
35803				mfp.wrap.off('click'+ns);
35804				mfp.arrowRight = mfp.arrowLeft = null;
35805			});
35806
35807		},
35808		next: function() {
35809			mfp.direction = true;
35810			mfp.index = _getLoopedId(mfp.index + 1);
35811			mfp.updateItemHTML();
35812		},
35813		prev: function() {
35814			mfp.direction = false;
35815			mfp.index = _getLoopedId(mfp.index - 1);
35816			mfp.updateItemHTML();
35817		},
35818		goTo: function(newIndex) {
35819			mfp.direction = (newIndex >= mfp.index);
35820			mfp.index = newIndex;
35821			mfp.updateItemHTML();
35822		},
35823		preloadNearbyImages: function() {
35824			var p = mfp.st.gallery.preload,
35825				preloadBefore = Math.min(p[0], mfp.items.length),
35826				preloadAfter = Math.min(p[1], mfp.items.length),
35827				i;
35828
35829			for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
35830				mfp._preloadItem(mfp.index+i);
35831			}
35832			for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
35833				mfp._preloadItem(mfp.index-i);
35834			}
35835		},
35836		_preloadItem: function(index) {
35837			index = _getLoopedId(index);
35838
35839			if(mfp.items[index].preloaded) {
35840				return;
35841			}
35842
35843			var item = mfp.items[index];
35844			if(!item.parsed) {
35845				item = mfp.parseEl( index );
35846			}
35847
35848			_mfpTrigger('LazyLoad', item);
35849
35850			if(item.type === 'image') {
35851				item.img = $('<img class="mfp-img" />').on('load.mfploader', function() {
35852					item.hasSize = true;
35853				}).on('error.mfploader', function() {
35854					item.hasSize = true;
35855					item.loadError = true;
35856					_mfpTrigger('LazyLoadError', item);
35857				}).attr('src', item.src);
35858			}
35859
35860
35861			item.preloaded = true;
35862		}
35863	}
35864});
35865
35866/*>>gallery*/
35867
35868/*>>retina*/
35869
35870var RETINA_NS = 'retina';
35871
35872$.magnificPopup.registerModule(RETINA_NS, {
35873	options: {
35874		replaceSrc: function(item) {
35875			return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
35876		},
35877		ratio: 1 // Function or number.  Set to 1 to disable.
35878	},
35879	proto: {
35880		initRetina: function() {
35881			if(window.devicePixelRatio > 1) {
35882
35883				var st = mfp.st.retina,
35884					ratio = st.ratio;
35885
35886				ratio = !isNaN(ratio) ? ratio : ratio();
35887
35888				if(ratio > 1) {
35889					_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
35890						item.img.css({
35891							'max-width': item.img[0].naturalWidth / ratio,
35892							'width': '100%'
35893						});
35894					});
35895					_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
35896						item.src = st.replaceSrc(item, ratio);
35897					});
35898				}
35899			}
35900
35901		}
35902	}
35903});
35904
35905/*>>retina*/
35906 _checkInstance(); }));
35907/* End */
35908;
35909; /* Start:"a:4:{s:4:"full";s:83:"/local/templates/aspro_max/js/jquery.mCustomScrollbar.concat.min.js?166601759345485";s:6:"source";s:67:"/local/templates/aspro_max/js/jquery.mCustomScrollbar.concat.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
35910/* == jquery mousewheel plugin == Version: 3.1.13, License: MIT License (MIT) */
35911!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1
vendor: 13,157 bytes, lines 35911-35913
35911),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
35912/* == malihu jquery custom scrollbar plugin == Version: 3.1.5, License: MIT License (MIT) */
35913!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var o="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",i="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";o||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+i+"%3E%3C/script%3E"))),t()}(function(){var t,o="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",i={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},r=0,l={},s=window.attachEvent&&!window.addEventListener?1:0,c=!1,d=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],u={init:function(t){var t=e.extend(!0,{},i,t),o=f.call(this);if(t.live){var s=t.liveSelector||this.selector||n,c=e(s);if("off"===t.live)return void m(s);l[s]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&m(s)},500)}else m(s);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":p(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),h(t),e(o).each(function(){var o=e(this);if(!o.data(a)){o.data(a,{idx:++r,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:o.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var n=o.data(a),i=n.opt,l=o.data("mcs-axis"),s=o.data("mcs-scrollbar-position"),c=o.data("mcs-theme");l&&(i.axis=l),s&&(i.scrollbarPosition=s),c&&(i.theme=c,h(i)),v.call(this),n&&i.callbacks.onCreate&&"function"==typeof i.callbacks.onCreate&&i.callbacks.onCreate.call(this),e("#mCSB_"+n.idx+"_container img:not(."+d[2]+")").addClass(d[2]),u.update.call(null,o)}})},update:function(t,o){var n=t||f.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container"),l=e("#mCSB_"+n.idx),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!r.length)return;n.tweenRunning&&Q(t),o&&n&&i.callbacks.onBeforeUpdate&&"function"==typeof i.callbacks.onBeforeUpdate&&i.callbacks.onBeforeUpdate.call(this),t.hasClass(d[3])&&t.removeClass(d[3]),t.hasClass(d[4])&&t.removeClass(d[4]),l.css("max-height","none"),l.height()!==t.height()&&l.css("max-height",t.height()),_.call(this),"y"===i.axis||i.advanced.autoExpandHorizontalScroll||r.css("width",x(r)),n.overflowed=y.call(this),M.call(this),i.autoDraggerLength&&S.call(this),b.call(this),T.call(this);var c=[Math.abs(r[0].offsetTop),Math.abs(r[0].offsetLeft)];"x"!==i.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?B.call(this):(G(t,c[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(B.call(this),"y"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[1]&&G(t,c[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==i.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?B.call(this):(G(t,c[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(B.call(this),"x"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[0]&&G(t,c[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),o&&n&&(2===o&&i.callbacks.onImageLoad&&"function"==typeof i.callbacks.onImageLoad?i.callbacks.onImageLoad.call(this):3===o&&i.callbacks.onSelectorChange&&"function"==typeof i.callbacks.onSelectorChange?i.callbacks.onSelectorChange.call(this):i.callbacks.onUpdate&&"function"==typeof i.callbacks.onUpdate&&i.callbacks.onUpdate.call(this)),N.call(this)}})},scrollTo:function(t,o){if("undefined"!=typeof t&&null!=t){var n=f.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l={trigger:"external",scrollInertia:r.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},s=e.extend(!0,{},l,o),c=Y.call(this,t),d=s.scrollInertia>0&&s.scrollInertia<17?17:s.scrollInertia;c[0]=X.call(this,c[0],"y"),c[1]=X.call(this,c[1],"x"),s.moveDragger&&(c[0]*=i.scrollRatio.y,c[1]*=i.scrollRatio.x),s.dur=ne()?0:d,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==r.axis&&i.overflowed[0]&&(s.dir="y",s.overwrite="all",G(n,c[0].toString(),s)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==r.axis&&i.overflowed[1]&&(s.dir="x",s.overwrite="none",G(n,c[1].toString(),s))},s.timeout)}})}},stop:function(){var t=f.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Q(t)})},disable:function(t){var o=f.call(this);return e(o).each(function(){var o=e(this);if(o.data(a)){o.data(a);N.call(this,"remove"),k.call(this),t&&B.call(this),M.call(this,!0),o.addClass(d[3])}})},destroy:function(){var t=f.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l=e("#mCSB_"+i.idx),s=e("#mCSB_"+i.idx+"_container"),c=e(".mCSB_"+i.idx+"_scrollbar");r.live&&m(r.liveSelector||e(t).selector),N.call(this,"remove"),k.call(this),B.call(this),n.removeData(a),$(this,"mcs"),c.remove(),s.find("img."+d[2]).removeClass(d[2]),l.replaceWith(s.contents()),n.removeClass(o+" _"+a+"_"+i.idx+" "+d[6]+" "+d[7]+" "+d[5]+" "+d[3]).addClass(d[4])}})}},f=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},h=function(t){var o=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],i=["minimal","minimal-dark"],r=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,o)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,i)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,r)>-1?"outside":t.scrollbarPosition},m=function(e){l[e]&&(clearTimeout(l[e]),$(l,e))},p=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),i=n.opt,r=i.autoExpandScrollbar?" "+d[1]+"_expand":"",l=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+i.theme+" mCSB_scrollTools_vertical"+r+"'><div class='"+d[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div
vendor: 32,054 bytes, lines 35913-35914
35913></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+i.theme+" mCSB_scrollTools_horizontal"+r+"'><div class='"+d[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],s="yx"===i.axis?"mCSB_vertical_horizontal":"x"===i.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===i.axis?l[0]+l[1]:"x"===i.axis?l[1]:l[0],u="yx"===i.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",f=i.autoHideScrollbar?" "+d[6]:"",h="x"!==i.axis&&"rtl"===n.langDir?" "+d[7]:"";i.setWidth&&t.css("width",i.setWidth),i.setHeight&&t.css("height",i.setHeight),i.setLeft="y"!==i.axis&&"rtl"===n.langDir?"989999px":i.setLeft,t.addClass(o+" _"+a+"_"+n.idx+f+h).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+i.theme+" "+s+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+i.setTop+"; left:"+i.setLeft+";' dir='"+n.langDir+"' /></div>");var m=e("#mCSB_"+n.idx),p=e("#mCSB_"+n.idx+"_container");"y"===i.axis||i.advanced.autoExpandHorizontalScroll||p.css("width",x(p)),"outside"===i.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),m.addClass("mCSB_outside").after(c)):(m.addClass("mCSB_inside").append(c),p.wrap(u)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},x=function(t){var o=[t[0].scrollWidth,Math.max.apply(Math,t.children().map(function(){return e(this).outerWidth(!0)}).get())],a=t.parent().width();return o[0]>a?o[0]:o[1]>a?o[1]:"100%"},_=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx+"_container");if(n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis){i.css({width:"auto","min-width":0,"overflow-x":"scroll"});var r=Math.ceil(i[0].scrollWidth);3===n.advanced.autoExpandHorizontalScroll||2!==n.advanced.autoExpandHorizontalScroll&&r>i.parent().width()?i.css({width:r,"min-width":"100%","overflow-x":"inherit"}):i.css({"overflow-x":"inherit",position:"absolute"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(i[0].getBoundingClientRect().right+.4)-Math.floor(i[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},w=function(){var t=e(this),o=t.data(a),n=o.opt,i=e(".mCSB_"+o.idx+"_scrollbar:first"),r=oe(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",l=["<a href='#' class='"+d[13]+"' "+r+" />","<a href='#' class='"+d[14]+"' "+r+" />","<a href='#' class='"+d[15]+"' "+r+" />","<a href='#' class='"+d[16]+"' "+r+" />"],s=["x"===n.axis?l[2]:l[0],"x"===n.axis?l[3]:l[1],l[2],l[3]];n.scrollButtons.enable&&i.prepend(s[0]).append(s[1]).next(".mCSB_scrollTools").prepend(s[2]).append(s[3])},S=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],l=[n.height()/i.outerHeight(!1),n.width()/i.outerWidth(!1)],c=[parseInt(r[0].css("min-height")),Math.round(l[0]*r[0].parent().height()),parseInt(r[1].css("min-width")),Math.round(l[1]*r[1].parent().width())],d=s&&c[1]<c[0]?c[0]:c[1],u=s&&c[3]<c[2]?c[2]:c[3];r[0].css({height:d,"max-height":r[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),r[1].css({width:u,"max-width":r[1].parent().width()-10})},b=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],l=[i.outerHeight(!1)-n.height(),i.outerWidth(!1)-n.width()],s=[l[0]/(r[0].parent().height()-r[0].height()),l[1]/(r[1].parent().width()-r[1].width())];o.scrollRatio={y:s[0],x:s[1]}},C=function(e,t,o){var a=o?d[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(d[0]+" "+a),n.toggleClass(d[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(d[0]),n.removeClass(d[1])):(e.addClass(d[0]),n.addClass(d[1])))},y=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=null==o.overflowed?i.height():i.outerHeight(!1),l=null==o.overflowed?i.width():i.outerWidth(!1),s=i[0].scrollHeight,c=i[0].scrollWidth;return s>r&&(r=s),c>l&&(l=c),[r>n.height(),l>n.width()]},B=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx),r=e("#mCSB_"+o.idx+"_container"),l=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")];if(Q(t),("x"!==n.axis&&!o.overflowed[0]||"y"===n.axis&&o.overflowed[0])&&(l[0].add(r).css("top",0),G(t,"_resetY")),"y"!==n.axis&&!o.overflowed[1]||"x"===n.axis&&o.overflowed[1]){var s=dx=0;"rtl"===o.langDir&&(s=i.width()-r.outerWidth(!1),dx=Math.abs(s/o.scrollRatio.x)),r.css("left",s),l[1].css("left",dx),G(t,"_resetX")}},T=function(){function t(){r=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(r),W.call(o[0])):t()},100)}var o=e(this),n=o.data(a),i=n.opt;if(!n.bindEvents){if(I.call(this),i.contentTouchScroll&&D.call(this),E.call(this),i.mouseWheel.enable){var r;t()}P.call(this),U.call(this),i.advanced.autoScrollOnFocus&&H.call(this),i.scrollButtons.enable&&F.call(this),i.keyboard.enable&&q.call(this),n.bindEvents=!0}},k=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=".mCSB_"+o.idx+"_scrollbar",l=e("#mCSB_"+o.idx+",#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,"+r+" ."+d[12]+",#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal,"+r+">a"),s=e("#mCSB_"+o.idx+"_container");n.advanced.releaseDraggableSelectors&&l.add(e(n.advanced.releaseDraggableSelectors)),n.advanced.extraDraggableSelectors&&l.add(e(n.advanced.extraDraggableSelectors)),o.bindEvents&&(e(document).add(e(!A()||top.document)).unbind("."+i),l.each(function(){e(this).unbind("."+i)}),clearTimeout(t[0]._focusTimeout),$(t[0],"_focusTimeout"),clearTimeout(o.sequential.step),$(o.sequential,"step"),clearTimeout(s[0].onCompleteTimeout),$(s[0],"onCompleteTimeout"),o.bindEvents=!1)},M=function(t){var o=e(this),n=o.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container_wrapper"),l=r.length?r:e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[s[0].find(".mCSB_dragger"),s[1].find(".mCSB_dragger")];"x"!==i.axis&&(n.overflowed[0]&&!t?(s[0].add(c[0]).add(s[0].children("a")).css("display","block"),l.removeClass(d[8]+" "+d[10])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[0].css("display","none"),l.removeClass(d[10])):(s[0].css("display","none"),l.addClass(d[10])),l.addClass(d[8]))),"y"!==i.axis&&(n.overflowed[1]&&!t?(s[1].add(c[1]).add(s[1].children("a")).css("display","block"),l.removeClass(d[9]+" "+d[11])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[1].css("display","none"),l.removeClass(d[11])):(s[1].css("display","none"),l.addClass(d[11])),l.addClass(d[9]))),n.overflowed[0]||n.overflowed[1]?o.removeClass(d[5]):o.addClass(d[5])},O=function(t){var o=t.type,a=t.target.ownerDocument!==document&&null!==frameElement?[e(frameElement).offset().top,e(frameElement).offset().left]:null,n=A()&&t.target.ownerDocument!==top.document&&null!==frameElement?[e(t.view.frameElement).offset().top,e(t.view.frameElement).offset().left]:[0,0];switch(o){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return a?[t.originalEvent.pageY-a[0]+n[0],t.originalEvent.pageX-a[1]+n[1],!1]:[t.originalEvent.pageY,t.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],r=t.originalEvent.touches.length||t.originalEvent.changedTouches.length;return t.target.ownerDocument!==document?[i.screenY,i.screenX,r>1]:[i.pageY,i.pageX,r>1];default:return a?[t.pageY-a[0]+n[0],t.pageX-a[1]+n[1],!1]:[t.pageY,t.pageX,!1]}},I=function(){function t(e,t,a,n){if(h[0].idleTimer=d.scrollInertia<233?250:0,o.attr("id")===f[1])var i="x",s=(o[0].offsetLeft-t+n)*l.scrollRatio.x;else var i="y",s=(o[0].offsetTop-e+a)*l.scrollRatio.y;G(r,s.toString(),{dir:i,drag:!0})}var o,n,i,r=e(this),l=r.data(a),d=l.opt,u=a+"_"+l.idx,f=["mCSB_"+l.idx+"_dragger_vertical","mCSB_"+l.idx+"_dragger_horizontal"],h=e("#mCSB_"+l.idx+"_container"),m=e("#"+f[0]+",#"+f[1]),p=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m,g=d.advanced.extraDraggableSelectors?e(!A()||top.document).add(e(d.advanced.extraDraggableSelectors)):e(!A()||top.document);m.bind("contextmenu."+u,function(e){e.preventDefault()}).bind("mousedown."+u+" touchstart."+u+" pointerdown."+u+" MSPointerDown."+u,function(t){if(t.stopImmediatePropagation(),t.preventDefault(),ee(t)){c=!0,s&&(document.onselectstart=function(){return!1}),L.call(h,!1),Q(r),o=e(this);var a=o.offset(),l=O(t)[0]-a.top,u=O(t)[1]-a.left,f=o.height()+a.top,m=o.width()+a.left;f>l&&l>0&&m>u&&u>0&&(n=l,i=u),C(o,"active",d.autoExpandScrollbar)}}).bind("touchmove."+u,function(e){e.stopImmediatePropagation(),e.preventDefault();var a=o.offset(),r=O(e)[0]-a.top,l=O(e)[1]-a.left;t(n,i,r,l)}),e(document).add(g).bind("mousemove."+u+" pointermove."+u+" MSPointerMove."+u,function(e){if(o){var a=o.offset(),r=O(e)[0]-a.top,l=O(e)[1]-a.left;if(n===r&&i===l)return;t(n,i,r,l)}}).add(p).bind("mouseup."+u+" touchend."+u+" pointerup."+u+" MSPointerUp."+u,function(){o&&(C(o,"active",d.autoExpandScrollbar),o=null),c=!1,s&&(document.onselectstart=null),L.call(h,!0)})},D=function(){function o(e){if(!te(e)||c||O(e)[2])return void(t=0);t=1,b=0,C=0,d=1,y.removeClass("mCS_touch_action");var o=I.offset();u=O(e)[0]-o.top,f=O(e)[1]-o.left,z=[O(e)[0],O(e)[1]]}function n(e){if(te(e)&&!c&&!O(e)[2]&&(T.documentTouchScroll||e.preventDefault(),e.stopImmediatePropagation(),(!C||b)&&d)){g=K();var t=M.offset(),o=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(o),W.push(a),z[2]=Math.abs(O(e)[0]-z[0]),z[3]=Math.abs(O(e)[1]-z[1]),B.overflowed[0])var i=D[0].parent().height()-D[0].height(),r=u-o>0&&o-u>-(i*B.scrollRatio.y)&&(2*z[3]<z[2]||"yx"===T.axis);if(B.overflowed[1])var l=D[1].parent().width()-D[1].width(),h=f-a>0&&a-f>-(l*B.scrollRatio.x)&&(2*z[2]<z[3]||"yx"===T.axis);r||h?(U||e.preventDefault(),b=1):(C=1,y.addClass("mCS_touch_action")),U&&e.preventDefault(),w="yx"===T.axis?[u-o,f-a]:"x"===T.axis?[null,f-a]:[u-o,null],I[0].idleTimer=250,B.overflowed[0]&&s(w[0],R,n,"y","all",!0),B.overflowed[1]&&s(w[1],R,n,"x",L,!0)}}function i(e){if(!te(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Q(y),p=K();var o=M.offset();h=O(e)[0]-o.top,m=O(e)[1]-o.left,E=[],W=[]}function r(e){if(te(e)&&!c&&!O(e)[2]){d=0,e.stopImmediatePropagation(),b=0,C=0,v=K();var t=M.offset(),o=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(v-g>30)){_=1e3/(v-p);var n="mcsEaseOut",i=2.5>_,r=i?[E[E.length-2],W[W.length-2]]:[0,0];x=i?[o-r[0],a-r[1]]:[o-h,a-m];var u=[Math.abs(x[0]),Math.abs(x[1])];_=i?[Math.abs(x[0]/4),Math.abs(x[1]/4)]:[_,_];var f=[Math.abs(I[0].offsetTop)-x[0]*l(u[0]/_[0],_[0]),Math.abs(I[0].offsetLeft)-x[1]*l(u[1]/_[1],_[1])];w="yx"===T.axis?[f[0],f[1]]:"x"===T.axis?[null,f[1]]:[f[0],null],S=[4*u[0]+T.scrollInertia,4*u[1]+T.scrollInertia];var y=parseInt(T.contentTouchScroll)||0;w[0]=u[0]>y?w[0]:0,w[1]=u[1]>y?w[1]:0,B.overflowed[0]&&s(w[0],S[0],n,"y",L,!1),B.overflowed[1]&&s(w[1],S[1],n,"x",L,!1)}}}function l(e,t){var o=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?o[0]:o[3]:e>60?t>3?o[3]:o[2]:e>30?t>8?o[1]:t>6?o[0]:t>4?t:o[2]:t>8?t:o[3]}function s(e,t,o,a,n,i){e&&G(y,e.toString(),{dur:t,scrollEasing:o,dir:a,overwrite:n,drag:i})}var d,u,f,h,m,p,g,v,x,_,w,S,b,C,y=e(this),B=y.data(a),T=B.opt,k=a+"_"+B.idx,M=e("#mCSB_"+B.idx),I=e("#mCSB_"+B.idx+"_container"),D=[e("#mCSB_"+B.idx+"_dragger_vertical"),e("#mCSB_"+B.idx+"_dragger_horizontal")],E=[],W=[],R=0,L="yx"===T.axis?"none":"all",z=[],P=I.find("iframe"),H=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k],U=void 0!==document.body.style.touchAction&&""!==document.body.style.touchAction;I.bind(H[0],function(e){o(e)}).bind(H[1],function(e){n(e)}),M.bind(H[0],function(e){i(e)}).bind(H[2],function(e){r(e)}),P.length&&P.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(H[0],function(e){o(e),i(e)}).bind(H[1],function(e){n(e)}).bind(H[2],function(e){r(e)})})})},E=function(){function o(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,o){d.type=o&&i?"stepped":"stepless",d.scrollAmount=10,j(r,e,t,"mcsLinearOut",o?60:null)}var i,r=e(this),l=r.data(a),s=l.opt,d=l.sequential,u=a+"_"+l.idx,f=e("#mCSB_"+l.idx+"_container"),h=f.parent();f.bind("mousedown."+u,function(){t||i||(i=1,c=!0)}).add(document).bind("mousemove."+u,function(e){if(!t&&i&&o()){var a=f.offset(),r=O(e)[0]-a.top+f[0].offsetTop,c=O(e)[1]-a.left+f[0].offsetLeft;r>0&&r<h.height()&&c>0&&c<h.width()?d.step&&n("off",null,"stepped"):("x"!==s.axis&&l.overflowed[0]&&(0>r?n("on",38):r>h.height()&&n("on",40)),"y"!==s.axis&&l.overflowed[1]&&(0>c?n("on",37):c>h.width()&&n("on",39)))}}).bind("mouseup."+u+" dragend."+u,function(){t||(i&&(i=0,n("off",null)),c=!1)})},W=function(){function t(t,a){if(Q(o),!z(o,t.target)){var r="auto"!==i.mouseWheel.deltaFactor?parseInt(i.mouseWheel.deltaFactor):s&&t.deltaFactor<100?100:t.deltaFactor||100,d=i.scrollInertia;if("x"===i.axis||"x"===i.mouseWheel.axis)var u="x",f=[Math.round(r*n.scrollRatio.x),parseInt(i.mouseWheel.scrollAmount)],h="auto"!==i.mouseWheel.scrollAmount?f[1]:f[0]>=l.width()?.9*l.width():f[0],m=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),p=c[1][0].offsetLeft,g=c[1].parent().width()-c[1].width(),v="y"===i.mouseWheel.axis?t.deltaY||a:t.deltaX;else var u="y",f=[Math.round(r*n.scrollRatio.y),parseInt(i.mouseWheel.scrollAmount)],h="auto"!==i.mouseWheel.scrollAmount?f[1]:f[0]>=l.height()?.9*l.height():f[0],m=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),p=c[0][0].offsetTop,g=c[0].parent().height()-c[0].height(),v=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||((i.mouseWheel.invert||t.webkitDirectionInvertedFromDevice)&&(v=-v),i.mouseWheel.normalizeDelta&&(v=0>v?-1:1),(v>0&&0!==p||0>v&&p!==g||i.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),t.deltaFactor<5&&!i.mouseWheel.normalizeDelta&&(h=t.deltaFactor,d=17),G(o,(m-v*h).toString(),{dir:u,dur:d}))}}if(e(this).data(a)){var o=e(this),n=o.data(a),i=n.opt,r=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],d=e("#mCSB_"+n.idx+"_container").find("iframe");d.length&&d.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+r,function(e,o){t(e,o)})})}),l.bind("mousewheel."+r,function(e,o){t(e,o)})}},R=new Object,A=function(t){var o=!1,a=!1,n=null;if(void 0===t?a="#empty":void 0!==e(t).attr("id")&&(a=e(t).attr("id")),a!==!1&&void 0!==R[a])return R[a];if(t){try{var i=t.contentDocument||t.contentWindow.document;n=i.body.innerHTML}catch(r){}o=null!==n}else{try{var i=top.document;n=i.body.innerHTML}catch(r){}o=null!==n}return a!==!1&&(R[a]=o),o},L=function(e){var t=this.find("iframe");if(t.length){var o=e?"auto":"none";t.css("pointer-events",o)}},z=function(t,o){var n=o.nodeName.toLowerCase(),i=t.data(a).opt.mouseWheel.disableOver,r=["select","textarea"];return e.inArray(n,i)>-1&&!(e.inArray(n,r)>-1&&!e(o).is(":focus"))},P=function(){var t,o=e(this),n=o.data(a),i=a+"_"+n.idx,r=e("#mCSB_"+n.idx+"_container"),l=r.parent(),s=e(".mCSB_"+n.idx+"_scrollbar ."+d[12]);s.bind("mousedown."+i+" touchstart."+i+" pointerdown."+i+" MSPointerDown."+i,function(o){c=!0,e(o.target).hasClass("mCSB_dragger")||(t=1)}).bind("touchend."+i+" pointerup."+i+" MSPointerUp."+i,function(){c=!1}).bind("click."+i,function(a){if(t&&(t=0,e(a.target).hasClass(d[12])||e(a.target).hasClass("mCSB_draggerRail"))){Q(o);var i=e(this),s=i.find(".mCSB_dragger");if(i.parent(".mCSB_scrollTools_horizontal").length>0){if(!n.overflowed[1])return;var c="x",u=a.pageX>s.offset().left?-1:1,f=Math.abs(r[0].offsetLeft)-u*(.9*l.width())}else{if(!n.overflowed[0])return;var c="y",u=a.pageY>s.offset().top?-1:1,f=Math.abs(r[0].offsetTop)-u*(.9*l.height())}G(o,f.toString(),{dir:c,scrollEasing:"mcsEaseInOut"})}})},H=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=e("#mCSB_"+o.idx+"_container"),l=r.parent();r.bind("focusin."+i,function(){var o=e(document.activeElement),a=r.find(".mCustomScrollBox").length,i=0;o.is(n.advanced.autoScrollOnFocus)&&(Q(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(i+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ae(o)[0],ae(o)[1]],a=[r[0].offsetTop,r[0].offsetLeft],s=[a[0]+e[0]>=0&&a[0]+e[0]<l.height()-o.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<l.width()-o.outerWidth(!1)],c="yx"!==n.axis||s[0]||s[1]?"all":"none";"x"===n.axis||s[0]||G(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:i}),"y"===n.axis||s[1]||G(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:i})},t[0]._focusTimer))})},U=function(){var t=e(this),o=t.data(a),n=a+"_"+o.idx,i=e("#mCSB_"+o.idx+"_container").parent();i.bind("scroll."+n,function(){0===i.scrollTop()&&0===i.scrollLeft()||e(".mCSB_"+o.idx+"_scrollbar").css("visibility","hidden")})},F=function(){var t=e(this),o=t.data(a),n=o.opt,i=o.sequential,r=a+"_"+o.idx,l=".mCSB_"+o.idx+"_scrollbar",s=e(l+">a");s.bind("contextmenu."+r,function(e){e.preventDefault()}).bind("mousedown."+r+" touchstart."+r+" pointerdown."+r+" MSPointerDown."+r+" mouseup."+r+" touchend."+r+" pointerup."+r+" MSPointerUp."+r+" mouseout."+r+" pointerout."+r+" MSPointerOut."+r+" click."+r,function(a){function r(e,o){i.scrollAmount=n.scrollButtons.scrollAmount,j(t,e,o)}if(a.preventDefault(),ee(a)){var l=e(this).attr("class");switch(i.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===i.type)return;c=!0,o.tweenRunning=!1,r("on",l);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===i.type)return;c=!1,i.dir&&r("off",l);break;case"click":if("stepped"!==i.type||o.tweenRunning)return;r("on",l)}}})},q=function(){function t(t){function a(e,t){r.type=i.keyboard.scrollType,r.scrollAmount=i.keyboard.scrollAmount,"stepped"===r.type&&n.tweenRunning||j(o,e,t)}switch(t.type){case"blur":n.tweenRunning&&r.dir&&a("off",null);break;case"keydown":case"keyup":var l=t.keyCode?t.keyCode:t.which,s="on";if("x"!==i.axis&&(38===l||40===l)||"y"!==i.axis&&(37===l||39===l)){if((38===l||40===l)&&!n.overflowed[0]||(37===l||39===l)&&!n.overflowed[1])return;"keyup"===t.type&&(s="off"),e(document.activeElement).is(u)||(t.preventDefault(),t.stopImmediatePropagation(),a(s,l))}else if(33===l||34===l){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Q(o);var f=34===l?-1:1;if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=Math.abs(c[0].offsetLeft)-f*(.9*d.width());else var h="y",m=Math.abs(c[0].offsetTop)-f*(.9*d.height());G(o,m.toString(),{dir:h,scrollEasing:"mcsEaseInOut"})}}else if((35===l||36===l)&&!e(document.activeElement).is(u)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=35===l?Math.abs(d.width()-c.outerWidth(!1)):0;else var h="y",m=35===l?Math.abs(d.height()-c.outerHeight(!1)):0;G(o,m.toString(),{dir:h,scrollEasing:"mcsEaseInOut"})}}}var o=e(this),n=o.data(a),i=n.opt,r=n.sequential,l=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),d=c.parent(),u="input,textarea,select,datalist,keygen,[contenteditable='true']",f=c.find("iframe"),h=["blur."+l+" keydown."+l+" keyup."+l];f.length&&f.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(h[0],function(e){t(e)})})}),s.attr("tabindex","0").bind(h[0],function(e){t(e)})},j=function(t,o,n,i,r){function l(e){u.snapAmount&&(f.scrollAmount=u.snapAmount instanceof Array?"x"===f.dir[0]?u.snapAmount[1]:u.snapAmount[0]:u.snapAmount);var o="stepped"!==f.type,a=r?r:e?o?p/1.5:g:1e3/60,n=e?o?7.5:40:2.5,s=[Math.abs(h[0].offsetTop),Math.abs(h[0].offsetLeft)],d=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],m="x"===f.dir[0]?s[1]+f.dir[1]*(d[1]*n):s[0]+f.dir[1]*(d[0]*n),v="x"===f.dir[0]?s[1]+f.dir[1]*parseInt(f.scrollAmount):s[0]+f.dir[1]*parseInt(f.scrollAmount),x="auto"!==f.scrollAmount?v:m,_=i?i:e?o?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",w=!!e;return e&&17>a&&(x="x"===f.dir[0]?s[1]:s[0]),G(t,x.toString(),{dir:f.dir[0],scrollEasing:_,dur:a,onComplete:w}),e?void(f.dir=!1):(clearTimeout(f.step),void(f.step=setTimeout(function(){l()},a)))}function s(){clearTimeout(f.step),$(f,"step"),Q(t)}var c=t.data(a),u=c.opt,f=c.sequential,h=e("#mCSB_"+c.idx+"_container"),m="stepped"===f.type,p=u.scrollInertia<26?26:u.scrollInertia,g=u.scrollInertia<1?17:u.scrollInertia;switch(o){case"on":if(f.dir=[n===d[16]||n===d[15]||39===n||37===n?"x":"y",n===d[13]||n===d[15]||38===n||37===n?-1:1],Q(t),oe(n)&&"stepped"===f.type)return;l(m);break;case"off":s(),(m||c.tweenRunning&&f.dir)&&l(!0)}},Y=function(t){var o=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===o.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===o.axis?null:t,n[1]=t.x?t.x:t.y||"y"===o.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},X=function(t,o){if(null!=t&&"undefined"!=typeof t){var n=e(this),i=n.data(a),r=i.opt,l=e("#mCSB_"+i.idx+"_container"),s=l.parent(),c=typeof t;o||(o="x"===r.axis?"x":"y");var d="x"===o?l.outerWidth(!1)-s.width():l.outerHeight(!1)-s.height(),f="x"===o?l[0].offsetLeft:l[0].offsetTop,h="x"===o?"left":"top";switch(c){case"function":return t();case"object":var m=t.jquery?t:e(t);if(!m.length)return;return"x"===o?ae(m)[1]:ae(m)[0];case"string":case"number":if(oe(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(d*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(f-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var p=f+parseInt(t.split("+=")[1]);return p>=0?0:Math.abs(p)}if(-1!==t.indexOf("px")&&oe(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(s.height()-l.outerHeight(!1));if("right"===t)return Math.abs(s.width()-l.outerWidth(!1));if("first"===t||"last"===t){var m=l.find(":"+t);return"x"===o?ae(m)[1]:ae(m)[0]}return e(t).length?"x"===o?ae(e(t))[1]:ae(e(t))[0]:(l.css(h,t),void u.update.call(null,n[0]))}}},N=function(t){function o(){return clearTimeout(f[0].autoUpdate),0===l.parents("html").length?void(l=null):void(f[0].autoUpdate=setTimeout(function(){return c.advanced.updateOnSelectorChange&&(s.poll.change.n=i(),s.poll.change.n!==s.poll.change.o)?(s.poll.change.o=s.poll.change.n,void r(3)):c.advanced.updateOnContentResize&&(s.poll.size.n=l[0].scrollHeight+l[0].scrollWidth+f[0].offsetHeight+l[0].offsetHeight+l[0].offsetWidth,s.poll.size.n!==s.poll.size.o)?(s.poll.size.o=s.poll.size.n,void r(1)):!c.advanced.updateOnImageLoad||"auto"===c.advanced.updateOnImageLoad&&"y"===c.axis||(s.poll.img.n=f.find("img").length,s.poll.img.n===s.poll.img.o)?void((c.advanced.updateOnSelectorChange||c.advanced.updateOnContentResize||c.advanced.updateOnImageLoad)&&o()):(s.poll.img.o=s.poll.img.n,void f.find("img").each(function(){n(this)}))},c.advanced.autoUpdateTimeout))}function n(t){function o(e,t){return function(){
35914return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(d[2]),r(2)}if(e(t).hasClass(d[2]))return void r();var n=new Image;n.onload=o(n,a),n.src=t.src}function i(){c.advanced.updateOnSelectorChange===!0&&(c.advanced.updateOnSelectorChange="*");var e=0,t=f.find(c.advanced.updateOnSelectorChange);return c.advanced.updateOnSelectorChange&&t.length>0&&t.each(function(){e+=this.offsetHeight+this.offsetWidth}),e}function r(e){clearTimeout(f[0].autoUpdate),u.update.call(null,l[0],e)}var l=e(this),s=l.data(a),c=s.opt,f=e("#mCSB_"+s.idx+"_container");return t?(clearTimeout(f[0].autoUpdate),void $(f[0],"autoUpdate")):void o()},V=function(e,t,o){return Math.round(e/t)*t-o},Q=function(t){var o=t.data(a),n=e("#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal");n.each(function(){Z.call(this)})},G=function(t,o,n){function i(e){return s&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function r(){return[c.callbacks.alwaysTriggerOffsets||w>=S[0]+y,c.callbacks.alwaysTriggerOffsets||-B>=w]}function l(){var e=[h[0].offsetTop,h[0].offsetLeft],o=[x[0].offsetTop,x[0].offsetLeft],a=[h.outerHeight(!1),h.outerWidth(!1)],i=[f.height(),f.width()];t[0].mcs={content:h,top:e[0],left:e[1],draggerTop:o[0],draggerLeft:o[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-i[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-i[1])),direction:n.dir}}var s=t.data(a),c=s.opt,d={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(d,n),u=[n.dur,n.drag?0:n.dur],f=e("#mCSB_"+s.idx),h=e("#mCSB_"+s.idx+"_container"),m=h.parent(),p=c.callbacks.onTotalScrollOffset?Y.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?Y.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(s.trigger=n.trigger,0===m.scrollTop()&&0===m.scrollLeft()||(e(".mCSB_"+s.idx+"_scrollbar").css("visibility","visible"),m.scrollTop(0).scrollLeft(0)),"_resetY"!==o||s.contentReset.y||(i("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),s.contentReset.y=1),"_resetX"!==o||s.contentReset.x||(i("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),s.contentReset.x=1),"_resetY"!==o&&"_resetX"!==o){if(!s.contentReset.y&&t[0].mcs||!s.overflowed[0]||(i("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),s.contentReset.x=null),!s.contentReset.x&&t[0].mcs||!s.overflowed[1]||(i("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),s.contentReset.x=null),c.snapAmount){var v=c.snapAmount instanceof Array?"x"===n.dir?c.snapAmount[1]:c.snapAmount[0]:c.snapAmount;o=V(o,v,c.snapOffset)}switch(n.dir){case"x":var x=e("#mCSB_"+s.idx+"_dragger_horizontal"),_="left",w=h[0].offsetLeft,S=[f.width()-h.outerWidth(!1),x.parent().width()-x.width()],b=[o,0===o?0:o/s.scrollRatio.x],y=p[1],B=g[1],T=y>0?y/s.scrollRatio.x:0,k=B>0?B/s.scrollRatio.x:0;break;case"y":var x=e("#mCSB_"+s.idx+"_dragger_vertical"),_="top",w=h[0].offsetTop,S=[f.height()-h.outerHeight(!1),x.parent().height()-x.height()],b=[o,0===o?0:o/s.scrollRatio.y],y=p[0],B=g[0],T=y>0?y/s.scrollRatio.y:0,k=B>0?B/s.scrollRatio.y:0}b[1]<0||0===b[0]&&0===b[1]?b=[0,0]:b[1]>=S[1]?b=[S[0],S[1]]:b[0]=-b[0],t[0].mcs||(l(),i("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(h[0].onCompleteTimeout),J(x[0],_,Math.round(b[1]),u[1],n.scrollEasing),!s.tweenRunning&&(0===w&&b[0]>=0||w===S[0]&&b[0]<=S[0])||J(h[0],_,Math.round(b[0]),u[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!s.tweenRunning&&(i("onScrollStart")&&(l(),c.callbacks.onScrollStart.call(t[0])),s.tweenRunning=!0,C(x),s.cbOffsets=r())},onUpdate:function(){n.callbacks&&n.onUpdate&&i("whileScrolling")&&(l(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(h[0].onCompleteTimeout);var e=h[0].idleTimer||0;h[0].onCompleteTimeout=setTimeout(function(){i("onScroll")&&(l(),c.callbacks.onScroll.call(t[0])),i("onTotalScroll")&&b[1]>=S[1]-T&&s.cbOffsets[0]&&(l(),c.callbacks.onTotalScroll.call(t[0])),i("onTotalScrollBack")&&b[1]<=k&&s.cbOffsets[1]&&(l(),c.callbacks.onTotalScrollBack.call(t[0])),s.tweenRunning=!1,h[0].idleTimer=0,C(x,"hide")},e)}}})}},J=function(e,t,o,a,n,i,r){function l(){S.stop||(x||m.call(),x=K()-v,s(),x>=S.time&&(S.time=x>S.time?x+f-(x-S.time):x+f-1,S.time<x+1&&(S.time=x+1)),S.time<a?S.id=h(l):g.call())}function s(){a>0?(S.currVal=u(S.time,_,b,a,n),w[t]=Math.round(S.currVal)+"px"):w[t]=o+"px",p.call()}function c(){f=1e3/60,S.time=x+f,h=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return s(),setTimeout(e,.01)},S.id=h(l)}function d(){null!=S.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(S.id):clearTimeout(S.id),S.id=null)}function u(e,t,o,a,n){switch(n){case"linear":case"mcsLinear":return o*e/a+t;case"mcsLinearOut":return e/=a,e--,o*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?o/2*e*e+t:(e--,-o/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?o/2*Math.pow(2,10*(e-1))+t:(e--,o/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?o/2*e*e*e+t:(e-=2,o/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-o*(e*e*e*e-1)+t;case"easeOutStrong":return o*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var i=(e/=a)*e,r=i*e;return t+o*(.499999999999997*r*i+-2.5*i*i+5.5*r+-6.5*i+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var f,h,r=r||{},m=r.onStart||function(){},p=r.onUpdate||function(){},g=r.onComplete||function(){},v=K(),x=0,_=e.offsetTop,w=e.style,S=e._mTween[t];"left"===t&&(_=e.offsetLeft);var b=o-_;S.stop=0,"none"!==i&&d(),c()},K=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},Z=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],o=0;o<t.length;o++){var a=t[o];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},$=function(e,t){try{delete e[t]}catch(o){e[t]=null}},ee=function(e){return!(e.which&&1!==e.which)},te=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},oe=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ae=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]},ne=function(){function e(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}var t=e();return t?document[t]:!1};e.fn[o]=function(t){return u[t]?u[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):u.init.apply(this,arguments)},e[o]=function(t){return u[t]?u[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):u.init.apply(this,arguments)},e[o].defaults=i,window[o]=!0,e(window).bind("load",function(){e(n)[o](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var o,a,n=e(t),i=n.parents(".mCSB_container");if(i.length)return o=i.parent(),a=[i[0].offsetTop,i[0].offsetLeft],a[0]+ae(n)[0]>=0&&a[0]+ae(n)[0]<o.height()-n.outerHeight(!1)&&a[1]+ae(n)[1]>=0&&a[1]+ae(n)[1]<o.width()-n.outerWidth(!1)},mcsInSight:e.expr[":"].mcsInSight||function(t,o,a){var n,i,r,l,s=e(t),c=s.parents(".mCSB_container"),d="exact"===a[3]?[[1,0],[1,0]]:[[.9,.1],[.6,.4]];if(c.length)return n=[s.outerHeight(!1),s.outerWidth(!1)],r=[c[0].offsetTop+ae(s)[0],c[0].offsetLeft+ae(s)[1]],i=[c.parent()[0].offsetHeight,c.parent()[0].offsetWidth],l=[n[0]<i[0]?d[0]:d[1],n[1]<i[1]?d[0]:d[1]],r[0]-i[0]*l[0][0]<0&&r[0]+n[0]-i[0]*l[0][1]>=0&&r[1]-i[1]*l[1][0]<0&&r[1]+n[1]-i[1]*l[1][1]>=0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var o=e(t).data(a);if(o)return o.overflowed[0]||o.overflowed[1]}})})})});
35914
35915/* End */
35916;
35917; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_max/js/jquery.autocomplete.js?166601759332714";s:6:"source";s:52:"/local/templates/aspro_max/js/jquery.autocomplete.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
35918/**
35919*  Ajax Autocomplete for jQuery, version %version%
35920*  (c) 2017 Tomas Kirda
35921*
35922*  Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
35923*  For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
35924*/
35925
35926/*jslint  browser: true, white: true, single: true, this: true, multivar: true */
35927/*global define, window, document, jQuery, exports, require */
35928
35929// Expose plugin as an AMD module if AMD loader is present:
35930(function (factory) {
35931    "use strict";
35932    if (typeof define === 'function' && define.amd) {
35933        // AMD. Register as an anonymous module.
35934        define(['jquery'], factory);
35935    } else if (typeof exports === 'object' && typeof require === 'function') {
35936        // Browserify
35937        factory(require('jquery'));
35938    } else {
35939        // Browser globals
35940        factory(jQuery);
35941    }
35942}(function ($) {
35943    'use strict';
35944
35945    var
35946        utils = (function () {
35947            return {
35948                escapeRegExChars: function (value) {
35949                    return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
35950                },
35951                createNode: function (containerClass) {
35952                    var div = document.createElement('div');
35953                    div.className = containerClass;
35954                    div.style.position = 'absolute';
35955                    div.style.display = 'none';
35956                    return div;
35957                }
35958            };
35959        }()),
35960
35961        keys = {
35962            ESC: 27,
35963            TAB: 9,
35964            RETURN: 13,
35965            LEFT: 37,
35966            UP: 38,
35967            RIGHT: 39,
35968            DOWN: 40
35969        },
35970
35971        noop = $.noop;
35972
35973    function Autocomplete(el, options) {
35974        var that = this;
35975
35976        // Shared variables:
35977        that.element = el;
35978        that.el = $(el);
35979        that.suggestions = [];
35980        that.badQueries = [];
35981        that.selectedIndex = -1;
35982        that.currentValue = that.element.value;
35983        that.timeoutId = null;
35984        that.cachedResponse = {};
35985        that.onChangeTimeout = null;
35986        that.onChange = null;
35987        that.isLocal = false;
35988        that.suggestionsContainer = null;
35989        that.noSuggestionsContainer = null;
35990        that.options = $.extend({}, Autocomplete.defaults, options);
35991        that.classes = {
35992            selected: 'autocomplete-selected',
35993            suggestion: 'autocomplete-suggestion'
35994        };
35995        that.hint = null;
35996        that.hintValue = '';
35997        that.selection = null;
35998
35999        // Initialize and set options:
36000        that.initialize();
36001        that.setOptions(options);
36002    }
36003
36004    Autocomplete.utils = utils;
36005
36006    $.Autocomplete = Autocomplete;
36007
36008    Autocomplete.defaults = {
36009            ajaxSettings: {},
36010            autoSelectFirst: false,
36011            appendTo: 'body',
36012            serviceUrl: null,
36013            lookup: null,
36014            onSelect: null,
36015            width: 'auto',
36016            minChars: 1,
36017            maxHeight: 300,
36018            deferRequestBy: 0,
36019            params: {},
36020            formatResult: _formatResult,
36021            formatGroup: _formatGroup,
36022            delimiter: null,
36023            zIndex: 9999,
36024            type: 'GET',
36025            noCache: false,
36026            onSearchStart: noop,
36027            onSearchComplete: noop,
36028            onSearchError: noop,
36029            preserveInput: false,
36030            containerClass: 'autocomplete-suggestions',
36031            tabDisabled: false,
36032            dataType: 'text',
36033            currentRequest: null,
36034            triggerSelectOnValidInput: true,
36035            preventBadQueries: true,
36036            lookupFilter: _lookupFilter,
36037            paramName: 'query',
36038            transformResult: _transformResult,
36039            showNoSuggestionNotice: false,
36040            noSuggestionNotice: 'No results',
36041            orientation: 'bottom',
36042            forceFixPosition: false
36043    };
36044
36045    function _lookupFilter(suggestion, originalQuery, queryLowerCase) {
36046        return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
36047    };
36048
36049    function _transformResult(response) {
36050        return typeof response === 'string' ? $.parseJSON(response) : response;
36051    };
36052
36053    function _formatResult(suggestion, currentValue) {
36054        // Do not replace anything if the current value is empty
36055        if (!currentValue) {
36056            return suggestion.value;
36057        }
36058        
36059        var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
36060
36061        return suggestion.value
36062            .replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
36063            .replace(/&/g, '&amp;')
36064            .replace(/</g, '&lt;')
36065            .replace(/>/g, '&gt;')
36066            .replace(/"/g, '&quot;')
36067            .replace(/&lt;(\/?strong)&gt;/g, '<$1>');
36068    };
36069
36070    function _formatGroup(suggestion, category) {
36071        return '<div class="autocomplete-group">' + category + '</div>';
36072    };
36073
36074    Autocomplete.prototype = {
36075
36076        initialize: function () {
36077            var that = this,
36078                suggestionSelector = '.' + that.classes.suggestion,
36079                selected = that.classes.selected,
36080                options = that.options,
36081                container;
36082
36083            // Remove autocomplete attribute to prevent native suggestions:
36084            that.element.setAttribute('autocomplete', 'off');
36085
36086            // html() deals with many types: htmlString or Element or Array or jQuery
36087            that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>')
36088                                          .html(this.options.noSuggestionNotice).get(0);
36089
36090            that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass);
36091
36092            container = $(that.suggestionsContainer);
36093
36094            container.appendTo(options.appendTo || 'body');
36095
36096            // Only set width if it was provided:
36097            if (options.width !== 'auto') {
36098                container.css('width', options.width);
36099            }
36100
36101            // Listen for mouse over event on suggestions list:
36102            container.on('mouseover.autocomplete', suggestionSelector, function () {
36103                that.activate($(this).data('index'));
36104            });
36105
36106            // Deselect active element when mouse leaves suggestions container:
36107            container.on('mouseout.autocomplete', function () {
36108                that.selectedIndex = -1;
36109                container.children('.' + selected).removeClass(selected);
36110            });
36111
36112
36113            // Listen for click event on suggestions list:
36114            container.on('click.autocomplete', suggestionSelector, function () {
36115                that.select($(this).data('index'));
36116            });
36117
36118            container.on('click.autocomplete', function () {
36119                clearTimeout(that.blurTimeoutId);
36120            })
36121
36122            that.fixPositionCapture = function () {
36123                if (that.visible) {
36124                    that.fixPosition();
36125                }
36126            };
36127
36128            $(window).on('resize.autocomplete', that.fixPositionCapture);
36129
36130            that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
36131            that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
36132            that.el.on('blur.autocomplete', function () { that.onBlur(); });
36133            that.el.on('focus.autocomplete', function () { that.onFocus(); });
36134            that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
36135            that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); });
36136        },
36137
36138        onFocus: function () {
36139            var that = this;
36140
36141            that.fixPosition();
36142
36143            if (that.el.val().length >= that.options.minChars) {
36144                that.onValueChange();
36145            }
36146        },
36147
36148        onBlur: function () {
36149            var that = this;
36150
36151            // If user clicked on a suggestion, hide() will
36152            // be canceled, otherwise close suggestions
36153            that.blurTimeoutId = setTimeout(function () {
36154                that.hide();
36155            }, 200);
36156        },
36157        
36158        abortAjax: function () {
36159            var that = this;
36160            if (that.currentRequest) {
36161                that.currentRequest.abort();
36162                that.currentRequest = null;
36163            }
36164        },
36165
36166        setOptions: function (suppliedOptions) {
36167            var that = this,
36168                options = that.options;
36169
36170            this.options = $.extend({}, options, suppliedOptions);
36171
36172            that.isLocal = $.isArray(options.lookup);
36173
36174            if (that.isLocal) {
36175                options.lookup = that.verifySuggestionsFormat(options.lookup);
36176            }
36177
36178            options.orientation = that.validateOrientation(options.orientation, 'bottom');
36179
36180            // Adjust height, width and z-index:
36181            $(that.suggestionsContainer).css({
36182                'max-height': options.maxHeight + 'px',
36183                'width': options.width + 'px',
36184                'z-index': options.zIndex
36185            });
36186        },
36187
36188
36189        clearCache: function () {
36190            this.cachedResponse = {};
36191            this.badQueries = [];
36192        },
36193
36194        clear: function () {
36195            this.clearCache();
36196            this.currentValue = '';
36197            this.suggestions = [];
36198        },
36199
36200        disable: function () {
36201            var that = this;
36202            that.disabled = true;
36203            clearTimeout(that.onChangeTimeout);
36204            that.abortAjax();
36205        },
36206
36207        enable: function () {
36208            this.disabled = false;
36209        },
36210
36211        fixPosition: function () {
36212            // Use only when container has already its content
36213
36214            var that = this,
36215                $container = $(that.suggestionsContainer),
36216                containerParent = $container.parent().get(0);
36217            // Fix position automatically when appended to body.
36218            // In other cases force parameter must be given.
36219            if (containerParent !== document.body && !that.options.forceFixPosition) {
36220                return;
36221            }
36222
36223            // Choose orientation
36224            var orientation = that.options.orientation,
36225                containerHeight = $container.outerHeight(),
36226                height = that.el.outerHeight(),
36227                offset = that.el.offset(),
36228                styles = { 'top': offset.top, 'left': offset.left };
36229
36230            if (orientation === 'auto') {
36231                var viewPortHeight = $(window).height(),
36232                    scrollTop = $(window).scrollTop(),
36233                    topOverflow = -scrollTop + offset.top - containerHeight,
36234                    bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
36235
36236                orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
36237            }
36238
36239            if (orientation === 'top') {
36240                styles.top += -containerHeight;
36241            } else {
36242                styles.top += height;
36243            }
36244
36245            // If container is not positioned to body,
36246            // correct its position using offset parent offset
36247            if(containerParent !== document.body) {
36248                var opacity = $container.css('opacity'),
36249                    parentOffsetDiff;
36250
36251                    if (!that.visible){
36252                        $container.css('opacity', 0).show();
36253                    }
36254
36255                parentOffsetDiff = $container.offsetParent().offset();
36256                styles.top -= parentOffsetDiff.top;
36257                styles.left -= parentOffsetDiff.left;
36258
36259                if (!that.visible){
36260                    $container.css('opacity', opacity).hide();
36261                }
36262            }
36263
36264            if (that.options.width === 'auto') {
36265                styles.width = that.el.outerWidth() + 'px';
36266            }
36267
36268            $container.css(styles);
36269        },
36270
36271        isCursorAtEnd: function () {
36272            var that = this,
36273                valLength = that.el.val().length,
36274                selectionStart = that.element.selectionStart,
36275                range;
36276
36277            if (typeof selectionStart === 'number') {
36278                return selectionStart === valLength;
36279            }
36280            if (document.selection) {
36281                range = document.selection.createRange();
36282                range.moveStart('character', -valLength);
36283                return valLength === range.text.length;
36284            }
36285            return true;
36286        },
36287
36288        onKeyPress: function (e) {
36289            var that = this;
36290
36291            // If suggestions are hidden and user presses arrow down, display suggestions:
36292            if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
36293                that.suggest();
36294                return;
36295            }
36296
36297            if (that.disabled || !that.visible) {
36298                return;
36299            }
36300
36301            switch (e.which) {
36302                case keys.ESC:
36303                    that.el.val(that.currentValue);
36304                    that.hide();
36305                    break;
36306                case keys.RIGHT:
36307                    if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
36308                        that.selectHint();
36309                        break;
36310                    }
36311                    return;
36312                case keys.TAB:
36313                    if (that.hint && that.options.onHint) {
36314                        that.selectHint();
36315                        return;
36316                    }
36317                    if (that.selectedIndex === -1) {
36318                        that.hide();
36319                        return;
36320                    }
36321                    that.select(that.selectedIndex);
36322                    if (that.options.tabDisabled === false) {
36323                        return;
36324                    }
36325                    break;
36326                case keys.RETURN:
36327                    if (that.selectedIndex === -1) {
36328                        that.hide();
36329                        return;
36330                    }
36331                    that.select(that.selectedIndex);
36332                    break;
36333                case keys.UP:
36334                    that.moveUp();
36335                    break;
36336                case keys.DOWN:
36337                    that.moveDown();
36338                    break;
36339                default:
36340                    return;
36341            }
36342
36343            // Cancel event if function did not return:
36344            e.stopImmediatePropagation();
36345            e.preventDefault();
36346        },
36347
36348        onKeyUp: function (e) {
36349            var that = this;
36350
36351            if (that.disabled) {
36352                return;
36353            }
36354
36355            switch (e.which) {
36356                case keys.UP:
36357                case keys.DOWN:
36358                    return;
36359            }
36360
36361            clearTimeout(that.onChangeTimeout);
36362
36363            if (that.currentValue !== that.el.val()) {
36364                that.findBestHint();
36365                if (that.options.deferRequestBy > 0) {
36366                    // Defer lookup in case when value changes very quickly:
36367                    that.onChangeTimeout = setTimeout(function () {
36368                        that.onValueChange();
36369                    }, that.options.deferRequestBy);
36370                } else {
36371                    that.onValueChange();
36372                }
36373            }
36374        },
36375
36376        onValueChange: function () {
36377            var that = this,
36378                options = that.options,
36379                value = that.el.val(),
36380                query = that.getQuery(value);
36381
36382            if (that.selection && that.currentValue !== query) {
36383                that.selection = null;
36384                (options.onInvalidateSelection || $.noop).call(that.element);
36385            }
36386
36387            clearTimeout(that.onChangeTimeout);
36388            that.currentValue = value;
36389            that.selectedIndex = -1;
36390
36391            // Check existing suggestion for the match before proceeding:
36392            if (options.triggerSelectOnValidInput && that.isExactMatch(query)) {
36393                that.select(0);
36394                return;
36395            }
36396
36397            if (query.length < options.minChars) {
36398                that.hide();
36399            } else {
36400                that.getSuggestions(query);
36401            }
36402        },
36403
36404        isExactMatch: function (query) {
36405            var suggestions = this.suggestions;
36406
36407            return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase());
36408        },
36409
36410        getQuery: function (value) {
36411            var delimiter = this.options.delimiter,
36412                parts;
36413
36414            if (!delimiter) {
36415                return value;
36416            }
36417            parts = value.split(delimiter);
36418            return $.trim(parts[parts.length - 1]);
36419        },
36420
36421        getSuggestionsLocal: function (query) {
36422            var that = this,
36423                options = that.options,
36424                queryLowerCase = query.toLowerCase(),
36425                filter = options.lookupFilter,
36426                limit = parseInt(options.lookupLimit, 10),
36427                data;
36428
36429            data = {
36430                suggestions: $.grep(options.lookup, function (suggestion) {
36431                    return filter(suggestion, query, queryLowerCase);
36432                })
36433            };
36434
36435            if (limit && data.suggestions.length > limit) {
36436                data.suggestions = data.suggestions.slice(0, limit);
36437            }
36438
36439            return data;
36440        },
36441
36442        getSuggestions: function (q) {
36443            var response,
36444                that = this,
36445                options = that.options,
36446                serviceUrl = options.serviceUrl,
36447                params,
36448                cacheKey,
36449                ajaxSettings;
36450
36451            options.params[options.paramName] = q;
36452
36453            if (options.onSearchStart.call(that.element, options.params) === false) {
36454                return;
36455            }
36456
36457            params = options.ignoreParams ? null : options.params;
36458
36459            if ($.isFunction(options.lookup)){
36460                options.lookup(q, function (data) {
36461                    that.suggestions = data.suggestions;
36462                    that.suggest();
36463                    options.onSearchComplete.call(that.element, q, data.suggestions);
36464                });
36465                return;
36466            }
36467
36468            if (that.isLocal) {
36469                response = that.getSuggestionsLocal(q);
36470            } else {
36471                if ($.isFunction(serviceUrl)) {
36472                    serviceUrl = serviceUrl.call(that.element, q);
36473                }
36474                cacheKey = serviceUrl + '?' + $.param(params || {});
36475                response = that.cachedResponse[cacheKey];
36476            }
36477
36478            if (response && $.isArray(response.suggestions)) {
36479                that.suggestions = response.suggestions;
36480                that.suggest();
36481                options.onSearchComplete.call(that.element, q, response.suggestions);
36482            } else if (!that.isBadQuery(q)) {
36483                that.abortAjax();
36484
36485                ajaxSettings = {
36486                    url: serviceUrl,
36487                    data: params,
36488                    type: options.type,
36489                    dataType: options.dataType
36490                };
36491
36492                $.extend(ajaxSettings, options.ajaxSettings);
36493
36494                that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
36495                    var result;
36496                    that.currentRequest = null;
36497                    result = options.transformResult(data, q);
36498                    that.processResponse(result, q, cacheKey);
36499                    options.onSearchComplete.call(that.element, q, result.suggestions);
36500                }).fail(function (jqXHR, textStatus, errorThrown) {
36501                    options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
36502                });
36503            } else {
36504                options.onSearchComplete.call(that.element, q, []);
36505            }
36506        },
36507
36508        isBadQuery: function (q) {
36509            if (!this.options.preventBadQueries){
36510                return false;
36511            }
36512
36513            var badQueries = this.badQueries,
36514                i = badQueries.length;
36515
36516            while (i--) {
36517                if (q.indexOf(badQueries[i]) === 0) {
36518                    return true;
36519                }
36520            }
36521
36522            return false;
36523        },
36524
36525        hide: function () {
36526            var that = this,
36527                container = $(that.suggestionsContainer);
36528
36529            if ($.isFunction(that.options.onHide) && that.visible) {
36530                that.options.onHide.call(that.element, container);
36531            }
36532
36533            that.visible = false;
36534            that.selectedIndex = -1;
36535            clearTimeout(that.onChangeTimeout);
36536            $(that.suggestionsContainer).hide();
36537            that.signalHint(null);
36538        },
36539
36540        suggest: function () {
36541            if (!this.suggestions.length) {
36542                if (this.options.showNoSuggestionNotice) {
36543                    this.noSuggestions();
36544                } else {
36545                    this.hide();
36546                }
36547                return;
36548            }
36549
36550            var that = this,
36551                options = that.options,
36552                groupBy = options.groupBy,
36553                formatResult = options.formatResult,
36554                value = that.getQuery(that.currentValue),
36555                className = that.classes.suggestion,
36556                classSelected = that.classes.selected,
36557                container = $(that.suggestionsContainer),
36558                noSuggestionsContainer = $(that.noSuggestionsContainer),
36559                beforeRender = options.beforeRender,
36560                html = '',
36561                category,
36562                formatGroup = function (suggestion, index) {
36563                        var currentCategory = suggestion.data[groupBy];
36564
36565                        if (category === currentCategory){
36566                            return '';
36567                        }
36568
36569                        category = currentCategory;
36570
36571                        return options.formatGroup(suggestion, category);
36572                    };
36573
36574            if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
36575                that.select(0);
36576                return;
36577            }
36578
36579            // Build suggestions inner HTML:
36580            $.each(that.suggestions, function (i, suggestion) {
36581                if (groupBy){
36582                    html += formatGroup(suggestion, value, i);
36583                }
36584
36585                html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
36586            });
36587
36588            this.adjustContainerWidth();
36589
36590            noSuggestionsContainer.detach();
36591            container.html(html);
36592
36593            if ($.isFunction(beforeRender)) {
36594                beforeRender.call(that.element, container, that.suggestions);
36595            }
36596
36597            that.fixPosition();
36598            container.show();
36599
36600            // Select first value by default:
36601            if (options.autoSelectFirst) {
36602                that.selectedIndex = 0;
36603                container.scrollTop(0);
36604                container.children('.' + className).first().addClass(classSelected);
36605            }
36606
36607            that.visible = true;
36608            that.findBestHint();
36609        },
36610
36611        noSuggestions: function() {
36612             var that = this,
36613                 beforeRender = that.options.beforeRender,
36614                 container = $(that.suggestionsContainer),
36615                 noSuggestionsContainer = $(that.noSuggestionsContainer);
36616
36617            this.adjustContainerWidth();
36618
36619            // Some explicit steps. Be careful here as it easy to get
36620            // noSuggestionsContainer removed from DOM if not detached properly.
36621            noSuggestionsContainer.detach();
36622
36623            // clean suggestions if any
36624            container.empty(); 
36625            container.append(noSuggestionsContainer);
36626
36627            if ($.isFunction(beforeRender)) {
36628                beforeRender.call(that.element, container, that.suggestions);
36629            }
36630
36631            that.fixPosition();
36632
36633            container.show();
36634            that.visible = true;
36635        },
36636
36637        adjustContainerWidth: function() {
36638            var that = this,
36639                options = that.options,
36640                width,
36641                container = $(that.suggestionsContainer);
36642
36643            // If width is auto, adjust width before displaying suggestions,
36644            // because if instance was created before input had width, it will be zero.
36645            // Also it adjusts if input width has changed.
36646            if (options.width === 'auto') {
36647                width = that.el.outerWidth();
36648                container.css('width', width > 0 ? width : 300);
36649            } else if(options.width === 'flex') {
36650                // Trust the source! Unset the width property so it will be the max length
36651                // the containing elements.
36652                container.css('width', '');
36653            }
36654        },
36655
36656        findBestHint: function () {
36657            var that = this,
36658                value = that.el.val().toLowerCase(),
36659                bestMatch = null;
36660
36661            if (!value) {
36662                return;
36663            }
36664
36665            $.each(that.suggestions, function (i, suggestion) {
36666                var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
36667                if (foundMatch) {
36668                    bestMatch = suggestion;
36669                }
36670                return !foundMatch;
36671            });
36672
36673            that.signalHint(bestMatch);
36674        },
36675
36676        signalHint: function (suggestion) {
36677            var hintValue = '',
36678                that = this;
36679            if (suggestion) {
36680                hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
36681            }
36682            if (that.hintValue !== hintValue) {
36683                that.hintValue = hintValue;
36684                that.hint = suggestion;
36685                (this.options.onHint || $.noop)(hintValue);
36686            }
36687        },
36688
36689        verifySuggestionsFormat: function (suggestions) {
36690            // If suggestions is string array, convert them to supported format:
36691            if (suggestions.length && typeof suggestions[0] === 'string') {
36692                return $.map(suggestions, function (value) {
36693                    return { value: value, data: null };
36694                });
36695            }
36696
36697            return suggestions;
36698        },
36699
36700        validateOrientation: function(orientation, fallback) {
36701            orientation = $.trim(orientation || '').toLowerCase();
36702
36703            if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
36704                orientation = fallback;
36705            }
36706
36707            return orientation;
36708        },
36709
36710        processResponse: function (result, originalQuery, cacheKey) {
36711            var that = this,
36712                options = that.options;
36713
36714            result.suggestions = that.verifySuggestionsFormat(result.suggestions);
36715
36716            // Cache results if cache is not disabled:
36717            if (!options.noCache) {
36718                that.cachedResponse[cacheKey] = result;
36719                if (options.preventBadQueries && !result.suggestions.length) {
36720                    that.badQueries.push(originalQuery);
36721                }
36722            }
36723
36724            // Return if originalQuery is not matching current query:
36725            if (originalQuery !== that.getQuery(that.currentValue)) {
36726                return;
36727            }
36728
36729            that.suggestions = result.suggestions;
36730            that.suggest();
36731        },
36732
36733        activate: function (index) {
36734            var that = this,
36735                activeItem,
36736                selected = that.classes.selected,
36737                container = $(that.suggestionsContainer),
36738                children = container.find('.' + that.classes.suggestion);
36739
36740            container.find('.' + selected).removeClass(selected);
36741
36742            that.selectedIndex = index;
36743
36744            if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
36745                activeItem = children.get(that.selectedIndex);
36746                $(activeItem).addClass(selected);
36747                return activeItem;
36748            }
36749
36750            return null;
36751        },
36752
36753        selectHint: function () {
36754            var that = this,
36755                i = $.inArray(that.hint, that.suggestions);
36756
36757            that.select(i);
36758        },
36759
36760        select: function (i) {
36761            var that = this;
36762            that.hide();
36763            that.onSelect(i);
36764        },
36765
36766        moveUp: function () {
36767            var that = this;
36768
36769            if (that.selectedIndex === -1) {
36770                return;
36771            }
36772
36773            if (that.selectedIndex === 0) {
36774                $(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
36775                that.selectedIndex = -1;
36776                that.el.val(that.currentValue);
36777                that.findBestHint();
36778                return;
36779            }
36780
36781            that.adjustScroll(that.selectedIndex - 1);
36782        },
36783
36784        moveDown: function () {
36785            var that = this;
36786
36787            if (that.selectedIndex === (that.suggestions.length - 1)) {
36788                return;
36789            }
36790
36791            that.adjustScroll(that.selectedIndex + 1);
36792        },
36793
36794        adjustScroll: function (index) {
36795            var that = this,
36796                activeItem = that.activate(index);
36797
36798            if (!activeItem) {
36799                return;
36800            }
36801
36802            var offsetTop,
36803                upperBound,
36804                lowerBound,
36805                heightDelta = $(activeItem).outerHeight();
36806
36807            offsetTop = activeItem.offsetTop;
36808            upperBound = $(that.suggestionsContainer).scrollTop();
36809            lowerBound = upperBound + that.options.maxHeight - heightDelta;
36810
36811            if (offsetTop < upperBound) {
36812                $(that.suggestionsContainer).scrollTop(offsetTop);
36813            } else if (offsetTop > lowerBound) {
36814                $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
36815            }
36816
36817            if (!that.options.preserveInput) {
36818                that.el.val(that.getValue(that.suggestions[index].value));
36819            }
36820            that.signalHint(null);
36821        },
36822
36823        onSelect: function (index) {
36824            var that = this,
36825                onSelectCallback = that.options.onSelect,
36826                suggestion = that.suggestions[index];
36827
36828            that.currentValue = that.getValue(suggestion.value);
36829
36830            if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
36831                that.el.val(that.currentValue);
36832            }
36833
36834            that.signalHint(null);
36835            that.suggestions = [];
36836            that.selection = suggestion;
36837
36838            if ($.isFunction(onSelectCallback)) {
36839                onSelectCallback.call(that.element, suggestion);
36840            }
36841        },
36842
36843        getValue: function (value) {
36844            var that = this,
36845                delimiter = that.options.delimiter,
36846                currentValue,
36847                parts;
36848
36849            if (!delimiter) {
36850                return value;
36851            }
36852
36853            currentValue = that.currentValue;
36854            parts = currentValue.split(delimiter);
36855
36856            if (parts.length === 1) {
36857                return value;
36858            }
36859
36860            return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
36861        },
36862
36863        dispose: function () {
36864            var that = this;
36865            that.el.off('.autocomplete').removeData('autocomplete');
36866            $(window).off('resize.autocomplete', that.fixPositionCapture);
36867            $(that.suggestionsContainer).remove();
36868        }
36869    };
36870
36871    // Create chainable jQuery plugin:
36872    $.fn.devbridgeAutocomplete = function (options, args) {
36873        var dataKey = 'autocomplete';
36874        // If function invoked without argument return
36875        // instance of the first matched element:
36876        if (!arguments.length) {
36877            return this.first().data(dataKey);
36878        }
36879
36880        return this.each(function () {
36881            var inputElement = $(this),
36882                instance = inputElement.data(dataKey);
36883
36884            if (typeof options === 'string') {
36885                if (instance && typeof instance[options] === 'function') {
36886                    instance[options](args);
36887                }
36888            } else {
36889                // If instance already exists, destroy it:
36890                if (instance && instance.dispose) {
36891                    instance.dispose();
36892                }
36893                instance = new Autocomplete(this, options);
36894                inputElement.data(dataKey, instance);
36895            }
36896        });
36897    };
36898
36899    // Don't overwrite if it already exists
36900    if (!$.fn.autocomplete) {
36901        $.fn.autocomplete = $.fn.devbridgeAutocomplete;
36902    }
36903}));
36904
36905/* End */
36906;
36907; /* Start:"a:4:{s:4:"full";s:64:"/bitrix/components/bitrix/search.title/script.js?177454507810573";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
36908function JCTitleSearch(arParams)
36909{
36910	var _this = this;
36911
36912	this.arParams = {
36913		'AJAX_PAGE': BX.util.htmlspecialcharsback(arParams.AJAX_PAGE),
36914		'CONTAINER_ID': arParams.CONTAINER_ID,
36915		'INPUT_ID': arParams.INPUT_ID,
36916		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN, 10),
36917	};
36918
36919	if (arParams.WAIT_IMAGE)
36920	{
36921		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
36922	}
36923
36924	if (this.arParams.MIN_QUERY_LEN <= 0)
36925	{
36926		this.arParams.MIN_QUERY_LEN = 1;
36927	}
36928
36929	this.cache = [];
36930	this.cache_key = null;
36931
36932	this.startText = '';
36933	this.running = false;
36934	this.runningCall = false;
36935	this.currentRow = -1;
36936	this.RESULT = null;
36937	this.CONTAINER = null;
36938	this.INPUT = null;
36939	this.WAIT = null;
36940
36941	this.ShowResult = function(result)
36942	{
36943		if (BX.type.isString(result))
36944		{
36945			_this.RESULT.innerHTML = result;
36946		}
36947
36948		_this.RESULT.style.display = _this.RESULT.innerHTML === '' ? 'none' : 'block';
36949		var pos = _this.adjustResultNode();
36950
36951		// adjust left column to be an outline
36952		var resultPosition = null;
36953		var th = null;
36954		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
36955		if (tbl)
36956		{
36957			th = BX.findChild(tbl, { 'tag': 'th' }, true);
36958		}
36959
36960		if (th)
36961		{
36962			var tablePosition = BX.pos(tbl);
36963			tablePosition.width = tablePosition.right - tablePosition.left;
36964
36965			var tableHeaderPosition = BX.pos(th);
36966			tableHeaderPosition.width = tableHeaderPosition.right - tableHeaderPosition.left;
36967			th.style.width = tableHeaderPosition.width + 'px';
36968
36969			_this.RESULT.style.width = (pos.width + tableHeaderPosition.width) + 'px';
36970
36971			// Move table to left by width of the first column
36972			_this.RESULT.style.left = (pos.left - tableHeaderPosition.width - 1) + 'px';
36973
36974			// Shrink table when it's too wide
36975			if ((tablePosition.width - tableHeaderPosition.width) > pos.width)
36976			{
36977				_this.RESULT.style.width = (pos.width + tableHeaderPosition.width - 1) + 'px';
36978			}
36979
36980			// Check if table is too wide and shrink result div to it's width
36981			tablePosition = BX.pos(tbl);
36982			resultPosition = BX.pos(_this.RESULT);
36983			if (resultPosition.right > tablePosition.right)
36984			{
36985				_this.RESULT.style.width = (tablePosition.right - tablePosition.left) + 'px';
36986			}
36987		}
36988
36989		var fade = false;
36990		if (tbl)
36991		{
36992			fade = BX.findChild(_this.RESULT, { 'class': 'title-search-fader' }, true);
36993		}
36994
36995		if (fade && th)
36996		{
36997			resultPosition = BX.pos(_this.RESULT);
36998			fade.style.left = (resultPosition.right - resultPosition.left - 18) + 'px';
36999			fade.style.width = 18 + 'px';
37000			fade.style.top = 0 + 'px';
37001			fade.style.height = (resultPosition.bottom - resultPosition.top) + 'px';
37002			fade.style.display = 'block';
37003		}
37004	};
37005
37006	this.onKeyPress = function(keyCode)
37007	{
37008		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
37009		if (!tbl)
37010		{
37011			return false;
37012		}
37013
37014		var i = 0;
37015		var cnt = tbl.rows.length;
37016
37017		switch (keyCode)
37018		{
37019			case 27: // escape key - close search div
37020				_this.RESULT.style.display = 'none';
37021				_this.currentRow = -1;
37022				_this.UnSelectAll();
37023
37024				return true;
37025			case 40: // down key - navigate down on search results
37026				if (_this.RESULT.style.display == 'none')
37027				{
37028					_this.RESULT.style.display = 'block';
37029				}
37030
37031				var first = -1;
37032				for (i = 0; i < cnt; i++)
37033				{
37034					if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
37035					{
37036						if (first == -1)
37037						{
37038							first = i;
37039						}
37040
37041						if (_this.currentRow < i)
37042						{
37043							_this.currentRow = i;
37044							break;
37045						}
37046						else if (tbl.rows[i].className == 'title-search-selected')
37047						{
37048							tbl.rows[i].className = '';
37049						}
37050					}
37051				}
37052
37053				if (i == cnt && _this.currentRow != i)
37054				{
37055					_this.currentRow = first;
37056				}
37057
37058				tbl.rows[_this.currentRow].className = 'title-search-selected';
37059
37060				return true;
37061			case 38: // up key - navigate up on search results
37062				if (_this.RESULT.style.display == 'none')
37063				{
37064					_this.RESULT.style.display = 'block';
37065				}
37066
37067				var last = -1;
37068				for (i = cnt - 1; i >= 0; i--)
37069				{
37070					if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
37071					{
37072						if (last == -1)
37073						{
37074							last = i;
37075						}
37076
37077						if (_this.currentRow > i)
37078						{
37079							_this.currentRow = i;
37080							break;
37081						}
37082						else if (tbl.rows[i].className == 'title-search-selected')
37083						{
37084							tbl.rows[i].className = '';
37085						}
37086					}
37087				}
37088
37089				if (i < 0 && _this.currentRow != i)
37090				{
37091					_this.currentRow = last;
37092				}
37093
37094				tbl.rows[_this.currentRow].className = 'title-search-selected';
37095
37096				return true;
37097			case 13: // enter key - choose current search result
37098				if (_this.RESULT.style.display == 'block')
37099				{
37100					for (i = 0; i < cnt; i++)
37101					{
37102						if (
37103							_this.currentRow == i
37104							&& !BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true)
37105						)
37106						{
37107							var a = BX.findChild(tbl.rows[i], { 'tag': 'a' }, true);
37108							if (a)
37109							{
37110								window.location = a.href;
37111
37112								return true;
37113							}
37114						}
37115					}
37116				}
37117
37118				return false;
37119			default:
37120				break;
37121		}
37122
37123		return false;
37124	};
37125
37126	this.onTimeout = function()
37127	{
37128		_this.onChange(function() {
37129			setTimeout(_this.onTimeout, 500);
37130		});
37131	};
37132
37133	this.onChange = function(callback)
37134	{
37135		if (_this.running)
37136		{
37137			_this.runningCall = true;
37138
37139			return;
37140		}
37141		_this.running = true;
37142
37143		if (_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
37144		{
37145			_this.oldValue = _this.INPUT.value;
37146			if (_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
37147			{
37148				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
37149				if (_this.cache[_this.cache_key] == null)
37150				{
37151					if (_this.WAIT)
37152					{
37153						var pos = BX.pos(_this.INPUT);
37154						var height = (pos.bottom - pos.top) - 2;
37155						_this.WAIT.style.top = (pos.top + 1) + 'px';
37156						_this.WAIT.style.height = height + 'px';
37157						_this.WAIT.style.width = height + 'px';
37158						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
37159						_this.WAIT.style.display = 'block';
37160					}
37161
37162					BX.ajax.post(
37163						_this.arParams.AJAX_PAGE,
37164						{
37165							'ajax_call': 'y',
37166							'INPUT_ID': _this.arParams.INPUT_ID,
37167							'q': _this.INPUT.value,
37168							'l': _this.arParams.MIN_QUERY_LEN,
37169						},
37170						function(result)
37171						{
37172							_this.cache[_this.cache_key] = result;
37173							_this.ShowResult(result);
37174							_this.currentRow = -1;
37175							_this.EnableMouseEvents();
37176							if (_this.WAIT)
37177							{
37178								_this.WAIT.style.display = 'none';
37179							}
37180
37181							if (!!callback)
37182							{
37183								callback();
37184							}
37185
37186							_this.running = false;
37187							if (_this.runningCall)
37188							{
37189								_this.runningCall = false;
37190								_this.onChange();
37191							}
37192						}
37193					);
37194
37195					return;
37196				}
37197
37198				_this.ShowResult(_this.cache[_this.cache_key]);
37199				_this.currentRow = -1;
37200				_this.EnableMouseEvents();
37201			}
37202			else
37203			{
37204				_this.RESULT.style.display = 'none';
37205				_this.currentRow = -1;
37206				_this.UnSelectAll();
37207			}
37208		}
37209
37210		if (!!callback)
37211		{
37212			callback();
37213		}
37214		_this.running = false;
37215	};
37216
37217	this.onScroll = function ()
37218	{
37219		if (BX.type.isElementNode(_this.RESULT)
37220			&& _this.RESULT.style.display !== 'none'
37221			&& _this.RESULT.innerHTML !== ''
37222		)
37223		{
37224			_this.adjustResultNode();
37225		}
37226	};
37227
37228	this.UnSelectAll = function()
37229	{
37230		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
37231		if (tbl)
37232		{
37233			var cnt = tbl.rows.length;
37234			for (var i = 0; i < cnt; i++)
37235			{
37236				tbl.rows[i].className = '';
37237			}
37238		}
37239	};
37240
37241	this.EnableMouseEvents = function()
37242	{
37243		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
37244		if (tbl)
37245		{
37246			var cnt = tbl.rows.length;
37247			for (var i = 0; i < cnt; i++)
37248			{
37249				if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
37250				{
37251					tbl.rows[i].id = 'row_' + i;
37252					tbl.rows[i].onmouseover = function (e) {
37253						if (_this.currentRow != this.id.substr(4))
37254						{
37255							_this.UnSelectAll();
37256							this.className = 'title-search-selected';
37257							_this.currentRow = this.id.substr(4);
37258						}
37259					};
37260
37261					tbl.rows[i].onmouseout = function (e) {
37262						this.className = '';
37263						_this.currentRow = -1;
37264					};
37265				}
37266			}
37267		}
37268	};
37269
37270	this.onFocusLost = function(hide)
37271	{
37272		setTimeout(function() { _this.RESULT.style.display = 'none'; }, 250);
37273	};
37274
37275	this.onFocusGain = function()
37276	{
37277		if (_this.RESULT.innerHTML.length > 0)
37278		{
37279			_this.ShowResult();
37280		}
37281	};
37282
37283	this.onKeyDown = function(e)
37284	{
37285		if (!e)
37286		{
37287			e = window.event;
37288		}
37289
37290		if (_this.RESULT.style.display == 'block' && _this.onKeyPress(e.keyCode))
37291		{
37292			return BX.PreventDefault(e);
37293		}
37294	};
37295
37296	this.adjustResultNode = function()
37297	{
37298		if (!(BX.type.isElementNode(_this.RESULT)
37299			&& BX.type.isElementNode(_this.CONTAINER))
37300		)
37301		{
37302			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
37303		}
37304
37305		var pos = BX.pos(_this.CONTAINER);
37306
37307		_this.RESULT.style.position = 'absolute';
37308		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
37309		_this.RESULT.style.left = pos.left + 'px';
37310		_this.RESULT.style.width = pos.width + 'px';
37311
37312		return pos;
37313	};
37314
37315	this.onContainerLayoutChange = function()
37316	{
37317		if (BX.type.isElementNode(_this.RESULT)
37318			&& _this.RESULT.style.display !== 'none'
37319			&& _this.RESULT.innerHTML !== ''
37320		)
37321		{
37322			_this.adjustResultNode();
37323		}
37324	};
37325
37326	this.Init = function()
37327	{
37328		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
37329		BX.addCustomEvent(this.CONTAINER, 'OnNodeLayoutChange', this.onContainerLayoutChange);
37330
37331		this.RESULT = document.body.appendChild(document.createElement("DIV"));
37332		this.RESULT.className = 'title-search-result';
37333		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
37334		this.startText = this.INPUT.value;
37335		this.oldValue = this.INPUT.value;
37336		BX.bind(this.INPUT, 'focus', function() { _this.onFocusGain(); });
37337		BX.bind(this.INPUT, 'blur', function() { _this.onFocusLost(); });
37338		this.INPUT.onkeydown = this.onKeyDown;
37339
37340		if (this.arParams.WAIT_IMAGE)
37341		{
37342			this.WAIT = document.body.appendChild(document.createElement('DIV'));
37343			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
37344			if (!BX.browser.IsIE())
37345			{
37346				this.WAIT.style.backgroundRepeat = 'none';
37347			}
37348			this.WAIT.style.display = 'none';
37349			this.WAIT.style.position = 'absolute';
37350			this.WAIT.style.zIndex = '1100';
37351		}
37352
37353		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
37354
37355		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
37356		if (BX.type.isElementNode(fixedParent))
37357		{
37358			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
37359		}
37360	};
37361
37362	BX.ready(function() { _this.Init(arParams); });
37363}
37364
37365/* End */
37366;
37367; /* Start:"a:4:{s:4:"full";s:93:"/local/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js?166601759310313";s:6:"source";s:77:"/local/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37368$(document).ready(function(){
37369	var containerHTML = $('.title-search-input_mega_menu').detach();
37370	$('#title-search_mega_menu').append(containerHTML);
37371});
37372
37373function JCTitleSearch3(arParams)
37374{
37375	var _this = this;
37376
37377	this.arParams = {
37378		'AJAX_PAGE': arParams.AJAX_PAGE,
37379		'CONTAINER_ID': arParams.CONTAINER_ID,
37380		'INPUT_ID': arParams.INPUT_ID,
37381		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
37382	};
37383	if(arParams.WAIT_IMAGE)
37384		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
37385	if(arParams.MIN_QUERY_LEN <= 0)
37386		arParams.MIN_QUERY_LEN = 1;
37387
37388	this.cache = [];
37389	this.cache_key = null;
37390
37391	this.startText = '';
37392	this.running = false;
37393	this.needRunAgain = false;
37394	this.currentRow = -1;
37395	this.RESULT = null;
37396	this.CONTAINER = null;
37397	this.INPUT = null;
37398	this.WAIT = null;
37399
37400	this.ShowResult = function(result)
37401	{
37402		if(BX.type.isString(result))
37403		{
37404			_this.RESULT.innerHTML = result;
37405		}
37406
37407		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
37408		var pos = _this.adjustResultNode();
37409
37410		//adjust left column to be an outline
37411		var res_pos;
37412		var th;
37413		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37414		if(tbl)
37415		{
37416			th = BX.findChild(tbl, {'tag':'th'}, true);
37417		}
37418		if(th)
37419		{
37420			var tbl_pos = BX.pos(tbl);
37421			tbl_pos.width = tbl_pos.right - tbl_pos.left;
37422
37423			var th_pos = BX.pos(th);
37424			th_pos.width = th_pos.right - th_pos.left;
37425			th.style.width = th_pos.width + 'px';
37426
37427			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
37428
37429			//Move table to left by width of the first column
37430			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
37431
37432			//Shrink table when it's too wide
37433			if((tbl_pos.width - th_pos.width) > pos.width)
37434				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
37435
37436			//Check if table is too wide and shrink result div to it's width
37437			tbl_pos = BX.pos(tbl);
37438			res_pos = BX.pos(_this.RESULT);
37439			if(res_pos.right > tbl_pos.right)
37440			{
37441				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
37442			}
37443		}
37444
37445		var fade;
37446		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
37447		if(fade && th)
37448		{
37449			res_pos = BX.pos(_this.RESULT);
37450			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
37451			fade.style.width = 18 + 'px';
37452			fade.style.top = 0 + 'px';
37453			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
37454			fade.style.display = 'block';
37455		}
37456
37457		
37458		$('.bx_searche.scrollbar').mCustomScrollbar({
37459			mouseWheel: {
37460				scrollAmount: 150,
37461				preventDefault: true
37462			}
37463		});
37464	};
37465
37466	this.onKeyPress = function(keyCode)
37467	{
37468		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37469		if(!tbl)
37470			return false;
37471
37472		var i;
37473		var cnt = tbl.rows.length;
37474
37475		switch (keyCode)
37476		{
37477		case 27: // escape key - close search div
37478			_this.RESULT.style.display = 'none';
37479			_this.currentRow = -1;
37480			_this.UnSelectAll();
37481		return true;
37482
37483		case 40: // down key - navigate down on search results
37484			if(_this.RESULT.style.display == 'none')
37485				_this.RESULT.style.display = 'block';
37486
37487			var first = -1;
37488			for(i = 0; i < cnt; i++)
37489			{
37490				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37491				{
37492					if(first == -1)
37493						first = i;
37494
37495					if(_this.currentRow < i)
37496					{
37497						_this.currentRow = i;
37498						break;
37499					}
37500					else if(tbl.rows[i].className == 'title-search-selected')
37501					{
37502						tbl.rows[i].className = '';
37503					}
37504				}
37505			}
37506
37507			if(i == cnt && _this.currentRow != i)
37508				_this.currentRow = first;
37509
37510			tbl.rows[_this.currentRow].className = 'title-search-selected';
37511		return true;
37512
37513		case 38: // up key - navigate up on search results
37514			if(_this.RESULT.style.display == 'none')
37515				_this.RESULT.style.display = 'block';
37516
37517			var last = -1;
37518			for(i = cnt-1; i >= 0; i--)
37519			{
37520				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37521				{
37522					if(last == -1)
37523						last = i;
37524
37525					if(_this.currentRow > i)
37526					{
37527						_this.currentRow = i;
37528						break;
37529					}
37530					else if(tbl.rows[i].className == 'title-search-selected')
37531					{
37532						tbl.rows[i].className = '';
37533					}
37534				}
37535			}
37536
37537			if(i < 0 && _this.currentRow != i)
37538				_this.currentRow = last;
37539
37540			tbl.rows[_this.currentRow].className = 'title-search-selected';
37541		return true;
37542
37543		case 13: // enter key - choose current search result
37544			if(_this.RESULT.style.display == 'block')
37545			{
37546				for(i = 0; i < cnt; i++)
37547				{
37548					if(_this.currentRow == i)
37549					{
37550						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37551						{
37552							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
37553							if(a)
37554							{
37555								window.location = a.href;
37556								return true;
37557							}
37558						}
37559					}
37560				}
37561			}
37562		return false;
37563		}
37564
37565		return false;
37566	};
37567
37568	this.onTimeout = function()
37569	{
37570		_this.onChange(function(){
37571			setTimeout(_this.onTimeout, 500);
37572		});
37573	};
37574
37575	this.onChange = function(callback)
37576	{
37577		if (_this.running) {
37578			_this.needRunAgain = true;
37579			return;
37580		}
37581		_this.running = true;
37582
37583		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
37584		{
37585			_this.oldValue = _this.INPUT.value;
37586			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
37587			{
37588				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
37589				if(_this.cache[_this.cache_key] == null)
37590				{
37591					if(_this.WAIT)
37592					{
37593						var pos = BX.pos(_this.INPUT);
37594						var height = (pos.bottom - pos.top)-2;
37595						_this.WAIT.style.top = (pos.top+1) + 'px';
37596						_this.WAIT.style.height = height + 'px';
37597						_this.WAIT.style.width = height + 'px';
37598						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
37599						_this.WAIT.style.display = 'block';
37600					}
37601
37602					BX.ajax.post(
37603						_this.arParams.AJAX_PAGE,
37604						{
37605							'ajax_call':'y',
37606							'INPUT_ID':_this.arParams.INPUT_ID,
37607							'q':_this.INPUT.value,
37608							'l':_this.arParams.MIN_QUERY_LEN
37609						},
37610						function(result)
37611						{
37612							_this.cache[_this.cache_key] = result;
37613							_this.ShowResult(result);
37614							_this.currentRow = -1;
37615							_this.EnableMouseEvents();
37616							if(_this.WAIT)
37617								_this.WAIT.style.display = 'none';
37618							if (!!callback)
37619								callback();
37620							_this.running = false;
37621
37622							if(_this.needRunAgain){
37623								_this.needRunAgain = false;
37624								_this.onChange(callback);
37625							}
37626						}
37627					);
37628					return;
37629				}
37630				else
37631				{
37632					_this.ShowResult(_this.cache[_this.cache_key]);
37633					_this.currentRow = -1;
37634					_this.EnableMouseEvents();
37635				}
37636			}
37637			else
37638			{
37639				_this.RESULT.style.display = 'none';
37640				_this.currentRow = -1;
37641				_this.UnSelectAll();
37642			}
37643		}
37644		if (!!callback)
37645			callback();
37646		_this.running = false;
37647	};
37648
37649	this.UnSelectAll = function()
37650	{
37651		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37652		if(tbl)
37653		{
37654			var cnt = tbl.rows.length;
37655			for(var i = 0; i < cnt; i++)
37656				tbl.rows[i].className = '';
37657		}
37658	};
37659
37660	this.EnableMouseEvents = function()
37661	{
37662		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37663		if(tbl)
37664		{
37665			var cnt = tbl.rows.length;
37666			for(var i = 0; i < cnt; i++)
37667				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37668				{
37669					tbl.rows[i].id = 'row_' + i;
37670					tbl.rows[i].onmouseover = function (e) {
37671						if(_this.currentRow != this.id.substr(4))
37672						{
37673							_this.UnSelectAll();
37674							this.className = 'title-search-selected';
37675							_this.currentRow = this.id.substr(4);
37676						}
37677					};
37678					tbl.rows[i].onmouseout = function (e) {
37679						this.className = '';
37680						_this.currentRow = -1;
37681					};
37682				}
37683		}
37684	};
37685
37686	this.onFocusLost = function(hide)
37687	{
37688		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
37689		//_this.RESULT.style.display = 'none';
37690	};
37691
37692	this.onFocusGain = function()
37693	{
37694		if(_this.RESULT.innerHTML.length)
37695			_this.ShowResult();
37696	};
37697
37698	this.onKeyDown = function(e)
37699	{
37700		if(!e)
37701			e = window.event;
37702
37703		if (_this.RESULT.style.display == 'block')
37704		{
37705			if(_this.onKeyPress(e.keyCode))
37706				return BX.PreventDefault(e);
37707		}
37708		
37709		$('.title-search-result.'+_this.arParams.INPUT_ID).removeClass('closed');
37710	};
37711
37712	this.adjustResultNode = function()
37713	{
37714		var pos, pos_input;
37715		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
37716		/*if(!!fixedParent)
37717		{
37718			_this.RESULT.style.position = 'fixed';
37719			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
37720			pos = BX.pos(_this.CONTAINER, true);
37721		}
37722		else
37723		{*/
37724			_this.RESULT.style.position = 'absolute';
37725			pos = BX.pos(_this.CONTAINER, true);
37726		//}
37727		pos_input = BX.pos(_this.INPUT);
37728
37729		pos.width = pos.right - pos.left;
37730		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
37731		//_this.RESULT.style.left = pos_input.left + 'px';
37732		_this.RESULT.style.left = 0 + 'px';
37733
37734		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
37735			_this.RESULT.style.width = pos_input.width + 'px';
37736		else
37737			_this.RESULT.style.width = pos.width + 'px';
37738		return pos;
37739	};
37740
37741	this._onContainerLayoutChange = function()
37742	{
37743		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
37744		{
37745			_this.adjustResultNode();
37746		}
37747	};
37748	this.Init = function()
37749	{
37750		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
37751		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
37752
37753		this.RESULT = document.body.appendChild(document.createElement("DIV"));
37754
37755		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
37756		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
37757		this.startText = this.oldValue = this.INPUT.value;
37758		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
37759		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
37760
37761		if(BX.browser.IsSafari() || BX.browser.IsIE())
37762			this.INPUT.onkeydown = this.onKeyDown;
37763		else
37764			this.INPUT.onkeypress = this.onKeyDown;
37765
37766		if(this.arParams.WAIT_IMAGE)
37767		{
37768			this.WAIT = document.body.appendChild(document.createElement("DIV"));
37769			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
37770			if(!BX.browser.IsIE())
37771				this.WAIT.style.backgroundRepeat = 'none';
37772			this.WAIT.style.display = 'none';
37773			this.WAIT.style.position = 'absolute';
37774			this.WAIT.style.zIndex = '1100';
37775		}
37776
37777		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
37778	};
37779	BX.ready(function (){_this.Init(arParams)});
37780}
37781
37782/* End */
37783;
37784; /* Start:"a:4:{s:4:"full";s:88:"/local/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js?1666017593201";s:6:"source";s:74:"/local/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37785$(document).ready(function(){
37786	$('.menu-row .mega-menu table td.wide_menu .dropdown-menu > .customScrollbar').mCustomScrollbar({
37787		mouseWheel: {
37788			scrollAmount: 150,
37789			preventDefault: true
37790		}
37791	})
37792})
37793/* End */
37794;
37795; /* Start:"a:4:{s:4:"full";s:83:"/local/templates/aspro_max/components/bitrix/menu/header_top/script.
37795js?168933586935";s:6:"source";s:70:"/local/templates/aspro_max/components/bitrix/menu/header_top/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37796$(document).ready(function () {});
37797
37798/* End */
37799;
37800; /* Start:"a:4:{s:4:"full";s:90:"/local/templates/aspro_max/components/bitrix/menu/top_catalog_wide/script.js?1666017593201";s:6:"source";s:76:"/local/templates/aspro_max/components/bitrix/menu/top_catalog_wide/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37801$(document).ready(function () {
37802  /*$('.menu-row .mega-menu table td.wide_menu .customScrollbar').mCustomScrollbarDeferred({
37803		mouseWheel: {
37804			scrollAmount: 150,
37805			preventDefault: true
37806		}
37807	})*/
37808});
37809
37810/* End */
37811;
37812; /* Start:"a:4:{s:4:"full";s:76:"/local/templates/aspro_max/components/bitrix/menu/top/script.js?166601759335";s:6:"source";s:63:"/local/templates/aspro_max/components/bitrix/menu/top/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37813$(document).ready(function () {});
37814
37815/* End */
37816;
37817; /* Start:"a:4:{s:4:"full";s:109:"/local/templates/aspro_max/components/aspro/regionality.list.max/popup_regions_small/script.js?16660175931104";s:6:"source";s:94:"/local/templates/aspro_max/components/aspro/regionality.list.max/popup_regions_small/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37818$(document).ready(function(){
37819	$('.confirm_region .aprove').on('click', function(e){
37820		var _this = $(this);
37821		$.removeCookie('current_region');
37822		$.cookie('current_region', _this.data('id'), {path: '/',domain: arMaxOptions['SITE_ADDRESS']});
37823
37824		$('.confirm_region').remove();
37825		if(typeof _this.data('href') !== 'undefined')
37826			location.href = _this.data('href');
37827	})
37828
37829	$(document).on('click', '.confirm_region .close', function(){
37830		var _this = $(this);
37831		$.removeCookie('current_region');
37832		$.cookie('current_region', _this.data('id'), {path: '/',domain: arMaxOptions['SITE_ADDRESS']});
37833		$('.confirm_region').remove();
37834		$('.top_mobile_region .confirm_wrapper').remove();
37835	});
37836	
37837	$('.js_city_change').on('click', function(){
37838		var _this = $(this);
37839		_this.closest('.region_wrapper').find('.js_city_chooser').trigger('click');
37840		if(_this.closest('.top_mobile_region').length)
37841		{
37842			$('.burger').click();
37843
37844			$('.mobile_regions > ul > li > a').click()
37845		}
37846		$('.confirm_region').remove();
37847	})
37848	$('.js_city_chooser').on('click', function(){
37849		var _this = $(this);
37850		$('.confirm_region').remove();
37851	})
37852});
37853/* End */
37854;
37855; /* Start:"a:4:{s:4:"full";s:85:"/local/templates/aspro_max/components/bitrix/news.list/banners/script.js?166601759382";s:6:"source";s:72:"/local/templates/aspro_max/components/bitrix/news.list/banners/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37856readyDOM(function () {
37857    checkLinkedBlocks(".linked-banners-list");
37858});
37859
37860      	
37861/* End */
37862;
37863; /* Start:"a:4:{s:4:"full";s:98:"/local/templates/aspro_max/components/bitrix/catalog.section/product_list/script.js?16660175938513";s:6:"source";s:83:"/local/templates/aspro_max/components/bitrix/catalog.section/product_list/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37864if(!funcDefined("sliceItemBlock")){
37865	sliceItemBlock = function(){
37866		/*
37867		$('.cur .catalog_block .catalog_item_wrapp.catalog_item:visible').sliceHeight({
37868			classNull: '.footer_button', 
37869			item:'.cur .catalog_block .catalog_item_wrapp.catalog_item:visible', 
37870			classes: [
37871				'.item_info .item-title',
37872				'.item_info .sa_block',
37873				'.item_info .cost.prices',
37874			],
37875			mobile: true,
37876			blockNull: {
37877				class: 'big',
37878				width: 2,
37879			},
37880			breakpoint: {
37881				'(max-width: 600px)': {
37882					blockNull: {
37883						width: 1,
37884					},
37885					autoslicecount: false, 
37886					slice: 999,
37887				}
37888			},
37889		});
37890		*/
37891
37892		InitCustomScrollBar();
37893	}
37894}
37895if(!funcDefined("sliceItemBlockSlide")){
37896	sliceItemBlockSlide = function(options){
37897		/*var settings = 
37898		{
37899			classNull: '.footer_button', 
37900			item:'.cur .catalog_block.owl-carousel .catalog_item:not(.big)', 
37901			classes: [
37902				'.item_info .item-title',
37903				'.item_info .sa_block',
37904				'.item_info .cost.prices',
37905			],
37906			mobile: true,
37907			autoslicecount: false, 
37908			slice: 999,
37909		};
37910
37911		if(options !== undefined) {
37912			settings = Object.assign(settings, options);
37913		}
37914		$('.cur .catalog_block.owl-carousel .catalog_item_wrapp.catalog_item').sliceHeight(settings);
37915		*/
37916		InitCustomScrollBar();
37917	}
37918}
37919
37920$(document).ready(function(){
37921	if(!('SelectOfferProp' in window) && typeof window.SelectOfferProp != 'function')
37922	{
37923		SelectOfferProp1 = function(){
37924			// return false;
37925			var _this = $(this),
37926				obParams = {},
37927				obSelect = {},
37928				objUrl = parseUrlQuery(),
37929				add_url = '',
37930				container = _this.closest('.bx_catalog_item_scu');
37931
37932			/* request params */
37933			obParams = {
37934				'PARAMS': _this.closest('.js_wrapper_items').data('params'),
37935				'ID': container.data('offer_id'),
37936				'SITE_ID': container.data('site_id'),
37937				'LINK_ID': container.data('id')+'_block',
37938				'IBLOCK_ID': container.data('offer_iblockid'),
37939				'PROPERTY_ID': container.data('propertyid'),
37940				'DEPTH': _this.closest('.item_wrapper').index(),
37941				'VALUE': _this.data('onevalue'),
37942				'CLASS': 'inner_content',
37943				'PICTURE': _this.closest('.catalog_item_wrapp').find('.thumb img').attr('src'),
37944				'ARTICLE_NAME': _this.closest('.catalog_item_wrapp').find('.article_block').data('name'),
37945				'ARTICLE_VALUE': _this.closest('.catalog_item_wrapp').find('.article_block').data('value'),
37946			}
37947			/**/
37948
37949			if("clear_cache" in objUrl)
37950			{
37951				if(objUrl.clear_cache == "Y")
37952					add_url += "?clear_cache=Y";
37953			}
37954
37955			/* save selected values */
37956			for (i = 0; i < obParams.DEPTH+1; i++)
37957			{
37958				strName = 'PROP_'+container.find('.item_wrapper:eq('+i+') > div').data('id');
37959				obSelect[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
37960				obParams[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
37961			}
37962
37963			// obParams.SELECTED = JSON.stringify(obSelect);
37964			/**/
37965
37966			_this.siblings().removeClass('active');
37967			_this.addClass('active');
37968
37969			if(_this.attr('title'))
37970			{
37971				var skuVal = _this.attr('title').split(':')[1];
37972				_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
37973			}
37974			else
37975			{
37976				var img_row = _this.find(' > i');
37977				if(img_row.length && img_row.attr('title')) {
37978					var skuVal = img_row.attr('title').split(':')[1];
37979					_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
37980				}
37981			}
37982
37983			/* get sku */
37984			$.ajax({
37985				url: arMaxOptions['SITE_DIR']+'ajax/js_item_detail.php'+add_url,
37986				type: 'POST',
37987				data: obParams,
37988			}).success(function(html){
37989				var ob = BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT);
37990			})
37991		}
37992		$(document).on('click', '.bx_catalog_item_scu li.item', SelectOfferProp)
37993	}
37994
37995	if ($('.filter_exists').is('div')) {
37996		stickyCatalogFilter();
37997	}
37998});
37999
38000(function (window) {
38001	if (!window.JCCatalogSectionOnlyElement)
38002	{
38003
38004		window.JCCatalogSectionOnlyElement = function (arParams)
38005		{
38006			if (typeof arParams === 'object')
38007			{
38008				this.params = arParams;
38009
38010				this.obProduct = null;
38011				this.set_quantity = 1;
38012
38013				this.currentPriceMode = '';
38014				this.currentPrices = [];
38015				this.currentPriceSelected = 0;
38016				this.currentQuantityRanges = [];
38017				this.currentQuantityRangeSelected = 0;
38018
38019				if (this.params.MESS)
38020				{
38021					this.mess = this.params.MESS;
38022				}
38023
38024				this.init();
38025			}
38026		}
38027		window.JCCatalogSectionOnlyElement.prototype = {
38028			init: function()
38029			{
38030				var i = 0,
38031					j = 0,
38032					treeItems = null;
38033
38034				this.obProduct = BX(this.params.ID);
38035
38036				if(!!this.obProduct)
38037				{
38038					$(this.obProduct).find('.counter_wrapp .counter_block input').data('product', 'ob'+this.obProduct.id+'el');
38039					this.currentPriceMode = this.params.ITEM_PRICE_MODE;
38040					this.currentPrices = this.params.ITEM_PRICES;
38041					this.currentQuantityRanges = this.params.ITEM_QUANTITY_RANGES;
38042				}
38043
38044			},
38045
38046			setPriceAction: function()
38047			{
38048				this.set_quantity = this.params.MIN_QUANTITY_BUY;
38049				if($(this.obProduct).find('input[name=quantity]').length)
38050					this.set_quantity = $(this.obProduct).find('input[name=quantity]').val();
38051
38052				this.checkPriceRange(this.set_quantity);
38053
38054				$(this.obProduct).find('.not_matrix').hide();
38055				$(this.obProduct).find('.with_matrix .price_value_block').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_PRICE));
38056
38057				if($(this.obProduct).find('.with_matrix .discount'))
38058				{
38059					$(this.obProduct).find('.with_matrix .discount').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].BASE_PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_BASE_PRICE));
38060				}
38061
38062				if(this.params.SHOW_DISCOUNT_PERCENT_NUMBER == 'Y')
38063				{
38064					if(this.currentPrices[this.currentPriceSelected].PERCENT > 0 && this.currentPrices[this.currentPriceSelected].PERCENT < 100)
38065					{
38066						if(!$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
38067							$('<div class="value"></div>').insertBefore($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .text'));
38068
38069						$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').html('-<span>'+this.currentPrices[this.currentPriceSelected].PERCENT+'</span>%');
38070					}
38071					else
38072					{
38073						if($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
38074							$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').remove();
38075					}
38076				}
38077				$(this.obProduct).find('.with_matrix .sale_block .text .values_wrapper').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].DISCOUNT, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_DISCOUNT));
38078
38079				if('NOT_SHOW' in this.params && this.params.NOT_SHOW != 'Y')
38080					$(this.obProduct).find('.with_matrix').show();
38081
38082				if(arMaxOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
38083				{
38084					if(typeof this.currentPrices[this.currentPriceSelected] !== 'undefined')
38085						setPriceItem($(this.obProduct), this.set_quantity, this.currentPrices[this.currentPriceSelected].PRICE);
38086				}
38087			},
38088
38089			checkPriceRange: function(quantity)
38090			{
38091				if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
38092					return;
38093
38094				var range, found = false;
38095
38096				for (var i in this.currentQuantityRanges)
38097				{
38098					if (this.currentQuantityRanges.hasOwnProperty(i))
38099					{
38100						range = this.currentQuantityRanges[i];
38101
38102						if (
38103							parseInt(quantity) >= parseInt(range.SORT_FROM)
38104							&& (
38105								range.SORT_TO == 'INF'
38106								|| parseInt(quantity) <= parseInt(range.SORT_TO)
38107							)
38108						)
38109						{
38110							found = true;
38111							this.currentQuantityRangeSelected = range.HASH;
38112							break;
38113						}
38114					}
38115				}
38116
38117				if (!found && (range = this.getMinPriceRange()))
38118				{
38119					this.currentQuantityRangeSelected = range.HASH;
38120				}
38121
38122				for (var k in this.currentPrices)
38123				{
38124					if (this.currentPrices.hasOwnProperty(k))
38125					{
38126						if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
38127						{
38128							this.currentPriceSelected = k;
38129							break;
38130						}
38131					}
38132				}
38133			},
38134
38135			getMinPriceRange: function()
38136			{
38137				var range;
38138
38139				for (var i in this.currentQuantityRanges)
38140				{
38141					if (this.currentQuantityRanges.hasOwnProperty(i))
38142					{
38143						if (
38144							!range
38145							|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
38146						)
38147						{
38148							range = this.currentQuantityRanges[i];
38149						}
38150					}
38151				}
38152
38153				return range;
38154			}
38155		}
38156	}
38157})(window);
38158
38159/* End */
38160;
38161; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/js/blocks/blocks.min.js?16660175938843";s:6:"source";s:50:"/local/templates/aspro_max/js/blocks/blocks.min.js";s:3:"min";s:50:"/local/templates/aspro_max/js/blocks/blocks.min.js";s:3:"map";s:54:"/local/templates/aspro_max/js/blocks/blocks.min.js.map";}"*/
38162function updateProgressBar(){let allProgressBar="nodelist"===typeofExt(window.asproAllProgressBar)&&window.asproAllProgressBar;if(allProgressBar&&allProgressBar.length){let scrollHeight=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),scrollTop=window.pageYOffset||document.documentElement.scrollTop,clientHeight=document.documentElement.clientHeight,scrollProcent=Math.round(scrollTop/(scrollHeight-clientHeight)*100);if(allProgressBar.length)for(let item=0;item<allProgressBar.length;item++)allProgressBar[item].style.width=scrollProcent+"%"}}InitMenuNavigationAim=function(){var $block=$(".menu-navigation__sections-wrapper .menu-navigation__sections:not(.aim-init)");$block.length&&($block.addClass("aim-init"),BX.loadScript(arAsproOptions.SITE_TEMPLATE_PATH+"/vendor/js/jquery.menu-aim.js",(function(){$block.menuAim({firstActiveRow:!0,rowSelector:"> .menu-navigation__sections-item",activate:function activate(a){var _this=$(a),index=_this.index(),items=_this.closest(".menu-navigation__sections-wrapper").next(),link=_this.find("> a");_this.siblings().find("> a").addClass("dark_link"),link.addClass("colored_theme_text").removeClass("dark_link"),items.find(".parent-items").siblings().hide(),items.find(".parent-items").eq(index).show()},deactivate:function deactivate(a){var _this=$(a),index=_this.index(),items=_this.closest(".menu-navigation__sections-wrapper").next(),link;_this.find("> a").removeClass("colored_theme_text").addClass("dark_link"),items.find(".parent-items").siblings().hide()}})})))},readyDOM((function(){window.asproAllProgressBar=document.querySelectorAll(".header-progress-bar__inner")})),$(document).ready((function(){$(document).on("click",".dropdown-select .dropdown-select__title",(function(){var _this=$(this),menu=_this.parent().find("> .dropdown-select__list"),bVisibleMeu,animate=menu.is(":visible")?"fadeOut":"transition.slideUpIn";_this.hasClass("clicked")||(_this.addClass("clicked"),menu.velocity("stop").velocity(animate,{duration:300,begin:function(){_this.toggleClass("opened")},complete:function(){_this.removeClass("clicked")}}))})),$("html, body").on("mousedown",(function(e){"string"==typeof e.target.className&&e.target.className.indexOf("adm")<0&&(e.stopPropagation(),$(e.target).closest(".dropdown-select").length||$(".dropdown-select .dropdown-select__title.opened").click())})),$(document).on("click",".slide-block .slide-block__head",(function(e){var _this=$(this),menu=_this.siblings(".slide-block__body"),bVisibleMeu=menu.is(":visible"),animate=bVisibleMeu?"slideUp":"slideDown";if(!_this.hasClass("clicked")&&menu.length&&!_this.hasClass("ignore")&&!$(e.target).attr("href")){var type=_this.data("id");_this.addClass("clicked"),bVisibleMeu?$.cookie(type+"_CLOSED","Y"):$.removeCookie(type+"_CLOSED"),menu.velocity("stop").velocity(animate,{duration:150,begin:function(){_this.toggleClass("closed")},complete:function(){_this.removeClass("clicked"),void 0!==window.stickySidebar&&window.stickySidebar.updateSticky()}})}})),"SelectOfferProp"in window||"function"==typeof window.SelectOfferProp||(SelectOfferProp=function(){var _this=$(this),obParams={},obSelect={},objUrl=parseUrlQuery(),add_url="",selectMode=!!_this.hasClass("list_values_wrapper"),container=_this.closest(".bx_catalog_item_scu"),img=_this.closest(".item-parent").find(".thumb img"),bDetail=_this.closest(".product-main").length;obParams={PARAMS:bDetail?$(".js-sku-config").data("params"):_this.closest(".
38162js_wrapper_items").data("params"),ID:container.data("offer_id"),SITE_ID:container.data("site_id"),LINK_ID:container.data("id")+"_"+(bDetail?"detail":_this.closest(".cur").data("code")),IBLOCK_ID:container.data("offer_iblockid"),IBLOCK_ID_PARENT:container.data("iblockid"),PROPERTY_ID:container.data("propertyid"),DEPTH:_this.closest(".item_wrapper").index(),VALUE:selectMode?_this.find("option:selected").data("onevalue"):_this.data("onevalue"),CLASS:"inner_content",PICTURE:img.data("src")?img.data("src"):img.attr("src"),ARTICLE_NAME:_this.closest(".item-parent").find(".article_block").data("name"),ARTICLE_VALUE:_this.closest(".item-parent").find(".article_block").data("value")},"clear_cache"in objUrl&&"Y"==objUrl.clear_cache&&(add_url+="?clear_cache=Y");let isActiveContainer=container.hasClass("js-selected");for($(".bx_catalog_item_scu").removeClass("js-selected"),container.addClass("js-selected"),i=0;i<obParams.DEPTH+1;i++)strName="PROP_"+container.find(".item_wrapper:eq("+i+") > div").data("id"),container.find(".item_wrapper:eq("+i+") select").length?(obSelect[strName]=container.find(".item_wrapper:eq("+i+") select option:selected").data("onevalue"),obParams[strName]=container.find(".item_wrapper:eq("+i+") select option:selected").data("onevalue")):(obSelect[strName]=container.find(".item_wrapper:eq("+i+") li.item.active").data("onevalue"),obParams[strName]=container.find(".item_wrapper:eq("+i+") li.item.active").data("onevalue"));if(selectMode||(_this.siblings().removeClass("active"),_this.addClass("active")),_this.attr("title")){var skuVal=_this.attr("title").split(":")[1];_this.closest(".item_wrapper").find(".show_class .val").text(skuVal)}else{var img_row=_this.find(" > i");if(img_row.length&&img_row.attr("title")){var skuVal=img_row.attr("title").split(":")[1];_this.closest(".item_wrapper").find(".show_class .val").text(skuVal)}}function finalActionSKUInfo(th){$(".counter_wrapp.list")&&$(".counter_wrapp.list .counter_block.big").removeClass("big");var sku_props=th.closest(".sku_props").find(".item_wrapper .item.active, .item_wrapper .list_values_wrapper");$.each(sku_props,(function(index,value){var skuVal="";if((value=$(value)).attr("title"))skuVal=value.attr("title").split(":")[1];else if(void 0!==value.val())skuVal=value.val();else{var img_row=value.find(" > i");img_row.length&&img_row.attr("title")&&(skuVal=img_row.attr("title").split(":")[1])}""!=skuVal&&value.closest(".item_wrapper").find(".show_class .val").text(skuVal)}))}window.obOffers&&"array"===typeofExt(obOffers)&&isActiveContainer?(selectedValues=obSelect,strPropValue=obParams.VALUE,depth=obParams.DEPTH,arFilter={},tmpFilter=[],UpdateSKUInfoByProps(),finalActionSKUInfo(_this)):$.ajax({url:arMaxOptions.SITE_DIR+"ajax/js_item_detail.php"+add_url,type:"POST",data:obParams}).success((function(html){var ob=BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT),finalActionSKUInfo(_this)}))},$(document).on("click",".ajax_load .bx_catalog_item_scu li.item",SelectOfferProp),$(document).on("change",".ajax_load .bx_catalog_item_scu select.list_values_wrapper",SelectOfferProp),$(document).on("click",".bx_catalog_item_scu.sku_in_detail li.item",SelectOfferProp),$(document).on("change",".bx_catalog_item_scu.sku_in_detail select.list_values_wrapper",SelectOfferProp)),$(".switch-item-block .switch-item-block__icons").on("click",(function(){var $this=$(this),animationTime=200;$this.hasClass("switch-item-block__icons--small")&&!$this.hasClass("active")?($this.addClass("active"),$this.siblings(".switch-item-block__icons--big").removeClass("active"),$this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--big").fadeOut(200,(function(){$this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--small").fadeIn(200)})),$this.closest(".switch-item-block").siblings(".big-gallery-block").fadeOut(200,(function(){$this.closest(".switch-item-block").siblings(".small-gallery-block").fadeIn(200)}))):$this.hasClass("switch-item-block__icons--big")&&!$this.hasClass("active")&&($this.addClass("active"),$this.siblings(".switch-item-block__icons--small").removeClass("active"),$this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--small").fadeOut(200,(function(){$this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--big").fadeIn(200)})),$this.closest(".switch-item-block").siblings(".small-gallery-block").fadeOut(200,(function(){$this.closest(".switch-item-block").siblings(".big-gallery-block").fadeIn(200)}))),setTimeout((function(){InitLazyLoad()}),300)})),window.addEventListener("scroll",throttle(updateProgressBar,200)),$(".form-control:not(.eye-password-ignore) [type=password]").each((function(item){let passBlock=$(this).closest(".form-control"),labelBlock=passBlock.find(".label_block");labelBlock.length?labelBlock.addClass("eye-password"):passBlock.addClass("eye-password")})),$(document).on("click",".eye-password:not(.eye-password-ignore)",(function(event){let input=this.querySelector("input"),eyeWidth=56;this.clientWidth-56<event.offsetX&&("password"==input.type?(input.type="text",this.classList.add("password-show")):"text"==input.type&&(input.type="password",this.classList.remove("password-show")))}))}));
38163/* End */
38164;
38165; /* Start:"a:4:{s:4:"full";s:110:"/local/templates/aspro_max/components/bitrix/catalog.section/product_list_bestsellers/script.
38165js?16660175938411";s:6:"source";s:95:"/local/templates/aspro_max/components/bitrix/catalog.section/product_list_bestsellers/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
38166if(!funcDefined("sliceItemBlock")){
38167	sliceItemBlock = function(){
38168		/*
38169		$('.cur .catalog_block .catalog_item_wrapp.catalog_item:visible').sliceHeight({
38170			classNull: '.footer_button', 
38171			item:'.cur .catalog_block .catalog_item_wrapp.catalog_item:visible', 
38172			classes: [
38173				'.item_info .item-title',
38174				'.item_info .sa_block',
38175				'.item_info .cost.prices',
38176			],
38177			mobile: true,
38178			blockNull: {
38179				class: 'big',
38180				width: 2,
38181			},
38182			breakpoint: {
38183				'(max-width: 600px)': {
38184					blockNull: {
38185						width: 1,
38186					},
38187					autoslicecount: false, 
38188					slice: 999,
38189				}
38190			},
38191		});
38192		*/
38193		
38194		InitCustomScrollBar();
38195	}
38196}
38197if(!funcDefined("sliceItemBlockSlide")){
38198	sliceItemBlockSlide = function(options){
38199		/*var settings = 
38200		{
38201			classNull: '.footer_button', 
38202			item:'.cur .catalog_block.owl-carousel .catalog_item:not(.big)', 
38203			classes: [
38204				'.item_info .item-title',
38205				'.item_info .sa_block',
38206				'.item_info .cost.prices',
38207			],
38208			mobile: true,
38209			autoslicecount: false, 
38210			slice: 999,
38211		};
38212
38213		if(options !== undefined) {
38214			settings = Object.assign(settings, options);
38215		}
38216		$('.cur .catalog_block.owl-carousel .catalog_item_wrapp.catalog_item').sliceHeight(settings);
38217		*/
38218		InitCustomScrollBar();
38219	}
38220}
38221
38222$(document).ready(function(){
38223	if(!('SelectOfferProp' in window) && typeof window.SelectOfferProp != 'function')
38224	{
38225		SelectOfferProp1 = function(){
38226			// return false;
38227			var _this = $(this),
38228				obParams = {},
38229				obSelect = {},
38230				objUrl = parseUrlQuery(),
38231				add_url = '',
38232				container = _this.closest('.bx_catalog_item_scu');
38233
38234			/* request params */
38235			obParams = {
38236				'PARAMS': _this.closest('.js_wrapper_items').data('params'),
38237				'ID': container.data('offer_id'),
38238				'SITE_ID': container.data('site_id'),
38239				'LINK_ID': container.data('id')+'_block',
38240				'IBLOCK_ID': container.data('offer_iblockid'),
38241				'PROPERTY_ID': container.data('propertyid'),
38242				'DEPTH': _this.closest('.item_wrapper').index(),
38243				'VALUE': _this.data('onevalue'),
38244				'CLASS': 'inner_content',
38245				'PICTURE': _this.closest('.catalog_item_wrapp').find('.thumb img').attr('src'),
38246				'ARTICLE_NAME': _this.closest('.catalog_item_wrapp').find('.article_block').data('name'),
38247				'ARTICLE_VALUE': _this.closest('.catalog_item_wrapp').find('.article_block').data('value'),
38248			}
38249			/**/
38250
38251			if("clear_cache" in objUrl)
38252			{
38253				if(objUrl.clear_cache == "Y")
38254					add_url += "?clear_cache=Y";
38255			}
38256
38257			/* save selected values */
38258			for (i = 0; i < obParams.DEPTH+1; i++)
38259			{
38260				strName = 'PROP_'+container.find('.item_wrapper:eq('+i+') > div').data('id');
38261				obSelect[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
38262				obParams[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
38263			}
38264
38265			// obParams.SELECTED = JSON.stringify(obSelect);
38266			/**/
38267			
38268			_this.siblings().removeClass('active');
38269			_this.addClass('active');
38270
38271			if(_this.attr('title'))
38272			{
38273				var skuVal = _this.attr('title').split(':')[1];
38274				_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
38275			}
38276			else
38277			{
38278				var img_row = _this.find(' > i');
38279				if(img_row.length && img_row.attr('title')) {
38280					var skuVal = img_row.attr('title').split(':')[1];
38281					_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
38282				}
38283			}
38284
38285			/* get sku */
38286			$.ajax({
38287				url: arMaxOptions['SITE_DIR']+'ajax/js_item_detail.php'+add_url,
38288				type: 'POST',
38289				data: obParams,
38290			}).success(function(html){
38291				var ob = BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT);
38292			})
38293		}
38294		$(document).on('click', '.bx_catalog_item_scu li.item', SelectOfferProp)
38295	}
38296
38297    if ($('.filter_exists').is('div')) {
38298    	stickyCatalogFilter();
38299    }
38300});
38301
38302(function (window) {
38303if (!window.JCCatalogSectionOnlyElement)
38304{
38305
38306	window.JCCatalogSectionOnlyElement = function (arParams)
38307	{
38308		if (typeof arParams === 'object')
38309		{
38310			this.params = arParams;
38311
38312			this.obProduct = null;
38313			this.set_quantity = 1;
38314
38315			this.currentPriceMode = '';
38316			this.currentPrices = [];
38317			this.currentPriceSelected = 0;
38318			this.currentQuantityRanges = [];
38319			this.currentQuantityRangeSelected = 0;
38320
38321			if (this.params.MESS)
38322			{
38323				this.mess = this.params.MESS;
38324			}
38325
38326			this.init();
38327		}
38328	}
38329	window.JCCatalogSectionOnlyElement.prototype = {
38330		init: function()
38331		{
38332			var i = 0,
38333				j = 0,
38334				treeItems = null;
38335
38336			this.obProduct = BX(this.params.ID);
38337
38338			if(!!this.obProduct)
38339			{
38340				$(this.obProduct).find('.counter_wrapp .counter_block input').data('product', 'ob'+this.obProduct.id+'el');
38341				this.currentPriceMode = this.params.ITEM_PRICE_MODE;
38342				this.currentPrices = this.params.ITEM_PRICES;
38343				this.currentQuantityRanges = this.params.ITEM_QUANTITY_RANGES;
38344			}
38345
38346		},
38347
38348		setPriceAction: function()
38349		{
38350			this.set_quantity = this.params.MIN_QUANTITY_BUY;			
38351			if($(this.obProduct).find('input[name=quantity]').length)
38352				this.set_quantity = $(this.obProduct).find('input[name=quantity]').val();
38353			
38354			this.checkPriceRange(this.set_quantity);
38355
38356			$(this.obProduct).find('.not_matrix').hide();
38357			$(this.obProduct).find('.with_matrix .price_value_block').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_PRICE));
38358
38359			if($(this.obProduct).find('.with_matrix .discount'))
38360			{
38361				$(this.obProduct).find('.with_matrix .discount').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].BASE_PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_BASE_PRICE));
38362			}
38363
38364			if(this.params.SHOW_DISCOUNT_PERCENT_NUMBER == 'Y')
38365			{
38366				if(this.currentPrices[this.currentPriceSelected].PERCENT > 0 && this.currentPrices[this.currentPriceSelected].PERCENT < 100)
38367				{
38368					if(!$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
38369						$('<div class="value"></div>').insertBefore($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .text'));
38370
38371					$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').html('-<span>'+this.currentPrices[this.currentPriceSelected].PERCENT+'</span>%');
38372				}
38373				else
38374				{
38375					if($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
38376						$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').remove();
38377				}
38378			}
38379			$(this.obProduct).find('.with_matrix .sale_block .text .values_wrapper').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].DISCOUNT, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_DISCOUNT));
38380			
38381			if('NOT_SHOW' in this.params && this.params.NOT_SHOW != 'Y')
38382				$(this.obProduct).find('.with_matrix').show();			
38383
38384			if(arMaxOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
38385			{
38386				if(typeof this.currentPrices[this.currentPriceSelected] !== 'undefined')
38387					setPriceItem($(this.obProduct), this.set_quantity, this.currentPrices[this.currentPriceSelected].PRICE);
38388			}
38389		},
38390
38391		checkPriceRange: function(quantity)
38392		{
38393			if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
38394				return;
38395
38396			var range, found = false;
38397			
38398			for (var i in this.currentQuantityRanges)
38399			{
38400				if (this.currentQuantityRanges.hasOwnProperty(i))
38401				{
38402					range = this.currentQuantityRanges[i];
38403
38404					if (
38405						parseInt(quantity) >= parseInt(range.SORT_FROM)
38406						&& (
38407							range.SORT_TO == 'INF'
38408							|| parseInt(quantity) <= parseInt(range.SORT_TO)
38409						)
38410					)
38411					{
38412						found = true;
38413						this.currentQuantityRangeSelected = range.HASH;
38414						break;
38415					}
38416				}
38417			}
38418
38419			if (!found && (range = this.getMinPriceRange()))
38420			{
38421				this.currentQuantityRangeSelected = range.HASH;
38422			}
38423
38424			for (var k in this.currentPrices)
38425			{
38426				if (this.currentPrices.hasOwnProperty(k))
38427				{
38428					if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
38429					{
38430						this.currentPriceSelected = k;
38431						break;
38432					}
38433				}
38434			}
38435		},
38436
38437		getMinPriceRange: function()
38438		{
38439			var range;
38440
38441			for (var i in this.currentQuantityRanges)
38442			{
38443				if (this.currentQuantityRanges.hasOwnProperty(i))
38444				{
38445					if (
38446						!range
38447						|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
38448					)
38449					{
38450						range = this.currentQuantityRanges[i];
38451					}
38452				}
38453			}
38454
38455			return range;
38456		}
38457	}
38458}
38459})(window);
38460
38461/* End */
38462;
38463; /* Start:"a:4:{s:4:"full";s:89:"/local/templates/aspro_max/components/bitrix/search.title/fixed/script.js?166601759310846";s:6:"source";s:73:"/local/templates/aspro_max/components/bitrix/search.title/fixed/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
38464function JCTitleSearch2(arParams)
38465{
38466	var _this = this;
38467
38468	this.arParams = {
38469		'AJAX_PAGE': arParams.AJAX_PAGE,
38470		'CONTAINER_ID': arParams.CONTAINER_ID,
38471		'INPUT_ID': arParams.INPUT_ID,
38472		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
38473		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
38474	};
38475	if(arParams.WAIT_IMAGE)
38476		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
38477	if(arParams.MIN_QUERY_LEN <= 0)
38478		arParams.MIN_QUERY_LEN = 1;
38479
38480	this.cache = [];
38481	this.cache_key = null;
38482
38483	this.startText = '';
38484	this.running = false;
38485	this.needRunAgain = false;
38486	this.currentRow = -1;
38487	this.RESULT = null;
38488	this.CONTAINER = null;
38489	this.INPUT = null;
38490	this.TYPE = null;
38491	this.WAIT = null;
38492
38493	this.ShowResult = function(result)
38494	{
38495		if(BX.type.isString(result))
38496		{
38497			_this.RESULT.innerHTML = result;
38498		}
38499
38500		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
38501		var pos = _this.adjustResultNode();
38502
38503		//adjust left column to be an outline
38504		var res_pos;
38505		var th;
38506		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38507		if(tbl)
38508		{
38509			th = BX.findChild(tbl, {'tag':'th'}, true);
38510		}
38511		if(th)
38512		{
38513			var tbl_pos = BX.pos(tbl);
38514			tbl_pos.width = tbl_pos.right - tbl_pos.left;
38515
38516			var th_pos = BX.pos(th);
38517			th_pos.width = th_pos.right - th_pos.left;
38518			th.style.width = th_pos.width + 'px';
38519
38520			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
38521
38522			//Move table to left by width of the first column
38523			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
38524
38525			//Shrink table when it's too wide
38526			if((tbl_pos.width - th_pos.width) > pos.width)
38527				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
38528
38529			//Check if table is too wide and shrink result div to it's width
38530			tbl_pos = BX.pos(tbl);
38531			res_pos = BX.pos(_this.RESULT);
38532			if(res_pos.right > tbl_pos.right)
38533			{
38534				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
38535			}
38536		}
38537
38538		var fade;
38539		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
38540		if(fade && th)
38541		{
38542			res_pos = BX.pos(_this.RESULT);
38543			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
38544			fade.style.width = 18 + 'px';
38545			fade.style.top = 0 + 'px';
38546			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
38547			fade.style.display = 'block';
38548		}
38549
38550		$('.bx_searche.scrollbar').mCustomScrollbar({
38551			mouseWheel: {
38552				scrollAmount: 150,
38553				preventDefault: true
38554			}
38555		});
38556	};
38557
38558	this.onKeyPress = function(keyCode)
38559	{
38560		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38561		if(!tbl)
38562			return false;
38563
38564		var i;
38565		var cnt = tbl.rows.length;
38566
38567		switch (keyCode)
38568		{
38569		case 27: // escape key - close search div
38570			_this.RESULT.style.display = 'none';
38571			_this.currentRow = -1;
38572			_this.UnSelectAll();
38573		return true;
38574
38575		case 40: // down key - navigate down on search results
38576			if(_this.RESULT.style.display == 'none')
38577				_this.RESULT.style.display = 'block';
38578
38579			var first = -1;
38580			for(i = 0; i < cnt; i++)
38581			{
38582				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38583				{
38584					if(first == -1)
38585						first = i;
38586
38587					if(_this.currentRow < i)
38588					{
38589						_this.currentRow = i;
38590						break;
38591					}
38592					else if(tbl.rows[i].className == 'title-search-selected')
38593					{
38594						tbl.rows[i].className = '';
38595					}
38596				}
38597			}
38598
38599			if(i == cnt && _this.currentRow != i)
38600				_this.currentRow = first;
38601
38602			tbl.rows[_this.currentRow].className = 'title-search-selected';
38603		return true;
38604
38605		case 38: // up key - navigate up on search results
38606			if(_this.RESULT.style.display == 'none')
38607				_this.RESULT.style.display = 'block';
38608
38609			var last = -1;
38610			for(i = cnt-1; i >= 0; i--)
38611			{
38612				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38613				{
38614					if(last == -1)
38615						last = i;
38616
38617					if(_this.currentRow > i)
38618					{
38619						_this.currentRow = i;
38620						break;
38621					}
38622					else if(tbl.rows[i].className == 'title-search-selected')
38623					{
38624						tbl.rows[i].className = '';
38625					}
38626				}
38627			}
38628
38629			if(i < 0 && _this.currentRow != i)
38630				_this.currentRow = last;
38631
38632			tbl.rows[_this.currentRow].className = 'title-search-selected';
38633		return true;
38634
38635		case 13: // enter key - choose current search result
38636			if(_this.RESULT.style.display == 'block')
38637			{
38638				for(i = 0; i < cnt; i++)
38639				{
38640					if(_this.currentRow == i)
38641					{
38642						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38643						{
38644							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
38645							if(a)
38646							{
38647								window.location = a.href;
38648								return true;
38649							}
38650						}
38651					}
38652				}
38653			}
38654		return false;
38655		}
38656
38657		return false;
38658	};
38659
38660	this.onTimeout = function()
38661	{
38662		_this.onChange(function(){
38663			setTimeout(_this.onTimeout, 500);
38664		});
38665	};
38666
38667	this.onChange = function(callback)
38668	{
38669		if (_this.running){
38670			_this.needRunAgain = true;
38671			return;
38672		}
38673		_this.running = true;
38674
38675		let type = 'catalog';
38676		if (this.TYPE) {
38677			type = this.TYPE.value;
38678		}
38679
38680		if(
38681			(
38682				_this.INPUT.value != _this.oldValue
38683				&& _this.INPUT.value != _this.startText
38684			)
38685			|| type != _this.oldType
38686		){
38687			_this.oldValue = _this.INPUT.value;
38688			_this.oldType = type;
38689
38690			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
38691			{
38692				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value + '|' + type;
38693				if(_this.cache[_this.cache_key] == null)
38694				{
38695					if(_this.WAIT)
38696					{
38697						var pos = BX.pos(_this.INPUT);
38698						var height = (pos.bottom - pos.top)-2;
38699						_this.WAIT.style.top = (pos.top+1) + 'px';
38700						_this.WAIT.style.height = height + 'px';
38701						_this.WAIT.style.width = height + 'px';
38702						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
38703						_this.WAIT.style.display = 'block';
38704					}
38705
38706					BX.ajax.post(
38707						_this.arParams.AJAX_PAGE,
38708						{
38709							'ajax_call':'y',
38710							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
38711							'q':_this.INPUT.value,
38712							'l':_this.arParams.MIN_QUERY_LEN,
38713							'type': type,
38714						},
38715						function(result)
38716						{
38717							_this.cache[_this.cache_key] = result;
38718							_this.ShowResult(result);
38719							_this.currentRow = -1;
38720							_this.EnableMouseEvents();
38721							if(_this.WAIT)
38722								_this.WAIT.style.display = 'none';
38723							if (!!callback)
38724								callback();
38725							_this.running = false;
38726
38727							if(_this.needRunAgain){
38728								_this.needRunAgain = false;
38729								_this.onChange(callback);
38730							}
38731						}
38732					);
38733					return;
38734				}
38735				else
38736				{
38737					_this.ShowResult(_this.cache[_this.cache_key]);
38738					_this.currentRow = -1;
38739					_this.EnableMouseEvents();
38740				}
38741			}
38742			else
38743			{
38744				_this.RESULT.style.display = 'none';
38745				_this.currentRow = -1;
38746				_this.UnSelectAll();
38747			}
38748		}
38749		if (!!callback)
38750			callback();
38751		_this.running = false;
38752	};
38753
38754	this.UnSelectAll = function()
38755	{
38756		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38757		if(tbl)
38758		{
38759			var cnt = tbl.rows.length;
38760			for(var i = 0; i < cnt; i++)
38761				tbl.rows[i].className = '';
38762		}
38763	};
38764
38765	this.EnableMouseEvents = function()
38766	{
38767		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38768		if(tbl)
38769		{
38770			var cnt = tbl.rows.length;
38771			for(var i = 0; i < cnt; i++)
38772				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38773				{
38774					tbl.rows[i].id = 'row_' + i;
38775					tbl.rows[i].onmouseover = function (e) {
38776						if(_this.currentRow != this.id.substr(4))
38777						{
38778							_this.UnSelectAll();
38779							this.className = 'title-search-selected';
38780							_this.currentRow = this.id.substr(4);
38781						}
38782					};
38783					tbl.rows[i].onmouseout = function (e) {
38784						this.className = '';
38785						_this.currentRow = -1;
38786					};
38787				}
38788		}
38789	};
38790
38791	this.onFocusLost = function(hide)
38792	{
38793		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
38794		// _this.RESULT.style.display = 'none';
38795	};
38796
38797	this.onFocusGain = function()
38798	{
38799		if(_this.RESULT.innerHTML.length)
38800			_this.ShowResult();
38801	};
38802
38803	this.onKeyDown = function(e)
38804	{
38805		if(!e)
38806			e = window.event;
38807
38808		if (_this.RESULT.style.display == 'block')
38809		{
38810			if(_this.onKeyPress(e.keyCode))
38811				return BX.PreventDefault(e);
38812		}
38813	};
38814
38815	this.adjustResultNode = function()
38816	{
38817		var pos, pos_input;
38818		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
38819		if(!!fixedParent)
38820		{
38821			_this.RESULT.style.position = 'fixed';
38822			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
38823			pos = BX.pos(_this.CONTAINER, true);
38824		}
38825		else
38826		{
38827			_this.RESULT.style.position = 'absolute';
38828			pos = BX.pos(_this.CONTAINER);
38829		}
38830		//console.log(pos);
38831		//console.log(_this.CONTAINER);
38832		pos_input = BX.pos(_this.INPUT);
38833
38834		pos.width = pos.right - pos.left;
38835		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
38836		_this.RESULT.style.left = pos_input.left + 'px';
38837
38838		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
38839			_this.RESULT.style.width = pos_input.width + 'px';
38840		else
38841			_this.RESULT.style.width = pos.width + 'px';
38842		return pos;
38843	};
38844
38845	this._onContainerLayoutChange = function()
38846	{
38847		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
38848		{
38849			_this.adjustResultNode();
38850		}
38851	};
38852	this.Init = function()
38853	{
38854		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
38855		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
38856
38857		this.RESULT = document.body.appendChild(document.createElement("DIV"));
38858
38859		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
38860		if(this.arParams.INPUT_ID != 'title-search-input_fixed')
38861			this.RESULT.className += ' '+arMaxOptions['THEME']['TYPE_SEARCH']+'_type';
38862
38863		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
38864		this.startText = this.oldValue = this.INPUT.value;
38865
38866		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain();});
38867		BX.bind(this.INPUT, 'blur', function() {
38868			setTimeout(function(){
38869				if(!$(_this.INPUT).closest('form').find('.dropdown-select.searchtype .dropdown-select__title.opened').length){
38870					_this.onFocusLost();
38871				}
38872			}, 100);
38873		});
38874
38875		this.TYPE = this.CONTAINER ? this.CONTAINER.querySelector('.dropdown-select.searchtype input[name="type"]') : null;
38876
38877		if(BX.browser.IsSafari() || BX.browser.IsIE())
38878			this.INPUT.onkeydown = this.onKeyDown;
38879		else
38880			this.INPUT.onkeypress = this.onKeyDown;
38881
38882		if(this.arParams.WAIT_IMAGE)
38883		{
38884			this.WAIT = document.body.appendChild(document.createElement("DIV"));
38885			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
38886			if(!BX.browser.IsIE())
38887				this.WAIT.style.backgroundRepeat = 'none';
38888			this.WAIT.style.display = 'none';
38889			this.WAIT.style.position = 'absolute';
38890			this.WAIT.style.zIndex = '1100';
38891		}
38892
38893		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
38894		
38895		if (this.TYPE) {
38896			BX.bind(this.TYPE, 'change', function() {_this.onChange()});
38897		}
38898	};
38899	BX.ready(function (){_this.Init(arParams)});
38900}
38901
38902/* End */
38903;
38904; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/aspro_max/js/searchtitle.js?16660935731924";s:6:"source";s:44:"/local/templates/aspro_max/js/searchtitle.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
38905$(document).on('click', '.dropdown-select.searchtype .dropdown-select__list-link:not(.dropdown-select__list-link--current)', function(){
38906    let $this = $(this);
38907    let $title = $this.closest('.dropdown-select').find('.dropdown-select__title');
38908    let $menu = $this.closest('.dropdown-select').find('.dropdown-select__list');
38909    let bVisibleMeu = $menu.is(':visible');
38910    let animate = !bVisibleMeu ? 'transition.slideUpIn' : 'fadeOut';
38911    let type = $this.data('type');
38912    let name = type === 'all' ? BX.message('SEARCH_IN_SITE') : BX.message('SEARCH_IN_CATALOG');
38913
38914    if (!$title.hasClass('clicked')) {
38915        $title.addClass('clicked');
38916
38917        $menu.velocity('stop').velocity(animate, {
38918            duration: 300,
38919            begin: function () {
38920                $title.toggleClass('opened');
38921            },
38922            complete: function () {
38923                $title.removeClass('clicked');
38924            },
38925        });
38926    }
38927
38928    $.cookie('searchtitle_type', type);
38929
38930    $this.closest('.dropdown-select').find('input[name=type]').val(type);
38931
38932    // remove already visible results
38933    $('.title-search-result').hide().empty();
38934
38935    // fire new search request
38936    BX.fireEvent($this.closest('.dropdown-select').find('input[name=type]')[0], 'change');    
38937
38938    $('.dropdown-select.searchtype').each(function(){
38939        $(this).closest('form').attr('action', type === 'all' ? arAsproOptions.PAGES.SEARCH_PAGE_URL : arAsproOptions.PAGES.CATALOG_PAGE_URL);
38940        $(this).find('.dropdown-select__title>span').text(name);
38941        $(this).find('input[name=type]').val(type);
38942
38943        $(this).find('.dropdown-select__list-link').removeClass('dropdown-select__list-link--current');
38944        $(this).find('.dropdown-select__list-link[data-type=' + type + ']').addClass('dropdown-select__list-link--current');
38945    });
38946
38947    try {
38948        $this.closest('form').find('input[name=q]')[0].focus();
38949    }
38950    catch (e) {
38951    }
38952});
38953/* End */
38954;
38955; /* Start:"a:4:{s:4:"full";s:49:"/local/js/logictim.balls/basket.js?17494589713128";s:6:"source";s:34:"/local/js/logictim.balls/basket.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
38956BX.ready(function(){
38957	if(!BX.Sale || !BX.Sale.BasketComponent)
38958		return;
38959		
38960		logictimBasket('first');
38961});
38962
38963BX.addCustomEvent('onAjaxSuccess', function(command,params) {logictimBasket(params);});
38964
38965
38966function logictimBasket(params) {
38967	
38968	if(!BX.Sale || !BX.Sale.BasketComponent)
38969		return;
38970	
38971	if(!BX.Sale.BasketComponent.result)
38972		return;
38973		
38974	if(!BX.Sale.BasketComponent.result.GRID.ROWS && BX.Sale.BasketComponent.result.BASKET_ITEM_RENDER_DATA) //DLYA ASPRO
38975		BX.Sale.BasketComponent.result.GRID.ROWS = BX.Sale.BasketComponent.result.BASKET_ITEM_RENDER_DATA;
38976	if(!BX.Sale.BasketComponent.result.GRID.ROWS)
38977		return;
38978	
38979	if(params.url == '/local/components/logictim/bonus.ajax/bonus_cart_ajax.php')
38980		return;
38981		
38982	//CHECK CAN_BUY
38983	var rows = [];
38984	for(id in BX.Sale.BasketComponent.result.GRID.ROWS) {
38985		var row = BX.Sale.BasketComponent.result.GRID.ROWS[id];
38986		if(row['CAN_BUY'] != 'N' && row['NOT_AVAILABLE'] != true)
38987			rows[id] = row;
38988	}
38989	
38990		
38991	BX.ajax({
38992		url: '/local/components/logictim/bonus.ajax/bonus_cart_ajax.php',
38993		method: 'POST',
38994		data: rows,
38995		dataType: 'json',
38996		onsuccess: function(result) {
38997			setBonusInBasket(result);
38998		}
38999	});
39000}
39001
39002function setBonusInBasket(result) {
39003	
39004	//for standart template of cart
39005	if(BX.findChild(BX('basket-root'), {'tag': 'div', 'class': 'basket-checkout-block-total-price-inner'}, true))
39006		var itog_block = BX.findChild(BX('basket-root'), {'tag': 'div', 'class': 'basket-checkout-block-total-price-inner'}, true);
39007	else
39008	{
39009		//for template of Aspro.Max 'V2'
39010		if(BX.findChild(BX('basket-root'), {'tag': 'div', 'class': 'basket-coupon-block-total-price-current'}, true))
39011			var itog_block = BX.findChild(BX('basket-root'), {'tag': 'div', 'class': 'basket-coupon-block-total-price-current'}, true);
39012	}
39013	
39014	var bonus_all = BX.create('DIV', {props: {id: 'bonus_all', className: 'lt_cart_bonus_all'}, style: {order: '10', fontWeight: 'normal'}, html: result.ALL_BONUS_FORMAT});
39015	BX.remove(BX('bonus_all'));
39016	
39017	if(parseFloat(result.ALL_BONUS) > 0)
39018		itog_block.appendChild(bonus_all);
39019	
39020	for(id in result.ITEMS) {
39021		var item = result.ITEMS[id];
39022		var product_block = BX('basket-item-'+item.BASKET_ITEM_ID);
39023		
39024		if(!product_block)
39025			continue;
39026		
39027		BX.remove(BX('bonus_item_'+item.BASKET_ITEM_ID));
39028		var bonus_item = BX.create('DIV', {props: {id: 'bonus_item_'+item.BASKET_ITEM_ID, className: 'bonus bonus_item_cart'}, style: {order: '10', fontWeight: 'normal'}, html: item.ADD_BONUS_FORMAT});
39029		
39030		//NEW CART VERSION
39031		if(BX('basket-item-sum-price-'+item.BASKET_ITEM_ID))
39032		{
39033			var price_for_item = BX('basket-item-sum-price-'+item.BASKET_ITEM_ID);
39034			if(parseFloat(item.ADD_BONUS) > 0)
39035				price_for_item.appendChild(bonus_item);
39036		}
39037		//OLD CART VERSION
39038		else
39039		{
39040			var price_blocks = BX.findChild(product_block, {'tag': 'div', 'class': 'basket-item-block-price'}, true, true);
39041			var price_for_one = price_blocks[0];
39042			var price_for_item = price_blocks[1];
39043			
39044			if(parseFloat(item.ADD_BONUS) > 0)
39045				price_for_item.appendChild(bonus_item);
39046		}
39047			
39048		//console.log(price_for_one);
39049	}
39050	
39051	
39052}
39053/* End */
39054;
39055; /* Start:"a:4:{s:4:"full";s:54:"/local/templates/aspro_max/js/custom.js?17900720181204";s:6:"source";s:39:"/local/templates/aspro_max/js/custom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
39056function loadSmartCaptcha(id) {
39057	const waitForSmartCaptcha = setInterval(() => {
39058		if (window.smartCaptcha) {
39059			clearInterval(waitForSmartCaptcha);
39060			const container = document.getElementById(id);
39061
39062			const widgetId = window.smartCaptcha.render(container, {
39063				sitekey: 'ysc1_uJ8xdGPEQYPfelQJvYq5BjhvFrklNLTcTTvqt5Iz2c7c71b8',
39064				hl: 'ru',
39065				callback: function (token) {
39066				},
39067				invisible: true,
39068				hideShield: true,
39069			});
39070
39071			container.closest('form').dataset.widgetId = widgetId;
39072
39073			return widgetId;
39074		}
39075	}, 100);
39076}
39077
39078$(document).on('click', '.detail-news1 .to-cart', function () {
39079	ym(20761690, 'reachGoal', 'blog2basket');
39080	console.log('Ушла цель blog2basket');
39081});
39082
39083$(function ($) {
39084	$(document).mouseup(function (e) { // событие клика по веб-документу
39085		var div = $(".holidays-notice-popup-inner");
39085 // тут указываем ID элемента
39086		if (!div.is(e.target) // если клик был не по нашему блоку
39087			&& div.has(e.target).length === 0) { // и не по его дочерним элементам
39088			$('#holiday-notice-popup').hide(); // скрываем его
39089			$('body').css('overflow-y', 'visible');
39090		}
39091	});
39092});
39093/* End */
39094;; /* /local/templates/aspro_max/vendor/js/velocity/velocity.js?166601759344791*/
39095; /* /local/templates/aspro_max/vendor/js/velocity/velocity.ui.js?166601759313257*/
39096; /* /local/templates/aspro_max/js/jquery.dotdotdot.js?16660175935908*/
39097; /* /local/templates/aspro_max/js/jqModal.js?166601759311178*/
39098; /* /local/templates/aspro_max/js/jquery.ikSelect.js?166609357332265*/
39099; /* /local/templates/aspro_max/vendor/js/bootstrap.js?166601759327908*/
39100; /* /local/templates/aspro_max/js/jquery.actual.min.js?16660175931238*/
39101; /* /local/templates/aspro_max/vendor/js/jquery.bxslider.js?166601759366080*/
39102; /* /local/templates/aspro_max/vendor/js/ripple.js?16660175934702*/
39103; /* /local/templates/aspro_max/js/browser.js?1666017593996*/
39104; /* /local/templates/aspro_max/js/jquery.uniform.min.js?16660175938308*/
39105; /* /local/templates/aspro_max/vendor/js/moment.min.js?166601759334436*/
39106; /* /local/templates/aspro_max/vendor/js/footable.js?1666017593268108*/
39107; /* /local/templates/aspro_max/vendor/js/sticky-sidebar.js?166601759325989*/
39108; /* /local/templates/aspro_max/js/jquery.validate.min.js?166601759322254*/
39109; /* /local/templates/aspro_max/js/jquery.alphanumeric.js?16660175931901*/
39110; /* /local/templates/aspro_max/js/jquery.cookie.js?16660175933066*/
39111; /* /local/templates/aspro_max/js/mobile.js?169745415728345*/
39112; /* /local/templates/aspro_max/js/main.js?1790072018399787*/
39113; /* /local/templates/aspro_max/js/blocks/blocks.js?16660175939271*/
39114; /* /local/templates/aspro_max/js/swiper.js?1679582531325175*/
39115; /* /local/templates/aspro_max/js/jQuery.Brazzers-Carousel.js?1666017593926*/
39116; /* /local/templates/aspro_max/js/main-custom.js?170608091114122*/
39117; /* /local/templates/aspro_max/js/jquery.magnific-popup.js?166601759341730*/
39118; /* /local/templates/aspro_max/js/jquery.mCustomScrollbar.concat.min.js?166601759345485*/
39119; /* /local/templates/aspro_max/js/jquery.autocomplete.js?166601759332714*/
39120; /* /bitrix/components/bitrix/search.title/script.js?177454507810573*/
39121; /* /local/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js?166601759310313*/
39122; /* /local/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js?1666017593201*/
39123; /* /local/templates/aspro_max/components/bitrix/menu/header_top/script.js?168933586935*/
39124; /* /local/templates/aspro_max/components/bitrix/menu/top_catalog_wide/script.js?1666017593201*/
39125; /* /local/templates/aspro_max/components/bitrix/menu/top/script.js?166601759335*/
39126; /* /local/templates/aspro_max/components/aspro/regionality.list.max/popup_regions_small/script.js?16660175931104*/
39127; /* /local/templates/aspro_max/components/bitrix/news.list/banners/script.js?166601759382*/
39128; /* /local/templates/aspro_max/components/bitrix/catalog.section/product_list/script.js?16660175938513*/
39129; /* /local/templates/aspro_max/js/blocks/blocks.min.js?16660175938843*/
39130; /* /local/templates/aspro_max/components/bitrix/catalog.section/product_list_bestsellers/script.js?16660175938411*/
39131; /* /local/templates/aspro_max/components/bitrix/search.title/fixed/script.js?166601759310846*/
39132; /* /local/templates/aspro_max/js/searchtitle.js?16660935731924*/
39133; /* /local/js/logictim.balls/basket.js?17494589713128*/
39134; /* /local/templates/aspro_max/js/custom.js?17900720181204*/
39135
39136//# sourceMappingURL=template_3a8b2f2c9363ca62cb4b0c6f276d21ff.map.js

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.