import { s as __toESM } from "./chunk-BNovOVIE.js";
import { m as useComposedRefs } from "./button-Dj4BTre0.js";
import { t as require_react } from "./react-DA-nE2FX.js";
import { t as require_react_dom } from "./react-dom-BWRJ_g_k.js";
import { t as require_jsx_runtime } from "./jsx-runtime-COBk7ree.js";
import { _t as Primitive, gt as createContextScope, lt as useCallbackRef, pt as useLayoutEffect2 } from "./zod-BWkcDORu.js";
/**
* @license lucide-react v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var mergeClasses = (...e) => e.filter((e2, a, o) => !!e2 && e2.trim() !== "" && o.indexOf(e2) === a).join(" ").trim(), toKebabCase = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toCamelCase = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e2, a, o) => o ? o.toUpperCase() : a.toLowerCase()), toPascalCase = (e) => {
  let a = toCamelCase(e);
  return a.charAt(0).toUpperCase() + a.slice(1);
}, defaultAttributes = {
  xmlns: "http://www.w3.org/2000/svg",
  width: 24,
  height: 24,
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  strokeWidth: 2,
  strokeLinecap: "round",
  strokeLinejoin: "round"
}, hasA11yProp = (e) => {
  for (let a in e) if (a.startsWith("aria-") || a === "role" || a === "title") return true;
  return false;
}, import_react = /* @__PURE__ */ __toESM(require_react()), Icon = (0, import_react.forwardRef)(({ color: e = "currentColor", size: a = 24, strokeWidth: o = 2, absoluteStrokeWidth: s, className: c = "", children: l, iconNode: u, ...d }, f) => (0, import_react.createElement)("svg", {
  ref: f,
  ...defaultAttributes,
  width: a,
  height: a,
  stroke: e,
  strokeWidth: s ? Number(o) * 24 / Number(a) : o,
  className: mergeClasses("lucide", c),
  ...!l && !hasA11yProp(d) && { "aria-hidden": "true" },
  ...d
}, [...u.map(([e2, a2]) => (0, import_react.createElement)(e2, a2)), ...Array.isArray(l) ? l : [l]])), createLucideIcon = (e, a) => {
  let o = (0, import_react.forwardRef)(({ className: o2, ...s }, c) => (0, import_react.createElement)(Icon, {
    ref: c,
    iconNode: a,
    className: mergeClasses(`lucide-${toKebabCase(toPascalCase(e))}`, `lucide-${e}`, o2),
    ...s
  }));
  return o.displayName = toPascalCase(e), o;
}, import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1), VISUALLY_HIDDEN_STYLES = Object.freeze({
  position: "absolute",
  border: 0,
  width: 1,
  height: 1,
  padding: 0,
  margin: -1,
  overflow: "hidden",
  clip: "rect(0, 0, 0, 0)",
  whiteSpace: "nowrap",
  wordWrap: "normal"
}), NAME$1 = "VisuallyHidden", VisuallyHidden = import_react.forwardRef((e, a) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
  ...e,
  ref: a,
  style: {
    ...VISUALLY_HIDDEN_STYLES,
    ...e.style
  }
}));
VisuallyHidden.displayName = NAME$1;
var Root$1 = VisuallyHidden;
function useSize(e) {
  let [a, o] = import_react.useState(void 0);
  return useLayoutEffect2(() => {
    if (e) {
      o({
        width: e.offsetWidth,
        height: e.offsetHeight
      });
      let a2 = new ResizeObserver((a3) => {
        if (!Array.isArray(a3) || !a3.length) return;
        let s = a3[0], c, l;
        if ("borderBoxSize" in s) {
          let e2 = s.borderBoxSize, a4 = Array.isArray(e2) ? e2[0] : e2;
          c = a4.inlineSize, l = a4.blockSize;
        } else c = e.offsetWidth, l = e.offsetHeight;
        o({
          width: c,
          height: l
        });
      });
      return a2.observe(e, { box: "border-box" }), () => a2.unobserve(e);
    } else o(void 0);
  }, [e]), a;
}
var sides = [
  "top",
  "right",
  "bottom",
  "left"
], min = Math.min, max = Math.max, round = Math.round, floor = Math.floor, createCoords = (e) => ({
  x: e,
  y: e
}), oppositeSideMap = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
}, oppositeAlignmentMap = {
  start: "end",
  end: "start"
};
function clamp(e, a, o) {
  return max(e, min(a, o));
}
function evaluate(e, a) {
  return typeof e == "function" ? e(a) : e;
}
function getSide(e) {
  return e.split("-")[0];
}
function getAlignment(e) {
  return e.split("-")[1];
}
function getOppositeAxis(e) {
  return e === "x" ? "y" : "x";
}
function getAxisLength(e) {
  return e === "y" ? "height" : "width";
}
var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
function getSideAxis(e) {
  return yAxisSides.has(getSide(e)) ? "y" : "x";
}
function getAlignmentAxis(e) {
  return getOppositeAxis(getSideAxis(e));
}
function getAlignmentSides(e, a, o) {
  o === void 0 && (o = false);
  let s = getAlignment(e), c = getAlignmentAxis(e), l = getAxisLength(c), u = c === "x" ? s === (o ? "end" : "start") ? "right" : "left" : s === "start" ? "bottom" : "top";
  return a.reference[l] > a.floating[l] && (u = getOppositePlacement(u)), [u, getOppositePlacement(u)];
}
function getExpandedPlacements(e) {
  let a = getOppositePlacement(e);
  return [
    getOppositeAlignmentPlacement(e),
    a,
    getOppositeAlignmentPlacement(a)
  ];
}
function getOppositeAlignmentPlacement(e) {
  return e.replace(/start|end/g, (e2) => oppositeAlignmentMap[e2]);
}
var lrPlacement = ["left", "right"], rlPlacement = ["right", "left"], tbPlacement = ["top", "bottom"], btPlacement = ["bottom", "top"];
function getSideList(e, a, o) {
  switch (e) {
    case "top":
    case "bottom":
      return o ? a ? rlPlacement : lrPlacement : a ? lrPlacement : rlPlacement;
    case "left":
    case "right":
      return a ? tbPlacement : btPlacement;
    default:
      return [];
  }
}
function getOppositeAxisPlacements(e, a, o, s) {
  let c = getAlignment(e), l = getSideList(getSide(e), o === "start", s);
  return c && (l = l.map((e2) => e2 + "-" + c), a && (l = l.concat(l.map(getOppositeAlignmentPlacement)))), l;
}
function getOppositePlacement(e) {
  return e.replace(/left|right|bottom|top/g, (e2) => oppositeSideMap[e2]);
}
function expandPaddingObject(e) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...e
  };
}
function getPaddingObject(e) {
  return typeof e == "number" ? {
    top: e,
    right: e,
    bottom: e,
    left: e
  } : expandPaddingObject(e);
}
function rectToClientRect(e) {
  let { x: a, y: o, width: s, height: c } = e;
  return {
    width: s,
    height: c,
    top: o,
    left: a,
    right: a + s,
    bottom: o + c,
    x: a,
    y: o
  };
}
function computeCoordsFromPlacement(e, a, o) {
  let { reference: s, floating: c } = e, l = getSideAxis(a), u = getAlignmentAxis(a), d = getAxisLength(u), f = getSide(a), p = l === "y", m = s.x + s.width / 2 - c.width / 2, h = s.y + s.height / 2 - c.height / 2, g = s[d] / 2 - c[d] / 2, _;
  switch (f) {
    case "top":
      _ = {
        x: m,
        y: s.y - c.height
      };
      break;
    case "bottom":
      _ = {
        x: m,
        y: s.y + s.height
      };
      break;
    case "right":
      _ = {
        x: s.x + s.width,
        y: h
      };
      break;
    case "left":
      _ = {
        x: s.x - c.width,
        y: h
      };
      break;
    default:
      _ = {
        x: s.x,
        y: s.y
      };
  }
  switch (getAlignment(a)) {
    case "start":
      _[u] -= g * (o && p ? -1 : 1);
      break;
    case "end":
      _[u] += g * (o && p ? -1 : 1);
      break;
  }
  return _;
}
var computePosition$1 = async (e, a, o) => {
  let { placement: s = "bottom", strategy: c = "absolute", middleware: l = [], platform: u } = o, d = l.filter(Boolean), f = await (u.isRTL == null ? void 0 : u.isRTL(a)), p = await u.getElementRects({
    reference: e,
    floating: a,
    strategy: c
  }), { x: m, y: h } = computeCoordsFromPlacement(p, s, f), g = s, _ = {}, v = 0;
  for (let o2 = 0; o2 < d.length; o2++) {
    let { name: l2, fn: y } = d[o2], { x: b, y: x, data: S, reset: C } = await y({
      x: m,
      y: h,
      initialPlacement: s,
      placement: g,
      strategy: c,
      middlewareData: _,
      rects: p,
      platform: u,
      elements: {
        reference: e,
        floating: a
      }
    });
    m = b ?? m, h = x ?? h, _ = {
      ..._,
      [l2]: {
        ..._[l2],
        ...S
      }
    }, C && v <= 50 && (v++, typeof C == "object" && (C.placement && (g = C.placement), C.rects && (p = C.rects === true ? await u.getElementRects({
      reference: e,
      floating: a,
      strategy: c
    }) : C.rects), { x: m, y: h } = computeCoordsFromPlacement(p, g, f)), o2 = -1);
  }
  return {
    x: m,
    y: h,
    placement: g,
    strategy: c,
    middlewareData: _
  };
};
async function detectOverflow$1(e, a) {
  a === void 0 && (a = {});
  let { x: o, y: s, platform: c, rects: l, elements: u, strategy: d } = e, { boundary: f = "clippingAncestors", rootBoundary: p = "viewport", elementContext: m = "floating", altBoundary: h = false, padding: g = 0 } = evaluate(a, e), _ = getPaddingObject(g), v = u[h ? m === "floating" ? "reference" : "floating" : m], y = rectToClientRect(await c.getClippingRect({
    element: await (c.isElement == null ? void 0 : c.isElement(v)) ?? true ? v : v.contextElement || await (c.getDocumentElement == null ? void 0 : c.getDocumentElement(u.floating)),
    boundary: f,
    rootBoundary: p,
    strategy: d
  })), b = m === "floating" ? {
    x: o,
    y: s,
    width: l.floating.width,
    height: l.floating.height
  } : l.reference, x = await (c.getOffsetParent == null ? void 0 : c.getOffsetParent(u.floating)), S = await (c.isElement == null ? void 0 : c.isElement(x)) && await (c.getScale == null ? void 0 : c.getScale(x)) || {
    x: 1,
    y: 1
  }, C = rectToClientRect(c.convertOffsetParentRelativeRectToViewportRelativeRect ? await c.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements: u,
    rect: b,
    offsetParent: x,
    strategy: d
  }) : b);
  return {
    top: (y.top - C.top + _.top) / S.y,
    bottom: (C.bottom - y.bottom + _.bottom) / S.y,
    left: (y.left - C.left + _.left) / S.x,
    right: (C.right - y.right + _.right) / S.x
  };
}
var arrow$2 = (e) => ({
  name: "arrow",
  options: e,
  async fn(a) {
    let { x: o, y: s, placement: c, rects: l, platform: u, elements: d, middlewareData: f } = a, { element: p, padding: m = 0 } = evaluate(e, a) || {};
    if (p == null) return {};
    let h = getPaddingObject(m), g = {
      x: o,
      y: s
    }, _ = getAlignmentAxis(c), v = getAxisLength(_), y = await u.getDimensions(p), b = _ === "y", x = b ? "top" : "left", S = b ? "bottom" : "right", C = b ? "clientHeight" : "clientWidth", w = l.reference[v] + l.reference[_] - g[_] - l.floating[v], T = g[_] - l.reference[_], E = await (u.getOffsetParent == null ? void 0 : u.getOffsetParent(p)), D = E ? E[C] : 0;
    (!D || !await (u.isElement == null ? void 0 : u.isElement(E))) && (D = d.floating[C] || l.floating[v]);
    let O = w / 2 - T / 2, A = D / 2 - y[v] / 2 - 1, j = min(h[x], A), M = min(h[S], A), N = j, P = D - y[v] - M, F = D / 2 - y[v] / 2 + O, R = clamp(N, F, P), B = !f.arrow && getAlignment(c) != null && F !== R && l.reference[v] / 2 - (F < N ? j : M) - y[v] / 2 < 0, H = B ? F < N ? F - N : F - P : 0;
    return {
      [_]: g[_] + H,
      data: {
        [_]: R,
        centerOffset: F - R - H,
        ...B && { alignmentOffset: H }
      },
      reset: B
    };
  }
}), flip$2 = function(e) {
  return e === void 0 && (e = {}), {
    name: "flip",
    options: e,
    async fn(a) {
      var _a, _b, _c, _d;
      var o;
      let { placement: s, middlewareData: c, rects: l, initialPlacement: u, platform: d, elements: f } = a, { mainAxis: p = true, crossAxis: m = true, fallbackPlacements: h, fallbackStrategy: g = "bestFit", fallbackAxisSideDirection: _ = "none", flipAlignment: v = true, ...y } = evaluate(e, a);
      if ((o = c.arrow) != null && o.alignmentOffset) return {};
      let b = getSide(s), x = getSideAxis(u), S = getSide(u) === u, C = await (d.isRTL == null ? void 0 : d.isRTL(f.floating)), w = h || (S || !v ? [getOppositePlacement(u)] : getExpandedPlacements(u)), T = _ !== "none";
      !h && T && w.push(...getOppositeAxisPlacements(u, v, _, C));
      let E = [u, ...w], D = await detectOverflow$1(a, y), O = [], k = ((_a = c.flip) == null ? void 0 : _a.overflows) || [];
      if (p && O.push(D[b]), m) {
        let e2 = getAlignmentSides(s, l, C);
        O.push(D[e2[0]], D[e2[1]]);
      }
      if (k = [...k, {
        placement: s,
        overflows: O
      }], !O.every((e2) => e2 <= 0)) {
        let e2 = (((_b = c.flip) == null ? void 0 : _b.index) || 0) + 1, a2 = E[e2];
        if (a2 && (!(m === "alignment" && x !== getSideAxis(a2)) || k.every((e3) => e3.overflows[0] > 0 && getSideAxis(e3.placement) === x))) return {
          data: {
            index: e2,
            overflows: k
          },
          reset: { placement: a2 }
        };
        let o2 = (_c = k.filter((e3) => e3.overflows[0] <= 0).sort((e3, a3) => e3.overflows[1] - a3.overflows[1])[0]) == null ? void 0 : _c.placement;
        if (!o2) switch (g) {
          case "bestFit": {
            let e3 = (_d = k.filter((e4) => {
              if (T) {
                let a3 = getSideAxis(e4.placement);
                return a3 === x || a3 === "y";
              }
              return true;
            }).map((e4) => [e4.placement, e4.overflows.filter((e5) => e5 > 0).reduce((e5, a3) => e5 + a3, 0)]).sort((e4, a3) => e4[1] - a3[1])[0]) == null ? void 0 : _d[0];
            e3 && (o2 = e3);
            break;
          }
          case "initialPlacement":
            o2 = u;
            break;
        }
        if (s !== o2) return { reset: { placement: o2 } };
      }
      return {};
    }
  };
};
function getSideOffsets(e, a) {
  return {
    top: e.top - a.height,
    right: e.right - a.width,
    bottom: e.bottom - a.height,
    left: e.left - a.width
  };
}
function isAnySideFullyClipped(e) {
  return sides.some((a) => e[a] >= 0);
}
var hide$2 = function(e) {
  return e === void 0 && (e = {}), {
    name: "hide",
    options: e,
    async fn(a) {
      let { rects: o } = a, { strategy: s = "referenceHidden", ...c } = evaluate(e, a);
      switch (s) {
        case "referenceHidden": {
          let e2 = getSideOffsets(await detectOverflow$1(a, {
            ...c,
            elementContext: "reference"
          }), o.reference);
          return { data: {
            referenceHiddenOffsets: e2,
            referenceHidden: isAnySideFullyClipped(e2)
          } };
        }
        case "escaped": {
          let e2 = getSideOffsets(await detectOverflow$1(a, {
            ...c,
            altBoundary: true
          }), o.floating);
          return { data: {
            escapedOffsets: e2,
            escaped: isAnySideFullyClipped(e2)
          } };
        }
        default:
          return {};
      }
    }
  };
}, originSides = /* @__PURE__ */ new Set(["left", "top"]);
async function convertValueToCoords(e, a) {
  let { placement: o, platform: s, elements: c } = e, l = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), u = getSide(o), d = getAlignment(o), f = getSideAxis(o) === "y", p = originSides.has(u) ? -1 : 1, m = l && f ? -1 : 1, h = evaluate(a, e), { mainAxis: g, crossAxis: _, alignmentAxis: v } = typeof h == "number" ? {
    mainAxis: h,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: h.mainAxis || 0,
    crossAxis: h.crossAxis || 0,
    alignmentAxis: h.alignmentAxis
  };
  return d && typeof v == "number" && (_ = d === "end" ? v * -1 : v), f ? {
    x: _ * m,
    y: g * p
  } : {
    x: g * p,
    y: _ * m
  };
}
var offset$2 = function(e) {
  return e === void 0 && (e = 0), {
    name: "offset",
    options: e,
    async fn(a) {
      var _a;
      var o;
      let { x: s, y: c, placement: l, middlewareData: u } = a, d = await convertValueToCoords(a, e);
      return l === ((_a = u.offset) == null ? void 0 : _a.placement) && (o = u.arrow) != null && o.alignmentOffset ? {} : {
        x: s + d.x,
        y: c + d.y,
        data: {
          ...d,
          placement: l
        }
      };
    }
  };
}, shift$2 = function(e) {
  return e === void 0 && (e = {}), {
    name: "shift",
    options: e,
    async fn(a) {
      let { x: o, y: s, placement: c } = a, { mainAxis: l = true, crossAxis: u = false, limiter: d = { fn: (e2) => {
        let { x: a2, y: o2 } = e2;
        return {
          x: a2,
          y: o2
        };
      } }, ...f } = evaluate(e, a), p = {
        x: o,
        y: s
      }, m = await detectOverflow$1(a, f), h = getSideAxis(getSide(c)), g = getOppositeAxis(h), _ = p[g], v = p[h];
      if (l) {
        let e2 = g === "y" ? "top" : "left", a2 = g === "y" ? "bottom" : "right", o2 = _ + m[e2], s2 = _ - m[a2];
        _ = clamp(o2, _, s2);
      }
      if (u) {
        let e2 = h === "y" ? "top" : "left", a2 = h === "y" ? "bottom" : "right", o2 = v + m[e2], s2 = v - m[a2];
        v = clamp(o2, v, s2);
      }
      let y = d.fn({
        ...a,
        [g]: _,
        [h]: v
      });
      return {
        ...y,
        data: {
          x: y.x - o,
          y: y.y - s,
          enabled: {
            [g]: l,
            [h]: u
          }
        }
      };
    }
  };
}, limitShift$2 = function(e) {
  return e === void 0 && (e = {}), {
    options: e,
    fn(a) {
      var _a, _b;
      let { x: o, y: s, placement: c, rects: l, middlewareData: u } = a, { offset: d = 0, mainAxis: f = true, crossAxis: p = true } = evaluate(e, a), m = {
        x: o,
        y: s
      }, h = getSideAxis(c), g = getOppositeAxis(h), _ = m[g], v = m[h], y = evaluate(d, a), b = typeof y == "number" ? {
        mainAxis: y,
        crossAxis: 0
      } : {
        mainAxis: 0,
        crossAxis: 0,
        ...y
      };
      if (f) {
        let e2 = g === "y" ? "height" : "width", a2 = l.reference[g] - l.floating[e2] + b.mainAxis, o2 = l.reference[g] + l.reference[e2] - b.mainAxis;
        _ < a2 ? _ = a2 : _ > o2 && (_ = o2);
      }
      if (p) {
        let e2 = g === "y" ? "width" : "height", a2 = originSides.has(getSide(c)), o2 = l.reference[h] - l.floating[e2] + (a2 && ((_a = u.offset) == null ? void 0 : _a[h]) || 0) + (a2 ? 0 : b.crossAxis), s2 = l.reference[h] + l.reference[e2] + (a2 ? 0 : ((_b = u.offset) == null ? void 0 : _b[h]) || 0) - (a2 ? b.crossAxis : 0);
        v < o2 ? v = o2 : v > s2 && (v = s2);
      }
      return {
        [g]: _,
        [h]: v
      };
    }
  };
}, size$2 = function(e) {
  return e === void 0 && (e = {}), {
    name: "size",
    options: e,
    async fn(a) {
      var o, s;
      let { placement: c, rects: l, platform: u, elements: d } = a, { apply: f = () => {
      }, ...p } = evaluate(e, a), m = await detectOverflow$1(a, p), h = getSide(c), g = getAlignment(c), _ = getSideAxis(c) === "y", { width: v, height: y } = l.floating, b, x;
      h === "top" || h === "bottom" ? (b = h, x = g === (await (u.isRTL == null ? void 0 : u.isRTL(d.floating)) ? "start" : "end") ? "left" : "right") : (x = h, b = g === "end" ? "top" : "bottom");
      let S = y - m.top - m.bottom, C = v - m.left - m.right, w = min(y - m[b], S), T = min(v - m[x], C), E = !a.middlewareData.shift, D = w, O = T;
      if ((o = a.middlewareData.shift) != null && o.enabled.x && (O = C), (s = a.middlewareData.shift) != null && s.enabled.y && (D = S), E && !g) {
        let e2 = max(m.left, 0), a2 = max(m.right, 0), o2 = max(m.top, 0), s2 = max(m.bottom, 0);
        _ ? O = v - 2 * (e2 !== 0 || a2 !== 0 ? e2 + a2 : max(m.left, m.right)) : D = y - 2 * (o2 !== 0 || s2 !== 0 ? o2 + s2 : max(m.top, m.bottom));
      }
      await f({
        ...a,
        availableWidth: O,
        availableHeight: D
      });
      let j = await u.getDimensions(d.floating);
      return v !== j.width || y !== j.height ? { reset: { rects: true } } : {};
    }
  };
};
function hasWindow() {
  return typeof window < "u";
}
function getNodeName(e) {
  return isNode(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function getWindow(e) {
  var a;
  return (e == null || (a = e.ownerDocument) == null ? void 0 : a.defaultView) || window;
}
function getDocumentElement(e) {
  var _a;
  return (_a = (isNode(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : _a.documentElement;
}
function isNode(e) {
  return hasWindow() ? e instanceof Node || e instanceof getWindow(e).Node : false;
}
function isElement(e) {
  return hasWindow() ? e instanceof Element || e instanceof getWindow(e).Element : false;
}
function isHTMLElement(e) {
  return hasWindow() ? e instanceof HTMLElement || e instanceof getWindow(e).HTMLElement : false;
}
function isShadowRoot(e) {
  return !hasWindow() || typeof ShadowRoot > "u" ? false : e instanceof ShadowRoot || e instanceof getWindow(e).ShadowRoot;
}
var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
function isOverflowElement(e) {
  let { overflow: a, overflowX: o, overflowY: s, display: c } = getComputedStyle(e);
  return /auto|scroll|overlay|hidden|clip/.test(a + s + o) && !invalidOverflowDisplayValues.has(c);
}
var tableElements = /* @__PURE__ */ new Set([
  "table",
  "td",
  "th"
]);
function isTableElement(e) {
  return tableElements.has(getNodeName(e));
}
var topLayerSelectors = [":popover-open", ":modal"];
function isTopLayer(e) {
  return topLayerSelectors.some((a) => {
    try {
      return e.matches(a);
    } catch {
      return false;
    }
  });
}
var transformProperties = [
  "transform",
  "translate",
  "scale",
  "rotate",
  "perspective"
], willChangeValues = [
  "transform",
  "translate",
  "scale",
  "rotate",
  "perspective",
  "filter"
], containValues = [
  "paint",
  "layout",
  "strict",
  "content"
];
function isContainingBlock(e) {
  let a = isWebKit(), o = isElement(e) ? getComputedStyle(e) : e;
  return transformProperties.some((e2) => o[e2] ? o[e2] !== "none" : false) || (o.containerType ? o.containerType !== "normal" : false) || !a && (o.backdropFilter ? o.backdropFilter !== "none" : false) || !a && (o.filter ? o.filter !== "none" : false) || willChangeValues.some((e2) => (o.willChange || "").includes(e2)) || containValues.some((e2) => (o.contain || "").includes(e2));
}
function getContainingBlock(e) {
  let a = getParentNode(e);
  for (; isHTMLElement(a) && !isLastTraversableNode(a); ) {
    if (isContainingBlock(a)) return a;
    if (isTopLayer(a)) return null;
    a = getParentNode(a);
  }
  return null;
}
function isWebKit() {
  return typeof CSS > "u" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter", "none");
}
var lastTraversableNodeNames = /* @__PURE__ */ new Set([
  "html",
  "body",
  "#document"
]);
function isLastTraversableNode(e) {
  return lastTraversableNodeNames.has(getNodeName(e));
}
function getComputedStyle(e) {
  return getWindow(e).getComputedStyle(e);
}
function getNodeScroll(e) {
  return isElement(e) ? {
    scrollLeft: e.scrollLeft,
    scrollTop: e.scrollTop
  } : {
    scrollLeft: e.scrollX,
    scrollTop: e.scrollY
  };
}
function getParentNode(e) {
  if (getNodeName(e) === "html") return e;
  let a = e.assignedSlot || e.parentNode || isShadowRoot(e) && e.host || getDocumentElement(e);
  return isShadowRoot(a) ? a.host : a;
}
function getNearestOverflowAncestor(e) {
  let a = getParentNode(e);
  return isLastTraversableNode(a) ? e.ownerDocument ? e.ownerDocument.body : e.body : isHTMLElement(a) && isOverflowElement(a) ? a : getNearestOverflowAncestor(a);
}
function getOverflowAncestors(e, a, o) {
  var _a;
  a === void 0 && (a = []), o === void 0 && (o = true);
  let s = getNearestOverflowAncestor(e), c = s === ((_a = e.ownerDocument) == null ? void 0 : _a.body), l = getWindow(s);
  if (c) {
    let e2 = getFrameElement(l);
    return a.concat(l, l.visualViewport || [], isOverflowElement(s) ? s : [], e2 && o ? getOverflowAncestors(e2) : []);
  }
  return a.concat(s, getOverflowAncestors(s, [], o));
}
function getFrameElement(e) {
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
}
function getCssDimensions(e) {
  let a = getComputedStyle(e), o = parseFloat(a.width) || 0, s = parseFloat(a.height) || 0, c = isHTMLElement(e), l = c ? e.offsetWidth : o, u = c ? e.offsetHeight : s, d = round(o) !== l || round(s) !== u;
  return d && (o = l, s = u), {
    width: o,
    height: s,
    $: d
  };
}
function unwrapElement(e) {
  return isElement(e) ? e : e.contextElement;
}
function getScale(e) {
  let a = unwrapElement(e);
  if (!isHTMLElement(a)) return createCoords(1);
  let o = a.getBoundingClientRect(), { width: s, height: c, $: l } = getCssDimensions(a), u = (l ? round(o.width) : o.width) / s, d = (l ? round(o.height) : o.height) / c;
  return (!u || !Number.isFinite(u)) && (u = 1), (!d || !Number.isFinite(d)) && (d = 1), {
    x: u,
    y: d
  };
}
var noOffsets = /* @__PURE__ */ createCoords(0);
function getVisualOffsets(e) {
  let a = getWindow(e);
  return !isWebKit() || !a.visualViewport ? noOffsets : {
    x: a.visualViewport.offsetLeft,
    y: a.visualViewport.offsetTop
  };
}
function shouldAddVisualOffsets(e, a, o) {
  return a === void 0 && (a = false), !o || a && o !== getWindow(e) ? false : a;
}
function getBoundingClientRect(e, a, o, s) {
  a === void 0 && (a = false), o === void 0 && (o = false);
  let c = e.getBoundingClientRect(), l = unwrapElement(e), u = createCoords(1);
  a && (s ? isElement(s) && (u = getScale(s)) : u = getScale(e));
  let d = shouldAddVisualOffsets(l, o, s) ? getVisualOffsets(l) : createCoords(0), f = (c.left + d.x) / u.x, p = (c.top + d.y) / u.y, m = c.width / u.x, h = c.height / u.y;
  if (l) {
    let e2 = getWindow(l), a2 = s && isElement(s) ? getWindow(s) : s, o2 = e2, c2 = getFrameElement(o2);
    for (; c2 && s && a2 !== o2; ) {
      let e3 = getScale(c2), a3 = c2.getBoundingClientRect(), s2 = getComputedStyle(c2), l2 = a3.left + (c2.clientLeft + parseFloat(s2.paddingLeft)) * e3.x, u2 = a3.top + (c2.clientTop + parseFloat(s2.paddingTop)) * e3.y;
      f *= e3.x, p *= e3.y, m *= e3.x, h *= e3.y, f += l2, p += u2, o2 = getWindow(c2), c2 = getFrameElement(o2);
    }
  }
  return rectToClientRect({
    width: m,
    height: h,
    x: f,
    y: p
  });
}
function getWindowScrollBarX(e, a) {
  let o = getNodeScroll(e).scrollLeft;
  return a ? a.left + o : getBoundingClientRect(getDocumentElement(e)).left + o;
}
function getHTMLOffset(e, a, o) {
  o === void 0 && (o = false);
  let s = e.getBoundingClientRect();
  return {
    x: s.left + a.scrollLeft - (o ? 0 : getWindowScrollBarX(e, s)),
    y: s.top + a.scrollTop
  };
}
function convertOffsetParentRelativeRectToViewportRelativeRect(e) {
  let { elements: a, rect: o, offsetParent: s, strategy: c } = e, l = c === "fixed", u = getDocumentElement(s), d = a ? isTopLayer(a.floating) : false;
  if (s === u || d && l) return o;
  let f = {
    scrollLeft: 0,
    scrollTop: 0
  }, p = createCoords(1), m = createCoords(0), h = isHTMLElement(s);
  if ((h || !h && !l) && ((getNodeName(s) !== "body" || isOverflowElement(u)) && (f = getNodeScroll(s)), isHTMLElement(s))) {
    let e2 = getBoundingClientRect(s);
    p = getScale(s), m.x = e2.x + s.clientLeft, m.y = e2.y + s.clientTop;
  }
  let g = u && !h && !l ? getHTMLOffset(u, f, true) : createCoords(0);
  return {
    width: o.width * p.x,
    height: o.height * p.y,
    x: o.x * p.x - f.scrollLeft * p.x + m.x + g.x,
    y: o.y * p.y - f.scrollTop * p.y + m.y + g.y
  };
}
function getClientRects(e) {
  return Array.from(e.getClientRects());
}
function getDocumentRect(e) {
  let a = getDocumentElement(e), o = getNodeScroll(e), s = e.ownerDocument.body, c = max(a.scrollWidth, a.clientWidth, s.scrollWidth, s.clientWidth), l = max(a.scrollHeight, a.clientHeight, s.scrollHeight, s.clientHeight), u = -o.scrollLeft + getWindowScrollBarX(e), d = -o.scrollTop;
  return getComputedStyle(s).direction === "rtl" && (u += max(a.clientWidth, s.clientWidth) - c), {
    width: c,
    height: l,
    x: u,
    y: d
  };
}
function getViewportRect(e, a) {
  let o = getWindow(e), s = getDocumentElement(e), c = o.visualViewport, l = s.clientWidth, u = s.clientHeight, d = 0, f = 0;
  if (c) {
    l = c.width, u = c.height;
    let e2 = isWebKit();
    (!e2 || e2 && a === "fixed") && (d = c.offsetLeft, f = c.offsetTop);
  }
  return {
    width: l,
    height: u,
    x: d,
    y: f
  };
}
var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
function getInnerBoundingClientRect(e, a) {
  let o = getBoundingClientRect(e, true, a === "fixed"), s = o.top + e.clientTop, c = o.left + e.clientLeft, l = isHTMLElement(e) ? getScale(e) : createCoords(1);
  return {
    width: e.clientWidth * l.x,
    height: e.clientHeight * l.y,
    x: c * l.x,
    y: s * l.y
  };
}
function getClientRectFromClippingAncestor(e, a, o) {
  let s;
  if (a === "viewport") s = getViewportRect(e, o);
  else if (a === "document") s = getDocumentRect(getDocumentElement(e));
  else if (isElement(a)) s = getInnerBoundingClientRect(a, o);
  else {
    let o2 = getVisualOffsets(e);
    s = {
      x: a.x - o2.x,
      y: a.y - o2.y,
      width: a.width,
      height: a.height
    };
  }
  return rectToClientRect(s);
}
function hasFixedPositionAncestor(e, a) {
  let o = getParentNode(e);
  return o === a || !isElement(o) || isLastTraversableNode(o) ? false : getComputedStyle(o).position === "fixed" || hasFixedPositionAncestor(o, a);
}
function getClippingElementAncestors(e, a) {
  let o = a.get(e);
  if (o) return o;
  let s = getOverflowAncestors(e, [], false).filter((e2) => isElement(e2) && getNodeName(e2) !== "body"), c = null, l = getComputedStyle(e).position === "fixed", u = l ? getParentNode(e) : e;
  for (; isElement(u) && !isLastTraversableNode(u); ) {
    let a2 = getComputedStyle(u), o2 = isContainingBlock(u);
    !o2 && a2.position === "fixed" && (c = null), (l ? !o2 && !c : !o2 && a2.position === "static" && c && absoluteOrFixed.has(c.position) || isOverflowElement(u) && !o2 && hasFixedPositionAncestor(e, u)) ? s = s.filter((e2) => e2 !== u) : c = a2, u = getParentNode(u);
  }
  return a.set(e, s), s;
}
function getClippingRect(e) {
  let { element: a, boundary: o, rootBoundary: s, strategy: c } = e, l = [...o === "clippingAncestors" ? isTopLayer(a) ? [] : getClippingElementAncestors(a, this._c) : [].concat(o), s], u = l[0], d = l.reduce((e2, o2) => {
    let s2 = getClientRectFromClippingAncestor(a, o2, c);
    return e2.top = max(s2.top, e2.top), e2.right = min(s2.right, e2.right), e2.bottom = min(s2.bottom, e2.bottom), e2.left = max(s2.left, e2.left), e2;
  }, getClientRectFromClippingAncestor(a, u, c));
  return {
    width: d.right - d.left,
    height: d.bottom - d.top,
    x: d.left,
    y: d.top
  };
}
function getDimensions(e) {
  let { width: a, height: o } = getCssDimensions(e);
  return {
    width: a,
    height: o
  };
}
function getRectRelativeToOffsetParent(e, a, o) {
  let s = isHTMLElement(a), c = getDocumentElement(a), l = o === "fixed", u = getBoundingClientRect(e, true, l, a), d = {
    scrollLeft: 0,
    scrollTop: 0
  }, f = createCoords(0);
  function p() {
    f.x = getWindowScrollBarX(c);
  }
  if (s || !s && !l) if ((getNodeName(a) !== "body" || isOverflowElement(c)) && (d = getNodeScroll(a)), s) {
    let e2 = getBoundingClientRect(a, true, l, a);
    f.x = e2.x + a.clientLeft, f.y = e2.y + a.clientTop;
  } else c && p();
  l && !s && c && p();
  let m = c && !s && !l ? getHTMLOffset(c, d) : createCoords(0);
  return {
    x: u.left + d.scrollLeft - f.x - m.x,
    y: u.top + d.scrollTop - f.y - m.y,
    width: u.width,
    height: u.height
  };
}
function isStaticPositioned(e) {
  return getComputedStyle(e).position === "static";
}
function getTrueOffsetParent(e, a) {
  if (!isHTMLElement(e) || getComputedStyle(e).position === "fixed") return null;
  if (a) return a(e);
  let o = e.offsetParent;
  return getDocumentElement(e) === o && (o = o.ownerDocument.body), o;
}
function getOffsetParent(e, a) {
  let o = getWindow(e);
  if (isTopLayer(e)) return o;
  if (!isHTMLElement(e)) {
    let a2 = getParentNode(e);
    for (; a2 && !isLastTraversableNode(a2); ) {
      if (isElement(a2) && !isStaticPositioned(a2)) return a2;
      a2 = getParentNode(a2);
    }
    return o;
  }
  let s = getTrueOffsetParent(e, a);
  for (; s && isTableElement(s) && isStaticPositioned(s); ) s = getTrueOffsetParent(s, a);
  return s && isLastTraversableNode(s) && isStaticPositioned(s) && !isContainingBlock(s) ? o : s || getContainingBlock(e) || o;
}
var getElementRects = async function(e) {
  let a = this.getOffsetParent || getOffsetParent, o = this.getDimensions, s = await o(e.floating);
  return {
    reference: getRectRelativeToOffsetParent(e.reference, await a(e.floating), e.strategy),
    floating: {
      x: 0,
      y: 0,
      width: s.width,
      height: s.height
    }
  };
};
function isRTL(e) {
  return getComputedStyle(e).direction === "rtl";
}
var platform = {
  convertOffsetParentRelativeRectToViewportRelativeRect,
  getDocumentElement,
  getClippingRect,
  getOffsetParent,
  getElementRects,
  getClientRects,
  getDimensions,
  getScale,
  isElement,
  isRTL
};
function rectsAreEqual(e, a) {
  return e.x === a.x && e.y === a.y && e.width === a.width && e.height === a.height;
}
function observeMove(e, a) {
  let o = null, s, c = getDocumentElement(e);
  function l() {
    var e2;
    clearTimeout(s), (e2 = o) == null || e2.disconnect(), o = null;
  }
  function u(d, f) {
    d === void 0 && (d = false), f === void 0 && (f = 1), l();
    let p = e.getBoundingClientRect(), { left: m, top: h, width: g, height: _ } = p;
    if (d || a(), !g || !_) return;
    let v = floor(h), y = floor(c.clientWidth - (m + g)), b = floor(c.clientHeight - (h + _)), x = floor(m), S = {
      rootMargin: -v + "px " + -y + "px " + -b + "px " + -x + "px",
      threshold: max(0, min(1, f)) || 1
    }, C = true;
    function w(a2) {
      let o2 = a2[0].intersectionRatio;
      if (o2 !== f) {
        if (!C) return u();
        o2 ? u(false, o2) : s = setTimeout(() => {
          u(false, 1e-7);
        }, 1e3);
      }
      o2 === 1 && !rectsAreEqual(p, e.getBoundingClientRect()) && u(), C = false;
    }
    try {
      o = new IntersectionObserver(w, {
        ...S,
        root: c.ownerDocument
      });
    } catch {
      o = new IntersectionObserver(w, S);
    }
    o.observe(e);
  }
  return u(true), l;
}
function autoUpdate(e, a, o, s) {
  s === void 0 && (s = {});
  let { ancestorScroll: c = true, ancestorResize: l = true, elementResize: u = typeof ResizeObserver == "function", layoutShift: d = typeof IntersectionObserver == "function", animationFrame: f = false } = s, p = unwrapElement(e), m = c || l ? [...p ? getOverflowAncestors(p) : [], ...getOverflowAncestors(a)] : [];
  m.forEach((e2) => {
    c && e2.addEventListener("scroll", o, { passive: true }), l && e2.addEventListener("resize", o);
  });
  let h = p && d ? observeMove(p, o) : null, g = -1, _ = null;
  u && (_ = new ResizeObserver((e2) => {
    let [s2] = e2;
    s2 && s2.target === p && _ && (_.unobserve(a), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
      var e3;
      (e3 = _) == null || e3.observe(a);
    })), o();
  }), p && !f && _.observe(p), _.observe(a));
  let v, y = f ? getBoundingClientRect(e) : null;
  f && b();
  function b() {
    let a2 = getBoundingClientRect(e);
    y && !rectsAreEqual(y, a2) && o(), y = a2, v = requestAnimationFrame(b);
  }
  return o(), () => {
    var e2;
    m.forEach((e3) => {
      c && e3.removeEventListener("scroll", o), l && e3.removeEventListener("resize", o);
    }), h == null ? void 0 : h(), (e2 = _) == null || e2.disconnect(), _ = null, f && cancelAnimationFrame(v);
  };
}
var offset$1 = offset$2, shift$1 = shift$2, flip$1 = flip$2, size$1 = size$2, hide$1 = hide$2, arrow$1 = arrow$2, limitShift$1 = limitShift$2, computePosition = (e, a, o) => {
  let s = /* @__PURE__ */ new Map(), c = {
    platform,
    ...o
  }, l = {
    ...c.platform,
    _c: s
  };
  return computePosition$1(e, a, {
    ...c,
    platform: l
  });
}, import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1), index = typeof document < "u" ? import_react.useLayoutEffect : function() {
};
function deepEqual(e, a) {
  if (e === a) return true;
  if (typeof e != typeof a) return false;
  if (typeof e == "function" && e.toString() === a.toString()) return true;
  let o, s, c;
  if (e && a && typeof e == "object") {
    if (Array.isArray(e)) {
      if (o = e.length, o !== a.length) return false;
      for (s = o; s-- !== 0; ) if (!deepEqual(e[s], a[s])) return false;
      return true;
    }
    if (c = Object.keys(e), o = c.length, o !== Object.keys(a).length) return false;
    for (s = o; s-- !== 0; ) if (!{}.hasOwnProperty.call(a, c[s])) return false;
    for (s = o; s-- !== 0; ) {
      let o2 = c[s];
      if (!(o2 === "_owner" && e.$$typeof) && !deepEqual(e[o2], a[o2])) return false;
    }
    return true;
  }
  return e !== e && a !== a;
}
function getDPR(e) {
  return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function roundByDPR(e, a) {
  let o = getDPR(e);
  return Math.round(a * o) / o;
}
function useLatestRef(e) {
  let a = import_react.useRef(e);
  return index(() => {
    a.current = e;
  }), a;
}
function useFloating(e) {
  e === void 0 && (e = {});
  let { placement: a = "bottom", strategy: o = "absolute", middleware: s = [], platform: c, elements: { reference: l, floating: u } = {}, transform: d = true, whileElementsMounted: f, open: p } = e, [m, h] = import_react.useState({
    x: 0,
    y: 0,
    strategy: o,
    placement: a,
    middlewareData: {},
    isPositioned: false
  }), [g, _] = import_react.useState(s);
  deepEqual(g, s) || _(s);
  let [v, b] = import_react.useState(null), [x, S] = import_react.useState(null), C = import_react.useCallback((e2) => {
    e2 !== D.current && (D.current = e2, b(e2));
  }, []), w = import_react.useCallback((e2) => {
    e2 !== O.current && (O.current = e2, S(e2));
  }, []), T = l || v, E = u || x, D = import_react.useRef(null), O = import_react.useRef(null), k = import_react.useRef(m), A = f != null, j = useLatestRef(f), M = useLatestRef(c), N = useLatestRef(p), P = import_react.useCallback(() => {
    if (!D.current || !O.current) return;
    let e2 = {
      placement: a,
      strategy: o,
      middleware: g
    };
    M.current && (e2.platform = M.current), computePosition(D.current, O.current, e2).then((e3) => {
      let a2 = {
        ...e3,
        isPositioned: N.current !== false
      };
      F.current && !deepEqual(k.current, a2) && (k.current = a2, import_react_dom.flushSync(() => {
        h(a2);
      }));
    });
  }, [
    g,
    a,
    o,
    M,
    N
  ]);
  index(() => {
    p === false && k.current.isPositioned && (k.current.isPositioned = false, h((e2) => ({
      ...e2,
      isPositioned: false
    })));
  }, [p]);
  let F = import_react.useRef(false);
  index(() => (F.current = true, () => {
    F.current = false;
  }), []), index(() => {
    if (T && (D.current = T), E && (O.current = E), T && E) {
      if (j.current) return j.current(T, E, P);
      P();
    }
  }, [
    T,
    E,
    P,
    j,
    A
  ]);
  let I = import_react.useMemo(() => ({
    reference: D,
    floating: O,
    setReference: C,
    setFloating: w
  }), [C, w]), L = import_react.useMemo(() => ({
    reference: T,
    floating: E
  }), [T, E]), R = import_react.useMemo(() => {
    let e2 = {
      position: o,
      left: 0,
      top: 0
    };
    if (!L.floating) return e2;
    let a2 = roundByDPR(L.floating, m.x), s2 = roundByDPR(L.floating, m.y);
    return d ? {
      ...e2,
      transform: "translate(" + a2 + "px, " + s2 + "px)",
      ...getDPR(L.floating) >= 1.5 && { willChange: "transform" }
    } : {
      position: o,
      left: a2,
      top: s2
    };
  }, [
    o,
    d,
    L.floating,
    m.x,
    m.y
  ]);
  return import_react.useMemo(() => ({
    ...m,
    update: P,
    refs: I,
    elements: L,
    floatingStyles: R
  }), [
    m,
    P,
    I,
    L,
    R
  ]);
}
var arrow$1$1 = (e) => {
  function a(e2) {
    return {}.hasOwnProperty.call(e2, "current");
  }
  return {
    name: "arrow",
    options: e,
    fn(o) {
      let { element: s, padding: c } = typeof e == "function" ? e(o) : e;
      return s && a(s) ? s.current == null ? {} : arrow$1({
        element: s.current,
        padding: c
      }).fn(o) : s ? arrow$1({
        element: s,
        padding: c
      }).fn(o) : {};
    }
  };
}, offset = (e, a) => ({
  ...offset$1(e),
  options: [e, a]
}), shift = (e, a) => ({
  ...shift$1(e),
  options: [e, a]
}), limitShift = (e, a) => ({
  ...limitShift$1(e),
  options: [e, a]
}), flip = (e, a) => ({
  ...flip$1(e),
  options: [e, a]
}), size = (e, a) => ({
  ...size$1(e),
  options: [e, a]
}), hide = (e, a) => ({
  ...hide$1(e),
  options: [e, a]
}), arrow = (e, a) => ({
  ...arrow$1$1(e),
  options: [e, a]
}), NAME = "Arrow", Arrow$1 = import_react.forwardRef((e, a) => {
  let { children: o, width: s = 10, height: c = 5, ...u } = e;
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.svg, {
    ...u,
    ref: a,
    width: s,
    height: c,
    viewBox: "0 0 30 10",
    preserveAspectRatio: "none",
    children: e.asChild ? o : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polygon", { points: "0,0 30,0 15,10" })
  });
});
Arrow$1.displayName = NAME;
var Root = Arrow$1, POPPER_NAME = "Popper", [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME), [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME), Popper = (e) => {
  let { __scopePopper: a, children: o } = e, [s, c] = import_react.useState(null);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperProvider, {
    scope: a,
    anchor: s,
    onAnchorChange: c,
    children: o
  });
};
Popper.displayName = POPPER_NAME;
var ANCHOR_NAME = "PopperAnchor", PopperAnchor = import_react.forwardRef((e, o) => {
  let { __scopePopper: s, virtualRef: c, ...u } = e, d = usePopperContext(ANCHOR_NAME, s), f = import_react.useRef(null), p = useComposedRefs(o, f), m = import_react.useRef(null);
  return import_react.useEffect(() => {
    let e2 = m.current;
    m.current = (c == null ? void 0 : c.current) || f.current, e2 !== m.current && d.onAnchorChange(m.current);
  }), c ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
    ...u,
    ref: p
  });
});
PopperAnchor.displayName = ANCHOR_NAME;
var CONTENT_NAME = "PopperContent", [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME), PopperContent = import_react.forwardRef((e, o) => {
  var _a, _b, _c, _d, _e, _f;
  let { __scopePopper: s, side: c = "bottom", sideOffset: u = 0, align: p = "center", alignOffset: m = 0, arrowPadding: h = 0, avoidCollisions: g = true, collisionBoundary: _ = [], collisionPadding: v = 0, sticky: b = "partial", hideWhenDetached: x = false, updatePositionStrategy: C = "optimized", onPlaced: w, ...T } = e, E = usePopperContext(CONTENT_NAME, s), [O, k] = import_react.useState(null), A = useComposedRefs(o, (e2) => k(e2)), [j, M] = import_react.useState(null), N = useSize(j), P = (N == null ? void 0 : N.width) ?? 0, F = (N == null ? void 0 : N.height) ?? 0, I = c + (p === "center" ? "" : "-" + p), L = typeof v == "number" ? v : {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...v
  }, R = Array.isArray(_) ? _ : [_], z = R.length > 0, B = {
    padding: L,
    boundary: R.filter(isNotNull),
    altBoundary: z
  }, { refs: V, floatingStyles: H, placement: U, isPositioned: W, middlewareData: G } = useFloating({
    strategy: "fixed",
    placement: I,
    whileElementsMounted: (...e2) => autoUpdate(...e2, { animationFrame: C === "always" }),
    elements: { reference: E.anchor },
    middleware: [
      offset({
        mainAxis: u + F,
        alignmentAxis: m
      }),
      g && shift({
        mainAxis: true,
        crossAxis: false,
        limiter: b === "partial" ? limitShift() : void 0,
        ...B
      }),
      g && flip({ ...B }),
      size({
        ...B,
        apply: ({ elements: e2, rects: a, availableWidth: o2, availableHeight: s2 }) => {
          let { width: c2, height: l } = a.reference, u2 = e2.floating.style;
          u2.setProperty("--radix-popper-available-width", `${o2}px`), u2.setProperty("--radix-popper-available-height", `${s2}px`), u2.setProperty("--radix-popper-anchor-width", `${c2}px`), u2.setProperty("--radix-popper-anchor-height", `${l}px`);
        }
      }),
      j && arrow({
        element: j,
        padding: h
      }),
      transformOrigin({
        arrowWidth: P,
        arrowHeight: F
      }),
      x && hide({
        strategy: "referenceHidden",
        ...B
      })
    ]
  }), [K, q] = getSideAndAlignFromPlacement(U), J = useCallbackRef(w);
  useLayoutEffect2(() => {
    W && (J == null ? void 0 : J());
  }, [W, J]);
  let Y = (_a = G.arrow) == null ? void 0 : _a.x, X = (_b = G.arrow) == null ? void 0 : _b.y, Z = ((_c = G.arrow) == null ? void 0 : _c.centerOffset) !== 0, [Q, $] = import_react.useState();
  return useLayoutEffect2(() => {
    O && $(window.getComputedStyle(O).zIndex);
  }, [O]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
    ref: V.setFloating,
    "data-radix-popper-content-wrapper": "",
    style: {
      ...H,
      transform: W ? H.transform : "translate(0, -200%)",
      minWidth: "max-content",
      zIndex: Q,
      "--radix-popper-transform-origin": [(_d = G.transformOrigin) == null ? void 0 : _d.x, (_e = G.transformOrigin) == null ? void 0 : _e.y].join(" "),
      ...((_f = G.hide) == null ? void 0 : _f.referenceHidden) && {
        visibility: "hidden",
        pointerEvents: "none"
      }
    },
    dir: e.dir,
    children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperContentProvider, {
      scope: s,
      placedSide: K,
      onArrowChange: M,
      arrowX: Y,
      arrowY: X,
      shouldHideArrow: Z,
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
        "data-side": K,
        "data-align": q,
        ...T,
        ref: A,
        style: {
          ...T.style,
          animation: W ? void 0 : "none"
        }
      })
    })
  });
});
PopperContent.displayName = CONTENT_NAME;
var ARROW_NAME = "PopperArrow", OPPOSITE_SIDE = {
  top: "bottom",
  right: "left",
  bottom: "top",
  left: "right"
}, PopperArrow = import_react.forwardRef(function(e, a) {
  let { __scopePopper: o, ...s } = e, c = useContentContext(ARROW_NAME, o), l = OPPOSITE_SIDE[c.placedSide];
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
    ref: c.onArrowChange,
    style: {
      position: "absolute",
      left: c.arrowX,
      top: c.arrowY,
      [l]: 0,
      transformOrigin: {
        top: "",
        right: "0 0",
        bottom: "center 0",
        left: "100% 0"
      }[c.placedSide],
      transform: {
        top: "translateY(100%)",
        right: "translateY(50%) rotate(90deg) translateX(-50%)",
        bottom: "rotate(180deg)",
        left: "translateY(50%) rotate(-90deg) translateX(50%)"
      }[c.placedSide],
      visibility: c.shouldHideArrow ? "hidden" : void 0
    },
    children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root, {
      ...s,
      ref: a,
      style: {
        ...s.style,
        display: "block"
      }
    })
  });
});
PopperArrow.displayName = ARROW_NAME;
function isNotNull(e) {
  return e !== null;
}
var transformOrigin = (e) => ({
  name: "transformOrigin",
  options: e,
  fn(a) {
    var _a, _b, _c;
    let { placement: o, rects: s, middlewareData: c } = a, l = ((_a = c.arrow) == null ? void 0 : _a.centerOffset) !== 0, u = l ? 0 : e.arrowWidth, d = l ? 0 : e.arrowHeight, [f, p] = getSideAndAlignFromPlacement(o), m = {
      start: "0%",
      center: "50%",
      end: "100%"
    }[p], h = (((_b = c.arrow) == null ? void 0 : _b.x) ?? 0) + u / 2, g = (((_c = c.arrow) == null ? void 0 : _c.y) ?? 0) + d / 2, _ = "", v = "";
    return f === "bottom" ? (_ = l ? m : `${h}px`, v = `${-d}px`) : f === "top" ? (_ = l ? m : `${h}px`, v = `${s.floating.height + d}px`) : f === "right" ? (_ = `${-d}px`, v = l ? m : `${g}px`) : f === "left" && (_ = `${s.floating.width + d}px`, v = l ? m : `${g}px`), { data: {
      x: _,
      y: v
    } };
  }
});
function getSideAndAlignFromPlacement(e) {
  let [a, o = "center"] = e.split("-");
  return [a, o];
}
var Root2 = Popper, Anchor = PopperAnchor, Content = PopperContent, Arrow = PopperArrow;
export {
  createPopperScope as a,
  VISUALLY_HIDDEN_STYLES as c,
  Root2 as i,
  VisuallyHidden as l,
  Arrow as n,
  useSize as o,
  Content as r,
  Root$1 as s,
  Anchor as t,
  createLucideIcon as u
};
