function f(t=document.activeElement){if(t!=null&&t.shadowRoot){let e=t.shadowRoot.activeElement;if(e)return f(e)}return t}function r(t){let e=t.tagName.toLowerCase();return t.getAttribute("tabindex")==="-1"||t.hasAttribute("disabled")||t.hasAttribute("aria-disabled")&&t.getAttribute("aria-disabled")!=="false"||e==="input"&&t.getAttribute("type")==="radio"&&!t.hasAttribute("checked")||t.offsetParent===null&&!(t.getRootNode()instanceof ShadowRoot)||window.getComputedStyle(t).visibility==="hidden"?!1:(e==="audio"||e==="video")&&t.hasAttribute("controls")||t.hasAttribute("tabindex")||t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")!=="false"?!0:["button","input","select","textarea","a","audio","video","summary"].includes(e)}function b(t){var o,i;let e=[];function a(n){n instanceof HTMLElement&&(e.push(n),n.shadowRoot!==null&&n.shadowRoot.mode==="open"&&a(n.shadowRoot)),[...n.children].forEach(d=>a(d))}a(t);let u=(o=e.find(n=>r(n)))!=null?o:null,s=(i=e.reverse().find(n=>r(n)))!=null?i:null;return{start:u,end:s}}export{f as a,b};
