1(()=>{let isShellToggleGlobalBound=!1,headerScrollVisibilityController=null;const getRuntimeAdapter=()=>window.ThemeRuntimeAdapter||{},THEME_A11Y_STORAGE_KEY="theme_a11y_preferences_v1",THEME_A11Y_META_UPDATED_KEY="theme_a11y_last_updated",THEME_A11Y_META_SOURCE_KEY="theme_a11y_restore_source",THEME_A11Y_ALLOWED_VALUES={font_size:["sm","md","lg"],contrast:["default","high"],motion:["default","reduce"],focus_aid:["off","on"]};let themeA11yState=null,themeA11yRestoreSource="default",themeA11yStorageAvailable=null,themeA11yActiveRoot=null;const THEME_ACCOUNT_OFFER_DISMISS_KEY="theme_account_offer_dismiss_until_v1",THEME_ACCOUNT_OFFER_EMAIL_KEY="theme_account_offer_email_v1",THEME_ACCOUNT_OFFER_CLAIM_KEY="theme_account_offer_claimed_v1",SHOPIFY_PRIVACY_BANNER_SRC="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js",SHOPIFY_PRIVACY_BANNER_PATH="/shopifycloud/privacy-banner/storefront-banner.js",SHOPIFY_PRIVACY_BANNER_LOAD_TIMEOUT=8e3;let privacyBannerLoadPromise=null;const getPrivacyBanner=()=>{const banner=window.privacyBanner;return banner&&typeof banner.showPreferences=="function"?banner:null},findPrivacyBannerScript=()=>Array.from(document.scripts).find(script=>{try{return new URL(script.src,window.location.href).pathname.endsWith(SHOPIFY_PRIVACY_BANNER_PATH)}catch{return!1}}),waitForPrivacyBannerScript=(script,timeoutMs=SHOPIFY_PRIVACY_BANNER_LOAD_TIMEOUT)=>new Promise((resolve,reject)=>{const finish=error=>{if(window.clearTimeout(timeoutId),script.removeEventListener("load",handleLoad),script.removeEventListener("error",handleError),error){script.dataset.themePrivacyBannerState="error",reject(error);return}const banner=getPrivacyBanner();if(!banner){script.dataset.themePrivacyBannerState="error",reject(new Error("Shopify privacy banner API did not initialize."));return}script.dataset.themePrivacyBannerState="loaded",resolve(banner)},handleLoad=()=>finish(),handleError=()=>finish(new Error("Shopify privacy banner script failed to load.")),timeoutId=window.setTimeout(()=>finish(new Error("Shopify privacy banner script load timed out.")),timeoutMs);script.addEventListener("load",handleLoad,{once:!0}),script.addEventListener("error",handleError,{once:!0})}),loadPrivacyBanner=async(timeoutMs=SHOPIFY_PRIVACY_BANNER_LOAD_TIMEOUT)=>{const availableBanner=getPrivacyBanner();if(availableBanner)return availableBanner;if(privacyBannerLoadPromise)return privacyBannerLoadPromise;privacyBannerLoadPromise=(async()=>{let script=findPrivacyBannerScript();if(script&&(script.dataset.themePrivacyBannerState==="loading"||document.readyState==="loading"))try{return await waitForPrivacyBannerScript(script,timeoutMs)}catch{script.parentNode&&script.parentNode.removeChild(script),script=null}else script&&(script.parentNode&&script.parentNode.removeChild(script),script=null);return script=document.createElement("script"),script.src=SHOPIFY_PRIVACY_BANNER_SRC,script.async=!0,script.dataset.themePrivacyBannerState="loading",document.head.appendChild(script),waitForPrivacyBannerScript(script,timeoutMs)})();try{return await privacyBannerLoadPromise}finally{privacyBannerLoadPromise=null}},initPrivacyPreferences=(scope=document)=>{const buttons=[];scope instanceof Element&&scope.matches("[data-theme-privacy-preferences]")&&buttons.push(scope),buttons.push(...scope.querySelectorAll("[data-theme-privacy-preferences]")),buttons.forEach(button=>{button.dataset.themePrivacyPreferencesBound!=="true"&&(button.addEventListener("click",async()=>{const container=button.closest(".theme-site-footer__meta"),status=container?container.querySelector("[data-theme-privacy-preferences-status]"):null;button.disabled=!0,status&&(status.textContent="Opening privacy preferences.");try{await(await loadPrivacyBanner()).showPreferences(),status&&(status.textContent="")}catch(error){console.error("Unable to open Shopify privacy preferences.",error),status&&(status.textContent="Privacy preferences are unavailable. Please try again.")}finally{button.disabled=!1}}),button.dataset.themePrivacyPreferencesBound="true")})},focusFirstInteractive=container=>{if(!container)return!1;const firstTarget=container.querySelector('button:not([disabled]), [href], input
1:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');return firstTarget?(firstTarget.focus(),!0):!1},scheduleIdleTask=(callback,timeout=1200)=>{if(typeof callback=="function"){if("requestIdleCallback"in window){window.requestIdleCallback(()=>callback(),{timeout});return}window.setTimeout(callback,Math.min(timeout,400))}},getDefaultA11yState=()=>({font_size:"md",contrast:"default",motion:window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?"reduce":"default",focus_aid:"off"}),sanitizeA11yState=(candidate,fallback)=>{const defaults=fallback||getDefaultA11yState(),next=Object.assign({},defaults);return Object.keys(THEME_A11Y_ALLOWED_VALUES).forEach(key=>{!candidate||typeof candidate[key]!="string"||THEME_A11Y_ALLOWED_VALUES[key].indexOf(candidate[key])>-1&&(next[key]=candidate[key])}),next},detectA11yStorage=()=>{if(themeA11yStorageAvailable!==null)return themeA11yStorageAvailable;try{const probeKey="__theme_a11y_probe__";window.localStorage.setItem(probeKey,"1"),window.localStorage.removeItem(probeKey),themeA11yStorageAvailable=!0}catch{themeA11yStorageAvailable=!1}return themeA11yStorageAvailable},readStoredValue=key=>{if(!detectA11yStorage())return null;try{return window.localStorage.getItem(key)}catch{return null}},writeStoredValue=(key,value)=>{if(detectA11yStorage())try{window.localStorage.setItem(key,value)}catch{}},readA11yState=()=>{const defaults=getDefaultA11yState();if(!detectA11yStorage())return{state:defaults,source:defaults.motion==="reduce"?"os_pref":"default"};try{const raw=window.localStorage.getItem(THEME_A11Y_STORAGE_KEY);if(!raw)return{state:defaults,source:defaults.motion==="reduce"?"os_pref":"default"};const parsed=JSON.parse(raw);return{state:sanitizeA11yState(parsed,defaults),source:"storage"}}catch{return{state:defaults,source:defaults.motion==="reduce"?"os_pref":"default"}}},writeA11yState=(state,source)=>{if(detectA11yStorage())try{window.localStorage.setItem(THEME_A11Y_STORAGE_KEY,JSON.stringify(state)),window.localStorage.setItem(THEME_A11Y_META_UPDATED_KEY,String(Date.now())),window.localStorage.setItem(THEME_A11Y_META_SOURCE_KEY,source||"storage")}catch{}},updateA11yUiStatus=()=>{const message=detectA11yStorage()?"Preferences saved and restored automatically.":"Preferences are active for this session only.";document.querySelectorAll("[data-theme-a11y-controls-root]").forEach(root=>{const status=root.querySelector("[data-theme-a11y-status]");status&&(status.textContent=message),root.querySelectorAll("[data-theme-a11y-control]").forEach(button=>{const key=button.getAttribute("data-theme-a11y-control"),value=button.getAttribute("data-theme-a11y-value"),isActive=themeA11yState&&themeA11yState[key]===value;button.setAttribute("aria-pressed",isActive?"true":"false"),button.dataset.themeA11yActive=isActive?"true":"false"})})},applyA11yState=(state,source)=>{const next=sanitizeA11yState(state,getDefaultA11yState()),root=document.documentElement,body=document.body,targets=[root];body&&targets.push(body),targets.forEach(target=>{target.setAttribute("data-theme-a11y-font-size",next.font_size),target.setAttribute("data-theme-a11y-contrast",next.contrast),target.setAttribute("data-theme-a11y-motion",next.motion),target.setAttribute("data-theme-a11y-focus-aid",next.focus_aid),target.setAttribute("data-theme-a11y-ready","true")}),themeA11yState=next,themeA11yRestoreSource=source||themeA11yRestoreSource,updateA11yUiStatus()},bindA11yControls=(scope=document)=>{scope.querySelectorAll("[data-theme-a11y-controls-root]").forEach(root=>{if(root.dataset.themeA11yBound==="true")return;const panel=root.querySelector(".theme-a11y-controls__panel"),closeButton=root.querySelector("[data-theme-a11y-close]"),reset=root.querySelector("[data-theme-a11y-reset]");let lastOpener=null;const getOpeners=()=>document.querySelectorAll("[data-theme-a11y-open]"),syncOpeners=isExpanded=>{getOpeners().forEach(opener=>{opener.setAttribute("aria-expanded",isExpanded?"true":"false")})},closePanel=({restoreFocus=!1}={})=>{panel&&(syncOpeners(!1),panel.hidden=!0,themeA11yActiveRoot===root&&(themeA11yActiveRoot=null),restoreFocus&&lastOpener?.isConnected&&lastOpener.focu
1s({preventScroll:!0}),lastOpener=null)},openPanel=opener=>{if(!panel)return;if(themeA11yActiveRoot&&themeA11yActiveRoot!==root){const activePanel=themeA11yActiveRoot.querySelector(".theme-a11y-controls__panel");activePanel&&(activePanel.hidden=!0)}const parentDrawer=opener.closest("details[open]");themeA11yActiveRoot=root,lastOpener=parentDrawer?.querySelector("summary")||opener,parentDrawer&&(parentDrawer.open=!1),syncOpeners(!0),panel.hidden=!1,(closeButton||panel).focus({preventScroll:!0})};panel&&(closePanel(),getOpeners().forEach(opener=>{opener.addEventListener("click",event=>{if(event.preventDefault(),event.stopPropagation(),opener.getAttribute("aria-expanded")==="true"){closePanel({restoreFocus:!0});return}openPanel(opener)})}),closeButton&&closeButton.addEventListener("click",()=>{closePanel({restoreFocus:!0})}),document.addEventListener("click",event=>{const clickedOpener=event.target.closest&&event.target.closest("[data-theme-a11y-open]");!root.contains(event.target)&&!clickedOpener&&closePanel()}),document.addEventListener("keydown",event=>{event.key!=="Escape"||panel.hidden||(event.stopPropagation(),closePanel({restoreFocus:!0}))}
1)),root.querySelectorAll("[data-theme-a11y-control][data-theme-a11y-value]").forEach(button=>{button.addEventListener("click",()=>{const key=button.getAttribute("data-theme-a11y-control"),value=button.getAttribute("data-theme-a11y-value");if(!key||!value||!THEME_A11Y_ALLOWED_VALUES[key]||THEME_A11Y_ALLOWED_VALUES[key].indexOf(value)===-1)return;const next=Object.assign({},themeA11yState||getDefaultA11yState(),{[key]:value});applyA11yState(next,"storage"),writeA11yState(next,"storage")})}),reset&&reset.addEventListener("click",()=>{const defaults=getDefaultA11yState();applyA11yState(defaults,defaults.motion==="reduce"?"os_pref":"default"),writeA11yState(defaults,"default")}),root.dataset.themeA11yBound="true"})},initA11yControls=(scope=document)=>{const restored=readA11yState();applyA11yState(restored.state,restored.source),bindA11yControls(scope)},initCartAnnouncementLabel=()=>{const announce=document.querySelector(".site-cart");!announce||announce.dataset.themeCartAnnounceBound==="true"||(announce.dataset.themeCartAnnounceBound="true",announce.addEventListener("focus",()=>{announce.setAttribute("aria-label","Open shopping cart")}))},initAccountOfferRail=(scope=document)=>{const root=scope.querySelector("[data-theme-account-offer]")||document.querySelector("[data-theme-account-offer]");if(!root||root.dataset.themeAccountOfferBound==="true")return;const pathname=window.location.pathname.toLowerCase(),accountOfferRoutes=getRuntimeAdapter().accountOfferRoutes||{},isFeaturedRoute=typeof accountOfferRoutes.isFeaturedRoute=="function"?accountOfferRoutes.isFeaturedRoute(pathname):pathname==="/",isHighFocusRoute=typeof accountOfferRoutes.isHighFocusRoute=="function"?accountOfferRoutes.isHighFocusRoute(pathname):pathname==="/"||pathname.includes("/collections/")||isFeaturedRoute,bar=root.querySelector("[data-theme-account-offer-bar]"),pill=root.querySelector("[data-theme-account-offer-pill]"),panel=root.querySelector("[data-theme-account-offer-panel]"),openButtons=document.querySelectorAll("[data-theme-account-offer-open], [data-theme-account-offer-pill]"),closeButtons=root.querySelectorAll("[data-theme-account-offer-close]"),dismissButtons=root.querySelectorAll("[data-theme-account-offer-dismiss]"),form=root.querySelector("[data-theme-account-offer-form]"),emailInput=form?form.querySelector('input[type="email"]'):null,verification=root.querySelector("[data-theme-account-offer-verification]"),verificationFrame=root.querySelector("[data-theme-account-offer-target]"),status=root.querySelector("[data-theme-account-offer-status]"),delayMs=Number(root.dataset.themeDelayMs||"24000"),dismissDays=Number(root.dataset.themeDismissDays||"14"),scrollThreshold=Math.max(.1,Math.min(.9,Number(root.dataset.themeScrollThreshold||"40")/100));let isActivated=!1,isPanelOpen=!1;const updateStatus=message=>{status&&(status.textContent=message||"")},hideRoot=()=>{root.hidden=!0,root.setAttribute("hidden",""),root.classList.remove("is-active","is-open"),bar&&(bar.hidden=!0),pill&&(pill.hidden=!0),panel&&(panel.hidden=!0,panel.setAttribute("aria-hidden","true")),isPanelOpen=!1},resetVerification=()=>{form&&(form.hidden=!1),verification&&(verification.hidden=!0)},showRoot=()=>{root.hidden=!1,root.removeAttribute("hidden"),root.classList.add("is-active"),bar&&(bar.hidden=!1),pill&&(pill.hidden=!1)},isDismissed=()=>Number(readStoredValue(THEME_ACCOUNT_OFFER_DISMISS_KEY)||"0")>Date.now(),isClaimed=()=>readStoredValue(THEME_ACCOUNT_OFFER_CLAIM_KEY)==="true",dismissRail=()=>{const dismissUntil=Date.now()+dismissDays*24*60*60*1e3;writeStoredValue(THEME_ACCOUNT_OFFER_DISMISS_KEY,String(dismissUntil)),hideRoot()},openPanel=()=>{if(panel&&(showRoot(),root.classList.add("is-open"),panel.hidden=!1,panel.setAttribute("aria-hidden","false"),isPanelOpen=!0,updateStatus(""),resetVerification(),emailInput)){const storedEmail=readStoredValue(THEME_ACCOUNT_OFFER_EMAIL_KEY);storedEmail&&!emailInput.value&&(emailInput.value=storedEmail),emailInput.focus()}},closePanel=()=>{panel&&(root.classList.remove("is-open"),panel.hidden=!0,panel.setAttribute("aria-hidden","true"),isPanelOpen=!1,resetVerification())},activateRail=()=>{isActivated||isDismissed()||isClaimed()||(isActivated=!0,showRoot())},handleScrollTrigger=()=>{if(isActivated)return;const maxScroll=Math.max(document.documentElement.scrollHeight-window.innerHeight,1);window.scrollY/maxScroll>=scrollThreshold&&(activateRail(),window.removeEventListener("scroll",handleScrollTrigger))};
1if(hideRoot(),!isHighFocusRoute&&!isDismissed()&&!isClaimed()&&(window.setTimeout(activateRail,delayMs),window.addEventListener("scroll",handleScrollTrigger,{passive:!0})),openButtons.forEach(button=>{button.addEventListener("click",event=>{event.preventDefault(),openPanel()})}),closeButtons.forEach(button=>{button.addEventListener("click",event=>{event.preventDefault(),closePanel()})}),dismissButtons.forEach(button=>{button.addEventListener("click",event=>{event.preventDefault(),dismissRail()})}),document.addEventListener("keydown",event=>{event.key==="Escape"&&isPanelOpen&&closePanel()}),form&&emailInput){const phoneInput=form.querySelector('input[name="SMSPHONE"]');form.addEventListener("submit",event=>{event.preventDefault(),updateStatus("");const emailValue=String(emailInput.value||"").trim();if(!emailValue||!emailInput.checkValidity()){updateStatus("Enter a valid email to continue."),emailInput.focus();return}writeStoredValue(THEME_ACCOUNT_OFFER_EMAIL_KEY,emailValue),phoneInput&&(phoneInput.value=String(phoneInput.value||"").trim()),updateStatus("Opening secure verification..."),verification&&verificationFrame&&(form.hidden=!0,verification.hidden=!1),window.requestAnimationFrame(()=>{form.submit()})})}root.dataset.themeAccountOfferBound="true"},initAccountOfferPrefill=()=>{const registerEmailField=document.querySelector("#ThemeRegisterEmail")||document.querySelector('input[name="customer[email]"]'),storedEmail=readStoredValue(THEME_ACCOUNT_OFFER_EMAIL_KEY);registerEmailField&&storedEmail&&!registerEmailField.value&&(registerEmailField.value=storedEmail),registerEmailField&®isterEmailField.form&®isterEmailField.form.addEventListener("submit",()=>{const latestEmail=String(registerEmailField.value||"").trim();latestEmail&&writeStoredValue(THEME_ACCOUNT_OFFER_EMAIL_KEY,latestEmail)}),document.body&&document.body.dataset.themeCustomerAuthenticated==="true"&&writeStoredValue(THEME_ACCOUNT_OFFER_CLAIM_KEY,"true")},syncThemeOptionControlState=(button,{selected=!1,soldOut=!1,unavailable=!1}={})=>{if(!button)return null;const disabled=!!(soldOut||unavailable),state=soldOut?"sold-out":unavailable?"impossible":"available",stateLabel=soldOut?" Sold out":unavailable?" Unavailable":"";button.classList.toggle("is-active",!!selected),button.classList.toggle("is-sold-out",!!soldOut),button.classList.toggle("is-unavailable",!!unavailable),button.setAttribute("aria-pressed",selected?"true":"false"),button.setAttribute("aria-disabled",disabled?"true":"false"),button.toggleAttribute("disabled",disabled),button.dataset.themeOptionState=state;const stateNode=button.querySelector("[data-theme-option-control-state]");return stateNode&&(stateNode.textContent=stateLabel),{state,disabled}};window.ThemeOptionControl=window.ThemeOptionControl||{sync:syncThemeOptionControlState};const bindThemeQuantityControl=(scope,{onChange}={})=>{const control=scope?.matches?.("[data-theme-quantity-control]")?scope:scope?.querySelector?.("[data-theme-quantity-control]"),input=control?.querySelector?.("[data-theme-quantity-input]");if(!control||!input)return null;const normalize=()=>{const min=Math.max(1,Number.parseInt(input.getAttribute("min")||"1",10)||1),step=Math.max(1,Number.parseInt(input.getAttribute("step")||"1",10)||1),parsed=Number.parseInt(input.value||String(min),10),value=Number.isFinite(parsed)?Math.max(min,parsed):min;return input.value=String(value),{min,step,value}},notify=()=>{normalize(),typeof control.__themeQuantityOnChange=="function"&&control.__themeQuantityOnChange(input)},adjust=delta=>{const{min,step,value}=normalize(),next=Math.max(min,value+step*delta);next!==value&&(input.value=String(next),input.dispatchEvent(new Event("input",{bubbles:!0})),input.dispatchEvent(new Event("change",{bubbles:!0})))};return control.__themeQuantityOnChange=onChange,control.dataset.themeQuantityControlBound!=="true"&&(control.querySelector("[data-theme-quantity-decrease]")?.addEventListener("click",()=>adjust(-1)),control.querySelector("[data-theme-quantity-increase]")?.addEventListener("click",()=>adjust(1)),input.addEventListener("input",notify),input.addEventListener("change",notify),c
1ontrol.dataset.themeQuantityControlBound="true"),normalize(),{input,reset(){input.value=String(Math.max(1,Number.parseInt(input.getAttribute("min")||"1",10)||1)),notify()}}};window.ThemeQuantityControl=window.ThemeQuantityControl||{bind:bindThemeQuantityControl};const initPdpEventPayloadSync=(scope=document)=>{scope.querySelectorAll(".theme-main-product").forEach(section=>{if(section.dataset.themePdpSyncBound==="true")return;const variantInput=section.querySelector("#theme-variant-select"),variantChips=Array.from(section.querySelectorAll("[data-theme-variant-chip]")),variantOptionButtons=Array.from(section.querySelectorAll("[data-theme-pdp-option]")),variantMatrixNode=section.querySelector("[data-theme-pdp-variant-matrix]"),variantForm=variantInput?.form||variantInput?.closest("form"),qtyInput=section.querySelector("#theme-qty"),addToCartButton=section.querySelector("#theme-pdp-atc"),wishlistButton=section.querySelector("[data-theme-wishlist-button]"),availabilityBadge=section.querySelector("[data-theme-pdp-availability-badge]");if(!variantInput||!qtyInput||!addToCartButton)return;const pdpVariants=(()=>{if(!variantMatrixNode)return[];try{const matrix=JSON.parse(variantMatrixNode.textContent||"[]");return Array.isArray(matrix)?matrix.filter(variant=>variant&&variant.id!=null&&Array.isArray(variant.options)).map(variant=>({id:String(variant.id),title:String(variant.title||""),price:String(variant.price||""),available:variant.available===!0,options:variant.options.map(value=>String(value??""))})):[]}catch{return[]}})(),initialPdpVariant=pdpVariants.find(variant=>variant.id===String(variantInput.value||""))||pdpVariants.find(variant=>variant.available)||pdpVariants[0]||null,pdpOptionState=initialPdpVariant&&variantOptionButtons.length?{variants:pdpVariants,selection:initialPdpVariant.options.slice(),resolvedVariant:initialPdpVariant,userInteracted:!1}:null,resolvePdpVariant=selection=>pdpOptionState&&pdpOptionState.variants.find(variant=>variant.options.length===selection.length&&variant.options.every((value,index)=>value===selection[index]))||null,resolvePdpCandidate=(position,value)=>{if(!pdpOptionState)return null;const candidateSelection=pdpOptionState.selection.slice();return candidateSelection[position]=value,resolvePdpVariant(candidateSelection)},isPdpOptionReachable=(position,value)=>pdpOptionState?pdpOptionState.variants.some(variant=>variant.options.length===pdpOptionState.selection.length&&variant.options[position]===value&&variant.options.every((candidate,index)=>index===position||candidate===pdpOptionState.selection[index])):!1,selectedVariant=()=>{if(pdpOptionState?.resolvedVariant){const variant=pdpOptionState.resolvedVariant;return{id:variant.id,title:variant.title,price:variant.price,available:variant.available?"true":"false"}}const selectedVariantId=variantInput.value||addToCartButton.dataset.themeSelectedVariantId||"",activeChip=variantChips.find(chip=>chip.dataset.themeVariantId===selectedVariantId);return{id:selectedVariantId,title:activeChip?.dataset.themeVariantTitle||variantInput.dataset.themeVariantTitle||"",price:activeChip?.dataset.themeVariantPrice||variantInput.dataset.themeVariantPrice||"",available:activeChip?.dataset.themeVariantAvailable||variantInput.dataset.themeVariantAvailable||"false"}},updatePdpOptionUrl=variant=>{if(!(!pdpOptionState?.userInteracted||!variant||!window.history?.replaceState||!window.location?.href))try{const nextUrl=new URL(window.location.href);nextUrl.searchParams.set("variant",variant.id),window.history.replaceState({},"",`${nextUrl.pathname}${nextUrl.search}${nextUrl.hash}`)}catch{}},ensureVariantFormValue=()=>{const variant=selectedVariant();return variant.id&&variantInput.value!==variant.id&&(variantInput.value=variant.id),variant},syncAddToCartEventPayload=()=>{const variant=ensureVariantFormValue(),labelNode=addToCartButton.querySelector("[data-theme-pdp-atc-label]")||addToCartButton.querySelector(".theme-main-product__atc-label");let normalizedQty=parseInt(qtyInput.value,10);if(!variant.id)return;(!normalizedQty||normalizedQty<1)&&(normalizedQty=1,qtyInput.value="1"),addToCartButton.dataset.themeEventItemVariant=variant.title,addToCartButton.dataset.themeEventPrice
1=variant.price,addToCartButton.dataset.themeEventQuantity=String(normalizedQty),addToCartButton.dataset.themeSelectedVariantId=variant.id;const isSoldOut=variant.available==="false",soldOutLabel=addToCartButton.dataset.themeSoldOutLabel||"Sold out";if(availabilityBadge){const productAvailable=pdpVariants.length?pdpVariants.some(candidate=>candidate.available):availabilityBadge.dataset.themeAvailabilityProductAvailable==="true",familyHasAvailable=availabilityBadge.dataset.themeAvailabilityFamilyHasAvailable==="true",availabilityLabel=productAvailable?"":familyHasAvailable?"Color sold out":"Sold out";availabilityBadge.textContent=availabilityLabel,availabilityBadge.hidden=!availabilityLabel,availabilityBadge.classList.toggle("theme-availability-badge--color-sold-out",availabilityLabel==="Color sold out"),availabilityBadge.classList.toggle("theme-availability-badge--sold-out",availabilityLabel==="Sold out")}addToCartButton.dataset.themeSoldOut=isSoldOut?"true":"false",isSoldOut?(addToCartButton.disabled=!0,addToCartButton.setAttribute("aria-disabled","true"),labelNode&&(labelNode.textContent=soldOutLabel)):(addToCartButton.disabled=!1,addToCartButton.setAttribute("aria-disabled","false")),wishlistButton&&variant.id&&(wishlistButton.dataset.variantId=variant.id,wishlistButton.dataset.themeVariantId=variant.id);const onVariantChange=getRuntimeAdapter().onVariantChange;typeof onVariantChange=="function"&&onVariantChange({section,variant,wishlistButton}),variantChips.length&&variantChips.forEach(chip=>{const isActive=chip.dataset.themeVariantId===variant.id;chip.classList.toggle("is-active",isActive),chip.setAttribute("aria-pressed",isActive?"true":"false"),chip.dataset.themeVariantAvailable==="false"?(chip.classList.add("is-sold-out"),chip.disabled=!0,chip.setAttribute("aria-disabled","true")):(chip.classList.remove("is-sold-out"),chip.disabled=!1,chip.setAttribute("aria-disabled","false"))})},refreshPdpOptionState=()=>{if(!pdpOptionState)return;const variant=resolvePdpVariant(pdpOptionState.selection);pdpOptionState.resolvedVariant=variant,variantOptionButtons.forEach(button=>{const position=Number(button.dataset.themePdpOptionPosition),value=button.dataset.themePdpOptionValue||"",selected=pdpOptionState.selection[position]===value,reachable=Number.isInteger(position)&&position>=0&&isPdpOptionReachable(position,value),candidate=reachable?resolvePdpCandidate(position,value):null,soldOut=!!(candidate&&candidate.available===!1);syncThemeOptionControlState(button,{selected,soldOut,unavailable:!reachable})}),variant&&(variantInput.value=variant.id,variantInput.dataset.themeVariantTitle=variant.title,variantInput.dataset.themeVariantPrice=variant.price,variantInput.dataset.themeVariantAvailable=variant.available?"true":"false",variantInput.dispatchEvent(new Event("change",{bubbles:!0})),updatePdpOptionUrl(variant))};variantInput.addEventListener("change",syncAddToCartEventPayload),variantForm?.addEventListener("submit",ensureVariantFormValue),variantChips.forEach(chip=>{chip.addEventListener("click",()=>{const nextVariantId=chip.dataset.themeVariantId;!nextVariantId||chip.classList.contains("is-sold-out")||variantInput.value!==nextVariantId&&chip.dataset.themeVariantAvailable!=="false"&&(variantInput.value=nextVariantId,variantInput.dataset.themeVariantTitle=chip.dataset.themeVariantTitle||"",variantInput.dataset.themeVariantPrice=chip.dataset.themeVariantPrice||"",variantInput.dataset.themeVariantAvailable=chip.dataset.themeVariantAvailable||"false",variantInput.dispatchEvent(new Event("change",{bubbles:!0})))})}),variantOptionButtons.forEach(button=>{button.addEventListener("click",()=>{const position=Number(button.dataset.themePdpOptionPosition),value=button.dataset.themePdpOptionValue||"";if(!pdpOptionState||!Number.isInteger(position)||position<0||button.disabled||button.getAttribute("aria-disabled")==="true")return;const candidate=resolvePdpCandidate(position,value);!candidate||candidate.available===!1||(pdpOptionState.selection[position]=value,pdpOptionState.userInteracted=!0,refreshPdpOptionState())})}),bindThemeQuantityControl(section,{onChange:syncAddToCartEventPayload}),pdpOptionState?refreshPdpOptionState():syncAddToCartEventPayload(),section.dataset.themePdpSyncBound="true"})},THEME_WISHLIST_AUTH_RETURN_KEY="theme_wishlist_auth_return_v1",THEME_WISHLIST_AUTH_RETURN_TTL=1800*1e3,initWishlistButtons=(scope=document)=>{const runtimeAdapter=getRuntimeAdapter(),wishlistProvider=runtimeAdapter.wishlistProvider||null,wishlistRoutes=runtimeAdapter.wishlistRoutes||{},wishlistButtons=scope.querySelectorAll("[data-theme-wishlist-button]"),wishlistPage=document.querySelector('[data-theme-page-handle="wishlist"]'),wishlistPanel=wishlistPage?.querySelector("[data-theme-wishlist-panel]")||null,wishlistOpenTrigger=wishlistPage?.querySelector("[data-theme-wishlist-open]")||null,isCustomerAuthenticated=document.body?.dataset.themeCustomerAuthenticated==="true";if(!wishlistButtons.length&&!wishlistPage)return;const normalizeReturnUrl=value=>{if(!value)return"/";try{const url=new URL(String(value),window.location.origin);return url.origin!==window.location.origin?"/":`${url.pathname.replace(/\/+$/,"")||"/"}${url.search}${url.hash}`}catch{const raw=String(value),hashIndex=raw.indexOf("#"),hash=hashIndex>=0?raw.slice(hashIndex):"",pathWithSearch=hashIndex>=0?raw.slice(0,hashIndex):raw,searchIndex=pathWithSearch.indexOf("?"),search=searchIndex>=0?pathWithSearch.slice(searchIndex):"";return`${(searchIndex>=0?pathWithSearch.slice(0,searchIndex):pathWithSearch).replace(/\/+$/,"")||"/"}${search}${hash}`}},currentReturnUrl=()=>normalizeReturnUrl(`${window.location.pathname||"/"}${window.location.search||""}${window.location.hash||""}`),wishlistReturnPath=normalizeReturnUrl(wishlistPage?.querySelector("[data-theme-wishlist-auth-link]")?.dataset.themeWishlistReturnUrl||wishlistOpenTrigger?.dataset.themeWishlistReturnUrl||wishlistRoutes.returnPath||currentReturnUrl()),supportedWishlistContexts=new Set(["card","pdp"]),wasRecentlyTriggered=button=>{const triggeredAt=Number(button?.dataset.themeWishlistTriggeredAt||0);return!Number.isFinite(triggeredAt)||triggeredAt<=0?!1:Date.now()-triggeredAt<2500},getWishlistAuthStorage=()=>{try{return window.sessionStorage}catch{return null}},readWishlistAuthReturn=()=>{const storage=getWishlistAuthStorage();if(!storage)return null;try{const raw=storage.getItem(THEME_WISHLIST_AUTH_RETURN_KEY);if(!raw)return null;const parsed=JSON.parse(raw),path=normalizeReturnUrl(parsed?.path||""),savedAt=Number(parsed?.savedAt||0);return!path||!Number.isFinite(savedAt)||Date.now()-savedAt>THEME_WISHLIST_AUTH_RETURN_TTL?(storage.removeItem(THEME_WISHLIST_AUTH_RETURN_KEY),null):{path,savedAt}}catch{return storage.removeItem(THEME_WISHLIST_AUTH_RETURN_KEY),null}},writeWishlistAuthReturn=path=>{const storage=getWishlistAuthStorage();if(storage)try{storage.setItem(THEME_WISHLIST_AUTH_RETURN_KEY,JSON.stringify({path:normalizeReturnUrl(path||wishlistReturnPath),savedAt:Date.now()}))}catch{}},clearWishlistAuthReturn=()=>{const storage=getWishlistAuthStorage();if(storage)try{storage.removeItem(THEME_WISHLIST_AUTH_RETURN_KEY)}catch{}},syncBubble=isCustomerAuthenticated?null:(()=>{let bubble=document.querySelector("[data-theme-wishlist-sync-bubble]");return bubble||(bubble=document.createElement("aside"),bubble.className="theme-wishlist-sync-bubble",bubble.hidden=!0,bubble.setAttribute("aria-hidden","true"),bubble.setAttribute("aria-live","polite"),bubble.setAttribute("data-theme-wishlist-sync-bubble",""),bubble.innerHTML=` 2 <button type="button" class="theme-wishlist-sync-bubble__close" data-theme-wishlist-sync-close aria-label="Dismiss wishlist sync message">Close</button> 3 <p class="theme-wishlist-sync-bubble__eyebrow">Saved for now</p> 4 <h3>Sync this wishlist to your account</h3> 5 <p>Keep this item beyond the current browser by signing in or creating an account.</p> 6 <div class="theme-wishlist-sync-bubble__actions"> 7 <a href="/account/login" data-theme-wishlist-auth-link data-theme-wishlist-return-current="true">Sign in</a> 8 <a href="/account/login" data-theme-wishlist-auth-link data-theme-wishlist-return-current="true">Create account</a> 9 </div> 10 `,document.body.appendChild(bubble),bubble)})();let syncBubbleTimer=null;const hideWishlistSyncBubble=()=>{syncBubble&&(syncBubbleTimer&&(window.clearTimeout(syncBubbleTimer),syncBubbleTimer=null),syncBubble.hidden=!0,syncBubble.setAttribute("aria-hidden","true"),syncBubble.dataset.themeState="closed",delete syncBubble.dataset.themeWishlistContext)},showWishlistSyncBubble=button=>{if(!syncBubble||!button)return;const context=button.dataset.themeWishlistContext||"default";supportedWishlistContexts.has(context)&&(syncBubbleTimer&&window.clearTimeout(syncBubbleTimer),syncBubble.hidden=!1,syncBubble.setAttribute("aria-hidden","false"),syncBubble.dataset.themeState="open",syncBubble.dataset.themeWishlistContext=context,syncBubbleTimer=window.setTimeout(()=>{hideWishlistSyncBubble()},7e3))},bindWishlistSyncBubble=()=>{if(!syncBubble||syncBubble.dataset.themeWishlistSyncBound==="true")return;const closeButton=syncBubble.querySelector("[data-theme-wishlist-sync-close]");closeButton&&closeButton.addEventListener("click",()=>{hideWishlistSyncBubble()}),document.addEventListener("keydown",event=>{event.key==="Escape"&&hideWishlistSyncBubble()}),document.addEventListener("pointerdown",event=>{syncBubble.hidden||syncBubble.contains(event.target)||hideWishlistSyncBubble()}),syncBubble.dataset.themeWishlistSyncBound="true"},getWishlistPayload=button=>{const productId=Number(button?.dataset.productId||button?.dataset.themeProductId||0),variantId=Number(button?.dataset.variantId||button?.dataset.themeVariantId||0);return!Number.isFinite(productId)||!Number.isFinite(variantId)||productId<=0||variantId<=0?null:{empi:productId,epi:variantId}},getWishlistButtonLabel=button=>button?.dataset.themeWishlistLabel||"Save to wishlist",updateWishlistButtonA11y=(button,isAdded)=>{button&&(button.setAttribute("aria-pressed",isAdded?"true":"false"),button.setAttribute("aria-label",isAdded?"Remove from wishlist":getWishlistButtonLabel(button)))},setWishlistButtonRemoving=(button,isRemoving)=>{if(button){if(button.classList.toggle("theme-wishlist-button--removing",isRemoving),isRemoving){button.dataset.themeWishlistRemoving="true",button.setAttribute("aria-busy","true");return}delete button.dataset.themeWishlistRemoving,button.removeAttribute("aria-busy")}},setWishlistButtonSavedState=(button,isAdded)=>{button&&(button.classList.toggle("theme-wishlist-saved",isAdded),button.classList.remove("theme-wishlist-loading"),isAdded?button.classList.add("theme-wishlist-loaded"):button.classList.remove("disabled"),button.dataset.themeWishlistState=isAdded?"saved":"idle",updateWishlistButtonA11y(button,isAdded),syncWishlistButtonState(button))},removeWishlistItem=button=>{if(!button||button.dataset.themeWishlistRemoving==="true")return;const payload=getWishlistPayload(button);if(payload){if(hideWishlistSyncBubble(),setWishlistButtonRemoving(button,!0),typeof wishlistProvider?.remove=="function"){wishlistProvider.remove({button,payload,onComplete:({isSaved=!1}={})=>{typeof wishlistProvider.setSavedState=="function"&&wishlistProvider.setSavedState(button,isSaved),setWishlistButtonRemoving(button,!1),syncWishlistButtonState(button),delete button.dataset.themeWishlistTriggeredAt},onError:()=>{setWishlistButtonRemoving(button,!1)}})||setWishlistButtonRemoving(button,!1);return}setWishlistButtonRemoving(button,!1),setWishlistButtonSavedState(button,!1),delete button.dataset.themeWishlistTriggeredAt}};bindWishlistSyncBubble();const syncWishlistButtonState=button=>{if(!button)return;const previousState=button.dataset.themeWishlistState||"idle",wasInitialized=button.dataset.themeWishlistInitialized==="true",isAdded=typeof wishlistProvider?.isSaved=="function"?!!wishlistProvider.isSaved(button):button.classList.contains("theme-wishlist-saved"),nextState=isAdded?"saved":"idle";button.dataset.themeWishlistState=nextState,updateWishlistButtonA11y(button,isAdded),!isCustomerAuthenticated&&wasInitialized&&previousState!==nextState&&nextState==="saved"&&wasRecentlyTriggered(button)&&showWishlistSyncBubble(button),previousState!==nextState&&nextState==="saved"&&delete button.dataset.themeWishlistTriggeredAt,button.dataset.themeWishlistInitialized="true"};if(wishlistButtons.forEach(button=>{if(button.dataset.themeWishlistBound==="true")return;syncWishlistButtonState(button),new MutationObserver(()=>{syncWishlistButtonState(button)}).observe(button,{attributes:!0,attributeFilter:["class"]}),button.addEventListener("click",event=>{if(typeof wishlistProvider?.isSaved=="function"?!!wishlistProvider.isSaved(button):button.classList.contains("theme-wishlist-saved")||button.dataset.themeWishlistState==="saved"){event.preventDefault(),event.stopImmediatePropagation(),removeWishlistItem(button);return}button.dataset.themeWishlistTriggeredAt=String(Date.now())},!0),button.dataset.themeWishlistBound="true"}),document.querySelectorAll("[data-theme-wishlist-auth-link]").forEach(link=>{link.dataset.themeWishlistAuthBound!=="true"&&(link.addEventListener("click",event=>{event.defaultPrevented||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button!==0||link.target&&link.target!=="_self"||writeWishlistAuthReturn(link.dataset.themeWishlistReturnCurrent==="true"?currentReturnUrl():link.dataset.themeWishlistReturnUrl||wishlistReturnPath)}),link.dataset.themeWishlistAuthBound="true")}),document.body?.dataset.themeWishlistAuthResumeBound!=="true"){const pendingWishlistReturn=readWishlistAuthReturn();if(pendingWishlistReturn&&isCustomerAuthenticated&&(clearWishlistAuthReturn(),currentReturnUrl()!==pendingWishlistReturn.path)){window.location.replace(pendingWishlistReturn.path);return}!pendingWishlistReturn&¤tReturnUrl()===wishlistReturnPath&&clearWishlistAuthReturn(),document.body.dataset.themeWishlistAuthResumeBound="true"}if(wishlistPage&&wishlistPage.dataset.themeWishlistPageBound!=="true"){wishlistPage.dataset.themeWishlistAuthState=isCustomerAuthenticated?"account":"guest";
10const markWishlistReady=()=>{if(!wishlistPanel)return;wishlistPanel.dataset.themeWishlistReady="true";const title=wishlistPanel.querySelector("h2"),copy=wishlistPanel.querySelector("p:last-child");title&&(title.textContent="Your saved items are ready"),copy&&(copy.textContent=isCustomerAuthenticated?"The wishlist panel is active and linked to your account. Use the button above to review, remove, or move items to cart.":"The wishlist panel is active. Your guest saves are available in this browser now, and they can sync after sign-in or account creation.")},queueWishlistOpen=()=>{markWishlistReady(),!(!wishlistOpenTrigger||wishlistPage.dataset.themeWishlistAutoOpened==="true")&&(wishlistPage.dataset.themeWishlistAutoOpened="true",window.setTimeout(()=>{wishlistOpenTrigger.click()},350))};typeof wishlistProvider?.whenReady=="function"?wishlistProvider.whenReady(queueWishlistOpen):queueWishlistOpen(),wishlistPage.dataset.themeWishlistPageBound="true"}},initPdpMediaGallery=(scope=document)=>{scope.querySelectorAll(".theme-main-product__media").forEach(gallery=>{if(gallery.dataset.themeMediaGalleryBound==="true")return;const stageImage=gallery.querySelector(".theme-main-product__media-stage-image"),stageTrigger=gallery.querySelector("[data-theme-media-stage-trigger]"),thumbs=Array.from(gallery.querySelectorAll("[data-theme-media-thumb]")),stageBadge=gallery.querySelector(".theme-main-product__media-stage-badge");if(!stageImage){gallery.dataset.themeMediaGalleryBound="true";return}const readThumbMediaItem=(thumb,fallbackIndex)=>{const idxFromData=Number.parseInt(thumb.getAttribute("data-theme-media-index")||"",10);return{index:Number.isFinite(idxFromData)?idxFromData:fallbackIndex,stageSrc:thumb.getAttribute("data-theme-media-src")||"",zoomSrc:thumb.getAttribute("data-theme-media-zoom-src")||thumb.getAttribute("data-theme-media-src")||"",alt:thumb.getAttribute("data-theme-media-alt")||stageImage.getAttribute("alt")||""}},mediaItemsFromThumbs=thumbs.map((thumb,index)=>readThumbMediaItem(thumb,index)),fallbackStageSrc=stageImage.getAttribute("src")||"",fallbackStageZoomSrc=stageTrigger?.getAttribute("data-theme-media-stage-zoom-src")||fallbackStageSrc,fallbackStageAlt=stageImage.getAttribute("alt")||"",mediaItems=mediaItemsFromThumbs.length?mediaItemsFromThumbs:[{index:0,stageSrc:fallbackStageSrc,zoomSrc:fallbackStageZoomSrc,alt:fallbackStageAlt}];let activeIndex=0,stageLoadToken=0,lightboxOpen=!1,lightboxIndex=0,zoomLevel=1,panX=0,panY=0,pointerIsDown=!1,pointerStartX=0,pointerStartY=0,panStartX=0,panStartY=0,lastFocusedElement=null,stagePointerStartX=0,stagePointerStartY=0,stagePointerMoved=!1,suppressStageClick=!1;const lightbox=gallery.querySelector("[data-theme-media-lightbox]"),lightboxImage=lightbox?.querySelector("[data-theme-media-lightbox-image]")||null,lightboxCount=lightbox?.querySelector("[data-theme-media-lightbox-count]")||null,lightboxViewport=lightbox?.querySelector("[data-theme-media-lightbox-viewport]")||null,zoomInButton=lightbox?.querySelector("[data-theme-media-zoom-in]")||null,zoomOutButton=lightbox?.querySelector("[data-theme-media-zoom-out]")||null,zoomResetButton=lightbox?.querySelector("[data-theme-media-zoom-reset]")||null,prevButton=lightbox?.querySelector("[data-theme-media-prev]")||null,nextButton=lightbox?.querySelector("[data-theme-media-next]")||null,closeButtons=lightbox?Array.from(lightbox.querySelectorAll("[data-theme-media-lightbox-close]")):[],lightboxDialog=lightbox?.querySelector('[role="dialog"]')||null;let lightboxBackgroundState=[];lightbox&&lightbox.parentElement!==document.body&&(document.body.appendChild(lightbox),lightbox.dataset.themeMediaLightboxPortaled="true");const clampIndex=index=>{const max=mediaItems.length-1;return Math.min(Math.max(index,0),max)},isolateLightboxBackground=()=>{!lightbox||lightboxBackgroundState.length||(lightboxBackgroundState=Array.from(document.body.children).filter(element=>element!==lightbox&&!["SCRIPT","STYLE","LINK"].includes(element.tagName)).map(element=>({element,inert:"inert"in element?element.inert:null,ariaHidden:element.getAttribute("aria-hidden")}
10)),lightboxBackgroundState.forEach(({element})=>{"inert"in element&&(element.inert=!0),element.setAttribute("aria-hidden","true")}))},restoreLightboxBackground=()=>{lightboxBackgroundState.forEach(({element,inert,ariaHidden})=>{inert!==null&&(element.inert=inert),ariaHidden===null?element.removeAttribute("aria-hidden"):element.setAttribute("aria-hidden",ariaHidden)}),lightboxBackgroundState=[]},isPointInsideRect=(x,y,rect)=>rect?x>=rect.left&&x<=rect.right&&y>=rect.top&&y<=rect.bottom:!1,imagePreloadCache=new Map,preloadImage=src=>{if(!src)return Promise.resolve();if(imagePreloadCache.has(src))return imagePreloadCache.get(src);const preloadPromise=new Promise(resolve=>{const image=new Image;image.decoding="async",image.onload=()=>{typeof image.decode=="function"?image.decode().catch(()=>{}).finally(resolve):resolve()},image.onerror=()=>resolve(),image.src=src});return imagePreloadCache.set(src,preloadPromise),preloadPromise},syncThumbState=item=>{thumbs.forEach((thumb,thumbIndex)=>{const thumbMedia=mediaItemsFromThumbs[thumbIndex],isActive=thumbMedia&&thumbMedia.index===item.index;thumb.classList.toggle("is-active",isActive),thumb.setAttribute("aria-pressed",isActive?"true":"false")})},getFittedMediaDimensions=()=>{if(!lightboxImage||!lightboxViewport)return{width:0,height:0};const viewportWidth=lightboxViewport.clientWidth,viewportHeight=lightboxViewport.clientHeight;if(!viewportWidth||!viewportHeight)return{width:0,height:0};const rect=lightboxImage.getBoundingClientRect(),currentScale=Math.max(zoomLevel,1),fittedWidth=rect.width/currentScale,fittedHeight=rect.height/currentScale;if(fittedWidth>0&&fittedHeight>0)return{width:fittedWidth,height:fittedHeight};const naturalWidth=lightboxImage.naturalWidth,naturalHeight=lightboxImage.naturalHeight;if(!naturalWidth||!naturalHeight)return{width:0,height:0};const fitScale=Math.min(viewportWidth/naturalWidth,viewportHeight/naturalHeight,1);return{width:naturalWidth*fitScale,height:naturalHeight*fitScale}},clampPanToBounds=()=>{if(!lightboxViewport||zoomLevel<=1){panX=0,panY=0;return}const viewportWidth=lightboxViewport.clientWidth,viewportHeight=lightboxViewport.clientHeight,fitted=getFittedMediaDimensions(),scaledWidth=fitted.width*zoomLevel,scaledHeight=fitted.height*zoomLevel,maxPanX=Math.max(0,(scaledWidth-viewportWidth)/2),maxPanY=Math.max(0,(scaledHeight-viewportHeight)/2);panX=Math.min(maxPanX,Math.max(-maxPanX,panX)),panY=Math.min(maxPanY,Math.max(-maxPanY,panY))},applyLightboxTransform=()=>{lightboxImage&&(clampPanToBounds(),lightboxImage.style.transform=`translate(${panX}px, ${panY}px) scale(${zoomLevel})`,lightboxImage.classList.toggle("is-zoomed",zoomLevel>1),lightboxViewport?.classList.toggle("is-zoomed",zoomLevel>1))},updateLightboxSizing=()=>{if(!lightbox||!lightboxViewport)return;const viewportWidth=Math.max(window.innerWidth||0,document.documentElement.clientWidth||0),viewportHeight=Math.max(window.innerHeight||0,document.documentElement.clientHeight||0),isDesktop=viewportWidth>=960,naturalWidth=lightboxImage?.naturalWidth||2e3,naturalHeight=lightboxImage?.naturalHeight||2500,imageAspect=naturalWidth>0&&naturalHeight>0?naturalWidth/naturalHeight:.8,clampedAspect=Math.min(Math.max(imageAspect,.62),1.45),dialogHeightCap=Math.min(viewportHeight*.92,900),dialogStyle=lightboxDialog?window.getComputedStyle(lightboxDialog):null,dialogVerticalPadding=dialogStyle?(Number.parseFloat(dialogStyle.paddingTop)||0)+(Number.parseFloat(dialogStyle.paddingBottom)||0):0,dialogRowGap=dialogStyle&&Number.parseFloat(dialogStyle.rowGap)||0,dialogControlsHeight=lightbox?Array.from(lightbox.querySelectorAll(".theme-main-product__lightbox-close, .theme-main-product__lightbox-toolbar, .theme-main-product__lightbox-nav")).reduce((total,control)=>total+control.getBoundingClientRect().height,0):0,viewportMaxHeight=Math.max(1,Math.min(viewportHeight*(isDesktop?.7:.64),dialogHeightCap-dialogVerticalPadding-dialogControlsHeight-dialogRowGap*3)),desktopWidthCap=Math.min(viewportWidth*.72,860),mobileWidthCap=viewportWidth*.92,viewportWidthCap=isDesktop?desktopWidthCap:mobileWidthCap,portraitBiasAspect=isDesktop&&clampedAspect<1?Math.min(clampedAspect,.84):clampedAspect,computedViewportWidth=Math.min(viewportWidthCap,viewportMaxHeight*portraitBiasAspect),dialogMaxWidth=Math.min(viewportWidth*.96,computedViewportWidth+(isDesktop?48:24));lightbox.style.setProperty("--theme-lightbox-viewport-aspect",String(portraitBiasAspect)),lightbox.style.setProperty("--theme-lightbox-viewport-width",`${Math.round(computedViewportWidth)}px`),lightbox.style.setProperty("--theme-lightbox-viewport-max-height",`${Math.round(viewportMaxHeight)}px`),lightbox.style.setProperty("--theme-lightbox-dialog-max-width",`${Math.round(dialogMaxWidth)}px`)},resetLightboxTransform=()=>{zoomLevel=1,panX=0,panY=0,applyLightboxTransform(),zoomResetButton&&(zoomResetButton.textContent="100%")},setZoomLevel=requestedLevel=>{zoomLevel=Math.min(Math.max(requestedLevel,1),4),zoomLevel<=1&&(panX=0,panY=0),applyLightboxTransform(),zoomResetButton&&(zoomResetButton.textContent=`${Math.round(zoomLevel*100)}%`)},setActiveByIndex=nextIndex=>{const safeIndex=clampIndex(nextIndex),item=mediaItems[safeIndex];if(!item)return;const nextToken=stageLoadToken+1;stageLoadToken=nextToken,activeIndex=safeIndex,lightboxIndex=safeIndex,syncThumbState(item),gallery.classList.add("is-loading"),preloadImage(item.stageSrc).catch(()=>{}).finally(()=>
10{stageLoadToken===nextToken&&(item.stageSrc&&stageImage.getAttribute("src")!==item.stageSrc&&(stageImage.setAttribute("src",item.stageSrc),stageImage.removeAttribute("srcset")),item.alt&&stageImage.setAttribute("alt",item.alt),stageTrigger&&item.zoomSrc&&stageTrigger.setAttribute("data-theme-media-stage-zoom-src",item.zoomSrc),gallery.classList.remove("is-loading"),lightboxOpen&&renderLightbox())})},shiftIndex=delta=>{if(!mediaItems.length)return;const wrapped=((lightboxOpen?lightboxIndex+delta:activeIndex+delta)%mediaItems.length+mediaItems.length)%mediaItems.length;setActiveByIndex(wrapped)},renderLightbox=()=>{if(!lightbox||!lightboxImage)return;const item=mediaItems[lightboxIndex]||mediaItems[0];item&&(lightboxImage.setAttribute("src",item.zoomSrc||item.stageSrc||""),lightboxImage.setAttribute("alt",item.alt||fallbackStageAlt),lightboxImage.setAttribute("draggable","false"),lightboxCount&&(lightboxCount.textContent=`${lightboxIndex+1} / ${mediaItems.length}`),prevButton&&(prevButton.disabled=mediaItems.length<2),nextButton&&(nextButton.disabled=mediaItems.length<2),updateLightboxSizing(),resetLightboxTransform())},openLightbox=(index=activeIndex)=>{if(!lightbox||!lightboxImage)return;lightboxIndex=clampIndex(index),lightboxOpen=!0,lastFocusedElement=document.activeElement,lightbox.hidden=!1,lightbox.setAttribute("aria-hidden","false"),document.body.classList.add("theme-lightbox-open"),gallery.classList.add("is-lightbox-open"),isolateLightboxBackground(),renderLightbox();const closeButton=closeButtons.find(button=>button.classList.contains("theme-main-product__lightbox-close"))||closeButtons[0];typeof trapFocus=="function"?trapFocus(lightbox,closeButton||lightboxDialog||lightbox):(closeButton||lightboxDialog||lightbox).focus()},closeLightbox=()=>{if(!lightbox)return;lightboxOpen=!1,lightbox.hidden=!0,lightbox.setAttribute("aria-hidden","true"),pointerIsDown=!1,document.body.classList.remove("theme-lightbox-open"),gallery.classList.remove("is-lightbox-open"),resetLightboxTransform(),restoreLightboxBackground();const returnFocus=lastFocusedElement?.isConnected?lastFocusedElement:stageTrigger;typeof removeTrapFocus=="function"?removeTrapFocus(returnFocus):returnFocus&&typeof returnFocus.focus=="function"&&returnFocus.focus()};document.addEventListener("keydown",event=>{event.key!=="Escape"||!lightboxOpen||(event.preventDefault(),closeLightbox())}),thumbs.forEach((thumb,thumbIndex)=>{thumb.addEventListener("click",()=>{const thumbMedia=mediaItemsFromThumbs[thumbIndex];if(!thumbMedia)return;const nextIndex=mediaItems.findIndex(item=>item.index===thumbMedia.index);setActiveByIndex(nextIndex>=0?nextIndex:thumbIndex)})});const warmStageImages=()=>{mediaItems.forEach((item,index)=>{index!==activeIndex&&preloadImage(item.stageSrc)})};typeof window.requestIdleCallback=="function"?window.requestIdleCallback(warmStageImages,{timeout:1200}):window.setTimeout(warmStageImages,400),stageTrigger&&(stageTrigger.addEventListener("pointerdown",event=>{event.pointerType==="mouse"&&event.button!==0||(stagePointerStartX=event.clientX,stagePointerStartY=event.clientY,stagePointerMoved=!1)}),stageTrigger.addEventListener("pointermove",event=>{const deltaX=event.clientX-stagePointerStartX,deltaY=event.clientY-stagePointerStartY;(Math.abs(deltaX)>10||Math.abs(deltaY)>10)&&(stagePointerMoved=!0)}),stageTrigger.addEventListener("pointerup",event=>{if(!mediaItems.length||!stagePointerMoved)return;const deltaX=event.clientX-stagePointerStartX,deltaY=event.clientY-stagePointerStartY;Math.abs(deltaX)>=24&&Math.abs(deltaX)>Math.abs(deltaY)&&(suppressStageClick=!0,shiftIndex(deltaX<0?1:-1),window.setTimeout(()=>{suppressStageClick=!1},0))}),stageTrigger.addEventListener("click",event=>{if(suppressStageClick){event.preventDefault();return}if(!(event.detail===0)&&mediaItems.length>1){const badgeRect=stageBadge?.getBoundingClientRect?.()||null;if(isPointInsideRect(event.clientX,event.clientY,badgeRect)){openLightbox(activeIndex);return}const rect=stageTrigger.getBoundingClientRect(),horizontalOffset=event.clientX-rect.left,width=rect.width||1;if(horizontalOffset<=width*.18){event.preventDefault(),shiftIndex(-1);return}if(horizontalOffset>=width*.82){event.preventDefault(),shiftIndex(1);return}}openLightbox(activeIndex)})),closeButtons.forEach(button=>{button.addEventListener("click",()=>{closeLightbox()})}),prevButton?.addEventListener("click",event=>{event.preventDefault(),event.stopPropagation(),shiftIndex(-1)}),nextButton?.addEventListener("click",event=>{event.preventDefault(),event.stopPropagation(),shiftIndex(1)}),lightbox?.addEventListener("click",event=>{if(!lightboxOpen)return;const actionTarget=event.target.closest("[data-theme-media-zoom-in], [data-theme-media-zoom-out], [data-theme-media-zoom-reset], [data-theme-media-prev], [data-theme-media-next]");if(actionTarget){if(event.preventDefault(),event.stopPropagation(),actionTarget.hasAttribute("data-theme-media-zoom-in")){setZoomLevel(zoomLevel+.25);return}if(actionTarget.hasAttribute("data-theme-media-zoom-out")){setZoomLevel(zoomLevel-.25);return}if(actionTarget.hasAttribute("data-theme-media-zoom-reset")){resetLightboxTransform();return}if(actionTarget.hasAttribute("data-theme-media-prev")){shiftIndex(-1);return}actionTarget.hasAttribute("data-theme-media-next")&&shiftIndex(1)}}),zoomInButton?.addEventListener("click",event=>{event.preventDefault(),event.stopPropagation(),setZoomLevel(zoomLevel+.25)}),zoomOutButton?.addEventListener("click",event=>{event.preventDefault(),event.stopPropagation(),setZoomLevel(zoomLevel-.25)}),zoomResetButton?.addEventListener("click",event=>{event.preventDefault(),event.stopPropagation(),resetLightboxTransform()}),lightboxViewport?.addEventListener("dblclick",()=>{setZoomLevel(zoomLevel>1?1:2)}),lightboxViewport?.addEventListener("click",event=>{if(!lightboxOpen||zoomLevel>1||mediaItems.length<2)return;const rect=lightboxViewport.getBoundingClientRect(),horizontalOffset=event.clientX-rect.left,width=rect.width||1;if(horizontalOffset<=width*.3){event.preventDefault(),shiftIndex(-1);return}horizontalOffset>=width*.7&&(event.preventDefault(),shiftIndex(1))}),lightboxViewport?.addEventListener("wheel",event=>{if(!lightboxOpen)return;event.preventDefault();const zoomDelta=event.deltaY<0?.2:-.2;setZoomLevel(zoomLevel+zoomDelta)},{passive:!1}),lightboxViewport?.addEventListener("pointerdown",event=>{!lightboxOpen||zoomLevel<=1||event.pointerType==="mouse"&&event.button!==0||(event.preventDefault(),pointerIsDown=!0,lightboxViewport.classList.add("is-dragging"),pointerStartX=event.clientX,pointerStartY=event.clientY,panStartX=panX,panStartY=panY,lightboxViewport.setPointerCapture?.(event.pointerId))});const handleLightboxPointerMove=event=>{if(!pointerIsDown||zoomLevel<=1)return;event.preventDefault();const deltaX=event.clientX-pointerStartX,deltaY=event.clientY-pointerStartY;panX=panStartX+deltaX,panY=panStartY+deltaY,applyLightboxTransform()};lightboxImage?.addEventListener("dragstart",event=>{event.preventDefault()}),lightboxImage?.addEventListener("load",()=>{lightboxOpen&&(updateLightboxSizing(),applyLightboxTransform())});const releasePointer=event=>{pointerIsDown&&(pointerIsDown=!1,lightboxViewport?.classList.remove("is-dragging"),lightboxViewport?.releasePointerCapture?.(event.pointerId),clampPanToBounds(),applyLightboxTransform())};window.addEventListener("pointermove",handleLightboxPointerMove),window.addEventListener("pointerup",releasePointer),window.addEventListener("pointercancel",releasePointer),window.addEventListener("resize",()=>{lightboxOpen&&(updateLightboxSizing(),clampPanToBounds(),applyLightboxTransform())}),document.addEventListener("keydown",event=>{if(lightboxOpen){if(event.key==="Escape"){closeLightbox();return}if(event.key==="ArrowLeft"){shiftIndex(-1);return}if(event.key==="ArrowRight"){shiftIndex(1);return}if(event.key==="+"||event.key==="="){event.preventDefault(),setZoomLevel(zoomLevel+.2);return}if(event.key==="-"){event.preventDefault(),setZoomLevel(zoomLevel-.2);return}event.key==="0"&&(event.preventDefault(),resetLightboxTransform())}});const initiallyActiveThumb=thumbs.find(thumb=>thumb.classList.contains("is-active"))||thumbs[0];if(initiallyActiveThumb){const initialThumbIndex=thumbs.indexOf(initiallyActiveThumb),thumbMedia=mediaItemsFromThumbs[initialThumbIndex],mappedIndex=thumbMedia?mediaItems.findIndex(item=>item.index===thumbMedia.index):initialThumbIndex;setActiveByIndex(mappedIndex>=0?mappedIndex:0)}else setActiveByIndex(0);gallery.dataset.themeMediaGalleryBound="true"})},initPdpFitSizeToggle=(scope=document)=>
10{const cleanSizeGuideLabel=(value,fallback="")=>String(value||"").replace(/\u00a0/g," ").replace(/\s+/g," ").trim()||fallback,buildPreviewAwareUrl=rawValue=>{const fallbackUrl=new URL("/pages/size-chart",window.location.origin);try{const nextUrl=new URL(rawValue||fallbackUrl.toString(),window.location.origin),previewThemeId=new URL(window.location.href).searchParams.get("preview_theme_id");return previewThemeId&&!nextUrl.searchParams.has("preview_theme_id")&&nextUrl.searchParams.set("preview_theme_id",previewThemeId),nextUrl.toString()}catch{return fallbackUrl.toString()}},polishEmbeddedSizeGuideTable=table=>{if(!table)return null;table.querySelectorAll("meta, colgroup, col").forEach(node=>node.remove()),table.removeAttribute("width"),table.removeAttribute("height"),table.classList.add("theme-size-chart-table");const rows=Array.from(table.querySelectorAll("tr")).filter(row=>row.children.length);if(!rows.length)return table;const firstRow=rows[0];firstRow&&!table.querySelector("th")&&Array.from(firstRow.children).forEach(cell=>{if(cell.tagName.toLowerCase()!=="td")return;const th=document.createElement("th");th.innerHTML=cell.innerHTML,cell.replaceWith(th)});const normalizedRows=Array.from(table.querySelectorAll("tr")).filter(row=>row.children.length),headerLabels=["US","Alpha","Bust","Waist","Hips"];return normalizedRows.forEach((row,rowIndex)=>{Array.from(row.children).forEach((cell,colIndex)=>{const normalized=cleanSizeGuideLabel(cell.textContent,""),colLabel=headerLabels[colIndex]||`Column ${colIndex+1}`;if(cell.className="",cell.classList.add("theme-richtext-table__cell","theme-size-chart-table__cell"),cell.dataset.themeColLabel=colLabel,cell.textContent=rowIndex===0?colLabel:normalized,rowIndex===0){cell.classList.add("theme-richtext-table__cell--head","theme-size-chart-table__cell--head");return}colIndex===0&&cell.classList.add("theme-size-chart-table__cell--numeric"),colIndex===1&&cell.classList.add("theme-size-chart-table__cell--alpha"),colIndex>=2&&cell.classList.add("theme-size-chart-table__cell--measurement")})}),table.style.tableLayout="auto",table.style.width="",table};scope.querySelectorAll(".theme-pdp-fit-size").forEach(section=>{if(section.dataset.themeFitSizeToggleBound==="true")return;const trigger=section.querySelector("[data-theme-size-guide-toggle]");if(!trigger)return;const panelId=trigger.getAttribute("aria-controls");if(!panelId)return;const panel=section.querySelector(`#${panelId}`);if(!panel)return;const guideUrl=panel.dataset.themeSizeGuideUrl||"/pages/size-chart",status=panel.querySelector("[data-theme-size-guide-status]"),content=panel.querySelector("[data-theme-size-guide-content]"),shell=panel.querySelector("[data-theme-size-guide-shell]"),fallback=panel.querySelector("[data-theme-size-guide-fallback]");let loadPromise=null;const setGuideState=isOpen=>{trigger.setAttribute("aria-expanded",isOpen?"true":"false"),panel.hidden=!isOpen},loadGuide=async()=>{if(section.dataset.themeSizeGuideLoaded==="true")return;if(loadPromise)return loadPromise;const requestUrl=buildPreviewAwareUrl(guideUrl);return shell&&(shell.dataset.themeState="loading"),fallback&&(fallback.hidden=!0),status&&(status.hidden=!1,status.textContent="Loading the size chart..."),loadPromise=window.fetch(requestUrl,{credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"}}).then(response=>{if(!response.ok)throw new Error(`Size chart request failed: ${response.status}`);return response.text()}).then(markup=>{const doc=new window.DOMParser().parseFromString(markup,"text/html"),sourceTable=doc.querySelector(".theme-main-page-router--size-chart .theme-main-page-router__content table")||doc.querySelector(".theme-main-page-router__content table")||doc.querySelector("table");if(!sourceTable||!content)throw new Error("Size chart table not found");const polishedTable=polishEmbeddedSizeGuideTable(sourceTable.cloneNode(!0)),wrapper=document.createElement("div");wrapper.className="theme-size-chart-table-wrap",wrapper.appendChild(polishedTable),content.innerHTML="",content.appendChild(wrapper),content.hidden=!1,status&&(status.hidden=!0),shell&&(shell.dataset.themeState="loaded"),fallback&&(fallback.hidden=!1),section.dataset.themeSizeGuideLoaded="true"}).catch(()=>{shell&&(shell.dataset.themeState="error"),status&&(status.hidden=!1,status.textContent="The size chart could not load here. Use the full size page link above."),content&&(content.hidden=!0),fallback&&(fallback.hidden=!0)}).finally(()=>{loadPromise=null}),loadPromise};trigger.addEventListener("click",async()=>{const nextState=!(trigger.getAttribute("aria-expanded")==="true");setGuideState(nextState),nextState&&await loadGuide()}),setGuideState(!1),fallback&&(fallback.hidden=!0),section.dataset.themeFitSizeToggleBound="true"})},initPdpReturnLinks=(scope=document)=>{const productRoot=scope.querySelector(".theme-main-product")||document.querySelector(".theme-main-product");
10if(!productRoot)return;const productTitle=(productRoot.querySelector("h1")?.textContent||"").replace(/\s+/g," ").trim(),currentUrl=new URL(window.location.href),returnTo=`${window.location.pathname||"/"}${window.location.search||""}${window.location.hash||""}`,buildReturnAwareUrl=rawValue=>{const baseUrl=new URL(rawValue||"/",window.location.origin),previewThemeId=currentUrl.searchParams.get("preview_theme_id");return previewThemeId&&!baseUrl.searchParams.has("preview_theme_id")&&baseUrl.searchParams.set("preview_theme_id",previewThemeId),baseUrl.searchParams.set("theme_opened_from","pdp"),baseUrl.searchParams.set("theme_return_to",returnTo),productTitle&&baseUrl.searchParams.set("theme_return_label",productTitle),baseUrl.toString()};productRoot.querySelectorAll("[data-theme-pdp-return-link]").forEach(link=>{!(link instanceof HTMLAnchorElement)||link.dataset.themePdpReturnLinkBound==="true"||(link.href=buildReturnAwareUrl(link.getAttribute("href")),link.target="_blank",link.removeAttribute("rel"),link.addEventListener("click",event=>{if(event.defaultPrevented||event.button!==0||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey)return;event.preventDefault();const supportTab=window.open(link.href,"_blank");if(!supportTab){window.location.assign(link.href);return}try{supportTab.focus()}catch{}}),link.dataset.themePdpReturnLinkBound="true")})},initReturnTabBubble=()=>{if(document.body.dataset.themeReturnTabBubbleBound==="true")return;const currentUrl=new URL(window.location.href),openedFrom=currentUrl.searchParams.get("theme_opened_from"),returnTo=currentUrl.searchParams.get("theme_return_to"),returnLabel=(currentUrl.searchParams.get("theme_return_label")||"").replace(/\s+/g," ").trim();if(openedFrom!=="pdp"||!returnTo){document.body.dataset.themeReturnTabBubbleBound="true";return}const bubble=(()=>{let bubble2=document.querySelector("[data-theme-return-tab-bubble]");return bubble2||(bubble2=document.createElement("aside"),bubble2.className="theme-return-tab-bubble",bubble2.hidden=!0,bubble2.setAttribute("aria-hidden","true"),bubble2.setAttribute("aria-live","polite"),bubble2.setAttribute("data-theme-return-tab-bubble",""),bubble2.innerHTML=` 11 <button type="button" class="theme-return-tab-bubble__dismiss" data-theme-return-tab-dismiss aria-label="Dismiss return message">Close</button> 12 <p class="theme-return-tab-bubble__eyebrow">Still shopping?</p> 13 <h3>Your product page is still open in your other tab.</h3> 14 <p class="theme-return-tab-bubble__body" data-theme-return-tab-copy>This page opened separately so your product page stays in place. Close this tab when you are done here.</p> 15 <div class="theme-return-tab-bubble__actions"> 16 <button type="button" data-theme-return-tab-close>Close this tab</button> 17 </div> 18 `,document.body.appendChild(bubble2),bubble2)})(),closeButton=bubble.querySelector("[data-theme-return-tab-close]"),dismissButton=bubble.querySelector("[data-theme-return-tab-dismiss]"),title=bubble.querySelector("h3"),copy=bubble.querySelector("[data-theme-return-tab-copy]");if(!(closeButton instanceof HTMLButtonElement)||!(dismissButton instanceof HTMLButtonElement)){document.body.dataset.themeReturnTabBubbleBound="true";return}const closeBubble=()=>{bubble.hidden=!0,bubble.setAttribute("aria-hidden","true"),bubble.dataset.themeState="closed"};title&&(title.textContent=returnLabel?`${returnLabel} is still open in your other tab.`:"Your product page is still open in your other tab."),copy&&(copy.textContent="This page opened separately so your product page stays in place. Close this tab when you are done here."),dismissButton.addEventListener("click",closeBubble),closeButton.addEventListener("click",()=>{const openerWindow=window.opener&&!window.opener.closed?window.opener:null;if(openerWindow)try{openerWindow.focus()}catch{}window.close(),window.setTimeout(()=>{window.closed||copy&&(copy.textContent=openerWindow?"This tab could not close automatically. Your product page is still open in the other tab.":"This tab could not find the original product tab. You can close this tab and return to the product manually.")},160)}),bubble.hidden=!1,bubble.setAttribute("aria-hidden","false"),bubble.dataset.themeState="open",document.body.dataset.themeReturnTabBubbleBound="true"},initPdpReviewPresentation=(scope=document)=>{const reviewPresentation=getRuntimeAdapter().initPdpReviewPresentation;typeof reviewPresentation=="function"&&reviewPresentation(scope)},closeAllShellToggles=(exceptToggle=null,{restoreFocus=!1}={})=>{const openToggles=Array.from(document.querySelectorAll(".theme-site-header .theme-shell-toggle[open]")).filter(toggle=>!exceptToggle||toggle!==exceptToggle);
18if(openToggles.forEach(toggle=>{exceptToggle&&toggle===exceptToggle||toggle.hasAttribute("open")&&toggle.removeAttribute("open")}),restoreFocus){const summary=openToggles[0]?.querySelector(":scope > summary");summary&&summary.focus({preventScroll:!0})}},syncShellState=()=>{const shell=document.querySelector(".theme-shell"),header=document.querySelector(".theme-site-header");if(!shell||!header)return;let state="default";header.querySelector(".theme-shell-toggle--menu[open]")?state="menu-open":header.querySelector(".theme-shell-toggle--search[open]")?state="search-open":header.querySelector(".theme-shell-toggle--account[open]")&&(state="account-open"),shell.setAttribute("data-theme-shell-state",state)},initMobileMenuDrillIn=header=>{const drawer=header.querySelector("[data-theme-mobile-menu-drawer]"),root=drawer?.querySelector("[data-theme-mobile-menu-root]");if(!drawer||!root||drawer.dataset.themeMobileMenuBound==="true")return;const panels=Array.from(drawer.querySelectorAll("[data-theme-mobile-menu-panel]")),controls=Array.from(drawer.querySelectorAll("[data-theme-mobile-menu-open]")),panelById=new Map(panels.map(panel=>[panel.id,panel])),openerByPanel=new Map(controls.map(control=>[panelById.get(control.getAttribute("aria-controls")),control]).filter(([panel])=>panel)),scrollPositions=new WeakMap;let activePane=root;const paneScrollTop=pane=>pane===root?drawer.scrollTop:pane.scrollTop,setPaneScrollTop=(pane,value)=>{pane===root?drawer.scrollTop=value:pane.scrollTop=value},setControlState=(activePanel=null)=>{controls.forEach(control=>{control.setAttribute("aria-expanded",String(panelById.get(control.getAttribute("aria-controls"))===activePanel))})},showPane=nextPane=>{nextPane&&(scrollPositions.set(activePane,paneScrollTop(activePane)),activePane!==nextPane&&(activePane.hidden=!0),panels.forEach(panel=>{panel!==nextPane&&(panel.hidden=!0)}),nextPane.hidden=!1,activePane=nextPane,setPaneScrollTop(nextPane,scrollPositions.get(nextPane)||0),setControlState(nextPane===root?null:nextPane))},returnToParent=()=>{if(activePane===root)return!1;const closingPanel=activePane,parentPane=closingPanel.dataset.themeMobileMenuParent==="root"?root:panelById.get(closingPanel.dataset.themeMobileMenuParent);return showPane(parentPane||root),openerByPanel.get(closingPanel)?.focus({preventScroll:!0}),!0},reset=()=>{root.hidden=!1,panels.forEach(panel=>{panel.hidden=!0,panel.scrollTop=0}),drawer.scrollTop=0,activePane=root,setControlState()},presentActiveRoute=()=>{const activePanel=panels.filter(panel=>panel.querySelector('[aria-current="page"]')).sort((left,right)=>Number(right.dataset.themeMobileMenuLevel)-Number(left.dataset.themeMobileMenuLevel))[0];showPane(activePanel||root)},focusActivePane=()=>{if(activePane===root){focusFirstInteractive(root);return}activePane.querySelector("[data-theme-mobile-menu-back]")?.focus({preventScroll:!0})};controls.forEach(control=>{control.addEventListener("click",()=>{const panel=panelById.get(control.getAttribute("aria-controls"));panel&&showPane(panel)})}),panels.forEach(panel=>{panel.querySelector("[data-theme-mobile-menu-back]")?.addEventListener("click",returnToParent)}),header.addEventListener("keydown",event=>{event.key!=="Escape"||activePane===root||(event.preventDefault(),event.stopPropagation(),returnToParent())}),drawer.__themeMobileMenu={focusActivePane,presentActiveRoute,reset},drawer.dataset.themeMobileMenuBound="true",reset()},deferMobileSearchFocus=toggle=>{window.requestAnimationFrame(()=>{if(!toggle?.open)return;const input=toggle.querySelector("#theme-shell-search-input-mobile");input&&typeof input.focus=="function"&&input.focus({preventScroll:!0})})},initShellHeaderControls=(scope=document)=>{scope.querySelectorAll(".theme-site-header").forEach(header=>{if(header.dataset.themeShellToggleBound==="true")return;initMobileMenuDrillIn(header),Array.from(header.querySelectorAll(".theme-shell-toggle")).forEach(toggle=>{toggle.addEventListener("toggle",()=>{if(toggle.open){closeAllShellToggles(toggle);const mobileMenu=toggle.querySelector("[data-theme-mobile-menu-drawer]")?.__themeMobileMenu;
18mobileMenu?(mobileMenu.presentActiveRoute(),mobileMenu.focusActivePane()):toggle.matches(".theme-shell-toggle--search")?deferMobileSearchFocus(toggle):focusFirstInteractive(toggle.querySelector(".theme-shell-drawer"))}else toggle.querySelector("[data-theme-mobile-menu-drawer]")?.__themeMobileMenu?.reset();syncShellState()})}),header.dataset.themeShellToggleBound="true"}),isShellToggleGlobalBound||(document.addEventListener("click",event=>{const header=document.querySelector(".theme-site-header");header&&(header.contains(event.target)||(closeAllShellToggles(),syncShellState()))}),document.addEventListener("keydown",event=>{event.key==="Escape"&&(closeAllShellToggles(null,{restoreFocus:!0}),syncShellState())}),window.addEventListener("resize",()=>{window.innerWidth>=960&&(closeAllShellToggles(),syncShellState())}),isShellToggleGlobalBound=!0),syncShellState()},initHeaderScrollVisibility=(scope=document)=>{const header=(scope instanceof Element&&scope.matches(".theme-site-header")?scope:scope.querySelector?.(".theme-site-header"))||document.querySelector(".theme-site-header");if(!header||headerScrollVisibilityController?.header===header)return;headerScrollVisibilityController?.destroy();const mobileQuery=window.matchMedia("(max-width: 59.99rem)"),directionThreshold=12,topThreshold=8;let previousScrollY=Math.max(0,window.scrollY||window.pageYOffset||0),scrollDirection=null,directionalDistance=0,scrollFrame=null;const isEditorMode=()=>!!window.Shopify?.designMode,isMobileScrollVisibilityEnabled=()=>mobileQuery.matches&&!isEditorMode(),isShellToggleOpen=()=>!!header.querySelector(".theme-shell-toggle--menu[open], .theme-shell-toggle--search[open], .theme-shell-toggle--account[open]"),hasFullscreenThemeOverlay=()=>!!document.querySelector([".theme-quick-view[open]","[data-theme-media-lightbox]:not([hidden])",'.theme-contact-popup[data-theme-state="open"]',".theme-account-offer.is-open","details.theme-collection-filter-bar__drawer[open]","cart-drawer.drawer.active",".cart-drawer.drawer.active","modal-dialog[open]"].join(", ")),resetTracking=(scrollY=Math.max(0,window.scrollY||window.pageYOffset||0))=>{previousScrollY=scrollY,scrollDirection=null,directionalDistance=0},setVisibility=visibility=>header.dataset.themeScrollVisibility===visibility?!1:(header.dataset.themeScrollVisibility=visibility,resetTracking(),!0),showAndSuspend=()=>{setVisibility("shown"),resetTracking()},updateVisibility=()=>
18{if(scrollFrame=null,!isMobileScrollVisibilityEnabled()||isShellToggleOpen()||hasFullscreenThemeOverlay()){showAndSuspend();return}const currentScrollY=Math.max(0,window.scrollY||window.pageYOffset||0),delta=currentScrollY-previousScrollY;if(currentScrollY<=topThreshold){setVisibility("shown"),resetTracking(currentScrollY);return}if(delta===0)return;const nextDirection=delta>0?"down":"up";if(directionalDistance=nextDirection===scrollDirection?directionalDistance+Math.abs(delta):Math.abs(delta),scrollDirection=nextDirection,previousScrollY=currentScrollY,!(directionalDistance<directionThreshold)){if(nextDirection==="down"){const hideAfter=header.getBoundingClientRect().height+topThreshold;currentScrollY>hideAfter&&setVisibility("hidden");return}setVisibility("shown")}},requestVisibilityUpdate=()=>{scrollFrame===null&&(scrollFrame=window.requestAnimationFrame(updateVisibility))},handleToggle=()=>{isShellToggleOpen()?showAndSuspend():resetTracking()},handleFocusIn=()=>showAndSuspend(),handleMediaChange=()=>{showAndSuspend(),requestVisibilityUpdate()},isFullscreenOverlayNode=node=>node instanceof Element&&(node.matches("cart-drawer.drawer, .cart-drawer.drawer, modal-dialog")||node.querySelector("cart-drawer.drawer, .cart-drawer.drawer, modal-dialog")),fullscreenOverlayObserver=typeof MutationObserver=="function"?new MutationObserver(records=>{records.some(record=>record.type==="attributes"?isFullscreenOverlayNode(record.target):Array.from(record.addedNodes).some(isFullscreenOverlayNode))&&showAndSuspend()}):null,toggles=Array.from(header.querySelectorAll(".theme-shell-toggle--menu, .theme-shell-toggle--search, .theme-shell-toggle--account"));window.addEventListener("scroll",requestVisibilityUpdate,{passive:!0}),header.addEventListener("focusin",handleFocusIn),toggles.forEach(toggle=>toggle.addEventListener("toggle",handleToggle)),document.addEventListener("click",requestVisibilityUpdate),document.addEventListener("toggle",requestVisibilityUpdate,!0),fullscreenOverlayObserver?.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","open"]}),typeof mobileQuery.addEventListener=="function"?mobileQuery.addEventListener("change",handleMediaChange):mobileQuery.addListener(handleMediaChange),setVisibility("shown"),header.dataset.themeScrollVisibilityBound="true",headerScrollVisibilityController={header,destroy(){window.removeEventListener("scroll",requestVisibilityUpdate),header.removeEventListener("focusin",handleFocusIn),toggles.forEach(toggle=>toggle.removeEventListener("toggle",handleToggle)),document.removeEventListener("click",requestVisibilityUpdate),document.removeEventListener("toggle",requestVisibilityUpdate,!0),fullscreenOverlayObserver?.disconnect(),typeof mobileQuery.removeEventListener=="function"?mobileQuery.removeEventListener("change",handleMediaChange):mobileQuery.removeListener(handleMediaChange),scrollFrame!==null&&window.cancelAnimationFrame(scrollFrame),header.removeAttribute("data-theme-scroll-visibility-bound")}}},initRichTextTablePolish=(scope=document)=>{const containers=scope.querySelectorAll(".theme-policy-content__page.rte, .theme-policy-content__body.rte, .theme-main-page-router__content.rte, .theme-generic-page__content.rte"),cleanLabel=(value,fallback)=>String(value||"").replace(/\s+/g," ").replace(/\u00a0/g," ").trim()||fallback,escapeHtml=value=>String(value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),normalizeCellStyle=cell=>{if(!cell||!cell.getAttribute)return;const raw=cell.getAttribute("style");if(!raw)return;const keep=raw.split(";").map(part=>part.trim()).filter(Boolean).filter(part=>{const key=part.split(":")[0]?.trim().toLowerCase();return key?!["width","height","min-width","max-width","min-height","max-height","padding","margin"].includes(key):!1});keep.length?cell.setAttribute("style",keep.join("; ")+";"):cell.removeAttribute("style")},normalizeTextNodes=root=>{if(!root||!document.createTreeWalker)return;const walker=document.createTreeWalker(root,NodeFilter.SHOW_TEXT),nodes=[];let current=walker.nextNode();for(;current;)nodes.push(current),current=walker.nextNode();
18nodes.forEach(node=>{const nextValue=String(node.nodeValue||"").replace(/\u00a0/g," ").replace(/[ \t]{2,}/g," ").replace(/\s+\n/g,` 19`).replace(/\n\s+/g,` 20`);node.nodeValue=nextValue})},cleanupCellContent=cell=>{cell&&(cell.querySelectorAll("div, span, p, strong, em").forEach(node=>{if(node.querySelector("img, picture, video, iframe, table"))return;cleanLabel(node.textContent,"")||node.remove()}),cell.querySelectorAll("br").forEach(lineBreak=>{const next=lineBreak.nextSibling;next&&next.nodeType===Node.TEXT_NODE&&(next.nodeValue=String(next.nodeValue||"").replace(/^\s+/,""))}),normalizeTextNodes(cell))},wrapTable=(table,className)=>{if(!table||!className)return null;const parent=table.parentElement;if(parent&&parent.classList.contains(className))return parent;const wrapper=document.createElement("div");return wrapper.className=className,table.parentNode.insertBefore(wrapper,table),wrapper.appendChild(table),wrapper},polishSizeChartTable=table=>{if((table.closest("[data-theme-page-handle]")?.dataset.themePageHandle||"")!=="size-chart")return!1;const rows=Array.from(table.querySelectorAll("tr")).filter(row=>row.children.length);if(!rows.length)return!0;const headerLabels=["US","Alpha","Bust","Waist","Hips"];return table.classList.add("theme-size-chart-table"),wrapTable(table,"theme-size-chart-table-wrap"),rows.forEach((row,rowIndex)=>{Array.from(row.children).forEach((cell,colIndex)=>{const normalized=cleanLabel(cell.textContent,""),colLabel=headerLabels[colIndex]||`Column ${colIndex+1}`;if(cell.classList.add("theme-richtext-table__cell","theme-size-chart-table__cell"),cell.classList.remove("theme-richtext-table__cell--price"),cell.dataset.themeColLabel=colLabel,rowIndex===0){cell.classList.add("theme-richtext-table__cell--head","theme-size-chart-table__cell--head"),cell.textContent=colLabel;return}cell.classList.remove("theme-richtext-table__cell--head"),cell.textContent=normalized,colIndex===1&&cell.classList.add("theme-size-chart-table__cell--alpha"),colIndex===0&&cell.classList.add("theme-size-chart-table__cell--numeric"),colIndex>=2&&cell.classList.add("theme-size-chart-table__cell--measurement")})}),table.style.tableLayout="auto",table.style.width="",!0};containers.forEach(container=>{container.querySelectorAll("table").forEach(table=>{if(table.dataset.themeTablePolished==="true")return;table.dataset.themeTablePolished="true",table.classList.add("theme-richtext-table"),table.removeAttribute("width"),table.removeAttribute("height"),normalizeCellStyle(table),table.querySelectorAll("meta, colgroup, col").forEach(node=>node.remove()),table.querySelectorAll("tr, th, td").forEach(node=>{node.removeAttribute("width"),node.removeAttribute("height"),normalizeCellStyle(node),cleanupCellContent(node)}),table.querySelectorAll("p").forEach(paragraph=>{if(paragraph.querySelector("img, picture, video, iframe, table"))return;const text=cleanLabel(paragraph.textContent,""),semanticText=text.replace(/[\s\u00a0\-\–\—\|\_]/g,"");if(!text||!/[A-Za-z0-9$]/.test(semanticText)){paragraph.remove();return}paragraph.textContent=text});const firstRow=table.querySelector("tr");if(firstRow&&!table.querySelector("th")&&Array.from(firstRow.children).forEach(cell=>{if(cell.tagName.toLowerCase()!=="td")return;const th=document.createElement("th");th.innerHTML=cell.innerHTML,cell.replaceWith(th)}),polishSizeChartTable(table))return;const rows=Array.from(table.querySelectorAll("tr"));if(!rows.length)return;const labels=Array.from(rows[0].children).map((cell,index)=>{const fallback=index===1?"Cost":`Column ${index+1}`;return cleanLabel(cell.textContent,fallback)});rows.forEach((row,rowIndex)=>{Array.from(row.children).forEach((cell,colIndex)=>{if(cell.classList.add("theme-richtext-table__cell"),cell.dataset.themeColLabel=labels[colIndex]||`Column ${colIndex+1}`,(colIndex===1||/cost|price|amount/i.test(cell.dataset.themeColLabel||""))&&cell.classList.add("theme-richtext-table__cell--price"),rowIndex===0){cell.classList.add("theme-richtext-table__cell--head"),cell.textContent=labels[colIndex]||cleanLabel(cell.textContent,"");return}if(colIndex===1||cell.classList.contains("theme-richtext-table__cell--price")){const amountMatch=cleanLabel(cell.textContent,"").match(/\$\s?\d[\d,]*(?:\.\d{2})?/);amountMatch&&amountMatch[0]?cell.textContent=amountMatch[0].replace(/\s+/g,""):cell.textContent=cleanLabel(cell.textContent,"").replace(/[^\d$.,-]/g," ").replace(/\s+/g," ").trim()}else{const normalized=cleanLabel(cell.textContent,"").replace(/\s{2,}/g," "),fallbackPrimary=normalized;let primary=normalized,detail="";const parentheticalMatch=normalized.match(/^(.*?)\s*\((.+)\)$/);if(parentheticalMatch)primary=cleanLabel(parentheticalMatch[1],fallbackPrimary),detail=cleanLabel(parentheticalMatch[2],"");else{const freeShippingMatch=normalized.match(/^(.*?)(free\s+standard\s+shipping.+)$/i);freeShippingMatch&&(primary=cleanLabel(freeShippingMatch[1],fallbackPrimary),detail=cleanLabel(freeShippingMatch[2],""))}const safePrimary=escapeHtml(primary),safeDetail=escapeHtml(detail);cell.innerHTML=safeDetail?`<span class="theme-richtext-table__service">${safePrimary}</span><span class="theme-richtext-table__detail">${safeDetail}</span>`:`<span class="theme-richtext-table__service">${safePrimary}</span>`}})}),labels.length===2&&(table.style.tableLayout="fixed",table.style.width="100%")})})}
20,initContactSupportPopup=(scope=document)=>{const popup=scope.querySelector("[data-theme-contact-popup]")||document.querySelector("[data-theme-contact-popup]");if(!popup||popup.dataset.themeContactPopupBound==="true")return;const panel=popup.querySelector("[data-theme-contact-popup-panel]"),closeButtons=Array.from(popup.querySelectorAll("[data-theme-contact-popup-close]")),nameField=popup.querySelector('input[name="contact[name]"]'),shell=document.querySelector(".theme-shell"),configuredContactPath=getRuntimeAdapter().contactRoutes?.popupPath,contactPath=typeof configuredContactPath=="string"&&configuredContactPath.startsWith("/")?configuredContactPath:"/search";let lastFocusedElement=null;const normalizePath=value=>value&&value.replace(/\/+$/,"")||"/",isContactPath=value=>{const normalized=normalizePath(value);return normalized===contactPath||normalized.endsWith(contactPath)},currentPath=()=>normalizePath(window.location.pathname||"/"),forceClosed=()=>{popup.hidden=!0,popup.setAttribute("hidden",""),popup.setAttribute("aria-hidden","true"),popup.dataset.themeState="closed",popup.style.display="none",document.body.classList.remove("theme-contact-popup-open"),shell&&shell.setAttribute("data-theme-contact-popup-state","closed")},setPopupState=isOpen=>{if(isOpen){popup.hidden=!1,popup.removeAttribute("hidden"),popup.setAttribute("aria-hidden","false"),popup.dataset.themeState="open",popup.style.display="grid",document.body.classList.add("theme-contact-popup-open"),shell&&shell.setAttribute("data-theme-contact-popup-state","open"),lastFocusedElement=document.activeElement,window.requestAnimationFrame(()=>{typeof nameField?.focus=="function"?nameField.focus():focusFirstInteractive(panel)});return}forceClosed(),lastFocusedElement&&typeof lastFocusedElement.focus=="function"&&lastFocusedElement.focus()},openPopup=()=>{closeAllShellToggles(),syncShellState(),setPopupState(!0)},closePopup=()=>{setPopupState(!1),window.location.hash==="#contact-support"&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)};forceClosed(),window.addEventListener("pageshow",()=>{forceClosed()}),closeButtons.forEach(button=>{button.addEventListener("click",closePopup)}),document.addEventListener("keydown",event=>{event.key==="Escape"&&popup.dataset.themeState==="open"&&closePopup()});const isPopupTriggerHash=hash=>{const normalized=(hash||"").toLowerCase();return normalized===""||normalized==="#theme-contact-form"||normalized==="#contact-support"},shouldInterceptLink=link=>{if(!link||link.hasAttribute("download")||link.target&&link.target!=="_self")return!1;let url;try{url=new URL(link.getAttribute("href"),window.location.origin)}catch{return!1}const targetPath=normalizePath(url.pathname);return!(!(isContactPath(targetPath)&&isPopupTriggerHash(url.hash))||isContactPath(currentPath()))},bindContactTrigger=link=>{!link||link.dataset.themeContactTriggerBound==="true"||(link.addEventListener("click",event=>{event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button!==0||shouldInterceptLink(link)&&(event.preventDefault(),event.stopPropagation(),openPopup())}),link.dataset.themeContactTriggerBound="true")},bindAllContactTriggers=(root=document)=>{Array.from(root.querySelectorAll("a[href]")).forEach(link=>{shouldInterceptLink(link)&&bindContactTrigger(link)})};bindAllContactTriggers(document),new MutationObserver(mutations=>{mutations.forEach(mutation=>{mutation.addedNodes.forEach(node=>{if(node instanceof Element){if(node.matches("a[href]")){shouldInterceptLink(node)&&bindContactTrigger(node);return}bindAllContactTriggers(node)}})})}).observe(document.body,{childList:!0,subtree:!0}),popup.dataset.themeContactPopupBound="true"},initShellAnnouncementCopy=()=>{},initContactFormAnchorRouting=(scope=document)=>{const formWrap=scope.querySelector("#theme-contact-form");if(!formWrap||formWrap.dataset.themeContactAnchorBound==="true")return;const configuredContactPaths=getRuntimeAdapter().contactRoutes?.anchorPaths,contactPaths=Array.isArray(configuredContactPaths)&&configuredContactPaths.length?configuredContactPaths:["/search"],focusSupportNameField=()=>{const nameField=formWrap.querySelector('input[name="contact[name]"]');nameField&&typeof nameField.focus=="function"&&nameField.focus({preventScroll:!0})},scrollToSupportForm=(focusField=!1)=>{formWrap.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}),focusField&&setTimeout(focusSupportNameField,320)};document.addEventListener("click",event=>{const link=event.target.closest("a[href]");if(!link)return;const href=link.getAttribute("href")||"";!href.includes("#theme-contact-form")||!(href==="#theme-contact-form"||contactPaths.some(path=>href.endsWith(`${path}#theme-contact-form`)||href.endsWith(`${path}/#theme-contact-form`)))&&!href.startsWith(window.location.pathname+"#")||(event.preventDefault(),history.replaceState(null,"",`${window.location.pathname}#theme-contact-form`),scrollToSupportForm(!0))}),window.location.hash==="#theme-contact-form"&&requestAnimationFrame(()=>{scrollToSupportForm(!0)}),formWrap.dataset.themeContactAnchorBound="true"},initContactBotGuard=(scope=document)=>{const forms=scope.querySelectorAll("form");
20forms.length&&forms.forEach(form=>{const guardRoot=form.querySelector("[data-theme-contact-guard-root]");if(!guardRoot||form.dataset.themeContactGuardBound==="true")return;const startedAtInput=guardRoot.querySelector("[data-theme-contact-guard-started-at]"),elapsedInput=guardRoot.querySelector("[data-theme-contact-guard-elapsed]"),interactionInput=guardRoot.querySelector("[data-theme-contact-guard-interaction]"),resultInput=guardRoot.querySelector("[data-theme-contact-guard-result]"),sourcePathInput=guardRoot.querySelector("[data-theme-contact-guard-path]"),honeypotInput=guardRoot.querySelector("[data-theme-contact-guard-honeypot]"),questionNode=guardRoot.querySelector("[data-theme-contact-guard-question]"),answerInput=guardRoot.querySelector("[data-theme-contact-guard-answer]"),humanCheckbox=guardRoot.querySelector("[data-theme-contact-guard-human]"),errorNode=guardRoot.querySelector("[data-theme-contact-guard-error]"),submitControl=form.querySelector('button[type="submit"], input[type="submit"]'),startedAt=Date.now();let interactionCount=0,expectedAnswer=null;if(startedAtInput&&(startedAtInput.value=String(startedAt)),sourcePathInput&&(sourcePathInput.value=window.location.pathname||sourcePathInput.value||"/"),questionNode&&answerInput){const left=Math.floor(Math.random()*7)+3,right=Math.floor(Math.random()*7)+2;expectedAnswer=left+right,questionNode.textContent=`What is ${left} + ${right}?`}const setError=message=>{errorNode&&(errorNode.textContent=message,errorNode.hidden=!1)},clearError=()=>{errorNode&&(errorNode.textContent="",errorNode.hidden=!0)},markInteraction=()=>{interactionCount+=1,interactionInput&&interactionCount>0&&(interactionInput.value="true")};form.addEventListener("pointerdown",markInteraction,{passive:!0}),form.addEventListener("keydown",markInteraction),form.addEventListener("input",markInteraction,{passive:!0}),form.addEventListener("submit",event=>{clearError();const now=Date.now(),elapsedMs=Math.max(0,now-startedAt);if(elapsedInput&&(elapsedInput.value=String(elapsedMs)),honeypotInput&&honeypotInput.value.trim()!==""){event.preventDefault(),resultInput&&(resultInput.value="blocked_honeypot"),setError("Submission blocked. Please refresh the page and try again.");return}if(elapsedMs<3200){event.preventDefault(),resultInput&&(resultInput.value="blocked_too_fast"),setError("Please wait a moment, then submit again.");return}if(interactionCount<2){event.preventDefault(),resultInput&&(resultInput.value="blocked_no_interaction"),setError("Please complete the form fields before submitting.");return}if(answerInput&&expectedAnswer!==null){const actual=parseInt(answerInput.value,10);if(!Number.isFinite(actual)||actual!==expectedAnswer){event.preventDefault(),resultInput&&(resultInput.value="blocked_bad_challenge"),setError("Security check answer is incorrect. Please try again."),answerInput.focus();return}}if(humanCheckbox&&!humanCheckbox.checked){event.preventDefault(),resultInput&&(resultInput.value="blocked_unchecked_human"),setError("Please confirm that you are a real person."),humanCheckbox.focus();return}if(submitControl){if(submitControl.dataset.themeSubmitting==="true"){event.preventDefault();return}submitControl.dataset.themeSubmitting="true",submitControl.setAttribute("disabled","disabled"),window.setTimeout(()=>{submitControl.dataset.themeSubmitting="false",submitControl.removeAttribute("disabled")},8e3)}resultInput&&(resultInput.value="pass")}),form.dataset.themeContactGuardBound="true"})},initGlobalContactInlineRouting=()=>{if(document.body.dataset.themeContactInlineRoutingBound==="true")return;const normalizePath=value=>value&&value.replace(/\/+$/,"")||"/",configuredContactRoutes=getRuntimeAdapter().contactRoutes||{},primaryContactPath=typeof configuredContactRoutes.primaryPath=="string"&&configuredContactRoutes.primaryPath.startsWith("/")?configuredContactRoutes.primaryPath:"/search",legacyContactPaths=Array.isArray(configuredContactRoutes.legacyPaths)?configuredContactRoutes.legacyPaths.filter(path=>typeof path=="string"&&path.startsWith("/")):["/search"],isContactPath=value=>{const normalized=normalizePath(value);return normalized===primaryContactPath||normalized.endsWith(primaryContactPath)||legacyContactPaths.some(path=>normalized===path||normalized.endsWith(path))};document.addEventListener("click",event=>{const link=event.target.closest("a[href]");if(!link||link.hasAttribute("download")||link.target&&link.target!=="_self"||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button!==0)return;let url;
20try{url=new URL(link.getAttribute("href"),window.location.origin)}catch{return}if(url.origin!==window.location.origin||!isContactPath(url.pathname))return;const currentPath=normalizePath(window.location.pathname||"/");if(isContactPath(currentPath))return;const hash=(url.hash||"").toLowerCase();hash&&hash!=="#theme-contact-form"||(event.preventDefault(),window.location.assign(`${primaryContactPath}#theme-contact-form`))},!0),document.body.dataset.themeContactInlineRoutingBound="true"},initFreeShippingPresentation=()=>{if(!document.body||document.body.dataset.themeFreeShippingPresentationBound==="true")return;const shellSelector="[class*='free_shipping_card_wrapper_']",titleSelector="[class*='free_shipping_card_title_']",progressSelector="[class*='free_shipping_card_progress_']",productsSelector="[class*='free_shipping_products_wrapper_']",productSelector="[class*='free_shipping_card_product_']",imageSelector="[class*='free_shipping_card_product_image_']",metaSelector="[class*='free_shipping_card_product_meta_']",priceWrapSelector="[class*='free_shipping_card_product_prices_wrapper_']",ctaSelector="[class*='free_shipping_card_product_cta_']",decorateShell=shell=>{if(!shell||shell.dataset.themeFreeShippingPresented==="true")return;const isDrawer=shell.className.indexOf("placement_side_cart")>-1||!!shell.closest(".order-value-booster-side-cart, .side-cart, cart-drawer, .drawer"),title=shell.querySelector(titleSelector),progress=shell.querySelector(progressSelector),products=shell.querySelector(productsSelector);shell.classList.add("theme-free-shipping-shell"),shell.classList.toggle("theme-free-shipping-shell--drawer",isDrawer),shell.classList.toggle("theme-free-shipping-shell--page",!isDrawer);let summary=shell.querySelector(".theme-free-shipping-shell__summary");summary||(summary=document.createElement("div"),summary.className="theme-free-shipping-shell__summary",shell.prepend(summary)),title&&title.parentElement!==summary&&summary.appendChild(title),progress&&progress.parentElement!==summary&&summary.appendChild(progress),products&&(products.classList.add("theme-free-shipping-shell__products"),products.parentElement!==shell&&shell.appendChild(products)),shell.querySelectorAll(productSelector).forEach(productCard=>{productCard.classList.add("theme-free-shipping-shell__product");const image=productCard.querySelector(imageSelector),meta=productCard.querySelector(metaSelector),prices=productCard.querySelector(priceWrapSelector),cta=productCard.querySelector(ctaSelector);image&&image.classList.add("theme-free-shipping-shell__image"),meta&&meta.classList.add("theme-free-shipping-shell__meta"),prices&&prices.classList.add("theme-free-shipping-shell__prices"),cta&&cta.classList.add("theme-free-shipping-shell__cta")}),shell.dataset.themeFreeShippingPresented="true"},decorateAll=()=>{document.querySelectorAll(shellSelector).forEach(shell=>decorateShell(shell))};decorateAll(),new MutationObserver(()=>{decorateAll()}).observe(document.body,{childList:!0,subtree:!0}),document.body.dataset.themeFreeShippingPresentationBound="true"},initNativeFreeShipping=()=>{if(!document.body||document.body.dataset.themeNativeFreeShippingBound==="true")return;if(document.body.dataset.themeFreeShippingEnabled!=="true"){document.querySelectorAll("[data-theme-free-shipping-mount]").forEach(mount=>{mount.hidden=!0,mount.innerHTML=""}),document.body.dataset.themeNativeFreeShippingBound="true";return}const getConfig=()=>{const body=document.body,parsedThresholdCents=Number.parseInt(body.dataset.themeFreeShippingThresholdCents||"",10);return{thresholdCents:Number.isFinite(parsedThresholdCents)?Math.max(0,parsedThresholdCents):0,heading:body.dataset.themeFreeShippingHeading||"Free shipping unlock",intro:body.dataset.themeFreeShippingIntro||"Free standard shipping on orders over {threshold}.",progressCopy:body.dataset.themeFreeShippingProgressCopy||"You\u2019re {remaining} away from free shipping.",completeCopy:body.dataset.themeFreeShippingCompleteCopy||"You\u2019ve unlocked free standard shipping."}},formatMoney=(cents,currency)=>{const amount=Math.max(0,cents)/100,language=document.documentElement.lang||"en-US";try{return new Intl.NumberFormat(language,{style:"currency",currency:currency||"USD",maximumFractionDigits:2}).format(amount)}catch{return`$${amount.toFixed(2)}`}},resolveCopyTokens=(copy,thresholdText,remainingText)=>String(copy).replace(/\{threshold\}/g,thresholdText).replace(/\{remaining\}/g,remainingText),resolveMounts=()=>{const mounts=Array.from(document.querySelectorAll("[data-theme-free-shipping-mount]")),drawerFooter=document.querySelector("cart-drawer .drawer__footer");if(drawerFooter){let drawerMount=drawerFooter.querySelector('[data-theme-free-shipping-mount][data-theme-free-shipping-context="drawer"]');drawerMount||(drawerMount=document.createElement("div"),drawerMount.className="theme-cart-drawer__free-shipping",drawerMount.dataset.themeFreeShippingMount="",drawerMount.dataset.themeFreeShippingContext="drawer",drawerFooter.insertBefore(drawerMount,drawerFooter.firstChild)),mounts.push(drawerMount)}return mounts},renderCard=(mount,cart)=>{if(!mount)return;const config=getConfig(),threshold=config.thresholdCents,total=Math.max(0,parseInt(cart.total_price||0,10)),remaining=Math.max(0,threshold-total),progress=threshold>0?Math.min(100,Math.round(total/threshold*100)):100,thresholdText=formatMoney(threshold,cart.currency),remainingText=formatMoney(remaining,cart.currency),isUnlocked=total>=threshold&&cart.item_count>0,message=isUnlocked?config.completeCopy:cart.item_count>0?config.progressCopy:config.intro,resolvedHeading=resolveCopyTokens(config.heading,thresholdText,remainingText),resolvedMessage=resolveCopyTokens(message,thresholdText,remainingText);mount.innerHTML=` 21 <section class="theme-free-shipping-native theme-free-shipping-native--${mount.dataset.themeFreeShippingContext||"page"}" aria-label="${resolvedHeading}"> 22 <div class="theme-free-shipping-native__header"> 23 <p class="theme-free-shipping-native__eyebrow">${resolvedHeading}</p> 24 <p class="theme-free-shipping-native__message">${resolvedMessage}</p> 25 </div> 26 <div class="theme-free-shipping-native__progress" aria-hidden="true">
27 <span class="theme-free-shipping-native__progress-track"> 28 <span class="theme-free-shipping-native__progress-bar" style="transform: scaleX(${Math.max(.08,progress/100)});"></span> 29 </span> 30 <span class="theme-free-shipping-native__progress-meta">${isUnlocked?"Unlocked":`${progress}%`}</span> 31 </div> 32 </section> 33 `,mount.hidden=!1};let refreshTimer=null;const refresh=()=>{window.clearTimeout(refreshTimer),refreshTimer=window.setTimeout(async()=>{const mounts=resolveMounts();if(mounts.length)try{const response=await fetch(`${window.Shopify.routes.root}cart.js`,{credentials:"same-origin",headers:{Accept:"application/json"}});if(!response.ok)return;const cart=await response.json();mounts.forEach(mount=>renderCard(mount,cart))}catch{}},80)};new MutationObserver(mutations=>{mutations.some(mutation=>Array.from(mutation.addedNodes).some(node=>node instanceof HTMLElement?node.matches?.("cart-drawer, cart-drawer-items, .drawer__footer, #MainContent")||node.querySelector?.("cart-drawer, cart-drawer-items, .drawer__footer, [data-theme-free-shipping-mount]"):!1))&&refresh()}).observe(document.body,{childList:!0,subtree:!0}),document.addEventListener("submit",refresh,!0),document.addEventListener("click",refresh,!0),document.body.dataset.themeNativeFreeShippingBound="true",refresh()},initPdpCartState=()=>{const buttons=Array.from(document.querySelectorAll("[data-theme-pdp-atc]"));if(!buttons.length)return;const cartState=window.__themePdpCartState||{lineItemsByVariantId:new Map,refreshPromise:null};window.__themePdpCartState=cartState;const setButtonState=(button,variantId)=>{if(!button)return;const labelNode=button.querySelector("[data-theme-pdp-atc-label]")||button.querySelector(".theme-main-product__atc-label");if(!labelNode)return;const defaultLabel=button.dataset.themeDefaultLabel||"Add to cart",inCartLabel=button.dataset.themeInCartLabel||"Already in cart",soldOutLabel=button.dataset.themeSoldOutLabel||"Sold out",isSoldOut=button.dataset.themeSoldOut==="true",isInCart=variantId&&cartState.lineItemsByVariantId.has(String(variantId));if(isSoldOut){labelNode.textContent=soldOutLabel,button.dataset.themeInCart="false",button.disabled=!0,button.setAttribute("aria-disabled","true");return}labelNode.textContent=isInCart?inCartLabel:defaultLabel,button.dataset.themeInCart=isInCart?"true":"false",button.disabled=isInCart,button.setAttribute("aria-disabled",isInCart?"true":"false")},syncAllButtons=()=>{buttons.forEach(button=>{const selectedVariantId=button.closest("product-form")?.querySelector('select[name="id"], input[name="id"]')?.value||button.dataset.themeSelectedVariantId;setButtonState(button,selectedVariantId)})},fetchCartState=async()=>(cartState.refreshPromise||(cartState.refreshPromise=fetch(`${window.routes.cart_url}.js`,{credentials:"same-origin",headers:{Accept:"application/json"}}).then(response=>response.ok?response.json():null).then(cart=>{cartState.lineItemsByVariantId.clear(),cart&&Array.isArray(cart.items)&&cart.items.forEach(item=>{!item||item.variant_id==null||cartState.lineItemsByVariantId.set(String(item.variant_id),item.quantity||0)}),syncAllButtons()}).catch(()=>{}).finally(()=>{cartState.refreshPromise=null})),cartState.refreshPromise);buttons.forEach(button=>{if(button.dataset.themeCartStateBound==="true")return;const variantSelect=button.closest("product-form")?.querySelector('select[name="id"], input[name="id"]');variantSelect&&variantSelect.addEventListener("change",event=>{button.dataset.themeSelectedVariantId=event.currentTarget.value,syncAllButtons()}),button.dataset.themeCartStateBound="true"}),document.body.dataset.themePdpCartStateBound!=="true"?(document.addEventListener("theme:cart:add",()=>{fetchCartState()}),document.body.dataset.themePdpCartStateBound="true",fetchCartState()):syncAllButtons()},initHorizontalRails=(scope=document)=>{const rails=[];scope instanceof Element&&scope.matches("[data-theme-horizontal-rail]")&&rails.push(scope),rails.push(...scope.querySelectorAll("[data-theme-horizontal-rail]")),rails.length&&rails.forEac
33h(root=>{if(root.dataset.themeHorizontalRailBound==="true")return;const track=root.querySelector("[data-theme-horizontal-rail-track]"),prevButton=root.querySelector("[data-theme-horizontal-rail-prev]"),nextButton=root.querySelector("[data-theme-horizontal-rail-next]"),progress=root.querySelector("[data-theme-horizontal-rail-progress]");if(!track||!prevButton||!nextButton||!progress)return;const getScrollAmount=()=>{const firstCard=track.firstElementChild,styles=window.getComputedStyle(track),gap=parseFloat(styles.columnGap||styles.gap||"0")||0,cardWidth=firstCard?firstCard.getBoundingClientRect().width:0,viewportRatio=window.innerWidth>=960?.78:.9;return Math.max(cardWidth+gap,track.clientWidth*viewportRatio,220)},updateRailState=()=>{const maxScrollLeft=Math.max(0,track.scrollWidth-track.clientWidth),overflow=maxScrollLeft>8,scrollLeft=Math.max(0,Math.min(track.scrollLeft,maxScrollLeft)),progressRatio=overflow?Math.min(1,scrollLeft/maxScrollLeft):0,thumbScale=overflow?Math.max(.18,Math.min(.48,track.clientWidth/Math.max(track.scrollWidth,1))):1,travel=1-thumbScale;root.dataset.themeHorizontalRailOverflow=overflow?"true":"false",root.dataset.themeCanScrollLeft=overflow&&scrollLeft>6?"true":"false",root.dataset.themeCanScrollRight=overflow&&scrollLeft<maxScrollLeft-6?"true":"false",progress.style.transform=`translateX(${travel*progressRatio*100}%) scaleX(${thumbScale})`},scrollRailTo=targetScrollLeft=>{const maxScrollLeft=Math.max(0,track.scrollWidth-track.clientWidth),scrollLeft=Math.max(0,Math.min(track.scrollLeft,maxScrollLeft)),nextScrollLeft=Math.max(0,Math.min(maxScrollLeft,targetScrollLeft));return nextScrollLeft===scrollLeft?!1:(track.scrollBy({left:nextScrollLeft-scrollLeft,behavior:"smooth"}),!0)},scrollRail=direction=>scrollRailTo(track.scrollLeft+getScrollAmount()*direction),handleTrackKeydown=event=>{if(event.target!==track)return;let didScroll=!1;event.key==="ArrowLeft"?didScroll=scrollRail(-1):event.key==="ArrowRight"?didScroll=scrollRail(1):event.key==="Home"?didScroll=scrollRailTo(0):event.key==="End"&&(didScroll=scrollRailTo(track.scrollWidth-track.clientWidth)),didScroll&&event.preventDefault()};if(prevButton.addEventListener("click",()=>scrollRail(-1)),nextButton.addEventListener("click",()=>scrollRail(1)),track.addEventListener("keydown",handleTrackKeydown),track.addEventListener("scroll",updateRailState,{passive:!0}),window.addEventListener("resize",updateRailState,{passive:!0}),"ResizeObserver"in window){const observer=new ResizeObserver(()=>updateRailState());observer.observe(track),root.themeHorizontalRailObserver=observer}root.dataset.themeHorizontalRailBound="true",updateRailState()})},initPdpRecommendations=(scope=document)=>{const recommendationSections=[];scope instanceof Element&&scope.matches(".theme-main-product__recommendations[data-theme-recommendation-product-id]")&&recommendationSections.push(scope),recommendationSections.push(...scope.querySelectorAll(".theme-main-product__recommendations[data-theme-recommendation-product-id]"));const complementaryTemplates=scope.querySelectorAll("template[data-theme-complementary-recommendations-template]");if(!recommendationSections.length&&!complementaryTemplates.length)return;const recommendationRoot=window.Shopify?.routes?.root||"/",fetchRecommendationFragment=({productId,limit,intent,recommendationSectionId})=>fetch(`${recommendationRoot}recommendations/products?section_id=${encodeURIComponent(recommendationSectionId)}&product_id=${encodeURIComponent(productId)}&limit=${encodeURIComponent(limit)}&intent=${encodeURIComponent(intent)}`,{credentials:"same-origin",headers:{Accept:"text/html"}}).then(response=>response.ok?response.text():"").then(markup=>{if(!markup)return null;const fragment=new DOMParser().parseFromString(markup,"text/html").querySelector("[data-theme-recommendation-fragment]"),itemCount=Number.parseInt(fragment?.dataset?.themeEventItemsCount||"",10)||0;return!fragment||fragment.dataset.themeRecommendationIntent!==intent||itemCount<1||!fragment.children.length?null:fragment}),syncRecommendationAnalytics=(section,fragment)=>{const track=section.querySelector("[data-theme-horizontal-rail-track]"),railCta=section.querySelector(".theme-home-discovery-grid__rail-cta"),listId=section.dataset.themeEventListId||fragment.dataset.themeRecommendationListId||"",listName=section.dataset.themeEventListName||fragment.dataset.themeRecommendationListName||"",rawItems=String(fragment.dataset.themeEventItemsJson||"[]");let parsedItems=[];try{parsedItems=JSON.parse(rawItems)}catch{parsedItems=[]}const normalizedItems=Array.isArray(parsedItems)?parsedItems.map((item,index)=>({...item,item_category:listName,item_list_id:listId,item_list_name:listName,index:index+1})):[];section.dataset.themeModule=listId,section.dataset.themeEventListId=listId,section.dataset.themeEventListName=listName,section.dataset.themeEventItemsCount=String(Number.parseInt(fragment.dataset.themeEventItemsCount||"",10)||normalizedItems.length),section.dataset.themeEventItemsJson=JSON.stringify(normalizedItems),track.querySelectorAll("[data-theme-product-card]").forEach((card,index)=>{const position=String(index+1),syncAnalyticsTarget=target=>{target.dataset.themeEventItemCategory=listName,target.dataset.themeEventListId=listId,target.dataset.themeEventListName=listName,target.dataset.themeEventPositionIndex=
33position};syncAnalyticsTarget(card),card.querySelectorAll("[data-theme-product-link]").forEach(syncAnalyticsTarget)}),railCta&&(railCta.dataset.themeEventListId=listId,railCta.dataset.themeEventListName=listName,railCta.dataset.themeEventCtaTarget=railCta.getAttribute("href")||"")},applyRecommendationFragment=(section,fragment)=>{const track=section.querySelector("[data-theme-horizontal-rail-track]");return track?(track.innerHTML=fragment.innerHTML,syncRecommendationAnalytics(section,fragment),initWishlistButtons(track),track.scrollLeft=0,track.dispatchEvent(new Event("scroll")),window.dispatchEvent(new Event("resize")),!0):!1},dispatchImpression=(section,source)=>{section.dataset.themeEventLoadDispatched="true",window.__themeDispatchFromElement?.(section,source)};complementaryTemplates.forEach(template=>{if(template.dataset.themeRecommendationBound==="true")return;template.dataset.themeRecommendationBound="true";const productId=template.dataset.themeRecommendationProductId,limit=Math.max(1,Number.parseInt(template.dataset.themeRecommendationLimit||"6",10)||6),recommendationSectionId=template.dataset.themeRecommendationSectionId||"theme-pdp-related-recommendations";!productId||!recommendationSectionId||fetchRecommendationFragment({productId,limit,intent:"complementary",recommendationSectionId}).then(fragment=>{if(!fragment)return;const section=template.content.firstElementChild?.cloneNode(!0);!(section instanceof Element)||!applyRecommendationFragment(section,fragment)||(section.dataset.themeRecommendationBound="true",template.replaceWith(section),initHorizontalRails(section),dispatchImpression(section,"complementary_recommendations"))}).catch(()=>{})}),recommendationSections.forEach(section=>{if(section.dataset.themeRecommendationIntent!=="related"||section.dataset.themeRecommendationBound==="true")return;section.dataset.themeRecommendationBound="true";const productId=section.dataset.themeRecommendationProductId,limit=Math.max(1,Number.parseInt(section.dataset.themeRecommendationLimit||"6",10)||6),recommendationSectionId=section.dataset.themeRecommendationSectionId||"theme-pdp-related-recommendations";let impressionDispatched=!1;if(!productId||!recommendationSectionId)return;const dispatchCurrentImpression=source=>{impressionDispatched||(impressionDispatched=!0,dispatchImpression(section,source||"load"))};fetchRecommendationFragment({productId,limit,intent:"related",recommendationSectionId}).then(fragment=>{if(!fragment||!applyRecommendationFragment(section,fragment)){dispatchCurrentImpression("related_fallback");return}dispatchCurrentImpression("related_recommendations")}).catch(()=>{dispatchCurrentImpression("related_fallback_error")})})},THEME_COLLECTION_STATE_VERSION=2,THEME_COLLECTION_STATE_STORAGE_PREFIX="theme_collection_state_v2:",THEME_COLLECTION_CONTINUATION_PHASES=new Set(["pending","restoring","settled"]),THEME_COLLECTION_SCROLL_MODES=new Set(["auto","manual"]),THEME_COLLECTION_SOURCE_PAGE_ATTRIBUTE="data-theme-collection-source-page-url",THEME_COLLECTION_ENHANCED_ATTRIBUTE="data-theme-collection-enhanced",THEME_COLLECTION_FOCUSABLE_SELECTOR='a[href], area[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',getCollectionQueryKey=(rawUrl=window.location.href)=>{try{const url=new URL(rawUrl,window.location.origin),entries=[],isSearchRoute=/\/search\/?$/.test(url.pathname);url.searchParams.forEach((value,key)=>{key!=="sort_by"&&!key.startsWith("filter.")&&!(isSearchRoute&&["q","type","options[prefix]","options[unavailable]"].includes(key))||value&&entries.push([key,value])}),entries.sort((left,right)=>left[0]<right[0]?-1:left[0]>right[0]?1:left[1]<right[1]?-1:left[1]>right[1]?1:0);const sortedParams=new URLSearchParams;return entries.forEach(([key,value])=>sortedParams.append(key,value)),`${url.pathname||"/"}?${sortedParams.toString()}`}catch{return""}},normalizeCollectionPageUrl=rawUrl=>{if(!rawUrl)return"";try{const url=new URL(rawUrl,window.location.origin);return url.origin!==window.location.origin?"":(url.searchParams.delete("section_id"),url.hash="",`${url.pathname||"/"}${url.search}`)}catch{return""}},normalizeSameOriginUrl=rawUrl=>{if(!rawUrl)return"";try{const url=new URL(rawUrl,window.location.origin);return url.origin!==window.location.origin?"":`${url.pathname||"/"}${url.search}${url.hash}`}catch{return""}},normalizeCollectionContinuation=(continuation,expectedQueryKey)=>{if(!continuation||typeof continuation!="object")return null;const id=typeof continuation.id=="string"?continuation.id.trim():"",phase=typeof continuation.phase=="string"?continuation.phase:"",sourceUrl=normalizeCollectionPageUrl(continuation.sourceUrl),targetHref=normalizeSameOriginUrl(continuation.targetHref),previousMode=typeof continuation.previousMode=="string"?continuation.previousMode:"";return!id||!THEME_COLLECTION_CONTINUATION_PHASES.has(phase)||!sourceUrl||!targetHref||!THEME_COLLECTION_SCROLL_MODES.has(previousMode)||getCollectionQueryKey(sourceUrl)!==expectedQueryKey?null:{
33id,phase,sourceUrl,targetHref,previousMode}},normalizeCollectionState=(state,expectedQueryKey)=>{if(!state||state.version!==THEME_COLLECTION_STATE_VERSION)return null;const queryKey=state.queryKey||state.key;if(!queryKey||queryKey!==expectedQueryKey||!Array.isArray(state.loadedPageUrls))return null;const loadedPageUrls=[];if(state.loadedPageUrls.forEach(rawUrl=>{const pageUrl=normalizeCollectionPageUrl(rawUrl);!pageUrl||getCollectionQueryKey(pageUrl)!==expectedQueryKey||loadedPageUrls.includes(pageUrl)||loadedPageUrls.push(pageUrl)}),loadedPageUrls.length!==state.loadedPageUrls.length)return null;const nextUrl=state.nextUrl?normalizeCollectionPageUrl(state.nextUrl):"";if(state.nextUrl&&(!nextUrl||getCollectionQueryKey(nextUrl)!==expectedQueryKey))return null;const scrollY=Number(state.scrollY);if(!Number.isFinite(scrollY)||scrollY<0)return null;const selectedProductId=state.selectedProductId?String(state.selectedProductId):"",selectedProductHref=state.selectedProductHref?normalizeSameOriginUrl(state.selectedProductHref):"";if(state.selectedProductHref&&!selectedProductHref)return null;const continuation=state.continuation?normalizeCollectionContinuation(state.continuation,expectedQueryKey):null;return state.continuation&&!continuation?null:{version:THEME_COLLECTION_STATE_VERSION,queryKey,loadedPageUrls,nextUrl,selectedProductId,selectedProductHref,scrollY,focusFromProductLink:state.focusFromProductLink===!0,...continuation?{continuation}:{}}},getCollectionStorage=()=>{try{return window.sessionStorage}catch{return null}},getCollectionStorageKey=queryKey=>`${THEME_COLLECTION_STATE_STORAGE_PREFIX}${encodeURIComponent(queryKey)}`,readCollectionSessionState=queryKey=>{const storage=getCollectionStorage();if(!storage||!queryKey)return null;try{const raw=storage.getItem(getCollectionStorageKey(queryKey));return raw?normalizeCollectionState(JSON.parse(raw),queryKey):null}catch{return null}},writeCollectionSessionState=state=>{const storage=getCollectionStorage();if(!(!storage||!state?.queryKey))try{storage.setItem(getCollectionStorageKey(state.queryKey),JSON.stringify(state))}catch{}},clearCollectionSessionState=queryKey=>{const storage=getCollectionStorage();if(!(!storage||!queryKey))try{storage.removeItem(getCollectionStorageKey(queryKey))}catch{}},readCollectionHistoryState=queryKey=>{try{const state=window.history?.state,candidate=state?.themeCollectionState||state?.themeCollection||null;return normalizeCollectionState(candidate,queryKey)}catch{return null}},writeCollectionHistoryState=state=>{try{const history2=window.history;if(!history2||typeof history2.replaceState!="function"||!state?.queryKey)return!1;const existingState=history2.state&&typeof history2.state=="object"?history2.state:{},nextHistoryState={...existingState,themeCollectionState:state},currentHref=getCollectionLocationHref?.()||window.location.href;try{history2.replaceState(nextHistoryState,document.title,currentHref)}catch{try{history2.replaceState(existingState,document.title,currentHref)}catch{}return!1}const writtenState=history2.state?.themeCollectionState;if(!writtenState||writtenState.version!==state.version||writtenState.queryKey!==state.queryKey||(state.continuation?writtenState.continuation?.id!==state.continuation.id:writtenState.continuation)){try{history2.replaceState(existingState,document.title,currentHref)}catch{}return!1}return!0}catch{return!1}},getCollectionHistoryCandidate=()=>{try{const state=window.history?.state;return{present:!!(state&&typeof state=="object"&&(Object.prototype.hasOwnProperty.call(state,"themeCollectionState")||Object.prototype.hasOwnProperty.call(state,"themeCollection"))),value:state?.themeCollectionState||state?.themeCollection||null}}catch{return{present:!1,value:null}}},trySetCollectionScrollRestoration=mode=>{if(!THEME_COLLECTION_SCROLL_MODES.has(mode))return{ok:!1,previousMode:""};let history2,previousMode;try{if(history2=window.history,!history2)return{ok:!1,previousMode:""};previousMode=history2.scrollRestoration}catch{return{ok:!1,previousMode:""}}if(!THEME_COLLECTION_SCROLL_MODES.has(previousMode))return{ok:!1,previousMode:""};try{if(history2.scrollRestoration=mode,history2.scrollRestoration!==mode)return{ok:!1,previousMode}}catch{return{ok:!1,previousMode}}return{ok:!0,previousMode}},focusWithoutScroll=element=>{if(!(!element||typeof element.focus!="function"))try{element.focus({preventScroll:!0})}catch{element.focus()}}
33,THEME_COLLECTION_TITLE_ROW_SELECTOR=".theme-main-collection__title-row",THEME_COLLECTION_TITLE_ROW_INLINE_CLASS="theme-main-collection__title-row--inline",collectionTitleRowBindings=new WeakMap,getCollectionElementInlineSize=element=>{if(!element)return 0;const rect=element.getBoundingClientRect?.();if(rect&&Number.isFinite(rect.width))return rect.width;const offsetWidth=Number(element.offsetWidth);if(Number.isFinite(offsetWidth))return offsetWidth;const scrollWidth=Number(element.scrollWidth);return Number.isFinite(scrollWidth)?scrollWidth:0},getCollectionTitleRowChild=(row,selector)=>Array.from(row?.children||[]).find(child=>child?.matches?.(selector))||null,createCollectionTitleMeasurement=title=>{if(!title||typeof title.cloneNode!="function")return null;const measurement=title.cloneNode(!0);measurement.setAttribute?.("aria-hidden","true"),measurement.setAttribute?.("inert",""),"inert"in measurement&&(measurement.inert=!0),measurement.removeAttribute?.("id");const style=measurement.style;return style&&(style.position="absolute",style.visibility="hidden",style.pointerEvents="none",style.flex="0 0 auto",style.inlineSize="max-content",style.width="max-content",style.maxInlineSize="none",style.maxWidth="none",style.minInlineSize="max-content",style.minWidth="max-content",style.whiteSpace="nowrap",style.overflow="visible",style.margin="0",style.insetInlineStart="0",style.insetBlockStart="0"),measurement},measureCollectionTitleNaturalWidth=(row,title)=>{const measurement=createCollectionTitleMeasurement(title);if(!measurement)return 0;const append=typeof row.appendChild=="function"?child=>row.appendChild(child):typeof row.append=="function"?child=>row.append(child):null;if(!append)return 0;append(measurement);try{return getCollectionElementInlineSize(measurement)}finally{typeof measurement.remove=="function"?measurement.remove():typeof row.removeChild=="function"&&row.removeChild(measurement)}},getCollectionTitleRowColumnGap=row=>{const computed=typeof window.getComputedStyle=="function"?window.getComputedStyle(row):null,rawGap=computed?.columnGap||computed?.gap||row?.style?.columnGap||row?.style?.gap,gap=parseFloat(rawGap);return Number.isFinite(gap)&&gap>=0?gap:0},setCollectionTitleRowInline=(row,inline)=>{if(typeof row.classList?.toggle=="function"){row.classList.toggle(THEME_COLLECTION_TITLE_ROW_INLINE_CLASS,inline);return}inline?row.classList?.add(THEME_COLLECTION_TITLE_ROW_INLINE_CLASS):row.classList?.remove(THEME_COLLECTION_TITLE_ROW_INLINE_CLASS)},initCollectionTitleFit=(scope=document)=>{const rows=[],addRow=row=>{row&&!rows.includes(row)&&rows.push(row)};scope instanceof Element&&scope.matches(THEME_COLLECTION_TITLE_ROW_SELECTOR)&&addRow(scope),scope.querySelectorAll(THEME_COLLECTION_TITLE_ROW_SELECTOR).forEach(addRow),rows.forEach(row=>{const title=getCollectionTitleRowChild(row,"h1"),count=getCollectionTitleRowChild(row,".theme-main-collection__count"),existingBinding=collectionTitleRowBindings.get(row);if(!title||!count){existingBinding?.dispose();return}if(existingBinding&&existingBinding.title===title&&existingBinding.count===count){existingBinding.measure();return}existingBinding?.dispose();const binding={title,count,disposed:!1,resizeObserver:null,resizeHandler:null,measure:null,dispose:null};binding.measure=()=>{if(binding.disposed)return;setCollectionTitleRowInline(row,!1);const titleNaturalWidth=measureCollectionTitleNaturalWidth(row,title),rowWidth=getCollectionElementInlineSize(row),countWidth=getCollectionElementInlineSize(count),columnGap=getCollectionTitleRowColumnGap(row),fits=titleNaturalWidth+countWidth+columnGap<=rowWidth+.5;setCollectionTitleRowInline(row,fits)},binding.dispose=()=>{binding.disposed||(binding.disposed=!0,binding.resizeObserver?.disconnect(),binding.resizeHandler&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",binding.resizeHandler),collectionTitleRowBindings.get(row)===binding&&collectionTitleRowBindings.delete(row))},collectionTitleRowBindings.set(row,binding),binding.measure();const ResizeObserverConstructor=typeof window.ResizeObserver=="function"?window.ResizeObserver:typeof ResizeObserver=="function"?ResizeObserver:null;if(ResizeObserverConstructor)try{binding.resizeObserver=new ResizeObserverConstructor(()=>binding.measure()),binding.resizeObserver.observe(row)}catch{binding.resizeObserver=null}!binding.resizeObserver&&typeof window.addEventListener=="function"&&(binding.resizeHandler=()=>binding.measure(),window.addEventListener("resize",binding.resizeHandler));const fontsReady=document.fonts?.ready;fontsReady&&typeof fontsReady.then=="function"&&fontsReady.then(()=>{binding.disposed||binding.measure()},()=>{})})},collectionFilterDisclosureBindings=new WeakMap,getCollectionFilterDisclosures=scope=>{const disclosures=[];return(element=>element?typeof element.matches=="function"&&element.matches("details[data-theme-collection-filter-disclosure]")?!0:element.tagName==="DETAILS"&&element.hasAttribute?.("data-theme-collection-filter-disclosure"):!1)(scope)&&disclosures.push(scope),scope?.querySelectorAll?.("details[data-theme-collection-filter-disclosure]")?.forEach(disclosure=>{disclosures.includes(disclosure)||disclosures.push(disclosure)}),disclosures},abortCollectionFilterDisclosureBindings=scope=>{getCollectionFilterDisclosures(scope||document).forEach(disclosure=>{collectionFilterDisclosureBindings.get(disclosure)?.dispose()})}
33,initCollectionFilterEnhancements=(scope=document)=>{const collectionRoots=[];scope instanceof Element&&scope.matches('[data-theme-collection-infinite-root="true"]')&&collectionRoots.push(scope),collectionRoots.push(...scope.querySelectorAll('[data-theme-collection-infinite-root="true"]'));const filterBars=[],addFilterBar=bar=>{bar&&!filterBars.includes(bar)&&filterBars.push(bar)};scope instanceof Element&&scope.matches(".theme-collection-filter-bar, [data-theme-collection-filter-bar]")&&addFilterBar(scope),scope.querySelectorAll(".theme-collection-filter-bar, [data-theme-collection-filter-bar]").forEach(addFilterBar),scope.querySelectorAll("details[data-theme-collection-filter-disclosure]").forEach(disclosure=>{addFilterBar(disclosure.closest(".theme-collection-filter-bar, [data-theme-collection-filter-bar]")||disclosure)});const isMobile=()=>typeof window.matchMedia=="function"?window.matchMedia("(max-width: 47.999rem)").matches:window.innerWidth<768,getFocusable=container=>Array.from(container?.querySelectorAll(THEME_COLLECTION_FOCUSABLE_SELECTOR)||[]).filter(element=>!element.hidden&&element.getAttribute("aria-hidden")!=="true"&&!element.disabled);
33filterBars.forEach(filterBar=>{const details=[];filterBar.matches("details")&&details.push(filterBar);const scopedDisclosures=Array.from(filterBar.querySelectorAll("details[data-theme-collection-filter-disclosure]"));if(scopedDisclosures.length)details.push(...scopedDisclosures);else{const fallbackDisclosure=filterBar.querySelectorAll("details")[0];fallbackDisclosure&&!details.includes(fallbackDisclosure)&&details.push(fallbackDisclosure)}details.forEach(disclosure=>{if(collectionFilterDisclosureBindings.has(disclosure))return;disclosure.dataset.themeCollectionFilterBound==="true"&&disclosure.removeAttribute?.("data-theme-collection-filter-bound");const summary=disclosure.querySelector(":scope > summary")||disclosure.querySelector("summary"),panel=disclosure.querySelector("[data-theme-collection-filter-panel]")||disclosure.querySelector(".theme-collection-filter-bar__panel");if(!summary||!panel)return;const closeButton=panel.querySelector("[data-theme-collection-filter-close]"),heading=panel.querySelector("[data-theme-collection-filter-heading], h2, h3"),searchFilterForm=panel.querySelector("form[data-theme-search-filter-form]"),searchFilterApplyButton=searchFilterForm?.querySelector('button[type="submit"]');!summary.hasAttribute("aria-controls")&&panel.id&&summary.setAttribute("aria-controls",panel.id),heading&&!heading.id&&panel.id&&(heading.id=`${panel.id}-heading`),heading&&heading.id&&!panel.hasAttribute("aria-labelledby")&&panel.setAttribute("aria-labelledby",heading.id);const originalRole=panel.getAttribute("role")||"region",originalAriaModal=panel.getAttribute("aria-modal");let shouldRestoreFocus=!1,desktopPanelPositionFramePending=!1,suppressedOutsidePointerActivation=null,suppressedOutsidePointerActivationTimer=null;const controller=typeof AbortController=="function"?new AbortController:typeof window.AbortController=="function"?new window.AbortController:null,binding={controller,disposed:!1,listeners:[],dispose:null};collectionFilterDisclosureBindings.set(disclosure,binding);const listen=(target,type,handler,listenerOptions)=>{if(!target||typeof target.addEventListener!="function")return;const options={...listenerOptions||{},...controller?.signal?{signal:controller.signal}:{}};let appliedOptions=Object.keys(options).length>0?options:void 0;try{target.addEventListener(type,handler,appliedOptions)}catch{appliedOptions=listenerOptions,target.addEventListener(type,handler,appliedOptions)}binding.listeners.push({target,type,handler,options:appliedOptions})},clearOutsidePointerActivationSuppression=()=>{suppressedOutsidePointerActivation=null,suppressedOutsidePointerActivationTimer!==null&&(window.clearTimeout?.(suppressedOutsidePointerActivationTimer),suppressedOutsidePointerActivationTimer=null)},suppressOutsidePointerActivation=(event,eventPath)=>{clearOutsidePointerActivationSuppression(),suppressedOutsidePointerActivation={target:event.target,path:eventPath.slice()},typeof window.setTimeout=="function"&&(suppressedOutsidePointerActivationTimer=window.setTimeout(()=>{suppressedOutsidePointerActivation=null,suppressedOutsidePointerActivationTimer=null},500))},setPanelStyle=(property,value)=>{typeof panel.style?.setProperty=="function"?panel.style.setProperty(property,value):panel.style&&(panel.style[property]=value)},removePanelStyle=property=>{typeof panel.style?.removeProperty=="function"?panel.style.removeProperty(property):panel.style&&(panel.style[property]="")},clearDesktopPanelPosition=()=>{desktopPanelPositionFramePending=!1,panel.dataset&&delete panel.dataset.themeCollectionFilterPanelPlacement,panel.removeAttribute?.("data-theme-collection-filter-panel-placement"),removePanelStyle("--theme-collection-filter-panel-inline-start"),removePanelStyle("--theme-collection-filter-panel-max-block-size"),removePanelStyle("--theme-collection-filter-panel-block-offset"),removePanelStyle("width")};binding.dispose=()=>{binding.disposed||(binding.disposed=!0,clearOutsidePointerActivationSuppression(),controller?.abort(),binding.listeners.forEach(({target,type,handler,options})=>{try{target.removeEventListener?.(type,handler,options)}catch{target.removeEventListener?.(type,handler)}}),binding.listeners=[],clearDesktopPanelPosition(),disclosure.dataset.themeCollectionFilterModal="false",document.querySelector('[data-theme-collection-filter-modal="true"]')||document.body?.classList?.remove("theme-collection-filter-modal-open"),disclosure.removeAttribute?.(THEME_COLLECTION_ENHANCED_ATTRIBUTE),disclosure.removeAttribute?.("data-theme-collection-filter-bound"),collectionFilterDisclosureBindings.get(disclosure)===binding&&collectionFilterDisclosureBindings.delete(
33disclosure))};const positionDesktopPanel=()=>{if(binding.disposed||!disclosure.open||isMobile()){clearDesktopPanelPosition();return}const triggerRect=summary.getBoundingClientRect?.(),visualViewport=window.visualViewport,viewportHeight=Number.isFinite(visualViewport?.height)?visualViewport.height:window.innerHeight,viewportWidth=Number.isFinite(visualViewport?.width)?visualViewport.width:window.innerWidth;if(!triggerRect||!Number.isFinite(triggerRect.top)||!Number.isFinite(triggerRect.bottom)||!Number.isFinite(triggerRect.left)||!Number.isFinite(viewportHeight)||!Number.isFinite(viewportWidth))return;const panelScrollHeight=Number.isFinite(panel.scrollHeight)?panel.scrollHeight:448,natural=Math.min(panelScrollHeight,448),below=Math.max(0,viewportHeight-16-triggerRect.bottom-8),above=Math.max(0,triggerRect.top-8-16),placeBelow=below>=natural||below>=above,available=placeBelow?below:above,width=Math.min(448,Math.max(0,viewportWidth-32)),left=Math.min(Math.max(16,triggerRect.left),Math.max(16,viewportWidth-16-width)),blockOffset=placeBelow?triggerRect.bottom+8:viewportHeight-triggerRect.top+8,placement=placeBelow?"below":"above";panel.dataset&&(panel.dataset.themeCollectionFilterPanelPlacement=placement),panel.setAttribute?.("data-theme-collection-filter-panel-placement",placement),setPanelStyle("--theme-collection-filter-panel-inline-start",`${left}px`),setPanelStyle("--theme-collection-filter-panel-max-block-size",`${available}px`),setPanelStyle("--theme-collection-filter-panel-block-offset",`${blockOffset}px`),setPanelStyle("width",`${width}px`)},scheduleDesktopPanelPosition=()=>{if(!disclosure.open||isMobile()){clearDesktopPanelPosition();return}if(desktopPanelPositionFramePending)return;desktopPanelPositionFramePending=!0;const update=()=>
33{desktopPanelPositionFramePending=!1,binding.disposed||positionDesktopPanel()};typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(update):typeof window.setTimeout=="function"?window.setTimeout(update,0):update()},setSummaryState=()=>{summary.setAttribute("aria-expanded",disclosure.open?"true":"false")},containsNode=(ancestor,node)=>{if(!ancestor||!node)return!1;if(typeof ancestor.contains=="function"&&ancestor.contains(node))return!0;for(let current=node;current;current=current.parentNode)if(current===ancestor)return!0;return!1},getEventPath=event=>{if(typeof event?.composedPath=="function"){const path=event.composedPath();if(Array.isArray(path))return path}return event?.target?[event.target]:[]},pathsMatch=(firstPath,secondPath)=>!Array.isArray(firstPath)||!Array.isArray(secondPath)||firstPath.length!==secondPath.length?!1:firstPath.every((entry,index)=>entry===secondPath[index]),restoreSummaryFocusIfSafe=()=>{if(!isMobile()){focusWithoutScroll(summary);return}const activeElement=document.activeElement,focusIsInside=activeElement===summary||activeElement===heading||activeElement===closeButton||containsNode(disclosure,activeElement)||containsNode(panel,activeElement);(activeElement===document.body||focusIsInside)&&focusWithoutScroll(summary)},closeDisclosure=({restoreFocus=!0}={})=>{shouldRestoreFocus=restoreFocus,disclosure.open=!1},unlockBody=()=>{disclosure.dataset.themeCollectionFilterModal="false",document.querySelector('[data-theme-collection-filter-modal="true"]')||document.body.classList.remove("theme-collection-filter-modal-open")},setDesktopPanelState=()=>{(!disclosure.open||isMobile())&&clearDesktopPanelPosition(),panel.setAttribute("role",originalRole),originalAriaModal===null?panel.removeAttribute("aria-modal"):panel.setAttribute("aria-modal",originalAriaModal),unlockBody()},focusPanelEntry=()=>{if(binding.disposed||!disclosure.open||!isMobile())return;const target=heading||closeButton||getFocusable(panel)[0];heading&&!heading.hasAttribute("tabindex")&&heading.setAttribute("tabindex","-1"),focusWithoutScroll(target)},setMobilePanelState=(focusEntry=!1)=>{clearDesktopPanelPosition(),panel.setAttribute("role","dialog"),panel.setAttribute("aria-modal","true"),disclosure.dataset.themeCollectionFilterModal="true",document.body.classList.add("theme-collection-filter-modal-open"),focusEntry&&(typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(focusPanelEntry):window.setTimeout(focusPanelEntry,0))},syncDisclosureMode=()=>{if(setSummaryState(),!disclosure.open){setDesktopPanelState(),shouldRestoreFocus&&(shouldRestoreFocus=!1,restoreSummaryFocusIfSafe());return}isMobile()?setMobilePanelState(!1):(setDesktopPanelState(),scheduleDesktopPanelPosition())};listen(disclosure,"toggle",()=>{if(!binding.disposed){if(setSummaryState(),disclosure.open&&isMobile()){setMobilePanelState(!0);return}disclosure.open?(setDesktopPanelState(),scheduleDesktopPanelPosition()):(setDesktopPanelState(),shouldRestoreFocus&&(shouldRestoreFocus=!1,restoreSummaryFocusIfSafe()))}}),listen(disclosure,"keydown",event=>{!disclosure.open||event.key!=="Escape"||(event.preventDefault(),closeDisclosure({restoreFocus:!0}))}),listen(panel,"keydown",event=>{if(!disclosure.open||!isMobile()||event.key!=="Tab")return;const focusable=getFocusable(panel);if(event.shiftKey&&heading&&document.activeElement===heading){event.preventDefault(),focusWithoutScroll(focusable[focusable.length-1]||closeButton||summary);return}if(!focusable.length){event.preventDefault(),focusWithoutScroll(closeButton||summary);return}const first=focusable[0],last=focusable[focusable.length-1];event.shiftKey&&document.activeElement===first?(event.preventDefault(),focusWithoutScroll(last)):!event.shiftKey&&document.activeElement===last&&(event.preventDefault(),focusWithoutScroll(first))}),listen(closeButton,"click",event=>{event.preventDefault(),closeDisclosure({restoreFocus:!0})});const submitSearchFilters=event=>{const controls=Array.from(searchFilterForm.elements||[]),parameters=[];controls.forEach(control=>{if(!control?.name||control.disabled||(control.type==="checkbox"||control.type==="radio")&&!control.checked)return;(control.tagName==="SELECT"&&control.multiple?Array.from(control.selectedOptions||[]).map(option=>
33option.value):[control.value]).forEach(value=>{const normalizedValue=String(value??"").trim();normalizedValue!==""&¶meters.push(`${encodeURIComponent(control.name)}=${encodeURIComponent(normalizedValue)}`)})}),event.preventDefault();const destination=String(searchFilterForm.action||window.location.pathname||"/search").split("?")[0];window.location.href=parameters.length?`${destination}?${parameters.join("&")}`:destination};listen(searchFilterForm,"submit",submitSearchFilters,{capture:!0}),listen(searchFilterApplyButton,"click",submitSearchFilters,{capture:!0}),listen(document,"pointerdown",event=>{if(!disclosure.open)return;const eventPath=getEventPath(event);eventPath?.includes?.(disclosure)||containsNode(disclosure,event.target)||(suppressOutsidePointerActivation(event,eventPath),event.preventDefault?.(),event.stopPropagation?.(),closeDisclosure({restoreFocus:!0}))},{capture:!0}),listen(document,"click",event=>{if(!suppressedOutsidePointerActivation)return;const eventPath=getEventPath(event),sameTarget=event.target===suppressedOutsidePointerActivation.target,samePath=pathsMatch(eventPath,suppressedOutsidePointerActivation.path);!sameTarget||!samePath||(event.preventDefault?.(),event.stopPropagation?.(),clearOutsidePointerActivationSuppression())},{capture:!0}),listen(document,"pointercancel",clearOutsidePointerActivationSuppression,{capture:!0});const handleViewportChange=()=>{if(!disclosure.open){clearDesktopPanelPosition(),setDesktopPanelState();return}isMobile()?setMobilePanelState(!1):(setDesktopPanelState(),scheduleDesktopPanelPosition())};listen(window,"resize",handleViewportChange),listen(window,"scroll",handleViewportChange),typeof window.visualViewport?.addEventListener=="function"&&(listen(window.visualViewport,"resize",handleViewportChange),listen(window.visualViewport,"scroll",handleViewportChange)),disclosure.setAttribute(THEME_COLLECTION_ENHANCED_ATTRIBUTE,"true"),disclosure.dataset.themeCollectionFilterBound="true",syncDisclosureMode()}),filterBar.querySelectorAll("form.theme-collection-filter-bar__sort, form[data-theme-collection-sort-form]").forEach(sortForm=>{if(sortForm.dataset.themeCollectionSortBound==="true")return;const sortSelect=sortForm.querySelector('[data-theme-collection-sort], select[name="sort_by"]');if(!sortSelect)return;const submitFallback=sortForm.querySelector('[data-theme-collection-sort-submit], button[type="submit"], input[type="submit"]');sortForm.setAttribute(THEME_COLLECTION_ENHANCED_ATTRIBUTE,"true"),sortSelect.setAttribute(THEME_COLLECTION_ENHANCED_ATTRIBUTE,"true"),submitFallback&&(submitFallback.hidden=!0,submitFallback.setAttribute("aria-hidden","true")),sortSelect.addEventListener("change",()=>{sortSelect.dataset.themeEventSortOption=sortSelect.value,typeof sortForm.requestSubmit=="function"?sortForm.requestSubmit():typeof sortForm.submit=="function"&&sortForm.submit()}),sortForm.dataset.themeCollectionSortBound="true"})}),collectionRoots.forEach(root=>{root.setAttribute(THEME_COLLECTION_ENHANCED_ATTRIBUTE,"true")})},collectionRootStates=new WeakMap,collectionScrollLifecycle={listenersBound:!1,rootState:null,owner:null,restorationPromise:null,restorationRunId:"",pageshowSeen:!1};let collectionContinuationSequence=0;const getCollectionLocationHref=()=>{try{return window.location?.href||""}catch{return""}},getCollectionCurrentPageUrl=()=>normalizeCollectionPageUrl(getCollectionLocationHref()),getCollectionCurrentQueryKey=()=>getCollectionQueryKey(getCollectionLocationHref()),readCollectionScrollY=()=>{try{const scrollY=Number(window.scrollY);return Number.isFinite(scrollY)&&scrollY>=0?scrollY:null}catch{return null}},createCollectionContinuationId=()=>{try{const randomUuid=window.crypto?.randomUUID;if(typeof randomUuid=="function"){const id=randomUuid.call(window.crypto);if(id)return String(id)}}catch{}collectionContinuationSequence+=1;let randomPart="";try{randomPart=Math.random().toString(36).slice(2)}catch{randomPart="local"}return`collection-${Date.now()}-${collectionContinuationSequence}-${randomPart}`},hasCollectionRoot=root=>!root||typeof root.matches=="function"&&root.matches('[data-theme-collection-infinite-root="true"]')===!1&&root.getAttribute?.("data-theme-collection-infinite-root")!=="true"?!1:!!(root.querySelector?.("[data-theme-collection-infinite-scroll]")&&root.querySelector?.(".theme-main-collection__grid")),getCollectionHistoryStateForQuery=queryKey=>{try{return readCollectionHistoryState(queryKey)}catch{return null}},resolveCollectionContinuation=(queryKey=getCollectionCurrentQueryKey())=>{if(!queryKey)return null;const historyState=getCollectionHistoryStateForQuery(queryKey),continuation=historyState?.continuation;if(!historyState||!continuation||continuation.sourceUrl!==getCollectionCurrentPageUrl())return null;let sessionState=null;const mirroredState=readCollectionSessionState(queryKey);return mirroredState?.continuation?.id===continuation.id&&mirroredState.continuation.sourceUrl===continuation.sourceUrl&&(sessionState=mirroredState),{historyState,continuation,sessionState}},isCollectionOwnerCurrent=(owner=collectionScrollLifecycle.owner,phases=["pending","restoring"])=>
33{if(!owner||!phases.includes(owner.phase)||owner.queryKey!==getCollectionCurrentQueryKey()||owner.sourceUrl!==getCollectionCurrentPageUrl())return!1;const resolved=resolveCollectionContinuation(owner.queryKey);return!(!resolved||resolved.continuation.id!==owner.id||!phases.includes(resolved.continuation.phase)||!trySetCollectionScrollRestoration("manual").ok)},clearCollectionHistoryContinuation=(owner,{force=!1}={})=>{let candidate;try{candidate=getCollectionHistoryCandidate()}catch{return!1}if(!candidate.present)return!0;const queryKey=getCollectionCurrentQueryKey(),state=candidate.value?normalizeCollectionState(candidate.value,queryKey):null;if(!state){if(!force)return!1;try{const history2=window.history,nextState={...history2?.state&&typeof history2.state=="object"?history2.state:{}};return delete nextState.themeCollectionState,delete nextState.themeCollection,typeof history2?.replaceState!="function"?!1:(history2.replaceState(nextState,document.title,getCollectionLocationHref()),!0)}catch{return!1}}if(!state.continuation||owner&&state.continuation.id!==owner.id)return!0;const stateWithoutContinuation={...state};return delete stateWithoutContinuation.continuation,writeCollectionHistoryState(stateWithoutContinuation)},isExactCollectionScrollOwner=owner=>{if(!owner||collectionScrollLifecycle.owner!==owner||owner.queryKey!==getCollectionCurrentQueryKey()||owner.sourceUrl!==getCollectionCurrentPageUrl())return!1;const continuation=resolveCollectionContinuation(owner.queryKey)?.continuation;return!!(continuation&&continuation.id===owner.id&&continuation.phase===owner.phase&&continuation.sourceUrl===owner.sourceUrl&&continuation.targetHref===owner.targetHref&&continuation.previousMode===owner.previousMode)},releaseCollectionScrollOwnership=(owner=collectionScrollLifecycle.owner)=>{owner&&(isExactCollectionScrollOwner(owner)&&trySetCollectionScrollRestoration(owner.previousMode),collectionScrollLifecycle.owner===owner&&(collectionScrollLifecycle.owner=null,collectionScrollLifecycle.restorationRunId=""))},abandonCollectionContinuation=(reason="abandoned",{clearHistory=!0}={})=>{const owner=collectionScrollLifecycle.owner;owner&&(owner.rootState?.abortActiveLoad&&owner.rootState.abortActiveLoad(),owner.abandonReason=reason,releaseCollectionScrollOwnership(owner),clearHistory&&owner.queryKey===getCollectionCurrentQueryKey()&&owner.sourceUrl===getCollectionCurrentPageUrl()&&clearCollectionHistoryContinuation(owner,{force:!0}),clearCollectionSessionState(owner.queryKey))},ensureCollectionScrollOwnership=(continuation,rootState=null)=>{if(!continuation)return!1;const existingOwner=collectionScrollLifecycle.owner;return existingOwner&&existingOwner.id!==continuation.id&&releaseCollectionScrollOwnership(existingOwner),trySetCollectionScrollRestoration("manual").ok?(collectionScrollLifecycle.owner={...continuation,queryKey:getCollectionCurrentQueryKey(),rootState:rootState||existingOwner?.rootState||null},!0):!1},updateCollectionContinuationPhase=(rootState,phase)=>{const owner=collectionScrollLifecycle.owner;if(!owner||!THEME_COLLECTION_CONTINUATION_PHASES.has(phase))return!1;const resolved=resolveCollectionContinuation(owner.queryKey);if(!resolved||resolved.continuation.id!==owner.id)return!1;const nextContinuation={...resolved.continuation,phase},nextState={...resolved.historyState,continuation:nextContinuation};return writeCollectionHistoryState(nextState)?(writeCollectionSessionState(nextState),owner.phase=phase,owner.rootState=rootState||owner.rootState,!0):!1},armCollectionContinuation=(rootState,link)=>{if(!rootState||!link||!hasCollectionRoot(rootState.root))return!1;const queryKey=rootState.queryKey,sourceUrl=getCollectionCurrentPageUrl(),targetHref=normalizeSameOriginUrl(link.getAttribute?.("href")||link.href||""),scrollY=readCollectionScrollY();if(!queryKey||!sourceUrl||!targetHref||scrollY===null||getCollectionQueryKey(sourceUrl)!==queryKey)return!1;collectionScrollLifecycle.owner&&abandonCollectionContinuation("rearmed");const manualResult=trySetCollectionScrollRestoration("manual");if(!manualResult.ok)return!1;const continuation={id:createCollectionContinuationId(),phase:"pending",sourceUrl,targetHref,previousMode:manualResult.previousMode},selectedProductId=rootState.getProductId(link)||link.closest?.("[data-theme-product-id]")?.dataset?.themeProductId||"",state=rootState.makeCollectionState({selectedProductId,selectedProductHref:targetHref,scrollY,focusFromProductLink:!0,continuation});return writeCollectionHistoryState(state)?(collectionScrollLifecycle.owner={...continuation,queryKey,rootState},writeCollectionSessionState(state),rootState.abortActiveLoad(),!0):(trySetCollectionScrollRestoration(manualResult.previousMode),!1)},isCollectionPrimaryProductActivation=(event,link)=>
33{if(!event||!link||event.defaultPrevented||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button!==void 0&&event.button!==0)return!1;const target=(link.getAttribute?.("target")||link.target||"").trim().toLowerCase();return target&&target!=="_self"||link.hasAttribute?.("download")||link.download?!1:!!normalizeSameOriginUrl(link.getAttribute?.("href")||link.href||"")},findCollectionRootState=()=>{const state=collectionScrollLifecycle.rootState;return state&&hasCollectionRoot(state.root)?state:null},handleCollectionPageShow=(event={})=>{collectionScrollLifecycle.pageshowSeen=!0;const queryKey=getCollectionCurrentQueryKey(),resolved=resolveCollectionContinuation(queryKey),rootState=findCollectionRootState();if(rootState?.queryKey===queryKey&&rootState.syncNativeSort(),!resolved){const owner2=collectionScrollLifecycle.owner;return owner2&&(owner2.queryKey!==queryKey||owner2.sourceUrl!==getCollectionCurrentPageUrl())?abandonCollectionContinuation("pageshow-query-mismatch"):owner2&&abandonCollectionContinuation("pageshow-owner-mismatch"),Promise.resolve(!1)}if(!rootState)return document.readyState!=="loading"&&(clearCollectionHistoryContinuation(null,{force:!0}),clearCollectionSessionState(queryKey),collectionScrollLifecycle.owner&&releaseCollectionScrollOwnership()),Promise.resolve(!1);if(!ensureCollectionScrollOwnership(resolved.continuation,rootState))return clearCollectionHistoryContinuation(resolved.continuation,{force:!0}),clearCollectionSessionState(queryKey),releaseCollectionScrollOwnership(),Promise.resolve(!1);const owner=collectionScrollLifecycle.owner;return owner.rootState=rootState,resolved.continuation.phase==="settled"?Promise.resolve(!1):collectionScrollLifecycle.restorationRunId===owner.id||collectionScrollLifecycle.restorationPromise?collectionScrollLifecycle.restorationPromise||Promise.resolve(!1):beginCollectionRestoration(rootState,resolved.historyState,resolved.continuation,event)},handleCollectionPageHide=()=>{collectionScrollLifecycle.rootState?.abortActiveLoad?.();const owner=collectionScrollLifecycle.owner;if(!owner)return;const resolved=resolveCollectionContinuation(owner.queryKey);if(!resolved||resolved.continuation.id!==owner.id){releaseCollectionScrollOwnership(owner);return}if(resolved.continuation.phase==="pending"){trySetCollectionScrollRestoration("manual").ok||abandonCollectionContinuation("pending-pagehide-unsupported");return}abandonCollectionContinuation(`${resolved.continuation.phase}-pagehide`)},handleCollectionPopState=()=>{const rootState=collectionScrollLifecycle.rootState,currentQueryKey=getCollectionCurrentQueryKey();if(rootState&&rootState.queryKey!==currentQueryKey){rootState.abortActiveLoad(),rootState.observer?.disconnect?.(),collectionScrollLifecycle.owner&&abandonCollectionContinuation("canonical-query-popstate");return}const owner=collectionScrollLifecycle.owner;owner&&(!resolveCollectionContinuation(owner.queryKey)||owner.sourceUrl!==getCollectionCurrentPageUrl())&&abandonCollectionContinuation("popstate-owner-mismatch")},bindCollectionLifecycleListeners=()=>{collectionScrollLifecycle.listenersBound||(collectionScrollLifecycle.listenersBound=!0,typeof window.addEventListener=="function"&&(window.addEventListener("pageshow",handleCollectionPageShow),window.addEventListener("pagehide",handleCollectionPageHide),window.addEventListener("popstate",handleCollectionPopState)))},bootstrapCollectionScrollOwnership=()=>{const queryKey=getCollectionCurrentQueryKey(),resolved=resolveCollectionContinuation(queryKey);if(!(!resolved||resolved.continuation.phase==="settled")){if(!ensureCollectionScrollOwnership(resolved.continuation)){clearCollectionHistoryContinuation(resolved.continuation,{force:!0}),clearCollectionSessionState(queryKey),releaseCollectionScrollOwnership();return}collectionScrollLifecycle.owner.rootState=null}},initCollectionInfiniteScroll=(scope=document)=>{const roots=[];scope instanceof Element&&scope.matches('[data-theme-collection-infinite-root="true"]')&&roots.push(scope),roots.push(...scope.querySelectorAll('[data-theme-collection-infinite-root="true"]')),roots.length&&roots.forEac
33h(root=>{const loader=root.querySelector("[data-theme-collection-infinite-scroll]"),grid=root.querySelector(".theme-main-collection__grid");if(!loader||!grid)return;const existingRootState=collectionRootStates.get(root);if(existingRootState){collectionScrollLifecycle.rootState=existingRootState,collectionScrollLifecycle.owner?.queryKey===existingRootState.queryKey&&(collectionScrollLifecycle.owner.rootState=existingRootState);return}const status=loader.querySelector("[data-theme-collection-infinite-status]"),button=loader.querySelector("[data-theme-collection-infinite-button]"),sectionId=root.dataset.themeSectionId||"",queryKey=getCollectionQueryKey(window.location.href),initialPageUrl=normalizeCollectionPageUrl(window.location.href);let nextUrl=normalizeCollectionPageUrl(loader.dataset.themeNextUrl||loader.getAttribute("href")||""),loadedPageUrls=initialPageUrl?[initialPageUrl]:[],isLoading=!1,activeController=null,observer,errorState=!1;const setStatus=(message,isError=!1)=>{status&&(status.textContent=message,isError?(status.setAttribute("role","alert"),status.setAttribute("aria-live","assertive"),status.setAttribute("aria-atomic","true"),status.dataset.themeCollectionError="true"):status.dataset.themeCollectionError!=="true"&&(status.setAttribute("role","status"),status.setAttribute("aria-live","polite")))},getSourcePageUrl=item=>normalizeCollectionPageUrl(item?.getAttribute?.(THEME_COLLECTION_SOURCE_PAGE_ATTRIBUTE)||"")||initialPageUrl,tagGridItems=(sourcePageUrl,gridToTag=grid)=>{!sourcePageUrl||!gridToTag||Array.from(gridToTag.children).forEach(item=>{item.hasAttribute(THEME_COLLECTION_SOURCE_PAGE_ATTRIBUTE)||item.setAttribute(THEME_COLLECTION_SOURCE_PAGE_ATTRIBUTE,sourcePageUrl)})},getProductId=item=>item?.dataset?.themeProductId||item?.querySelector?.("[data-theme-product-id]")?.dataset?.themeProductId||"",getLoadedProductIds=()=>{const ids=new Set;return grid.querySelectorAll("[data-theme-product-id]").forEach(item=>{const id=item.dataset.themeProductId;id&&ids.add(id)}),ids},setLoadMoreHref=()=>{!button||button.tagName!=="A"||!nextUrl||button.setAttribute("href",nextUrl)},syncLoaderState=()=>{if(errorState)return;const hasNextPage=!!nextUrl;loader.hidden=!hasNextPage,root.dataset.themeCollectionInfiniteState=hasNextPage?"idle":"complete",setLoadMoreHref(),button&&(button.hidden=!hasNextPage,"disabled"in button&&(button.disabled=!hasNextPage),hasNextPage||button.removeAttribute("aria-disabled")),setStatus(hasNextPage?"Scroll to load more":"All products loaded"),!hasNextPage&&observer&&observer.disconnect()},abortActiveLoad=()=>{activeController&&activeController.abort(),activeController=null},buildSectionUrl=href=>{const url=new URL(href,window.location.origin);if(url.origin!==window.location.origin)throw new Error("Collection page must stay same-origin.");return sectionId&&url.searchParams.set("section_id",sectionId),url.toString()},readResponseQueryKey=(response,nextRoot,requestedPageUrl)=>{const responsePageUrl=normalizeCollectionPageUrl(response?.url||requestedPageUrl);if(!responsePageUrl)throw new Error("Collection response URL must stay same-origin.");if(getCollectionQueryKey(responsePageUrl)!==queryKey)throw new Error("Collection response query state does not match the active collection.");const marker=nextRoot?.matches?.("[data-theme-collection-query-key], [data-theme-collection-state-key], [data-theme-canonical-state-key]")?nextRoot:nextRoot?.querySelector?.("[data-theme-collection-query-key], [data-theme-collection-state-key], [data-theme-canonical-state-key]"),markerKey=marker?.dataset?.themeCollectionQueryKey||marker?.dataset?.themeCollectionStateKey||marker?.dataset?.themeCanonicalStateKey||marker?.getAttribute?.("data-theme-collection-query-key")||marker?.getAttribute?.("data-theme-collection-state-key")||marker?.getAttribute?.("data-theme-canonical-state-key")||"";if(markerKey&&markerKey!==queryKey)throw new Error("Collection response state marker does not match the active query.")},appendResponseItems=(nextGrid,sourcePageUrl)=>{const existingProductIds=getLoadedProductIds(),appendedIds=new Set;
33Array.from(nextGrid.children).forEach(item=>{const productId=getProductId(item);productId&&(existingProductIds.has(productId)||appendedIds.has(productId))||(item.setAttribute(THEME_COLLECTION_SOURCE_PAGE_ATTRIBUTE,sourcePageUrl),grid.appendChild(item),productId&&(existingProductIds.add(productId),appendedIds.add(productId)))})},makeCollectionState=(selection={})=>({version:THEME_COLLECTION_STATE_VERSION,queryKey,loadedPageUrls:Array.from(new Set(loadedPageUrls)),nextUrl:nextUrl||"",selectedProductId:selection.selectedProductId||"",selectedProductHref:selection.selectedProductHref||"",scrollY:Number.isFinite(selection.scrollY)?selection.scrollY:readCollectionScrollY()??0,focusFromProductLink:selection.focusFromProductLink===!0,...selection.continuation?{continuation:selection.continuation}:collectionScrollLifecycle.owner?.rootState===rootState&&collectionScrollLifecycle.owner?.queryKey===queryKey?{continuation:{id:collectionScrollLifecycle.owner.id,phase:collectionScrollLifecycle.owner.phase,sourceUrl:collectionScrollLifecycle.owner.sourceUrl,targetHref:collectionScrollLifecycle.owner.targetHref,previousMode:collectionScrollLifecycle.owner.previousMode}}:{}}),persistCollectionState=(selection={})=>{const state=makeCollectionState(selection);return writeCollectionSessionState(state),writeCollectionHistoryState(state)},setLoadError=error=>{error?.name!=="AbortError"&&(console.error(error),errorState=!0,observer&&observer.disconnect(),root.dataset.themeCollectionInfiniteState="error",loader.hidden=!1,loader.dataset.themeCollectionError="true",button&&(button.hidden=!1,"disabled"in button&&(button.disabled=!1),button.removeAttribute("aria-disabled"),button.tagName==="A"&&nextUrl&&button.setAttribute("href",nextUrl)),setStatus("Unable to load more right now. Use Load more to continue.",!0))},loadPage=async(rawPageUrl,{restoring=!1,persist=!0}={})=>{const requestedPageUrl=normalizeCollectionPageUrl(rawPageUrl);if(!requestedPageUrl||isLoading||errorState||getCollectionQueryKey(window.location.href)!==queryKey||restoring&&!isCollectionOwnerCurrent())return!1;isLoading=!0;const controller=new AbortController;activeController=controller;const requestQueryKey=queryKey;root.dataset.themeCollectionInfiniteState=restoring?"restoring":"loading",loader.dataset.themeCollectionLoading="true",loader.dataset.themeCollectionRestoring=restoring?"true":"false",loader.hidden=!1,setLoadMoreHref(),setStatus(restoring?"Restoring more products":"Loading more products"),button&&"disabled"in button&&(button.disabled=!0);try{const response=await fetch(buildSectionUrl(requestedPageUrl),{credentials:"same-origin",headers:{Accept:"text/html"},signal:controller.signal});if(!response.ok)throw new Error(`Failed to load collection page: ${response.status}`);readResponseQueryKey(response,null,requestedPageUrl);const html=await response.text();if(requestQueryKey!==queryKey||getCollectionQueryKey(window.location.href)!==requestQueryKey||restoring&&!isCollectionOwnerCurrent())return!1;const parsed=new DOMParser().parseFromString(html,"text/html"),nextRoot=Array.from(parsed.querySelectorAll('[data-theme-collection-infinite-root="true"]')).find(candidate=>!sectionId||candidate.dataset.themeSectionId===sectionId),nextGrid=nextRoot?.querySelector(".theme-main-collection__grid");if(!nextRoot||!nextGrid||sectionId&&nextRoot.dataset.themeSectionId!==sectionId)throw new Error("Collection response is missing the active section.");if(restoring&&!isCollectionOwnerCurrent())return!1;readResponseQueryKey(response,nextRoot,requestedPageUrl),appendResponseItems(nextGrid,requestedPageUrl),tagGridItems(requestedPageUrl,grid),loadedPageUrls.includes(requestedPageUrl)||loadedPageUrls.push(requestedPageUrl);const nextLoader=nextRoot.querySelector("[data-theme-collection-infinite-scroll]");return nextUrl=normalizeCollectionPageUrl(nextLoader?.dataset?.themeNextUrl||nextLoader?.getAttribute?.("href")||""),loader.dataset.themeNextUrl=nextUrl,persist&&persistCollectionState(),init(grid),syncLoaderState(),!0}catch(error){return error?.name==="AbortError"||requestQueryKey!==queryKey||getCollectionQueryKey(window.location.href)!==requestQueryKey||setLoadError(error),!1}finally{activeController===controller&&(activeController=null),isLoading=!1,loader.dataset.themeCollectionLoading="false",loader.dataset.themeCollectionRestoring="false",button&&!errorState&&(nextUrl&&"disabled"in button&&(button.disabled=!1),nextUrl||syncLoaderState())}},loadNextPage=()=>{!nextUrl||isLoading||errorState||loadPage(nextUrl)},syncNativeSort=()=>{const sortSelect=root.querySelector('[data-theme-collection-sort], select[name="sort_by"]');if(!sortSelect)return;const requestedSort=new URL(window.location.href).searchParams.get("sort_by"),serverDefault=sortSelect.dataset.themeCollectionDefaultSort||sortSelect.querySelector("option[selected]")?.value||sortSelect.value,nextSort=requestedSort||serverDefault;nextSort&&(Array.from(sortSelect.options||[]).some(option=>option.value===nextSort)&&(sortSelect.value=nextSort),sortSelect.dataset.themeEventSortOption=sortSelect.value)},rootState={root,loader,grid,status,button,queryKey,initialPageUrl,get loadedPageUrls(){return loadedPageUrls},get nextUrl(){return nextUrl},setNextUrl(value){nextUrl=normalizeCollectionPageUrl(value||""),loader.dataset.themeNextUrl=nextUrl},get isLoading(){return isLoading},get errorState(){return errorState},get observer(){return observer},getProductId,makeCollectionState,persistCollectionState,abortActiveLoad,loadPage,syncLoaderState,syncNativeSort,tagGridItems,getSourcePageUrl,findSelectedProductLink:state=>
33{if(!state?.focusFromProductLink||!state.selectedProductId&&!state.selectedProductHref)return null;const productLinks=Array.from(grid.querySelectorAll("[data-theme-product-link]"));return productLinks.find(link=>{const id=link.dataset.themeProductId||link.closest("[data-theme-product-id]")?.dataset?.themeProductId||"";return state.selectedProductId&&id===state.selectedProductId})||productLinks.find(link=>normalizeSameOriginUrl(link.getAttribute?.("href")||link.href||"")===state.selectedProductHref)||null},getLoadedProductIds};root.addEventListener("click",event=>{const link=event.target?.closest?.("a");if(!(!link||root.contains?.(link)===!1)){if(link.matches("[data-theme-product-link]")){isCollectionPrimaryProductActivation(event,link)&&armCollectionContinuation(rootState,link);return}if(link.matches("[data-theme-collection-infinite-button]")){if(errorState||event.defaultPrevented||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button!==void 0&&event.button!==0)return;event.preventDefault(),loadNextPage();return}abortActiveLoad(),abandonCollectionContinuation("non-product-navigation")}}),root.addEventListener("submit",event=>{event.target?.matches?.("form")&&(abortActiveLoad(),abandonCollectionContinuation("filter-or-sort-submit"))}),root.addEventListener("change",event=>{event.target?.matches?.('[data-theme-collection-sort], select[name="sort_by"]')&&(abortActiveLoad(),abandonCollectionContinuation("sort-navigation"))}),button&&button.addEventListener("click",event=>{errorState||event.defaultPrevented||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button!==void 0&&event.button!==0||(event.preventDefault(),loadNextPage())}),"IntersectionObserver"in window&&(observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&loadNextPage()})},{rootMargin:"320px 0px"}),observer.observe(loader)),tagGridItems(initialPageUrl,grid),loader.dataset.themeCollectionInfiniteBound="true",syncLoaderState(),syncNativeSort(),collectionRootStates.set(root,rootState);const previousRootState=collectionScrollLifecycle.rootState;previousRootState&&previousRootState!==rootState&&(previousRootState.abortActiveLoad(),previousRootState.observer?.disconnect?.()),collectionScrollLifecycle.rootState=rootState,collectionScrollLifecycle.owner?.queryKey===queryKey&&(collectionScrollLifecycle.owner.rootState=rootState),collectionScrollLifecycle.pageshowSeen&&collectionScrollLifecycle.owner?.queryKey===queryKey&&["pending","restoring"].includes(collectionScrollLifecycle.owner.phase)&&handleCollectionPageShow({type:"pageshow",lateInit:!0})})},scheduleCollectionDoubleFrame=callback=>{const runLater=()=>{try{if(typeof window.setTimeout=="function"){window.setTimeout(callback,0);return}}catch{}callback()};try{if(typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(()=>{try{window.requestAnimationFrame(callback)}catch{runLater()}});return}}catch{}runLater()},beginCollectionRestoration=(rootState,historyState,continuation)=>{if(!rootState||!historyState||!continuation)return Promise.resolve(!1);if(collectionScrollLifecycle.restorationRunId===continuation.id||collectionScrollLifecycle.restorationPromise)return collectionScrollLifecycle.restorationPromise||Promise.resolve(!1);if(!isCollectionOwnerCurrent(collectionScrollLifecycle.owner,["pending","restoring"]))return abandonCollectionContinuation("restoration-owner-invalid"),Promise.resolve(!1);const owner=collectionScrollLifecycle.owner;if(collectionScrollLifecycle.restorationRunId=continuation.id,continuation.phase==="pending"&&!updateCollectionContinuationPhase(rootState,"restoring"))return abandonCollectionContinuation("restoration-phase-write-failed"),Promise.resolve(!1);const promise=(async()=>{try{rootState.abortActiveLoad(),rootState.tagGridItems(rootState.initialPageUrl,rootState.grid);const currentLoadedPageUrls=Array.from(rootState.grid.children).map(item=>rootState.getSourcePageUrl(item)).filter(Boolean);rootState.loadedPageUrls.splice(0,rootState.loadedPageUrls.length,...Array.from(new Set(currentLoadedPageUrls.length?currentLoadedPageUrls:rootState.initialPageUrl?[rootState.initialPageUrl]:[])));for(const pageUrl of historyState.loadedPageUrls){if(!isCollectionOwnerCurrent(owner,["restoring"]))throw new Error("Collection restoration ownership was lost.");if(rootState.loadedPageUrls.includes(pageUrl))continue;if(!await rootState.loadPage(pageUrl,{restoring:!0,persist:!1}))throw new Error("Collection restoration failed to load a saved page.");if(!isCollectionOwnerCurrent(owner,["restoring"]))throw new Error("Collection restoration ownership was lost.")}if(rootState.loadedPageUrls.splice(0,rootState.loadedPageUrls.length,...Array.from(new Set(historyState.loadedPageUrls.concat(rootState.loadedPageUrls)))),rootState.setNextUrl(historyState.nextUrl),rootState.syncLoaderState(),!rootState.persistCollectionState({selectedProductId:historyState.selectedProductId,selectedProductHref:historyState.selectedProductHref,scrollY:historyState.scrollY,focusFromProductLink:historyState.focusFromProductLink,continuation:{id:owner.id,phase:owner.phase,sourceUrl:owner.sourceUrl,targetHref:owner.targetHref,previousMode:owner.previousMode}}))throw new Error("Collection restoration state could not be persisted.");
33if(!isCollectionOwnerCurrent(owner,["restoring"]))throw new Error("Collection restoration ownership was lost.");if(await new Promise(resolve=>scheduleCollectionDoubleFrame(resolve)),!isCollectionOwnerCurrent(owner,["restoring"]))throw new Error("Collection restoration ownership was lost.");if(typeof window.scrollTo!="function")throw new Error("Collection restoration requires window.scrollTo.");window.scrollTo({top:historyState.scrollY,behavior:"auto"});const selectedLink=rootState.findSelectedProductLink(historyState);if(selectedLink&&focusWithoutScroll(selectedLink),window.scrollTo({top:historyState.scrollY,behavior:"auto"}),!isCollectionOwnerCurrent(owner,["restoring"]))throw new Error("Collection restoration ownership was lost.");if(!updateCollectionContinuationPhase(rootState,"settled"))throw new Error("Collection restoration could not settle its continuation.");return!0}catch(error){return collectionScrollLifecycle.owner?.id===owner.id&&abandonCollectionContinuation(error?.name==="AbortError"?"restoration-aborted":"restoration-failed"),!1}finally{collectionScrollLifecycle.restorationPromise===promise&&(collectionScrollLifecycle.restorationPromise=null)}})();return collectionScrollLifecycle.restorationPromise=promise,promise};bindCollectionLifecycleListeners(),bootstrapCollectionScrollOwnership();const footerDisclosureBindings=new WeakMap,initFooterDisclosures=(scope=document)=>{const roots=[];scope instanceof Element&&scope.matches("[data-theme-footer]")&&roots.push(scope),scope.querySelectorAll&&roots.push(...scope.querySelectorAll("[data-theme-footer]")),roots.forEach(root=>{if(footerDisclosureBindings.has(root))return;const groups=Array.from(root.querySelectorAll(".theme-site-footer__group")).map(group=>({button:group.querySelector("[data-theme-footer-disclosure]"),panel:group.querySelector("[data-theme-footer-panel]")})).filter(({button,panel})=>button&&panel);if(!groups.length||typeof window.matchMedia!="function")return;const mobileQuery=window.matchMedia("(max-width: 749px)"),setGroupState=({button,panel},expanded)=>{button.setAttribute("aria-expanded",String(expanded)),panel.hidden=!expanded},syncBreakpointState=()=>{root.classList.add("is-disclosure-ready"),groups.forEach(group=>{mobileQuery.matches?(group.button.hidden=!1,setGroupState(group,!1)):(group.button.hidden=!0,setGroupState(group,!0))})};groups.forEach(group=>{group.button.addEventListener("click",()=>{mobileQuery.matches&&setGroupState(group,group.button.getAttribute("aria-expanded")!=="true")})}),typeof mobileQuery.addEventListener=="function"?mobileQuery.addEventListener("change",syncBreakpointState):mobileQuery.addListener(syncBreakpointState),syncBreakpointState(),footerDisclosureBindings.set(root,{mobileQuery,syncBreakpointState})})},initCritical=(scope=document)=>{initA11yControls(scope),initPrivacyPreferences(scope),initShellAnnouncementCopy(),initShellHeaderControls(scope),initHeaderScrollVisibility(scope),initCartAnnouncementLabel(),initHorizontalRails(scope),initCollectionTitleFit(scope),initCollectionFilterEnhancements(scope),initCollectionInfiniteScroll(scope),initFooterDisclosures(scope)},initDeferred=(scope=document)=>{initAccountOfferPrefill(),initAccountOfferRail(scope),initRichTextTablePolish(scope),initWishlistButtons(scope),initGlobalContactInlineRouting(),initContactFormAnchorRouting(scope),initContactBotGuard(scope),initPdpEventPayloadSync(scope),initPdpMediaGallery(scope),initPdpRecommendations(scope),initPdpFitSizeToggle(scope),initPdpReturnLinks(scope),initPdpReviewPresentation(scope),initPdpCartState(),initReturnTabBubble(),initNativeFreeShipping()},init=(scope=document)=>{initCritical(scope),scheduleIdleTask(()=>{initDeferred(scope)})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>init(document),{once:!0}):init(document),document.addEventListener("shopify:section:load",event=>{const scope=event&&event.target?event.target:document;init(scope)}),document.addEventListener("shopify:section:unload",event=>{abortCollectionFilterDisclosureBindings(event?.target||document)})})(); 34//# sourceMappingURL=/cdn/shop/t/50/assets/theme.js.map?v=11094569770
34783649731790109469
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.