"use client";
import * as a from "react";
import { composeEventHandlers as M } from "../../../../../@radix-ui_primitive@1.1.1/node_modules/@radix-ui/primitive/dist/index.js";
import { createContextScope as U } from "../../../../../@radix-ui_react-context@1.1.1_@types_react@19.0.10_react@19.0.0/node_modules/@radix-ui/react-context/dist/index.js";
import { Primitive as B } from "../../../../../@radix-ui_react-primitive@2.0.2_@types_react-dom@19.0.4_@types_react@19.0.10__@types_react@19_i7clg2yux7aeir464mbcqjzvuu/node_modules/@radix-ui/react-primitive/dist/index.js";
import { createMenuScope as h, SubTrigger as F, SubContent as X, Content as j, Item as H, CheckboxItem as W, ItemIndicator as $, RadioItem as K, Label as Y, Separator as q, Anchor as z, Portal as J, Root as Q, Group as V, Sub as Z, RadioGroup as ee, Arrow as te } from "../../../../../@radix-ui_react-menu@2.1.6_@types_react-dom@19.0.4_@types_react@19.0.10__@types_react@19.0.10_kbi2yr3tgcaexldivcort6kxam/node_modules/@radix-ui/react-menu/dist/index.js";
import { useCallbackRef as ne } from "../../../../../@radix-ui_react-use-callback-ref@1.1.0_@types_react@19.0.10_react@19.0.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js";
import { useControllableState as oe } from "../../../../../@radix-ui_react-use-controllable-state@1.1.0_@types_react@19.0.10_react@19.0.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
import { jsx as u, jsxs as re, Fragment as ae } from "react/jsx-runtime";
var v = "ContextMenu", [ue, Ae] = U(v, [
  h
]), i = h(), [ie, g] = ue(v), R = (e) => {
  const { __scopeContextMenu: n, children: o, onOpenChange: t, dir: r, modal: x = !0 } = e, [p, c] = a.useState(!1), d = i(n), l = ne(t), s = a.useCallback(
    (m) => {
      c(m), l(m);
    },
    [l]
  );
  return /* @__PURE__ */ u(
    ie,
    {
      scope: n,
      open: p,
      onOpenChange: s,
      modal: x,
      children: /* @__PURE__ */ u(
        Q,
        {
          ...d,
          dir: r,
          open: p,
          onOpenChange: s,
          modal: x,
          children: o
        }
      )
    }
  );
};
R.displayName = v;
var _ = "ContextMenuTrigger", S = a.forwardRef(
  (e, n) => {
    const { __scopeContextMenu: o, disabled: t = !1, ...r } = e, x = g(_, o), p = i(o), c = a.useRef({ x: 0, y: 0 }), d = a.useRef({
      getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...c.current })
    }), l = a.useRef(0), s = a.useCallback(
      () => window.clearTimeout(l.current),
      []
    ), m = (C) => {
      c.current = { x: C.clientX, y: C.clientY }, x.onOpenChange(!0);
    };
    return a.useEffect(() => s, [s]), a.useEffect(() => void (t && s()), [t, s]), /* @__PURE__ */ re(ae, { children: [
      /* @__PURE__ */ u(z, { ...p, virtualRef: d }),
      /* @__PURE__ */ u(
        B.span,
        {
          "data-state": x.open ? "open" : "closed",
          "data-disabled": t ? "" : void 0,
          ...r,
          ref: n,
          style: { WebkitTouchCallout: "none", ...e.style },
          onContextMenu: t ? e.onContextMenu : M(e.onContextMenu, (C) => {
            s(), m(C), C.preventDefault();
          }),
          onPointerDown: t ? e.onPointerDown : M(
            e.onPointerDown,
            f((C) => {
              s(), l.current = window.setTimeout(() => m(C), 700);
            })
          ),
          onPointerMove: t ? e.onPointerMove : M(e.onPointerMove, f(s)),
          onPointerCancel: t ? e.onPointerCancel : M(e.onPointerCancel, f(s)),
          onPointerUp: t ? e.onPointerUp : M(e.onPointerUp, f(s))
        }
      )
    ] });
  }
);
S.displayName = _;
var ce = "ContextMenuPortal", P = (e) => {
  const { __scopeContextMenu: n, ...o } = e, t = i(n);
  return /* @__PURE__ */ u(J, { ...t, ...o });
};
P.displayName = ce;
var b = "ContextMenuContent", I = a.forwardRef(
  (e, n) => {
    const { __scopeContextMenu: o, ...t } = e, r = g(b, o), x = i(o), p = a.useRef(!1);
    return /* @__PURE__ */ u(
      j,
      {
        ...x,
        ...t,
        ref: n,
        side: "right",
        sideOffset: 2,
        align: "start",
        onCloseAutoFocus: (c) => {
          var d;
          (d = e.onCloseAutoFocus) == null || d.call(e, c), !c.defaultPrevented && p.current && c.preventDefault(), p.current = !1;
        },
        onInteractOutside: (c) => {
          var d;
          (d = e.onInteractOutside) == null || d.call(e, c), !c.defaultPrevented && !r.modal && (p.current = !0);
        },
        style: {
          ...e.style,
          "--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
          "--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
          "--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
          "--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
          "--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
        }
      }
    );
  }
);
I.displayName = b;
var se = "ContextMenuGroup", N = a.forwardRef(
  (e, n) => {
    const { __scopeContextMenu: o, ...t } = e, r = i(o);
    return /* @__PURE__ */ u(V, { ...r, ...t, ref: n });
  }
);
N.displayName = se;
var de = "ContextMenuLabel", w = a.forwardRef(
  (e, n) => {
    const { __scopeContextMenu: o, ...t } = e, r = i(o);
    return /* @__PURE__ */ u(Y, { ...r, ...t, ref: n });
  }
);
w.displayName = de;
var pe = "ContextMenuItem", A = a.forwardRef(
  (e, n) => {
    const { __scopeContextMenu: o, ...t } = e, r = i(o);
    return /* @__PURE__ */ u(H, { ...r, ...t, ref: n });
  }
);
A.displayName = pe;
var xe = "ContextMenuCheckboxItem", E = a.forwardRef((e, n) => {
  const { __scopeContextMenu: o, ...t } = e, r = i(o);
  return /* @__PURE__ */ u(W, { ...r, ...t, ref: n });
});
E.displayName = xe;
var Ce = "ContextMenuRadioGroup", O = a.forwardRef((e, n) => {
  const { __scopeContextMenu: o, ...t } = e, r = i(o);
  return /* @__PURE__ */ u(ee, { ...r, ...t, ref: n });
});
O.displayName = Ce;
var le = "ContextMenuRadioItem", T = a.forwardRef((e, n) => {
  const { __scopeContextMenu: o, ...t } = e, r = i(o);
  return /* @__PURE__ */ u(K, { ...r, ...t, ref: n });
});
T.displayName = le;
var me = "ContextMenuItemIndicator", y = a.forwardRef((e, n) => {
  const { __scopeContextMenu: o, ...t } = e, r = i(o);
  return /* @__PURE__ */ u($, { ...r, ...t, ref: n });
});
y.displayName = me;
var Me = "ContextMenuSeparator", G = a.forwardRef((e, n) => {
  const { __scopeContextMenu: o, ...t } = e, r = i(o);
  return /* @__PURE__ */ u(q, { ...r, ...t, ref: n });
});
G.displayName = Me;
var fe = "ContextMenuArrow", ve = a.forwardRef(
  (e, n) => {
    const { __scopeContextMenu: o, ...t } = e, r = i(o);
    return /* @__PURE__ */ u(te, { ...r, ...t, ref: n });
  }
);
ve.displayName = fe;
var he = "ContextMenuSub", k = (e) => {
  const { __scopeContextMenu: n, children: o, onOpenChange: t, open: r, defaultOpen: x } = e, p = i(n), [c, d] = oe({
    prop: r,
    defaultProp: x,
    onChange: t
  });
  return /* @__PURE__ */ u(Z, { ...p, open: c, onOpenChange: d, children: o });
};
k.displayName = he;
var ge = "ContextMenuSubTrigger", D = a.forwardRef((e, n) => {
  const { __scopeContextMenu: o, ...t } = e, r = i(o);
  return /* @__PURE__ */ u(F, { ...r, ...t, ref: n });
});
D.displayName = ge;
var Re = "ContextMenuSubContent", L = a.forwardRef((e, n) => {
  const { __scopeContextMenu: o, ...t } = e, r = i(o);
  return /* @__PURE__ */ u(
    X,
    {
      ...r,
      ...t,
      ref: n,
      style: {
        ...e.style,
        "--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
        "--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
        "--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
        "--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
        "--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
      }
    }
  );
});
L.displayName = Re;
function f(e) {
  return (n) => n.pointerType !== "mouse" ? e(n) : void 0;
}
var Ee = R, Oe = S, Te = P, ye = I, Ge = N, ke = w, De = A, Le = E, Ue = O, Be = T, Fe = y, Xe = G, je = k, He = D, We = L;
export {
  Le as CheckboxItem,
  ye as Content,
  R as ContextMenu,
  ve as ContextMenuArrow,
  E as ContextMenuCheckboxItem,
  I as ContextMenuContent,
  N as ContextMenuGroup,
  A as ContextMenuItem,
  y as ContextMenuItemIndicator,
  w as ContextMenuLabel,
  P as ContextMenuPortal,
  O as ContextMenuRadioGroup,
  T as ContextMenuRadioItem,
  G as ContextMenuSeparator,
  k as ContextMenuSub,
  L as ContextMenuSubContent,
  D as ContextMenuSubTrigger,
  S as ContextMenuTrigger,
  Ge as Group,
  De as Item,
  Fe as ItemIndicator,
  ke as Label,
  Te as Portal,
  Ue as RadioGroup,
  Be as RadioItem,
  Ee as Root,
  Xe as Separator,
  je as Sub,
  We as SubContent,
  He as SubTrigger,
  Oe as Trigger,
  Ae as createContextMenuScope
};
//# sourceMappingURL=index.js.map
