1/* IMPORTANT: This file is auto-generated. Do not modify it directly or changes will be lost. */ 2const checkoutBtn=document.querySelector(".cart__checkout");async function addPropertyPriceKg(t,e){const r=t;try{await fetch("/cart/clear.js",{method:"POST"});const t=r.items.map(t=>{const r={id:t.id,quantity:t.quantity};if(t.properties&&(r.properties={...t.properties}),e.includes(t.id.toString())){let e=document.querySelector(`[data-key="${t.key}"] [data-price-per-kg]`).getAttribute("data-price-per-kg"),o=document.querySelector(`[data-key="${t.key}"] [data-property-translation]`).getAttribute("data-property-translation");r.properties={...r.properties,[o]:e}}return r}).reverse();await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:t})})}catch(t){console.error("Error on product update :",t)}}async function removePropertyPriceKg(){try{const t=await fetch("/cart.js"),e=await t.json(),r=e.items.map(t=>{if(t.properties&&Object.keys(t.properties).length>0){const e={...t.properties};let r=document.querySelector(`[data-key="${t.key}"] [data-property-translation]`)?.getAttribute("data-property-translation");for(const t in e)t.includes(r)&&delete e[t];return{id:t.id,quantity:t.quantity,properties:Object.keys(e).length>0?e:null}}return{id:t.id,quantity:t.quantity}}).reverse();await fetch("/cart/clear.js",{method:"POST"});if(!(await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:r})})).ok)throw new Error("Failed to update cart items")}catch(t){console.error("Error removing properties:",t)}}checkoutBtn.addEventListener("click",async function t(e){if(document.querySelector(".drawer__inner .cart__items .price-per-kg")){e.preventDefault(),checkoutBtn.classList.toggle("btn--loading");const r=document.querySelectorAll("[data-price-kg-eligible]"),o=[];r.forEach(t=>{o.push(t.getAttribute("data-price-kg-eligible"))});try{const e=await fetch("/cart.js"),r=await e.json();await addPropertyPriceKg(r,o),checkoutBtn.classList.toggle("btn--loading"),checkoutBtn.removeEventListener("click",t),checkoutBtn.click()}catch(e){console.error("Error updating properties:",e),checkoutBtn.classList.toggle("btn--loading"),checkoutBtn.removeEventListener("click",t),checkoutBtn.click()}}}),window.addEventListener("load",async()=>{document.querySelector('[data-property-price-kg-set="true"]')&&(await removePropertyPriceKg(),window.location.reload())});
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.