PageSourceSearch

https://www.aimn.co.nz/cdn/shop/t/132/assets/quickshop.js?v=112813797303856453551790672546

js aimn.co.nz collected 2026-10-04 13:28:30 UTC 27,034 bytes, 118 lines download raw bytes

1function quickshopCnvString(key,fallback){const s=window.theme&&window.theme.strings&&window.theme.strings[key];return typeof s=="string"&&s.length?s:fallback}function bindSkuListAddToCartButtons(){document.querySelectorAll(".quickshop .sku-container-new .sku-item, .template-cart .nosto-list-item .sku-item, .sku-list-new .sku-item").forEach(item=>{item.hasAttribute("data-listener-added")||(item.setAttribute("data-listener-added","true"),item.addEventListener("click",()=>{const variantId=item.getAttribute("data-variant-id");fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:variantId,quantity:1})}).then(response=>response.json()).then(data=>{if(document.dispatchEvent(new Event("cart:build")),!document.querySelector("#cnv-cart-popup-style")){const style=document.createElement("style");style.id="cnv-cart-popup-style",style.textContent=`
2    .cnv-cart-popup {
3      position: fixed;
4      align-items: center;
5      justify-content: center;
6      flex-direction: row-reverse;
7      gap: 2px;
8      top: 20px;
9      right: 20px;
10      background: #fff;
11      border: 1px solid #ddd;
12      box-shadow: 0 4px 16px rgba(0,0,0,0.15);
13      border-radius: 4px;
14      padding: 12px;
15      max-width: 300px;
16      z-index: 9999;
17      display: none;
18      opacity: 0;
19      transition: opacity 0.3s ease, transform 0.3s ease;
20      transform: translateY(-10px);
21      font-family: inherit;
22    }
23    .cnv-cart-popup.show {
24      display: flex;
25      opacity: 1;
26      transform: translateY(0);
27    }
28    .cnv-cart-popup img {
29      width: 60px;
30      height: auto;
31      float: left;
32      margin-right: 10px;
33      border-radius: 2px;
34    }
35    .cnv-cart-popup .details {
36      overflow: hidden;
37      font-size: 12px;
38    }
39    .cnv-cart-popup .title {
40      font-weight: 400;
41      margin-bottom: 4px;
42    }
43    .cnv-cart-popup .checkout-btn {
44      display: block;
45      text-align: center;
46      margin-top: 10px;
47      background: #000;
48      color: #fff;
49      padding: 10px;
50      font-weight: 600;
51      text-decoration: none;
52    }
53    .cnv-cart-popup .close-btn {
54      position: relative;
55      background: none;
56      border: none;
57      font-size: 18px;
58      line-height: 1;
59      cursor: pointer;
60      color: #999;
61      padding: 4px;
62      width: 24px;
63      height: 24px;
64      display: flex;
65      align-items: center;
66      justify-content: center;
67    }
68    .cnv-cart-popup .close-btn:hover {
69      color: #333;
70    }
71  `,document.head.appendChild(style)}const popup=document.createElement("div");popup.className="cnv-cart-popup",document.body.appendChild(popup);function closePopup(){popup.classList.remove("show"),setTimeout(()=>popup.style.display="none",300)}fetch("/cart.js",{headers:{Accept:"application/json"}}).then(r=>r.json()).then(cart=>{if(!cart||!cart.items?.length)return;const cartItem=cart.items[0],popupLine=quickshopCnvString("cnvCartPopupLine","[product_title] added to cart.").replace("[product_title]",String(cartItem.product_title||"")),closeLabel=quickshopCnvString("cnvCartPopupClose","Close");popup.innerHTML=`
72      <button class="close-btn" aria-label="${closeLabel}">\xD7</button>
73      <div class="details">
74        <div class="title">${popupLine}</div>
75      </div>
76    `,popup.querySelector(".close-btn").addEventListener("click",closePopup),popup.style.display="block",requestAnimationFrame(()=>popup.classList.add("show")),setTimeout(closePopup,5e3)}).catch(console.error)}).catch(error=>{console.error("Error adding to cart:",error)})}))})}document.addEventListener("DOMContentLoaded",()=>{function updateProductHandles(){const elements=document.querySelectorAll(".nosto-recs-template-last .nosto-bottom-bar [data-product-handle]");elements.length&&elements.forEach(element=>{const fullUrl=element.getAttribute("data-product-handle");if(fullUrl){const cleanHandle=fullUrl.split("?")[0].split("/").pop();element.setAttribute("data-product-handle",cleanHandle)}})}function hideQuickShopBadges(){document.querySelectorAll(".quickshop .product-badges").forEach(container=>{const badges=container.querySelectorAll(".badge");if(badges.length>1){let highestZIndex=-1/0,highestZIndexBadge=null;
76badges.forEach(badge=>{const zIndex=parseInt(window.getComputedStyle(badge).zIndex);!isNaN(zIndex)&&zIndex>highestZIndex&&(highestZIndex=zIndex,highestZIndexBadge=badge)}),badges.forEach(badge=>{badge!==highestZIndexBadge&&(badge.style.opacity="0")})}})}function checkElementsLoaded(){const elements=document.querySelectorAll(".nosto-recs-template-last .nosto-bottom-bar");elements.length&&Array.from(elements).every(el=>el.offsetParent!==null)?(updateProductHandles(),window._swat.fetch(function(r){window.myWishList=r,window.myWishList.length>0?document.querySelector(".wishlist-link__bubble").classList.add("wishlist-link__bubble--visible"):document.querySelector(".wishlist-link__bubble").classList.remove("wishlist-link__bubble--visible");const wishlistButtons=document.querySelectorAll(".wishlist");wishlistButtons.length!=0&&wishlistButtons.forEach(function(button){const empi=button.getAttribute("data-empi"),epi=button.getAttribute("data-epi");if(empi||epi){if(window.myWishList.filter(i=>i.empi==empi||i.epi==epi).length==0)return;button.classList.add("is-saved")}})})):requestAnimationFrame(checkElementsLoaded)}checkElementsLoaded();function reinitializeQuickShopSliders(){setTimeout(()=>{document.querySelectorAll(".quickshop .product-single__color-variants").forEach(sli
76der=>{if(slider.querySelectorAll(".quickshop .product-single__color-variant").length>4){const qsflickityInstance=Flickity.data(slider);qsflickityInstance&&qsflickityInstance.destroy(),new Flickity(slider,{cellAlign:"left",contain:!0,pageDots:!1,prevNextButtons:!0,draggable:!0})}}),document.querySelectorAll(".quickshop .product-slideshow").forEach(slider=>{const initialHeight=slider.scrollHeight;slider.style.minHeight=initialHeight+"px";const existingInstance=Flickity.data(slider);existingInstance&&existingInstance.destroy();const flkty=new Flickity(slider,{cellAlign:"left",contain:!0,pageDots:!1,prevNextButtons:!1,draggable:!0});setTimeout(()=>{flkty.on("settle",()=>{slider.style.minHeight=""}),flkty.on("ready",()=>{slider.style.minHeight=""})},1e3)}),document.querySelectorAll(".template-product .product-badges, .quickshop .product-badges").forEach(container=>{const badges=container.querySelectorAll(".badge");if(badges.length>1){let highestZIndex=-1/0,highestZIndexBadge=null;badges.forEach(badge=>{const zIndex=parseInt(window.getComputedStyle(badge).zIndex);!isNaN(zIndex)&&zIndex>highestZIndex&&(highestZIndex=zIndex,highestZIndexBadge=badge)}),badges.forEach(badge=>{badge!==highestZIndexBadge&&(badge.style.opacity="0")})}})},300)}function initializeQuickShop(){document.querySelectorAll(".mobile-atc-size-drawer").forEach(button=>{button.hasAttribute("data-quickshop-initialized")||(button.setAttribute("data-quickshop-initialized","true"),button.addEventListener("pointerdown",async event=>{console.log("wowza"),event.preventDefault(),document.getElementById("quickshop").classList.add("open");const productHandle=button.getAttribute("data-product-handle");if(!productHandle){console.error("Product handle not found.");return}try{const response=await fetch(`/products/${productHandle}?view=ajax`);if(!response.ok)throw new Error("Failed to fetch product page.");const productHTML=await response.text(),ccartNostoCart=document.querySelector(".js-drawer-open-cart"),drawerContent=document.querySelector(".quickshop");if(drawerContent){let updateProductDetails2=function(productUrl){const newTitle=document.querySelector(".quickshop .product-single__title").textContent;document.title=newTitle,initNoDrawerCheckoutCTA()},onVariantChange2=function({target:optionValueElement}){const productElement=document.querySelector(".quickshop .combined-product"),sectionId=document.querySelector(".quickshop #productSection").dataset.sectionId,oldProductUrl=productElement.dataset.productUrl,newProductUrl=optionValueElement.dataset.productUrl,productUrl=newProductUrl||oldProductUrl,newVariantId=optionValueElement.dataset.variantId;let params=`section_id=${sectionId}&`;if(newVariantId)params+=`variant=${newVariantId}`;else{const selectedOptionValues=Array.from(document.querySelectorAll(".quickshop fieldset input:checked")).map(element=>element.dataset.optionValueId).join(",");params+=`option_values=${selectedOptionValues}`}document.querySelectorAll(".quickshop variant-input").forEach(div=>div.classList.remove("selected")),document.querySelectorAll('.quickshop input[type="radio"]').forEach(input=>input.classList.remove("selected")),optionValueElement.classList.add("selected"),optionValueElement.closest(".variant-input").classList.add("selected"),fetch(`${productUrl}?${params}`).then(response2=>response2.text()).then(responseText=>{const html=new DOMParser().parseFromString(responseText,"text/html");if(newProductUrl&&oldProductUrl!==newProductUrl){if(productElement.parentNode.insertBefore(html.querySelector(".combined-product"),productElement),productElement.remove(),updateProductDetails2(newProductUrl),reinitializeQuickShopSliders(),typeof window.cleanupPdpLengthNoticeOrphans=="function"&&window.cleanupPdpLengthNoticeOrphans(),typeof window.initPdpLengthNoticeIn=="function"){var cpLenQs=document.querySelector(".quickshop .combined-product");cpLenQs&&window.initPdpLengthNoticeIn(cpLenQs)}document.querySelectorAll(".quickshop .size-selector-button").forEach(function(button2){button2.addEventListener("click",function(){theme.SizeGuideModal.open()})}),document.querySelector(`#${optionValueElement.id}`).focus(),window.theme&&typeof window.theme.initPdpWishlist=="function"&&window.theme.initPdpWishlist(document.querySelector(".quickshop")),initNoDrawerCheckoutCTA();return}if(document.querySelector(".quickshop .optionValueSelectors").innerHTML=html.querySelector(".optionValueSelectors").innerHTML,typeof window.cleanupPdpLengthNoticeOrphans=="function"&&window.cleanupPdpLengthNoticeOrphans(),typeof window.initPdpLengthNoticeIn=="function"){var ovsLenQs=document.querySelector(".quickshop .optionValueSelectors");ovsLenQs&&window.initPdpLengthNoticeIn(ovsLenQs)}document.querySelector(`#${optionValueElement.id}`).focus();const priceEl=document.querySelector(".quickshop .product__price");html.querySelector(".product__price")?priceEl.innerHTML=html.querySelector(".product__price").innerHTML:priceEl.innerHTML="",document.querySelectorAll(".quickshop .size-selector-button").forEach(function(button2){button2.addEventListener("click",function(){theme.SizeGuideModal.open()})});const addToCartForm=document.querySelector(".quickshop .product-form"),newVariantInput=html.querySelector('.product-form input[name="id"]');if(addToCartForm&&newVariantInput){const hiddenId=addToCartForm.querySelector('input[name="id"]');hiddenId&&(hiddenId.value=newVariantInput.value)}window.theme&&typeof window.theme.updatePdpWishlistFromHtml=="function"&&window.theme.updatePdpWishlistFromHtml(document.querySelector(".quickshop"),html)})};var updateProductDetails=updateProductDetails2,onVariantChange=onVariantChange2;const headerHTML=`
77               <div class="quickshop-header">
78                    <div class="drawer__close">
79                      <button type="button" class="drawer__close-button js-drawer-close">
80                        <svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-close" xmlns="http://www.w3.org/2000/svg" width="19.799" height="19.799" viewBox="0 0 19.799 19.799">
81                          <g id="Group_4" data-name="Group 4" transform="translate(0.707 0.707)">
82                            <line id="Line_1" data-name="Line 1" x2="26" transform="translate(0 0) rotate(45)" fill="none" stroke="#222" stroke-width="2"/>
83                            <line id="Line_2" data-name="Line 2" x2="26" transform="translate(0 18.385) rotate(-45)" fill="none" stroke="#222" stroke-width="2"/>
84                          </g>
85                        </svg>
86                        <span class="icon__fallback-text">{{ 'cart.general.close_cart' | t }}</span>
87                      </button>
88                    </div>
89                    <div class="h1 site-header__logo" itemscope="" itemtype="https://schema.org/Organization" aria-label="to homepage">
90                      <a href="/" itemprop="url" class="site-header__logo-link">
91                        <svg xmlns="http://www.w3.org/2000/svg" width="98.439" height="26" viewBox="0 0 404.29 98.61"><polygon points="95.05 8.05 112.93 8.05 112.93 98.44 95.05 98.22 95.05 8.05" fill="currentColor"></polygon><path d="M336.18,243h17.93v9.27s9.48-9.54,26.66-9.44c22.42-.1,36,17.86,36,17.86s10.6-17.86,36.25-17.86c37.4,0,43.08,35.8,43.08,36.89v53.66H479l0-49.62s-.95-22.95-26-22.9c-24.85,0-27.52,22.9-27.52,22.9v49.61H407.67l-.06-49.62s-2.37-22.95-26.76-22.9c-24.16,0-26.74,22.9-26.74,22.9l-.06,49.62H336.18Z" transform="translate(-218.18 -234.99)" fill="currentColor"></path><path d="M306.88,243l-.05,90.39h-18v-8s-13.35,9.15-26.26,8c-1.1-.11-43.47,1.11-44.35-47.13C218,245.49,258.12,243,258.12,243Zm-45.12,17.82s-25.49-2.35-25.71,25.51c1.8,29.34,26.81,28.7,26.81,28.7s22.95,1.9,25.91-21.78V260.86Z" transform="translate(-218.18 -234.99)" fill="currentColor"></path><path d="M501.08,243.1H519v9.27s9.48-9.54,26.66-9.44c22.42-.1,36,17.86,36,17.86a38.24,38.24,0,0,1,8.73,23.07c0,1.76,0,49.61,0,49.61H572.57l-.06-49.62s-2.37-22.95-26.76-22.9c-24.16,0-26.74,22.9-26.74,22.9L519,333.48H501.08Z" transform="translate(-218.18 -234.99)" fill="currentColor"></path><path d="M495.61,235l-16.31,0,0,8.81a39.37,39.37,0,0,1,8.22,7.26c1.49,1.82,2.34,1.43,8.07,12.58Z" transform="translate(-218.18 -234.99)" fill="currentColor"></path><path d="M591.18,258.69c0-9.11,6.49-15.76,15.68-15.76s15.6,6.65,15.6,15.76-6.49,15.83-15.6,15.83S591.18,267.8,591.18,258.69Zm4.31,0c0,6.85,4.38,11.65,11.3,11.65s11.37-4.8,11.37-11.65S613.64,247,606.79,247,595.49,251.84,595.49,258.69Zm14.69,1.7,4.33,6.41-4.87.08-3.71-6.18h-1.31v6.18h-4v-16.6H608c3.47,0,5.79,2,5.79,5.17A4.92,4.92,0,0,1,610.18,260.39Zm-5.56-6.49v3.48h3.17a1.77,1.77,0,0,0,2-1.78c0-1.23-.93-1.7-2-1.7Z" transform="translate(-218.18 -234.99)" fill="currentColor"></path></svg> 
92                      </a>
93                    </div>
94                    <div class="drawer__empty-right"></div>
95                </div>
96            `;drawerContent.innerHTML=headerHTML+productHTML,window.theme&&typeof window.theme.initQuickshopWishlist=="function"&&window.theme.initQuickshopWishlist(drawerContent),reinitializeQuickShopSliders(),hideQuickShopBadges(),lipscore.reInitWidgets(),document.querySelectorAll(".size-selector-button").forEach(function(button2){button2.addEventListener("click",function(){theme.SizeGuideModal.open()})});const closeButton=document.querySelector(".quickshop-header .drawer__close-button");closeButton&&closeButton.addEventListener("click",()=>{const quickshop=document.querySelector(".quickshop");quickshop&&(quickshop.innerHTML="",quickshop.style.display="none");const existingOverlay=document.querySelector(".quickshop-overlay");existingOverlay&&existingOverlay.remove()});const overlay=document.createElement("div");overlay.className="quickshop-overlay",overlay.style.cssText=`
97              width: 100%;
98              height: 100%;
99              position: fixed;
100              background: black;
101              left: 50%;
102              z-index: 1;
103              top: 50%;
104              transform: translate(-50%, -50%);
105              opacity: 0.3;
106            `,document.body.appendChild(overlay);const closeQuickShop=()=>{const quickshop=document.querySelector(".quickshop");quickshop&&(quickshop.innerHTML="",quickshop.style.display="none");const existingOverlay=document.querySelector(".quickshop-overlay");existingOverlay&&existingOverlay.remove()};overlay.addEventListener("click",closeQuickShop),drawerContent.style.display="flex",document.querySelectorAll(".quickshop .variant-input").forEach(input=>{input.addEventListener("click",()=>{document.querySelectorAll(".quickshop .variant-input").forEach(el=>{el.classList.remove("var-inpt-selected")}),input.classList.add("var-inpt-selected")})});const quickshopproductSection=document.querySelector(".quickshop #productSection");quickshopproductSection&&quickshopproductSection.addEventListener("change",onVariantChange2),initNoDrawerCheckoutCTA()}}catch(error){console.error("Error loading product page:",error)}}))})}new MutationObserver((mutationsList,observer2)=>{document.querySelectorAll(".mobile-atc-size-drawer").length>0&&setTimeout(initializeQuickShop,500),mutationsList.forEach(mutation=>{mutation.type==="childList"&&mutation.addedNodes.length>
1060&&(mutation.addedNodes.forEach(node=>{node.nodeType===1&&(node.matches&&node.matches(".mobile-atc-size-drawer")||node.querySelectorAll&&node.querySelectorAll(".mobile-atc-size-drawer").length>0)&&setTimeout(initializeQuickShop,500)}),setTimeout(()=>{bindSkuListAddToCartButtons(),setTimeout(()=>{document.querySelectorAll(".nosto-list-item .colorVariantCount").forEach(element=>{if(!element.hasAttribute("data-count-updated")){element.setAttribute("data-count-updated","true");const colorCount=(element.textContent||"").split("|").length;colorCount>1?element.textContent=`Colors +${colorCount-1}`:element.textContent=""}})},600)},600))})}).observe(document.body,{childList:!0,subtree:!0}),bindSkuListAddToCartButtons()});function updateSniffieOmnibusPrice(variantId){fetch(`/products/{{ product.handle }}?variant=${variantId}`).then(response=>response.text()).then(html=>{const srcBlocks=new DOMParser().parseFromString(html,"text/html").querySelectorAll(".sniffie-omnibus-price"),destBlocks=document.querySelectorAll(".sniffie-omnibus-price");!srcBlocks.length||!destBlocks.length||srcBlocks.forEach((src,i)=>{destBlocks[i]&&(destBlocks[i].innerHTML=src.innerHTML)})}).catch(error=>{console.error("Error updating sniffie omnibus price:",error)})}function initNoDrawerCheckoutCTA(){(function(){const VER="CNV-PDP NoDrawer Checkout CTA v1.6 (Nosto moves after ATC under .under-atc-text)";if(window.__cnvNoDrawerCheckoutCTA_v16){console.warn(`[${VER}] already applied`);return}window.__cnvNoDrawerCheckoutCTA_v16=!0;const q=(s,r=document)=>r.querySelector(s),qa=(s,r=document)=>Array.prototype.slice.call(r.querySelectorAll(s)),on=(el,ev,fn,opts)=>el&&el.addEventListener(ev,fn,opts||!1),FORM_SEL='.product-form, .product-single__form, form[action="/cart/add"]';(function(){if(q("#cnv-nodrawer-style"))return;const css=`
107      #cnv-checkout-cta { display:none; width:100%; clear:both; margin-top:10px; overflow:hidden; transition:max-height .25s ease; }
108      #cnv-checkout-cta.cnv-open { display:block; max-height:160px; }
109      #cnv-checkout-cta:not(.cnv-open) { max-height:0; }
110      #cnv-checkout-cta .cnv-checkout-btn {
111        display:block; width:100%; text-align:center;
112        background:#000; color:#fff; border:0; border-radius:0px;
113        padding:14px 16px; font-weight:600; cursor:pointer; text-decoration:none;
114      }
115      #cnv-checkout-cta .cnv-checkout-btn:focus { outline:2px solid #111; outline-offset:2px; }
116      .cnv-nosto-below-cta { width:100% !important; display:block !important; clear:both !important; }
117    `,s=document.createElement("style");s.id="cnv-nodrawer-style",s.textContent=css,document.head.appendChild(s)})();function getCheckoutHref(){const candidates=['#CartDrawer a[href*="/check"]','.ajaxcart__checkout[href*="/check"]','.mini-cart a[href*="/check"]','.cart__checkout[href*="/check"]','a.btn--checkout[href*="/check"]','a[href^="/checkout"]'];for(const sel of candidates){const a=q(sel);if(a&&a.getAttribute("href"))return a.getAttribute("href")}return"/cart"}function ensureCheckoutCTA(){const btnWrap=q(".pdp-button-container")||q(FORM_SEL);if(!btnWrap)return null;let cta=q("#cnv-checkout-cta",btnWrap)||q("#cnv-checkout-cta");if(!cta||cta&&cta.parentElement!==btnWrap){if(cta&&cta.parentElement!==btnWrap)btnWrap.appendChild(cta);else if(!cta){cta=document.createElement("div"),cta.id="cnv-checkout-cta";const a=document.createElement("a");a.className="cnv-checkout-btn",a.textContent=quickshopCnvString("cnvCheckoutCta","Go to checkout"),a.href=getCheckoutHref(),a.rel="nofollow",cta.appendChild(a),btnWrap.appendChild(cta)}}else{const a=cta.querySelector(".cnv-checkout-btn");a&&(a.href=getCheckoutHref())}return cta}function revealCheckoutCTA(){const cta=ensureCheckoutCTA();if(cta){const a=cta.querySelector(".cnv-checkout-btn");a&&(a.href=getCheckoutHref()),cta.classList.add("cnv-open")}}function getCandidateNostoEls(){const found=(typeof window.theme<"u"&&typeof window.theme.getNostoMoveUnderCtaSelectors=="function"?window.theme.getNostoMoveUnderCtaSelectors():["#productpage_nosto_8","#productpage-nosto-8","#productpage-nosto_2","#pdp-rec-bundle-1",".nosto_element#pdp-rec-bundle-1","#pdp-rec-1","#pdp-rec-3","#pdp-rec-4","#pdp-rec-5",".n
117osto_element#productpage_nosto_8",".nosto_element#productpage-nosto-2"]).map(sel=>q(sel)).filter(Boolean);return qa(".product-single__meta .nosto_element").forEach(el=>{found.includes(el)||found.push(el)}),found}function nostoHasContent(root){if(!root)return!1;const sel=[".nosto-list-item",".nosto-product",".product, .grid-product, .product-card","img[src], img[data-src], img[data-srcset]",'a[href*="/products/"]'].join(",");return root.querySelector(sel)?!0:(root.textContent||"").replace(/\s+/g," ").trim().length>80}function moveNostoUnderATCTextWhenReady(timeoutMs=15e3){const underAtc=q(".under-atc-text");if(!underAtc)return;const nostos=getCandidateNostoEls();if(!nostos.length)return;const doMove=el=>{el&&(el.classList.add("cnv-nosto-below-cta"),underAtc.insertAdjacentElement("afterend",el))},ready=nostos.find(n=>nostoHasContent(n));if(ready){doMove(ready);return}const observers=[],stopAll=()=>observers.forEach(o=>o.disconnect());nostos.forEach(nosto=>{const obs=new MutationObserver(()=>{nostoHasContent(nosto)&&(stopAll(),doMove(nosto))});obs.observe(nosto,{childList:!0,subtree:!0}),observers.push(obs)}),setTimeout(stopAll,timeoutMs)}function getCurrentVariantId(scope=document){let cand=scope.querySelector('input[type="radio"][data-variant-id].selected')||scope.querySelector('input[type="radio"][data-variant-id]:checked');if(cand&&cand.getAttribute("data-variant-id"))return cand.getAttribute("data-variant-id");const checked=scope.querySelector('input[type="radio"]:checked');if(checked){const wrapper=checked.closest(".variant-input");if(wrapper&&wrapper.getAttribute("data-variant-id"))return wrapper.getAttribute("data-variant-id")}const selWrap=scope.querySelector(".variant-input.selected");if(selWrap&&selWrap.getAttribute("data-variant-id"))return selWrap.getAttribute("data-variant-id");const sel=scope.querySelector('select[name="id"]');if(sel&&sel.value)return sel.value;const hidden=scope.querySelector('input[name="id"]');return hidden&&hidden.value?hidden.value:null}function syncVariantIdIntoForm(form){if(!form)return null;const current=getCurrentVariantId(form)||getCurrentVariantId(document);if(!current)return null;const hidden=form.querySelector('input[name="id"]'),select=form.querySelector('select[name="id"]');return hidden&&hidden.value!==String(current)&&(hidden.value=String(current)),select&&select.value!==String(current)&&(select.value=String(current)),String(current)}function setATCStateSuccess(form){const atcBtn=form.querySelector('.add-to-cart, .combined-atc-btn, button[name="add"]');if(!atcBtn)return;const txt=atcBtn.querySelector('[id^="AddToCartText-"]')||atcBtn;atcBtn.classList.add("cnv-atc-success");const original=txt.getAttribute("data-default-text")||quickshopCnvString("cnvAddToCartDefault","Add to cart");txt.setAttribute("data-original-text",original),txt.textContent=quickshopCnvString("cnvAddedToCart","Added")}function resetATCState(form){const atcBtn=form&&form.querySelector('.add-to-cart, .combined-atc-btn, button[name="add"]');if(!atcBtn)return;atcBtn.classList.remove("cnv-atc-success");const txt=atcBtn.querySelector('[id^="AddToCartText-"]')||atcBtn,def=(txt.getAttribute("data-default-text")||txt.getAttribute("data-original-text")||quickshopCnvString("cnvAddToCartDefault","Add to cart")).trim();txt.textContent=def;const cta=ensureCheckoutCTA();cta&&cta.classList.remove("cnv-open")}function refreshCartQuietly(){try{fetch("/cart.js",{headers:{Accept:"application/json"}}).then(r=>r.ok?r.json():null).then(cart=>{cart&&(document.dispatchEvent(new CustomEvent("cart:refresh",{detail:{cart}})),document.dispatchEvent(new CustomEvent("cart:build",{detail:{cart}})))}).catch(()=>{})}catch{}}let guardUntil=0;function armDrawerGuard(ms=5e3){guardUntil=Date.now()+ms}const CART_OPEN_SEL=[".js-drawer-open-cart",'[data-action="open-drawer"]','[data-drawer="cart"]','[data-drawer-trigger="cart"]',".cart-toggle",".header-cart",".site-header__cart-toggle"].join(",");on(document,"click",function(e){e.target&&e.target.closest&&e.target.closest(CART_OPEN_SEL)&&Date.now()<guardUntil&&(e.preventDefault(),e.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation())},!0),on(document,"submit",function(e){const form=e.target;if(!form||!form.matches(FORM_SEL))return;e.preventDefault(),e.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation();const currentVariantId=syncVariantIdIntoForm(form);
117if(!currentVariantId)return;armDrawerGuard(5e3);const atcBtn=form.querySelector('.add-to-cart, .combined-atc-btn, button[name="add"]');atcBtn&&(atcBtn.disabled=!0,atcBtn.setAttribute("aria-busy","true"));const fd=new FormData(form);fd.set("id",String(currentVariantId)),fetch("/cart/add.js",{method:"POST",body:fd,headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}}).then(r=>{if(!r.ok)throw new Error("Add to cart failed");return r.json()}).then(()=>{setATCStateSuccess(form),revealCheckoutCTA(),moveNostoUnderATCTextWhenReady(),refreshCartQuietly()}).catch(err=>{console.error("[NoDrawer] ATC error",err)}).finally(()=>{atcBtn&&(atcBtn.disabled=!1,atcBtn.removeAttribute("aria-busy"))})},!0),(function(){const root=q("#productSection")||q(".combined-product")||q(".product-single__meta")||document.documentElement;new MutationObserver(()=>{const form=q(FORM_SEL);form&&syncVariantIdIntoForm(form),ensureCheckoutCTA()}).observe(root,{childList:!0,subtree:!0})})(),(function(){const container=q("#productSection")||q(".product-single__meta")||document;on(container,"change",function(e){if(e.target&&e.target.matches('input[type="radio"], select')){const form=q(FORM_SEL);syncVariantIdIntoForm(form),resetATCState(form),ensureCheckoutCTA()}},!0),on(document,"variant:change",function(){const form=q(FORM_SEL);syncVariantIdIntoForm(form),resetATCState(form),ensureCheckoutCTA()}),on(document,"variantSwitched",function(){const form=q(FORM_SEL);syncVariantIdIntoForm(form),resetATCState(form),ensureCheckoutCTA()})})(),(function(){const form=q(FORM_SEL);form&&syncVariantIdIntoForm(form),ensureCheckoutCTA()})()})()}
118//# sourceMappingURL=/cdn/shop/t/132/assets/quickshop.js.map?v=112813797303856453551790672546

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.