(()=>{var e={9:(e,t)=>{"use strict";t.__esModule=!0,t.default=function(e,t){null==i[e]&&(i[e]=new n(e)),i[e].trackAction(t)};class n{constructor(e,t=5e3){this.serviceUrl=e,this.batchInterval=t,this.eventQueue=[],this.timer=null,this.isSubmitting=!1,window.addEventListener("beforeunload",this.handlePageUnload.bind(this))}trackAction(e){const t={...e,timestamp:(new Date).toISOString()};this.eventQueue.push(t),this.timer||(this.timer=setTimeout((()=>this.submitEvents()),this.batchInterval))}async submitEvents(){if(0===this.eventQueue.length||this.isSubmitting)return;this.isSubmitting=!0;const e=[...this.eventQueue];this.eventQueue=[];try{const t=new Blob([JSON.stringify(e)],{type:"text/plain"});navigator.sendBeacon(this.serviceUrl,t)}catch(t){this.eventQueue=[...e,...this.eventQueue]}finally{this.isSubmitting=!1,this.timer=null,this.eventQueue.length>0&&(this.timer=setTimeout((()=>this.submitEvents()),this.batchInterval))}}handlePageUnload(){if(this.eventQueue.length>0){const e=new Blob([JSON.stringify(this.eventQueue)],{type:"text/plain"});this.eventQueue=[],navigator.sendBeacon(this.serviceUrl,e)}}}const i={};e.exports=t.default},12:e=>{"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return e.apply(t,n)}}},15:(e,t,n)=>{"use strict";var i=n(516),s=n(12),o=n(155),a=n(343);function r(e){var t=new o(e),n=s(o.prototype.request,t);return i.extend(n,o.prototype,t),i.extend(n,t),n}var c=r(n(987));c.Axios=o,c.create=function(e){return r(a(c.defaults,e))},c.Cancel=n(928),c.CancelToken=n(191),c.isCancel=n(864),c.all=function(e){return Promise.all(e)},c.spread=n(980),e.exports=c,e.exports.default=c},18:(e,t,n)=>{"use strict";var i=n(516);e.exports=function(e,t){i.forEach(e,(function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])}))}},23:(e,t)=>{"use strict";t.__esModule=!0,t.default=void 0;let n=null;if("undefined"!=typeof document){const e=document.currentScript;e&&e.src&&(n=e.src.substr(0,e.src.indexOf("runtime/client")))}else n="//api.customizer.drivecommerce.com/api/v4/";t.default=class{constructor(){this.endpoint=this.constructor.captureApiEndpoint(),null==this.endpoint&&(this.endpoint="//api.customizer.drivecommerce.com/api/v4/"),this.endpoint=this.constructor.prepareEndpoint(this.endpoint)}static captureApiEndpoint(){return n}static prepareEndpoint(e){let t=e;return"/"!==t.substr(-1)&&(t+="/"),"//"===t.substr(0,2)&&(t="undefined"!=typeof window?window.location.protocol+t:"https:"+t),t}},e.exports=t.default},24:(e,t,n)=>{"use strict";var i=n(709);t.__esModule=!0,t.default=void 0;var s=i(n(505)),o=i(n(23)),a=i(n(181)),r=i(n(983)),c=i(n(37)),l=i(n(497)),u=i(n(152)),h=i(n(468)),m=i(n(66));"undefined"==typeof window&&(s.default.defaults.adapter=require("axios/lib/adapters/http")),t.default={Controller:a.default,UndoStack:r.default,ImageCache:u.default,ImageButton:h.default,ImageView:c.default,LayeredImageView:l.default,CachedImage:m.default,Configuration:o.default},e.exports=t.default},37:(e,t,n)=>{"use strict";var i=n(709);t.__esModule=!0,t.default=void 0;var s=i(n(851));t.default=class{constructor(e,t){(0,s.default)(this),this.settings={controller:e,animationFrameExposure:30,imageAllowEmptyWhileLoading:!0,imageAnimateOnFrameChange:!0,imageAnimateOnSimilarViewChange:!0,imageSimilarViewChangeSnapIfNotLoaded:!1,highlightPlacements:!0,selectPlacements:!0,filterView:null,beforePlacement:null,afterPlacement:null,baseWidth:null,baseHeight:null,preloadViews:!0,...t},this.loading="done",this.controller=this.settings.controller,this.container=this.settings.container,this.blueprint=null,this.view=null,this.state=null,this.stateHash=null,this.frame=null,this.frames={},this.targetView=null,this.targetFrame=null,this.animating=!1,this.displayView=null,this.displayFrame=null,this.displayLoaded=!1,this.displayExposure=(new Date).getTime(),this.highlightView=null,this.highlightFrame=null,this.highlightImages=[],this.selectImages=[],this.highlightsLoaded=!1,this.displayHighlightsLoaded=!1,this.lastHighlight=null,this.lastSelect=null,this.hiddenPlacements=null,this.updateFrameOptions();const n=(new DOMParser).parseFromString('<div class="cz__render"><canvas class="cz__surface cz__surface--main"></canvas></div>',"text/html").documentElement.querySelector(".cz__render");this.container.insertAdjacentElement("beforeend",n),this.resize(),this.containerEvents={mousedown:e=>this.onMouseDown(e),mouseleave:e=>this.onMouseLeave(e),mousemove:e=>this.onMouseMove(e),click:e=>this.onClick(e),keydown:e=>this.onKeyDown(e)},Object.keys(this.containerEvents).forEach((e=>{this.container.addEventListener(e,this.containerEvents[e])})),this.controllerEvents={afterInitializeBlueprint:e=>this.onAfterInitializeBlueprint(e),stateChanged:e=>this.onStateChanged(e),repaint:e=>this.onRepaint(e)},Object.keys(this.controllerEvents).forEach((e=>{this.controller.on(e,this.controllerEvents[e])})),this.blueprint=this.controller.blueprint,this.ticker=setTimeout((()=>this.tick()),10)}resize(){const e=this.container.querySelector(".cz__render"),t=e.clientWidth,n=e.clientHeight,i=this.backingScale();Array.from(this.container.querySelectorAll("canvas")).forEach((e=>{e.width=t*i,e.height=n*i,e.style.width=t+"px",e.style.height=n+"px"})),this.rerender()}destroy(){this.ticker&&clearTimeout(this.ticker),Object.keys(this.controllerEvents).forEach((e=>{this.controller.off(e,this.controllerEvents[e])})),Object.keys(this.containerEvents).forEach((e=>{this.container.removeEventListener(e,this.containerEvents[e])}));const e=this.container.querySelector(".cz__render");e&&e.parentNode&&e.parentNode.removeChild(e)}selectViewByCode(e){if(!this.blueprint)return null;const t=(this.blueprint.views||[]).find((t=>t.code===e));return t&&this.updateView(t,t.frameLow),t}selectViewByCodeWithOptions(e,t){if(!this.blueprint)return null;this.updateFrameOptions(t);const n=(this.blueprint.views||[]).find((t=>t.code===e));return n&&this.updateView(n,n.frameLow),n}selectedView(){return this.targetView||this.view}selectedFrame(){return this.targetFrame||this.frame}updateView(e,t){if(!this.blueprint)return;const{state:n}=this.controller,i=this.calculateStateHash(n);if(this.animating=!1,this.view===e)this.stateHash===i?this.frame===t||(this.targetView=e,this.targetFrame=t,this.updateHighlights(this.targetView,this.targetFrame),this.displayLoaded=!1):(this.targetView=e,this.targetFrame=t,this.updateHighlights(this.targetView,this.targetFrame),this.displayLoaded=!1,this.loadState(e,n));else{const s=this.transformChanged(this.view||this.targetView,e),o=this.formatChanged(this.view||this.targetView,e);if(this.targetView=e,this.targetFrame=t,this.updateHighlights(this.targetView,this.targetFrame),this.displayLoaded=!1,this.stateHash!==i||s||o)this.loadState(e,n);else if(this.targetView){let e=null;if("Single"===this.targetView.viewType&&(e=this.targetView.frameLow),"Range"===this.targetView.viewType&&({targetFrame:e}=this),null!=e){let t=null,n=null;Object.entries(this.frames).forEach((([i,s])=>{s.target&&(t=s),+i===e&&(n=s)})),t&&(t.target=!1),n&&(n.target=!0)}}}}reloadCurrentFrame(){if(null!=this.view&&null!=this.state&&null!=this.frame){const{view:e}=this;"Single"===e.viewType&&this.frames[this.frame]&&(this.frames[this.frame]=this.loadImage(this.controller.makeFrameUrl(e,this.state,this.frame,this.frameOptions),this.frames[this.frame].target,e),this.frames[this.frame].redrawWhenDone=!0)}}repaint(){this.repaintDebounceTimer&&clearTimeout(this.repaintDebounceTimer),null==this.repaintDebounced&&(this.repaintDebounced=()=>{this.repaintDebounce()}),this.repaintDebounceTimer=setTimeout(this.repaintDebounced)}repaintDebounce(){null!=this.view&&(null==this.targetView&&(this.targetView=this.view),this.loadState(this.view,this.state,!0))}rerender(){this.displayView&&this.render(this.displayView,this.displayFrame,!0)}setHiddenPlacements(e){this.hiddenPlacements=e,this.updateFrameOptions()}selectPlacements(e,t){const n=e||[];let i=!1;const s=[];let o;if(this.lastHighlight&&(this.fadeOutOverlay(this.lastHighlight),this.lastHighlight=null,this.container.classList.removeClass("cz-over-highlight")),null!=this.lastSelect)for(let e=0;e<this.lastSelect.length;){if(!this.lastSelect[e].customizer){e+=1;continue}const t=this.lastSelect[e].customizer.image;let a=!1;if(t&&(o=t.placement,o))for(let e=0;e<n.length;e+=1){const t=n[e];if("string"==typeof t){if(o.placement.code===t||o.placement.name===t){a=!0;break}}else if(t.placement.code){if(t.placement.code===o.placement.code){a=!0;break}}else if(t.placement.name===o.placement.name){a=!0;break}}a?(e+=1,s.push(o)):(this.fadeOutOverlay(this.lastSelect[e]),this.lastSelect.splice(e,1),i=!0)}const a=Array.from(this.container.querySelectorAll(".cz__surface-overlay"));for(let e=0;e<n.length;e+=1){const t=n[e];if(s.indexOf(t)<0)for(let e=a.length-1;e>=0;e-=1){const n=a[e];if(!n.customizer)continue;if("select"!==n.customizer.overlayType)continue;o=n.customizer.image.placement;let r=!1;r="string"==typeof t?o.placement.code===t||o.placement.name===t:t.placement.code?o.placement.code===t.placement.code:o.placement.name===t.placement.name,r&&(this.fadeInOverlay(n),this.lastSelect||(this.lastSelect=[]),this.lastSelect.push(n),i=!0,s.push(o))}}i&&!t&&this.emit("select",{placements:s})}render(e,t,n){let i=n;this.displayView!==e&&(i=!0),this.displayFrame!==t&&(i=!0);let s=!1,o=null;if(o=this.frames[t]||{},s=o.ready,this.displayLoaded!==s&&(i=!0),i){let n=null;if(s){const e=this.container.querySelector(".cz__surface--main");if(e){const t=e.width,i=e.height,s=e.getContext("2d");s.clearRect(0,0,t,i);const a=this.backingScale();if(!o.error){const e=o.image.width,r=o.image.height;let c=e*a,l=r*a;c>t&&(l=l*(t/c)|0,c=t),l>i&&(c=c*(i/l)|0,l=i);const u=(t-c)/2|0,h=(i-l)/2|0;s.drawImage(o.image,0,0,e,r,u,h,c,l),n={scale:this.backingScale(),sourceWidth:e,sourceHeight:r,targetLeft:u,targetTop:h,targetWidth:c,targetHeight:l}}}}this.displayView=e,this.displayFrame=t,this.displayLoaded=s,this.displayExposure=(new Date).getTime(),this.renderOverlays(),this.emit("rendered",n)}}updateFrameOptions(e){e&&(this.settings.beforePlacement=e.beforePlacement,this.settings.afterPlacement=e.afterPlacement,this.settings.baseWidth=e.baseWidth,this.settings.baseHeight=e.baseHeight),this.frameOptions={},this.settings.baseWidth&&this.settings.baseHeight&&(this.frameOptions.baseWidth=this.settings.baseWidth,this.frameOptions.baseHeight=this.settings.baseHeight),this.settings.afterPlacement&&(this.frameOptions.afterPlacement=this.settings.afterPlacement),this.settings.beforePlacement&&(this.frameOptions.beforePlacement=this.settings.beforePlacement),this.hiddenPlacements&&(this.frameOptions.hiddenPlacements=this.hiddenPlacements)}controller(){return this.settings.controller}adoptController(e){Object.keys(this.controllerEvents).forEach((e=>{this.controller.off(e,this.controllerEvents[e])})),this.controller=e,Object.keys(this.controllerEvents).forEach((e=>{this.controller.off(e,this.controllerEvents[e])})),Object.keys(this.controllerEvents).forEach((e=>{this.controller.on(e,this.controllerEvents[e])})),this.view=null,this.frame=null,this.frames={},this.stateHash=null}updateBlueprint(e){this.blueprint!==e&&(this.blueprint=e,this.view=null,this.state=null,this.frame=null)}loadIfNotYet(e,t,n,i){for(let t=0;t<n.length;t+=1)if(n[t].url===e)return n[t];const s=this.loadImage(e,t,i);return n.push(s),s}abortNotValidated(e,t){for(let n=0;n<e.length;)t.indexOf(e[n])<0?(e[n].abort(),e.splice(n,1)):n+=1}checkHighlightsLoaded(){let e=!0;for(let t=0;t<this.highlightImages.length;t+=1)if(!this.highlightImages[t].ready){e=!1;break}if(e)for(let t=0;t<this.selectImages.length;t+=1)if(!this.selectImages[t].ready){e=!1;break}e&&(this.highlightsLoaded=!0,this.rerender())}updateHighlights(e,t){if((this.settings.highlightPlacements||this.settings.selectPlacements)&&(this.highlightView!==e||this.highlightFrame!==t)){this.highlightView=e,this.highlightFrame=t,this.highlightsLoaded=!1,this.displayHighlightsLoaded=!1;const{state:n}=this.controller,i=[],s=[];for(let t=0;t<n.length;t+=1){const o=n[t];if(e.placements){const t=e.placements.find((e=>e.code===o.placement.code));if(t&&t.hidden)continue}if(o.placement&&o.placement.custom&&("yes"===o.placement.custom.highlight||"true"===o.placement.custom.highlight)&&o.component&&o.component.code){if(this.settings.highlightPlacements){const e=this.controller.makeComponentUrl(this.highlightView,n,this.highlightFrame,o.component.code,"highlight",!0),t=this.loadIfNotYet(e,!1,this.highlightImages,this.highlightView);t.redrawWhenDone=()=>{this.checkHighlightsLoaded()},t.placement=o,i.push(t)}if(this.settings.selectPlacements){const e=this.controller.makeComponentUrl(this.highlightView,n,this.highlightFrame,o.component.code,"select",!0),t=this.loadIfNotYet(e,!1,this.selectImages,this.highlightView);t.redrawWhenDone=()=>{this.checkHighlightsLoaded()},t.placement=o,s.push(t)}}}this.abortNotValidated(this.highlightImages,i),this.abortNotValidated(this.selectImages,s)}}loadState(e,t,n){this.stateHash=this.calculateStateHash(t),this.state=t,Object.entries(this.frames).forEach((([e,t])=>{t.abort&&t.abort()}));const i=this.frames;this.frames={},this.loadStateView(e,this.state,!0,n,i),this.settings.preloadViews&&this.blueprint.views.forEach((t=>{if(e!==t){if(t.productionReady)return;this.settings.filterView&&!this.settings.filterView(t)||this.loadStateView(t,this.state,null,null,i)}}))}loadStateView(e,t,n,i,s){if(!e)return;if(!t)return;let o=null==this.frame?this.targetFrame:this.frame;if(null==o&&(o=e.frameLow),"Single"===e.viewType){const a="number"==typeof e.frameLow?e.frameLow:0;o!==a&&(o=a),this.frames[o]||(this.frames[o]=this.loadImage(this.controller.makeFrameUrl(e,t,o,this.frameOptions),n,e,s&&s[o]),i&&n&&(this.frames[o].redrawWhenDone=!0))}if("Range"===e.viewType){const a=e.frameLow,r=e.frameHigh;let c,l;if(o<a&&(o=a),o>r&&(o=r),null!=this.targetFrame&&this.targetFrame>=a&&this.targetFrame<=r){if(Math.abs(this.targetFrame-o)<(r-a)/2)for(c=o;this.frames[c]||(this.frames[c]=this.loadImage(this.controller.makeFrameUrl(e,t,c,this.frameOptions),n&&this.targetFrame===c,e,s&&s[c]),i&&n&&this.targetFrame===c&&(this.frames[c].redrawWhenDone=!0)),c!==this.targetFrame;)c<this.targetFrame?c+=1:c-=1;else for(l=o<this.targetFrame?-1:1,c=o;this.frames[c]||(this.frames[c]=this.loadImage(this.controller.makeFrameUrl(e,t,c,this.frameOptions),n&&this.targetFrame===c,e,s&&s[c])),c!==this.targetFrame;)c+=l,c<a&&(c=r),c>r&&(c=a);for(c=a;c<=r;c+=1)this.frames[c]||(this.frames[c]=this.loadImage(this.controller.makeFrameUrl(e,t,c,this.frameOptions),!1,e,s&&s[c]))}else{l=1;let u=1;c=o;for(let o=a;o<=r;o+=1){let o=c;o<a&&(o+=r-a+1),o>r&&(o-=r-a+1),this.frames[o]||(this.frames[o]=this.loadImage(this.controller.makeFrameUrl(e,t,o,this.frameOptions),n&&o===this.targetFrame,e,s&&s[o]),i&&n&&o===this.targetFrame&&(this.frames[o].redrawWhenDone=!0)),c+=l*u,l=-l,u+=1}}}}loadImage(e,t,n,i){if(i&&i.url===e&&i.ready&&!i.error)return setTimeout((()=>{"function"==typeof i.redrawWhenDone?(i.redrawWhenDone(i),i.redrawWhenDone=null):i.redrawWhenDone&&(i.redrawWhenDone=!1)})),i;const s={url:e,ready:!1,error:!1,target:t,image:new Image,xhr:new XMLHttpRequest},o=this;return s.xhr.onload=function(){if(404===s.xhr.status)return s.ready=!0,s.error=!0,o.emit("notfound",n),void("function"==typeof s.redrawWhenDone?(s.redrawWhenDone(s),s.redrawWhenDone=null):s.redrawWhenDone&&(s.redrawWhenDone=!1));const e=URL.createObjectURL(this.response),t=s.xhr.getResponseHeader("X-Clipped-By");t&&"None"!==t?o.emit("clipped",t):o.emit("clipped",null),s.image.onload=function(){s.ready=!0,URL.revokeObjectURL(e),"function"==typeof s.redrawWhenDone?(s.redrawWhenDone(s),s.redrawWhenDone=null):s.redrawWhenDone&&(s.redrawWhenDone=!1,o.rerender())},s.image.src=e},s.xhr.onerror=function(){s.error||(s.ready=!0,s.error=!0,o.emit("error"),"function"==typeof s.redrawWhenDone?(s.redrawWhenDone(s),s.redrawWhenDone=null):s.redrawWhenDone&&(s.redrawWhenDone=!1))},s.xhr.onreadystatechange=function(e){e&&e.target&&e.target.status>200&&(s.ready=!0,s.error=!0,"function"==typeof s.redrawWhenDone?(s.redrawWhenDone(s),s.redrawWhenDone=null):s.redrawWhenDone&&(s.redrawWhenDone=!1))},s.abort=function(){s.ready||s.xhr.abort()},setTimeout((()=>{s.xhr.open("GET",e,!0),s.xhr.responseType="blob",s.xhr.send()})),s}checkLoading(){let e=!1,t=!1;for(const n in this.frames)if(Object.prototype.hasOwnProperty.call(this.frames,n)){const i=this.frames[n];i.ready||(e=!0),i.target&&i.ready&&(t=!0)}let n="done";if(e&&(n=t?"viewReady":"loading"),this.loading!==n){const e=this.loading;this.loading=n,this.emit("imagesLoading",{state:n,previous:e})}}completeTarget(e,t){this.view=e,this.frame=t,this.targetView=null,this.targetFrame=null}backingScale(){return 2}makeOverlay(e,t,n,i,s){let o;"highlight"===s?o="cz__surface-overlay cz__surface-highlight":"select"===s&&(o="cz__surface-overlay cz__surface-select");let a="";"highlight"===s&&(a='tabindex="0"');const r=this.backingScale(),c="<canvas "+a+' class="cz__surface '+o+'" width="'+t*r+'" height="'+n*r+'" style="width: '+t+"px; height: "+n+'px;"></canvas>',l=(new DOMParser).parseFromString(c,"text/html").documentElement.querySelector("canvas");e.insertAdjacentElement("beforeend",l),l.customizer||(l.customzier={}),l.customizer.image=i,l.customizer.overlayType=s}removeHighlights(){const e=this.container.querySelector(".cz__render");Array.from(e.querySelectorAll("canvas.cz__surface-highlight")).forEach((e=>{e.parentNode.removeChild(e)})),Array.from(e.querySelectorAll("canvas.cz__surface-select")).forEach((e=>{e.parentNode.removeChild(e)}))}renderOverlays(){const e=this.container.querySelector(".cz__render");if(this.highlightsLoaded)if(this.highlightView===this.displayView&&this.highlightFrame===this.displayFrame){const t=e.clientWidth,n=e.clientHeight;if(!this.displayHighlightsLoaded){this.removeHighlights();for(let i=0;i<this.selectImages.length;i+=1)this.selectImages[i].ready&&!this.selectImages[i].error&&this.makeOverlay(e,t,n,this.selectImages[i],"select");for(let i=0;i<this.highlightImages.length;i+=1)this.highlightImages[i].ready&&!this.highlightImages[i].error&&this.makeOverlay(e,t,n,this.highlightImages[i],"highlight");this.displayHighlightsLoaded=!0}Array.from(e.querySelectorAll(".cz__surface-overlay")).forEach((e=>{const t=e.customizer?e.customizer.image:null,n=e.width,i=e.height,s=e.getContext("2d");s.clearRect(0,0,n,i);const o=this.backingScale();if(!t.error){const e=t.image.width,a=t.image.height;let r=e*o,c=a*o;r>n&&(c=c*(n/r)|0,r=n),c>i&&(r=r*(i/c)|0,c=i);const l=(n-r)/2|0,u=(i-c)/2|0;s.drawImage(t.image,0,0,e,a,l,u,r,c)}}))}else this.removeHighlights();else this.removeHighlights()}findHightlight(e,t,n){const i=this.backingScale(),s=e*i,o=t*i,a=Array.from(this.container.querySelectorAll(".cz__surface-overlay"));for(let e=a.length-1;e>=0;e-=1){const t=a[e];if(t.customizer&&t.customizer.overlayType===n&&t.getContext("2d").getImageData(s,o,1,1).data[3]>0)return t}return null}hitTest(e,t){const n=this.findHightlight(e,t,"highlight");if(n&&n.customizer){const{placement:e}=n.customizer.image,t={placement:e.placement,component:e.component};if(e&&e.component&&e.component.code){const n=this.controller.imageName(e.component.code,e.component.placementIndependentCode,this.highlightView,this.highlightFrame);t.componentImageName=n;let i=null;if(n){const e=this.controller.blueprint.imageMapping;for(let t=0;t<e.length;t+=1){const s=e[t];if(s.from===n){i=s;break}}}t.componentImageMapping=i}return t}return null}hitTestHighlight(e,t){const n=this.findHightlight(e,t,"highlight");let i=null;n&&n.customizer&&({placement:i}=n.customizer.image),this.emit("highlightPlacement",i?[i]:null),n?this.lastHighlight!==n&&(this.lastHighlight&&this.fadeOutOverlay(this.lastHighlight),this.lastHighlight=n,this.fadeInOverlay(n),this.container.classList.add("cz-over-highlight")):this.lastHighlight&&(this.fadeOutOverlay(this.lastHighlight),this.lastHighlight=null,this.container.classList.removeClass("cz-over-highlight"))}clickTestHighlight(e,t){const n=this.findHightlight(e,t,"select");n&&n.customizer?this.selectPlacements([n.customizer.image.placement]):this.selectPlacements(null)}fadeInOverlay(e){this.emit("fadeInOverlay",e),e.classList.add("cz-overlay-visible")}fadeOutOverlay(e){this.emit("fadeOutOverlay",e),e.classList.remove("cz-overlay-visible")}findRangeView(e){for(let t=0;t<this.blueprint.views.length;t+=1){const n=this.blueprint.views[t];if("Range"===n.viewType&&e>=n.frameLow&&e<=n.frameHigh)return n}return null}getFramePath(e,t,n){const i=[],s=e.frameLow,o=e.frameHigh;let a;if(Math.abs(t-n)<(o-s)/2)for(a=t;i.push(a),a!==n;)a<n?a+=1:a-=1;else{let e;for(e=t<n?-1:1,a=t;i.push(a),a!==n;)a+=e,a<s&&(a=o),a>o&&(a=s)}return i}checkFramePathLoaded(e){for(let t=0;t<e.length;t+=1)if(!this.frames[e[t]].ready)return!1;return!0}checkPendingSingleView(e,t){let n=!1;if(this.settings.imageAnimateOnSimilarViewChange){const i=this.findRangeView(t),s=this.findRangeView(this.frame);if(null!=i&&i===s){n=!0;const s=this.getFramePath(i,this.frame,t);if(this.checkFramePathLoaded(s)){if(this.animating=!0,(new Date).getTime()-this.displayExposure>=this.settings.animationFrameExposure){const n=s[1];null==n?(this.render(e,this.frame),this.completeTarget(e,t),this.animating=!1):(this.frame=n,this.render(e,this.frame))}}else this.settings.imageSimilarViewChangeSnapIfNotLoaded&&this.settings.imageAllowEmptyWhileLoading&&(this.render(e,t),this.completeTarget(e,t))}}if(!n){const n=this.frames[t];n&&(n.ready?(this.render(e,t),this.completeTarget(e,t)):this.settings.imageAllowEmptyWhileLoading&&this.render(e,t))}}checkPendingRangeView(e,t){let n=!1;if(this.settings.imageAnimateOnSimilarViewChange){const i=this.findRangeView(this.frame);if(e===i){n=!0;const s=this.getFramePath(i,this.frame,t);if(this.checkFramePathLoaded(s)){if(this.animating=!0,(new Date).getTime()-this.displayExposure>=this.settings.animationFrameExposure){const n=s[1];null==n?(this.render(e,t),this.completeTarget(e,t),this.animating=!1):(this.frame=n,this.render(e,this.frame))}}else this.settings.imageSimilarViewChangeSnapIfNotLoaded&&this.settings.imageAllowEmptyWhileLoading&&(this.render(e,t),this.completeTarget(e,t))}}if(!n){const n=this.frames[t];n&&(n.ready?(this.render(e,t),this.completeTarget(e,t)):this.settings.imageAllowEmptyWhileLoading&&this.render(e,t))}}checkPendingViewActions(){const e=null==this.targetView?this.view:this.targetView,t=null==this.targetFrame?this.frame:this.targetFrame;e&&("Single"===e.viewType?this.checkPendingSingleView(e,t):"Range"===e.viewType&&this.checkPendingRangeView(e,t))}tick(){this.checkLoading(),null==this.targetView&&null==this.targetFrame||this.checkPendingViewActions();let e=10;this.animating&&(e=1),null==this.tickHandler&&(this.tickHandler=()=>{this.tick()}),this.ticker=setTimeout(this.tickHandler,e)}onMouseLeave(){this.hitTestHighlight(-1,-1)}onMouseMove(e){const t=this.container.getBoundingClientRect(),n=e.pageX-(t.left+document.body.scrollLeft),i=e.pageY-(t.top+document.body.scrollTop);this.hitTestHighlight(n,i)}onClick(e){const t=this.container.getBoundingClientRect(),n=e.pageX-(t.left+document.body.scrollLeft),i=e.pageY-(t.top+document.body.scrollTop);this.clickTestHighlight(n,i)}onMouseDown(){this.container.classList.remove("cz__accessible")}onKeyDown(e){if(this.container.classList.add("cz__accessible"),13===e.keyCode){const e=document.activeElement;if("CANVAS"===e.tagName&&e.classList.contains("cz__surface--overlay")&&e.classList.contains("cz__surface-highlight")&&e.customizer){const{image:t}=e.customizer;t&&t.placement&&this.selectPlacements([t.placement])}}}onAfterInitializeBlueprint(e){this.updateBlueprint(e.blueprint)}onStateChanged(){this.stateChangedTimer&&(cancelAnimationFrame(this.stateChangedTimer),this.stateChangedTimer=null),this.stateChangedTimer=requestAnimationFrame((()=>{const e=this.selectedView(),t=this.selectedFrame();e&&t&&this.updateView(e,t)}))}onRepaint(){this.repaint()}calculateStateHash(e){const t=[];return e.forEach((e=>{t.push(e.placement.name),t.push(":"),t.push(e.component.code),e.component.custom&&e.component.custom["personalization-text"]&&(t.push(":text:"),t.push(e.component.custom["personalization-text"])),e.component.custom&&e.component.custom["dynamic-image-url"]&&(t.push(":image:"),t.push(e.component.custom["dynamic-image-url"])),t.push("|")})),t.push("edit-before:"),t.push(this.settings.beforePlacement),t.push("|edit-after:"),t.push(this.settings.afterPlacement),t.join("")}formatChanged(e,t){return(e&&e.custom&&e.custom["image-file-format-frame"]?e.custom["image-file-format-frame"]:null)!==(t&&t.custom&&t.custom["image-file-format-frame"]?t.custom["image-file-format-frame"]:null)}transformChanged(e,t){if((e&&e.custom&&e.custom.transform?e.custom.transform:null)!==(t&&t.custom&&t.custom.transform?t.custom.transform:null))return!0;if(e&&e.placements&&t&&t.placements){for(const n of e.placements){const e=t.placements.find((e=>e.code===n.code));if((n.custom&&n.custom.transform)!==(e&&e.custom.transform))return!0}for(const n of t.placements){const t=e.placements.find((e=>e.code===n.code)),i=n.custom&&n.custom.transform;if((t&&t.custom.transform)!==i)return!0}}return!1}},e.exports=t.default},66:(e,t,n)=>{"use strict";var i=n(709);t.__esModule=!0,t.default=void 0;var s=i(n(152));t.default=class{constructor(e){this.container=e,this.canvas=null,this.image=null,this.make(),this.resize()}make(){const e=this.container.clientWidth,t=this.container.clientHeight,n=this.backingScale(),i='<canvas class="cz-cached-image" width="'+e*n+'" height="'+t*n+'" style="width: '+e+"px; height: "+t+'px;"></canvas>';this.canvas=(new DOMParser).parseFromString(i,"text/html").documentElement.querySelector("canvas"),this.container.insertAdjacentElement("beforeend",this.canvas)}backingScale(){return 2}draw(){if(this.canvas){const e=this.canvas.getContext("2d"),t=this.canvas.width,n=this.canvas.height;e.clearRect(0,0,t,n);const i=this.backingScale();if(this.image){const s=this.image.width,o=this.image.height;let a=s*i,r=o*i;a>t&&(r=r*(t/a)|0,a=t),r>n&&(a=a*(n/r)|0,r=n);const c=(t-a)/2|0,l=(n-r)/2|0;e.drawImage(this.image,0,0,s,o,c,l,a,r)}}}resize(){const e=this.container.clientWidth,t=this.container.clientHeight,n=this.backingScale();this.canvas&&(this.canvas.width=e*n,this.canvas.height=t*n,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px")}clear(){this.set()}set(e,t){e&&t?s.default.get(e,t,(e=>{this.image=e,this.draw()})):this.image&&(this.image=null,this.draw())}},e.exports=t.default},106:(e,t,n)=>{"use strict";var i=n(516);function s(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(i.isURLSearchParams(t))o=t.toString();else{var a=[];i.forEach(t,(function(e,t){null!=e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,(function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),a.push(s(t)+"="+s(e))})))})),o=a.join("&")}if(o){var r=e.indexOf("#");-1!==r&&(e=e.slice(0,r)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},137:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},152:(e,t)=>{"use strict";t.__esModule=!0,t.default=void 0,t.default=new class{constructor(){this.buckets={}}clear(e){const t=this.buckets[e];t&&Object.keys(t).forEach((e=>{t[e].ready||t[e].abort()})),delete this.buckets[e]}get(e,t,n,i){const s=t.replace("http://","//").replace("https://","//");let o=this.buckets[e];null==o&&(o={},this.buckets[e]=o);let a=o[s];if(a||(a={url:s,ready:!1,error:!1,image:new Image,xhr:new XMLHttpRequest,done:[],fail:[],custom:null},a.xhr.onload=function(){const e=URL.createObjectURL(this.response);a.image.onload=function(){a.ready=!0,URL.revokeObjectURL(e);for(let e=0;e<a.done.length;e+=1){const t=a.done[e](a.image,a.custom);t&&(a.custom=t)}a.done=[],a.fail=[]},a.image.src=e},a.xhr.onerror=function(){a.ready=!0,a.error=!0;for(let e=0;e<a.fail.length;e+=1)a.fail[e](a.url);a.done=[],a.fail=[]},a.xhr.onreadystatechange=function(e){if(e&&e.target&&e.target.status>200){a.ready=!0,a.error=!0;for(let e=0;e<a.fail.length;e+=1)a.fail[e](a.url);a.done=[],a.fail=[]}},a.abort=function(){a.ready||a.xhr.abort()},setTimeout((()=>{a.xhr.open("GET",s,!0),a.xhr.responseType="blob",a.xhr.send()})),o[s]=a),a.ready){if(a.error)i&&i(a.url);else if(n){const e=n(a.image,a.custom);e&&(a.custom=e)}}else i&&a.fail.push(i),n&&a.done.push(n)}},e.exports=t.default},155:(e,t,n)=>{"use strict";var i=n(516),s=n(106),o=n(471),a=n(490),r=n(343);function c(e){this.defaults=e,this.interceptors={request:new o,response:new o}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=r(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},c.prototype.getUri=function(e){return e=r(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}})),i.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,n,s){return this.request(i.merge(s||{},{method:e,url:t,data:n}))}})),e.exports=c},181:(e,t,n)=>{"use strict";var i=n(709);t.__esModule=!0,t.default=void 0;var s=i(n(505)),o=i(n(880)),a=i(n(851)),r=i(n(23)),c=i(n(9));let l=1;class u{constructor(e){(0,a.default)(this);const t=new r.default;if(this.id=`${l}`,l+=1,this.settings={endpoint:t.endpoint,...e},null!=this.settings.products&&(null!=this.settings.product&&(console.log("%cBoth products and product settings are specified.","color:#f00;"),delete this.settings.product),Array.isArray(this.settings.products)||(this.settings.products=[this.settings.products])),null!=this.settings.product&&(Array.isArray(this.settings.product)?(this.settings.products=this.settings.product,delete this.settings.product):(this.settings.products=[this.settings.product],delete this.settings.product)),this.settings.products&&(this.settings.products=this.settings.products.map((e=>e.toString()))),null==this.settings.assembly&&(this.settings.assembly={}),null==this.settings.select&&(this.settings.select=[]),this.settings.products){const e=[];this.settings.products.forEach((t=>{t.split("~").map((e=>e.trim())).forEach(((t,n)=>{const i=t.match(/[^,(]+(?:\([^)]*\))?/g).map((e=>e.trim()));0===n?e.push(...i):i.length>1&&(this.settings.assembly[i[0]]=i.slice(1))}))}));const t=[];e.forEach((e=>{const n=e.split(/\(|\)|,/).map((e=>e.trim())).filter((e=>e.length>0));n.length>0&&(t.push(n[0]),n.length>1&&this.settings.select.push(...n.slice(1)))})),this.settings.products=t}this.blueprintReady=!1,this.dirty=!1,this.blueprint={},this.state=[],this.socketsState=[],this.globalTags=[],this.placementTags={},this.componentTags={},this.assembly=[],this.uniqueSequence=1,this.transactionCode=null,this.traceAllowed=!1,this.traceAvailable=!1,this.traceUpdated=!1,this.traceTransaction=!1,this.standardAnalytics={},this.allowAnalytics=!1,this.allowStandardAnalytics=!1,this.allowDataLayer=null,this._triggerEffectsInitial=!1,this._triggerEffectsChanged=[],this._cacheAllowed={},this._cacheAvailable={},this._cachePlacementToComponent={},this._nonReactive={__v_skip:!0,state:[],stateByPlacement:{},placementTags:{},componentTags:{}},this.allowStateCaching=!1}setBlueprint(e){this.blueprint=e}setState(e){this.state=e;for(let e=0;e<this.state.length;e+=1)this.updateNonReactiveState(e)}updateNonReactiveState(e){const t=this._nonReactive.state,n=this._nonReactive.stateByPlacement,i=this.state[e];t[e]=JSON.parse(JSON.stringify({placement:{code:i.placement.code,tags:i.placement.tags&&i.placement.tags.length>0?i.placement.tags:[],custom:i.placement.custom},component:i.component?{code:i.component.code,placementIndependentCode:i.component.placementIndependentCode,tags:i.component.tags&&i.component.tags.length>0?i.component.tags:[],topTags:i.component.topTags&&i.component.topTags.length>0?i.component.topTags:[],custom:i.component.custom}:null})),n[i.placement.code]=i.component?JSON.parse(JSON.stringify({code:i.component.code,placementIndependentCode:i.component.placementIndependentCode,tags:i.component.tags&&i.component.tags.length>0?i.component.tags:[],topTags:i.component.topTags&&i.component.topTags.length>0?i.component.topTags:[],custom:i.component.custom})):null}clone(e){const t=new u;t.traceAllowed=this.traceAllowed,t.traceAvailable=this.traceAvailable,t.traceUpdated=this.traceUpdated,t.traceTransaction=this.traceTransaction,t.allowStateCaching=this.allowStateCaching,t.settings=JSON.parse(JSON.stringify(this.settings,((e,t)=>void 0===t?null:t))),t.blueprint=JSON.parse(JSON.stringify(this.blueprint,((e,t)=>void 0===t?null:t))),t.setState(JSON.parse(JSON.stringify(this.state,((e,t)=>void 0===t?null:t)))),t.globalTags=JSON.parse(JSON.stringify(this.globalTags)),t.placementTags=JSON.parse(JSON.stringify(this.placementTags)),t.componentTags=JSON.parse(JSON.stringify(this.componentTags)),t.standardAnalytics=JSON.parse(JSON.stringify(this.standardAnalytics)),t.allowAnalytics=this.allowAnalytics,t.allowStandardAnalytics=this.allowStandardAnalytics,t.allowDataLayer=this.allowDataLayer,t.resetStateCache(),t.state.forEach((e=>{let n=null;if((t.blueprint.groups||[]).forEach((t=>{null===n&&(t.placements||[]).forEach((t=>{null===n&&t.code===e.placement.code&&(n=t)}))})),n){e.placement=n;const t=e.placement.components.find((t=>t.code===e.component.code));t&&(e.component=t)}})),t.blueprintReady=this.blueprintReady,null!=e&&!0===e.excludeEvents||(t.events?Object.keys(t.events).forEach((e=>{delete t.events[e]})):t.events={},Object.entries(this.events).forEach((e=>{e[1]&&(t.events[e[0]]=e[1].slice(0))}))),t._updateAssembly();for(let e=0;e<this.assembly.length;e+=1){const n=this.assembly[e];if(null==n.socket)continue;const i=t.assembly.find((e=>null!=e.socket&&e.socket.code===n.socket.code));null!=i&&n.to&&(i.to=n.to.clone())}return t}load(e){return new Promise((t=>{this.settings=Object.assign(this.settings,e);const n=this.resolveBlueprintUrl();if(n)if(this.settings.assembly){const e=[];Object.entries(this.settings.assembly).forEach((([t,n])=>{const i={...this.settings};delete i.product,delete i.products,delete i.assembly,i.products=Array.isArray(n)?n:[n],e.push(new Promise((e=>{const n=new u(i);n.traceAllowed=this.traceAllowed,n.traceAvailable=this.traceAvailable,n.traceUpdated=this.traceUpdated,n.traceTransaction=this.traceTransaction,n.load().then((()=>{e({slot:t,controller:n})}))})))})),Promise.all(e).then((e=>{this.settings.preloadedAssembly=e,this.loadBlueprint(n).then((e=>{t(e)}))}))}else this.loadBlueprint(n).then((e=>{t(e)}))}))}destroy(){}products(){let{products:e}=this.settings;if(null==e&&this.settings.product&&(e=Array.isArray(this.settings.product)?this.settings.product:[this.settings.product]),(!e||0===e.length)&&this.settings.blueprint){const t=this.settings.blueprint.match(/blueprint\/([^/]+)/);t&&t.length>1&&(e=t[1].split(",").map((e=>e.trim())))}return[...e]}findProduct(e){if(this.blueprint.relatedProducts)return function t(n,i){for(let s=0;s<n.length;s+=1){if(n[s].styleCode===e)return{product:n[s],path:i.concat(n[s])};if(n[s].related){const e=t(n[s].related,i.concat(n[s]));if(e)return e}}}(this.blueprint.relatedProducts,[])}resetStateCache(){(this.rootController||this).forAllControllers((e=>{e._resetStateCache()}));try{this._nonReactive.placementTags=JSON.parse(JSON.stringify(this.placementTags))}catch(e){this._nonReactive.placementTags={}}try{this._nonReactive.componentTags=JSON.parse(JSON.stringify(this.componentTags))}catch(e){this._nonReactive.componentTags={}}}_resetStateCache(){this.emit("stateWillChange"),this._cacheAllowed={},this._cacheAvailable={},this._cachePlacementToComponent={}}addTag(e){this.globalTags.includes(e)||this.globalTags.push(e),this.resetStateCache()}removeTag(e){this.globalTags=this.globalTags.filter((t=>t!==e)),this.resetStateCache()}addComponentTag(e,t){null==this.componentTags[e]&&(this.componentTags[e]=[]),this.componentTags[e].includes(t)||this.componentTags[e].push(t),this.resetStateCache()}removeComponentTag(e,t){null==this.componentTags[e]&&(this.componentTags[e]=[]),this.componentTags[e]=this.componentTags[e].filter((e=>e!==t)),this.resetStateCache()}clearComponentTags(e){this.componentTags[e]=[],this.resetStateCache()}trackComponentAs(e,t){const n=this.findComponent(e);n&&(n.trackAs=t)}addPlacementTag(e,t){null==this.placementTags[e]&&(this.placementTags[e]=[]),this.placementTags[e].includes(t)||this.placementTags[e].push(t),this.resetStateCache()}removePlacementTag(e,t){null==this.placementTags[e]&&(this.placementTags[e]=[]),this.placementTags[e]=this.placementTags[e].filter((e=>e!==t)),this.resetStateCache()}clearPlacementTags(e){this.placementTags[e]=[],this.resetStateCache()}collectActiveTags(){const e=new Set(this.globalTags);this.blueprint&&this.blueprint.tags&&this.blueprint.tags.forEach((t=>{e.add(t)}));const t=this.temporaryState||this.state;t.forEach((t=>{if(t.component&&t.component.tags){const{tags:n}=t.component;for(let t=0;t<n.length;t+=1)e.add(n[t])}if(t.component&&t.component.topTags){const{topTags:n}=t.component;for(let t=0;t<n.length;t+=1)e.add(n[t])}if(t.placement){const n=this.placementTags[t.placement.code];if(null!=n)for(let t=0;t<n.length;t+=1)e.add(n[t])}if(t.component){const n=this.componentTags[t.component.code];if(null!=n)for(let t=0;t<n.length;t+=1)e.add(n[t])}}));const n=this.rootController||this;return n.forAllControllers((i=>{i.id!==this.id&&i.state!==t&&(i.state.forEach((t=>{if(t.component&&t.component.topTags){const{topTags:n}=t.component;for(let t=0;t<n.length;t+=1)e.add(n[t])}})),this.blueprint.noSiblingRules&&i!==n||(i.blueprint&&i.blueprint.tags&&i.blueprint.tags.forEach((t=>{e.add(t)})),i.state.forEach((t=>{if(t.component&&t.component.tags){const{tags:n}=t.component;for(let t=0;t<n.length;t+=1)e.add(n[t])}if(t.placement){const n=i.placementTags[t.placement.code];if(null!=n)for(let t=0;t<n.length;t+=1)e.add(n[t])}if(t.component){const n=i.componentTags[t.component.code];if(null!=n)for(let t=0;t<n.length;t+=1)e.add(n[t])}}))))})),[...e]}isAllowed(e){if(null==e)return null;if(this.allowStateCaching){const t=this._cacheAllowed[e.code];if(null!=t)return t}const t=this._isAllowed(e);return this._cacheAllowed[e.code]=t,t}_selectedAtPlacementForRules(e){return this._nonReactive.stateByPlacement[e]}_isAllowed(e){if(null==this.state)return!0;const t=this.emit("isAllowed",e);if(!0===t||!1===t)return t;if(null==this.blueprint.rules)return!0;if("string"==typeof e)return!0;if(null==e||null==e.tags)return!0;const n=new Set(this.globalTags),i=this.findComponentPlacement(e.code),s=i.code,o=e.code;let a=[];try{a=JSON.parse(JSON.stringify(e.tags))}catch(e){a=[]}if(null==i)return!0;this.blueprint&&this.blueprint.tags&&this.blueprint.tags.forEach((e=>{n.add(e)}));let r=null;if(this.temporaryState)r=this.temporaryState;else{const e=this._nonReactive.state;r=e}const c=this._nonReactive.placementTags,l=this._nonReactive.componentTags,u=r.length;for(let e=0;e<u;e+=1){const t=r[e],i=t.component,a=t.placement;if(i){const{tags:e}=i;if(e&&a.code!==s&&i.code!==o){const t=e.length;for(let i=0;i<t;i+=1)n.add(e[i])}const{topTags:t}=i;if(t){const e=t.length;for(let i=0;i<e;i+=1)n.add(t[i])}{const e=l[i.code];if(null!=e){const t=e.length;for(let i=0;i<t;i+=1)n.add(e[i])}}}if(a){const e=c[a.code];if(null!=e){const t=e.length;for(let i=0;i<t;i+=1)n.add(e[i])}}}const h=this.rootController||this;h.forAllControllers((t=>{t.id!==this.id&&t.state!==r&&(t.state.forEach((e=>{if(e.component&&e.component.topTags){const{topTags:t}=e.component;for(let e=0;e<t.length;e+=1)n.add(t[e])}})),this.blueprint.noSiblingRules&&t!==h||(t.blueprint&&t.blueprint.tags&&t.blueprint.tags.forEach((e=>{n.add(e)})),t.state.forEach((t=>{if(t.component&&t.component.tags&&t.placement.code!==i.code&&t.component.code!==e.code){const{tags:e}=t.component;for(let t=0;t<e.length;t+=1)n.add(e[t])}if(t.placement){const e=this.placementTags[t.placement.code];if(null!=e)for(let t=0;t<e.length;t+=1)n.add(e[t])}if(t.component){const e=this.componentTags[t.component.code];if(null!=e)for(let t=0;t<e.length;t+=1)n.add(e[t])}}))))}));let m=!1,d=!1,p=!0;this.blueprint.combineOnlyWhen&&(m=0,d=0);const f=[],g=[],y=new Set,b=this.blueprint.rules,v=[];this.settings.locale&&v.push(this._normalizeLocale(this.settings.locale));const w=[];this.settings.site&&w.push(this.settings.site);const S={active:n,sites:w,locales:v};let k=null;const A=this.traceAllowedComponent===e.code;if(A&&console.log(`%cTrace component: [${this.id}] Begin trace component ${e.code}`,"color: #b27;"),b)for(let t=0;t<b.length;t+=1){const s=b[t];if(s.inactive)continue;if(null==a)continue;if("Coded"===s.type){const t=this._checkRuleEffects(s.code,S);for(let n=0;n<t.length;){const s=t[n];if("+"===s){const s=t[n+2],o=t[n+3];A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Check allow ${s} on ${o||"anywhere"}`,"color: #b27;"),null!=o?o===i.code&&a.includes(s)&&(k=!1,A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Unblocked by ${s} on ${o}`,"color: #2b5;")):a.includes(s)&&(k=!1,A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Unblocked by ${s}`,"color: #2b5;"))}if("-"===s){const s=t[n+2],o=t[n+3];A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Check block ${s} on ${o||"anywhere"}`,"color: #b27;"),null!=o?i.code===o&&a.includes(s)&&(k=!0,A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Blocked by ${s} on ${o}`,"color: #b22;")):a.includes(s)&&(k=!0,A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Blocked by ${s}`,"color: #b22;"))}if("!"===s){const s=t[n+2];A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Check placement block ${s}`,"color: #b27;"),i.code===s&&(k=!0,A&&console.log(`%cTrace component: [${this.id}] [${e.code}] Blocked by placement ${s}`,"color: #b22;"))}n+=t[n+1]}continue}if(null==s.source||null==s.target||0===s.target.length)continue;if(s.except&&a.some((e=>s.except.includes(e))))continue;let o=!0;if(1===a.length&&(s.target.includes(a[0])||(o=!1)),a.some((e=>s.target.includes(e)))||(o=!1),"BlockedIfAnyUnless"===s.type){if(s.source.some((e=>n.has(e)))&&!o)return this.traceAllowed&&console.log(`%cTrace allowed: [${this.id}] Component ${e.code} is blocked because of BlockedIfAnyUnless rule`,"color: #f93;",s),!1}else if("BlockedIfAllUnless"===s.type&&s.source.every((e=>n.has(e)))&&!o)return this.traceAllowed&&console.log(`%cTrace allowed: [${this.id}] Component ${e.code} is blocked because of BlockedIfAllUnless rule`,"color: #f93;",s),!1;if(o){if("AlwaysOn"===s.type)return!0;if("AlwaysOnConditional"===s.type)return!0;if("BlockedIfAny"===s.type){if(s.source.some((e=>n.has(e))))return this.traceAllowed&&console.log(`%cTrace allowed: [${this.id}] Component ${e.code} is blocked because of BlockedIfAny rule`,"color: #f93;",s),!1}else if("BlockedIfAll"===s.type){if(s.source.every((e=>n.has(e))))return this.traceAllowed&&console.log(`%cTrace allowed: [${this.id}] Component ${e.code} is blocked because of BlockedIfAll rule`,"color: #f93;",s),!1}else this.blueprint.combineOnlyWhen||"OnlyWhenAny"!==s.type?this.blueprint.combineOnlyWhen||"OnlyWhenAll"!==s.type?this.blueprint.combineOnlyWhen&&"OnlyWhenAny"===s.type?(m+=1,s.source.some((e=>n.has(e)))?(d+=1,this.traceAllowed&&(y.add(s.source.find((e=>n.has(e)))),g.push(s))):this.traceAllowed&&f.push(s)):this.blueprint.combineOnlyWhen&&"OnlyWhenAll"===s.type&&(m+=1,p=!1,s.source.every((e=>n.has(e)))?(d+=1,this.traceAllowed&&(y.add(s.source.find((e=>n.has(e)))),g.push(s))):this.traceAllowed&&f.push(s)):(m=!0,s.source.every((e=>n.has(e)))?(d=!0,this.traceAllowed&&(y.add(s.source.find((e=>n.has(e)))),g.push(s))):this.traceAllowed&&f.push(s)):(m=!0,s.source.some((e=>n.has(e)))?(d=!0,this.traceAllowed&&(y.add(s.source.find((e=>n.has(e)))),g.push(s))):this.traceAllowed&&f.push(s))}}return!0===k?(this.traceAllowed&&console.log(`%cTrace allowed: [${this.id}] Component ${e.code} is blocked because of coded rule`,"color: #f93;"),!1):this.blueprint.combineOnlyWhen&&m>0?p?(this.traceAllowed&&(d>0?console.log(`%cTrace allowed: [${this.id}] Component ${e.code} has OnlyWhenOR rules and was activated (${d}/${m}), inactive/active rules: `,"color: #f93;",f,g,y):console.log(`%cTrace allowed: [${this.id}] Component ${e.code} has OnlyWhenOR rules but was not activated (${d}/${m}), inactive/active rules: `,"color: #f93;",f,g,y)),d>0):(this.traceAllowed&&(d===m?console.log(`%cTrace allowed: [${this.id}] Component ${e.code} has OnlyWhenAND rules and was activated (${d}/${m}), inactive/active rules: `,"color: #f93;",f,g,y):console.log(`%cTrace allowed: [${this.id}] Component ${e.code} has OnlyWhenAND rules but was not activated (${d}/${m}), inactive/active rules: `,"color: #f93;",f,g,y)),d===m):!(!this.blueprint.combineOnlyWhen&&m)||(this.traceAllowed&&(d?console.log(`%cTrace allowed: [${this.id}] Component ${e.code} has OnlyWhen rules and was activated`,"color: #f93;"):console.log(`%cTrace allowed: [${this.id}] Component ${e.code} has OnlyWhen rules but was not activated`,"color: #f93;")),d)}_triggerCodedEffects(e,t){(this.rootController||this).forAllControllers((n=>{n._triggerControllerCodedEffects(e,t)}))}_triggerControllerCodedEffects(e,t){if(t>10)return;const n=this.collectActiveTags(),i=[];this.settings.locale&&i.push(this._normalizeLocale(this.settings.locale));const s=[];this.settings.site&&s.push(this.settings.site);const o={active:new Set(n),sites:s,locales:i},a=this.blueprint.rules;if(a)for(let n=0;n<a.length;n+=1){const i=a[n];if(!i.inactive&&"Coded"===i.type){const n=this._checkRuleEffects(i.code,o);for(let i=0;i<n.length;){const s=n[i];if("c"===s){const s=n[i+2],o=n[i+3],a=this.findPlacement(s);if(a){const n=a.components.find((e=>!(e.code!==o&&e.placementIndependentCode!==o||!this.isAvailable(e))));if(n){const i=this.selectedAtPlacement(s);null!=i&&i.code===n.code||this.updateComponent(a.code,n.code,{...e,nestingLevel:t})}}}if("t"===s){const s=n[i+2],o=n[i+3],a=this.findPlacement(s);if(a){const n=a.components.find((e=>!!(e.tags&&e.tags.includes(o)&&this.isAvailable(e))));if(n){const i=this.selectedAtPlacement(s);null!=i&&i.code===n.code||this.updateComponent(a.code,n.code,{...e,nestingLevel:t})}}}if("s"===s){const e=n[i+2],s=n[i+3],o=n[i+4],a=this.findPlacement(e);if(a){const n=this.selectedAtPlacement(e);null==n||null!=n.custom&&n.custom[s]===o||this.commitCustomAttributes(a.code,{[s]:o},{propagate:!0,nestingLevel:t})}}if("b"===s){const e=n[i+2],t=n[i+3];this.setBlueprintValueByPath(e,t)}if("a"===s){const e=n[i+2],t=n[i+3];this.emit("ruleEvent",this,e,t)}i+=n[i+1]}}}}splitPropertyPath(e){if(!e||"string"!=typeof e)return[];const t=[];let n="",i=null,s=!1;for(let o=0;o<e.length;o+=1){const a=e[o];s?(n+=a,s=!1):"\\"!==a?'"'!==a&&"'"!==a||!(null===i||"single"===i&&"'"===a||"double"===i&&'"'===a)?"."!==a||null!==i?n+=a:n&&(t.push(n),n=""):i=null===i?'"'===a?"double":"single":null:s=!0}return n&&t.push(n),t}setBlueprintValueByPath(e,t){const n=this.splitPropertyPath(e);let i=this.blueprint,s="blueprint";for(let t=0;t<n.length-1;t+=1){if(null==i)return void console.log(`Invalid blueprint path ${e}`);const o=n[t];if("custom"!==o||"blueprint"!==s&&"group"!==s&&"view"!==s&&"placement"!==s&&"component"!==s){if("views"===o){if("blueprint"===s){i=i.views,s="views";continue}}else if("groups"===o){if("blueprint"===s){i=i.groups,s="groups";continue}}else if("placements"===o){if("group"===s){i=i.placements,s="placements";continue}if("view"===s){i=i.placements,s="placements";continue}}else if("components"===o&&"placement"===s){i=i.components,s="components";continue}if("views"===s){if(Array.isArray(i)){i=i.find((e=>e.code===o)),s="view";continue}}else if("groups"===s){if(Array.isArray(i)){i=i.find((e=>e.code===o)),s="group";continue}}else if("placements"===s){if(Array.isArray(i)){i=i.find((e=>e.code===o)),s="placement";continue}}else if("components"===s&&Array.isArray(i)){i=i.find((e=>e.code===o||e.placementIndependentCode===o)),s="component";continue}if(null==i)return void console.log(`Invalid blueprint path ${e}, current state ${s}, attempted to find ${o}`)}else i=i.custom,s="custom"}null!=i&&"object"==typeof i&&n[n.length-1].length>0&&(i[n[n.length-1]]=t,this.stateChanged())}_normalizeLocale(e){return null==e?e:e.replace("_","-")}_checkRuleEffects(e,t){const n=[];if(e&&Array.isArray(e))for(const i of e)"if"===i.type&&this._executeIfNode(i,t,n);return n}_executeIfNode(e,t,n){let i=!1;e.condition&&(i=this._executeCondition(e.condition,t),i?this._collectEffects(e.then,t,n):this._collectEffects(e.else,t,n))}_collectEffects(e,t,n){if(e)for(const i of e)"if"===i.type?this._executeIfNode(i,t,n):"block"===i.type?(n.push("-"),n.push(4),n.push(i.tag),n.push(i.placement)):"blockAll"===i.type?(n.push("!"),n.push(3),n.push(i.placement)):"allow"===i.type?(n.push("+"),n.push(4),n.push(i.tag),n.push(i.placement)):"select"===i.type?(n.push("c"),n.push(4),n.push(i.placement),n.push(i.component)):"selectByTag"===i.type?(n.push("t"),n.push(4),n.push(i.placement),n.push(i.tag)):"set"===i.type?(n.push("s"),n.push(5),n.push(i.placement),n.push(i.attribute),n.push(i.value)):"updateBlueprint"===i.type?(n.push("b"),n.push(4),n.push(i.path),n.push(i.value)):"action"===i.type&&(n.push("a"),n.push(4),n.push(i.name),n.push(i.arguments))}_executeCondition(e,t){if("always"===e.type)return!0;if("not"===e.type)return!!e.condition&&!this._executeCondition(e.condition,t);if("any"===e.type){if(e.conditions)for(const n of e.conditions)if(this._executeCondition(n,t))return!0;return!1}if("all"===e.type){if(e.conditions)for(const n of e.conditions)if(!this._executeCondition(n,t))return!1;return!0}if("tagged"===e.type){if(e.placement){const t=this._selectedAtPlacementForRules(e.placement);if(t&&t.tags&&t.tags.includes(e.tag))return!0}else if(t.active.has(e.tag))return!0;return!1}if("component"===e.type){if(e.placement&&e.component){const t=this._selectedAtPlacementForRules(e.placement);if(t&&(t.placementIndependentCode===e.component||t.code===e.component))return!0}return!1}if("isSite"===e.type)return!(!e.site||!this._compareSites(t.sites,e.site));if("isLocale"===e.type)return!(!e.locale||!this._compareLocales(t.locales,e.locale));if("hasValue"===e.type){if(e.attribute&&e.placement){const t=this._selectedAtPlacementForRules(e.placement);if(t&&null!=t.custom[e.attribute]&&t.custom[e.attribute].length>0)return!0}return!1}if("initial"===e.type)return!!this._triggerEffectsInitial;if("changed"===e.type){if(e.placement){const t=this._triggerEffectsChanged.length>0?this._triggerEffectsChanged[this._triggerEffectsChanged.length-1]:null;if(t&&t===e.placement)return!0}return!1}return!1}_compareSites(e,t){if(!t.includes(",")){for(const n of e){if(n===t)return!0;if(n.includes(",")){const e=n.indexOf(",");if(n.startsWith(t)&&e===t.length||n.endsWith(t)&&n.length-e-1===t.length)return!0}}return!1}for(const n of e)if(n===t)return!0;return!1}_compareLocales(e,t){const n=t.indexOf("-"),i=t.indexOf("_"),s=n>=0?n:i;if(-1===s){for(const n of e)if(n===t||n.startsWith(t)&&("-"===n[t.length]||"_"===n[t.length]))return!0;return!1}const o=t.substring(0,s);for(const n of e){if(n===t)return!0;if(n.length===t.length){const e=n.indexOf("-");if(-1===e){const e=n.indexOf("_");if(e===s&&n.startsWith(o)&&n.substring(e+1)===t.substring(s+1))return!0}else if(e===s&&n.startsWith(o)&&n.substring(e+1)===t.substring(s+1))return!0}if(n===o)return!0}return!1}isAvailable(e,t){const n=`${e.code} -> ${t||"1"}`;if(this.allowStateCaching){const e=this._cacheAvailable[n];if(null!=e)return e}const i=this._isAvailable(e,t);return this._cacheAvailable[n]=i,i}_isAvailable(e,t){if(!this.isAllowed(e))return!1;const n=this.emit("isAvailable",e);if(!0===n||!1===n)return this.traceAvailable&&!1===n&&console.log(`%cTrace available: Component ${e.code} is not available`,"color: #f93;"),n;if(!e.available)return this.traceAvailable&&console.log(`%cTrace available: Component ${e.code} is not available`,"color: #f93;"),!1;if(!e.placeholder&&this.blueprint.inventory){if(null==this.inventoryCache&&(this.inventoryCache={},this.blueprint.inventory.forEach((e=>{e.short||(this.inventoryCache[e.component]=e.inactive?0:e.inventory||0)}))),null==this.inventoryShortCache&&(this.inventoryShortCache={},this.blueprint.inventory.forEach((e=>{e.short&&(this.inventoryShortCache[e.component]=e.inactive?0:e.inventory||0)}))),0===this.inventoryCache[e.code])return this.traceAvailable&&console.log(`%cTrace available: Component ${e.code} is out of stock`,"color: #f93;"),!1;if(0===this.inventoryShortCache[e.placementIndependentCode])return this.traceAvailable&&console.log(`%cTrace available: Component ${e.code} is out of stock`,"color: #f93;"),!1}if(!e.placeholder&&e.description&&this.blueprint.options)for(let n=0;n<e.description.length;n+=1){const i=e.description[n];if("Option"===i.inventoryType){const n=this.blueprint.options.find((e=>e.code===i.code));let s=0;this.state.forEach((t=>{if(t.component.code!==e.code&&(!t.placement.custom||"true"!==t.placement.custom["ignore-quantity"])&&t.component.description&&t.component.description.some((e=>e.code===n.code))){let e=1;null!=t.component.quantityMultiplier&&(e=t.component.quantityMultiplier),s+=e}}));let o=1;null!=e.quantityMultiplier&&(o=e.quantityMultiplier),t&&(o=t);let a=0;this.blueprint.custom&&this.blueprint.custom["safety-inventory"]&&(a=+this.blueprint.custom["safety-inventory"]),e.custom&&e.custom["safety-inventory"]&&(a=+e.custom["safety-inventory"]);let r=this.emit("getInventory",e);if(null==r&&(r=n&&n.inventory),null!=r&&r<o+s+a)return!1}}return!0}getPrice(e){let t=this.emit("getPrice",e);if(void 0!==t)return t;const n=this.settings.currency||"USD";if(e.price)for(let i=0;i<e.price.length;i+=1)e.price[i].currencyCode===n&&(t=e.price[i].value);return null==t?0:t}statePrice(e){const{state:t}=this;let n=null,i=null,s=null;const o=[],a={},r={};for(let i=0;i<t.length;i+=1){const{component:s}=t[i];if(e&&e.excludePlacements&&e.excludePlacements.indexOf(t[i].placement.code)>=0)continue;if(e&&e.includePlacements&&e.includePlacements.indexOf(t[i].placement.code)<0)continue;let c=this.getPrice(s),l=!1;s.priceOnce&&(a[s.priceOnce]?c=0:(a[s.priceOnce]=!0,l=!0));const u=null==c?null:c*(s.quantityMultiplier||1)*(t[i].placement.quantityMultiplier||1);null!=u&&(n+=u,l?r[s.priceOnce]=u:s.priceOnce||(null==r.other&&(r.other=0),r.other+=u));let h=null,m=null,d=null,p=!1;(this.blueprint.groups||[]).forEach((e=>{(e.placements||[]).forEach((n=>{n.code===t[i].placement.code&&(d=e.code,(n.components||[]).forEach((e=>{e.placeholder&&e.placeholderOptional&&(p=!0)})))}))})),e&&e.fixedPlacements&&e.fixedPlacements.indexOf(t[i].placement.code)>=0?(h=c,m=c):(this.blueprint.groups||[]).forEach((n=>{(n.placements||[]).forEach((n=>{if(n.code===t[i].placement.code){let t=!1;e&&e.ignoreOptional&&(n.components||[]).forEach((e=>{e.placeholder&&e.placeholderOptional&&(t=!0)})),e&&e.ignorePlaceholders&&("boolean"==typeof e.ignorePlaceholders||e.ignorePlaceholders.indexOf(n.code)>=0)&&(n.components||[]).forEach((e=>{e.placeholder&&(t=!0)}));let i=!1;s.placeholder||(t=!1,i=!0),t||(n.components||[]).forEach((e=>{if(!e.placeholder&&(i||this.isAvailable(e))){const t=this.getPrice(e),i=null==t?null:t*(s.quantityMultiplier||1)*(n.quantityMultiplier||1);(null==h||null!=i&&i<h)&&(h=i),(null==m||null!=i&&i>m)&&(m=i)}}))}}))})),o.push({placement:t[i].placement.code,group:d,optional:p,current:u,min:h,max:m})}for(let e=0;e<o.length;e+=1)i+=null==o[e].min?0:o[e].min,s+=null==o[e].max?0:o[e].max;const c={};return o.forEach((e=>{if(e.group){let t=c[e.group];null==t&&(t={current:null,min:null,max:null},c[e.group]=t),null!=e.current&&(t.current=null==t.current?e.current:t.current+e.current),e.optional?(null!=e.min&&(t.min=null==t.min?e.min:Math.min(t.min,e.min)),null!=e.max&&(t.max=null==t.max?e.max:Math.max(t.max,e.max))):(null!=e.min&&(t.min=null==t.min?e.min:t.min+e.min),null!=e.max&&(t.max=null==t.max?e.max:t.max+e.max))}})),{current:n,currentPriceGroups:r,min:i,max:s,breakdown:o,groups:c}}getDimension(e,t){if(null==t||null==t.dimensions)return null;const{code:n}=e;return t.dimensions.find((e=>e.code===n))}stateDimensions(e){const t=[];return(this.blueprint.dimensions||[]).forEach((n=>{t.push({dimension:n,value:this.stateDimension(n,e)})})),t}stateDimension(e,t){const{state:n}=this;let i=null,s=null,o=null;const a=[];for(let s=0;s<n.length;s+=1){const{component:o}=n[s];if(t&&t.excludePlacements&&t.excludePlacements.indexOf(n[s].placement.code)>=0)continue;if(t&&t.includePlacements&&t.includePlacements.indexOf(n[s].placement.code)<0)continue;const r=this.getDimension(e,o);if(null==r||null==r.number)continue;const c=r.number*(o.quantityMultiplier||1)*(n[s].placement.quantityMultiplier||1);if(null!=c)switch(e.aggregate){case"Sum":i=null==i?c:i+c;break;case"Min":i=null==i?c:Math.min(i,c);break;case"Max":i=null==i?c:Math.max(i,c)}let l=null,u=null,h=null,m=!1;(this.blueprint.groups||[]).forEach((e=>{(e.placements||[]).forEach((t=>{t.code===n[s].placement.code&&(h=e.code,(t.components||[]).forEach((e=>{e.placeholder&&e.placeholderOptional&&(m=!0)})))}))})),t&&t.fixedPlacements&&t.fixedPlacements.indexOf(n[s].placement.code)>=0?(l=c,u=c):(this.blueprint.groups||[]).forEach((i=>{(i.placements||[]).forEach((i=>{if(i.code===n[s].placement.code){let n=!1;t&&t.ignoreOptional&&(i.components||[]).forEach((e=>{e.placeholder&&e.placeholderOptional&&(n=!0)})),t&&t.ignorePlaceholders&&("boolean"==typeof t.ignorePlaceholders||t.ignorePlaceholders.indexOf(i.code)>=0)&&(i.components||[]).forEach((e=>{e.placeholder&&(n=!0)}));let s=!1;o.placeholder||(n=!1,s=!0),n||(i.components||[]).forEach((t=>{if(!t.placeholder&&(s||this.isAvailable(t))){const n=this.getDimension(e,t),s=null==n||null==n.number?null:n.number*(o.quantityMultiplier||1)*(i.quantityMultiplier||1);null!=s&&((null==l||s<l)&&(l=s),(null==u||s>u)&&(u=s))}}))}}))})),a.push({placement:n[s].placement.code,group:h,optional:m,current:c,min:l,max:u})}for(let t=0;t<a.length;t+=1){if(null!=a[t].min)switch(e.aggregate){case"Sum":s=null==s?a[t].min:s+a[t].min;break;case"Min":s=null==s?a[t].min:Math.min(s,a[t].min);break;case"Max":s=null==s?a[t].min:Math.max(s,a[t].min)}if(null!=a[t].max)switch(e.aggregate){case"Sum":o=null==o?a[t].max:o+a[t].max;break;case"Min":o=null==o?a[t].max:Math.min(o,a[t].max);break;case"Max":o=null==o?a[t].max:Math.max(o,a[t].max)}}const r={};return a.forEach((t=>{if(t.group){let n=r[t.group];if(null==n&&(n={current:null,min:null,max:null},r[t.group]=n),null!=t.current)switch(e.aggregate){case"Sum":n.current=null==n.current?t.current:n.current+t.current;break;case"Min":n.current=null==n.current?t.current:Math.min(n.current,t.current);break;case"Max":n.current=null==n.current?t.current:Math.max(n.current,t.current)}switch(e.aggregate){case"Sum":null!=t.min&&(n.min=null==n.min?t.min:n.min+t.min),null!=t.max&&(n.max=null==n.max?t.max:n.max+t.max);break;case"Min":case"Max":null!=t.min&&(n.min=null==n.min?t.min:Math.min(n.min,t.min)),null!=t.max&&(n.max=null==n.max?t.max:Math.max(n.max,t.max))}}})),{current:i,min:s,max:o,breakdown:a,groups:r}}canBuild(e){const{state:t}=this;let n=!0;for(let i=0;i<t.length;i+=1)(!e||!e.excludePlacements||e.excludePlacements.indexOf(t[i].placement.code)<0)&&(this.blueprint.groups||[]).forEach((s=>{(s.placements||[]).forEach((s=>{if(s.code===t[i].placement.code){let o=!1;e&&e.ignoreOptional&&(s.components||[]).forEach((e=>{e.placeholder&&e.placeholderOptional&&(o=!0)})),e&&e.ignorePlaceholders&&("boolean"==typeof e.ignorePlaceholders||e.ignorePlaceholders.indexOf(s.code)>=0)&&(s.components||[]).forEach((e=>{e.placeholder&&(o=!0)}));let a=!1;if(t[i].component.placeholder||(o=!1,a=!0),!o){let t=!1;t=e&&e.validateAvailability?(s.components||[]).some((e=>!e.placeholder&&this.isAvailable(e))):(s.components||[]).some((e=>!e.placeholder)),t||(n=!1),a||(n=!1)}}}))}));return n}transferCompatibleState(e,t,n){const i=e.state;for(let e=0;e<i.length;e+=1){const s=i[e];if((null==t||t.indexOf(s.placement.code)>=0)&&(null==n||n.indexOf(s.placement.code)<0)&&this.updateComponent(s.placement.code,s.component.code)){const e=this.selectedAtPlacement(s.placement.code);s.component.custom&&e.custom&&Object.assign(e.custom,s.component.custom);const t=this.findPlacement(s.placement.code);t&&s.placement.custom&&(t.custom||(t.custom={}),Object.assign(t.custom,s.placement.custom))}}}isSelected(e){const{state:t}=this;for(let n=0;n<t.length;n+=1)if(t[n].component.code===e)return!0;return!1}selectedAtPlacement(e){if(this.allowStateCaching){const t=this._cachePlacementToComponent[e];if(null!=t)return t}const{state:t}=this;for(let n=0;n<t.length;n+=1)if(t[n].placement.code===e)return this.allowStateCaching&&(this._cachePlacementToComponent[e]=t[n].component),t[n].component;return null}acceptableComponents(e){const t=[];return(this.blueprint().groups||[]).forEach((n=>{(n.placements||[]).forEach((n=>{e&&n.code!==e||(n.components||[]).forEach((e=>{e.placeholder||t.push({placement:n,component:e})}))}))})),t}_checkPlacement(e,t,n){const i=[];if(e){const s=e;for(let e=0;e<s.length;e+=1){const o=s[e];let a=!1;if(n&&null!=n[o.code]?a=n[o.code]:(a=this.isAvailable(o),n&&(n[o.code]=a)),!a)continue;let r=!0;for(let e=0;e<t.length;e+=1){const n=t[e];let i=!1;for(let e=0;e<o.description.length;e+=1){const t=o.description[e];if(t.definition===n.definition&&t.code===n.option){i=!0;break}}if(!i){r=!1;break}}r&&i.push(o)}}return i}groupByDefinitions(e,t){const n=[];(e.components||[]).forEach((e=>{if(!e.description)return;let i=!0,s=!0;(this.isAllowed(e)||(i=!1,null!=t&&!0===t.includeDisallowed))&&(this.isAvailable(e)||(s=!1,null!=t&&!0===t.includeUnavailable))&&(e.description||[]).forEach((t=>{let o=n.find((e=>e.description.definition===t.definition));o||(o={description:t,options:[]},n.push(o));let a=o.options.find((e=>e.option.code===t.code));a||(a={option:(this.blueprint.options||[]).find((e=>e.code===t.code)),components:[]},o.options.push(a)),a.components.push({component:e,allowed:i,available:s,placeholder:e.placeholder,selected:this.isSelected(e.code)})}))})),n.forEach((e=>{e.options.forEach((e=>{e.placeholder=e.components.every((e=>e.placeholder)),e.selected=e.components.some((e=>e.selected)),e.allowed=e.components.some((e=>e.allowed)),e.available=e.components.some((e=>e.available))}))}));const i=[];let s=e.components;const o={};return n.forEach((e=>{let t=null;i.length>0?e.options.forEach((n=>{const i=[];i.push({definition:e.description.definition,option:n.option.code});const a=this._checkPlacement(s,i,o);n.hidden=0===a.length,n.hidden||(n.safeSelection=a[0].code),n.selected&&(t=a)})):e.options.forEach((n=>{n.hidden=!1;const i=this._checkPlacement(s,[{definition:e.description.definition,option:n.option.code}],o);i.length>0&&(n.safeSelection=i[0].code),n.selected&&(t=i)})),s=t;const n=e.options.find((e=>e.selected));n&&i.push({definition:e.description.definition,option:n.option.code})})),n}aggregateByOption(e){const t={};return(e||[]).forEach((e=>{let n=null;if(e.component.description&&e.component.description.length>0&&(n=e.component.description[0].code),n){let i=t[n];i||(i={components:[],placements:[]},t[n]=i),i.components.push(e.component),i.placements.find((t=>t.code===e.placement.code))||i.placements.push(e.placement)}})),t}ensureComponentCache(){null==this.componentCache&&(this.componentCache={},this.placementComponentCache={},this.placementIndependentCache={},(this.blueprint.groups||[]).forEach((e=>{(e.placements||[]).forEach((e=>{(e.components||[]).forEach((t=>{this.componentCache[t.code]=t,this.placementIndependentCache[t.placementIndependentCode]=t,this.placementComponentCache[t.code]=e}))}))})))}ensurePlacementCache(){null==this.placementCache&&(this.placementCache={},(this.blueprint.groups||[]).forEach((e=>{(e.placements||[]).forEach((e=>{this.placementCache[e.code]=e}))})))}findComponent(e){return this.ensureComponentCache(),this.componentCache[e]}findByPlacementIndependentCode(e){return this.ensureComponentCache(),this.placementIndependentCache[e]}findComponentPlacement(e){return this.ensureComponentCache(),this.placementComponentCache[e]}findPlacement(e){return this.ensurePlacementCache(),this.placementCache[e]}findView(e){return this.blueprint.views.find((t=>t.code===e))}searchPlacement(e){let t=null;return(this.blueprint.groups||[]).forEach((n=>{null===t&&(n.placements||[]).forEach((n=>{null===t&&e(n)&&(t=n)}))})),t}searchComponents(e,t){const n=this.findPlacement(e),i=[];return(n.components||[]).forEach((e=>{if(!e.description)return;let n=!0;for(let i=0;i<t.length;i+=1){const s=t[i];if(!e.description.some((e=>e.code===s.code&&e.definition===s.definition))){n=!1;break}}n&&i.push(e)})),i}updateSimilarComponent(e,t,n){const i=this.selectedAtPlacement(e),s=this.findPlacement(e);if(s&&i){const o=s.components.find((e=>e.code===i.code));if(o){let i=null;if(s.components.forEach((e=>{let s=!1;for(let i=0;i<e.description.length;i+=1){const o=e.description[i];if(o.definition===t&&o.code===n){s=!0;break}}if(!s)return;let a=!0;for(const n of o.description)n.definition!==t&&(e.description.some((e=>e.definition===n.definition&&e.code===n.code))||(a=!1));a&&(i=e)})),i)return this.updateComponent(e,i.code)}}return null}clearComponent(e){let t=null;const n=this.findPlacement(e);if(n){let i=null;if(null==i&&(i=n.components.find((e=>!e.placeholder&&!e.fallback&&e.preferred&&this.isAvailable(e)))),null==i&&(i=n.components.find((e=>e.placeholder&&!e.fallback&&e.preferred&&this.isAvailable(e)))),null==i&&(i=n.components.find((e=>!e.fallback&&this.isAvailable(e)))),null==i&&(i=n.components.find((e=>e.fallback&&e.preferred&&this.isAvailable(e)))),null==i&&(i=n.components.find((e=>e.fallback&&this.isAvailable(e)))),i){const n=this.selectedAtPlacement(e);null!=n&&i.code===n.code||(i.custom&&"yes"===i.custom["dynamic-image"]&&i.custom["dynamic-image-placeholder"]&&(i.custom["dynamic-image-is-placeholder"]=!0,i.custom["dynamic-image-name"]=i.custom["dynamic-image-placeholder"],i.custom["dynamic-image-scale"]=+i.custom["dynamic-image-placeholder-scale"],i.custom["dynamic-image-x"]=+i.custom["dynamic-image-placeholder-x"],i.custom["dynamic-image-y"]=+i.custom["dynamic-image-placeholder-y"],i.custom["dynamic-image-width"]=+i.custom["dynamic-image-placeholder-width"],i.custom["dynamic-image-height"]=+i.custom["dynamic-image-placeholder-height"],i.custom["dynamic-image-rotate"]=+i.custom["dynamic-image-placeholder-rotate"]),this.updateComponent(e,i.code),t=i)}}return t}beginTransaction(e){null==this.transactionCode?(this.transactionCode=e,this.traceTransaction&&console.log(`%cTrace transaction: Start ${this.transactionCode}`,"color: #f5c;")):this.emit("error",{message:`Transaction ${this.transactionCode||"default"} is already in progress`})}endTransaction(){null!=this.transactionCode?(this.traceTransaction&&console.log(`%cTrace transaction: End ${this.transactionCode}`,"color: #f5c;"),this.transactionCode=null,this.validateAllComponents()):this.emit("error",{message:"There is no transaction in progress"})}updateComponent(e,t,n){let i=null,s=null;const o=this.findPlacement(e);if(o&&o.components){const e=o.components.find((e=>e.code===t));e&&(i=o,s=e)}if(null==s&&(this.blueprint.groups||[]).forEach((n=>{(n.placements||[]).forEach((n=>{n.name===e&&(n.components||[]).forEach((e=>{e.code===t&&(i=n,s=e)}))}))})),null==s)return this.emit("error",{message:"Requested to select invalid component "+t+" for placement "+e}),null;if((null==n||null==n.checkAvailability||!0===n.checkAvailability)&&!this.isAvailable(s))return this.emit("error",{message:"Component "+t+" is not available"}),null;let a,r=!1;for(let t=0;t<this.state.length;t+=1)if(a=this.state[t],a.placement.code===e){r={placement:a.placement,component:a.component},this.state.splice(t,1,{placement:i,component:s}),this.updateNonReactiveState(t);break}if(!r)for(let t=0;t<this.state.length;t+=1)if(a=this.state[t],a.placement.name===e){r={placement:a.placement,component:a.component},this.state.splice(t,1,{placement:i,component:s}),this.updateNonReactiveState(t);break}if(r){if(this.resetStateCache(),this.traceUpdated&&console.log(`%cTrace updated: ${e} ${t} got selected replacing ${r.component.code}`,"color: #f5c;"),(null==n||!n.skipSync)&&i.synchronizationKey&&i.synchronizationKey.length>0&&r.component){const e=[];r.component.description.forEach((t=>{s.description.forEach((n=>{t.definition===n.definition&&t.code!==n.code&&e.push({definition:t.definition,newCode:n.code})}))}));for(let t=0;t<this.state.length;t+=1){const n=this.state[t];if(n.placement.code!==i.code&&n.placement.synchronizationKey===i.synchronizationKey){let t=null;n.placement.components.forEach((i=>{let s=0;if(i.description.forEach((t=>{e.forEach((e=>{t.definition===e.definition&&t.code===e.newCode&&(s+=1)}))})),s!==e.length)return;let o=!0;i.description.forEach((t=>{if(e.some((e=>e.definition===t.definition)))return;const i=n.component.description.find((e=>e.definition===t.definition));null!=i&&i.code===t.code||(o=!1)})),o&&(t=i)})),t&&this.updateComponent(n.placement.code,t.code,{skipSync:!0})}}}this._updateAssembly(),this.rootController?this.rootController.validateAllComponents(n,s):this.validateAllComponents(n,s);const o=null==n||null==n.nestingLevel?1:n.nestingLevel+1;this._triggerEffectsChanged.push(e),this._triggerCodedEffects(n,o),this._triggerEffectsChanged.pop(),this.blueprintReady&&(this.dirty=!0,null!=s&&this.allowStandardAnalytics&&this.trackAction({category:"blueprint",action:"updated",placement:e,component:s.placementIndependentCode}),this.stateChanged({replaced:r})),(s.removeTaggedProducts||s.addProducts)&&this.updateProducts(s.removeTaggedProducts,null,s.addProducts)}return a}updateProducts(e,t,n){if(this.blueprintReady){let i=this.products(),s=!1;if(e&&(i=i.filter((t=>{const n=this.findProduct(t);let i=!1;return n&&n.product&&n.product.tags&&e.forEach((e=>{n.product.tags.includes(e)&&(i=!0)})),!i||(s=!0,!1)}))),t&&(i=i.filter((e=>!t.includes(e)))),n&&n.forEach((e=>{i.includes(e)||(i.push(e),s=!0)})),s){this.settings.products=i;const e=this.resolveBlueprintUrl();this.reloadBlueprint(e)}}}updateComponents(){this.rootController?this.rootController.validateAllComponents():this.validateAllComponents(),this._triggerCodedEffects({},1)}validateAllComponents(e,t){this.emit("beforeValidateAllComponents"),this.forAllControllers((n=>{n.validateComponents(e,t)})),this.emit("afterValidateAllComponents")}validateComponents(e,t,n){const i=[];for(let n=0;n<this.state.length;n+=1){const s=this.state[n];if(null==s.component)continue;if(null!=t&&s.component.code===t.code)continue;let o=!1;if(this.isAllowed(s.component)||(o=!0),s.component.fallback&&(o=!0),o){let o=null;e&&e.alternateSelector&&(o=e.alternateSelector(s.placement,s.component)),null==o&&(o=this.emit("pickAlternate",s.placement,s.component)),o&&(o&&!s.placement.components.some((e=>e.code===o.code))&&(o=null),o&&!this.isAvailable(o)&&(o=null)),null==o&&(o=s.placement.components.find((e=>!e.placeholder&&!e.fallback&&e.preferred&&this.isAvailable(e)))),null==o&&(o=s.placement.components.find((e=>e.placeholder&&!e.fallback&&e.preferred&&this.isAvailable(e)))),null==o&&(o=s.placement.components.find((e=>!e.fallback&&this.isAvailable(e)))),null==o&&(o=s.placement.components.find((e=>e.fallback&&e.preferred&&this.isAvailable(e)))),null==o&&(o=s.placement.components.find((e=>e.fallback&&this.isAvailable(e)))),o&&o.code!==s.component.code?(i.push({placement:s.placement.code,component:s.component.code}),this.state.splice(n,1,{placement:s.placement,component:o}),this.updateNonReactiveState(n),this.traceUpdated&&(console.log(`%cTrace updated: ${s.placement.code} ${o.code} replaced ${s.component.code} because it got invalidated`,"color: #f5c;"),o.fallback&&console.log(`%cTrace updated: ${o.code} is a fallback component`,"color: #f5c;"),this.traceAllowed&&this.isAllowed(s.component))):this.emit("error",{message:`Component ${t?t.code:"<ad-hoc>"} caused invalidation of ${s.component.code} and there is no alternate available`})}}let s=!1;if(this.blueprint&&this.blueprint.rules){const t={};let n=null;const i=this.blueprint.rules;for(let e=0;e<i.length;e+=1){const s=i[e];"Action"===s.type&&s.condition&&s.action&&this.checkRuleCondition(s.condition)&&("SelectComponent"===s.action.type&&s.action.placement&&s.action.component&&!1!==this.emit("beforeApplyActionRule",s)&&(null==t[s.action.placement]&&(t[s.action.placement]=[]),t[s.action.placement].push(s.action)),"Event"===s.action.type&&this.emit("ruleEvent",s),"UpdateProducts"===s.action.type&&null==n&&!1!==this.emit("beforeApplyActionRule",s)&&(n=s.action))}Object.values(t).forEach((t=>{let n=!1;if(t.forEach((e=>{if("SelectComponent"===e.type){const t=this.selectedAtPlacement(e.placement);t&&t.code===e.component&&(n=!0)}})),!n){let n=!1;if(t.length>0){const i=this.emit("resolveSelectComponentActionRule",t);null!=i&&(n=!0,this.updateComponent(i.placement,i.component,e)&&(s=!0))}if(!n){let n=null;t.forEach((e=>{"SelectComponent"===e.type&&(n=e)})),this.updateComponent(n.placement,n.component,e)&&(s=!0)}}})),n&&void 0===this.emit("updateProducts",n)&&this.updateProducts(n.removeTaggedProducts,n.removeProducts,n.addProducts)}s&&(n||this.validateComponents(e,t,!0)),i.length>0&&(this.emit("invalidatedComponent",i),e&&e.invalidatedNotifier&&e.invalidatedNotifier(i))}checkRuleCondition(e){if("And"===e.type){if(e.group){for(let t=0;t<e.group.length;t+=1)if(!this.checkRuleCondition(e.group[t]))return!1;return!0}return!1}if("Or"===e.type){if(e.group){for(let t=0;t<e.group.length;t+=1)if(this.checkRuleCondition(e.group[t]))return!0;return!1}return!1}if("Component"===e.type){if(e.placement&&e.component){const t=this.selectedAtPlacement(e.placement);return!(!t||t.placementIndependentCode!==e.component)}return!1}if("NotComponent"===e.type){if(e.placement&&e.component){const t=this.selectedAtPlacement(e.placement);return!t||t.placementIndependentCode!==e.component}return!1}if("ExactComponent"===e.type){if(e.placement&&e.component){const t=this.selectedAtPlacement(e.placement);return!(!t||t.code!==e.component)}return!1}if("NotExactComponent"===e.type){if(e.placement&&e.component){const t=this.selectedAtPlacement(e.placement);return!t||t.code!==e.component}return!1}return!1}updateDynamicImage(e,t){return new Promise((n=>{const i={accepted:!1};this.state.forEach((n=>{if(n.placement&&n.component&&n.placement.code===e){const{placement:e}=n;e&&e.components&&e.components.forEach((n=>{if(n&&n.custom&&"dynamic-image"===n.custom["widget-type"]){i.accepted=!0;const{width:s,height:o}=t,a=t.rotate||0;let r=n.custom["dynamic-image-area-x"]||e.custom&&e.custom["dynamic-image-area-x"],c=n.custom["dynamic-image-area-y"]||e.custom&&e.custom["dynamic-image-area-y"];if(null==r){const t=(this.blueprint.views||[]).filter((e=>"Camera"!==e.viewType))[0];if(t&&t.placements){const n=t.placements.find((t=>t.code===e.code));n&&n.custom&&n.custom["dynamic-image-area-x"]&&(r=n.custom["dynamic-image-area-x"])}}if(null==c){const t=(this.blueprint.views||[]).filter((e=>"Camera"!==e.viewType))[0];if(t&&t.placements){const n=t.placements.find((t=>t.code===e.code));n&&n.custom&&n.custom["dynamic-image-area-y"]&&(c=n.custom["dynamic-image-area-y"])}}r=+r,c=+c;let l=n.custom["dynamic-image-area-width"]||e.custom&&e.custom["dynamic-image-area-width"];if(null==l){const t=(this.blueprint.views||[]).filter((e=>"Camera"!==e.viewType))[0];if(t&&t.placements){const n=t.placements.find((t=>t.code===e.code));n&&n.custom&&n.custom["dynamic-image-area-width"]&&(l=n.custom["dynamic-image-area-width"])}}let u=n.custom["dynamic-image-area-height"]||e.custom&&e.custom["dynamic-image-area-height"];if(null==u){const t=(this.blueprint.views||[]).filter((e=>"Camera"!==e.viewType))[0];if(t&&t.placements){const n=t.placements.find((t=>t.code===e.code));n&&n.custom&&n.custom["dynamic-image-area-height"]&&(u=n.custom["dynamic-image-area-height"])}}l=+l,u=+u,null==r&&(r=.5*l),r=+r,null==c&&(c=.5*u),c=+c;let h=null;t&&t.fit&&(h=t.fit);let m=null;m=t&&null!=t.density&&t.density>1?t.density:72;let d=1;if(n.custom["dynamic-image-area-dpi"]){const e=+n.custom["dynamic-image-area-dpi"];e>1&&(d=e/m)}const p=t.scale?t.scale:this.fitDynamicImage(n,e,s,o,r,c,a,h,d);if("center"===n.custom["dynamic-image-fit-offset"]){const e=.5*l,t=.5*u;n.custom["dynamic-image-offset-x"]=e.toFixed(4),n.custom["dynamic-image-offset-y"]=t.toFixed(4)}null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-title",value:t.title})&&(n.custom["dynamic-image-title"]=t.title),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-name",value:t.name})&&(n.custom["dynamic-image-name"]=t.name),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-url",value:t.url})&&(n.custom["dynamic-image-url"]=t.url),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-pngUrl",value:t.pngUrl})&&(n.custom["dynamic-image-pngUrl"]=t.pngUrl),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-jpgUrl",value:t.jpgUrl})&&(n.custom["dynamic-image-jpgUrl"]=t.jpgUrl),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-width",value:s})&&(n.custom["dynamic-image-width"]=s),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-height",value:o})&&(n.custom["dynamic-image-height"]=o),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-x",value:r})&&(n.custom["dynamic-image-x"]=r),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-y",value:c})&&(n.custom["dynamic-image-y"]=c),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-scale",value:p})&&(n.custom["dynamic-image-scale"]=p),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-rotate",value:a})&&(n.custom["dynamic-image-rotate"]=a),null==this.emit("setReactive",{target:n.custom,key:"dynamic-image-is-placeholder",value:!1})&&(n.custom["dynamic-image-is-placeholder"]=!1)}}))}})),n(i),this.stateChanged({repaint:!0})}))}commitCustomPlacementAttributes(e,t){return new Promise((n=>{const i={accepted:!1};let s=null;this.state.forEach((t=>{t.placement&&t.component&&t.placement.code===e&&(s=t.placement)})),s&&(null==s.custom&&(s.custom={}),Object.keys(t).forEach((e=>{s.custom[e]!==t[e]&&(i.accepted=!0,null==this.emit("setReactive",{target:s.custom,key:e,value:t[e]})&&(s.custom[e]=t[e]))}))),n(i),i.accepted&&this.stateChanged({repaint:!0})}))}commitCustomAttributes(e,t,n){return new Promise((i=>{const s={accepted:!1},o=[];this.state.forEach((t=>{t.placement&&t.component&&t.placement.code===e&&(n&&n.propagate?o.push(...t.placement.components):o.push(t.component))})),o.forEach((e=>{null==e.custom&&(e.custom={}),Object.keys(t).forEach((n=>{e.custom[n]!==t[n]&&(s.accepted=!0,null==this.emit("setReactive",{target:e.custom,key:n,value:t[n]})&&(e.custom[n]=t[n]))}))})),n&&n.flushStateCache&&this.resetStateCache(),i(s),s.accepted&&this.stateChanged({repaint:!0})}))}fitDynamicImage(e,t,n,i,s,o,a,r,c){let l=e.custom["dynamic-image-fit"]||t.custom&&t.custom["dynamic-image-fit"]||"none";null!=r&&(l=r);let u=e.custom["dynamic-image-area-width"]||t.custom&&t.custom["dynamic-image-area-width"];if(null==u){const e=(this.blueprint.views||[]).filter((e=>"Camera"!==e.viewType))[0];if(e&&e.placements){const n=e.placements.find((e=>e.code===t.code));n&&n.custom&&n.custom["dynamic-image-area-height"]&&(u=n.custom["dynamic-image-area-height"])}}let h=e.custom["dynamic-image-area-height"]||t.custom&&t.custom["dynamic-image-area-height"];if(null==h){const e=(this.blueprint.views||[]).filter((e=>"Camera"!==e.viewType))[0];if(e&&e.placements){const n=e.placements.find((e=>e.code===t.code));n&&n.custom&&n.custom["dynamic-image-area-height"]&&(h=n.custom["dynamic-image-area-height"])}}const m=+(e.custom["dynamic-image-scale-min"]||t.custom&&t.custom["dynamic-image-scale-min"]||"0.1"),d=+(e.custom["dynamic-image-scale-max"]||t.custom&&t.custom["dynamic-image-scale-max"]||"5"),p=c||1;if("none"===l)return c||1;let f=n*p,g=i*p;if("fit"===l){if(f>u){const e=u/f;if(g*e<=h)return Math.min(d,Math.max(m,e*p))}if(g>h){const e=h/g;if(f*e<=u)return Math.min(d,Math.max(m,e*p))}return p}if("contain"===l){const e=u/f;if(g*e<=h)return Math.min(d,Math.max(m,e*p));const t=h/g;return f*t<=u?Math.min(d,Math.max(m,t*p)):p}if("cover"===l){f=n,g=i;const e=u/f;if(g*e>=h)return e;return h/g}return p}updatePersonalization(e,t,n){return new Promise((i=>{const s=n&&n.preview;let o={preview:s,accepted:!0,acceptedAs:t},a=null;this.state.forEach((t=>{t.placement&&t.component&&t.placement.code===e&&(a=t.component.code)})),(this.blueprint.groups||[]).forEach((i=>{(i.placements||[]).forEach((i=>{if(i.code===e&&i.components)for(let e=0;e<i.components.length;e+=1){const r=i.components[e];if(r.placeholder)continue;let c=t,l=!0,u=!0;if(r.custom){if("uppercase"===r.custom["personalization-transform"]&&(c=(c||"").toUpperCase(),u=!0),"lowercase"===r.custom["personalization-transform"]&&(c=(c||"").toLowerCase(),u=!0),!n||!n.noEnforceLimit){if(r.custom["personalization-limit"]&&r.custom["personalization-limit"].length>0&&c.replace(/\n/g,"").length>+r.custom["personalization-limit"]&&(l=!1),r.custom["personalization-limit-line"]&&r.custom["personalization-limit-line"].length>0){const e=+r.custom["personalization-limit-line"];(c||"").split("\n").map((e=>e.trim())).some((t=>t.length>e))&&(l=!1)}if(r.custom["personalization-limit-lines"]&&r.custom["personalization-limit-lines"].length>0){const e=+r.custom["personalization-limit-lines"];(c||"").split("\n").map((e=>e.trim())).length>e&&(l=!1)}}(r.custom["personalization-validate"]||"").length>0&&(new RegExp(r.custom["personalization-validate"]||"").test(c)||(l=!1))}i.custom&&(i.custom["personalization-validate"]||"").length>0&&(new RegExp(i.custom["personalization-validate"]||"").test(c)||(l=!1)),l?(s||null==this.emit("setReactive",{target:r.custom,key:"personalization-text",value:c})&&(r.custom["personalization-text"]=c),u&&a===r.code&&(o={preview:s,accepted:!0,as:c,acceptedAs:c})):a===r.code&&(o={accepted:!1,lastValid:r.custom["personalization-text"]||""})}}))})),o.accepted&&this.resetStateCache(),i(o),s||this.stateChanged({repaint:!0})}))}imageName(e,t,n,i){let s=this.blueprint.imageNameFormat||[],o=e,a=e,r=t;if("string"==typeof o?o=this.findComponent(o):(a=e.code,null==r&&(r=e.placementIndependentCode)),o&&null!=o.assets&&o.assets.length>0){const e=(i||"").toString();let t=o.assets.find((t=>t.frame===e&&"Asset"===t.type));if(null==t&&(t=o.assets.find((e=>e.frame===n.code&&"Asset"===e.type))),null==t&&(t=o.assets.find((e=>(null==e.frame||""===e.frame)&&"Asset"===e.type))),t)return t.asset;if(t=o.assets.find((t=>t.frame===e&&"AssetFromAttribute"===t.type)),null==t&&(t=o.assets.find((e=>e.frame===n.code&&"AssetFromAttribute"===e.type))),null==t&&(t=o.assets.find((e=>(null==e.frame||""===e.frame)&&"AssetFromAttribute"===e.type))),t){let e=null;if((this.rootController||this).forAllControllers((n=>{n.blueprint&&n.blueprint.custom&&n.blueprint.custom[t.asset]&&(e=n.blueprint.custom[t.asset])})),e){const t=(e,t)=>e.endsWith(t)?e.substr(0,e.length-t.length):e;return e=t(e,".gltf"),e=t(e,".glb"),e=t(e,".png"),e=t(e,".jpg"),e=t(e,".jpeg"),e=t(e,".webp"),e=t(e,".svg"),e}}}o&&o.custom&&o.custom["image-name-format"]&&(s=o.custom["image-name-format"]),o&&o.custom&&o.custom["image-name-code"]&&(a=o.custom["image-name-code"],r=o.custom["image-name-code"]),"string"==typeof s&&(s=JSON.parse(s));let c="";return s.forEach((e=>{switch(e.type){case"static":c+=e.text;break;case"code":c+=a;break;case"placementless-code":c+=r||a;break;case"view":null!=n.code&&(c+=n.code);break;case"frame":{let t=(i||"1").toString();for(;t.length<Math.min(10,e.width);)t="0"+t;c+=t;break}}})),c}mapImageName(e,t,n){let i=e;if(t)for(let e=0;e<t.length;e+=1){const s=t[e];if(s.from===i){i=s.to;let e="",t=!1;if(null!=s.r&&0!==s.r&&(n&&n.noRotation||(t=!0)),t?e+="&rotate="+(s.r+(n&&n.rotate?n.rotate:0)):n&&n.rotate&&(e+="&rotate="+n.rotate),null!=s.x&&null!=s.y){const{x:t,y:n}=s;e+="&pos="+Math.round(t)+","+Math.round(n)}if(null!=s.sx&&null!=s.sy?e+="&scale="+(parseFloat(s.sx.toString())+(n&&n.scale?n.scale:0)).toFixed(4):n&&n.scale&&(e+="&scale="+n.scale.toFixed(4)),n&&null!=n.x&&null!=n.y&&(e+=`&pos=${(+n.x).toFixed(4)},${(+n.y).toFixed(4)}`),n&&n.viewTransform){const t=/\s*\w+\([^)]+\)\s*/g;for(;;){let i=t.exec(n.viewTransform);if(null==i)break;i.length>0&&(i=i[0].trim().replace("(","=").replace(")",""),e+=`&${i}`)}}return{name:i,suffix:e}}}if(n&&n.background)return i;const s={name:i,suffix:""};if(n&&n.rotate?s.suffix+=`&rotate=${n.rotate}`:n&&n.componentRotate&&(s.suffix+=`&rotate=${n.componentRotate}`),n&&n.scale?s.suffix+=`&scale=${n.scale.toFixed(4)}`:n&&n.componentScale&&(s.suffix+=`&scale=${(+n.componentScale).toFixed(4)}`),n&&n.size?s.suffix+=`&size=${n.size.toFixed(4)}`:n&&n.componentSize&&(s.suffix+=`&size=${n.componentSize}`),n&&null!=n.x&&null!=n.y?s.suffix+=`&pos=${(+n.x).toFixed(4)},${(+n.y).toFixed(4)}`:n&&null!=n.componentX&&null!=n.componentY&&(s.suffix+=`&pos=${(+n.componentX).toFixed(4)},${(+n.componentY).toFixed(4)}`),n&&n.viewTransform){const e=/\s*\w+\([^)]+\)\s*/g;for(;;){let t=e.exec(n.viewTransform);if(null==t)break;t.length>0&&(t=t[0].trim().replace("(","=").replace(")",""),s.suffix+=`&${t}`)}}return s}baseFrameUrl(e){let t=this.blueprint.imageRootUrl;return this.settings.imageRootUrlOverride&&(t=this.settings.imageRootUrlOverride),"/"!==t[t.length-1]&&(t+="/"),null==e&&"?"!==t[t.length-1]&&(t+="?"),t}getAccountName(){let e=this.blueprint.imageRootUrl;"/"===e[e.length-1]&&(e=e.substr(0,e.length-1));const t=e.lastIndexOf("/");return t>=0&&(e=e.substr(t+1)),e}shadowOrGlow(e,t,n,i){let s=n,o=i;return t.forEach((t=>{const n=t.split(" ");if(4===n.length||5===n.length){const t="inset"===n[0],i=parseInt(n[t?1:0],10),a=parseInt(n[t?2:1],10),r=parseInt(n[t?3:2],10);let c=n[t?4:3],l=100;if("rgba("===c.substr(0,5))c=c.replace(/\s/g,""),c=c.substr(5,c.length-5-1).split("|"),c.length>3&&(l=Math.floor(100*parseFloat(c[3]))),c=c[0]+","+c[1]+","+c[2];else{let e,t,n,i;e=c.length>2?parseInt(c.substr(1,2),16):255,t=c.length>4?parseInt(c.substr(3,2),16):255,n=c.length>6?parseInt(c.substr(5,2),16):255,i=c.length>4?parseInt(c.substr(7,2),16):255,c=e+","+t+","+n,l=Math.floor(i/255*100)}s.length>0&&(s+="&"),t?(s+="effect="+o,o+=1):(s+="effect=-"+o,o+=1),s+="&"+e,s+="&op_blur="+r,s+="&pos="+Math.round(i)+","+Math.round(a),s+="&color="+c,s+="&opac="+l}})),{effects:s,effectIndex:o}}addEffectShadows(e,t,n){let i=n,s=t;const o=(e||"").replace(/\s+/g," ").replace(/,\s+/g,",").replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([.\d]+)\s*\)/g,"rgba($1|$2|$3|$4)").split(","),a=this.shadowOrGlow("$shadow$",o,s,i);return a&&(s.length>0&&(s+="&"),({effects:s,effectIndex:i}=a)),{effects:s,effectIndex:i}}addEffectGlow(e,t,n){let i=n,s=t;const o=(e||"").replace(/\s+/g," ").replace(/,\s+/g,",").replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([.\d]+)\s*\)/g,"rgba($1|$2|$3|$4)").split(","),a=this.shadowOrGlow("$glow$",o,s,i);return a&&(s.length>0&&(s+="&"),({effects:s,effectIndex:i}=a)),{effects:s,effectIndex:i}}componentEffects(e,t,n){let i=e;"string"==typeof i&&(i=this.findComponent(i));let s=n,o=t;if(i&&i.custom){if(i.custom["effect-colorize"]&&(o+="&op_colorize="+i.custom["effect-colorize"].replace("#","")),i.custom["effect-colorize-add"]&&(o+="&op_colorizeadd="+i.custom["effect-colorize-add"].replace("#","")),i.custom["effect-shadow"]){const e=this.addEffectShadows(i.custom["effect-shadow"],o,s);e&&({effects:o,effectIndex:s}=e)}if(i.custom["effect-glow"]){const e=this.addEffectGlow(i.custom["effect-glow"],o,s);e&&({effects:o,effectIndex:s}=e)}i.custom.effects&&i.custom.effects.split(",").map((e=>e.trim())).forEach((e=>{if("shadow"===e.substr(0,6)){const t=this.addEffectShadows(e.substr(6).trim(),o,s);t&&({effects:o,effectIndex:s}=t)}if("glow"===e.substr(0,4)){const t=this.addEffectGlow(e.substr(4).trim(),o,s);t&&({effects:o,effectIndex:s}=t)}}))}return{effects:o,effectIndex:s}}customEffects(e,t,n){let i=n,s=t;return(e||[]).forEaxh((e=>{if("shadow"===e.type){const t=(e.effect||"").replace(/\s+/g," ").split(","),n=this.shadowOrGlow("$shadow$",t,s,i);n&&({effects:s,effectIndex:i}=n)}if("glow"===e.type){const t=(e.effect||"").replace(/\s+/g," ").split(","),n=this.shadowOrGlow("$glow$",t,s,i);n&&({effects:s,effectIndex:i}=n)}})),{effects:s,effectIndex:i}}componentImage(e,t,n,i,s,o){if("drive"===this.blueprint.imageProvider||"scene7"===this.blueprint.imageProvider){let t=this.baseFrameUrl();const s=i,a=this.mapImageName(this.imageName(s,null,e,n),this.blueprint.imageMapping,o);t.indexOf("?")>=0&&"?"!==t[t.length-1]&&(t+="&"),t+="layer=1",a.name?t+="&src="+encodeURIComponent(a.name):t+="&src="+encodeURIComponent(a);let r="fmt=png-alpha";return e.custom&&e.custom["image-file-format-component"]&&(r=e.custom["image-file-format-component"]),t+="&"+r,this.blueprint.imageCacheId&&this.blueprint.imageCacheId.length>0&&(t+="&"+this.blueprint.imageCacheId),t=t.replace("http://","//").replace("https://","//"),t}return null}findComponentMapping(e,t,n,i){const s=this.imageName(i,null,e,n),o=this.blueprint.imageMapping;if(o)for(let e=0;e<o.length;e+=1){const t=o[e];if(t.from===s)return t}return null}makeComponentUrl(e,t,n,i,s,o,a,r){if("drive"===this.blueprint.imageProvider||"scene7"===this.blueprint.imageProvider){let t=this.baseFrameUrl(),c=-1;if(o&&e.background){const i=this.mapImageName(this.imageName(e.background,null,e,n),this.blueprint.imageMapping,{background:!0});t.indexOf("?")>=0&&"?"!==t[t.length-1]&&(t+="&"),t+="layer="+(c+=1),i.name?i.suffix?t+="&src="+encodeURIComponent(i.name)+i.suffix:t+="&src="+encodeURIComponent(i.name):t+="&src="+encodeURIComponent(i),t+="&op_colorize=0,0,0,0"}let l=!1,u=i;"highlight"===s?(u+=this.blueprint.imageHighlightedSuffix||"--H",l=!0):"select"===s&&(u+=this.blueprint.imageSelectedSuffix||"--S",l=!0);const h=this.mapImageName(this.imageName(u,null,e,n),this.blueprint.imageMapping,a);t.indexOf("?")>=0&&"?"!==t[t.length-1]&&(t+="&"),t+="layer="+(c+=1),h.name?h.suffix?t+="&src="+encodeURIComponent(h.name)+h.suffix:t+="&src="+encodeURIComponent(h.name):t+="&src="+encodeURIComponent(h);let m=1;if(a)if(a.noEffects)l=!0;else if(a.effects){const e=this.customEffects(a.effects,"",m);t+="&"+e.effects,({effectIndex:m}=e)}if(!l){let e=!1;if(a&&a.overrideEffects&&(e=!0),!e){const e=this.componentEffects(u,"",m);t+="&"+e.effects,({effectIndex:m}=e)}}if(c>=0){let n="fmt=png-alpha";e.custom&&e.custom["image-file-format-component"]&&(n=e.custom["image-file-format-component"]),r&&r.opaque&&(n="fmt=jpeg"),r&&r.transparent&&(n="fmt=png-alpha"),t+="&"+n}return this.blueprint.imageCacheId&&this.blueprint.imageCacheId.length>0&&(t+="&"+this.blueprint.imageCacheId),t=t.replace("http://","//").replace("https://","//"),t}return null}resolveLocal(e,t,n,i){Object.keys(e).forEach((s=>{const o=e[s];if(null!=o&&"["===o[0]){const a=JSON.parse(o);let r=!1;a.forEach((n=>{if((!n.placement||n.placement===t.placement.code)&&n.option){let i=!1;t.component.description&&t.component.description.some((e=>e.code===n.option))&&(i=!0),i&&(e[s]=n.value,r=!0)}})),a.forEach((o=>{if(r)return;let a=!0;if(!o.placement||o.placement===t.placement.code){if(o.option){let e=!1;n.forEach((t=>{if(e)return;const n=t.component;n.description&&(e=e||n.description.some((e=>e.code===o.option)))})),e||(a=!1)}o.view&&o.view!==i.code&&(a=!1),a&&(e[s]=o.value,r=!0)}})),r||a.forEach((t=>{r||t.default&&(e[s]=t.default,r=!0)}))}})),Object.keys(e).forEach((t=>{const n=e[t];null!=n&&("["===n[0]||"{"===n[0]&&"{{#"!==n.substr(0,3))&&(e[t]=null)}))}isNumber(e){return null!=e&&("number"==typeof e||e.length>0)}addOverlay(e,t,n,i,s,o){let a=null,r=null,c=null,l=null;t.custom&&t.custom.overlay&&(a=t.custom.overlay),n.custom&&n.custom.overlay&&(a=n.custom.overlay),i&&i.custom&&i.custom.overlay&&(a=i.custom.overlay),t.custom&&t.custom["overlay-blend"]&&(c=t.custom["overlay-blend"]),n.custom&&n.custom["overlay-blend"]&&(c=n.custom["overlay-blend"]),i&&i.custom&&i.custom["overlay-blend"]&&(c=i.custom["overlay-blend"]),t.custom&&t.custom["overlay-color"]&&(l=t.custom["overlay-color"]),n.custom&&n.custom["overlay-color"]&&(l=n.custom["overlay-color"]),i&&i.custom&&i.custom["overlay-color"]&&(l=i.custom["overlay-color"]),l&&(l=l.replace("#","")),t.custom&&t.custom["overlay-size"]&&(r=t.custom["overlay-size"]),n.custom&&n.custom["overlay-size"]&&(r=n.custom["overlay-size"]),i&&i.custom&&i.custom["overlay-size"]&&(r=i.custom["overlay-size"]);let u=e;if(a){const e=this.mapImageName(this.imageName(a,null,s,o),this.blueprint.imageMapping,{background:!0});e.name?e.suffix?u+="&over="+encodeURIComponent(e.name)+e.suffix:u+="&over="+encodeURIComponent(e.name):u+="&over="+encodeURIComponent(e)}return c&&(u+="&overblend="+c),l&&(u+="&overcolor="+l),r&&(u+="&oversize="+r),u}convertTable(e,t){return e.map((e=>({index:+e.substr(e.lastIndexOf("-")+1),value:t[e]}))).sort(((e,t)=>e.index-t.index))}makeFrameUrl(e,t,n,i){let s=this.blueprint.imageNameFormat||[];if("string"==typeof s&&(s=JSON.parse(s)),s.length>0&&s.some((e=>"template"===e.type))){let e="";return s.forEach((n=>{if("static"===n.type&&(e+=n.text),"template"===n.type){let i=n.text;t.forEach((e=>{const t="${"+e.placement.code+"}",n=e.component.placementIndependentCode;i=i.replace(t,n),e.component.custom&&Object.keys(e.component.custom).forEach((t=>{const n="${"+e.placement.code+":"+t+"}",s=e.component.custom[t];i=i.replace(n,s)}))})),e+=i}})),e=e.replace(/\$\{[^}]*}/g,""),e}let o=this.baseFrameUrl(),a=-1,r=1;if(i&&i.baseWidth&&(o.indexOf("?")>=0&&"?"!==o[o.length-1]&&(o+="&"),o+="wid="+i.baseWidth),i&&i.baseHeight&&(o.indexOf("?")>=0&&"?"!==o[o.length-1]&&(o+="&"),o+="hei="+i.baseHeight),e.background&&(!i||!i.afterPlacement)){let s=!1;if(i&&i.afterPlacement&&(s=!0),i&&i.noBackground&&(s=!0),!s){const s=this.mapImageName(this.imageName(e.background,null,e,n),this.blueprint.imageMapping,{background:!0});o.indexOf("?")>=0&&"?"!==o[o.length-1]&&(o+="&"),o+="layer="+(a+=1),s.name?s.suffix?o+="&src="+encodeURIComponent(s.name)+s.suffix:o+="&src="+encodeURIComponent(s.name):o+="&src="+encodeURIComponent(s),i&&i.onlyPlacement&&t[0].placement.code!==i.onlyPlacement&&(o+="&op_colorize=0,0,0,0"),i&&i.onlyPlacements&&(i.onlyPlacements.includes(t[0].placement.code)||(o+="&op_colorize=0,0,0,0"))}}const c={"personalization-text":null,"personalization-font":null,"personalization-bold":null,"personalization-italic":null,"personalization-size":null,"personalization-scale":null,"personalization-scale-box":null,"personalization-x":null,"personalization-y":null,"personalization-offset-x":null,"personalization-offset-y":null,"personalization-offset-size-x":null,"personalization-offset-size-y":null,"personalization-width":null,"personalization-height":null,"personalization-curve-radius":null,"personalization-curve-start":null,"personalization-color":null,"personalization-effects":null,"personalization-effect-shadow":null,"personalization-effect-glow":null,"personalization-effect-colorize":null,"personalization-effect-colorize-add":null,"personalization-pattern":null,"personalization-pattern-scale":null,"personalization-pattern-background":null,"personalization-alignment":null,"personalization-rotate":null,"personalization-skewx":null,"personalization-skewy":null,"personalization-layout":null,"personalization-tag-box":null,"personalization-size-fit-min":null,"personalization-text-flow":null,"personalization-vertical-alignment":null,"personalization-line-height":null,"personalization-line-height-value":null,"personalization-line-height-min":null,"personalization-line-tight-spacing":null,"personalization-vertical-spacing":null,"personalization-line-wrap":null,"personalization-stroke":null,"personalization-stroke-cap":null,"personalization-stroke-join":null,"personalization-stroke-miter":null,"personalization-linear-gradient":null,"personalization-merge-lines":null,"personalization-merge-condensed":null,"personalization-monogram-format":null};t.forEach((e=>{const t=e.component;t.custom&&(Object.keys(c).forEach((e=>{const n=t.custom[e];null!=n&&("["===n[0]||"{"===n[0]&&"{{#"!==n.substr(0,3))&&(c[e]=n)})),Object.keys(t.custom).forEach((e=>{if(e.startsWith("personalization-size-")){const n=t.custom[e];null!=n&&("["===n[0]||"{"===n[0]&&"{{#"!==n.substr(0,3))&&(c[e]=n)}})))}));const l={"dynamic-image-x":null,"dynamic-image-y":null,"dynamic-image-area-center-x":null,"dynamic-image-area-center-y":null,"dynamic-image-area-width":null,"dynamic-image-area-height":null,"dynamic-image-rotate":null},u={};t.forEach((e=>{if(e.component.custom){let t=null,n=null;e.component.custom["personalization-merge-lines"]?(t=e.component.custom["personalization-merge-lines"],n="lines"):e.component.custom["personalization-merge-condensed"]?(t=e.component.custom["personalization-merge-condensed"],n="condensed"):e.placement.custom["personalization-merge-lines"]?(t=e.placement.custom["personalization-merge-lines"],n="lines"):e.placement.custom["personalization-merge-condensed"]&&(t=e.placement.custom["personalization-merge-condensed"],n="condensed"),t&&t.length>0&&(u[e.placement.code]={type:n,merge:t.split(",").map((e=>e.trim()))})}}));const h=Object.keys(u),m=Object.values(u);t.forEach((e=>{const t=e.component;t.custom&&Object.keys(l).forEach((e=>{const n=t.custom[e];null!=n&&(l[e]=n)}))}));let d=!0,p=!1;const f=[];if(t.forEach(((e,t)=>{f.push({placement:e,explicit:e.placement.custom&&null!=e.placement.custom["explicit-order"]?+e.placement.custom["explicit-order"]:Number.MAX_SAFE_INTEGER,native:t})})),f.sort(((e,t)=>e.explicit<t.explicit?-1:e.explicit>t.explicit?1:e.native<t.native?-1:e.native>t.native?1:0)),f.forEach((s=>{const{placement:f}=s;if(!i||!i.onlyPlacement&&!i.onlyPlacements){let t=!1;if(i&&i.baking&&(t=!0),this.emit("placementHidden",{placement:f,view:e,baking:t}))return;if(i&&i.hiddenPlacements&&i.hiddenPlacements.includes(f.placement.code))return}if(i&&i.beforePlacement&&(f.placement.code===i.beforePlacement&&(d=!1),!d))return;if(i&&i.afterPlacement){if(f.placement.code===i.afterPlacement)return void(p=!0);if(!p)return}if(i&&i.onlyPlacement&&f.placement.code!==i.onlyPlacement)return;if(i&&i.onlyPlacements&&!i.onlyPlacements.includes(f.placement.code))return;if(e.onlySelectedPlacements){let t=!1;if(e.placements&&e.placements.forEach((e=>{f.placement.code&&e.code===f.placement.code&&(t=!0)})),!t)return}if(e.placements){let t=!1;if(e.placements.forEach((e=>{f.placement.code&&e.code===f.placement.code&&e.custom&&"true"===e.custom.hidden&&(t=!0)})),t)return}if(e.custom&&"false"===e.custom["render-placeholders"]&&f.component.placeholder)return;if(!h.includes(f.placement.code)&&m.some((e=>e.merge.includes(f.placement.code))))return;let g=null,y=null,b=null,v=null,w=null;if(e.custom&&(g=e.custom.transform),e.placements){let t=!1;if(e.placements.forEach((e=>{f.placement.code&&e.code===f.placement.code&&(w=e,e.hidden&&(t=!0),e.custom&&(e.custom.transform&&(g=e.custom.transform),e.custom["image-blend"]&&(y=e.custom["image-blend"]),e.custom["image-color"]&&(b=e.custom["image-color"]),e.custom["object-mask"]&&(v=e.custom["object-mask"])))})),t)return}const S=`view-${e.code}-`,k=`view-${e.code}-${f.placement.code}-`;t.forEach((e=>{const t=e.component;t&&t.custom&&Object.entries(t.custom).forEach((e=>{let t=null;e[0].startsWith(k)?t=e[0].substr(k.length):e[0].startsWith(S)&&(t=e[0].substr(S)),t&&("transform"===t&&(g=e[1]),"image-blend"===t&&(y=e[1]),"image-color"===t&&(b=e[1]),"object-mask"===t&&(v=e[1]))}))}));let A=!1;if(f.placement.custom&&"dynamic-image"===f.placement.custom["widget-type"]){const n=f.component,s={...l};w&&w.custom&&Object.keys(s).forEach((e=>{const t=w.custom[e];null!=t&&(s[e]=t)})),f.placement.custom&&Object.keys(s).forEach((e=>{const t=f.placement.custom[e];null!=t&&(s[e]=t)})),Object.keys(s).forEach((e=>{const t=n.custom[e];null!=t&&(s[e]=t)}));const r=n.custom["dynamic-image-name"];if(null!=r&&r.length>0){this.resolveLocal(s,f,t,e);let c=+(s["dynamic-image-x"]||n.custom["dynamic-image-x"]||0),l=+(s["dynamic-image-y"]||n.custom["dynamic-image-y"]||0),u=s["dynamic-image-area-center-x"]||n.custom["dynamic-image-area-center-x"],h=s["dynamic-image-area-center-y"]||n.custom["dynamic-image-area-center-y"];const m=+(n.custom["dynamic-image-scale"]||1);c-=.5*+(s["dynamic-image-area-width"]||n.custom["dynamic-image-area-width"]||0),l-=.5*+(s["dynamic-image-area-height"]||n.custom["dynamic-image-area-height"]||0);const d=+(n.custom["dynamic-image-offset-x"]||0),p=+(n.custom["dynamic-image-offset-y"]||0),y=+(n.custom["dynamic-image-rotate"]||0),b=this.mapImageName(r,this.blueprint.imageMapping,{viewTransform:g,componentX:f.placement.custom&&f.placement.custom["placement-x"]||f.component.custom&&f.component.custom["component-x"],componentY:f.placement.custom&&f.placement.custom["placement-y"]||f.component.custom&&f.component.custom["component-y"],componentScale:f.placement.custom&&f.placement.custom["placement-scale"]||f.component.custom&&f.component.custom["component-scale"],componentSize:f.placement.custom&&f.placement.custom["placement-size"]||f.component.custom&&f.component.custom["component-size"],componentRotate:f.placement.custom&&f.placement.custom["placement-rotate"]||f.component.custom&&f.component.custom["component-rotate"]});o.indexOf("?")>=0&&"?"!==o[o.length-1]&&(o+="&"),o+="layer="+(a+=1),A=!0,w&&w.custom&&w.custom.group&&"string"==typeof w.custom.group&&(i&&i.onlyPlacement?(w.custom["group-width"]&&(o+="&wid="+w.custom["group-width"]),w.custom["group-height"]&&(o+="&hei="+w.custom["group-height"])):(o+="&group="+w.custom.group,w.custom["group-width"]&&(o+="&gw="+w.custom["group-width"]),w.custom["group-height"]&&(o+="&gh="+w.custom["group-height"])));let S=!1;w&&w.custom&&w.custom.wrap&&(S=!0),f.component.custom&&f.component.custom.wrap&&(S=!0),S&&(o+="&wrap=all"),w&&w.custom&&w.custom.projection&&(o+="&prj="+w.custom.projection,w.custom["projection-radius"]&&(o+="&prjr="+w.custom["projection-radius"]),w.custom["projection-quality"]&&(o+="&prjq="+w.custom["projection-quality"]),w.custom["projection-arc-offset"]&&(o+="&prjo="+w.custom["projection-arc-offset"]),w.custom["projection-arc-start"]&&(o+="&prja="+w.custom["projection-arc-start"]),w.custom["projection-arc-end"]&&(o+="&prje="+w.custom["projection-arc-end"])),b.name?b.suffix?o+="&src="+encodeURIComponent(b.name)+b.suffix:o+="&src="+encodeURIComponent(b.name):o+="&src="+encodeURIComponent(b),null!=v?"none"!==v&&(o+="&omask="+v):n.custom["dynamic-image-mask"]&&(o+="&omask="+n.custom["dynamic-image-mask"]),this.isNumber(u)&&this.isNumber(h)&&(u-=.5*+(s["dynamic-image-area-width"]||n.custom["dynamic-image-area-width"]||0),h-=.5*+(s["dynamic-image-area-height"]||n.custom["dynamic-image-area-height"]||0),o+=`&pos=${u},${h}`),o+=`&osize=${s["dynamic-image-area-width"]||n.custom["dynamic-image-area-width"]},${s["dynamic-image-area-height"]||n.custom["dynamic-image-area-height"]}`,o+=`&opos=${d+c},${p+l}`,o+=`&oscale=${m}`,o+=`&orotate=${y}`,n.custom["dynamic-image-background"]&&(o+=`&obgc=${n.custom["dynamic-image-background"]}`)}}else if(f.placement.custom&&"personalization"===f.placement.custom["widget-type"]){const n=f.component;if(e.custom&&"false"===e.custom["render-placeholders"]&&n.custom&&(!n.custom["personalization-text"]||0===n.custom["personalization-text"].length))return;const s={...c};f.placement.custom&&(Object.keys(s).forEach((e=>{const t=f.placement.custom[e];null!=t&&(s[e]=t)})),Object.keys(f.placement.custom).forEach((e=>{if(e.startsWith("personalization-size-")){const t=f.placement.custom[e];null!=t&&(s[e]=t)}}))),Object.keys(s).forEach((e=>{const t=n.custom[e];null!=t&&(s[e]=t)})),Object.keys(n.custom).forEach((e=>{if(e.startsWith("personalization-size-")){const t=n.custom[e];null!=t&&(s[e]=t)}})),w&&w.custom&&Object.keys(s).forEach((e=>{null!=w.custom[e]&&(s[e]=w.custom[e])})),s["personalization-text"]=n.custom?n.custom["personalization-text"]:"",this.resolveLocal(s,f,t,e),o.indexOf("?")>=0&&"?"!==o[o.length-1]&&(o+="&"),o+="layer="+(a+=1),A=!0,w&&w.custom&&w.custom.group&&"string"==typeof w.custom.group&&(i&&i.onlyPlacement?(w.custom["group-width"]&&(o+="&wid="+w.custom["group-width"]),w.custom["group-height"]&&(o+="&hei="+w.custom["group-height"])):(o+="&group="+w.custom.group,w.custom["group-width"]&&(o+="&gw="+w.custom["group-width"]),w.custom["group-height"]&&(o+="&gh="+w.custom["group-height"]))),w&&w.custom&&w.custom.projection&&(o+="&prj="+w.custom.projection,w.custom["projection-radius"]&&(o+="&prjr="+w.custom["projection-radius"]),w.custom["projection-slices"]&&(o+="&prjq="+w.custom["projection-slices"]),w.custom["projection-arc-offset"]&&(o+="&prjo="+w.custom["projection-arc-offset"]),w.custom["projection-arc-start"]&&(o+="&prja="+w.custom["projection-arc-start"]),w.custom["projection-arc-end"]&&(o+="&prje="+w.custom["projection-arc-end"]));let l=null,h=null;f.placement.custom&&f.placement.custom["personalization-add-before-all"]&&(h=f.placement.custom["personalization-add-before-all"]),f.placement.custom&&f.placement.custom["personalization-add-after-all"]&&(l=f.placement.custom["personalization-add-after-all"]),f.component.custom&&f.component.custom["personalization-add-before-all"]&&(h=f.component.custom["personalization-add-before-all"]),f.component.custom&&f.component.custom["personalization-add-after-all"]&&(l=f.component.custom["personalization-add-after-all"]);let m=null,d=null;f.placement.custom&&f.placement.custom["personalization-add-before-all-empty"]&&(d=f.placement.custom["personalization-add-before-all-empty"]),f.placement.custom&&f.placement.custom["personalization-add-after-all-empty"]&&(m=f.placement.custom["personalization-add-after-all-empty"]),f.component.custom&&f.component.custom["personalization-add-before-all-empty"]&&(d=f.component.custom["personalization-add-before-all-empty"]),f.component.custom&&f.component.custom["personalization-add-after-all-empty"]&&(m=f.component.custom["personalization-add-after-all-empty"]);let p=s["personalization-text"];if(null!=p&&p.length>0||null!=l&&l.length>0||null!=h&&h.length>0){null==p&&(p="");const e=f.placement.code;if(u[e]&&u[e].merge.length>0){let n="";const i=u[e];u[e].merge.forEach((s=>{let o=null,a=null,r=null;s===e?(f.placement.custom&&f.placement.custom["personalization-merge-before"]&&(a=f.placement.custom["personalization-merge-before"]),f.placement.custom&&f.placement.custom["personalization-merge-after"]&&(r=f.placement.custom["personalization-merge-after"]),f.component.custom&&f.component.custom["personalization-merge-before"]&&(a=f.component.custom["personalization-merge-before"]),f.component.custom&&f.component.custom["personalization-merge-after"]&&(r=f.component.custom["personalization-merge-after"]),o=p):t.forEach((e=>{if(e.placement.code===s&&e.component.custom){const t=e.component.custom["personalization-text"];o=t&&t.length>0?t:"",e.placement.custom&&e.placement.custom["personalization-merge-before"]&&(a=e.placement.custom["personalization-merge-before"]),e.placement.custom&&e.placement.custom["personalization-merge-after"]&&(r=e.placement.custom["personalization-merge-after"]),e.component.custom&&e.component.custom["personalization-merge-before"]&&(a=e.component.custom["personalization-merge-before"]),e.component.custom&&e.component.custom["personalization-merge-after"]&&(r=e.component.custom["personalization-merge-after"])}})),o&&o.length>0&&("lines"===i.type&&n.length>0&&(n+="\n"),null!=a&&(n+=a),n+=o,null!=r&&(n+=r))})),p=n}0===p.length?(d&&d.length>0&&(p=d+p),m&&m.length>0&&(p+=m)):(h&&h.length>0&&(p=h+p),l&&l.length>0&&(p+=l));let n=s["personalization-line-wrap"];if(n&&(n=+n,n>0)){const e=p.split("\n"),t=[];e.forEach((e=>{e.length>n?t.push(...e.match(new RegExp(`.{1,${n}}`,"g"))):t.push(e)})),p=t.join("\n")}let i="",a=s["personalization-font"];null!=a&&a.length>0&&(a.includes(",")?(a=a.split(/[, ]+/),4===a.length&&(a={init:a[0],medi:a[1],fina:a[2],isol:a[3]},i+="{\\fonttbl{\\f1"+a.init+";}}\\f1")):i+="{\\fonttbl{\\f1"+a+";}}\\f1");let c=s["personalization-color"];null!=c&&c.length>0&&("#"===c.substr(0,1)&&(c=c.substr(1)),i+="{\\iscolortbl;"+c+";}\\cf1");let y=null;const b=s["personalization-size"];if(null!=b&&b.length>0){let e=+b;const t=p.split("\n");let n=Object.keys(s).filter((e=>e.startsWith("personalization-size-line-")));if(n.length>0)n=this.convertTable(n,s),n.forEach((n=>{t.some((e=>e.length>=n.index))&&(e=+n.value)}));else{let n=Object.keys(s).filter((e=>e.startsWith("personalization-size-")&&"personalization-size-fit-min"!==e));if(n.length>0){n=this.convertTable(n,s);const i=t.reduce(((e,t)=>e+t.length),0);n.forEach((t=>{i>=t.index&&(e=+t.value)}))}}const o=s["personalization-scale"];null!=o&&("number"==typeof o?e*=o:o.length>0&&(e*=+o)),y=Math.floor(+e),i+="\\fs"+y}s["personalization-bold"]&&(i+="\\b"),s["personalization-italic"]&&(i+="\\i"),"vertical"===s["personalization-text-flow"]&&(i+="\\stextflow5"),"top"===s["personalization-vertical-alignment"]&&(i+="\\vertalt"),"bottom"===s["personalization-vertical-alignment"]&&(i+="\\vertalb"),"center"===s["personalization-vertical-alignment"]&&(i+="\\vertalc");let v="\\qc";if("left"===s["personalization-alignment"]&&(v="\\ql"),"right"===s["personalization-alignment"]&&(v="\\qr"),"center"===s["personalization-alignment"]&&(v="\\qc"),s["personalization-line-height"]&&(i+="\\slmult"+s["personalization-line-height"]),s["personalization-line-height-value"]&&(i+="\\slabso"+s["personalization-line-height-value"]),s["personalization-line-height-min"]&&(i+="\\slmini"+s["personalization-line-height-min"]),s["personalization-line-tight-spacing"]&&(i+="\\slspac"+s["personalization-line-tight-spacing"]),s["personalization-vertical-spacing"]&&(i+="\\slvmult"+s["personalization-vertical-spacing"]),i+=v,null!=s["personalization-monogram-format"]&&s["personalization-monogram-format"].length>0){const e=s["personalization-monogram-format"].split(",").map((e=>e.trim()));e.sort(((e,t)=>t.length-e.length));let t=!1;for(let n=0;n<e.length;n+=1){const i=e[n];if(0===i.length)continue;let s=0;for(let e=0;e<i.length;e+=1){const t=i[e];("?"===t||t>="A"&&t<="Z"||t>="a"&&t<="z")&&(s+=1)}if(s>p.length)continue;let o="",a=0;for(let e=0;e<i.length;e+=1){const t=i[e];"?"===t?(o+=p[a],a+=1):o+=t>="A"&&t<="Z"?p[t.charCodeAt(0)-"A".charCodeAt(0)].toUpperCase():t>="a"&&t<="z"?p[t.charCodeAt(0)-"a".charCodeAt(0)].toLowerCase():t}t=!0,p=o;break}t||(p=""),a&&"object"==typeof a&&(p=0===p.length||1===p.length?`{{# font=${a.isol}}}${p}{{/}}`:2===p.length?`{{# font=${a.init}}}${p[0]}{{/}}{{# font=${a.fina}}}${p[1]}{{/}}`:`{{# font=${a.init}}}${p[0]}{{/}}{{# font=${a.medi}}}${p.substr(1,p.length-2)}{{/}}{{# font=${a.fina}}}${p[p.length-1]}{{/}}`),i+=" "+encodeURIComponent(p)}else i+=" "+encodeURIComponent(p);let w=+(s["personalization-x"]||"0"),S=+(s["personalization-y"]||"0"),k=+(s["personalization-offset-x"]||"0"),A=+(s["personalization-offset-y"]||"0");s["personalization-offset-size-x"]&&y&&(k+=+s["personalization-offset-size-x"]*y),s["personalization-offset-size-y"]&&y&&(A+=+s["personalization-offset-size-y"]*y),w+=k,S+=A;let x=null;s["personalization-rotate"]&&(x=+(s["personalization-rotate"]||"0"));let E=+(s["personalization-width"]||"0"),C=+(s["personalization-height"]||"0");const z=+(s["personalization-curve-radius"]||"0"),_=+(s["personalization-curve-start"]||"0"),O=s["personalization-pattern"],M=s["personalization-pattern-scale"];O&&"drive"===this.blueprint.imageProvider&&(o+="&pattern="+O,M&&(o+="&patternscale="+M)),o+="&textPs="+i;let P=s["personalization-scale-box"];if(P&&P.length>0){P=+P;const e=E,t=C;E*=P,C*=P,w+=.5*(e-E),S+=.5*(t-C),E=Math.round(100*E)/100,C=Math.round(100*C)/100,w=Math.round(100*w)/100,S=Math.round(100*S)/100}if(o+="&size="+E+","+C,o+="&pos="+w+","+S,s["personalization-skewx"]&&(o+="&skewx="+s["personalization-skewx"]),s["personalization-skewy"]&&(o+="&skewy="+s["personalization-skewy"]),x&&(o+="&rotate="+x),o+="&tag="+f.placement.code,s["personalization-layout"]&&(o+="&layout="+s["personalization-layout"]),s["personalization-tag-box"]&&(o+="&tagbox="+s["personalization-tag-box"]),s["personalization-size-fit-min"]&&(o+="&fontmin="+s["personalization-size-fit-min"]),s["personalization-stroke"]&&(o+="&textstroke="+s["personalization-stroke"]),s["personalization-stroke-cap"]&&(o+="&strokecap="+s["personalization-stroke-cap"]),s["personalization-stroke-join"]&&(o+="&strokejoin="+s["personalization-stroke-join"]),s["personalization-stroke-miter"]&&(o+="&strokemiter="+s["personalization-stroke-miter"]),s["personalization-linear-gradient"]&&(o+="&lineargradient="+encodeURIComponent(s["personalization-linear-gradient"])),g){const e=/\s*\w+\([^)]+\)\s*/g;for(;;){let t=e.exec(g);if(null==t)break;t.length>0&&(t=t[0].trim().replace("(","=").replace(")",""),o+=`&${t}`)}}z&&(o+=_?"&arc="+z+","+_:"&arc="+z);const T=s["personalization-effect-colorize"];T&&(o+="&op_colorize="+T.replace("#",""));const R=s["personalization-effect-colorize-add"];R&&(o+="&op_colorizeadd="+R.replace("#",""));const I=s["personalization-effects"];I&&I.split(",").map((e=>e.trim())).forEach((e=>{if("shadow"===e.substr(0,6)){const t=this.addEffectShadows(e.substr(6).trim(),"",r);t&&t.effects&&t.effects.length>0&&(o+="&"+t.effects,({effectIndex:r}=t))}if("glow"===e.substr(0,4)){const t=this.addEffectGlow(e.substr(4).trim(),"",r);t&&t.effects&&t.effects.length>0&&(o+="&"+t.effects,({effectIndex:r}=t))}if("innerstroke"===e.substr(0,11)){r+=1;const t=e.split(" ").filter((e=>e.length>0));"innerstroke"===t[0]&&(o+="&effect="+r+"&$innerstroke$",t.length>1&&(o+="&strokewidth="+t[1]),t.length>2&&(o+="&color="+t[2].replace("#","")))}if("emboss"===e.substr(0,6)){r+=1;const t=e.split(" ").filter((e=>e.length>0));"emboss"===t[0]&&(o+="&effect="+r+"&$emboss$",o+="&pos="+t[1]+","+t[2]+","+t[3],t.length>4&&(o+="&lc="+t[4]),t.length>5&&(o+="&kd="+t[5]),t.length>6&&(o+="&ku="+t[6]),t.length>7&&(o+="&color="+t[7].replace("#","")))}}));const F=s["personalization-effect-shadow"];if(F){const e=this.addEffectShadows(F,"",r);e&&e.effects&&e.effects.length>0&&(o+="&"+e.effects,({effectIndex:r}=e))}const j=s["personalization-effect-glow"];if(j){const e=this.addEffectGlow(j,"",r);e&&e.effects&&e.effects.length>0&&(o+="&"+e.effects,({effectIndex:r}=e))}}}else if(f.component){let t=!1,s=f.component.code,r=f.component.placementIndependentCode;f.placement.custom&&f.placement.custom.source&&(t=!0,s=f.placement.custom.source,r=f.placement.custom.source),f.component.custom&&f.component.custom.source&&(t=!0,s=f.component.custom.source,r=f.component.custom.source),w&&w.custom&&w.custom.source&&(t=!0,s=w.custom.source,r=w.custom.source);let c=null;if(t)c=s;else{let t=f.placement.custom&&f.placement.custom["placement-x"]||f.component.custom&&f.component.custom["component-x"];w&&w.custom&&w.custom["placement-x"]&&(t=+w.custom["placement-x"]);let i=f.placement.custom&&f.placement.custom["placement-y"]||f.component.custom&&f.component.custom["component-y"];w&&w.custom&&w.custom["placement-y"]&&(i=+w.custom["placement-y"]);let o=f.placement.custom&&f.placement.custom["placement-scale"]||f.component.custom&&f.component.custom["component-scale"];w&&w.custom&&w.custom["placement-scale"]&&(o=+w.custom["placement-scale"]);let a=f.placement.custom&&f.placement.custom["placement-size"]||f.component.custom&&f.component.custom["component-size"];w&&w.custom&&w.custom["placement-size"]&&(a=+w.custom["placement-size"]);let l=f.placement.custom&&f.placement.custom["placement-rotate"]||f.component.custom&&f.component.custom["component-rotate"];w&&w.custom&&w.custom["placement-rotate"]&&(l=+w.custom["placement-rotate"]),c=this.mapImageName(this.imageName(s,r,e,n),this.blueprint.imageMapping,{viewTransform:g,componentX:t,componentY:i,componentScale:o,componentSize:a,componentRotate:l})}if(o.indexOf("?")>=0&&"?"!==o[o.length-1]&&(o+="&"),o+="layer="+(a+=1),A=!0,w&&w.custom&&w.custom.group&&"string"==typeof w.custom.group&&(i&&i.onlyPlacement?(w.custom["group-width"]&&(o+="&wid="+w.custom["group-width"]),w.custom["group-height"]&&(o+="&hei="+w.custom["group-height"])):(o+="&group="+w.custom.group,w.custom["group-width"]&&(o+="&gw="+w.custom["group-width"]),w.custom["group-height"]&&(o+="&gh="+w.custom["group-height"]))),w&&w.custom&&w.custom.projection&&(o+="&prj="+w.custom.projection,w.custom["projection-radius"]&&(o+="&prjr="+w.custom["projection-radius"]),w.custom["projection-slices"]&&(o+="&prjq="+w.custom["projection-slices"]),w.custom["projection-arc-offset"]&&(o+="&prjo="+w.custom["projection-arc-offset"]),w.custom["projection-arc-start"]&&(o+="&prja="+w.custom["projection-arc-start"]),w.custom["projection-arc-end"]&&(o+="&prje="+w.custom["projection-arc-end"])),c.name?c.suffix?o+="&src="+encodeURIComponent(c.name)+c.suffix:o+="&src="+encodeURIComponent(c.name):o+="&src="+encodeURIComponent(c),t&&g&&g.length>0){const e=/\s*\w+\([^)]+\)\s*/g;for(;;){let t=e.exec(g);if(null==t)break;t.length>0&&(t=t[0].trim().replace("(","=").replace(")",""),o+=`&${t}`)}}}if(A){const e=this.componentEffects(f.component.code,"",r);if(e.effects&&e.effects.length>0&&(o+="&"+e.effects,({effectIndex:r}=e)),w&&w.custom){const e=this.componentEffects(w,"",r);e.effects&&e.effects.length>0&&(o+="&"+e.effects,({effectIndex:r}=e))}}A&&(o=this.addOverlay(o,f.placement,f.component,w,e,n));let x=null;f.component.custom.filters&&(x=f.component.custom.filters),w&&w.custom&&null!=w.custom.filters&&(x=w.custom.filters),x&&(o+="&fltr="+encodeURI(x));let E=!1;f.component.custom["thread-width"]&&(o+="&thw="+encodeURIComponent(f.component.custom["thread-width"]),E=!0),f.component.custom["thread-spread"]&&(o+="&ths="+encodeURIComponent(f.component.custom["thread-spread"]),E=!0),f.component.custom["thread-min-luminosity"]&&(o+="&thm="+encodeURIComponent(f.component.custom["thread-min-luminosity"]),E=!0),f.component.custom["thread-gradient"]&&(o+="&thg="+encodeURIComponent(f.component.custom["thread-gradient"]),E=!0),f.component.variables&&E&&f.component.variables.forEach((e=>{const t=e.value||e.defaultValue,n=this.findByPlacementIndependentCode(t);n&&n.custom&&n.custom.hex&&(o+="&v="+encodeURIComponent(n.custom.hex))})),f.component.custom["object-size"]&&(o+="&osize="+encodeURIComponent(f.component.custom["object-size"]));let C=null;if(f.component.custom&&f.component.custom.mask&&({mask:C}=f.component.custom),f.placement.custom&&f.placement.custom.mask&&({mask:C}=f.placement.custom),w&&w.custom&&null!=w.custom.mask&&({mask:C}=w.custom),null==C&&e.custom&&e.custom.mask&&({mask:C}=e.custom),C&&A){const t=this.mapImageName(this.imageName(C,null,e,n),this.blueprint.imageMapping,{background:!0});t.name?t.suffix?o+="&mask="+encodeURIComponent(t.name)+t.suffix:o+="&mask="+encodeURIComponent(t.name):o+="&mask="+encodeURIComponent(t)}let z=null;if(w&&w.custom&&null!=w.custom["clip-mask"]&&(z=w.custom["clip-mask"]),z&&A){const t=this.mapImageName(this.imageName(z,null,e,n),this.blueprint.imageMapping,{background:!0});t.name?t.suffix?o+="&clipmask="+encodeURIComponent(t.name)+t.suffix:o+="&clipmask="+encodeURIComponent(t.name):o+="&clipmask="+encodeURIComponent(t)}i&&i.transparent||y&&(o+="&blend="+y),b&&(o+="&color="+b)})),a>=0){e.custom&&e.custom["sync-font-size"]&&(o+="&syncfsize="+e.custom["sync-font-size"]),e.custom&&e.custom["sync-font-scale"]&&(o+="&syncfscale="+e.custom["sync-font-scale"]);let t="fmt=png-alpha";e.custom&&e.custom["image-file-format-frame"]&&(t=e.custom["image-file-format-frame"]),i&&i.opaque&&(t="fmt=jpeg"),i&&i.transparent&&(t="fmt=png-alpha"),i&&i.baking&&e.custom&&e.custom["image-file-format-frame-bake"]&&(t=e.custom["image-file-format-frame-bake"]),o+="&"+t}return o=o.replace("http://","//").replace("https://","//"),this.blueprint.imageCacheId&&this.blueprint.imageCacheId.length>0&&(o+="&"+this.blueprint.imageCacheId),o}createRecipe(e){let t={blueprintUrl:this.resolveBlueprintUrl(!0),name:this.blueprint.name,related:[],version:this.blueprint.version,styleCode:this.blueprint.styleCode,components:[],custom:{...this.blueprint.custom||{}}};this.globalTags.length>0&&(t.addedTags=[...this.globalTags]),e&&e.childRecipe&&(t.childRecipe=e.childRecipe),e&&e.temporaryRecipe&&(t.temporaryRecipe=e.temporaryRecipe),e&&e.externalInventory&&(t.externalInventory=e.externalInventory),e&&null!=e.batch&&(t.custom.batch=e.batch),e&&null!=e.batchIndex&&(t.custom["batch-index"]=e.batchIndex.toString());const n=[];(this.products()||[]).forEach((e=>{const i=this.findProduct(e);i&&[...i.path].reverse().forEach((e=>{n.indexOf(e.styleCode)<0&&(n.push(e.styleCode),t.related.push(e))}))}));const i=[];t.related.forEach((e=>{e.custom&&e.custom["product-type.essential"]&&"product"===e.custom["product-type.essential"]&&(i.push(e),t.name=e.name,t.styleCode=e.styleCode)})),t.related.forEach((e=>{e.custom&&e.custom["product-type.essential"]&&"product"===e.custom["product-type.essential"]||i.push(e)})),t.related=i,this.state.forEach((n=>{if(n.placement&&n.component){let i={code:n.component.code,dynamicCode:n.component.code,sku:n.component.sku,upc:n.component.upc};e&&e.translateCode&&(i=e.translateCode(i,n.component,n.placement));const s=this.placementTags[n.placement.code],o={name:n.placement.name,code:n.placement.code,description:n.placement.description,custom:{...n.placement.custom||{}}};null!=s&&s.length>0&&(o.addedTags=[...s]);const a=this.componentTags[n.component.code];o.component={placeholder:n.component.placeholder,code:i.code,trackAs:n.component.trackAs,sku:i.sku,upc:i.upc,dynamicCode:i.dynamicCode,placementIndependentCode:n.component.placementIndependentCode,quantityMultiplier:(n.component.quantityMultiplier||1)*(n.placement.quantityMultiplier||1),name:n.component.name,description:n.component.description,custom:{...n.component.custom||{}},views:[]},null!=a&&a.length>0&&(o.component.addedTags=[...a]),i.code!==n.component.code&&(o.component.originCode=n.component.code,o.component.originDynamicCode=n.component.dynamicCode),(this.blueprint.views||[]).forEach((e=>{if(e.bakeInRecipe){let t;e.bakedFrame?({bakedFrame:t}=e):("Single"===e.viewType&&(t=e.frameLow),"Range"===e.viewType&&(t=e.frameLow));let i=this.imageName(n.component.code,n.component.placementIndependentCode,e,t);i=this.mapImageName(i,this.blueprint.imageMapping),i&&i.name&&(i=i.name);const s={name:e.name,code:e.code,preview:i};o.component.views.push(s)}})),t.components.push(o)}})),e&&e.translateRecipe&&e.translateRecipe(t,this);const s=[];(this.blueprint.views||[]).forEach((e=>{if(e.bakeInRecipe||e.productionReady){let n;e.bakedFrame?({bakedFrame:n}=e):("Single"===e.viewType&&(n=e.frameLow),"Range"===e.viewType&&(n=e.frameLow));const i=t.components.map(((e,t)=>{const n={placement:e,component:{...e.component}};return this.state[t]&&(n.component.code=this.state[t].component.code),n})),o=this.makeFrameUrl(e,i,n,{baking:!0}),a={name:e.name,code:e.code,continueOnError:e.continueOnError,preview:o};e.custom&&e.custom["override-recipe-code"]&&(a.code=e.custom["override-recipe-code"]),e.custom&&(a.custom={...e.custom}),e.productionReady&&(a.productionReady=!0),e.variants&&e.variants.length>0&&(a.variants=e.variants.map((e=>({code:e.code,suffix:e.suffix})))),s.push(a)}})),t.views=s,this.blueprint.custom&&"true"===this.blueprint.custom["translate-recipe-after"]&&e&&e.translateRecipe&&e.translateRecipe(t,this),e&&e.translateRecipeAfter&&e.translateRecipeAfter(t,this);const o=this.collectActiveTags();return t.tags=o,t=JSON.parse(JSON.stringify(t,((e,t)=>{if(null!=t)return t}))),t}saveBatch(e){return new Promise((t=>{const n=[],i=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)+(new Date).getTime().toString();if(!e||!e.accepted)throw new Error("saveBatch requires accepted callback function");for(let t=0;e.accepted(t);t+=1){const s={...e};s.batch=i,s.batchIndex=t;const o=this.createRecipe(s);n.push(o)}s.default.post(this.resolveBlueprintUrl(!1,!0),n).then((e=>{const n=JSON.parse(JSON.stringify(e.data));t(n)}))}))}trackAction(e){if(e){const t=this.resolveServiceUrl("action/record");let n={};this.rootController&&(n=this.rootController.standardAnalytics);const i={...n,...this.standardAnalytics,...e};if(this.emit("trackAction",i),this.allowAnalytics&&((0,c.default)(t,i),this.allowDataLayer&&this.allowDataLayer.length>0)){window.dataLayer=window.dataLayer||[];const e={event:this.allowDataLayer};for(const t of Object.keys(i))e[`cz_${t}`]=i[t];window.dataLayer.push(e)}}}queryDataGrid(e){return new Promise(((t,n)=>{const i=this.resolveServiceUrl("query/datagrid"),o=this.settings.serviceTimeout||3e4;s.default.post(i,e,{timeout:o,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const n=JSON.parse(JSON.stringify(e.data));t(n)})).catch((e=>{e.data?n(e.data):n(e)}))}))}skuToUpc(e){return new Promise(((t,n)=>{const i=this.resolveServiceUrl("query/skutoupc"),o=this.settings.serviceTimeout||3e4;s.default.post(i,{sku:e},{timeout:o,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const n=e.data.upc;t(n)})).catch((e=>{e.data?n(e.data):n(e)}))}))}skusToUpcs(e){return new Promise(((t,n)=>{const i=this.resolveServiceUrl("query/skustoupcs"),o=this.settings.serviceTimeout||3e4;s.default.post(i,{skus:e},{timeout:o,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const n=e.data;t(n)})).catch((e=>{e.data?n(e.data):n(e)}))}))}skusToInventory(e,t){return new Promise(((n,i)=>{const o=this.resolveServiceUrl("query/skustoinventory"),a=this.settings.serviceTimeout||3e4;s.default.post(o,{skus:e,locations:t},{timeout:a,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const t=e.data;n(t)})).catch((e=>{e.data?i(e.data):i(e)}))}))}upcsToInventory(e,t){return new Promise(((n,i)=>{const o=this.resolveServiceUrl("query/upcstoinventory"),a=this.settings.serviceTimeout||3e4;s.default.post(o,{upcs:e,locations:t},{timeout:a,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const t=e.data;n(t)})).catch((e=>{e.data?i(e.data):i(e)}))}))}reviewText(e){return new Promise(((t,n)=>{const i=this.resolveServiceUrl("review/text"),o=this.settings.serviceTimeout||3e4,a={text:e};this.settings.moderationLocale&&"any"!==this.settings.moderationLocale&&(a.locale=this.settings.moderationLocale),s.default.post(i,a,{timeout:o,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const n=JSON.parse(JSON.stringify(e.data));this.allowStandardAnalytics&&this.trackAction({category:"moderation",action:"text-validated"}),t(n)})).catch((e=>{this.allowStandardAnalytics&&this.trackAction({category:"moderation",action:"text-rejected"}),e.data?n(e.data):n(e)}))}))}mapValue(e,t){return new Promise(((n,i)=>{let o=this.resolveBlueprintUrl();o=o.replace("/blueprint/","/blueprint/map/"),o+=`&name=${e}&value=${encodeURIComponent(t)}`,s.default.get(o).then((e=>{const t=e.data;n(t)})).catch((e=>{e.data?i(e.data):i(e)}))}))}askAssistant(e,t,n,i){return new Promise(((o,a)=>{let r=this.resolveBlueprintUrl();const c=new URL(r);c.pathname+="/assistant/chat",r=c.toString();let l={};e&&e.length>0&&("text"===t&&(l={sessionKey:e,messageType:t,message:n}),"image"===t&&(l={sessionKey:e,messageType:t,message:n,image:i}));const u=this.settings.assistantTimeout||12e4;s.default.post(r,l,{timeout:u,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const t=JSON.parse(JSON.stringify(e.data));o(t)})).catch((e=>{e.data?a(e.data):a(e)}))}))}saveRecipe(e){return new Promise(((t,n)=>{const i=this.createRecipe(e);i.session=this.standardAnalytics.sessionId;const o=this.settings.recipeTimeout||6e4;s.default.post(this.resolveBlueprintUrl(),i,{timeout:o,headers:{"X-Referrer":"undefined"!=typeof window?window.location.href:"nodejs"}}).then((e=>{const n=JSON.parse(JSON.stringify(e.data));if(this.allowStandardAnalytics){let e=this.settings.products;if(e&&Array.isArray(e)&&(e=e.join(",")),!i.temporaryRecipe){const t=this.collectActiveTags();this.trackAction({category:"blueprint",action:"saved",recipe:n.id,value:e,tags:t})}}t(n)})).catch((e=>{e.data?n(e.data):n(e)}))}))}parameter(e,t){if("undefined"!=typeof window){const n=RegExp("[?&]"+e+"=([^&]*)").exec(t||window.location.search);return n&&decodeURIComponent(n[1].replace(/\+/g," "))}return null}resolveBlueprintUrl(e,t){let n=this.settings.blueprint;if("function"==typeof n){let{products:e}=this.settings;if("string"==typeof e&&(e=[e]),null==e&&this.settings.product&&(e=Array.isArray(this.settings.product)?this.settings.product:[this.settings.product]),null==e)return this.emit("error",{message:"Products list (options.product or options.products) is required."}),null;n=n(e)}if(!n){let{products:e}=this.settings;if("string"==typeof e&&(e=[e]),null==e&&this.settings.product&&(e=Array.isArray(this.settings.product)?this.settings.product:[this.settings.product]),null==e)return this.emit("error",{message:"Products list (options.product or options.products) is required."}),null;n=this.settings.endpoint+"blueprint/"+e.join(",");const t=this.parameter("customizer-blueprint-preview-version");t&&t.length>0?n+="/"+t+"/":null==this.settings.version?n+="/_/":n+="/"+this.settings.version+"/";const i=this.parameter("customizer-blueprint-preview-site");i&&i.length>0?n+=i:null==this.settings.site?n+="_":n+=this.settings.site}if(t&&(n+="/batch"),e||this.settings.apiKey&&(n=n.indexOf("?")<0?n+"?apikey="+this.settings.apiKey:n+"&apikey="+this.settings.apiKey),this.settings.preview)n=n.indexOf("?")<0?n+"?preview="+this.settings.preview:n+"&preview="+this.settings.preview;else{const e=this.parameter("customizer-blueprint-preview");e&&(n=n.indexOf("?")<0?n+"?preview="+e:n+"&preview="+e)}return this.settings.disableCaching&&(n.indexOf("?")<0?n+="?cache=nocache":n+="&cache=nocache"),this.settings.locale&&(n.indexOf("?")<0?n+="?locale="+this.settings.locale:n+="&locale="+this.settings.locale),n=n.replace("api/v4","api/v2"),n}resolveServiceUrl(e){let t=this.settings.endpoint+"blueprint/"+e;return this.settings.apiKey&&(t=t.indexOf("?")<0?t+"?apikey="+this.settings.apiKey:t+"&apikey="+this.settings.apiKey),t=t.replace("api/v4","api/v2"),t}loadBlueprint(e){return new Promise((t=>{const n=this.emit("beforeLoadBlueprint",{blueprintUrl:e});if(this.blueprintReady=!1,n)return this.setBlueprint(n),void this.initializeBlueprint();const i=this.settings.timeout||3e4;s.default.get(e,{timeout:i}).then((e=>{this.hydrateBlueprint(e.data),this.setBlueprint(e.data),this.initializeBlueprint().then((e=>{t(e)}))})).catch((e=>{this.emit("load-error",{error:e})}))}))}reloadBlueprint(e){return new Promise((t=>{const n=this.settings.timeout||3e4;this.emit("beforeReloadBlueprint",{blueprintUrl:e}),s.default.get(e,{timeout:n}).then((e=>{this.hydrateBlueprint(e.data),this.previousBlueprint=this.blueprint,this.previousState=this.state;const n=this.clone();n.blueprintReady=!1,n.state=[],n.blueprint=e.data,n.initializeBlueprint({transferFrom:{state:this.previousState}}).then((()=>{n.off(),this.setBlueprint(n.blueprint),this.state.length=0,n.state.forEach((e=>{this.state.push(e)})),this.assembly=n.assembly,this.socketsState=n.socketsState,this.stateChanged({repaint:!0}),t(this)}))})).catch((e=>{this.emit("load-error",{error:e})}))}))}initializeBlueprint(e){return this.hydrateBlueprint(this.blueprint),this.setupAnalytics(this.blueprint),new Promise((t=>{this.initializeState().then((n=>{const i=()=>{this.stateChanged({first:!0}),this.settings.preloadedAssembly&&this.settings.preloadedAssembly.forEach((({slot:e,controller:t})=>{const n=this.allSockets().find((t=>t.socket.code===e));if(n){let e=!0;if(n.socket.jointTags){const i=n.socket.jointTags;e=!1;let s=!1;for(let o=0;o<i.length;o+=1){const a=i[o];if(null==t.blueprint.tags){this.emit("error",{message:`Socket ${n.socket.code} requires tags but the suggested controller does not have tags defined.`}),e=!1,s=!0;break}if(t.blueprint.tags.includes(a)){e=!0;break}}e||s||(this.emit("error",{message:`Socket ${n.socket.code} requires one of ${n.socket.jointTags.join(", ")} tags but the suggested controller does not have the tag defined.`}),s=!0)}e&&this.attachToSocket(n.id,t)}else this.emit("error",{message:`Could not find socket ${e}.`})})),setTimeout((()=>{this._triggerEffectsInitial=!0,this._triggerCodedEffects({},1),this._triggerEffectsInitial=!1,this.emit("afterAssembliesBuilt",{blueprint:this.blueprint});let e=this.settings.products;e&&Array.isArray(e)&&(e=e.join(",")),this.allowStandardAnalytics&&this.trackAction({category:"blueprint",action:"loaded",value:e}),t(this)}))},s=()=>{this._updateAssembly({noUpdateNotification:!0}),e&&e.transferFrom&&null==this.emit("beforeTransferCompatibleState",{controller:this,from:e.transferFrom})&&this.transferCompatibleState(e.transferFrom),this.blueprintReady=!0;const t=this.emit("afterInitializeBlueprint",{blueprint:this.blueprint});t instanceof Promise?t.then((()=>{i()})):i()};this.setState(n),this.validateComponents();const o=this.emit("afterInitializeState",{state:this.state});o instanceof Promise?o.then((()=>{s()})):s()}))}))}deepFreeze(e){const t=Reflect.ownKeys(e);for(const n of t){const t=e[n];"__ob__"!==n&&(Object.isFrozen(t)||(t&&"object"==typeof t||"function"==typeof t)&&this.deepFreeze(t))}return Object.freeze(e)}hydrateBlueprint(e){e.rules&&this.deepFreeze(e.rules),(e.groups||[]).forEach((e=>{(e.placements||[]).forEach((e=>{e.tags&&Object.freeze(e.tags),(e.components||[]).forEach((e=>{e.tags&&Object.freeze(e.tags)}))}))}))}setupAnalytics(e){if(this.standardAnalytics.sessionId=function(){const e=new Uint8Array(16);crypto.getRandomValues(e);const t=Date.now();return e[0]=t/1099511627776&255,e[1]=t/4294967296&255,e[2]=t/16777216&255,e[3]=t/65536&255,e[4]=t/256&255,e[5]=255&t,e[6]=15&e[6]|112,e[8]=63&e[8]|128,Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join("").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5")}(),e.collectAnalytics&&(this.allowAnalytics=!0),e.collectStandardAnalytics&&(this.allowStandardAnalytics=!0),e.collectDataLayer&&(this.allowDataLayer=e.collectDataLayer),e.collectDeviceBasicAnalytics||e.collectDeviceMoreAnalytics){const t=o.default.parse(window.navigator.userAgent);t&&(e.collectDeviceBasicAnalytics&&t.platform&&"mobile"===t.platform.type&&(this.standardAnalytics.browserMobile=!0),e.collectDeviceMoreAnalytics&&t.browser&&(this.standardAnalytics.browserName=t.browser.name,this.standardAnalytics.browserVersion=t.browser.version))}if(e.collectDeviceDimensionsAnalytics){const e=function(){const e=window.innerWidth,t=[1,320,375,425,768,1024,1280,1440,1600,1920,2560];for(let n=t.length-1;n>=0;n-=1)if(e>=t[n])return t[n];return 1}(),t=function(){const e=window.innerHeight,t=[1,400,480,500,600,660,720,760,900,940,1e3,1080,1440,1920];for(let n=t.length-1;n>=0;n-=1)if(e>=t[n])return t[n];return 1}();this.standardAnalytics.browserWidth=e,this.standardAnalytics.browserHeight=t}this.settings.site&&(this.standardAnalytics.siteCodes=this.settings.site),this.settings.locale&&(this.standardAnalytics.locales=this.settings.locale),this.settings.initialAnalyticsParameters&&Object.assign(this.standardAnalytics,this.settings.initialAnalyticsParameters);const t=new URLSearchParams(window.location.search);t&&t.has("czpj")&&t.get("czpj").length>0&&(this.standardAnalytics.projectId=t.get("czpj")),t&&t.has("czch")&&t.get("czch").length>0&&(this.standardAnalytics.cohort=t.get("czch")),t&&t.has("czpg")&&t.get("czpg").length>0&&(this.standardAnalytics.page=t.get("czpg")),t&&t.has("czrg")&&t.get("czrg").length>0&&(this.standardAnalytics.region=t.get("czrg"))}trackSharedActionParameters(e){Object.assign(this.standardAnalytics,e)}stateChanged(e){this.stateTimer&&clearTimeout(this.stateTimer);const t=e&&e.first?75:0;this.stateTimer=setTimeout((()=>{const t={blueprint:this.blueprint,state:this.state,controller:this};e&&Object.assign(t,e),this.emit("stateChanged",t),t&&t.repaint&&this.emit("repaint")}),t)}calculateInitialState(){let e=[];this.temporaryState=e;let t=!1;const n=[],i=e=>{let t;if(this.settings.select)for(let n=0;n<this.settings.select.length;n+=1){let i=this.settings.select[n];if(i&&(i.startsWith("!")?(i=i.substr(1),t=e.components.find((e=>!e.placeholder&&(e.code===i||e.sku&&e.sku===i)&&this.isAvailable(e)))):t=e.components.find((e=>!e.placeholder&&(e.code.includes(i)||e.sku&&e.sku.includes(i))&&this.isAvailable(e)))),t)break}if(null==t&&this.blueprint.initial){const n=this.blueprint.initial.find((t=>t.placement===e.code));if(n){const i=e.components.find((e=>e.code===n.component&&this.isAvailable(e)));i&&(t=i)}}return null==t&&(t=e.components.find((e=>!e.placeholder&&!e.fallback&&e.preferred&&this.isAvailable(e)))),null==t&&(t=e.components.find((e=>e.placeholder&&!e.fallback&&e.preferred&&this.isAvailable(e)))),null==t&&(t=e.components.find((e=>!e.fallback&&this.isAvailable(e)))),null==t&&(t=e.components.find((e=>e.fallback&&e.preferred&&this.isAvailable(e)))),null==t&&(t=e.components.find((e=>e.fallback&&this.isAvailable(e)))),t&&t.custom&&"yes"===t.custom["dynamic-image"]&&t.custom["dynamic-image-placeholder"]&&(t.custom["dynamic-image-is-placeholder"]=!0,t.custom["dynamic-image-name"]=t.custom["dynamic-image-placeholder"],t.custom["dynamic-image-scale"]=+t.custom["dynamic-image-placeholder-scale"],t.custom["dynamic-image-x"]=+t.custom["dynamic-image-placeholder-x"],t.custom["dynamic-image-y"]=+t.custom["dynamic-image-placeholder-y"],t.custom["dynamic-image-width"]=+t.custom["dynamic-image-placeholder-width"],t.custom["dynamic-image-height"]=+t.custom["dynamic-image-placeholder-height"],t.custom["dynamic-image-rotate"]=+t.custom["dynamic-image-placeholder-rotate"]),t};if(this.settings.recipe&&this.settings.recipe.addedTags)for(const e of this.settings.recipe.addedTags)this.addTag(e);if((this.blueprint.groups||[]).forEach((s=>{(s.placements||[]).forEach((s=>{if(s.components){let t=!1;if(this.settings.recipe&&this.settings.recipe.components){const n=this.settings.recipe.components.find((e=>e.code===s.code));if(n&&n.addedTags)for(const e of n.addedTags)this.addPlacementTag(s.code,e);if(n&&n.component&&n.component.code){const i=s.components.find((e=>e.code===n.component.code));if(i&&this.isAvailable(i)){if(t=!0,n.component.custom&&(i.custom||(i.custom={}),Object.assign(i.custom,n.component.custom)),n.component.addedTags)for(const e of n.component.addedTags)this.addComponentTag(i.code,e);e.push({placement:s,component:i})}}}if(!t){const t=i(s);t?e.push({placement:s,component:t}):(e.push({placement:s,component:null}),n.push(s))}}else t=!0}))})),n.length>0){const s=[];n.forEach((t=>{const n=i(t);if(n){const i=e.find((e=>e.placement.code===t.code));i?i.component=n:s.push(t)}else s.push(t)})),s.length>0&&(t=!0)}return e=e.filter((e=>null!=e.placement&&null!=e.component)),this.temporaryState=null,t&&this.emit("incompleteState"),e}_resetInitialState(){this.setState(this.calculateInitialState())}initializeState(){return new Promise((e=>{const t=this.emit("initializeAvailability",{controller:this,blueprint:this.blueprint});t?t.then((()=>{e(this.calculateInitialState())})):setTimeout((()=>{e(this.calculateInitialState())}))}))}socketsOf(e){const t=[];return e.state.forEach((e=>{e.component&&e.component.joints&&e.component.joints.forEach((n=>{"Socket"===n.socketType&&t.push({placement:e.placement,component:e.component,joint:n}),"Anchor"===n.socketType&&t.push({placement:e.placement,component:e.component,joint:n})}))})),t}_updateAssembly(e){this._checkAssembly(this.assembly,this)&&(this.socketsState=this.allSockets(),null!=e&&e.noUpdateNotification||this.emit("socketsUpdated",{assembly:this.assembly,controller:this}))}matchSocketTags(e,t){if(null==e)return null==t;if(null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}_checkAssembly(e,t){let n=!1;const i=this.socketsOf(t),s=[];(i||[]).forEach((i=>{const o=i.joint,a=e.find((e=>e.socket.code===o.code&&this.matchSocketTags(e.socket.jointTags,o.jointTags)));if(a)s.push(a),a.component&&a.component.code!==i.component.code&&(a.component=i.component,a.socket=i.joint,n=!0),a.to&&this._checkAssembly(a.assembly,a.to)&&(n=!0);else{const a={id:this.uniqueId(),socket:o,component:i.component,placement:i.placement,on:t,to:null,assembly:[]};e.push(a),s.push(a),this.emit("socketCreated",{assembly:e,socket:a}),n=!0}}));for(let t=0;t<e.length;)if(s.includes(e[t]))t+=1;else{const i=e[t];e.splice(t,1),this._notifyDeletedSocket(i),n=!0}return n}_notifyDeletedSocket(e){e.assembly&&e.assembly.forEach((e=>{this._notifyDeletedSocket(e)})),e.eventNamespace&&e.to&&e.to.off(e.eventNamespace),this.emit("socketDeleted",e)}allSockets(){const e=[];return this._addSockets(e,this.assembly),e}forAllControllers(e){e(this,"root"),this.allSockets().forEach((t=>{t.to&&e(t.to,t.id)}))}forAllControllersStates(e){this.state.forEach((t=>{e(t,this.state,this,"root")})),this.allSockets().forEach((t=>{t.to&&t.to.state.forEach((n=>{e(n,t.to.state,t.to,t.id)}))}))}_addSockets(e,t){t&&t.forEach((t=>{e.push(t),this._addSockets(e,t.assembly)}))}attachToSocket(e,t){const n=this.allSockets().find((t=>t.id===e));n&&t&&(n.eventNamespace&&n.to&&n.to.off(n.eventNamespace),n.eventNamespace=`.socket-${this.uniqueId()}`,t.socket=n.id,this.rootController?t.rootController=this.rootController:t.rootController=this,this.standardAnalytics.parentSessionId?t.standardAnalytics.parentSessionId=this.standardAnalytics.parentSessionId:t.standardAnalytics.parentSessionId=this.standardAnalytics.sessionId,t.on(`stateChanged${n.eventNamespace}`,(e=>{this._updateAssembly(),this.emit("socketStateChanged",e)})),t.blueprintReady?(n.to=t,this._updateAssembly(),t.dirty||t._resetInitialState(),this.validateAllComponents(),setTimeout((()=>{t._triggerCodedEffects({},1),this.emit("socketAttached",n)}))):(t.on(`afterInitializeBlueprint${n.eventNamespace}`,(()=>{n.to=t,this._updateAssembly(),t.dirty||this._resetInitialState(),this.validateAllComponents(),t._triggerCodedEffects({},1),this.emit("socketAttached",n)})),t.load()))}getProductsByTags(e){return new Promise(((t,n)=>{if(null==e)return void t([]);let i=this.resolveBlueprintUrl();i=i.replace("/blueprint/","/blueprint/tagged/"),i+=`&tags=${encodeURIComponent(e.join(","))}`,s.default.get(i).then((e=>{const n=e.data;t(n)})).catch((e=>{e.data?n(e.data):n(e)}))}))}uniqueId(){return this.uniqueSequence+=1,`${this.uniqueSequence}`}componentNames(e){return null==e||null==e.description?[]:e.description.map((e=>e.name)).filter((e=>null!=e&&e.length>0))}updateVariable(e,t,n){const i=this.selectedAtPlacement(e);if(null==i.variables)return!1;const s=i.variables.find((e=>e.code===t));return null!=s&&(null==this.emit("setReactive",{target:s,key:"value",value:n})&&(s.value=n),this.stateChanged({repaint:!0}),!0)}}t.default=u,e.exports=t.default},191:(e,t,n)=>{"use strict";var i=n(928);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new i(e),t(n.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},202:(e,t,n)=>{"use strict";var i=n(516);e.exports=i.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function s(e){var i=e;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=s(window.location.href),function(t){var n=i.isString(t)?s(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},343:(e,t,n)=>{"use strict";var i=n(516);e.exports=function(e,t){t=t||{};var n={},s=["url","method","params","data"],o=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];i.forEach(s,(function(e){void 0!==t[e]&&(n[e]=t[e])})),i.forEach(o,(function(s){i.isObject(t[s])?n[s]=i.deepMerge(e[s],t[s]):void 0!==t[s]?n[s]=t[s]:i.isObject(e[s])?n[s]=i.deepMerge(e[s]):void 0!==e[s]&&(n[s]=e[s])})),i.forEach(a,(function(i){void 0!==t[i]?n[i]=t[i]:void 0!==e[i]&&(n[i]=e[i])}));var r=s.concat(o).concat(a),c=Object.keys(t).filter((function(e){return-1===r.indexOf(e)}));return i.forEach(c,(function(i){void 0!==t[i]?n[i]=t[i]:void 0!==e[i]&&(n[i]=e[i])})),n}},449:e=>{"use strict";e.exports=function(e,t,n,i,s){return e.config=t,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},468:(e,t,n)=>{"use strict";var i=n(709);t.__esModule=!0,t.default=void 0;var s=i(n(152));t.default=class{constructor(e){this.settings=Object.assign({direction:"up"},e),this.image=null,this.trim=null,this.container=e.container,this.canvas=null,this.dragging=!1,this.dragAbort=!1,this.lastX=null,this.lastY=null,this.offsetX=null,this.offsetY=null,this.clone=null,this.containerEvents={},this.documentEvents={},this.load()}load(){this.container.classList.add("cz-button-loading"),s.default.get(this.settings.segment,this.settings.url,((e,t)=>{this.container.classList.remove("cz-button-loading"),this.image=e,this.make(),0===this.container.offsetWidth&&0===this.container.offsetHeight&&(this.draw(),this.settings.trimHSpace&&(this.trim=t||this.findHSpace(),this.trim&&(this.resizeInternal(),this.draw())),this.settings.update&&this.settings.update()),this.containerEvents={touchmove:e=>this.onTouchMove(e),touchup:e=>this.onTouchUp(e),touchstart:e=>this.onTouchStart(e),mousedown:e=>this.onMouseDown(e)},this.documentEvents={mousemove:e=>this.onMouseMove(e),mouseup:e=>this.onMouseUp(e)},this.container.addEventListener("touchstart",this.containerEvents.touchstart),this.container.addEventListener("mousedown",this.containerEvents.mousedown)}))}make(){const e=this.container.clientWidth,t=this.container.clientHeight,n=this.backingScale(),i='<canvas class="cz-cached-image" width="'+e*n+'" height="'+t*n+'" style="width: '+e+"px; height: "+t+'px;"></canvas>';this.canvas=(new DOMParser).parseFromString(i,"text/html").documentElement.querySelector("canvas"),this.container.insertAdjacentElement("beforeend",this.canvas)}destroy(){Object.keys(this.containerEvents).forEach((e=>{this.container.removeEventListener(e,this.containerEvents[e])})),Object.keys(this.documentEvents).forEach((e=>{this.container.removeEventListener(e,this.documentEvents[e])}))}backingScale(){return 2}resizeInternal(e){let t;const n=this.backingScale(),i=this.container.clientHeight;e?(t=this.container.clientWidth,this.container.style.width=t+"px",this.canvas&&(this.canvas.width=t*n,this.canvas.height=i*n,this.canvas.style.width=t+"px",this.canvas.style.height=i+"px")):this.trim&&(t=this.container.clientWidth,t=t-this.trim.left/n-this.trim.right/n,this.settings&&this.settings.minWidth&&t<this.settings.minWidth&&(t=this.settings.minWidth),this.container.style.width=t+"px",this.canvas&&(this.canvas.width=t*n,this.canvas.height=i*n,this.canvas.style.width=t+"px",this.canvas.style.height=i+"px"))}draw(e){if(e||(e=this.canvas),e&&this.image){const t=e.getContext("2d"),n=e.width,i=e.height;t.clearRect(0,0,n,i);const s=this.backingScale(),o=this.image.width,a=this.image.height;let r=null,c=null;this.settings.fitWidth&&this.settings.fitHeight?(r=this.settings.fitWidth,c=this.settings.fitHeight):this.settings.inheritSizeFrom&&(r=this.settings.inheritSizeFrom.clientWidth,c=this.settings.inheritSizeFrom.clientHeight);const l=this.trim?this.trim.left:0,u=this.trim?this.trim.right:0;let h=o,m=a,d=1;this.settings.idealWidth&&null!=r&&(d=r/this.settings.idealWidth,h=o*d),this.settings.idealHeight&&null!=c&&(m=a*c/this.settings.idealHeight),h*=s,m*=s,t.drawImage(this.image,0,0,o,a,(n+l+u-h)/2-l|0,(i-m)/2|0,h,m)}}findHSpace(){if(this.canvas&&this.image){const e=this.canvas.getContext("2d"),t=this.canvas.width,n=this.canvas.height,i=e.getImageData(0,0,t,n).data;let s=0,o=0;const a=4*t;let r,c,l,u;for(r=0;r<t;r+=1){for(u=!0,c=4*r+3,l=0;l<n;l+=1){if(0!==i[c]){u=!1;break}c+=a}if(!u)break;s+=1}for(r=t-1;r>s;r-=1){for(u=!0,c=4*r+3,l=0;l<n;l+=1){if(0!==i[c]){u=!1;break}c+=a}if(!u)break;o+=1}return{left:s,right:o}}return null}resize(){this.image&&this.container&&0===this.container.offsetWidth&&0===this.container.offsetHeight&&!this.trim&&(this.resizeInternal(!0),this.draw(),this.settings.trimHSpace&&(this.trim||(this.trim=this.findHSpace()),this.trim&&(this.resizeInternal(),this.draw())),this.settings.update&&this.settings.update())}onTouchMove(e){if(e.targetTouches&&e.targetTouches.length>0){const t=e.targetTouches[0].pageX,n=e.targetTouches[0].pageY;this.dragMove(t,n),this.dragging&&(e.preventDefault(),e.stopPropagation())}}onTouchUp(){this.dragEnd()}onMouseMove(e){this.dragMove(e.pageX,e.pageY)}onMouseUp(){this.dragEnd()}dragStart(e,t){this.dragging=!1,this.dragAbort=!1,this.lastX=e,this.lastY=t;const n=this.container.getBoundingClientRect();this.offsetX=e-(n.left+document.body.scrollLeft),this.offsetY=t-(n.top+document.body.scrollTop),this.container.addEventListener("touchmove",this.containerEvents.touchmove,!0),document.addEventListener("mousemove",this.documentEvents.mousemove,!0),this.container.addEventListener("touchend",this.containerEvents.touchup,!0),document.addEventListener("mouseup",this.documentEvents.mouseup,!0)}setDragPosition(e,t){this.clone&&(this.clone.style.left=e-this.offsetX+"px",this.clone.style.top=t-this.offsetY+"px")}dragMove(e,t){if(this.dragAbort)return;const n=t-this.lastY,i=e-this.lastX;"up"===this.setting.direction&&(n>=0?window.innerWidth<=768&&(this.dragAbort=!0,this.dragEnd()):n<-3&&this.startDragging()),"down"===this.setting.direction&&(n<=0?window.innerWidth<=768&&(this.dragAbort=!0,this.dragEnd()):n>3&&this.startDragging()),"left"===this.setting.direction&&(i>=0?window.innerWidth<=768&&(this.dragAbort=!0,this.dragEnd()):i<-3&&this.startDragging()),"down"===this.setting.direction&&(i<=0?window.innerWidth<=768&&(this.dragAbort=!0,this.dragEnd()):i>3&&this.startDragging())}startDragging(e,t){let n=!0;if(this.settings.canDrag&&(this.settings.canDrag(this.container)||(n=!1)),n)if(this.dragging){let n=!1;this.settings.dragMove&&(n=this.settings.dragMove(this.container,e,t)),n?this.clone.style.display="none":(this.clone.style.display="block",this.setDragPosition(e,t))}else this.dragging=!0,this.clone=this.container.cloneNode(!0),this.clone.classList.add("cz-image-button-floating"),document.body.insertAdjacentElement("beforeend",this.clone),this.draw(this.clone.querySelector("canvas")),this.setDragPosition(e,t),this.container.classList.add("cz-image-button-dragging"),this.settings.dragStart&&this.settings.dragStart(this.container)}dragEnd(){this.dragging&&(this.container.classList.remove("cz-image-button-dragging"),this.settings.dragEnd&&this.settings.dragEnd(this.container),this.clone.parentNode.removeChild(this.clone),this.clone=null,this.dragging=!1),this.container.removeEventListener("touchmove",this.containerEvents.touchmove,!0),document.removeEventListener("mousemove",this.documentEvents.mousemove,!0),this.container.removeEventListener("touchend",this.containerEvents.touchup,!0),document.removeEventListener("mouseup",this.documentEvents.mouseup,!0)}onTouchStart(e){e.targetTouches&&e.targetTouches.length>0&&this.dragStart(e.targetTouches[0].pageX,e.targetTouches[0].pageY)}onMouseDown(e){this.dragStart(e.pageX,e.pageY)}},e.exports=t.default},471:(e,t,n)=>{"use strict";var i=n(516);function s(){this.handlers=[]}s.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.forEach=function(e){i.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},490:(e,t,n)=>{"use strict";var i=n(516),s=n(881),o=n(864),a=n(987);function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return r(e),e.headers=e.headers||{},e.data=s(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return r(e),t.data=s(t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(r(e),t&&t.response&&(t.response.data=s(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},497:(e,t,n)=>{"use strict";var i=n(709);t.__esModule=!0,t.default=void 0;var s=i(n(851));t.default=class{constructor(e,t){(0,s.default)(this),this.settings=Object.assign({controller:e,noPartialPaints:!0},t),this.controller=this.settings.controller,this.container=this.settings.container,this.drawables=[],this.container.insertAdjacentElement("beforeend",(new DOMParser).parseFromString('<div class="cz__render"></div>',"text/html").documentElement.querySelector(".cz__render")),this.resize(),this.view=null,this.frame=null,this.loading=0,this.containerEvents={mousedown:e=>this.onMouseDown(e),mouseleave:e=>this.onMouseLeave(e),mousemove:e=>this.onMouseMove(e),click:e=>this.onClick(e),keydown:e=>this.onKeyDown(e)},Object.keys(this.containerEvents).forEach((e=>{this.container.addEventListener(e,this.containerEvents[e])})),this.controllerEvents={afterInitializeBlueprint:e=>this.onAfterInitializeBlueprint(e),stateChanged:e=>this.onStateChanged(e),repaint:e=>this.onRepaint(e)},Object.keys(this.controllerEvents).forEach((e=>{this.controller.on(e,this.controllerEvents[e])})),this.blueprint=this.controller.blueprint}controller(){return this.settings.controller}adoptController(e){Object.keys(this.controllerEvents).forEach((e=>{this.controller.off(e,this.controllerEvents[e])})),this.controller=e,Object.keys(this.controllerEvents).forEach((e=>{this.controller.on(e,this.controllerEvents[e])})),this.view=null,this.frame=null}updateBlueprint(e){this.blueprint=e,this.view=null,this.frame=null}selectViewByCode(e){if(!this.blueprint)return null;const t=(this.blueprint.views||[]).find((t=>t.code===e));return t&&this.updateView(t,t.frameLow),t}resize(){const e=this.container.querySelector(".cz__render"),t=e.clientWidth,n=e.clientHeight,i=this.backingScale();[...this.container.querySelectorAll("canvas")].forEach((e=>{e.width===t*i&&e.height===n*i||(e.width=t*i,e.height=n*i,e.style.width=`${t}px`,e.style.height=`${n}px`)})),this.rerender()}backingScale(){return null!=this.settings.backingScale?this.settings.backingScale:2}destroy(){this.drawables.forEach((e=>{e.loader&&e.loader.abort(),this.removeDrawable(e)})),Object.keys(this.controllerEvents).forEach((e=>{this.controller.off(e,this.controllerEvents[e])})),Object.keys(this.containerEvents).forEach((e=>{this.container.removeEventListener(e,this.containerEvents[e])}));const e=this.container.querySelector(".cz__render");e&&e.parentNode&&e.parentNode.removeChild(e)}selectedView(){return this.view}selectedFrame(){return this.frame}updateView(e,t){this.blueprint&&(this.view=e,this.frame=t,this.load())}load(){this.stateChangedTimer&&(cancelAnimationFrame(this.stateChangedTimer),this.stateChangedTimer=null),this.stateChangedTimer=requestAnimationFrame((()=>{this.loadDeferred()}))}stateGroups(){const{state:e}=this.controller,t=e.map((e=>[e]));let n=this.emit("stateGroups",{default:t,state:e});return n=n||t,n.map((e=>({placements:e.map((e=>e.placement.code)),states:e})))}loadDeferred(){if(null==this.controller)return;const{state:e}=this.controller;if(null==e||null==this.view||null==this.frame)return;let t=!1;const n=this.stateGroups();let i=!1;for(let s=0;s<n.length;s+=1){const{placements:o}=n[s];let a;if(a=0===s?this.controller.makeFrameUrl(this.view,e,this.frame,{onlyPlacements:o}):this.controller.makeFrameUrl(this.view,e,this.frame,{onlyPlacements:o,transparent:!0}),this.settings&&this.settings.loadExactSize){const e=this.container.querySelector(".cz__render"),t=this.backingScale(),n=e.offsetWidth*t,i=e.offsetHeight*t;a.includes("?")?a+="&":a+="?",a+=`rwid=${n}&rhei=${i}`}let r=null;this.view.placements&&o.forEach((e=>{const t=this.view.placements.find((t=>t.code===e));t&&t.custom&&t.custom["image-blend"]&&(r=t.custom["image-blend"])}));let c=this.drawables[s];null==c?(c={index:s},this.drawables[s]=c,this.createDrawable(c,n[s].states),t=!0):this.updateDrawable(c,n[s].states),c.loader&&c.loader.imageCache&&c.loader.imageCache.remove(),c.loader&&c.loader.url!==a&&(c.loader.abort(),c.loader=null),c.blend=r,null==c.loader&&(c.loader=this.loadImage(a,s),i=!0)}i||this.syncDrawables(),t&&this.resize()}loadImage(e,t){const n={url:e,index:t,ready:!1,error:!1,image:new Image,xhr:new XMLHttpRequest};return n.xhr.addEventListener("load",(()=>{this.notifyLoading(-1);const e=n.xhr.getResponseHeader("X-Clipped-By");e&&"None"!==e?this.emit("clipped",e):this.emit("clipped",null);const t=URL.createObjectURL(n.xhr.response);n.image.addEventListener("load",(()=>{n.ready=!0,URL.revokeObjectURL(t),this.imageLoaded(this.drawables[n.index])})),n.image.src=t})),n.xhr.addEventListener("error",(()=>{this.notifyLoading(-1),n.error=!0})),n.abort=()=>{this.notifyLoading(-1),n.ready||n.xhr.abort()},this.notifyLoading(1),n.xhr.open("GET",e,!0),n.xhr.responseType="blob",n.xhr.send(),n}notifyLoading(e){const t=this.loading;this.loading+=e,this.loading<0&&(this.loading=0),this.emit("imagesLoading",{state:this.loading>0?"loading":"done",previous:t>0?"loading":"done"})}createDrawable(e,t){const n=this.container.querySelector(".cz__render"),i=document.createElement("div");i.classList.add("cz__render__layer");const s=document.createElement("canvas");s.classList.add("cz__surface"),i.appendChild(s),e.el=i,e.canvas=s,n.insertAdjacentElement("beforeend",i),1===t.length&&(e.placement=t[0].placement.code,e.component=t[0].component.code),this.updateDrawableClasses(e,t),1===t.length?this.emit("updateDrawable",{layer:e.el,placement:t[0].placement,component:t[0].component}):this.emit("updateDrawable",{layer:e.el})}updateDrawableClasses(e,t){if(1===t.length){const[n]=t,i=[...e.el.classList].filter((e=>e.startsWith("cz2__render__layer__")));i&&i.length>0&&e.el.classList.remove(...i),e.el.classList.add(`cz2__render__layer__placement-${n.placement.code.replace(/\s/g,"-")}`),e.el.classList.add(`cz2__render__layer__component-${n.component.code.replace(/\s/g,"-")}`),n.component.description&&n.component.description.forEach((t=>{e.el.classList.add(`cz2__render__layer__option-${t.code.replace(/\s/g,"-")}`)}))}}updateDrawable(e,t){if(1===t.length){const[n]=t;e.placement=n.placement.code,e.component=n.component.code,this.updateDrawableClasses(e,t),this.emit("updateDrawable",{layer:e.el,placement:n.placement,component:n.component})}else this.updateDrawableClasses(e,t),this.emit("updateDrawable",{layer:e.el})}removeDrawable(e){e.loader&&e.loader.abort(),e.loader&&e.loader.imageCache&&e.loader.imageCache.remove(),e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el)}repaint(){this.rerender()}rerender(){if(null==this.controller)return;let e=null;const t=this.container.querySelector(".cz__render"),n=this.backingScale(),i=t.offsetWidth*n,s=t.offsetHeight*n,o=this.stateGroups();for(let t=0;t<this.drawables.length;t+=1){if(t>=o.length)continue;const a=this.drawables[t];if(a.el&&a.loader&&a.loader.ready){const t=a.canvas.getContext("2d");if(t.clearRect(0,0,i,s),this.drawables.length>1&&a.blend)if("mixBlendMode"in a.canvas.style)a.canvas.style.mixBlendMode=a.blend;else if("overlay"===a.blend||"screen"===a.blend||"multiply"===a.blend)continue;const o=a.loader.image.width,r=a.loader.image.height;let c=o*n,l=r*n;c>i&&(l=l*(i/c)|0,c=i),l>s&&(c=c*(s/l)|0,l=s);const u=(i-c)/2|0,h=(s-l)/2|0,m=Math.floor(c),d=Math.floor(l);t.drawImage(a.loader.image,0,0,o,r,u,h,m,d),null==e&&(e={scale:this.backingScale(),sourceWidth:o,sourceHeight:r,targetLeft:u,targetTop:h,targetWidth:c,targetHeight:l})}}this.syncDrawables(),this.emit("rendered",e)}syncDrawables(){const e=this.stateGroups();if(this.drawables.length>e.length){for(let t=e.length;t<this.drawables.length;t+=1){const e=this.drawables[t];e&&this.removeDrawable(e)}this.drawables.length=e.length}}imageLoaded(){this.rerender()}onAfterInitializeBlueprint(e){this.updateBlueprint(e.blueprint)}onStateChanged(){this.load()}onRepaint(){this.repaint()}onMouseLeave(){}onMouseMove(){}onClick(){}onMouseDown(){}onKeyDown(){}},e.exports=t.default},505:(e,t,n)=>{e.exports=n(15)},516:(e,t,n)=>{"use strict";var i=n(12),s=Object.prototype.toString;function o(e){return"[object Array]"===s.call(e)}function a(e){return void 0===e}function r(e){return null!==e&&"object"==typeof e}function c(e){return"[object Function]"===s.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}e.exports={isArray:o,isArrayBuffer:function(e){return"[object ArrayBuffer]"===s.call(e)},isBuffer:function(e){return null!==e&&!a(e)&&null!==e.constructor&&!a(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:r,isUndefined:a,isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:c,isStream:function(e){return r(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function e(){var t={};function n(n,i){"object"==typeof t[i]&&"object"==typeof n?t[i]=e(t[i],n):t[i]=n}for(var i=0,s=arguments.length;i<s;i++)l(arguments[i],n);return t},deepMerge:function e(){var t={};function n(n,i){"object"==typeof t[i]&&"object"==typeof n?t[i]=e(t[i],n):t[i]="object"==typeof n?e({},n):n}for(var i=0,s=arguments.length;i<s;i++)l(arguments[i],n);return t},extend:function(e,t,n){return l(t,(function(t,s){e[s]=n&&"function"==typeof t?i(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},522:(e,t,n)=>{"use strict";var i=n(763);e.exports=function(e,t,n){var s=n.config.validateStatus;!s||s(n.status)?e(n):t(i("Request failed with status code "+n.status,n.config,null,n.request,n))}},592:(e,t,n)=>{"use strict";var i=n(516),s=n(522),o=n(106),a=n(615),r=n(631),c=n(202),l=n(763);e.exports=function(e){return new Promise((function(t,u){var h=e.data,m=e.headers;i.isFormData(h)&&delete m["Content-Type"];var d=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",f=e.auth.password||"";m.Authorization="Basic "+btoa(p+":"+f)}var g=a(e.baseURL,e.url);if(d.open(e.method.toUpperCase(),o(g,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?r(d.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:n,config:e,request:d};s(t,u,i),d=null}},d.onabort=function(){d&&(u(l("Request aborted",e,"ECONNABORTED",d)),d=null)},d.onerror=function(){u(l("Network Error",e,null,d)),d=null},d.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),u(l(t,e,"ECONNABORTED",d)),d=null},i.isStandardBrowserEnv()){var y=n(948),b=(e.withCredentials||c(g))&&e.xsrfCookieName?y.read(e.xsrfCookieName):void 0;b&&(m[e.xsrfHeaderName]=b)}if("setRequestHeader"in d&&i.forEach(m,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete m[t]:d.setRequestHeader(t,e)})),i.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){d&&(d.abort(),u(e),d=null)})),void 0===h&&(h=null),d.send(h)}))}},615:(e,t,n)=>{"use strict";var i=n(137),s=n(680);e.exports=function(e,t){return e&&!i(t)?s(e,t):t}},631:(e,t,n)=>{"use strict";var i=n(516),s=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,a={};return e?(i.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=i.trim(e.substr(0,o)).toLowerCase(),n=i.trim(e.substr(o+1)),t){if(a[t]&&s.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},680:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},709:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},763:(e,t,n)=>{"use strict";var i=n(449);e.exports=function(e,t,n,s,o){var a=new Error(e);return i(a,t,n,s,o)}},851:(e,t)=>{"use strict";t.__esModule=!0,t.default=function(e){const t={};e.events=t,e.on=function(e,n){const i=e.split(".");t[i[0]]=t[i[0]]||[],t[i[0]].push({ns:i[1],f:n})},e.off=function(e,n){const i=null==e?[""]:e.split(".");Object.keys(t).forEach((e=>{if(""===i[0]||i[0]===e){const s=t[e];for(let e=0;e<s.length;)null!=i[1]&&s[e].ns!==i[1]||n&&s[e].f!==n?e+=1:s.splice(e,1)}}))},e.emit=function(e,n,i,s,o){"error"===e&&n&&n.message&&console.log(`%cEmitted error: ${n.message}`,"color: #b00b00");const a=t[e];let r;if(a)for(let e=0;e<a.length;e+=1){const t=a[e].f(n,i,s,o);void 0!==t&&void 0===r&&(r=t)}return r}},e.exports=t.default},864:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},880:function(e){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(i,s,function(t){return e[t]}.bind(null,s));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i=n(18),s=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,i){void 0===i&&(i=!1);var s=e.getVersionPrecision(t),o=e.getVersionPrecision(n),a=Math.max(s,o),r=0,c=e.map([t,n],(function(t){var n=a-e.getVersionPrecision(t),i=t+new Array(n+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(r=a-Math.min(s,o)),a-=1;a>=r;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===r)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var n,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)i.push(t(e[n]));return i},e.find=function(e,t){var n,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,i=e.length;n<i;n+=1){var s=e[n];if(t(s,n))return s}},e.assign=function(e){for(var t,n,i=e,s=arguments.length,o=new Array(s>1?s-1:0),a=1;a<s;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var r=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)r();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=s,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,s=(i=n(91))&&i.__esModule?i:{default:i},o=n(18);function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var r=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new s.default(e,t)},e.parse=function(e){return new s.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],null&&a(t.prototype,null),n&&a(t,n),e}();t.default=r,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i=c(n(92)),s=c(n(93)),o=c(n(94)),a=c(n(95)),r=c(n(17));function c(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=r.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=r.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=r.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=r.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return r.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},i=0,s={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(s[t]=a,o+=1):"object"==typeof a&&(n[t]=a,i+=1)})),i>0){var a=Object.keys(n),c=r.default.find(a,(function(e){return t.isOS(e)}));if(c){var l=this.satisfies(n[c]);if(void 0!==l)return l}var u=r.default.find(a,(function(e){return t.isPlatform(e)}));if(u){var h=this.satisfies(n[u]);if(void 0!==h)return h}}if(o>0){var m=Object.keys(s),d=r.default.find(m,(function(e){return t.isBrowser(e,!0)}));if(void 0!==d)return this.compareVersion(s[d])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),s=r.default.getBrowserTypeByAlias(i);return t&&s&&(i=s.toLowerCase()),i===n},t.compareVersion=function(e){var t=[0],n=e,i=!1,s=this.getBrowserVersion();if("string"==typeof s)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(i=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(i=!0,n=e.substr(1)),t.indexOf(r.default.compareVersions(s,n,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=l,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,s=(i=n(17))&&i.__esModule?i:{default:i},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=s.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=s.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=s.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=s.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=s.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=s.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=s.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=s.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=s.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=s.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=s.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=s.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=s.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=s.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=s.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=s.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=s.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=s.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=s.default.getFirstMatch(o,e)||s.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=s.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=s.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=s.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=s.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=s.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=s.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=s.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=s.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=s.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=s.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:s.default.getFirstMatch(t,e),version:s.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,s=(i=n(17))&&i.__esModule?i:{default:i},o=n(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=s.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=s.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=s.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=s.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=s.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=s.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=s.default.getMacOSVersionName(t),i={name:o.OS_MAP.MacOS,version:t};return n&&(i.versionName=n),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=s.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=s.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=s.default.getAndroidVersionName(t),i={name:o.OS_MAP.Android,version:t};return n&&(i.versionName=n),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=s.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=s.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||s.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||s.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=s.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=s.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=s.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,s=(i=n(17))&&i.__esModule?i:{default:i},o=n(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=s.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=s.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,s=(i=n(17))&&i.__esModule?i:{default:i},o=n(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=s.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=s.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=s.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=s.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=s.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=a,e.exports=t.default}})},881:(e,t,n)=>{"use strict";var i=n(516);e.exports=function(e,t,n){return i.forEach(n,(function(n){e=n(e,t)})),e}},928:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},948:(e,t,n)=>{"use strict";var i=n(516);e.exports=i.isStandardBrowserEnv()?{write:function(e,t,n,s,o,a){var r=[];r.push(e+"="+encodeURIComponent(t)),i.isNumber(n)&&r.push("expires="+new Date(n).toGMTString()),i.isString(s)&&r.push("path="+s),i.isString(o)&&r.push("domain="+o),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},980:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},983:(e,t)=>{"use strict";t.__esModule=!0,t.default=void 0,t.default=class{constructor(e){this.controller=e,this.initial={},this.stack=[]}updateComponent(e,t){const{state:n}=this.controller,i=Object.assign({},this.initial),s=this.stack.slice();n.forEach((t=>{t.placement.code===e&&(t.component.placeholder&&(this.initial[e]=t.component.code),this.stack.push({placement:e,component:t.component.code}))}));const o=this.controller.updateComponent(e,t);return o||(this.initial=i,this.stack=s),o}undo(){if(this.canUndo()){const e=this.stack.pop();return this.controller.updateComponent(e.placement,e.component)}return null}reset(){this.canReset()&&(this.initial.forEach(((e,t)=>{this.controller.updateComponent(t,e)})),this.initial={},this.stack=[])}canUndo(){return this.stack.length>0}canReset(){return this.stack.length>0}},e.exports=t.default},987:(e,t,n)=>{"use strict";var i=n(516),s=n(18),o={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var r,c={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(r=n(592)),r),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){c.headers[e]=i.merge(o)})),e.exports=c}},t={},n=function n(i){var s=t[i];if(void 0!==s)return s.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}(24);this.DriveCustomizer=n})();
//# sourceMappingURL=customizer.js.map