1import"@theme/events";import{applyCustomizerFields}from"@theme/customizer-fields";import{applyCustomizerCanvas}from"@theme/customizer-canvas";import{applyCustomizerRender}from"@theme/customizer-render";import{applyCustomizerActions}from"@theme/customizer-actions";import{mountCanvasTabs}from"@theme/customizer-tabs";class ProductCustomizer extends HTMLElement{revealDesignTab(){const tabsEl=(this.closest("[data-section-id]")||this.closest(".product")||document).querySelector('.canvas-tabs[data-testid="media-gallery-canvas-tab"], [data-canvas-tabs]');if(tabsEl)try{tabsEl.dispatchEvent(new CustomEvent("customizer:reveal-design"))}catch{}}connectedCallback(){if(this._designObjects=this._designObjects||new Map,this._editingDesignId=null,this._cleanups=this._cleanups||[],this.bindFieldsetEvents?.(),this.bindOutsideClickHandler?.(),this.populatePreselectedValues?.(),this.initConditionalVisibility?.(),this.watchRequiredFields?.(),this.bindVariantRequiredRevalidation?.(),this.initCanvas?.(),this._stages=this.readStages?.()||[],this.initActionDropdowns?.(),this.initActionButtons?.(),this.initGreekAction?.(),this.initImageAction?.(),this.updateDragStageOverlay?.(),this.observeConditionalImageTriggers?.(),!window.__gsCanvasTabsMounted){try{mountCanvasTabs(document)}catch{}window.__gsCanvasTabsMounted=!0}this.setupCanvasStickyObserver();const revealDesign=()=>{this.revealDesignTab?.(),requestAnimationFrame(()=>this._syncCanvasStickyNow?.())};this.addEventListener("change",revealDesign,!0),this.addEventListener("input",revealDesign,!0),this.registerCleanup(()=>{this.removeEventListener("change",revealDesign,!0),this.removeEventListener("input",revealDesign,!0)})}disconnectedCallback(){if(this.runCleanups(),this._abortAndClear("_actionsAbort"),this._abortAndClear("_dropdownAbort"),this._disconnectAndClear("_actionsObserver"),this._abortAndClear("_visibilityAbort"),this._abortAndClear("_requiredAbort"),this._observedCheckboxes){for(const{checkbox,handler}of this._observedCheckboxes.values())checkbox.removeEventListener("change",handler);this._observedCheckboxes.clear()}this._disconnectAndClear("_canvasResizeObserver")}setupCanvasStickyObserver(){if(!this.hasAttribute("data-sticky-canvas-preview")||!window.matchMedia("(max-width: 749px)").matches)return;const canvasPreviewEl=(this.closest("[data-section-id]")||this.closest(".product")||document).querySelector(".product-media__canvas");if(!canvasPreviewEl)return;const STICKY_CLASS="canvas-preview--sticky",EXPANDED_CLASS="canvas-preview--expanded",PLACEHOLDER_CLASS="canvas-preview-placeholder",SENTINEL_CLASS="canvas-preview-sentinel",TOGGLE_BTN_ATTR="data-canvas-sticky-toggle",ICON_OPEN=` 2 <svg width="24px" height="24px" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="#000000"><path d="M9 9L4 4M4 4V8M4 4H8" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15 9L20 4M20 4V8M20 4H16" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9 15L4 20M4 20V16M4 20H8" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15 15L20 20M20 20V16M20 20H16" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> 3 `,ICON_CLOSE=` 4 <svg width="24px" height="24px" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="#000000"><path d="M20 20L15 15M15 15V19M15 15H19" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M4 20L9 15M9 15V19M9 15H5" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M20 4L15 9M15 9V5M15 9H19" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M4 4L9 9M9 9V5M9 9H5" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> 5 `;let placeholderEl=canvasPreviewEl.nextElementSibling;(!placeholderEl||!placeholderEl.classList.contains(PLACEHOLDER_CLASS))&&(placeholderEl=document.createElement("div"),placeholderEl.className=PLACEHOLDER_CLASS,placeholderEl.style.cssText="height:0;margin:0;padding:0;",canvasPreviewEl.after(placeholderEl));let sentinelEl=placeholderEl.nextElementSibling;(!sentinelEl||!sentinelEl.classList.contains(SENTINEL_CLASS))&&(sentinelEl=document.createElement("div"),sentinelEl.className=SENTINEL_CLASS,sentinelEl.style.cssText="height:1px;margin:0;padding:0;",placeholderEl.after(sentinelEl));const reservePlaceholder=()=>{placeholderEl.style.height=`${canvasPreviewEl.offsetHeight}px`},releasePlaceholder=()=>{placeholderEl.style.height="0px"},ensureToggleButton=()=>{let btn=canvasPreviewEl.querySelector(`button[${TOGGLE_BTN_ATTR}]`);return btn||(btn=document.createElement("button"),btn.type="button",btn.className="
5canvas-sticky-toggle",btn.setAttribute(TOGGLE_BTN_ATTR,""),btn.innerHTML=`${ICON_OPEN}<span>Show design</span>`,canvasPreviewEl.prepend(btn),btn.addEventListener("click",()=>{canvasPreviewEl.classList.toggle(EXPANDED_CLASS);const expanded=canvasPreviewEl.classList.contains(EXPANDED_CLASS);btn.innerHTML=expanded?`${ICON_CLOSE}<span>Hide design</span>`:`${ICON_OPEN}<span>Show design</span>`}),btn)},removeToggleButton=()=>{canvasPreviewEl.querySelector(`button[${TOGGLE_BTN_ATTR}]`)?.remove()},setStickyState=shouldStick=>{const isSticky=canvasPreviewEl.classList.contains(STICKY_CLASS);shouldStick!==isSticky&&(shouldStick?(reservePlaceholder(),canvasPreviewEl.classList.add(STICKY_CLASS),ensureToggleButton()):(canvasPreviewEl.classList.remove(STICKY_CLASS,EXPANDED_CLASS),removeToggleButton(),releasePlaceholder()))},observer=new IntersectionObserver(([entry])=>{entry&&setStickyState(entry.boundingClientRect.top<0)},{threshold:0});observer.observe(sentinelEl),this._syncCanvasStickyNow=()=>{const rect=sentinelEl.getBoundingClientRect();setStickyState(rect.top<0)},requestAnimationFrame(()=>this._syncCanvasStickyNow?.()),this.registerCleanup?.(()=>{observer.disconnect(),canvasPreviewEl.classList.remove(STICKY_CLASS,EXPANDED_CLASS),removeToggleButton(),releasePlaceholder(),sentinelEl.remove(),placeholderEl.remove(),this._syncCanvasStickyNow=null})}bindVariantRequiredRevalidation(){const scope=this.closest("[data-section-id]")||this.closest(".product")||document;if(this._variantRevalidateAbort)try{this._variantRevalidateAbort.abort()}catch{}const ac=new AbortController;this._variantRevalidateAbort=ac;const{signal}=ac,revalidate=()=>{requestAnimationFrame(()=>this.watchRequiredFields?.())};["variant:selected","variant:updated","variant:change","variant:changed","variant:update"].forEach(name=>{scope.addEventListener(name,revalidate,{capture:!0,signal})}),this.registerCleanup?.(()=>{try{ac.abort()}catch{}this._variantRevalidateAbort===ac&&(this._variantRevalidateAbort=null)})}registerCleanup(fn){typeof fn=="function"&&(this._cleanups=this._cleanups||[],this._cleanups.push(fn))}registerAbort(controllerKey,controller){!controller||typeof controller.abort!="function"||(this[controllerKey]=controller,this.registerCleanup(()=>{try{controller.abort()}catch{}this[controllerKey]===controller&&(this[controllerKey]=null)}))}registerObserver(observerKey,observer){!observer||typeof observer.disconnect!="function"||(this[observerKey]=observer,this.registerCleanup(()=>{try{observer.disconnect()}catch{}this[observerKey]===observer&&(this[observerKey]=null)}))}runCleanups(){const list=Array.isArray(this._cleanups)?this._cleanups:[];this._cleanups=[];for(let i=list.length-1;i>=0;i--)try{list[i]?.()}catch{}}_abortAndClear(key){const controller=this[key];controller&&typeof controller.abort=="function"&&controller.abort(),this[key]=null}_disconnectAndClear(key){const obs=this[key];obs&&typeof obs.disconnect=="function"&&obs.disconnect(),this[key]=null}}applyCustomizerFields(ProductCustomizer.prototype),applyCustomizerCanvas(ProductCustomizer.prototype),applyCustomizerRender(ProductCustomizer.prototype),applyCustomizerActions(ProductCustomizer.prototype),customElements.get("product-customizer")||customElements.define("product-customizer",ProductCustomizer);export{ProductCustomizer}; 6//# sourceMappingURL=/cdn/shop/t/13/assets/product-customizer.js.map?v=125090888785193276731783100958
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.