1import deferrableData from"deferrable-data";var product_default={loading:!1,addedToCart:!1,cartAddErrorMessage:null,hasGiftCardRecipientForm:!1,coreInit(){this.$root.querySelector('[x-data="GiftCardRecipient"]')&&(this.hasGiftCardRecipientForm=!0),this.setUpProductFormEvents(),Shopify?.PaymentButtons?.init()},setUpProductFormEvents(){this.$root.addEventListener("shapes:productform:loading",event=>{event.stopPropagation(),this.loading=!0,this.addedToCart=!1}),this.$root.addEventListener("shapes:productform:success",event=>{event.stopPropagation(),this.loading=!1,this.cartAddErrorMessage=null,this.addedToCart=!0,typeof this.refreshPreloadCache=="function"&&this.refreshPreloadCache()}),this.hasGiftCardRecipientForm||this.$root.addEventListener("shapes:productform:error",event=>{event.stopPropagation();const quantityEl=this.$root.querySelector('[name="quantity"]');this.cartAddErrorMessage=event.detail?.message||window.theme.strings.cartError,this.quantity=quantityEl?Number(quantityEl.getAttribute("min")):1,this.loading=!1})}},product_default2=({product,featuredMediaID=null,templateType="default",thumbnailsPosition="left",showThumbnailsOnMobile=!1,isPreOrder=!1,preselectVariant=!0,shouldUpdateHistoryState})=>({...product_default,productRoot:null,product,currentVariant:null,cacheOptionsFor:Shopify?.designMode?0:3e5,sectionUpdateAbortController:null,preloadAbortController:null,unselectedPreloadAbortController:null,currentMediaId:featuredMediaID,firstMediaView:!0,preselectVariant,quantity:1,variantChanged:!1,templateType,thumbnailsPosition,showThumbnailsOnMobile,isPreOrder,shouldUpdateHistoryState,allProductURLs:[],allOptionsHaveSelections:!1,allOptionsHaveClientSelections:!1,optionPositionsWithSelection:new Set,optionPositionsWithClientSelection:new Set,sectionUpdateFetchIsPending:!1,finishedSelectingOptions:!1,get resolvedParentRoot(){return this.productRoot??this.$root},get currentVariantJSONEl(){return this.resolvedParentRoot.querySelector("[data-current-variant]")},get optionEls(){return Array.from(this.resolvedParentRoot.querySelectorAll("[data-product-option]")??[])},get optionValueEls(){return Array.from(this.resolvedParentRoot.querySelectorAll("[data-single-option-selector]")??[])},get selectedOptionValueEls(){return Array.from(this.resolvedParentRoot.querySelectorAll('[data-single-option-selector]:checked, [data-single-option-selector][aria-selected="true"]')??[])},get unselectedOptionValueEls(){return Array.from(this.resolvedParentRoot.querySelectorAll('[data-single-option-selector]:not(:checked, [aria-selected="true"])')??[])},get optionsFromOtherProductURLs(){return this.optionValueEls.filter(({dataset:{productUrl}})=>productUrl&&productUrl!==this.product.url)??[]},get currentPrice(){return this.currentVariant?this.currentVariant.price:0},formatMoney(price){return formatMoney(price,theme.moneyFormat)},get splideEl(){return this.productRoot.querySelector(".splide--product")},get isUsingSlideshowToDisplayMedia(){return!!(window.Splide&&this.productRoot&&this.splideEl&&window.slideshows&&window.slideshows[`${this.splideEl.id}`]&&!window.slideshows[`${this.splideEl.id}`].state.is(window.Splide.STATES.DESTROYED))},get isPrimaryProductOnPage(){return this.product.url===window.location.pathname},get identifyingURLParam(){return this.templateType.startsWith("quick-buy")?["view",this.templateType]:["section_id",this.sectionId]},optionClientSelectionValueFor(position){return this.selectedOptionValueEls.find(el=>el.dataset.position===String(position))?.value.trim()||null},optionHasClientSelection(position){return this.allOptionsHaveClientSelections||this.optionPositionsWithClientSelection.has(position)},optionHasSelection(position){return this.allOptionsHaveSelections||this.optionPositionsWithSelection.has(position)},updateSelectionState(){this.allOptionsHaveSelections=this.selectedOptionValueEls.length===this.optionEls.length,this.allOptionsHaveClientSelections=this.allOptionsHaveSelections,this.optionPositionsWithSelection=new Set(this.selectedOptionValueEls.map(el=>parseInt(el.getAttribute("data-position"),10)))},init(){if(this.productRoot=this.$root,this.sectionId=getSectionId(this.$root),this.updateSelectionState(),this.isPrimaryProductOnPage&&!this.allOptionsHaveSelections&&(window.location.search.includes("variant=")||window.location.search.includes("option_values="))){const searchParams=new URLSearchParams(window.location.search);let selectedValueEls=Array.from(this.resolvedParentRoot.querySelectorAll("[data-selected-value]"))??[];if(searchParams.has("option_values")){const optionValuesLength=searchParams.get("option_values")?.split(",").length??0;selectedValueEls=selectedValueEls.slice(null,optionValuesLength)}this.restoreSelectionState(selectedValueEls)}this.coreInit(),this.$watch("currentMediaId",(value,oldValue)=>{value&&this.$root.dispatchEvent(new CustomEvent("shapes:product:mediachange",{bubbles:!0,detail:{mediaId:this.currentMediaId,slideshowId:this.productRoot.querySelector(".splide--product")?.id}})),!this.isUsingSlideshowToDisplayMedia&&(this.$root.querySelector(`[data-
1product-single-media-wrapper="${oldValue}"]`)?.dispatchEvent(new CustomEvent("mediaHidden")),this.$root.querySelector(`[data-product-single-media-wrapper="${value}"]`)?.dispatchEvent(new CustomEvent("mediaVisible")))}),this.$watch("currentVariant",(value,oldValue)=>{this.firstMediaView&&oldValue&&value!==oldValue&&(this.firstMediaView=!1),document.dispatchEvent(new CustomEvent("theme:variant:change",{detail:{productRootEl:this.productRoot,formEl:this.productRoot.querySelector("form.shopify-product-form"),variant:value,previousVariant:oldValue,product:this.product}})),this.preselectVariant===!1&&this.firstMediaView||this.$root.dispatchEvent(new CustomEvent("shapes:product:slideshow:variantchange",{bubbles:!0,detail:{variant:value}})),value&&value.featured_media&&!(this.preselectVariant===!1&&this.firstMediaView)&&(this.currentMediaId=value.featured_media.id)}),this.productRoot.addEventListener("theme:change:variant",event=>{if(!event.detail||!event.detail.variantId){console.error("theme:change:variant requires a variant ID");return}this.handleVariantChange(event.detail.variantId)}),this.productRoot.addEventListener("theme:change:option-values",event=>{if(!event.detail||!event.detail.optionValueIDs){console.error("theme:change:option-values requires option value IDs");return}this.handleOptionValuesChangeEvent(event.detail.optionValueIDs)}),this.productRoot.addEventListener("shapes:productslideshow:destroyed",event=>{event.target.querySelectorAll(".splide__slide[data-media-id]").forEach(sli
1de=>{slide.style.display=Number(slide.dataset.mediaId)===this.currentMediaId?"":"none"})}),this.currentVariant=this.parseCurrentVariantJSON(),this.allProductURLs=[this.product.url,...this.optionValueEls.map(({dataset:{productUrl}})=>productUrl).filter(Boolean)],requestIdleCallback(()=>{this.preloadReachableCombinations(),updateRecentlyViewedProducts(this.product.id),this.shouldUpdateHistoryState&&window.location.search.includes("option_values=")&&this.updateHistoryState(new URL(window.location.href))}),this.$watch("$store.breakpoints.maxLg",async(value,oldValue)=>{value===!0&&(await this.$nextTick(),this.preselectVariant===!1&&this.firstMediaView||this.$root.dispatchEvent(new CustomEvent("shapes:product:slideshow:variantchange",{bubbles:!0,detail:{variant:this.currentVariant}})))})},parseCurrentVariantJSON(){let currentVariant=null;try{currentVariant=JSON.parse(this.currentVariantJSONEl?.innerHTML)}catch{}return currentVariant},selectionStateForOptionValueEl(optionValueEl){const optionProductURL=optionValueEl.getAttribute("data-product-url");return{selections:[optionValueEl,...this.selectedOptionValueEls.filter(el=>el.getAttribute("data-position")!==optionValueEl.getAttribute("data-position"))].sort((a,b)=>parseInt(a.getAttribute("data-position"),10)-parseInt(b.getAttribute("data-position"),10)).map(el=>el.getAttribute("data-id")),productURL:optionProductURL||this.product.url}},hasValidOptionSelectionSequence(){this.optionPositionsWithClientSelection=new Set(this.selectedOptionValueEls.map(el=>parseInt(el.getAttribute("data-position"),10)));const maxClientSelection=Math.max(...this.optionPositionsWithClientSelection);return this.optionPositionsWithClientSelection.size===maxClientSelection},canShowSoldOutState(){if(this.allOptionsHaveSelections)return!0;const position=parseInt(this.$el.dataset.position,10);if(position===1)return!0;if(this.optionPositionsWithSelection.size===0)return!1;const maxSelection=Math.max(...this.optionPositionsWithSelection);return this.optionPositionsWithSelection.size===maxSelection&&position<=maxSelection+1},preloadLastUnselectedOptionValues(){if(Shopify?.designMode||!this.$root||!this.optionValueEls||this.optionValueEls.length===0||this.selectedOptionValueEls.length!==this.optionEls.length-1)return;if(window.shouldTryToSaveData()){console.log("Preference to save data detected, will not preload last unselected product option values.");return}this.unselectedPreloadAbortController?.abort();const selectedPositions=this.selectedOptionValueEls.map(el=>el.dataset.position),unselectedPositionOptionValueEls=this.unselectedOptionValueEls.filter(el=>!selectedPositions.includes(el.dataset.position)),combinationsToPreload=[];for(const unselectedOptionValueEl of unselectedPositionOptionValueEls)combinationsToPreload.push(this.selectionStateForOptionValueEl(unselectedOptionValueEl));this._preloadOptionCombinations("unselectedPreloadAbortController",combinationsToPreload)},preloadReachableCombinations(){if(Shopify?.designMode||!this.$root||!this.optionValueEls||this.optionValueEls.length===0||!this.allOptionsHaveSelections)return;if(window.shouldTryToSaveData()){console.log("Preference to save data detected, will not preload reachable product option combinations.");return}this.preloadAbortController?.abort();const combinationsToPreload=[];for(const unselectedOptionValueEl of this.unselectedOptionValueEls)combinationsToPreload.push(this.selectionStateForOptionValueEl(unselectedOptionValueEl));this._preloadOptionCombinations("preloadAbortController",combinationsToPreload)},refreshPreloadCache(){for(const url of this.allProductURLs)invalidateCacheForKeysContaining(url);requestIdleCallback(()=>{this.preloadReachableCombinations()})},_preloadOptionCombinations(abortControllerKey,combinationsToPreload){if(!abortControllerKey||!combinationsToPreload)return;const urlsToPreload=new Set;for(const combination of combinationsToPreload){const selections=combination.selections,productURL=combination.productURL,url=getURLWithParams(productURL,[["option_values",selections.join(",")],this.templateType.startsWith("quick-buy")?["view",this.templateType]:productURL!==this.product.url&&this.isPrimaryProductOnPage?null:["section_id",this.sectionId]].filter(
1Boolean));url.searchParams.delete("variant"),urlsToPreload.add(url.toString())}this[abortControllerKey]=new AbortController;for(const urlToPreload of urlsToPreload)fetchHTML(urlToPreload,{signal:this[abortControllerKey].signal},this.cacheOptionsFor,!1).catch(e=>{if(e.name!=="AbortError")throw e})},async handleOptionValuesChangeEvent(optionValueIDs){if(!optionValueIDs||optionValueIDs.length===0){console.error("handleOptionValuesChangeEvent requires an array of optionValueIDs, none provided");return}this.preloadAbortController?.abort(),this.sectionUpdateAbortController?.abort(),this.sectionUpdateAbortController=new AbortController;const handleOptionValuesChangeAbortController=this.sectionUpdateAbortController,params=[["option_values",optionValueIDs.join(",")],this.identifyingURLParam],url=this.isPrimaryProductOnPage?currentURLWithParams(params):getURLWithParams(this.product.url,params);await this.updateSectionHTML(url),this.currentVariant=this.parseCurrentVariantJSON(),this.shouldUpdateHistoryState&&this.updateHistoryState(url),this.sectionUpdateAbortController===handleOptionValuesChangeAbortController&&(this.sectionUpdateAbortController=null),this.checkForProductURLMismatch()},async handleVariantChange(id){if(!id){console.error("handleVariantChange requires a variant ID, none provided");return}this.preloadAbortController?.abort(),this.sectionUpdateAbortController?.abort(),this.sectionUpdateAbortController=new AbortController;const handleVariantChangeAbortController=this.sectionUpdateAbortController,params=[["variant",id],this.identifyingURLParam],url=this.isPrimaryProductOnPage?currentURLWithParams(params):getURLWithParams(this.product.url,params);await this.updateSectionHTML(url),this.currentVariant=this.parseCurrentVariantJSON(),this.shouldUpdateHistoryState&&this.updateHistoryState(url),this.sectionUpdateAbortController===handleVariantChangeAbortController&&(this.sectionUpdateAbortController=null),this.checkForProductURLMismatch()},async optionChange(optionEl=this.$el){if(this.allOptionsHaveClientSelections=this.selectedOptionValueEls.length===this.optionEls.length,!this.allOptionsHaveClientSelections){if(!this.hasValidOptionSelectionSequence())return;this.preloadLastUnselectedOptionValues()}this.preloadAbortController?.abort(),this.sectionUpdateAbortController?.abort(),this.sectionUpdateAbortController=new AbortController;const optionChangeAbortController=this.sectionUpdateAbortController,addToCartButtonEl=this.resolvedParentRoot.querySelector("form[data-product-form] [type=submit]");setTimeout(()=>{this.finishedSelectingOptions=this.allOptionsHaveClientSelections,this.sectionUpdateFetchIsPending&&addToCartButtonEl&&(addToCartButtonEl.classList.add("cursor-not-allowed"),addToCartButtonEl.disabled=!0)},50);const selectionState=this.selectionStateForOptionValueEl(optionEl);if(selectionState.productURL!==this.product.url){if(this.isPrimaryProductOnPage){const updatedProductURLWithOptions=getURLWithParams(selectionState.productURL,[["option_values",selectionState.selections.join(",")]]);let onReplaced=()=>{};this.preselectVariant||(onReplaced=(newEl,oldEl)=>{const newPriceEl=newEl.querySelector("[data-product-price]"),oldPriceEl=oldEl.querySelector("[data-product-price]");newPriceEl&&oldPriceEl&&(newPriceEl.classList=oldPriceEl.classList)}),replaceMainContent(updatedProductURLWithOptions,void 0,this.cacheOptionsFor,onReplaced)}else{const updatedProductURLWithOptions=getURLWithParams(selectionState.productURL,[["option_values",selectionState.selections.join(",")],this.identifyingURLParam]);let onReplaced=()=>{};this.preselectVariant||(onReplaced=(newEl,oldEl)=>{const selectedOptions=selectionState.selections;let selectedValueEls=Array.from(newEl.querySelectorAll("[data-single-option-selector][data-selected-value]"));selectedValueEls=selectedValueEls.slice(null,selectedOptions.length);const newPriceEl=newEl.querySelector("[data-product-price]"),oldPriceEl=oldEl.querySelector("[data-product-price]");newPriceEl&&oldPriceEl&&(newPriceEl.style.display=oldPriceEl.style.display),this.restoreSelectionState(selectedValueEls)}),replaceElement(this.templateType.startsWith("quick-buy")?this.resolvedParentRoot:this.resolvedParentRoot.closest(".shopify-section"),updatedProductURLWithOptions,void 0,this.cacheOptionsFor,onReplaced)}return}const params=[["option_values",selectionState.selections.join(",")],this.identifyingURLParam],url=this.isPrimaryProductOnPage?currentURLWithParams(params):getURLWithParams(this.product.url,params);url.searchParams.delete("variant"),await this.updateSectionHTML(url),this.currentVariant=this.parseCurrentVariantJSON(),this.shouldUpdateHistoryState&&this.updateHistoryState(url),this.sectionUpdateAbortController===optionChangeAbortController&&(this.sectionUpdateAbortController=null)},async updateSectionHTML(url){this.sectionUpdateFetchIsPending=!0;try{const updatedSectionHTML=await fetchHTML(url,{signal:this.sectionUpdateAbortController.signal,priority:"high"},this.cacheOptionsFor,!!Shopify?.designMode),updatedSectionDOM=parseDOMFromString(updatedSectionHTML),currentVariantFragmentEls=Array.from(this.productRoot.querySelectorAll("[data-variant-fragment]")),selectedOptionValueEls=this.selectedOptionValueEls;for(const currentVariantFragmentEl of currentVariantFragmentEls){const updatedVariantFragmentEl=updatedSectionDOM.querySelector(`[data-variant-fragment="${currentVariantFragmentEl.dataset.variantFragment}"]`),morphingVariantPickerInNonPreselectMode=this.preselectVariant===!1&¤tVariantFragmentEl.hasAttribute("data-variant-picker");Alpine.morph(currentVariantFragmentEl,updatedVariantFragmentEl?.outerHTML||"",{updating(el,toEl,_childrenOnly,skip){if(el.nodeType===1&&(el.hasAttribute("data-replace-on-morph")&&(el.replaceWith(toEl),skip()),el.hasAttribute("data-skip-on-section-update")&&skip(),el.hasAttribute("ready")&&toEl.setAttribute("ready",""),el.tagName==="IMG"&&el.getAttribute("src")===toEl?.getAttribute("src")&&skip(),morphingVariantPickerInNonPreselectMode&&(el.tagName==="INPUT"&&el.hasAttribute("checked")&&toEl.setAttribute("checked",""),el.getAttribute("aria-selected")==="true"&&toEl.setAttribute("aria-selected","true"),el.hasAttribute("data-selected-swatch-value"))))try{const swatchPosition=el.closest("[data-product-option]").querySelector("[data-position]").getAttribute("data-position");selectedOptionValueEls.some(selectedEl=>selectedEl?.getAttribute("data-position")===swatchPosition)&&toEl.classList.remove("hidden")}catch{}}}),this.updateSelectionState()}}
1catch(err){if(err.name!=="AbortError")throw err}finally{this.sectionUpdateFetchIsPending=!1}await this.$nextTick(),requestIdleCallback(()=>{this.preloadReachableCombinations()})},restoreSelectionState(selectedValueEls){if(selectedValueEls?.length>0){for(const selectedValueEl of selectedValueEls)selectedValueEl.tagName==="INPUT"?selectedValueEl.setAttribute("checked",""):selectedValueEl.setAttribute("aria-selected","true");this.updateSelectionState()}},checkForProductURLMismatch(){if(!this.isPrimaryProductOnPage)return;const selectedOptionValueEls=this.selectedOptionValueEls,selectionsWithURLMismatch=selectedOptionValueEls.map(({dataset:{productUrl}})=>productUrl&&productUrl!==window.location.pathname?productUrl:null).filter(Boolean);if(selectionsWithURLMismatch.length>0){const newURL=getURLWithParams(selectionsWithURLMismatch[0],[this.currentVariant&&this.currentVariant.id?["variant",this.currentVariant.id]:["option_values",selectedOptionValueEls.map(el=>el.dataset.id).join(",")]]);replaceMainContent(newURL,void 0,this.cacheOptionsFor)}},updateHistoryState(url){if(this.allOptionsHaveSelections===!1)return;const historyURL=new URL(url);historyURL.searchParams.delete("section_id"),historyURL.searchParams.delete("view"),historyURL.searchParams.delete("variant"),this.currentVariant&&this.currentVariant.id&&(historyURL.searchParams.delete("option_values"),historyURL.searchParams.set("variant",this.currentVariant.id));const historyURLAsString=historyURL.toString();window.history.replaceState({path:historyURLAsString},"",historyURLAsString)},changeMedia(direction){if(this.$root.dispatchEvent(new CustomEvent("shapes:product:arrow-change",{bubbles:!0,detail:{direction}})),this.thumbnailsPosition==="under"){const currentThumbnail=this.$root.querySelector(".product-thumbnail-list-item--active"),nextElement=direction==="prev"?currentThumbnail.previousElementSibling:currentThumbnail.nextElementSibling;nextElement!==null&&nextElement.querySelector(".media-thumbnail").click()}},openZoom(id){const imageZoomDataEl=this.productRoot.querySelector("[data-photoswipe-images]");if(!imageZoomDataEl)return;const imageZoomData=JSON.parse(imageZoomDataEl.innerHTML),index=Object.keys(imageZoomData).indexOf(id);this.$refs.photoSwipeComponent.dispatchEvent(new CustomEvent("shapes:photoswipe:open",{detail:{index}}))}}),product_form_default=()=>({formEl:null,init(){this.formEl=this.$root.querySelector("form"),this.formEl?.addEventListener("submit",this.submit.bind(this))},async submit(event){event?.preventDefault?.(),this.$root.dispatchEvent(new CustomEvent("shapes:productform:loading",{bubbles:!0})),liveRegion(window.theme.strings.loading);const hasForm=event&&event.target&&event.target instanceof HTMLFormElement;let formId,formData;if(hasForm)formId=event.target.getAttribute("id"),formData=new FormData(event.target);else{formId=this.$root.getAttribute("id")||`transient-form-${Date.now()}`,formData=new FormData;const id=this.$root.querySelector('input[name="id"]:not(:disabled)')?.value||null;formData.append("id",id)}const options=fetchConfigDefaults("application/javascript");formData.append("sections",getCartSectionRequestIds().join(",")),formData.append("sections_url",window.location.pathname),options.body=formData,options.headers["X-Requested-With"]="XMLHttpRequest",delete options.headers["Content-Type"];let response,data,fetchError=null;try{response=await fetch(`${theme.routes.cart_add_url}`,options),data=await response.json()}catch(e){fetchError=e}if(data?.status||fetchError){let errors=data?.errors||data?.description||fetchError,message=data?.description||data?.message||null;const errorDetail={sourceId:formId,variantId:Number(formData.get("id")),errors,message};this.$root.dispatchEvent(new CustomEvent("shapes:productform:error",{detail:errorDetail,bubbles:!0}));const formEl=this.formEl,productRootEl=formEl?.closest("[data-product-root]")||null;if(document.dispatchEvent(new CustomEvent("theme:product:error:add-to-cart",{detail:{productRootEl,formEl,...errorDetail}})),errors){console.error(`Encountered the following errors in form #${formId}:`),Array.isArray(errors)||(errors=[errors]);for(const error of errors)console.error(error.message||error);console.error(`End errors for form #${formId}.`)}}else this.$root.dispatchEvent(new CustomEvent("shapes:productform:success",{bubbles:!0})),document.body.dispatchEvent(new CustomEvent("shapes:cart:afteradditem",{bubbles:!0,detail:{response:data,sourceId:formId}}))}}),product_group_picker_default=()=>({cacheGroupProductsFor:Shopify?.designMode?0:3e5,init(){requestIdleCallback(()=>{this.preloadGroupProducts()})},preloadGroupProducts(){if(window.shouldTryToSaveData()){console.log("Preference to save data detected, will not preload product group products");return}const elsWithUrls=this.$root?.querySelectorAll('a[href],[role="option"][data-url]');if(!elsWithUrls||elsWithUrls.length===0)return;const urlsToPreload=Array.from(elsWithUrls).map(linkEl=>{const elUrl=linkEl.hasAttribute("href")?linkEl.href:linkEl.dataset.url;return this.isPrimaryProductOnPage?elUrl:getURLWithParams(elUrl,[this.identifyingURLParam])});for(const urlToPreload of urlsToPreload)fetchHTML(urlToPreload,void 0,this.cacheGroupProductsFor,!!Shopify?.designMode)},selectGroupProduct(){let newUrl=null;if(this.$el.hasAttribute("href")?newUrl=this.$el.href:this.$el.hasAttribute("data-url")&&(newUrl=this.$el.dataset.url),!!newUrl)if(this.isPrimaryProductOnPage)replaceMainContent(newUrl,void 0,this.cacheGroupProductsFor);else{const updatedProductURL=getURLWithParams(newUrl,[this.identifyingURLParam]);replaceElement(this.templateType.startsWith("quick-buy")?this.resolvedParentRoot:this.resolvedParentRoot.closest(".shopify-section"),updatedProductURL,void 0,this.cacheGroupProductsFor)}}}),sticky_add_to_cart_default=()=>({productRoot:null,shown:!1,triggerEl:null,triggerObserver:null,footerObserver:null,footerInView:!1,pastTrigger:!1,scrollingUp:!1,lastScrollY:0,scrollFrame:null,scrollHandler:null,resizeHandler:null,init(){if(this.productRoot=this.$root.closest("[data-product-root]"),this.triggerEl=this.productRoot?.querySelector("[data-sticky-add-to-cart-trigger]"),!this.triggerEl)return;this.lastScrollY=window.scrollY,this.updateTriggerState(),this.updateVisibility(),this.triggerObserver=new IntersectionObserver(()=>{this.updateTriggerState(),this.updateVisibility()}),this.triggerObserver.observe(this.triggerEl);const footer=document.querySelector(".section-footer");footer&&(this.footerObserver=new IntersectionObserver(([entry])=>{this.footerInView=entry.isIntersecting,this.updateVisibility()}),this.footerObserver.observe(footer)),this.scrollHandler=()=>{this.scrollFrame||(this.scrollFrame=window.requestAnimationFrame(()=>{const currentScrollY=window.scrollY;this.scrollingUp=currentScrollY<this.lastScrollY,this.lastScrollY=currentScrollY,this.updateTriggerState(),this.updateVisibility(),this.scrollFrame=null}))},this.resizeHandler=()=>{this.updateTriggerState(),this.updateVisibility()},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),window.addEventListener("resize",this.resizeHandler)},updateTriggerState(){if(!this.triggerEl){this.pastTrigger=!1;return}const{top,bottom}=this.triggerEl.getBoundingClientRect();this.pastTrigger=top<0&&bottom<=0},updateVisibility(){this.shown=this.pastTrigger&&!this.footerInView&&!this.scrollingUp},destroy(){this.triggerObserver?.disconnect(),this.triggerObserver=null,this.footerObserver?.disconnect(),this.footerObserver=null,this.scrollFrame&&(window.cancelAnimationFrame(this.scrollFrame),this.scrollFrame=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null)}});deferrableData("Product",product_default2),deferrableData("ProductForm",product_form_default),deferrableData("StickyAddToCart",sticky_add_to_cart_default),deferrableData("ProductGroupPicker",product_group_picker_default); 2//# sourceMappingURL=/cdn/shop/t/47/assets/island-product.bundle.js.map?v=14566611021534542841789076334
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.