/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import{p as a}from"./IXZEUVT2.js";function C(e){return h(e)||f(e)}function d(e){return m(e).filter(n=>n.nodeType===Node.TEXT_NODE).map(n=>n.textContent).join("").trim()}function f(e){return d(e).length>0}function m(e){return e.currentTarget.assignedNodes({flatten:!0})}function h(e){return g(e).length>0}function g(e,n){return E(e.target,n)}function E(e,n){let t=e.assignedElements({flatten:!0});return n?t.filter(s=>s.matches(n)):t}var p=["arcgis-map","arcgis-scene","arcgis-link-chart"];function T(e,n){let t=n??e.referenceElement;if(typeof t!="string")return t??void 0;let s=t.includes("#")||t.includes(".")||t.includes("["),o=e.el.getRootNode(),r=(s?void 0:o.querySelector(`#${t}`))??o.querySelector(t)??(s?void 0:c(e.el,`#${t}`))??c(e.el,t);if(r==null){a("error",e,`Expected property \`referenceElement\` to resolve to an <arcgis-map>, <arcgis-scene>, or <arcgis-link-chart> element, but no element matched \`${t}\`.`);return}return p.includes(r.localName)||a("error",e,`Expected property \`referenceElement\` to point to an <arcgis-map>, <arcgis-scene>, or <arcgis-link-chart> element, but instead found <${r?.localName}>.`,{detail:{referenceElement:t,resolved:r}}),r??void 0}var w=(...e)=>{let n=[];for(let s=0;s<e.length;++s){let o=e[s];if(typeof o=="string")n.push(o);else if(Array.isArray(o))n.push.apply(n,o);else if(typeof o=="object")for(let r in o)o[r]&&n.push(r)}let t=n.join(" ");return n.length=0,t},b=(e,n)=>{let t=e;for(;t;){if(t===n)return!0;if(!t.parentNode)return!1;t.parentNode instanceof ShadowRoot?t=t.parentNode.host:t=t.parentNode}return!1},A=(e,n,t)=>{let s=v(n).subscribe;return s(o=>{o.some(i=>b(e,i.target))&&t()})},l={},v=e=>{let n=e.join(","),t=l[n];if(t!==void 0)return t;let s=new Set,o=new MutationObserver(i=>s.forEach(u=>u(i)));globalThis.document&&o.observe(document.documentElement,{attributes:!0,attributeFilter:e,subtree:!0});let r={subscribe:i=>(s.add(i),()=>{s.delete(i),s.size===0&&(o.disconnect(),l[n]=void 0)})};return l[n]=r,r},c=(e,n)=>{let t=e;for(;t;){let s=t.closest?.(n);if(s)return s;let o=t.getRootNode?.();if(o===globalThis.document)return;t=o?.host}};function R(e){let n=c(e,".calcite-mode-dark, .calcite-mode-light, .calcite-mode-auto");return n?.classList.contains("calcite-mode-dark")||n?.classList.contains("calcite-mode-auto")&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var x=(e,n,t)=>c(e,`[${n}]`)?.getAttribute(n)??t,O=async e=>{e!=null&&(N(e)?await e.setFocus():e.focus())},N=e=>typeof e.setFocus=="function";export{C as a,E as b,T as c,w as d,A as e,c as f,R as g,x as h,O as i};
