https://chulafashion.com/cdn/shop/t/49/assets/chula-locale-panel.js?v=169955487199499373781790327941
1(()=>{if(customElements.get("chula-locale-panel"))return;const REGIONS={eu:"AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA XK",na:"AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI",sa:"AR BO BR CL CO EC FK GF GY PE PY SR UY VE",mea:"AE AO BF BH BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW IL IO IQ JO KE KM KW LB LR LS LY MA MG ML MR MU MW MZ NA NE NG OM PS QA RE RW SA SC SD SH SL SN SO SS ST SZ TD TF TG TN TR TZ UG YE YT ZA ZM ZW",ap:"AF AM AS AU AZ BD BN BT CC CK CX CN FJ FM GE GU HK HM ID IN JP KG KH KI KP KR KZ LA LK MH MM MN MO MP MV MY NC NF NP NR NU NZ PF PG PH PK PN PW SB SG TH TJ TK TL TM TO TV TW UM UZ VN VU WF WS"},ORDER=["eu","na","sa","mea","ap"],LOOKUP={};ORDER.forEach(key=>REGIONS[key].split(" ").forEach(code=>{LOOKUP[code]=key}));class ChulaLocalePanel extends HTMLElement{connectedCallback(){this.panel=this.querySelector("[data-cl-panel]"),!(!this.panel||this.panel.dataset.clReady)&&(this.panel.dataset.clReady="1",this.buildColumns(),document.body.appendChild(this.panel),this.card=this.panel.querySelector(".chula-locale__panel"),this.closeBtn=this.panel.querySelector(".chula-locale__close"),this.scrollY=0,this.opener=null,document.addEventListener("click",e=>{const opener=e.target.closest("[data-cl-open]");if(!opener)return;e.preventDefault();const sidebar=document.getElementById("sidebar-menu");if(sidebar&&sidebar.shadowRoot){const sidebarClose=sidebar.shadowRoot.querySelector('[part~="close-button"]');sidebarClose&&sidebarClose.click(),setTimeout(()=>this.open(opener),60);return}if(opener.hasAttribute("data-chula-panel-nav")){setTimeout(()=>this.open(opener),60);return}this.open(opener)}),this.panel.querySelectorAll("[data-cl-close]").forEach(el=>el.addEventListener("click",()=>this.close())),document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(!this.panel.hidden){this.close();return}if(this.geoEl&&!this.geoEl.hidden&&this._hideGeo){try{localStorage.setItem("chulaGeoChoice","stayed")}catch{}this._hideGeo(!1)}}}),this.panel.addEventListener("click",e=>{const item=e.target.closest("[data-cl-item]");if(!item)return;if(item.dataset.clCountry===this.panel.dataset.currentCountry&&item.dataset.clLocaleValue===this.panel.dataset.currentLocale){e.preventDefault(),this.close();return}const localeInput=this.panel.querySelector("[data-cl-locale]");localeInput&&(localeInput.value=item.dataset.clLocaleValue),item.classList.add("is-loading"),this.panel.classList.add("is-submitting")}),window.chulaOpenLocalePanel=opener=>this.open(opener||null),this.geoEl=this.querySelector("[data-geo]"),this.initGeo())}lock(on){const root=document.documentElement;if(on){if(root.classList.contains("chula-locale-open"))return;this.scrollY=window.scrollY||window.pageYOffset||0;const gap=window.innerWidth-root.clientWidth;gap>0&&(document.body.style.paddingRight=gap+"px"),document.body.style.top=-this.scrollY+"px",root.classList.add("chula-locale-open")}else{if(!root.classList.contains("chula-locale-open"))return;root.classList.remove("chula-locale-open"),document.body.style.top="",document.body.style.paddingRight="",window.scrollTo(0,this.scrollY)}}initGeo(){const queue=window.chulaDialogQueue,geo=this.geoEl;if(!geo||window.Shopify&&window.Shopify.designMode)return;let choice=null;try{choice=localStorage.getItem("chulaGeoChoice")}catch{}if(choice)return;const current=(geo.dataset.currentCountry||"").toUpperCase(),root=(geo.dataset.root||"").replace(/\/$/,"");queue&&queue.claim("region");let reported=!1;const report=fn=>{if(!reported){if(reported=!0,!queue){fn&&fn();return}fn?queue.announce("region",fn):queue.decline("region")}};fetch(root+"/browsing_context_suggestions.json").then(r=>r.ok?r.json():null).then(data=>{if(!data)return report(null);const d=data.detected_values||{},iso=(d.country&&(d.country.handle||d.country.iso_code)||d.country_code||"").toUpperCase(),name=d.country&&d.country.name||d.country_name||iso;if(!iso||iso===current)return report(null);report(()=>(setTimeout(()=>{this.showGeo(iso,name)===!1&&window.chulaDialogQueue&&window.chulaDialogQueue.release("region")},800),!0))}).catch(()=>report(null))}showGeo(iso,name){const geo=this.geoEl;if(!geo||!this.panel.hidden)return!1;const body=geo.querySelector("[data-geo-body]");body.textContent=(body.dataset.template||"").replace("{country}",name);const acceptBtn=geo.querySelector("[data-geo-accept]");acceptBtn.textContent=(acceptBtn.dataset.template||"").replace("{country}",name);const remember=v=>{try{localStorage.setItem("chulaGeoChoice",v)}catch{}},releaseQueue=()=>{window.chulaDialogQueue&&window.chulaDialogQueue.release("region")},hideGeo=keepLock=>{geo.classList.remove("is-open"),keepLock||this.lock(!1),clearTimeout(this._geoTimer),this._geoTimer=setTimeout(()=>{geo.hidden=!0},700),releaseQueue()};this._hideGeo=hideGeo,geo.querySelectorAll("[data-geo-stay]").forEach(el=>el.addEventListener("click",()=>{remember("stayed"),hideGeo(!1)})),geo.querySelector("[data-geo-other]").addEventListener("click",()=>{remember("browsed"),geo.classList.remove("is-open"),geo.hidden=!0,releaseQueue(),this.showPanel()}),geo.querySelector("[data-geo-accept]").addEventListener("click",()=>{remember("accepted");let map={};try{map=JSON.parse(geo.dataset.localeMap||"{}")}catch{}const loc=map[iso]||"en",line=this.panel.querySelector('[data-cl-country="'+iso+'"][data-cl-locale-value="'+loc+'"]')||this.panel.querySelector('[data-cl-country="'+iso+'"]');if(line){line.click();return}const form=this.panel.querySelector("form");if(!form)return;const localeInput=this.panel.querySelector("[data-cl-locale]");localeInput&&(localeInput.value=loc);const input=document.createElement("input");input.type="hidden",input.name="country_code",input.value=iso,form.appendChild(input),form.submit()}),this.lock(!0),geo.hidden=!1,geo.offsetHeight,geo.classList.add("is-open");try{geo.querySelector(".chula-geo__close").focus({preventScroll:!0})}catch{}return!0}buildColumns(){const columns=this.panel.querySelector("[data-cl-columns]"),source=this.panel.querySelector("[data-cl-source]");if(!columns||!source)return;const lists={};
1ORDER.forEach(key=>{const region=document.createElement("div");region.className="chula-locale__region"+(key==="eu"?" chula-locale__region--eu":"");const title=document.createElement("p");title.className="chula-locale__region-title",title.textContent=columns.dataset["label"+key.charAt(0).toUpperCase()+key.slice(1)]||"";const list=document.createElement("div");list.className="chula-locale__region-list",region.appendChild(title),region.appendChild(list),columns.appendChild(region),lists[key]=list}),Array.prototype.slice.call(source.querySelectorAll("[data-cl-item]")).forEach(item=>{const key=LOOKUP[item.dataset.clCountry]||"ap";lists[key].appendChild(item)}),source.remove()}open(opener){this.opener=opener||null,this.lock(!0),this.showPanel()}showPanel(){this.panel.hidden=!1,this.panel.offsetHeight,this.panel.classList.add("is-open"),window.chulaFocusTrap&&window.chulaFocusTrap.activate(this.panel,null);try{this.closeBtn.focus({preventScroll:!0})}catch{this.closeBtn.focus()}}close(){if(window.chulaFocusTrap&&window.chulaFocusTrap.release(this.panel),this.panel.classList.remove("is-open"),this.lock(!1),clearTimeout(this._hideTimer),this._hideTimer=setTimeout(()=>{this.panel.hidden=!0},700),this.opener&&this.opener.isConnected)try{this.opener.focus({preventScroll:!0})}catch{this.opener.focus()}this.opener=null}}customElements.define("chula-locale-panel",ChulaLocalePanel)})(); 2//# sourceMappingURL=/cdn/shop/t/49/assets/chula-locale-panel.js.map?v=169955487199499373781790327941
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.