"use client";
import * as React from "react";
import { useId } from "../../../../utils/esm/useId.js";
import { ContextMenuRootContext } from "./ContextMenuRootContext.js";
import { MenuRootContext } from "../../menu/root/MenuRootContext.js";
import { jsx } from "react/jsx-runtime";
import { MenuRoot } from "../../menu/root/MenuRoot.js";
function ContextMenuRoot(props) {
  const [anchor, setAnchor] = React.useState({
    getBoundingClientRect() {
      return DOMRect.fromRect({
        width: 0,
        height: 0,
        x: 0,
        y: 0
      });
    }
  });
  const backdropRef = React.useRef(null);
  const internalBackdropRef = React.useRef(null);
  const actionsRef = React.useRef(null);
  const positionerRef = React.useRef(null);
  const allowMouseUpTriggerRef = React.useRef(true);
  const initialCursorPointRef = React.useRef(null);
  const id = useId();
  const contextValue = React.useMemo(() => ({
    anchor,
    setAnchor,
    actionsRef,
    backdropRef,
    internalBackdropRef,
    positionerRef,
    allowMouseUpTriggerRef,
    initialCursorPointRef,
    rootId: id
  }), [anchor, id]);
  return /* @__PURE__ */ jsx(ContextMenuRootContext.Provider, {
    value: contextValue,
    children: /* @__PURE__ */ jsx(MenuRootContext.Provider, {
      value: void 0,
      children: /* @__PURE__ */ jsx(MenuRoot, {
        ...props
      })
    })
  });
}
export {
  ContextMenuRoot
};
//# sourceMappingURL=ContextMenuRoot.js.map
