{"version":3,"file":"get-pie-chart-data.cjs","names":["getThemeColor"],"sources":["../../../src/utils/get-pie-chart-data/get-pie-chart-data.ts"],"sourcesContent":["import { getThemeColor, MantineColor, MantineTheme } from '@mantine/core';\n\ninterface PieChartDataItem {\n  color: MantineColor;\n  [key: string]: any;\n}\n\ninterface GetPieChartDataInput<T extends PieChartDataItem> {\n  data: T[];\n  theme: MantineTheme;\n  strokeWidth: number | undefined;\n  highlightedIndex: number | null;\n  cellProps:\n    | ((item: T) => Partial<Omit<React.SVGProps<SVGElement>, 'ref'>>)\n    | Partial<Omit<React.SVGProps<SVGElement>, 'ref'>>\n    | undefined;\n}\n\nexport function getPieChartData<T extends PieChartDataItem>({\n  data,\n  theme,\n  strokeWidth,\n  highlightedIndex,\n  cellProps,\n}: GetPieChartDataInput<T>) {\n  return data.map((item, index) => ({\n    ...item,\n    __segmentIndex: index,\n    fill: getThemeColor(item.color, theme),\n    stroke: 'var(--chart-stroke-color, var(--mantine-color-body))',\n    strokeWidth,\n    ...(typeof cellProps === 'function' ? cellProps(item) : cellProps),\n    ...(highlightedIndex !== null ? { fillOpacity: highlightedIndex === index ? 1 : 0.2 } : null),\n  }));\n}\n"],"mappings":";;;AAkBA,SAAgB,gBAA4C,EAC1D,MACA,OACA,aACA,kBACA,aAC0B;CAC1B,OAAO,KAAK,KAAK,MAAM,WAAW;EAChC,GAAG;EACH,gBAAgB;EAChB,OAAA,GAAMA,cAAAA,cAAAA,CAAc,KAAK,OAAO,KAAK;EACrC,QAAQ;EACR;EACA,GAAI,OAAO,cAAc,aAAa,UAAU,IAAI,IAAI;EACxD,GAAI,qBAAqB,OAAO,EAAE,aAAa,qBAAqB,QAAQ,IAAI,GAAI,IAAI;CAC1F,EAAE;AACJ"}