"use strict";

/**
 * Shared context definitions and hooks for ContextMenu (native + web).
 */
import { createContext, useContext } from 'react';
// ---------------------------------------------------------------------------
// 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.
 */
export const ContextMenuContext = /*#__PURE__*/createContext(null);
ContextMenuContext.displayName = 'ContextMenuContext';
export function useContextMenuContext() {
  const ctx = useContext(ContextMenuContext);
  if (!ctx) {
    throw new Error('ContextMenu components must be used within a ContextMenu.Root');
  }
  return ctx;
}

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

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