function i() {
  return typeof window < "u";
}
function l(t) {
  return p(t) ? (t.nodeName || "").toLowerCase() : "#document";
}
function s(t) {
  var e;
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
}
function N(t) {
  var e;
  return (e = (p(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
}
function p(t) {
  return i() ? t instanceof Node || t instanceof s(t).Node : !1;
}
function m(t) {
  return i() ? t instanceof Element || t instanceof s(t).Element : !1;
}
function w(t) {
  return i() ? t instanceof HTMLElement || t instanceof s(t).HTMLElement : !1;
}
function f(t) {
  return !i() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof s(t).ShadowRoot;
}
const E = /* @__PURE__ */ new Set(["inline", "contents"]);
function h(t) {
  const {
    overflow: e,
    overflowX: n,
    overflowY: o,
    display: r
  } = b(t);
  return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !E.has(r);
}
const T = /* @__PURE__ */ new Set(["table", "td", "th"]);
function A(t) {
  return T.has(l(t));
}
const v = [":popover-open", ":modal"];
function L(t) {
  return v.some((e) => {
    try {
      return t.matches(e);
    } catch {
      return !1;
    }
  });
}
const D = ["transform", "translate", "scale", "rotate", "perspective"], k = ["transform", "translate", "scale", "rotate", "perspective", "filter"], C = ["paint", "layout", "strict", "content"];
function V(t) {
  const e = O(), n = m(t) ? b(t) : t;
  return D.some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || k.some((o) => (n.willChange || "").includes(o)) || C.some((o) => (n.contain || "").includes(o));
}
function B(t) {
  let e = a(t);
  for (; w(e) && !y(e); ) {
    if (V(e))
      return e;
    if (L(e))
      return null;
    e = a(e);
  }
  return null;
}
function O() {
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
const R = /* @__PURE__ */ new Set(["html", "body", "#document"]);
function y(t) {
  return R.has(l(t));
}
function b(t) {
  return s(t).getComputedStyle(t);
}
function F(t) {
  return m(t) ? {
    scrollLeft: t.scrollLeft,
    scrollTop: t.scrollTop
  } : {
    scrollLeft: t.scrollX,
    scrollTop: t.scrollY
  };
}
function a(t) {
  if (l(t) === "html")
    return t;
  const e = (
    // Step into the shadow DOM of the parent of a slotted node.
    t.assignedSlot || // DOM Element detected.
    t.parentNode || // ShadowRoot detected.
    f(t) && t.host || // Fallback.
    N(t)
  );
  return f(e) ? e.host : e;
}
function g(t) {
  const e = a(t);
  return y(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : w(e) && h(e) ? e : g(e);
}
function d(t, e, n) {
  var o;
  e === void 0 && (e = []), n === void 0 && (n = !0);
  const r = g(t), S = r === ((o = t.ownerDocument) == null ? void 0 : o.body), c = s(r);
  if (S) {
    const u = _(c);
    return e.concat(c, c.visualViewport || [], h(r) ? r : [], u && n ? d(u) : []);
  }
  return e.concat(r, d(r, [], n));
}
function _(t) {
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
}
export {
  f as a,
  p as b,
  m as c,
  d,
  b as e,
  s as f,
  N as g,
  L as h,
  w as i,
  a as j,
  y as k,
  A as l,
  V as m,
  B as n,
  l as o,
  h as p,
  F as q,
  _ as r,
  O as s
};
//# sourceMappingURL=floating-ui.utils.dom-uiDUZc_y.mjs.map
