/**
 * Shadow-DOM-safe `document.activeElement`.
 *
 * When focus lives inside a shadow tree, `document.activeElement` reports
 * the shadow host; to reach the actual focused element you must descend
 * through each nested `shadowRoot.activeElement`.
 */
export function activeElement(doc) {
  let element = doc.activeElement;
  while (element?.shadowRoot?.activeElement != null) {
    element = element.shadowRoot.activeElement;
  }
  return element;
}
//# sourceMappingURL=active-element.jsx.map
