{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/Menu/utils.tsx"],"sourcesContent":["import type { ItemType as AntdItemType } from 'antd/es/menu/interface';\nimport { isValidElement } from 'react';\n\nimport Icon from '@/Icon';\n\nimport type { ItemType } from './type';\n\nexport const mapItems = (item: ItemType): AntdItemType => {\n  switch (item?.type) {\n    case 'divider': {\n      return item;\n    }\n    case 'group': {\n      const { children, ...rest } = item;\n      return {\n        children: children ? children?.map((i) => mapItems(i)) : undefined,\n        ...rest,\n      };\n    }\n    default: {\n      const { children, icon, ...rest } = item as any;\n      return {\n        children: children ? children?.map((i: any) => mapItems(i)) : undefined,\n        icon: icon ? isValidElement(icon) ? icon : <Icon icon={icon} size={'small'} /> : undefined,\n        ...rest,\n      };\n    }\n  }\n};\n"],"mappings":";;;;AAOA,MAAa,YAAY,SAAiC;AACxD,SAAQ,MAAM,MAAd;EACE,KAAK,UACH,QAAO;EAET,KAAK,SAAS;GACZ,MAAM,EAAE,UAAU,GAAG,SAAS;AAC9B,UAAO;IACL,UAAU,WAAW,UAAU,KAAK,MAAM,SAAS,EAAE,CAAC,GAAG,KAAA;IACzD,GAAG;IACJ;;EAEH,SAAS;GACP,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS;AACpC,UAAO;IACL,UAAU,WAAW,UAAU,KAAK,MAAW,SAAS,EAAE,CAAC,GAAG,KAAA;IAC9D,MAAM,OAAO,eAAe,KAAK,GAAG,OAAO,oBAAC,MAAD;KAAY;KAAM,MAAM;KAAW,CAAA,GAAG,KAAA;IACjF,GAAG;IACJ"}