1import{prepareTransition}from"util.misc";import{disableBodyScroll,clearAllBodyScrollLocks}from"vendor.body-scroll-lock";import{trapFocus,removeTrapFocus,focusable}from"util.a11y";import{EVENTS}from"util.events";class HeaderDrawer extends HTMLElement{constructor(){super(),this.isOpen=!1,this.scrollBeforeOpen=null,this.abortController=new AbortController}connectedCallback(){!this.getAttribute("open")||!this.getAttribute("close")||(document.addEventListener(this.getAttribute("open"),this.open.bind(this),{signal:this.abortController.signal}),document.addEventListener(this.getAttribute("close"),this.close.bind(this),{signal:this.abortController.signal}))}open(evt){this.activeElement=evt.target,this.dispatchEvent(new CustomEvent(EVENTS.sizeDrawer,{bubbles:!0})),prepareTransition(this,function(){this.classList.add("is-active")}.bind(this));const _scrollX=window.scrollX,_scrollY=window.scrollY,_prevScrollBehavior=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",this.skipScrollLock=this.hasAttribute("no-scroll-lock")&&window.matchMedia("(min-width: 769px)").matches,this.skipScrollLock||disableBodyScroll(this,{reserveScrollBarGap:!0,allowTouchMove:el=>this===el||this.contains(el)}),trapFocus(this),this.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});const isSticky=document.querySelector("#SiteHeader")?.dataset.sticky==="true";this.scrollBeforeOpen=isSticky?null:{x:_scrollX,y:_scrollY},requestAnimationFrame(()=>{isSticky?window.scrollTo(_scrollX,_scrollY):window.scrollTo(0,0),document.documentElement.style.scrollBehavior=_prevScrollBehavior||""}),window.addEventListener("keyup",this.handleWindowKeyup,{signal:this.abortController.signal}),this.dispatchEvent(new CustomEvent(EVENTS.headerOverlayRemoveClass,{bubbles:!0})),this.dispatchEvent(new CustomEvent(EVENTS.headerDrawerOpened,{bubbles:!0})),this.dispatchEvent(new CustomEvent("drawerOpen",{bubbles:!0})),this.isOpen=!0,setTimeout(()=>{window.addEventListener("click",this.handleWindowClick,{signal:this.abortController.signal})},0)}close(evt,noAnimate){if(!(evt&&evt.target.closest&&evt.target.closest(".site-header__drawer"))&&this.isOpen)if(noAnimate)this.classList.remove("is-active"),this.dispatchEvent(new CustomEvent(EVENTS.headerDrawerClosed,{bubbles:!0})),window.removeEventListener("keyup",this.handleWindowKeyup),window.removeEventListener("click",this.handleWindowClick),this.removeEventListener("keydown",this.handleKeydown),this.isOpen=!1,this.activeElement&&removeTrapFocus(this.activeElement),this.releaseScrollLock();else{const onClosed=()=>{this.removeEventListener("transitionend",onClosed),this.dispatchEvent(new CustomEvent(EVENTS.headerDrawerClosed,{bubbles:!0})),window.removeEventListener("keyup",this.handleWindowKeyup),window.removeEventListener("click",this.handleWindowClick),this.removeEventListener("keydown",this.handleKeydown),this.isOpen=!1,this.activeElement&&removeTrapFocus(this.activeElement),this.releaseScrollLock()};this.addEventListener("transitionend",onClosed,{once:!0}),prepareTransition(this,function(){this.classList.remove("is-active")}.bind(this))}}releaseScrollLock(){this.skipScrollLock||clearAllBodyScrollLocks();const scrollBeforeOpen=this.scrollBeforeOpen;this.scrollBeforeOpen=null,scrollBeforeOpen&&(window.scrollX===scrollBeforeOpen.x&&window.scrollY===scrollBeforeOpen.y||window.scrollTo(scrollBeforeOpen.x,scrollBeforeOpen.y))}handleWindowKeyup=evt=>{evt.keyCode===27&&this.close()};handleWindowClick=evt=>{this.close(evt)};handleKeydown=evt=>{if(!(evt.key==="Tab"||evt.keyCode===9))return;let elements=[];try{elements=focusable(this)||[]}catch{elements=[]}if(!elements.length)return;const first=elements[0],last=elements[elements.length-1],active=document.activeElement;if(!evt.shiftKey&&active===last){evt.preventDefault(),first&&first.focus();return}if(evt.shiftKey&&(active===first||active===this)){evt.preventDefault(),last&&last.focus();return}};disconnectedCallback(){this.abortController.abort()}}customElements.define("header-drawer",HeaderDrawer); 2//# sourceMappingURL=/cdn/shop/t/94/assets/header.drawer.js.map?v=28360777810081842331788882631
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.