{"version":3,"file":"Menu.mjs","sources":["../../../../../../../../node_modules/@mui/material/Menu/Menu.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { isFragment } from 'react-is';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport HTMLElementType from '@mui/utils/HTMLElementType';\nimport { useRtl } from '@mui/system/RtlProvider';\nimport useSlotProps from '@mui/utils/useSlotProps';\nimport MenuList from \"../MenuList/index.js\";\nimport Popover, { PopoverPaper } from \"../Popover/index.js\";\nimport rootShouldForwardProp from \"../styles/rootShouldForwardProp.js\";\nimport { styled } from \"../zero-styled/index.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { getMenuUtilityClass } from \"./menuClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst RTL_ORIGIN = {\n  vertical: 'top',\n  horizontal: 'right'\n};\nconst LTR_ORIGIN = {\n  vertical: 'top',\n  horizontal: 'left'\n};\nconst useUtilityClasses = ownerState => {\n  const {\n    classes\n  } = ownerState;\n  const slots = {\n    root: ['root'],\n    paper: ['paper'],\n    list: ['list']\n  };\n  return composeClasses(slots, getMenuUtilityClass, classes);\n};\nconst MenuRoot = styled(Popover, {\n  shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',\n  name: 'MuiMenu',\n  slot: 'Root',\n  overridesResolver: (props, styles) => styles.root\n})({});\nexport const MenuPaper = styled(PopoverPaper, {\n  name: 'MuiMenu',\n  slot: 'Paper',\n  overridesResolver: (props, styles) => styles.paper\n})({\n  // specZ: The maximum height of a simple menu should be one or more rows less than the view\n  // height. This ensures a tappable area outside of the simple menu with which to dismiss\n  // the menu.\n  maxHeight: 'calc(100% - 96px)',\n  // Add iOS momentum scrolling for iOS < 13.0\n  WebkitOverflowScrolling: 'touch'\n});\nconst MenuMenuList = styled(MenuList, {\n  name: 'MuiMenu',\n  slot: 'List',\n  overridesResolver: (props, styles) => styles.list\n})({\n  // We disable the focus ring for mouse, touch and keyboard users.\n  outline: 0\n});\nconst Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {\n  const props = useDefaultProps({\n    props: inProps,\n    name: 'MuiMenu'\n  });\n  const {\n    autoFocus = true,\n    children,\n    className,\n    disableAutoFocusItem = false,\n    MenuListProps = {},\n    onClose,\n    open,\n    PaperProps = {},\n    PopoverClasses,\n    transitionDuration = 'auto',\n    TransitionProps: {\n      onEntering,\n      ...TransitionProps\n    } = {},\n    variant = 'selectedMenu',\n    slots = {},\n    slotProps = {},\n    ...other\n  } = props;\n  const isRtl = useRtl();\n  const ownerState = {\n    ...props,\n    autoFocus,\n    disableAutoFocusItem,\n    MenuListProps,\n    onEntering,\n    PaperProps,\n    transitionDuration,\n    TransitionProps,\n    variant\n  };\n  const classes = useUtilityClasses(ownerState);\n  const autoFocusItem = autoFocus && !disableAutoFocusItem && open;\n  const menuListActionsRef = React.useRef(null);\n  const handleEntering = (element, isAppearing) => {\n    if (menuListActionsRef.current) {\n      menuListActionsRef.current.adjustStyleForScrollbar(element, {\n        direction: isRtl ? 'rtl' : 'ltr'\n      });\n    }\n    if (onEntering) {\n      onEntering(element, isAppearing);\n    }\n  };\n  const handleListKeyDown = event => {\n    if (event.key === 'Tab') {\n      event.preventDefault();\n      if (onClose) {\n        onClose(event, 'tabKeyDown');\n      }\n    }\n  };\n\n  /**\n   * the index of the item should receive focus\n   * in a `variant=\"selectedMenu\"` it's the first `selected` item\n   * otherwise it's the very first item.\n   */\n  let activeItemIndex = -1;\n  // since we inject focus related props into children we have to do a lookahead\n  // to check if there is a `selected` item. We're looking for the last `selected`\n  // item and use the first valid item as a fallback\n  React.Children.map(children, (child, index) => {\n    if (! /*#__PURE__*/React.isValidElement(child)) {\n      return;\n    }\n    if (process.env.NODE_ENV !== 'production') {\n      if (isFragment(child)) {\n        console.error([\"MUI: The Menu component doesn't accept a Fragment as a child.\", 'Consider providing an array instead.'].join('\\n'));\n      }\n    }\n    if (!child.props.disabled) {\n      if (variant === 'selectedMenu' && child.props.selected) {\n        activeItemIndex = index;\n      } else if (activeItemIndex === -1) {\n        activeItemIndex = index;\n      }\n    }\n  });\n  const PaperSlot = slots.paper ?? MenuPaper;\n  const paperExternalSlotProps = slotProps.paper ?? PaperProps;\n  const rootSlotProps = useSlotProps({\n    elementType: slots.root,\n    externalSlotProps: slotProps.root,\n    ownerState,\n    className: [classes.root, className]\n  });\n  const paperSlotProps = useSlotProps({\n    elementType: PaperSlot,\n    externalSlotProps: paperExternalSlotProps,\n    ownerState,\n    className: classes.paper\n  });\n  return /*#__PURE__*/_jsx(MenuRoot, {\n    onClose: onClose,\n    anchorOrigin: {\n      vertical: 'bottom',\n      horizontal: isRtl ? 'right' : 'left'\n    },\n    transformOrigin: isRtl ? RTL_ORIGIN : LTR_ORIGIN,\n    slots: {\n      paper: PaperSlot,\n      root: slots.root\n    },\n    slotProps: {\n      root: rootSlotProps,\n      paper: paperSlotProps\n    },\n    open: open,\n    ref: ref,\n    transitionDuration: transitionDuration,\n    TransitionProps: {\n      onEntering: handleEntering,\n      ...TransitionProps\n    },\n    ownerState: ownerState,\n    ...other,\n    classes: PopoverClasses,\n    children: /*#__PURE__*/_jsx(MenuMenuList, {\n      onKeyDown: handleListKeyDown,\n      actions: menuListActionsRef,\n      autoFocus: autoFocus && (activeItemIndex === -1 || disableAutoFocusItem),\n      autoFocusItem: autoFocusItem,\n      variant: variant,\n      ...MenuListProps,\n      className: clsx(classes.list, MenuListProps.className),\n      children: children\n    })\n  });\n});\nprocess.env.NODE_ENV !== \"production\" ? Menu.propTypes /* remove-proptypes */ = {\n  // ┌────────────────────────────── Warning ──────────────────────────────┐\n  // │ These PropTypes are generated from the TypeScript type definitions. │\n  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │\n  // └─────────────────────────────────────────────────────────────────────┘\n  /**\n   * An HTML element, or a function that returns one.\n   * It's used to set the position of the menu.\n   */\n  anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),\n  /**\n   * If `true` (Default) will focus the `[role=\"menu\"]` if no focusable child is found. Disabled\n   * children are not focusable. If you set this prop to `false` focus will be placed\n   * on the parent modal container. This has severe accessibility implications\n   * and should only be considered if you manage focus otherwise.\n   * @default true\n   */\n  autoFocus: PropTypes.bool,\n  /**\n   * Menu contents, normally `MenuItem`s.\n   */\n  children: PropTypes.node,\n  /**\n   * Override or extend the styles applied to the component.\n   */\n  classes: PropTypes.object,\n  /**\n   * @ignore\n   */\n  className: PropTypes.string,\n  /**\n   * When opening the menu will not focus the active item but the `[role=\"menu\"]`\n   * unless `autoFocus` is also set to `false`. Not using the default means not\n   * following WAI-ARIA authoring practices. Please be considerate about possible\n   * accessibility implications.\n   * @default false\n   */\n  disableAutoFocusItem: PropTypes.bool,\n  /**\n   * Props applied to the [`MenuList`](https://mui.com/material-ui/api/menu-list/) element.\n   * @default {}\n   */\n  MenuListProps: PropTypes.object,\n  /**\n   * Callback fired when the component requests to be closed.\n   *\n   * @param {object} event The event source of the callback.\n   * @param {string} reason Can be: `\"escapeKeyDown\"`, `\"backdropClick\"`, `\"tabKeyDown\"`.\n   */\n  onClose: PropTypes.func,\n  /**\n   * If `true`, the component is shown.\n   */\n  open: PropTypes.bool.isRequired,\n  /**\n   * @ignore\n   */\n  PaperProps: PropTypes.object,\n  /**\n   * `classes` prop applied to the [`Popover`](https://mui.com/material-ui/api/popover/) element.\n   */\n  PopoverClasses: PropTypes.object,\n  /**\n   * The props used for each slot inside.\n   * @default {}\n   */\n  slotProps: PropTypes.shape({\n    paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n    root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])\n  }),\n  /**\n   * The components used for each slot inside.\n   * @default {}\n   */\n  slots: PropTypes.shape({\n    paper: PropTypes.elementType,\n    root: PropTypes.elementType\n  }),\n  /**\n   * The system prop that allows defining system overrides as well as additional CSS styles.\n   */\n  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n  /**\n   * The length of the transition in `ms`, or 'auto'\n   * @default 'auto'\n   */\n  transitionDuration: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.shape({\n    appear: PropTypes.number,\n    enter: PropTypes.number,\n    exit: PropTypes.number\n  })]),\n  /**\n   * Props applied to the transition element.\n   * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.\n   * @default {}\n   */\n  TransitionProps: PropTypes.object,\n  /**\n   * The variant to use. Use `menu` to prevent selected items from impacting the initial focus.\n   * @default 'selectedMenu'\n   */\n  variant: PropTypes.oneOf(['menu', 'selectedMenu'])\n} : void 0;\nexport default Menu;"],"names":["useUtilityClasses","React.forwardRef","React.useRef","React.Children","React.isValidElement","_jsx"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,UAAU,GAAG;AACnB,EAAE,QAAQ,EAAE,KAAK;AACjB,EAAE,UAAU,EAAE;AACd,CAAC;AACD,MAAM,UAAU,GAAG;AACnB,EAAE,QAAQ,EAAE,KAAK;AACjB,EAAE,UAAU,EAAE;AACd,CAAC;AACD,MAAMA,mBAAiB,GAAG,UAAU,IAAI;AACxC,EAAE,MAAM;AACR,IAAI;AACJ,GAAG,GAAG,UAAU;AAChB,EAAE,MAAM,KAAK,GAAG;AAChB,IAAI,IAAI,EAAE,CAAC,MAAM,CAAC;AAClB,IAAI,KAAK,EAAE,CAAC,OAAO,CAAC;AACpB,IAAI,IAAI,EAAE,CAAC,MAAM;AACjB,GAAG;AACH,EAAE,OAAO,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,CAAC;AAC5D,CAAC;AACD,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE;AACjC,EAAE,iBAAiB,EAAE,IAAI,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS;AAC9E,EAAE,IAAI,EA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