// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports","./guid","./componentsUtils"],function(k,Q,C){function x(f,e){function c(a){if(a){var b;(b=a.closest(e))||(a=a.getRootNode().host||null,b=c(a));a=b}else a=null;return a}return c(f)}function R(f,e){return D(f,e)}function D(f,e){if(f){var c=e(f);if(void 0!==c)return c;({parentNode:f}=f);return D(f instanceof ShadowRoot?f.host:f,e)}}async function E(f){if(f)return"function"===typeof f?.setFocus?f.setFocus():f.focus()}function F(f){if(f)return G(f,H)[0]??f}function I(f,e){return f?Array.from(f.children|| []).filter(c=>c?.matches(e)):[]}function S(f,e,c){e=":not([slot])"===e?I(f,":not([slot])"):Array.from(f.querySelectorAll(e));e=c&&!1===c.direct?e:e.filter(b=>b.parentElement===f);e=c?.matches?e.filter(b=>b?.matches(c.matches)):e;const a=c?.selector;return a?e.map(b=>Array.from(b.querySelectorAll(a))).reduce((b,d)=>[...b,...d],[]).filter(b=>!!b):e}function T(f,e,c){e=":not([slot])"===e?I(f,":not([slot])")[0]||null:f.querySelector(e);e=c&&!1===c.direct?e:e?.parentElement===f?e:null;e=c?.matches?e?.matches(c.matches)? e:null:e;return(f=c?.selector)?e?.querySelector(f):e}function U(f){return f.target.assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join("").trim()}function J(f){return!!K(f).length}function K(f){return f.target.assignedElements({flatten:!0})}var L='input:not([inert]) select:not([inert]) textarea:not([inert]) a[href]:not([inert]) button:not([inert]) [tabindex]:not(slot):not([inert]) audio[controls]:not([inert]) video[controls]:not([inert]) [contenteditable]:not([contenteditable\x3d"false"]):not([inert]) details\x3esummary:first-of-type:not([inert]) details:not([inert])'.split(" "), t=L.join(","),M="undefined"===typeof Element,q=M?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,u=!M&&Element.prototype.getRootNode?function(f){var e;return null===f||void 0===f?void 0:null===(e=f.getRootNode)||void 0===e?void 0:e.call(f)}:function(f){return null===f||void 0===f?void 0:f.ownerDocument},v=function a(e,c){var b;void 0===c&&(c=!0);var d=null===e||void 0===e?void 0:null===(b=e.getAttribute)||void 0===b?void 0:b.call(e, "inert");return""===d||"true"===d||c&&e&&a(e.parentNode)},N=function(e,c,a){if(v(e))return[];var b=Array.prototype.slice.apply(e.querySelectorAll(t));c&&q.call(e,t)&&b.unshift(e);return b=b.filter(a)},O=function d(c,a,b){for(var g=[],l=Array.from(c);l.length;){var h=l.shift();if(!v(h,!1))if("SLOT"===h.tagName){var m=h.assignedElements();m=d(m.length?m:h.children,!0,b);b.flatten?g.push.apply(g,m):g.push({scopeParent:h,candidates:m})}else{q.call(h,t)&&b.filter(h)&&(a||!c.includes(h))&&g.push(h);m=h.shadowRoot|| "function"===typeof b.getShadowRoot&&b.getShadowRoot(h);var n=!v(m,!1)&&(!b.shadowRootFilter||b.shadowRootFilter(h));m&&n?(m=d(!0===m?h.children:m.children,!0,b),b.flatten?g.push.apply(g,m):g.push({scopeParent:h,candidates:m})):l.unshift.apply(l,h.children)}}return g},y=function(c){if(!c)throw Error("No node provided");if(0>c.tabIndex){var a;if(!(a=/^(AUDIO|VIDEO|DETAILS)$/.test(c.tagName))){var b;a=null===c||void 0===c?void 0:null===(b=c.getAttribute)||void 0===b?void 0:b.call(c,"contenteditable"); a=""===a||"true"===a}if(a&&isNaN(parseInt(c.getAttribute("tabindex"),10)))return 0}return c.tabIndex},V=function(c,a){return c.tabIndex===a.tabIndex?c.documentOrder-a.documentOrder:c.tabIndex-a.tabIndex},W=function(c){return"DETAILS"===c.tagName&&Array.prototype.slice.apply(c.children).some(function(a){return"SUMMARY"===a.tagName})},X=function(c,a){for(var b=0;by(a)||!w(c,a)?!1:!0},aa=function(c){c=parseInt(c.getAttribute("tabindex"),10);return isNaN(c)|| 0<=c?!0:!1},ba=function b(a){var d=[],g=[];a.forEach(function(l,h){var m=!!l.scopeParent,n=m?l.scopeParent:l;var p=y(n);p=0>p&&m&&isNaN(parseInt(n.getAttribute("tabindex"),10))?0:p;var r=m?b(l.candidates):n;0===p?m?d.push.apply(d,r):d.push(n):g.push({documentOrder:h,tabIndex:p,item:l,isScope:m,content:r})});return g.sort(V).reduce(function(l,h){h.isScope?l.push.apply(l,h.content):l.push(h.content);return l},[]).concat(d)},G=function(a,b){b=b||{};a=b.getShadowRoot?O([a],b.includeContainer,{filter:B.bind(null, b),flatten:!1,getShadowRoot:b.getShadowRoot,shadowRootFilter:aa}):N(a,b.includeContainer,B.bind(null,b));return ba(a)},ca=L.concat("iframe").join(",");const H={getShadowRoot:!0};k.closestElementCrossShadowBoundary=x;k.containsCrossShadowBoundary=function(a,b){return!!R(b,d=>d===a?!0:void 0)};k.ensureId=function(a){return a?a.id=a.id||`${a.tagName.toLowerCase()}-${Q.guid()}`:""};k.filterDirectChildren=function(a,b){return Array.from(a.children).filter(d=>d.matches(b))};k.focusElement=E;k.focusElementInGroup= (a,b,d,g=!0)=>{b=a.indexOf(b);const l=b===a.length-1;g&&(d="previous"===d&&0===b?"last":"next"===d&&l?"first":d);a="previous"===d?a[b-1]||a[g?a.length-1:b]:"next"===d?a[b+1]||a[g?0:b]:"last"===d?a[a.length-1]:a[0];E(a);return a};k.focusFirstTabbable=function(a){F(a)?.focus()};k.focusable=function(a,b){b=b||{};return b.getShadowRoot?O([a],b.includeContainer,{filter:w.bind(null,b),flatten:!0,getShadowRoot:b.getShadowRoot}):N(a,b.includeContainer,w.bind(null,b))};k.getElementDir=function(a){return(a= x(a,"[dir]"))?a.getAttribute("dir"):"ltr"};k.getElementWidth=function(a){return a?parseFloat(getComputedStyle(a).inlineSize):0};k.getFirstTabbable=F;k.getModeName=function(a){return x(a,`.${C.CSS_UTILITY.darkMode}, .${C.CSS_UTILITY.lightMode}`)?.classList.contains("calcite-mode-dark")?"dark":"light"};k.getShadowRootNode=function(a){a=a.getRootNode();return"host"in a?a:null};k.getSlotted=function(a,b,d){b&&!Array.isArray(b)&&"string"!==typeof b&&(d=b,b=null);b=b?Array.isArray(b)?b.map(g=>`[slot="${g}"]`).join(","): `[slot="${b}"]`:":not([slot])";return d?.all?S(a,b,d):T(a,b,d)};k.getTabIndex=y;k.getTextWidth=function(a,b){if(!a)return 0;const d=document.createElement("canvas").getContext("2d");d.font=b;return d.measureText(a).width};k.intersects=function(a,b){return!(b.left>a.right||b.righta.bottom||b.bottom