import { f as a, p as s } from "./safeReact.js";
import { i } from "./detectBrowser.js";
import { c as o } from "./constants.js";
import { n as u } from "./shadowDom.js";
function h(t, e) {
  if (!a(t)) return !1;
  const r = t;
  if (e.hasElement(r)) return !r.hasAttribute("data-trigger-disabled");
  for (const [, n] of e.entries()) if (u(n, r)) return !n.hasAttribute("data-trigger-disabled");
  return !1;
}
function p(t, e) {
  if (e == null) return !1;
  if ("composedPath" in t) return t.composedPath().includes(e);
  const r = t;
  return r.target != null && e.contains(r.target);
}
function E(t) {
  return t.matches("html,body");
}
function c(t) {
  return s(t) && t.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])");
}
function T(t) {
  return t?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${o}`) != null;
}
function g(t) {
  return t ? t.getAttribute("role") === "combobox" && c(t) : !1;
}
function A(t) {
  if (!t || i) return !0;
  try {
    return t.matches(":focus-visible");
  } catch {
    return !0;
  }
}
function x(t) {
  return t ? t.hasAttribute("data-base-ui-focusable") ? t : t.querySelector("[data-base-ui-focusable]") || t : null;
}
export {
  h as a,
  A as c,
  E as i,
  p as n,
  g as o,
  T as r,
  c as s,
  x as t
};

//# sourceMappingURL=element.js.map