1const s={addToCart:".js-add-to-cart",optionSelect:".js-product-option",variantsJson:".js-product-variants",optionWrapper:".js-option-wrapper",currentValue:".js-current-value"};class p extends HTMLElement{constructor(){super(),this.eventListeners=[]}connectedCallback(){this.initializeVariantChange(),this.initializeAddToCart()}disconnectedCallback(){this.cleanup()}cleanup(){this.eventListeners.forEach(({element:t,event:e,handler:n})=>{t.removeEventListener(e,n)}),this.eventListeners=[]}addEventListenerWithCleanup(t,e,n){t.addEventListener(e,n),this.eventListeners.push({element:t,event:e,handler:n})}getSectionsToRender(){return["cart-drawer","cart-icon-bubble","cart-icon-bubble-mobile","cart-icon-bubble-animation"]}updateCurrentValue(t){const e=t.closest(s.optionWrapper),n=e==null?void 0:e.querySelector(s.currentValue);n&&(n.textContent=t.value)}initializeVariantChange(){const t=this.querySelectorAll(s.optionSelect),e=this.querySelector(s.addToCart),n=this.querySelector(s.variantsJson);if(!t.length||!e||!n)return;const d=JSON.parse(n.textContent),i=()=>Array.from(t).map(a=>a.value),c=a=>d.find(o=>o.options.every((l,u)=>l===a[u])),r=()=>{const a=i(),o=c(a);o?(e.dataset.variantId=o.id,e.disabled=!o.available):e.disabled=!0};t.forEach(a=>{const o=()=>{this.updateCurrentValue(a),r()};this.addEventListenerWithCleanup(a,"change",o),this.updateCurrentValue(a)}),r()}initializeAddToCart(){const t=this.querySelector(s.addToCart),e=document.querySelector("cart-drawer");if(!t)return;let n=!1;const d=()=>{if(n)return;let i=t.dataset.variantId;if(i||(i=t.getAttribute("data-variant-id")),!i){console.error("No variant ID found");return}n=!0,t.disabled=!0,t.classList.add("is-loading");const c={items:[{id:i,quantity:1}],sections:this.getSectionsToRender().join(",")};fetch(window.Shopify.routes.root+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).then(r=>r.json()).then(r=>{e&&r.sections&&e.renderContents(r,!0),window.updateCartIconBadge&&r.item_count!==void 0&&window.updateCartIconBadge(r),document.dispatchEvent(new CustomEvent("cart:item-added",{detail:{item:r,itemCount:r.item_count}})),console.log("this.closest(.js-nosto-carousel-wrapper)",this.closest(".js-nosto-carousel-wrapper")),this.closest(".js-nosto-carousel-wrapper")&&window.Nosto&&window.Nosto.reloadCart()}).catch(r=>{console.error("Add to cart error:",r)}).finally(()=>{n=!1,t.disabled=!1,t.classList.remove("is-loading")})};this.addEventListenerWithCleanup(t,"click",d)}}customElements.define("card-product-small",p);
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.