{"version":3,"file":"chunk-Menu.mjs","names":["MenuPrimitive","_Fragment","Icon.Icon"],"sources":["../../src/components/Menu/Menu.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { Menu as MenuPrimitive, useMenuContext } from '@ark-ui/react/menu';\nimport { Portal } from '@ark-ui/react/portal';\nimport React, {\n  type ComponentPropsWithoutRef,\n  type ReactNode,\n  type RefObject,\n  createContext,\n  forwardRef,\n  useContext,\n  useEffect,\n  useId,\n  useRef,\n  useState,\n} from 'react';\n\nimport { invariant } from '@dxos/invariant';\nimport { mx } from '@dxos/ui-theme';\nimport { type ThemedClassName } from '@dxos/ui-types';\n\nimport { recipes } from '../../recipes.ts';\nimport { type Size } from '../../sizes.ts';\nimport { composable, composableProps } from '../../util/slots.ts';\nimport * as Icon from '../Icon/Icon.tsx';\nimport { PopupScroll, popupPositioning, usePopupSize } from '../ScrollArea/PopupScroll.tsx';\n\n/** Gap between trigger and popup, in px (positioning takes a number, not a CSS variable). */\nconst POPUP_GUTTER = 2;\n\n/** A popup's ring is 1px drawn outside its box, so a submenu this far off its parent paints its ring on the parent's. */\nconst SUBMENU_OFFSET = 1;\n\n//\n// Root\n//\n\ntype MenuRootProps = MenuPrimitive.RootProps;\n\n/**\n * The enclosing menu: its `onSelect`, so a nested menu reports its selections to the root by default, and whether it\n * is a `Menu.Sub`, whose Content lines its first item up with the TriggerItem row.\n */\ntype MenuContextValue = {\n  onSelect?: MenuRootProps['onSelect'];\n  sub: boolean;\n  /** Whether the menu was last opened at the pointer (ContextTrigger), where an arrow has no trigger to point at. */\n  atPointer: boolean;\n  setAtPointer?: (atPointer: boolean) => void;\n};\n\nconst MenuContext = createContext<MenuContextValue>({ sub: false, atPointer: false });\n\nconst MenuRootBase = ({\n  lazyMount = true,\n  unmountOnExit = true,\n  positioning,\n  onSelect,\n  sub,\n  ...props\n}: MenuRootProps & { sub: boolean }) => {\n  const [atPointer, setAtPointer] = useState(false);\n  return (\n    <MenuContext.Provider value={{ onSelect, sub, atPointer, setAtPointer }}>\n      <MenuPrimitive.Root\n        {...props}\n        onSelect={onSelect}\n        lazyMount={lazyMount}\n        unmountOnExit={unmountOnExit}\n        // Ark's 8px default reads as detached from the trigger.\n        positioning={popupPositioning(POPUP_GUTTER, positioning)}\n      />\n    </MenuContext.Provider>\n  );\n};\n\n/**\n * Ark menu; content mounts on open and unmounts on close unless the caller opts out. With no Trigger (a virtual\n * trigger), open it under control and anchor it with `positioning={useVirtualAnchor(ref)}`.\n */\nconst MenuRoot = (props: MenuRootProps) => <MenuRootBase {...props} sub={false} />;\n\nMenuRoot.displayName = 'Menu.Root';\n\n//\n// Trigger\n//\n\ntype MenuTriggerProps = MenuPrimitive.TriggerProps;\n\n/** Use `asChild` to open the menu from a `Button`. */\nconst MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(\n  ({ onPointerDown, onKeyDown, ...props }, forwardedRef) => {\n    const { setAtPointer } = useContext(MenuContext);\n    return (\n      <MenuPrimitive.Trigger\n        {...props}\n        onPointerDown={(event) => {\n          setAtPointer?.(false);\n          onPointerDown?.(event);\n        }}\n        onKeyDown={(event) => {\n          setAtPointer?.(false);\n          onKeyDown?.(event);\n        }}\n        ref={forwardedRef}\n      />\n    );\n  },\n);\n\nMenuTrigger.displayName = 'Menu.Trigger';\n\n//\n// ContextTrigger\n//\n\ntype MenuContextTriggerProps = MenuPrimitive.ContextTriggerProps;\n\n/** Opens the menu at the pointer on right-click (or long-press); use `asChild` to make a region the target. */\nconst MenuContextTrigger = forwardRef<HTMLButtonElement, MenuContextTriggerProps>(\n  ({ onContextMenu, ...props }, forwardedRef) => {\n    const { setAtPointer } = useContext(MenuContext);\n    return (\n      <MenuPrimitive.ContextTrigger\n        {...props}\n        onContextMenu={(event) => {\n          setAtPointer?.(true);\n          onContextMenu?.(event);\n        }}\n        ref={forwardedRef}\n      />\n    );\n  },\n);\n\nMenuContextTrigger.displayName = 'Menu.ContextTrigger';\n\n//\n// Content\n//\n\ntype MenuContentProps = ThemedClassName<MenuPrimitive.ContentProps> & {\n  /** The menu's size; `md` by default (a submenu inherits its parent's). */\n  size?: Size;\n  /** Point at the trigger with an arrow in the popup's surface colour, like Popover's; on by default, off for submenus. */\n  arrow?: boolean;\n  /** Portals into this element instead of the body (e.g. a sized scope, AUDIT 2.2). */\n  container?: RefObject<HTMLElement | null>;\n  /** Lays the items out as a grid of square cells, this many to a row (e.g. a palette of swatches). */\n  columns?: number;\n};\n\n/**\n * Closes the menu on a pointerdown outside it whose target leaves the DOM within a frame (e.g. a CodeMirror line that\n * redraws as the caret enters it): zag checks the target a frame later and ignores a detached one, so it never closes.\n */\nconst useDismissOnDetachedPointerDown = (open: boolean, setOpen: (open: boolean) => void) => {\n  // Zag's api is rebuilt every render; re-subscribing on each would cancel a frame the click itself re-rendered past.\n  const setOpenRef = useRef(setOpen);\n  setOpenRef.current = setOpen;\n  useEffect(() => {\n    if (!open) {\n      return;\n    }\n\n    let frame: number | undefined;\n    const handlePointerDown = (event: PointerEvent) => {\n      const target = event.target;\n      if (!(target instanceof Element) || target.closest('[data-scope=\"menu\"]')) {\n        return;\n      }\n\n      frame = requestAnimationFrame(() => {\n        if (!target.isConnected) {\n          setOpenRef.current(false);\n        }\n      });\n    };\n\n    document.addEventListener('pointerdown', handlePointerDown, true);\n    return () => {\n      document.removeEventListener('pointerdown', handlePointerDown, true);\n      if (frame !== undefined) {\n        cancelAnimationFrame(frame);\n      }\n    };\n  }, [open]);\n};\n\n/**\n * Ark's content as a composable part, so the ScrollArea viewport slot merges onto it (a plain Ark part gets the dev\n * warning wrapper, which breaks the frame's child rules); it restates Ark's scope and part, which the slot's replace.\n */\nconst MenuViewport = composable<HTMLDivElement, MenuPrimitive.ContentProps>((props, forwardedRef) => (\n  <MenuPrimitive.Content {...composableProps(props)} data-scope='menu' data-part='content' ref={forwardedRef} />\n));\n\n/**\n * Portalled menu at `level='popup'`, scrolling in a thin ScrollArea whose viewport is the menu itself; a nested menu's\n * Content is the same part inside a `Menu.Sub`.\n */\nconst MenuContent = forwardRef<HTMLDivElement, MenuContentProps>(\n  ({ classNames, size, arrow: arrowProp, container, columns, style, children, ...props }, forwardedRef) => {\n    const { sub, atPointer } = useContext(MenuContext);\n    // A submenu opens beside its row and a context menu at the pointer: neither has a trigger to point at.\n    const arrow = arrowProp ?? (!sub && !atPointer);\n    const menu = useMenuContext();\n    useDismissOnDetachedPointerDown(menu.open, menu.setOpen);\n    // A menu reads at one density wherever it opens (a navtree row or a plank's larger header), so a top-level menu is\n    // `md` unless sized; a Sub's trigger is its item in the parent menu, so it inherits the parent popup's size.\n    const popupSize = usePopupSize(\n      size ?? (sub ? undefined : 'md'),\n      menu.open,\n      [menu.getTriggerProps().id, menu.getContextTriggerProps().id],\n      'md',\n    );\n    return (\n      <Portal container={container}>\n        <MenuPrimitive.Positioner>\n          <PopupScroll\n            size={popupSize}\n            classNames={mx(recipes.menuContent(), sub && recipes.submenuContent(), classNames)}\n            outside={\n              arrow && (\n                <MenuPrimitive.Arrow className={recipes.arrow()}>\n                  <MenuPrimitive.ArrowTip className={recipes.arrowTip()} />\n                </MenuPrimitive.Arrow>\n              )\n            }\n          >\n            <MenuViewport\n              {...props}\n              data-columns={columns}\n              style={columns ? { ...style, gridTemplateColumns: `repeat(${columns}, var(--dx-block-size))` } : style}\n              ref={forwardedRef}\n            >\n              {children}\n            </MenuViewport>\n          </PopupScroll>\n        </MenuPrimitive.Positioner>\n      </Portal>\n    );\n  },\n);\n\nMenuContent.displayName = 'Menu.Content';\n\n//\n// Item\n//\n\n/** What a row shows: its default layout renders the icon, label and shortcut. */\ntype MenuItemData = {\n  label: string;\n  /** Leading icon. */\n  icon?: string;\n  /** Trailing keyboard hint, e.g. `⌘C`; display only. */\n  shortcut?: string;\n};\n\ntype MenuOption = MenuItemData & {\n  value: string;\n  disabled?: boolean;\n};\n\n// The row an item part belongs to; a TriggerItem is no Ark option, so its text cannot be Ark's ItemText.\nconst ItemContext = createContext<{ data: MenuItemData; trigger: boolean } | undefined>(undefined);\n\nconst useItem = (part: string) => {\n  const context = useContext(ItemContext);\n  if (!context) {\n    throw new Error(`Menu.${part} must be inside a Menu item`);\n  }\n  return context;\n};\n\n/** An item part's row data comes from its caller, so a missing `item` names the part rather than failing deep inside it. */\nconst assertItem = (part: string, item: MenuItemData | undefined) =>\n  invariant(item, `Menu.${part} requires an \\`item\\``);\n\ntype MenuItemProps = ThemedClassName<Omit<MenuPrimitive.ItemProps, 'value' | 'children'>> & {\n  item: MenuOption;\n  /** Replaces the whole row, composed from `ItemIcon`, `ItemText`, `ItemShortcut` and any trailing control. */\n  children?: ReactNode;\n};\n\n/** A block-tall row: without children, the option's leading icon, its label and its trailing shortcut. */\nconst MenuItem = forwardRef<HTMLDivElement, MenuItemProps>(\n  ({ classNames, item, disabled, children, ...props }, forwardedRef) => {\n    assertItem('Item', item);\n    return (\n      <ItemContext.Provider value={{ data: item, trigger: false }}>\n        <MenuPrimitive.Item\n          {...props}\n          value={item.value}\n          disabled={disabled ?? item.disabled}\n          className={mx(recipes.menuItem(), classNames)}\n          ref={forwardedRef}\n        >\n          {children ?? (\n            <>\n              {item.icon && <MenuItemIcon />}\n              <MenuItemText />\n              {item.shortcut && <MenuItemShortcut />}\n            </>\n          )}\n        </MenuPrimitive.Item>\n      </ItemContext.Provider>\n    );\n  },\n);\n\nMenuItem.displayName = 'Menu.Item';\n\n//\n// ItemIcon\n//\n\ntype MenuItemIconProps = Omit<Icon.IconProps, 'icon'> & {\n  /** Defaults to the item's `icon`. */\n  icon?: string;\n};\n\nconst MenuItemIcon = forwardRef<SVGSVGElement, MenuItemIconProps>(({ icon, ...props }, forwardedRef) => {\n  const { data } = useItem('ItemIcon');\n  const glyph = icon ?? data.icon;\n  return glyph ? <Icon.Icon {...props} icon={glyph} ref={forwardedRef} /> : null;\n});\n\nMenuItemIcon.displayName = 'Menu.ItemIcon';\n\n//\n// ItemText\n//\n\ntype MenuItemTextProps = ThemedClassName<MenuPrimitive.ItemTextProps>;\n\n/** The row's label, taking the free space and truncating; the item's `label` by default. */\nconst MenuItemText = forwardRef<HTMLDivElement, MenuItemTextProps>(\n  ({ classNames, children, ...props }, forwardedRef) => {\n    const { data, trigger } = useItem('ItemText');\n    const className = mx(recipes.menuItemText(), classNames);\n    return trigger ? (\n      <div {...props} data-scope='menu' data-part='item-text' className={className} ref={forwardedRef}>\n        {children ?? data.label}\n      </div>\n    ) : (\n      <MenuPrimitive.ItemText {...props} className={className} ref={forwardedRef}>\n        {children ?? data.label}\n      </MenuPrimitive.ItemText>\n    );\n  },\n);\n\nMenuItemText.displayName = 'Menu.ItemText';\n\n//\n// ItemShortcut\n//\n\ntype MenuItemShortcutProps = ThemedClassName<ComponentPropsWithoutRef<'kbd'>>;\n\n/** A trailing keyboard hint in the description colour, hidden from assistive tech; the item's `shortcut` by default. */\nconst MenuItemShortcut = forwardRef<HTMLElement, MenuItemShortcutProps>(\n  ({ classNames, children, ...props }, forwardedRef) => {\n    const { data } = useItem('ItemShortcut');\n    return (\n      <kbd\n        aria-hidden\n        {...props}\n        data-scope='menu'\n        data-part='item-shortcut'\n        className={mx(recipes.menuShortcut(), classNames)}\n        ref={forwardedRef}\n      >\n        {children ?? data.shortcut}\n      </kbd>\n    );\n  },\n);\n\nMenuItemShortcut.displayName = 'Menu.ItemShortcut';\n\n//\n// ItemIndicator\n//\n\ntype MenuItemIndicatorProps = ThemedClassName<MenuPrimitive.ItemIndicatorProps>;\n\n/**\n * The trailing cell of a checkbox or radio item: icon-sized whether or not the item is checked, so rows keep one shape,\n * and showing a check by default while it is.\n */\nconst MenuItemIndicator = forwardRef<HTMLDivElement, MenuItemIndicatorProps>(\n  ({ classNames, children, ...props }, forwardedRef) => (\n    <MenuPrimitive.ItemIndicator\n      aria-hidden\n      // Kept in the layout while unchecked (styled by `data-state`), since preflight's `[hidden]` rule is `!important`.\n      hidden={false}\n      {...props}\n      className={mx(recipes.menuIndicator(), classNames)}\n      ref={forwardedRef}\n    >\n      {children ?? <Icon.Icon icon='ph--check--regular' />}\n    </MenuPrimitive.ItemIndicator>\n  ),\n);\n\nMenuItemIndicator.displayName = 'Menu.ItemIndicator';\n\n//\n// CheckboxItem\n//\n\ntype MenuCheckboxItemProps = ThemedClassName<Omit<MenuPrimitive.CheckboxItemProps, 'value' | 'children'>> & {\n  item: MenuOption;\n  /** Replaces the whole row, composed from `ItemIndicator`, `ItemText` and `ItemShortcut`. */\n  children?: ReactNode;\n};\n\n/** A `menuitemcheckbox` row: without children, the icon, the label, the shortcut and a trailing check; selecting it toggles `checked`. */\nconst MenuCheckboxItem = forwardRef<HTMLDivElement, MenuCheckboxItemProps>(\n  ({ classNames, item, disabled, children, ...props }, forwardedRef) => {\n    assertItem('CheckboxItem', item);\n    return (\n      <ItemContext.Provider value={{ data: item, trigger: false }}>\n        <MenuPrimitive.CheckboxItem\n          {...props}\n          value={item.value}\n          disabled={disabled ?? item.disabled}\n          className={mx(recipes.menuItem(), classNames)}\n          ref={forwardedRef}\n        >\n          {children ?? (\n            <>\n              {item.icon && <MenuItemIcon />}\n              <MenuItemText />\n              {item.shortcut && <MenuItemShortcut />}\n              <MenuItemIndicator />\n            </>\n          )}\n        </MenuPrimitive.CheckboxItem>\n      </ItemContext.Provider>\n    );\n  },\n);\n\nMenuCheckboxItem.displayName = 'Menu.CheckboxItem';\n\n//\n// RadioItemGroup\n//\n\ntype MenuRadioItemGroupProps = ThemedClassName<MenuPrimitive.RadioItemGroupProps>;\n\n/** A group of radio items holding one `value`; name it with an `ItemGroupLabel` inside. */\nconst MenuRadioItemGroup = forwardRef<HTMLDivElement, MenuRadioItemGroupProps>(\n  ({ classNames, ...props }, forwardedRef) => (\n    <MenuPrimitive.RadioItemGroup {...props} className={mx(classNames)} ref={forwardedRef} />\n  ),\n);\n\nMenuRadioItemGroup.displayName = 'Menu.RadioItemGroup';\n\n//\n// RadioItem\n//\n\ntype MenuRadioItemProps = ThemedClassName<Omit<MenuPrimitive.RadioItemProps, 'value' | 'children'>> & {\n  item: MenuOption;\n  /** Replaces the whole row, composed from `ItemIndicator` and `ItemText`. */\n  children?: ReactNode;\n};\n\n/** A `menuitemradio` row: without children, the icon, the label and a trailing check while it holds its group's value. */\nconst MenuRadioItem = forwardRef<HTMLDivElement, MenuRadioItemProps>(\n  ({ classNames, item, disabled, children, ...props }, forwardedRef) => {\n    assertItem('RadioItem', item);\n    return (\n      <ItemContext.Provider value={{ data: item, trigger: false }}>\n        <MenuPrimitive.RadioItem\n          {...props}\n          value={item.value}\n          disabled={disabled ?? item.disabled}\n          className={mx(recipes.menuItem(), classNames)}\n          ref={forwardedRef}\n        >\n          {children ?? (\n            <>\n              {item.icon && <MenuItemIcon />}\n              <MenuItemText />\n              <MenuItemIndicator />\n            </>\n          )}\n        </MenuPrimitive.RadioItem>\n      </ItemContext.Provider>\n    );\n  },\n);\n\nMenuRadioItem.displayName = 'Menu.RadioItem';\n\n//\n// Sub\n//\n\ntype MenuSubProps = MenuRootProps;\n\n/**\n * A nested menu: a Root inside a parent's Content, opened by its `TriggerItem` and placed beside it. Ark reports a\n * nested item only to its own menu, so without an `onSelect` of its own a Sub forwards selections to its parent's.\n */\nconst MenuSub = ({ positioning, onSelect, ...props }: MenuSubProps) => {\n  const parent = useContext(MenuContext);\n  return (\n    <MenuRootBase\n      {...props}\n      sub\n      onSelect={onSelect ?? parent.onSelect}\n      positioning={{ placement: 'right-start', gutter: 0, getAnchorRect: parentEdgeRect, ...positioning }}\n    />\n  );\n};\n\n/**\n * The trigger item's rect stretched to its menu's end edge (plus {@link SUBMENU_OFFSET}, since zag forces a submenu's\n * gutter to 0), so a submenu opens beside the menu rather than over the thumb strip an overflowing menu reserves.\n */\nconst parentEdgeRect = (element: unknown) => {\n  // A virtual anchor has no menu to measure, so zag falls back to its own rect.\n  if (!(element instanceof HTMLElement)) {\n    return null;\n  }\n  const item = element.getBoundingClientRect();\n  const frame = element.closest('.dx-popup')?.getBoundingClientRect();\n  return { x: item.x, y: item.y, width: (frame?.right ?? item.right) + SUBMENU_OFFSET - item.x, height: item.height };\n};\n\nMenuSub.displayName = 'Menu.Sub';\n\n//\n// TriggerItem\n//\n\ntype MenuTriggerItemProps = ThemedClassName<Omit<MenuPrimitive.TriggerItemProps, 'children'>> & {\n  item: MenuItemData;\n  /** Neither highlights nor opens its submenu. */\n  disabled?: boolean;\n  /** Replaces the whole row, composed from `ItemIcon`, `ItemText` and a trailing caret. */\n  children?: ReactNode;\n};\n\n/** An item row that opens its `Menu.Sub` (hover, ArrowRight or Enter): without children, icon, label and a caret. */\nconst MenuTriggerItem = forwardRef<HTMLDivElement, MenuTriggerItemProps>(\n  ({ classNames, item, disabled, children, onSelect, ...props }, forwardedRef) => {\n    const value = useId();\n    assertItem('TriggerItem', item);\n    const row = children ?? (\n      <>\n        {item.icon && <MenuItemIcon />}\n        <MenuItemText />\n        <Icon.Icon icon='ph--caret-right--regular' />\n      </>\n    );\n\n    // Ark's trigger item takes no `disabled`, so a disabled one is an inert item row and its submenu never opens.\n    if (disabled) {\n      return (\n        <ItemContext.Provider value={{ data: item, trigger: false }}>\n          <MenuPrimitive.Item\n            {...props}\n            value={value}\n            disabled\n            className={mx(recipes.menuItem(), classNames)}\n            ref={forwardedRef}\n          >\n            {row}\n          </MenuPrimitive.Item>\n        </ItemContext.Provider>\n      );\n    }\n\n    return (\n      <ItemContext.Provider value={{ data: item, trigger: true }}>\n        <MenuPrimitive.TriggerItem\n          {...props}\n          onSelect={onSelect}\n          className={mx(recipes.menuItem(), classNames)}\n          ref={forwardedRef}\n        >\n          {row}\n        </MenuPrimitive.TriggerItem>\n      </ItemContext.Provider>\n    );\n  },\n);\n\nMenuTriggerItem.displayName = 'Menu.TriggerItem';\n\n//\n// Separator\n//\n\ntype MenuSeparatorProps = ThemedClassName<MenuPrimitive.SeparatorProps>;\n\n/** Ark's separator (`role=separator`) with `Separator`'s horizontal rule. */\nconst MenuSeparator = forwardRef<HTMLHRElement, MenuSeparatorProps>(({ classNames, ...props }, forwardedRef) => (\n  <MenuPrimitive.Separator\n    {...props}\n    data-orientation='horizontal'\n    className={mx(recipes.separator(), classNames)}\n    ref={forwardedRef}\n  />\n));\n\nMenuSeparator.displayName = 'Menu.Separator';\n\n//\n// ItemGroup\n//\n\ntype MenuItemGroupProps = ThemedClassName<MenuPrimitive.ItemGroupProps>;\n\nconst MenuItemGroup = forwardRef<HTMLDivElement, MenuItemGroupProps>(({ classNames, ...props }, forwardedRef) => (\n  <MenuPrimitive.ItemGroup {...props} className={mx(classNames)} ref={forwardedRef} />\n));\n\nMenuItemGroup.displayName = 'Menu.ItemGroup';\n\n//\n// ItemGroupLabel\n//\n\ntype MenuItemGroupLabelProps = ThemedClassName<MenuPrimitive.ItemGroupLabelProps>;\n\n/** A small caption naming the group that follows. */\nconst MenuItemGroupLabel = forwardRef<HTMLDivElement, MenuItemGroupLabelProps>(\n  ({ classNames, ...props }, forwardedRef) => (\n    <MenuPrimitive.ItemGroupLabel {...props} className={mx(recipes.popupGroupLabel(), classNames)} ref={forwardedRef} />\n  ),\n);\n\nMenuItemGroupLabel.displayName = 'Menu.ItemGroupLabel';\nexport type {\n  MenuCheckboxItemProps as CheckboxItemProps,\n  MenuContentProps as ContentProps,\n  MenuContextTriggerProps as ContextTriggerProps,\n  MenuItemGroupLabelProps as ItemGroupLabelProps,\n  MenuItemGroupProps as ItemGroupProps,\n  MenuItemIconProps as ItemIconProps,\n  MenuItemIndicatorProps as ItemIndicatorProps,\n  MenuItemProps as ItemProps,\n  MenuItemShortcutProps as ItemShortcutProps,\n  MenuItemTextProps as ItemTextProps,\n  MenuRadioItemGroupProps as RadioItemGroupProps,\n  MenuRadioItemProps as RadioItemProps,\n  MenuRootProps as RootProps,\n  MenuSeparatorProps as SeparatorProps,\n  MenuSubProps as SubProps,\n  MenuTriggerItemProps as TriggerItemProps,\n  MenuTriggerProps as TriggerProps,\n};\n\nexport {\n  MenuCheckboxItem as CheckboxItem,\n  MenuContent as Content,\n  MenuContextTrigger as ContextTrigger,\n  MenuItem as Item,\n  MenuItemGroup as ItemGroup,\n  MenuItemGroupLabel as ItemGroupLabel,\n  MenuItemIcon as ItemIcon,\n  MenuItemIndicator as ItemIndicator,\n  MenuItemShortcut as ItemShortcut,\n  MenuItemText as ItemText,\n  MenuRadioItem as RadioItem,\n  MenuRadioItemGroup as RadioItemGroup,\n  MenuRoot as Root,\n  MenuSeparator as Separator,\n  MenuSub as Sub,\n  MenuTrigger as Trigger,\n  MenuTriggerItem as TriggerItem,\n};\nexport type { MenuItemData as ItemData, MenuOption as Option };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,eAAe;;AAGrB,IAAM,iBAAiB;AAoBvB,IAAM,cAAc,cAAgC;CAAE,KAAK;CAAO,WAAW;AAAM,CAAC;AAEpF,IAAM,gBAAgB,EACpB,YAAY,MACZ,gBAAgB,MAChB,aACA,UACA,KACA,GAAG,YACmC;CACtC,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAChD,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;GAAE;GAAU;GAAK;GAAW;EAAa;EACpE,UAAA,oBAACA,KAAc,MAAf;GACE,GAAI;GACM;GACC;GACI;GAEf,aAAa,iBAAiB,cAAc,WAAW;EACxD,CAAA;CACmB,CAAA;AAE1B;;;;;AAMA,IAAM,YAAY,UAAyB,oBAAC,cAAD;CAAc,GAAI;CAAO,KAAK;AAAQ,CAAA;AAEjF,SAAS,cAAc;;AASvB,IAAM,cAAc,YACjB,EAAE,eAAe,WAAW,GAAG,SAAS,iBAAiB;CACxD,MAAM,EAAE,iBAAiB,WAAW,WAAW;CAC/C,OACE,oBAACA,KAAc,SAAf;EACE,GAAI;EACJ,gBAAgB,UAAU;GACxB,eAAe,KAAK;GACpB,gBAAgB,KAAK;EACvB;EACA,YAAY,UAAU;GACpB,eAAe,KAAK;GACpB,YAAY,KAAK;EACnB;EACA,KAAK;CACN,CAAA;AAEL,CACF;AAEA,YAAY,cAAc;;AAS1B,IA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