1import{LitElement,html}from"@hh/global.js";class CountrySelectorPopup extends LitElement{static properties={};constructor(){super(),this.addFocusTrap=this.addFocusTrap.bind(this)}connectedCallback(){super.connectedCallback(),this._init()}_init(){!window.mdApp_openAndRefreshModal||!window.mdApp_closeModal||(this.classList.add("block"),this.classList.remove("hidden"))}handleCustomSelectorClick(){window.mdApp_openAndRefreshModal(),document.addEventListener("keydown",this.closeOnEscape.bind(this)),this.modalWrapper=document.querySelector("#md-app-embed__modal"),this.modalWrapper.addEventListener("keydown",this.onTrapFocus.bind(this)),this.addFocusTrap()}closeOnEscape(e){e.key==="Escape"&&(window.mdApp_closeModal(),document.removeEventListener("keydown",this.closeOnEscape),this.modalWrapper.removeEventListener("keydown",this.onTrapFocus.bind(this)))}isHidden(element){return element.getAttribute("tabindex")==="-1"||element.hasAttribute("hidden")||element.hasAttribute("aria-hidden")&&element.getAttribute("aria-hidden")!=="false"||element.style.display==="none"||element.style.opacity==="0"}isFocusable(element){return!element.disabled&&element.hasAttribute("tabindex")||(element instanceof HTMLAnchorElement||element instanceof HTMLAreaElement)&&element.hasAttribute("href")||element instanceof HTMLButtonElement||element instanceof HTMLInputElement||element instanceof HTMLTextAreaElement||element instanceof HTMLSelectElement||element instanceof HTMLIFrameElement}addFocusTrap(){const focusableChildren=Array.from(this.modalWrapper.querySelectorAll(` 2 a[href]:not([disabled]), 3 button:not([disabled]), 4 textarea:not([disabled]), 5 input[type='text']:not([disabled]), 6 input[type='radio']:not([disabled]), 7 input[type='checkbox']:not([disabled]), 8 select:not([disabled]) 9 `))||[];this.firstFocusableElement=focusableChildren.find(element=>!this.isHidden(element)),this.lastFocusableElement=focusableChildren.findLast(element=>!this.isHidden(element)),this.firstFocusableElement.focus()}onTrapFocus(e){(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?document.activeElement===this.firstFocusableElement&&(this.lastFocusableElement.focus(),e.preventDefault()):document.activeElement===this.lastFocusableElement&&(this.firstFocusableElement.focus(),e.preventDefault()))}render(){return html`<slot @click="${this.handleCustomSelectorClick}"></slot>`}}customElements.define("country-selector-popup",CountrySelectorPopup),window.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".md-modal__bodyContent__text")[0]?.setAttribute("role","heading"),document.querySelectorAll(".md-modal__bodyContent__text")[0]?.setAttribute("aria-level",2),document.getElementById("label-md-modal__dialog")?.setAttribute("role","heading"),document.getElementById("label-md-modal__dialog")?.setAttribute("aria-level",1)}); 10//# sourceMappingURL=/cdn/shop/t/1772/assets/component-country-selector.js.map?v=75060927981250513611789367555
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.