1if(!customElements.get("product-item")){class a extends HTMLElement{constructor(){super();this.getAttribute("data-product-id");const t=this.getAttribute("data-product-title"),e=this.querySelector(".product-item__compare input"),a=this.querySelector("[data-compare-remove]");this.atc_button=this.querySelector(".product-item__atc"),this.atc_button&&this.addToCartInit(),e&&e.addEventListener("change",()=>{window.dispatchEvent(new CustomEvent("compareProduct",{detail:{id:e.value,title:t,checked:e.checked,image:this.querySelector(".media img").getAttribute("src")}}))}),a&&a.addEventListener("click",()=>{window.dispatchEvent(new CustomEvent("compareRemove",{detail:{id:a.getAttribute("data-compare-remove")}}))})}addToCartInit(){this.atc_button.addEventListener("click",t=>{t.preventDefault(),"add-to-cart"==this.atc_button.getAttribute("data-action")?this.addToCart(t.target):this.removeFromCart(t.target)})}addToCart(e){e.classList.add("product-item__atc--loading");var t={items:[{id:e.dataset.variantId,quantity:1}]};fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>t.json()).then(t=>{e.setAttribute("data-action","remove-from-cart"),e.classList.remove("product-item__atc--loading"),e.setAttribute("title",window.accessibility.remove_from_cart),e.setAttribute("aria-label",window.accessibility.remove_from_cart),window.dispatchEvent(new CustomEvent("cartCounterUpdate")),window.dispatchEvent(new CustomEvent("cartViewUpdate",{detail:t.items}))})}removeFromCart(e){e.classList.add("product-item__atc--loading");var t={updates:{}};t.updates[e.dataset.variantId]=0,fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>t.json()).then(t=>{e.setAttribute("data-action","add-to-cart"),e.classList.remove("product-item__atc--loading"),e.setAttribute("title",window.accessibility.add_to_cart),e.setAttribute("aria-label",window.accessibility.add_to_cart),window.dispatchEvent(new CustomEvent("cartCounterUpdate"))})}}customElements.define("product-item",a)}
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.