/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
v5.0.0-next.22 */
var E=(t,e)=>{let n=t;for(;n;){if(n===e)return!0;if(!n.parentNode)return!1;n.parentNode instanceof ShadowRoot?n=n.parentNode.host:n=n.parentNode}return!1},f=(t,e,n)=>{let o=v(e).subscribe;return o(s=>{s.some(r=>E(t,r.target))&&n()})},u={},v=t=>{let e=t.join(","),n=u[e];if(n!==void 0)return n;let o=new Set,s=new MutationObserver(r=>o.forEach(l=>l(r)));globalThis.document&&s.observe(document.documentElement,{attributes:!0,attributeFilter:t,subtree:!0});let c={subscribe:r=>(o.add(r),()=>{o.delete(r),o.size===0&&(s.disconnect(),u[e]=void 0)})};return u[e]=c,c},h=(t,e)=>{let n=t;for(;n;){let o=n.closest?.(e);if(o)return o;let s=n.getRootNode?.();if(s===globalThis.document)return;n=s.host}};function S(t){let e=h(t,".calcite-mode-dark, .calcite-mode-light, .calcite-mode-auto");return e?.classList.contains("calcite-mode-dark")||e?.classList.contains("calcite-mode-auto")&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var g=(t,e,n)=>h(t,`[${e}]`)?.getAttribute(e)??n,$=async t=>{t!=null&&(m(t)?await t.setFocus():t.focus())},m=t=>typeof t.setFocus=="function",k=(t,e)=>{if(t?.shadowRoot){if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated")){i(t,e);return}Promise.resolve(t.componentOnReady?.()).then(()=>i(t,e))}},C=t=>t.nodeType===Node.ELEMENT_NODE,i=(t,e="")=>{if(!C(t))return!1;if(t.matches(e))return m(t)&&setTimeout(()=>void t.setFocus(),0),!0;for(let o of t.children)if(i(o,e))return!0;let n=t.shadowRoot;if(n){for(let o of n.children)if(i(o,e))return!0}return!1};var N="ar,bg,bs,ca,cs,da,de,el,en,es,et,fi,fr,he,hr,hu,id,it,ja,ko,lt,lv,nl,nb,no,pl,pt-BR,pt-PT,ro,ru,sk,sl,sr,sv,th,tr,uk,vi,zh-CN,zh-HK,zh-TW".split(","),y=new Set(N),a="en",L={pt:"pt-PT",nb:"no",nn:"no",zh:"zh-CN"},T=async(t,e,n="")=>{let o=`${e}/${n}`,s=`${o}${t}.json`;return d[s]??(d[s]=p(t,o)),await d[s]},d={},p=async(t,e)=>{let n=`${e}${t}.json`;try{let o=await fetch(n);if(o.ok)return await o.json()}catch(o){return console.error(o),{}}return t===a?{}:await p(a,e)},A=t=>{let e=g(t,"lang",globalThis.navigator?.language||a);return{lang:e,t9nLocale:b(e)}},b=t=>{let[e,n]=t.split("-"),o=e.toLowerCase(),s=o;return n&&(s=`${o}-${n.toUpperCase()}`),s=L[s]??s,y.has(s)?s:n?b(o):a},j=(t,e,n,o)=>{let s,c=()=>w(t,e(),o).then(r=>{(s?.lang!==r.lang||s.t9nLocale!==r.t9nLocale||s.t9nStrings!==r.t9nStrings)&&n(r),s=r}).catch(console.error);return queueMicrotask(c),f(t,["lang"],c)},w=async(t,e,n=t.localName.split("-").slice(1).join("-"))=>{let{lang:o,t9nLocale:s}=A(t),c=`${e}/${n}/t9n`,l=n===null?{}:await T(s,c,"messages.");return{lang:o,t9nLocale:s,t9nStrings:l}};export{f as a,S as b,$ as c,k as d,y as e,T as f,A as g,b as h,j as i};
