"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ItemCtx = exports.ContextMenuContext = void 0;
exports.useContextMenuContext = useContextMenuContext;
exports.useItemContext = useItemContext;
var _react = require("react");
/**
 * Shared context definitions and hooks for ContextMenu (native + web).
 */

// ---------------------------------------------------------------------------
// ContextMenu context + hook
// ---------------------------------------------------------------------------

/**
 * Base context shared by both platforms. Each platform extends this with
 * additional fields (native adds `control`, web adds `position`) by
 * providing a compatible superset value.
 */
const ContextMenuContext = exports.ContextMenuContext = /*#__PURE__*/(0, _react.createContext)(null);
ContextMenuContext.displayName = 'ContextMenuContext';
function useContextMenuContext() {
  const ctx = (0, _react.useContext)(ContextMenuContext);
  if (!ctx) {
    throw new Error('ContextMenu components must be used within a ContextMenu.Root');
  }
  return ctx;
}

// ---------------------------------------------------------------------------
// Item context + hook
// ---------------------------------------------------------------------------

const ItemCtx = exports.ItemCtx = /*#__PURE__*/(0, _react.createContext)(null);
ItemCtx.displayName = 'ContextMenuItemContext';
function useItemContext() {
  const ctx = (0, _react.useContext)(ItemCtx);
  if (!ctx) {
    throw new Error('ContextMenu.ItemText/ItemIcon must be used within a ContextMenu.Item');
  }
  return ctx;
}
//# sourceMappingURL=context.js.map