1function loadScript(src){return new Promise((resolve,reject)=>{const s=document.createElement("script");s.src=src,s.onload=resolve,s.onerror=reject,document.body.appendChild(s)})}if(!customElements.get("cart-drawer-disclosure")){class CartDrawerDisclosure extends DetailsDisclosure{constructor(){super(),this.openBtn=this.querySelector("summary"),this.closeBtn=this.querySelector(".js-close"),this.overlay=document.getElementById("cart-drawer").querySelector(".overlay")}handleClick(evt){evt.target.matches(".js-close")&&this.close()}open(){this.overlay.classList.add("is-visible"),super.open(),trapFocus(this),this.clickHandler=this.clickHandler||this.handleClick.bind(this),this.keyupHandler=evt=>evt.key==="Escape"&&this.close(),this.addEventListener("click",this.clickHandler),this.addEventListener("keyup",this.keyupHandler),this.overlay.addEventListener("click",this.clickHandler)}close(){this.overlay.classList.remove("is-visible"),super.close(),removeTrapFocus(this.openBtn),this.removeEventListener("click",this.clickHandler),this.removeEventListener("keyup",this.keyupHandler),this.overlay.removeEventListener("click",this.clickHandler)}}customElements.define("cart-drawer-disclosure",CartDrawerDisclosure)}if(!customElements.get("cart-drawer")){class CartDrawer extends DockableSideDrawer{constructor(){super(),this.cartSummary=this.querySelector(".cart-drawer__summary"),this.init(),this.bindEvents()}disconnectedCallback(){document.removeEventListener("dispatch:cart-drawer:refresh",this.refreshHandler),document.removeEventListener("on:bfcache:load-restore",this.refreshHandler),document.removeEventListener("dispatch:cart-drawer:open",this.openDrawerViaEventHandler),document.removeEventListener("dispatch:cart-drawer:close",this.closeDrawerViaEventHandler),Shopify.designMode&&(document.removeEventListener("shopify:section:select",this.sectionSelectHandler),document.removeEventListener("shopify:section:deselect",this.sectionDeselectHandler)),this.dcbLoadedHandler&&document.removeEventListener("shopify:payment_button:loaded",this.dcbLoadedHandler)}init(){const cartIcon=document.getElementById("cart-icon");cartIcon&&(cartIcon.setAttribute("role","button"),cartIcon.setAttribute("aria-haspopup","dialog"),cartIcon.addEventListener("click",evt=>{this.isDocked||(evt.preventDefault(),this.open(cartIcon))}),cartIcon.addEventListener("keydown",evt=>{if(!this.isDocked){if(evt.key!==" ")return;evt.preventDefault(),this.open(cartIcon)}}))}bindEvents(){Shopify.designMode&&(this.sectionSelectHandler=this.handleSectionSelect.bind(this),this.sectionDeselectHandler=this.handleSectionDeselect.bind(this),document.addEventListener("shopify:section:select",this.sectionSelectHandler),document.addEventListener("shopify:section:deselect",this.sectionDeselectHandler)),this.openDrawerViaEventHandler=this.handleDrawerOpenViaEvent.bind(this),this.closeDrawerViaEventHandler=this.close.bind(this,null),this.addEventListener("click",this.handleEmptyCart.bind(this)),document.addEventListener("dispatch:cart-drawer:open",this.openDrawerViaEventHandler),document.addEventListener("dispatch:cart-drawer:close",this.closeDrawerViaEventHandler),this.cartSummary.classList.contains("cart-drawer--checkout--sticky-true")&&(this.dcbLoadedHandler=this.dcbLoadedHandler||CartDrawer.recalculateCssVarHeights,document.addEventListener("shopify:payment_button:loaded",this.dcbLoadedHandler)),this.refreshHandler=this.refreshCartDrawer.bind(this),document.addEventListener("dispatch:cart-drawer:refresh",this.refreshHandler),document.addEventListener("on:bfcache:load-restore",this.refreshHandler)}handleEmptyCart(evt){if(evt.target.matches(".js-empty-cart")&&(evt.preventDefault(),confirm(theme.strings.confirmEmptyCart))){this.querySelectorAll(".cart-item").forEach((cartItem,index)=>{setTimeout(()=>cartItem.classList.add("cart-item--out"),index*50)});try{fetch(`${theme.routes.cartClear}.js`,{method:"POST"}).then(response=>{if(!response.ok)throw new Error(response.status);this.querySelectorAll(".cart-item").forEach(cartItem=>{this.dispatchEvent(new CustomEvent("on:line-item:change",{bubbles:!0,detail:{variantId:cartItem.dataset.variantId,newQuantity:0}}))}),this.refreshCartDrawer()})}catch(error){console.log("Error clearing cart:",error),window.location.href=evt.target.href}}}handleSectionSelect(evt){evt.target===this.closest(".shopify-section")&&this.open()}handleSectionDeselect(evt){evt.target===this.closest(".shopify-section")&&this.close()}handleDrawerOpenViaEvent(evt){this.open(evt.detail?evt.detail.opener:null)}open(opener,elementToFocus){const quickAddDrawer=document.querySelector('quick-add-drawer[aria-hidden="false"]'),overlay=document.querySelector(".js-overlay.is-visible");quickAddDrawer&&(overlay&&(overlay.style.transitionDelay="200ms"),quickAddDrawer.close()),setTimeout(()=>{super.open(opener,elementToFocus,()=>{this.cartSummary.classList.contains("cart-drawer--checkout--sticky-true")&&CartDrawer.recalculateCssVarHeights()}),this.cartSummary.classList.contains("cart-drawer--checkout--sticky-true")&&CartDrawer.recalculateCssVarHeights(),overlay&&(overlay.style.transitionDelay="")},quickAddDrawer?200:0),window.initLazyImages()}async refreshCartDrawer(dontRefreshCartItems){try{const cartItems=this.querySelector('cart-items[data-empty="false"]');if(cartItems&&!dontRefreshCartItems)cartItems.refreshCartItems();else{const response=this.getSectionsToRender().map(section=>section.section),sections=await(await fetch(`?sections=${response.join(",")}`)).json();this.renderContents({sections},!1),CartDrawer.recalculateCssVarHeights()}}catch(error){console.log(error),this.dispatchEvent(new CustomEvent("on:cart:error",{bubbles:!0,detail:{error:this.errorMsg?this.errorMsg.textContent:null}}))}}async renderContents(data,openDrawer=!0){this.scriptsLoaded||(document.querySelector(`script[src="${theme.scripts.cartItems}"]`)||await loadScript(theme.scripts.cartItems),!document.querySelector(`script[src="${theme.scripts.shippingCalculator}"]`)&&this.dataset.shippingCalculator&&(await loadScript(theme.scripts.countryProvinceSelector),await loadScript(theme.scripts.shippingCalculator)),this.scriptsLoaded=!0),this.get
1SectionsToRender().forEach(section=>{const el=document.getElementById(section.id);if(el&&(el.innerHTML=CartDrawer.getElementHTML(data.sections[section.section],section.selector),section.id==="cart-icon-bubble")){const drawerCount=document.getElementById("cart-drawer__count");if(drawerCount){const html=CartDrawer.getElementHTML(data.sections[section.section],`${section.selector} .header__cart-count-number`);drawerCount.innerHTML=`(${html})`}}}),openDrawer&&this.getAttribute("open")===null&&setTimeout(()=>this.open()),window.initLazyImages(),CartDrawer.recalculateCssVarHeights()}getSectionsToRender(){const sections=[{id:"cart-drawer",section:this.closest(".shopify-section").id.replace("shopify-section-",""),selector:"cart-drawer"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"}];return document.querySelectorAll("quick-order-list").forEach(quickOrderList=>{const closestSection=quickOrderList.closest(".shopify-section");if(closestSection){const sectionId=closestSection.id.replace("shopify-section-","");sections.push({id:`quick-order-list_${sectionId}`,section:sectionId,selector:`#quick-order-list_${sectionId}`})}}),sections}static recalculateCssVarHeights(){window.requestAnimationFrame(()=>{document.dispatchEvent(new CustomEvent("on:css-var-height:update"))})}static getElementHTML(html,selector){const tmpl=document.createElement("template");return tmpl.innerHTML=html,tmpl.content.querySelector(selector).innerHTML}}customElements.define("cart-drawer",CartDrawer)} 2//# sourceMappingURL=/cdn/shop/t/36/assets/cart-drawer.js.map?v=43986109057971355761791562848
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.