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C;YAClC,iCAAiC;QACnC;OACC;WAAI,CAAA,GAAA,oBAAY,EAAE,MAAM,MAAM,UAAU;KAAE,CAAC,GAAG,CAAC,CAAA;QAC9C,IAAI,qBAAO,gCAAC,CAAA,GAAA,yCAAO;YAAE,KAAK,KAAK,GAAG;YAAE,MAAM;YAAM,OAAO;;QAEvD,IAAI,KAAK,OAAO,EACd,OAAO,KAAK,OAAO,CAAC;QAGtB,OAAO;IACT;AAKV","sources":["packages/@adobe/react-spectrum/src/menu/MenuSection.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '../utils/classNames';\nimport {getChildNodes} from 'react-stately/private/collections/getChildNodes';\nimport {MenuItem} from './MenuItem';\nimport {Node} from '@react-types/shared';\nimport React, {Fragment, JSX} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {TreeState} from 'react-stately/useTreeState';\nimport {useMenuSection} from 'react-aria/useMenu';\nimport {useSeparator} from 'react-aria/useSeparator';\n\ninterface MenuSectionProps<T> {\n  item: Node<T>;\n  state: TreeState<T>;\n}\n\n/** @private */\nexport function MenuSection<T>(props: MenuSectionProps<T>): JSX.Element {\n  let {item, state} = props;\n  let {itemProps, headingProps, groupProps} = useMenuSection({\n    heading: item.rendered,\n    'aria-label': item['aria-label']\n  });\n\n  let {separatorProps} = useSeparator({\n    elementType: 'div'\n  });\n\n  let firstSectionKey = state.collection.getFirstKey();\n  let lastSectionKey = [...state.collection].filter(node => node.type === 'section').at(-1)?.key;\n  let sectionIsFirst =\n    firstSectionKey === item.key && state.collection.getFirstKey() === firstSectionKey;\n  let lastKey = state.collection.getLastKey();\n  let sectionIsLast =\n    lastSectionKey === item.key &&\n    lastKey != null &&\n    state.collection.getItem(lastKey)!.parentKey === lastSectionKey;\n\n  return (\n    <Fragment>\n      {item.key !== state.collection.getFirstKey() && (\n        <div {...separatorProps} className={classNames(styles, 'spectrum-Menu-divider')} />\n      )}\n      <div {...itemProps}>\n        {item.rendered && (\n          <span {...headingProps} className={classNames(styles, 'spectrum-Menu-sectionHeading')}>\n            {item.rendered}\n          </span>\n        )}\n        <div\n          {...groupProps}\n          className={classNames(styles, 'spectrum-Menu', {\n            'spectrum-Menu-section--noHeading': item.rendered == null,\n            'spectrum-Menu-section--isFirst': sectionIsFirst,\n            'spectrum-Menu-section--isLast': sectionIsLast\n          })}>\n          {[...getChildNodes(item, state.collection)].map(node => {\n            let item = <MenuItem key={node.key} item={node} state={state} />;\n\n            if (node.wrapper) {\n              item = node.wrapper(item);\n            }\n\n            return item;\n          })}\n        </div>\n      </div>\n    </Fragment>\n  );\n}\n"],"names":[],"version":3,"file":"MenuSection.mjs.map"}