1(()=>{if(window.__stickyProductCTASyncInitialized)return;window.__stickyProductCTASyncInitialized=!0;const stickyVisibilityInstances=new WeakMap,initStickyVariantPriceSync=stickyCTA=>{const card=stickyCTA.querySelector("product-card-with-variants"),priceEl=stickyCTA.querySelector("[data-sticky-sale-price]"),compareEl=stickyCTA.querySelector("[data-sticky-compare-price]");if(!card||!priceEl||!compareEl)return;let variants;try{variants=JSON.parse(card.querySelector("script.variants").textContent).variants}catch{return}if(!variants?.length)return;const getSelectedOptions=()=>{const selected={};return card.querySelectorAll('product-swatch input[type="radio"]:checked').forEach(input=>{const optName=input.closest(".swatch-element")?.getAttribute("data-option");optName&&(selected[optName]=input.value)}),selected},findVariant=selected=>variants.find(v=>Object.entries(selected).every(([key,val])=>v.options[key]===val))??null,updatePrice=()=>{const variant=findVariant(getSelectedOptions());if(!variant)return;const onSale=!!variant.compare_at_price;priceEl.textContent=variant.price,priceEl.classList.toggle("price--sale-price",onSale),priceEl.classList.toggle("price--regular-price",!onSale),compareEl.textContent=onSale?variant.compare_at_price:"",compareEl.classList.toggle("hidden",!onSale)};card.addEventListener("change",event=>{event.target.matches('input[type="radio"]')&&requestAnimationFrame(updatePrice)})},setStickyDisplay=(stickyCTA,shouldShow)=>{const nextDisplay=shouldShow?"block":"none";stickyCTA.style.display!==nextDisplay&&(stickyCTA.style.display=nextDisplay)},HEADER_SELECTORS=[".header-section","header.site-header","nav.mobile-nav-bar-wrapper"],getStickyHeader=()=>{for(const selector of HEADER_SELECTORS){const candidate=document.querySelector(selector);if(candidate&&candidate.offsetHeight>0)return candidate}return null},getDocumentTop=element=>{let top=0,node=element;for(;node;)top+=node.offsetTop,node=node.offsetParent;return top},getTopSentinel=()=>{let sentinel=document.querySelector("[data-sticky-cta-top-sentinel]");return sentinel||(sentinel=document.createElement("span"),sentinel.setAttribute("data-sticky-cta-top-sentinel",""),sentinel.setAttribute("aria-hidden","true"),sentinel.style.cssText="position:absolute;top:200px;left:0;width:1px;height:1px;pointer-events:none;opacity:0;",document.body.appendChild(sentinel),sentinel)},getSettleSentinel=()=>{let sentinel=document.querySelector("[data-sticky-cta-settle-sentinel]");return sentinel||(sentinel=document.createElement("span"),sentinel.setAttribute("data-sticky-cta-settle-sentinel",""),sentinel.setAttribute("aria-hidden","true"),sentinel.style.cssText="position:absolute;top:0;left:0;width:1px;height:1px;pointer-events:none;opacity:0;",document.body.appendChild(sentinel),sentinel)},getLastElement=selector=>{const elements=document.querySelectorAll(selector);return elements.length?elements[elements.length-1]:null},initStickyVisibility=({stickySelector,triggerSelector,alwaysVisible=!1})=>{if(typeof IntersectionObserver>"u")return;const stickyCTA=document.querySelector(stickySelector),trigger=getLastElement(triggerSelector);if(!stickyCTA||!trigger&&!alwaysVisible)return;const existingInstance=stickyVisibilityInstances.get(stickyCTA);existingInstance&&existingInstance.destroy();let triggerVisible=!0,nearTop=(window.scrollY||window.pageYOffset||0)<200,nearFooter=!1,visible=!1,updateFrame=null,positionFrame=null,headerObserver=null;const settleSentinel=getSettleSentinel();let header=getStickyHeader(),settledTop=0,settleDistance=0,settling=!1,scrollBound=!1,lastTop=null;const writeTop=value=>{const next=`${Math.max(value,0)}px`;next!==lastTop&&(lastTop=next,stickyCTA.style.top=next)},positionNow=()=>{if(!header)return writeTop(0);writeTop(settling?header.getBoundingClientRect().bottom-2:settledTop)},schedulePosition=()=>{positionFrame||(positionFrame=window.requestAnimationFrame(()=>{positionFrame=null,positionNow()}))},syncScrollBinding=()=>{const shouldBind=visible&&settling;shouldBind!==scrollBound&&(scrollBound=shouldBind,shouldBind?window.addEventListener("scroll",schedulePosition,{passive:!0}):(window.removeEventListener("scroll",schedulePosition),positionFrame&&(window.cancelAnimationFrame(positionFrame),positionFrame=null)))},measureHeader=()=>{if(!header||header.offsetHeight===0){const resolved=getStickyHeader();resolved!==header&&(header=resolved,observeHeader())}if(!header){settledTop=0,settleDistance=0;return}settledTop=Math.max(header.offsetHeight-2,0),settleDistance=Math.max(getDocumentTop(header),0),settleSentinel.style.height=`${settleDistance+1}px`},updateVisibility=()=>{updateFrame=null;
1const nextVisible=!(alwaysVisible?nearFooter:nearTop||triggerVisible||nearFooter);nextVisible!==visible&&(visible=nextVisible,setStickyDisplay(stickyCTA,visible),syncScrollBinding()),visible&&positionNow()},scheduleVisibilityUpdate=()=>{updateFrame||(updateFrame=window.requestAnimationFrame(updateVisibility))},observeHeader=()=>{headerObserver&&headerObserver.disconnect(),!(!header||typeof ResizeObserver>"u")&&(headerObserver=new ResizeObserver(()=>{measureHeader(),scheduleVisibilityUpdate()}),headerObserver.observe(header))},settleObserver=new IntersectionObserver(entries=>{const nextSettling=entries[entries.length-1].isIntersecting;nextSettling!==settling&&(settling=nextSettling,syncScrollBinding(),scheduleVisibilityUpdate())},{threshold:0}),visibilityObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.target===trigger?triggerVisible=entry.isIntersecting:entry.target.hasAttribute("data-sticky-cta-top-sentinel")?nearTop=entry.isIntersecting||entry.boundingClientRect.top>0:nearFooter=entry.isIntersecting}),scheduleVisibilityUpdate()},{threshold:0});trigger&&visibilityObserver.observe(trigger),alwaysVisible||visibilityObserver.observe(getTopSentinel());const footerImage=document.querySelector(".footer-image"),footerTarget=footerImage?.children.length?footerImage:document.querySelector("footer");footerTarget&&visibilityObserver.observe(footerTarget),measureHeader(),settling=(window.scrollY||window.pageYOffset||0)<=settleDistance,observeHeader(),settleObserver.observe(settleSentinel),updateVisibility(),stickyVisibilityInstances.set(stickyCTA,{destroy(){visibilityObserver.disconnect(),settleObserver.disconnect(),headerObserver&&headerObserver.disconnect(),visible=!1,syncScrollBinding(),updateFrame&&window.cancelAnimationFrame(updateFrame),positionFrame&&window.cancelAnimationFrame(positionFrame)}})},initAll=()=>{document.querySelectorAll(".sticky-product-cta").forEach(initStickyVariantPriceSync)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initAll):initAll(),document.addEventListener("shopify:section:load",initAll),window.initStickyProductCTAVisibility=initStickyVisibility,window.initStickyProductCTAPriceSync=initStickyVariantPriceSync,window.dispatchEvent(new CustomEvent("stickyProductCTA:ready"))})(); 2//# sourceMappingURL=/cdn/shop/t/101/assets/component-sticky-product-cta.js.map?v=147107240254910002561790792148
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.