1var onceOpen=0;class CartDrawer extends HTMLElement{constructor(){super(),this.openAnimationDelay=null,this.renderContentsDelay=null,this.openToken=0,this.onOverlayClose=this.close.bind(this),this.addEventListener("keyup",evt=>evt.code==="Escape"&&this.close()),this.addEventListener("click",event=>{event.target.closest(".drawer__close")&&(event.preventDefault(),this.close())});const overlay=this.querySelector(".CartDrawer-Overlay");overlay&&overlay.addEventListener("click",this.onOverlayClose),this.setHeaderCartIconAccessibility()}setHeaderCartIconAccessibility(){const cartLink=document.querySelector("#cart-icon-bubble");cartLink&&(cartLink.setAttribute("role","button"),cartLink.setAttribute("aria-haspopup","dialog"),cartLink.addEventListener("click",event=>{event.preventDefault(),this.open(cartLink)}),cartLink.addEventListener("keydown",event=>{event.code.toUpperCase()==="SPACE"&&(event.preventDefault(),this.open(cartLink))}))}setBodyScrollLock(locked){document.body.classList.toggle("cart-hidden",locked),document.documentElement.classList.toggle("cart-hidden",locked),typeof $<"u"&&$("body").toggleClass("cart-hidden",locked)}setOverlayVisible(visible){const overlay=this.querySelector(".CartDrawer-Overlay");overlay&&(overlay.style.display=visible?"":"none",overlay.style.pointerEvents=visible?"":"none")}syncViewportHeight(){if(typeof window.cartHeight=="function"){window.cartHeight();return}const vh=window.visualViewport?window.visualViewport.height:window.innerHeight;document.documentElement.style.setProperty("--cart-viewport-height",Math.round(vh)+"px")}open(triggeredBy){this._closedByUser=!1,triggeredBy&&this.setActiveElement(triggeredBy);const cartDrawerNote=this.querySelector('[id^="Details-"] summary');cartDrawerNote&&!cartDrawerNote.hasAttribute("role")&&this.setSummaryAccessibility(cartDrawerNote);const openToken=++this.openToken;clearTimeout(this.openAnimationDelay),this.setBodyScrollLock(!0),this.setOverlayVisible(!0),this.removeAttribute("aria-hidden"),this.syncViewportHeight(),this.openAnimationDelay=setTimeout(()=>{openToken===this.openToken&&(this.classList.add("animate","active"),this.syncViewportHeight(),requestAnimationFrame(()=>this.syncViewportHeight()),setTimeout(()=>this.syncViewportHeight(),120),onceOpen==0&&(onceOpen++,typeof cartNoticeFun=="function"&&cartNoticeFun().init()))}),this.addEventListener("transitionend",()=>{const containerToTrapFocusOn=this.classList.contains("is-empty")?this.querySelector(".drawer__inner-empty"):document.getElementById("CartDrawer"),focusElement=this.querySelector(".drawer__inner")||this.querySelector(".drawer__close");trapFocus(containerToTrapFocusOn,focusElement)},{once:!0})}close(){this.openToken++,clearTimeout(this.openAnimationDelay),clearTimeout(this.renderContentsDelay),this.openAnimationDelay=null,this.renderContentsDelay=null,this._closedByUser=!0,this.classList.remove("active","animate"),this.setAttribute("aria-hidden","true"),this.setOverlayVisible(!1),this.setBodyScrollLock(!1),removeTrapFocus(this.activeElement)}setSummaryAccessibility(cartDrawerNote){cartDrawerNote.setAttribute("role","button"),cartDrawerNote.setAttribute("aria-expanded","false"),cartDrawerNote.nextElementSibling.getAttribute("id")&&cartDrawerNote.setAttribute("aria-controls",cartDrawerNote.nextElementSibling.id),cartDrawerNote.addEventListener("click",event=>{event.currentTarget.setAttribute("aria-expanded",!event.currentTarget.closest("details").hasAttribute("open"))}),cartDrawerNote.parentElement.addEventListener("keyup",onKeyUpEscape)}resolveSectionHtml(sections,sectionId){if(!sections||typeof sections!="object")return null;if(sections[sectionId])return sections[sectionId];if(sectionId!=="cart-icon-bubble"&§ions["cart-drawer"])return sections["cart-drawer"];if(sectionId==="cart-icon-bubble")return sections["cart-icon-bubble"]||null;const matchKey=Object.keys(sections).find(key=>key==="cart-drawer"||key.endsWith("__cart-model")||key.endsWith("__cart-drawer"));return matchKey?sections[matchKey]:null}getSectionsRequestIds(){const sectionId=this.getCartDrawerSectionId();
1return[...new Set([sectionId,"cart-drawer","cart-icon-bubble"])].filter(Boolean)}renderContents(parsedState,options={}){const shouldOpen=options.open!==!1;this.querySelector(".drawer__inner").classList.contains("is-empty")&&this.querySelector(".drawer__inner").classList.remove("is-empty"),this.productId=parsedState.id;const drawerRoot=this.querySelector("#CartDrawer")||this;if(this.getSectionsToRender().forEach(section=>{const sectionElement=section.selector?drawerRoot.querySelector(section.selector)||document.querySelector(section.selector):document.getElementById(section.id),sectionHtml=this.resolveSectionHtml(parsedState.sections,section.id);if(!sectionElement||!sectionHtml)return;const html=this.getSectionInnerHTML(sectionHtml,section.selector);html&&(sectionElement.innerHTML=html)}),typeof cartOpenValue<"u"&&cartOpenValue.indexOf(parsedState.product_id)!=-1)return;clearTimeout(this.renderContentsDelay);const renderToken=++this.openToken;this.renderContentsDelay=setTimeout(()=>{renderToken===this.openToken&&shouldOpen&&(this._closedByUser=!1,this.open())})}getSectionInnerHTML(html,selector=".shopify-section"){if(!html)return"";const node=new DOMParser().parseFromString(html,"text/html").querySelector(selector);return node?node.innerHTML:""}getCartDrawerSectionId(){return typeof window.getCartDrawerSectionId=="function"?window.getCartDrawerSectionId():"cart-drawer"}getSectionsToRender(){const sectionId=this.getCartDrawerSectionId();return[{id:sectionId,selector:".drawer__header"},{id:sectionId,selector:".recom_list_box1"},{id:sectionId,selector:".recom_list_box2"},{id:"cart-icon-bubble"},{id:sectionId,selector:".render-data"}]}getSectionDOM(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector)}setActiveElement(element){this.activeElement=element}}customElements.define("cart-drawer",CartDrawer);class CartDrawerItems extends CartItems{getCartDrawerSectionId(){return typeof window.getCartDrawerSectionId=="function"?window.getCartDrawerSectionId():"cart-drawer"}getSectionsToRender(){const sectionId=this.getCartDrawerSectionId();return[{id:"CartDrawer",section:sectionId,selector:".drawer__header"},{id:"CartDrawer",section:sectionId,selector:".recom_list_box1 .recom_box"},{id:"CartDrawer",section:sectionId,selector:".recom_list_box2 .recom_box"},{id:"CartDrawer",section:sectionId,selector:".gift_list"},{id:"CartDrawer",section:sectionId,selector:".gift_list2"},{id:"CartDrawer",section:sectionId,selector:".render-data"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"}]}}customElements.define("cart-drawer-items",CartDrawerItems); 2//# sourceMappingURL=/cdn/shop/t/134/assets/cart-drawer.js.map?v=57647446971574282491785749975
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.