1import{d as o}from"./chunk--chunk-IULP5YAC.vbt.js";var r=class{constructor(t){this.el=t,this.button=t.querySelector(".add-all-to-cart"),this.products=t.querySelectorAll("[data-product-form]")}init(){this.initAddAll()}initAddAll(){this.button.addEventListener("click",()=>o(this,null,function*(){try{let t=Array.from(this.products).map(e=>({id:e.querySelector('input[name="id"]').value,quantity:1}));if((yield fetch("/cart/add.js",{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({items:t})})).status===200){let e=this.el.closest("[data-cart-rec]");e&&(e.querySelector('input[type="checkbox"]').checked=!1);let i=yield(yield fetch("/?sections=ajaxcart")).json(),a=document.createElement("div");a.innerHTML=i.ajaxcart;let l=a.querySelector("[data-ajax-cart-content]"),n=document.querySelector("[data-ajaxcart] [data-ajax-cart-content]").parentNode;n.innerHTML="",n.appendChild(l);let d=a.querySelector("[data-subtotal-value]").value;document.querySelectorAll("[data-subtotal]").forEach(u=>{u.innerHTML=d}),document.dispatchEvent(new CustomEvent("ajaxcart refresh"));let c=document.getElementById("cart-drawer-toggle");c&&(c.checked=!0,c.dispatchEvent(new Event("change",{bubbles:!0})))}}catch(t){console.error("Error adding all to cart: ",t)}}))}},m=r;export{m as default};
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.