1class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",event=>{event.preventDefault(),(this.closest("cart-items")||this.closest("cart-drawer-items")).updateQuantity(this.dataset.index,0)})}}customElements.define("cart-remove-button",CartRemoveButton);class CartItems extends HTMLElement{constructor(){super(),this.lineItemStatusElement=document.getElementById("shopping-cart-line-item-status")||document.getElementById("CartDrawer-LineItemStatus"),this.debouncedOnChange=debounce(event=>{this.onChange(event)},300).bind(this),this.addEventListener("change",this.debouncedOnChange)}disconnectedCallback(){this.removeEventListener("change",this.debouncedOnChange)}onChange(event){this.updateQuantity(event.target.dataset.index,event.target.value,document.activeElement.getAttribute("name"),event.target.dataset.quantityVariantId)}getSectionsToRender(){return[{section:"main-cart-items",id:document.getElementById("main-cart-items").dataset.id,selector:".js-contents"},{section:"cart-icon-bubble",id:"cart-icon-bubble",selector:".shopify-section"},{section:"cart-live-region-text",id:"cart-live-region-text",selector:".shopify-section"},{section:"main-cart-footer",id:document.getElementById("main-cart-items").dataset.id,selector:".cart__footer__js-contents"}]}updateQuantity(line,quantity,name,variantId){this.enableLoading(line);const body=JSON.stringify({line,quantity,sections:this.getSectionsToRender().map(section=>section.id),sections_url:window.location.pathname}),errors=document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors");fetch(`${routes.cart_change_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state),quantityElement=document.getElementById(`Quantity-${line}`)||document.getElementById(`Drawer-quantity-${line}`),items=document.querySelectorAll(".cart-item");if(parsedState.errors){quantityElement.value=quantityElement.getAttribute("value"),this.updateLiveRegions(line,parsedState.errors);return}const updatedValue=parsedState.items[line-1]?parsedState.items[line-1].quantity:void 0;let message="";items.length===parsedState.items.length&&updatedValue!==parseInt(quantityElement.value)&&(typeof updatedValue>"u"?message=window.cartStrings.error:message=window.cartStrings.quantityError.replace("[quantity]",updatedValue)),this.updateLiveRegions(line,message);const lineItem=document.getElementById(`CartItem-${line}`)||document.getElementById(`CartDrawer-Item-${line}`);this.renderContents(parsedState,lineItem,name),document.dispatchEvent(new CustomEvent("afterUpdateQuantity",{detail:{source:"cart-items",cartData:parsedState,variantId}})),errors.classList.add("hidden")}).catch(e=>{errors.classList.remove("hidden"),errors.querySelector("span").textContent=window.cartStrings.error}).finally(()=>{this.querySelectorAll(".loading-overlay").forEach(overlay=>overlay.classList.add("hidden")),this.disableLoading()})}updateLiveRegions(line,message){const lineItemError=document.getElementById(`Line-item-error-${line}`)||document.getElementById(`CartDrawer-LineItemError-${line}`);lineItemError&&(lineItemError.querySelector(".cart-item__error-text").innerHTML=message,lineItemError.classList.remove("hidden"));const lineItemError2=document.getElementById(`Line-item-error-2-${line}`);lineItemError2&&(lineItemError2.querySelector(".cart-item__error-text").innerHTML=message,lineItemError2.classList.remove("hidden")),this.lineItemStatusElement.setAttribute("aria-hidden",!0);const cartStatus=document.getElementById("cart-live-region-text")||document.getElementById("CartDrawer-LiveRegionText");cartStatus.setAttribute("aria-hidden",!1),setTimeout(()=>{cartStatus.setAttribute("aria-hidden",!0)},1e3)}renderContents(parsedState,lineItem,name){const cartDrawerWrapper=document.querySelector("cart-drawer"),cartPage=document.getElementById("main-cart");if(cartPage){cartPage.classList.toggle("is-empty",parsedState.item_count===0);const cartPageBox=cartPage.getBoundingClientRect();cartPageBox.top<window.innerHeight&&cartPageBox.bottom>=0||cartPage.scrollIntoView({behavior:"smooth"})}cartDrawerWrapper&&cartDrawerWrapper.classList.toggle("is-empty",parsedState.item_count===0),this.get
1SectionsToRender().forEach((section=>{const elementToReplace=document.getElementById(section.section).querySelector(section.selector)||document.getElementById(section.section);elementToReplace&&(elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id],section.selector))})),lineItem&&lineItem.querySelector(`[name="${name}"]`)?cartDrawerWrapper?trapFocus(cartDrawerWrapper,lineItem.querySelector(`[name="${name}"]`)):lineItem.querySelector(`[name="${name}"]`).focus():parsedState.item_count===0&&cartDrawerWrapper?trapFocus(cartDrawerWrapper.querySelector(".drawer__inner-empty"),cartDrawerWrapper.querySelector("a")):document.querySelector(".cart-item")&&cartDrawerWrapper&&trapFocus(cartDrawerWrapper,document.querySelector(".cart-item__name")),this.updateProductRecommendation()}updateProductRecommendation(){const recommendation=document.querySelector("main-cart-recommendations");recommendation&&recommendation.update()}getSectionInnerHTML(html,selector){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}enableLoading(line){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.add("cart__items--disabled");const cartItemElements=this.querySelectorAll(`#CartItem-${line} .loading-overlay`),cartDrawerItemElements=this.querySelectorAll(`#CartDrawer-Item-${line} .loading-overlay`);
1[...cartItemElements,...cartDrawerItemElements].forEach(overlay=>overlay.classList.remove("hidden")),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1)}disableLoading(){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.remove("cart__items--disabled")}setActiveElement(element){}}customElements.define("cart-items",CartItems),customElements.get("cart-note")||customElements.define("cart-note",class extends HTMLElement{constructor(){super(),this.onChangeHandler=debounce(this.onChange.bind(this),300),this.addEventListener("change",this.onChangeHandler)}disconnectedCallback(){this.removeEventListener("change",this.onChangeHandler)}onChange(event){const body=JSON.stringify({note:event.target.value});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body})}}); 2//# sourceMappingURL=/cdn/shop/t/61/assets/cart.js.map?v=155261651746960756871785937410
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.