import * as r from "react";
import { a as F, c as W, P as X, b as g, j as q, y as i, m as J } from "./index.D1n9HtNk.js";
import { c as I, R as Q, A as Y, P as Z, C as ee, G as re, L as oe, I as ne, S as ae, a as te, b as se, d as de, e as ce, f as pe, g as ue, h as ie, n as D, i as N, j as le, k as me, p as we } from "./base-menu.props.DId21TTL.js";
import { u as v, H as fe, R } from "./theme.BwnlJUJD.js";
import { a as Me, t as C, l as De } from "./icons.fQeDMwI8.js";
import { v as E } from "./radius.prop.CaJVv35S.js";
import { jsx as c } from "react/jsx-runtime";
var h = "DropdownMenu", [ge] = W(
  h,
  [I]
), u = I(), [he, b] = ge(h), S = (e) => {
  const {
    __scopeDropdownMenu: n,
    children: o,
    dir: a,
    open: t,
    defaultOpen: s,
    onOpenChange: p,
    modal: d = !0
  } = e, l = u(n), w = r.useRef(null), [m, f] = F({
    prop: t,
    defaultProp: s ?? !1,
    onChange: p,
    caller: h
  });
  return /* @__PURE__ */ c(
    he,
    {
      scope: n,
      triggerId: v(),
      triggerRef: w,
      contentId: v(),
      open: m,
      onOpenChange: f,
      onOpenToggle: r.useCallback(() => f((M) => !M), [f]),
      modal: d,
      children: /* @__PURE__ */ c(Q, { ...l, open: m, onOpenChange: f, dir: a, modal: d, children: o })
    }
  );
};
S.displayName = h;
var _ = "DropdownMenuTrigger", y = r.forwardRef(
  (e, n) => {
    const { __scopeDropdownMenu: o, disabled: a = !1, ...t } = e, s = b(_, o), p = u(o);
    return /* @__PURE__ */ c(Y, { asChild: !0, ...p, children: /* @__PURE__ */ c(
      X.button,
      {
        type: "button",
        id: s.triggerId,
        "aria-haspopup": "menu",
        "aria-expanded": s.open,
        "aria-controls": s.open ? s.contentId : void 0,
        "data-state": s.open ? "open" : "closed",
        "data-disabled": a ? "" : void 0,
        disabled: a,
        ...t,
        ref: q(n, s.triggerRef),
        onPointerDown: g(e.onPointerDown, (d) => {
          !a && d.button === 0 && d.ctrlKey === !1 && (s.onOpenToggle(), s.open || d.preventDefault());
        }),
        onKeyDown: g(e.onKeyDown, (d) => {
          a || (["Enter", " "].includes(d.key) && s.onOpenToggle(), d.key === "ArrowDown" && s.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(d.key) && d.preventDefault());
        })
      }
    ) });
  }
);
y.displayName = _;
var ve = "DropdownMenuPortal", x = (e) => {
  const { __scopeDropdownMenu: n, ...o } = e, a = u(n);
  return /* @__PURE__ */ c(Z, { ...a, ...o });
};
x.displayName = ve;
var P = "DropdownMenuContent", A = r.forwardRef(
  (e, n) => {
    const { __scopeDropdownMenu: o, ...a } = e, t = b(P, o), s = u(o), p = r.useRef(!1);
    return /* @__PURE__ */ c(
      ee,
      {
        id: t.contentId,
        "aria-labelledby": t.triggerId,
        ...s,
        ...a,
        ref: n,
        onCloseAutoFocus: g(e.onCloseAutoFocus, (d) => {
          p.current || t.triggerRef.current?.focus(), p.current = !1, d.preventDefault();
        }),
        onInteractOutside: g(e.onInteractOutside, (d) => {
          const l = d.detail.originalEvent, w = l.button === 0 && l.ctrlKey === !0, m = l.button === 2 || w;
          (!t.modal || m) && (p.current = !0);
        }),
        style: {
          ...e.style,
          "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
          "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
          "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
          "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
          "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
        }
      }
    );
  }
);
A.displayName = P;
var Ie = "DropdownMenuGroup", B = r.forwardRef(
  (e, n) => {
    const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
    return /* @__PURE__ */ c(re, { ...t, ...a, ref: n });
  }
);
B.displayName = Ie;
var Ne = "DropdownMenuLabel", T = r.forwardRef(
  (e, n) => {
    const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
    return /* @__PURE__ */ c(oe, { ...t, ...a, ref: n });
  }
);
T.displayName = Ne;
var Re = "DropdownMenuItem", O = r.forwardRef(
  (e, n) => {
    const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
    return /* @__PURE__ */ c(ne, { ...t, ...a, ref: n });
  }
);
O.displayName = Re;
var Ce = "DropdownMenuCheckboxItem", G = r.forwardRef((e, n) => {
  const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
  return /* @__PURE__ */ c(te, { ...t, ...a, ref: n });
});
G.displayName = Ce;
var Ee = "DropdownMenuRadioGroup", k = r.forwardRef((e, n) => {
  const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
  return /* @__PURE__ */ c(de, { ...t, ...a, ref: n });
});
k.displayName = Ee;
var be = "DropdownMenuRadioItem", L = r.forwardRef((e, n) => {
  const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
  return /* @__PURE__ */ c(ce, { ...t, ...a, ref: n });
});
L.displayName = be;
var Se = "DropdownMenuItemIndicator", $ = r.forwardRef((e, n) => {
  const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
  return /* @__PURE__ */ c(se, { ...t, ...a, ref: n });
});
$.displayName = Se;
var _e = "DropdownMenuSeparator", z = r.forwardRef((e, n) => {
  const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
  return /* @__PURE__ */ c(ae, { ...t, ...a, ref: n });
});
z.displayName = _e;
var ye = "DropdownMenuArrow", xe = r.forwardRef(
  (e, n) => {
    const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
    return /* @__PURE__ */ c(pe, { ...t, ...a, ref: n });
  }
);
xe.displayName = ye;
var Pe = "DropdownMenuSubTrigger", K = r.forwardRef((e, n) => {
  const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
  return /* @__PURE__ */ c(ue, { ...t, ...a, ref: n });
});
K.displayName = Pe;
var Ae = "DropdownMenuSubContent", U = r.forwardRef((e, n) => {
  const { __scopeDropdownMenu: o, ...a } = e, t = u(o);
  return /* @__PURE__ */ c(
    ie,
    {
      ...t,
      ...a,
      ref: n,
      style: {
        ...e.style,
        "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
        "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
        "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
        "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
        "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
      }
    }
  );
});
U.displayName = Ae;
var Be = S, Te = y, V = x, Oe = A, Ge = B, ke = T, Le = O, $e = G, ze = k, Ke = L, j = $, Ue = z, Ve = K, je = U;
const He = (e) => r.createElement(Be, { ...e });
He.displayName = "DropdownMenu.Root";
const Fe = r.forwardRef(({ children: e, ...n }, o) => r.createElement(Te, { ...n, ref: o, asChild: !0 }, Me(e)));
Fe.displayName = "DropdownMenu.Trigger";
const H = r.createContext({}), We = r.forwardRef((e, n) => {
  const o = fe(), { size: a = D.size.default, variant: t = D.variant.default, highContrast: s = D.highContrast.default } = e, { className: p, children: d, color: l, container: w, forceMount: m, ...f } = E(e, D), M = l || o.accentColor;
  return r.createElement(V, { container: w, forceMount: m }, r.createElement(R, { asChild: !0 }, r.createElement(Oe, { "data-accent-color": M, align: "start", sideOffset: 4, collisionPadding: 10, ...f, asChild: !1, ref: n, className: i("rt-PopperContent", "rt-BaseMenuContent", "rt-DropdownMenuContent", p) }, r.createElement(N, { type: "auto" }, r.createElement("div", { className: i("rt-BaseMenuViewport", "rt-DropdownMenuViewport") }, r.createElement(H.Provider, { value: r.useMemo(() => ({ size: a, variant: t, color: M, highContrast: s }), [a, t, M, s]) }, d))))));
});
We.displayName = "DropdownMenu.Content";
const Xe = r.forwardRef(({ className: e, ...n }, o) => r.createElement(ke, { ...n, asChild: !1, ref: o, className: i("rt-BaseMenuLabel", "rt-DropdownMenuLabel", e) }));
Xe.displayName = "DropdownMenu.Label";
const qe = r.forwardRef((e, n) => {
  const { className: o, children: a, color: t = le.color.default, shortcut: s, ...p } = e;
  return r.createElement(Le, { "data-accent-color": t, ...p, ref: n, className: i("rt-reset", "rt-BaseMenuItem", "rt-DropdownMenuItem", o) }, r.createElement(J, null, a), s && r.createElement("div", { className: "rt-BaseMenuShortcut rt-DropdownMenuShortcut" }, s));
});
qe.displayName = "DropdownMenu.Item";
const Je = r.forwardRef(({ className: e, ...n }, o) => r.createElement(Ge, { ...n, asChild: !1, ref: o, className: i("rt-BaseMenuGroup", "rt-DropdownMenuGroup", e) }));
Je.displayName = "DropdownMenu.Group";
const Qe = r.forwardRef(({ className: e, ...n }, o) => r.createElement(ze, { ...n, asChild: !1, ref: o, className: i("rt-BaseMenuRadioGroup", "rt-DropdownMenuRadioGroup", e) }));
Qe.displayName = "DropdownMenu.RadioGroup";
const Ye = r.forwardRef((e, n) => {
  const { children: o, className: a, color: t = we.color.default, ...s } = e;
  return r.createElement(Ke, { ...s, asChild: !1, ref: n, "data-accent-color": t, className: i("rt-BaseMenuItem", "rt-BaseMenuRadioItem", "rt-DropdownMenuItem", "rt-DropdownMenuRadioItem", a) }, o, r.createElement(j, { className: "rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator" }, r.createElement(C, { className: "rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon" })));
});
Ye.displayName = "DropdownMenu.RadioItem";
const Ze = r.forwardRef((e, n) => {
  const { children: o, className: a, shortcut: t, color: s = me.color.default, ...p } = e;
  return r.createElement($e, { ...p, asChild: !1, ref: n, "data-accent-color": s, className: i("rt-BaseMenuItem", "rt-BaseMenuCheckboxItem", "rt-DropdownMenuItem", "rt-DropdownMenuCheckboxItem", a) }, o, r.createElement(j, { className: "rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator" }, r.createElement(C, { className: "rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon" })), t && r.createElement("div", { className: "rt-BaseMenuShortcut rt-DropdownMenuShortcut" }, t));
});
Ze.displayName = "DropdownMenu.CheckboxItem";
const er = r.forwardRef((e, n) => {
  const { className: o, children: a, ...t } = e;
  return r.createElement(Ve, { ...t, asChild: !1, ref: n, className: i("rt-BaseMenuItem", "rt-BaseMenuSubTrigger", "rt-DropdownMenuItem", "rt-DropdownMenuSubTrigger", o) }, a, r.createElement("div", { className: "rt-BaseMenuShortcut rt-DropdownMenuShortcut" }, r.createElement(De, { className: "rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon" })));
});
er.displayName = "DropdownMenu.SubTrigger";
const rr = r.forwardRef((e, n) => {
  const { size: o, variant: a, color: t, highContrast: s } = r.useContext(H), { className: p, children: d, container: l, forceMount: w, ...m } = E({ size: o, variant: a, color: t, highContrast: s, ...e }, D);
  return r.createElement(V, { container: l, forceMount: w }, r.createElement(R, { asChild: !0 }, r.createElement(je, { "data-accent-color": t, alignOffset: -Number(o) * 4, sideOffset: 1, collisionPadding: 10, ...m, asChild: !1, ref: n, className: i("rt-PopperContent", "rt-BaseMenuContent", "rt-BaseMenuSubContent", "rt-DropdownMenuContent", "rt-DropdownMenuSubContent", p) }, r.createElement(N, { type: "auto" }, r.createElement("div", { className: i("rt-BaseMenuViewport", "rt-DropdownMenuViewport") }, d)))));
});
rr.displayName = "DropdownMenu.SubContent";
const or = r.forwardRef(({ className: e, ...n }, o) => r.createElement(Ue, { ...n, asChild: !1, ref: o, className: i("rt-BaseMenuSeparator", "rt-DropdownMenuSeparator", e) }));
or.displayName = "DropdownMenu.Separator";
export {
  or as B,
  He as I,
  Je as R,
  Ze as T,
  We as g,
  Fe as h,
  qe as v,
  Xe as y
};
