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