import{offsetParent as t}from"../../../../composed-offset-position/dist/composed-offset-position.esm.js";function getTabbableBoundary(t){var e,a;const n=getTabbableElements(t);return{start:null!=(e=n[0])?e:null,end:null!=(a=n[n.length-1])?a:null}}function getTabbableElements(e){const a=[];return function walk(n){if(n instanceof Element){if(n.hasAttribute("inert"))return;!a.includes(n)&&function isTabbable(e){const a=e.tagName.toLowerCase();return"-1"!==e.getAttribute("tabindex")&&!e.hasAttribute("disabled")&&(!e.hasAttribute("aria-disabled")||"false"===e.getAttribute("aria-disabled"))&&!("input"===a&&"radio"===e.getAttribute("type")&&!e.hasAttribute("checked"))&&(null!==e.offsetParent||null!==t(e))&&"hidden"!==window.getComputedStyle(e).visibility&&(!("audio"!==a&&"video"!==a||!e.hasAttribute("controls"))||!!e.hasAttribute("tabindex")||!(!e.hasAttribute("contenteditable")||"false"===e.getAttribute("contenteditable"))||["button","input","select","textarea","a","audio","video","summary"].includes(a))}(n)&&a.push(n);n instanceof HTMLSlotElement&&(t=>{var a;return(null==(a=t.getRootNode({composed:!0}))?void 0:a.host)!==e})(n)&&n.assignedElements({flatten:!0}).forEach((t=>{walk(t)})),null!==n.shadowRoot&&"open"===n.shadowRoot.mode&&walk(n.shadowRoot)}[...n.children].forEach((t=>walk(t)))}(e),a}export{getTabbableBoundary,getTabbableElements};