1class CartDrawer extends HTMLElement{constructor(){super();this.addEventListener("keyup",(evt)=>evt.code==="Escape"&&this.close(),);this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this),);this.setHeaderCartIconAccessibility();} 2setHeaderCartIconAccessibility(){const cartLink=document.querySelector("#cart-icon-bubble");cartLink.setAttribute("role","button");cartLink.setAttribute("aria-haspopup","dialog");cartLink.addEventListener("click",(event)=>{event.preventDefault();if(cartLink.getAttribute("pageType")!=="cart"){this.open(cartLink);}});cartLink.addEventListener("keydown",(event)=>{if(event.code.toUpperCase()==="SPACE"){event.preventDefault();this.open(cartLink);}});} 3open(triggeredBy){if(triggeredBy)this.setActiveElement(triggeredBy);const cartDrawerNote=this.querySelector('[id^="Details-"] summary');if(cartDrawerNote&&!cartDrawerNote.hasAttribute("role")) 4this.setSummaryAccessibility(cartDrawerNote);setTimeout(()=>{this.classList.add("animate","active");});this.addEventListener("transitionend",()=>{const containerToTrapFocusOn=this.classList.contains("is-empty")?this.querySelector(".drawer__inner-empty"):document.getElementById("CartDrawer");const focusElement=this.querySelector(".drawer__inner")||this.querySelector(".drawer__close");const tbodyElement=focusElement.querySelector('tbody[role="rowgroup"]',);sortAndAppendCartItems(tbodyElement);trapFocus(containerToTrapFocusOn,focusElement);},{once:true},);document.body.classList.add("overflow-hidden");} 5close(){this.classList.remove("active");removeTrapFocus(this.activeElement);document.body.classList.remove("overflow-hidden");} 6setSummaryAccessibility(cartDrawerNote){cartDrawerNote.setAttribute("role","button");cartDrawerNote.setAttribute("aria-expanded","false");if(cartDrawerNote.nextElementSibling.getAttribute("id")){cartDrawerNote.setAttribute("aria-controls",cartDrawerNote.nextElementSibling.id,);} 7cartDrawerNote.addEventListener("click",(event)=>{event.currentTarget.setAttribute("aria-expanded",!event.currentTarget.closest("details").hasAttribute("open"),);});cartDrawerNote.parentElement.addEventListener("keyup",onKeyUpEscape);} 8renderContents(parsedState){this.querySelector(".drawer__inner").classList.contains("is-empty")&&this.querySelector(".drawer__inner").classList.remove("is-empty");this.productId=parsedState.id;this.getSectionsToRender().forEach((section)=>{const sectionElement=section.selector?document.querySelector(section.selector):document.getElementById(section.id);sectionElement.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id],section.selector,);});setTimeout(()=>{this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this),);this.open();});} 9getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML;} 10getSectionsToRender(){return[{id:"cart-drawer",selector:"#CartDrawer"},{id:"cart-icon-bubble"},];} 11getSectionDOM(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector);} 12setActiveElement(element){this.activeElement=element;}} 13customElements.define("cart-drawer",CartDrawer);class CartDrawerItems extends CartItems{getSectionsToRender(){return[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section",},];}} 14customElements.define("cart-drawer-items",CartDrawerItems);
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.