1class CartDrawerSection extends HTMLElement{cartUpdateUnsubscriber=void 0;constructor(){super(),this.cartType=this.dataset.cartType,this.drawerClass="wt-cart__drawer",this.drawer=this.querySelector(`.${this.drawerClass}`),this.classDrawerActive=`${this.drawerClass}--open`,this.pageOverlayClass="page-overlay-cart",this.activeOverlayBodyClass=`${this.pageOverlayClass}-on`,this.body=document.body,this.triggerQuery=[".wt-cart__trigger",".wt-cart__back-link",`.${this.pageOverlayClass}`].join(", "),this.triggers=()=>document.querySelectorAll(this.triggerQuery),this.isOpen=!1,this.isCartPage=window.location.pathname.includes("cart"),this.closeButton=()=>this.querySelector(".wt-cart__drawer__close"),this.mainTrigger=document.querySelector(".wt-cart__trigger"),this.toggleEelements=()=>this.querySelectorAll(this.dataset.toggleTabindex)}connectedCallback(){this.cartType==="page"||this.isCartPage||(this.init(),this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,()=>{this.isOpen&&(setTabindex(this.toggleEelements(),"0"),this.closeButton().focus())}))}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}getFocusableElements(){const focusableElementsSelector="button, [href], input, select, [tabindex]",focusableElements=()=>Array.from(this.querySelectorAll(focusableElementsSelector)).filter(el=>!el.hasAttribute("disabled")&&el.tabIndex>=0);return{focusableElements,first:focusableElements()[0],last:focusableElements()[focusableElements().length-1]}}temporaryHideFocusVisible(){document.body.classList.add("no-focus-visible")}onToggle(){this.hasAttribute("open")?(this.removeAttribute("open"),this.isOpen=!1,this.mainTrigger.focus(),this.temporaryHideFocusVisible(),setTabindex(this.toggleEelements(),"-1")):(this.setAttribute("open",""),this.isOpen=!0,this.closeButton().focus(),this.temporaryHideFocusVisible(),setTabindex(this.toggleEelements(),"0"))}toggleDrawerClasses(){this.onToggle(),this.drawer.classList.toggle(this.classDrawerActive),this.body.classList.toggle(this.activeOverlayBodyClass)}init(){this.addEventListener("keydown",e=>{const isTabPressed=e.key==="Tab"||e.keyCode===9||e.code==="Tab",{first,last}=this.getFocusableElements();(e.key==="Escape"||e.keyCode===27||e.code==="Escape")&&this.isOpen&&this.toggleDrawerClasses(),isTabPressed&&(e.shiftKey&&document.activeElement===first?(last.focus(),e.preventDefault()):!e.shiftKey&&document.activeElement===last&&(first.focus(),e.preventDefault()))}),this.triggers().forEach(trigger=>{trigger.addEventListener("click",e=>{e.preventDefault(),this.toggleDrawerClasses()})}),this.addEventListener("click",e=>{e.target.classList.contains("wt-cart__drawer__close")&&(e.preventDefault(),this.toggleDrawerClasses())})}renderContents(parsedState,isClosedCart=!0){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)}),isClosedCart&&setTimeout(()=>{this.toggleDrawerClasses(),this.isOpen&&this.closeButton().focus()})}getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}getSectionsToRender(){return[{id:"cart-drawer",selector:"#CartDrawer"},{id:"cart-icon-bubble"}]}setActiveElement(element){this.activeElement=element}}customElements.define("cart-drawer",CartDrawerSection);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"}]}}customElements.define("cart-drawer-items",CartDrawerItems); 2//# sourceMappingURL=/cdn/shop/t/27/assets/cart-drawer.js.map?v=38999056533100869401741857025
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.