1class CartDrawer extends HTMLElement{constructor(){super();this.drawer=this.querySelector("[data-cart-drawer]");this.activeClass="cart-drawer-is-open";this.cartIconBubble=document.querySelector("cart-icon-bubble");this.closeButtons=this.querySelectorAll("[data-cart-button-close]");this.closeButtons.forEach((btn=>btn.addEventListener("click",this.close.bind(this))));this.onBodyClick=this.handleBodyClick.bind(this);this.drawer.addEventListener("keyup",(evt=>evt.code==="Escape"&&this.close()));const vScrollbarWidth=window.innerWidth-document.documentElement.clientWidth;if(vScrollbarWidth>0){const css=`\n .${this.activeClass} {\n margin-right: ${vScrollbarWidth}px;\n }\n `;const style=document.createElement("style");document.body.append(style);style.append(document.createTextNode(css))}}open(){document.body.classList.add(this.activeClass);this.cartIconBubble.toggleButton.setAttribute("aria-expanded",true);this.drawer.focus();trapFocus(this.drawer);document.body.addEventListener("click",this.onBodyClick)}close(){document.body.classList.remove(this.activeClass);this.cartIconBubble.toggleButton.setAttribute("aria-expanded",false);document.body.removeEventListener("click",this.onBodyClick);removeTrapFocus()}renderContents(parsedState){this.getSectionsToRender().forEach((section=>{document.querySelector(section.selector).innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id],section.selector)}));this.querySelectorAll("[data-cart-button-close]").forEach((btn=>btn.addEventListener("click",this.close.bind(this))))}getSectionsToRender(){return[{id:"cart-drawer",selector:"[data-cart-drawer]"},{id:"cart-icon-bubble",selector:"[data-cart-icon-bubble]"}]}getSectionInnerHTML(html,selector){return(new DOMParser).parseFromString(html,"text/html").querySelector(selector).innerHTML}handleBodyClick(event){const target=event.target;if(target!==this.drawer&&!target.closest("cart-drawer")){this.close()}}}if(!customElements.get("cart-drawer")){customElements.define("cart-drawer",CartDrawer)} 2//# sourceMappingURL=cart-drawer.js.map
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.