(()=>{"use strict";var e={857:e=>{var t=function(e){var t;return!!e&&"object"==typeof e&&"[object RegExp]"!==(t=Object.prototype.toString.call(e))&&"[object Date]"!==t&&e.$$typeof!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function s(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a(Array.isArray(e)?[]:{},e,t):e}function n(e,t,r){return e.concat(t).map(function(e){return s(e,r)})}function i(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[])}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,r,c){(c=c||{}).arrayMerge=c.arrayMerge||n,c.isMergeableObject=c.isMergeableObject||t,c.cloneUnlessOtherwiseSpecified=s;var l,u,d=Array.isArray(r);return d!==Array.isArray(e)?s(r,c):d?c.arrayMerge(e,r,c):(u={},(l=c).isMergeableObject(e)&&i(e).forEach(function(t){u[t]=s(e[t],l)}),i(r).forEach(function(t){(!o(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(o(e,t)&&l.isMergeableObject(r[t])?u[t]=(function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a})(t,l)(e[t],r[t],l):u[t]=s(r[t],l))}),u)}a.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,r){return a(e,r,t)},{})},e.exports=a}},t={};function r(s){var n=t[s];if(void 0!==n)return n.exports;var i=t[s]={exports:{}};return e[s](i,i.exports,r),i.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{var e=r(857);class t{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,r){let s=t.toUpperCamelCase(e,r);return t.lcFirst(s)}static toUpperCamelCase(e,r){return r?e.split(r).map(e=>t.ucFirst(e.toLowerCase())).join(""):t.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}class s{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,t){if(!s.isNode(e))throw Error("The element must be a valid HTML Node!");return"function"==typeof e.hasAttribute&&e.hasAttribute(t)}static getAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!1===s.hasAttribute(e,t))throw Error('The required property "'.concat(t,'" does not exist!'));if("function"!=typeof e.getAttribute){if(r)throw Error("This node doesn't support the getAttribute function!");return}return e.getAttribute(t)}static getDataAttribute(e,r){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=r.replace(/^data(|-)/,""),o=t.toLowerCamelCase(i,"-");if(!s.isNode(e)){if(n)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===e.dataset){if(n)throw Error("This node doesn't support the dataset attribute!");return}let a=e.dataset[o];if(void 0===a){if(n)throw Error('The required data attribute "'.concat(r,'" does not exist on ').concat(e,"!"));return a}return t.parsePrimitive(a)}static querySelector(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!s.isNode(e))throw Error("The parent node is not a valid HTML Node!");let n=e.querySelector(t)||!1;if(r&&!1===n)throw Error('The required element "'.concat(t,'" does not exist in parent node!'));return n}static querySelectorAll(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!s.isNode(e))throw Error("The parent node is not a valid HTML Node!");let n=e.querySelectorAll(t);if(0===n.length&&(n=!1),r&&!1===n)throw Error('At least one item of "'.concat(t,'" must exist in parent node!'));return n}}class n{publish(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=new CustomEvent(e,{detail:t,cancelable:r});return this.el.dispatchEvent(s),s}subscribe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=this,n=e.split("."),i=r.scope?t.bind(r.scope):t;if(r.once&&!0===r.once){let t=i;i=function(r){s.unsubscribe(e),t(r)}}return this.el.addEventListener(n[0],i),this.listeners.push({splitEventName:n,opts:r,cb:i}),!0}unsubscribe(e){let t=e.split(".");return this.listeners=this.listeners.reduce((e,r)=>([...r.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):e.push(r),e),[]),!0}reset(){return this.listeners.forEach(e=>{this.el.removeEventListener(e.splitEventName[0],e.cb)}),this.listeners=[],!0}get el(){return this._el}set el(e){this._el=e}get listeners(){return this._listeners}set listeners(e){this._listeners=e}constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}}class i{static isSupported(){return"undefined"!==document.cookie}static setItem(e,t,r){if(null==e)throw Error("You must specify a key to set a cookie");let s=new Date;s.setTime(s.getTime()+864e5*r);let n="";"https:"===location.protocol&&(n="secure"),document.cookie="".concat(e,"=").concat(t,";expires=").concat(s.toUTCString(),";path=/;sameSite=lax;").concat(n)}static getItem(e){if(!e)return!1;let t=e+"=",r=document.cookie.split(";");for(let e=0;e<r.length;e++){let s=r[e];for(;" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return!1}static removeItem(e){document.cookie="".concat(e,"= ; expires = Thu, 01 Jan 1970 00:00:00 GMT;path=/")}static key(){return""}static clear(){}}class o{static isTouchDevice(){return"ontouchstart"in document.documentElement}static isIOSDevice(){return o.isIPhoneDevice()||o.isIPadDevice()}static isNativeWindowsBrowser(){return o.isIEBrowser()||o.isEdgeBrowser()}static isIPhoneDevice(){return!!navigator.userAgent.match(/iPhone/i)}static isIPadDevice(){return!!navigator.userAgent.match(/iPad/i)}static isIEBrowser(){return -1!==navigator.userAgent.toLowerCase().indexOf("msie")||!!navigator.userAgent.match(/Trident.*rv:\d+\./)}static isEdgeBrowser(){return!!navigator.userAgent.match(/Edge\/\d+/i)}static getList(){return{"is-touch":o.isTouchDevice(),"is-ios":o.isIOSDevice(),"is-native-windows":o.isNativeWindowsBrowser(),"is-iphone":o.isIPhoneDevice(),"is-ipad":o.isIPadDevice(),"is-ie":o.isIEBrowser(),"is-edge":o.isEdgeBrowser()}}}class a{static iterate(e,t){if(e instanceof Map||Array.isArray(e))return e.forEach(t);if(e instanceof FormData){for(var r of e.entries())t(r[1],r[0]);return}if(e instanceof NodeList)return e.forEach(t);if(e instanceof HTMLCollection)return Array.from(e).forEach(t);if(e instanceof Object)return Object.keys(e).forEach(r=>{t(e[r],r)});throw Error("The element type ".concat(typeof e," is not iterable!"))}}let c="offcanvas";class l{open(e,t,r,s,n,i,o){this._removeExistingOffCanvas();let a=this._createOffCanvas(r,i,o,s);this.setContent(e,s,n),this._openOffcanvas(a,t)}setContent(e,t){let r=this.getOffCanvas();r[0]&&(r[0].innerHTML=e,this._registerEvents(t))}setAdditionalClassName(e){this.getOffCanvas()[0].classList.add(e)}getOffCanvas(){return document.querySelectorAll(".".concat(c))}close(e){let t=this.getOffCanvas();a.iterate(t,e=>{bootstrap.Offcanvas.getInstance(e).hide()}),setTimeout(()=>{this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:t})},e)}goBackInHistory(){window.history.back()}exists(){return this.getOffCanvas().length>0}_openOffcanvas(e,t){l.bsOffcanvas.show(),window.history.pushState("offcanvas-open",""),"function"==typeof t&&t()}_registerEvents(e){let t=o.isTouchDevice()?"touchend":"click",r=this.getOffCanvas();a.iterate(r,t=>{let s=()=>{setTimeout(()=>{t.remove(),this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:r})},e),t.removeEventListener("hide.bs.offcanvas",s)};t.addEventListener("hide.bs.offcanvas",s)}),window.addEventListener("popstate",this.close.bind(this,e),{once:!0});let s=document.querySelectorAll(".".concat("js-offcanvas-close"));a.iterate(s,r=>r.addEventListener(t,this.close.bind(this,e)))}_removeExistingOffCanvas(){l.bsOffcanvas=null;let e=this.getOffCanvas();return a.iterate(e,e=>e.remove())}_getPositionClass(e){return"left"===e?"offcanvas-start":"right"===e?"offcanvas-end":"offcanvas-".concat(e)}_createOffCanvas(e,t,r,s){let n=document.createElement("div");if(n.classList.add(c),n.classList.add(this._getPositionClass(e)),!0===t&&n.classList.add("is-fullwidth"),r){let e=typeof r;if("string"===e)n.classList.add(r);else if(Array.isArray(r))r.forEach(e=>{n.classList.add(e)});else throw Error('The type "'.concat(e,'" is not supported. Please pass an array or a string.'))}return document.body.appendChild(n),l.bsOffcanvas=new bootstrap.Offcanvas(n,{backdrop:!1!==s||"static"}),n}constructor(){this.$emitter=new n}}let u=Object.freeze(new l);class d{static open(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left",s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";u.open(e,t,r,s,n,i,o)}static setContent(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:350;u.setContent(e,t,r)}static setAdditionalClassName(e){u.setAdditionalClassName(e)}static close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;u.close(e)}static exists(){return u.exists()}static getOffCanvas(){return u.getOffCanvas()}static REMOVE_OFF_CANVAS_DELAY(){return 350}}class h{get(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",s=this._createPreparedRequest("GET",e,r);return this._sendRequest(s,null,t)}post(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";s=this._getContentType(t,s);let n=this._createPreparedRequest("POST",e,s);return this._sendRequest(n,t,r)}delete(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";s=this._getContentType(t,s);let n=this._createPreparedRequest("DELETE",e,s);return this._sendRequest(n,t,r)}patch(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";s=this._getContentType(t,s);let n=this._createPreparedRequest("PATCH",e,s);return this._sendRequest(n,t,r)}abort(){if(this._request)return this._request.abort()}_registerOnLoaded(e,t){t&&e.addEventListener("loadend",()=>{t(e.responseText,e)})}_sendRequest(e,t,r){return this._registerOnLoaded(e,r),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,r){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&this._request.setRequestHeader("Content-type",r),this._request}constructor(){this._request=null}}let f="loader",p={BEFORE:"before",INNER:"inner"};class v{create(){if(!this.exists()){if(this.position===p.INNER){this.parent.innerHTML=v.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),v.getTemplate())}}remove(){let e=this.parent.querySelectorAll(".".concat(f));a.iterate(e,e=>e.remove())}exists(){return this.parent.querySelectorAll(".".concat(f)).length>0}_getPosition(){return this.position===p.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return'<div class="'.concat(f,'" role="status">\n                    <span class="').concat("visually-hidden",'">Loading...</span>\n                </div>')}static SELECTOR_CLASS(){return f}constructor(e,t=p.BEFORE){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}}let g=null;class m extends d{static open(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"left",n=!(arguments.length>4)||void 0===arguments[4]||arguments[4],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:d.REMOVE_OFF_CANVAS_DELAY(),o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"";if(!e)throw Error("A url must be given!");u._removeExistingOffCanvas();let c=u._createOffCanvas(s,o,a,n);this.setContent(e,t,r,n,i),u._openOffcanvas(c)}static setContent(e,t,r,s,n){let i=new h;super.setContent('<div class="offcanvas-body">'.concat(v.getTemplate(),"</div>"),s,n),g&&g.abort();let o=e=>{super.setContent(e,s,n),"function"==typeof r&&r(e)};g=t?i.post(e,t,m.executeCallback.bind(this,o)):i.get(e,m.executeCallback.bind(this,o))}static executeCallback(e,t){"function"==typeof e&&e(t),window.PluginManager.initializePlugins()}}let b="element-loader-backdrop";class y extends v{static create(e){e.classList.add("has-element-loader"),y.exists(e)||(y.appendLoader(e),setTimeout(()=>{let t=e.querySelector(".".concat(b));t&&t.classList.add("element-loader-backdrop-open")},1))}static remove(e){e.classList.remove("has-element-loader");let t=e.querySelector(".".concat(b));t&&t.remove()}static exists(e){return e.querySelectorAll(".".concat(b)).length>0}static getTemplate(){return'\n        <div class="'.concat(b,'">\n            <div class="loader" role="status">\n                <span class="').concat("visually-hidden",'">Loading...</span>\n            </div>\n        </div>\n        ')}static appendLoader(e){e.insertAdjacentHTML("beforeend",y.getTemplate())}}window.router["frontend.cookie.offcanvas"];class w extends window.PluginBaseClass{init(){let e=this;document.$emitter.subscribe("CookieConfiguration_Update",function(e){let t=e.detail;for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&void 0!==window.dataLayer&&Array.isArray(window.dataLayer)&&(t[e]?window.dataLayer.push({event:"enableCookie",name:e}):window.dataLayer.push({event:"disableCookie",name:e}))});let{acceptButtonSelector:t,acceptButtonLoadingIndicatorSelector:r,cookiePreference:s}=this.options,n=document.querySelector(t+":not(.disabled)");n&&n.addEventListener("click",function(){let t=window.PluginManager.getPluginInstances("CookieConfiguration")[0],n=this.querySelector("button");n.classList.add("disabled");let o=n.querySelector(r);o.innerHTML='<span class="offcanvas-content-container">'.concat(v.getTemplate(),"</span>");let a=window.router["frontend.cookie.offcanvas"];new h(window.accessKey,window.contextToken).get(a,function(r){let a=document.createElement("div");a.innerHTML=r,e._setInitialState(a,t);let c=e._getCookies(a,t,"all"),l=[];c.forEach(function(e){let{cookie:t,value:r,expiration:s}=e;l.push(t),t&&r&&i.setItem(t,r,s)}),i.setItem(s,"1","30"),t._handleUpdateListener(l,[]),n.classList.remove("disabled"),o.innerHTML="",t._hideCookieBar(),1===window.COOKIE_ACCEPT_RELOAD&&location.reload()})})}_setInitialState(e,t){let r=this._getCookies(e,t,"all"),s=[],n=[];r.forEach(function(e){let{cookie:t,required:r}=e;i.getItem(t)||r?s.push(t):n.push(t)}),t.lastState={active:s,inactive:n},s.forEach(function(r){let s=e.querySelector('[data-cookie="'.concat(r,'"]'));s&&(s.checked=!0,t._childCheckboxEvent(s))})}_getCookies(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",{cookieSelector:s}=this.options;return Array.from(e.querySelectorAll(s)).filter(e=>{switch(r){case"all":return!0;case"active":return t._isChecked(e);case"inactive":return!t._isChecked(e);default:return!1}}).map(e=>{let{cookie:t,cookieValue:r,cookieExpiration:s,cookieRequired:n}=e.dataset;return{cookie:t,value:r,expiration:s,required:n}})}}w.options={acceptButtonSelector:".js-cookie-accept-button",acceptButtonLoadingIndicatorSelector:".js-cookie-accept-button-loading-indicator",cookieSelector:"[data-cookie]",cookiePreference:"cookie-preference"},window.PluginManager.register("JkwebShopwareCookieAcceptPlugin",w)})()})();