1const ROOT_SELECTOR="[data-aeocky-pdp]",TABS_ROOT_SELECTOR="[data-aeocky-pdp-tabs]",controllers=new WeakMap,tabsControllers=new WeakMap;class AeockyPdpController{constructor(root){this.root=root,this.panel=root.querySelector("[data-aeocky-pdp-panel]"),this.track=root.querySelector("[data-aeocky-pdp-gallery-track]"),this.mediaQuery=window.matchMedia("(min-width: 1025px)"),this.frame=0,this.resizeObserver=null,this.handleClick=this.handleClick.bind(this),this.handleChange=this.handleChange.bind(this),this.handleVariantChange=this.handleVariantChange.bind(this),this.handleAccessoriesVariantChange=this.handleAccessoriesVariantChange.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.syncTrackHeight=this.syncTrackHeight.bind(this)}connect(){this.root.addEventListener("click",this.handleClick),this.root.addEventListener("change",this.handleChange),this.root.addEventListener("variant:change",this.handleVariantChange),this.root.addEventListener("variant:change",this.handleAccessoriesVariantChange),this.root.addEventListener("submit",this.handleSubmit,!0),this.panel&&this.track&&"ResizeObserver"in window&&(this.resizeObserver=new ResizeObserver(this.syncTrackHeight),this.resizeObserver.observe(this.panel)),window.addEventListener("resize",this.syncTrackHeight),this.mediaQuery.addEventListener?.("change",this.syncTrackHeight),this.mediaQuery.addListener?.(this.syncTrackHeight),this.updateShippingDates(),this.updateAccessoriesSummary(),this.syncTrackHeight()}disconnect(){this.root.removeEventListener("click",this.handleClick),this.root.removeEventListener("change",this.handleChange),this.root.removeEventListener("variant:change",this.handleVariantChange),this.root.removeEventListener("variant:change",this.handleAccessoriesVariantChange),this.root.removeEventListener("submit",this.handleSubmit,!0),this.resizeObserver?.disconnect(),window.removeEventListener("resize",this.syncTrackHeight),this.mediaQuery.removeEventListener?.("change",this.syncTrackHeight),this.mediaQuery.removeListener?.(this.syncTrackHeight),window.cancelAnimationFrame(this.frame)}syncTrackHeight(){window.cancelAnimationFrame(this.frame),this.frame=window.requestAnimationFrame(()=>{if(!this.panel||!this.track||!this.mediaQuery.matches){this.root.style.removeProperty("--ae-pdp-gallery-track-height");return}const height=Math.ceil(this.panel.getBoundingClientRect().height);height>0?this.root.style.setProperty("--ae-pdp-gallery-track-height",`${height}px`):this.root.style.removeProperty("--ae-pdp-gallery-track-height")})}handleClick(event){const coupon=event.target.closest("[data-aeocky-coupon]");if(coupon&&this.root.contains(coupon)){this.copyCoupon(coupon);return}const buyNow=event.target.closest("[data-aeocky-buy-now]");if(buyNow&&this.root.contains(buyNow)){const form=buyNow.closest("form");form&&this.addToCart(form,!0);return}const toggle=event.target.closest("[data-aeocky-accessories-toggle]");toggle&&this.root.contains(toggle)&&this.toggleAccessories(toggle)}handleChange(event){event.target.matches("[data-aeocky-accessory-checkbox]")&&this.updateAccessoriesSummary()}handleVariantChange(){this.updateShippingDates(),this.syncTrackHeight()}handleAccessoriesVariantChange(){this.updateAccessoriesSummary()}handleSubmit(event){const form=event.target;!(form instanceof HTMLFormElement)||!this.root.contains(form)||this.getSelectedAccessoryInputs().length!==0&&(event.preventDefault(),event.stopPropagation(),this.addToCart(form,!1))}async copyCoupon(button){const code=button.getAttribute("data-coupon-code");if(!code)return;try{await navigator.clipboard?.writeText(code)}catch{const textarea=document.createElement("textarea");textarea.value=code,textarea.setAttribute("readonly",""),textarea.style.position="fixed",textarea.style.opacity="0",document.body.append(textarea),textarea.select(),document.execCommand("copy"),textarea.remove()}const label=button.querySelector(".ae-pdp__copy-label"),defaultLabel=button.getAttribute("data-copy-label")||"Copy code",copiedLabel=button.getAttribute("data-copied-label")||"Copied";button.classList.add("is-copied"),label&&(label.textContent=copiedLabel),window.clearTimeout(button.__aeockyCouponTimer),button.__aeockyCouponTimer=window.setTimeout(()=>{button.classList.remove("is-copied"),label&&(label.textContent=defaultLabel)},1800)}toggleAccessories(button){const nextExpanded=!(button.getAttribute("aria-expanded")==="true");button.closest(".ae-pdp__accessories")?.querySelectorAll("[data-aeocky-accessory-extra]").forEach(item=>{item.hidden=!nextExpanded}),button.setAttribute("aria-expanded",String(nextExpanded)),button.textContent=nextExpanded?button.getAttribute("data-expanded-label"):button.getAttribute("data-collapsed-label"),this.syncTrackHeight()}updateShippingDates(){this.root.querySelectorAll("[data-aeocky-shipping-date]").forEach(shippingLine=>{const output=shippingLine.querySelector("[data-aeocky-shipping-date-output]"),delayDays=Number.parseInt(shippingLine.getAttribute("data-shipping-delay-days")||"",10);if(!output||!Number.isFinite(delayDays)||delayDays<0){shippingLine.hidden=!0;return}output.textContent=this.formatShippingDate(this.calculateShippingDate(delayDays))})}calculateShippingDate(delayDays){const date=new Date;date.setHours(12,0,0,0);let remainingDays=Math.max(0,delayDays);for(;remainingDays>0;)date.setDate(date.getDate()+1),this.isWeekend(date)||(remainingDays-=1);for(;this.isWeekend(date);)date.setDate(date.getDate()+1);return date}isWeekend(date){const day=date.getDay();return day===0||day===6}formatShippingDate(date){const locale=document.documentElement.lang||"en-US";try{return new Intl.DateTimeFormat(locale,{weekday:"long",month:"long",day:"numeric"}).format(date)}catch{return date.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})}}updateAccessoriesSummary(){const accessories=this.root.querySelector("[data-aeocky-accessories]");if(!accessories)return;const selected=this.getSelectedAccessoryInputs(),total=selected.reduce((sum,checkbox)=>{const price=Number.parseInt(checkbox.getAttribute("data-price")||"0",10);return sum+(Number.isFinite(price)?price:0)},0),totalTarget=accessories.querySelector("[data-aeocky-accessories-total]"),countTarget=accessories.querySelector("[data-aeocky-accessories-count]");totalTarget&&(totalTarget.textContent=this.formatMoney(total)),countTarget&&(countTarget.textContent=`${selected.length} selected`)}getSelectedAccessoryInputs(){return Array.from(this.root.querySelectorAll("[data-aeocky-accessory-checkbox]:checked:not(:disabled)"))}async addToCart(form,redirectToCheckout){if(!form.checkValidity()){form.reportValidity();return}const formData=new FormData(form),variantId=formData.get("id");if(!variantId)return;const quantity=Number.parseInt(formData.get("quantity")||"1",10),items=[{id:Number(variantId),quantity:Number.isFinite(quantity)&&quantity>0?quantity:1}];
1this.getSelectedAccessoryInputs().forEach(checkbox=>{const accessoryVariantId=Number(checkbox.getAttribute("data-variant-id"));Number.isFinite(accessoryVariantId)&&items.push({id:accessoryVariantId,quantity:1})});const buttons=Array.from(form.querySelectorAll('button[type="submit"], [data-aeocky-buy-now]'));buttons.forEach(button=>button.setAttribute("aria-busy","true"));try{const root=window.Shopify?.routes?.root||"/",sectionsToBundle=["variant-added"];document.documentElement.dispatchEvent(new CustomEvent("cart:prepare-bundled-sections",{bubbles:!0,detail:{sections:sectionsToBundle}}));const response=await fetch(`${root}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({items,sections:sectionsToBundle.join(","),sections_url:`${root}variants/${variantId}`})}),responseJson=await response.json();if(!response.ok)throw new Error(responseJson.description||responseJson.message||"Unable to add item to cart.");if(redirectToCheckout){window.location.href=`${root}checkout`;return}const cartContent=await(await fetch(`${root}cart.js`)).json();cartContent.sections=responseJson.sections||{},form.dispatchEvent(new CustomEvent("variant:add",{bubbles:!0,detail:{items:responseJson.items||[responseJson],cart:cartContent}})),document.documentElement.dispatchEvent(new CustomEvent("cart:change",{bubbles:!0,detail:{baseEvent:"variant:add",cart:cartContent}}))}catch(error){form.dispatchEvent(new CustomEvent("cart:error",{bubbles:!0,detail:{error:error.message}})),document.dispatchEvent(new CustomEvent("cart:refresh"))}finally{buttons.forEach(button=>button.removeAttribute("aria-busy"))}}formatMoney(cents){const currency=this.root.getAttribute("data-money-currency")||"USD",locale=document.documentElement.lang||"en-US";try{return new Intl.NumberFormat(locale,{style:"currency",currency,currencyDisplay:"narrowSymbol"}).format(cents/100)}catch{return`$${(cents/100).toFixed(2)}`}}}class AeockyPdpTabsController{constructor(root){this.root=root,this.tabsSection=root.closest(".shopify-section--product-2026-tabs"),this.headerStyleObserver=null,this.visibilityFrame=null,this.navigationFrame=null,this.handleClick=this.handleClick.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this)}connect(){this.root.addEventListener("click",this.handleClick),this.tabsSection&&(this.headerStyleObserver=new MutationObserver(()=>this.updateHeaderOverlap()),this.headerStyleObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("scroll",this.handleViewportChange,{passive:!0}),window.addEventListener("resize",this.handleViewportChange),this.updateHeaderOverlap())}disconnect(){this.root.removeEventListener("click",this.handleClick),window.removeEventListener("scroll",this.handleViewportChange),window.removeEventListener("resize",this.handleViewportChange),this.headerStyleObserver?.disconnect(),this.visibilityFrame!==null&&window.cancelAnimationFrame(this.visibilityFrame),this.navigationFrame!==null&&window.cancelAnimationFrame(this.navigationFrame),this.tabsSection?.classList.remove("is-hidden-by-header")}handleViewportChange(){this.visibilityFrame===null&&(this.visibilityFrame=window.requestAnimationFrame(()=>{this.visibilityFrame=null,this.updateHeaderOverlap()}))}updateHeaderOverlap(){if(!this.tabsSection)return;const tabsStyles=window.getComputedStyle(this.tabsSection),stickyTop=Number.parseFloat(tabsStyles.top)||0,isStuck=tabsStyles.position==="sticky"&&this.tabsSection.getBoundingClientRect().top<=stickyTop+1,headerIsVisible=window.getComputedStyle(document.documentElement).getPropertyValue("--header-is-visible").trim()!=="0";this.tabsSection.classList.toggle("is-hidden-by-header",isStuck&&headerIsVisible)}handleClick(event){const link=event.target.closest("[data-aeocky-tab-link]");if(!link||!this.root.contains(link))return;const targetHeading=this.normalizeHeading(link.getAttribute("data-target-section-heading")),targetSection=this.findTargetByUrl(link)||this.findSectionByHeading(targetHeading);if(!targetSection)return;event.preventDefault(),document.dispatchEvent(new CustomEvent("aeocky:pdp-navigation-start",{detail:{link,target:target
1Section}}));const targetTop=targetSection.getBoundingClientRect().top+window.scrollY-this.getStickyOffset();window.scrollTo({top:Math.max(0,Math.round(targetTop)),behavior:"auto"}),this.root.querySelectorAll("[data-aeocky-tab-link]").forEach(tabLink=>{tabLink===link?tabLink.setAttribute("aria-current","location"):tabLink.removeAttribute("aria-current")}),this.updateUrlHash(link),this.navigationFrame!==null&&window.cancelAnimationFrame(this.navigationFrame),this.navigationFrame=window.requestAnimationFrame(()=>{this.navigationFrame=window.requestAnimationFrame(()=>{this.navigationFrame=null,document.dispatchEvent(new CustomEvent("aeocky:pdp-navigation-end",{detail:{link,target:targetSection}}))})})}findTargetByUrl(link){const href=link.getAttribute("href");if(!href||href==="#")return null;try{const url=new URL(href,window.location.href);return url.origin!==window.location.origin||url.pathname!==window.location.pathname||url.search!==window.location.search||!url.hash?null:document.getElementById(decodeURIComponent(url.hash.slice(1)))}catch{return null}}updateUrlHash(link){try{const url=new URL(link.href,window.location.href);url.origin===window.location.origin&&url.pathname===window.location.pathname&&url.search===window.location.search&&url.hash&&window.history.replaceState(window.history.state,"",`${url.pathname}${url.search}${url.hash}`)}catch{}}getStickyOffset(){if(!this.tabsSection)return 0;const stickyTop=Number.parseFloat(window.getComputedStyle(this.tabsSection).top)||0;return Math.max(0,stickyTop)+this.tabsSection.getBoundingClientRect().height+12}findSectionByHeading(targetHeading){if(!targetHeading)return null;const main=this.root.closest("main")||document.querySelector("main");if(!main)return null;const sections=Array.from(main.querySelectorAll(".shopify-section")).filter(section=>!section.parentElement?.closest(".shopify-section")),currentSection=this.root.closest(".shopify-section"),currentIndex=sections.indexOf(currentSection);return(currentIndex>=0?sections.slice(currentIndex+1):sections).find(section=>Array.from(section.querySelectorAll("h1, h2, h3, h4, h5, h6, [role='heading']")).some(heading=>this.normalizeHeading(heading.textContent)===targetHeading))||null}normalizeHeading(value){return(value||"").replace(/\s+/g," ").trim().toLocaleLowerCase()}}function init(container=document){const roots=[];container.matches?.(ROOT_SELECTOR)&&roots.push(container),roots.push(...container.querySelectorAll?.(ROOT_SELECTOR)||[]),roots.forEach(root=>{if(controllers.has(root))return;const controller=new AeockyPdpController(root);controllers.set(root,controller),controller.connect()});const tabsRoots=[];container.matches?.(TABS_ROOT_SELECTOR)&&tabsRoots.push(container),tabsRoots.push(...container.querySelectorAll?.(TABS_ROOT_SELECTOR)||[]),tabsRoots.forEach(root=>{if(tabsControllers.has(root))return;const controller=new AeockyPdpTabsController(root);tabsControllers.set(root,controller),controller.connect()})}function destroy(container){const roots=[];container.matches?.(ROOT_SELECTOR)&&roots.push(container),roots.push(...container.querySelectorAll?.(ROOT_SELECTOR)||[]),roots.forEach(root=>{const controller=controllers.get(root);controller&&(controller.disconnect(),controllers.delete(root))});const tabsRoots=[];container.matches?.(TABS_ROOT_SELECTOR)&&tabsRoots.push(container),tabsRoots.push(...container.querySelectorAll?.(TABS_ROOT_SELECTOR)||[]),tabsRoots.forEach(root=>{const controller=tabsControllers.get(root);controller&&(controller.disconnect(),tabsControllers.delete(root))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>init()):init(),document.addEventListener("shopify:section:load",event=>init(event.target)),document.addEventListener("shopify:section:unload",event=>destroy(event.target)); 2//# sourceMappingURL=/cdn/shop/t/53/assets/aeocky-pdp.js.map?v=39995667489173993561790162140
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.