import * as y from "react";
import { useLayoutEffect as Te, useEffect as Me } from "react";
import { f as mt, u as gt, P as it, b as vt, g as ke, h as Et, c as Fe, e as Ne } from "./index-5908484b.js";
import { jsx as H } from "react/jsx-runtime";
import * as $e from "react-dom";
function We(t, e = globalThis == null ? void 0 : globalThis.document) {
  const n = mt(t);
  y.useEffect(() => {
    const o = (r) => {
      r.key === "Escape" && n(r);
    };
    return e.addEventListener("keydown", o, { capture: !0 }), () => e.removeEventListener("keydown", o, { capture: !0 });
  }, [n, e]);
}
var Be = "DismissableLayer", Pt = "dismissableLayer.update", He = "dismissableLayer.pointerDownOutside", _e = "dismissableLayer.focusOutside", Yt, te = y.createContext({
  layers: /* @__PURE__ */ new Set(),
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
  branches: /* @__PURE__ */ new Set()
}), Ie = y.forwardRef(
  (t, e) => {
    const {
      disableOutsidePointerEvents: n = !1,
      onEscapeKeyDown: o,
      onPointerDownOutside: r,
      onFocusOutside: i,
      onInteractOutside: s,
      onDismiss: c,
      ...f
    } = t, l = y.useContext(te), [a, u] = y.useState(null), p = (a == null ? void 0 : a.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, d] = y.useState({}), h = gt(e, (x) => u(x)), m = Array.from(l.layers), [w] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), g = m.indexOf(w), v = a ? m.indexOf(a) : -1, E = l.layersWithOutsidePointerEventsDisabled.size > 0, b = v >= g, A = Ye((x) => {
      const C = x.target, M = [...l.branches].some((O) => O.contains(C));
      !b || M || (r == null || r(x), s == null || s(x), x.defaultPrevented || c == null || c());
    }, p), P = je((x) => {
      const C = x.target;
      [...l.branches].some((O) => O.contains(C)) || (i == null || i(x), s == null || s(x), x.defaultPrevented || c == null || c());
    }, p);
    return We((x) => {
      v === l.layers.size - 1 && (o == null || o(x), !x.defaultPrevented && c && (x.preventDefault(), c()));
    }, p), y.useEffect(() => {
      if (a)
        return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (Yt = p.body.style.pointerEvents, p.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(a)), l.layers.add(a), jt(), () => {
          n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (p.body.style.pointerEvents = Yt);
        };
    }, [a, p, n, l]), y.useEffect(() => () => {
      a && (l.layers.delete(a), l.layersWithOutsidePointerEventsDisabled.delete(a), jt());
    }, [a, l]), y.useEffect(() => {
      const x = () => d({});
      return document.addEventListener(Pt, x), () => document.removeEventListener(Pt, x);
    }, []), /* @__PURE__ */ H(
      it.div,
      {
        ...f,
        ref: h,
        style: {
          pointerEvents: E ? b ? "auto" : "none" : void 0,
          ...t.style
        },
        onFocusCapture: vt(t.onFocusCapture, P.onFocusCapture),
        onBlurCapture: vt(t.onBlurCapture, P.onBlurCapture),
        onPointerDownCapture: vt(
          t.onPointerDownCapture,
          A.onPointerDownCapture
        )
      }
    );
  }
);
Ie.displayName = Be;
var ze = "DismissableLayerBranch", Ve = y.forwardRef((t, e) => {
  const n = y.useContext(te), o = y.useRef(null), r = gt(e, o);
  return y.useEffect(() => {
    const i = o.current;
    if (i)
      return n.branches.add(i), () => {
        n.branches.delete(i);
      };
  }, [n.branches]), /* @__PURE__ */ H(it.div, { ...t, ref: r });
});
Ve.displayName = ze;
function Ye(t, e = globalThis == null ? void 0 : globalThis.document) {
  const n = mt(t), o = y.useRef(!1), r = y.useRef(() => {
  });
  return y.useEffect(() => {
    const i = (c) => {
      if (c.target && !o.current) {
        let f = function() {
          ee(
            He,
            n,
            l,
            { discrete: !0 }
          );
        };
        const l = { originalEvent: c };
        c.pointerType === "touch" ? (e.removeEventListener("click", r.current), r.current = f, e.addEventListener("click", r.current, { once: !0 })) : f();
      } else
        e.removeEventListener("click", r.current);
      o.current = !1;
    }, s = window.setTimeout(() => {
      e.addEventListener("pointerdown", i);
    }, 0);
    return () => {
      window.clearTimeout(s), e.removeEventListener("pointerdown", i), e.removeEventListener("click", r.current);
    };
  }, [e, n]), {
    // ensures we check React component tree (not just DOM tree)
    onPointerDownCapture: () => o.current = !0
  };
}
function je(t, e = globalThis == null ? void 0 : globalThis.document) {
  const n = mt(t), o = y.useRef(!1);
  return y.useEffect(() => {
    const r = (i) => {
      i.target && !o.current && ee(_e, n, { originalEvent: i }, {
        discrete: !1
      });
    };
    return e.addEventListener("focusin", r), () => e.removeEventListener("focusin", r);
  }, [e, n]), {
    onFocusCapture: () => o.current = !0,
    onBlurCapture: () => o.current = !1
  };
}
function jt() {
  const t = new CustomEvent(Pt);
  document.dispatchEvent(t);
}
function ee(t, e, n, { discrete: o }) {
  const r = n.originalEvent.target, i = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: n });
  e && r.addEventListener(t, e, { once: !0 }), o ? ke(r, i) : r.dispatchEvent(i);
}
var Xe = y["useId".toString()] || (() => {
}), Ue = 0;
function oo(t) {
  const [e, n] = y.useState(Xe());
  return Et(() => {
    t || n((o) => o ?? String(Ue++));
  }, [t]), t || (e ? `radix-${e}` : "");
}
const qe = ["top", "right", "bottom", "left"], q = Math.min, $ = Math.max, ut = Math.round, at = Math.floor, V = (t) => ({
  x: t,
  y: t
}), Ke = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
}, Ze = {
  start: "end",
  end: "start"
};
function Rt(t, e, n) {
  return $(t, q(e, n));
}
function X(t, e) {
  return typeof t == "function" ? t(e) : t;
}
function U(t) {
  return t.split("-")[0];
}
function tt(t) {
  return t.split("-")[1];
}
function St(t) {
  return t === "x" ? "y" : "x";
}
function Dt(t) {
  return t === "y" ? "height" : "width";
}
function K(t) {
  return ["top", "bottom"].includes(U(t)) ? "y" : "x";
}
function Lt(t) {
  return St(K(t));
}
function Ge(t, e, n) {
  n === void 0 && (n = !1);
  const o = tt(t), r = Lt(t), i = Dt(r);
  let s = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
  return e.reference[i] > e.floating[i] && (s = dt(s)), [s, dt(s)];
}
function Je(t) {
  const e = dt(t);
  return [Ct(t), e, Ct(e)];
}
function Ct(t) {
  return t.replace(/start|end/g, (e) => Ze[e]);
}
function Qe(t, e, n) {
  const o = ["left", "right"], r = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
  switch (t) {
    case "top":
    case "bottom":
      return n ? e ? r : o : e ? o : r;
    case "left":
    case "right":
      return e ? i : s;
    default:
      return [];
  }
}
function tn(t, e, n, o) {
  const r = tt(t);
  let i = Qe(U(t), n === "start", o);
  return r && (i = i.map((s) => s + "-" + r), e && (i = i.concat(i.map(Ct)))), i;
}
function dt(t) {
  return t.replace(/left|right|bottom|top/g, (e) => Ke[e]);
}
function en(t) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...t
  };
}
function ne(t) {
  return typeof t != "number" ? en(t) : {
    top: t,
    right: t,
    bottom: t,
    left: t
  };
}
function pt(t) {
  const {
    x: e,
    y: n,
    width: o,
    height: r
  } = t;
  return {
    width: o,
    height: r,
    top: n,
    left: e,
    right: e + o,
    bottom: n + r,
    x: e,
    y: n
  };
}
function Xt(t, e, n) {
  let {
    reference: o,
    floating: r
  } = t;
  const i = K(e), s = Lt(e), c = Dt(s), f = U(e), l = i === "y", a = o.x + o.width / 2 - r.width / 2, u = o.y + o.height / 2 - r.height / 2, p = o[c] / 2 - r[c] / 2;
  let d;
  switch (f) {
    case "top":
      d = {
        x: a,
        y: o.y - r.height
      };
      break;
    case "bottom":
      d = {
        x: a,
        y: o.y + o.height
      };
      break;
    case "right":
      d = {
        x: o.x + o.width,
        y: u
      };
      break;
    case "left":
      d = {
        x: o.x - r.width,
        y: u
      };
      break;
    default:
      d = {
        x: o.x,
        y: o.y
      };
  }
  switch (tt(e)) {
    case "start":
      d[s] -= p * (n && l ? -1 : 1);
      break;
    case "end":
      d[s] += p * (n && l ? -1 : 1);
      break;
  }
  return d;
}
const nn = async (t, e, n) => {
  const {
    placement: o = "bottom",
    strategy: r = "absolute",
    middleware: i = [],
    platform: s
  } = n, c = i.filter(Boolean), f = await (s.isRTL == null ? void 0 : s.isRTL(e));
  let l = await s.getElementRects({
    reference: t,
    floating: e,
    strategy: r
  }), {
    x: a,
    y: u
  } = Xt(l, o, f), p = o, d = {}, h = 0;
  for (let m = 0; m < c.length; m++) {
    const {
      name: w,
      fn: g
    } = c[m], {
      x: v,
      y: E,
      data: b,
      reset: A
    } = await g({
      x: a,
      y: u,
      initialPlacement: o,
      placement: p,
      strategy: r,
      middlewareData: d,
      rects: l,
      platform: s,
      elements: {
        reference: t,
        floating: e
      }
    });
    a = v ?? a, u = E ?? u, d = {
      ...d,
      [w]: {
        ...d[w],
        ...b
      }
    }, A && h <= 50 && (h++, typeof A == "object" && (A.placement && (p = A.placement), A.rects && (l = A.rects === !0 ? await s.getElementRects({
      reference: t,
      floating: e,
      strategy: r
    }) : A.rects), {
      x: a,
      y: u
    } = Xt(l, p, f)), m = -1);
  }
  return {
    x: a,
    y: u,
    placement: p,
    strategy: r,
    middlewareData: d
  };
};
async function ot(t, e) {
  var n;
  e === void 0 && (e = {});
  const {
    x: o,
    y: r,
    platform: i,
    rects: s,
    elements: c,
    strategy: f
  } = t, {
    boundary: l = "clippingAncestors",
    rootBoundary: a = "viewport",
    elementContext: u = "floating",
    altBoundary: p = !1,
    padding: d = 0
  } = X(e, t), h = ne(d), w = c[p ? u === "floating" ? "reference" : "floating" : u], g = pt(await i.getClippingRect({
    element: (n = await (i.isElement == null ? void 0 : i.isElement(w))) == null || n ? w : w.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
    boundary: l,
    rootBoundary: a,
    strategy: f
  })), v = u === "floating" ? {
    x: o,
    y: r,
    width: s.floating.width,
    height: s.floating.height
  } : s.reference, E = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), b = await (i.isElement == null ? void 0 : i.isElement(E)) ? await (i.getScale == null ? void 0 : i.getScale(E)) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  }, A = pt(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements: c,
    rect: v,
    offsetParent: E,
    strategy: f
  }) : v);
  return {
    top: (g.top - A.top + h.top) / b.y,
    bottom: (A.bottom - g.bottom + h.bottom) / b.y,
    left: (g.left - A.left + h.left) / b.x,
    right: (A.right - g.right + h.right) / b.x
  };
}
const on = (t) => ({
  name: "arrow",
  options: t,
  async fn(e) {
    const {
      x: n,
      y: o,
      placement: r,
      rects: i,
      platform: s,
      elements: c,
      middlewareData: f
    } = e, {
      element: l,
      padding: a = 0
    } = X(t, e) || {};
    if (l == null)
      return {};
    const u = ne(a), p = {
      x: n,
      y: o
    }, d = Lt(r), h = Dt(d), m = await s.getDimensions(l), w = d === "y", g = w ? "top" : "left", v = w ? "bottom" : "right", E = w ? "clientHeight" : "clientWidth", b = i.reference[h] + i.reference[d] - p[d] - i.floating[h], A = p[d] - i.reference[d], P = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l));
    let x = P ? P[E] : 0;
    (!x || !await (s.isElement == null ? void 0 : s.isElement(P))) && (x = c.floating[E] || i.floating[h]);
    const C = b / 2 - A / 2, M = x / 2 - m[h] / 2 - 1, O = q(u[g], M), F = q(u[v], M), N = O, D = x - m[h] - F, S = x / 2 - m[h] / 2 + C, B = Rt(N, S, D), L = !f.arrow && tt(r) != null && S !== B && i.reference[h] / 2 - (S < N ? O : F) - m[h] / 2 < 0, T = L ? S < N ? S - N : S - D : 0;
    return {
      [d]: p[d] + T,
      data: {
        [d]: B,
        centerOffset: S - B - T,
        ...L && {
          alignmentOffset: T
        }
      },
      reset: L
    };
  }
}), rn = function(t) {
  return t === void 0 && (t = {}), {
    name: "flip",
    options: t,
    async fn(e) {
      var n, o;
      const {
        placement: r,
        middlewareData: i,
        rects: s,
        initialPlacement: c,
        platform: f,
        elements: l
      } = e, {
        mainAxis: a = !0,
        crossAxis: u = !0,
        fallbackPlacements: p,
        fallbackStrategy: d = "bestFit",
        fallbackAxisSideDirection: h = "none",
        flipAlignment: m = !0,
        ...w
      } = X(t, e);
      if ((n = i.arrow) != null && n.alignmentOffset)
        return {};
      const g = U(r), v = K(c), E = U(c) === c, b = await (f.isRTL == null ? void 0 : f.isRTL(l.floating)), A = p || (E || !m ? [dt(c)] : Je(c)), P = h !== "none";
      !p && P && A.push(...tn(c, m, h, b));
      const x = [c, ...A], C = await ot(e, w), M = [];
      let O = ((o = i.flip) == null ? void 0 : o.overflows) || [];
      if (a && M.push(C[g]), u) {
        const S = Ge(r, s, b);
        M.push(C[S[0]], C[S[1]]);
      }
      if (O = [...O, {
        placement: r,
        overflows: M
      }], !M.every((S) => S <= 0)) {
        var F, N;
        const S = (((F = i.flip) == null ? void 0 : F.index) || 0) + 1, B = x[S];
        if (B)
          return {
            data: {
              index: S,
              overflows: O
            },
            reset: {
              placement: B
            }
          };
        let L = (N = O.filter((T) => T.overflows[0] <= 0).sort((T, R) => T.overflows[1] - R.overflows[1])[0]) == null ? void 0 : N.placement;
        if (!L)
          switch (d) {
            case "bestFit": {
              var D;
              const T = (D = O.filter((R) => {
                if (P) {
                  const k = K(R.placement);
                  return k === v || // Create a bias to the `y` side axis due to horizontal
                  // reading directions favoring greater width.
                  k === "y";
                }
                return !0;
              }).map((R) => [R.placement, R.overflows.filter((k) => k > 0).reduce((k, z) => k + z, 0)]).sort((R, k) => R[1] - k[1])[0]) == null ? void 0 : D[0];
              T && (L = T);
              break;
            }
            case "initialPlacement":
              L = c;
              break;
          }
        if (r !== L)
          return {
            reset: {
              placement: L
            }
          };
      }
      return {};
    }
  };
};
function Ut(t, e) {
  return {
    top: t.top - e.height,
    right: t.right - e.width,
    bottom: t.bottom - e.height,
    left: t.left - e.width
  };
}
function qt(t) {
  return qe.some((e) => t[e] >= 0);
}
const sn = function(t) {
  return t === void 0 && (t = {}), {
    name: "hide",
    options: t,
    async fn(e) {
      const {
        rects: n
      } = e, {
        strategy: o = "referenceHidden",
        ...r
      } = X(t, e);
      switch (o) {
        case "referenceHidden": {
          const i = await ot(e, {
            ...r,
            elementContext: "reference"
          }), s = Ut(i, n.reference);
          return {
            data: {
              referenceHiddenOffsets: s,
              referenceHidden: qt(s)
            }
          };
        }
        case "escaped": {
          const i = await ot(e, {
            ...r,
            altBoundary: !0
          }), s = Ut(i, n.floating);
          return {
            data: {
              escapedOffsets: s,
              escaped: qt(s)
            }
          };
        }
        default:
          return {};
      }
    }
  };
};
async function cn(t, e) {
  const {
    placement: n,
    platform: o,
    elements: r
  } = t, i = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), s = U(n), c = tt(n), f = K(n) === "y", l = ["left", "top"].includes(s) ? -1 : 1, a = i && f ? -1 : 1, u = X(e, t);
  let {
    mainAxis: p,
    crossAxis: d,
    alignmentAxis: h
  } = typeof u == "number" ? {
    mainAxis: u,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: u.mainAxis || 0,
    crossAxis: u.crossAxis || 0,
    alignmentAxis: u.alignmentAxis
  };
  return c && typeof h == "number" && (d = c === "end" ? h * -1 : h), f ? {
    x: d * a,
    y: p * l
  } : {
    x: p * l,
    y: d * a
  };
}
const ln = function(t) {
  return t === void 0 && (t = 0), {
    name: "offset",
    options: t,
    async fn(e) {
      var n, o;
      const {
        x: r,
        y: i,
        placement: s,
        middlewareData: c
      } = e, f = await cn(e, t);
      return s === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
        x: r + f.x,
        y: i + f.y,
        data: {
          ...f,
          placement: s
        }
      };
    }
  };
}, an = function(t) {
  return t === void 0 && (t = {}), {
    name: "shift",
    options: t,
    async fn(e) {
      const {
        x: n,
        y: o,
        placement: r
      } = e, {
        mainAxis: i = !0,
        crossAxis: s = !1,
        limiter: c = {
          fn: (w) => {
            let {
              x: g,
              y: v
            } = w;
            return {
              x: g,
              y: v
            };
          }
        },
        ...f
      } = X(t, e), l = {
        x: n,
        y: o
      }, a = await ot(e, f), u = K(U(r)), p = St(u);
      let d = l[p], h = l[u];
      if (i) {
        const w = p === "y" ? "top" : "left", g = p === "y" ? "bottom" : "right", v = d + a[w], E = d - a[g];
        d = Rt(v, d, E);
      }
      if (s) {
        const w = u === "y" ? "top" : "left", g = u === "y" ? "bottom" : "right", v = h + a[w], E = h - a[g];
        h = Rt(v, h, E);
      }
      const m = c.fn({
        ...e,
        [p]: d,
        [u]: h
      });
      return {
        ...m,
        data: {
          x: m.x - n,
          y: m.y - o,
          enabled: {
            [p]: i,
            [u]: s
          }
        }
      };
    }
  };
}, fn = function(t) {
  return t === void 0 && (t = {}), {
    options: t,
    fn(e) {
      const {
        x: n,
        y: o,
        placement: r,
        rects: i,
        middlewareData: s
      } = e, {
        offset: c = 0,
        mainAxis: f = !0,
        crossAxis: l = !0
      } = X(t, e), a = {
        x: n,
        y: o
      }, u = K(r), p = St(u);
      let d = a[p], h = a[u];
      const m = X(c, e), w = typeof m == "number" ? {
        mainAxis: m,
        crossAxis: 0
      } : {
        mainAxis: 0,
        crossAxis: 0,
        ...m
      };
      if (f) {
        const E = p === "y" ? "height" : "width", b = i.reference[p] - i.floating[E] + w.mainAxis, A = i.reference[p] + i.reference[E] - w.mainAxis;
        d < b ? d = b : d > A && (d = A);
      }
      if (l) {
        var g, v;
        const E = p === "y" ? "width" : "height", b = ["top", "left"].includes(U(r)), A = i.reference[u] - i.floating[E] + (b && ((g = s.offset) == null ? void 0 : g[u]) || 0) + (b ? 0 : w.crossAxis), P = i.reference[u] + i.reference[E] + (b ? 0 : ((v = s.offset) == null ? void 0 : v[u]) || 0) - (b ? w.crossAxis : 0);
        h < A ? h = A : h > P && (h = P);
      }
      return {
        [p]: d,
        [u]: h
      };
    }
  };
}, un = function(t) {
  return t === void 0 && (t = {}), {
    name: "size",
    options: t,
    async fn(e) {
      var n, o;
      const {
        placement: r,
        rects: i,
        platform: s,
        elements: c
      } = e, {
        apply: f = () => {
        },
        ...l
      } = X(t, e), a = await ot(e, l), u = U(r), p = tt(r), d = K(r) === "y", {
        width: h,
        height: m
      } = i.floating;
      let w, g;
      u === "top" || u === "bottom" ? (w = u, g = p === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (g = u, w = p === "end" ? "top" : "bottom");
      const v = m - a.top - a.bottom, E = h - a.left - a.right, b = q(m - a[w], v), A = q(h - a[g], E), P = !e.middlewareData.shift;
      let x = b, C = A;
      if ((n = e.middlewareData.shift) != null && n.enabled.x && (C = E), (o = e.middlewareData.shift) != null && o.enabled.y && (x = v), P && !p) {
        const O = $(a.left, 0), F = $(a.right, 0), N = $(a.top, 0), D = $(a.bottom, 0);
        d ? C = h - 2 * (O !== 0 || F !== 0 ? O + F : $(a.left, a.right)) : x = m - 2 * (N !== 0 || D !== 0 ? N + D : $(a.top, a.bottom));
      }
      await f({
        ...e,
        availableWidth: C,
        availableHeight: x
      });
      const M = await s.getDimensions(c.floating);
      return h !== M.width || m !== M.height ? {
        reset: {
          rects: !0
        }
      } : {};
    }
  };
};
function wt() {
  return typeof window < "u";
}
function et(t) {
  return oe(t) ? (t.nodeName || "").toLowerCase() : "#document";
}
function W(t) {
  var e;
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
}
function j(t) {
  var e;
  return (e = (oe(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
}
function oe(t) {
  return wt() ? t instanceof Node || t instanceof W(t).Node : !1;
}
function _(t) {
  return wt() ? t instanceof Element || t instanceof W(t).Element : !1;
}
function Y(t) {
  return wt() ? t instanceof HTMLElement || t instanceof W(t).HTMLElement : !1;
}
function Kt(t) {
  return !wt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof W(t).ShadowRoot;
}
function st(t) {
  const {
    overflow: e,
    overflowX: n,
    overflowY: o,
    display: r
  } = I(t);
  return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !["inline", "contents"].includes(r);
}
function dn(t) {
  return ["table", "td", "th"].includes(et(t));
}
function yt(t) {
  return [":popover-open", ":modal"].some((e) => {
    try {
      return t.matches(e);
    } catch {
      return !1;
    }
  });
}
function Tt(t) {
  const e = Mt(), n = _(t) ? I(t) : t;
  return ["transform", "translate", "scale", "rotate", "perspective"].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) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
}
function pn(t) {
  let e = Z(t);
  for (; Y(e) && !Q(e); ) {
    if (Tt(e))
      return e;
    if (yt(e))
      return null;
    e = Z(e);
  }
  return null;
}
function Mt() {
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function Q(t) {
  return ["html", "body", "#document"].includes(et(t));
}
function I(t) {
  return W(t).getComputedStyle(t);
}
function xt(t) {
  return _(t) ? {
    scrollLeft: t.scrollLeft,
    scrollTop: t.scrollTop
  } : {
    scrollLeft: t.scrollX,
    scrollTop: t.scrollY
  };
}
function Z(t) {
  if (et(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.
    Kt(t) && t.host || // Fallback.
    j(t)
  );
  return Kt(e) ? e.host : e;
}
function re(t) {
  const e = Z(t);
  return Q(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : Y(e) && st(e) ? e : re(e);
}
function rt(t, e, n) {
  var o;
  e === void 0 && (e = []), n === void 0 && (n = !0);
  const r = re(t), i = r === ((o = t.ownerDocument) == null ? void 0 : o.body), s = W(r);
  if (i) {
    const c = Ot(s);
    return e.concat(s, s.visualViewport || [], st(r) ? r : [], c && n ? rt(c) : []);
  }
  return e.concat(r, rt(r, [], n));
}
function Ot(t) {
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
}
function ie(t) {
  const e = I(t);
  let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
  const r = Y(t), i = r ? t.offsetWidth : n, s = r ? t.offsetHeight : o, c = ut(n) !== i || ut(o) !== s;
  return c && (n = i, o = s), {
    width: n,
    height: o,
    $: c
  };
}
function kt(t) {
  return _(t) ? t : t.contextElement;
}
function J(t) {
  const e = kt(t);
  if (!Y(e))
    return V(1);
  const n = e.getBoundingClientRect(), {
    width: o,
    height: r,
    $: i
  } = ie(e);
  let s = (i ? ut(n.width) : n.width) / o, c = (i ? ut(n.height) : n.height) / r;
  return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
    x: s,
    y: c
  };
}
const hn = /* @__PURE__ */ V(0);
function se(t) {
  const e = W(t);
  return !Mt() || !e.visualViewport ? hn : {
    x: e.visualViewport.offsetLeft,
    y: e.visualViewport.offsetTop
  };
}
function mn(t, e, n) {
  return e === void 0 && (e = !1), !n || e && n !== W(t) ? !1 : e;
}
function G(t, e, n, o) {
  e === void 0 && (e = !1), n === void 0 && (n = !1);
  const r = t.getBoundingClientRect(), i = kt(t);
  let s = V(1);
  e && (o ? _(o) && (s = J(o)) : s = J(t));
  const c = mn(i, n, o) ? se(i) : V(0);
  let f = (r.left + c.x) / s.x, l = (r.top + c.y) / s.y, a = r.width / s.x, u = r.height / s.y;
  if (i) {
    const p = W(i), d = o && _(o) ? W(o) : o;
    let h = p, m = Ot(h);
    for (; m && o && d !== h; ) {
      const w = J(m), g = m.getBoundingClientRect(), v = I(m), E = g.left + (m.clientLeft + parseFloat(v.paddingLeft)) * w.x, b = g.top + (m.clientTop + parseFloat(v.paddingTop)) * w.y;
      f *= w.x, l *= w.y, a *= w.x, u *= w.y, f += E, l += b, h = W(m), m = Ot(h);
    }
  }
  return pt({
    width: a,
    height: u,
    x: f,
    y: l
  });
}
function Ft(t, e) {
  const n = xt(t).scrollLeft;
  return e ? e.left + n : G(j(t)).left + n;
}
function ce(t, e, n) {
  n === void 0 && (n = !1);
  const o = t.getBoundingClientRect(), r = o.left + e.scrollLeft - (n ? 0 : (
    // RTL <body> scrollbar.
    Ft(t, o)
  )), i = o.top + e.scrollTop;
  return {
    x: r,
    y: i
  };
}
function gn(t) {
  let {
    elements: e,
    rect: n,
    offsetParent: o,
    strategy: r
  } = t;
  const i = r === "fixed", s = j(o), c = e ? yt(e.floating) : !1;
  if (o === s || c && i)
    return n;
  let f = {
    scrollLeft: 0,
    scrollTop: 0
  }, l = V(1);
  const a = V(0), u = Y(o);
  if ((u || !u && !i) && ((et(o) !== "body" || st(s)) && (f = xt(o)), Y(o))) {
    const d = G(o);
    l = J(o), a.x = d.x + o.clientLeft, a.y = d.y + o.clientTop;
  }
  const p = s && !u && !i ? ce(s, f, !0) : V(0);
  return {
    width: n.width * l.x,
    height: n.height * l.y,
    x: n.x * l.x - f.scrollLeft * l.x + a.x + p.x,
    y: n.y * l.y - f.scrollTop * l.y + a.y + p.y
  };
}
function wn(t) {
  return Array.from(t.getClientRects());
}
function yn(t) {
  const e = j(t), n = xt(t), o = t.ownerDocument.body, r = $(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), i = $(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
  let s = -n.scrollLeft + Ft(t);
  const c = -n.scrollTop;
  return I(o).direction === "rtl" && (s += $(e.clientWidth, o.clientWidth) - r), {
    width: r,
    height: i,
    x: s,
    y: c
  };
}
function xn(t, e) {
  const n = W(t), o = j(t), r = n.visualViewport;
  let i = o.clientWidth, s = o.clientHeight, c = 0, f = 0;
  if (r) {
    i = r.width, s = r.height;
    const l = Mt();
    (!l || l && e === "fixed") && (c = r.offsetLeft, f = r.offsetTop);
  }
  return {
    width: i,
    height: s,
    x: c,
    y: f
  };
}
function vn(t, e) {
  const n = G(t, !0, e === "fixed"), o = n.top + t.clientTop, r = n.left + t.clientLeft, i = Y(t) ? J(t) : V(1), s = t.clientWidth * i.x, c = t.clientHeight * i.y, f = r * i.x, l = o * i.y;
  return {
    width: s,
    height: c,
    x: f,
    y: l
  };
}
function Zt(t, e, n) {
  let o;
  if (e === "viewport")
    o = xn(t, n);
  else if (e === "document")
    o = yn(j(t));
  else if (_(e))
    o = vn(e, n);
  else {
    const r = se(t);
    o = {
      x: e.x - r.x,
      y: e.y - r.y,
      width: e.width,
      height: e.height
    };
  }
  return pt(o);
}
function le(t, e) {
  const n = Z(t);
  return n === e || !_(n) || Q(n) ? !1 : I(n).position === "fixed" || le(n, e);
}
function bn(t, e) {
  const n = e.get(t);
  if (n)
    return n;
  let o = rt(t, [], !1).filter((c) => _(c) && et(c) !== "body"), r = null;
  const i = I(t).position === "fixed";
  let s = i ? Z(t) : t;
  for (; _(s) && !Q(s); ) {
    const c = I(s), f = Tt(s);
    !f && c.position === "fixed" && (r = null), (i ? !f && !r : !f && c.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || st(s) && !f && le(t, s)) ? o = o.filter((a) => a !== s) : r = c, s = Z(s);
  }
  return e.set(t, o), o;
}
function An(t) {
  let {
    element: e,
    boundary: n,
    rootBoundary: o,
    strategy: r
  } = t;
  const s = [...n === "clippingAncestors" ? yt(e) ? [] : bn(e, this._c) : [].concat(n), o], c = s[0], f = s.reduce((l, a) => {
    const u = Zt(e, a, r);
    return l.top = $(u.top, l.top), l.right = q(u.right, l.right), l.bottom = q(u.bottom, l.bottom), l.left = $(u.left, l.left), l;
  }, Zt(e, c, r));
  return {
    width: f.right - f.left,
    height: f.bottom - f.top,
    x: f.left,
    y: f.top
  };
}
function En(t) {
  const {
    width: e,
    height: n
  } = ie(t);
  return {
    width: e,
    height: n
  };
}
function Pn(t, e, n) {
  const o = Y(e), r = j(e), i = n === "fixed", s = G(t, !0, i, e);
  let c = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const f = V(0);
  if (o || !o && !i)
    if ((et(e) !== "body" || st(r)) && (c = xt(e)), o) {
      const p = G(e, !0, i, e);
      f.x = p.x + e.clientLeft, f.y = p.y + e.clientTop;
    } else
      r && (f.x = Ft(r));
  const l = r && !o && !i ? ce(r, c) : V(0), a = s.left + c.scrollLeft - f.x - l.x, u = s.top + c.scrollTop - f.y - l.y;
  return {
    x: a,
    y: u,
    width: s.width,
    height: s.height
  };
}
function bt(t) {
  return I(t).position === "static";
}
function Gt(t, e) {
  if (!Y(t) || I(t).position === "fixed")
    return null;
  if (e)
    return e(t);
  let n = t.offsetParent;
  return j(t) === n && (n = n.ownerDocument.body), n;
}
function ae(t, e) {
  const n = W(t);
  if (yt(t))
    return n;
  if (!Y(t)) {
    let r = Z(t);
    for (; r && !Q(r); ) {
      if (_(r) && !bt(r))
        return r;
      r = Z(r);
    }
    return n;
  }
  let o = Gt(t, e);
  for (; o && dn(o) && bt(o); )
    o = Gt(o, e);
  return o && Q(o) && bt(o) && !Tt(o) ? n : o || pn(t) || n;
}
const Rn = async function(t) {
  const e = this.getOffsetParent || ae, n = this.getDimensions, o = await n(t.floating);
  return {
    reference: Pn(t.reference, await e(t.floating), t.strategy),
    floating: {
      x: 0,
      y: 0,
      width: o.width,
      height: o.height
    }
  };
};
function Cn(t) {
  return I(t).direction === "rtl";
}
const On = {
  convertOffsetParentRelativeRectToViewportRelativeRect: gn,
  getDocumentElement: j,
  getClippingRect: An,
  getOffsetParent: ae,
  getElementRects: Rn,
  getClientRects: wn,
  getDimensions: En,
  getScale: J,
  isElement: _,
  isRTL: Cn
};
function fe(t, e) {
  return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
}
function Sn(t, e) {
  let n = null, o;
  const r = j(t);
  function i() {
    var c;
    clearTimeout(o), (c = n) == null || c.disconnect(), n = null;
  }
  function s(c, f) {
    c === void 0 && (c = !1), f === void 0 && (f = 1), i();
    const l = t.getBoundingClientRect(), {
      left: a,
      top: u,
      width: p,
      height: d
    } = l;
    if (c || e(), !p || !d)
      return;
    const h = at(u), m = at(r.clientWidth - (a + p)), w = at(r.clientHeight - (u + d)), g = at(a), E = {
      rootMargin: -h + "px " + -m + "px " + -w + "px " + -g + "px",
      threshold: $(0, q(1, f)) || 1
    };
    let b = !0;
    function A(P) {
      const x = P[0].intersectionRatio;
      if (x !== f) {
        if (!b)
          return s();
        x ? s(!1, x) : o = setTimeout(() => {
          s(!1, 1e-7);
        }, 1e3);
      }
      x === 1 && !fe(l, t.getBoundingClientRect()) && s(), b = !1;
    }
    try {
      n = new IntersectionObserver(A, {
        ...E,
        // Handle <iframe>s
        root: r.ownerDocument
      });
    } catch {
      n = new IntersectionObserver(A, E);
    }
    n.observe(t);
  }
  return s(!0), i;
}
function Dn(t, e, n, o) {
  o === void 0 && (o = {});
  const {
    ancestorScroll: r = !0,
    ancestorResize: i = !0,
    elementResize: s = typeof ResizeObserver == "function",
    layoutShift: c = typeof IntersectionObserver == "function",
    animationFrame: f = !1
  } = o, l = kt(t), a = r || i ? [...l ? rt(l) : [], ...rt(e)] : [];
  a.forEach((g) => {
    r && g.addEventListener("scroll", n, {
      passive: !0
    }), i && g.addEventListener("resize", n);
  });
  const u = l && c ? Sn(l, n) : null;
  let p = -1, d = null;
  s && (d = new ResizeObserver((g) => {
    let [v] = g;
    v && v.target === l && d && (d.unobserve(e), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
      var E;
      (E = d) == null || E.observe(e);
    })), n();
  }), l && !f && d.observe(l), d.observe(e));
  let h, m = f ? G(t) : null;
  f && w();
  function w() {
    const g = G(t);
    m && !fe(m, g) && n(), m = g, h = requestAnimationFrame(w);
  }
  return n(), () => {
    var g;
    a.forEach((v) => {
      r && v.removeEventListener("scroll", n), i && v.removeEventListener("resize", n);
    }), u == null || u(), (g = d) == null || g.disconnect(), d = null, f && cancelAnimationFrame(h);
  };
}
const Ln = ln, Tn = an, Mn = rn, kn = un, Fn = sn, Jt = on, Nn = fn, $n = (t, e, n) => {
  const o = /* @__PURE__ */ new Map(), r = {
    platform: On,
    ...n
  }, i = {
    ...r.platform,
    _c: o
  };
  return nn(t, e, {
    ...r,
    platform: i
  });
};
var ft = typeof document < "u" ? Te : Me;
function ht(t, e) {
  if (t === e)
    return !0;
  if (typeof t != typeof e)
    return !1;
  if (typeof t == "function" && t.toString() === e.toString())
    return !0;
  let n, o, r;
  if (t && e && typeof t == "object") {
    if (Array.isArray(t)) {
      if (n = t.length, n !== e.length)
        return !1;
      for (o = n; o-- !== 0; )
        if (!ht(t[o], e[o]))
          return !1;
      return !0;
    }
    if (r = Object.keys(t), n = r.length, n !== Object.keys(e).length)
      return !1;
    for (o = n; o-- !== 0; )
      if (!{}.hasOwnProperty.call(e, r[o]))
        return !1;
    for (o = n; o-- !== 0; ) {
      const i = r[o];
      if (!(i === "_owner" && t.$$typeof) && !ht(t[i], e[i]))
        return !1;
    }
    return !0;
  }
  return t !== t && e !== e;
}
function ue(t) {
  return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function Qt(t, e) {
  const n = ue(t);
  return Math.round(e * n) / n;
}
function At(t) {
  const e = y.useRef(t);
  return ft(() => {
    e.current = t;
  }), e;
}
function Wn(t) {
  t === void 0 && (t = {});
  const {
    placement: e = "bottom",
    strategy: n = "absolute",
    middleware: o = [],
    platform: r,
    elements: {
      reference: i,
      floating: s
    } = {},
    transform: c = !0,
    whileElementsMounted: f,
    open: l
  } = t, [a, u] = y.useState({
    x: 0,
    y: 0,
    strategy: n,
    placement: e,
    middlewareData: {},
    isPositioned: !1
  }), [p, d] = y.useState(o);
  ht(p, o) || d(o);
  const [h, m] = y.useState(null), [w, g] = y.useState(null), v = y.useCallback((R) => {
    R !== P.current && (P.current = R, m(R));
  }, []), E = y.useCallback((R) => {
    R !== x.current && (x.current = R, g(R));
  }, []), b = i || h, A = s || w, P = y.useRef(null), x = y.useRef(null), C = y.useRef(a), M = f != null, O = At(f), F = At(r), N = At(l), D = y.useCallback(() => {
    if (!P.current || !x.current)
      return;
    const R = {
      placement: e,
      strategy: n,
      middleware: p
    };
    F.current && (R.platform = F.current), $n(P.current, x.current, R).then((k) => {
      const z = {
        ...k,
        // The floating element's position may be recomputed while it's closed
        // but still mounted (such as when transitioning out). To ensure
        // `isPositioned` will be `false` initially on the next open, avoid
        // setting it to `true` when `open === false` (must be specified).
        isPositioned: N.current !== !1
      };
      S.current && !ht(C.current, z) && (C.current = z, $e.flushSync(() => {
        u(z);
      }));
    });
  }, [p, e, n, F, N]);
  ft(() => {
    l === !1 && C.current.isPositioned && (C.current.isPositioned = !1, u((R) => ({
      ...R,
      isPositioned: !1
    })));
  }, [l]);
  const S = y.useRef(!1);
  ft(() => (S.current = !0, () => {
    S.current = !1;
  }), []), ft(() => {
    if (b && (P.current = b), A && (x.current = A), b && A) {
      if (O.current)
        return O.current(b, A, D);
      D();
    }
  }, [b, A, D, O, M]);
  const B = y.useMemo(() => ({
    reference: P,
    floating: x,
    setReference: v,
    setFloating: E
  }), [v, E]), L = y.useMemo(() => ({
    reference: b,
    floating: A
  }), [b, A]), T = y.useMemo(() => {
    const R = {
      position: n,
      left: 0,
      top: 0
    };
    if (!L.floating)
      return R;
    const k = Qt(L.floating, a.x), z = Qt(L.floating, a.y);
    return c ? {
      ...R,
      transform: "translate(" + k + "px, " + z + "px)",
      ...ue(L.floating) >= 1.5 && {
        willChange: "transform"
      }
    } : {
      position: n,
      left: k,
      top: z
    };
  }, [n, c, L.floating, a.x, a.y]);
  return y.useMemo(() => ({
    ...a,
    update: D,
    refs: B,
    elements: L,
    floatingStyles: T
  }), [a, D, B, L, T]);
}
const Bn = (t) => {
  function e(n) {
    return {}.hasOwnProperty.call(n, "current");
  }
  return {
    name: "arrow",
    options: t,
    fn(n) {
      const {
        element: o,
        padding: r
      } = typeof t == "function" ? t(n) : t;
      return o && e(o) ? o.current != null ? Jt({
        element: o.current,
        padding: r
      }).fn(n) : {} : o ? Jt({
        element: o,
        padding: r
      }).fn(n) : {};
    }
  };
}, Hn = (t, e) => ({
  ...Ln(t),
  options: [t, e]
}), _n = (t, e) => ({
  ...Tn(t),
  options: [t, e]
}), In = (t, e) => ({
  ...Nn(t),
  options: [t, e]
}), zn = (t, e) => ({
  ...Mn(t),
  options: [t, e]
}), Vn = (t, e) => ({
  ...kn(t),
  options: [t, e]
}), Yn = (t, e) => ({
  ...Fn(t),
  options: [t, e]
}), jn = (t, e) => ({
  ...Bn(t),
  options: [t, e]
});
var Xn = "Arrow", de = y.forwardRef((t, e) => {
  const { children: n, width: o = 10, height: r = 5, ...i } = t;
  return /* @__PURE__ */ H(
    it.svg,
    {
      ...i,
      ref: e,
      width: o,
      height: r,
      viewBox: "0 0 30 10",
      preserveAspectRatio: "none",
      children: t.asChild ? n : /* @__PURE__ */ H("polygon", { points: "0,0 30,0 15,10" })
    }
  );
});
de.displayName = Xn;
var Un = de, Nt = "Popper", [pe, ro] = Fe(Nt), [qn, he] = pe(Nt), me = (t) => {
  const { __scopePopper: e, children: n } = t, [o, r] = y.useState(null);
  return /* @__PURE__ */ H(qn, { scope: e, anchor: o, onAnchorChange: r, children: n });
};
me.displayName = Nt;
var ge = "PopperAnchor", we = y.forwardRef(
  (t, e) => {
    const { __scopePopper: n, virtualRef: o, ...r } = t, i = he(ge, n), s = y.useRef(null), c = gt(e, s);
    return y.useEffect(() => {
      i.onAnchorChange((o == null ? void 0 : o.current) || s.current);
    }), o ? null : /* @__PURE__ */ H(it.div, { ...r, ref: c });
  }
);
we.displayName = ge;
var $t = "PopperContent", [Kn, Zn] = pe($t), ye = y.forwardRef(
  (t, e) => {
    var Wt, Bt, Ht, _t, It, zt;
    const {
      __scopePopper: n,
      side: o = "bottom",
      sideOffset: r = 0,
      align: i = "center",
      alignOffset: s = 0,
      arrowPadding: c = 0,
      avoidCollisions: f = !0,
      collisionBoundary: l = [],
      collisionPadding: a = 0,
      sticky: u = "partial",
      hideWhenDetached: p = !1,
      updatePositionStrategy: d = "optimized",
      onPlaced: h,
      ...m
    } = t, w = he($t, n), [g, v] = y.useState(null), E = gt(e, (nt) => v(nt)), [b, A] = y.useState(null), P = Ne(b), x = (P == null ? void 0 : P.width) ?? 0, C = (P == null ? void 0 : P.height) ?? 0, M = o + (i !== "center" ? "-" + i : ""), O = typeof a == "number" ? a : { top: 0, right: 0, bottom: 0, left: 0, ...a }, F = Array.isArray(l) ? l : [l], N = F.length > 0, D = {
      padding: O,
      boundary: F.filter(Jn),
      // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
      altBoundary: N
    }, { refs: S, floatingStyles: B, placement: L, isPositioned: T, middlewareData: R } = Wn({
      // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
      strategy: "fixed",
      placement: M,
      whileElementsMounted: (...nt) => Dn(...nt, {
        animationFrame: d === "always"
      }),
      elements: {
        reference: w.anchor
      },
      middleware: [
        Hn({ mainAxis: r + C, alignmentAxis: s }),
        f && _n({
          mainAxis: !0,
          crossAxis: !1,
          limiter: u === "partial" ? In() : void 0,
          ...D
        }),
        f && zn({ ...D }),
        Vn({
          ...D,
          apply: ({ elements: nt, rects: Vt, availableWidth: Oe, availableHeight: Se }) => {
            const { width: De, height: Le } = Vt.reference, lt = nt.floating.style;
            lt.setProperty("--radix-popper-available-width", `${Oe}px`), lt.setProperty("--radix-popper-available-height", `${Se}px`), lt.setProperty("--radix-popper-anchor-width", `${De}px`), lt.setProperty("--radix-popper-anchor-height", `${Le}px`);
          }
        }),
        b && jn({ element: b, padding: c }),
        Qn({ arrowWidth: x, arrowHeight: C }),
        p && Yn({ strategy: "referenceHidden", ...D })
      ]
    }), [k, z] = be(L), ct = mt(h);
    Et(() => {
      T && (ct == null || ct());
    }, [T, ct]);
    const Ae = (Wt = R.arrow) == null ? void 0 : Wt.x, Ee = (Bt = R.arrow) == null ? void 0 : Bt.y, Pe = ((Ht = R.arrow) == null ? void 0 : Ht.centerOffset) !== 0, [Re, Ce] = y.useState();
    return Et(() => {
      g && Ce(window.getComputedStyle(g).zIndex);
    }, [g]), /* @__PURE__ */ H(
      "div",
      {
        ref: S.setFloating,
        "data-radix-popper-content-wrapper": "",
        style: {
          ...B,
          transform: T ? B.transform : "translate(0, -200%)",
          // keep off the page when measuring
          minWidth: "max-content",
          zIndex: Re,
          "--radix-popper-transform-origin": [
            (_t = R.transformOrigin) == null ? void 0 : _t.x,
            (It = R.transformOrigin) == null ? void 0 : It.y
          ].join(" "),
          // hide the content if using the hide middleware and should be hidden
          // set visibility to hidden and disable pointer events so the UI behaves
          // as if the PopperContent isn't there at all
          ...((zt = R.hide) == null ? void 0 : zt.referenceHidden) && {
            visibility: "hidden",
            pointerEvents: "none"
          }
        },
        dir: t.dir,
        children: /* @__PURE__ */ H(
          Kn,
          {
            scope: n,
            placedSide: k,
            onArrowChange: A,
            arrowX: Ae,
            arrowY: Ee,
            shouldHideArrow: Pe,
            children: /* @__PURE__ */ H(
              it.div,
              {
                "data-side": k,
                "data-align": z,
                ...m,
                ref: E,
                style: {
                  ...m.style,
                  // if the PopperContent hasn't been placed yet (not all measurements done)
                  // we prevent animations so that users's animation don't kick in too early referring wrong sides
                  animation: T ? void 0 : "none"
                }
              }
            )
          }
        )
      }
    );
  }
);
ye.displayName = $t;
var xe = "PopperArrow", Gn = {
  top: "bottom",
  right: "left",
  bottom: "top",
  left: "right"
}, ve = y.forwardRef(function(e, n) {
  const { __scopePopper: o, ...r } = e, i = Zn(xe, o), s = Gn[i.placedSide];
  return (
    // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
    // doesn't report size as we'd expect on SVG elements.
    // it reports their bounding box which is effectively the largest path inside the SVG.
    /* @__PURE__ */ H(
      "span",
      {
        ref: i.onArrowChange,
        style: {
          position: "absolute",
          left: i.arrowX,
          top: i.arrowY,
          [s]: 0,
          transformOrigin: {
            top: "",
            right: "0 0",
            bottom: "center 0",
            left: "100% 0"
          }[i.placedSide],
          transform: {
            top: "translateY(100%)",
            right: "translateY(50%) rotate(90deg) translateX(-50%)",
            bottom: "rotate(180deg)",
            left: "translateY(50%) rotate(-90deg) translateX(50%)"
          }[i.placedSide],
          visibility: i.shouldHideArrow ? "hidden" : void 0
        },
        children: /* @__PURE__ */ H(
          Un,
          {
            ...r,
            ref: n,
            style: {
              ...r.style,
              // ensures the element can be measured correctly (mostly for if SVG)
              display: "block"
            }
          }
        )
      }
    )
  );
});
ve.displayName = xe;
function Jn(t) {
  return t !== null;
}
var Qn = (t) => ({
  name: "transformOrigin",
  options: t,
  fn(e) {
    var w, g, v;
    const { placement: n, rects: o, middlewareData: r } = e, s = ((w = r.arrow) == null ? void 0 : w.centerOffset) !== 0, c = s ? 0 : t.arrowWidth, f = s ? 0 : t.arrowHeight, [l, a] = be(n), u = { start: "0%", center: "50%", end: "100%" }[a], p = (((g = r.arrow) == null ? void 0 : g.x) ?? 0) + c / 2, d = (((v = r.arrow) == null ? void 0 : v.y) ?? 0) + f / 2;
    let h = "", m = "";
    return l === "bottom" ? (h = s ? u : `${p}px`, m = `${-f}px`) : l === "top" ? (h = s ? u : `${p}px`, m = `${o.floating.height + f}px`) : l === "right" ? (h = `${-f}px`, m = s ? u : `${d}px`) : l === "left" && (h = `${o.floating.width + f}px`, m = s ? u : `${d}px`), { data: { x: h, y: m } };
  }
});
function be(t) {
  const [e, n = "center"] = t.split("-");
  return [e, n];
}
var io = me, so = we, co = ye, lo = ve;
export {
  so as A,
  co as C,
  Ie as D,
  io as R,
  lo as a,
  ro as c,
  oo as u
};
