PageSourceSearch

https://garden-shop.ru/bitrix/cache/js/s1/gardenshop/template_93d1…9590d62e228de564a279_v1.js?1786739460304380

js garden-shop.ru collected 2026-10-07 15:24:49 UTC 304,380 bytes, 4,865 lines download raw bytes

vendor: 5,255 bytes, lines 1-4
1
2; /* Start:"a:4:{s:4:"full";s:73:"/local/templates/gardenshop/lib/fancybox/fancybox.umd.js?1714684890105639";s:6:"source";s:56:"/local/templates/gardenshop/lib/fancybox/fancybox.umd.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3// @fancyapps/ui/Fancybox v4.0.31
4!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function i(t){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,i){return e&&a(t.prototype,e),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return d(t)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=c(t);if(e){var o=c(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return u(this,i)}}function v(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=v(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:i):o.value}},p.apply(this,arguments)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,o,a=[],s=!0,r=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){r=!0,o=t}finally{try{s||null==i.return||i.return()}finally{if(r)throw o}}return a}(t,e)||y(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return b(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function x(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=y(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){r=!0,a=t}
4,f:function(){try{s||null==i.return||i.return()}finally{if(r)throw a}}}}var w=function(t){return"object"===n(t)&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)},k=function t(){for(var e=!1,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];"boolean"==typeof o[0]&&(e=o.shift());var s=o[0];if(!s||"object"!==n(s))throw new Error("extendee must be an object");for(var r=o.slice(1),l=r.length,c=0;c<l;c++){var h=r[c];for(var d in h)if(h.hasOwnProperty(d)){var u=h[d];if(e&&(Array.isArray(u)||w(u))){var f=Array.isArray(u)?[]:{};s[d]=t(!0,s.hasOwnProperty(d)?s[d]:f,u)}else s[d]=u}}return s},S=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;return t=parseFloat(t)||0,Math.round((t+Number.EPSILON)*e)/e},C=function t(e){return!!(e&&"object"===n(e)&&e instanceof Element&&e!==document.body)&&(!e.__Panzoom&&(function(t){var e=getComputedStyle(t)["overflow-y"],i=getComputedStyle(t)["overflow-x"],n=("scroll"===e||"auto"===e)&&Math.abs(t.scrollHeight-t.clientHeight)>1,o=("scroll"===i||"auto"===i)&&Math.abs(t.scrollWidth-t.clientWidth)>1;return n||o}(e)?e:t(e.parentNode)))},$="undefined"!=typeof window&&window.ResizeObserver||function(){function t(e){o(this,t),this.observables=[],this.boundCheck=this.check.bind(this),this.boundCheck(),this.callback=e}return s(t,[{key:"observe",value:function(t){if(!this.observables.some((function(e){return e.el===t}))){var e={el:t,size:{height:t.clientHeight,width:t.clientWidth}};this.observables.push(e)}}},{key:"unobserve",value:function(t){this.observables=this.observables.filter((function(e){return e.el!==t}))}},{key:"disconnect",value:function(){this.observables=[]}},{key:"check",value:function(){var t=this.observables.filter((function(t){var e=t.el.clientHeight,i=t.el.clientWidth;if(t.size.height!==e||t.size.width!==i)return t.size.height=e,t.size.width=i,!0})).map((function(t){return t.el}));t.length>0&&this.callback(t),window.requestAnimationFrame(this.boundCheck)}}]),t}(),E=s((function t(e){o(this,t),this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY})),P=function(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0},T=function(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t},L=function(t){return"changedTouches"in t},_=function(){function t(e){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.start,s=void 0===a?function(){return!0}:a,r=n.move,l=void 0===r?function(){}:r,c=n.end,h=void 0===c?function(){}:c;o(this,t),this._element=e,this.startPointers=[],this.currentPointers=[],this._pointerStart=function(t){if(!(t.buttons>0&&0!==t.button)){var e=new E(t);i.currentPointers.some((function(t){return t.id===e.id}))||i._triggerPointerStart(e,t)&&(window.addEventListener("mousemove",i._move),window.addEventListener("mouseup",i._pointerEnd))}},this._touchStart=function(t){for(var e=0,n=Array.from(t.changedTouches||[]);e<n.length;e++){var o=n[e];i._triggerPointerStart(new E(o),t)}},this._move=function(t){var e,n=i.currentPointers.slice(),o=L(t)?Array.from(t.changedTouches).map((function(t){return new E(t)})):[new E(t)],a=[],s=x(o);try{var r=function(){var t=e.value,n=i.currentPointers.findIndex((function(e){return e.id===t.id}));if(n<0)return"continue";a.push(t),i.currentPointers[n]=t};for(s.s();!(e=s.n()).done;)r()}catch(t){s.e(t)}finally{s.f()}i._moveCallback(n,i.currentPointers.slice(),t)},this._triggerPointerEnd=function(t,e){var n=i.currentPointers.findIndex((function(e){return e.id===t.id}));return!(n<0)&&(i.currentPointers.splice(n,1),i.startPointers.splice(n,1),i._endCallback(t,e),!0)},this._pointerEnd=function(t){t.buttons>0&&0!==t.button||i._triggerPointerEnd(new E(t),t)&&(window.removeEventListener("mousemove",i._move,{passive:!1}),window.removeEventListener("mouseup",i._pointerEnd,{passive:!1}))},this._touchEnd=function(t){for(var e=0,n=Array.from(t.changedTouches||[]);e<n.length;e++){var o=n[e];i._triggerPointerEnd(new E(o),t)}},this._startCallback=s,this._moveCallback=l,this._endCallback=h,this._element.addEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.addEventListener("touchstart",this._touchStart,{passive:!1}),this._element.addEventListener("touchmove",this._move,{passive:!1}),this._element.addEventListener("touchend",this._touchEnd),this._element.addEventListener("touchcancel",this._touchEnd)}return s(t,[{key:"stop",value:function(){this._element.removeEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.removeEventListener("touchstart",this._touchStart,{passive:!1}),this._element.removeEventListener("touchmove",this._move,{passive:!1}),this._element.removeEventListener("touchend",this._touchEnd),this._element.removeEventListener("touchcancel",this._touchEnd),window.removeEventListener("mousemove",this._move),window.removeEventListener("mouseup",this._pointerEnd)}},{key:"_triggerPointerStart",value:function(t,e){return!!this._startCallback(t,e)&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}}]),t}(),A=function(t,e){return t.split(".").reduce((function(t,e){return t&&t[e]}
4),e)},O=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),this.options=k(!0,{},e),this.plugins=[],this.events={};for(var i=0,n=["on","once"];i<n.length;i++)for(var a=n[i],s=0,r=Object.entries(this.options[a]||{});s<r.length;s++){var l=r[s];this[a].apply(this,m(l))}}return s(t,[{key:"option",value:function(t,e){t=String(t);var i=A(t,this.options);if("function"==typeof i){for(var n,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];i=(n=i).call.apply(n,[this,this].concat(a))}return void 0===i?e:i}},{key:"localize",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t=(t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,(function(t,n,o){var a="";o?a=e.option("".concat(n[0]+n.toLowerCase().substring(1),".l10n.").concat(o)):n&&(a=e.option("l10n.".concat(n))),a||(a=t);for(var s=0;s<i.length;s++)a=a.split(i[s][0]).join(i[s][1]);return a}))).replace(/\{\{(.*)\}\}/,(function(t,e){return e}))}},{key:"on",value:function(t,e){var i=this;if(w(t)){for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.on.apply(this,m(a))}return this}return String(t).split(" ").forEach((function(t){var n=i.events[t]=i.events[t]||[];-1==n.indexOf(e)&&n.push(e)})),this}},{key:"once",value:function(t,e){var i=this;if(w(t)){for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.once.apply(this,m(a))}return this}return String(t).split(" ").forEach((function(t){var n=function n(){i.off(t,n);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];e.call.apply(e,[i,i].concat(a))};n._=e,i.on(t,n)})),this}},{key:"off",value:function(t,e){var i=this;if(!w(t))return t.split(" ").forEach((function(t){var n=i.events[t];if(!n||!n.length)return i;for(var o=-1,a=0,s=n.length;a<s;a++){var r=n[a];if(r&&(r===e||r._===e)){o=a;break}}-1!=o&&n.splice(o,1)})),this;for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.off.apply(this,m(a))}}},{key:"trigger",value:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];var o,a=x(m(this.events[t]||[]).slice());try{for(a.s();!(o=a.n()).done;){var s=o.value;if(s&&!1===s.call.apply(s,[this,this].concat(i)))return!1}}catch(t){a.e(t)}finally{a.f()}var r,l=x(m(this.events["*"]||[]).slice());try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c&&!1===c.call.apply(c,[this,t,this].concat(i)))return!1}}catch(t){l.e(t)}finally{l.f()}return!0}},{key:"attachPlugins",value:function(t){for(var e={},i=0,n=Object.entries(t||{});i<n.length;i++){var o=g(n[i],2),a=o[0],s=o[1];!1===this.options[a]||this.plugins[a]||(this.options[a]=k({},s.defaults||{},this.options[a]),e[a]=new s(this))}for(var r=0,l=Object.entries(e);r<l.length;r++){var c=g(l[r],2);c[0],c[1].attach(this)}return this.plugins=Object.assign({},this.plugins,e),this}},{key:"detachPlugins",value:function(){for(var t in this.plugins){var e=void 0;(e=this.plugins[t])&&"function"==typeof e.detach&&e.detach(this)}return this.plugins={},this}}]),t}(),z={touch:!0,zoom:!0,pinchToZoom:!0,panOnlyZoomed:!1,lockAxis:!1,friction:.64,decelFriction:.88,zoomFriction:.74,bounceForce:.2,baseScale:1,minScale:1,maxScale:2,step:.5,textSelection:!1,click:"toggleZoom",wheel:"zoom",wheelFactor:42,wheelLimit:5,draggableClass:"is-draggable",draggingClass:"is-dragging",ratio:1},M=function(t){l(n,t);var e=f(n);function n(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,n),(i=e.call(this,k(!0,{},z,a))).state="init",i.$container=t;for(var s=0,r=["onLoad","onWheel","onClick"];s<r.length;s++){var l=r[s];i[l]=i[l].bind(d(i))}return i.initLayout(),i.resetValues(),i.attachPlugins(n.Plugins),i.trigger("init"),i.updateMetrics(),i.attachEvents(),i.trigger("ready"),!1===i.option("centerOnStart")?i.state="ready":i.panTo({friction:0}),t.__Panzoom=d(i),i}return s(n,[{key:"initLayout",value:function(){var t=this.$container;if(!(t instanceof HTMLElement))throw new Error("Panzoom: Container not found");var e=this.option("content")||t.querySelector(".panzoom__content");if(!e)throw new Error("Panzoom: Content not found");this.$content=e;var i,n=this.option("viewport")||t.querySelector(".panzoom__viewport");n||!1===this.option("wrapInner")||((n=document.createElement("div")).classList.add("panzoom__viewport"),(i=n).append.apply(i,m(t.childNodes)),t.appendChild(n));this.$viewport=n||e.parentNode}},{key:"resetValues",value:function(){this.updateRate=this.option("updateRate",/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)?250:24),this.container={width:0,height:0},this.viewport={width:0,height:0},this.content={origWidth:0,origHeight:0,width:0,height:0,x:this.option("x",0),y:this.option("y",0),scale:this.option("baseScale")},this.transform={x:0,y:0,scale:1},this.resetDragPosition()}},{key:"onLoad",value:function(t){this.updateMetrics(),this.panTo({scale:this.option("baseScale"),friction:0}),this.trigger("load",t)}},{key:"onClick",value:function(t){if(!(t.defaultPrevented||document.activeElement&&document.activeElement.closest("[contenteditable]")))if(!this.option("textSelection")||!window.getSelection().toString().length||t.target&&t.target.hasAttribute("data-fancybox-close")){var e=this.$content.getClientRects()[0];if("ready"!==this.state&&(this.dragPosition.midPoint||Math.abs(e.top-this.dragStart.rect.top)>1||Math.abs(e.left-this.dragStart.rect.left)>1))return t.preventDefault(),void t.stopPropagation();!1!==this.trigger("click",t)&&this.option("zoom")&&"toggleZoom"===this.option("click")&&(t.preventDefault(),t.stopPropagation(),this.zoomWithClick(t))}else t.stopPropagation()}},{key:"onWheel",value:function(t){!1!==this.trigger("wheel",t)&&this.option("zoom")&&this.option("wheel")&&this.zoomWithWheel(t)}},{key:"zoomWithWheel",value:function(t){void 0===this.changedDelta&&(this.changedDelta=0);var e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)),i=this.content.scale,n=i*(100+e*this.option("wheelFactor"))/100;if(e<0&&Math.abs(i-this.option("minScale"))<.01||e>0&&Math.abs(i-this.option("maxScale"))<.01?(this.changedDelta+=Math.abs(e),n=i):(this.changedDelta=0,n=Math.max(Math.min(n,this.option("maxScale")),this.option("minScale"))),!(this.changedDelta>this.option("wheelLimit"))&&(t.preventDefault(),n!==i)){var o=this.$content.getBoundingClientRect(),a=t.clientX-o.left,s=t.clientY-o.top;this.zoomTo(n,{x:a,y:s}
4)}}},{key:"zoomWithClick",value:function(t){var e=this.$content.getClientRects()[0],i=t.clientX-e.left,n=t.clientY-e.top;this.toggleZoom({x:i,y:n})}},{key:"attachEvents",value:function(){var t=this;this.$content.addEventListener("load",this.onLoad),this.$container.addEventListener("wheel",this.onWheel,{passive:!1}),this.$container.addEventListener("click",this.onClick,{passive:!1}),this.initObserver();var e=new _(this.$container,{start:function(i,n){if(!t.option("touch"))return!1;if(t.velocity.scale<0)return!1;var o=n.composedPath()[0];if(!e.currentPointers.length){if(-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(o.nodeName))return!1;if(t.option("textSelection")&&function(t,e,i){for(var n=t.childNodes,o=document.createRange(),a=0;a<n.length;a++){var s=n[a];if(s.nodeType===Node.TEXT_NODE){o.selectNodeContents(s);var r=o.getBoundingClientRect();if(e>=r.left&&i>=r.top&&e<=r.right&&i<=r.bottom)return s}}return!1}(o,i.clientX,i.clientY))return!1}return!C(o)&&(!1!==t.trigger("touchStart",n)&&("mousedown"===n.type&&n.preventDefault(),t.state="pointerdown",t.resetDragPosition(),t.dragPosition.midPoint=null,t.dragPosition.time=Date.now(),!0))},move:function(i,n,o){if("pointerdown"===t.state)if(!1!==t.trigger("touchMove",o)){if(!(n.length<2&&!0===t.option("panOnlyZoomed")&&t.content.width<=t.viewport.width&&t.content.height<=t.viewport.height&&t.transform.scale<=t.option("baseScale"))&&(!(n.length>1)||t.option("zoom")&&!1!==t.option("pinchToZoom"))){var a=T(i[0],i[1]),s=T(n[0],n[1]),r=s.clientX-a.clientX,l=s.clientY-a.clientY,c=P(i[0],i[1]),h=P(n[0],n[1]),d=c&&h?h/c:1;t.dragOffset.x+=r,t.dragOffset.y+=l,t.dragOffset.scale*=d,t.dragOffset.time=Date.now()-t.dragPosition.time;var u=1===t.dragStart.scale&&t.option("lockAxis");if(u&&!t.lockAxis){if(Math.abs(t.dragOffset.x)<6&&Math.abs(t.dragOffset.y)<6)return void o.preventDefault();var f=Math.abs(180*Math.atan2(t.dragOffset.y,t.dragOffset.x)/Math.PI);t.lockAxis=f>45&&f<135?"y":"x"}if("xy"===u||"y"!==t.lockAxis){if(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),t.lockAxis&&(t.dragOffset["x"===t.lockAxis?"y":"x"]=0),t.$container.classList.add(t.option("draggingClass")),t.transform.scale===t.option("baseScale")&&"y"===t.lockAxis||(t.dragPosition.x=t.dragStart.x+t.dragOffset.x),t.transform.scale===t.option("baseScale")&&"x"===t.lockAxis||(t.dragPosition.y=t.dragStart.y+t.dragOffset.y),t.dragPosition.scale=t.dragStart.scale*t.dragOffset.scale,n.length>1){var v=T(e.startPointers[0],e.startPointers[1]),p=v.clientX-t.dragStart.rect.x,g=v.clientY-t.dragStart.rect.y,m=t.getZoomDelta(t.content.scale*t.dragOffset.scale,p,g),y=m.deltaX,b=m.deltaY;t.dragPosition.x-=y,t.dragPosition.y-=b,t.dragPosition.midPoint=s}else t.setDragResistance();t.transform={x:t.dragPosition.x,y:t.dragPosition.y,scale:t.dragPosition.scale},t.startAnimation()}}}else o.preventDefault()},end:function(n,o){if("pointerdown"===t.state)if(t._dragOffset=i({},t.dragOffset),e.currentPointers.length)t.resetDragPosition();else if(t.state="decel",t.friction=t.option("decelFriction"),t.recalculateTransform(),t.$container.classList.remove(t.option("draggingClass")),!1!==t.trigger("touchEnd",o)&&"decel"===t.state){var a=t.option("minScale");if(t.transform.scale<a)t.zoomTo(a,{friction:.64});else{var s=t.option("maxScale");if(t.transform.scale-s>.01){var r=t.dragPosition.midPoint||n,l=t.$content.getClientRects()[0];t.zoomTo(s,{friction:.64,x:r.clientX-l.left,y:r.clientY-l.top})}else;}}}});this.pointerTracker=e}},{key:"initObserver",value:function(){var t=this;this.resizeObserver||(this.resizeObserver=new $((function(){t.updateTimer||(t.updateTimer=setTimeout((function(){var e=t.$container.getBoundingClientRect();e.width&&e.height?((Math.abs(e.width-t.container.width)>1||Math.abs(e.height-t.container.height)>1)&&(t.isAnimating()&&t.endAnimation(!0),t.updateMetrics(),t.panTo({x:t.content.x,y:t.content.y,scale:t.option("baseScale"),friction:0})),t.updateTimer=null):t.updateTimer=null}),t.updateRate))})),this.resizeObserver.observe(this.$container))}},{key:"resetDragPosition",value:function(){this.lockAxis=null,this.friction=this.option("friction"),this.velocity={x:0,y:0,scale:0};var t=this.content,e=t.x,n=t.y,o=t.scale;
4this.dragStart={rect:this.$content.getBoundingClientRect(),x:e,y:n,scale:o},this.dragPosition=i(i({},this.dragPosition),{},{x:e,y:n,scale:o}),this.dragOffset={x:0,y:0,scale:1,time:0}}},{key:"updateMetrics",value:function(t){!0!==t&&this.trigger("beforeUpdate");var e,n=this.$container,o=this.$content,a=this.$viewport,s=o instanceof HTMLImageElement,r=this.option("zoom"),l=this.option("resizeParent",r),c=this.option("width"),h=this.option("height"),d=c||(e=o,Math.max(parseFloat(e.naturalWidth||0),parseFloat(e.width&&e.width.baseVal&&e.width.baseVal.value||0),parseFloat(e.offsetWidth||0),parseFloat(e.scrollWidth||0))),u=h||function(t){return Math.max(parseFloat(t.naturalHeight||0),parseFloat(t.height&&t.height.baseVal&&t.height.baseVal.value||0),parseFloat(t.offsetHeight||0),parseFloat(t.scrollHeight||0))}(o);Object.assign(o.style,{width:c?"".concat(c,"px"):"",height:h?"".concat(h,"px"):"",maxWidth:"",maxHeight:""}),l&&Object.assign(a.style,{width:"",height:""});var f=this.option("ratio");c=d=S(d*f),h=u=S(u*f);var v=o.getBoundingClientRect(),p=a.getBoundingClientRect(),g=a==n?p:n.getBoundingClientRect(),m=Math.max(a.offsetWidth,S(p.width)),y=Math.max(a.offsetHeight,S(p.height)),b=window.getComputedStyle(a);if(m-=parseFloat(b.paddingLeft)+parseFloat(b.paddingRight),y-=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),this.viewport.width=m,this.viewport.height=y,r){if(Math.abs(d-v.width)>.1||Math.abs(u-v.height)>.1){var x=function(t,e,i,n){var o=Math.min(i/t||0,n/e);return{width:t*o||0,height:e*o||0}}(d,u,Math.min(d,v.width),Math.min(u,v.height));c=S(x.width),h=S(x.height)}Object.assign(o.style,{width:"".concat(c,"px"),height:"".concat(h,"px"),transform:""})}if(l&&(Object.assign(a.style,{width:"".concat(c,"px"),height:"".concat(h,"px")}),this.viewport=i(i({},this.viewport),{},{width:c,height:h})),s&&r&&"function"!=typeof this.options.maxScale){var w=this.option("maxScale");this.options.maxScale=function(){return this.content.origWidth>0&&this.content.fitWidth>0?this.content.origWidth/this.content.fitWidth:w}}this.content=i(i({},this.content),{},{origWidth:d,origHeight:u,fitWidth:c,fitHeight:h,width:c,height:h,scale:1,isZoomable:r}),this.container={width:g.width,height:g.height},!0!==t&&this.trigger("afterUpdate")}},{key:"zoomIn",value:function(t){this.zoomTo(this.content.scale+(t||this.option("step")))}},{key:"zoomOut",value:function(t){this.zoomTo(this.content.scale-(t||this.option("step")))}},{key:"toggleZoom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.option("maxScale"),i=this.option("baseScale"),n=this.content.scale>i+.5*(e-i)?i:e;this.zoomTo(n,t)}},{key:"zoomTo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.option("baseScale"),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.x,n=void 0===i?null:i,o=e.y,a=void 0===o?null:o;t=Math.max(Math.min(t,this.option("maxScale")),this.option("minScale"));var s=S(this.content.scale/(this.content.width/this.content.fitWidth),1e7);null===n&&(n=this.content.width*s*.5),null===a&&(a=this.content.height*s*.5);var r=this.getZoomDelta(t,n,a),l=r.deltaX,c=r.deltaY;n=this.content.x-l,a=this.content.y-c,this.panTo({x:n,y:a,scale:t,friction:this.option("zoomFriction")})}},{key:"getZoomDelta",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.content.fitWidth*this.content.scale,o=this.content.fitHeight*this.content.scale,a=e>0&&n?e/n:0,s=i>0&&o?i/o:0,r=this.content.fitWidth*t,l=this.content.fitHeight*t,c=(r-n)*a,h=(l-o)*s;return{deltaX:c,deltaY:h}}},{key:"panTo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.x,n=void 0===e?this.content.x:e,o=t.y,a=void 0===o?this.content.y:o,s=t.scale,r=t.friction,l=void 0===r?this.option("friction"):r,c=t.ignoreBounds,h=void 0!==c&&c;if(s=s||this.content.scale||1,!h){var d=this.getBounds(s),u=d.boundX,f=d.boundY;u&&(n=Math.max(Math.min(n,u.to),u.from)),f&&(a=Math.max(Math.min(a,f.to),f.from))}this.friction=l,this.transform=i(i({},this.transform),{},{x:n,y:a,scale:s}),l?(this.state="panning",this.velocity={x:(1/this.friction-1)*(n-this.content.x),y:(1/this.friction-1)*(a-this.content.y),scale:(1/this.friction-1)*(s-this.content.scale)},this.startAnimation()):this.endAnimation()}},{key:"startAnimation",value:function(){var t=this;this.rAF?cancelAnimationFrame(this.rAF):this.trigger("startAnimation"),this.rAF=requestAnimationFrame((function(){return t.animate()}))}},{key:"animate",value:function(){var t=this;if(this.setEdgeForce(),this.setDragForce(),this.velocity.x*=this.friction,this.velocity.y*=this.friction,this.velocity.scale*=this.friction,this.content.x+=this.velocity.x,this.content.y+=this.velocity.y,this.content.scale+=this.velocity.scale,this.isAnimating())this.setTransform();else if("pointerdown"!==this.state)return void this.endAnimation();this.rAF=requestAnimationFrame((function(){return t.animate()}))}},{key:"getBounds",value:function(t){var e=this.boundX,i=this.boundY;if(void 0!==e&&void 0!==i)return{boundX:e,boundY:i};e={from:0,to:0},i={from:0,to:0},t=t||this.transform.scale;var n=this.content.fitWidth*t,o=this.content.fitHeight*t,a=this.viewport.width,s=this.viewport.height;if(n<a){var r=S(.5*(a-n));e.from=r,e.to=r}else e.from=S(a-n);if(o<s){var l=.5*(s-o);i.from=l,i.to=l}else i.from=S(s-o);return{boundX:e,boundY:i}}},{key:"setEdgeForce",value:function(){if("decel"===this.state){var t,e,i,n,o=this.option("bounceForce"),a=this.getBounds(Math.max(this.transform.scale,this.content.scale)),s=a.boundX,r=a.boundY;if(s&&(t=this.content.x<s.from,e=this.content.x>s.to),r&&(i=this.content.y<r.from,n=this.content.y>r.to),t||e){var l=((t?s.from:s.to)-this.content.x)*o,c=this.content.x+(this.velocity.x+l)/this.friction;c>=s.from&&c<=s.to&&(l+=this.velocity.x),this.velocity.x=l,this.recalculateTransform()}if(i||n){var h=((i?r.from:r.to)-this.content.y)*o,d=this.content.y+(h+this.velocity.y)/this.friction;d>=r.from&&d<=r.to&&(h+=this.velocity.y),this.velocity.y=h,this.recalculateTransform()}}}},{key:"setDragResistance",value:function(){if("pointerdown"===this.state){var t,e,i,n,o=this.getBounds(this.dragPosition.scale),a=o.boundX,s=o.boundY;if(a&&(t=this.dragPosition.x<a.from,e=this.dragPosition.x>a.to),s&&(i=this.dragPosition.y<s.from,n=this.dragPosition.y>s.to),(t||e)&&(!t||!e)){var r=t?a.from:a.to,l=r-this.dragPosition.x;this.dragPosition.x=r-.3*l}if((i||n)&&(!i||!n)){var c=i?s.from:s.to,h=c-this.dragPosition.y;this.dragPosition.y=c-.3*h}}}},{key:"setDragForce",value:function(){"pointerdown"===this.state&&(this.velocity.x=this.dragPosition.x-this.content.x,this.velocity.y=this.dragPosition.y-this.content.y,this.velocity.scale=this.dragPosition.scale-this.content.scale)}},{key:"recalculateTransform",value:function(){this.transform.x=this.content.x+this.velocity.x/(1/this.friction-1),this.transform.y=this.content.y+this.velocity.y/(1/this.friction-1),this.transform.scale=this.content.scale+this.velocity.scale/(1/this.friction-1)}},{key:"isAnimating",value:function(){return!(!this.friction||!(Math.abs(this.velocity.x)>.05||Math.abs(this.velocity.y)>.05||Math.abs(this.velocity.scale)>.05))}},{key:"setTransform",value:function(t){var e,n,o,a,s;(t?(e=S(this.transform.x),n=S(this.transform.y),o=this.transform.scale,this.content=i(i({},this.content),{},{x:e,y:n,scale:o})):(e=S(this.content.x),n=S(this.content.y),o=this.content.scale/(this.content.width/this.content.fitWidth),this.content=i(i({},this.content),{},{x:e,y:n})),this.trigger("beforeTransform"),e=S(this.content.x),n=S(this.content.y),t&&this.option("zoom"))?(a=S(this.content.fitWidth*o),s=S(this.content.fitHeight*o),this.content.width=a,this.content.height=s,this.transform=i(i({},this.transform),{},{width:a,height:s,scale:o}),Object.assign(this.$content.style,{width:"".concat(a,"px"),height:"".concat(s,"px"),maxWidth:"none",maxHeight:"none",transform:"translate3d(".concat(e,"px, ").concat(n,"px, 0) scale(1)")})):this.$content.style.transform="translate3d(".concat(e,"px, ").concat(n,"px, 0) scale(").concat(o,")");this.trigger("afterTransform")}},{key:"endAnimation",value:function(t){cancelAnimationFrame(this.rAF),this.rAF=null,this.velocity={x:0,y:0,scale:0}
4,this.setTransform(!0),this.state="ready",this.handleCursor(),!0!==t&&this.trigger("endAnimation")}},{key:"handleCursor",value:function(){var t=this.option("draggableClass");t&&this.option("touch")&&(1==this.option("panOnlyZoomed")&&this.content.width<=this.viewport.width&&this.content.height<=this.viewport.height&&this.transform.scale<=this.option("baseScale")?this.$container.classList.remove(t):this.$container.classList.add(t))}},{key:"detachEvents",value:function(){this.$content.removeEventListener("load",this.onLoad),this.$container.removeEventListener("wheel",this.onWheel,{passive:!1}),this.$container.removeEventListener("click",this.onClick,{passive:!1}),this.pointerTracker&&(this.pointerTracker.stop(),this.pointerTracker=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"destroy",value:function(){"destroy"!==this.state&&(this.state="destroy",clearTimeout(this.updateTimer),this.updateTimer=null,cancelAnimationFrame(this.rAF),this.rAF=null,this.detachEvents(),this.detachPlugins(),this.resetDragPosition())}}]),n}(O);M.version="4.0.31",M.Plugins={};var I=function(t,e){var i=0;return function(){var n=(new Date).getTime();if(!(n-i<e))return i=n,t.apply(void 0,arguments)}},R=function(){function t(e){o(this,t),this.$container=null,this.$prev=null,this.$next=null,this.carousel=e,this.onRefresh=this.onRefresh.bind(this)}return s(t,[{key:"option",value:function(t){return this.carousel.option("Navigation.".concat(t))}},{key:"createButton",value:function(t){var e,i=this,n=document.createElement("button");n.setAttribute("title",this.carousel.localize("{{".concat(t.toUpperCase(),"}}")));var o=this.option("classNames.button")+" "+this.option("classNames.".concat(t));return(e=n.classList).add.apply(e,m(o.split(" "))),n.setAttribute("tabindex","0"),n.innerHTML=this.carousel.localize(this.option("".concat(t,"Tpl"))),n.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation(),i.carousel["slide".concat("next"===t?"Next":"Prev")]()})),n}},{key:"build",value:function(){var t;this.$container||(this.$container=document.createElement("div"),(t=this.$container.classList).add.apply(t,m(this.option("classNames.main").split(" "))),this.carousel.$container.appendChild(this.$container));this.$next||(this.$next=this.createButton("next"),this.$container.appendChild(this.$next)),this.$prev||(this.$prev=this.createButton("prev"),this.$container.appendChild(this.$prev))}},{key:"onRefresh",value:function(){var t=this.carousel.pages.length;t<=1||t>1&&this.carousel.elemDimWidth<this.carousel.wrapDimWidth&&!Number.isInteger(this.carousel.option("slidesPerPage"))?this.cleanup():(this.build(),this.$prev.removeAttribute("disabled"),this.$next.removeAttribute("disabled"),this.carousel.option("infiniteX",this.carousel.option("infinite"))||(this.carousel.page<=0&&this.$prev.setAttribute("disabled",""),this.carousel.page>=t-1&&this.$next.setAttribute("disabled","")))}},{key:"cleanup",value:function(){this.$prev&&this.$prev.remove(),this.$prev=null,this.$next&&this.$next.remove(),this.$next=null,this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.carousel.on("refresh change",this.onRefresh)}},{key:"detach",value:function(){this.carousel.off("refresh change",this.onRefresh),this.cleanup()}}]),t}();R.defaults={prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>',nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',classNames:{main:"carousel__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}};var F=function(){function t(e){o(this,t),this.carousel=e,this.$list=null,this.events={change:this.onChange.bind(this),refresh:this.onRefresh.bind(this)}}return s(t,[{key:"buildList",value:function(){var t=this;if(!(this.carousel.pages.length<this.carousel.option("Dots.minSlideCount"))){var e=document.createElement("ol");return e.classList.add("carousel__dots"),e.addEventListener("click",(function(e){if("page"in e.target.dataset){e.preventDefault(),e.stopPropagation();var i=parseInt(e.target.dataset.page,10),n=t.carousel;i!==n.page&&(n.pages.length<3&&n.option("infinite")?n[0==i?"slidePrev":"slideNext"]():n.slideTo(i))}})),this.$list=e,this.carousel.$container.appendChild(e),this.carousel.$container.classList.add("has-dots"),e}}},{key:"removeList",value:function(){this.$list&&(this.$list.parentNode.removeChild(this.$list),this.$list=null),this.carousel.$container.classList.remove("has-dots")}},{key:"rebuildDots",value:function(){var t=this,e=this.$list,i=!!e,n=this.carousel.pages.length;if(n<2)i&&this.removeList();else{i||(e=this.buildList());var o=this.$list.children.length;if(o>n)for(var a=n;a<o;a++)this.$list.removeChild(this.$list.lastChild);else{for(var s=function(e){var i=document.createElement("li");i.classList.add("carousel__dot"),i.dataset.page=e,i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("title",t.carousel.localize("{{GOTO}}",[["%d",e+1]])),i.addEventListener("keydown",(function(t){var e,n=t.code;"Enter"===n||"NumpadEnter"===n?e=i:"ArrowRight"===n?e=i.nextSibling:"ArrowLeft"===n&&(e=i.previousSibling),e&&e.click()})),t.$list.appendChild(i)},r=o;r<n;r++)s(r);this.setActiveDot()}}}},{key:"setActiveDot",value:function(){if(this.$list){this.$list.childNodes.forEac
4h((function(t){t.classList.remove("is-selected")}));var t=this.$list.childNodes[this.carousel.page];t&&t.classList.add("is-selected")}}},{key:"onChange",value:function(){this.setActiveDot()}},{key:"onRefresh",value:function(){this.rebuildDots()}},{key:"attach",value:function(){this.carousel.on(this.events)}},{key:"detach",value:function(){this.removeList(),this.carousel.off(this.events),this.carousel=null}}]),t}(),N=function(){function t(e){o(this,t),this.carousel=e,this.selectedIndex=null,this.friction=0,this.onNavReady=this.onNavReady.bind(this),this.onNavClick=this.onNavClick.bind(this),this.onNavCreateSlide=this.onNavCreateSlide.bind(this),this.onTargetChange=this.onTargetChange.bind(this)}return s(t,[{key:"addAsTargetFor",value:function(t){this.target=this.carousel,this.nav=t,this.attachEvents()}},{key:"addAsNavFor",value:function(t){this.target=t,this.nav=this.carousel,this.attachEvents()}},{key:"attachEvents",value:function(){this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.on("createSlide",this.onNavCreateSlide),this.nav.on("Panzoom.click",this.onNavClick),this.target.on("change",this.onTargetChange),this.target.on("Panzoom.afterUpdate",this.onTargetChange)}},{key:"onNavReady",value:function(){this.onTargetChange(!0)}},{key:"onNavClick",value:function(t,e,i){var n=i.target.closest(".carousel__slide");if(n){i.stopPropagation();var o=parseInt(n.dataset.index,10),a=this.target.findPageForSlide(o);this.target.page!==a&&this.target.slideTo(a,{friction:this.friction}),this.markSelectedSlide(o)}}},{key:"onNavCreateSlide",value:function(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}},{key:"onTargetChange",value:function(){var t=this.target.pages[this.target.page].indexes[0],e=this.nav.findPageForSlide(t);this.nav.slideTo(e),this.markSelectedSlide(t)}},{key:"markSelectedSlide",value:function(t){this.selectedIndex=t,m(this.nav.slides).filter((function(t){return t.$el&&t.$el.classList.remove("is-nav-selected")}));var e=this.nav.slides[t];e&&e.$el&&e.$el.classList.add("is-nav-selected")}},{key:"attach",value:function(t){var e=t.options.Sync;(e.target||e.nav)&&(e.target?this.addAsNavFor(e.target):e.nav&&this.addAsTargetFor(e.nav),this.friction=e.friction)}},{key:"detach",value:function(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.target&&(this.target.off("Panzoom.afterUpdate",this.onTargetChange),this.target.off("change",this.onTargetChange))}}]),t}();N.defaults={friction:.92};var D={Navigation:R,Dots:F,Sync:N},B={slides:[],preload:0,slidesPerPage:"auto",initialPage:null,initialSlide:null,friction:.92,center:!0,infinite:!0,fill:!0,dragFree:!1,prefix:"",classNames:{viewport:"carousel__viewport",track:"carousel__track",slide:"carousel__slide",slideSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}},H=function(t){l(n,t);var e=f(n);function n(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o(this,n),a=k(!0,{},B,a),(i=e.call(this,a)).state="init",i.$container=t,!(i.$container instanceof HTMLElement))throw new Error("No root element provided");return i.slideNext=I(i.slideNext.bind(d(i)),250),i.slidePrev=I(i.slidePrev.bind(d(i)),250),i.init(),t.__Carousel=d(i),i}return s(n,[{key:"init",value:function(){this.pages=[],this.page=this.pageIndex=null,this.prevPage=this.prevPageIndex=null,this.attachPlugins(n.Plugins),this.trigger("init"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.$track&&this.pages.length&&(this.$track.style.transform="translate3d(".concat(-1*this.pages[this.page].left,"px, 0px, 0) scale(1)")),this.manageSlideVisiblity(),this.initPanzoom(),this.state="ready",this.trigger("ready")}},{key:"initLayout",value:function(){var t,e,i,n,o=this.option("prefix"),a=this.option("classNames");(this.$viewport=this.option("viewport")||this.$container.querySelector(".".concat(o).concat(a.viewport)),this.$viewport)||(this.$viewport=document.createElement("div"),(t=this.$viewport.classList).add.apply(t,m((o+a.viewport).split(" "))),(e=this.$viewport).append.apply(e,m(this.$container.childNodes)),this.$container.appendChild(this.$viewport));(this.$track=this.option("track")||this.$container.querySelector(".".concat(o).concat(a.track)),this.$track)||(this.$track=document.createElement("div"),(i=this.$track.classList).add.apply(i,m((o+a.track).split(" "))),(n=this.$track).append.apply(n,m(this.$viewport.childNodes)),this.$viewport.appendChild(this.$track))}},{key:"initSlides",value:function(){var t=this;this.slides=[],this.$viewport.querySelectorAll(".".concat(this.option("prefix")).c
4oncat(this.option("classNames.slide"))).forEach((function(e){var i={$el:e,isDom:!0};t.slides.push(i),t.trigger("createSlide",i,t.slides.length)})),Array.isArray(this.options.slides)&&(this.slides=k(!0,m(this.slides),this.options.slides))}},{key:"updateMetrics",value:function(){var t,e=this,n=0,o=[];this.slides.forEach((function(i,a){var s=i.$el,r=i.isDom||!t?e.getSlideMetrics(s):t;i.index=a,i.width=r,i.left=n,t=r,n+=r,o.push(a)}));var a=Math.max(this.$track.offsetWidth,S(this.$track.getBoundingClientRect().width)),s=getComputedStyle(this.$track);a-=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),this.contentWidth=n,this.viewportWidth=a;var r=[],l=this.option("slidesPerPage");if(Number.isInteger(l)&&n>a)for(var c=0;c<this.slides.length;c+=l)r.push({indexes:o.slice(c,c+l),slides:this.slides.slice(c,c+l)});else for(var h=0,d=0,u=0;u<this.slides.length;u+=1){var f=this.slides[u];(!r.length||d+f.width>a)&&(r.push({indexes:[],slides:[]}),h=r.length-1,d=0),d+=f.width,r[h].indexes.push(u),r[h].slides.push(f)}var v=this.option("center"),p=this.option("fill");r.forEach((function(t,i){t.index=i,t.width=t.slides.reduce((function(t,e){return t+e.width}),0),t.left=t.slides[0].left,v&&(t.left+=.5*(a-t.width)*-1),p&&!e.option("infiniteX",e.option("infinite"))&&n>a&&(t.left=Math.max(t.left,0),t.left=Math.min(t.left,n-a))}));var g,y=[];r.forEach((function(t){var e=i({},t);g&&e.left===g.left?(g.width+=e.width,g.slides=[].concat(m(g.slides),m(e.slides)),g.indexes=[].concat(m(g.indexes),m(e.indexes))):(e.index=y.length,g=e,y.push(e))})),this.pages=y;var b=this.page;if(null===b){var x=this.option("initialSlide");b=null!==x?this.findPageForSlide(x):parseInt(this.option("initialPage",0),10)||0,y[b]||(b=y.length&&b>y.length?y[y.length-1].index:0),this.page=b,this.pageIndex=b}this.updatePanzoom(),this.trigger("refresh")}},{key:"getSlideMetrics",value:function(t){if(!t){var e,i,n=this.slides[0];if((t=document.createElement("div")).dataset.isTestEl=1,t.style.visibility="hidden",(e=t.classList).add.apply(e,m((this.option("prefix")+this.option("classNames.slide")).split(" "))),n.customClass)(i=t.classList).add.apply(i,m(n.customClass.split(" ")));this.$track.prepend(t)}var o=Math.max(t.offsetWidth,S(t.getBoundingClientRect().width)),a=t.currentStyle||window.getComputedStyle(t);return o=o+(parseFloat(a.marginLeft)||0)+(parseFloat(a.marginRight)||0),t.dataset.isTestEl&&t.remove(),o}},{key:"findPageForSlide",value:function(t){t=parseInt(t,10)||0;var e=this.pages.find((function(e){return e.indexes.indexOf(t)>-1}));return e?e.index:null}},{key:"slideNext",value:function(){this.slideTo(this.pageIndex+1)}},{key:"slidePrev",value:function(){this.slideTo(this.pageIndex-1)}},{key:"slideTo",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.x,n=void 0===i?-1*this.setPage(t,!0):i,o=e.y,a=void 0===o?0:o,s=e.friction,r=void 0===s?this.option("friction"):s;this.Panzoom.content.x===n&&!this.Panzoom.velocity.x&&r||(this.Panzoom.panTo({x:n,y:a,friction:r,ignoreBounds:!0}),"ready"===this.state&&"ready"===this.Panzoom.state&&this.trigger("settle"))}},{key:"initPanzoom",value:function(){var t=this;this.Panzoom&&this.Panzoom.destroy();var e=k(!0,{},{content:this.$track,wrapInner:!1,resizeParent:!1,zoom:!1,click:!1,lockAxis:"x",x:this.pages.length?-1*this.pages[this.page].left:0,centerOnStart:!1,textSelection:function(){return t.option("textSelection",!1)},panOnlyZoomed:function(){return this.content.width<=this.viewport.width}},this.option("Panzoom"));this.Panzoom=new M(this.$container,e),this.Panzoom.on({"*":function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return t.trigger.apply(t,["Panzoom.".concat(e)].concat(n))},afterUpdate:function(){t.updatePage()},beforeTransform:this.onBeforeTransform.bind(this),touchEnd:this.onTouchEnd.bind(this),endAnimation:function(){t.trigger("settle")}}),this.updateMetrics(),this.manageSlideVisiblity()}},{key:"updatePanzoom",value:function(){this.Panzoom&&(this.Panzoom.content=i(i({},this.Panzoom.content),{},{fitWidth:this.contentWidth,origWidth:this.contentWidth,width:this.contentWidth}
4),this.pages.length>1&&this.option("infiniteX",this.option("infinite"))?this.Panzoom.boundX=null:this.pages.length&&(this.Panzoom.boundX={from:-1*this.pages[this.pages.length-1].left,to:-1*this.pages[0].left}),this.option("infiniteY",this.option("infinite"))?this.Panzoom.boundY=null:this.Panzoom.boundY={from:0,to:0},this.Panzoom.handleCursor())}},{key:"manageSlideVisiblity",value:function(){var t=this,e=this.contentWidth,i=this.viewportWidth,n=this.Panzoom?-1*this.Panzoom.content.x:this.pages.length?this.pages[this.page].left:0,o=this.option("preload"),a=this.option("infiniteX",this.option("infinite")),s=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-left")),r=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-right"));this.slides.forEach((function(l){var c,h,d=0;c=n-s,h=n+i+r,c-=o*(i+s+r),h+=o*(i+s+r);var u=l.left+l.width>c&&l.left<h;c=n+e-s,h=n+e+i+r,c-=o*(i+s+r);var f=a&&l.left+l.width>c&&l.left<h;c=n-e-s,h=n-e+i+r,c-=o*(i+s+r);var v=a&&l.left+l.width>c&&l.left<h;f||u||v?(t.createSlideEl(l),u&&(d=0),f&&(d=-1),v&&(d=1),l.left+l.width>n&&l.left<=n+i+r&&(d=0)):t.removeSlideEl(l),l.hasDiff=d}));var l=0,c=0;this.slides.forEach((function(t,i){var n=0;t.$el?(i!==l||t.hasDiff?n=c+t.hasDiff*e:c=0,t.$el.style.left=Math.abs(n)>.1?"".concat(c+t.hasDiff*e,"px"):"",l++):c+=t.width})),this.markSelectedSlides()}},{key:"createSlideEl",value:function(t){var e;if(t){if(!t.$el){var i,n=document.createElement("div");if(n.dataset.index=t.index,(e=n.classList).add.apply(e,m((this.option("prefix")+this.option("classNames.slide")).split(" "))),t.customClass)(i=n.classList).add.apply(i,m(t.customClass.split(" ")));t.html&&(n.innerHTML=t.html);var o=[];this.slides.forEach((function(t,e){t.$el&&o.push(e)}));var a=t.index,s=null;if(o.length){var r=o.reduce((function(t,e){return Math.abs(e-a)<Math.abs(t-a)?e:t}));s=this.slides[r]}return this.$track.insertBefore(n,s&&s.$el?s.index<t.index?s.$el.nextSibling:s.$el:null),t.$el=n,this.trigger("createSlide",t,a),t}var l,c=t.$el.dataset.index;c&&parseInt(c,10)===t.index||(t.$el.dataset.index=t.index,t.$el.querySelectorAll("[data-lazy-srcset]").forEach((function(t){t.srcset=t.dataset.lazySrcset})),t.$el.querySelectorAll("[data-lazy-src]").forEach((function(t){var e=t.dataset.lazySrc;t instanceof HTMLImageElement?t.src=e:t.style.backgroundImage="url('".concat(e,"')")})),(l=t.$el.dataset.lazySrc)&&(t.$el.style.backgroundImage="url('".concat(l,"')")),t.state="ready")}}},{key:"removeSlideEl",value:function(t){t.$el&&!t.isDom&&(this.trigger("removeSlide",t),t.$el.remove(),t.$el=null)}},{key:"markSelectedSlides",value:function(){var t=this,e=this.option("classNames.slideSelected"),i="aria-hidden";this.slides.forEach((function(n,o){var a=n.$el;if(a){var s=t.pages[t.page];s&&s.indexes&&s.indexes.indexOf(o)>-1?(e&&!a.classList.contains(e)&&(a.classList.add(e),t.trigger("selectSlide",n)),a.removeAttribute(i)):(e&&a.classList.contains(e)&&(a.classList.remove(e),t.trigger("unselectSlide",n)),a.setAttribute(i,!0))}}))}},{key:"updatePage",value:function(){this.updateMetrics(),this.slideTo(this.page,{friction:0})}},{key:"onBeforeTransform",value:function(){this.option("infiniteX",this.option("infinite"))&&this.manageInfiniteTrack(),this.manageSlideVisiblity()}},{key:"manageInfiniteTrack",value:function(){var t=this.contentWidth,e=this.viewportWidth;if(!(!this.option("infiniteX",this.option("infinite"))||this.pages.length<2||t<e)){var i=this.Panzoom,n=!1;return i.content.x<-1*(t-e)&&(i.content.x+=t,this.pageIndex=this.pageIndex-this.pages.length,n=!0),i.content.x>e&&(i.content.x-=t,this.pageIndex=this.pageIndex+this.pages.length,n=!0),n&&"pointerdown"===i.state&&i.resetDragPosition(),n}}},{key:"onTouchEnd",value:function(t,e){var i=this.option("dragFree");if(!i&&this.pages.length>1&&t.dragOffset.time<350&&Math.abs(t.dragOffset.y)<1&&Math.abs(t.dragOffset.x)>5)this[t.dragOffset.x<0?"slideNext":"slidePrev"]();else if(i){var n=g(this.getPageFromPosition(-1*t.transform.x),2)[1];this.setPage(n)}else this.slideToClosest()}},{key:"slideToClosest",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.getPageFromPosition(-1*this.Panzoom.content.x),i=g(e,2),n=i[1];this.slideTo(n,t)}},{key:"getPageFromPosition",value:function(t){var e=this.pages.length;this.option("center")&&(t+=.5*this.viewportWidth);var i=Math.floor(t/this.contentWidth);t-=i*this.contentWidth;var n=this.slides.find((function(e){return e.left<=t&&e.left+e.width>t}));if(n){var o=this.findPageForSlide(n.index);return[o,o+i*e]}return[0,0]}},{key:"setPage",value:function(t,e){var i=0,n=parseInt(t,10)||0,o=this.page,a=this.pageIndex,s=this.pages.length,r=this.contentWidth,l=this.viewportWidth;if(t=(n%s+s)%s,this.option("infiniteX",this.option("infinite"))&&r>l){var c=Math.floor(n/s)||0,h=r;if(i=this.pages[t].left+c*h,!0===e&&s>2){var d=-1*this.Panzoom.content.x,u=i-h,f=i+h,v=Math.abs(d-i),p=Math.abs(d-u),g=Math.abs(d-f);g<v&&g<=p?(i=f,n+=s):p<v&&p<g&&(i=u,n-=s)}}else t=n=Math.max(0,Math.min(n,s-1)),i=this.pages.length?this.pages[t].left:0;return this.page=t,this.pageIndex=n,null!==o&&t!==o&&(this.prevPage=o,this.prevPageIndex=a,this.trigger("change",t,o)),i}},{key:"destroy",value:function(){var t=this;
4this.state="destroy",this.slides.forEach((function(e){t.removeSlideEl(e)})),this.slides=[],this.Panzoom.destroy(),this.detachPlugins()}}]),n}(O);H.version="4.0.31",H.Plugins=D;var W=!("undefined"==typeof window||!window.document||!window.document.createElement),j=null,X=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'],q=function(t){if(t&&W){null===j&&document.createElement("div").focus({get preventScroll(){return j=!0,!1}});try{if(t.setActive)t.setActive();else if(j)t.focus({preventScroll:!0});else{var e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}},U=function(){function t(e){o(this,t),this.fancybox=e,this.viewport=null,this.pendingUpdate=null;for(var i=0,n=["onReady","onResize","onTouchstart","onTouchmove"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}}return s(t,[{key:"onReady",value:function(){var t=window.visualViewport;t&&(this.viewport=t,this.startY=0,t.addEventListener("resize",this.onResize),this.updateViewport()),window.addEventListener("touchstart",this.onTouchstart,{passive:!1}),window.addEventListener("touchmove",this.onTouchmove,{passive:!1}),window.addEventListener("wheel",this.onWheel,{passive:!1})}},{key:"onResize",value:function(){this.updateViewport()}},{key:"updateViewport",value:function(){var t=this.fancybox,e=this.viewport,i=e.scale||1,n=t.$container;if(n){var o="",a="",s="";i-1>.1&&(o="".concat(e.width*i,"px"),a="".concat(e.height*i,"px"),s="translate3d(".concat(e.offsetLeft,"px, ").concat(e.offsetTop,"px, 0) scale(").concat(1/i,")")),n.style.width=o,n.style.height=a,n.style.transform=s}}},{key:"onTouchstart",value:function(t){this.startY=t.touches?t.touches[0].screenY:t.screenY}},{key:"onTouchmove",value:function(t){var e=this.startY,i=window.innerWidth/window.document.documentElement.clientWidth;if(t.cancelable&&!(t.touches.length>1||1!==i)){var n=C(t.composedPath()[0]);if(n){var o=window.getComputedStyle(n),a=parseInt(o.getPropertyValue("height"),10),s=t.touches?t.touches[0].screenY:t.screenY,r=e<=s&&0===n.scrollTop,l=e>=s&&n.scrollHeight-n.scrollTop===a;(r||l)&&t.preventDefault()}else t.preventDefault()}}},{key:"onWheel",value:function(t){C(t.composedPath()[0])||t.preventDefault()}},{key:"cleanup",value:function(){this.pendingUpdate&&(cancelAnimationFrame(this.pendingUpdate),this.pendingUpdate=null);var t=this.viewport;t&&(t.removeEventListener("resize",this.onResize),this.viewport=null),window.removeEventListener("touchstart",this.onTouchstart,!1),window.removeEventListener("touchmove",this.onTouchmove,!1),window.removeEventListener("wheel",this.onWheel,{passive:!1})}},{key:"attach",value:function(){this.fancybox.on("initLayout",this.onReady)}},{key:"detach",value:function(){this.fancybox.off("initLayout",this.onReady),this.cleanup()}}]),t}(),Y=function(){function t(e){o(this,t),this.fancybox=e,this.$container=null,this.state="init";for(var i=0,n=["onPrepare","onClosing","onKeydown"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={prepare:this.onPrepare,closing:this.onClosing,keydown:this.onKeydown}}return s(t,[{key:"onPrepare",value:function(){this.getSlides().length<this.fancybox.option("Thumbs.minSlideCount")?this.state="disabled":!0===this.fancybox.option("Thumbs.autoStart")&&this.fancybox.Carousel.Panzoom.content.height>=this.fancybox.option("Thumbs.minScreenHeight")&&this.build()}},{key:"onClosing",value:function(){this.Carousel&&this.Carousel.Panzoom.detachEvents()}},{key:"onKeydown",value:function(t,e){e===t.option("Thumbs.key")&&this.toggle()}},{key:"build",value:function(){var t=this;if(!this.$container){var e=document.createElement("div");e.classList.add("fancybox__thumbs"),this.fancybox.$carousel.parentNode.insertBefore(e,this.fancybox.$carousel.nextSibling),this.Carousel=new H(e,k(!0,{Dots:!1,Navigation:!1,Sync:{friction:0},infinite:!1,center:!0,fill:!0,dragFree:!0,slidesPerPage:1,preload:1},this.fancybox.option("Thumbs.Carousel"),{Sync:{target:this.fancybox.Carousel},slides:this.getSlides()})),this.Carousel.Panzoom.on("wheel",(function(e,i){i.preventDefault(),t.fancybox[i.deltaY<0?"prev":"next"]()})),this.$container=e,this.state="visible"}}},{key:"getSlides",value:function(){var t,e=[],i=x(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){var n=t.value,o=n.thumb;o&&e.push({html:this.fancybox.option("Thumbs.tpl").replace(/\{\{src\}\}/gi,o),customClass:"has-thumb has-".concat(n.type||"image")})}}catch(t){i.e(t)}finally{i.f()}return e}},{key:"toggle",value:function(){"visible"===this.state?this.hide():"hidden"===this.state?this.show():this.build()}},{key:"show",value:function(){"hidden"===this.state&&(this.$container.style.display="",this.Carousel.Panzoom.attachEvents(),this.state="visible")}},{key:"hide",value:function(){"visible"===this.state&&(this.Carousel.Panzoom.detachEvents(),this.$container.style.display="none",this.state="hidden")}},{key:"cleanup",value:function(){this.Carousel&&(this.Carousel.destroy(),this.Carousel=null),this.$container&&(this.$container.remove(),this.$container=null),this.state="init"}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),t}();Y.defaults={minSlideCount:2,minScreenHeight:500,autoStart:!0,key:"t",Carousel:{},tpl:'<div class="fancybox__thumb" style="background-image:url(\'{{src}}\')"></div>'};var V=function(t,e){for(var i=new URL(t),n=new URLSearchParams(i.search),o=new URLSearchParams,a=0,s=[].concat(m(n),m(Object.entries(e)));a<s.length;a++){var r=g(s[a],2),l=r[0],c=r[1];"t"===l?o.set("start",parseInt(c)):o.set(l,c)}o=o.toString();var h=t.match(/#t=((.*)?\d+s)/);return h&&(o+="#t=".concat(h[1])),o},Z={video:{autoplay:!0,ratio:16/9},youtube:{autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},vimeo:{hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},html5video:{tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">\n  <source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos.</video>',format:""}}
4,G=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onInit","onReady","onCreateSlide","onRemoveSlide","onSelectSlide","onUnselectSlide","onRefresh","onMessage"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={init:this.onInit,ready:this.onReady,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide,"Carousel.selectSlide":this.onSelectSlide,"Carousel.unselectSlide":this.onUnselectSlide,"Carousel.refresh":this.onRefresh}}return s(t,[{key:"onInit",value:function(){var t,e=x(this.fancybox.items);try{for(e.s();!(t=e.n()).done;){var i=t.value;this.processType(i)}}catch(t){e.e(t)}finally{e.f()}}},{key:"processType",value:function(t){if(t.html)return t.src=t.html,t.type="html",void delete t.html;var e=t.src||"",i=t.type||this.fancybox.options.type,n=null;if(!e||"string"==typeof e){if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){var o=V(e,this.fancybox.option("Html.youtube")),a=encodeURIComponent(n[1]);t.videoId=a,t.src="https://www.youtube-nocookie.com/embed/".concat(a,"?").concat(o),t.thumb=t.thumb||"https://i.ytimg.com/vi/".concat(a,"/mqdefault.jpg"),t.vendor="youtube",i="video"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){var s=V(e,this.fancybox.option("Html.vimeo")),r=encodeURIComponent(n[1]);t.videoId=r,t.src="https://player.vimeo.com/video/".concat(r,"?").concat(s),t.vendor="vimeo",i="video"}else(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src="//maps.google.".concat(n[1],"/?ll=").concat((n[2]?n[2]+"&z="+Math.floor(n[3])+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&"),"&output=").concat(n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"),i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src="//maps.google.".concat(n[1],"/maps?q=").concat(n[2].replace("query=","q=").replace("api=1",""),"&output=embed"),i="map");i||("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.format=t.format||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)&&(i="pdf")),t.type=i||this.fancybox.option("defaultType","image"),"html5video"!==i&&"video"!==i||(t.video=k({},this.fancybox.option("Html.video"),t.video),t._width&&t._height?t.ratio=parseFloat(t._width)/parseFloat(t._height):t.ratio=t.ratio||t.video.ratio||Z.video.ratio)}}},{key:"onReady",value:function(){var t=this;this.fancybox.Carousel.slides.forEach((function(e){e.$el&&(t.setContent(e),e.index===t.fancybox.getSlide().index&&t.playVideo(e))}))}},{key:"onCreateSlide",value:function(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}},{key:"loadInlineContent",value:function(t){var e;if(t.src instanceof HTMLElement)e=t.src;else if("string"==typeof t.src){var i=t.src.split("#",2),n=2===i.length&&""===i[0]?i[1]:i[0];e=document.getElementById(n)}if(e){if("clone"===t.type||e.$placeHolder){var o=(e=e.cloneNode(!0)).getAttribute("id");o=o?"".concat(o,"--clone"):"clone-".concat(this.fancybox.id,"-").concat(t.index),e.setAttribute("id",o)}else{var a=document.createElement("div");a.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(a,e),e.$placeHolder=a}this.fancybox.setContent(t,e)}else this.fancybox.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"loadAjaxContent",value:function(t){var e=this.fancybox,i=new XMLHttpRequest;e.showLoading(t),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&"ready"===e.state&&(e.hideLoading(t),200===i.status?e.setContent(t,i.responseText):e.setError(t,404===i.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};var n=t.ajax||null;i.open(n?"POST":"GET",t.src),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(n),t.xhr=i}},{key:"loadIframeContent",value:function(t){var e=this,i=this.fancybox,n=document.createElement("iframe");
4if(n.className="fancybox__iframe",n.setAttribute("id","fancybox__iframe_".concat(i.id,"_").concat(t.index)),n.setAttribute("allow","autoplay; fullscreen"),n.setAttribute("scrolling","auto"),t.$iframe=n,"iframe"!==t.type||!1===t.preload)return n.setAttribute("src",t.src),this.fancybox.setContent(t,n),void this.resizeIframe(t);i.showLoading(t);var o=document.createElement("div");o.style.visibility="hidden",this.fancybox.setContent(t,o),o.appendChild(n),n.onerror=function(){i.setError(t,"{{IFRAME_ERROR}}")},n.onload=function(){i.hideLoading(t);var o=!1;n.isReady||(n.isReady=!0,o=!0),n.src.length&&(n.parentNode.style.visibility="",e.resizeIframe(t),o&&i.revealContent(t))},n.setAttribute("src",t.src)}},{key:"setAspectRatio",value:function(t){var e=t.$content,i=t.ratio;if(e){var n=t._width,o=t._height;if(i||n&&o){Object.assign(e.style,{width:n&&o?"100%":"",height:n&&o?"100%":"",maxWidth:"",maxHeight:""});var a=e.offsetWidth,s=e.offsetHeight;if(o=o||s,(n=n||a)>a||o>s){var r=Math.min(a/n,s/o);n*=r,o*=r}Math.abs(n/o-i)>.01&&(i<n/o?n=o*i:o=n/i),Object.assign(e.style,{width:"".concat(n,"px"),height:"".concat(o,"px")})}}}},{key:"resizeIframe",value:function(t){var e=t.$iframe;if(e){var i=t._width||0,n=t._height||0;i&&n&&(t.autoSize=!1);var o=e.parentNode,a=o&&o.style;if(!1!==t.preload&&!1!==t.autoSize&&a)try{var s=window.getComputedStyle(o),r=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),l=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom),c=e.contentWindow.document,h=c.getElementsByTagName("html")[0],d=c.body;a.width="",d.style.overflow="hidden",i=i||h.scrollWidth+r,a.width="".concat(i,"px"),d.style.overflow="",a.flex="0 0 auto",a.height="".concat(d.scrollHeight,"px"),n=h.scrollHeight+l}catch(t){}if(i||n){var u={flex:"0 1 auto"};i&&(u.width="".concat(i,"px")),n&&(u.height="".concat(n,"px")),Object.assign(a,u)}}}},{key:"onRefresh",value:function(t,e){var i=this;e.slides.forEach((function(t){t.$el&&(t.$iframe&&i.resizeIframe(t),t.ratio&&i.setAspectRatio(t))}))}},{key:"setContent",value:function(t){if(t&&!t.isDom){switch(t.type){case"html":this.fancybox.setContent(t,t.src);break;case"html5video":this.fancybox.setContent(t,this.fancybox.option("Html.html5video.tpl").replace(/\{\{src\}\}/gi,t.src).replace("{{format}}",t.format||t.html5video&&t.html5video.format||"").replace("{{poster}}",t.poster||t.thumb||""));break;case"inline":case"clone":this.loadInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"video":case"map":t.preload=!1;case"iframe":this.loadIframeContent(t)}t.ratio&&this.setAspectRatio(t)}}},{key:"onSelectSlide",value:function(t,e,i){"ready"===t.state&&this.playVideo(i)}},{key:"playVideo",value:function(t){if("html5video"===t.type&&t.video.autoplay)try{var e=t.$el.querySelector("video");if(e){var i=e.play();void 0!==i&&i.then((function(){})).catch((function(t){e.muted=!0,e.play()}))}}catch(t){}if("video"===t.type&&t.$iframe&&t.$iframe.contentWindow){!function e(){if("done"===t.state&&t.$iframe&&t.$iframe.contentWindow){var i;if(t.$iframe.isReady)return t.video&&t.video.autoplay&&(i="youtube"==t.vendor?{event:"command",func:"playVideo"}:{method:"play",value:"true"}),void(i&&t.$iframe.contentWindow.postMessage(JSON.stringify(i),"*"));"youtube"===t.vendor&&(i={event:"listening",id:t.$iframe.getAttribute("id")},t.$iframe.contentWindow.postMessage(JSON.stringify(i),"*"))}t.poller=setTimeout(e,250)}()}}},{key:"onUnselectSlide",value:function(t,e,i){if("html5video"!==i.type){var n=!1;"vimeo"==i.vendor?n={method:"pause",value:"true"}:"youtube"===i.vendor&&(n={event:"command",func:"pauseVideo"}),n&&i.$iframe&&i.$iframe.contentWindow&&i.$iframe.contentWindow.postMessage(JSON.stringify(n),"*"),clearTimeout(i.poller)}else try{i.$el.querySelector("video").pause()}catch(t){}}},{key:"onRemoveSlide",value:function(t,e,i){i.xhr&&(i.xhr.abort(),i.xhr=null),i.$iframe&&(i.$iframe.onload=i.$iframe.onerror=null,i.$iframe.src="//about:blank",i.$iframe=null);var n=i.$content;"inline"===i.type&&n&&(n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none")),i.$closeButton&&(i.$closeButton.remove(),i.$closeButton=null);var o=n&&n.$placeHolder;o&&(o.parentNode.insertBefore(n,o),o.remove(),n.$placeHolder=null)}},{key:"onMessage",value:function(t){try{var e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event){var i,n=x(document.getElementsByClassName("fancybox__iframe"));try{for(n.s();!(i=n.n()).done;){var o=i.value;o.contentWindow===t.source&&(o.isReady=1)}}catch(t){n.e(t)}finally{n.f()}}}else"https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event&&(document.getElementById(e.id).isReady=1)}catch(t){}}},{key:"attach",value:function(){this.fancybox.on(this.events),window.addEventListener("message",this.onMessage,!1)}},{key:"detach",value:function(){this.fancybox.off(this.events),window.removeEventListener("message",this.onMessage,!1)}}]),t}();G.defaults=Z;var K=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onReady","onClosing","onDone","onPageChange","onCreateSlide","onRemoveSlide","onImageStatusChange"];
4i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={ready:this.onReady,closing:this.onClosing,done:this.onDone,"Carousel.change":this.onPageChange,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide}}return s(t,[{key:"onReady",value:function(){var t=this;this.fancybox.Carousel.slides.forEach((function(e){e.$el&&t.setContent(e)}))}},{key:"onDone",value:function(t,e){this.handleCursor(e)}},{key:"onClosing",value:function(t){clearTimeout(this.clickTimer),this.clickTimer=null,t.Carousel.slides.forEach((function(t){t.$image&&(t.state="destroy"),t.Panzoom&&t.Panzoom.detachEvents()})),"closing"===this.fancybox.state&&this.canZoom(t.getSlide())&&this.zoomOut()}},{key:"onCreateSlide",value:function(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}},{key:"onRemoveSlide",value:function(t,e,i){i.$image&&(i.$el.classList.remove(t.option("Image.canZoomInClass")),i.$image.remove(),i.$image=null),i.Panzoom&&(i.Panzoom.destroy(),i.Panzoom=null),i.$el&&i.$el.dataset&&delete i.$el.dataset.imageFit}},{key:"setContent",value:function(t){var e=this;if(!(t.isDom||t.html||t.type&&"image"!==t.type||t.$image)){t.type="image",t.state="loading";var i=document.createElement("div");i.style.visibility="hidden";var n=document.createElement("img");n.addEventListener("load",(function(i){i.stopImmediatePropagation(),e.onImageStatusChange(t)})),n.addEventListener("error",(function(){e.onImageStatusChange(t)})),n.src=t.src,n.alt="",n.draggable=!1,n.classList.add("fancybox__image"),t.srcset&&n.setAttribute("srcset",t.srcset),t.sizes&&n.setAttribute("sizes",t.sizes),t.$image=n;var o=this.fancybox.option("Image.wrap");if(o){var a=document.createElement("div");a.classList.add("string"==typeof o?o:"fancybox__image-wrap"),a.appendChild(n),i.appendChild(a),t.$wrap=a}else i.appendChild(n);t.$el.dataset.imageFit=this.fancybox.option("Image.fit"),this.fancybox.setContent(t,i),n.complete||n.error?this.onImageStatusChange(t):this.fancybox.showLoading(t)}}},{key:"onImageStatusChange",value:function(t){var e=this,i=t.$image;i&&"loading"===t.state&&(i.complete&&i.naturalWidth&&i.naturalHeight?(this.fancybox.hideLoading(t),"contain"===this.fancybox.option("Image.fit")&&this.initSlidePanzoom(t),t.$el.addEventListener("wheel",(function(i){return e.onWheel(t,i)}),{passive:!1}),t.$content.addEventListener("click",(function(i){return e.onClick(t,i)}),{passive:!1}),this.revealContent(t)):this.fancybox.setError(t,"{{IMAGE_ERROR}}"))}},{key:"initSlidePanzoom",value:function(t){var e=this;t.Panzoom||(t.Panzoom=new M(t.$el,k(!0,this.fancybox.option("Image.Panzoom",{}),{viewport:t.$wrap,content:t.$image,width:t._width,height:t._height,wrapInner:!1,textSelection:!0,touch:this.fancybox.option("Image.touch"),panOnlyZoomed:!0,click:!1,wheel:!1})),t.Panzoom.on("startAnimation",(function(){e.fancybox.trigger("Image.startAnimation",t)})),t.Panzoom.on("endAnimation",(function(){"zoomIn"===t.state&&e.fancybox.done(t),e.handleCursor(t),e.fancybox.trigger("Image.endAnimation",t)})),t.Panzoom.on("afterUpdate",(function(){e.handleCursor(t),e.fancybox.trigger("Image.afterUpdate",t)})))}},{key:"revealContent",value:function(t){null===this.fancybox.Carousel.prevPage&&t.index===this.fancybox.options.startIndex&&this.canZoom(t)?this.zoomIn():this.fancybox.revealContent(t)}},{key:"getZoomInfo",value:function(t){var e=t.$thumb.getBoundingClientRect(),i=e.width,n=e.height,o=t.$content.getBoundingClientRect(),a=o.width,s=o.height,r=o.top-e.top,l=o.left-e.left,c=this.fancybox.option("Image.zoomOpacity");return"auto"===c&&(c=Math.abs(i/n-a/s)>.1),{top:r,left:l,scale:a&&i?i/a:1,opacity:c}}},{key:"canZoom",value:function(t){var e=this.fancybox,i=e.$container;if(window.visualViewport&&1!==window.visualViewport.scale)return!1;if(t.Panzoom&&!t.Panzoom.content.width)return!1;if(!e.option("Image.zoom")||"contain"!==e.option("Image.fit"))return!1;var n=t.$thumb;if(!n||"loading"===t.state)return!1;i.classList.add("fancybox__no-click");var o,a=n.getBoundingClientRect();if(this.fancybox.option("Image.ignoreCoveredThumbnail")){var s=document.elementFromPoint(a.left+1,a.top+1)===n,r=document.elementFromPoint(a.right-1,a.bottom-1)===n;o=s&&r}else o=document.elementFromPoint(a.left+.5*a.width,a.top+.5*a.height)===n;return i.classList.remove("fancybox__no-click"),o}},{key:"zoomIn",value:function(){var t=this.fancybox,e=t.getSlide(),i=e.Panzoom,n=this.getZoomInfo(e),o=n.top,a=n.left,s=n.scale,r=n.opacity;t.trigger("reveal",e),i.panTo({x:-1*a,y:-1*o,scale:s,friction:0,ignoreBounds:!0}),e.$content.style.visibility="",e.state="zoomIn",!0===r&&i.on("afterTransform",(function(t){"zoomIn"!==e.state&&"zoomOut"!==e.state||(t.$content.style.opacity=Math.min(1,1-(1-t.content.scale)/(1-s)))})),i.panTo({x:0,y:0,scale:1,friction:this.fancybox.option("Image.zoomFriction")})}},{key:"zoomOut",value:function(){var t=this,e=this.fancybox,i=e.getSlide(),n=i.Panzoom;if(n){i.state="zoomOut",e.state="customClosing",i.$caption&&(i.$caption.style.visibility="hidden");var o=this.fancybox.option("Image.zoomFriction"),a=function(e){var a=t.getZoomInfo(i),s=a.top,r=a.left,l=a.scale,c=a.opacity;e||c||(o*=.82),n.panTo({x:-1*r,y:-1*s,scale:l,friction:o,ignoreBounds:!0}),o*=.98};window.addEventListener("scroll",a),n.once("endAnimation",(function(){window.removeEventListener("scroll",a),e.destroy()})),a()}}},{key:"handleCursor",value:function(t){if("image"===t.type&&t.$el){var e=t.Panzoom,i=this.fancybox.option("Image.click",!1,t),n=this.fancybox.option("Image.touch"),o=t.$el.classList,a=this.fancybox.option("Image.canZoomInClass"),s=this.fancybox.option("Image.canZoomOutClass");if(o.remove(s),o.remove(a),e&&"toggleZoom"===i)e&&1===e.content.scale&&e.option("maxScale")-e.content.scale>.01?o.add(a):e.content.scale>1&&!n&&o.add(s);else"close"===i&&o.add(s)}}},{key:"onWheel",value:function(t,e){if("ready"===this.fancybox.state&&!1!==this.fancybox.trigger("Image.
4wheel",e))switch(this.fancybox.option("Image.wheel")){case"zoom":"done"===t.state&&t.Panzoom&&t.Panzoom.zoomWithWheel(e);break;case"close":this.fancybox.close();break;case"slide":this.fancybox[e.deltaY<0?"prev":"next"]()}}},{key:"onClick",value:function(t,e){var i=this;if("ready"===this.fancybox.state){var n=t.Panzoom;if(!n||!n.dragPosition.midPoint&&0===n.dragOffset.x&&0===n.dragOffset.y&&1===n.dragOffset.scale){if(this.fancybox.Carousel.Panzoom.lockAxis)return!1;var o=function(n){switch(n){case"toggleZoom":e.stopPropagation(),t.Panzoom&&t.Panzoom.zoomWithClick(e);break;case"close":i.fancybox.close();break;case"next":e.stopPropagation(),i.fancybox.next()}},a=this.fancybox.option("Image.click"),s=this.fancybox.option("Image.doubleClick");s?this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null,o(s)):this.clickTimer=setTimeout((function(){i.clickTimer=null,o(a)}),300):o(a)}}}},{key:"onPageChange",value:function(t,e){var i=t.getSlide();e.slides.forEach((function(t){t.Panzoom&&"done"===t.state&&t.index!==i.index&&t.Panzoom.panTo({x:0,y:0,scale:1,friction:.8})}))}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events)}}]),t}();K.defaults={canZoomInClass:"can-zoom_in",canZoomOutClass:"can-zoom_out",zoom:!0,zoomOpacity:"auto",zoomFriction:.82,ignoreCoveredThumbnail:!1,touch:!0,click:"toggleZoom",doubleClick:null,wheel:"zoom",fit:"contain",wrap:!1,Panzoom:{ratio:1}};var J=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onChange","onClosing"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={initCarousel:this.onChange,"Carousel.change":this.onChange,closing:this.onClosing},this.hasCreatedHistory=!1,this.origHash="",this.timer=null}return s(t,[{key:"onChange",value:function(t){var e=this,i=t.Carousel;this.timer&&clearTimeout(this.timer);var n=null===i.prevPage,o=t.getSlide(),a=new URL(document.URL).hash,s=!1;if(o.slug)s="#"+o.slug;else{var r=o.$trigger&&o.$trigger.dataset,l=t.option("slug")||r&&r.fancybox;l&&l.length&&"true"!==l&&(s="#"+l+(i.slides.length>1?"-"+(o.index+1):""))}n&&(this.origHash=a!==s?a:""),s&&a!==s&&(this.timer=setTimeout((function(){try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+s),n&&(e.hasCreatedHistory=!0)}catch(t){}}),300))}},{key:"onClosing",value:function(){if(this.timer&&clearTimeout(this.timer),!0!==this.hasSilentClose)try{return void window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}},{key:"attach",value:function(t){t.on(this.events)}},{key:"detach",value:function(t){t.off(this.events)}}],[{key:"startFromUrl",value:function(){var e=t.Fancybox;if(e&&!e.getInstance()&&!1!==e.defaults.Hash){var i=t.getParsedURL(),n=i.hash,o=i.slug,a=i.index;if(o){var s=document.querySelector('[data-slug="'.concat(n,'"]'));if(s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),!e.getInstance()){var r=document.querySelectorAll('[data-fancybox="'.concat(o,'"]'));r.length&&(null===a&&1===r.length?s=r[0]:a&&(s=r[a-1]),s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}}}}},{key:"onHashChange",value:function(){var e=t.getParsedURL(),i=e.slug,n=e.index,o=t.Fancybox,a=o&&o.getInstance();if(a&&a.plugins.Hash){if(i){var s=a.Carousel;if(i===a.option("slug"))return s.slideTo(n-1);var r,l=x(s.slides);try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c.slug&&c.slug===i)return s.slideTo(c.index)}}catch(t){l.e(t)}finally{l.f()}var h=a.getSlide(),d=h.$trigger&&h.$trigger.dataset;if(d&&d.fancybox===i)return s.slideTo(n-1)}a.plugins.Hash.hasSilentClose=!0,a.close()}t.startFromUrl()}},{key:"create",value:function(e){function i(){window.addEventListener("hashchange",t.onHashChange,!1),t.startFromUrl()}t.Fancybox=e,W&&window.requestAnimationFrame((function(){/complete|interactive|loaded/.test(document.readyState)?i():document.addEventListener("DOMContentLoaded",i)}))}},{key:"destroy",value:function(){window.removeEventListener("hashchange",t.onHashChange,!1)}},{key:"getParsedURL",value:function(){var t=window.location.hash.substr(1),e=t.split("-"),i=e.length>1&&/^\+?\d+$/.test(e[e.length-1])&&parseInt(e.pop(-1),10)||null;return{hash:t,slug:e.join("-"),index:i}}}]),t}(),Q={pageXOffset:0,pageYOffset:0,element:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement},activate:function(t){Q.pageXOffset=window.pageXOffset,Q.pageYOffset=window.pageYOffset,t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},deactivate:function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},tt=function(){function t(e){o(this,t),this.fancybox=e,this.active=!1,this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}return s(t,[{key:"isActive",value:function(){return this.active}},{key:"setTimer",value:function(){var t=this;if(this.active&&!this.timer){var e=this.fancybox.option("slideshow.delay",3e3);this.timer=setTimeout((function(){t.timer=null,t.fancybox.option("infinite")||t.fancybox.getSlide().index!==t.fancybox.Carousel.slides.length-1?t.fancybox.next():t.fancybox.jumpTo(0,{friction:0})}),e);var i=this.$progress;i||((i=document.createElement("div")).classList.add("fancybox__progress"),this.fancybox.$carousel.parentNode.insertBefore(i,this.fancybox.$carousel),this.$progress=i,i.offsetHeight),i.style.transitionDuration="".concat(e,"ms"),i.style.transform="scaleX(1)"}}},{key:"clearTimer",value:function(){clearTimeout(this.timer),this.timer=null,this.$progress&&(this.$progress.style.transitionDuration="",this.$progress.style.transform="",this.$progress.offsetHeight)}},{key:"activate",value:function(){this.active||(this.active=!0,this.fancybox.$container.classList.add("has-slideshow"),"done"===this.fancybox.getSlide().state&&this.setTimer(),document.addEventListener("visibilitychange",this.handleVisibilityChange,!1))}},{key:"handleVisibilityChange",value:function(){this.deactivate()}},{key:"deactivate",value:function(){this.active=!1,this.clearTimer(),this.fancybox.$container.classList.remove("has-slideshow"),document.removeEventListener("visibilitychange",this.handleVisibilityChange,!1)}},{key:"toggle",value:function(){this.active?this.deactivate():this.fancybox.Carousel.slides.length>1&&this.activate()}}]),t}(),et={display:["counter","zoom","slideshow","fullscreen","thumbs","close"],autoEnable:!0,items:{counter:{position:"left",type:"div",class:"fancybox__counter",html:'<span data-fancybox-index=""></span>&nbsp;/&nbsp;<span data-fancybox-count=""></span>',attr:{tabindex:-1}},prev:{type:"button",class:"fancybox__button--prev",label:"PREV",html:'<svg viewBox="0 0 24 24">
4<path d="M15 4l-8 8 8 8"/></svg>',attr:{"data-fancybox-prev":""}},next:{type:"button",class:"fancybox__button--next",label:"NEXT",html:'<svg viewBox="0 0 24 24"><path d="M8 4l8 8-8 8"/></svg>',attr:{"data-fancybox-next":""}},fullscreen:{type:"button",class:"fancybox__button--fullscreen",label:"TOGGLE_FULLSCREEN",html:'<svg viewBox="0 0 24 24">\n                <g><path d="M3 8 V3h5"></path><path d="M21 8V3h-5"></path><path d="M8 21H3v-5"></path><path d="M16 21h5v-5"></path></g>\n                <g><path d="M7 2v5H2M17 2v5h5M2 17h5v5M22 17h-5v5"/></g>\n            </svg>',click:function(t){t.preventDefault(),Q.element()?Q.deactivate():Q.activate(this.fancybox.$container)}},slideshow:{type:"button",class:"fancybox__button--slideshow",label:"TOGGLE_SLIDESHOW",html:'<svg viewBox="0 0 24 24">\n                <g><path d="M6 4v16"/><path d="M20 12L6 20"/><path d="M20 12L6 4"/></g>\n                <g><path d="M7 4v15M17 4v15"/></g>\n            </svg>',click:function(t){t.preventDefault(),this.Slideshow.toggle()}},zoom:{type:"button",class:"fancybox__button--zoom",label:"TOGGLE_ZOOM",html:'<svg viewBox="0 0 24 24"><circle cx="10" cy="10" r="7"></circle><path d="M16 16 L21 21"></svg>',click:function(t){t.preventDefault();var e=this.fancybox.getSlide().Panzoom;e&&e.toggleZoom()}},download:{type:"link",label:"DOWNLOAD",class:"fancybox__button--download",html:'<svg viewBox="0 0 24 24"><path d="M12 15V3m0 12l-4-4m4 4l4-4M2 17l.62 2.48A2 2 0 004.56 21h14.88a2 2 0 001.94-1.51L22 17"/></svg>',click:function(t){t.stopPropagation()}},thumbs:{type:"button",label:"TOGGLE_THUMBS",class:"fancybox__button--thumbs",html:'<svg viewBox="0 0 24 24"><circle cx="4" cy="4" r="1" /><circle cx="12" cy="4" r="1" transform="rotate(90 12 4)"/><circle cx="20" cy="4" r="1" transform="rotate(90 20 4)"/><circle cx="4" cy="12" r="1" transform="rotate(90 4 12)"/><circle cx="12" cy="12" r="1" transform="rotate(90 12 12)"/><circle cx="20" cy="12" r="1" transform="rotate(90 20 12)"/><circle cx="4" cy="20" r="1" transform="rotate(90 4 20)"/><circle cx="12" cy="20" r="1" transform="rotate(90 12 20)"/><circle cx="20" cy="20" r="1" transform="rotate(90 20 20)"/></svg>',click:function(t){t.stopPropagation();var e=this.fancybox.plugins.Thumbs;e&&e.toggle()}},close:{type:"button",label:"CLOSE",class:"fancybox__button--close",html:'<svg viewBox="0 0 24 24"><path d="M20 20L4 4m16 0L4 20"></path></svg>',attr:{"data-fancybox-close":"",tabindex:0}}}},it=function(){function t(e){var i=this;o(this,t),this.fancybox=e,this.$container=null,this.state="init";for(var n=0,a=["onInit","onPrepare","onDone","onKeydown","onClosing","onChange","onSettle","onRefresh"];n<a.length;n++){var s=a[n];this[s]=this[s].bind(this)}this.events={init:this.onInit,prepare:this.onPrepare,done:this.onDone,keydown:this.onKeydown,closing:this.onClosing,"Carousel.change":this.onChange,"Carousel.settle":this.onSettle,"Carousel.Panzoom.touchStart":function(){return i.onRefresh()},"Image.startAnimation":function(t,e){return i.onRefresh(e)},"Image.afterUpdate":function(t,e){return i.onRefresh(e)}}}return s(t,[{key:"onInit",value:function(){if(this.fancybox.option("Toolbar.autoEnable")){var t,e=!1,i=x(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){if("image"===t.value.type){e=!0;break}}}catch(t){i.e(t)}finally{i.f()}if(!e)return void(this.state="disabled")}var n,o=x(this.fancybox.option("Toolbar.display"));try{for(o.s();!(n=o.n()).done;){var a=n.value;if("close"===(w(a)?a.id:a)){this.fancybox.options.closeButton=!1;break}}}catch(t){o.e(t)}finally{o.f()}}},{key:"onPrepare",value:function(){var t=this.fancybox;if("init"===this.state&&(this.build(),this.update(),this.Slideshow=new tt(t),!t.Carousel.prevPage&&(t.option("slideshow.autoStart")&&this.Slideshow.activate(),t.option("fullscreen.autoStart")&&!Q.element())))try{Q.activate(t.$container)}catch(t){}}},{key:"onFsChange",value:function(){window.scrollTo(Q.pageXOffset,Q.pageYOffset)}},{key:"onSettle",value:function(){var t=this.fancybox,e=this.Slideshow;e&&e.isActive()&&(t.getSlide().index!==t.Carousel.slides.length-1||t.option("infinite")?"done"===t.getSlide().state&&e.setTimer():e.deactivate())}},{key:"onChange",value:function(){this.update(),this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer()}},{key:"onDone",value:function(t,e){var i=this.Slideshow;e.index===t.getSlide().index&&(this.update(),i&&i.isActive()&&(t.option("infinite")||e.index!==t.Carousel.slides.length-1?i.setTimer():i.deactivate()))}},{key:"onRefresh",value:function(t){t&&t.index!==this.fancybox.getSlide().index||(this.update(),!this.Slideshow||!this.Slideshow.isActive()||t&&"done"!==t.state||this.Slideshow.deactivate())}}
4,{key:"onKeydown",value:function(t,e,i){" "===e&&this.Slideshow&&(this.Slideshow.toggle(),i.preventDefault())}},{key:"onClosing",value:function(){this.Slideshow&&this.Slideshow.deactivate(),document.removeEventListener("fullscreenchange",this.onFsChange)}},{key:"createElement",value:function(t){var e,i;("div"===t.type?e=document.createElement("div"):(e=document.createElement("link"===t.type?"a":"button")).classList.add("carousel__button"),e.innerHTML=t.html,e.setAttribute("tabindex",t.tabindex||0),t.class)&&(i=e.classList).add.apply(i,m(t.class.split(" ")));for(var n in t.attr)e.setAttribute(n,t.attr[n]);t.label&&e.setAttribute("title",this.fancybox.localize("{{".concat(t.label,"}}"))),t.click&&e.addEventListener("click",t.click.bind(this)),"prev"===t.id&&e.setAttribute("data-fancybox-prev",""),"next"===t.id&&e.setAttribute("data-fancybox-next","");var o=e.querySelector("svg");return o&&(o.setAttribute("role","img"),o.setAttribute("tabindex","-1"),o.setAttribute("xmlns","http://www.w3.org/2000/svg")),e}},{key:"build",value:function(){var t=this;this.cleanup();var e,i=this.fancybox.option("Toolbar.items"),n=[{position:"left",items:[]},{position:"center",items:[]},{position:"right",items:[]}],o=this.fancybox.plugins.Thumbs,a=x(this.fancybox.option("Toolbar.display"));try{var s=function(){var a=e.value,s=void 0,r=void 0;if(w(a)?(s=a.id,r=k({},i[s],a)):r=i[s=a],["counter","next","prev","slideshow"].includes(s)&&t.fancybox.items.length<2)return"continue";if("fullscreen"===s){if(!document.fullscreenEnabled||window.fullScreen)return"continue";document.addEventListener("fullscreenchange",t.onFsChange)}if("thumbs"===s&&(!o||"disabled"===o.state))return"continue";if(!r)return"continue";var l=r.position||"right",c=n.find((function(t){return t.position===l}));c&&c.items.push(r)};for(a.s();!(e=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}var r=document.createElement("div");r.classList.add("fancybox__toolbar");for(var l=0,c=n;l<c.length;l++){var h=c[l];if(h.items.length){var d=document.createElement("div");d.classList.add("fancybox__toolbar__items"),d.classList.add("fancybox__toolbar__items--".concat(h.position));var u,f=x(h.items);try{for(f.s();!(u=f.n()).done;){var v=u.value;d.appendChild(this.createElement(v))}}catch(t){f.e(t)}finally{f.f()}r.appendChild(d)}}this.fancybox.$carousel.parentNode.insertBefore(r,this.fancybox.$carousel),this.$container=r}},{key:"update",value:function(){var t,e=this.fancybox.getSlide(),i=e.index,n=this.fancybox.items.length,o=e.downloadSrc||("image"!==e.type||e.error?null:e.src),a=x(this.fancybox.$container.querySelectorAll("a.fancybox__button--download"));try{for(a.s();!(t=a.n()).done;){var s=t.value;o?(s.removeAttribute("disabled"),s.removeAttribute("tabindex"),s.setAttribute("href",o),s.setAttribute("download",o),s.setAttribute("target","_blank")):(s.setAttribute("disabled",""),s.setAttribute("tabindex",-1),s.removeAttribute("href"),s.removeAttribute("download"))}}catch(t){a.e(t)}finally{a.f()}var r,l=e.Panzoom,c=l&&l.option("maxScale")>l.option("baseScale"),h=x(this.fancybox.$container.querySelectorAll(".fancybox__button--zoom"));try{for(h.s();!(r=h.n()).done;){var d=r.value;c?d.removeAttribute("disabled"):d.setAttribute("disabled","")}}catch(t){h.e(t)}finally{h.f()}var u,f=x(this.fancybox.$container.querySelectorAll("[data-fancybox-index]"));try{for(f.s();!(u=f.n()).done;){u.value.innerHTML=e.index+1}}catch(t){f.e(t)}finally{f.f()}var v,p=x(this.fancybox.$container.querySelectorAll("[data-fancybox-count]"));try{for(p.s();!(v=p.n()).done;){v.value.innerHTML=n}}catch(t){p.e(t)}finally{p.f()}if(!this.fancybox.option("infinite")){var g,m=x(this.fancybox.$container.querySelectorAll("[data-fancybox-prev]"));try{for(m.s();!(g=m.n()).done;){var y=g.value;0===i?y.setAttribute("disabled",""):y.removeAttribute("disabled")}}catch(t){m.e(t)}finally{m.f()}var b,w=x(this.fancybox.$container.querySelectorAll("[data-fancybox-next]"));try{for(w.s();!(b=w.n()).done;){var k=b.value;i===n-1?k.setAttribute("disabled",""):k.removeAttribute("disabled")}}catch(t){w.e(t)}finally{w.f()}}}},{key:"cleanup",value:function(){this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer(),this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),t}();it.defaults=et;var nt={ScrollLock:U,Thumbs:Y,Html:G,Toolbar:it,Image:K,Hash:J},ot={startIndex:0,preload:1,infinite:!0,showClass:"fancybox-zoomInUp",hideClass:"fancybox-fadeOut",animated:!0,hideScrollbar:!0,parentEl:null,mainClass:null,autoFocus:!0,trapFocus:!0,placeFocusBack:!0,click:"close",closeButton:"inside",dragToClose:!0,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},template:{closeButton:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1">
4<path d="M20 20L4 4m16 0L4 20"/></svg>',spinner:'<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="25 25 50 50" tabindex="-1"><circle cx="50" cy="50" r="20"/></svg>',main:null},l10n:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}},at=new Map,st=0,rt=function(t){l(i,t);var e=f(i);function i(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),t=t.map((function(t){return t.width&&(t._width=t.width),t.height&&(t._height=t.height),t})),(n=e.call(this,k(!0,{},ot,a))).bindHandlers(),n.state="init",n.setItems(t),n.attachPlugins(i.Plugins),n.trigger("init"),!0===n.option("hideScrollbar")&&n.hideScrollbar(),n.initLayout(),n.initCarousel(),n.attachEvents(),at.set(n.id,d(n)),n.trigger("prepare"),n.state="ready",n.trigger("ready"),n.$container.setAttribute("aria-hidden","false"),n.option("trapFocus")&&n.focus(),n}return s(i,[{key:"option",value:function(t){for(var e,n=this.getSlide(),o=n?n[t]:void 0,a=arguments.length,s=new Array(a>1?a-1:0),r=1;r<a;r++)s[r-1]=arguments[r];if(void 0!==o){var l;if("function"==typeof o)o=(l=o).call.apply(l,[this,this].concat(s));return o}return(e=p(c(i.prototype),"option",this)).call.apply(e,[this,t].concat(s))}},{key:"bindHandlers",value:function(){for(var t=0,e=["onMousedown","onKeydown","onClick","onFocus","onCreateSlide","onSettle","onTouchMove","onTouchEnd","onTransform"];t<e.length;t++){var i=e[t];this[i]=this[i].bind(this)}}},{key:"attachEvents",value:function(){document.addEventListener("mousedown",this.onMousedown),document.addEventListener("keydown",this.onKeydown,!0),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),this.$container.addEventListener("click",this.onClick)}},{key:"detachEvents",value:function(){document.removeEventListener("mousedown",this.onMousedown),document.removeEventListener("keydown",this.onKeydown,!0),document.removeEventListener("focus",this.onFocus,!0),this.$container.removeEventListener("click",this.onClick)}},{key:"initLayout",value:function(){var t=this;this.$root=this.option("parentEl")||document.body;var e=this.option("template.main");e&&(this.$root.insertAdjacentHTML("beforeend",this.localize(e)),this.$container=this.$root.querySelector(".fancybox__container")),this.$container||(this.$container=document.createElement("div"),this.$root.appendChild(this.$container)),this.$container.onscroll=function(){return t.$container.scrollLeft=0,!1},Object.entries({class:"fancybox__container",role:"dialog",tabIndex:"-1","aria-modal":"true","aria-hidden":"true","aria-label":this.localize("{{MODAL}}")}).forEach((function(e){var i;return(i=t.$container).setAttribute.apply(i,m(e))})),this.option("animated")&&this.$container.classList.add("is-animated"),this.$backdrop=this.$container.querySelector(".fancybox__backdrop"),this.$backdrop||(this.$backdrop=document.createElement("div"),this.$backdrop.classList.add("fancybox__backdrop"),this.$container.appendChild(this.$backdrop)),this.$carousel=this.$container.querySelector(".fancybox__carousel"),this.$carousel||(this.$carousel=document.createElement("div"),this.$carousel.classList.add("fancybox__carousel"),this.$container.appendChild(this.$carousel)),this.$container.Fancybox=this,this.id=this.$container.getAttribute("id"),this.id||(this.id=this.options.id||++st,this.$container.setAttribute("id","fancybox-"+this.id));var i,n=this.option("mainClass");n&&(i=this.$container.classList).add.apply(i,m(n.split(" ")));return document.documentElement.classList.add("with-fancybox"),this.trigger("initLayout"),this}},{key:"setItems",value:function(t){var e,i=[],n=x(t);try{for(n.s();!(e=n.n()).done;){var o=e.value,a=o.$trigger;if(a){var s=a.dataset||{};o.src=s.src||a.getAttribute("href")||o.src,o.type=s.type||o.type,!o.src&&a instanceof HTMLImageElement&&(o.src=a.currentSrc||o.$trigger.src)}var r=o.$thumb;if(!r){var l=o.$trigger&&o.$trigger.origTarget;l&&(r=l instanceof HTMLImageElement?l:l.querySelector("img:not([aria-hidden])")),!r&&o.$trigger&&(r=o.$trigger instanceof HTMLImageElement?o.$trigger:o.$trigger.querySelector("img:not([aria-hidden])"))}o.$thumb=r||null;var c=o.thumb;!c&&r&&!(c=r.currentSrc||r.src)&&r.dataset&&(c=r.dataset.lazySrc||r.dataset.src),c||"image"!==o.type||(c=o.src),o.thumb=c||null,o.caption=o.caption||"",i.push(o)}}catch(t){n.e(t)}finally{n.f()}this.items=i}},{key:"initCarousel",value:function(){var t=this;return this.Carousel=new H(this.$carousel,k(!0,{},{prefix:"",classNames:{viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"},textSelection:!0,preload:this.option("preload"),friction:.88,slides:this.items,initialPage:this.options.startIndex,slidesPerPage:1,infiniteX:this.option("infinite"),infiniteY:!0,l10n:this.option("l10n"),Dots:!1,Navigation:{classNames:{main:"fancybox__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}},Panzoom:{textSelection:!0,panOnlyZoomed:function(){return t.Carousel&&t.Carousel.pages&&t.Carousel.pages.length<2&&!t.option("dragToClose")},lockAxis:function(){if(t.Carousel){var e="x";return t.option("dragToClose")&&(e+="y"),e}}},on:{"*":function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];
4return t.trigger.apply(t,["Carousel.".concat(e)].concat(n))},init:function(e){return t.Carousel=e},createSlide:this.onCreateSlide,settle:this.onSettle}},this.option("Carousel"))),this.option("dragToClose")&&this.Carousel.Panzoom.on({touchMove:this.onTouchMove,afterTransform:this.onTransform,touchEnd:this.onTouchEnd}),this.trigger("initCarousel"),this}},{key:"onCreateSlide",value:function(t,e){var i=e.caption||"";if("function"==typeof this.options.caption&&(i=this.options.caption.call(this,this,this.Carousel,e)),"string"==typeof i&&i.length){var n=document.createElement("div"),o="fancybox__caption_".concat(this.id,"_").concat(e.index);n.className="fancybox__caption",n.innerHTML=i,n.setAttribute("id",o),e.$caption=e.$el.appendChild(n),e.$el.classList.add("has-caption"),e.$el.setAttribute("aria-labelledby",o)}}},{key:"onSettle",value:function(){this.option("autoFocus")&&this.focus()}},{key:"onFocus",value:function(t){this.isTopmost()&&this.focus(t)}},{key:"onClick",value:function(t){if(!t.defaultPrevented){var e=t.composedPath()[0];if(e.matches("[data-fancybox-close]"))return t.preventDefault(),void i.close(!1,t);if(e.matches("[data-fancybox-next]"))return t.preventDefault(),void i.next();if(e.matches("[data-fancybox-prev]"))return t.preventDefault(),void i.prev();var n=document.activeElement;if(n){if(n.closest("[contenteditable]"))return;e.matches(X)||n.blur()}if(!e.closest(".fancybox__content"))if(!getSelection().toString().length)if(!1!==this.trigger("click",t))switch(this.option("click")){case"close":this.close();break;case"next":this.next()}}}},{key:"onTouchMove",value:function(){var t=this.getSlide().Panzoom;return!t||1===t.content.scale}},{key:"onTouchEnd",value:function(t){var e=t.dragOffset.y;Math.abs(e)>=150||Math.abs(e)>=35&&t.dragOffset.time<350?(this.option("hideClass")&&(this.getSlide().hideClass="fancybox-throwOut".concat(t.content.y<0?"Up":"Down")),this.close()):"y"===t.lockAxis&&t.panTo({y:0})}},{key:"onTransform",value:function(t){if(this.$backdrop){var e=Math.abs(t.content.y),i=e<1?"":Math.max(.33,Math.min(1,1-e/t.content.fitHeight*1.5));this.$container.style.setProperty("--fancybox-ts",i?"0s":""),this.$container.style.setProperty("--fancybox-opacity",i)}}},{key:"onMousedown",value:function(){"ready"===this.state&&document.body.classList.add("is-using-mouse")}},{key:"onKeydown",value:function(t){if(this.isTopmost()){document.body.classList.remove("is-using-mouse");var e=t.key,i=this.option("keyboard");if(i&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){var n=t.composedPath()[0],o=document.activeElement&&document.activeElement.classList,a=o&&o.contains("carousel__button");if("Escape"!==e&&!a)if(t.target.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return;if(!1!==this.trigger("keydown",e,t)){var s=i[e];"function"==typeof this[s]&&this[s]()}}}}},{key:"getSlide",value:function(){var t=this.Carousel;if(!t)return null;var e=null===t.page?t.option("initialPage"):t.page,i=t.pages||[];return i.length&&i[e]?i[e].slides[0]:null}},{key:"focus",value:function(t){if(!(i.ignoreFocusChange||["init","closing","customClosing","destroy"].indexOf(this.state)>-1)){var e=this.$container,n=this.getSlide(),o="done"===n.state?n.$el:null;if(!o||!o.contains(document.activeElement)){t&&t.preventDefault(),i.ignoreFocusChange=!0;for(var a,s=[],r=0,l=Array.from(e.querySelectorAll(X));r<l.length;r++){var c=l[r],h=c.offsetParent,d=o&&o.contains(c),u=!this.Carousel.$viewport.contains(c);h&&(d||u)?(s.push(c),void 0!==c.dataset.origTabindex&&(c.tabIndex=c.dataset.origTabindex,c.removeAttribute("data-orig-tabindex")),(c.hasAttribute("autoFocus")||!a&&d&&!c.classList.contains("carousel__button"))&&(a=c)):(c.dataset.origTabindex=void 0===c.dataset.origTabindex?c.getAttribute("tabindex"):c.dataset.origTabindex,c.tabIndex=-1)}t?s.indexOf(t.target)>-1?this.lastFocus=t.target:this.lastFocus===e?q(s[s.length-1]):q(e):this.option("autoFocus")&&a?q(a):s.indexOf(document.activeElement)<0&&q(e),this.lastFocus=document.activeElement,i.ignoreFocusChange=!1}}}},{key:"hideScrollbar",value:function(){if(W){var t=window.innerWidth-document.documentElement.getBoundingClientRect().width,e="fancybox-style-noscroll",i=document.getElementById(e);i||t>0&&((i=document.createElement("style")).id=e,i.type="text/css",i.innerHTML=".compensate-for-scrollbar {padding-right: ".concat(t,"px;}"),document.getElementsByTagName("head")[0].appendChild(i),document.body.classList.add("compensate-for-scrollbar"))}}},{key:"revealScrollbar",value:function(){document.body.classList.remove("compensate-for-scrollbar");var t=document.getElementById("fancybox-style-noscroll");t&&t.remove()}},{key:"clearContent",value:function(t){this.Carousel.trigger("removeSlide",t),t.$content&&(t.$content.remove(),t.$content=null),t.$closeButton&&(t.$closeButton.remove(),t.$closeButton=null),t._className&&t.$el.classList.remove(t._className)}},{key:"setContent",value:function(t,e){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t.$el;if(e instanceof HTMLElement)["img","iframe","video","audio"].indexOf(e.nodeName.toLowerCase())>-1?(i=document.createElement("div")).appendChild(e):i=e;else{var a=document.createRange().createContextualFragment(e);(i=document.createElement("div")).appendChild(a)}if(t.filter&&!t.error&&(i=i.querySelector(t.filter)),i instanceof Element)return t._className="has-".concat(n.suffix||t.type||"unknown"),o.classList.add(t._className),i.classList.add("fancybox__content"),"none"!==i.style.display&&"none"!==getComputedStyle(i).getPropertyValue("display")||(i.style.display=t.display||this.option("defaultDisplay")||"flex"),t.id&&i.setAttribute("id",t.id),t.$content=i,o.prepend(i),this.manageCloseButton(t),"loading"!==t.state&&this.revealContent(t),i;this.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"manageCloseButton",value:function(t){var e=this,i=void 0===t.closeButton?this.option("closeButton"):t.closeButton;if(i&&("top"!==i||!this.$closeButton)){var n=document.createElement("button");n.classList.add("carousel__button","is-close"),n.setAttribute("title",this.options.l10n.CLOSE),n.innerHTML=this.option("template.closeButton"),n.addEventListener("click",(function(t){return e.close(t)})),"inside"===i?(t.$closeButton&&t.$closeButton.remove(),t.$closeButton=t.$content.appendChild(n)):this.$closeButton=this.$container.insertBefore(n,this.$container.firstChild)}}},{key:"revealContent",value:function(t){var e=this;this.trigger("reveal",t),t.$content.style.visibility="";var i=!1;t.error||"loading"===t.state||null!==this.Carousel.prevPage||t.index!==this.options.startIndex||(i=void 0===t.showClass?this.option("showClass"):t.showClass),i?(t.state="animating",this.animateCSS(t.$content,i,(function(){e.done(t)}))):this.done(t)}}
4,{key:"animateCSS",value:function(t,e,i){if(t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!0,cancelable:!0})),t&&e){t.addEventListener("animationend",(function n(o){o.currentTarget===this&&(t.removeEventListener("animationend",n),i&&i(),t.classList.remove(e))})),t.classList.add(e)}else"function"==typeof i&&i()}},{key:"done",value:function(t){t.state="done",this.trigger("done",t);var e=this.getSlide();e&&t.index===e.index&&this.option("autoFocus")&&this.focus()}},{key:"setError",value:function(t,e){t.error=e,this.hideLoading(t),this.clearContent(t);var i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"<p>{{ERROR}}</p>"),this.setContent(t,i,{suffix:"error"})}},{key:"showLoading",value:function(t){var e=this;t.state="loading",t.$el.classList.add("is-loading");var i=t.$el.querySelector(".fancybox__spinner");i||((i=document.createElement("div")).classList.add("fancybox__spinner"),i.innerHTML=this.option("template.spinner"),i.addEventListener("click",(function(){e.Carousel.Panzoom.velocity||e.close()})),t.$el.prepend(i))}},{key:"hideLoading",value:function(t){var e=t.$el&&t.$el.querySelector(".fancybox__spinner");e&&(e.remove(),t.$el.classList.remove("is-loading")),"loading"===t.state&&(this.trigger("load",t),t.state="ready")}},{key:"next",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slideNext()}},{key:"prev",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slidePrev()}},{key:"jumpTo",value:function(){var t;this.Carousel&&(t=this.Carousel).slideTo.apply(t,arguments)}},{key:"isClosing",value:function(){return["closing","customClosing","destroy"].includes(this.state)}},{key:"isTopmost",value:function(){return i.getInstance().id==this.id}},{key:"close",value:function(t){var e=this;if(t&&t.preventDefault(),!this.isClosing()&&!1!==this.trigger("shouldClose",t)&&(this.state="closing",this.Carousel.Panzoom.destroy(),this.detachEvents(),this.trigger("closing",t),"destroy"!==this.state)){this.$container.setAttribute("aria-hidden","true"),this.$container.classList.add("is-closing");var i=this.getSlide();if(this.Carousel.slides.forEach((function(t){t.$content&&t.index!==i.index&&e.Carousel.trigger("removeSlide",t)})),"closing"===this.state){var n=void 0===i.hideClass?this.option("hideClass"):i.hideClass;this.animateCSS(i.$content,n,(function(){e.destroy()}),!0)}}}},{key:"destroy",value:function(){if("destroy"!==this.state){this.state="destroy",this.trigger("destroy");var t=this.option("placeFocusBack")?this.option("triggerTarget",this.getSlide().$trigger):null;this.Carousel.destroy(),this.detachPlugins(),this.Carousel=null,this.options={},this.events={},this.$container.remove(),this.$container=this.$backdrop=this.$carousel=null,t&&q(t),at.delete(this.id);var e=i.getInstance();e?e.focus():(document.documentElement.classList.remove("with-fancybox"),document.body.classList.remove("is-using-mouse"),this.revealScrollbar())}}}],[{key:"show",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new i(t,e)}},{key:"fromEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t.defaultPrevented&&!(t.button&&0!==t.button||t.ctrlKey||t.metaKey||t.shiftKey)){var n,o,a,s=t.composedPath()[0],r=s;if((r.matches("[data-fancybox-trigger]")||(r=r.closest("[data-fancybox-trigger]")))&&(e.triggerTarget=r,n=r&&r.dataset&&r.dataset.fancyboxTrigger),n){var l=document.querySelectorAll('[data-fancybox="'.concat(n,'"]')),c=parseInt(r.dataset.fancyboxIndex,10)||0;r=l.length?l[c]:r}Array.from(i.openers.keys()).reverse().some((function(e){a=r||s;var i=!1;try{a instanceof Element&&("string"==typeof e||e instanceof String)&&(i=a.matches(e)||(a=a.closest(e)))}catch(t){}return!!i&&(t.preventDefault(),o=e,!0)}));var h=!1;if(o){e.event=t,e.target=a,a.origTarget=s,h=i.fromOpener(o,e);var d=i.getInstance();d&&"ready"===d.state&&t.detail&&document.body.classList.add("is-using-mouse")}return h}}},{key:"fromOpener",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(t){for(var e=["false","0","no","null","undefined"],i=["true","1","yes"],n=Object.assign({},t.dataset),o={},a=0,s=Object.entries(n);a<s.length;a++){var r=g(s[a],2),l=r[0],c=r[1];if("fancybox"!==l)if("width"===l||"height"===l)o["_".concat(l)]=c;else if("string"==typeof c||c instanceof String)if(e.indexOf(c)>-1)o[l]=!1;else if(i.indexOf(o[l])>-1)o[l]=!0;else try{o[l]=JSON.parse(c)}catch(t){o[l]=c}else o[l]=c}return t instanceof Element&&(o.$trigger=t),o}
4,o=[],a=e.startIndex||0,s=e.target||null,r=void 0!==(e=k({},e,i.openers.get(t))).groupAll&&e.groupAll,l=void 0===e.groupAttr?"data-fancybox":e.groupAttr,c=l&&s?s.getAttribute("".concat(l)):"";if(!s||c||r){var h=e.root||(s?s.getRootNode():document.body);o=[].slice.call(h.querySelectorAll(t))}if(s&&!r&&(o=c?o.filter((function(t){return t.getAttribute("".concat(l))===c})):[s]),!o.length)return!1;var d=i.getInstance();return!(d&&o.indexOf(d.options.$trigger)>-1)&&(a=s?o.indexOf(s):a,new i(o=o.map(n),k({},e,{startIndex:a,$trigger:s})))}},{key:"bind",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function n(){document.body.addEventListener("click",i.fromEvent,!1)}W&&(i.openers.size||(/complete|interactive|loaded/.test(document.readyState)?n():document.addEventListener("DOMContentLoaded",n)),i.openers.set(t,e))}},{key:"unbind",value:function(t){i.openers.delete(t),i.openers.size||i.destroy()}},{key:"destroy",value:function(){for(var t;t=i.getInstance();)t.destroy();i.openers=new Map,document.body.removeEventListener("click",i.fromEvent,!1)}},{key:"getInstance",value:function(t){return t?at.get(t):Array.from(at.values()).reverse().find((function(t){return!t.isClosing()&&t}))||null}},{key:"close",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if(t){var n,o=x(at.values());try{for(o.s();!(n=o.n()).done;){var a=n.value;a.close(e)}}catch(t){o.e(t)}finally{o.f()}}else{var s=i.getInstance();s&&s.close(e)}}},{key:"next",value:function(){var t=i.getInstance();t&&t.next()}},{key:"prev",value:function(){var t=i.getInstance();t&&t.prev()}}]),i}(O);rt.version="4.0.31",rt.defaults=ot,rt.openers=new Map,rt.Plugins=nt,rt.bind("[data-fancybox]");for(var lt=0,ct=Object.entries(rt.Plugins||{});lt<ct.length;lt++){var ht=g(ct[lt],2);ht[0];var dt=ht[1];"function"==typeof dt.create&&dt.create(rt)}t.Carousel=H,t.Fancybox=rt,t.Panzoom=M}));
5
6/* End */
7;
8; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/gardenshop/lib/rSlider/rSlider.min.js?17146848909638";s:6:"source";s:54:"/local/templates/gardenshop/lib/rSlider/rSlider.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
9! function () {
10    "use strict";
11    var t = function (t) {
12        this.input = null, this.inputDisplay = null, this.slider = null, this.sliderWidth = 0, this.sliderLeft = 0, this.pointerWidth = 0, this.pointerR = null, this.pointerL = null, this.activePointer = null, this.selected = null, this.scale = null, this.step = 0, this.tipL = null, this.tipR = null, this.timeout = null, this.valRange = !1, this.values = {
13            start: null,
14            end: null
15        }, this.conf = {
16            target: null,
17            values: null,
18            set: null,
19            range: !1,
20            width: null,
21            scale: !0,
22            labels: !0,
23            tooltip: !0,
24            step: null,
25            disabled: !1,
26            onChange: null
27        }, this.cls = {
28            container: "rs-container",
29            background: "rs-bg",
30            selected: "rs-selected",
31            pointer: "rs-pointer",
32            scale: "rs-scale",
33            noscale: "rs-noscale",
34            tip: "rs-tooltip"
35        };
36        for (var i in this.conf) t.hasOwnProperty(i) && (this.conf[i] = t[i]);
37        this.init()
38    };
39    t.prototype.init = function () {
40        return "object" == typeof this.conf.target ? this.input = this.conf.target : this.input = document.getElementById(this.conf.target.replace("#", "")), this.input ? (this.inputDisplay = getComputedStyle(this.input, null).display, this.input.style.display = "none", this.valRange = !(this.conf.values instanceof Array), !this.valRange || this.conf.values.hasOwnProperty("min") && this.conf.values.hasOwnProperty("max") ? this.createSlider() : console.log("Missing min or max value...")) : console.log("Cannot find target element...")
41    }, t.prototype.createSlider = function () {
42        return this.slider = i("div", this.cls.container), this.slider.innerHTML = '<div class="rs-bg"><span class="rs-bg-point"></span><span class="rs-bg-point"></span><span class="rs-bg-point"></span><span class="rs-bg-point"></span><span class="rs-bg-point"></span><span class="rs-bg-point"></span><span class="rs-bg-point"></span></div>', this.selected = i("div", this.cls.selected), this.pointerL = i("div", this.cls.pointer, ["dir", "left"]), this.scale = i("div", this.cls.scale), this.conf.tooltip && (this.tipL = i("div", this.cls.tip), this.tipR = i("div", this.cls.tip), this.pointerL.appendChild(this.tipL)), this.slider.appendChild(this.selected), this.slider.appendChild(this.scale), this.slider.appendChild(this.pointerL), this.conf.range && (this.pointerR = i("div", this.cls.pointer, ["dir", "right"]), this.conf.tooltip && this.pointerR.appendChild(this.tipR), this.slider.appendChild(this.pointerR)), this.input.parentNode.insertBefore(this.slider, this.input.nextSibling), this.conf.width && (this.slider.style.width = parseInt(this.conf.width) + "px"), this.sliderLeft = this.slider.getBoundingClientRect().left, this.sliderWidth = this.slider.clientWidth, this.pointerWidth = this.pointerL.clientWidth, this.conf.scale || this.slider.classList.add(this.cls.noscale), this.setInitialValues()
43    }, t.prototype.setInitialValues = function () {
44        if (this.disabled(this.conf.disabled), this.valRange && (this.conf.values = s(this.conf)), this.values.start = 0, this.values.end = this.conf.range ? this.conf.values.length - 1 : 0, this.conf.set && this.conf.set.length && n(this.conf)) {
45            var t = this.conf.set;
46            this.conf.range ? (this.values.start = this.conf.values.indexOf(t[0]), this.values.end = this.conf.set[1] ? this.conf.values.indexOf(t[1]) : null) : this.values.end = this.conf.values.indexOf(t[0])
47        }
48        return this.createScale()
49    }, t.prototype.createScale = function (t) {
50        this.step = this.sliderWidth / (this.conf.values.length - 1);
51        for (var e = 0, s = this.conf.values.length; e < s; e++) {
52            var n = i("span"),
53                l = i("ins");
54            n.appendChild(l), this.scale.appendChild(n), n.style.width = e === s - 1 ? 0 : this.step + "px", this.conf.labels ? l.innerHTML = this.conf.values[e] : 0 !== e && e !== s - 1 || (l.innerHTML = this.conf.values[e]), l.style.marginLeft = l.clientWidth / 2 * -1 + "px"
55        }
56        return this.addEvents()
57    }, t.prototype.updateScale = function () {
58        this.step = this.sliderWidth / (this.conf.values.length - 1);
59        for (var t = this.slider.querySelectorAll("span"), i = 0, e = t.length; i < e; i++) t[i].style.width = this.step + "px";
60        return this.setValues()
61    }, t.prototype.addEvents = function () {
62        var t = this.slider.querySelectorAll("." + this.cls.pointer),
63            i = this.slider.querySelectorAll("span");
64        e(document, "mousemove touchmove", this.move.bind(this)), e(document, "mouseup touchend touchcancel", this.drop.bind(this));
65        for (var s = 0, n = t.length; s < n; s++) e(t[s], "mousedown touchstart", this.drag.bind(this));
66        for (var s = 0, n = i.length; s < n; s++) e(i[s], "click", this.onClickPiece.bind(this));
67        return window.addEventListener("resize", this.onResize.bind(this)), this.setValues()
68    }, t.prototype.drag = function (t) {
69        if (t.preventDefault(), !this.conf.disabled) {
70            var i = t.target.getAttribute("data-dir");
71            return "left" === i && (this.activePointer = this.pointerL), "right" === i && (this.activePointer = this.pointerR), this.slider.classList.add("sliding")
72        }
73    }, t.prototype.move = function (t) {
74        if (this.activePointer && !this.conf.disabled) {
75            var i = ("touchmove" === t.type ? t.touches[0].clientX : t.pageX) - this.sliderLeft - this.pointerWidth / 2 + 15;
76            return (i = Math.round(i / this.step)) <= 0 && (i = 0), i > this.conf.values.length - 1 && (i = this.conf.values.length - 1), this.conf.range ? (this.activePointer === this.pointerL && (this.values.start = i), this.activePointer === this.pointerR && (this.values.end = i)) : this.values.end = i, this.setValues()
77        }
78    }, t.prototype.drop = function () {
79        this.activePointer = null
80    }, t.prototype.setValues = function (t, i) {
81        var e = this.conf.range ? "start" : "end";
82        return t && this.conf.values.indexOf(t) > -1 && (this.values[e] = this.conf.values.indexOf(t)), i && this.conf.values.indexOf(i) > -1 && (this.values.end = this.conf.values.indexOf(i)), this.conf.range && this.values.start > this.values.end && (this.values.start = this.values.end), this.pointerL.style.left = this.values[e] * this.step - this.pointerWidth / 2 + "px", this.conf.range ? (this.conf.tooltip && (this.tipL.innerHTML = this.conf.values[this.values.start], this.tipR.innerHTML = this.conf.values[this.values.end]), this.input.value = this.conf.values[this.values.start] + "," + this.conf.values[this.values.end], this.pointerR.style.left = this.values.end * this.step - this.pointerWidth / 2 + "px") : (this.conf.tooltip && (this.tipL.innerHTML = this.conf.values[this.values.end]), this.input.value = this.conf.values[this.values.end]), this.values.end > this.conf.values.length - 1 && (this.values.end = this.conf.values.length - 1), this.values.start < 0 && (this.values.start = 0), this.selected.style.width = (this.values.end - this.values.start) * this.step + "px", this.selected.style.left = this.values.start * this.step + "px", this.onChange()
83    }, t.prototype.onClickPiece = function (t) {
84        if (!this.conf.disabled) {
85            var i = Math.round((t.clientX - this.sliderLeft) / this.step);
86            return i > this.conf.values.length - 1 && (i = this.conf.values.length - 1), i < 0 && (i = 0), this.conf.range && i - this.values.start <= this.values.end - i ? this.values.start = i : this.values.end = i, this.slider.classList.remove("sliding"), this.setValues()
87        }
88    }, t.prototype.onChange = function () {
89        var t = this;
90        this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(function () {
91            if (t.conf.onChange && "function" == typeof t.conf.onChange) return t.conf.onChange(t.input.value)
92        }, 500)
93    }, t.prototype.onResize = function () {
94        return this.sliderLeft = this.slider.getBoundingClientRect().left, this.sliderWidth = this.slider.clientWidth, this.updateScale()
95    }, t.prototype.disabled = function (t) {
96        this.conf.disabled = t, this.slider.classList[t ? "add" : "remove"]("disabled")
97    }, t.prototype.getValue = function () {
98        return this.input.value
99    }, t.prototype.destroy = function () {
100        this.input.style.display = this.inputDisplay, this.slider.remove()
101    };
102    var i = function (t, i, e) {
103        var s = document.createElement(t);
104        return i && (s.className = i), e && 2 === e.length && s.setAttribute("data-" + e[0], e[1]), s
105    },
106        e = function (t, i, e) {
107            for (var s = i.split(" "), n = 0, l = s.length; n < l; n++) t.addEventListener(s[n], e)
108        },
109        s = function (t) {
110            var i = [],
111                e = t.values.max - t.values.min;
112            if (!t.step) return console.log("No step defined..."), [t.values.min, t.values.max];
113            for (var s = 0, n = e / t.step; s < n; s++) i.push(t.values.min + s * t.step);
114            return i.indexOf(t.values.max) < 0 && i.push(t.values.max), i
115        },
116        n = function (t) {
117            return !t.set || t.set.length < 1 ? null : t.values.indexOf(t.set[0]) < 0 ? null : !t.range || !(t.set.length < 2 || t.values.indexOf(t.set[1]) < 0) || null
118        };
119    window.rSlider = t
120}();
121/* End */
122;
123; /* Start:"a:4:{s:4:"full";s:88:"/local/templates/gardenshop/lib/vanilla-calendar/vanilla-calendar.min.js?171468489045010";s:6:"source";s:72:"/local/templates/gardenshop/lib/vanilla-calendar/vanilla-calendar.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
124/*! name: @uvarov.frontend/vanilla-calendar | url: https://github.com/uvarov-frontend/vanilla-calendar */
125!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendar=t()}(this,(function(){"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=(t,l,s)=>l in t?e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[l]=s,n=(e,t,l)=>(a(e,"symbol"!=typeof t?t+"":t,l),l);const i=e=>{const t=e.getFullYear();let l=e.getMonth()+1,s=e.getDate();return l=l<10?`0${l}`:l,s=s<10?`0${s}`:s,`${t}-${l}-${s}`},d=e=>{const t=[];return e.forEach((e=>{e.match(/^(\d{4}-\d{2}-\d{2})$/g)?t.push(e):e.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((e,l,s)=>{const a=new Date(`${l}T00:00:00`),n=new Date(`${s}T00:00:00`),d=new Date(a.getTime());for(;d<=n;d.setDate(d.getDate()+1))t.push(i(d));return e}))})),t},r=e=>{const t=Number(e);let l=String(t);
125return 0===t?l="12":13===t?l="01":14===t?l="02":15===t?l="03":16===t?l="04":17===t?l="05":18===t?l="06":19===t?l="07":20===t?l="08":21===t?l="09":22===t?l="10":23===t&&(l="11"),l},c=e=>{var t,l;e.rangeMin=e.settings.range.min,e.rangeMax=e.settings.range.max,e.rangeDisabled=e.settings.range.disabled?d([...e.settings.range.disabled]):[],e.rangeEnabled=e.settings.range.enabled?d([...e.settings.range.enabled]):[],e.selectedDates=e.settings.selected.dates?d([...e.settings.selected.dates]):[],e.selectedHolidays=e.settings.selected.holidays?d([...e.settings.selected.holidays]):[],e.settings.range.disablePast&&!e.settings.range.disableAllDays&&new Date(`${e.settings.range.min}T00:00:00`)<e.date.today&&(e.rangeMin=i(e.date.today)),e.settings.range.disableAllDays&&(e.rangeMin=i(e.date.today),e.rangeMax=i(e.date.today),null==(t=e.rangeDisabled)||t.push(i(e.date.today))),e.rangeEnabled&&e.rangeEnabled.sort(((e,t)=>+new Date(e)-+new Date(t))),(null==(l=e.rangeEnabled)?void 0:l[0])&&e.settings.range.disableAllDays&&(e.rangeMin=e.rangeEnabled[0],e.rangeMax=e.rangeEnabled[e.rangeEnabled.length-1]);const s=new Date(`${e.rangeMin}T00:00:00`),a=new Date(`${e.rangeMax}T00:00:00`);s.setDate(s.getDate()-1),a.setDate(a.getDate()+1),e.rangeDisabled.push(i(s)),e.rangeDisabled.push(i(a)),null!==e.settings.selected.month&&e.settings.selected.month>=0&&e.settings.selected.month<12?e.selectedMonth=e.settings.selected.month:e.selectedMonth=e.date.today.getMonth(),null!==e.settings.selected.year&&e.settings.selected.year>=0&&e.settings.selected.year<=9999?e.selectedYear=e.settings.selected.year:e.selectedYear=e.date.today.getFullYear(),e.viewYear=e.selectedYear,e.dateMin=e.settings.visibility.disabled?new Date(`${e.date.min}T00:00:00`):new Date(`${e.rangeMin}T00:00:00`),e.dateMax=e.settings.visibility.disabled?new Date(`${e.date.max}T00:00:00`):new Date(`${e.rangeMax}T00:00:00`);const n=!0===e.settings.selection.time||12===e.settings.selection.time;if(n||24===e.settings.selection.time){if(e.userTime=!1,"string"==typeof e.settings.selected.time){const t=n?/^([0-9]|0[1-9]|1[0-2]):([0-5][0-9])|(AM|PM)/g:/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])/g;e.settings.selected.time.replace(t,((t,l,s,a)=>(l&&s&&(e.userTime=!0,e.selectedHours=l,e.selectedMinutes=s),a&&n?e.selectedKeeping=a:n&&(e.selectedKeeping="AM"),"")))}!e.userTime&&n?(e.selectedHours=r(String(e.date.today.getHours())),e.selectedMinutes=String(e.date.today.getMinutes()),e.selectedKeeping=Number(e.date.today.getHours())>=12?"PM":"AM"):e.userTime||(e.selectedHours=String(e.date.today.getHours()),e.selectedMinutes=String(e.date.today.getMinutes())),e.selectedHours=Number(e.selectedHours)<10?`0${Number(e.selectedHours)}`:`${e.selectedHours}`,e.selectedMinutes=Number(e.selectedMinutes)<10?`0${Number(e.selectedMinutes)}`:`${e.selectedMinutes}`,e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`}else e.settings.selection.time&&(e.settings.selection.time=!1,console.error("The value of the time property can be: false, true, 12 or 24."));"multiple"===e.type&&(1===e.months?(console.warn("The value of the «months» parameter cannot be less than «2», the minimum available value will be initialized."),e.correctMonths=2):e.months>12?(console.warn("The value of the «months» parameter cannot be greater than «12», the maximum available value will be initialized."),e.correctMonths=12):e.correctMonths=e.months)},o=e=>{if(!["default","multiple","year"].includes(e.currentType))return;const t=e.HTMLElement.querySelector(`.${e.CSSClasses.arrowPrev}`),l=e.HTMLElement.querySelector(`.${e.CSSClasses.arrowNext}`);if(!t||!l)return;"default"!==e.currentType&&"multiple"!==e.currentType||(()=>{if(!e.dateMin||!e.dateMax)return;const s=new Date(`${i(new Date(e.selectedYear,e.selectedMonth,1))}T00:00:00`),a=new Date(s.getTime());s.setMonth(s.getMonth()-e.jumpMonths),a.setMonth(a.getMonth()+e.jumpMonths),!e.settings.selection.month||s.getFullYear()<e.dateMin.getFullYear()||s.getFullYear()===e.dateMin.getFullYear()&&s.getMonth()<e.dateMin.getMonth()?t.style.visibility="hidden":t.style.visibility="",!e.settings.selection.month||a.getFullYear()>e.dateMax.getFullYear()||a.getFullYear()===e.dateMax.getFullYear()&&a.getMonth()>e.dateMax.getMonth()?l.style.visibility="hidden":l.style.visibility=""})(),"year"===e.currentType&&e.dateMin&&e.dateMax&&void 0!==e.viewYear&&(e.dateMin.getFullYear()&&e.viewYear-7<=e.dateMin.getFullYear()?t.style.visibility="hidden":t.style.visibility="",e.dateMax.getFullYear()&&e.viewYear+7>=e.dateMax.getFullYear()?l.style.visibility="hidden":l.style.visibility="")},u=(e,t)=>
125{if(!e)return null;const l=new Date(`${e}T00:00:00`).getDate(),s=new Date(`${e}T00:00:00`).getMonth(),a=new Date(`${e}T00:00:00`).getFullYear(),n=new Date(a,s,l),i=t?n.getDay()||7:n.getDay();n.setDate(n.getDate()+4-i);const d=new Date(n.getFullYear(),0,1);return{year:a,week:Math.ceil(((+n-+d)/864e5+1)/7)}},m=e=>{var t,l;const s=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),a=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),n=new Date(e.selectedYear,e.selectedMonth,1),d=document.createElement("div"),r=document.createElement("button");d.className=e.CSSClasses.day,r.className=e.CSSClasses.dayBtn,r.type="button",null==(t=e.selectedDates)||t.sort(((e,t)=>+new Date(e)-+new Date(t))),s.forEach(((t,l)=>{const c=new Date(n.setMonth(e.selectedMonth+l)).getMonth(),o=new Date(n.setFullYear(e.selectedYear,e.selectedMonth+l)).getFullYear(),m=new Date(o,c,1),g=new Date(o,c+1,0).getDate();let v=Number(m.getDay());e.settings.iso8601&&(v=Number((0!==m.getDay()?m.getDay():7)-1)),e.settings.selection.day&&["single","multiple","multiple-ranged"].includes(e.settings.selection.day)&&s[l].classList.add(e.CSSClasses.daysSelecting),s[l].innerHTML="";const y=(t,a,n,i,c)=>{var m,g,v,y,h,S,M,p,C;const b=d.cloneNode(!0),D=r.cloneNode(!0);if(c&&D.classList.add(c),D.innerText=t,D.dataset.calendarDay=n,e.settings.visibility.weekNumbers){const t=u(n,e.settings.iso8601);if(!t)return;D.dataset.calendarWeekNumber=`${t.week}`}(null==(m=e.rangeEnabled)?void 0:m[0])&&e.settings.range.disableAllDays&&!(null==(g=e.rangeDisabled)?void 0:g.includes(n))&&(null==(v=e.rangeDisabled)||v.push(n)),(null==(y=e.rangeEnabled)?void 0:y[0])&&(null==(h=e.rangeDisabled)?void 0:h.includes(n))&&(e.rangeDisabled=null==(S=e.rangeDisabled)?void 0:S.filter((t=>{var l;return!(null==(l=e.rangeEnabled)?void 0:l.includes(t))}))),(null==(M=e.settings.range.disableWeekday)?void 0:M.includes(a))&&!(null==(p=e.rangeDisabled)?void 0:p.includes(n))&&(null==(C=e.rangeDisabled)||C.push(n)),((t,l,s,a,n)=>{(e.rangeMin>a||e.rangeMax<a)&&(l.classList.add(e.CSSClasses.dayBtnDisabled),l.tabIndex=-1),!e.settings.visibility.weekend||0!==s&&6!==s||l.classList.add(e.CSSClasses.dayBtnWeekend),Array.isArray(e.selectedHolidays)&&e.selectedHolidays.forEach((t=>{t===a&&l.classList.add(e.CSSClasses.dayBtnHoliday)}));let i=e.date.today.getDate(),d=e.date.today.getMonth()+1;i=i<10?`0${i}`:i,d=d<10?`0${d}`:d;const r=`${e.date.today.getFullYear()}-${d}-${i}`;e.settings.visibility.today&&l.dataset.calendarDay===r&&l.classList.add(e.CSSClasses.dayBtnToday),e.selectedDates&&0===e.selectedDates.indexOf(a)?("multiple-ranged"===e.settings.selection.day&&e.selectedDates.length>1?t.classList.add(e.CSSClasses.daySelectedFirst):t.classList.add(e.CSSClasses.daySelected),l.classList.add(e.CSSClasses.dayBtnSelected)):e.selectedDates&&e.selectedDates[0]&&e.selectedDates.indexOf(a)===e.selectedDates.length-1?(t.classList.add(e.CSSClasses.daySelected),"multiple-ranged"===e.settings.selection.day?t.classList.add(e.CSSClasses.daySelectedLast):t.classList.add(e.CSSClasses.daySelected),l.classList.add(e.CSSClasses.dayBtnSelected)):e.selectedDates&&e.selectedDates.indexOf(a)>0&&"multiple-ranged"===e.settings.selection.day?(t.classList.add(e.CSSClasses.daySelectedIntermediate),l.classList.add(e.CSSClasses.dayBtnSelected),l.classList.add(e.CSSClasses.dayBtnIntermediate)):e.selectedDates&&e.selectedDates.indexOf(a)>0&&(t.classList.add(e.CSSClasses.daySelected),l.classList.add(e.CSSClasses.dayBtnSelected)),Array.isArray(e.rangeDisabled)&&e.rangeDisabled[0]&&e.rangeDisabled.forEach((t=>{t===a&&(l.classList.add(e.CSSClasses.dayBtnDisabled),l.tabIndex=-1)})),!e.settings.selection.month&&n&&(l.classList.add(e.CSSClasses.dayBtnDisabled),l.tabIndex=-1),e.settings.selection.year||new Date(`${a}T00:00:00`).getFullYear()===o||(l.classList.add(e.CSSClasses.dayBtnDisabled),l.tabIndex=-1)})(b,D,a,n,i),i?e.settings.visibility.daysOutside&&b.append(D):b.append(D),s[l].append(b),e.actions.getDays&&e.actions.getDays(Number(t),n,b,D)};(()=>{let t=new Date(o,c,0).getDate()-v,l=o,s=c;0===c?(s=e.locale.months.length,l=o-1):c<10&&(s=`0${c}`);for(let a=0;a<v;a++){t+=1;const a=`${l}-${s}-${t}`,n=new Date(o,c,t-1).getMonth()-1,i=new Date(o,n,t).getDay();
125y(String(t),i,a,!0,e.CSSClasses.dayBtnPrev)}})(),(()=>{for(let e=1;e<=g;e++){const t=new Date(o,c,e),l=i(t),s=t.getDay();y(String(e),s,l,!1,null)}})(),(()=>{const t=v+g,l=Math.ceil(t/e.locale.weekday.length),s=e.locale.weekday.length*l-t;let a=o,n=String(c+2);c+1===e.locale.months.length?(n="01",a=o+1):c+2<10&&(n=`0${c+2}`);for(let i=1;i<=s;i++){const t=`${a}-${n}-${i<10?`0${i}`:String(i)}`,l=new Date(o,c,i).getMonth()+1,s=new Date(o,l,i).getDay();y(String(i),s,t,!0,e.CSSClasses.dayBtnNext)}})(),((e,t)=>{e.popups&&Object.keys(e.popups).forEach((l=>{var s;const a=t.querySelector(`[data-calendar-day="${l}"]`);if(a){const t=null==(s=e.popups)?void 0:s[l];(null==t?void 0:t.modifier)&&t.modifier.trim().split(" ").forEach((e=>{a.classList.add(e)})),(null==t?void 0:t.html)&&(a.parentNode.innerHTML+=`<div class="${e.CSSClasses.dayPopup}">${t.html}</div>`)}}))})(e,s[l]),((e,t,l,s,a)=>{if(!e.settings.visibility.weekNumbers)return;const n=a.querySelectorAll(`.${e.CSSClasses.day}`);s.innerHTML="";const i=Math.ceil((t+l)/7),d=document.createElement("b");d.className=e.CSSClasses.weekNumbersTitle,d.innerText="#",s.append(d);const r=document.createElement("div");r.className=e.CSSClasses.weekNumbersContent,s.append(r);const c=document.createElement("span");c.className=e.CSSClasses.weekNumber;for(let o=0;o<i;o++){let t=null;t=0===o?n[6].querySelector(`.${e.CSSClasses.dayBtn}`):n[7*o].querySelector(`.${e.CSSClasses.dayBtn}`);const l=u(t.dataset.calendarDay,e.settings.iso8601);if(!l)return;const s=c.cloneNode(!0);s.innerText=`${l.week}`,s.dataset.calendarYearWeek=`${l.year}`,r.append(s)}})(e,v,g,a[l],s[l])})),null==(l=e.rangeDisabled)||l.sort(((e,t)=>+new Date(e)-+new Date(t)))},g=e=>`\n\t<button type="button"\n\t\tclass="${e.CSSClasses.arrow} ${e.CSSClasses.arrowPrev}"\n\t\tdata-calendar-arrow="prev"\n\t\ttitle="Prev">\n\t</button>\n`,v=e=>`\n\t<button type="button"\n\tclass="${e.CSSClasses.arrow} ${e.CSSClasses.arrowNext}"\n\tdata-calendar-arrow="next"\n\ttitle="Next">\n\t</button>\n`,y=e=>`\n\t<button type="button"\n\t\tclass="${e.CSSClasses.month}"\n\t\tdata-calendar-selected-month>\n\t</button>\n`,h=e=>`\n\t<button type="button"\n\t\tclass="${e.CSSClasses.year}"\n\t\tdata-calendar-selected-year>\n\t</button>\n`,S=e=>`\n\t<div class="${e.CSSClasses.week}"></div>\n`,M=e=>`\n\t<div class="${e.CSSClasses.days}"></div>\n`,p=e=>`\n\t<div class="${e.CSSClasses.months}"></div>\n`,C=e=>`\n\t<div class="${e.CSSClasses.years}"></div>\n`,b=e=>e.settings.visibility.weekNumbers?`\n\t<div class="${e.CSSClasses.weekNumbers}"></div>\n`:"",D=e=>e.settings.selection.time?`\n\t<div class="${e.CSSClasses.time}"></div>\n`:"",T=(e,t)=>t.replace(/<#(.*?)\/>/g,((t,l)=>{const s=(e=>{let t=null;switch(e){case"ArrowPrev":t=g;break;case"ArrowNext":t=v;break;case"Month":t=y;break;case"Year":t=h;break;case"Week":t=S;break;case"Days":t=M;break;case"Months":t=p;break;case"Years":t=C;break;case"WeekNumbers":t=b;break;case"ControlTime":t=D}return t})(l.replace(/[\s\n\t]/g,""));return s?s(e):""})).replace(/[\n\t]/g,""),w=(e,t)=>{const l=e.HTMLElement;l.classList.add(e.CSSClasses.calendar);const s=(l,s)=>{if(!t)return;const a=e.HTMLElement.querySelector(`.${e.CSSClasses.controls}`);a&&e.HTMLElement.removeChild(a);e.HTMLElement.querySelector(`.${e.CSSClasses.grid}`).classList.add(e.CSSClasses.gridDisabled);const n=t.closest(`.${e.CSSClasses.column}`);n.classList.add(l),n.innerHTML=T(e,s)};switch(e.currentType){case"default":l.classList.add(e.CSSClasses.calendarDefault),l.classList.remove(e.CSSClasses.calendarMonth),l.classList.remove(e.CSSClasses.calendarYear),l.innerHTML=T(e,e.DOMTemplates.default);break;case"multiple":if(!e.correctMonths)break;l.classList.add(e.CSSClasses.calendarMultiple),l.classList.remove(e.CSSClasses.calendarMonth),l.classList.remove(e.CSSClasses.calendarYear),l.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,l)=>{let s="";for(let a=0;a<e.correctMonths;a++)s+=l;return s})).replace(/[\n\t]/g,""))(e,T(e,e.DOMTemplates.multiple));break;case"month":if("multiple"===e.type){s(e.CSSClasses.columnMonth,e.DOMTemplates.month);break}
125l.classList.remove(e.CSSClasses.calendarDefault),l.classList.add(e.CSSClasses.calendarMonth),l.classList.remove(e.CSSClasses.calendarYear),l.innerHTML=T(e,e.DOMTemplates.month);break;case"year":if("multiple"===e.type){s(e.CSSClasses.columnYear,e.DOMTemplates.year);break}l.classList.remove(e.CSSClasses.calendarDefault),l.classList.remove(e.CSSClasses.calendarMonth),l.classList.add(e.CSSClasses.calendarYear),l.innerHTML=T(e,e.DOMTemplates.year)}},$=e=>{const t=e.HTMLElement.querySelectorAll("[data-calendar-selected-month]");if(!t[0]||void 0===e.selectedMonth)return;const l=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((s,a)=>{const n=new Date(l.setMonth(e.selectedMonth+a)).getMonth();t[a].dataset.calendarSelectedMonth=String(n),t[a].innerText=e.locale.months[n],!1===e.settings.selection.month||"only-arrows"===e.settings.selection.month?(t[a].tabIndex=-1,t[a].classList.add(e.CSSClasses.monthDisabled)):(t[a].tabIndex=0,t[a].classList.remove(e.CSSClasses.monthDisabled))}))},f=e=>{const t=e.HTMLElement.querySelectorAll("[data-calendar-selected-year]");if(!t||void 0===e.selectedMonth)return;const l=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((s,a)=>{const n=new Date(l.setFullYear(e.selectedYear,e.selectedMonth+a)).getFullYear();t[a].dataset.calendarSelectedYear=String(n),t[a].innerText=String(n),!1===e.settings.selection.year||"only-arrows"===e.settings.selection.year?(t[a].tabIndex=-1,t[a].classList.add(e.CSSClasses.yearDisabled)):(t[a].tabIndex=0,t[a].classList.remove(e.CSSClasses.yearDisabled))}))},L=(e,t)=>{var l;const s=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(t.dataset.calendarSelectedMonth):e.selectedMonth,a=null==(l=null==t?void 0:t.closest(`.${e.CSSClasses.column}`))?void 0:l.querySelector(`.${e.CSSClasses.year}`),n=a?Number(a.dataset.calendarSelectedYear):e.selectedYear;e.currentType="month",w(e,t),$(e),f(e);const i=e.HTMLElement.querySelector(`.${e.CSSClasses.months}`);if(!e.dateMin||!e.dateMax||!i)return;e.settings.selection.month&&i.classList.add(e.CSSClasses.monthsSelecting);const d=e.jumpMonths>1?e.locale.months.map(((t,l)=>s-e.jumpMonths*l)).concat(e.locale.months.map(((t,l)=>s+e.jumpMonths*l))).filter((e=>e>=0&&e<=12)):Array.from(Array(12).keys()),r=document.createElement("button");r.type="button",r.className=e.CSSClasses.monthsMonth;const c=()=>{if("multiple"!==e.type)return 0;const t=[...e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`)].findIndex((t=>t.classList.contains(`${e.CSSClasses.columnMonth}`)));return t>0?t:0};for(let o=0;o<e.locale.months.length;o++){const t=e.locale.months[o],l=r.cloneNode(!0);o===s&&l.classList.add(e.CSSClasses.monthsMonthSelected),(o<e.dateMin.getMonth()+c()&&n<=e.dateMin.getFullYear()||o>e.dateMax.getMonth()+c()&&n>=e.dateMax.getFullYear()||o!==s&&!d.includes(o))&&(l.classList.add(e.CSSClasses.monthsMonthDisabled),l.tabIndex=-1),l.dataset.calendarMonth=String(o),l.title=`${t}`,l.innerText=`${e.settings.visibility.monthShort?t.substring(0,3):t}`,i.append(l)}},k=e=>({hide(){e.HTMLElement.classList.add(e.CSSClasses.calendarHidden),e.actions.hideCalendar&&e.actions.hideCalendar(e.HTMLInputElement,e.HTMLElement)},show(){e.HTMLElement.classList.remove(e.CSSClasses.calendarHidden),e.actions.showCalendar&&e.actions.showCalendar(e.HTMLInputElement,e.HTMLElement)},HTMLInputElement:e.HTMLInputElement,HTMLElement:e.HTMLElement}),H=(e,t)=>{const l=Number(e);let s=String(l);return"AM"===t?12===l&&(s="00"):"PM"===t&&(1===l?s="13":2===l?s="14":3===l?s="15":4===l?s="16":5===l?s="17":6===l?s="18":7===l?s="19":8===l?s="20":9===l?s="21":10===l?s="22":11===l&&(s="23")),s},E=e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const l=!0===e.settings.selection.time?12:e.settings.selection.time,s="range"===e.settings.selection.controlTime;t.innerHTML=`\n\t<div class="${e.CSSClasses.timeContent}">\n\t\t<label class="${e.CSSClasses.timeHours}">\n\t\t\t<input type="text"\n\t\t\t\tname="hours"\n\t\t\t\tmaxlength="2"\n\t\t\t\tvalue="${e.selectedHours}"\n\t\t\t\t${s?"disabled":""}>\n\t\t</label>\n\t\t<label class="${e.CSSClasses.timeMinutes}">\n\t\t\t<input type="text"\n\t\t\t\tname="minutes"\n\t\t\t\tmaxlength="2"\n\t\t\t\tvalue="${e.selectedMinutes}"\n\t\t\t\t${s?"disabled":""}>\n\t\t</label>\n\t\t${12===l?`\n\t\t<button type="button"\n\t\t\tclass="${e.CSSClasse
125s.timeKeeping}"\n\t\t\t${s?"disabled":""}>${e.selectedKeeping}</button>\n\t\t`:""}\n\t</div>\n\t<div class="${e.CSSClasses.timeRanges}">\n\t\t<label class="${e.CSSClasses.timeRange}">\n\t\t\t<input type="range"\n\t\t\t\tname="hours"\n\t\t\t\tmin="0"\n\t\t\t\tmax="23"\n\t\t\t\tstep="${e.settings.selection.stepHours}"\n\t\t\t\tvalue="${e.selectedKeeping?H(e.selectedHours,e.selectedKeeping):e.selectedHours}">\n\t\t</label>\n\t\t<label class="${e.CSSClasses.timeRange}">\n\t\t\t<input type="range"\n\t\t\t\tname="minutes"\n\t\t\t\tmin="0"\n\t\t\t\tmax="59"\n\t\t\t\tstep="${e.settings.selection.stepMinutes}"\n\t\t\t\tvalue="${e.selectedMinutes}">\n\t\t</label>\n\t</div>`,((e,t)=>{const l=e.HTMLElement.querySelector(`.${e.CSSClasses.timeRange} input[name="hours"]`),s=e.HTMLElement.querySelector(`.${e.CSSClasses.timeRange} input[name="minutes"]`),a=e.HTMLElement.querySelector(`.${e.CSSClasses.timeHours} input[name="hours"]`),n=e.HTMLElement.querySelector(`.${e.CSSClasses.timeMinutes} input[name="minutes"]`),i=e.HTMLElement.querySelector(`.${e.CSSClasses.timeKeeping}`),d=(t,l)=>{t.addEventListener("mouseover",(()=>l.classList.add(e.CSSClasses.isFocus)))},c=(t,l)=>{t.addEventListener("mouseout",(()=>l.classList.remove(e.CSSClasses.isFocus)))},o=(t,l,s)=>{"hours"===s?e.selectedHours=`${l}`:"minutes"===s&&(e.selectedMinutes=`${l}`),e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`,e.actions.changeTime&&e.actions.changeTime(t,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping),e.input&&e.HTMLInputElement&&e.actions.changeToInput&&e.actions.changeToInput(t,k(e),e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping)},u=(t,l,s,a)=>{t.addEventListener("input",(t=>{let n=Number(t.target.value);n=n<10?`0${n}`:`${n}`,"hours"===s&&12===a?Number(t.target.value)<a&&Number(t.target.value)>0?(l.value=n,e.selectedKeeping="AM",i.innerText=e.selectedKeeping,o(t,n,s)):(0===Number(t.target.value)?(e.selectedKeeping="AM",i.innerText="AM"):(e.selectedKeeping="PM",i.innerText="PM"),l.value=r(t.target.value),o(t,r(t.target.value),s)):(l.value=n,o(t,n,s))}))},m=(t,l,s,a)=>{l.addEventListener("change",(l=>{const n=l.target;let d=Number(n.value);d=d<10?`0${d}`:`${d}`,"hours"===s&&12===a?n.value&&Number(n.value)<=a&&Number(n.value)>0?(n.value=d,t.value=H(d,e.selectedKeeping),o(l,d,s)):n.value&&Number(n.value)<24&&(Number(n.value)>a||0===Number(n.value))?(0===Number(n.value)?(e.selectedKeeping="AM",i.innerText="AM"):(e.selectedKeeping="PM",i.innerText="PM"),n.value=r(n.value),t.value=d,o(l,r(n.value),s)):n.value=e.selectedHours:n.value&&Number(n.value)<=a&&Number(n.value)>=0?(n.value=d,t.value=d,o(l,d,s)):"hours"===s?n.value=e.selectedHours:"minutes"===s&&(n.value=e.selectedMinutes)}))};d(l,a),d(s,n),c(l,a),c(s,n),u(l,a,"hours",24===t?23:12),u(s,n,"minutes",0),m(l,a,"hours",24===t?23:12),m(s,n,"minutes",59),i&&i.addEventListener("click",(t=>{i.innerText.includes("AM")?e.selectedKeeping="PM":e.selectedKeeping="AM",l.value=H(e.selectedHours,e.selectedKeeping),o(t,e.selectedHours,"hours"),i.innerText=e.selectedKeeping}))})(e,l)},Y=e=>{const t=[...e.locale.weekday];if(!t[0])return;const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`),s=document.createElement("b");s.className=e.CSSClasses.weekDay,e.settings.iso8601&&t.push(t.shift()),l.forEach((l=>{l.innerHTML="";for(let a=0;a<t.length;a++){const n=t[a],i=s.cloneNode(!0);e.settings.visibility.weekend&&e.settings.iso8601?5!==a&&6!==a||i.classList.add(e.CSSClasses.weekDayWeekend):e.settings.visibility.weekend&&!e.settings.iso8601&&(0!==a&&6!==a||i.classList.add(e.CSSClasses.weekDayWeekend)),i.innerText=`${n}`,l.append(i)}}))},x=(e,t)=>{if(void 0===e.viewYear||!e.dateMin||!e.dateMax)return;const l=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",w(e,t),$(e),f(e),o(e);const s=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!s)return;e.settings.selection.year&&s.classList.add(e.CSSClasses.yearsSelecting);const a=document.createElement("button");
125a.type="button",a.className=e.CSSClasses.yearsYear;for(let n=e.viewYear-7;n<e.viewYear+8;n++){const t=n,i=a.cloneNode(!0);t===l&&i.classList.add(e.CSSClasses.yearsYearSelected),(t<e.dateMin.getFullYear()+("multiple"!==e.type||e.selectedYear===l?0:1)||t>e.dateMax.getFullYear())&&(i.classList.add(e.CSSClasses.yearsYearDisabled),i.tabIndex=-1),i.dataset.calendarYear=String(t),i.innerText=`${t}`,s.append(i)}},N=["light","dark","system"];let _=!1;const A=(e,t)=>{var l;let s=null;for(let a=0;a<N.length;a++){if("system"===N[a])return;if(null==(l=e.getAttribute(t))?void 0:l.includes(N[a])){s=N[a];break}}return s},F=(e,t)=>{e.HTMLElement&&(N.includes(t)?e.HTMLElement.dataset.calendarTheme=t:console.error("Incorrect name of theme in settings.visibility.theme"))},I=(e,t)=>{if(!t)return void F(e,"light");const l=e=>e.matches?"dark":"light";e.HTMLElement.dataset.calendarTheme=l(t),_||(t.onchange=t=>{"system"===e.settings.visibility.theme&&(e.HTMLElement.dataset.calendarTheme=l(t))},_=!0)},O=(e,t)=>{if(!e.HTMLElement)return;const l=!!e.settings.visibility.themeDetect&&document.querySelector(e.settings.visibility.themeDetect);if(!l)return void I(e,t);const s=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),a=l.hasAttribute(s);if(!s||!a)return void I(e,t);const n=A(l,s);n?(F(e,n),((e,t,l)=>{new MutationObserver((s=>{for(let a=0;a<s.length;a++)if(s[a].attributeName===l){const s=A(t,l);s&&F(e,s);break}})).observe(t,{attributes:!0})})(e,l,s)):I(e,t)},B=e=>{const t={default(){Y(e),m(e)},multiple(){Y(e),m(e)},month(){L(e)},year(){x(e)}};(e=>{if(!e.HTMLElement)return;let t;"not all"!==window.matchMedia("(prefers-color-scheme)").media&&(t=window.matchMedia("(prefers-color-scheme: dark)")),"system"===e.settings.visibility.theme?O(e,t):F(e,e.settings.visibility.theme)})(e),(e=>{if("define"!==e.settings.lang){e.locale.weekday=[];for(let t=0;t<7;t++){let l=new Date(0,0,t).toLocaleString(e.settings.lang,{weekday:"short"});l=`${l.charAt(0).toUpperCase()}${l.substring(1,l.length)}`,l=l.replace(/\./,""),e.locale.weekday.push(l)}e.locale.months=[];for(let t=0;t<12;t++){let l=new Date(0,t).toLocaleString(e.settings.lang,{month:"long"});l=`${l.charAt(0).toUpperCase()}${l.substring(1,l.length)}`,l=l.replace(/\./,""),e.locale.months.push(l)}}})(e),w(e),$(e),f(e),o(e),E(e),t[e.currentType]()},q=e=>{c(e),B(e)},P=(e,t)=>{if(void 0===e.selectedMonth||void 0===e.selectedYear)return;const l=new Date(`${i(new Date(e.selectedYear,e.selectedMonth,1))}T00:00:00`);switch(t){case"prev":l.setMonth(l.getMonth()-e.jumpMonths);break;case"next":l.setMonth(l.getMonth()+e.jumpMonths)}e.selectedMonth=l.getMonth(),e.selectedYear=l.getFullYear(),$(e),f(e),o(e),m(e)};let K=null;const W=()=>{var e;if(!K)return;const t=null==(e=K.HTMLElement)?void 0:e.querySelectorAll(`.${K.CSSClasses.dayBtnHover}`);t&&t.forEach((e=>e.classList.remove(K.CSSClasses.dayBtnHover)))},j=e=>{var t;if(!K||!K.selectedDates)return;const l=i(e);if(K.rangeDisabled&&K.rangeDisabled.includes(l))return;const s=null==(t=K.HTMLElement)?void 0:t.querySelectorAll(`[data-calendar-day="${l}"]`);null==s||s.forEach((e=>{e.classList.add(K.CSSClasses.dayBtnHover)}))},R=e=>{if(!e.target||!K||!K.selectedDates)return;if(!e.target.closest(`.${K.CSSClasses.days}`))return void W();const t=e.target.dataset.calendarDay;if(!t)return;W();const l=new Date(new Date(`${K.selectedDates[0]}T00:00:00`).getFullYear(),new Date(`${K.selectedDates[0]}T00:00:00`).getMonth(),new Date(`${K.selectedDates[0]}T00:00:00`).getDate()),s=new Date(new Date(`${t}T00:00:00`).getFullYear(),new Date(`${t}T00:00:00`).getMonth(),new Date(`${t}T00:00:00`).getDate());if(s>l)for(let a=l;a<=s;a.setDate(a.getDate()+1))j(a);else for(let a=l;a>=s;a.setDate(a.getDate()-1))j(a)},G=e=>{K&&"Escape"===e.key&&(K.selectedDates=[],K.HTMLElement.removeEventListener("mousemove",R),document.removeEventListener("keydown",G),B(K))},z=e=>{e&&e.selectedDates&&(K=e,e.selectedDates[0]&&e.selectedDates.length<=1?(e.HTMLElement.addEventListener("mousemove",R),document.addEventListener("keydown",G),e.settings.range.disableGaps&&(()=>{var e;if(!K||!(null==(e=K.selectedDates)?void 0:e[0])||!K.rangeDisabled||K.rangeDisabled.length<2)return;const t=new Date(`${K.selectedDates[0]}T00:00:00`);let l=null,s=null;for(let a=0;a<K.rangeDisabled.length;a++){const e=new Date(`${K.rangeDisabled[a]}T00:00:00`);if(!(t>=e)){s=e;break}l=e}l&&(l=new Date(l.setDate(l.getDate()+1)),K.rangeMin=i(l)),s&&(s=new Date(s.setDate(s.getDate()-1)),K.rangeMax=i(s))})()):(e.HTMLElement.removeEventListener("mousemove",R),document.removeEventListener("keydown",G),e.settings.range.disableGaps&&K&&(K.rangeMin=K.settings.range.min,K.rangeMax=K.settings.range.max,K.settings.range.disablePast&&new Date(`${K.settings.range.min}T00:00:00`)<K.date.today&&(K.rangeMin=i(K.date.today)))))},U=(e,t,l,s,a)=>
125{const n=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),i=[...n].findIndex((e=>e.classList.contains(t))),d=Number(n[i].querySelector(`.${l}`).getAttribute(a));return"month"===e.currentType&&i>=0?s-i:"year"===e.currentType&&e.selectedYear!==d?s-1:s},V=e=>{e.HTMLElement.addEventListener("click",(t=>{const l=t.target,s=l.closest(`.${e.CSSClasses.arrow}`),a=l.closest(`.${e.CSSClasses.arrowPrev}`),n=l.closest(`.${e.CSSClasses.arrowNext}`),d=l.closest(`.${e.CSSClasses.dayBtn}`),r=l.closest(`.${e.CSSClasses.dayBtnPrev}`),c=l.closest(`.${e.CSSClasses.dayBtnNext}`),o=l.closest(`.${e.CSSClasses.weekNumber}`),u=l.closest(`.${e.CSSClasses.year}`),g=l.closest(`.${e.CSSClasses.yearsYear}`),v=l.closest(`.${e.CSSClasses.month}`),y=l.closest(`.${e.CSSClasses.monthsMonth}`),h=l.closest(`.${e.CSSClasses.grid}`),S=l.closest(`.${e.CSSClasses.column}`);s&&"year"!==e.currentType&&"month"!==e.currentType&&P(e,l.dataset.calendarArrow),s&&e.actions.clickArrow&&e.actions.clickArrow(t,Number(e.selectedYear),Number(e.selectedMonth)),(()=>{if(e.settings.selection.day&&["single","multiple","multiple-ranged"].includes(e.settings.selection.day)&&d){switch(e.settings.selection.day){case"single":e.selectedDates&&d&&d.dataset.calendarDay&&(d.classList.contains(e.CSSClasses.dayBtnSelected)?e.selectedDates.splice(e.selectedDates.indexOf(d.dataset.calendarDay),1):(e.selectedDates=[],e.selectedDates.push(d.dataset.calendarDay)));break;case"multiple":e.selectedDates&&d&&d.dataset.calendarDay&&(d.classList.contains(e.CSSClasses.dayBtnSelected)?e.selectedDates.splice(e.selectedDates.indexOf(d.dataset.calendarDay),1):e.selectedDates.push(d.dataset.calendarDay));break;case"multiple-ranged":(()=>{if(e.selectedDates&&d&&d.dataset.calendarDay){if(e.selectedDates.length<=1&&e.selectedDates[0]&&e.selectedDates[0].includes(d.dataset.calendarDay)?e.selectedDates=[]:(e.selectedDates.length>1&&(e.selectedDates=[]),e.selectedDates.push(d.dataset.calendarDay)),e.selectedDates[1]){const t=new Date(new Date(`${e.selectedDates[0]}T00:00:00`).getFullYear(),new Date(`${e.selectedDates[0]}T00:00:00`).getMonth(),new Date(`${e.selectedDates[0]}T00:00:00`).getDate()),l=new Date(new Date(`${e.selectedDates[1]}T00:00:00`).getFullYear(),new Date(`${e.selectedDates[1]}T00:00:00`).getMonth(),new Date(`${e.selectedDates[1]}T00:00:00`).getDate()),s=t=>{if(!e.selectedDates)return;const l=i(t);e.rangeDisabled&&e.rangeDisabled.includes(l)||e.selectedDates.push(l)};if(e.selectedDates=[],l>t)for(let e=t;e<=l;e.setDate(e.getDate()+1))s(e);else for(let e=t;e>=l;e.setDate(e.getDate()-1))s(e)}z(e)}})()}e.actions.clickDay&&e.actions.clickDay(t,e.selectedDates),e.input&&e.HTMLInputElement&&e.HTMLElement&&e.actions.changeToInput&&e.actions.changeToInput(t,k(e),e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping),r?P(e,"prev"):c?P(e,"next"):m(e)}})(),(()=>{var l;if(!e.settings.visibility.weekNumbers||!o||!e.actions.clickWeekNumber)return;const s=null==(l=e.HTMLElement)?void 0:l.querySelectorAll("[data-calendar-week-number]");if(!s)return;const a=Number(o.innerText),n=Number(o.dataset.calendarYearWeek),i=[...s].filter((e=>Number(e.dataset.calendarWeekNumber)===a));e.actions.clickWeekNumber(t,a,i,n)})(),(()=>{if(e.settings.selection.year)if(s&&"year"===e.currentType){if(void 0===e.viewYear)return;n?e.viewYear+=15:a&&(e.viewYear-=15),x(e,t.target)}else if("year"!==e.currentType&&u)x(e,t.target);else if("year"===e.currentType&&u)e.currentType=e.type,B(e);else if(g){if(void 0===e.selectedMonth||!e.dateMin||!e.dateMax)return;e.selectedYear="multiple"===e.type?U(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(g.dataset.calendarYear),"data-calendar-selected-year"):Number(g.dataset.calendarYear),e.currentType=e.type,(e.selectedMonth<e.dateMin.getMonth()&&e.selectedYear<=e.dateMin.getFullYear()||e.selectedYear<e.dateMin.getFullYear())&&(e.selectedMonth=e.dateMin.getMonth(),e.selectedYear=e.dateMin.getFullYear()),(e.selectedMonth>e.dateMax.getMonth()&&e.selectedYear>=e.dateMax.getFullYear()||e.selectedYear>e.dateMax.getFullYear())&&(e.selectedMonth=e.dateMax.getMonth(),e.selectedYear=e.dateMax.getFullYear()),e.actions.clickYear&&e.actions.clickYear(t,e.selectedYear),B(e)}else"multiple"===e.type&&"year"===e.currentType&&h&&!S&&(e.currentType=e.type,B(e))})(),(()=>{if(e.settings.selection.month)if("month"!==e.currentType&&v)L(e,t.target);else if("month"===e.currentType&&v)e.currentType=e.type,B(e);else if(y){if(void 0===e.selectedMonth||!e.dateMin||!e.dateMax)return;
125if(e.selectedMonth="multiple"===e.type?U(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(y.dataset.calendarMonth),"data-calendar-selected-month"):Number(y.dataset.calendarMonth),"multiple"===e.type){const t=y.closest(`.${e.CSSClasses.columnMonth}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(t.dataset.calendarSelectedYear),e.selectedMonth<e.dateMin.getMonth()&&e.selectedYear<=e.dateMin.getFullYear()&&(e.selectedMonth=e.dateMin.getMonth()),e.selectedMonth>e.dateMax.getMonth()&&e.selectedYear>=e.dateMax.getFullYear()&&(e.selectedMonth=e.dateMax.getMonth())}e.currentType=e.type,e.actions.clickMonth&&e.actions.clickMonth(t,e.selectedMonth),B(e)}else"multiple"===e.type&&"month"===e.currentType&&h&&!S&&(e.currentType=e.type,B(e))})()}))},J=(e,t)=>{let l=e.offsetHeight,s=0;for(let a=e;a;a=a.offsetParent)l+=a.offsetTop||0,s+=a.offsetLeft||0;Object.assign(t.style,{left:`${s}px`,top:`${l}px`})},Q=e=>{if(!e)return;e.HTMLInputElement=e.HTMLElement,e.HTMLElement=null;const t=l=>{var s;e&&l.target!==e.HTMLInputElement&&!(null==(s=e.HTMLElement)?void 0:s.contains(l.target))&&(k(e).hide(),document.removeEventListener("click",t,{capture:!0}))};e.HTMLInputElement.addEventListener("click",(()=>{e.HTMLElement?(J(e.HTMLInputElement,e.HTMLElement),k(e).show()):(()=>{if(!e.HTMLInputElement)return;const t=document.createElement("div");t.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,J(e.HTMLInputElement,t),e.HTMLElement=t,document.body.append(e.HTMLElement),setTimeout((()=>k(e).show()),0),q(e),V(e)})(),document.addEventListener("click",t,{capture:!0})}))},X=e=>`\n\t<div class="${e.controls}">\n\t\t<#ArrowPrev />\n\t\t<#ArrowNext />\n\t</div>\n\t<div class="${e.grid}">\n\t\t<#Multiple>\n\t\t\t<div class="${e.column}">\n\t\t\t\t<div class="${e.header}">\n\t\t\t\t\t<div class="${e.headerContent}">\n\t\t\t\t\t\t<#Month />\n\t\t\t\t\t\t<#Year />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class="${e.wrapper}">\n\t\t\t\t\t<#WeekNumbers />\n\t\t\t\t\t<div class="${e.content}">\n\t\t\t\t\t\t<#Week />\n\t\t\t\t\t\t<#Days />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t<#/Multiple>\n\t</div>\n\t<#ControlTime />\n`,Z=e=>`\n\t<div class="${e.header}">\n\t\t<div class="${e.headerContent}">\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t</div>\n\t</div>\n\t<div class="${e.wrapper}">\n\t\t<div class="${e.content}">\n\t\t\t<#Months />\n\t\t</div>\n\t</div>\n`,ee=e=>`\n\t<div class="${e.header}">\n\t\t<#ArrowPrev />\n\t\t<div class="${e.headerContent}">\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t</div>\n\t\t<#ArrowNext />\n\t</div>\n\t<div class="${e.wrapper}">\n\t\t<div class="${e.content}">\n\t\t\t<#Years />\n\t\t</div>\n\t</div>\n`,te={calendar:"vanilla-calendar",calendarDefault:"vanilla-calendar_default",calendarMultiple:"vanilla-calendar_multiple",calendarMonth:"vanilla-calendar_month",calendarYear:"vanilla-calendar_year",calendarHidden:"vanilla-calendar_hidden",calendarToInput:"vanilla-calendar_to-input",controls:"vanilla-calendar-controls",grid:"vanilla-calendar-grid",gridDisabled:"vanilla-calendar-grid_disabled",column:"vanilla-calendar-column",columnMonth:"vanilla-calendar-column_month",columnYear:"vanilla-calendar-column_year",header:"vanilla-calendar-header",headerContent:"vanilla-calendar-header__content",month:"vanilla-calendar-month",monthDisabled:"vanilla-calendar-month_disabled",year:"vanilla-calendar-year",yearDisabled:"vanilla-calendar-year_disabled",arrow:"vanilla-calendar-arrow",arrowPrev:"vanilla-calendar-arrow_prev",arrowNext:"vanilla-calendar-arrow_next",wrapper:"vanilla-calendar-wrapper",content:"vanilla-calendar-content",week:"vanilla-calendar-week",weekDay:"vanilla-calendar-week__day",weekDayWeekend:"vanilla-calendar-week__day_weekend",days:"vanilla-calendar-days",daysSelecting:"vanilla-calendar-days_selecting",months:"vanilla-calendar-months",monthsSelecting:"vanilla-calendar-months_selecting",monthsMonth:"vanilla-calendar-months__month",monthsMonthSelected:"vanilla-calendar-months__month_selected",monthsMonthDisabled:"vanilla-calendar-months__month_disabled",years:"vanilla-calendar-years",yearsSelecting:"vanilla-calendar-years_selecting",yearsYear:"vanilla-calendar-years__year",yearsYearSelected:"vanilla-calendar-years__year_selected",yearsYearDisabled:"vanilla-calendar-years__year_disabled",time:"vanilla-calendar-time",timeContent:"vanilla-calendar-time__content",timeHours:"vanilla-calendar-time__hours",timeMinutes:"vanilla-calendar-time__minutes",timeKeeping:"vanilla-calendar-time__keeping",timeRanges:"vanilla-calendar-time__ranges",timeRange:"vanilla-calendar-time__range",day:"vanilla-calendar-day",daySelected:"vanilla-calendar-day_selected",daySelectedFirst:"vanilla-calendar-day_selected-first",daySelectedLast:"vanilla-calendar-day_selected-last",daySelectedIntermediate:"vanilla-calendar-day_selected-intermediate",dayPopup:"vanilla-calendar-day__popup",dayBtn:"vanilla-calendar-day__btn",dayBtnPrev:"vanilla-calendar-day__btn_prev",dayBtnNext:"vanilla-calendar-day__btn_next",dayBtnToday:"vanilla-calendar-day__btn_today",dayBtnSelected:"vanilla-calendar-day__btn_selected",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnIntermediate:"vanilla-calendar-day__btn_intermediate",dayBtnWeekend:"vanilla-calendar-day__btn_weekend",dayBtnHoliday:"vanilla-calendar-day__btn_holiday",weekNumbers:"vanilla-calendar-week-numbers",weekNumbersTitle:"vanilla-calendar-week-numbers__title",weekNumbersContent:"vanilla-calendar-week-numbers__content",weekNumber:"vanilla-calendar-week-number",isFocus:"vanilla-calendar-is-focus"};return class{constructor(e,i){var d,r,o,u,m,g,v,y,h,S,M,p,C,b,D,T,w,$,f,L,k,H,E,Y,x,N,_,A,F,I,O,P,K,W,j,R,G,z,U,J,le,
125se,ae,ne,ie,de,re,ce,oe,ue,me,ge,ve,ye,he,Se,Me,pe,Ce,be,De,Te,we,$e,fe,Le,ke,He,Ee,Ye,xe,Ne,_e,Ae,Fe,Ie,Oe,Be,qe,Pe,Ke,We,je,Re,Ge,ze,Ue,Ve,Je,Qe,Xe,Ze,et,tt,lt,st,at,nt,it,dt,rt,ct,ot,ut,mt,gt,vt,yt,ht,St,Mt,pt,Ct,bt,Dt,Tt,wt,$t,ft,Lt,kt,Ht,Et,Yt,xt,Nt,_t,At,Ft,It,Ot,Bt;(n(this,"HTMLElement"),n(this,"input"),n(this,"type"),n(this,"months"),n(this,"jumpMonths"),n(this,"date"),n(this,"settings"),n(this,"locale"),n(this,"actions"),n(this,"popups"),n(this,"CSSClasses"),n(this,"DOMTemplates"),n(this,"currentType"),n(this,"reset",(()=>q(this))),n(this,"update",(()=>(e=>{var t;let l=null,s=null,a=null;(null==(t=e.settings.selected.dates)?void 0:t[0])||(l=e.settings.selected.dates,e.settings.selected.dates=e.selectedDates),e.settings.selected.month||(s=e.settings.selected.month,e.settings.selected.month=e.selectedMonth),e.settings.selected.year||(a=e.settings.selected.year,e.settings.selected.year=e.selectedYear),c(e),B(e),e.settings.selected.dates=l,e.settings.selected.month=s,e.settings.selected.year=a})(this))),n(this,"init",(()=>{var e;(e=this).HTMLElement&&(e.HTMLOriginalElement=e.HTMLElement.cloneNode(!0),e.input?Q(e):(q(e),V(e)))})),n(this,"destroy",(()=>(e=>{var t,l,s,a;e.HTMLOriginalElement&&(e.input?(null==(t=e.HTMLInputElement)||t.replaceWith(e.HTMLOriginalElement),null==(s=null==(l=e.HTMLElement)?void 0:l.parentNode)||s.removeChild(e.HTMLElement)):null==(a=e.HTMLElement)||a.replaceWith(e.HTMLOriginalElement),e.HTMLElement=e.HTMLOriginalElement)})(this))),this.HTMLElement="string"==typeof e?document.querySelector(e):e,this.HTMLElement)&&(this.input=null!=(d=null==i?void 0:i.input)&&d,this.type=null!=(r=null==i?void 0:i.type)?r:"default",this.months=null!=(o=null==i?void 0:i.months)?o:2,this.jumpMonths=null!=(u=null==i?void 0:i.jumpMonths)?u:1,this.date={min:null!=(g=null==(m=null==i?void 0:i.date)?void 0:m.min)?g:"1970-01-01",max:null!=(y=null==(v=null==i?void 0:i.date)?void 0:v.max)?y:"2470-12-31",today:null!=(S=null==(h=null==i?void 0:i.date)?void 0:h.today)?S:new Date},this.settings={lang:null!=(p=null==(M=null==i?void 0:i.settings)?void 0:M.lang)?p:"en",iso8601:null==(b=null==(C=null==i?void 0:i.settings)?void 0:C.iso8601)||b,range:{min:null!=(w=null==(T=null==(D=null==i?void 0:i.settings)?void 0:D.range)?void 0:T.min)?w:this.date.min,max:null!=(L=null==(f=null==($=null==i?void 0:i.settings)?void 0:$.range)?void 0:f.max)?L:this.date.max,disablePast:null!=(E=null==(H=null==(k=null==i?void 0:i.settings)?void 0:k.range)?void 0:H.disablePast)&&E,disableGaps:null!=(N=null==(x=null==(Y=null==i?void 0:i.settings)?void 0:Y.range)?void 0:x.disableGaps)&&N,disableAllDays:null!=(F=null==(A=null==(_=null==i?void 0:i.settings)?void 0:_.range)?void 0:A.disableAllDays)&&F,disableWeekday:null!=(P=null==(O=null==(I=null==i?void 0:i.settings)?void 0:I.range)?void 0:O.disableWeekday)?P:null,disabled:null!=(j=null==(W=null==(K=null==i?void 0:i.settings)?void 0:K.range)?void 0:W.disabled)?j:null,enabled:null!=(z=null==(G=null==(R=null==i?void 0:i.settings)?void 0:R.range)?void 0:G.enabled)?z:null},selection:{day:null!=(le=null==(J=null==(U=null==i?void 0:i.settings)?void 0:U.selection)?void 0:J.day)?le:"single",month:null==(ne=null==(ae=null==(se=null==i?void 0:i.settings)?void 0:se.selection)?void 0:ae.month)||ne,year:null==(re=null==(de=null==(ie=null==i?void 0:i.settings)?void 0:ie.selection)?void 0:de.year)||re,time:null!=(ue=null==(oe=null==(ce=null==i?void 0:i.settings)?void 0:ce.selection)?void 0:oe.time)&&ue,controlTime:null!=(ve=null==(ge=null==(me=null==i?void 0:i.settings)?void 0:me.selection)?void 0:ge.controlTime)?ve:"all",stepHours:null!=(Se=null==(he=null==(ye=null==i?void 0:i.settings)?void 0:ye.selection)?void 0:he.stepHours)?Se:1,stepMinutes:null!=(Ce=null==(pe=null==(Me=null==i?void 0:i.settings)?void 0:Me.selection)?void 0:pe.stepMinutes)?Ce:1},selected:{dates:null!=(Te=null==(De=null==(be=null==i?void 0:i.settings)?void 0:be.selected)?void 0:De.dates)?Te:null,month:null!=(fe=null==($e=null==(we=null==i?void 0:i.settings)?void 0:we.selected)?void 0:$e.month)?fe:null,year:null!=(He=null==(ke=null==(Le=null==i?void 0:i.settings)?void 0:Le.selected)?void 0:ke.year)?He:null,holidays:null!=(xe=null==(Ye=null==(Ee=null==i?void 0:i.settings)?void 0:Ee.selected)?void 0:Ye.holidays)?xe:null,time:null!=(Ae=null==(_e=null==(Ne=null==i?void 0:i.settings)?void 0:Ne.selected)?void 0:_e.time)?Ae:null},visibility:{theme:null!=(Oe=null==(Ie=null==(Fe=null==i?void 0:i.settings)?void 0:Fe.visibility)?void 0:Ie.theme)?Oe:"system",themeDetect:null!=(Pe=null==(qe=null==(Be=null==i?void 0:i.settings)?void 0:Be.visibility)?void 0:qe.themeDetect)?Pe:"html[data-theme]",monthShort:null==(je=null==(We=null==(Ke
125=null==i?void 0:i.settings)?void 0:Ke.visibility)?void 0:We.monthShort)||je,weekNumbers:null!=(ze=null==(Ge=null==(Re=null==i?void 0:i.settings)?void 0:Re.visibility)?void 0:Ge.weekNumbers)&&ze,weekend:null==(Je=null==(Ve=null==(Ue=null==i?void 0:i.settings)?void 0:Ue.visibility)?void 0:Ve.weekend)||Je,today:null==(Ze=null==(Xe=null==(Qe=null==i?void 0:i.settings)?void 0:Qe.visibility)?void 0:Xe.today)||Ze,disabled:null!=(lt=null==(tt=null==(et=null==i?void 0:i.settings)?void 0:et.visibility)?void 0:tt.disabled)&&lt,daysOutside:null==(nt=null==(at=null==(st=null==i?void 0:i.settings)?void 0:st.visibility)?void 0:at.daysOutside)||nt}},this.locale={months:null!=(dt=null==(it=null==i?void 0:i.locale)?void 0:it.months)?dt:[],weekday:null!=(ct=null==(rt=null==i?void 0:i.locale)?void 0:rt.weekday)?ct:[]},this.actions={clickDay:null!=(ut=null==(ot=null==i?void 0:i.actions)?void 0:ot.clickDay)?ut:null,clickWeekNumber:null!=(gt=null==(mt=null==i?void 0:i.actions)?void 0:mt.clickWeekNumber)?gt:null,clickMonth:null!=(yt=null==(vt=null==i?void 0:i.actions)?void 0:vt.clickMonth)?yt:null,clickYear:null!=(St=null==(ht=null==i?void 0:i.actions)?void 0:ht.clickYear)?St:null,clickArrow:null!=(pt=null==(Mt=null==i?void 0:i.actions)?void 0:Mt.clickArrow)?pt:null,changeTime:null!=(bt=null==(Ct=null==i?void 0:i.actions)?void 0:Ct.changeTime)?bt:null,changeToInput:null!=(Tt=null==(Dt=null==i?void 0:i.actions)?void 0:Dt.changeToInput)?Tt:null,getDays:null!=($t=null==(wt=null==i?void 0:i.actions)?void 0:wt.getDays)?$t:null,hideCalendar:null!=(Lt=null==(ft=null==i?void 0:i.actions)?void 0:ft.hideCalendar)?Lt:null,showCalendar:null!=(Ht=null==(kt=null==i?void 0:i.actions)?void 0:kt.showCalendar)?Ht:null},this.popups=null!=(Et=null==i?void 0:i.popups)?Et:null,this.CSSClasses=(()=>{const e=((e,n)=>{for(var i in n||(n={}))l.call(n,i)&&a(e,i,n[i]);if(t)for(var i of t(n))s.call(n,i)&&a(e,i,n[i]);return e})({},te);return Object.keys(te).forEach((t=>{var l;(null==(l=null==i?void 0:i.CSSClasses)?void 0:l[t])?e[t]=i.CSSClasses[t]:e[t]=te[t]})),e})(),this.DOMTemplates={default:null!=(xt=null==(Yt=null==i?void 0:i.DOMTemplates)?void 0:Yt.default)?xt:(Bt=this.CSSClasses,`\n\t<div class="${Bt.header}">\n\t\t<#ArrowPrev />\n\t\t<div class="${Bt.headerContent}">\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t</div>\n\t\t<#ArrowNext />\n\t</div>\n\t<div class="${Bt.wrapper}">\n\t\t<#WeekNumbers />\n\t\t<div class="${Bt.content}">\n\t\t\t<#Week />\n\t\t\t<#Days />\n\t\t</div>\n\t</div>\n\t<#ControlTime />\n`),multiple:null!=(_t=null==(Nt=null==i?void 0:i.DOMTemplates)?void 0:Nt.multiple)?_t:X(this.CSSClasses),month:null!=(Ft=null==(At=null==i?void 0:i.DOMTemplates)?void 0:At.month)?Ft:Z(this.CSSClasses),year:null!=(Ot=null==(It=null==i?void 0:i.DOMTemplates)?void 0:It.year)?Ot:ee(this.CSSClasses)},this.currentType=this.type)}}}));
126
127/* End */
128;
129; /* Start:"a:4:{s:4:"full";s:54:"/local/templates/gardenshop/js/main.js?177642696039419";s:6:"source";s:38:"/local/templates/gardenshop/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
130function InitCardPictureBlock() {
131  picture = $('.detail-block__slide').eq(0).find('img')[0].src;
132  name = $('.detail-block__title').html();
133  article = $('.detail-block__index').html();
134  price = $('.detail-block__current-price').html();
135  $('.card-product__name').html(name);
136  $('.card-product__code').html('Код товара: ' + article);
137  $('.card-product__price').html(price);
138  $('.card-product__img img')[0].src = picture;
139}
140
141$(document).ready(function () {
142  // Sticky Header
143  var lastScrollTop = 0;
144  let currentPadding = $('main').css('padding-top');
145  let currentPaddingReplace = Number(currentPadding.replace(/[a-zа-яё]/gi, ''));
146
147  $(window).on('scroll', function () {
148    const $header = $('.header');
149    let headerHeight = $header.height();
150    let curScrollTop = $(this).scrollTop();
151    let newPadding = headerHeight + currentPaddingReplace;
152
153    if (curScrollTop > headerHeight) {
154      if (!$header.hasClass('fixed')) {
155        $header.css('top', `-${headerHeight}px`);
156        $header.css('transition', '0ms');
157        $header.addClass('fixed');
158        $('head style').remove();
159        $(`<style>html.with-fancybox .header { padding-right: ${$.scrollbarWidth()}px; }</style>`).appendTo('head');
160        setTimeout(() => {
161          $header.css('transition', '500ms');
162          $header.css('top', `0`);
163        }, 500);
164        setTimeout(() => {
165          $header.css('transition', '0ms');
166        }, 1000);
167        headerMarginDes();
168        $('.header__line').hide();
169        $('.header__btm').hide();
170        function headerMarginDes() {
171          $('main').css('padding-top', `${newPadding}px`);
172        }
173      }
174    } else {
175      $header.removeClass('fixed');
176      $('head style').remove();
177      $('main').css('padding-top', currentPadding);
178      $('.header__line').show();
179      $('.header__btm').show();
180    }
181    lastScrollTop = curScrollTop;
182  });
183});
184
185function initCalendar(vanilaDiv) {
186  let date = new Date();
187  const calendar = new VanillaCalendar(vanilaDiv, {
188    settings: {
189      lang: 'ru',
190    },
191    date: {
192      min: '1920-01-01',
193      max: date.toISOString().split('T')[0],
194    },
195    actions: {
196      clickDay(event, dates) {
197        event.target.closest('.input').querySelector('.input__field').value = dates;
198        event.target.closest('.input_with-calendar').classList.remove('input_calendar-open');
199      },
200    },
201  });
202  calendar.init();
203}
204function showThanks($data) {
205  var data = {};
206  Fancybox.close();
207  data = $data;
208  Fancybox.show(
209    [
210      {
211        src: '/include/popup-thanks.php',
212        type: 'ajax',
213        ajax: $.param(data),
214      },
215    ],
216    {
217      dragToClose: false,
218      placeFocusBack: false,
219      on: {
220        reveal: (fancybox, slide) => {
221          var loader = $('#popup-success .loader-info');
222          var seconds = 5;
223          if (data.timeout) {
224            seconds = data.timeout;
225          }
226          if (data.link) {
227            let timerId = setInterval(function () {
228              loader.html('Автоматический переход через ' + seconds);
229              seconds--;
230            }, 1000);
231            setTimeout(() => {
232              clearInterval(timerId);
233              window.location = data.link;
234            }, seconds * 1000);
235          }
236        },
237      },
238    }
239  );
240}
241
242$.scrollbarWidth = function () {
243  var a, b, c;
244  if (c === undefined) {
245    a = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body');
246    b = a.children();
247    c = b.innerWidth() - b.height(99).innerWidth();
248    a.remove();
249  }
250  return c;
251};
252
253$(function () {
254  if ($('.header').hasClass('fixed')) {
255    $(`<style>html.with-fancybox .header { padding-right: ${$.scrollbarWidth()}px; }</style>`).appendTo('head');
256  }
257});
258
259$(window).on('resize', function () {
260  $('head style').remove();
261  if ($('.header').hasClass('fixed')) {
262    $(`<style>html.with-fancybox .header { padding-right: ${$.scrollbarWidth()}px; }</style>`).appendTo('head');
263  }
264});
265
266var observeObject = (function () {
267  var _class = {
268    init: function (selector, callback) {
269      var element = document.querySelector(selector);
270
271      try {
272        var observer = new MutationObserver(function (mutations) {
273          mutations.forEach(function (mutation) {
274            callback(mutation.target, mutation.attributeName, mutation.oldValue);
275          });
276        });
277
278        observer.observe(element, {
279          attributes: true,
280          subtree: true,
281          attributeOldValue: true,
282        });
283      } catch (z) {
284        element.addEventListener(
285          'DOMAttrModified',
286          function (e) {
287            callback(e.target, e.attrName, e.prevValue);
288          },
289          false
290        );
291      }
292    },
293  };
294
295  return _class;
296})();
297
298document.addEventListener('DOMContentLoaded', function () {
299  $('#regions_choose_component_mobile').on('click', function (event) {
300    event.preventDefault();
301    $('#regions_choose_component>div').click();
302  });
303
304  //phone mask for order
305  $("[autocomplete='tel']").each(function (index, el) {
306    var phoneMask = IMask(el, {
307      mask: '+{7} (000) 000-00-00',
308    });
309  });
310  BX.addCustomEvent('onAjaxSuccess', function () {
311    $("[autocomplete='tel']").each(function (index, el) {
312      var phoneMask = IMask(el, {
313        mask: '+{7} (000) 000-00-00',
314      });
315    });
316  });
317  //messenger btn
318  document.querySelectorAll('.open-messenger-button').forEach(btn => {
319    btn.addEventListener('click', e => {
320      e.preventDefault();
321      if (window.innerWidth > 1150) {
322        if (!document.querySelector('.message__links')) return;
323        document.querySelector('.message__links').parentElement.classList.toggle('active');
324      } else {
325        if (!document.querySelector('.menu__social')) return;
326        document.body.classList.toggle('menu-open');
327      }
328    });
329  });
330
331  // slider home
332  let sliderHome = () => {
333    let SwiperHome = new Swiper('.home-slider__container', {
334      slidesPerView: 1,
335      spaceBetween: 30,
336      loop: true,
337      centeredSlides: true,
338      /* autoplay: {
339				delay: 5000,
340				disableOnInteraction: false,
341				waitForTransition: false,
342			}, */
343
344      pagination: {
345        el: '.home-slider__pagination',
346        type: 'bullets',
347        clickable: true,
348      },
349      navigation: {
350        nextEl: '.home-slider__next',
351        prevEl: '.home-slider__prev',
352      },
353      breakpoints: {
354        0: {
355          slidesPerView: 1,
356          spaceBetween: 20,
357        },
358        769: {
359          slidesPerView: 1.25,
360          spaceBetween: 20,
361        },
362        1024: {
363          slidesPerView: 1,
364          spaceBetween: 30,
365        },
366      },
367    });
368  };
369  sliderHome();
370
371  // slider default
372  let sliderDefault = () => {
373    let SwiperDefault = new Swiper('.default-slider__container', {
374      slidesPerView: 'auto',
375      spaceBetween: 30,
376      // loop: true,
377      autoHeight: false,
378      pagination: {
379        el: '.default-slider__pagination',
380        type: 'bullets',
381        clickable: true,
382      },
383      navigation: {
384        nextEl: '.default-slider__next',
385        prevEl: '.default-slider__prev',
386      },
387      scrollbar: {
388        el: '.default-slider__scrollbar',
389        // draggable: true,
390      },
391      breakpoints: {
392        0: {
393          slidesPerView: 1,
394          spaceBetween: 15,
395        },
396        680: {
397          slidesPerView: 2,
398          spaceBetween: 15,
399        },
400        769: {
401          slidesPerView: 'auto',
402          spaceBetween: 15,
403        },
404        991: {
405          spaceBetween: 30,
406        },
407      },
408    });
409
410    //уникализируем выдачу переменной
411    if (!SwiperDefault.length && SwiperDefault) {
412      SwiperDefault = [SwiperDefault];
413    }
414    SwiperDefault.forEach(function (el, index) {
415      el.on('touchStart', function (swiper, event) {
416        if (event.target.closest('.stop-parent-touch')) {
417          swiper.allowTouchMove = false;
418        } else swiper.allowTouchMove = true;
419      });
420    });
421
422    // update slider when tab changes
423    document.querySelectorAll('.default-slider').forEach((el, index) => {
424      if (el.closest('.tab')) {
425        el.closest('.tab')
426          .querySelectorAll('.tab__header')
427          .forEach(elem => {
428            elem.addEventListener('click', e => {
429              SwiperDefault[index].update();
430            });
431          });
432      }
433    });
434  };
435  sliderDefault();
436
437  // slider category
438  let sliderCategory = () => {
439    let SwiperCategory = new Swiper('.category__slider', {
440      slidesPerView: 1,
441      spaceBetween: 30,
442      loop: true,
443      pagination: {
444        el: '.category__pagination',
445        type: 'bullets',
446        clickable: true,
447      },
448      navigation: {
449        nextEl: '.category__next',
450        prevEl: '.category__prev',
451      },
452      breakpoints: {
453        0: {
454          slidesPerView: 1,
455          spaceBetween: 15,
456        },
457        570: {
458          slidesPerView: 2,
459          spaceBetween: 15,
460        },
461        769: {
462          slidesPerView: 3,
463          spaceBetween: 30,
464        },
465        1200: {
466          slidesPerView: 4,
467        },
468      },
469    });
470  };
471  sliderCategory();
472
473  // slider partners
474  let sliderPartners = () => {
475    let SwiperPartners = new Swiper('.partners__slider', {
476      slidesPerView: 'auto',
477      spaceBetween: 24,
478      loop: true,
479      pagination: {
480        el: '.partners__pagination',
481        type: 'bullets',
482        clickable: true,
483        dynamicBullets: true,
484      },
485      navigation: {
486        nextEl: '.partners__next',
487        prevEl: '.partners__prev',
488      },
489      breakpoints: {
490        0: {
491          spaceBetween: 10,
492          slidesPerView: 2,
493        },
494        570: {
495          spaceBetween: 24,
496          slidesPerView: 'auto',
497        },
498      },
499    });
500  };
501  sliderPartners();
502
503  // slider Tab
504  let sliderTab = () => {
505    let SwiperTab = new Swiper('.tab-slider__container', {
506      slidesPerView: 1,
507      spaceBetween: 30,
508      loop: true,
509      pagination: {
510        el: '.tab-slider__pagination',
511        type: 'bullets',
512        clickable: true,
513      },
514      navigation: {
515        nextEl: '.tab-slider__next',
516        prevEl: '.tab-slider__prev',
517      },
518      breakpoints: {
519        0: {
520          slidesPerView: 1,
521          spaceBetween: 15,
522        },
523        570: {
524          slidesPerView: 2,
525          spaceBetween: 15,
526        },
527        769: {
528          slidesPerView: 3,
529          spaceBetween: 30,
530        },
531        1300: {
532          slidesPerView: 4,
533        },
534      },
535    });
536  };
537  sliderTab();
538
539  // slider review
540  let sliderReview = () => {
541    let SwiperReview = new Swiper('.review__slider', {
542      slidesPerView: 'auto',
543      spaceBetween: 30,
544      autoHeight: true,
545      navigation: {
546        nextEl: '.review__next',
547        prevEl: '.review__prev',
548      },
549      scrollbar: {
550        el: '.review__scrollbar',
551        draggable: true,
552      },
553      breakpoints: {
554        0: {
555          slidesPerView: 1,
556        },
557        570: {
558          slidesPerView: 'auto',
559        },
560      },
561    });
562  };
563  sliderReview();
564
565  // slider advantages
566  let sliderAdvantages = () => {
567    let SwiperAdvantages = new Swiper('.advantages__slider', {
568      slidesPerView: 4,
569      spaceBetween: 30,
570      grid: {
571        rows: 2,
572      },
573      scrollbar: {
574        el: '.advantages__scrollbar',
575        draggable: true,
576      },
577      breakpoints: {
578        0: {
579          slidesPerView: 1,
580          spaceBetween: 15,
581        },
582        570: {
583          slidesPerView: 2,
584          spaceBetween: 30,
585        },
586        769: {
587          slidesPerView: 3,
588          spaceBetween: 30,
589        },
590        1025: {
591          slidesPerView: 4,
592          spaceBetween: 30,
593        },
594      },
595    });
596  };
597  sliderAdvantages();
598
599  // sticky header
600  document.addEventListener('scroll', e => {
601    if (window.pageYOffset > 30) {
602      document.querySelector('.body-wrapper').classList.add('header-stick');
603    } else {
604      document.querySelector('.body-wrapper').classList.remove('header-stick');
605    }
606  });
607
608  // dropdown
609  $(document).on('click', '.dropdown', function (event) {
610    if (event.target.tagName === 'A') return;
611    $(this).toggleClass('dropdown_active');
612    if (event.target.closest('.dropdown__list')) {
613      $(this).find('.dropdown__title-text').html(event.target.innerText);
614      $('.select').removeClass('dropdown_active');
615    }
616  });
617
618  $(document).on('click', function (e) {
619    if (!$(e.target).closest('.dropdown__title, .dropdown__list').length) {
620      $('.select').removeClass('dropdown_active');
621    }
622    e.stopPropagation();
623  });
624
625  /*  $('.dropdown__item').click(function(){
626			$('.select').removeClass('dropdown_active')
627		})
628	 */
629  // tab
630  document.querySelectorAll('.tab').forEach(el => {
631    el.addEventListener('click', e => {
632      if (e.target.closest('.tab__link')) {
633        el.querySelectorAll('.tab__link').forEach(elem => {
634          elem.classList.remove('tab__link-active');
635        });
636        e.target.classList.add('tab__link-active');
637
638        el.querySelectorAll('.tab__item').forEach(elem => {
639          elem.classList.remove('tab__item-active');
640        });
641        let index = [...e.target.parentElement.children].indexOf(e.target);
642        el.querySelectorAll('.tab__item')[index].classList.add('tab__item-active');
643      }
644    });
645  });
646
647  // replace header search form
648  if (window.innerWidth < 570) {
649    let cloneEl = document.querySelector('.header__search').cloneNode(true);
650    document.querySelector('.header__mid').append(cloneEl);
651    document.querySelector('.header__body .header__search').remove();
652  }
653
654  // accordion
655  function initAcc(elem, option) {
656    document.addEventListener('click', function (e) {
657      if (!e.target.closest('.a-btn')) {
658        if (document.querySelector(`${elem} > .a-container_open`) && option == true) {
659          document.querySelector(`${elem} > .a-container_open .a-panel`).style.maxHeight = 0;
660          document.querySelector(`${elem} > .a-container_open`).classList.remove('a-container_open');
661        }
662        return;
663      } else if (e.target.closest(`${elem}`)) {
664        if (!e.target.closest('.a-container').classList.contains('a-container_open')) {
665          e.preventDefault();
666          if (option == true) {
667            var elementList = document.querySelectorAll(elem + ' .a-container');
668            Array.prototype.forEach.call(elementList, function (e) {
669              e.classList.remove('a-container_open');
670              e.querySelector('.a-panel').style.maxHeight = 0;
671            });
672          }
673          e.target.closest('.a-container').classList.add('a-container_open');
674          e.target.closest('.a-container').querySelector('.a-panel').style.maxHeight =
675            e.target.closest('.a-container').querySelector('.a-panel').scrollHeight + 'px';
676        } else {
677          e.target.closest('.a-container').classList.remove('a-container_open');
678          e.target.closest('.a-container').querySelector('.a-panel').style.maxHeight = 0;
679        }
680      }
681    });
682  }
683
684  // catalog filter accordion
685  initAcc('.accordion_v2', false);
686
687  // order list accordion
688  initAcc('.accordion_v3', false);
689
690  // footer nav and catalog list accordion
691  if (window.innerWidth < 570) {
692    initAcc('.accordion_v1', true);
693  }
694
695  // menu
696  document.querySelector('.menu').addEventListener('click', e => {
697    if (e.target.closest('.menu__btn')) {
698      document.querySelector('body').classList.toggle('menu-open');
699    } else if (!e.target.closest('.menu__nav') && !e.target.closest('.menu__list')) {
700      document.querySelector('body').classList.remove('menu-open');
701    }
702  });
703
704  // tags
705  document.querySelectorAll('.tags').forEach(el => {
706    el.querySelector('.tags__btn').addEventListener('click', e => {
707      let currentText = e.target.innerText;
708      let toggleText = e.target.getAttribute('data-toggle-text');
709      e.target.setAttribute('data-toggle-text', currentText);
710      e.target.innerText = toggleText;
711      el.classList.toggle('tags_open');
712    });
713  });
714
715  // catalog template
716  document.querySelectorAll('.catalog__template-item').forEach(el => {
717    el.addEventListener('click', e => {
718      document.querySelectorAll('.catalog__template-item_active').forEach(elem => {
719        elem.classList.remove('catalog__template-item_active');
720      });
721      el.classList.add('catalog__template-item_active');
722    });
723  });
724
725  document.querySelectorAll('.catalog__filter-menu-btn').forEach(el => {
726    el.addEventListener('click', e => {
727      document.querySelector('body').classList.toggle('filter-open');
728    });
729  });
730
731  // acnhor
732  document.querySelectorAll('.anchor').forEach(el => {
733    el.addEventListener('click', e => {
734      e.preventDefault();
735      let currentAnchor = e.target.href.split('#').slice(1).join('');
736      let blockPosition = document.getElementById(currentAnchor).offsetTop - 276;
737      window.scroll({
738        top: blockPosition,
739        left: 0,
740        behavior: 'smooth',
741      });
742    });
743  });
744
745  // info item popup
746  document.addEventListener('click', e => {
747    if (
748      (e.target.closest('.info-item__btn') && !e.target.closest('.info-item_open')) ||
749      (e.target.closest('.info-item__popup') && !e.target.closest('.info-item__btn'))
750    ) {
751      document.querySelectorAll('.info-item').forEach(el => {
752        el.classList.remove('info-item_open');
753      });
754      e.target.closest('.info-item').classList.add('info-item_open');
755    } else {
756      document.querySelectorAll('.info-item').forEach(el => {
757        el.classList.remove('info-item_open');
758      });
759    }
760  });
761
762  // fancybox defaults
763  Fancybox.bind('[data-fancybox]', {
764    autoFocus: false,
765    dragToClose: false,
766  });
767
768  $('.body-wrapper select').select2();
769
770  // quiz range slider
771  function quizRangeSliderFunc() {
772    function calculateRangeInput(el, data, rangeUnit) {
773      el.querySelector('.quiz__stage_active .range-slider__input_max').value = data.from + rangeUnit;
774      el.querySelector('.quiz__stage_active .range-slider__input_max').dataset.realValue = data.from;
775    }
776    document.querySelectorAll('.quiz__stage_active .range-slider').forEach(el => {
777      el.querySelectorAll('.rs-container').forEach(elem => {
778        elem.remove();
779      });
780      let rangeLimits;
781      el.getAttribute('data-limits')
782        ? (rangeLimits = el.getAttribute('data-limits').split(','))
783        : (rangeLimits = [0, 100]);
784      let rangeUnit;
785      el.getAttribute('data-unit') ? (rangeUnit = el.getAttribute('data-unit')) : (rangeUnit = '');
786
787      let rangeSlider = $('.quiz__stage_active .range-slider__slider');
788      let rangeMin = +rangeLimits[0];
789      let rangeMax = +rangeLimits[1];
790      var srZnach = Math.round((rangeMax - rangeMin) / 2 + rangeMin);
791      rangeSlider.ionRangeSlider({
792        min: rangeMin,
793        max: rangeMax,
794        from: srZnach,
795        grid: true,
796        onChange: function (data) {
797          calculateRangeInput(el, data, rangeUnit);
798        },
799        onStart: function (data) {
800          calculateRangeInput(el, data, rangeUnit);
801        },
802      });
803      var rangeSlider_instance = rangeSlider.data('ionRangeSlider');
804      $('.quiz__stage_active .range-slider__input').keypress(function (e) {
805        var chr = String.fromCharCode(e.which);
806        if ('1234567890NOABC'.indexOf(chr) < 0) return false;
807      });
808      $('.quiz__stage_active .range-slider__input').val(srZnach);
809      $('.quiz__stage_active .range-slider__input').on('input', function () {
810        let val = $(this)
811          .val()
812          .replace(/[^\w\s!?]/g, '');
813        rangeSlider_instance.update({
814          from: val,
815        });
816      });
817    });
818  }
819
820  function initQuiz(quiz) {
821    let activeStageNum = 0;
822    let stagesCount = quiz.querySelectorAll('.quiz__stage').length;
823    let activeStageObj = quiz.querySelectorAll('.quiz__stage')[activeStageNum];
824    let prevBtn = quiz.querySelector('.quiz__prev');
825    let nextBtn = quiz.querySelector('.quiz__next');
826    var message = [];
827    inputCheck();
828
829    quiz.querySelectorAll('.quiz__btn').forEach(btn => {
830      btn.addEventListener('click', e => {
831        btn.closest('.quiz__prev') ? activeStageNum-- : activeStageNum++;
832        activeStageObj = quiz.querySelectorAll('.quiz__stage')[activeStageNum];
833        endPointCheck();
834        updateDiscountBar();
835        updateStage();
836        updateProgressBar();
837        inputCheck();
838      });
839    });
840
841    quiz.addEventListener('input', inputCheck);
842
843    nextBtn.addEventListener('click', e => {
844      setTimeout(() => {
845        quizRangeSliderFunc();
846      }, 0);
847    });
848
849    function inputCheck() {
850      let inputArr = 0;
851      activeStageObj.querySelectorAll('input').forEach(input => {
852        let inputType = input.getAttribute('type');
853        if (
854          (input.checked && (inputType == 'radio' || inputType == 'checkbox')) ||
855          (input.value != '' && !(inputType == 'radio' || inputType == 'checkbox'))
856        ) {
857          inputArr++;
858        }
859      });
860      if (inputArr > 0) {
861        nextBtn.classList.remove('quiz__btn_disable');
862      } else {
863        nextBtn.classList.add('quiz__btn_disable');
864      }
865    }
866
867    function getQizContent() {
868      var message = '';
869      $(quiz)
870        .find('.quiz__stage')
871        .each(function (stageIndex, stageElem) {
872          if ($(stageElem).hasClass('quiz__stage_final')) return false;
873          $elem = $(stageElem);
874          let qwes = $elem.find('.quiz__title').html();
875          let answAll = $elem.find('input[name^="stage"]');
876          if (answAll.length > 1) {
877            let checkboxes = [];
878            answAll = $($elem).find('input[name^="stage"]:checked');
879            answAll.each(function (index, el) {
880              checkboxes.push(el.value);
881            });
882            message += qwes + ' \r\n' + checkboxes.join(', ') + ' \r\n';
883          } else {
884            message += qwes + ' \r\n' + answAll.val() + ' \r\n';
885          }
886        });
887      $('.quiz__stage_final input[name="form_message"]').val(message);
888      console.log(message);
889    }
890
891    function getQizBitrixFilter() {
892      var filters = Object.create(null);
893      var listsFilter = Object.create(null);
894      var IntFilter = Object.create(null);
895      var link = '';
896      $(quiz)
897        .find('.quiz__stage')
898        .each(function (stageIndex, stageElem) {
899          if ($(stageElem).hasClass('quiz__stage_final')) return false;
900          $elem = $(stageElem);
901          let stageContent = $elem.find('.quiz__stage-content');
902          let type = stageContent.data('type');
903
904          let answAll = $elem.find('input[name^="stage"]');
905
906          switch (type) {
907            case 'radio':
908            case 'checkbox':
909              if (stageContent.data('bitrixprop')) {
910                let checkboxes = [];
911                answAll = $($elem).find('input[name^="stage"]:checked');
912                answAll.each(function (index, el) {
913                  checkboxes.push(el.dataset.enumid);
914                });
915                listsFilter[stageContent.data('bitrixprop')] = checkboxes;
916              }
917              break;
918            case 'range':
919              if (stageContent.data('bitrixprop')) {
920                IntFilter[stageContent.data('bitrixprop')] = answAll.val();
921              } else if (stageContent.data('price')) {
922                filters['price'] = answAll.data('real-value');
923              }
924              break;
925            default:
926              break;
927          }
928        });
929      filters['list'] = listsFilter;
930      filters['int'] = IntFilter;
931      link = '/selequip/?' + $.param(filters);
932      $('.quiz__stage_final input[name="form_link"]').val(link);
933      quiz.link = link;
934    }
935
936    function endPointCheck() {
937      if (activeStageNum == 0) {
938        prevBtn.classList.add('quiz__btn_remove');
939      } else {
940        prevBtn.classList.remove('quiz__btn_remove');
941      }
942
943      if (activeStageNum == stagesCount - 1) {
944        replaceBtn();
945        getQizContent();
946        getQizBitrixFilter();
947      }
948      nextBtn.classList.remove('quiz__btn_disable');
949    }
950
951    function updateDiscountBar() {
952      if (activeStageNum == stagesCount - 1) {
953        return false;
954      } else {
955        quiz.querySelectorAll('.quiz__discount-item_active').forEach(item => {
956          item.classList.remove('quiz__discount-item_active');
957        });
958        quiz.querySelectorAll('.quiz__discount-item').forEach((item, index) => {
959          if (index <= activeStageNum) {
960            item.classList.add('quiz__discount-item_active');
961          }
962        });
963
964        quiz.querySelector('.quiz__discount-total-num ').innerText = quiz.querySelector(
965          `.quiz__discount-item_active:nth-child(${activeStageNum + 1}) span`
966        ).innerText;
967      }
968    }
969
970    function updateStage() {
971      quiz.querySelectorAll('.quiz__stage_active').forEach(stage => {
972        stage.classList.remove('quiz__stage_active');
973      });
974      activeStageObj.classList.add('quiz__stage_active');
975    }
976
977    function updateProgressBar() {
978      let progressNum = Math.floor((100 / (stagesCount - 1)) * activeStageNum);
979      quiz.querySelector('.quiz__progress-title span').innerHTML = progressNum + '%';
980      quiz.querySelector('.quiz__progress-fill').style.width = progressNum + '%';
981    }
982
983    function replaceBtn() {
984      let sendBtn = document.createElement('input');
985      sendBtn.setAttribute('type', 'submit');
986      sendBtn.setAttribute('value', 'Показать результат');
987      sendBtn.classList.add('btn');
988      sendBtn.classList.add('quiz__btn-send-form');
989      nextBtn.after(sendBtn);
990      sendBtn.addEventListener('click', function () {
991        $('#qiz_form_submit').click();
992        console.log(this);
993      });
994      nextBtn.classList.add('hidden');
995      prevBtn.classList.add('hidden');
996    }
997  }
998
999  $(document).on('click', '.input_with-calendar', function (event) {
1000    if (
1001      !event.target.closest('.input__calendar') &&
1002      !event.target.closest('.vanilla-calendar-header') &&
1003      !event.target.closest('.vanilla-calendar-months') &&
1004      !event.target.closest('.vanilla-calendar-years')
1005    ) {
1006      this.classList.toggle('input_calendar-open');
1007    }
1008  });
1009
1010  $(document).on('click', '.register-btn', function (event) {
1011    Fancybox.close();
1012    event.preventDefault();
1013    var data = $(this).data();
1014    data.link = location.href;
1015    Fancybox.show(
1016      [
1017        {
1018          src: '/include/register.php?register=yes&BACKURL=/auth/',
1019          type: 'ajax',
1020          ajax: $.param(data),
1021        },
1022      ],
1023      {
1024        dragToClose: false,
1025        placeFocusBack: false,
1026      }
1027    );
1028  });
1029
1030  $(document).on('click', '.forget-btn', function (event) {
1031    Fancybox.close();
1032    event.preventDefault();
1033    var data = $(this).data();
1034    data.link = location.href;
1035    Fancybox.show(
1036      [
1037        {
1038          src: '/include/register.php?forgot_password=yes&BACKURL=/auth/',
1039          type: 'ajax',
1040          ajax: $.param(data),
1041        },
1042      ],
1043      {
1044        dragToClose: false,
1045        placeFocusBack: false,
1046      }
1047    );
1048  });
1049  $(document).on('click', '.login-btn', function (event) {
1050    Fancybox.close();
1051    event.preventDefault();
1052    var data = $(this).data();
1053    data.link = location.href;
1054    Fancybox.show(
1055      [
1056        {
1057          src: '/include/register.php?login=yes&backurl=/personal/',
1058          type: 'ajax',
1059          ajax: $.param(data),
1060        },
1061      ],
1062      {
1063        dragToClose: false,
1064        placeFocusBack: false,
1065      }
1066    );
1067  });
1068
1069  $('.call-btn').on('click', function (event) {
1070    event.preventDefault();
1071    var data = $(this).data();
1072    data.link = location.href;
1073    Fancybox.show(
1074      [
1075        {
1076          src: '/include/popup-call.php',
1077          type: 'ajax',
1078          ajax: $.param(data),
1079        },
1080      ],
1081      {
1082        dragToClose: false,
1083        placeFocusBack: false,
1084      }
1085    );
1086  });
1087
1088  $('.video-btn').on('click', function (event) {
1089    event.preventDefault();
1090    var data = $(this).data();
1091    data.link = location.href;
1092    Fancybox.show(
1093      [
1094        {
1095          src: '/include/popup-video.php',
1096          type: 'ajax',
1097          ajax: $.param(data),
1098        },
1099      ],
1100      {
1101        dragToClose: false,
1102        placeFocusBack: false,
1103      }
1104    );
1105  });
1106
1107  $('.qiz-btn').on('click', function (event) {
1108    event.preventDefault();
1109    var data = $(this).data();
1110    data.link = location.href;
1111    Fancybox.show(
1112      [
1113        {
1114          src: '/include/popup-qiz.php',
1115          type: 'ajax',
1116          ajax: $.param(data),
1117        },
1118      ],
1119      {
1120        dragToClose: false,
1121        placeFocusBack: false,
1122        on: {
1123          reveal: (fancybox, slide) => {
1124            document.querySelectorAll('.quiz').forEach(quiz => {
1125              quizRangeSliderFunc();
1126              initQuiz(quiz);
1127            });
1128          },
1129        },
1130      }
1131    );
1132  });
1133
1134  function calculateCredit() {
1135    var srok = +$('select[name="form_credit_time"]').val();
1136    var vznos = +$('select[name="form_credit_money"]').val();
1137    var money = +$('.card-product__price')
1138      .html()
1139      .replace(/[^+\d]/g, '');
1140    if (vznos != 0) {
1141      money = money - money * (vznos / 100);
1142    }
1143    if (money) {
1144      money = money / srok;
1145      moneyTrim = money.toFixed(0) + ' ₽';
1146      $('.credit-result__price').html(moneyTrim);
1147    }
1148  }
1149
1150  $('.credit-btn').on('click', function (event) {
1151    event.preventDefault();
1152    var data = $(this).data();
1153    data.link = location.href;
1154    Fancybox.show(
1155      [
1156        {
1157          src: '/include/popup-credit.php',
1158          type: 'ajax',
1159          ajax: $.param(data),
1160        },
1161      ],
1162      {
1163        dragToClose: false,
1164        placeFocusBack: false,
1165        on: {
1166          reveal: (fancybox, slide) => {
1167            InitCardPictureBlock();
1168
1169            $('select[name="form_credit_time"],select[name="form_credit_money"]').on('change', function () {
1170              calculateCredit();
1171            });
1172            calculateCredit();
1173            $('.select__input').select2({
1174              dropdownParent: $('#popup-callback'),
1175            });
1176          },
1177        },
1178      }
1179    );
1180  });
1181
1182  function show_3d(pid, add_compl_id = '') {
1183    // add_compl_id = add_compl_id || '';
1184    if (!pid) return;
1185    var param = 'pid=' + pid + '&add_compl_id=' + add_compl_id;
1186    $.ajax({
1187      url: '/local/ajax/get_3d.php',
1188      type: 'POST',
1189      cache: false,
1190      dataType: 'json',
1191      data: param,
1192      success: function (res) {
1193        var title = res['title'];
1194        var fold = res['fold'];
1195
1196        var windowHeight = jQuery(window).height();
1197        var windowWidth = jQuery(window).width();
1198
1199        var img_w = 1280;
1200        var img_h = 720;
1201
1202        var z = img_w / img_h;
1203
1204        img_h = windowHeight - 150;
1205
1206        if (img_w > windowWidth - 90) {
1207          img_w = windowWidth - 90;
1208          img_w = img_w > 1280 ? 1280 : img_w;
1209          img_h = img_w / z;
1210        } else {
1211          img_w = img_h * z;
1212          if (img_w > 1280) {
1213            img_w = 1280;
1214            img_h = img_w / z;
1215          }
1216        }
1217
1218        const fancybox = new Fancybox(
1219          [
1220            {
1221              src: "<div><div class='spritespin'></div></div>",
1222              type: 'html',
1223            },
1224          ],
1225          {
1226            backdropClick: 'false',
1227            closeButton: true,
1228            dragToClose: false,
1229            placeFocusBack: false,
1230          }
1231        );
1232
1233        setTimeout(function () {
1234          jQuery('.spritespin').spritespin({
1235            source: SpriteSpin.sourceArray(fold + '/images-{lane}-{frame}.jpg', {
1236              lane: [0, 3],
1237              frame: [0, 35],
1238              digits: 2,
1239            }),
1240            width: img_w,
1241            height: img_h,
1242            frames: 36,
1243            lanes: 4,
1244            sense: 1,
1245            senseLane: 2,
1246            animate: false,
1247            plugins: ['progress', '360', 'drag'],
1248          });
1249        }, 100);
1250      },
1251      error: function () {},
1252    });
1253  }
1254
1255  $(document).on('click', '.btn-3d', function () {
1256    pid = $(this).data('pid');
1257    add_compl_id = $(this).data('add_compl_id');
1258    show_3d(pid, add_compl_id);
1259  });
1260
1261  // password input toggle visibility
1262  document.querySelectorAll('.input__pass-toggle').forEach(btn => {
1263    let input = btn.closest('.input').querySelector('.input__field');
1264    btn.addEventListener('click', e => {
1265      btn.classList.toggle('input__pass-toggle_show');
1266      input.getAttribute('type') == 'password'
1267        ? input.setAttribute('type', 'text')
1268        : input.setAttribute('type', 'password');
1269    });
1270  });
1271
1272  // cabinet photo
1273  if (window.innerWidth < 768) {
1274    document.querySelectorAll('.cabinet__photo').forEach(el => {
1275      el.addEventListener('click', e => {
1276        el.classList.toggle('cabinet__photo_show');
1277      });
1278    });
1279  }
1280
1281  $('.header__search').fadeIn();
1282
1283  // remove service card
1284  document.querySelectorAll('.service-card__remove-btn').forEach(btn => {
1285    let card = btn.closest('.service-card');
1286    btn.addEventListener('click', e => {
1287      card.remove();
1288    });
1289  });
1290
1291  // custom select
1292  document.querySelectorAll('.select').forEach(select => {
1293    let selectOptionArr = select.querySelectorAll('.select__input option');
1294    let selectItemArr = select.querySelectorAll('.select__item');
1295    selectItemArr.forEach((item, index) => {
1296      item.addEventListener('click', e => {
1297        selectOptionArr[index].setAttribute('selected', '');
1298      });
1299    });
1300  });
1301});
1302
1303window.onload = () => {
1304  // read more
1305  document.querySelectorAll('.read-more').forEach(el => {
1306    let btn = el.querySelector('.read-more__btn');
1307    let text = el.querySelector('.read-more__text');
1308
1309    let limitHeight = +text.style.maxHeight.split('').slice(0, -2).join('');
1310    let fullHeight = text.scrollHeight;
1311
1312    if (limitHeight >= fullHeight) {
1313      btn.remove();
1314      el.classList.toggle('read-more_open');
1315    }
1316
1317    btn.addEventListener('click', e => {
1318      e.target.closest('.read-more_open')
1319        ? (text.style.maxHeight = limitHeight + 'px')
1320        : (text.style.maxHeight = fullHeight + 'px');
1321
1322      let currentText = btn.innerHTML;
1323      let toggleText = btn.getAttribute('data-toggle-text');
1324      btn.setAttribute('data-toggle-text', currentText);
1325      btn.innerText = toggleText;
1326      el.classList.toggle('read-more_open');
1327    });
1328  });
1329};
1330
1331/* document.addEventListener('touchstart', handleTouchStart, false);        
1332document.addEventListener('touchmove', handleTouchMove, false);
1333
1334var xDown = null;                                                        
1335var yDown = null;
1336
1337function getTouches(evt) {
1338	return evt.touches ||             
1339				 evt.originalEvent.touches; 
1340}                                                     
1341																																				 
1342function handleTouchStart(evt) {
1343		const firstTouch = getTouches(evt)[0];                                      
1344		xDown = firstTouch.clientX;                                      
1345		yDown = firstTouch.clientY;                                      
1346};                                                
1347																																				 
1348function handleTouchMove(evt) {
1349		if ( ! xDown || ! yDown ) {
1350				return;
1351		}
1352
1353		var xUp = evt.touches[0].clientX;                                    
1354		var yUp = evt.touches[0].clientY;
1355
1356		var xDiff = xDown - xUp;
1357		var yDiff = yDown - yUp;
1358																																				 
1359		if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {
1360				if ( xDiff > 0 ) {
1361					 console.log('right swipe')
1362				} else {
1363						console.log('left swipe ')
1364				}                       
1365		} else {
1366				if ( yDiff > 0 ) { 
1367						console.log('down swipe ')
1368				} else { 
1369						console.log('up swipe')
1370				}                                                                 
1371		}
1372		xDown = null;
1373		yDown = null;                                             
1374}; */
1375
1376$(document).ready(function () {
1377  /* Favorites */
1378  $(document).on('click', '.wishlist_togler', function (e) {
1379    var favorID = $(this).attr('data-item');
1380    if ($(this).hasClass('icon_active')) var doAction = 'delete';
1381    else var doAction = 'add';
1382
1383    addFavorite(favorID, doAction);
1384  });
1385  /* Favorites */
1386
1387  if (getCookie('acceptCookes') != 'Y') {
1388    $('#cookiePopup').addClass('popup-info_open');
1389  }
1390  $('.cookie-popup-btn').on('click', function (event) {
1391    event.preventDefault();
1392    $('#cookiePopup').removeClass('popup-info_open');
1393    setCookie('acceptCookes', 'Y', {
1394      // secure: true, //https
1395      'max-age': 259200,
1396    });
1397  });
1398
1399  $('.sidebar__filter-list').each(function () {
1400    let itemList = $(this).find('.sidebar__filter-item').length;
1401
1402    if (itemList == 3) {
1403      $(this).addClass(`sidebar__filter-list--third`);
1404    }
1405    if (itemList == 2) {
1406      $(this).addClass(`sidebar__filter-list--second`);
1407    }
1408    if (itemList == 1) {
1409      $(this).addClass(`sidebar__filter-list--first`);
1410    }
1411    if (itemList == 0) {
1412      $(this).addClass(`sidebar__filter-list--zero`);
1413    }
1414  });
1415
1416  $('.footer__nav-list > li > a').click(function (e) {
1417    if ($(window).width() <= 570) {
1418      if ($(this).hasClass('active')) {
1419      } else {
1420        e.preventDefault();
1421        $(this).addClass('active');
1422        $(this).next().css('height', '100%');
1423      }
1424    }
1425  });
1426});
1427
1428/* Избранное */
1429function changeFavoriteHeader($count) {
1430  if ($count > 0) {
1431    $('.header-favorites').addClass('header__body-btn_notification').find('span').html($count);
1432  } else {
1433    $('.header-favorites').removeClass('header__body-btn_notification').find('span').html($count);
1434  }
1435}
1436
1437function addFavorite(id, action) {
1438  if (action == 'add') {
1439    // Если всё чётко, то выполняем действия, которые показывают, что данные отправлены
1440    $('.wishlist_togler[data-item="' + id + '"]').addClass('icon_active');
1441  }
1442  if (action == 'delete') {
1443    $('.wishlist_togler[data-item="' + id + '"]').removeClass('icon_active');
1444  }
1445  var param = 'id=' + id + '&action=' + action;
1446  $.ajax({
1447    url: '/local/ajax/favorites.php', // URL отправки запроса
1448    type: 'GET',
1449    dataType: 'json',
1450    data: param,
1451    success: function (response) {
1452      // Если Данные отправлены успешно
1453      var result = response.status;
1454      changeFavoriteHeader(response.count);
1455    },
1456    error: function (jqXHR, textStatus, errorThrown) {
1457      // Ошибка
1458      console.log('Error: ' + errorThrown);
1459    },
1460  });
1461}
1462
1463/* Избранное */
1464
1465function getCookie(name) {
1466  let matches = document.cookie.match(
1467    new RegExp('(?:^|; )' + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)')
1468  );
1469  return matches ? decodeURIComponent(matches[1]) : undefined;
1470}
1471
1472function setCookie(name, value, options = {}) {
1473  options = {
1474    path: '/',
1475    // при необходимости добавьте другие значения по умолчанию
1476    ...options,
1477  };
1478
1479  if (options.expires instanceof Date) {
1480    options.expires = options.expires.toUTCString();
1481  }
1482
1483  let updatedCookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
1484
1485  for (let optionKey in options) {
1486    updatedCookie += '; ' + optionKey;
1487    let optionValue = options[optionKey];
1488    if (optionValue !== true) {
1489      updatedCookie += '=' + optionValue;
1490    }
1491  }
1492
1493  document.cookie = updatedCookie;
1494}
1495
1496/* End */
1497;
1498; /* Start:"a:4:{s:4:"full";
1498s:97:"/local/templates/gardenshop/components/nastart/regions.choose/gardenshop/script.js?17146848909289";s:6:"source";s:82:"/local/templates/gardenshop/components/nastart/regions.choose/gardenshop/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1499class RegionsChoose {
1500
1501    constructor() {
1502
1503        this.getRegion();
1504
1505        this.rootId = 'regions_choose_component';
1506        this.rootDropDownId = 'regions_choose_component_dropdown';
1507        this.selectRegionID = 'regon_choose_select-city__modal';
1508        this.selectRegionOverlayID = 'regon_choose_modal__overlay';
1509
1510        this.questionRegionId = null;
1511        this.loctionList = null;
1512
1513        this.root = document.getElementById(this.rootId);
1514        this.rootDropDown = document.getElementById(this.rootDropDownId);
1515        this.selectRegion = document.getElementById(this.selectRegionID);
1516        this.selectRegionOverlay = document.getElementById(this.selectRegionOverlayID);
1517
1518        this.setEvents();
1519    }
1520
1521    getEntity(parent, entity, all=false) {
1522        if (!parent || !entity) {
1523            return null;
1524        }
1525        if (all) {
1526            return parent.querySelectorAll('[data-entity="' + entity + '"]');
1527        }
1528        return parent.querySelector('[data-entity="' + entity + '"]');
1529    }
1530
1531    setEvents() {
1532        const yesBtn = this.getEntity(this.rootDropDown, 'select-city__dropdown__choose__yes');
1533        const notBnt = this.getEntity(this.rootDropDown, 'select-city__dropdown__choose__no');
1534        const cityButton = this.getEntity(this.root, 'select-city__block');
1535        const cityName = this.getEntity(this.root, 'select-city__block__text-city');
1536        const selectRegionClose = this.getEntity(this.selectRegion, 'select-city__close');
1537        const searchLine = this.getEntity(this.selectRegion, 'select-city__modal__submit__input');
1538        const selectRegionBtn = this.getEntity(this.selectRegion, 'select-city__modal__submit__btn');
1539
1540        yesBtn.addEventListener('click', () => this.onSetRegion(this.questionRegionId));
1541        notBnt.addEventListener('click', () => {
1542            this.onShowALLRegions();
1543            this.dropDownShow(false);
1544        });
1545        cityButton.addEventListener('click', () => this.onShowALLRegions());
1546        selectRegionClose.addEventListener('click', () => this.onSelectRegionShow(false));
1547        searchLine.addEventListener('input', e => this.onInputSearch(e))
1548
1549        selectRegionBtn.addEventListener('click', () => {
1550            const selectedRegion = Object.keys(this.loctionList)
1551                .filter(i => searchLine.value === this.loctionList[i]);
1552
1553            if (selectedRegion.length === 0) {
1554                this.getEntity(this.selectRegion, select-city__modal__submit__block-wrap__input_wrap_error)
1555                    .setAttribute('style', '');
1556                return;
1557            }
1558
1559            this.onSetRegion(selectedRegion[0]);
1560            this.onShowALLRegions(false);
1561        })
1562
1563    }
1564
1565    onSetRegion(regionId) {
1566        BX.ajax.runAction('nastart:regions.ChooseComponentController.setRegion', {
1567            data: {regionId: regionId},
1568        }).then(
1569            (res) => res.data.actions.forEach(i => this[i](res.data)),
1570            (err) => console.log(err),
1571        )
1572    }
1573
1574    dropDownShow(action) {
1575        if (action) {
1576            this.rootDropDown.setAttribute('style', 'display: block;');
1577        } else {
1578            this.rootDropDown.setAttribute('style', 'display: none;');
1579        }
1580    }
1581
1582    onShowALLRegions() {
1583
1584        if (this.loctionList !== null) {
1585            return this.SHOW_SELECT_REGIONS(this.loctionList);
1586        }
1587
1588        BX.ajax.runAction('nastart:regions.ChooseComponentController.showLocations', {})
1589            .then(
1590                (res) => {
1591                    res.data.actions.forEach(i => this[i](res.data))
1592                },
1593                (err) => console.log(err),
1594            )
1595    }
1596
1597    getRegion() {
1598
1599        const query = new URLSearchParams(window.location.search);
1600        this.removeRegionGetParams(query);
1601
1602         BX.ajax.runAction('nastart:regions.ChooseComponentController.getRegion', {
1603            data: {redirectRegionId: query.get('redirectRegionId')},
1604        })
1605        .then(
1606            (res) => {
1607                res.data.actions.forEach(i => this[i](res.data))
1608            },
1609            (err) => console.log(err),
1610        )
1611
1612    }
1613
1614    onSelectRegionShow(action) {
1615        if (action) {
1616            this.selectRegion.setAttribute('style', 'display: block;');
1617            this.selectRegionOverlay.setAttribute('style', 'display: block;');
1618        } else {
1619            this.selectRegionOverlay.setAttribute('style', 'display: none;');
1620            this.selectRegion.setAttribute('style', 'display: none;');
1621        }
1622
1623        this.getEntity(this.selectRegion, 'select-city__modal__submit__block-wrap__input_wrap_error')
1624            .setAttribute('style', 'display: none;');
1625    }
1626
1627    SHOW_REGION_NAME ({currentRegionName}) {
1628        const elment = this.getEntity(this.root, 'select-city__block__text-city');
1629        elment.innerText = currentRegionName;
1630        this.getEntity(this.selectRegion, 'select-city__js').innerText = currentRegionName;
1631    }
1632
1633    SHOW_QUESTION ({currentRegionName, currentRegionId}) {
1634        this.questionRegionId = currentRegionId;
1635        this.dropDownShow(true);
1636        const element = this.getEntity(this.rootDropDown, 'select-city__dropdown__title');
1637        element.innerText = element.textContent.replace('###', currentRegionName).trim();
1638    }
1639
1640    CONFIRM_DOMAIN ({currentRegionName}) {
1641        this.dropDownShow(false);
1642        const elemnt = this.getEntity(this.root, 'select-city__block__text-city');
1643        elemnt.innerText = currentRegionName;
1644        this.getEntity(this.selectRegion, 'select-city__js').innerText = currentRegionName;
1645    }
1646
1647    SHOW_SELECT_REGIONS ({allRegions, allRegionsSort}) {
1648        this.onSelectRegionShow(true);
1649
1650        if (this.loctionList !== null) {
1651            return;
1652        }
1653        var allReginonsSorted = new Map();;
1654        allRegionsSort.forEach(function (currentValue,index){
1655            allReginonsSorted.set(currentValue, allRegions[currentValue]);
1656        });
1657
1658        const localRootElement = this.getEntity(this.selectRegion, 'select-city__modal__list');
1659
1660        this.loctionList = allRegions;
1661
1662        let counter = 0;
1663
1664        for (let i of allReginonsSorted.keys()) {
1665            const element = document.createElement('p');
1666            element.setAttribute('data-entity', 'select-city__modal__list__item');
1667            element.setAttribute('class', 'select-city__modal__list__item');
1668            element.innerText = allReginonsSorted.get(i);
1669            element.addEventListener('click', () => {
1670                this.onSetRegion(i);
1671                this.onSelectRegionShow(false);
1672            });
1673            localRootElement.append(element);
1674            counter++;
1675            if (counter > 14) {
1676                return;
1677            }
1678        }
1679    }
1680
1681    REDIRECT_TO_SUBDOMAIN ({currentRegionCode, currentRegionId}) {
1682        const hostName = window.location.hostname;
1683        const protocol = window.location.protocol;
1684        const newUrl = window.location.href.replace(hostName, currentRegionCode);
1685        const url = new URL(newUrl, `${protocol}${currentRegionCode}`);
1686        url.searchParams.set('redirectRegionId', currentRegionId);
1687        window.location.href = url.toString();
1688    }
1689
1690    CONFIRM_CITY ({}) {
1691    }
1692
1693    onInputSearch(e) {
1694
1695        const elementClass = 'regions_vars';
1696        this.getEntity(this.selectRegion, elementClass, true).forEach(i => i.remove());
1697        const text = e.currentTarget.value;
1698        const localRootElement = this.getEntity(this.selectRegion, 'select-city__modal__submit__vars');
1699        this.getEntity(this.selectRegion, 'select-city__modal__submit__block-wrap__input_wrap_error')
1700            .setAttribute('style', 'display: none;');
1701
1702        if (text.length  < 2) {
1703            localRootElement.setAttribute('style', 'display: none;');
1704            return;
1705        }
1706
1707        const currentTarget = e.currentTarget;
1708
1709        const match = Object.keys(this.loctionList).filter(i => {
1710            return  new RegExp(text, 'i').test(this.loctionList[i])
1711        });
1712
1713        if (match.length > 0) {
1714            localRootElement.setAttribute('style', 'display: block;');
1715        } else {
1716            localRootElement.setAttribute('style', 'display: none;');
1717        }
1718
1719        match.forEach(i => {
1720            const element = document.createElement('div');
1721            element.setAttribute('data-entity', elementClass);
1722            element.setAttribute('class', elementClass);
1723            element.setAttribute('tabindex', 0);
1724            let searchingWord=new RegExp(text,'i').exec(this.loctionList[i]);
1725            element.innerHTML = this.loctionList[i].replace(searchingWord,'<span>'+searchingWord+'</span>');
1726            element.addEventListener('click', () => {
1727                currentTarget.value = this.loctionList[i];
1728                this.getEntity(this.selectRegion, elementClass, true).forEach(i => i.remove());
1729                localRootElement.setAttribute('style', 'display: none;');
1730            });
1731            localRootElement.append(element);
1732        })
1733    }
1734
1735    removeRegionGetParams(query) {
1736        if (query.has('redirectRegionId')) {
1737            const url = new URL(window.location.href, window.location.href);
1738            url.searchParams.delete('redirectRegionId');
1739            window.history.replaceState(null, '', url)
1740        }
1741    }
1742}
1743
1744/* End */
1745;
1746; /* Start:"a:4:{s:4:"full";s:67:"/bitrix/components/bitrix/search.title/script.min.js?17863623516573";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:52:"/bitrix/components/bitrix/search.title/script.min.js";s:3:"map";s:52:"/bitrix/components/bitrix/search.title/script.map.js";}"*/
1747function JCTitleSearch(t){var e=this;this.arParams={AJAX_PAGE:BX.util.htmlspecialcharsback(t.AJAX_PAGE),CONTAINER_ID:t.CONTAINER_ID,INPUT_ID:t.INPUT_ID,MIN_QUERY_LEN:parseInt(t.MIN_QUERY_LEN,10)};if(t.WAIT_IMAGE){this.arParams.WAIT_IMAGE=t.WAIT_IMAGE}if(this.arParams.MIN_QUERY_LEN<=0){this.arParams.MIN_QUERY_LEN=1}this.cache=[];this.cache_key=null;this.startText="";this.running=false;this.runningCall=false;this.currentRow=-1;this.RESULT=null;this.CONTAINER=null;this.INPUT=null;this.WAIT=null;this.ShowResult=function(t){if(BX.type.isString(t)){e.RESULT.innerHTML=t}e.RESULT.style.display=e.RESULT.innerHTML===""?"none":"block";var s=e.adjustResultNode();var i=null;var n=null;var l=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(l){n=BX.findChild(l,{tag:"th"},true)}if(n){var r=BX.pos(l);r.width=r.right-r.left;var a=BX.pos(n);a.width=a.right-a.left;n.style.width=a.width+"px";e.RESULT.style.width=s.width+a.width+"px";e.RESULT.style.left=s.left-a.width-1+"px";if(r.width-a.width>s.width){e.RESULT.style.width=s.width+a.width-1+"px"}r=BX.pos(l);i=BX.pos(e.RESULT);if(i.right>r.right){e.RESULT.style.width=r.right-r.left+"px"}}var o=false;if(l){o=BX.findChild(e.RESULT,{class:"title-search-fader"},true)}if(o&&n){i=BX.pos(e.RESULT);o.style.left=i.right-i.left-18+"px";o.style.width=18+"px";o.style.top=0+"px";o.style.height=i.bottom-i.top+"px";o.style.display="block"}};this.onKeyPress=function(t){var s=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(!s){return false}var i=0;var n=s.rows.length;switch(t){case 27:e.RESULT.style.display="none";e.currentRow=-1;e.UnSelectAll();return true;case 40:if(e.RESULT.style.display=="none"){e.RESULT.style.display="block"}var l=-1;for(i=0;i<n;i++){if(!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){if(l==-1){l=i}if(e.currentRow<i){e.currentRow=i;break}else if(s.rows[i].className=="title-search-selected"){s.rows[i].className=""}}}if(i==n&&e.currentRow!=i){e.currentRow=l}s.rows[e.currentRow].className="title-search-selected";return true;case 38:if(e.RESULT.style.display=="none"){e.RESULT.style.display="block"}var r=-1;for(i=n-1;i>=0;i--){if(!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){if(r==-1){r=i}if(e.currentRow>i){e.currentRow=i;break}else if(s.rows[i].className=="title-search-selected"){s.rows[i].className=""}}}if(i<0&&e.currentRow!=i){e.currentRow=r}s.rows[e.currentRow].className="title-search-selected";return true;case 13:if(e.RESULT.style.display=="block"){for(i=0;i<n;i++){if(e.currentRow==i&&!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){var a=BX.findChild(s.rows[i],{tag:"a"},true);if(a){window.location=a.href;return true}}}}return false;default:break}return false};this.onTimeout=function(){e.onChange((function(){setTimeout(e.onTimeout,500)}))};this.onChange=function(t){if(e.running){e.runningCall=true;return}e.running=true;if(e.INPUT.value!=e.oldValue&&e.INPUT.value!=e.startText){e.oldValue=e.INPUT.value;if(e.INPUT.value.length>
1747=e.arParams.MIN_QUERY_LEN){e.cache_key=e.arParams.INPUT_ID+"|"+e.INPUT.value;if(e.cache[e.cache_key]==null){if(e.WAIT){var s=BX.pos(e.INPUT);var i=s.bottom-s.top-2;e.WAIT.style.top=s.top+1+"px";e.WAIT.style.height=i+"px";e.WAIT.style.width=i+"px";e.WAIT.style.left=s.right-i+2+"px";e.WAIT.style.display="block"}BX.ajax.post(e.arParams.AJAX_PAGE,{ajax_call:"y",INPUT_ID:e.arParams.INPUT_ID,q:e.INPUT.value,l:e.arParams.MIN_QUERY_LEN},(function(s){e.cache[e.cache_key]=s;e.ShowResult(s);e.currentRow=-1;e.EnableMouseEvents();if(e.WAIT){e.WAIT.style.display="none"}if(!!t){t()}e.running=false;if(e.runningCall){e.runningCall=false;e.onChange()}}));return}e.ShowResult(e.cache[e.cache_key]);e.currentRow=-1;e.EnableMouseEvents()}else{e.RESULT.style.display="none";e.currentRow=-1;e.UnSelectAll()}}if(!!t){t()}e.running=false};this.onScroll=function(){if(BX.type.isElementNode(e.RESULT)&&e.RESULT.style.display!=="none"&&e.RESULT.innerHTML!==""){e.adjustResultNode()}};this.UnSelectAll=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(t){var s=t.rows.length;for(var i=0;i<s;i++){t.rows[i].className=""}}};this.EnableMouseEvents=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(t){var s=t.rows.length;for(var i=0;i<s;i++){if(!BX.findChild(t.rows[i],{class:"title-search-separator"},true)){t.rows[i].id="row_"+i;t.rows[i].onmouseover=function(t){if(e.currentRow!=this.id.substr(4)){e.UnSelectAll();this.className="title-search-selected";e.currentRow=this.id.substr(4)}};t.rows[i].onmouseout=function(t){this.className="";e.currentRow=-1}}}}};this.onFocusLost=function(t){setTimeout((function(){e.RESULT.style.display="none"}),250)};this.onFocusGain=function(){if(e.RESULT.innerHTML.length>0){e.ShowResult()}};this.onKeyDown=function(t){if(!t){t=window.event}if(e.RESULT.style.display=="block"&&e.onKeyPress(t.keyCode)){return BX.PreventDefault(t)}};this.adjustResultNode=function(){if(!(BX.type.isElementNode(e.RESULT)&&BX.type.isElementNode(e.CONTAINER))){return{top:0,right:0,bottom:0,left:0,width:0,height:0}}var t=BX.pos(e.CONTAINER);e.RESULT.style.position="absolute";e.RESULT.style.top=t.bottom+2+"px";e.RESULT.style.left=t.left+"px";e.RESULT.style.width=t.width+"px";return t};this.onContainerLayoutChange=function(){if(BX.type.isElementNode(e.RESULT)&&e.RESULT.style.display!=="none"&&e.RESULT.innerHTML!==""){e.adjustResultNode()}};this.Init=function(){this.CONTAINER=document.getElementById(this.arParams.CONTAINER_ID);BX.addCustomEvent(this.CONTAINER,"OnNodeLayoutChange",this.onContainerLayoutChange);this.RESULT=document.body.appendChild(document.createElement("DIV"));this.RESULT.className="title-search-result";this.INPUT=document.getElementById(this.arParams.INPUT_ID);this.startText=this.INPUT.value;this.oldValue=this.INPUT.value;BX.bind(this.INPUT,"focus",(function(){e.onFocusGain()}));BX.bind(this.INPUT,"blur",(function(){e.onFocusLost()}));this.INPUT.onkeydown=this.onKeyDown;if(this.arParams.WAIT_IMAGE){this.WAIT=document.body.appendChild(document.createElement("DIV"));this.WAIT.style.backgroundImage="url('"+this.arParams.WAIT_IMAGE+"')";if(!BX.browser.IsIE()){this.WAIT.style.backgroundRepeat="none"}this.WAIT.style.display="none";this.WAIT.style.position="absolute";this.WAIT.style.zIndex="1100"}BX.bind(this.INPUT,"bxchange",(function(){e.onChange()}));var t=BX.findParent(this.CONTAINER,BX.is_fixed);if(BX.type.isElementNode(t)){BX.bind(window,"scroll",BX.throttle(this.onScroll,100,this))}};BX.ready((function(){e.Init(t)}))}
1748/* End */
1749;
1750; /* Start:"a:4:{s:4:"full";s:102:"/local/templates/gardenshop/components/bitrix/catalog.compare.list/gardenshop/script.js?17146848903197";s:6:"source";s:87:"/local/templates/gardenshop/components/bitrix/catalog.compare.list/gardenshop/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1751(function (window) {
1752
1753if (!!window.JCCatalogCompareList)
1754{
1755	return;
1756}
1757
1758window.JCCatalogCompareList = function (params)
1759{
1760	this.obCompare = null;
1761	this.obAdminPanel = null;
1762	this.visual = params.VISUAL;
1763	this.ajax = params.AJAX;
1764
1765	BX.ready(BX.proxy(this.init, this));
1766};
1767
1768window.JCCatalogCompareList.prototype.init = function()
1769{
1770	this.obCompare = BX(this.visual.ID);
1771	if (BX.type.isElementNode(this.obCompare))
1772	{
1773		BX.addCustomEvent(window, "OnCompareChange", BX.proxy(this.reload, this));
1774		BX.bindDelegate(this.obCompare, 'click', {tagName : 'a'}, BX.proxy(this.deleteCompare, this));
1775	}
1776};
1777
1778window.JCCatalogCompareList.prototype.reload = function()
1779{
1780	// BX.showWait(this.obCompare);
1781	BX.ajax.post(
1782		this.ajax.url,
1783		this.ajax.reload,
1784		BX.proxy(this.reloadResult, this)
1785	);
1786};
1787
1788window.JCCatalogCompareList.prototype.reloadResult = function(result)
1789{
1790	// var mode = 'none';
1791	// BX.closeWait();
1792	this.obCompare.innerHTML = result;
1793	// if (BX.type.isNotEmptyString(result))
1794	// {
1795	// 	if (result.indexOf('<table') >= 0)
1796	// 		mode = 'block';
1797	// }
1798	// BX.style(this.obCompare, 'display', mode);
1799};
1800
1801window.JCCatalogCompareList.prototype.deleteCompare = function()
1802{
1803	var target = BX.proxy_context,
1804		itemID,
1805		url;
1806
1807	if (!!target && target.hasAttribute('data-id'))
1808	{
1809		itemID = parseInt(target.getAttribute('data-id'), 10);
1810		if (!isNaN(itemID))
1811		{
1812			// BX.showWait(this.obCompare);
1813			url = this.ajax.url + this.ajax.templates.delete + itemID.toString();
1814			BX.ajax.loadJSON(
1815				url,
1816				this.ajax.params,
1817				BX.proxy(this.deleteCompareResult, this)
1818			);
1819		}
1820	}
1821};
1822
1823window.JCCatalogCompareList.prototype.deleteCompareResult = function(result)
1824{
1825	var tbl,
1826		i,
1827		cnt,
1828		newCount;
1829
1830	// BX.closeWait();
1831	if (BX.type.isPlainObject(result))
1832	{
1833		if (BX.type.isNotEmptyString(result.STATUS) && result.STATUS === 'OK' && !!result.ID)
1834		{
1835			BX.onCustomEvent('onCatalogDeleteCompare', [result.ID]);
1836
1837			tbl = this.obCompare.querySelector('table[data-block="item-list"]');
1838			if (BX.type.isElementNode(tbl))
1839			{
1840				if (tbl.rows.length > 1)
1841				{
1842					for (i = 0; i < tbl.rows.length; i++)
1843					{
1844						if (
1845							tbl.rows[i].hasAttribute('data-row-id')
1846							&& tbl.rows[i].getAttribute('data-row-id') === ('row' + result.ID)
1847						)
1848						{
1849							tbl.deleteRow(i);
1850						}
1851					}
1852					if (BX.type.isNotEmptyString(result.COUNT) || BX.type.isNumber(result.COUNT))
1853					{
1854						newCount = parseInt(result.COUNT, 10);
1855						if (!isNaN(newCount))
1856						{
1857							cnt = this.obCompare.querySelector('span[data-block="count"]');
1858							if (BX.type.isElementNode(cnt))
1859							{
1860								cnt.innerHTML = newCount.toString();
1861							}
1862							cnt = null;
1863							// BX.style(this.obCompare, 'display', (newCount > 0 ? 'block' : 'none'));
1864						}
1865					}
1866				}
1867				else
1868				{
1869					this.reload();
1870				}
1871			}
1872			tbl = null;
1873		}
1874	}
1875};
1876
1877window.JCCatalogCompareList.prototype.setVerticalAlign = function()
1878{
1879	var topSize;
1880	if (BX.type.isElementNode(this.obCompare) && BX.type.isElementNode(this.obAdminPanel))
1881	{
1882		topSize = parseInt(this.obAdminPanel.offsetHeight, 10);
1883		if (isNaN(topSize))
1884		{
1885			topSize = 0;
1886		}
1887		topSize +=5;
1888		BX.style(this.obCompare, 'top', topSize.toString()+'px');
1889	}
1890};
1891
1892})(window);
1893/* End */
1894;
1895; /* Start:"a:4:{s:4:"full";s:111:"/local/templates/gardenshop/components/bitrix/sale.basket.basket.line/basket_count/script.min.js?17146848903876";s:6:"source";s:92:"/local/templates/gardenshop/components/bitrix/sale.basket.basket.line/basket_count/script.js";s:3:"min";s:96:"/local/templates/gardenshop/components/bitrix/sale.basket.basket.line/basket_count/script.min.js";s:3:"map";s:96:"/local/templates/gardenshop/components/bitrix/sale.basket.basket.line/basket_count/script.map.js";}"*/
1896"use strict";function BitrixSmallCart(){}BitrixSmallCart.prototype={activate:function(){this.cartElement=BX(this.cartId);this.fixedPosition=this.arParams.POSITION_FIXED=="Y";if(this.fixedPosition){this.cartClosed=true;this.maxHeight=false;this.itemRemoved=false;this.verticalPosition=this.arParams.POSITION_VERTICAL;this.horizontalPosition=this.arParams.POSITION_HORIZONTAL;this.topPanelElement=BX("bx-panel");this.fixAfterRender();this.fixAfterRenderClosure=this.closure("fixAfterRender");var t=this.closure("fixCart");this.fixCartClosure=t;if(this.topPanelElement&&this.verticalPosition=="top")BX.addCustomEvent(window,"onTopPanelCollapse",t);var e=null;BX.bind(window,"resize",function(){clearTimeout(e);e=setTimeout(t,200)})}this.setCartBodyClosure=this.closure("setCartBody");BX.addCustomEvent(window,"OnBasketChange",this.closure("refreshCart",{}))},fixAfterRender:function(){this.statusElement=BX(this.cartId+"status");if(this.statusElement){if(this.cartClosed)this.statusElement.innerHTML=this.openMessage;else this.statusElement.innerHTML=this.closeMessage}this.productsElement=BX(this.cartId+"products");this.fixCart()},closure:function(t,e){var i=this;return e?function(){i[t](e)}:function(e){i[t](e)}},toggleOpenCloseCart:function(){if(this.cartClosed){BX.removeClass(this.cartElement,"bx-closed");BX.addClass(this.cartElement,"bx-opener");this.statusElement.innerHTML=this.closeMessage;this.cartClosed=false;this.fixCart()}else{BX.addClass(this.cartElement,"bx-closed");BX.removeClass(this.cartElement,"bx-opener");BX.removeClass(this.cartElement,"bx-max-height");this.statusElement.innerHTML=this.openMessage;this.cartClosed=true;var t=this.cartElement.querySelector("[data-role='basket-item-list']");if(t)t.style.top="auto"}setTimeout(this.fixCartClosure,100)},setVerticalCenter:function(t){var e=t/2-this.cartElement.offsetHeight/2;if(e<5)e=5;this.cartElement.style.top=e+"px"},fixCart:function(){if(this.horizontalPosition=="hcenter"){var t="innerWidth"in window?window.innerWidth:document.documentElement.offsetWidth;var e=t/2-this.cartElement.offsetWidth/2;if(e<5)e=5;this.cartElement.style.left=e+"px"}var i="innerHeight"in window?window.innerHeight:document.documentElement.offsetHeight;switch(this.verticalPosition){case"top":if(this.topPanelElement)this.cartElement.style.top=this.topPanelElement.offsetHeight+5+"px";break;
1896case"vcenter":this.setVerticalCenter(i);break}if(this.productsElement){var s=this.cartElement.querySelector("[data-role='basket-item-list']");if(this.cartClosed){if(this.maxHeight){BX.removeClass(this.cartElement,"bx-max-height");if(s)s.style.top="auto";this.maxHeight=false}}else{if(this.maxHeight){if(this.productsElement.scrollHeight==this.productsElement.clientHeight){BX.removeClass(this.cartElement,"bx-max-height");if(s)s.style.top="auto";this.maxHeight=false}}else{if(this.verticalPosition=="top"||this.verticalPosition=="vcenter"){if(this.cartElement.offsetTop+this.cartElement.offsetHeight>=i){BX.addClass(this.cartElement,"bx-max-height");if(s)s.style.top=82+"px";this.maxHeight=true}}else{if(this.cartElement.offsetHeight>=i){BX.addClass(this.cartElement,"bx-max-height");if(s)s.style.top=82+"px";this.maxHeight=true}}}}if(this.verticalPosition=="vcenter")this.setVerticalCenter(i)}},refreshCart:function(t){if(this.itemRemoved){this.itemRemoved=false;return}t.sessid=BX.bitrix_sessid();t.siteId=this.siteId;t.templateName=this.templateName;t.arParams=this.arParams;BX.ajax({url:this.ajaxPath,method:"POST",dataType:"html",data:t,onsuccess:this.setCartBodyClosure})},setCartBody:function(t){if(this.cartElement)this.cartElement.innerHTML=t.replace(/#CURRENT_URL#/g,this.currentUrl);if(this.fixedPosition)setTimeout(this.fixAfterRenderClosure,100)},removeItemFromCart:function(t){this.refreshCart({sbblRemoveItemFromCart:t});this.itemRemoved=true;BX.onCustomEvent("OnBasketChange")}};
1897/* End */
1898;
1899; /* Start:"a:4:{s:4:"full";s:98:"/local/templates/gardenshop/components/bitrix/catalog.section/gardenshop/script.js?171468489010902";s:6:"source";s:82:"/local/templates/gardenshop/components/bitrix/catalog.section/gardenshop/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1900(function () {
1901	'use strict';
1902
1903	if (!!window.JCCatalogSectionComponent)
1904		return;
1905
1906	window.JCCatalogSectionComponent = function (params) {
1907		this.formPosting = false;
1908		this.disableSort = false;
1909		this.disableView = false;
1910		this.siteId = params.siteId || '';
1911		this.ajaxId = params.ajaxId || '';
1912		this.template = params.template || '';
1913		this.componentPath = params.componentPath || '';
1914		this.ajaxPath = params.templatePath || params.componentPath;
1915		this.parameters = params.parameters || '';
1916
1917		if (params.navParams) {
1918			this.navParams = {
1919				NavNum: params.navParams.NavNum || 1,
1920				NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1,
1921				NavPageCount: parseInt(params.navParams.NavPageCount) || 1
1922			};
1923		}
1924
1925		this.bigData = params.bigData || { enabled: false };
1926		this.container = document.querySelector('[data-entity="' + params.container + '"]');
1927		this.lazyLoadContainer = document.querySelector('[data-entity="lazy-' + params.container + '"]');
1928		this.showMoreButton = null;
1929		this.showMoreButtonMessage = null;
1930		this.showSortButtons = null;
1931		this.showViewButtons = null;
1932
1933		if (this.bigData.enabled && BX.util.object_keys(this.bigData.rows).length > 0) {
1934			BX.cookie_prefix = this.bigData.js.cookiePrefix || '';
1935			BX.cookie_domain = this.bigData.js.cookieDomain || '';
1936			BX.current_server_time = this.bigData.js.serverTime;
1937
1938			BX.ready(BX.delegate(this.bigDataLoad, this));
1939		}
1940
1941		if (params.initiallyShowHeader) {
1942			BX.ready(BX.delegate(this.showHeader, this));
1943		}
1944
1945		if (params.deferredLoad) {
1946			BX.ready(BX.delegate(this.deferredLoad, this));
1947		}
1948
1949		if (params.lazyLoad) {
1950			this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]');
1951			this.showMoreButtonMessage = this.showMoreButton.innerHTML;
1952			BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this));
1953		}
1954
1955		if (params.loadOnScroll) {
1956			BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this));
1957		}
1958
1959		this.showSortButtons = document.querySelectorAll('[data-sort]');
1960		for (var k in this.showSortButtons) {
1961			if (this.showSortButtons.hasOwnProperty(k)) {
1962				BX.bind(this.showSortButtons[k], 'click', BX.proxy(this.showSort, this));
1963			}
1964		}
1965
1966		this.showViewButtons = document.querySelectorAll('[data-view]');
1967		for (var k in this.showViewButtons) {
1968			if (this.showViewButtons.hasOwnProperty(k)) {
1969				BX.bind(this.showViewButtons[k], 'click', BX.proxy(this.showView, this));
1970			}
1971		}
1972	};
1973
1974	window.JCCatalogSectionComponent.prototype =
1975	{
1976		checkButton: function () {
1977			if (this.showMoreButton) {
1978				if (this.navParams.NavPageNomer == this.navParams.NavPageCount) {
1979					BX.remove(this.showMoreButton);
1980				}
1981				else {
1982					this.lazyLoadContainer.appendChild(this.showMoreButton);
1983				}
1984			}
1985		},
1986
1987		enableButton: function () {
1988			if (this.showMoreButton) {
1989				BX.removeClass(this.showMoreButton, 'disabled');
1990				this.showMoreButton.innerHTML = this.showMoreButtonMessage;
1991			}
1992		},
1993
1994		disableButton: function () {
1995			if (this.showMoreButton) {
1996				BX.addClass(this.showMoreButton, 'disabled');
1997				this.showMoreButton.innerHTML = BX.message('BTN_MESSAGE_LAZY_LOAD_WAITER');
1998			}
1999		},
2000
2001		loadOnScroll: function () {
2002			var scrollTop = BX.GetWindowScrollPos().scrollTop,
2003				containerBottom = BX.pos(this.container).bottom;
2004
2005			if (scrollTop + window.innerHeight > containerBottom) {
2006				this.showMore();
2007			}
2008		},
2009
2010		showMore: function () {
2011			if (this.navParams.NavPageNomer < this.navParams.NavPageCount) {
2012				var data = {};
2013				data['action'] = 'showMore';
2014				data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
2015
2016				if (!this.formPosting) {
2017					this.formPosting = true;
2018					this.disableButton();
2019					this.sendRequest(data);
2020				}
2021			}
2022		},
2023		showSort: function (event) {
2024			if (BX.proxy_context.dataset.sort && this.disableSort == false) {
2025				var currentButton = BX(event.target);
2026				var allsortButtons = currentButton.parentNode.children;
2027				for (var key in allsortButtons) {
2028					if (allsortButtons.hasOwnProperty(key)) {
2029						BX.removeClass(BX(allsortButtons[key]), "catalog__sort-item_active");
2030					}
2031				}
2032				BX.addClass(currentButton, "catalog__sort-item_active");
2033
2034				var data = {};
2035				data['action'] = 'showSort';
2036				data['sort'] = BX.proxy_context.dataset.sort;
2037
2038				if (!this.formPosting) {
2039					this.formPosting = true;
2040					this.disableSort = true;
2041					this.sendRequest(data);
2042				}
2043			}
2044		},
2045		showView: function (event) {
2046			if (BX.proxy_context.dataset.view && this.disableView == false) {
2047				var data = {};
2048				data['action'] = 'showView';
2049				data['viewparams'] = BX.proxy_context.dataset.view;
2050
2051				if (!this.formPosting) {
2052					this.formPosting = true;
2053					this.disableView = true;
2054					this.sendRequest(data);
2055				}
2056			}
2057		},
2058
2059		bigDataLoad: function () {
2060			var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
2061				data = BX.ajax.prepareData(this.bigData.params);
2062
2063			if (data) {
2064				url += (url.indexOf('?') !== -1 ? '&' : '?') + data;
2065			}
2066
2067			var onReady = BX.delegate(function (result) {
2068				this.sendRequest({
2069					action: 'deferredLoad',
2070					bigData: 'Y',
2071					items: result && result.items || [],
2072					rid: result && result.id,
2073					count: this.bigData.count,
2074					rowsRange: this.bigData.rowsRange,
2075					shownIds: this.bigData.shownIds
2076				});
2077			}, this);
2078
2079			BX.ajax({
2080				method: 'GET',
2081				dataType: 'json',
2082				url: url,
2083				timeout: 3,
2084				onsuccess: onReady,
2085				onfailure: onReady
2086			});
2087		},
2088
2089		deferredLoad: function () {
2090			this.sendRequest({ action: 'deferredLoad' });
2091		},
2092
2093		sendRequest: function (data) {
2094			var defaultData = {
2095				siteId: this.siteId,
2096				template: this.template,
2097				parameters: this.parameters
2098			};
2099
2100			if (this.ajaxId) {
2101				defaultData.AJAX_ID = this.ajaxId;
2102			}
2103			BX.ajax({
2104				url: this.ajaxPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
2105				method: 'POST',
2106				dataType: 'json',
2107				timeout: 60,
2108				data: BX.merge(defaultData, data),
2109				onsuccess: BX.delegate(function (result) {
2110					if (!result || !result.JS)
2111						return;
2112
2113					BX.ajax.processScripts(
2114						BX.processHTML(result.JS).SCRIPT,
2115						false,
2116						BX.delegate(function () { this.showAction(result, data); }, this)
2117					);
2118				}, this)
2119			});
2120		},
2121
2122		showAction: function (result, data) {
2123			if (!data)
2124				return;
2125
2126			switch (data.action) {
2127				case 'showMore':
2128					this.processShowMoreAction(result);
2129					break;
2130				case 'showSort':
2131					this.processShowSortAction(result);
2132					break;
2133				case 'showView':
2134					this.processShowViewAction(result);
2135					break;
2136				case 'deferredLoad':
2137					this.processDeferredLoadAction(result, data.bigData === 'Y');
2138					break;
2139			}
2140		},
2141
2142		processShowMoreAction: function (result) {
2143			this.formPosting = false;
2144			this.enableButton();
2145
2146			if (result) {
2147				this.navParams.NavPageNomer++;
2148				this.processItems(result.items);
2149				this.processPagination(result.pagination);
2150				this.processEpilogue(result.epilogue);
2151				this.checkButton();
2152			}
2153		},
2154		processShowSortAction: function (result) {
2155			this.formPosting = false;
2156			this.disableSort = false;
2157
2158			if (result) {
2159				this.processItems(result.items, 0, true);
2160				this.processPagination(result.pagination);
2161				this.processEpilogue(result.epilogue);
2162			}
2163		},
2164		processShowViewAction: function (result) {
2165			this.formPosting = false;
2166			this.disableView = false;
2167
2168			if (result) {
2169				this.processItems(result.items, 0, true);
2170				this.processPagination(result.pagination);
2171				this.processEpilogue(result.epilogue);
2172			}
2173		},
2174
2175		processDeferredLoadAction: function (result, bigData) {
2176			if (!result)
2177				return;
2178
2179			var position = bigData ? this.bigData.rows : {};
2180
2181			this.processItems(result.items, BX.util.array_keys(position));
2182		},
2183
2184		processItems: function (itemsHtml, position, redraw = false) {
2185			if (!itemsHtml)
2186				return;
2187
2188			var processed = BX.processHTML(itemsHtml, false),
2189				temporaryNode = BX.create('DIV');
2190
2191			var items, k, origRows;
2192
2193			temporaryNode.innerHTML = processed.HTML;
2194			items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
2195
2196			if (items.length) {
2197				this.showHeader(true);
2198
2199				for (k in items) {
2200					if (items.hasOwnProperty(k)) {
2201						origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
2202						items[k].style.opacity = 0;
2203
2204						if (origRows && BX.type.isDomNode(origRows[position[k]])) {
2205							origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
2206						}
2207						else {
2208							if (redraw) {
2209								this.container.innerHTML = "";
2210								this.container.appendChild(items[k]);
2211							}
2212							else {
2213								this.container.appendChild(items[k]);
2214							}
2215						}
2216					}
2217				}
2218
2219				new BX.easing({
2220					duration: 2000,
2221					start: { opacity: 0 },
2222					finish: { opacity: 100 },
2223					transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
2224					step: function (state) {
2225						for (var k in items) {
2226							if (items.hasOwnProperty(k)) {
2227								items[k].style.opacity = state.opacity / 100;
2228							}
2229						}
2230					},
2231					complete: function () {
2232						for (var k in items) {
2233							if (items.hasOwnProperty(k)) {
2234								items[k].removeAttribute('style');
2235							}
2236						}
2237					}
2238				}).animate();
2239			}
2240
2241			BX.ajax.processScripts(processed.SCRIPT);
2242		},
2243
2244		processPagination: function (paginationHtml) {
2245			if (!paginationHtml)
2246				return;
2247
2248			var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
2249			for (var k in pagination) {
2250				if (pagination.hasOwnProperty(k)) {
2251					pagination[k].innerHTML = paginationHtml;
2252				}
2253			}
2254		},
2255
2256		processEpilogue: function (epilogueHtml) {
2257			if (!epilogueHtml)
2258				return;
2259
2260			var processed = BX.processHTML(epilogueHtml, false);
2261			BX.ajax.processScripts(processed.SCRIPT);
2262		},
2263
2264		showHeader: function (animate) {
2265			var parentNode = BX.findParent(this.container, { attr: { 'data-entity': 'parent-container' } }),
2266				header;
2267
2268			if (parentNode && BX.type.isDomNode(parentNode)) {
2269				header = parentNode.querySelector('[data-entity="header"]');
2270
2271				if (header && header.getAttribute('data-showed') != 'true') {
2272					header.style.display = '';
2273
2274					if (animate) {
2275						new BX.easing({
2276							duration: 2000,
2277							start: { opacity: 0 },
2278							finish: { opacity: 100 },
2279							transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
2280							step: function (state) {
2281								header.style.opacity = state.opacity / 100;
2282							},
2283							complete: function () {
2284								header.removeAttribute('style');
2285								header.setAttribute('data-showed', 'true');
2286							}
2287						}).animate();
2288					}
2289					else {
2290						header.style.opacity = 100;
2291					}
2292				}
2293			}
2294		}
2295	};
2296})();
2297
2298
2299$(function () {
2300	$('.catalog__sort').on('click', function (e) {
2301		if ($(this).find('.catalog__sort-list').css('position') != 'absolute') return;
2302		$(this).toggleClass('catalog__sort_open');
2303	});
2304});
2305/* End */
2306;
2307; /* Start:"a:4:{s:4:"full";s:95:"/local/templates/gardenshop/components/bitrix/catalog.item/gardenshop/script.js?171468489053481";s:6:"source";s:79:"/local/templates/gardenshop/components/bitrix/catalog.item/gardenshop/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2308(function (window){
2309	'use strict';
2310	if (window.JCCatalogItem) {
2311		return;
2312	}
2313
2314	var BasketButton = function(params)
2315	{
2316		BasketButton.superclass.constructor.apply(this, arguments);
2317		this.buttonNode = BX.create('button', {
2318			props: {className: 'btn btn-primary btn-buy btn-sm', id: this.id},
2319			style: typeof params.style === 'object' ? params.style : {},
2320			text: params.text,
2321			events: this.contextEvents
2322		});
2323
2324		if (BX.browser.IsIE())
2325		{
2326			this.buttonNode.setAttribute("hideFocus", "hidefocus");
2327		}
2328	};
2329	BX.extend(BasketButton, BX.PopupWindowButton);
2330
2331	window.JCCatalogItem = function (arParams)
2332	{
2333		this.productType = 0;
2334		this.showQuantity = true;
2335		this.showAbsent = true;
2336		this.secondPict = false;
2337		this.showOldPrice = false;
2338		this.showMaxQuantity = 'N';
2339		this.relativeQuantityFactor = 5;
2340		this.showPercent = false;
2341		this.showSkuProps = false;
2342		this.basketAction = 'ADD';
2343		this.showClosePopup = false;
2344		this.useCompare = false;
2345		this.showSubscription = false;
2346		this.visual = {
2347			ID: '',
2348			PICT_ID: '',
2349			PICT_SLIDER_ID: '',
2350			QUANTITY_ID: '',
2351			QUANTITY_UP_ID: '',
2352			QUANTITY_DOWN_ID: '',
2353			PRICE_ID: '',
2354			PRICE_OLD_ID: '',
2355			DSC_PERC: '',
2356			SECOND_DSC_PERC: '',
2357			DISPLAY_PROP_DIV: '',
2358			BASKET_PROP_DIV: '',
2359			SUBSCRIBE_ID: ''
2360		};
2361		this.product = {
2362			checkQuantity: false,
2363			maxQuantity: 0,
2364			stepQuantity: 1,
2365			isDblQuantity: false,
2366			canBuy: true,
2367			name: '',
2368			pict: {},
2369			id: 0,
2370			addUrl: '',
2371			buyUrl: ''
2372		};
2373
2374		this.basketMode = '';
2375		this.basketData = {
2376			useProps: false,
2377			emptyProps: false,
2378			quantity: 'quantity',
2379			props: 'prop',
2380			basketUrl: '',
2381			sku_props: '',
2382			sku_props_var: 'basket_props',
2383			add_url: '',
2384			buy_url: ''
2385		};
2386
2387		this.compareData = {
2388			compareUrl: '',
2389			compareDeleteUrl: '',
2390			comparePath: ''
2391		};
2392
2393		this.defaultPict = {
2394			pict: null,
2395			secondPict: null
2396		};
2397
2398		this.touch = null;
2399
2400		this.quantityDelay = null;
2401		this.quantityTimer = null;
2402
2403		this.checkQuantity = false;
2404		this.maxQuantity = 0;
2405		this.minQuantity = 0;
2406		this.stepQuantity = 1;
2407		this.isDblQuantity = false;
2408		this.canBuy = true;
2409		this.precision = 6;
2410		this.precisionFactor = Math.pow(10, this.precision);
2411		this.bigData = false;
2412		this.fullDisplayMode = false;
2413		this.viewMode = '';
2414		this.templateTheme = '';
2415
2416		this.currentPriceMode = '';
2417		this.currentPrices = [];
2418		this.currentPriceSelected = 0;
2419		this.currentQuantityRanges = [];
2420		this.currentQuantityRangeSelected = 0;
2421
2422		this.offers = [];
2423		this.offerNum = 0;
2424		this.treeProps = [];
2425		this.selectedValues = {};
2426
2427		this.obProduct = null;
2428		this.blockNodes = {};
2429		this.obQuantity = null;
2430		this.obQuantityUp = null;
2431		this.obQuantityDown = null;
2432		this.obQuantityLimit = {};
2433		this.obPict = null;
2434		this.obSecondPict = null;
2435		this.obPictSlider = null;
2436		this.initedSLider = null;
2437		this.obPictWrapper = null;
2438		this.obPrice = null;
2439		this.obTree = null;
2440		this.obBuyBtn = null;
2441		this.obBasketActions = null;
2442		this.obNotAvail = null;
2443		this.obSubscribe = null;
2444		this.obDscPerc = null;
2445		this.obSecondDscPerc = null;
2446		this.obSkuProps = null;
2447		this.obMeasure = null;
2448		this.obCompare = null;
2449
2450		this.obPopupWin = null;
2451		this.basketUrl = '';
2452		this.basketParams = {};
2453		this.isTouchDevice = BX.hasClass(document.documentElement, 'bx-touch');
2454		this.hoverTimer = null;
2455		this.hoverStateChangeForbidden = false;
2456		this.mouseX = null;
2457		this.mouseY = null;
2458
2459		this.useEnhancedEcommerce = false;
2460		this.dataLayerName = 'dataLayer';
2461		this.brandProperty = false;
2462
2463		this.errorCode = 0;
2464
2465		if (typeof arParams === 'object')
2466		{
2467			if (arParams.PRODUCT_TYPE)
2468			{
2469				this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
2470			}
2471
2472			this.showQuantity = arParams.SHOW_QUANTITY;
2473			this.showAbsent = arParams.SHOW_ABSENT;
2474			this.secondPict = arParams.SECOND_PICT;
2475			this.showOldPrice = arParams.SHOW_OLD_PRICE;
2476			this.showMaxQuantity = arParams.SHOW_MAX_QUANTITY;
2477			this.relativeQuantityFactor = parseInt(arParams.RELATIVE_QUANTITY_FACTOR);
2478			this.showPercent = arParams.SHOW_DISCOUNT_PERCENT;
2479			this.showSkuProps = arParams.SHOW_SKU_PROPS;
2480			this.showSubscription = arParams.USE_SUBSCRIBE;
2481
2482			if (arParams.ADD_TO_BASKET_ACTION)
2483			{
2484				this.basketAction = arParams.ADD_TO_BASKET_ACTION;
2485			}
2486
2487			this.showClosePopup = arParams.SHOW_CLOSE_POPUP;
2488			this.useCompare = arParams.DISPLAY_COMPARE;
2489			this.fullDisplayMode = arParams.PRODUCT_DISPLAY_MODE === 'Y';
2490			this.bigData = arParams.BIG_DATA;
2491			this.viewMode = arParams.VIEW_MODE || '';
2492			this.templateTheme = arParams.TEMPLATE_THEME || '';
2493			this.useEnhancedEcommerce = arParams.USE_ENHANCED_ECOMMERCE === 'Y';
2494			this.dataLayerName = arParams.DATA_LAYER_NAME;
2495			this.brandProperty = arParams.BRAND_PROPERTY;
2496
2497			this.visual = arParams.VISUAL;
2498
2499			switch (this.productType)
2500			{
2501				case 0: // no catalog
2502				case 1: // product
2503				case 2: // set
2504				case 7: // service
2505					if (arParams.PRODUCT && typeof arParams.PRODUCT === 'object')
2506					{
2507						this.currentPriceMode = arParams.PRODUCT.ITEM_PRICE_MODE;
2508						this.currentPrices = arParams.PRODUCT.ITEM_PRICES;
2509						this.currentPriceSelected = arParams.PRODUCT.ITEM_PRICE_SELECTED;
2510						this.currentQuantityRanges = arParams.PRODUCT.ITEM_QUANTITY_RANGES;
2511						this.currentQuantityRangeSelected = arParams.PRODUCT.ITEM_QUANTITY_RANGE_SELECTED;
2512
2513						if (this.showQuantity)
2514						{
2515							this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
2516							this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
2517
2518							if (this.product.checkQuantity)
2519							{
2520								this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
2521							}
2522
2523							this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
2524
2525							this.checkQuantity = this.product.checkQuantity;
2526							this.isDblQuantity = this.product.isDblQuantity;
2527							this.stepQuantity = this.product.stepQuantity;
2528							this.maxQuantity = this.product.maxQuantity;
2529							this.minQuantity = this.currentPriceMode === 'Q'
2530								? parseFloat(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY)
2531								: this.stepQuantity;
2532
2533							if (this.isDblQuantity)
2534							{
2535								this.stepQuantity = Math.round(this.stepQuantity * this.precisionFactor) / this.precisionFactor;
2536							}
2537						}
2538
2539						this.product.canBuy = arParams.PRODUCT.CAN_BUY;
2540
2541						if (arParams.PRODUCT.MORE_PHOTO_COUNT)
2542						{
2543							this.product.morePhoto = arParams.PRODUCT.MORE_PHOTO;
2544						}
2545
2546						if (arParams.PRODUCT.RCM_ID)
2547						{
2548							this.product.rcmId = arParams.PRODUCT.RCM_ID;
2549						}
2550
2551						this.canBuy = this.product.canBuy;
2552						this.product.name = arParams.PRODUCT.NAME;
2553						this.product.pict = arParams.PRODUCT.PICT;
2554						this.product.id = arParams.PRODUCT.ID;
2555						this.product.DETAIL_PAGE_URL = arParams.PRODUCT.DETAIL_PAGE_URL;
2556
2557						if (arParams.PRODUCT.ADD_URL)
2558						{
2559							this.product.addUrl = arParams.PRODUCT.ADD_URL;
2560						}
2561
2562						if (arParams.PRODUCT.BUY_URL)
2563						{
2564							this.product.buyUrl = arParams.PRODUCT.BUY_URL;
2565						}
2566
2567						if (arParams.BASKET && typeof arParams.BASKET === 'object')
2568						{
2569							this.basketData.useProps = arParams.BASKET.ADD_PROPS;
2570							this.basketData.emptyProps = arParams.BASKET.EMPTY_PROPS;
2571						}
2572					}
2573					else
2574					{
2575						this.errorCode = -1;
2576					}
2577
2578					break;
2579				case 3: // sku
2580					if (arParams.PRODUCT && typeof arParams.PRODUCT === 'object')
2581					{
2582						this.product.name = arParams.PRODUCT.NAME;
2583						this.product.id = arParams.PRODUCT.ID;
2584						this.product.DETAIL_PAGE_URL = arParams.PRODUCT.DETAIL_PAGE_URL;
2585						this.product.morePhoto = arParams.PRODUCT.MORE_PHOTO;
2586
2587						if (arParams.PRODUCT.RCM_ID)
2588						{
2589							this.product.rcmId = arParams.PRODUCT.RCM_ID;
2590						}
2591					}
2592
2593					if (arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
2594					{
2595						this.offers = arParams.OFFERS;
2596						this.offerNum = 0;
2597
2598						if (arParams.OFFER_SELECTED)
2599						{
2600							this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
2601						}
2602
2603						if (isNaN(this.offerNum))
2604						{
2605							this.offerNum = 0;
2606						}
2607
2608						if (arParams.TREE_PROPS)
2609						{
2610							this.treeProps = arParams.TREE_PROPS;
2611						}
2612
2613						if (arParams.DEFAULT_PICTURE)
2614						{
2615							this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
2616							this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
2617						}
2618					}
2619
2620					break;
2621				default:
2622					this.errorCode = -1;
2623			}
2624			if (arParams.BASKET && typeof arParams.BASKET === 'object')
2625			{
2626				if (arParams.BASKET.QUANTITY)
2627				{
2628					this.basketData.quantity = arParams.BASKET.QUANTITY;
2629				}
2630
2631				if (arParams.BASKET.PROPS)
2632				{
2633					this.basketData.props = arParams.BASKET.PROPS;
2634				}
2635
2636				if (arParams.BASKET.BASKET_URL)
2637				{
2638					this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
2639				}
2640
2641				if (3 === this.productType)
2642				{
2643					if (arParams.BASKET.SKU_PROPS)
2644					{
2645						this.basketData.sku_props = arParams.BASKET.SKU_PROPS;
2646					}
2647				}
2648
2649				if (arParams.BASKET.ADD_URL_TEMPLATE)
2650				{
2651					this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE;
2652				}
2653
2654				if (arParams.BASKET.BUY_URL_TEMPLATE)
2655				{
2656					this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE;
2657				}
2658
2659				if (this.basketData.add_url === '' && this.basketData.buy_url === '')
2660				{
2661					this.errorCode = -1024;
2662				}
2663			}
2664
2665			if (this.useCompare)
2666			{
2667				if (arParams.COMPARE && typeof arParams.COMPARE === 'object')
2668				{
2669					if (arParams.COMPARE.COMPARE_PATH)
2670					{
2671						this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH;
2672					}
2673
2674					if (arParams.COMPARE.COMPARE_URL_TEMPLATE)
2675					{
2676						this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE;
2677					}
2678					else
2679					{
2680						this.useCompare = false;
2681					}
2682
2683					if (arParams.COMPARE.COMPARE_DELETE_URL_TEMPLATE)
2684					{
2685						this.compareData.compareDeleteUrl = arParams.COMPARE.COMPARE_DELETE_URL_TEMPLATE;
2686					}
2687					else
2688					{
2689						this.useCompare = false;
2690					}
2691				}
2692				else
2693				{
2694					this.useCompare = false;
2695				}
2696			}
2697
2698			this.isFacebookConversionCustomizeProductEventEnabled
2699				= arParams.IS_FACEBOOK_CONVERSION_CUSTOMIZE_PRODUCT_EVENT_ENABLED
2700			;
2701		}
2702		if (this.errorCode === 0)
2703		{
2704			BX.ready(BX.delegate(this.init,this));
2705		}
2706	};
2707
2708	window.JCCatalogItem.prototype = {
2709		init: function()
2710		{
2711			var i = 0,
2712				treeItems = null;
2713
2714			this.obProduct = BX(this.visual.ID);
2715			if (!this.obProduct)
2716			{
2717				this.errorCode = -1;
2718			}
2719
2720			this.obPict = BX(this.visual.PICT_ID);
2721
2722
2723			this.obPictSlider = BX(this.visual.PICT_SLIDER_ID);
2724			if(this.obPictSlider){
2725				this.obPictWrapper = this.obPictSlider.parentNode;
2726			}
2727
2728			this.obPrice = BX(this.visual.PRICE_ID);
2729			this.obPriceOld = BX(this.visual.PRICE_OLD_ID);
2730			this.obPriceTotal = BX(this.visual.PRICE_TOTAL_ID);
2731			if (!this.obPrice)
2732			{
2733				this.errorCode = -16;
2734			}
2735
2736			if (this.showQuantity && this.visual.QUANTITY_ID)
2737			{
2738				this.obQuantity = BX(this.visual.QUANTITY_ID);
2739				this.blockNodes.quantity = this.obProduct.querySelector('[data-entity="quantity-block"]');
2740
2741				if (!this.isTouchDevice)
2742				{
2743					BX.bind(this.obQuantity, 'focus', BX.proxy(this.onFocus, this));
2744					BX.bind(this.obQuantity, 'blur', BX.proxy(this.onBlur, this));
2745				}
2746
2747				if (this.visual.QUANTITY_UP_ID)
2748				{
2749					this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
2750				}
2751
2752				if (this.visual.QUANTITY_DOWN_ID)
2753				{
2754					this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
2755				}
2756			}
2757
2758			if (this.visual.QUANTITY_LIMIT && this.showMaxQuantity !== 'N')
2759			{
2760				this.obQuantityLimit.all = BX(this.visual.QUANTITY_LIMIT);
2761				if (this.obQuantityLimit.all)
2762				{
2763					this.obQuantityLimit.value = this.obQuantityLimit.all.querySelector('[data-entity="quantity-limit-value"]');
2764					if (!this.obQuantityLimit.value)
2765					{
2766						this.obQuantityLimit.all = null;
2767					}
2768				}
2769			}
2770
2771			if (this.productType === 3 && this.fullDisplayMode)
2772			{
2773				if (this.visual.TREE_ID)
2774				{
2775					this.obTree = BX(this.visual.TREE_ID);
2776					if (!this.obTree)
2777					{
2778						this.errorCode = -256;
2779					}
2780				}
2781
2782				if (this.visual.QUANTITY_MEASURE)
2783				{
2784					this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
2785				}
2786			}
2787
2788			this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID);
2789			if (this.obBasketActions)
2790			{
2791				if (this.visual.BUY_ID)
2792				{
2793					this.obBuyBtn = BX(this.visual.BUY_ID);
2794				}
2795			}
2796
2797			this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS);
2798
2799			if (this.showSubscription)
2800			{
2801				this.obSubscribe = BX(this.visual.SUBSCRIBE_ID);
2802			}
2803
2804			if (this.showPercent)
2805			{
2806				if (this.visual.DSC_PERC)
2807				{
2808					this.obDscPerc = BX(this.visual.DSC_PERC);
2809				}
2810				if (this.secondPict && this.visual.SECOND_DSC_PERC)
2811				{
2812					this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
2813				}
2814			}
2815
2816			if (this.showSkuProps)
2817			{
2818				if (this.visual.DISPLAY_PROP_DIV)
2819				{
2820					this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
2821				}
2822			}
2823
2824			if (this.errorCode === 0)
2825			{
2826				if (this.viewMode === 'CARD')
2827				{
2828					// product hover events
2829					BX.bind(this.obProduct, 'mouseenter', BX.proxy(this.hoverOn, this));
2830					BX.bind(this.obProduct, 'mouseleave', BX.proxy(this.hoverOff, this));
2831				}
2832
2833				if (this.bigData)
2834				{
2835					var links = BX.findChildren(this.obProduct, {tag:'a'}, true);
2836					if (links)
2837					{
2838						for (i in links)
2839						{
2840							if (links.hasOwnProperty(i))
2841							{
2842								if (links[i].getAttribute('href') == this.product.DETAIL_PAGE_URL)
2843								{
2844									BX.bind(links[i], 'click', BX.proxy(this.rememberProductRecommendation, this));
2845								}
2846							}
2847						}
2848					}
2849				}
2850
2851				if (this.showQuantity)
2852				{
2853					var startEventName = this.isTouchDevice ? 'touchstart' : 'mousedown';
2854					var endEventName = this.isTouchDevice ? 'touchend' : 'mouseup';
2855
2856					if (this.obQuantityUp)
2857					{
2858						BX.bind(this.obQuantityUp, startEventName, BX.proxy(this.startQuantityInterval, this));
2859						BX.bind(this.obQuantityUp, endEventName, BX.proxy(this.clearQuantityInterval, this));
2860						BX.bind(this.obQuantityUp, 'mouseout', BX.proxy(this.clearQuantityInterval, this));
2861						BX.bind(this.obQuantityUp, 'click', BX.delegate(this.quantityUp, this));
2862					}
2863
2864					if (this.obQuantityDown)
2865					{
2866						BX.bind(this.obQuantityDown, startEventName, BX.proxy(this.startQuantityInterval, this));
2867						BX.bind(this.obQuantityDown, endEventName, BX.proxy(this.clearQuantityInterval, this));
2868						BX.bind(this.obQuantityDown, 'mouseout', BX.proxy(this.clearQuantityInterval, this));
2869						BX.bind(this.obQuantityDown, 'click', BX.delegate(this.quantityDown, this));
2870					}
2871
2872					if (this.obQuantity)
2873					{
2874						BX.bind(this.obQuantity, 'change', BX.delegate(this.quantityChange, this));
2875					}
2876				}
2877				
2878				switch (this.productType)
2879				{
2880					case 0: // no catalog
2881					case 1: // product
2882					case 2: // set
2883					case 7: // service
2884						if (this.product.morePhoto && this.product.morePhoto.length > 1 && this.obPictSlider)
2885						{
2886							this.initializeSlider();
2887						}
2888
2889						this.checkQuantityControls();
2890
2891						break;
2892					case 3: // sku
2893						if (this.offers.length > 0 && this.obTree)
2894						{
2895							treeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
2896
2897							if (treeItems && treeItems.length)
2898							{
2899								for (i = 0; i < treeItems.length; i++)
2900								{
2901									BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this));
2902								}
2903							}
2904
2905							this.setCurrent();
2906						}
2907						else if (this.product.morePhot && this.product.morePhoto.length > 1 && this.obPictSlider)
2908						{
2909							this.initializeSlider();
2910						}
2911
2912						break;
2913				}
2914
2915				if (this.obBuyBtn)
2916				{
2917					if (this.basketAction === 'ADD')
2918					{
2919
2920							BX.bind(this.obBuyBtn, 'click', BX.proxy(this.add2Basket, this));
2921					}
2922					else
2923					{
2924						BX.bind(this.obBuyBtn, 'click', BX.proxy(this.buyBasket, this));
2925					}
2926				}
2927
2928				if (this.useCompare)
2929				{
2930					this.obCompare = BX(this.visual.COMPARE_LINK_ID);
2931					if (this.obCompare)
2932					{
2933						BX.bind(this.obCompare, 'click', BX.proxy(this.compare, this));
2934					}
2935
2936					BX.addCustomEvent('onCatalogDeleteCompare', BX.proxy(this.checkDeletedCompare, this));
2937				}
2938			}
2939		},
2940
2941		setAnalyticsDataLayer: function(action)
2942		{
2943			if (!this.useEnhancedEcommerce || !this.dataLayerName)
2944				return;
2945
2946			var item = {},
2947				info = {},
2948				variants = [],
2949				i, k, j, propId, skuId, propValues;
2950
2951			switch (this.productType)
2952			{
2953				case 0: //no catalog
2954				case 1: //product
2955				case 2: //set
2956				case 7: // service
2957					item = {
2958						'id': this.product.id,
2959						'name': this.product.name,
2960						'price': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].PRICE,
2961						'brand': BX.type.isArray(this.brandProperty) ? this.brandProperty.join('/') : this.brandProperty
2962					};
2963					break;
2964				case 3: //sku
2965					for (i in this.offers[this.offerNum].TREE)
2966					{
2967						if (this.offers[this.offerNum].TREE.hasOwnProperty(i))
2968						{
2969							propId = i.substring(5);
2970							skuId = this.offers[this.offerNum].TREE[i];
2971
2972							for (k in this.treeProps)
2973							{
2974								if (this.treeProps.hasOwnProperty(k) && this.treeProps[k].ID == propId)
2975								{
2976									for (j in this.treeProps[k].VALUES)
2977									{
2978										propValues = this.treeProps[k].VALUES[j];
2979										if (propValues.ID == skuId)
2980										{
2981											variants.push(propValues.NAME);
2982											break;
2983										}
2984									}
2985
2986								}
2987							}
2988						}
2989					}
2990
2991					item = {
2992						'id': this.offers[this.offerNum].ID,
2993						'name': this.offers[this.offerNum].NAME,
2994						'price': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].PRICE,
2995						'brand': BX.type.isArray(this.brandProperty) ? this.brandProperty.join('/') : this.brandProperty,
2996						'variant': variants.join('/')
2997					};
2998					break;
2999			}
3000
3001			switch (action)
3002			{
3003				case 'addToCart':
3004					info = {
3005						'ecommerce': {
3006							'currencyCode': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].CURRENCY || '',
3007							'add': {
3008								'products': [{
3009									'name': item.name || '',
3010									'id': item.id || '',
3011									'price': item.price || 0,
3012									'brand': item.brand || '',
3013									'category': item.category || '',
3014									'variant': item.variant || '',
3015									'quantity': this.showQuantity && this.obQuantity ? this.obQuantity.value : 1
3016								}]
3017							}
3018						}
3019					};
3020					break;
3021			}
3022
3023			window[this.dataLayerName] = window[this.dataLayerName] || [];
3024			window[this.dataLayerName].push(info);
3025		},
3026
3027		hoverOn: function(event)
3028		{
3029			clearTimeout(this.hoverTimer);
3030			// this.obProduct.style.height = getComputedStyle(this.obProduct).height;
3031			BX.addClass(this.obProduct, 'hover');
3032
3033			BX.PreventDefault(event);
3034		},
3035
3036		hoverOff: function(event)
3037		{
3038			if (this.hoverStateChangeForbidden)
3039				return;
3040
3041			BX.removeClass(this.obProduct, 'hover');
3042			// this.hoverTimer = setTimeout(
3043			// 	BX.delegate(function(){
3044			// 		this.obProduct.style.height = 'auto';
3045			// 	}, this),
3046			// 	300
3047			// );
3048
3049			BX.PreventDefault(event);
3050		},
3051
3052		onFocus: function()
3053		{
3054			this.hoverStateChangeForbidden = true;
3055			BX.bind(document, 'mousemove', BX.proxy(this.captureMousePosition, this));
3056		},
3057
3058		onBlur: function()
3059		{
3060			this.hoverStateChangeForbidden = false;
3061			BX.unbind(document, 'mousemove', BX.proxy(this.captureMousePosition, this));
3062
3063			var cursorElement = document.elementFromPoint(this.mouseX, this.mouseY);
3064			if (!cursorElement || !this.obProduct.contains(cursorElement))
3065			{
3066				this.hoverOff();
3067			}
3068		},
3069
3070		captureMousePosition: function(event)
3071		{
3072			this.mouseX = event.clientX;
3073			this.mouseY = event.clientY;
3074		},
3075
3076		getCookie: function(name)
3077		{
3078			var matches = document.cookie.match(new RegExp(
3079				"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
3080			));
3081
3082			return matches ? decodeURIComponent(matches[1]) : null;
3083		},
3084
3085		rememberProductRecommendation: function()
3086		{
3087			// save to RCM_PRODUCT_LOG
3088			var cookieName = BX.cookie_prefix + '_RCM_PRODUCT_LOG',
3089				cookie = this.getCookie(cookieName),
3090				itemFound = false;
3091
3092			var cItems = [],
3093				cItem;
3094
3095			if (cookie)
3096			{
3097				cItems = cookie.split('.');
3098			}
3099
3100			var i = cItems.length;
3101
3102			while (i--)
3103			{
3104				cItem = cItems[i].split('-');
3105
3106				if (cItem[0] == this.product.id)
3107				{
3108					// it's already in recommendations, update the date
3109					cItem = cItems[i].split('-');
3110
3111					// update rcmId and date
3112					cItem[1] = this.product.rcmId;
3113					cItem[2] = BX.current_server_time;
3114
3115					cItems[i] = cItem.join('-');
3116					itemFound = true;
3117				}
3118				else
3119				{
3120					if ((BX.current_server_time - cItem[2]) > 3600 * 24 * 30)
3121					{
3122						cItems.splice(i, 1);
3123					}
3124				}
3125			}
3126
3127			if (!itemFound)
3128			{
3129				// add recommendation
3130				cItems.push([this.product.id, this.product.rcmId, BX.current_server_time].join('-'));
3131			}
3132
3133			// serialize
3134			var plNewCookie = cItems.join('.'),
3135				cookieDate = new Date(new Date().getTime() + 1000 * 3600 * 24 * 365 * 10).toUTCString();
3136
3137			document.cookie = cookieName + "=" + plNewCookie + "; path=/; expires=" + cookieDate + "; domain=" + BX.cookie_domain;
3138		},
3139
3140		startQuantityInterval: function()
3141		{
3142			var target = BX.proxy_context;
3143			var func = target.id === this.visual.QUANTITY_DOWN_ID
3144				? BX.proxy(this.quantityDown, this)
3145				: BX.proxy(this.quantityUp, this);
3146
3147			this.quantityDelay = setTimeout(
3148				BX.delegate(function() {
3149					this.quantityTimer = setInterval(func, 150);
3150				}, this),
3151				300
3152			);
3153		},
3154
3155		clearQuantityInterval: function()
3156		{
3157			clearTimeout(this.quantityDelay);
3158			clearInterval(this.quantityTimer);
3159		},
3160
3161		quantityUp: function()
3162		{
3163			var curValue = 0,
3164				boolSet = true;
3165
3166			if (this.errorCode === 0 && this.showQuantity && this.canBuy)
3167			{
3168				curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
3169				if (!isNaN(curValue))
3170				{
3171					curValue += this.stepQuantity;
3172					if (this.checkQuantity)
3173					{
3174						if (curValue > this.maxQuantity)
3175						{
3176							boolSet = false;
3177						}
3178					}
3179
3180					if (boolSet)
3181					{
3182						if (this.isDblQuantity)
3183						{
3184							curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
3185						}
3186
3187						this.obQuantity.value = curValue;
3188
3189						this.setPrice();
3190					}
3191				}
3192			}
3193		},
3194
3195		quantityDown: function()
3196		{
3197			var curValue = 0,
3198				boolSet = true;
3199
3200			if (this.errorCode === 0 && this.showQuantity && this.canBuy)
3201			{
3202				curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
3203				if (!isNaN(curValue))
3204				{
3205					curValue -= this.stepQuantity;
3206
3207					this.checkPriceRange(curValue);
3208
3209					if (curValue < this.minQuantity)
3210					{
3211						boolSet = false;
3212					}
3213
3214					if (boolSet)
3215					{
3216						if (this.isDblQuantity)
3217						{
3218							curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
3219						}
3220
3221						this.obQuantity.value = curValue;
3222
3223						this.setPrice();
3224					}
3225				}
3226			}
3227		},
3228
3229		quantityChange: function()
3230		{
3231			var curValue = 0,
3232				intCount;
3233
3234			if (this.errorCode === 0 && this.showQuantity)
3235			{
3236				if (this.canBuy)
3237				{
3238					curValue = this.isDblQuantity ? parseFloat(this.obQuantity.value) : Math.round(this.obQuantity.value);
3239					if (!isNaN(curValue))
3240					{
3241						if (this.checkQuantity)
3242						{
3243							if (curValue > this.maxQuantity)
3244							{
3245								curValue = this.maxQuantity;
3246							}
3247						}
3248
3249						this.checkPriceRange(curValue);
3250
3251						intCount = Math.floor(
3252							Math.round(curValue * this.precisionFactor / this.stepQuantity) / this.precisionFactor
3253						) || 1;
3254						curValue = (intCount <= 1 ? this.stepQuantity : intCount * this.stepQuantity);
3255						curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
3256
3257						if (curValue < this.minQuantity)
3258						{
3259							curValue = this.minQuantity;
3260						}
3261
3262						this.obQuantity.value = curValue;
3263					}
3264					else
3265					{
3266						this.obQuantity.value = this.minQuantity;
3267					}
3268				}
3269				else
3270				{
3271					this.obQuantity.value = this.minQuantity;
3272				}
3273
3274				this.setPrice();
3275			}
3276		},
3277
3278		quantitySet: function(index)
3279		{
3280			var resetQuantity, strLimit;
3281
3282			var newOffer = this.offers[index],
3283				oldOffer = this.offers[this.offerNum];
3284
3285			if (this.errorCode === 0)
3286			{
3287				this.canBuy = newOffer.CAN_BUY;
3288
3289				this.currentPriceMode = newOffer.ITEM_PRICE_MODE;
3290				this.currentPrices = newOffer.ITEM_PRICES;
3291				this.currentPriceSelected = newOffer.ITEM_PRICE_SELECTED;
3292				this.currentQuantityRanges = newOffer.ITEM_QUANTITY_RANGES;
3293				this.currentQuantityRangeSelected = newOffer.ITEM_QUANTITY_RANGE_SELECTED;
3294
3295				if (this.canBuy)
3296				{
3297					if (this.blockNodes.quantity)
3298					{
3299						BX.style(this.blockNodes.quantity, 'display', '');
3300					}
3301
3302					if (this.obBasketActions)
3303					{
3304						BX.style(this.obBasketActions, 'display', '');
3305					}
3306
3307					if (this.obNotAvail)
3308					{
3309						BX.style(this.obNotAvail, 'display', 'none');
3310					}
3311
3312					if (this.obSubscribe)
3313					{
3314						BX.style(this.obSubscribe, 'display', 'none');
3315					}
3316				}
3317				else
3318				{
3319					if (this.blockNodes.quantity)
3320					{
3321						BX.style(this.blockNodes.quantity, 'display', 'none');
3322					}
3323
3324					if (this.obBasketActions)
3325					{
3326						BX.style(this.obBasketActions, 'display', 'none');
3327					}
3328
3329					if (this.obNotAvail)
3330					{
3331						BX.style(this.obNotAvail, 'display', '');
3332					}
3333
3334					if (this.obSubscribe)
3335					{
3336						if (newOffer.CATALOG_SUBSCRIBE === 'Y')
3337						{
3338							BX.style(this.obSubscribe, 'display', '');
3339							this.obSubscribe.setAttribute('data-item', newOffer.ID);
3340							BX(this.visual.SUBSCRIBE_ID + '_hidden').click();
3341						}
3342						else
3343						{
3344							BX.style(this.obSubscribe, 'display', 'none');
3345						}
3346					}
3347				}
3348
3349				this.isDblQuantity = newOffer.QUANTITY_FLOAT;
3350				this.checkQuantity = newOffer.CHECK_QUANTITY;
3351
3352				if (this.isDblQuantity)
3353				{
3354					this.stepQuantity = Math.round(parseFloat(newOffer.STEP_QUANTITY) * this.precisionFactor) / this.precisionFactor;
3355					this.maxQuantity = parseFloat(newOffer.MAX_QUANTITY);
3356					this.minQuantity = this.currentPriceMode === 'Q' ? parseFloat(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY) : this.stepQuantity;
3357				}
3358				else
3359				{
3360					this.stepQuantity = parseInt(newOffer.STEP_QUANTITY, 10);
3361					this.maxQuantity = parseInt(newOffer.MAX_QUANTITY, 10);
3362					this.minQuantity = this.currentPriceMode === 'Q' ? parseInt(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY) : this.stepQuantity;
3363				}
3364
3365				if (this.showQuantity)
3366				{
3367					var isDifferentMinQuantity = oldOffer.ITEM_PRICES.length
3368						&& oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED]
3369						&& oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED].MIN_QUANTITY != this.minQuantity;
3370
3371					if (this.isDblQuantity)
3372					{
3373						resetQuantity = Math.round(parseFloat(oldOffer.STEP_QUANTITY) * this.precisionFactor) / this.precisionFactor !== this.stepQuantity
3374							|| isDifferentMinQuantity
3375							|| oldOffer.MEASURE !== newOffer.MEASURE
3376							|| (
3377								this.checkQuantity
3378								&& parseFloat(oldOffer.MAX_QUANTITY) > this.maxQuantity
3379								&& parseFloat(this.obQuantity.value) > this.maxQuantity
3380							);
3381					}
3382					else
3383					{
3384						resetQuantity = parseInt(oldOffer.STEP_QUANTITY, 10) !== this.stepQuantity
3385							|| isDifferentMinQuantity
3386							|| oldOffer.MEASURE !== newOffer.MEASURE
3387							|| (
3388								this.checkQuantity
3389								&& parseInt(oldOffer.MAX_QUANTITY, 10) > this.maxQuantity
3390								&& parseInt(this.obQuantity.value, 10) > this.maxQuantity
3391							);
3392					}
3393
3394					this.obQuantity.disabled = !this.canBuy;
3395
3396					if (resetQuantity)
3397					{
3398						this.obQuantity.value = this.minQuantity;
3399					}
3400
3401					if (this.obMeasure)
3402					{
3403						if (newOffer.MEASURE)
3404						{
3405							BX.adjust(this.obMeasure, {html: newOffer.MEASURE});
3406						}
3407						else
3408						{
3409							BX.adjust(this.obMeasure, {html: ''});
3410						}
3411					}
3412				}
3413
3414				if (this.obQuantityLimit.all)
3415				{
3416					if (!this.checkQuantity || this.maxQuantity == 0)
3417					{
3418						BX.adjust(this.obQuantityLimit.value, {html: ''});
3419						BX.adjust(this.obQuantityLimit.all, {style: {display: 'none'}});
3420					}
3421					else
3422					{
3423						if (this.showMaxQuantity === 'M')
3424						{
3425							strLimit = (this.maxQuantity / this.stepQuantity >= this.relativeQuantityFactor)
3426								? BX.message('RELATIVE_QUANTITY_MANY')
3427								: BX.message('RELATIVE_QUANTITY_FEW');
3428						}
3429						else
3430						{
3431							strLimit = this.maxQuantity;
3432
3433							if (newOffer.MEASURE)
3434							{
3435								strLimit += (' ' + newOffer.MEASURE);
3436							}
3437						}
3438
3439						BX.adjust(this.obQuantityLimit.value, {html: strLimit});
3440						BX.adjust(this.obQuantityLimit.all, {style: {display: ''}});
3441					}
3442				}
3443			}
3444		},
3445
3446		initializeSlider: function() {
3447			if(this.initedSLider)this.initedSLider.destroy();
3448			this.initedSLider = new Swiper(this.obPictWrapper, {
3449				slidesPerView: 1,
3450				spaceBetween: 30,
3451				loop: true,
3452				nested: true,
3453				pagination: {
3454					el: ".card__gallery-pagination",
3455					type: 'bullets',
3456					clickable: true,
3457				},
3458
3459			});
3460		},
3461
3462
3463
3464
3465		selectOfferProp: function()
3466		{
3467			var i = 0,
3468				value = '',
3469				strTreeValue = '',
3470				arTreeItem = [],
3471				rowItems = null,
3472				target = BX.proxy_context;
3473
3474			if (target && target.hasAttribute('data-treevalue'))
3475			{
3476				if (BX.hasClass(target, 'selected'))
3477					return;
3478
3479				strTreeValue = target.getAttribute('data-treevalue');
3480				arTreeItem = strTreeValue.split('_');
3481				if (this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
3482				{
3483					rowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
3484					if (rowItems && 0 < rowItems.length)
3485					{
3486						for (i = 0; i < rowItems.length; i++)
3487						{
3488							value = rowItems[i].getAttribute('data-onevalue');
3489							if (value === arTreeItem[1])
3490							{
3491								BX.addClass(rowItems[i], 'selected');
3492							}
3493							else
3494							{
3495								BX.removeClass(rowItems[i], 'selected');
3496							}
3497						}
3498					}
3499
3500					if (
3501						this.isFacebookConversionCustomizeProductEventEnabled
3502						&& BX.Type.isArrayFilled(this.offers)
3503						&& BX.Type.isObject(this.offers[this.offerNum])
3504					)
3505					{
3506						BX.ajax.runAction(
3507							'sale.facebookconversion.customizeProduct',
3508							{
3509								data: {
3510									offerId: this.offers[this.offerNum]['ID']
3511								}
3512							}
3513						);
3514					}
3515				}
3516			}
3517		},
3518
3519		searchOfferPropIndex: function(strPropID, strPropValue)
3520		{
3521			var strName = '',
3522				arShowValues = false,
3523				i, j,
3524				arCanBuyValues = [],
3525				allValues = [],
3526				index = -1,
3527				arFilter = {},
3528				tmpFilter = [];
3529
3530			for (i = 0; i < this.treeProps.length; i++)
3531			{
3532				if (this.treeProps[i].ID === strPropID)
3533				{
3534					index = i;
3535					break;
3536				}
3537			}
3538
3539			if (-1 < index)
3540			{
3541				for (i = 0; i < index; i++)
3542				{
3543					strName = 'PROP_'+this.treeProps[i].ID;
3544					arFilter[strName] = this.selectedValues[strName];
3545				}
3546				strName = 'PROP_'+this.treeProps[index].ID;
3547				arShowValues = this.getRowValues(arFilter, strName);
3548				if (!arShowValues)
3549				{
3550					return false;
3551				}
3552				if (!BX.util.in_array(strPropValue, arShowValues))
3553				{
3554					return false;
3555				}
3556				arFilter[strName] = strPropValue;
3557				for (i = index+1; i < this.treeProps.length; i++)
3558				{
3559					strName = 'PROP_'+this.treeProps[i].ID;
3560					arShowValues = this.getRowValues(arFilter, strName);
3561					if (!arShowValues)
3562					{
3563						return false;
3564					}
3565					allValues = [];
3566					if (this.showAbsent)
3567					{
3568						arCanBuyValues = [];
3569						tmpFilter = [];
3570						tmpFilter = BX.clone(arFilter, true);
3571						for (j = 0; j < arShowValues.length; j++)
3572						{
3573							tmpFilter[strName] = arShowValues[j];
3574							allValues[allValues.length] = arShowValues[j];
3575							if (this.getCanBuy(tmpFilter))
3576								arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
3577						}
3578					}
3579					else
3580					{
3581						arCanBuyValues = arShowValues;
3582					}
3583					if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
3584					{
3585						arFilter[strName] = this.selectedValues[strName];
3586					}
3587					else
3588					{
3589						if (this.showAbsent)
3590							arFilter[strName] = (arCanBuyValues.length > 0 ? arCanBuyValues[0] : allValues[0]);
3591						else
3592							arFilter[strName] = arCanBuyValues[0];
3593					}
3594					this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
3595				}
3596				this.selectedValues = arFilter;
3597				this.changeInfo();
3598			}
3599			return true;
3600		},
3601
3602		updateRow: function(intNumber, activeID, showID, canBuyID)
3603		{
3604			var i = 0,
3605				value = '',
3606				isCurrent = false,
3607				rowItems = null;
3608
3609			var lineContainer = this.obTree.querySelectorAll('[data-entity="sku-line-block"]'),
3610				listContainer;
3611
3612			if (intNumber > -1 && intNumber < lineContainer.length)
3613			{
3614				listContainer = lineContainer[intNumber].querySelector('ul');
3615				rowItems = BX.findChildren(listContainer, {tagName: 'li'}, false);
3616				if (rowItems && 0 < rowItems.length)
3617				{
3618					for (i = 0; i < rowItems.length; i++)
3619					{
3620						value = rowItems[i].getAttribute('data-onevalue');
3621						isCurrent = value === activeID;
3622
3623						if (isCurrent)
3624						{
3625							BX.addClass(rowItems[i], 'selected');
3626						}
3627						else
3628						{
3629							BX.removeClass(rowItems[i], 'selected');
3630						}
3631
3632						if (BX.util.in_array(value, canBuyID))
3633						{
3634							BX.removeClass(rowItems[i], 'notallowed');
3635						}
3636						else
3637						{
3638							BX.addClass(rowItems[i], 'notallowed');
3639						}
3640
3641						rowItems[i].style.display = BX.util.in_array(value, showID) ? '' : 'none';
3642
3643						if (isCurrent)
3644						{
3645							lineContainer[intNumber].style.display = (value == 0 && canBuyID.length == 1) ? 'none' : '';
3646						}
3647					}
3648				}
3649			}
3650		},
3651
3652		getRowValues: function(arFilter, index)
3653		{
3654			var i = 0,
3655				j,
3656				arValues = [],
3657				boolSearch = false,
3658				boolOneSearch = true;
3659
3660			if (0 === arFilter.length)
3661			{
3662				for (i = 0; i < this.offers.length; i++)
3663				{
3664					if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
3665					{
3666						arValues[arValues.length] = this.offers[i].TREE[index];
3667					}
3668				}
3669				boolSearch = true;
3670			}
3671			else
3672			{
3673				for (i = 0; i < this.offers.length; i++)
3674				{
3675					boolOneSearch = true;
3676					for (j in arFilter)
3677					{
3678						if (arFilter[j] !== this.offers[i].TREE[j])
3679						{
3680							boolOneSearch = false;
3681							break;
3682						}
3683					}
3684					if (boolOneSearch)
3685					{
3686						if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
3687						{
3688							arValues[arValues.length] = this.offers[i].TREE[index];
3689						}
3690						boolSearch = true;
3691					}
3692				}
3693			}
3694			return (boolSearch ? arValues : false);
3695		},
3696
3697		getCanBuy: function(arFilter)
3698		{
3699			var i, j,
3700				boolSearch = false,
3701				boolOneSearch = true;
3702
3703			for (i = 0; i < this.offers.length; i++)
3704			{
3705				boolOneSearch = true;
3706				for (j in arFilter)
3707				{
3708					if (arFilter[j] !== this.offers[i].TREE[j])
3709					{
3710						boolOneSearch = false;
3711						break;
3712					}
3713				}
3714				if (boolOneSearch)
3715				{
3716					if (this.offers[i].CAN_BUY)
3717					{
3718						boolSearch = true;
3719						break;
3720					}
3721				}
3722			}
3723
3724			return boolSearch;
3725		},
3726
3727		setCurrent: function()
3728		{
3729			var i,
3730				j = 0,
3731				arCanBuyValues = [],
3732				strName = '',
3733				arShowValues = false,
3734				arFilter = {},
3735				tmpFilter = [],
3736				current = this.offers[this.offerNum].TREE;
3737
3738			for (i = 0; i < this.treeProps.length; i++)
3739			{
3740				strName = 'PROP_'+this.treeProps[i].ID;
3741				arShowValues = this.getRowValues(arFilter, strName);
3742				if (!arShowValues)
3743				{
3744					break;
3745				}
3746				if (BX.util.in_array(current[strName], arShowValues))
3747				{
3748					arFilter[strName] = current[strName];
3749				}
3750				else
3751				{
3752					arFilter[strName] = arShowValues[0];
3753					this.offerNum = 0;
3754				}
3755				if (this.showAbsent)
3756				{
3757					arCanBuyValues = [];
3758					tmpFilter = [];
3759					tmpFilter = BX.clone(arFilter, true);
3760					for (j = 0; j < arShowValues.length; j++)
3761					{
3762						tmpFilter[strName] = arShowValues[j];
3763						if (this.getCanBuy(tmpFilter))
3764						{
3765							arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
3766						}
3767					}
3768				}
3769				else
3770				{
3771					arCanBuyValues = arShowValues;
3772				}
3773				this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
3774			}
3775			this.selectedValues = arFilter;
3776			this.changeInfo();
3777		},
3778
3779		changeInfo: function()
3780		{
3781			var i, j,
3782				index = -1,
3783				boolOneSearch = true,
3784				quantityChanged;
3785
3786			for (i = 0; i < this.offers.length; i++)
3787			{
3788				boolOneSearch = true;
3789				for (j in this.selectedValues)
3790				{
3791					if (this.selectedValues[j] !== this.offers[i].TREE[j])
3792					{
3793						boolOneSearch = false;
3794						break;
3795					}
3796				}
3797				if (boolOneSearch)
3798				{
3799					index = i;
3800					break;
3801				}
3802			}
3803			if (index > -1)
3804			{
3805
3806				if (this.showSkuProps && this.obSkuProps)
3807				{
3808					if (this.offers[index].DISPLAY_PROPERTIES.length)
3809					{
3810						BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
3811					}
3812					else
3813					{
3814						BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
3815					}
3816				}
3817
3818				this.quantitySet(index);
3819				this.setPrice();
3820				this.setCompared(this.offers[index].COMPARED);
3821
3822				this.offerNum = index;
3823			}
3824		},
3825
3826		checkPriceRange: function(quantity)
3827		{
3828			if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
3829				return;
3830
3831			var range, found = false;
3832
3833			for (var i in this.currentQuantityRanges)
3834			{
3835				if (this.currentQuantityRanges.hasOwnProperty(i))
3836				{
3837					range = this.currentQuantityRanges[i];
3838
3839					if (
3840						parseInt(quantity) >= parseInt(range.SORT_FROM)
3841						&& (
3842							range.SORT_TO == 'INF'
3843							|| parseInt(quantity) <= parseInt(range.SORT_TO)
3844						)
3845					)
3846					{
3847						found = true;
3848						this.currentQuantityRangeSelected = range.HASH;
3849						break;
3850					}
3851				}
3852			}
3853
3854			if (!found && (range = this.getMinPriceRange()))
3855			{
3856				this.currentQuantityRangeSelected = range.HASH;
3857			}
3858
3859			for (var k in this.currentPrices)
3860			{
3861				if (this.currentPrices.hasOwnProperty(k))
3862				{
3863					if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
3864					{
3865						this.currentPriceSelected = k;
3866						break;
3867					}
3868				}
3869			}
3870		},
3871
3872		getMinPriceRange: function()
3873		{
3874			var range;
3875
3876			for (var i in this.currentQuantityRanges)
3877			{
3878				if (this.currentQuantityRanges.hasOwnProperty(i))
3879				{
3880					if (
3881						!range
3882						|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
3883					)
3884					{
3885						range = this.currentQuantityRanges[i];
3886					}
3887				}
3888			}
3889
3890			return range;
3891		},
3892
3893		checkQuantityControls: function()
3894		{
3895			if (!this.obQuantity)
3896				return;
3897
3898			var reachedTopLimit = this.checkQuantity && parseFloat(this.obQuantity.value) + this.stepQuantity > this.maxQuantity,
3899				reachedBottomLimit = parseFloat(this.obQuantity.value) - this.stepQuantity < this.minQuantity;
3900
3901			if (reachedTopLimit)
3902			{
3903				BX.addClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled');
3904			}
3905			else if (BX.hasClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled'))
3906			{
3907				BX.removeClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled');
3908			}
3909
3910			if (reachedBottomLimit)
3911			{
3912				BX.addClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled');
3913			}
3914			else if (BX.hasClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled'))
3915			{
3916				BX.removeClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled');
3917			}
3918
3919			if (reachedTopLimit && reachedBottomLimit)
3920			{
3921				this.obQuantity.setAttribute('disabled', 'disabled');
3922			}
3923			else
3924			{
3925				this.obQuantity.removeAttribute('disabled');
3926			}
3927		},
3928
3929		setPrice: function()
3930		{
3931			var obData, price;
3932
3933			if (this.obQuantity)
3934			{
3935				this.checkPriceRange(this.obQuantity.value);
3936			}
3937
3938			this.checkQuantityControls();
3939
3940			price = this.currentPrices[this.currentPriceSelected];
3941
3942			if (this.obPrice)
3943			{
3944				if (price)
3945				{
3946					BX.adjust(this.obPrice, {html: BX.Currency.currencyFormat(price.RATIO_PRICE, price.CURRENCY, true)});
3947				}
3948				else
3949				{
3950					BX.adjust(this.obPrice, {html: ''});
3951				}
3952
3953				if (this.showOldPrice && this.obPriceOld)
3954				{
3955					if (price && price.RATIO_PRICE !== price.RATIO_BASE_PRICE)
3956					{
3957						BX.adjust(this.obPriceOld, {
3958							style: {display: ''},
3959							html: BX.Currency.currencyFormat(price.RATIO_BASE_PRICE, price.CURRENCY, true)
3960						});
3961					}
3962					else
3963					{
3964						BX.adjust(this.obPriceOld, {
3965							style: {display: 'none'},
3966							html: ''
3967						});
3968					}
3969				}
3970
3971				if (this.obPriceTotal)
3972				{
3973					if (price && this.obQuantity && this.obQuantity.value != this.stepQuantity)
3974					{
3975						BX.adjust(this.obPriceTotal, {
3976							html: BX.message('PRICE_TOTAL_PREFIX') + ' <strong>'
3977							+ BX.Currency.currencyFormat(price.PRICE * this.obQuantity.value, price.CURRENCY, true)
3978							+ '</strong>',
3979							style: {display: ''}
3980						});
3981					}
3982					else
3983					{
3984						BX.adjust(this.obPriceTotal, {
3985							html: '',
3986							style: {display: 'none'}
3987						});
3988					}
3989				}
3990
3991				if (this.showPercent)
3992				{
3993					if (price && parseInt(price.PERCENT) > 0)
3994					{
3995						obData = {style: {display: ''}, html: -price.PERCENT + '%'};
3996					}
3997					else
3998					{
3999						obData = {style: {display: 'none'}, html: ''};
4000					}
4001
4002					if (this.obDscPerc)
4003					{
4004						BX.adjust(this.obDscPerc, obData);
4005					}
4006
4007					if (this.obSecondDscPerc)
4008					{
4009						BX.adjust(this.obSecondDscPerc, obData);
4010					}
4011				}
4012			}
4013		},
4014
4015		compare: function(event)
4016		{
4017			var checkbox = this.obCompare.querySelector('[data-entity="compare-checkbox"]'),
4018				target = BX.getEventTarget(event),
4019				checked = true;
4020
4021			if (checkbox)
4022			{
4023				checked = target === checkbox ? checkbox.checked : !checkbox.checked;
4024			}
4025
4026			var url = checked ? this.compareData.compareUrl : this.compareData.compareDeleteUrl,
4027				compareLink;
4028
4029			if (url)
4030			{
4031				if (target !== checkbox)
4032				{
4033					BX.PreventDefault(event);
4034					this.setCompared(checked);
4035				}
4036
4037				switch (this.productType)
4038				{
4039					case 0: // no catalog
4040					case 1: // product
4041					case 2: // set
4042					case 7: // service
4043						compareLink = url.replace('#ID#', this.product.id.toString());
4044						break;
4045					case 3: // sku
4046						compareLink = url.replace('#ID#', this.offers[this.offerNum].ID);
4047						break;
4048				}
4049
4050				BX.ajax({
4051					method: 'POST',
4052					dataType: checked ? 'json' : 'html',
4053					url: compareLink + (compareLink.indexOf('?') !== -1 ? '&' : '?') + 'ajax_action=Y',
4054					onsuccess: checked
4055						? BX.proxy(this.compareResult, this)
4056						: BX.proxy(this.compareDeleteResult, this)
4057				});
4058			}
4059		},
4060
4061		compareResult: function(result)
4062		{
4063			// var popupContent, popupButtons;
4064
4065			// if (this.obPopupWin)
4066			// {
4067			// 	this.obPopupWin.close();
4068			// }
4069
4070			if (!BX.type.isPlainObject(result))
4071				return;
4072
4073			// this.initPopupWindow();
4074
4075			if (this.offers.length > 0)
4076			{
4077				this.offers[this.offerNum].COMPARED = result.STATUS === 'OK';
4078			}
4079
4080			if (result.STATUS === 'OK')
4081			{
4082				BX.onCustomEvent('OnCompareChange');
4083
4084				// popupContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
4085				// 	+ BX.message('COMPARE_MESSAGE_OK')
4086				// 	+ '</p></div>';
4087
4088				// if (this.showClosePopup)
4089				// {
4090				// 	popupButtons = [
4091				// 		new BasketButton({
4092				// 			text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
4093				// 			events: {
4094				// 				click: BX.delegate(this.compareRedirect, this)
4095				// 			},
4096				// 			style: {marginRight: '10px'}
4097				// 		}),
4098				// 		new BasketButton({
4099				// 			text: BX.message('BTN_MESSAGE_CLOSE_POPUP'),
4100				// 			events: {
4101				// 				click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
4102				// 			}
4103				// 		})
4104				// 	];
4105				// }
4106				// else
4107				// {
4108				// 	popupButtons = [
4109				// 		new BasketButton({
4110				// 			text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
4111				// 			events: {
4112				// 				click: BX.delegate(this.compareRedirect, this)
4113				// 			}
4114				// 		})
4115				// 	];
4116				// }
4117			}
4118			else
4119			{
4120				// popupContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
4121				// 	+ (result.MESSAGE ? result.MESSAGE : BX.message('COMPARE_UNKNOWN_ERROR'))
4122				// 	+ '</p></div>';
4123				// popupButtons = [
4124				// 	new BasketButton({
4125				// 		text: BX.message('BTN_MESSAGE_CLOSE'),
4126				// 		events: {
4127				// 			click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
4128				// 		}
4129				// 	})
4130				// ];
4131			}
4132
4133			// this.obPopupWin.setTitleBar(BX.message('COMPARE_TITLE'));
4134			// this.obPopupWin.setContent(popupContent);
4135			// this.obPopupWin.setButtons(popupButtons);
4136			// this.obPopupWin.show();
4137		},
4138
4139		compareDeleteResult: function()
4140		{
4141			BX.onCustomEvent('OnCompareChange');
4142
4143			if (this.offers && this.offers.length)
4144			{
4145				this.offers[this.offerNum].COMPARED = false;
4146			}
4147		},
4148
4149		setCompared: function(state)
4150		{
4151			if (!this.obCompare)
4152				return;
4153			var checkbox = this.obCompare.querySelector('[data-entity="compare-checkbox"]');
4154			if (checkbox)
4155			{
4156				checkbox.checked = state;
4157			}
4158			if(state){
4159				BX.addClass(this.obCompare,'icon_active');
4160			}
4161			else {
4162				BX.removeClass(this.obCompare,'icon_active');
4163			}
4164		},
4165
4166		setCompareInfo: function(comparedIds)
4167		{
4168			if (!BX.type.isArray(comparedIds))
4169				return;
4170
4171			for (var i in this.offers)
4172			{
4173				if (this.offers.hasOwnProperty(i))
4174				{
4175					this.offers[i].COMPARED = BX.util.in_array(this.offers[i].ID, comparedIds);
4176				}
4177			}
4178		},
4179
4180		compareRedirect: function()
4181		{
4182			if (this.compareData.comparePath)
4183			{
4184				location.href = this.compareData.comparePath;
4185			}
4186			else
4187			{
4188				this.obPopupWin.close();
4189			}
4190		},
4191
4192		checkDeletedCompare: function(id)
4193		{
4194			switch (this.productType)
4195			{
4196				case 0: // no catalog
4197				case 1: // product
4198				case 2: // set
4199				case 7: // service
4200					if (this.product.id == id)
4201					{
4202						this.setCompared(false);
4203					}
4204
4205					break;
4206				case 3: // sku
4207					var i = this.offers.length;
4208					while (i--)
4209					{
4210						if (this.offers[i].ID == id)
4211						{
4212							this.offers[i].COMPARED = false;
4213
4214							if (this.offerNum == i)
4215							{
4216								this.setCompared(false);
4217							}
4218
4219							break;
4220						}
4221					}
4222			}
4223		},
4224
4225		initBasketUrl: function()
4226		{
4227			this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url);
4228			switch (this.productType)
4229			{
4230				case 1: // product
4231				case 2: // set
4232				case 7: // service
4233					this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString());
4234					break;
4235				case 3: // sku
4236					this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID);
4237					break;
4238			}
4239			this.basketParams = {
4240				'ajax_basket': 'Y'
4241			};
4242			if (this.showQuantity)
4243			{
4244				this.basketParams[this.basketData.quantity] = this.obQuantity.value;
4245			}
4246			if (this.basketData.sku_props)
4247			{
4248				this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props;
4249			}
4250		},
4251
4252		fillBasketProps: function()
4253		{
4254			if (!this.visual.BASKET_PROP_DIV)
4255			{
4256				return;
4257			}
4258			var
4259				i = 0,
4260				propCollection = null,
4261				foundValues = false,
4262				obBasketProps = null;
4263
4264			if (this.basketData.useProps && !this.basketData.emptyProps)
4265			{
4266				if (this.obPopupWin && this.obPopupWin.contentContainer)
4267				{
4268					obBasketProps = this.obPopupWin.contentContainer;
4269				}
4270			}
4271			else
4272			{
4273				obBasketProps = BX(this.visual.BASKET_PROP_DIV);
4274			}
4275			if (obBasketProps)
4276			{
4277				propCollection = obBasketProps.getElementsByTagName('select');
4278				if (propCollection && propCollection.length)
4279				{
4280					for (i = 0; i < propCollection.length; i++)
4281					{
4282						if (!propCollection[i].disabled)
4283						{
4284							switch (propCollection[i].type.toLowerCase())
4285							{
4286								case 'select-one':
4287									this.basketParams[propCollection[i].name] = propCollection[i].value;
4288									foundValues = true;
4289									break;
4290								default:
4291									break;
4292							}
4293						}
4294					}
4295				}
4296				propCollection = obBasketProps.getElementsByTagName('input');
4297				if (propCollection && propCollection.length)
4298				{
4299					for (i = 0; i < propCollection.length; i++)
4300					{
4301						if (!propCollection[i].disabled)
4302						{
4303							switch (propCollection[i].type.toLowerCase())
4304							{
4305								case 'hidden':
4306									this.basketParams[propCollection[i].name] = propCollection[i].value;
4307									foundValues = true;
4308									break;
4309								case 'radio':
4310									if (propCollection[i].checked)
4311									{
4312										this.basketParams[propCollection[i].name] = propCollection[i].value;
4313										foundValues = true;
4314									}
4315									break;
4316								default:
4317									break;
4318							}
4319						}
4320					}
4321				}
4322			}
4323			if (!foundValues)
4324			{
4325				this.basketParams[this.basketData.props] = [];
4326				this.basketParams[this.basketData.props][0] = 0;
4327			}
4328		},
4329
4330		add2Basket: function(el)
4331		{
4332			if(BX.hasClass(this.obBuyBtn,'card-basket_add')){
4333				this.basketRedirect();
4334			}
4335			else{
4336				BX.addClass(this.obBuyBtn, 'card-basket_add');
4337				if(this.viewMode=='LINE'){
4338					this.obBuyBtn.innerHTML='В корзине';
4339				}
4340				this.basketMode = 'ADD';
4341				this.basket();
4342			}
4343		},
4344
4345		buyBasket: function()
4346		{
4347			this.basketMode = 'BUY';
4348			this.basket();
4349		},
4350
4351		sendToBasket: function()
4352		{
4353			if (!this.canBuy)
4354			{
4355				return;
4356			}
4357
4358			// check recommendation
4359			if (this.product && this.product.id && this.bigData)
4360			{
4361				this.rememberProductRecommendation();
4362			}
4363
4364			this.initBasketUrl();
4365			this.fillBasketProps();
4366			BX.ajax({
4367				method: 'POST',
4368				dataType: 'json',
4369				url: this.basketUrl,
4370				data: this.basketParams,
4371				onsuccess: BX.proxy(this.basketResult, this)
4372			});
4373		},
4374
4375		basket: function()
4376		{
4377			var contentBasketProps = '';
4378			if (!this.canBuy)
4379			{
4380				return;
4381			}
4382			switch (this.productType)
4383			{
4384				case 1: // product
4385				case 2: // set
4386				case 7: // service
4387					if (this.basketData.useProps && !this.basketData.emptyProps)
4388					{
4389						this.initPopupWindow();
4390						this.obPopupWin.setTitleBar(BX.message('TITLE_BASKET_PROPS'));
4391						if (BX(this.visual.BASKET_PROP_DIV))
4392						{
4393							contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML;
4394						}
4395						this.obPopupWin.setContent(contentBasketProps);
4396						this.obPopupWin.setButtons([
4397							new BasketButton({
4398								text: BX.message('BTN_MESSAGE_SEND_PROPS'),
4399								events: {
4400									click: BX.delegate(this.sendToBasket, this)
4401								}
4402							})
4403						]);
4404						this.obPopupWin.show();
4405					}
4406					else
4407					{
4408						this.sendToBasket();
4409					}
4410					break;
4411				case 3: // sku
4412					this.sendToBasket();
4413					break;
4414			}
4415		},
4416
4417		basketResult: function(arResult)
4418		{
4419			var strContent = '',
4420				strPict = '',
4421				successful,
4422				buttons = [];
4423
4424			if (this.obPopupWin)
4425				this.obPopupWin.close();
4426
4427			if (!BX.type.isPlainObject(arResult))
4428				return;
4429
4430			successful = arResult.STATUS === 'OK';
4431
4432			if (successful)
4433			{
4434				this.setAnalyticsDataLayer('addToCart');
4435			}
4436
4437			if (successful && this.basketAction === 'BUY')
4438			{
4439				this.basketRedirect();
4440			}
4441			else
4442			{
4443				this.initPopupWindow();
4444
4445				if (successful)
4446				{
4447					BX.onCustomEvent('OnBasketChange');
4448
4449					if  (BX.findParent(this.obProduct, {className: 'bx_sale_gift_main_products'}, 10))
4450					{
4451						BX.onCustomEvent('onAddToBasketMainProduct', [this]);
4452					}
4453
4454					switch (this.productType)
4455					{
4456						case 1: // product
4457						case 2: // set
4458						case 7: // service
4459							strPict = this.product.pict.SRC;
4460							break;
4461						case 3: // sku
4462							strPict = (this.offers[this.offerNum].PREVIEW_PICTURE ?
4463									this.offers[this.offerNum].PREVIEW_PICTURE.SRC :
4464									this.defaultPict.pict.SRC
4465							);
4466							break;
4467					}
4468
4469					strContent = '<div style="width: 100%; margin: 0; text-align: center;"><img src="'
4470						+ strPict + '" height="130" style="max-height:130px"><p>' + this.product.name + '</p></div>';
4471
4472					if (this.showClosePopup)
4473					{
4474						buttons = [
4475							new BasketButton({
4476								text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
4477								events: {
4478									click: BX.delegate(this.basketRedirect, this)
4479								},
4480								style: {marginRight: '10px'}
4481							}),
4482							new BasketButton({
4483								text: BX.message("BTN_MESSAGE_CLOSE_POPUP"),
4484								events: {
4485									click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
4486								}
4487							})
4488						];
4489					}
4490					else
4491					{
4492						buttons = [
4493							new BasketButton({
4494								text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
4495								events: {
4496									click: BX.delegate(this.basketRedirect, this)
4497								}
4498							})
4499						];
4500					}
4501				}
4502				else
4503				{
4504					strContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
4505						+ (arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'))
4506						+ '</p></div>';
4507					buttons = [
4508						new BasketButton({
4509							text: BX.message('BTN_MESSAGE_CLOSE'),
4510							events: {
4511								click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
4512							}
4513						})
4514					];
4515				}
4516				this.obPopupWin.setTitleBar(successful ? BX.message('TITLE_SUCCESSFUL') : BX.message('TITLE_ERROR'));
4517				this.obPopupWin.setContent(strContent);
4518				this.obPopupWin.setButtons(buttons);
4519				this.obPopupWin.show();
4520			}
4521		},
4522
4523		basketRedirect: function()
4524		{
4525			location.href = (this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL'));
4526		},
4527
4528		initPopupWindow: function()
4529		{
4530			if (this.obPopupWin)
4531				return;
4532
4533			this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_' + this.visual.ID, null, {
4534				autoHide: true,
4535				offsetLeft: 0,
4536				offsetTop: 0,
4537				overlay : true,
4538				closeByEsc: true,
4539				titleBar: true,
4540				closeIcon: true,
4541				contentColor: 'white',
4542				className: this.templateTheme ? 'bx-' + this.templateTheme : ''
4543			});
4544		}
4545	};
4546})(window);
4547/* End */
4548;
4549; /* Start:"a:4:{s:4:"full";s:87:"/local/templates/gardenshop/components/nastart/block/news_tabs/script.js?17146848901002";s:6:"source";s:72:"/local/templates/gardenshop/components/nastart/block/news_tabs/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4550$(document).ready(function() {
4551    $('.tab-ajax-block').on('click','.tab-ajax-tab',function (event){
4552        event.preventDefault();
4553        var parent=event.delegateTarget;
4554        var elem=$(this);
4555        var data=elem.data();
4556        var currentSwiper=$(parent).find('.tab-ajax-content .swiper')[0].swiper;
4557        data.ajax='Y';
4558        $.ajax({
4559            url:     '/local/templates/gardenshop/components/nastart/block/news_tabs/ajax.php', // URL отправки запроса
4560            type:     "GET",
4561            data: data,
4562            dataType: "html",
4563        })
4564        .done(function(response) {
4565            console.log(elem.parent());
4566            elem.parent().find('.tab__link').removeClass('tab__link-active');
4567            elem.addClass('tab__link-active');
4568            $(parent).find('.tab-ajax-content .swiper-wrapper').html(response);
4569            currentSwiper.update();
4570        })
4571        .fail(function(response) {
4572            console.log('some fail');
4573        });
4574    })
4575});
4576/* End */
4577;
4578; /* Start:"a:4:{s:4:"full";s:87:"/local/templates/gardenshop/components/nastart/cookies/module/script.js?175005684011759";s:6:"source";s:71:"/local/templates/gardenshop/components/nastart/cookies/module/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4579(function (window) {
4580    'use strict';
4581
4582    if (window.JSCookiePopup)
4583        return;
4584
4585
4586    window.JSCookiePopup = function (arParams) {
4587        this.params = arParams;
4588        BX.ready(BX.delegate(this.init, this));
4589    }
4590
4591    window.JSCookiePopup.prototype = {
4592        init: function () {
4593
4594            const analyticHeadStrings = this.params.ANALYTIC_HEAD_STRINGS;
4595            const analyticFooterStrings = this.params.ANALYTIC_FOOTER_STRINGS;
4596
4597            const marketingHeadStrings = this.params.MARKETING_HEAD_STRINGS;
4598            const marketingFooterStrings = this.params.MARKETING_FOOTER_STRINGS;
4599
4600            const cookieModalPrimary = document.getElementById(this.params.VISUAL.cookieModalPrimary);
4601            const cookieModalSettings = document.getElementById(this.params.VISUAL.cookieModalSettings);
4602            const overlay = document.getElementById(this.params.VISUAL.overlay);
4603
4604            const settingsBtn = document.getElementById(this.params.VISUAL.settingsBtn);
4605            const acceptAllBtn = document.getElementById(this.params.VISUAL.acceptAll);
4606            const acceptAllPopupBtn = document.getElementById(this.params.VISUAL.acceptAllPopup);
4607            const cancelPrimaryBtn = document.getElementById(this.params.VISUAL.cancelPrimary);
4608            const closePrimaryBtn = document.getElementById(this.params.VISUAL.closePrimary);
4609
4610            const acceptSettingsBtn = document.getElementById(this.params.VISUAL.acceptSettings);
4611            const rejectSettingsBtn = document.getElementById(this.params.VISUAL.rejectSettings);
4612            const closeSettingsBtn = document.getElementById(this.params.VISUAL.closeSettings);
4613
4614            const analyticsCheckbox = document.getElementById(this.params.VISUAL.analytics);
4615            const marketingCheckbox = document.getElementById(this.params.VISUAL.marketing);
4616
4617            const cookieName = this.params.SETTINGS.cookieName;
4618
4619            const cookieLifetime = this.params.SETTINGS.lifeLimit;
4620            const cookieLifetimeMs = this.params.SETTINGS.lifeLimit * 24 * 60 * 60 * 1000;
4621
4622            function saveCookiePreferences(acceptAll = false) {
4623
4624                const preferences = {
4625                    technical: true,
4626                    analytics: acceptAll ? true : (analyticsCheckbox?.checked !== undefined ? analyticsCheckbox.checked : false),
4627                    marketing: acceptAll ? true : (marketingCheckbox?.checked !== undefined ? marketingCheckbox.checked : false),
4628                    time: Date.now().toString()
4629                };
4630
4631                const cookieAnalyticValue = getCookie("NASTART_ANALYTIC_COOKIES_ALLOWED");
4632
4633                if (preferences.analytics === true && (cookieAnalyticValue === null || cookieAnalyticValue !== "Y")) {
4634                    setCookie("NASTART_ANALYTIC_COOKIES_ALLOWED", "Y", cookieLifetime);
4635
4636                    if (analyticHeadStrings.length > 0) {
4637                        var targetNode = document.querySelector('head');
4638                        if (targetNode) {
4639                            analyticHeadStrings.forEach(singleString => {
4640                                insertHTMLWithScripts(singleString, targetNode);
4641                            });
4642                        }
4643                    }
4644
4645                    if (analyticFooterStrings.length > 0) {
4646                        var targetNode = document.querySelector('body');
4647                        if (targetNode) {
4648                            analyticFooterStrings.forEach(singleString => {
4649                                insertHTMLWithScripts(singleString, targetNode);
4650                            });
4651                        }
4652                    }
4653                }
4654
4655                const cookieMarketingValue = getCookie("NASTART_MARKETING_COOKIES_ALLOWED");
4656
4657                if (preferences.marketing === true && (cookieMarketingValue === null || cookieMarketingValue !== "Y")) {
4658                    setCookie("NASTART_MARKETING_COOKIES_ALLOWED", "Y", cookieLifetime);
4659
4660                    if (marketingHeadStrings.length > 0) {
4661                        var targetNode = document.querySelector('head');
4662                        if (targetNode) {
4663                            marketingHeadStrings.forEach(singleString => {
4664                                insertHTMLWithScripts(singleString, targetNode);
4665                            });
4666                        }
4667                    }
4668
4669                    if (marketingFooterStrings.length > 0) {
4670                        var targetNode = document.querySelector('body');
4671                        if (targetNode) {
4672                            marketingFooterStrings.forEach(singleString => {
4673                                insertHTMLWithScripts(singleString, targetNode);
4674                            });
4675                        }
4676                    }
4677                }
4678
4679                BX.ajax.runComponentAction("nastart:cookies", "addCookie", {
4680                    mode: "class",
4681                    data: {
4682                        preferences: preferences,
4683                        datetime: Date.now().toString()
4684                    }
4685                }).then(function (response) {
4686                    if (response.status == "success") {
4687                        setCookie(cookieName, JSON.stringify(preferences), cookieLifetime);
4688                    }
4689                }, function (response) {
4690                });
4691
4692                return preferences;
4693            }
4694
4695            function insertHTMLWithScripts(htmlString, targetElement) {
4696                // Создаём временный контейнер
4697                const temp = document.createElement('div');
4698                temp.innerHTML = htmlString;
4699
4700                // Обрабатываем скрипты
4701                const scripts = temp.querySelectorAll('script');
4702                scripts.forEach(oldScript => {
4703                    // Создаём новый скрипт
4704                    const newScript = document.createElement('script');
4705
4706                    // Копируем атрибуты
4707                    Array.from(oldScript.attributes).forEach(attr => {
4708                        newScript.setAttribute(attr.name, attr.value);
4709                    });
4710
4711                    // Переносим содержимое (для inline-скриптов)
4712                    if (!oldScript.src) {
4713                        newScript.textContent = oldScript.textContent;
4714                    }
4715
4716                    // Заменяем старый скрипт в контейнере
4717                    oldScript.replaceWith(newScript);
4718                });
4719
4720                // Вставляем обработанное содержимое в документ
4721                targetElement.append(...temp.childNodes);
4722            }
4723
4724            function setCookie(name, value, days, path = "/") {
4725                const expires = new Date();
4726                expires.setDate(expires.getDate() + days);
4727
4728                const cookie = [
4729                    `${encodeURIComponent(name)}=${encodeURIComponent(value)}`,
4730                    `expires=${expires.toUTCString()}`,
4731                    `path=${path}`
4732                ];
4733
4734                document.cookie = cookie.join("; ");
4735            }
4736
4737            function getCookie(name) {
4738                const cookies = document.cookie.split(';');
4739                for (let i = 0; i < cookies.length; i++) {
4740                    const cookie = cookies[i].trim();
4741                    if (cookie.startsWith(name + '=')) {
4742                        return decodeURIComponent(cookie.substring(name.length + 1));
4743                    }
4744                }
4745                return null;
4746            }
4747
4748
4749            setTimeout(() => {
4750                var savedPreferences = getCookie(cookieName);
4751                
4752                if (!savedPreferences) {
4753                    cookieModalPrimary.classList.add('show');
4754                }
4755            }, this.params.SETTINGS.delay);
4756
4757            // Open settings modal
4758            settingsBtn.addEventListener('click', function () {
4759                cookieModalPrimary.classList.remove('show');
4760                setTimeout(() => {
4761                    overlay.classList.add('show');
4762                    cookieModalSettings.classList.add('show');
4763                }, 300);
4764            });
4765
4766            function closeSettingsModal() {
4767                cookieModalSettings.classList.remove('show');
4768                overlay.classList.remove('show');
4769            }
4770
4771            acceptAllBtn.addEventListener('click', function () {
4772                saveCookiePreferences(true);
4773                cookieModalPrimary.classList.remove('show');
4774            });
4775
4776            acceptAllPopupBtn.addEventListener('click', function () {
4777                saveCookiePreferences(true);
4778                closeSettingsModal();
4779            });
4780
4781            if (cancelPrimaryBtn) {
4782                cancelPrimaryBtn.addEventListener('click', function () {
4783                    analyticsCheckbox.checked = false;
4784                    marketingCheckbox.checked = false;
4785                    saveCookiePreferences(false);
4786                    cookieModalPrimary.classList.remove('show');
4787                });
4788            }
4789
4790            closePrimaryBtn.addEventListener('click', function () {
4791                cookieModalPrimary.classList.remove('show');
4792            });
4793
4794
4795            acceptSettingsBtn.addEventListener('click', function () {
4796                saveCookiePreferences();
4797                closeSettingsModal();
4798            });
4799
4800            rejectSettingsBtn.addEventListener('click', function () {
4801                analyticsCheckbox.checked = false;
4802                marketingCheckbox.checked = false;
4803                saveCookiePreferences(false);
4804                closeSettingsModal();
4805            });
4806
4807            closeSettingsBtn.addEventListener('click', function () {
4808                closeSettingsModal();
4809            });
4810
4811            overlay.addEventListener('click', function () {
4812                if (
4813                    cookieModalPrimary.classList.contains('show') &&
4814                    !cookieModalSettings.classList.contains('show')
4815                ) {
4816                    cookieModalPrimary.classList.remove('show')
4817                    overlay.classList.remove('show')
4818                }
4819            });
4820
4821            const accordions = cookieModalSettings.querySelectorAll('.cookie-accordion');
4822
4823            accordions.forEach(accordion => {
4824                accordion.addEventListener('click', function () {
4825                    const container = this.closest('.cookie-checkbox-container');
4826                    this.classList.toggle('active');
4827                    const description = container.querySelector('.cookie-type-desc');
4828                    console.log(container)
4829
4830                    description.classList.toggle('open');
4831                });
4832            });
4833
4834            const titles = cookieModalSettings.querySelectorAll('.cookie-type-title');
4835            titles.forEach(title => {
4836                title.addEventListener('click', function (e) {
4837                    e.preventDefault();
4838
4839                    // Находим аккордеон в том же контейнере и кликаем по нему
4840                    const container = this.closest('.cookie-checkbox-container');
4841                    const accordion = container.querySelector('.cookie-accordion');
4842                    accordion.click();
4843                });
4844            });
4845        }
4846    };
4847
4848})(window);
4849
4850
4851/* End */
4852;; /* /local/templates/gardenshop/lib/fancybox/fancybox.umd.js?1714684890105639*/
4853; /* /local/templates/gardenshop/lib/rSlider/rSlider.min.js?17146848909638*/
4854; /* /local/templates/gardenshop/lib/vanilla-calendar/vanilla-calendar.min.js?171468489045010*/
4855; /* /local/templates/gardenshop/js/main.js?177642696039419*/
4856; /* /local/templates/gardenshop/components/nastart/regions.choose/gardenshop/script.js?17146848909289*/
4857; /* /bitrix/components/bitrix/search.title/script.min.js?17863623516573*/
4858; /* /local/templates/gardenshop/components/bitrix/catalog.compare.list/gardenshop/script.js?17146848903197*/
4859; /* /local/templates/gardenshop/components/bitrix/sale.basket.basket.line/basket_count/script.min.js?17146848903876*/
4860; /* /local/templates/gardenshop/components/bitrix/catalog.section/gardenshop/script.js?171468489010902*/
4861; /* /local/templates/gardenshop/components/bitrix/catalog.item/gardenshop/script.js?171468489053481*/
4862; /* /local/templates/gardenshop/components/nastart/block/news_tabs/script.js?17146848901002*/
4863; /* /local/templates/gardenshop/components/nastart/cookies/module/script.js?175005684011759*/
4864
4865//# sourceMappingURL=template_93d1d32123239590d62e228de564a279.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.