1customElements.get("localization-form")||customElements.define("localization-form",class extends HTMLElement{constructor(){super(),this.header=document.querySelector(".header-wrapper"),this.elements={input:this.querySelector('input[name="locale_code"], input[name="country_code"]'),returnInput:this.querySelector('input[name="return_to"]'),button:this.querySelector("button.localization-form__select"),drawer:this.querySelector(".selector__dropdown[element-s-up]"),panel:this.querySelector(".disclosure__list-wrapper"),search:this.querySelector('input[name="country_filter"]'),closeButton:this.querySelector(".selector__close-button"),resetButton:this.querySelector(".country-filter__reset-button"),searchIcon:this.querySelector(".country-filter__search-icon"),liveRegion:this.querySelector("#sr-country-search-results")},this.initializeForm()}initializeForm(){!theme.config.isTouch||Shopify.designMode?Motion.inView(this,this.init.bind(this)):theme.initWhenVisible(this.init.bind(this))}init(){this.addEventListener("keyup",this.onContainerKeyUp.bind(this)),this.addEventListener("keydown",this.onContainerKeyDown.bind(this)),theme.config.mql&&this.addEventListener("focusout",this.closeSelector.bind(this)),this.querySelector("#Selector-Overlay")?.addEventListener("click",this.hidePanel.bind(this)),this.elements.button?.addEventListener("click",this.openSelector.bind(this)),theme.config.mqlDesktop&&this.getAttribute("activate-event")==="hover"&&["focusin","mouseenter","mouseleave"].forEach(event=>this.addEventListener(event,this._hoverOpen.bind(this))),this.elements.search&&(this.elements.search.addEventListener("keyup",this.filterCountries.bind(this)),this.elements.search.addEventListener("focus",this.onSearchFocus.bind(this)),this.elements.search.addEventListener("blur",this.onSearchBlur.bind(this)),this.elements.search.addEventListener("keydown",this.onSearchKeyDown.bind(this))),this.elements.closeButton&&this.elements.closeButton?.addEventListener("click",this.hidePanel.bind(this)),this.elements.resetButton&&(this.elements.resetButton.addEventListener("click",this.resetFilter.bind(this)),this.elements.resetButton.addEventListener("mousedown",event=>event.preventDefault())),this.querySelectorAll("a").forEach(item=>item.addEventListener("click",this.onItemClick.bind(this)))}hidePanel(){this.elements.button?.setAttribute("aria-expanded","false"),this.elements.drawer?.classList.remove("active"),this.elements.search&&(this.elements.search.value="",this.filterCountries(),this.elements.search.setAttribute("aria-activedescendant","")),theme.config.mql||removeTrapFocus(this.elements.button),document.body.classList.remove("overflow-hidden-mobile"),document.querySelector(".menu-drawer").classList.remove("disclosure-selector-open"),this.header.preventHide=!1}onContainerKeyDown(event){const focusableItems=Array.from(this.querySelectorAll("a")).filter(item=>!item.parentElement.classList.contains("hidden"));let focusedItemIndex=focusableItems.findIndex(item=>item===document.activeElement),itemToFocus;switch(event.code.toUpperCase()){case"ARROWUP":event.preventDefault(),itemToFocus=focusedItemIndex>0?focusableItems[focusedItemIndex-1]:focusableItems[focusableItems.length-1],itemToFocus.focus();break;case"ARROWDOWN":event.preventDefault(),itemToFocus=focusedItemIndex<focusableItems.length-1?focusableItems[focusedItemIndex+1]:focusableItems[0],itemToFocus.focus();break}this.elements.search&&setTimeout(()=>{focusedItemIndex=focusableItems.findIndex(item=>item===document.activeElement),focusedItemIndex>-1?this.elements.search.setAttribute("aria-activedescendant",focusableItems[focusedItemIndex].id):this.elements.search.setAttribute("aria-activedescendant","")})}onContainerKeyUp(event){switch(event.preventDefault(),event.code.toUpperCase()){case"ESCAPE":if(this.elements.button.getAttribute("aria-expanded")=="false")return;this.hidePanel(),event.stopPropagation(),this.elements.button.focus();break;case"SPACE":if(this.elements.button.getAttribute("aria-expanded")=="true")return;this.openSelector();break}}onItemClick(event){event.preventDefault();const form=this.querySelector("form");this.elements.input.value=event.currentTarget.dataset.value,this.elements.returnInput.value=window.location.href,form&&form.submit()}openSelector(){this.elements.button?.focus(),this.elements.drawer?.classList.toggle("active"),this.elements.button?.setAttribute("aria-expanded",(this.elements.button.getAttribute("aria-expanded")==="false").toString()),document.body.classList.contains("overflow-hidden-tablet")||document.body.classList.add("overflow-hidden-mobile"),theme.config.mql?this.elements.search&&this.elements.search.focus():(this.addEventListener("transitionend",()=>{const containerToTrapFocusOn=this.querySelector(".slide__inner--mb"),focusElement=this.querySelector(".selector__close-button");trapFocus(containerToTrapFocusOn,focusElement)},{once:!0}
1),this.elements.drawer.classList.add("drawer-slide-mb")),this.hasAttribute("data-prevent-hide")&&(this.header.preventHide=!0),document.querySelector(".menu-drawer").classList.add("disclosure-selector-open")}_hoverOpen(event){const value=event.type==="mouseenter"||event.type==="focusin";this.elements.drawer?.classList.toggle("active",value),this.elements.button?.setAttribute("aria-expanded",value),document.body.classList.contains("overflow-hidden-tablet")||document.body.classList.toggle("overflow-hidden-mobile",value),this.hasAttribute("data-prevent-hide")&&(this.header.preventHide=value),document.querySelector(".menu-drawer").classList.toggle("disclosure-selector-open",value)}closeSelector(event){(!this.contains(event.target)||!this.contains(event.relatedTarget))&&this.hidePanel()}normalizeString(str){return str.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase()}filterCountries(){const searchValue=this.normalizeString(this.elements.search.value),popularCountries=this.querySelector(".popular-countries"),allCountries=this.querySelectorAll("a");let visibleCountries=allCountries.length;this.elements.resetButton.classList.toggle("hidden",!searchValue),popularCountries&&popularCountries.classList.toggle("hidden",searchValue),allCountries.forEach(item=>{this.normalizeString(item.querySelector(".country").textContent).indexOf(searchValue)>-1?(item.parentElement.classList.remove("hidden"),visibleCountries++):(item.parentElement.classList.add("hidden"),visibleCountries--)}),this.elements.liveRegion&&(this.elements.liveRegion.innerHTML=window.accessibilityStrings.countrySelectorSearchCount.replace("[count]",visibleCountries)),this.querySelector(".country-selector").scrollTop=0,this.querySelector(".country-selector__list").scrollTop=0}resetFilter(event){event.stopPropagation(),this.elements.search.value="",this.filterCountries(),this.elements.search.focus()}onSearchFocus(){this.elements.searchIcon.classList.add("country-filter__search-icon--hidden")}onSearchBlur(){this.elements.search.value||this.elements.searchIcon.classList.remove("country-filter__search-icon--hidden")}onSearchKeyDown(event){event.code.toUpperCase()==="ENTER"&&event.preventDefault()}}),customElements.get("dropdown-localization-component")||customElements.define("dropdown-localization-component",class extends HTMLElement{constructor(){super()}connectedCallback(){this.waitForSectionFetcher()}waitForSectionFetcher(){const sectionFetcher=this.querySelector("section-fetcher");if(!sectionFetcher){this.initializeForm();return}let completedFetchers=0;const totalFetchers=1,onSectionCached=event=>{completedFetchers++,completedFetchers>=totalFetchers&&(document.removeEventListener("section:cached",onSectionCached),this.initializeForm())};document.addEventListener("section:cached",onSectionCached);const targetElement=document.getElementById(sectionFetcher.dataset.targetId);targetElement&&targetElement.hasAttribute("data-loaded")&&completedFetchers++,completedFetchers>=totalFetchers&&(document.removeEventListener("section:cached",onSectionCached),this.initializeForm())}initializeForm(){!theme.config.isTouch||Shopify.designMode?Motion.inView(this,this.init.bind(this)):theme.initWhenVisible(this.init.bind(this))}init(){this.header=document.querySelector(".header-wrapper"),this.elements={button:this.querySelector(".dropdown-localization__button"),drawer:this.querySelector(".selector__dropdown[element-s-up]"),panel:this.querySelector(".disclosure__list-wrapper")},this.addEventListener("keyup",this.onContainerKeyUp.bind(this)),theme.config.mql.matches&&this.addEventListener("focusout",this.closeSelector.bind(this)),this.elements.button?.addEventListener("click",this.openSelector.bind(this))}onContainerKeyUp(event){switch(event.preventDefault(),event.code.toUpperCase()){case"ESCAPE":if(this.elements.button.getAttribute("aria-expanded")=="false")return;this.hidePanel(),event.stopPropagation(),this.elements.button.focus();break;case"SPACE":if(this.elements.button.getAttribute("aria-expanded")=="true")return;this.openSelector();break}}openSelector(){this.elements.button.focus(),this.elements.drawer.classList.toggle("active"),this.elements.button.setAttribute("aria-expanded",(this.elements.button.getAttribute("aria-expanded")==="false").toString()),theme.config.mql?this.elements.search&&this.elements.search.focus():(this.addEventListener("transitionend",()=>{const containerToTrapFocusOn=this.querySelector(".slide__inner--mb"),focusElement=this.querySelector(".selector__close-button");trapFocus(containerToTrapFocusOn,focusElement)},{once:!0}
1),this.elements.drawer.classList.add("drawer-slide-mb")),this.hasAttribute("data-prevent-hide")&&(this.header.preventHide=!0),document.querySelector(".menu-drawer").classList.add("disclosure-selector-open")}closeSelector(event){event.preventDefault(),(!this.contains(event.target)||!this.contains(event.relatedTarget))&&this.hidePanel()}hidePanel(){this.elements.button?.setAttribute("aria-expanded","false"),this.elements.drawer?.classList.remove("active")}}),customElements.get("drawer-localization-component")||customElements.define("drawer-localization-component",class extends HTMLElement{constructor(){super(),this.waitForSectionFetcher()}waitForSectionFetcher(){const sectionFetcher=this.querySelector("section-fetcher");if(!sectionFetcher){this.initializeForm();return}let completedFetchers=0;const totalFetchers=1,onSectionCached=event=>{completedFetchers++,completedFetchers>=totalFetchers&&(document.removeEventListener("section:cached",onSectionCached),this.initializeForm())};document.addEventListener("section:cached",onSectionCached);const targetElement=document.getElementById(sectionFetcher.dataset.targetId);targetElement&&targetElement.hasAttribute("data-loaded")&&completedFetchers++,completedFetchers>=totalFetchers&&(document.removeEventListener("section:cached",onSectionCached),this.initializeForm())}initializeForm(){!theme.config.isTouch||Shopify.designMode?Motion.inView(this,this.init.bind(this)):theme.initWhenVisible(this.init.bind(this))}init(){this.loadTemplate(),this.header=document.querySelector(".header-wrapper"),this.elements={button:this.querySelector(".drawer-localization__button"),drawer:this.querySelector(".selector__dropdown[element-s-up]"),backButton:this.querySelector(".menu-drawer__back-button")},this.addEventListener("keyup",this.onContainerKeyUp.bind(this)),this.elements.button.addEventListener("click",this.openSelector.bind(this)),this.elements.backButton?.addEventListener("click",this.closeSelector.bind(this))}loadTemplate(){const template=this.querySelector("template");if(template){const templateContent=template.content.cloneNode(!0);this.appendChild(templateContent)}}openSelector(){this.elements.button.focus(),this.elements.drawer.classList.add("active")}onContainerKeyUp(event){switch(event.preventDefault(),event.code.toUpperCase()){case"ESCAPE":if(this.elements.button.getAttribute("aria-expanded")=="false")return;this.hidePanel(),event.stopPropagation(),this.elements.button.focus();break;case"SPACE":if(this.elements.button.getAttribute("aria-expanded")=="true")return;this.openSelector();break}}closeSelector(event){event.preventDefault(),(!this.contains(event.target)||!this.contains(event.relatedTarget))&&this.hidePanel()}hidePanel(){this.elements.button?.setAttribute("aria-expanded","false"),this.elements.drawer?.classList.remove("active"),document.body.classList.remove("overflow-hidden-mobile"),document.querySelector(".menu-drawer").classList.remove("disclosure-selector-open")}}); 2//# sourceMappingURL=/cdn/shop/t/15/assets/localization-form.js.map?v=83830534967772479541772638598
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.