{"version":3,"file":"index.cjs","names":["useTheme","RechartsPrimitive","useTheme","useTheme","useTheme","CartesianGrid","React","Button","ChevronUpIcon","ChevronDownIcon","React","autoUpdate","useTheme","React","IconButton","ChevronLeft","ChevronRight","React","IconButton","ChevronUp","ChevronDown","React","IconButton","X","IconButton","ChevronUp","ChevronDown","React","Separator","Button","React","Tooltip","React","React","getWidthOfData","getWidthOfGroup","findNearestSnapPosition","getSnapPositions","X_AXIS_PADDING","CHART_CONTAINER_BOTTOM_MARGIN","getWidthOfGroup","getWidthOfData","getSnapPositions","findNearestSnapPosition","RechartsAreaChart","YAxis","Area","XAxis","React","CHART_HEIGHT","CHART_CONTAINER_BOTTOM_MARGIN","RechartsAreaChart","YAxis","Area","XAxis","React","getWidthOfData","getPadding","getSnapPositions","BAR_GAP","BAR_CATEGORY_GAP","BAR_INTERNAL_LINE_WIDTH","BAR_RADIUS","CHART_CONTAINER_BOTTOM_MARGIN","getPadding","getWidthOfData","getSnapPositions","RechartsBarChart","YAxis","Bar","useTheme","XAxis","React","BAR_GAP","BAR_CATEGORY_GAP","BAR_INTERNAL_LINE_WIDTH","BAR_RADIUS","CHART_HEIGHT","CHART_CONTAINER_BOTTOM_MARGIN","useTheme","RechartsBarChart","YAxis","Bar","XAxis","React","React","getPadding","X_AXIS_HEIGHT","getPadding","RechartsBarChart","XAxis","Bar","useTheme","YAxis","React","CHART_CONTAINER_BOTTOM_MARGIN","getWidthOfGroup","getWidthOfData","getSnapPositions","findNearestSnapPosition","RechartsLineChart","YAxis","Line","XAxis","RechartsLineChart","YAxis","Line","XAxis","React","MINI_ELEMENT_SPACING","transformDataForChart","getRecentDataThatFits","DATA_KEY","getRecentDataThatFits","transformDataForChart","DATA_KEY","RechartsAreaChart","XAxis","Area","useTheme","BarChart","XAxis","Bar","getRecentDataThatFits","transformDataForChart","DATA_KEY","RechartsLineChart","XAxis","Line","calculatePercentage","STACKED_LEGEND_BREAKPOINT","MIN_CHART_SIZE","MAX_CHART_SIZE","useTheme","Pie","Cell","RechartsPieChart","MIN_CHART_SIZE","MAX_CHART_SIZE","Radar","RechartsRadarChart","PolarGrid","PolarAngleAxis","RadialBarChart","PolarGrid","RadialBar","Cell","RechartsScatterChart","XAxis","Scatter","YAxis","Cell","Separator"],"sources":["../../../src/context/PrintContext.tsx","../../../src/components/Charts/Charts.tsx","../../../src/components/Charts/context/SideBarTooltipContext.tsx","../../../src/components/Charts/hooks/useAutoAngleCalculation.ts","../../../src/components/Charts/hooks/useCanvasContextForLabelSize.ts","../../../src/components/Charts/hooks/useExportChartData.ts","../../../src/components/Charts/hooks/useMaxLabelHeight.tsx","../../../src/components/Charts/hooks/useMaxLabelWidth.ts","../../../src/components/Charts/hooks/useTransformKey.tsx","../../../src/components/Charts/utils/dataUtils.ts","../../../src/components/Charts/utils/PalletUtils.ts","../../../src/components/Charts/utils/styleUtils.ts","../../../src/components/Charts/hooks/useYAxisLabelWidth.tsx","../../../src/components/Charts/shared/ActiveDot/ActiveDot.tsx","../../../src/components/Charts/shared/CartesianGrid/cartesianGrid.tsx","../../../src/components/Charts/shared/DefaultLegend/hooks/useDefaultLegend.ts","../../../src/components/Charts/shared/DefaultLegend/DefaultLegend.tsx","../../../src/components/Charts/shared/LineInBarShape/LineInBarShape.tsx","../../../src/components/Charts/shared/PortalTooltip/FloatingUIPortal.tsx","../../../src/components/Charts/shared/PortalTooltip/utils/index.ts","../../../src/components/Charts/shared/PortalTooltip/CustomTooltipContent.tsx","../../../src/components/Charts/shared/ScrollButtonsHorizontal/ScrollButtonsHorizontal.tsx","../../../src/components/Charts/shared/ScrollButtonsVertical/ScrollButtonsVertical.tsx","../../../src/components/Charts/shared/SideBarTooltip/SideBarTooltip.tsx","../../../src/components/Charts/shared/StackedLegend/StackedLegend.tsx","../../../src/components/Charts/shared/SVGXAxisTick/SVGXAxisTick.tsx","../../../src/components/Charts/shared/LabelTooltip/LabelTooltip.tsx","../../../src/components/Charts/shared/XAxisTick/XAxisTick.tsx","../../../src/components/Charts/shared/YAxisTick/YAxisTick.tsx","../../../src/components/Charts/utils/AreaAndLine/AreaAndLineUtils.ts","../../../src/components/Charts/utils/AreaAndLine/common.ts","../../../src/components/Charts/AreaChart/AreaChart.tsx","../../../src/components/Charts/AreaChartCondensed/AreaChartCondensed.tsx","../../../src/components/Charts/utils/BarCharts/BarChartsUtils.ts","../../../src/components/Charts/BarChart/utils/BarChartUtils.ts","../../../src/components/Charts/BarChart/BarChart.tsx","../../../src/components/Charts/BarChartCondensed/BarChartCondensed.tsx","../../../src/components/Charts/HorizontalBarChart/components/CustomBarShape.tsx","../../../src/components/Charts/HorizontalBarChart/hooks/useMaxCategoryLabelWidth.tsx","../../../src/components/Charts/HorizontalBarChart/utils/HorizontalBarChartUtils.ts","../../../src/components/Charts/HorizontalBarChart/HorizontalBarChart.tsx","../../../src/components/Charts/LineChart/LineChart.tsx","../../../src/components/Charts/LineChartCondensed/LineChartCondensed.tsx","../../../src/components/Charts/utils/AreaAndLine/MiniAreaAndLineUtils.ts","../../../src/components/Charts/MiniAreaChart/MiniAreaChart.tsx","../../../src/components/Charts/MiniBarChart/utils/miniBarChartUtils.ts","../../../src/components/Charts/MiniBarChart/MiniBarChart.tsx","../../../src/components/Charts/MiniLineChart/MiniLineChart.tsx","../../../src/components/Charts/PieChart/utils/PieChartUtils.ts","../../../src/components/Charts/PieChart/PieChart.tsx","../../../src/components/Charts/RadarChart/utils/index.ts","../../../src/components/Charts/RadarChart/components/AxisLabel.tsx","../../../src/components/Charts/RadarChart/RadarChart.tsx","../../../src/components/Charts/RadialChart/utils/RadialChartUtils.ts","../../../src/components/Charts/RadialChart/RadialChart.tsx","../../../src/components/Charts/ScatterChart/components/ScatterDot.tsx","../../../src/components/Charts/ScatterChart/utils/ScatterChartUtils.ts","../../../src/components/Charts/ScatterChart/ScatterChart.tsx","../../../src/components/Charts/SingleStackedBarChart/components/ToolTip.tsx","../../../src/components/Charts/SingleStackedBarChart/SingleStackedBarChart.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\n\ntype PrintContextType = {} | null;\n\nexport const PrintContext = createContext<PrintContextType>(null);\n\nexport const usePrintContext = () => {\n  const context = useContext(PrintContext);\n  return context;\n};\n\nexport const PrintContextProvider = ({ children }: { children: React.ReactNode }) => {\n  const memoizedValue = useMemo(() => ({}), []);\n\n  return <PrintContext.Provider value={memoizedValue}>{children}</PrintContext.Provider>;\n};\n","import clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { ComponentProps, createContext, forwardRef, useContext, useId, useMemo } from \"react\";\nimport * as RechartsPrimitive from \"recharts\";\nimport { useTheme } from \"../ThemeProvider\";\n\n/**\n * @module Charts\n * A collection of chart components built on top of Recharts with enhanced styling and theming capabilities.\n */\n\n/**\n * Available themes for chart customization\n * @constant\n * @type {Record<'light' | 'dark', string>}\n */\nconst THEMES = { light: \"\", dark: \".dark\" } as const;\n\n/**\n * Configuration type for chart elements\n */\nexport type ChartConfig = {\n  [k in string]: {\n    label?: React.ReactNode;\n    icon?: React.ComponentType;\n    transformed?: string;\n  } & (\n    | { color?: string; secondaryColor?: string; theme?: never }\n    | {\n        color?: never;\n        theme: Record<\n          keyof typeof THEMES,\n          | string\n          | {\n              color: string;\n              secondaryColor?: string;\n            }\n        >;\n      }\n  );\n};\n\n/**\n * Data structure for chart export (e.g., to PPTX)\n */\nexport type ExportChartData = {\n  type: \"line\" | \"bar\" | \"area\" | \"pie\" | \"radar\" | \"scatter\";\n  data: {\n    name: string;\n    labels?: string[];\n    values?: number[];\n    x?: number[];\n    y?: number[];\n  }[];\n  options?: {\n    chartColors?: string[];\n    showLegend?: boolean;\n    legendPos?: \"b\" | \"t\" | \"l\" | \"r\";\n    title?: string;\n    showTitle?: boolean;\n    catAxisTitle?: string;\n    showCatAxisTitle?: boolean;\n    valAxisTitle?: string;\n    showValAxisTitle?: boolean;\n    lineSize?: number;\n    barDir?: \"bar\" | \"col\";\n    barGrouping?: \"stacked\" | \"clustered\" | \"percent\" | \"standard\";\n  };\n};\n\n/**\n * Context props for chart configuration\n */\ntype ChartContextProps = {\n  config: ChartConfig;\n  id: string;\n};\n\nconst ChartContext = createContext<ChartContextProps | null>(null);\n\n/**\n * Hook to access chart context\n * @throws Error if used outside of ChartContainer\n */\nfunction useChart() {\n  const context = useContext(ChartContext);\n\n  if (!context) {\n    throw new Error(\"useChart must be used within a <ChartContainer />\");\n  }\n\n  return context;\n}\n\n/**\n * Component that generates theme-specific styles for chart elements\n */\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n  const colorConfig = Object.entries(config).filter(([_, config]) => config.theme || config.color);\n\n  if (!colorConfig.length) {\n    return null;\n  }\n\n  return (\n    <style\n      dangerouslySetInnerHTML={{\n        __html: Object.entries(THEMES)\n          .map(\n            ([theme, prefix]) => `\n    ${prefix} [data-chart=${id}] {\n    ${colorConfig\n      .map(([_, itemConfig]) => {\n        const transformedKey = itemConfig.transformed;\n        const themeValue = itemConfig.theme?.[theme as keyof typeof itemConfig.theme];\n        const color =\n          typeof themeValue === \"string\" ? themeValue : themeValue?.color || itemConfig.color;\n        const secondaryColor =\n          typeof themeValue === \"object\"\n            ? themeValue?.secondaryColor\n            : \"secondaryColor\" in itemConfig\n              ? itemConfig.secondaryColor\n              : undefined;\n\n        return [\n          color ? `  --color-${transformedKey}: ${color};` : null,\n          secondaryColor ? `  --color-${transformedKey}-secondary: ${secondaryColor};` : null,\n        ]\n          .filter(Boolean)\n          .join(\"\\n\");\n      })\n      .filter(Boolean)\n      .join(\"\\n\")}\n    }\n    `,\n          )\n          .join(\"\\n\"),\n      }}\n    />\n  );\n};\n\n/**\n * Container component for charts that provides configuration context and styling\n */\nconst ChartContainer = forwardRef<\n  HTMLDivElement,\n  ComponentProps<\"div\"> & {\n    config: ChartConfig;\n    children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>[\"children\"];\n    rechartsProps?: Omit<\n      React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>,\n      \"children\"\n    >;\n  }\n>(({ id, className, children, config, rechartsProps, style, ...props }, ref) => {\n  const uniqueId = useId();\n  const chartId = `openui-chart-${id || uniqueId.replace(/:/g, \"\")}`;\n  const { theme } = useTheme();\n\n  return (\n    <ChartContext.Provider value={{ config, id: chartId }}>\n      <div\n        data-chart={chartId}\n        ref={ref}\n        className={clsx(\"openui-chart-container\", className)}\n        style={\n          {\n            //TODO: remove this once we have a proper theme for charts\n            \"--openui-foreground\": theme.foreground,\n            \"--openui-text-neutral-primary\": theme.textNeutralPrimary,\n            width: \"100%\",\n            height: \"100%\",\n            ...style,\n          } as React.CSSProperties\n        }\n        {...props}\n      >\n        <ChartStyle id={chartId} config={config} />\n        <RechartsPrimitive.ResponsiveContainer\n          width={rechartsProps?.width ?? \"100%\"}\n          height={rechartsProps?.height ?? \"100%\"}\n          minWidth={rechartsProps?.minWidth ?? 1}\n          minHeight={rechartsProps?.minHeight ?? 1}\n          initialDimension={rechartsProps?.initialDimension ?? { width: 1, height: 1 }}\n          id={rechartsProps?.id ?? chartId}\n          {...rechartsProps}\n        >\n          {children}\n        </RechartsPrimitive.ResponsiveContainer>\n      </div>\n    </ChartContext.Provider>\n  );\n});\nChartContainer.displayName = \"Chart\";\n\n/**\n * Re-exported Tooltip component from Recharts\n */\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\n/**\n * Custom tooltip content component with enhanced styling and formatting\n */\ntype ChartTooltipContentProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n  React.ComponentProps<\"div\"> & {\n    hideLabel?: boolean;\n    hideIndicator?: boolean;\n    indicator?: \"line\" | \"dot\" | \"dashed\";\n    nameKey?: string;\n    labelKey?: string;\n    showPercentage?: boolean;\n  };\n\nfunction ChartTooltipContentRender(\n  {\n    active,\n    payload,\n    className,\n    indicator = \"dot\",\n    hideLabel = false,\n    hideIndicator = false,\n    label,\n    labelFormatter,\n    labelClassName,\n    formatter,\n    color,\n    nameKey,\n    labelKey,\n    showPercentage = false,\n  }: ChartTooltipContentProps,\n  ref: React.ForwardedRef<HTMLDivElement>,\n) {\n  const { config } = useChart();\n\n  const tooltipLabel = useMemo(() => {\n    if (hideLabel || !payload?.length) {\n      return null;\n    }\n\n    const [item] = payload;\n    const key = `${labelKey ?? item?.dataKey ?? item?.name ?? \"value\"}`;\n    const itemConfig = getPayloadConfigFromPayload(config, item, key);\n    const value =\n      !labelKey && typeof label === \"string\" ? config[label]?.label || label : itemConfig?.label;\n\n    if (labelFormatter) {\n      return (\n        <div className={clsx(\"openui-chart-tooltip-label-heavy\", labelClassName)}>\n          {labelFormatter(value, payload)}\n        </div>\n      );\n    }\n\n    if (!value) {\n      return null;\n    }\n\n    return <div className={clsx(\"openui-chart-tooltip-label\", labelClassName)}>{value}</div>;\n  }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n  if (!active || !payload?.length) {\n    return null;\n  }\n\n  const nestLabel = payload.length === 1 && indicator !== \"dot\";\n\n  return (\n    <div ref={ref} className={clsx(\"openui-chart-tooltip\", className)}>\n      {!nestLabel && tooltipLabel}\n      <div className=\"openui-chart-tooltip-content\">\n        {payload.map((item, index) => {\n          const key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`;\n          const itemConfig = getPayloadConfigFromPayload(config, item, key);\n          const indicatorColor = (color ?? item.payload.fill) || item.color;\n\n          return (\n            <div\n              key={item.dataKey}\n              className={clsx(\n                \"openui-chart-tooltip-content-item\",\n                indicator === \"dot\" && \"openui-chart-tooltip-content-item--dot\",\n              )}\n            >\n              {formatter && item?.value !== undefined && item.name ? (\n                formatter(item.value, item.name, item, index, item.payload)\n              ) : (\n                <>\n                  {itemConfig?.icon ? (\n                    <itemConfig.icon />\n                  ) : (\n                    !hideIndicator && (\n                      <div\n                        className={clsx(\n                          \"openui-chart-tooltip-content-indicator\",\n                          `openui-chart-tooltip-content-indicator--${indicator}`,\n                        )}\n                        style={\n                          {\n                            \"--color-bg\": indicatorColor,\n                            \"--color-border\": indicatorColor,\n                          } as React.CSSProperties\n                        }\n                      />\n                    )\n                  )}\n                  <div\n                    className={clsx(\n                      \"openui-chart-tooltip-content-value-wrapper\",\n                      nestLabel\n                        ? \"openui-chart-tooltip-content-value-wrapper--nested\"\n                        : \"openui-chart-tooltip-content-value-wrapper--standard\",\n                    )}\n                  >\n                    <div className=\"openui-chart-tooltip-content-label\">\n                      {nestLabel && tooltipLabel}\n                      <span>{itemConfig?.label || item.name}</span>\n                    </div>\n                    {item.value !== undefined && (\n                      <span\n                        className={clsx(\n                          \"openui-chart-tooltip-content-value\",\n                          showPercentage && \"percentage\",\n                        )}\n                      >\n                        {item.value.toLocaleString()}\n                        {showPercentage ? \"%\" : \"\"}\n                      </span>\n                    )}\n                  </div>\n                </>\n              )}\n            </div>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n\nconst ChartTooltipContent = forwardRef(ChartTooltipContentRender);\nChartTooltipContent.displayName = \"ChartTooltip\";\n\n// this is not used any more, in the new chart, we are using the default legend which is rendered outside the charts container,\n// older charts are still using this legend.\n\n/**\n * Re-exported Legend component from Recharts\n */\nconst ChartLegend = RechartsPrimitive.Legend;\n\n/**\n * Custom legend content component with enhanced styling\n */\nconst ChartLegendContent = forwardRef<\n  HTMLDivElement,\n  React.ComponentProps<\"div\"> &\n    Pick<RechartsPrimitive.LegendProps, \"payload\" | \"verticalAlign\"> & {\n      hideIcon?: boolean;\n      nameKey?: string;\n    }\n>(({ className, hideIcon = false, payload, verticalAlign = \"bottom\", nameKey }, ref) => {\n  const { config } = useChart();\n\n  const payloadWithKeys = useMemo(\n    () =>\n      payload?.map((item) => ({\n        ...item,\n        uniqueKey: uniqueId(`chart-legend-${item.dataKey || item.value || \"\"}-`),\n      })),\n    [payload],\n  );\n\n  if (!payload?.length) {\n    return null;\n  }\n\n  return (\n    <div\n      ref={ref}\n      className={clsx(\"openui-chart-legend\", `openui-chart-legend--${verticalAlign}`, className)}\n    >\n      {payloadWithKeys?.map((item) => {\n        const key = `${nameKey || item.dataKey || \"value\"}`;\n        const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n        return (\n          <div key={item.uniqueKey} className=\"openui-chart-legend-item\">\n            {itemConfig?.icon && !hideIcon ? (\n              <itemConfig.icon />\n            ) : (\n              <div\n                className=\"openui-chart-legend-item-indicator\"\n                style={{ backgroundColor: item.color }}\n              />\n            )}\n            <span className=\"openui-chart-legend-item-label\">{itemConfig?.label}</span>\n          </div>\n        );\n      })}\n    </div>\n  );\n});\nChartLegendContent.displayName = \"ChartLegend\";\n\n/**\n * Helper function to extract configuration for a chart element from a payload\n */\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n  if (typeof payload !== \"object\" || payload === null) {\n    return undefined;\n  }\n\n  const payloadPayload =\n    \"payload\" in payload && typeof payload.payload === \"object\" && payload.payload !== null\n      ? payload.payload\n      : undefined;\n\n  let configLabelKey: string = key;\n\n  if (key in payload && typeof payload[key as keyof typeof payload] === \"string\") {\n    configLabelKey = payload[key as keyof typeof payload] as string;\n  } else if (\n    payloadPayload &&\n    key in payloadPayload &&\n    typeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n  ) {\n    configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;\n  }\n\n  return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n\nexport {\n  ChartContainer,\n  ChartLegend,\n  ChartLegendContent,\n  ChartStyle,\n  ChartTooltip,\n  ChartTooltipContent,\n  getPayloadConfigFromPayload,\n  useChart,\n};\n","import React, { createContext, ReactNode, useContext } from \"react\";\n\nexport interface SideBarChartData {\n  title: string;\n  values: {\n    value: number;\n    label: string;\n    color: string;\n  }[];\n}\n\ninterface SideBarTooltipContextType {\n  data: SideBarChartData | undefined;\n  isSideBarTooltipOpen: boolean;\n  setData: (data: SideBarChartData) => void;\n  setIsSideBarTooltipOpen: (isOpen: boolean) => void;\n}\n\nconst SideBarTooltipContext = createContext<SideBarTooltipContextType | undefined>(undefined);\n\ninterface SideBarTooltipProviderProps {\n  children: ReactNode;\n  isSideBarTooltipOpen: boolean;\n  setIsSideBarTooltipOpen: (isOpen: boolean) => void;\n  data: SideBarChartData | undefined;\n  setData: (data: SideBarChartData) => void;\n}\n\nexport const SideBarTooltipProvider: React.FC<SideBarTooltipProviderProps> = ({\n  children,\n  isSideBarTooltipOpen,\n  setIsSideBarTooltipOpen,\n  data,\n  setData,\n}) => {\n  const value: SideBarTooltipContextType = {\n    data,\n    isSideBarTooltipOpen,\n    setData,\n    setIsSideBarTooltipOpen,\n  };\n\n  return <SideBarTooltipContext.Provider value={value}>{children}</SideBarTooltipContext.Provider>;\n};\n\nexport const useSideBarTooltip = (): SideBarTooltipContextType => {\n  const context = useContext(SideBarTooltipContext);\n  if (context === undefined) {\n    throw new Error(\"useSideBarTooltip must be used within a SideBarTooltipProvider\");\n  }\n  return context;\n};\n\nexport default SideBarTooltipContext;\n","import { useMemo } from \"react\";\nimport { DEFAULT_X_AXIS_HEIGHT, MIN_ROTATION_ANGLE, X_AXIS_PADDING } from \"../constants\";\n\ninterface AngleCalculationResult {\n  angle: number;\n  height: number;\n}\n\n/**\n * Calculates the optimal rotation angle and height for X-axis labels using trigonometry.\n *\n * This hook uses the Pythagorean theorem to determine the optimal angle for rotating\n * labels based on the maximum label width and available horizontal space.\n *\n * Mathematical approach:\n * - Hypotenuse = maxLabelWidth (the label length)\n * - Base = X_AXIS_PADDING (available horizontal space from left edge to first label)\n * - Height = sqrt(hypotenuse² - base²)\n * - Angle = atan(height / base) converted to degrees\n *\n * @param maxLabelWidth - The maximum width of all labels in pixels\n * @param enabled - Whether to calculate the angle (typically based on tickVariant)\n * @returns Object containing the calculated angle (in degrees) and required height\n */\nexport const useAutoAngleCalculation = (\n  maxLabelWidth: number,\n  enabled: boolean,\n  widthOfData?: number,\n): AngleCalculationResult => {\n  return useMemo(() => {\n    // If not enabled, return default values for horizontal labels\n    if (!enabled) {\n      return {\n        angle: 0,\n        height: DEFAULT_X_AXIS_HEIGHT,\n      };\n    }\n\n    // Calculate the base (horizontal distance from left edge to first label anchor)\n    // Use widthOfData if provided (space per data point), otherwise fall back to padding\n    const base = widthOfData ?? X_AXIS_PADDING;\n\n    // The hypotenuse is the maximum label width\n    const hypotenuse = maxLabelWidth;\n\n    // Edge case: if base is greater than or equal to hypotenuse,\n    // labels would fit horizontally, but we always apply rotation per requirement\n    if (base >= hypotenuse) {\n      // Apply minimum rotation angle\n      const angleRadians = (MIN_ROTATION_ANGLE * Math.PI) / 180;\n      const height = Math.ceil(hypotenuse * Math.sin(angleRadians));\n\n      return {\n        angle: -MIN_ROTATION_ANGLE, // Negative for counter-clockwise rotation\n        height: Math.max(height, DEFAULT_X_AXIS_HEIGHT), // Ensure minimum height\n      };\n    }\n\n    // Calculate height using Pythagorean theorem: height = sqrt(hypotenuse² - base²)\n    const heightSquared = hypotenuse * hypotenuse - base * base;\n    const height = Math.sqrt(Math.max(0, heightSquared)); // Ensure non-negative\n\n    // Calculate angle using arctangent: angle = atan(height / base)\n    const angleRadians = Math.atan(height / base);\n\n    // Convert radians to degrees\n    const angleDegrees = (angleRadians * 180) / Math.PI;\n\n    // Apply minimum rotation angle if calculated angle is too small\n    const finalAngle = Math.max(angleDegrees, MIN_ROTATION_ANGLE);\n\n    // Recalculate height if we used minimum angle\n    const finalHeight =\n      finalAngle > angleDegrees\n        ? Math.ceil(hypotenuse * Math.sin((finalAngle * Math.PI) / 180))\n        : Math.ceil(height);\n\n    return {\n      angle: -finalAngle, // Negative for counter-clockwise rotation\n      height: Math.max(finalHeight + 16, DEFAULT_X_AXIS_HEIGHT), // Ensure minimum height\n    };\n  }, [maxLabelWidth, enabled, widthOfData]);\n};\n","import { useMemo } from \"react\";\n\nimport { useTheme } from \"../../ThemeProvider\";\n\n/**\n * Creates a canvas 2D rendering context and sets its font style.\n *\n * This hook initializes a canvas element in memory, gets its 2D context,\n * and then applies a font style based on the theme. It includes a fallback\n * to a default font if the theme property is not available.\n *\n * @returns The canvas 2D context with the font style applied, or `null` if the\n *\n */\n\nexport const useCanvasContextForLabelSize = () => {\n  const { theme: userTheme } = useTheme();\n\n  return useMemo(() => {\n    const canvas = document.createElement(\"canvas\");\n    const context = canvas.getContext(\"2d\")!;\n\n    // Should match the chart's actual font for accuracy.\n    const font = userTheme.textLabelXs ?? \"400 10px/12px Inter\";\n    context.font = font;\n    return context;\n  }, [userTheme.textLabelXs]);\n};\n","import { useMemo } from \"react\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ExportChartData } from \"../Charts\";\n\nexport interface UseExportChartDataProps {\n  type: ExportChartData[\"type\"];\n  data: any[];\n  categoryKey?: string;\n  dataKeys?: string[];\n  colors: string[];\n  legend?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  extraOptions?: Omit<\n    NonNullable<ExportChartData[\"options\"]>,\n    \"chartColors\" | \"showLegend\" | \"catAxisTitle\" | \"valAxisTitle\"\n  >;\n  // For specialized charts like scatter\n  customDataTransform?: () => ExportChartData[\"data\"];\n}\n\nexport const useExportChartData = ({\n  type,\n  data,\n  categoryKey,\n  dataKeys,\n  colors,\n  legend,\n  xAxisLabel,\n  yAxisLabel,\n  extraOptions,\n  customDataTransform,\n}: UseExportChartDataProps): string | undefined => {\n  const printContext = usePrintContext();\n\n  return useMemo(() => {\n    if (!printContext) {\n      return undefined;\n    }\n\n    const chartData = customDataTransform\n      ? customDataTransform()\n      : (dataKeys || []).map((key) => ({\n          name: key,\n          labels: data.map((item) => (categoryKey ? String(item[categoryKey]) : \"\")),\n          values: data.map((item) => Number(item[key])),\n        }));\n\n    const exportData: ExportChartData = {\n      type,\n      data: chartData,\n      options: {\n        chartColors: colors,\n        showLegend: legend,\n        catAxisTitle: typeof xAxisLabel === \"string\" ? xAxisLabel : undefined,\n        showCatAxisTitle: typeof xAxisLabel === \"string\",\n        valAxisTitle: typeof yAxisLabel === \"string\" ? yAxisLabel : undefined,\n        showValAxisTitle: typeof yAxisLabel === \"string\",\n        ...extraOptions,\n      },\n    };\n\n    return JSON.stringify(exportData);\n  }, [\n    type,\n    data,\n    dataKeys,\n    categoryKey,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n    extraOptions,\n    customDataTransform,\n    printContext,\n  ]);\n};\n","import { useMemo } from \"react\";\n\nimport { useTheme } from \"../../ThemeProvider\";\nimport { XAxisTickVariant } from \"../types\";\n\nconst DEFAULT_HEIGHT = 30;\n\nexport const useMaxLabelHeight = (\n  data: Record<string, string | number>[],\n  categoryKey: string,\n  tickVariant: XAxisTickVariant,\n  widthOfGroup = 70,\n) => {\n  const { theme: userTheme } = useTheme();\n\n  const maxLabelHeight = useMemo(() => {\n    if (typeof window === \"undefined\" || !data || data.length === 0) {\n      return DEFAULT_HEIGHT;\n    }\n\n    const largestLabel = data.reduce((max, item) => {\n      const label = String(item[categoryKey]);\n      if (max.length < label.length) {\n        return label;\n      }\n      return max;\n    }, \"\");\n\n    const [div1, div2, div3] = [\n      document.createElement(\"div\"),\n      document.createElement(\"div\"),\n      document.createElement(\"div\"),\n    ];\n\n    div1.style.font = userTheme.textLabelXs ?? \"\";\n    div1.style.letterSpacing = userTheme.textLabelXsLetterSpacing ?? \"\";\n    div1.style.opacity = \"0\";\n    div1.style.pointerEvents = \"none\";\n\n    div2.innerText = largestLabel;\n    div3.innerText = \"a\";\n    div1.append(div2, div3);\n\n    div1.style.width = `${widthOfGroup}px`;\n    div1.style.maxWidth = `${widthOfGroup}px`;\n    div1.style.wordBreak = \"break-word\";\n    div1.style.position = \"absolute\";\n    div1.style.visibility = \"hidden\";\n\n    document.body.append(div1);\n\n    const largestLabelHeight = Math.min(\n      div2.getBoundingClientRect().height,\n      div3.getBoundingClientRect().height * 3,\n    );\n    div1.remove();\n\n    return largestLabelHeight;\n  }, [data, categoryKey, tickVariant, widthOfGroup]);\n\n  if (tickVariant === \"multiLine\") {\n    return Math.max(maxLabelHeight + 13, DEFAULT_HEIGHT);\n  } else {\n    return DEFAULT_HEIGHT;\n  }\n};\n\n/**\n * Hook to calculate the maximum label height for horizontal bar charts.\n * This considers the vertical layout and label width constraints specific to horizontal bars.\n * @param data - The chart data\n * @param categoryKey - The category key\n * @param labelWidth - The available width for labels (full chart width for horizontal bars)\n * @returns The calculated label height\n */\nexport const useHorizontalBarLabelHeight = (\n  data: Record<string, string | number>[],\n  categoryKey: string,\n  labelWidth: number,\n) => {\n  const { theme: userTheme } = useTheme();\n\n  const labelHeight = useMemo(() => {\n    if (typeof window === \"undefined\" || !data || data.length === 0) {\n      return 20; // Default height for horizontal bar labels\n    }\n\n    const largestLabel = data.reduce((max, item) => {\n      const label = String(item[categoryKey]);\n      if (max.length < label.length) {\n        return label;\n      }\n      return max;\n    }, \"\");\n\n    const [div1, div2] = [document.createElement(\"div\"), document.createElement(\"div\")];\n\n    // Apply the same typography as the horizontal bar chart labels\n    div1.style.font = userTheme.textLabelXs ?? \"\";\n    div1.style.letterSpacing = userTheme.textLabelXsLetterSpacing ?? \"\";\n    div1.style.opacity = \"0\";\n    div1.style.pointerEvents = \"none\";\n    div1.style.position = \"absolute\";\n    div1.style.visibility = \"hidden\";\n\n    div2.innerText = largestLabel;\n    div1.append(div2);\n\n    // For horizontal bar charts, labels span the full width\n    // Set width constraint for horizontal bar labels\n    div1.style.width = `${labelWidth}px`;\n    div1.style.maxWidth = `${labelWidth}px`;\n    div1.style.overflow = \"hidden\";\n    div1.style.whiteSpace = \"nowrap\";\n    div1.style.textOverflow = \"ellipsis\";\n    div1.style.display = \"flex\";\n    div1.style.alignItems = \"center\";\n\n    document.body.append(div1);\n\n    const calculatedHeight = div2.getBoundingClientRect().height;\n    div1.remove();\n\n    // Add some padding for better visual spacing\n    // For horizontal bars, we need more space since labels are positioned above bars\n    return Math.max(calculatedHeight + 8, 24);\n  }, [data, categoryKey, labelWidth, userTheme.textLabelXs, userTheme.textLabelXsLetterSpacing]);\n\n  return labelHeight;\n};\n","import { useMemo } from \"react\";\n\nimport { useCanvasContextForLabelSize } from \"./useCanvasContextForLabelSize\";\n\n/**\n * Calculates the maximum width of all labels in the chart data.\n *\n * This hook measures the pixel width of each category label and returns\n * the maximum width found. It uses a canvas context to accurately measure\n * text dimensions based on the current theme's font settings.\n *\n * @param data - The chart data array\n * @param categoryKey - The key in the data object that contains the label text\n * @returns The maximum label width in pixels\n */\nexport const useMaxLabelWidth = <T extends Record<string, any>>(\n  data: T[],\n  categoryKey: keyof T,\n): number => {\n  const context = useCanvasContextForLabelSize();\n\n  return useMemo(() => {\n    if (!data || data.length === 0) {\n      return 0;\n    }\n\n    let maxWidth = 0;\n\n    for (const item of data) {\n      const labelValue = String(item[categoryKey] ?? \"\");\n      const metrics = context.measureText(labelValue);\n      const width = metrics.width;\n\n      if (width > maxWidth) {\n        maxWidth = width;\n      }\n    }\n\n    return maxWidth;\n  }, [data, categoryKey, context]);\n};\n","import { useMemo, useRef } from \"react\";\n\nexport const useTransformedKeys = (keys: string[]) => {\n  // Use a ref to maintain a stable cache of key -> UUID mappings\n  const cacheRef = useRef<Record<string, string>>({});\n\n  return useMemo(() => {\n    return keys.reduce(\n      (acc, key) => {\n        // Only generate a new UUID if we don't already have one for this key\n        if (!cacheRef.current[key]) {\n          cacheRef.current[key] = crypto.randomUUID();\n        }\n        acc[key] = cacheRef.current[key];\n        return acc;\n      },\n      {} as Record<string, string>,\n    );\n  }, [keys]);\n};\n","import { ChartConfig } from \"../Charts\";\nimport { PieChartData } from \"../PieChart\";\nimport { RadialChartData } from \"../RadialChart\";\nimport { LegendItem } from \"../types\";\n\n/**\n * This function returns the data keys for the chart, used for the data keys of the chart.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @returns The data keys for the chart.\n */\nexport const getDataKeys = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n): string[] => {\n  return Object.keys(data[0] || {}).filter((key) => key !== categoryKey);\n};\n\n/**\n * This function returns the chart configuration object, used for the chart configuration object of the chart.\n * @param dataKeys - The data keys for the chart.\n * @param colors - The colors for the chart.\n * @param transformedKeys - The transformed keys for the chart.\n * @param secondaryColors - The secondary colors for the chart (optional).\n * @param icons - The icons for the chart (optional).\n * @returns The chart configuration object for the chart.\n */\nexport const get2dChartConfig = (\n  dataKeys: string[],\n  colors: string[],\n  transformedKeys: Record<string, string>,\n  secondaryColors?: string[],\n  icons?: Partial<Record<string, React.ComponentType>>,\n): ChartConfig => {\n  return dataKeys.reduce(\n    (config, key, index) => ({\n      ...config,\n      [key]: {\n        label: key,\n        icon: icons?.[key],\n        color: colors[index],\n        secondaryColor: secondaryColors?.[index] || colors[dataKeys.length - index - 1],\n        transformed: transformedKeys[key],\n      },\n    }),\n    {},\n  );\n};\n\ntype CategoricalChartData = RadialChartData | PieChartData;\n\nexport const getCategoricalChartConfig = <T extends CategoricalChartData>(\n  data: T,\n  categoryKey: keyof T[number],\n  colors: string[], // Change this from 'theme: string' to 'colors: string[]'\n  transformedKeys: Record<string, string>,\n): ChartConfig => {\n  return data.reduce<ChartConfig>((config, item, index) => {\n    const originalKey = String(item[categoryKey]);\n    const transformedKey = `key-${transformedKeys[originalKey] ?? originalKey}`;\n    return {\n      ...config,\n      [transformedKey]: {\n        label: String(item[categoryKey as string]),\n        color: colors[index],\n        secondaryColor: colors[data.length - index - 1], // Add secondary color for gradient effect\n      },\n    };\n  }, {});\n};\n\n/**\n * This function returns the legend items for the chart, used for the legend items of the chart.\n * @param dataKeys - The data keys for the chart.\n * @param colors - The colors for the chart.\n * @param icons - The icons for the chart.\n * @returns The legend items for the chart.\n */\n\nexport const getLegendItems = (\n  dataKeys: string[],\n  colors: string[],\n  icons?: Partial<Record<string, React.ComponentType>>,\n): LegendItem[] => {\n  return dataKeys.map((key, index) => ({\n    key,\n    label: key,\n    color: colors[index] ?? \"#000000\", // Fallback color if undefined\n    icon: icons?.[key] as React.ComponentType | undefined,\n  }));\n};\n\n/**\n * This function returns the color value for a specific data key based on its position in the dataKeys array.\n * Use this instead of payload.fill to ensure consistent color mapping.\n * @param dataKey - The data key to get the color for.\n * @param dataKeys - The array of all data keys in the chart.\n * @param colors - The array of colors corresponding to the data keys.\n * @returns The color value for the specified data key.\n */\nexport const getColorForDataKey = (\n  dataKey: string,\n  dataKeys: string[],\n  colors: string[],\n): string => {\n  const index = dataKeys.indexOf(dataKey);\n  return colors[index] ?? \"#000000\"; // Fallback color if dataKey not found or color undefined\n};\n","import { useMemo } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { ChartColorPalette, useTheme } from \"../../ThemeProvider\";\n\nexport type ColorPalette = {\n  name: string;\n  // colors are used to display the palette\n  colors: string[];\n};\n\nexport type PaletteName = \"ocean\" | \"orchid\" | \"emerald\" | \"spectrum\" | \"sunset\" | \"vivid\";\n\ntype PaletteMap = Record<string, ColorPalette>;\n\nconst colorPalettes: PaletteMap = {\n  ocean: {\n    name: \"Ocean\",\n    colors: [\n      \"#0D47A1\",\n      \"#1565C0\",\n      \"#1976D2\",\n      \"#1E88E5\",\n      \"#2196F3\",\n      \"#42A5F5\",\n      \"#64B5F6\",\n      \"#90CAF9\",\n      \"#BBDEFB\",\n      \"#E3F2FD\",\n      \"#EFF8FF\",\n    ],\n  },\n  orchid: {\n    name: \"Orchid\",\n    colors: [\n      \"#3A365B\",\n      \"#482E77\",\n      \"#552594\",\n      \"#631DB0\",\n      \"#7014CC\",\n      \"#883BD5\",\n      \"#A062DD\",\n      \"#B88AE6\",\n      \"#CFB1EE\",\n      \"#E7D8F7\",\n      \"#F7EFFF\",\n    ],\n  },\n  emerald: {\n    name: \"Emerald\",\n    colors: [\n      \"#10451D\",\n      \"#155D27\",\n      \"#1A7431\",\n      \"#208B3A\",\n      \"#25A244\",\n      \"#2DC653\",\n      \"#4AD66D\",\n      \"#6EDE8A\",\n      \"#92E6A7\",\n      \"#B7EFC5\",\n      \"#DCFFE5\",\n    ],\n  },\n  spectrum: {\n    name: \"Spectrum\",\n    colors: [\n      \"#2171BC\",\n      \"#2681D7\",\n      \"#72A4EB\",\n      \"#A0C0F7\",\n      \"#C2D4F7\",\n      \"#EADDE8\",\n      \"#EEB3B1\",\n      \"#E99492\",\n      \"#E17475\",\n      \"#D75259\",\n      \"#CB253E\",\n    ],\n  },\n  sunset: {\n    name: \"Sunset\",\n    colors: [\n      \"#0D0887\",\n      \"#42049E\",\n      \"#6A00A8\",\n      \"#900DA4\",\n      \"#B12A90\",\n      \"#CC4678\",\n      \"#E16462\",\n      \"#F1844B\",\n      \"#FCA636\",\n      \"#FCCE25\",\n      \"#FFE06E\",\n    ],\n  },\n  vivid: {\n    name: \"Vivid\",\n    colors: [\n      \"#FF595E\",\n      \"#FF924C\",\n      \"#FFCA3A\",\n      \"#C5CA30\",\n      \"#8AC926\",\n      \"#36949D\",\n      \"#1982C4\",\n      \"#4267AC\",\n      \"#565AA0\",\n      \"#6A4C93\",\n      \"#63438F\",\n    ],\n  },\n};\n\nexport type PaletteKey = keyof typeof colorPalettes;\n\nexport const getPalette = (key: PaletteKey): ColorPalette => {\n  const palette = colorPalettes[key];\n  invariant(palette, `Palette ${key} not found`);\n  return palette;\n};\n\nexport const getAllPalettes = (): ColorPalette[] => {\n  return Object.values(colorPalettes);\n};\n\nexport const getPaletteKeys = (): PaletteKey[] => {\n  return Object.keys(colorPalettes) as PaletteKey[];\n};\n\nexport const getPaletteKey = (palette: ColorPalette): PaletteKey => {\n  return Object.keys(colorPalettes).find((key) => colorPalettes[key] === palette) as PaletteKey;\n};\n\nexport const getPaletteMap = (): PaletteMap => {\n  return colorPalettes;\n};\n\nexport const getDistributedColors = (colors: string[], dataLength: number): string[] => {\n  const midIndex = Math.floor(colors.length / 2);\n\n  if (dataLength === 1) {\n    return [colors[midIndex]!];\n  }\n\n  if (dataLength === 2) {\n    return [colors[midIndex - 1]!, colors[midIndex + 1]!];\n  }\n\n  const result: string[] = [];\n  const offset = Math.floor((dataLength - 1) / 2);\n\n  for (let i = 0; i < dataLength; i++) {\n    const index = midIndex + (i - offset);\n\n    // Handle out of bounds by cycling through colors\n    let actualIndex: number;\n    if (index < 0) {\n      // Wrap around from the end\n      actualIndex = colors.length + (index % colors.length);\n    } else if (index >= colors.length) {\n      // Wrap around from the beginning\n      actualIndex = index % colors.length;\n    } else {\n      actualIndex = index;\n    }\n\n    result.push(colors[actualIndex]!);\n  }\n\n  return result;\n};\n\nexport const useChartPalette = ({\n  chartThemeName,\n  customPalette,\n  themePaletteName,\n  dataLength,\n}: {\n  chartThemeName: PaletteName;\n  customPalette?: string[];\n  themePaletteName: keyof ChartColorPalette;\n  dataLength: number;\n}) => {\n  const { theme } = useTheme();\n  const paletteFromTheme = theme[themePaletteName] || theme.defaultChartPalette;\n  const paletteFromChartTheme = getPalette(chartThemeName);\n\n  const palette = customPalette || paletteFromTheme || paletteFromChartTheme.colors;\n\n  return useMemo(() => {\n    return getDistributedColors(palette, dataLength);\n  }, [palette, dataLength]);\n};\n","/**\n * This function returns the formatter for the Y-axis tick values.\n * @returns The formatter for the Y-axis tick values.\n * internally used by the YAxis component reCharts\n */\nconst numberTickFormatter = (value: number) => {\n  // Format the Y-axis tick values with abbreviations\n  if (typeof value === \"number\") {\n    const absValue = Math.abs(value);\n\n    if (absValue >= 1e12) {\n      return (value / 1e12).toFixed(absValue >= 10e12 ? 0 : 1) + \"T\";\n    } else if (absValue >= 1e9) {\n      return (value / 1e9).toFixed(absValue >= 10e9 ? 0 : 1) + \"B\";\n    } else if (absValue >= 1e6) {\n      return (value / 1e6).toFixed(absValue >= 10e6 ? 0 : 1) + \"M\";\n    } else if (absValue >= 1e3) {\n      return (value / 1e3).toFixed(absValue >= 10e3 ? 0 : 1) + \"K\";\n    } else {\n      // For values < 1000, show only 1 decimal place if there's a decimal\n      if (value % 1 !== 0) {\n        return value.toFixed(2);\n      }\n      return value.toString();\n    }\n  }\n  return String(value);\n};\n\nexport { numberTickFormatter };\n","import { useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { AreaChartData } from \"../AreaChart\";\nimport { BarChartData } from \"../BarChart\";\nimport { LineChartData } from \"../LineChart\";\nimport { ScatterPoint } from \"../ScatterChart/types\";\nimport { numberTickFormatter } from \"../utils\";\nimport { useCanvasContextForLabelSize } from \"./useCanvasContextForLabelSize\";\n\nconst DEFAULT_Y_AXIS_WIDTH = 40;\nconst MIN_Y_AXIS_WIDTH = 20;\nconst MAX_Y_AXIS_WIDTH = 200;\nconst LABEL_PADDING = 10;\n\nexport const useYAxisLabelWidth = (\n  data: AreaChartData | LineChartData | BarChartData | ScatterPoint[],\n  dataKeys: string[],\n) => {\n  const context = useCanvasContextForLabelSize();\n  const [maxLabelWidthReceived, setMaxLabelWidthReceived] = useState(0);\n\n  const maxLabelWidth = useMemo(() => {\n    if (typeof window === \"undefined\" || !data || data.length === 0 || !dataKeys.length) {\n      return DEFAULT_Y_AXIS_WIDTH;\n    }\n\n    if (!context) {\n      return DEFAULT_Y_AXIS_WIDTH;\n    }\n\n    let maxWidth = 0;\n\n    // Measure all possible Y-axis values\n    dataKeys.forEach((key) => {\n      // Get all unique values for this data key we basically want to get the max width of the values\n      const values = [\n        ...new Set(data.map((item) => item[key]).filter((v) => v != null && typeof v === \"number\")),\n      ];\n\n      values.forEach((value) => {\n        const displayValue = numberTickFormatter(value);\n        const textWidth = context.measureText(displayValue).width;\n\n        maxWidth = Math.max(maxWidth, textWidth);\n      });\n    });\n\n    // Add padding for better visual appearance\n    const totalWidth = Math.ceil(maxWidth) + LABEL_PADDING; // 5px padding on each side\n\n    // Clamp the width between MIN and MAX values\n    return Math.max(MIN_Y_AXIS_WIDTH, Math.min(MAX_Y_AXIS_WIDTH, totalWidth));\n  }, [data, dataKeys, context]);\n\n  const maxLabelWidthRef = useRef(maxLabelWidth);\n  maxLabelWidthRef.current = maxLabelWidthReceived || maxLabelWidth;\n\n  const setLabelWidth = useCallback(\n    (displayValue: string) => {\n      const textWidth = context.measureText(displayValue).width + LABEL_PADDING;\n      setMaxLabelWidthReceived((currentWidth) => Math.max(currentWidth, textWidth));\n    },\n    [context],\n  );\n\n  return { yAxisWidth: maxLabelWidthRef.current, setLabelWidth };\n};\n","import React, { useLayoutEffect, useRef } from \"react\";\n\nexport interface ActiveDotProps {\n  cx?: number;\n  cy?: number;\n  payload?: any;\n  value?: any;\n  fill?: string;\n  stroke?: string;\n}\n\nexport const ActiveDot: React.FC<ActiveDotProps> = (props) => {\n  const { cx, cy, fill, stroke } = props;\n  const ref = useRef<SVGGElement>(null);\n\n  useLayoutEffect(() => {\n    if (ref.current) {\n      const parent = ref.current.parentElement?.parentElement;\n      const dotGroup = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n\n      const circle1 = document.createElementNS(\"http://www.w3.org/2000/svg\", \"circle\");\n      circle1.setAttribute(\"cx\", String(cx));\n      circle1.setAttribute(\"cy\", String(cy));\n      circle1.setAttribute(\"r\", \"4\");\n      circle1.setAttribute(\"fill\", \"var(--openui-foreground)\");\n      circle1.setAttribute(\"stroke\", \"var(--openui-foreground)\");\n      circle1.setAttribute(\"stroke-width\", \"1\");\n\n      const circle2 = document.createElementNS(\"http://www.w3.org/2000/svg\", \"circle\");\n      circle2.setAttribute(\"cx\", String(cx));\n      circle2.setAttribute(\"cy\", String(cy));\n      circle2.setAttribute(\"r\", \"2\");\n      circle2.setAttribute(\"fill\", fill || \"var(--color-bg)\");\n      circle2.setAttribute(\"stroke\", stroke || \"transparent\");\n      circle2.setAttribute(\"stroke-width\", \"0\");\n\n      dotGroup.appendChild(circle1);\n      dotGroup.appendChild(circle2);\n      if (parent) {\n        parent.appendChild(dotGroup);\n      }\n\n      return () => {\n        dotGroup.remove();\n      };\n    }\n    return undefined;\n  });\n\n  if (cx === undefined || cy === undefined || cx === null || cy === null) {\n    return null;\n  }\n\n  return <g ref={ref}></g>;\n};\n","import { CartesianGrid } from \"recharts\";\n\nexport const cartesianGrid = () => gridCartesianGrid({ vertical: false });\n\nexport const verticalCartesianGrid = () => gridCartesianGrid({ horizontal: false });\n\nexport const gridCartesianGrid = (props: { vertical?: boolean; horizontal?: boolean }) => (\n  <CartesianGrid\n    vertical={props.vertical ?? true}\n    horizontal={props.horizontal ?? true}\n    fillOpacity={1}\n    strokeOpacity={1}\n    strokeWidth={1}\n    strokeDasharray=\"0\"\n    strokeLinecap=\"round\"\n    strokeLinejoin=\"round\"\n    stroke=\"currentColor\"\n    className=\"openui-chart-cartesian-grid\"\n  />\n);\n","import { useMemo } from \"react\";\nimport { useCanvasContextForLabelSize } from \"../../../hooks/useCanvasContextForLabelSize\";\nimport { LegendItem } from \"../../../types\";\n\nconst CHARACTER_WIDTH = 7; // Fallback width per character\nconst INDICATOR_WIDTH = 10;\nconst GAP_WIDTH = 12;\n\ninterface UseDefaultLegendProps {\n  items: LegendItem[];\n  containerWidth?: number;\n  buttonWidth?: number;\n  isExpanded: boolean;\n}\n\ninterface UseDefaultLegendResult {\n  displayItems: LegendItem[];\n  hasMoreItems: boolean;\n  toggleButtonText: string;\n}\n\nexport const useDefaultLegend = ({\n  items,\n  containerWidth,\n  buttonWidth,\n  isExpanded,\n}: UseDefaultLegendProps): UseDefaultLegendResult => {\n  const canvasContext = useCanvasContextForLabelSize();\n\n  const calculateItemWidth = useMemo(\n    () =>\n      (item: LegendItem): number => {\n        let displayText = item.label;\n\n        // If percentage is provided, include it in the width calculation\n        if (item.percentage !== undefined) {\n          displayText += ` (${item.percentage.toFixed(1)}%)`;\n        }\n\n        if (canvasContext) {\n          // If canvas is supported, measure text width accurately\n          return canvasContext.measureText(displayText).width + INDICATOR_WIDTH + GAP_WIDTH;\n        }\n\n        // Fallback for SSR or if canvas is not supported\n        return displayText.length * CHARACTER_WIDTH + INDICATOR_WIDTH + GAP_WIDTH;\n      },\n    [canvasContext],\n  );\n\n  const { visibleItems, hasMoreItems } = useMemo(() => {\n    if (!containerWidth || items.length === 0) {\n      return { visibleItems: items, hasMoreItems: false };\n    }\n\n    const availableWidth = containerWidth - (buttonWidth ?? 0);\n    let currentWidth = 0;\n    let visibleCount = 0;\n\n    for (let i = 0; i < items.length; i++) {\n      const item = items[i];\n      if (!item) continue;\n\n      const itemWidth = calculateItemWidth(item);\n      // Add gap between items except for the first one\n      const requiredWidth = visibleCount > 0 ? itemWidth + GAP_WIDTH : itemWidth;\n\n      if (currentWidth + requiredWidth <= availableWidth) {\n        currentWidth += requiredWidth;\n        visibleCount++;\n      } else {\n        break;\n      }\n    }\n    // If all items fit within available width, show all items\n    if (visibleCount === items.length) {\n      return { visibleItems: items, hasMoreItems: false };\n    }\n\n    // If no items fit within available width, show at least the first item\n    if (visibleCount === 0 && items[0]) {\n      return {\n        visibleItems: [items[0]], // Show first item\n        hasMoreItems: items.length > 1, // Has more if there are additional items\n      };\n    }\n\n    return {\n      visibleItems: items.slice(0, visibleCount),\n      hasMoreItems: items.length > visibleCount,\n    };\n  }, [items, containerWidth, buttonWidth, calculateItemWidth]);\n\n  const displayItems = useMemo(\n    () => (isExpanded ? items : visibleItems),\n    [isExpanded, items, visibleItems],\n  );\n\n  const toggleButtonText = useMemo(() => {\n    if (isExpanded) {\n      return \"Show Less\";\n    }\n    const hiddenCount = items.length - visibleItems.length;\n    return `${hiddenCount} more`;\n  }, [isExpanded, items.length, visibleItems.length]);\n\n  return {\n    displayItems,\n    hasMoreItems,\n    toggleButtonText,\n  };\n};\n","import clsx from \"clsx\";\nimport { ChevronDownIcon, ChevronUpIcon } from \"lucide-react\";\nimport React, { memo, useCallback, useState } from \"react\";\nimport { Button } from \"../../../Button/Button\";\nimport { type LegendItem } from \"../../types\";\nimport { useDefaultLegend } from \"./hooks/useDefaultLegend\";\n\ninterface DefaultLegendProps {\n  items: LegendItem[];\n  className?: string;\n  yAxisLabel?: React.ReactNode;\n  xAxisLabel?: React.ReactNode;\n  containerWidth?: number;\n  isExpanded: boolean;\n  setIsExpanded: (isExpanded: boolean) => void;\n  style?: React.CSSProperties;\n}\n\nconst DefaultLegend = memo(\n  React.forwardRef<HTMLDivElement, DefaultLegendProps>(\n    (\n      {\n        items,\n        className,\n        yAxisLabel,\n        xAxisLabel,\n        containerWidth,\n        isExpanded,\n        setIsExpanded,\n        style,\n      },\n      ref,\n    ) => {\n      const [buttonWidth, setButtonWidth] = useState(0);\n      const { displayItems, hasMoreItems, toggleButtonText } = useDefaultLegend({\n        items,\n        containerWidth,\n        buttonWidth,\n        isExpanded,\n      });\n\n      // We use a callback ref to measure the button's width as soon as it's mounted.\n      // This is more reliable than useEffect with ref.current in the dependency array,\n      // as it correctly triggers a re-render when the node is available.\n      // This is a workaround for the fact that the button's width is not available immediately.\n      // and we need the actual button width to calculate the layout of the legend items.\n      const buttonRef = useCallback(\n        (node: HTMLButtonElement | null) => {\n          if (node) {\n            if (node.clientWidth !== buttonWidth) {\n              setButtonWidth(node.clientWidth);\n            }\n          }\n        },\n        [buttonWidth],\n      );\n\n      const handleToggleExpanded = () => {\n        setIsExpanded(!isExpanded);\n      };\n\n      const showToggleButton = hasMoreItems;\n\n      return (\n        <div\n          ref={ref}\n          className={clsx(\"openui-chart-legend-container openui-chart-legend--bottom\", className)}\n          style={style}\n        >\n          {/* this is x and y axis labels container*/}\n          {(xAxisLabel || yAxisLabel) && (\n            <div className=\"openui-chart-legend-axis-label-container\">\n              {xAxisLabel && (\n                <span className=\"openui-chart-legend-axis-label\">\n                  X-Axis: <span className=\"openui-chart-legend-axis-label-text\">{xAxisLabel}</span>\n                </span>\n              )}\n              {yAxisLabel && (\n                <span className=\"openui-chart-legend-axis-label\">\n                  Y-Axis: <span className=\"openui-chart-legend-axis-label-text\">{yAxisLabel}</span>\n                </span>\n              )}\n            </div>\n          )}\n          {/* this is the legend items container*/}\n          <div\n            className={clsx(\"openui-chart-legend\", {\n              \"openui-chart-legend--expanded\": isExpanded,\n              \"openui-chart-legend--collapsed\": !isExpanded && showToggleButton,\n            })}\n          >\n            {displayItems.map((item) => (\n              <div key={item.key} className=\"openui-chart-legend-item\">\n                {item.icon ? (\n                  <item.icon />\n                ) : (\n                  <div\n                    className=\"openui-chart-legend-item-indicator\"\n                    style={{ backgroundColor: item.color }}\n                  />\n                )}\n                <div className=\"openui-chart-legend-item-label-container\">\n                  <span className=\"openui-chart-legend-item-label\">{item.label}</span>\n                  {item.percentage !== undefined && (\n                    <span className=\"openui-chart-legend-item-percentage\">\n                      {item.percentage.toFixed(1)}%\n                    </span>\n                  )}\n                </div>\n              </div>\n            ))}\n\n            {showToggleButton && (\n              <Button\n                variant=\"tertiary\"\n                size=\"small\"\n                ref={buttonRef}\n                className=\"openui-chart-legend-toggle-button\"\n                onClick={handleToggleExpanded}\n                iconRight={\n                  isExpanded ? (\n                    <ChevronUpIcon className=\"openui-chart-legend-toggle-button-icon\" />\n                  ) : (\n                    <ChevronDownIcon className=\"openui-chart-legend-toggle-button-icon\" />\n                  )\n                }\n              >\n                {toggleButtonText}\n              </Button>\n            )}\n          </div>\n        </div>\n      );\n    },\n  ),\n);\n\nDefaultLegend.displayName = \"DefaultLegend\";\nexport { DefaultLegend };\nexport type { DefaultLegendProps };\n","import React, { FunctionComponent, useMemo } from \"react\";\n\ninterface LineInBarShapeProps {\n  x?: number;\n  y?: number;\n  width?: number;\n  height?: number;\n  fill?: string;\n  stroke?: string;\n  strokeWidth?: number | string;\n  radius?: number | number[];\n  internalLineColor?: string;\n  internalLineWidth?: number;\n  isHovered?: boolean;\n  hoveredCategory?: string | number | null;\n  categoryKey?: string;\n  payload?: any;\n  variant?: \"grouped\" | \"stacked\";\n  stackGap?: number;\n  orientation?: \"vertical\" | \"horizontal\";\n  hasNegativeValueInStack?: boolean;\n  [key: string]: any; // Allow other props from Recharts\n}\n\nconst DEFAULT_STACK_GAP = 1;\nconst MIN_LINE_DIMENSION = 8; // For internal line visibility (height/width threshold)\nconst MIN_BAR_WIDTH_FOR_LINE = 3; // Minimum bar width to show internal line in vertical mode\nconst LINE_PADDING = 6;\nconst MIN_GROUP_BAR_HEIGHT = 2; // For vertical bars\nconst MIN_STACKED_BAR_HEIGHT = 4; // For vertical bars\nconst MIN_BAR_WIDTH = 2; // For horizontal bars\n\nconst LineInBarShape: FunctionComponent<LineInBarShapeProps> = React.memo((props) => {\n  const {\n    x = 0,\n    y = 0,\n    width = 0,\n    height = 0,\n    fill,\n    radius: r,\n    stroke,\n    strokeWidth,\n    internalLineColor: iLineColor,\n    internalLineWidth: iLineWidth,\n    isHovered,\n    hoveredCategory,\n    categoryKey,\n    payload,\n    variant = \"grouped\",\n    stackGap = DEFAULT_STACK_GAP,\n    orientation = \"vertical\",\n    hasNegativeValueInStack,\n  } = props;\n\n  const isVertical = orientation === \"vertical\";\n  const isNegative = isVertical ? height < 0 : width < 0;\n\n  const w = isNegative && !isVertical ? -width : width;\n  const h = isNegative && isVertical ? -height : height;\n\n  const x_ = isNegative && !isVertical ? x + width : x;\n  const y_ = isNegative && isVertical ? y + height : y;\n\n  /**\n   * Calculates the corner radii for the bar.\n   * This logic ensures that only the \"outer\" corners of a bar are rounded,\n   * depending on its orientation (vertical/horizontal) and whether it's a\n   * positive or negative value.\n   *\n   * - For vertical bars, top corners are rounded for positive values, and\n   *   bottom corners for negative values.\n   * - For horizontal bars, right corners are rounded for positive values, and\n   *   left corners for negative values.\n   *\n   * If the bar's dimensions are below a certain threshold, no rounding is applied.\n   * The `radius` prop can be a single number or an array `[rTL, rTR, rBR, rBL]`.\n   */\n  const { rTL, rTR, rBL, rBR } = useMemo(() => {\n    // This code calculates which corners of a bar should be rounded based on several factors:\n\n    // First check if the bar is too small to have rounded corners\n    const minDimension = isVertical ? MIN_GROUP_BAR_HEIGHT : MIN_BAR_WIDTH;\n    const dimension = isVertical ? h : w;\n\n    // If bar is too small, return no rounded corners\n    if (\n      (variant === \"grouped\" && dimension < minDimension) ||\n      (variant === \"stacked\" && dimension < MIN_STACKED_BAR_HEIGHT)\n    ) {\n      return { rTL: 0, rTR: 0, rBL: 0, rBR: 0 };\n    }\n\n    // Check bar thickness and remove rounded corners if too thin\n    // For vertical bars: check width, for horizontal bars: check height\n    const barThickness = isVertical ? w : h;\n    if (barThickness < 7) {\n      return { rTL: 0, rTR: 0, rBL: 0, rBR: 0 };\n    }\n\n    // If radius is an array, apply specific radius to each corner\n    if (Array.isArray(r)) {\n      // The radius array is expected to be in the format [rTL, rTR, rBR, rBL].\n      return { rTL: r[0] || 0, rTR: r[1] || 0, rBR: r[2] || 0, rBL: r[3] || 0 };\n    } else if (typeof r === \"number\") {\n      // If radius is a single number, apply it consistently based on orientation\n      if (isVertical) {\n        if (isNegative) return { rTL: 0, rTR: 0, rBL: r, rBR: r };\n        return { rTL: r, rTR: r, rBL: 0, rBR: 0 };\n      }\n      // For horizontal bars\n      if (isNegative) return { rTL: r, rTR: 0, rBL: r, rBR: 0 };\n      return { rTL: 0, rTR: r, rBL: 0, rBR: r };\n    }\n    // Default case - no rounded corners\n    return { rTL: 0, rTR: 0, rBL: 0, rBR: 0 };\n  }, [r, variant, h, w, isVertical, isNegative]);\n\n  // This code calculates the opacity of a bar based on hover state:\n  // - Returns 1 (fully opaque) if:\n  //   - Chart is not being hovered (isHovered is false)\n  //   - No category is being hovered (hoveredCategory is null)\n  //   - Missing required data (payload or categoryKey)\n  // - If chart is being hovered:\n  //   - Returns 1 if this bar's category matches the hovered category\n  //   - Returns 0.4 (40% opacity) if this bar's category doesn't match\n  const opacity = useMemo(() => {\n    if (!isHovered || hoveredCategory === null || !payload || !categoryKey) return 1;\n    return payload[categoryKey] === hoveredCategory ? 1 : 0.4;\n  }, [isHovered, hoveredCategory, payload, categoryKey]);\n\n  // This code adjusts the dimensions and position of bars in the chart:\n  // - For vertical bars:\n  //   - Reduces height by stackGap if stacked variant\n  //   - Enforces minimum height based on variant (grouped vs stacked)\n  //   - Adjusts Y position for positive values to align from bottom\n  // - For horizontal bars:\n  //   - Reduces width by stackGap if stacked variant\n  //   - Enforces minimum width\n  // Returns adjusted x, y coordinates and dimensions while preserving original values\n  const { adjustedX, adjustedY, adjustedWidth, adjustedHeight } = useMemo(() => {\n    // Initialize final dimensions with original values\n    let finalX = x_; // Starting x position\n    let finalY = y_; // Starting y position\n    let finalWidth = w; // Original width\n    let finalHeight = h; // Original height\n\n    if (isVertical) {\n      // For vertical bars:\n\n      // If stacked bars, reduce height by gap between bars\n      if (variant === \"stacked\" && stackGap > 0) {\n        finalHeight = h - stackGap;\n      }\n\n      // Enforce minimum height based on variant\n      if (h > 0) {\n        const minHeight =\n          variant === \"grouped\"\n            ? MIN_GROUP_BAR_HEIGHT // Minimum 2px for grouped bars\n            : MIN_STACKED_BAR_HEIGHT - stackGap; // Minimum 4px minus gap for stacked\n        finalHeight = Math.max(finalHeight, minHeight);\n      }\n\n      // For positive values, adjust Y to align from bottom\n      if (!isNegative) {\n        if (variant === \"stacked\" && stackGap > 0 && hasNegativeValueInStack) {\n          finalY = y + h - finalHeight - stackGap;\n        } else {\n          finalY = y + h - finalHeight;\n        }\n      }\n    } else {\n      // For horizontal bars:\n\n      // If stacked, reduce width by gap between bars\n      if (variant === \"stacked\" && stackGap > 0) {\n        finalWidth = w - stackGap;\n      }\n\n      // Enforce minimum width of 2px\n      if (w > 0) {\n        finalWidth = Math.max(finalWidth, MIN_BAR_WIDTH);\n      }\n    }\n\n    // Return adjusted dimensions and positions\n    return {\n      adjustedX: finalX,\n      adjustedY: finalY,\n      adjustedWidth: finalWidth,\n      adjustedHeight: finalHeight,\n    };\n  }, [variant, stackGap, x, y, w, h, isVertical, isNegative, x_, y_]);\n\n  /**\n   * Generates the SVG path for the bar.\n   * This code creates the SVG path string for a bar with rounded corners.\n   * The path drawing logic changes based on:\n   * 1. Bar orientation (vertical vs horizontal)\n   * 2. Value sign (positive vs negative)\n   *\n   * The SVG path is drawn using commands:\n   * - M x,y: Move to point (x,y) without drawing\n   * - L x,y: Draw line to point (x,y)\n   * - A rx,ry angle,large-arc,sweep x,y: Draw arc with radius rx,ry to point (x,y)\n   *   The arc parameters control:\n   *   - angle: rotation of arc (0 = no rotation)\n   *   - large-arc: 0 = small arc, 1 = large arc\n   *   - sweep: 0 = counter-clockwise, 1 = clockwise\n   * - Z: Close path by drawing line back to start\n   *\n   * For rounded corners, we:\n   * 1. Move to start point\n   * 2. Draw straight edges\n   * 3. For each corner that should be rounded:\n   *    - Stop short of corner by radius amount\n   *    - Draw arc with specified radius to next edge\n   *    - Continue with straight edges\n   * 4. Close path\n   */\n\n  const path = useMemo(() => {\n    // This code generates SVG path strings to draw bars with rounded corners\n    // The path drawing logic changes based on:\n    // 1. Bar orientation (vertical vs horizontal)\n    // 2. Value sign (positive vs negative)\n\n    if (isVertical) {\n      // For vertical bars\n      if (isNegative) {\n        // Draw downward pointing bar with rounded bottom corners if specified\n        // This path draws a vertical bar with rounded bottom corners for negative values\n        // Here's how each command works:\n        // 1. M ${x},${adjustedY} - Move to top-left corner\n        // 2. L ${x + adjustedWidth},${adjustedY} - Draw line to top-right corner\n        // 3. L ${x + adjustedWidth},${adjustedY + adjustedHeight - rBR} - Draw line down right side, stopping before bottom-right corner\n        // 4. If bottom-right radius (rBR) > 0:\n        //    A ${rBR},${rBR} 0 0 1 ${x + adjustedWidth - rBR},${adjustedY + adjustedHeight}\n        //    Draw arc: radius rBR, no rotation (0), small arc (0), clockwise (1), end at bottom-right rounded corner\n        //    Else: Draw straight line to bottom-right corner\n        // 5. L ${x + rBL},${adjustedY + adjustedHeight} - Draw line left along bottom, stopping before bottom-left corner\n        // 6. If bottom-left radius (rBL) > 0:\n        //    A ${rBL},${rBL} 0 0 1 ${x},${adjustedY + adjustedHeight - rBL}\n        //    Draw arc: radius rBL, no rotation (0), small arc (0), clockwise (1), end at bottom-left rounded corner\n        //    Else: Draw straight line to bottom-left corner\n        // 7. Z - Close path by drawing line back to start\n        return `\n          M ${x},${adjustedY}\n          L ${x + adjustedWidth},${adjustedY}\n          L ${x + adjustedWidth},${adjustedY + adjustedHeight - rBR}\n          ${rBR > 0 ? `A ${rBR},${rBR} 0 0 1 ${x + adjustedWidth - rBR},${adjustedY + adjustedHeight}` : `L ${x + adjustedWidth},${adjustedY + adjustedHeight}`}\n          L ${x + rBL},${adjustedY + adjustedHeight}\n          ${rBL > 0 ? `A ${rBL},${rBL} 0 0 1 ${x},${adjustedY + adjustedHeight - rBL}` : `L ${x},${adjustedY + adjustedHeight}`}\n          Z`;\n      }\n      // Draw upward pointing bar with rounded top corners if specified\n      return `\n        M ${x},${adjustedY + rTL}\n        ${rTL > 0 ? `A ${rTL},${rTL} 0 0 1 ${x + rTL},${adjustedY}` : `L ${x},${adjustedY}`}\n        L ${x + adjustedWidth - rTR},${adjustedY}\n        ${rTR > 0 ? `A ${rTR},${rTR} 0 0 1 ${x + adjustedWidth},${adjustedY + rTR}` : `L ${x + adjustedWidth},${adjustedY}`}\n        L ${x + adjustedWidth},${adjustedY + adjustedHeight}\n        L ${x},${adjustedY + adjustedHeight}\n        Z`;\n    }\n\n    // For horizontal bars\n    if (isNegative) {\n      // Draw leftward pointing bar with rounded left corners if specified\n      return `\n      M ${adjustedX + rTL},${y}\n      ${rTL > 0 ? `A ${rTL},${rTL} 0 0 0 ${adjustedX},${y + rTL}` : `L ${adjustedX},${y}`}\n      L ${adjustedX},${y + height - rBL}\n      ${rBL > 0 ? `A ${rBL},${rBL} 0 0 0 ${adjustedX + rBL},${y + height}` : `L ${adjustedX},${y + height}`}\n      L ${adjustedX + adjustedWidth},${y + height}\n      L ${adjustedX + adjustedWidth},${y}\n      Z`;\n    }\n    // Draw rightward pointing bar with rounded right corners if specified\n    return `\n      M ${adjustedX},${y}\n      L ${adjustedX + adjustedWidth - rTR},${y}\n      ${rTR > 0 ? `A ${rTR},${rTR} 0 0 1 ${adjustedX + adjustedWidth},${y + rTR}` : `L ${adjustedX + adjustedWidth},${y}`}\n      L ${adjustedX + adjustedWidth},${y + height - rBR}\n      ${rBR > 0 ? `A ${rBR},${rBR} 0 0 1 ${adjustedX + adjustedWidth - rBR},${y + height}` : `L ${adjustedX + adjustedWidth},${y + height}`}\n      L ${adjustedX},${y + height}\n      Z`;\n  }, [\n    x,\n    y,\n    adjustedX,\n    adjustedY,\n    adjustedWidth,\n    adjustedHeight,\n    height,\n    rTL,\n    rTR,\n    rBL,\n    rBR,\n    isVertical,\n    isNegative,\n  ]);\n\n  const lineCoords = useMemo(() => {\n    if (isVertical) {\n      // For vertical bars: hide line if bar width < 3px (too thin) OR height < 8px (too short)\n      // This ensures thin bars don't have a visible internal line that looks awkward\n      if (width <= 0 || width < MIN_BAR_WIDTH_FOR_LINE || adjustedHeight < MIN_LINE_DIMENSION) {\n        return null;\n      }\n      const centerX = x + width / 2;\n      return {\n        x1: centerX,\n        y1: adjustedY + LINE_PADDING,\n        x2: centerX,\n        y2: adjustedY + adjustedHeight - LINE_PADDING,\n      };\n    }\n    // Horizontal bars: hide line if width < 8px OR height <= 0\n    if (adjustedWidth < MIN_LINE_DIMENSION || height <= 0) return null;\n    const centerY = y + height / 2;\n    return {\n      x1: adjustedX + LINE_PADDING,\n      y1: centerY,\n      x2: adjustedX + adjustedWidth - LINE_PADDING,\n      y2: centerY,\n    };\n  }, [x, y, adjustedX, adjustedY, width, height, adjustedWidth, adjustedHeight, isVertical]);\n\n  return (\n    <g>\n      <path d={path} fill={fill} stroke={stroke} strokeWidth={strokeWidth} opacity={opacity} />\n      {lineCoords && (\n        <line\n          x1={lineCoords.x1}\n          y1={lineCoords.y1}\n          x2={lineCoords.x2}\n          y2={lineCoords.y2}\n          stroke={iLineColor}\n          strokeWidth={iLineWidth}\n          strokeLinecap=\"round\"\n          opacity={opacity}\n        />\n      )}\n    </g>\n  );\n});\n\nLineInBarShape.displayName = \"LineInBarShape\";\n\nexport { LineInBarShape };\n","import type { Placement } from \"@floating-ui/react-dom\";\nimport { autoUpdate, flip, hide, offset, useFloating } from \"@floating-ui/react-dom\";\nimport clsx from \"clsx\";\nimport React, { useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useTheme } from \"../../../ThemeProvider\";\n\ninterface FloatingUIPortalProps {\n  children: React.ReactNode;\n  className?: string;\n  chartId?: string;\n  portalContainer?: React.RefObject<HTMLElement | null>;\n  position?: Partial<{ x: number; y: number }>;\n  placement?: Placement;\n  offsetDistance?: number;\n}\n\nexport const FloatingUIPortal: React.FC<FloatingUIPortalProps> = ({\n  children,\n  className = \"\",\n  chartId,\n  portalContainer,\n  position,\n  placement = \"right-start\",\n  offsetDistance = 20,\n}) => {\n  const { refs, floatingStyles, update } = useFloating({\n    placement,\n    middleware: [offset(offsetDistance), flip(), hide()],\n    whileElementsMounted: autoUpdate,\n  });\n\n  const { portalThemeClassName } = useTheme();\n\n  useEffect(() => {\n    if (position) {\n      update();\n    }\n  }, [position, update]);\n\n  return (\n    <>\n      <div\n        ref={refs.setReference}\n        style={{\n          position: \"absolute\",\n          top: position?.y,\n          left: position?.x,\n        }}\n      />\n      {createPortal(\n        <div\n          ref={refs.setFloating}\n          className={clsx(\"openui-portal-tooltip\", portalThemeClassName, className)}\n          data-chart={chartId}\n          style={floatingStyles}\n        >\n          {children}\n        </div>,\n        portalContainer?.current || document.body,\n      )}\n    </>\n  );\n};\n","const tooltipNumberFormatter = (value: number) => {\n  const isNegative = value < 0;\n  const absValue = Math.abs(value);\n\n  if (absValue < 100000) {\n    return (isNegative ? \"-\" : \"\") + absValue.toLocaleString();\n  }\n\n  const units = [\"\", \"K\", \"M\", \"B\", \"T\"];\n  let unitIndex = 0;\n  let scaledValue = absValue;\n\n  while (scaledValue >= 1000 && unitIndex < units.length - 1) {\n    scaledValue /= 1000;\n    unitIndex++;\n  }\n\n  // Format with at most 1 decimal place\n  const formattedValue = Math.floor(scaledValue * 10) / 10;\n\n  return (isNegative ? \"-\" : \"\") + `${formattedValue}${units[unitIndex]}`;\n};\n\nexport { tooltipNumberFormatter };\n","import clsx from \"clsx\";\nimport { forwardRef, memo, useEffect, useMemo, useState } from \"react\";\nimport * as RechartsPrimitive from \"recharts\";\nimport { ChartStyle, getPayloadConfigFromPayload, useChart } from \"../../../Charts/Charts\";\nimport { useSideBarTooltip } from \"../../context/SideBarTooltipContext\";\nimport { FloatingUIPortal } from \"./FloatingUIPortal\";\nimport { tooltipNumberFormatter } from \"./utils\";\n\nconst DEFAULT_INDICATOR = \"dot\" as const;\n\ntype CustomTooltipContentProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n  React.ComponentProps<\"div\"> & {\n    hideLabel?: boolean;\n    hideIndicator?: boolean;\n    indicator?: \"line\" | \"dot\" | \"dashed\";\n    nameKey?: string;\n    labelKey?: string;\n    showPercentage?: boolean;\n    portalContainer?: React.RefObject<HTMLElement | null>;\n    parentRef: React.RefObject<HTMLElement | null>;\n  };\n\n/**\n * Custom tooltip content component for floating tooltips\n * Mirrors the functionality of ChartTooltipContent but works with FloatingUIPortal\n */\nfunction CustomTooltipContentRender(\n  props: CustomTooltipContentProps,\n  ref: React.ForwardedRef<HTMLDivElement>,\n) {\n  const {\n    active,\n    payload,\n    className,\n    indicator = DEFAULT_INDICATOR,\n    hideLabel = false,\n    hideIndicator = false,\n    label,\n    labelFormatter,\n    labelClassName,\n    formatter,\n    color,\n    nameKey,\n    labelKey,\n    showPercentage = false,\n    portalContainer,\n    parentRef,\n  } = props;\n\n  const { config, id } = useChart();\n  const { isSideBarTooltipOpen } = useSideBarTooltip();\n  const isGreaterThanTen = !!(payload?.length && payload.length > 10);\n  const remainingItems = payload && isGreaterThanTen ? payload.length - 5 : 0;\n  // this state is used to forcefully hide the tooltip when the user touches outside of the parent element\n  // this is not handled by recharts\n  const [forcefullyHideTooltip, setForcefullyHideTooltip] = useState(false);\n  const [parentScrollPosition, setParentScrollPosition] = useState({\n    x: 0,\n    y: 0,\n    width: 0,\n    height: 0,\n  });\n\n  const tooltipLabel = useMemo(() => {\n    if (hideLabel || !payload?.length) {\n      return null;\n    }\n\n    const [item] = payload;\n    const key = `${labelKey ?? item?.dataKey ?? item?.name ?? \"value\"}`;\n    const itemConfig = getPayloadConfigFromPayload(config, item, key);\n    const value =\n      !labelKey && typeof label === \"string\" ? config[label]?.label || label : itemConfig?.label;\n\n    // this is active when we pass a labelFormatter prop to the recharts tooltip\n    // normally we would not need this, but it's useful for customizing the label\n    if (labelFormatter) {\n      return (\n        <div className={clsx(\"openui-chart-tooltip-label-heavy\", labelClassName)}>\n          {labelFormatter(value, payload)}\n        </div>\n      );\n    }\n\n    if (!value) {\n      return null;\n    }\n\n    return <div className={clsx(\"openui-chart-tooltip-label\", labelClassName)}>{value}</div>;\n  }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n  const nestLabel = useMemo(\n    () => payload?.length === 1 && indicator !== DEFAULT_INDICATOR,\n    [payload?.length, indicator],\n  );\n\n  const payloadItems = useMemo(() => {\n    if (!payload?.length) {\n      return [];\n    }\n\n    const renderPayloadItem = (item: any, index: number, isTwoItemsLayout: boolean) => {\n      const key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`;\n      const itemConfig = getPayloadConfigFromPayload(config, item, key);\n      const indicatorColor = (color ?? item.payload?.fill) || item.color;\n\n      return (\n        <div\n          key={`${item.dataKey}-${index}`}\n          className={clsx(\n            \"openui-chart-tooltip-content-item\",\n            !isTwoItemsLayout &&\n              indicator === DEFAULT_INDICATOR &&\n              \"openui-chart-tooltip-content-item--dot\",\n          )}\n        >\n          {formatter && item?.value !== undefined && item.name ? (\n            formatter(item.value, item.name, item, index, item.payload)\n          ) : (\n            <>\n              {itemConfig?.icon ? (\n                <itemConfig.icon />\n              ) : (\n                !hideIndicator && (\n                  <div\n                    className={clsx(\n                      \"openui-chart-tooltip-content-indicator\",\n                      `openui-chart-tooltip-content-indicator--${indicator}`,\n                      isTwoItemsLayout && \"openui-chart-tooltip-content-indicator--two-items\",\n                    )}\n                    style={\n                      {\n                        \"--color-bg\": indicatorColor,\n                        \"--color-border\": indicatorColor,\n                      } as React.CSSProperties\n                    }\n                  />\n                )\n              )}\n\n              <div\n                className={clsx(\n                  \"openui-chart-tooltip-content-value-wrapper\",\n                  isTwoItemsLayout && \"openui-chart-tooltip-content-value-wrapper--vertical\",\n                  nestLabel\n                    ? \"openui-chart-tooltip-content-value-wrapper--nested\"\n                    : \"openui-chart-tooltip-content-value-wrapper--standard\",\n                )}\n              >\n                <div className=\"openui-chart-tooltip-content-label\">\n                  {nestLabel && tooltipLabel}\n                  <span>{itemConfig?.label || item.name}</span>\n                </div>\n\n                {item.value !== undefined && (\n                  <span\n                    className={clsx(\n                      \"openui-chart-tooltip-content-value\",\n                      showPercentage && \"percentage\",\n                    )}\n                  >\n                    {typeof item.value === \"number\"\n                      ? tooltipNumberFormatter(item.value)\n                      : item.value}\n                    {showPercentage ? \"%\" : \"\"}\n                  </span>\n                )}\n              </div>\n            </>\n          )}\n          <div className=\"openui-chart-tooltip-content-item-separator\" />\n        </div>\n      );\n    };\n\n    // Handle two items layout\n    if (payload.length <= 2) {\n      return payload.map((item, index) => renderPayloadItem(item, index, true));\n    }\n\n    // Handle regular layout with potential truncation\n    const morphPayload = isGreaterThanTen ? payload.slice(0, 5) : payload;\n    return morphPayload.map((item, index) => renderPayloadItem(item, index, false));\n  }, [\n    payload,\n    nameKey,\n    config,\n    color,\n    indicator,\n    formatter,\n    hideIndicator,\n    nestLabel,\n    tooltipLabel,\n    showPercentage,\n  ]);\n\n  useEffect(() => {\n    const parent = parentRef.current;\n    if (!parent) {\n      return;\n    }\n\n    const touchHandler = (e: TouchEvent) => {\n      for (let i = 0; i < e.targetTouches.length; i++) {\n        const target = e.targetTouches[i]!.target as HTMLElement;\n        if (!parent.contains(target)) {\n          setForcefullyHideTooltip(true);\n          return;\n        }\n      }\n      setForcefullyHideTooltip(false);\n    };\n    document.body.addEventListener(\"touchstart\", touchHandler);\n\n    const scrollHandler = () => {\n      setParentScrollPosition({\n        x: parent.scrollLeft,\n        y: parent.scrollTop,\n        width: parent.clientWidth,\n        height: parent.clientHeight,\n      });\n    };\n\n    parent.addEventListener(\"scroll\", scrollHandler);\n\n    setParentScrollPosition({\n      x: parent.scrollLeft,\n      y: parent.scrollTop,\n      width: parent.clientWidth,\n      height: parent.clientHeight,\n    });\n\n    return () => {\n      document.body.removeEventListener(\"touchstart\", touchHandler);\n      parent.removeEventListener(\"scroll\", scrollHandler);\n    };\n  }, [parentRef.current]);\n\n  // Early return for inactive or empty payload - moved after all hooks\n  if (!active || !payload?.length || isSideBarTooltipOpen || forcefullyHideTooltip) {\n    return null;\n  }\n\n  const tooltipContent = (\n    <div ref={ref} className={clsx(\"openui-chart-tooltip\", className)}>\n      {!nestLabel && tooltipLabel}\n      <div className=\"openui-chart-tooltip-content-item-separator\" />\n      <div className=\"openui-chart-tooltip-content\">{payloadItems}</div>\n      {isGreaterThanTen && <div className=\"openui-chart-tooltip-content-item-separator\" />}\n      {isGreaterThanTen && (\n        <div className=\"openui-chart-tooltip-content-view-more\">\n          Click to view all {remainingItems}\n        </div>\n      )}\n    </div>\n  );\n  const coordinates = { x: props.coordinate?.x ?? 0, y: props.coordinate?.y ?? 0 };\n\n  if (\n    parentScrollPosition.x > coordinates.x ||\n    parentScrollPosition.y > coordinates.y ||\n    parentScrollPosition.width + parentScrollPosition.x < coordinates.x ||\n    parentScrollPosition.height + parentScrollPosition.y < coordinates.y\n  ) {\n    return null;\n  }\n\n  return (\n    <FloatingUIPortal chartId={id} portalContainer={portalContainer} position={props.coordinate}>\n      <ChartStyle id={id} config={config} />\n      {tooltipContent}\n    </FloatingUIPortal>\n  );\n}\n\nexport const CustomTooltipContent = memo(forwardRef(CustomTooltipContentRender));\n\nCustomTooltipContent.displayName = \"CustomTooltipContent\";\n","import clsx from \"clsx\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport React from \"react\";\nimport { IconButton } from \"../../../IconButton\";\n\ninterface ScrollButtonsHorizontalProps {\n  dataWidth: number;\n  effectiveWidth: number;\n  canScrollLeft: boolean;\n  canScrollRight: boolean;\n  isSideBarTooltipOpen: boolean;\n  onScrollLeft: () => void;\n  onScrollRight: () => void;\n}\n\nexport const ScrollButtonsHorizontal = React.memo(\n  ({\n    dataWidth,\n    effectiveWidth,\n    canScrollLeft,\n    canScrollRight,\n    isSideBarTooltipOpen,\n    onScrollLeft,\n    onScrollRight,\n  }: ScrollButtonsHorizontalProps) => {\n    if (dataWidth <= effectiveWidth) {\n      return null;\n    }\n\n    return (\n      <div className=\"openui-chart-horizontal-scroll-buttons-container\">\n        <IconButton\n          className={clsx(\n            \"openui-chart-horizontal-scroll-button openui-chart-horizontal-scroll-button--left\",\n            {\n              \"openui-chart-horizontal-scroll-button--disabled\": !canScrollLeft,\n            },\n          )}\n          icon={<ChevronLeft />}\n          variant=\"secondary\"\n          onClick={onScrollLeft}\n          size=\"2-extra-small\"\n          disabled={!canScrollLeft}\n          aria-label=\"Scroll left\"\n        />\n\n        <IconButton\n          className={clsx(\n            \"openui-chart-horizontal-scroll-button openui-chart-horizontal-scroll-button--right\",\n            {\n              \"openui-chart-horizontal-scroll-button--disabled\": !canScrollRight,\n              \"openui-chart-horizontal-scroll-button--SideBarTooltip\": isSideBarTooltipOpen,\n            },\n          )}\n          icon={<ChevronRight />}\n          variant=\"secondary\"\n          size=\"2-extra-small\"\n          onClick={onScrollRight}\n          disabled={!canScrollRight}\n          aria-label=\"Scroll right\"\n        />\n      </div>\n    );\n  },\n);\n\nScrollButtonsHorizontal.displayName = \"ScrollButtonsHorizontal\";\n","import clsx from \"clsx\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport React from \"react\";\nimport { IconButton } from \"../../../IconButton\";\n\ninterface ScrollButtonsVerticalProps {\n  dataHeight: number;\n  effectiveHeight: number;\n  canScrollUp: boolean;\n  canScrollDown: boolean;\n  isSideBarTooltipOpen: boolean;\n  onScrollUp: () => void;\n  onScrollDown: () => void;\n}\n\nexport const ScrollButtonsVertical = React.memo(\n  ({\n    dataHeight,\n    effectiveHeight,\n    canScrollUp,\n    canScrollDown,\n    isSideBarTooltipOpen,\n    onScrollUp,\n    onScrollDown,\n  }: ScrollButtonsVerticalProps) => {\n    if (dataHeight <= effectiveHeight) {\n      return null;\n    }\n\n    return (\n      <div className=\"openui-chart-vertical-scroll-buttons-container\">\n        <IconButton\n          className={clsx(\n            \"openui-chart-vertical-scroll-button openui-chart-vertical-scroll-button--up\",\n            {\n              \"openui-chart-vertical-scroll-button--disabled\": !canScrollUp,\n            },\n          )}\n          icon={<ChevronUp />}\n          variant=\"secondary\"\n          onClick={onScrollUp}\n          size=\"extra-small\"\n          disabled={!canScrollUp}\n          aria-label=\"Scroll up\"\n        />\n\n        <IconButton\n          className={clsx(\n            \"openui-chart-vertical-scroll-button openui-chart-vertical-scroll-button--down\",\n            {\n              \"openui-chart-vertical-scroll-button--disabled\": !canScrollDown,\n              \"openui-chart-vertical-scroll-button--SideBarTooltip\": isSideBarTooltipOpen,\n            },\n          )}\n          icon={<ChevronDown />}\n          variant=\"secondary\"\n          size=\"extra-small\"\n          onClick={onScrollDown}\n          disabled={!canScrollDown}\n          aria-label=\"Scroll down\"\n        />\n      </div>\n    );\n  },\n);\n\nScrollButtonsVertical.displayName = \"ScrollButtonsVertical\";\n","import { X } from \"lucide-react\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { IconButton } from \"../../../IconButton\";\nimport { useSideBarTooltip } from \"../../context/SideBarTooltipContext\";\nimport { tooltipNumberFormatter } from \"../PortalTooltip/utils\";\n\ninterface SideBarTooltipProps {\n  height: number;\n}\n\n// Utility function for capitalizing strings\nconst capitalizeString = (str: string): string => {\n  return str.charAt(0).toUpperCase() + str.slice(1);\n};\n\nconst SideBarTooltip = React.memo(({ height }: SideBarTooltipProps) => {\n  const { setIsSideBarTooltipOpen, data } = useSideBarTooltip();\n\n  // if no data, close the tooltip\n  if (!data) {\n    setIsSideBarTooltipOpen(false);\n    return null;\n  }\n\n  const handleClose = useCallback(() => {\n    setIsSideBarTooltipOpen(false);\n  }, [setIsSideBarTooltipOpen]);\n\n  const processedValues = useMemo(() => {\n    return data.values?.map((value, index) => ({\n      ...value,\n      capitalizedLabel: capitalizeString(value.label),\n      isLast: index === data.values.length - 1,\n    }));\n  }, [data.values]);\n\n  const title = data.title;\n\n  return (\n    <div className=\"openui-chart-side-bar-tooltip\" style={{ height: `${height}px` }}>\n      <div className=\"openui-chart-side-bar-tooltip-header\">\n        <div className=\"openui-chart-side-bar-tooltip-title\">{title}</div>\n        <IconButton\n          icon={<X />}\n          size=\"extra-small\"\n          onClick={handleClose}\n          variant=\"secondary\"\n          className=\"openui-chart-side-bar-tooltip-close-button\"\n        />\n      </div>\n      <div className=\"openui-chart-side-bar-tooltip-content-item-separator\" />\n      <div className=\"openui-chart-side-bar-tooltip-content\" autoFocus>\n        {processedValues?.map((value, index) => (\n          <div key={index}>\n            <div className=\"openui-chart-side-bar-tooltip-content-item\">\n              <div\n                className=\"openui-chart-side-bar-tooltip-content-item-color\"\n                style={{ backgroundColor: value.color }}\n              />\n              <div className=\"openui-chart-side-bar-tooltip-content-item-label\">\n                {value.capitalizedLabel}\n              </div>\n              <div className=\"openui-chart-side-bar-tooltip-content-item-value\">\n                {tooltipNumberFormatter(value.value)}\n              </div>\n            </div>\n            {!value.isLast && (\n              <div className=\"openui-chart-side-bar-tooltip-content-item-separator\" />\n            )}\n          </div>\n        ))}\n      </div>\n    </div>\n  );\n});\n\nSideBarTooltip.displayName = \"SideBarTooltip\";\n\nexport { SideBarTooltip };\n","import clsx from \"clsx\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { Button } from \"../../../Button\";\nimport { IconButton } from \"../../../IconButton\";\nimport { Separator } from \"../../../Separator\";\nimport { StackedLegendItem } from \"../../types\";\n\nexport type StackedLegendLayout = \"auto\" | \"showMore\" | \"scrollable\";\n\ninterface StackedLegendProps {\n  items: StackedLegendItem[];\n  onItemHover?: (key: string | null) => void;\n  activeKey?: string | null;\n  onLegendItemHover?: (index: number | null) => void;\n  containerWidth?: number;\n  title?: string;\n  separator?: boolean;\n  showTitle?: boolean;\n  layout?: StackedLegendLayout;\n  className?: string;\n  style?: React.CSSProperties;\n}\n\nconst formatPercentage = (value: number, total: number): string => {\n  const percentage = (value / total) * 100;\n  return `${percentage.toFixed(1)}%`;\n};\n\nconst ITEM_HEIGHT = 36; // Height of each legend item\nconst ITEM_GAP = 2; // Gap between items\nconst LEGEND_ITEM_LIMIT = 6;\nconst SHOW_MORE_BREAKPOINT = 450;\n\nexport const StackedLegend = ({\n  items,\n  onItemHover,\n  activeKey,\n  onLegendItemHover,\n  containerWidth,\n  separator = false,\n  showTitle = true,\n  layout = \"auto\",\n  className,\n  style,\n}: StackedLegendProps) => {\n  const containerRef = useRef<HTMLDivElement>(null);\n  const listRef = useRef<HTMLDivElement>(null);\n  const [showUpButton, setShowUpButton] = useState(false);\n  const [showDownButton, setShowDownButton] = useState(false);\n  const [showAll, setShowAll] = useState(false);\n  const [isOverflowing, setIsOverflowing] = useState(false);\n\n  // Determine the actual layout to use\n  const isShowMoreLayout =\n    layout === \"showMore\" ||\n    (layout === \"auto\" &&\n      containerWidth !== undefined &&\n      (containerWidth < SHOW_MORE_BREAKPOINT || items.length > LEGEND_ITEM_LIMIT));\n\n  const isScrollableLayout = layout === \"scrollable\" || (layout === \"auto\" && !isShowMoreLayout);\n\n  const handleMouseEnter = (key: string, index: number) => {\n    onItemHover?.(key);\n    onLegendItemHover?.(index);\n  };\n\n  const handleMouseLeave = () => {\n    onItemHover?.(null);\n    onLegendItemHover?.(null);\n  };\n\n  // Check if scrolling is needed\n  useEffect(() => {\n    const checkScroll = () => {\n      if (listRef.current && containerRef.current) {\n        const { scrollTop, scrollHeight, clientHeight } = listRef.current;\n        const overflowing = scrollHeight > clientHeight;\n        setIsOverflowing(overflowing);\n        setShowUpButton(scrollTop > 0);\n        setShowDownButton(scrollTop < scrollHeight - clientHeight - 1);\n      }\n    };\n\n    if (isShowMoreLayout) {\n      setShowUpButton(false);\n      setShowDownButton(false);\n      return;\n    }\n\n    // Initial check\n    checkScroll();\n\n    // Add event listener for scroll\n    const currentRef = listRef.current;\n    if (currentRef) {\n      currentRef.addEventListener(\"scroll\", checkScroll);\n\n      // Also add resize observer to handle responsive changes\n      const resizeObserver = new ResizeObserver(checkScroll);\n      resizeObserver.observe(currentRef);\n\n      return () => {\n        currentRef.removeEventListener(\"scroll\", checkScroll);\n        resizeObserver.disconnect();\n      };\n    }\n    return () => {};\n  }, [isShowMoreLayout]);\n\n  // Scroll functions\n  const scrollUp = () => {\n    if (listRef.current) {\n      // Scroll one item up\n      listRef.current.scrollBy({ top: -(ITEM_HEIGHT + ITEM_GAP), behavior: \"smooth\" });\n    }\n  };\n\n  const scrollDown = () => {\n    if (listRef.current) {\n      // Scroll one item down\n      listRef.current.scrollBy({ top: ITEM_HEIGHT + ITEM_GAP, behavior: \"smooth\" });\n    }\n  };\n\n  // Calculate total for percentage\n  const total = items.reduce((sum, item) => sum + item.value, 0);\n\n  // Items are already sorted by the parent component, so we use them as-is\n  const itemsToDisplay = isShowMoreLayout && !showAll ? items.slice(0, 6) : items;\n  const shouldShowScrollControls =\n    isScrollableLayout && isOverflowing && items.length > LEGEND_ITEM_LIMIT;\n\n  return (\n    <div\n      ref={containerRef}\n      className={clsx(\"openui-stacked-legend-container\", className)}\n      style={{\n        width: containerWidth ? `${containerWidth}px` : \"100%\",\n        ...style,\n      }}\n    >\n      {shouldShowScrollControls && (\n        <div className=\"openui-stacked-legend-header\">\n          {showTitle && (\n            <div className=\"openui-stacked-legend-header-title\">{items.length} labels</div>\n          )}\n          <div className=\"openui-stacked-legend-header-buttons\">\n            {shouldShowScrollControls && (\n              <>\n                <IconButton\n                  className=\"openui-stacked-legend-scroll-button openui-stacked-legend-scroll-up\"\n                  onClick={scrollUp}\n                  aria-label=\"Scroll legend up\"\n                  icon={<ChevronUp />}\n                  variant=\"secondary\"\n                  size=\"extra-small\"\n                  disabled={!showUpButton}\n                />\n                <IconButton\n                  className=\"openui-stacked-legend-scroll-button openui-stacked-legend-scroll-down\"\n                  onClick={scrollDown}\n                  aria-label=\"Scroll legend down\"\n                  icon={<ChevronDown />}\n                  variant=\"secondary\"\n                  size=\"extra-small\"\n                  disabled={!showDownButton}\n                />\n              </>\n            )}\n          </div>\n        </div>\n      )}\n      <div ref={listRef} className=\"openui-stacked-legend\">\n        {itemsToDisplay.map((item, index) => (\n          <React.Fragment key={item.key}>\n            <div\n              className={`openui-stacked-legend__item ${\n                activeKey === item.key ? \"openui-stacked-legend__item--active\" : \"\"\n              }`}\n              onMouseEnter={() => handleMouseEnter(item.key, index)}\n              onMouseLeave={handleMouseLeave}\n            >\n              <div className=\"openui-stacked-legend__item-label\">\n                <div className=\"openui-stacked-legend__item-color-container\">\n                  <div\n                    className=\"openui-stacked-legend__item-color\"\n                    style={{ backgroundColor: item.color }}\n                  />\n                </div>\n                <div className=\"openui-stacked-legend__item-label-text\">{item.label}</div>\n              </div>\n              <div className=\"openui-stacked-legend__item-value\">\n                {formatPercentage(item.value, total)}\n              </div>\n            </div>\n            {index !== itemsToDisplay.length - 1 && separator && (\n              <Separator className=\"openui-stacked-legend-separator\" />\n            )}\n          </React.Fragment>\n        ))}\n      </div>\n      {isShowMoreLayout && !showAll && items.length > LEGEND_ITEM_LIMIT && (\n        <Button\n          variant=\"secondary\"\n          size=\"small\"\n          onClick={() => setShowAll(true)}\n          className=\"openui-stacked-legend-show-more-button\"\n        >\n          Show more\n        </Button>\n      )}\n      {isShowMoreLayout && showAll && items.length > LEGEND_ITEM_LIMIT && (\n        <Button\n          variant=\"secondary\"\n          size=\"small\"\n          onClick={() => setShowAll(false)}\n          className=\"openui-stacked-legend-show-less-button\"\n        >\n          Show less\n        </Button>\n      )}\n    </div>\n  );\n};\n","import clsx from \"clsx\";\nimport React from \"react\";\nimport { numberTickFormatter } from \"../../utils\";\n\nexport type SVGXAxisTickVariant = \"singleLine\" | \"angled\";\n\ninterface SVGXAxisTickProps {\n  x?: number;\n  y?: number;\n  payload?: {\n    value: any;\n  };\n  className?: string;\n  angle?: number;\n  textAnchor?: \"start\" | \"middle\" | \"end\";\n  tickFormatter?: (value: any) => string;\n  dy?: number;\n}\n\nconst SVGXAxisTick = React.forwardRef<SVGTextElement, SVGXAxisTickProps>((props, ref) => {\n  const {\n    x,\n    y,\n    payload,\n    className,\n    angle = 0,\n    textAnchor = \"middle\",\n    tickFormatter,\n    dy = 16,\n  } = props;\n\n  if (x === undefined || y === undefined) {\n    return null;\n  }\n\n  const raw = payload?.value;\n  // Auto-detect: Use custom formatter, or format numbers automatically, or stringify\n  const displayValue = tickFormatter\n    ? tickFormatter(raw)\n    : typeof raw === \"number\"\n      ? numberTickFormatter(raw)\n      : String(raw ?? \"\");\n\n  const transform = angle !== 0 ? `rotate(${angle}, ${x}, ${y})` : undefined;\n\n  return (\n    <text\n      ref={ref}\n      className={clsx(\n        \"openui-chart-svg-x-axis-tick\",\n        angle !== 0 && \"openui-chart-svg-x-axis-tick-angled\",\n        className,\n      )}\n      x={x}\n      y={y}\n      dy={dy}\n      textAnchor={textAnchor}\n      transform={transform}\n    >\n      {displayValue}\n    </text>\n  );\n});\n\nSVGXAxisTick.displayName = \"SVGXAxisTick\";\n\nexport { SVGXAxisTick };\nexport type { SVGXAxisTickProps };\n","import * as Tooltip from \"@radix-ui/react-tooltip\";\nimport React from \"react\";\n\ninterface LabelTooltipProviderProps {\n  children: React.ReactNode;\n  delayDuration?: number;\n  skipDelayDuration?: number;\n  disableHoverableContent?: boolean;\n}\n\ninterface LabelTooltipProps {\n  children: React.ReactNode;\n  content: string;\n  side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n  sideOffset?: number;\n  delayDuration?: number;\n  className?: string;\n  disabled?: boolean;\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n}\n\nconst DEFAULT_DELAY_DURATION = 300;\nconst DEFAULT_SKIP_DELAY_DURATION = 300;\nconst DEFAULT_DISABLE_HOVERABLE_CONTENT = false;\n\nconst LabelTooltipProvider: React.FC<LabelTooltipProviderProps> = (props) => {\n  const {\n    children,\n    delayDuration = DEFAULT_DELAY_DURATION,\n    skipDelayDuration = DEFAULT_SKIP_DELAY_DURATION,\n    disableHoverableContent = DEFAULT_DISABLE_HOVERABLE_CONTENT,\n  } = props;\n\n  return (\n    <Tooltip.Provider\n      delayDuration={delayDuration}\n      skipDelayDuration={skipDelayDuration}\n      disableHoverableContent={disableHoverableContent}\n    >\n      {children}\n    </Tooltip.Provider>\n  );\n};\n\nconst LabelTooltip = React.forwardRef<HTMLDivElement, LabelTooltipProps>((props, ref) => {\n  const {\n    children,\n    content,\n    side = \"top\",\n    sideOffset = 1,\n    delayDuration = DEFAULT_DELAY_DURATION,\n    className = \"openui-chart-label-tooltip\",\n    disabled = false,\n    open,\n    defaultOpen,\n    onOpenChange,\n  } = props;\n\n  if (disabled) {\n    return children;\n  }\n\n  return (\n    <Tooltip.Root\n      delayDuration={delayDuration}\n      open={open}\n      defaultOpen={defaultOpen}\n      onOpenChange={onOpenChange}\n    >\n      <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n      <Tooltip.Portal>\n        <Tooltip.Content ref={ref} className={className} side={side} sideOffset={sideOffset}>\n          {content}\n        </Tooltip.Content>\n      </Tooltip.Portal>\n    </Tooltip.Root>\n  );\n});\n\nLabelTooltip.displayName = \"LabelTooltip\";\n\nexport { LabelTooltip, LabelTooltipProvider };\nexport type { LabelTooltipProps, LabelTooltipProviderProps };\n","import clsx from \"clsx\";\nimport React, { useLayoutEffect, useRef, useState } from \"react\";\nimport { XAxisTickVariant } from \"../../types\";\nimport { LabelTooltip } from \"../LabelTooltip/LabelTooltip\";\n\ninterface XAxisTickProps {\n  x?: number;\n  y?: number;\n  payload?: {\n    value: any;\n    coordinate?: number;\n    tickCoord?: number;\n    index?: number;\n    offset?: number;\n    isShow?: boolean;\n  };\n  textAnchor?: \"start\" | \"middle\" | \"end\";\n  verticalAnchor?: \"start\" | \"middle\" | \"end\";\n  fill?: string;\n  stroke?: string;\n  width?: number;\n  height?: number;\n  className?: string;\n  orientation?: \"top\" | \"bottom\";\n  tickFormatter?: (value: any) => string;\n  index?: number;\n  visibleTicksCount?: number;\n  variant?: XAxisTickVariant;\n  widthOfGroup?: number;\n  labelHeight?: number;\n  onMouseEnter?: (tickProps: XAxisTickProps) => void;\n  onMouseLeave?: (tickProps: XAxisTickProps) => void;\n}\n\nconst XAxisTick = React.forwardRef<SVGGElement, XAxisTickProps>((props, ref) => {\n  const {\n    x,\n    y,\n    payload,\n    className,\n    variant = \"multiLine\",\n    widthOfGroup = 70,\n    labelHeight = 20,\n    onMouseEnter,\n    onMouseLeave,\n  } = props;\n\n  const rawValue = payload?.value;\n  const value = String(rawValue || \"\");\n\n  const foreignObjectRef = useRef<SVGForeignObjectElement>(null);\n  const spanRef = useRef<HTMLSpanElement>(null);\n  const [isTruncated, setIsTruncated] = useState(false);\n\n  // Check if text is truncated\n  useLayoutEffect(() => {\n    if (spanRef.current) {\n      const element = spanRef.current;\n      const isCurrentlyTruncated =\n        variant === \"multiLine\"\n          ? element.scrollHeight > element.clientHeight\n          : element.scrollWidth > element.clientWidth;\n      setIsTruncated(isCurrentlyTruncated);\n    }\n  }, [value, variant, widthOfGroup]);\n\n  if (x === undefined || y === undefined) {\n    return null;\n  }\n\n  // The x position from Recharts is the center of the group\n  // To center the foreignObject, we need to offset by half of widthOfGroup\n  // +2 is for the multiLine variant to center the text\n  // +5 is for the singleLine variant to center the text\n  // offset for padding - 4 and -10 respectively\n  const calX = variant === \"multiLine\" ? x - widthOfGroup / 2 + 2 : x - widthOfGroup / 2 + 5;\n  const calWidth = variant === \"multiLine\" ? widthOfGroup - 4 : widthOfGroup - 10;\n\n  const spanClassName =\n    variant === \"multiLine\"\n      ? \"openui-chart-x-axis-tick-multi-line\"\n      : \"openui-chart-x-axis-tick-single-line\";\n\n  return (\n    <g ref={ref} transform={`translate(${calX},${y})`}>\n      <foreignObject\n        ref={foreignObjectRef}\n        transform=\"translate(0, 0)\"\n        width={calWidth}\n        height={labelHeight} // Initial height, will be updated by useLayoutEffect\n        className=\"openui-chart-x-axis-tick-foreign\"\n      >\n        <div\n          style={{\n            width: \"100%\",\n            height: \"100%\",\n            boxSizing: \"border-box\",\n          }}\n          onMouseEnter={() => onMouseEnter?.(props)}\n          onMouseLeave={() => onMouseLeave?.(props)}\n        >\n          <LabelTooltip content={value} side=\"top\" disabled={!isTruncated}>\n            <span\n              ref={spanRef}\n              style={{\n                textAlign: \"center\",\n                wordBreak: \"break-word\",\n              }}\n              className={clsx(spanClassName, className)}\n            >\n              {value}\n            </span>\n          </LabelTooltip>\n        </div>\n      </foreignObject>\n    </g>\n  );\n});\n\nXAxisTick.displayName = \"XAxisTick\";\n\nexport { XAxisTick };\nexport type { XAxisTickProps };\n","import { useLayoutEffect } from \"react\";\nimport { numberTickFormatter } from \"../../utils\";\n\ninterface YAxisTickProps {\n  x?: number;\n  y?: number;\n  payload?: {\n    value: any;\n    coordinate?: number;\n    tickCoord?: number;\n    index?: number;\n    offset?: number;\n    isShow?: boolean;\n  };\n  textAnchor?: \"start\" | \"middle\" | \"end\";\n  verticalAnchor?: \"start\" | \"middle\" | \"end\";\n  fill?: string;\n  stroke?: string;\n  width?: number;\n  height?: number;\n  className?: string;\n  orientation?: \"left\" | \"right\";\n  tickFormatter?: (value: any) => string;\n  index?: number;\n  visibleTicksCount?: number;\n  setLabelWidth: (label: string) => void;\n}\n\nconst YAxisTick: React.FC<YAxisTickProps> = (props) => {\n  const { x, y, payload, textAnchor, verticalAnchor, className, setLabelWidth } = props;\n\n  const displayValue =\n    typeof payload?.value === \"number\"\n      ? numberTickFormatter(payload?.value)\n      : String(payload?.value);\n\n  useLayoutEffect(() => {\n    setLabelWidth(displayValue);\n  }, [displayValue, setLabelWidth]);\n\n  return (\n    <g transform={`translate(${x},${y})`} className={className}>\n      <text\n        x={0}\n        y={0}\n        dy={verticalAnchor === \"middle\" ? 4 : 0} // Adjust based on vertical anchor\n        textAnchor={textAnchor || \"end\"}\n        className=\"openui-chart-y-axis-tick\"\n      >\n        {displayValue}\n      </text>\n    </g>\n  );\n};\n\nexport { YAxisTick };\nexport type { YAxisTickProps };\n","// Common utility functions for Area and Line charts\n// These functions are chart-type agnostic and can be shared between AreaChartV2 and LineChartV2\n\nimport { AreaChartData } from \"../../AreaChart/types\";\nimport { LineChartData } from \"../../LineChart/types\";\n\nconst ELEMENT_SPACING = 72;\n\n// Common type for chart data - both AreaChart and LineChart data structures\ntype ChartData = AreaChartData | LineChartData;\n\n/**\n * AREA CHART AND LINE CHART SPECIFIC FUNCTION\n * This function returns the width of the data in the area chart, used for padding calculation, scroll amount calculation, and\n * for the width of the chart container.\n * @param data - The data to be displayed in the chart.\n */\nexport const getWidthOfData = (data: ChartData, containerWidth: number) => {\n  if (data.length === 0) {\n    return containerWidth;\n  }\n  // For area charts, we calculate based on the number of data points.\n  // We use getWidthOfGroup to ensure consistency\n  const width = data.length * getWidthOfGroup(data);\n\n  // if the container width is greater than the width of the data, then we return the container width\n  // because the we need the chart minimum width to be the container width\n  // this decision is made because area chart an bar chart are span from the left to the right of the container\n  if (containerWidth >= width) {\n    return containerWidth;\n  }\n\n  if (data.length === 1) {\n    const minSingleDataWidth = 200; // Minimum width for single data points\n    // if the data point is only one, then we need to set the width to the minimum width\n    return Math.max(width, minSingleDataWidth);\n  }\n\n  return width;\n};\n\n/**\n * SHARED UTILITY FUNCTION\n * This function returns the nearest snap position index for both chart types.\n * The implementation is identical for both AreaChart and LineChart.\n * @param snapPositions - The snap positions for the chart.\n * @param currentScroll - The current scroll of the chart.\n * @param direction - The direction of the scroll.\n * @returns The nearest snap position index for the chart.\n */\nexport const findNearestSnapPosition = (\n  snapPositions: number[],\n  currentScroll: number,\n  direction: \"left\" | \"right\",\n): number => {\n  // Find current position index\n  let currentIndex = 0;\n  for (let i = 0; i < snapPositions.length; i++) {\n    const snapPosition = snapPositions[i];\n    if (snapPosition !== undefined && currentScroll >= snapPosition) {\n      currentIndex = i;\n    } else {\n      break;\n    }\n  }\n\n  if (direction === \"left\") {\n    // Go to previous snap position\n    return Math.max(0, currentIndex - 1);\n  } else {\n    // Go to next snap position\n    return Math.min(snapPositions.length - 1, currentIndex + 1);\n  }\n};\n\n/**\n * SHARED UTILITY FUNCTION\n * This function returns the width of each group/category for both chart types.\n * Both AreaChart and LineChart use the same ELEMENT_SPACING.\n * @param data - The data to be displayed in the chart.\n * @returns The width of each group/category.\n */\nexport const getWidthOfGroup = (data: ChartData) => {\n  if (data.length === 0) return 200; // Fallback\n\n  // Both chart types use the same spacing\n  return ELEMENT_SPACING;\n};\n\n/**\n * SHARED UTILITY FUNCTION\n * This function returns the snap positions for both chart types, used for smooth scrolling.\n * @param data - The data to be displayed in the chart.\n * @returns The snap positions for the chart.\n */\nexport const getSnapPositions = (data: ChartData): number[] => {\n  if (data.length === 0) return [0];\n\n  const positions = [0]; // Start position\n  const groupWidthValue = getWidthOfGroup(data);\n\n  // Calculate all valid snap positions based on data points\n  for (let i = 1; i < data.length; i++) {\n    positions.push(i * groupWidthValue);\n  }\n\n  return positions;\n};\n","import { AreaChartVariant, LineChartVariant } from \"../..\";\n\nexport const getLineType = (lineType: LineChartVariant | AreaChartVariant) => {\n  switch (lineType) {\n    case \"linear\":\n      return \"linear\";\n    case \"natural\":\n      return \"monotone\";\n    case \"step\":\n      return \"step\";\n  }\n};\n","import clsx from \"clsx\";\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Area, AreaChart as RechartsAreaChart, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport {\n  useExportChartData,\n  useMaxLabelHeight,\n  useTransformedKeys,\n  useYAxisLabelWidth,\n} from \"../hooks\";\nimport {\n  ActiveDot,\n  cartesianGrid,\n  CustomTooltipContent,\n  DefaultLegend,\n  ScrollButtonsHorizontal,\n  SideBarTooltip,\n  XAxisTick,\n  YAxisTick,\n} from \"../shared\";\nimport { LabelTooltipProvider } from \"../shared/LabelTooltip/LabelTooltip\";\nimport { LegendItem, XAxisTickVariant } from \"../types\";\nimport {\n  findNearestSnapPosition,\n  getSnapPositions,\n  getWidthOfData,\n  getWidthOfGroup,\n} from \"../utils/AreaAndLine/AreaAndLineUtils\";\nimport { getLineType } from \"../utils/AreaAndLine/common\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\nimport {\n  get2dChartConfig,\n  getColorForDataKey,\n  getDataKeys,\n  getLegendItems,\n} from \"../utils/dataUtils\";\nimport { AreaChartData, AreaChartVariant } from \"./types\";\n\n// this a technic to get the type of the onClick event of the bar chart\n// we need to do this because the onClick event type is not exported by recharts\ntype AreaChartOnClick = React.ComponentProps<typeof RechartsAreaChart>[\"onClick\"];\ntype AreaClickData = Parameters<NonNullable<AreaChartOnClick>>[0];\n\nexport interface AreaChartProps<T extends AreaChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: AreaChartVariant;\n  tickVariant?: XAxisTickVariant;\n  grid?: boolean;\n  legend?: boolean;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  showYAxis?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  className?: string;\n  height?: number;\n  width?: number;\n}\n\nconst X_AXIS_PADDING = 36;\nconst CHART_CONTAINER_BOTTOM_MARGIN = 10;\n\nconst AreaChartComponent = <T extends AreaChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant: areaChartVariant = \"natural\",\n  tickVariant = \"multiLine\",\n  grid = true,\n  icons = {},\n  isAnimationActive = false,\n  showYAxis = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  className,\n  height,\n  width,\n}: AreaChartProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const variant = getLineType(areaChartVariant);\n\n  const { yAxisWidth, setLabelWidth } = useYAxisLabelWidth(data, dataKeys);\n\n  const widthOfGroup = useMemo(() => {\n    return getWidthOfGroup(data);\n  }, [data]);\n\n  const maxLabelHeight = useMaxLabelHeight(data, categoryKey as string, tickVariant, widthOfGroup);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"areaChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  const chartContainerRef = useRef<HTMLDivElement>(null);\n  const mainContainerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [canScrollLeft, setCanScrollLeft] = useState(false);\n  const [canScrollRight, setCanScrollRight] = useState(false);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n\n  // Use provided width or observed width\n  const effectiveWidth = useMemo(() => {\n    return width ?? containerWidth;\n  }, [width, containerWidth]);\n\n  const effectiveContainerWidth = useMemo(() => {\n    const dynamicYAxisWidth = showYAxis ? yAxisWidth : 0;\n    return Math.max(0, effectiveWidth - dynamicYAxisWidth - 40); // -40 because we are giving 20px padding in xAxis on each side\n  }, [effectiveWidth, showYAxis, yAxisWidth]);\n\n  const dataWidth = useMemo(() => {\n    return getWidthOfData(data, effectiveContainerWidth);\n  }, [data, effectiveContainerWidth]);\n\n  // Calculate snap positions for proper scrolling alignment\n  const snapPositions = useMemo(() => {\n    return getSnapPositions(data);\n  }, [data]);\n\n  const chartHeight = useMemo(() => {\n    return height ?? 296 + maxLabelHeight;\n  }, [height, maxLabelHeight]);\n\n  // Check scroll boundaries\n  const updateScrollState = useCallback(() => {\n    if (mainContainerRef.current) {\n      const { scrollLeft, scrollWidth, clientWidth } = mainContainerRef.current;\n      setCanScrollLeft(scrollLeft > 0);\n      setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 1); // -1 for floating point precision\n    }\n  }, []);\n\n  const scrollLeft = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollLeft;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"left\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        left: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  const scrollRight = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollLeft;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"right\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        left: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  useEffect(() => {\n    // Only set up ResizeObserver if width is not provided\n    if (width || !chartContainerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are observing the chart container\n      for (const entry of entries) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    resizeObserver.observe(chartContainerRef.current);\n    setContainerWidth(chartContainerRef.current.getBoundingClientRect().width);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, [width]);\n\n  // Update scroll state when container width or data width changes\n  useEffect(() => {\n    updateScrollState();\n  }, [effectiveWidth, dataWidth, updateScrollState]);\n\n  useEffect(() => {\n    setIsSideBarTooltipOpen(false);\n    setIsLegendExpanded(false);\n  }, [dataKeys]);\n\n  // Add scroll event listener to update button states\n  useEffect(() => {\n    const mainContainer = mainContainerRef.current;\n    if (!mainContainer) return;\n\n    const handleScroll = () => {\n      updateScrollState();\n    };\n\n    mainContainer.addEventListener(\"scroll\", handleScroll);\n    return () => {\n      mainContainer.removeEventListener(\"scroll\", handleScroll);\n    };\n  }, [updateScrollState]);\n\n  const legendItems: LegendItem[] = useMemo(() => {\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons]);\n\n  const exportData = useExportChartData({\n    type: \"area\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n  });\n\n  const id = useId();\n\n  const gradientID = useMemo(() => `area-chart-gradient-${id}`, [id]);\n\n  const onAreaClick = useCallback(\n    (data: AreaClickData) => {\n      if (data?.activePayload?.length && data.activePayload.length > 10) {\n        setIsSideBarTooltipOpen(true);\n        setSideBarTooltipData({\n          title: data.activeLabel as string,\n          values: data.activePayload.map((payload) => ({\n            value: payload.value as number,\n            label: payload.name || payload.dataKey,\n            color: getColorForDataKey(payload.dataKey, dataKeys, colors),\n          })),\n        });\n      }\n    },\n    [dataKeys, colors],\n  );\n\n  const yAxis = useMemo(() => {\n    if (!showYAxis) {\n      return null;\n    }\n    return (\n      <div className=\"openui-area-chart-y-axis-container\">\n        {/* Y-axis only chart - synchronized with main chart */}\n        <RechartsAreaChart\n          key={`y-axis-chart-${id}`}\n          width={yAxisWidth}\n          height={chartHeight}\n          data={data}\n          margin={{\n            top: 20,\n            bottom: maxLabelHeight + CHART_CONTAINER_BOTTOM_MARGIN, // this is required for to give space for x-axis\n            left: 0,\n            right: 0,\n          }}\n        >\n          <YAxis\n            width={yAxisWidth}\n            tickLine={false}\n            axisLine={false}\n            tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n          />\n          {/* Invisible area to maintain scale synchronization */}\n          {dataKeys.map((key) => {\n            return (\n              <Area\n                key={`y-axis-${key}`}\n                dataKey={key}\n                type={variant}\n                stroke=\"none\"\n                fill=\"transparent\"\n                fillOpacity={0}\n                stackId=\"a\"\n              />\n            );\n          })}\n        </RechartsAreaChart>\n      </div>\n    );\n  }, [showYAxis, chartHeight, data, dataKeys, variant, id, maxLabelHeight, yAxisWidth]);\n\n  return (\n    <LabelTooltipProvider>\n      <SideBarTooltipProvider\n        isSideBarTooltipOpen={isSideBarTooltipOpen}\n        setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n        data={sideBarTooltipData}\n        setData={setSideBarTooltipData}\n      >\n        <div\n          className={clsx(\"openui-area-chart-container\", className)}\n          data-openui-chart={exportData}\n          style={{\n            width: width ? `${width}px` : undefined,\n          }}\n        >\n          <div className=\"openui-area-chart-container-inner\" ref={chartContainerRef}>\n            {/* Y-axis of the chart */}\n            {yAxis}\n            <div className=\"openui-area-chart-main-container\" ref={mainContainerRef}>\n              <ChartContainer\n                config={chartConfig}\n                style={{ width: dataWidth, minWidth: \"100%\", height: chartHeight }}\n                rechartsProps={{\n                  width: \"100%\",\n                  height: \"100%\",\n                  minHeight: 1,\n                  minWidth: 1,\n                  initialDimension: { width: 1, height: 1 },\n                }}\n              >\n                <RechartsAreaChart\n                  accessibilityLayer\n                  key={`area-chart-${id}`}\n                  data={data}\n                  margin={{\n                    top: 20,\n                    bottom: CHART_CONTAINER_BOTTOM_MARGIN,\n                  }}\n                  onClick={onAreaClick}\n                >\n                  {grid && cartesianGrid()}\n                  <XAxis\n                    dataKey={categoryKey as string}\n                    tickLine={false}\n                    axisLine={false}\n                    textAnchor=\"middle\"\n                    interval={0}\n                    height={maxLabelHeight}\n                    tick={\n                      <XAxisTick\n                        variant={tickVariant}\n                        widthOfGroup={widthOfGroup}\n                        labelHeight={maxLabelHeight}\n                      />\n                    }\n                    orientation=\"bottom\"\n                    padding={{\n                      left: X_AXIS_PADDING,\n                      right: X_AXIS_PADDING,\n                    }}\n                  />\n\n                  <ChartTooltip\n                    content={<CustomTooltipContent parentRef={mainContainerRef} />}\n                    offset={15}\n                  />\n\n                  {dataKeys.map((key) => {\n                    const transformedKey = transformedKeys[key];\n                    const color = `var(--color-${transformedKey})`;\n                    return (\n                      <defs key={`gradient-${transformedKey}`}>\n                        <linearGradient\n                          id={`${gradientID}-${transformedKey}`}\n                          x1=\"0\"\n                          y1=\"0\"\n                          x2=\"0\"\n                          y2=\"1\"\n                        >\n                          <stop offset=\"5%\" stopColor={color} stopOpacity={0.6} />\n                          <stop offset=\"95%\" stopColor={color} stopOpacity={0} />\n                        </linearGradient>\n                      </defs>\n                    );\n                  })}\n\n                  {dataKeys.map((key) => {\n                    const transformedKey = transformedKeys[key];\n                    const color = `var(--color-${transformedKey})`;\n                    return (\n                      <Area\n                        key={`main-${key}`}\n                        dataKey={key}\n                        type={variant}\n                        stroke={color}\n                        fill={`url(#${gradientID}-${transformedKey})`}\n                        fillOpacity={1}\n                        stackId=\"a\"\n                        activeDot={<ActiveDot key={`active-dot-${key}-${id}`} />}\n                        dot={false}\n                        isAnimationActive={isAnimationActive}\n                      />\n                    );\n                  })}\n                </RechartsAreaChart>\n              </ChartContainer>\n            </div>\n            {isSideBarTooltipOpen && <SideBarTooltip height={chartHeight} />}\n          </div>\n          {/* if the data width is greater than the effective width, then show the scroll buttons */}\n          <ScrollButtonsHorizontal\n            dataWidth={dataWidth}\n            effectiveWidth={effectiveWidth}\n            canScrollLeft={canScrollLeft}\n            canScrollRight={canScrollRight}\n            isSideBarTooltipOpen={isSideBarTooltipOpen}\n            onScrollLeft={scrollLeft}\n            onScrollRight={scrollRight}\n          />\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              yAxisLabel={yAxisLabel}\n              xAxisLabel={xAxisLabel}\n              containerWidth={effectiveWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </SideBarTooltipProvider>\n    </LabelTooltipProvider>\n  );\n};\n\n// Added React.memo for performance optimization to avoid unnecessary re-renders\nexport const AreaChart = React.memo(AreaChartComponent) as typeof AreaChartComponent;\n","import clsx from \"clsx\";\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Area, AreaChart as RechartsAreaChart, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { AreaChartData, AreaChartVariant } from \"../AreaChart/types\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { DEFAULT_X_AXIS_HEIGHT, X_AXIS_PADDING } from \"../constants\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport {\n  useAutoAngleCalculation,\n  useExportChartData,\n  useMaxLabelWidth,\n  useTransformedKeys,\n  useYAxisLabelWidth,\n} from \"../hooks\";\nimport {\n  ActiveDot,\n  cartesianGrid,\n  CustomTooltipContent,\n  DefaultLegend,\n  SideBarTooltip,\n  SVGXAxisTick,\n  SVGXAxisTickVariant,\n  YAxisTick,\n} from \"../shared\";\nimport { LabelTooltipProvider } from \"../shared/LabelTooltip/LabelTooltip\";\nimport { LegendItem } from \"../types\";\nimport { getLineType } from \"../utils/AreaAndLine/common\";\nimport {\n  get2dChartConfig,\n  getColorForDataKey,\n  getDataKeys,\n  getLegendItems,\n} from \"../utils/dataUtils\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\n\n// this a technic to get the type of the onClick event of the area chart\n// we need to do this because the onClick event type is not exported by recharts\ntype AreaChartOnClick = React.ComponentProps<typeof RechartsAreaChart>[\"onClick\"];\ntype AreaClickData = Parameters<NonNullable<AreaChartOnClick>>[0];\n\nexport interface AreaChartCondensedProps<T extends AreaChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: AreaChartVariant;\n  tickVariant?: SVGXAxisTickVariant;\n  grid?: boolean;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  showYAxis?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  legend?: boolean;\n  className?: string;\n  height?: number;\n  width?: number;\n}\n\nconst CHART_HEIGHT = 296;\nconst CHART_CONTAINER_BOTTOM_MARGIN = 10;\n\nconst AreaChartCondensedComponent = <T extends AreaChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant: areaChartVariant = \"natural\",\n  tickVariant = \"singleLine\",\n  grid = true,\n  icons = {},\n  isAnimationActive = false,\n  showYAxis = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  className,\n  height = CHART_HEIGHT,\n  width,\n}: AreaChartCondensedProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const variant = getLineType(areaChartVariant);\n\n  const { yAxisWidth, setLabelWidth } = useYAxisLabelWidth(data, dataKeys);\n\n  const maxLabelWidth = useMaxLabelWidth(data, categoryKey as string);\n\n  const chartContainerRef = useRef<HTMLDivElement>(null);\n  const [chartContainerWidth, setChartContainerWidth] = useState<number>(0);\n\n  const widthOfData = useMemo(() => {\n    if (data.length === 0) {\n      return 0;\n    }\n    // Use passed width if available, otherwise use observed chartContainerWidth\n    const chartWidth = width ?? chartContainerWidth;\n    return chartWidth / data.length;\n  }, [width, chartContainerWidth, data]);\n\n  const { angle: calculatedAngle, height: xAxisHeight } = useAutoAngleCalculation(\n    maxLabelWidth,\n    tickVariant === \"angled\",\n    // if the max label width is less than 100px, then we use the width of the data to calculate the angle, gives better results for small datasets\n    maxLabelWidth < 100 ? widthOfData : undefined,\n  );\n\n  const isAngled = useMemo(() => {\n    return calculatedAngle !== 0;\n  }, [calculatedAngle]);\n\n  const effectiveHeight = useMemo(() => {\n    if (tickVariant === \"angled\") {\n      return xAxisHeight + height;\n    }\n    return height + DEFAULT_X_AXIS_HEIGHT;\n  }, [height, xAxisHeight, tickVariant]);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"areaChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  const id = useId();\n\n  const exportData = useExportChartData({\n    type: \"area\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n  });\n  const gradientID = useMemo(() => `area-chart-condensed-gradient-${id}`, [id]);\n\n  const chartMargin = useMemo(\n    () => ({\n      top: 10,\n      right: 10,\n      bottom: CHART_CONTAINER_BOTTOM_MARGIN,\n      left: showYAxis ? 10 : 0,\n    }),\n    [showYAxis],\n  );\n\n  const onAreaClick = useCallback(\n    (data: AreaClickData) => {\n      if (data?.activePayload?.length && data.activePayload.length > 10) {\n        setIsSideBarTooltipOpen(true);\n        setSideBarTooltipData({\n          title: data.activeLabel as string,\n          values: data.activePayload.map((payload) => ({\n            value: payload.value as number,\n            label: payload.name || payload.dataKey,\n            color: getColorForDataKey(payload.dataKey, dataKeys, colors),\n          })),\n        });\n      }\n    },\n    [dataKeys, colors],\n  );\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n\n  // Use provided width or observed width\n  const effectiveWidth = useMemo(() => {\n    return width ?? containerWidth;\n  }, [width, containerWidth]);\n\n  // Observe container width for legend\n  useEffect(() => {\n    // Only set up ResizeObserver if width is not provided\n    if (width || !containerRef.current || !chartContainerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are observing the chart container\n      for (const entry of entries) {\n        if (entry.target === containerRef.current) {\n          setContainerWidth(entry.contentRect.width);\n        }\n        if (entry.target === chartContainerRef.current) {\n          setChartContainerWidth(entry.contentRect.width);\n        }\n      }\n    });\n\n    resizeObserver.observe(containerRef.current);\n    resizeObserver.observe(chartContainerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, [width]);\n\n  useEffect(() => {\n    setIsLegendExpanded(false);\n  }, [dataKeys]);\n\n  // Memoize legend items creation\n  const legendItems: LegendItem[] = useMemo(() => {\n    if (!legend) {\n      return [];\n    }\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons, legend]);\n\n  const yAxis = useMemo(() => {\n    if (!showYAxis) {\n      return null;\n    }\n    return (\n      <div className=\"openui-area-chart-condensed-y-axis-container\">\n        {/* Y-axis only chart - synchronized with main chart */}\n        <RechartsAreaChart\n          key={`y-axis-area-chart-condensed-${id}`}\n          width={yAxisWidth}\n          height={effectiveHeight}\n          data={data}\n          margin={{\n            top: chartMargin.top,\n            bottom: xAxisHeight + chartMargin.bottom, // this is required to give space for x-axis\n            left: 0,\n            right: 0,\n          }}\n        >\n          <YAxis\n            width={yAxisWidth}\n            tickLine={false}\n            axisLine={false}\n            tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n          />\n          {/* Invisible areas to maintain scale synchronization */}\n          {dataKeys.map((key) => {\n            return (\n              <Area\n                key={`yaxis-area-chart-condensed-${key}`}\n                dataKey={key}\n                fill=\"transparent\"\n                stroke=\"transparent\"\n                stackId=\"a\"\n                isAnimationActive={false}\n              />\n            );\n          })}\n        </RechartsAreaChart>\n      </div>\n    );\n  }, [\n    showYAxis,\n    effectiveHeight,\n    data,\n    dataKeys,\n    id,\n    yAxisWidth,\n    chartMargin,\n    xAxisHeight,\n    setLabelWidth,\n  ]);\n\n  return (\n    <LabelTooltipProvider>\n      <SideBarTooltipProvider\n        isSideBarTooltipOpen={isSideBarTooltipOpen}\n        setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n        data={sideBarTooltipData}\n        setData={setSideBarTooltipData}\n      >\n        <div\n          className={clsx(\"openui-area-chart-condensed-container\", className)}\n          data-openui-chart={exportData}\n          style={{\n            width: width ? `${width}px` : undefined,\n          }}\n        >\n          {yAxisLabel && (\n            <div className=\"openui-area-chart-condensed-y-axis-label\">{yAxisLabel}</div>\n          )}\n          <div className=\"openui-area-chart-condensed-container-inner\" ref={containerRef}>\n            {/* Y-axis of the chart */}\n            {yAxis}\n            <div className=\"openui-area-chart-condensed\" ref={chartContainerRef}>\n              <ChartContainer\n                config={chartConfig}\n                style={{ width: \"100%\", height: effectiveHeight }}\n                rechartsProps={{\n                  width: \"100%\",\n                  height: \"100%\",\n                }}\n              >\n                <RechartsAreaChart\n                  accessibilityLayer\n                  key={`area-chart-condensed-${id}`}\n                  data={data}\n                  margin={chartMargin}\n                  onClick={onAreaClick}\n                >\n                  {grid && cartesianGrid()}\n\n                  <XAxis\n                    dataKey={categoryKey as string}\n                    tickLine={false}\n                    axisLine={false}\n                    textAnchor={isAngled ? \"end\" : \"middle\"}\n                    interval=\"preserveStartEnd\"\n                    minTickGap={5}\n                    height={xAxisHeight}\n                    tick={<SVGXAxisTick />}\n                    angle={calculatedAngle}\n                    orientation=\"bottom\"\n                    padding={{\n                      left: X_AXIS_PADDING,\n                      right: X_AXIS_PADDING,\n                    }}\n                  />\n                  {/* Y-axis is rendered in the separate synchronized chart */}\n\n                  <ChartTooltip\n                    content={<CustomTooltipContent parentRef={containerRef} />}\n                    offset={10}\n                  />\n\n                  {dataKeys.map((key) => {\n                    const transformedKey = transformedKeys[key];\n                    const color = `var(--color-${transformedKey})`;\n                    return (\n                      <defs key={`gradient-${transformedKey}`}>\n                        <linearGradient\n                          id={`${gradientID}-${transformedKey}`}\n                          x1=\"0\"\n                          y1=\"0\"\n                          x2=\"0\"\n                          y2=\"1\"\n                        >\n                          <stop offset=\"5%\" stopColor={color} stopOpacity={0.6} />\n                          <stop offset=\"95%\" stopColor={color} stopOpacity={0} />\n                        </linearGradient>\n                      </defs>\n                    );\n                  })}\n\n                  {dataKeys.map((key) => {\n                    const transformedKey = transformedKeys[key];\n                    const color = `var(--color-${transformedKey})`;\n                    return (\n                      <Area\n                        key={`area-${key}`}\n                        dataKey={key}\n                        type={variant}\n                        stroke={color}\n                        fill={`url(#${gradientID}-${transformedKey})`}\n                        fillOpacity={1}\n                        stackId=\"a\"\n                        activeDot={<ActiveDot key={`active-dot-${key}-${id}`} />}\n                        dot={false}\n                        isAnimationActive={isAnimationActive}\n                        // strokeWidth={2}\n                      />\n                    );\n                  })}\n                </RechartsAreaChart>\n              </ChartContainer>\n            </div>\n            {isSideBarTooltipOpen && <SideBarTooltip height={effectiveHeight} />}\n          </div>\n          {xAxisLabel && (\n            <div className=\"openui-area-chart-condensed-x-axis-label\">{xAxisLabel}</div>\n          )}\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              containerWidth={effectiveWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </SideBarTooltipProvider>\n    </LabelTooltipProvider>\n  );\n};\n\n// Added React.memo for performance optimization to avoid unnecessary re-renders\nexport const AreaChartCondensed = React.memo(\n  AreaChartCondensedComponent,\n) as typeof AreaChartCondensedComponent;\n","import { BarChartVariant } from \"../../types\";\n\nexport const getRadiusArray = (\n  variant: BarChartVariant,\n  radius: number,\n  orientation: \"vertical\" | \"horizontal\",\n  isFirst?: boolean,\n  isLast?: boolean,\n  isNegative?: boolean,\n): [number, number, number, number] => {\n  if (variant === \"grouped\") {\n    if (orientation === \"vertical\") {\n      if (isNegative) {\n        return [0, 0, radius, radius]; // bottom-right, bottom-left for negative bars\n      }\n      return [radius, radius, 0, 0]; // top-left, top-right for positive bars\n    } else {\n      // horizontal\n      if (isNegative) {\n        return [radius, 0, 0, radius]; // top-left, bottom-left for negative bars\n      }\n      return [0, radius, radius, 0]; // top-right, bottom-right for positive bars\n    }\n  } else if (variant === \"stacked\") {\n    // For single-item stacks, round the end of the bar.\n    if (isFirst && isLast) {\n      if (orientation === \"vertical\") {\n        return isNegative ? [0, 0, radius, radius] : [radius, radius, 0, 0];\n      } else {\n        // horizontal\n        return isNegative ? [radius, 0, 0, radius] : [0, radius, radius, 0];\n      }\n    }\n\n    // For multi-item stacks, only round the last bar in the stack.\n    if (orientation === \"vertical\") {\n      if (isLast) {\n        // Top of the stack for vertical bar\n        if (isNegative) {\n          return [0, 0, radius, radius];\n        }\n        return [radius, radius, 0, 0];\n      }\n    } else {\n      // horizontal\n      if (isLast) {\n        // Right of the stack for horizontal bar\n        if (isNegative) {\n          return [radius, 0, 0, radius];\n        }\n        return [0, radius, radius, 0];\n      }\n    }\n    // First and middle bars of the stack have no rounding.\n    return [0, 0, 0, 0];\n  }\n  // Default or other variants\n  return [radius, radius, radius, radius];\n};\n\nexport const findNearestSnapPosition = (\n  snapPositions: number[],\n  currentScroll: number,\n  direction: \"up\" | \"down\" | \"left\" | \"right\",\n): number => {\n  // Find current position index\n  let currentIndex = 0;\n  for (let i = 0; i < snapPositions.length; i++) {\n    const snapPosition = snapPositions[i]!;\n    if (currentScroll >= snapPosition) {\n      currentIndex = i;\n    } else {\n      break;\n    }\n  }\n\n  if (direction === \"up\" || direction === \"left\") {\n    // Go to previous snap position\n    return Math.max(0, currentIndex - 1);\n  } else {\n    // Go to next snap position\n    return Math.min(snapPositions.length - 1, currentIndex + 1);\n  }\n};\n\nexport interface BarStackInfo {\n  isNegative: boolean;\n  isFirstInStack?: boolean;\n  isLastInStack?: boolean;\n  hasNegativeValueInStack?: boolean;\n}\n\nexport function getBarStackInfo(\n  variant: \"grouped\" | \"stacked\",\n  value: number | [number, number],\n  dataKey: string,\n  payload: Record<string, unknown>,\n  dataKeys: string[],\n): BarStackInfo {\n  const isNegative = Array.isArray(value) ? value[0] <= 0 && value[1] < 0 : value < 0;\n\n  if (variant !== \"stacked\") {\n    return { isNegative };\n  }\n\n  const stackedKeys = dataKeys.filter((k) => typeof payload[k] === \"number\");\n  const positiveKeys = stackedKeys.filter((k) => (payload[k] as number) >= 0);\n  const negativeKeys = stackedKeys.filter((k) => (payload[k] as number) < 0);\n  const hasNegativeValueInStack = negativeKeys.length > 0;\n\n  const keys = isNegative ? negativeKeys : positiveKeys;\n  const currentIndex = keys.indexOf(dataKey);\n  const isFirstInStack = currentIndex === 0;\n  const isLastInStack = currentIndex === keys.length - 1;\n\n  return {\n    isNegative,\n    isFirstInStack,\n    isLastInStack,\n    hasNegativeValueInStack,\n  };\n}\n","import { getDataKeys } from \"../../utils/dataUtils\";\nimport { BarChartVariant } from \"../types\";\n\nexport const BAR_WIDTH = 16;\n\n// Internal constants - not exported as they're only used within this file\nconst ELEMENT_SPACING_GROUPED = 56; // Spacing per bar in grouped charts\n\nconst ELEMENT_SPACING_STACKED = 56; // Spacing per stack in stacked charts\n\n/**\n * INTERNAL HELPER FUNCTION\n * Get the appropriate element spacing based on chart variant\n * @param variant - The chart variant\n * @returns The spacing value for the given variant\n */\nconst getElementSpacing = (variant: BarChartVariant): number => {\n  switch (variant) {\n    case \"stacked\":\n      return ELEMENT_SPACING_STACKED;\n    case \"grouped\":\n    default:\n      return ELEMENT_SPACING_GROUPED;\n  }\n};\n\n/**\n * This function returns the width of the data in the chart, used for padding calculation, scroll amount calculation, and\n * for the width of the chart container.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param variant - The variant of the chart.\n */\nconst getWidthOfData = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  variant: BarChartVariant,\n) => {\n  if (data.length === 0) {\n    return 0;\n  }\n\n  const width = data.length * getWidthOfGroup(data, categoryKey, variant);\n\n  if (data.length === 1) {\n    const minSingleDataWidth = 200; // Minimum width for single data points\n    return Math.max(width, minSingleDataWidth);\n  }\n  return width;\n};\n\n/**\n * This function returns the padding for the chart, used for the padding of the chart container.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param containerWidth - The width of the container of the chart.\n * @param variant - The variant of the chart.\n */\nconst getPadding = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  containerWidth: number,\n  variant: BarChartVariant,\n) => {\n  const chartWidth = getWidthOfData(data, categoryKey, variant);\n  const paddingValue = containerWidth - chartWidth;\n\n  if (paddingValue < 0) {\n    // If chart content is wider than container, no padding\n    return {\n      left: 10,\n      right: 10,\n    };\n  } else {\n    return {\n      left: paddingValue / 2,\n      right: paddingValue / 2,\n    };\n  }\n};\n\n/**\n * This function returns the scroll amount for the chart, used for the scroll amount of the chart.\n * This can also be used to calculate the width of each group/category.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param variant - The variant of the chart.\n */\nconst getWidthOfGroup = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  variant: BarChartVariant,\n) => {\n  if (data.length === 0) return 200; // Fallback\n\n  // Get the number of data keys (excluding categoryKey)\n  const dataKeys = getDataKeys(data, categoryKey);\n  const elementSpacing = getElementSpacing(variant);\n\n  if (variant === \"stacked\") {\n    // For stacked: each category is one stack\n    // Example: month \"January\" = 1 stack = BAR_WIDTH + ELEMENT_SPACING_STACKED (60)\n    return BAR_WIDTH + elementSpacing;\n  } else {\n    // For grouped: each category contains multiple bars\n    // Example: month \"January\" with desktop+mobile+tablet = 3 bars\n    // Width = 3 * (BAR_WIDTH + gap between bars) - gap between bars for the last bar + elementSpacing\n    const seriesPerCategory = dataKeys.length;\n    return seriesPerCategory * (BAR_WIDTH + 8) - 8 + elementSpacing;\n  }\n};\n\n/**\n * This function returns the snap positions for the chart, used for the snap positions of the chart.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param variant - The variant of the chart.\n * @returns The snap positions for the chart.\n */\nconst getSnapPositions = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  variant: BarChartVariant,\n): number[] => {\n  if (data.length === 0) return [0];\n\n  const positions = [0]; // Start position\n  const groupWidthValue = getWidthOfGroup(data, categoryKey, variant);\n\n  // Calculate all valid snap positions based on groups\n  for (let i = 1; i < data.length; i++) {\n    positions.push(i * groupWidthValue);\n  }\n\n  return positions;\n};\n\nexport { getPadding, getSnapPositions, getWidthOfData, getWidthOfGroup };\n","import clsx from \"clsx\";\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Bar, BarChart as RechartsBarChart, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport {\n  useExportChartData,\n  useMaxLabelHeight,\n  useTransformedKeys,\n  useYAxisLabelWidth,\n} from \"../hooks\";\nimport {\n  cartesianGrid,\n  CustomTooltipContent,\n  DefaultLegend,\n  LineInBarShape,\n  SideBarTooltip,\n  XAxisTick,\n  XAxisTickProps,\n  YAxisTick,\n} from \"../shared\";\n\nimport { ScrollButtonsHorizontal } from \"../shared/ScrollButtonsHorizontal/ScrollButtonsHorizontal\";\nimport { XAxisTickVariant } from \"../types\";\nimport { type LegendItem } from \"../types/Legend\";\nimport { useChartPalette, type PaletteName } from \"../utils/PalletUtils\";\n\nimport { LabelTooltipProvider } from \"../shared/LabelTooltip/LabelTooltip\";\nimport {\n  findNearestSnapPosition,\n  getBarStackInfo,\n  getRadiusArray,\n} from \"../utils/BarCharts/BarChartsUtils\";\nimport {\n  get2dChartConfig,\n  getColorForDataKey,\n  getDataKeys,\n  getLegendItems,\n} from \"../utils/dataUtils\";\nimport { BarChartData, BarChartVariant } from \"./types\";\nimport {\n  BAR_WIDTH,\n  getPadding,\n  getSnapPositions,\n  getWidthOfData,\n  getWidthOfGroup,\n} from \"./utils/BarChartUtils\";\n\n// this a technic to get the type of the onClick event of the bar chart\n// we need to do this because the onClick event type is not exported by recharts\ntype BarChartOnClick = React.ComponentProps<typeof RechartsBarChart>[\"onClick\"];\ntype BarClickData = Parameters<NonNullable<BarChartOnClick>>[0];\nexport interface BarChartProps<T extends BarChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: BarChartVariant;\n  tickVariant?: XAxisTickVariant;\n  grid?: boolean;\n  radius?: number;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  showYAxis?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  legend?: boolean;\n  className?: string;\n  height?: number;\n  width?: number;\n}\n\nconst BAR_GAP = 10; // Gap between bars\nconst BAR_CATEGORY_GAP = \"20%\"; // Gap between categories\nconst BAR_INTERNAL_LINE_WIDTH = 1;\nconst BAR_RADIUS = 4;\nconst CHART_CONTAINER_BOTTOM_MARGIN = 10;\n\nconst BarChartComponent = <T extends BarChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant = \"grouped\",\n  tickVariant = \"multiLine\",\n  grid = true,\n  icons = {},\n  radius,\n  isAnimationActive = false,\n  showYAxis = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  className,\n  height,\n  width,\n}: BarChartProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const widthOfGroup = getWidthOfGroup(data, categoryKey as string, variant);\n\n  const maxLabelHeight = useMaxLabelHeight(data, categoryKey as string, tickVariant, widthOfGroup);\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const { yAxisWidth, setLabelWidth } = useYAxisLabelWidth(data, dataKeys);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"barChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  const chartContainerRef = useRef<HTMLDivElement>(null);\n  const mainContainerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [canScrollLeft, setCanScrollLeft] = useState(false);\n  const [canScrollRight, setCanScrollRight] = useState(false);\n  const [hoveredCategory, setHoveredCategory] = useState<string | number | null>(null);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n\n  // Use provided width or observed width\n  const effectiveWidth = useMemo(() => {\n    return width ?? containerWidth;\n  }, [width, containerWidth]);\n\n  // need this to calculate the padding for the chart container, because the y-axis is rendered in a separate chart\n  const effectiveContainerWidth = useMemo(() => {\n    const dynamicYAxisWidth = showYAxis ? yAxisWidth : 0;\n    return Math.max(0, effectiveWidth - dynamicYAxisWidth);\n  }, [effectiveWidth, showYAxis, yAxisWidth]);\n\n  const padding = useMemo(() => {\n    return getPadding(data, categoryKey as string, effectiveContainerWidth, variant);\n  }, [data, categoryKey, effectiveContainerWidth, variant]);\n\n  const dataWidth = useMemo(() => {\n    return getWidthOfData(data, categoryKey as string, variant);\n  }, [data, categoryKey, variant]);\n\n  // Calculate snap positions for proper group alignment\n  const snapPositions = useMemo(() => {\n    return getSnapPositions(data, categoryKey as string, variant);\n  }, [data, categoryKey, variant]);\n\n  // self note:\n  // Use provided height or calculated height based on container width\n  // if height is provided, it will be used to set the height of the chart\n  // if height is not provided, it will be calculated based on the container width (effectiveWidth)\n  // getChartHeight(effectiveWidth) this function is not used here, request of the designer, we will use fix height\n  // 296 is the height of the chart by default, given by designer\n  // we want to chart to scale with width but height will be fixed\n\n  const chartHeight = useMemo(() => {\n    return height ?? 296 + maxLabelHeight;\n  }, [height, maxLabelHeight]);\n\n  // Check scroll boundaries\n  const updateScrollState = useCallback(() => {\n    if (mainContainerRef.current) {\n      const { scrollLeft, scrollWidth, clientWidth } = mainContainerRef.current;\n      setCanScrollLeft(scrollLeft > 0);\n      setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 1); // -1 for floating point precision\n    }\n  }, []);\n\n  const scrollLeft = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollLeft;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"left\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        left: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  const scrollRight = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollLeft;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"right\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        left: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  useEffect(() => {\n    // Only set up ResizeObserver if width is not provided\n    if (width || !chartContainerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are observing the chart container\n      for (const entry of entries) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    resizeObserver.observe(chartContainerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, [width]);\n\n  // Update scroll state when container width or data width changes\n  useEffect(() => {\n    updateScrollState();\n  }, [effectiveWidth, dataWidth, updateScrollState]);\n\n  useEffect(() => {\n    setIsSideBarTooltipOpen(false);\n    setIsLegendExpanded(false);\n  }, [dataKeys]);\n\n  // Add scroll event listener to update button states\n  useEffect(() => {\n    const mainContainer = mainContainerRef.current;\n    if (!mainContainer) return;\n\n    const handleScroll = () => {\n      updateScrollState();\n    };\n\n    mainContainer.addEventListener(\"scroll\", handleScroll);\n    return () => {\n      mainContainer.removeEventListener(\"scroll\", handleScroll);\n    };\n  }, [updateScrollState]);\n\n  // Memoize legend items creation\n  const legendItems: LegendItem[] = useMemo(() => {\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons]);\n\n  const exportData = useExportChartData({\n    type: \"bar\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n  });\n\n  const id = useId();\n\n  const yAxis = useMemo(() => {\n    if (!showYAxis) {\n      return null;\n    }\n    return (\n      <div className=\"openui-bar-chart-y-axis-container\">\n        {/* Y-axis only chart - synchronized with main chart */}\n        <RechartsBarChart\n          key={`y-axis-bar-chart-${id}`}\n          width={yAxisWidth}\n          height={chartHeight}\n          data={data}\n          stackOffset=\"sign\"\n          margin={{\n            top: 20,\n            bottom: maxLabelHeight + CHART_CONTAINER_BOTTOM_MARGIN, // this is required for to give space for x-axis\n            left: 0,\n            right: 0,\n          }}\n        >\n          <YAxis\n            width={yAxisWidth}\n            tickLine={false}\n            axisLine={false}\n            tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n          />\n          {/* Invisible bars to maintain scale synchronization */}\n          {dataKeys.map((key) => {\n            return (\n              <Bar\n                key={`yaxis-bar-chart-${key}`}\n                dataKey={key}\n                fill=\"transparent\"\n                stackId={variant === \"stacked\" ? \"a\" : undefined}\n                isAnimationActive={false}\n                maxBarSize={0}\n              />\n            );\n          })}\n        </RechartsBarChart>\n      </div>\n    );\n  }, [showYAxis, chartHeight, data, dataKeys, variant, id, maxLabelHeight, yAxisWidth]);\n\n  // Handle mouse events for group hovering\n  const handleChartMouseMove = useCallback((state: any) => {\n    if (state && state.activeLabel !== undefined) {\n      setHoveredCategory(state.activeLabel);\n    }\n  }, []);\n\n  const handleChartMouseLeave = useCallback(() => {\n    setHoveredCategory(null);\n  }, []);\n\n  const handleXAxisTickMouseEnter = useCallback((tickProps: XAxisTickProps) => {\n    if (typeof tickProps.payload?.value === \"string\") {\n      setHoveredCategory(tickProps.payload.value);\n    }\n  }, []);\n\n  const handleXAxisTickMouseLeave = useCallback(() => {\n    setHoveredCategory(null);\n  }, []);\n\n  const { mode, theme: userTheme } = useTheme();\n\n  const barInternalLineColor = useMemo(() => {\n    if (mode === \"light\") {\n      return \"rgba(255, 255, 255, 0.3)\";\n    }\n    return \"rgba(0, 0, 0, 0.3)\";\n  }, [mode]);\n\n  const calculatedRadius = useMemo(() => {\n    let radiusValue: number = BAR_RADIUS;\n\n    if (typeof radius === \"number\") {\n      radiusValue = radius;\n    } else {\n      const radiusTheme = userTheme.radius2xs;\n      if (radiusTheme) {\n        radiusValue = typeof radiusTheme === \"string\" ? parseInt(radiusTheme) : radiusTheme;\n      }\n    }\n\n    return radiusValue;\n  }, [userTheme.radius2xs, radius]);\n\n  const onBarsClick = useCallback(\n    (data: BarClickData) => {\n      if (data?.activePayload?.length && data.activePayload.length > 10) {\n        setIsSideBarTooltipOpen(true);\n        setSideBarTooltipData({\n          title: data.activeLabel as string,\n          values: data.activePayload.map((payload) => ({\n            value: payload.value as number,\n            label: payload.name || payload.dataKey,\n            color: getColorForDataKey(payload.dataKey, dataKeys, colors),\n          })),\n        });\n      }\n    },\n    [dataKeys, colors],\n  );\n\n  const barElements = useMemo(() => {\n    return dataKeys.map((key) => {\n      const transformedKey = transformedKeys[key];\n      const color = `var(--color-${transformedKey})`;\n\n      return (\n        <Bar\n          key={`main-${key}`}\n          dataKey={key}\n          fill={color}\n          stackId={variant === \"stacked\" ? \"a\" : undefined}\n          isAnimationActive={isAnimationActive}\n          maxBarSize={BAR_WIDTH}\n          barSize={BAR_WIDTH}\n          shape={(props: any) => {\n            const { payload, value, dataKey } = props;\n\n            const { isNegative, isFirstInStack, isLastInStack, hasNegativeValueInStack } =\n              getBarStackInfo(variant, value, dataKey, payload, dataKeys);\n\n            const customRadius = getRadiusArray(\n              variant,\n              calculatedRadius,\n              \"vertical\",\n              isFirstInStack,\n              isLastInStack,\n              isNegative,\n            );\n\n            return (\n              <LineInBarShape\n                {...props}\n                radius={customRadius}\n                internalLineColor={barInternalLineColor}\n                internalLineWidth={BAR_INTERNAL_LINE_WIDTH}\n                isHovered={hoveredCategory !== null}\n                hoveredCategory={hoveredCategory}\n                categoryKey={categoryKey as string}\n                variant={variant}\n                hasNegativeValueInStack={hasNegativeValueInStack}\n              />\n            );\n          }}\n        />\n      );\n    });\n  }, [\n    dataKeys,\n    transformedKeys,\n    variant,\n    calculatedRadius,\n    isAnimationActive,\n    barInternalLineColor,\n    hoveredCategory,\n    categoryKey,\n  ]);\n\n  return (\n    <LabelTooltipProvider>\n      <SideBarTooltipProvider\n        isSideBarTooltipOpen={isSideBarTooltipOpen}\n        setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n        data={sideBarTooltipData}\n        setData={setSideBarTooltipData}\n      >\n        <div\n          className={clsx(\"openui-bar-chart-container\", className)}\n          data-openui-chart={exportData}\n          style={{\n            width: width ? `${width}px` : undefined,\n          }}\n        >\n          <div className=\"openui-bar-chart-container-inner\" ref={chartContainerRef}>\n            {/* Y-axis of the chart */}\n            {yAxis}\n            <div className=\"openui-bar-chart-main-container\" ref={mainContainerRef}>\n              <ChartContainer\n                config={chartConfig}\n                style={{ width: dataWidth, minWidth: \"100%\", height: chartHeight }}\n                rechartsProps={{\n                  width: \"100%\",\n                  height: \"100%\",\n                  minHeight: 1,\n                  minWidth: 1,\n                  initialDimension: { width: 1, height: 1 },\n                }}\n              >\n                <RechartsBarChart\n                  stackOffset=\"sign\"\n                  accessibilityLayer\n                  key={`bar-chart-${id}`}\n                  data={data}\n                  margin={{\n                    top: 20,\n                    bottom: CHART_CONTAINER_BOTTOM_MARGIN,\n                  }}\n                  onClick={onBarsClick}\n                  onMouseMove={handleChartMouseMove}\n                  onMouseLeave={handleChartMouseLeave}\n                  barGap={BAR_GAP}\n                  barCategoryGap={BAR_CATEGORY_GAP}\n                >\n                  {grid && cartesianGrid()}\n                  <XAxis\n                    dataKey={categoryKey as string}\n                    tickLine={false}\n                    axisLine={false}\n                    textAnchor={\"middle\"}\n                    interval={0}\n                    height={maxLabelHeight}\n                    tick={\n                      <XAxisTick\n                        variant={tickVariant}\n                        widthOfGroup={widthOfGroup}\n                        labelHeight={maxLabelHeight}\n                        onMouseEnter={handleXAxisTickMouseEnter}\n                        onMouseLeave={handleXAxisTickMouseLeave}\n                      />\n                    }\n                    orientation=\"bottom\"\n                    // gives the padding on the 2 sides see the function for reference\n                    padding={padding}\n                  />\n                  {/* Y-axis is rendered in the separate synchronized chart */}\n\n                  <ChartTooltip\n                    // cursor={<SimpleCursor />}\n                    cursor={{\n                      fill: \"var(--openui-highlight)\",\n                      stroke: \"var(--openui-stroke-default)\",\n                      opacity: 1,\n                      strokeWidth: 1,\n                    }}\n                    content={<CustomTooltipContent parentRef={mainContainerRef} />}\n                    offset={15}\n                  />\n\n                  {barElements}\n                </RechartsBarChart>\n              </ChartContainer>\n            </div>\n            {isSideBarTooltipOpen && <SideBarTooltip height={chartHeight} />}\n          </div>\n          {/* if the data width is greater than the effective width, then show the scroll buttons */}\n          <ScrollButtonsHorizontal\n            dataWidth={dataWidth}\n            effectiveWidth={effectiveWidth}\n            canScrollLeft={canScrollLeft}\n            canScrollRight={canScrollRight}\n            isSideBarTooltipOpen={isSideBarTooltipOpen}\n            onScrollLeft={scrollLeft}\n            onScrollRight={scrollRight}\n          />\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              yAxisLabel={yAxisLabel}\n              xAxisLabel={xAxisLabel}\n              containerWidth={effectiveWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </SideBarTooltipProvider>\n    </LabelTooltipProvider>\n  );\n};\n\n// Added React.memo for performance optimization to avoid unnecessary re-renders\nexport const BarChart = React.memo(BarChartComponent) as typeof BarChartComponent;\n","import clsx from \"clsx\";\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Bar, BarChart as RechartsBarChart, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { BarChartData, BarChartVariant } from \"../BarChart/types\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { DEFAULT_X_AXIS_HEIGHT, X_AXIS_PADDING } from \"../constants\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport {\n  useAutoAngleCalculation,\n  useExportChartData,\n  useMaxLabelWidth,\n  useTransformedKeys,\n  useYAxisLabelWidth,\n} from \"../hooks\";\nimport {\n  cartesianGrid,\n  CustomTooltipContent,\n  DefaultLegend,\n  LineInBarShape,\n  SideBarTooltip,\n  SVGXAxisTick,\n  SVGXAxisTickVariant,\n  YAxisTick,\n} from \"../shared\";\nimport { LabelTooltipProvider } from \"../shared/LabelTooltip/LabelTooltip\";\nimport { LegendItem } from \"../types\";\nimport { getBarStackInfo, getRadiusArray } from \"../utils/BarCharts/BarChartsUtils\";\nimport {\n  get2dChartConfig,\n  getColorForDataKey,\n  getDataKeys,\n  getLegendItems,\n} from \"../utils/dataUtils\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\n\n// this a technic to get the type of the onClick event of the bar chart\n// we need to do this because the onClick event type is not exported by recharts\ntype BarChartOnClick = React.ComponentProps<typeof RechartsBarChart>[\"onClick\"];\ntype BarClickData = Parameters<NonNullable<BarChartOnClick>>[0];\n\nexport interface BarChartCondensedProps<T extends BarChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: BarChartVariant;\n  tickVariant?: SVGXAxisTickVariant;\n  grid?: boolean;\n  radius?: number;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  showYAxis?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  legend?: boolean;\n  className?: string;\n  height?: number;\n  width?: number;\n  /** Maximum bar width in pixels. Prevents bars from becoming too wide. Default: 12 */\n  maxBarWidth?: number;\n}\n\n// Default maximum bar width - prevents bars from becoming too wide with sparse data\nconst DEFAULT_MAX_BAR_WIDTH = 12;\n\n// Layout constants\nconst BAR_GAP = 10;\nconst BAR_CATEGORY_GAP = \"20%\";\nconst BAR_INTERNAL_LINE_WIDTH = 1;\nconst BAR_RADIUS = 4;\nconst CHART_HEIGHT = 296;\nconst CHART_CONTAINER_BOTTOM_MARGIN = 10;\n\nconst BarChartCondensedComponent = <T extends BarChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant = \"grouped\",\n  tickVariant = \"singleLine\",\n  grid = true,\n  icons = {},\n  radius,\n  isAnimationActive = false,\n  showYAxis = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  className,\n  height = CHART_HEIGHT,\n  width,\n  maxBarWidth = DEFAULT_MAX_BAR_WIDTH,\n}: BarChartCondensedProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const { yAxisWidth, setLabelWidth } = useYAxisLabelWidth(data, dataKeys);\n\n  const maxLabelWidth = useMaxLabelWidth(data, categoryKey as string);\n\n  const chartContainerRef = useRef<HTMLDivElement>(null);\n  const [chartContainerWidth, setChartContainerWidth] = useState<number>(0);\n\n  const widthOfData = useMemo(() => {\n    if (data.length === 0) {\n      return 0;\n    }\n    // Use passed width if available, otherwise use observed chartContainerWidth\n    const chartWidth = width ?? chartContainerWidth;\n    return chartWidth / data.length;\n  }, [chartContainerWidth, data, width]);\n\n  const { angle: calculatedAngle, height: xAxisHeight } = useAutoAngleCalculation(\n    maxLabelWidth,\n    tickVariant === \"angled\",\n    maxLabelWidth < 100 ? widthOfData : undefined,\n  );\n\n  const isAngled = useMemo(() => {\n    return calculatedAngle !== 0;\n  }, [calculatedAngle]);\n\n  const effectiveHeight = useMemo(() => {\n    if (tickVariant === \"angled\") {\n      return xAxisHeight + height;\n    }\n    return height + DEFAULT_X_AXIS_HEIGHT;\n  }, [height, xAxisHeight, tickVariant]);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"barChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  const id = useId();\n\n  const exportData = useExportChartData({\n    type: \"bar\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n  });\n\n  const chartMargin = useMemo(\n    () => ({\n      top: 10,\n      right: 10,\n      bottom: CHART_CONTAINER_BOTTOM_MARGIN,\n      left: showYAxis ? 10 : 0,\n    }),\n    [showYAxis],\n  );\n\n  const { mode, theme: userTheme } = useTheme();\n\n  const calculatedRadius = useMemo(() => {\n    let radiusValue: number = BAR_RADIUS;\n\n    if (typeof radius === \"number\") {\n      radiusValue = radius;\n    } else {\n      const radiusTheme = userTheme.radius2xs;\n      if (radiusTheme) {\n        radiusValue = typeof radiusTheme === \"string\" ? parseInt(radiusTheme) : radiusTheme;\n      }\n    }\n\n    return radiusValue;\n  }, [userTheme.radius2xs, radius]);\n\n  const barInternalLineColor = useMemo(() => {\n    if (mode === \"light\") {\n      return \"rgba(255, 255, 255, 0.3)\";\n    }\n    return \"rgba(0, 0, 0, 0.3)\";\n  }, [mode]);\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n  const [hoveredCategory, setHoveredCategory] = useState<string | number | null>(null);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n\n  // Use provided width or observed width\n  const effectiveWidth = useMemo(() => {\n    return width ?? containerWidth;\n  }, [width, containerWidth]);\n\n  // Calculate explicit chart width when width prop is provided\n  // This allows Recharts to calculate bar dimensions on first render\n  const explicitChartWidth = useMemo(() => {\n    if (!width) return undefined;\n    // Subtract Y-axis width and margins to get the actual chart area width\n    const yAxisSpace = showYAxis ? yAxisWidth : 0;\n    return width - yAxisSpace - chartMargin.left - chartMargin.right;\n  }, [width, showYAxis, yAxisWidth, chartMargin.left, chartMargin.right]);\n\n  // Calculate optimal bar width based on available space\n  // Only applies maximum constraint - Recharts handles thin bars automatically\n  const calculatedBarWidth = useMemo(() => {\n    // Use explicitChartWidth if available, otherwise fall back to chartContainerWidth\n    const availableWidth = explicitChartWidth ?? chartContainerWidth;\n\n    // If no width available, return undefined and let Recharts auto-size\n    if (!availableWidth || availableWidth === 0 || data.length === 0) {\n      return undefined;\n    }\n\n    // Calculate space per category (Recharts handles gaps automatically via barGap and barCategoryGap props)\n    const spacePerCategory = availableWidth / data.length;\n\n    // For grouped charts, multiple bars share the category space\n    const barsPerCategory = variant === \"stacked\" ? 1 : dataKeys.length;\n\n    // Simple division - let Recharts apply gaps via barGap and barCategoryGap props\n    const barWidth = spacePerCategory / barsPerCategory;\n\n    // Only apply maximum constraint, let Recharts handle thin bars automatically\n    return Math.min(maxBarWidth, barWidth);\n  }, [explicitChartWidth, chartContainerWidth, data.length, dataKeys.length, variant, maxBarWidth]);\n\n  // Handle mouse events for bar hovering\n  const handleChartMouseMove = useCallback((state: any) => {\n    if (state && state.activeLabel !== undefined) {\n      setHoveredCategory(state.activeLabel);\n    }\n  }, []);\n\n  const handleChartMouseLeave = useCallback(() => {\n    setHoveredCategory(null);\n  }, []);\n\n  const onBarClick = useCallback(\n    (data: BarClickData) => {\n      if (data?.activePayload?.length && data.activePayload.length > 10) {\n        setIsSideBarTooltipOpen(true);\n        setSideBarTooltipData({\n          title: data.activeLabel as string,\n          values: data.activePayload.map((payload) => ({\n            value: payload.value as number,\n            label: payload.name || payload.dataKey,\n            color: getColorForDataKey(payload.dataKey, dataKeys, colors),\n          })),\n        });\n      }\n    },\n    [dataKeys, colors],\n  );\n\n  // Observe container width for legend\n  useEffect(() => {\n    // Always set up ResizeObserver for chartContainerRef to get accurate bar width calculations\n    if (!chartContainerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are observing the chart container\n      for (const entry of entries) {\n        if (entry.target === containerRef.current && !width) {\n          // Only observe containerRef if width is not provided\n          setContainerWidth(entry.contentRect.width);\n        }\n        if (entry.target === chartContainerRef.current) {\n          setChartContainerWidth(entry.contentRect.width);\n        }\n      }\n    });\n\n    // Always observe chartContainerRef\n    resizeObserver.observe(chartContainerRef.current);\n\n    // Only observe containerRef if width is not provided\n    if (!width && containerRef.current) {\n      resizeObserver.observe(containerRef.current);\n    }\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, [width]);\n\n  useEffect(() => {\n    setIsLegendExpanded(false);\n  }, [dataKeys]);\n\n  // Memoize legend items creation\n  const legendItems: LegendItem[] = useMemo(() => {\n    if (!legend) {\n      return [];\n    }\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons, legend]);\n\n  const yAxis = useMemo(() => {\n    if (!showYAxis) {\n      return null;\n    }\n    return (\n      <div className=\"openui-bar-chart-condensed-y-axis-container\">\n        {/* Y-axis only chart - synchronized with main chart */}\n        <RechartsBarChart\n          key={`y-axis-bar-chart-condensed-${id}`}\n          width={yAxisWidth}\n          height={effectiveHeight}\n          data={data}\n          stackOffset=\"sign\"\n          margin={{\n            top: chartMargin.top,\n            bottom: xAxisHeight + chartMargin.bottom, // this is required to give space for x-axis\n            left: 0,\n            right: 0,\n          }}\n        >\n          <YAxis\n            width={yAxisWidth}\n            tickLine={false}\n            axisLine={false}\n            tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n          />\n          {/* Invisible bars to maintain scale synchronization */}\n          {dataKeys.map((key) => {\n            return (\n              <Bar\n                key={`yaxis-bar-chart-condensed-${key}`}\n                dataKey={key}\n                fill=\"transparent\"\n                stackId={variant === \"stacked\" ? \"a\" : undefined}\n                isAnimationActive={false}\n                maxBarSize={0}\n              />\n            );\n          })}\n        </RechartsBarChart>\n      </div>\n    );\n  }, [\n    showYAxis,\n    effectiveHeight,\n    data,\n    dataKeys,\n    variant,\n    id,\n    yAxisWidth,\n    chartMargin,\n    xAxisHeight,\n    setLabelWidth,\n  ]);\n\n  const barElements = useMemo(() => {\n    return dataKeys.map((key) => {\n      const transformedKey = transformedKeys[key];\n      const color = `var(--color-${transformedKey})`;\n\n      return (\n        <Bar\n          key={`bar-${key}`}\n          dataKey={key}\n          fill={color}\n          stackId={variant === \"stacked\" ? \"a\" : undefined}\n          isAnimationActive={isAnimationActive}\n          maxBarSize={calculatedBarWidth}\n          barSize={calculatedBarWidth}\n          shape={(props: any) => {\n            const { payload, value, dataKey } = props;\n\n            const { isNegative, isFirstInStack, isLastInStack, hasNegativeValueInStack } =\n              getBarStackInfo(variant, value, dataKey, payload, dataKeys);\n\n            const customRadius = getRadiusArray(\n              variant,\n              calculatedRadius,\n              \"vertical\",\n              isFirstInStack,\n              isLastInStack,\n              isNegative,\n            );\n\n            return (\n              <LineInBarShape\n                {...props}\n                radius={customRadius}\n                internalLineColor={barInternalLineColor}\n                internalLineWidth={BAR_INTERNAL_LINE_WIDTH}\n                isHovered={hoveredCategory !== null}\n                hoveredCategory={hoveredCategory}\n                categoryKey={categoryKey as string}\n                variant={variant}\n                hasNegativeValueInStack={hasNegativeValueInStack}\n              />\n            );\n          }}\n        />\n      );\n    });\n  }, [\n    dataKeys,\n    transformedKeys,\n    variant,\n    calculatedRadius,\n    isAnimationActive,\n    barInternalLineColor,\n    hoveredCategory,\n    categoryKey,\n    calculatedBarWidth,\n  ]);\n\n  return (\n    <LabelTooltipProvider>\n      <SideBarTooltipProvider\n        isSideBarTooltipOpen={isSideBarTooltipOpen}\n        setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n        data={sideBarTooltipData}\n        setData={setSideBarTooltipData}\n      >\n        <div\n          className={clsx(\"openui-bar-chart-condensed-container\", className)}\n          data-openui-chart={exportData}\n          style={{\n            width: width ? `${width}px` : undefined,\n          }}\n        >\n          {yAxisLabel && (\n            <div className=\"openui-bar-chart-condensed-y-axis-label\">{yAxisLabel}</div>\n          )}\n          <div className=\"openui-bar-chart-condensed-container-inner\" ref={containerRef}>\n            {/* Y-axis of the chart */}\n            {yAxis}\n            <div className=\"openui-bar-chart-condensed\" ref={chartContainerRef}>\n              <ChartContainer\n                config={chartConfig}\n                style={{\n                  width: explicitChartWidth ? `${explicitChartWidth}px` : \"100%\",\n                  height: effectiveHeight,\n                }}\n                rechartsProps={{\n                  width: explicitChartWidth ?? \"100%\",\n                  height: effectiveHeight,\n                }}\n              >\n                <RechartsBarChart\n                  stackOffset=\"sign\"\n                  accessibilityLayer\n                  key={`bar-chart-condensed-${id}`}\n                  data={data}\n                  margin={chartMargin}\n                  barGap={BAR_GAP}\n                  barCategoryGap={BAR_CATEGORY_GAP}\n                  onMouseMove={handleChartMouseMove}\n                  onMouseLeave={handleChartMouseLeave}\n                  onClick={onBarClick}\n                  width={explicitChartWidth}\n                  height={effectiveHeight}\n                >\n                  {grid && cartesianGrid()}\n\n                  <XAxis\n                    dataKey={categoryKey as string}\n                    tickLine={false}\n                    axisLine={false}\n                    textAnchor={isAngled ? \"end\" : \"middle\"}\n                    interval=\"preserveStartEnd\"\n                    minTickGap={5}\n                    height={xAxisHeight}\n                    tick={<SVGXAxisTick />}\n                    angle={calculatedAngle}\n                    orientation=\"bottom\"\n                    padding={{\n                      left: X_AXIS_PADDING,\n                      right: X_AXIS_PADDING,\n                    }}\n                  />\n                  {/* Y-axis is rendered in the separate synchronized chart */}\n\n                  <ChartTooltip\n                    cursor={{\n                      fill: \"var(--openui-highlight)\",\n                      stroke: \"var(--openui-stroke-default)\",\n                      opacity: 1,\n                      strokeWidth: 1,\n                    }}\n                    content={<CustomTooltipContent parentRef={containerRef} />}\n                    offset={10}\n                  />\n\n                  {barElements}\n                </RechartsBarChart>\n              </ChartContainer>\n            </div>\n            {isSideBarTooltipOpen && <SideBarTooltip height={effectiveHeight} />}\n          </div>\n          {xAxisLabel && (\n            <div className=\"openui-bar-chart-condensed-x-axis-label\">{xAxisLabel}</div>\n          )}\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              containerWidth={effectiveWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </SideBarTooltipProvider>\n    </LabelTooltipProvider>\n  );\n};\n\n// Added React.memo for performance optimization to avoid unnecessary re-renders\nexport const BarChartCondensed = React.memo(\n  BarChartCondensedComponent,\n) as typeof BarChartCondensedComponent;\n","import React from \"react\";\n\nimport { LineInBarShape } from \"../../shared\";\nimport { type HorizontalBarChartVariant } from \"../types\";\n\ninterface CustomBarShapeProps {\n  // from recharts (can be more)\n  x?: number;\n  y?: number;\n  width?: number;\n  height?: number;\n  payload?: any;\n  // from parent scope\n  index: number;\n  categoryKey: string;\n  effectiveWidth: number;\n  labelHeight: number;\n  barInternalLineColor: string;\n  internalLineWidth: number;\n  hoveredCategory: string | number | null;\n  variant: HorizontalBarChartVariant;\n}\n\nconst CustomBarShapeComponent = (props: CustomBarShapeProps) => {\n  const {\n    // recharts props\n    y,\n    payload,\n    // my props\n    index,\n    categoryKey,\n    effectiveWidth,\n    labelHeight,\n    barInternalLineColor,\n    internalLineWidth,\n    hoveredCategory,\n    variant,\n    // rest of recharts props to pass down\n    ...rest\n  } = props;\n\n  // y might be undefined if not passed by recharts, but it's used.\n  // The original code has `let { y } = barProps;`. If `barProps.y` is undefined, `y` is undefined.\n  // The same for `payload`.\n  if (y === undefined || !payload) {\n    return null; // Or some fallback\n  }\n\n  let label = null;\n  if (index === 0 && payload[categoryKey]) {\n    const labelX = 0;\n    const labelWidth = effectiveWidth;\n    const labelY = y - labelHeight / 2;\n    label = (\n      <foreignObject\n        x={labelX}\n        y={labelY}\n        width={labelWidth}\n        height={labelHeight}\n        style={{ pointerEvents: \"none\" }}\n        xmlns=\"http://www.w3.org/1999/xhtml\"\n      >\n        <div className=\"openui-horizontal-bar-chart-category-label\">{payload[categoryKey]}</div>\n      </foreignObject>\n    );\n  }\n\n  return (\n    <g>\n      {label}\n      <LineInBarShape\n        {...rest}\n        payload={payload}\n        y={y + labelHeight / 2}\n        internalLineColor={barInternalLineColor}\n        internalLineWidth={internalLineWidth}\n        isHovered={hoveredCategory !== null}\n        hoveredCategory={hoveredCategory}\n        categoryKey={categoryKey as string}\n        variant={variant}\n        orientation=\"horizontal\"\n      />\n    </g>\n  );\n};\n\nexport const CustomBarShape = React.memo(CustomBarShapeComponent);\n","import { useMemo } from \"react\";\n\nimport { useCanvasContextForLabelSize } from \"../../hooks/useCanvasContextForLabelSize\";\n\nexport const useMaxCategoryLabelWidth = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n): number => {\n  const context = useCanvasContextForLabelSize();\n\n  return useMemo(() => {\n    if (data.length === 0) {\n      return 100; // Default fallback\n    }\n\n    if (!context) {\n      // Fallback if canvas is not available\n      return Math.max(...data.map((item) => String(item[categoryKey] || \"\").length * 8), 100);\n    }\n\n    return Math.max(\n      ...data.map((item) => {\n        const text = String(item[categoryKey] || \"\");\n        return context.measureText(text).width;\n      }),\n      100,\n    );\n  }, [data, categoryKey, context]);\n};\n","import { getDataKeys } from \"../../utils/dataUtils\";\nimport { HorizontalBarChartVariant } from \"../types\";\n\nexport const BAR_HEIGHT = 16;\nexport const BAR_GAP = 10;\n\n/**\n * This function returns the height of the data in the chart, used for padding calculation, scroll amount calculation, and\n * for the height of the chart container.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param variant - The variant of the chart.\n * @param labelHeight - The height of the category label.\n */\nconst getHeightOfData = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  variant: HorizontalBarChartVariant,\n  labelHeight: number,\n) => {\n  if (data.length === 0) {\n    return 0;\n  }\n\n  const height = data.length * getHeightOfGroup(data, categoryKey, variant, labelHeight);\n\n  if (data.length === 1) {\n    const minSingleDataHeight = 80; // Minimum height for single data points\n    return Math.max(height, minSingleDataHeight);\n  }\n  return height;\n};\n\n/**\n * This function returns the padding for the chart, used for the padding of the chart container.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param containerHeight - The height of the container of the chart.\n * @param variant - The variant of the chart.\n * @param labelHeight - The height of the category label.\n */\nconst getPadding = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  containerHeight: number,\n  variant: HorizontalBarChartVariant,\n  labelHeight: number,\n) => {\n  const chartHeight = getHeightOfData(data, categoryKey, variant, labelHeight);\n  const paddingValue = containerHeight - chartHeight;\n\n  if (paddingValue < 0) {\n    // If chart content is taller than container, no padding\n    return {\n      top: 10,\n      bottom: 10,\n    };\n  } else {\n    return {\n      top: paddingValue / 2,\n      bottom: paddingValue / 2,\n    };\n  }\n};\n\n/**\n * This function returns the height of each group/category.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param variant - The variant of the chart.\n * @param labelHeight - The height of the category label.\n */\nconst getHeightOfGroup = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  variant: HorizontalBarChartVariant,\n  labelHeight: number,\n) => {\n  if (data.length === 0) return 200; // Fallback\n\n  // Get the number of data keys (excluding categoryKey)\n  const dataKeys = getDataKeys(data, categoryKey);\n  const PADDING = 16;\n\n  if (variant === \"stacked\") {\n    // For stacked: each category is one stack\n    return BAR_HEIGHT + labelHeight + PADDING;\n  } else {\n    // For grouped: each category contains multiple bars\n    const seriesPerCategory = dataKeys.length;\n    return seriesPerCategory * (BAR_HEIGHT + BAR_GAP) - BAR_GAP + labelHeight + PADDING;\n  }\n};\n\n/**\n * This function returns the snap positions for the chart, used for the snap positions of the chart.\n * @param data - The data to be displayed in the chart.\n * @param categoryKey - The key of the category to be displayed in the chart.\n * @param variant - The variant of the chart.\n * @param labelHeight - The height of the category label.\n * @returns The snap positions for the chart.\n */\nconst getSnapPositions = (\n  data: Array<Record<string, string | number>>,\n  categoryKey: string,\n  variant: HorizontalBarChartVariant,\n  labelHeight: number,\n): number[] => {\n  if (data.length === 0) return [0];\n\n  const positions = [0]; // Start position\n  const groupHeightValue = getHeightOfGroup(data, categoryKey, variant, labelHeight);\n\n  // Calculate all valid snap positions based on groups\n  for (let i = 1; i < data.length; i++) {\n    positions.push(i * groupHeightValue);\n  }\n\n  return positions;\n};\n\nexport { getHeightOfData, getHeightOfGroup, getPadding, getSnapPositions };\n","import clsx from \"clsx\";\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Bar, BarChart as RechartsBarChart, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport { useExportChartData, useTransformedKeys } from \"../hooks\";\nimport { useHorizontalBarLabelHeight } from \"../hooks/useMaxLabelHeight\";\nimport {\n  CustomTooltipContent,\n  DefaultLegend,\n  SideBarTooltip,\n  SVGXAxisTick,\n  verticalCartesianGrid,\n  YAxisTick,\n} from \"../shared\";\nimport { ScrollButtonsVertical } from \"../shared/ScrollButtonsVertical\";\n\nimport { type LegendItem } from \"../types/Legend\";\nimport { useChartPalette, type PaletteName } from \"../utils/PalletUtils\";\n\nimport { LabelTooltipProvider } from \"../shared/LabelTooltip/LabelTooltip\";\nimport {\n  findNearestSnapPosition,\n  getBarStackInfo,\n  getRadiusArray,\n} from \"../utils/BarCharts/BarChartsUtils\";\nimport {\n  get2dChartConfig,\n  getColorForDataKey,\n  getDataKeys,\n  getLegendItems,\n} from \"../utils/dataUtils\";\nimport { numberTickFormatter } from \"../utils/styleUtils\";\nimport { CustomBarShape } from \"./components/CustomBarShape\";\nimport { useMaxCategoryLabelWidth } from \"./hooks/useMaxCategoryLabelWidth\";\nimport { HorizontalBarChartData, HorizontalBarChartVariant } from \"./types\";\nimport {\n  BAR_GAP,\n  BAR_HEIGHT,\n  getHeightOfData,\n  getPadding,\n  getSnapPositions,\n} from \"./utils/HorizontalBarChartUtils\";\n\n// Type for onClick event\ntype HorizontalBarChartOnClick = React.ComponentProps<typeof RechartsBarChart>[\"onClick\"];\ntype HorizontalBarClickData = Parameters<NonNullable<HorizontalBarChartOnClick>>[0];\n\nexport interface HorizontalBarChartProps<T extends HorizontalBarChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: HorizontalBarChartVariant;\n  grid?: boolean;\n  radius?: number;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  showXAxis?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  legend?: boolean;\n  className?: string;\n  height?: number;\n  width?: number;\n}\n\nconst X_AXIS_HEIGHT = 40; // Height of X-axis chart when shown\nconst BAR_CATEGORY_GAP = \"20%\"; // Gap between categories\nconst BAR_INTERNAL_LINE_WIDTH = 1;\nconst BAR_RADIUS = 4;\n\nconst HorizontalBarChartComponent = <T extends HorizontalBarChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant = \"grouped\",\n  grid = true,\n  icons = {},\n  radius = BAR_RADIUS,\n  isAnimationActive = false,\n  showXAxis = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  className,\n  height,\n  width,\n}: HorizontalBarChartProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const maxCategoryLabelWidth = useMaxCategoryLabelWidth(data, categoryKey as string);\n\n  const chartContainerRef = useRef<HTMLDivElement>(null);\n  const mainContainerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [canScrollUp, setCanScrollUp] = useState(false);\n  const [canScrollDown, setCanScrollDown] = useState(false);\n  const [hoveredCategory, setHoveredCategory] = useState<string | number | null>(null);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n\n  // Calculate chart width for internal calculations (legend, xAxis, etc.)\n  const effectiveWidth = useMemo(() => {\n    return width ?? containerWidth;\n  }, [width, containerWidth]);\n\n  // Calculate label height for better group height calculation\n  // Use chart width for label height calculation since labels span full width\n  const labelHeight = useHorizontalBarLabelHeight(data, categoryKey as string, effectiveWidth);\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"barChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  // Use provided height or observed height\n  const effectiveHeight = useMemo(() => {\n    return height ?? 296 + X_AXIS_HEIGHT;\n  }, [height]);\n\n  // Calculate effective container height (excluding X-axis)\n  const effectiveContainerHeight = useMemo(() => {\n    const xAxisHeight = showXAxis ? X_AXIS_HEIGHT : 0;\n    return Math.max(0, effectiveHeight - xAxisHeight);\n  }, [effectiveHeight, showXAxis]);\n\n  const padding = useMemo(() => {\n    return getPadding(data, categoryKey as string, effectiveContainerHeight, variant, labelHeight);\n  }, [data, categoryKey, effectiveContainerHeight, variant, labelHeight]);\n\n  const dataHeight = useMemo(() => {\n    return getHeightOfData(data, categoryKey as string, variant, labelHeight);\n  }, [data, categoryKey, variant, labelHeight]);\n\n  // Calculate snap positions for proper group alignment\n  const snapPositions = useMemo(() => {\n    return getSnapPositions(data, categoryKey as string, variant, labelHeight);\n  }, [data, categoryKey, variant, labelHeight]);\n\n  // Check scroll boundaries\n  const updateScrollState = useCallback(() => {\n    if (mainContainerRef.current) {\n      const { scrollTop, scrollHeight, clientHeight } = mainContainerRef.current;\n      setCanScrollUp(scrollTop > 0);\n      setCanScrollDown(scrollTop < scrollHeight - clientHeight - 1);\n    }\n  }, []);\n\n  const scrollUp = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollTop;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"up\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        top: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  const scrollDown = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollTop;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"down\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        top: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  useEffect(() => {\n    // Set up ResizeObserver if height or width is not provided\n    if (!chartContainerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      for (const entry of entries) {\n        if (!width) {\n          setContainerWidth(entry.contentRect.width);\n        }\n      }\n    });\n\n    resizeObserver.observe(chartContainerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, [height, width]);\n\n  // Update scroll state when container dimensions or data height changes\n  useEffect(() => {\n    updateScrollState();\n  }, [effectiveContainerHeight, dataHeight, containerWidth, updateScrollState]);\n\n  useEffect(() => {\n    setIsSideBarTooltipOpen(false);\n    setIsLegendExpanded(false);\n  }, [dataKeys]);\n\n  // Add scroll event listener to update button states\n  useEffect(() => {\n    const mainContainer = mainContainerRef.current;\n    if (!mainContainer) return;\n\n    const handleScroll = () => {\n      updateScrollState();\n    };\n\n    mainContainer.addEventListener(\"scroll\", handleScroll);\n    return () => {\n      mainContainer.removeEventListener(\"scroll\", handleScroll);\n    };\n  }, [updateScrollState]);\n\n  // Memoize legend items creation\n  const legendItems: LegendItem[] = useMemo(() => {\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons]);\n\n  const exportData = useExportChartData({\n    type: \"bar\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n    extraOptions: {\n      barDir: \"bar\",\n    },\n  });\n\n  const id = useId();\n\n  const xAxis = useMemo(() => {\n    if (!showXAxis) {\n      return null;\n    }\n    return (\n      <div className=\"openui-horizontal-bar-chart-x-axis-container\">\n        {/* X-axis only chart - synchronized with main chart */}\n        <ChartContainer\n          config={chartConfig}\n          style={{ width: \"100%\", height: X_AXIS_HEIGHT }}\n          rechartsProps={{\n            height: X_AXIS_HEIGHT,\n          }}\n        >\n          <RechartsBarChart\n            key={`x-axis-horizontal-bar-chart-${id}`}\n            data={data}\n            layout=\"vertical\"\n            margin={{\n              top: 0,\n              bottom: 0,\n              left: 5,\n              right: 2,\n            }}\n            stackOffset=\"sign\"\n          >\n            <XAxis\n              type=\"number\"\n              height={X_AXIS_HEIGHT}\n              tickLine={false}\n              axisLine={false}\n              tickFormatter={numberTickFormatter}\n              tick={<SVGXAxisTick />}\n            />\n            {/* Invisible bars to maintain scale synchronization */}\n            {dataKeys.map((key) => {\n              return (\n                <Bar\n                  key={`x-axis-horizontal-bar-chart-${key}`}\n                  dataKey={key}\n                  fill=\"transparent\"\n                  stackId={variant === \"stacked\" ? \"a\" : undefined}\n                  isAnimationActive={false}\n                  maxBarSize={0}\n                />\n              );\n            })}\n          </RechartsBarChart>\n        </ChartContainer>\n      </div>\n    );\n  }, [showXAxis, chartConfig, data, dataKeys, variant, id]);\n\n  // Handle mouse events for group hovering\n  const handleChartMouseMove = useCallback((state: any) => {\n    if (state && state.activeLabel !== undefined) {\n      setHoveredCategory(state.activeLabel);\n    }\n  }, []);\n\n  const handleChartMouseLeave = useCallback(() => {\n    setHoveredCategory(null);\n  }, []);\n\n  const { mode } = useTheme();\n\n  const barInternalLineColor = useMemo(() => {\n    if (mode === \"light\") {\n      return \"rgba(255, 255, 255, 0.3)\";\n    }\n    return \"rgba(0, 0, 0, 0.3)\";\n  }, [mode]);\n\n  const onBarsClick = useCallback(\n    (data: HorizontalBarClickData) => {\n      if (data?.activePayload?.length && data.activePayload.length > 10) {\n        setIsSideBarTooltipOpen(true);\n        setSideBarTooltipData({\n          title: data.activeLabel as string,\n          values: data.activePayload.map((payload) => ({\n            value: payload.value as number,\n            label: payload.name || payload.dataKey,\n            color: getColorForDataKey(payload.dataKey, dataKeys, colors),\n          })),\n        });\n      }\n    },\n    [dataKeys, colors],\n  );\n\n  const setLabelWidth = useCallback(() => {}, []);\n\n  return (\n    <LabelTooltipProvider>\n      <SideBarTooltipProvider\n        isSideBarTooltipOpen={isSideBarTooltipOpen}\n        setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n        data={sideBarTooltipData}\n        setData={setSideBarTooltipData}\n      >\n        <div\n          className={clsx(\"openui-horizontal-bar-chart-container\", className)}\n          data-openui-chart={exportData}\n        >\n          <div\n            className=\"openui-horizontal-bar-chart-container-inner-wrapper\"\n            style={{\n              height: height ? `${height}px` : effectiveHeight,\n            }}\n          >\n            <div className=\"openui-horizontal-bar-chart-container-inner\" ref={chartContainerRef}>\n              <div className=\"openui-horizontal-bar-chart-main-container\" ref={mainContainerRef}>\n                <ChartContainer\n                  config={chartConfig}\n                  style={{ height: dataHeight, minHeight: \"100%\", width: \"100%\" }}\n                >\n                  <RechartsBarChart\n                    accessibilityLayer\n                    key={`horizontal-bar-chart-${id}`}\n                    data={data}\n                    layout=\"vertical\"\n                    onClick={onBarsClick}\n                    onMouseMove={handleChartMouseMove}\n                    onMouseLeave={handleChartMouseLeave}\n                    barGap={BAR_GAP}\n                    barCategoryGap={BAR_CATEGORY_GAP}\n                    margin={{\n                      top: 0,\n                      bottom: 0,\n                      left: 2,\n                      right: 2,\n                    }}\n                    stackOffset=\"sign\"\n                  >\n                    {grid && verticalCartesianGrid()}\n                    {/* this x axis is not visible but is needed for the chart to work */}\n                    <XAxis type=\"number\" tickLine={false} axisLine={false} hide />\n                    <YAxis\n                      type=\"category\"\n                      dataKey={categoryKey as string}\n                      tickLine={false}\n                      axisLine={false}\n                      width={maxCategoryLabelWidth}\n                      tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n                      interval={0}\n                      // gives the padding on the 2 sides see the function for reference\n                      padding={padding}\n                      hide\n                    />\n\n                    <ChartTooltip\n                      cursor={{\n                        fill: \"var(--openui-highlight)\",\n                        stroke: \"var(--openui-stroke-default)\",\n                        opacity: 1,\n                        strokeWidth: 1,\n                      }}\n                      content={<CustomTooltipContent parentRef={mainContainerRef} />}\n                      offset={15}\n                    />\n\n                    {dataKeys.map((key, index) => {\n                      const transformedKey = transformedKeys[key];\n                      const color = `var(--color-${transformedKey})`;\n\n                      return (\n                        <Bar\n                          key={`main-${key}`}\n                          dataKey={key}\n                          fill={color}\n                          stackId={variant === \"stacked\" ? \"a\" : undefined}\n                          isAnimationActive={isAnimationActive}\n                          maxBarSize={BAR_HEIGHT}\n                          barSize={BAR_HEIGHT}\n                          shape={(props: any) => {\n                            const { payload, value, dataKey } = props;\n\n                            const { isNegative, isFirstInStack, isLastInStack } = getBarStackInfo(\n                              variant,\n                              value,\n                              dataKey,\n                              payload,\n                              dataKeys,\n                            );\n\n                            const customRadius = getRadiusArray(\n                              variant,\n                              radius,\n                              \"horizontal\",\n                              isFirstInStack,\n                              isLastInStack,\n                              isNegative,\n                            );\n\n                            return (\n                              <CustomBarShape\n                                {...props}\n                                radius={customRadius}\n                                index={index}\n                                categoryKey={categoryKey as string}\n                                effectiveWidth={effectiveWidth}\n                                labelHeight={labelHeight}\n                                barInternalLineColor={barInternalLineColor}\n                                internalLineWidth={BAR_INTERNAL_LINE_WIDTH}\n                                hoveredCategory={hoveredCategory}\n                                variant={variant}\n                              />\n                            );\n                          }}\n                        />\n                      );\n                    })}\n                  </RechartsBarChart>\n                </ChartContainer>\n              </div>\n              {/* X-axis of the chart */}\n              {xAxis}\n            </div>\n            {/* if the data height is greater than the effective height, then show the scroll buttons */}\n            <ScrollButtonsVertical\n              dataHeight={dataHeight}\n              effectiveHeight={effectiveContainerHeight}\n              canScrollUp={canScrollUp}\n              canScrollDown={canScrollDown}\n              isSideBarTooltipOpen={isSideBarTooltipOpen}\n              onScrollUp={scrollUp}\n              onScrollDown={scrollDown}\n            />\n            {isSideBarTooltipOpen && <SideBarTooltip height={effectiveHeight} />}\n          </div>\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              yAxisLabel={yAxisLabel}\n              xAxisLabel={xAxisLabel}\n              containerWidth={effectiveWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </SideBarTooltipProvider>\n    </LabelTooltipProvider>\n  );\n};\n\n// Added React.memo for performance optimization to avoid unnecessary re-renders\nexport const HorizontalBarChart = React.memo(\n  HorizontalBarChartComponent,\n) as typeof HorizontalBarChartComponent;\n","import clsx from \"clsx\";\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Line, LineChart as RechartsLineChart, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport {\n  useExportChartData,\n  useMaxLabelHeight,\n  useTransformedKeys,\n  useYAxisLabelWidth,\n} from \"../hooks\";\nimport {\n  ActiveDot,\n  cartesianGrid,\n  CustomTooltipContent,\n  DefaultLegend,\n  ScrollButtonsHorizontal,\n  SideBarTooltip,\n  XAxisTick,\n  YAxisTick,\n} from \"../shared\";\nimport { LabelTooltipProvider } from \"../shared/LabelTooltip/LabelTooltip\";\nimport { LegendItem, XAxisTickVariant } from \"../types\";\nimport {\n  findNearestSnapPosition,\n  getSnapPositions,\n  getWidthOfData,\n  getWidthOfGroup,\n} from \"../utils/AreaAndLine/AreaAndLineUtils\";\nimport { getLineType } from \"../utils/AreaAndLine/common\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\nimport {\n  get2dChartConfig,\n  getColorForDataKey,\n  getDataKeys,\n  getLegendItems,\n} from \"../utils/dataUtils\";\nimport { LineChartData, LineChartVariant } from \"./types\";\n\ntype LineChartOnClick = React.ComponentProps<typeof RechartsLineChart>[\"onClick\"];\ntype LineClickData = Parameters<NonNullable<LineChartOnClick>>[0];\n\nexport interface LineChartProps<T extends LineChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: LineChartVariant;\n  tickVariant?: XAxisTickVariant;\n  grid?: boolean;\n  legend?: boolean;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  showYAxis?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  className?: string;\n  height?: number;\n  width?: number;\n  strokeWidth?: number;\n}\n\nconst X_AXIS_PADDING = 36;\nconst CHART_CONTAINER_BOTTOM_MARGIN = 10;\n\nexport const LineChart = <T extends LineChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant: lineChartVariant = \"natural\",\n  tickVariant = \"multiLine\",\n  grid = true,\n  icons = {},\n  isAnimationActive = false,\n  showYAxis = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  className,\n  height,\n  width,\n  strokeWidth = 2,\n}: LineChartProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const variant = getLineType(lineChartVariant);\n\n  const { yAxisWidth, setLabelWidth } = useYAxisLabelWidth(data, dataKeys);\n\n  const widthOfGroup = useMemo(() => {\n    return getWidthOfGroup(data);\n  }, [data]);\n\n  const maxLabelHeight = useMaxLabelHeight(data, categoryKey as string, tickVariant, widthOfGroup);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"lineChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  const chartContainerRef = useRef<HTMLDivElement>(null);\n  const mainContainerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [canScrollLeft, setCanScrollLeft] = useState(false);\n  const [canScrollRight, setCanScrollRight] = useState(false);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n\n  // Use provided width or observed width\n  const effectiveWidth = useMemo(() => {\n    return width ?? containerWidth;\n  }, [width, containerWidth]);\n\n  const effectiveContainerWidth = useMemo(() => {\n    const dynamicYAxisWidth = showYAxis ? yAxisWidth : 0;\n    return Math.max(0, effectiveWidth - dynamicYAxisWidth - 40); // -40 because we are giving 20px padding in xAxis on each side\n  }, [effectiveWidth, showYAxis, yAxisWidth]);\n\n  const dataWidth = useMemo(() => {\n    return getWidthOfData(data, effectiveContainerWidth);\n  }, [data, effectiveContainerWidth]);\n\n  // Calculate snap positions for proper scrolling alignment\n  const snapPositions = useMemo(() => {\n    return getSnapPositions(data);\n  }, [data]);\n\n  const chartHeight = useMemo(() => {\n    return height ?? 296 + maxLabelHeight;\n  }, [height, maxLabelHeight]);\n\n  // Check scroll boundaries\n  const updateScrollState = useCallback(() => {\n    if (mainContainerRef.current) {\n      const { scrollLeft, scrollWidth, clientWidth } = mainContainerRef.current;\n      setCanScrollLeft(scrollLeft > 0);\n      setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 1); // -1 for floating point precision\n    }\n  }, []);\n\n  const scrollLeft = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollLeft;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"left\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        left: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  const scrollRight = useCallback(() => {\n    if (mainContainerRef.current) {\n      const currentScroll = mainContainerRef.current.scrollLeft;\n      const targetIndex = findNearestSnapPosition(snapPositions, currentScroll, \"right\");\n      const targetPosition = snapPositions[targetIndex] ?? 0;\n\n      mainContainerRef.current.scrollTo({\n        left: targetPosition,\n        behavior: \"smooth\",\n      });\n    }\n  }, [snapPositions]);\n\n  useEffect(() => {\n    // Only set up ResizeObserver if width is not provided\n    if (width || !chartContainerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are observing the chart container\n      for (const entry of entries) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    resizeObserver.observe(chartContainerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, [width]);\n\n  // Update scroll state when container width or data width changes\n  useEffect(() => {\n    updateScrollState();\n  }, [effectiveWidth, dataWidth, updateScrollState]);\n\n  useEffect(() => {\n    setIsSideBarTooltipOpen(false);\n    setIsLegendExpanded(false);\n  }, [dataKeys]);\n\n  // Add scroll event listener to update button states\n  useEffect(() => {\n    const mainContainer = mainContainerRef.current;\n    if (!mainContainer) return;\n\n    const handleScroll = () => {\n      updateScrollState();\n    };\n\n    mainContainer.addEventListener(\"scroll\", handleScroll);\n    return () => {\n      mainContainer.removeEventListener(\"scroll\", handleScroll);\n    };\n  }, [updateScrollState]);\n\n  const legendItems: LegendItem[] = useMemo(() => {\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons]);\n\n  const exportData = useExportChartData({\n    type: \"line\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n    extraOptions: {\n      lineSize: strokeWidth,\n    },\n  });\n\n  const id = useId();\n\n  const onLineClick = useCallback(\n    (data: LineClickData) => {\n      if (data?.activePayload?.length && data.activePayload.length > 10) {\n        setIsSideBarTooltipOpen(true);\n        setSideBarTooltipData({\n          title: data.activeLabel as string,\n          values: data.activePayload.map((payload) => ({\n            value: payload.value as number,\n            label: payload.name || payload.dataKey,\n            color: getColorForDataKey(payload.dataKey, dataKeys, colors),\n          })),\n        });\n      }\n    },\n    [dataKeys, colors],\n  );\n\n  const yAxis = useMemo(() => {\n    if (!showYAxis) {\n      return null;\n    }\n    return (\n      <div className=\"openui-line-chart-y-axis-container\">\n        {/* Y-axis only chart - synchronized with main chart */}\n        <RechartsLineChart\n          key={`y-axis-chart-${id}`}\n          width={yAxisWidth}\n          height={chartHeight}\n          data={data}\n          margin={{\n            top: 20,\n            bottom: maxLabelHeight + CHART_CONTAINER_BOTTOM_MARGIN, // this is required for to give space for x-axis\n            left: 0,\n            right: 0,\n          }}\n          onClick={onLineClick}\n        >\n          <YAxis\n            width={yAxisWidth}\n            tickLine={false}\n            axisLine={false}\n            tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n          />\n          {/* Invisible lines to maintain scale synchronization */}\n          {dataKeys.map((key) => {\n            return (\n              <Line\n                key={`y-axis-${key}`}\n                dataKey={key}\n                type={variant}\n                stroke=\"transparent\"\n                strokeWidth={0}\n                dot={false}\n                activeDot={false}\n                isAnimationActive={isAnimationActive}\n              />\n            );\n          })}\n        </RechartsLineChart>\n      </div>\n    );\n  }, [\n    showYAxis,\n    id,\n    chartHeight,\n    data,\n    onLineClick,\n    dataKeys,\n    variant,\n    isAnimationActive,\n    maxLabelHeight,\n    yAxisWidth,\n  ]);\n\n  return (\n    <LabelTooltipProvider>\n      <SideBarTooltipProvider\n        isSideBarTooltipOpen={isSideBarTooltipOpen}\n        setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n        data={sideBarTooltipData}\n        setData={setSideBarTooltipData}\n      >\n        <div\n          className={clsx(\"openui-line-chart-container\", className)}\n          data-openui-chart={exportData}\n          style={{\n            width: width ? `${width}px` : undefined,\n          }}\n        >\n          <div className=\"openui-line-chart-container-inner\" ref={chartContainerRef}>\n            {/* Y-axis of the chart */}\n            {yAxis}\n            <div className=\"openui-line-chart-main-container\" ref={mainContainerRef}>\n              <ChartContainer\n                config={chartConfig}\n                style={{ width: dataWidth, minWidth: \"100%\", height: chartHeight }}\n                rechartsProps={{\n                  width: \"100%\",\n                  height: \"100%\",\n                  minHeight: 1,\n                  minWidth: 1,\n                  initialDimension: { width: 1, height: 1 },\n                }}\n              >\n                <RechartsLineChart\n                  accessibilityLayer\n                  key={`line-chart-${id}`}\n                  data={data}\n                  margin={{\n                    top: 20,\n                    bottom: CHART_CONTAINER_BOTTOM_MARGIN,\n                  }}\n                  onClick={onLineClick}\n                >\n                  {grid && cartesianGrid()}\n                  <XAxis\n                    dataKey={categoryKey as string}\n                    tickLine={false}\n                    axisLine={false}\n                    height={maxLabelHeight}\n                    textAnchor=\"middle\"\n                    interval={0}\n                    tick={\n                      <XAxisTick\n                        variant={tickVariant}\n                        widthOfGroup={widthOfGroup}\n                        labelHeight={maxLabelHeight}\n                      />\n                    }\n                    orientation=\"bottom\"\n                    padding={{\n                      left: X_AXIS_PADDING,\n                      right: X_AXIS_PADDING,\n                    }}\n                  />\n\n                  <ChartTooltip\n                    content={<CustomTooltipContent parentRef={mainContainerRef} />}\n                    offset={15}\n                  />\n\n                  {dataKeys.map((key) => {\n                    const transformedKey = transformedKeys[key];\n                    const color = `var(--color-${transformedKey})`;\n                    return (\n                      <Line\n                        key={`main-${key}`}\n                        dataKey={key}\n                        type={variant}\n                        stroke={color}\n                        strokeWidth={strokeWidth}\n                        dot={false}\n                        activeDot={<ActiveDot key={`active-dot-${key}-${id}`} />}\n                        isAnimationActive={isAnimationActive}\n                      />\n                    );\n                  })}\n                </RechartsLineChart>\n              </ChartContainer>\n            </div>\n            {isSideBarTooltipOpen && <SideBarTooltip height={chartHeight} />}\n          </div>\n          {/* if the data width is greater than the effective width, then show the scroll buttons */}\n          <ScrollButtonsHorizontal\n            dataWidth={dataWidth}\n            effectiveWidth={effectiveWidth}\n            canScrollLeft={canScrollLeft}\n            canScrollRight={canScrollRight}\n            isSideBarTooltipOpen={isSideBarTooltipOpen}\n            onScrollLeft={scrollLeft}\n            onScrollRight={scrollRight}\n          />\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              yAxisLabel={yAxisLabel}\n              xAxisLabel={xAxisLabel}\n              containerWidth={effectiveWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </SideBarTooltipProvider>\n    </LabelTooltipProvider>\n  );\n};\n","import clsx from \"clsx\";\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Line, LineChart as RechartsLineChart, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { DEFAULT_X_AXIS_HEIGHT, X_AXIS_PADDING } from \"../constants\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport {\n  useAutoAngleCalculation,\n  useExportChartData,\n  useMaxLabelWidth,\n  useTransformedKeys,\n  useYAxisLabelWidth,\n} from \"../hooks\";\nimport { LineChartData, LineChartVariant } from \"../LineChart/types\";\nimport {\n  ActiveDot,\n  cartesianGrid,\n  CustomTooltipContent,\n  DefaultLegend,\n  SideBarTooltip,\n  SVGXAxisTick,\n  SVGXAxisTickVariant,\n  YAxisTick,\n} from \"../shared\";\nimport { LabelTooltipProvider } from \"../shared/LabelTooltip/LabelTooltip\";\nimport { LegendItem } from \"../types\";\nimport { getLineType } from \"../utils/AreaAndLine/common\";\nimport {\n  get2dChartConfig,\n  getColorForDataKey,\n  getDataKeys,\n  getLegendItems,\n} from \"../utils/dataUtils\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\n\n// this a technic to get the type of the onClick event of the line chart\n// we need to do this because the onClick event type is not exported by recharts\ntype LineChartOnClick = React.ComponentProps<typeof RechartsLineChart>[\"onClick\"];\ntype LineClickData = Parameters<NonNullable<LineChartOnClick>>[0];\n\nexport interface LineChartCondensedProps<T extends LineChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: LineChartVariant;\n  tickVariant?: SVGXAxisTickVariant;\n  grid?: boolean;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  showYAxis?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  legend?: boolean;\n  className?: string;\n  height?: number;\n  width?: number;\n  strokeWidth?: number;\n}\n\nconst CHART_HEIGHT = 296;\nconst CHART_CONTAINER_BOTTOM_MARGIN = 10;\n\nconst LineChartCondensedComponent = <T extends LineChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant: lineChartVariant = \"natural\",\n  tickVariant = \"singleLine\",\n  grid = true,\n  icons = {},\n  isAnimationActive = false,\n  showYAxis = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  className,\n  height = CHART_HEIGHT,\n  width,\n  strokeWidth = 2,\n}: LineChartCondensedProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const variant = getLineType(lineChartVariant);\n\n  const { yAxisWidth, setLabelWidth } = useYAxisLabelWidth(data, dataKeys);\n\n  const maxLabelWidth = useMaxLabelWidth(data, categoryKey as string);\n\n  const chartContainerRef = useRef<HTMLDivElement>(null);\n  const [chartContainerWidth, setChartContainerWidth] = useState<number>(0);\n\n  const widthOfData = useMemo(() => {\n    if (data.length === 0) {\n      return 0;\n    }\n    // Use passed width if available, otherwise use observed chartContainerWidth\n    const chartWidth = width ?? chartContainerWidth;\n    return chartWidth / data.length;\n  }, [width, chartContainerWidth, data]);\n\n  const { angle: calculatedAngle, height: xAxisHeight } = useAutoAngleCalculation(\n    maxLabelWidth,\n    tickVariant === \"angled\",\n    maxLabelWidth < 100 ? widthOfData : undefined,\n  );\n\n  const isAngled = useMemo(() => {\n    return calculatedAngle !== 0;\n  }, [calculatedAngle]);\n\n  const effectiveHeight = useMemo(() => {\n    if (tickVariant === \"angled\") {\n      return xAxisHeight + height;\n    }\n    return height + DEFAULT_X_AXIS_HEIGHT;\n  }, [height, xAxisHeight, tickVariant]);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"lineChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  const id = useId();\n\n  const exportData = useExportChartData({\n    type: \"line\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n    extraOptions: {\n      lineSize: strokeWidth,\n    },\n  });\n\n  const chartMargin = useMemo(\n    () => ({\n      top: 10,\n      right: 10,\n      bottom: CHART_CONTAINER_BOTTOM_MARGIN,\n      left: showYAxis ? 10 : 0,\n    }),\n    [showYAxis],\n  );\n\n  const onLineClick = useCallback(\n    (data: LineClickData) => {\n      if (data?.activePayload?.length && data.activePayload.length > 10) {\n        setIsSideBarTooltipOpen(true);\n        setSideBarTooltipData({\n          title: data.activeLabel as string,\n          values: data.activePayload.map((payload) => ({\n            value: payload.value as number,\n            label: payload.name || payload.dataKey,\n            color: getColorForDataKey(payload.dataKey, dataKeys, colors),\n          })),\n        });\n      }\n    },\n    [dataKeys, colors],\n  );\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n\n  // Use provided width or observed width\n  const effectiveWidth = useMemo(() => {\n    return width ?? containerWidth;\n  }, [width, containerWidth]);\n\n  // Observe container width for legend\n  useEffect(() => {\n    // Only set up ResizeObserver if width is not provided\n    if (width || !containerRef.current || !chartContainerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are observing the chart container\n      for (const entry of entries) {\n        if (entry.target === containerRef.current) {\n          setContainerWidth(entry.contentRect.width);\n        }\n        if (entry.target === chartContainerRef.current) {\n          setChartContainerWidth(entry.contentRect.width);\n        }\n      }\n    });\n\n    resizeObserver.observe(containerRef.current);\n    resizeObserver.observe(chartContainerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, [width]);\n\n  useEffect(() => {\n    setIsLegendExpanded(false);\n  }, [dataKeys]);\n\n  // Memoize legend items creation\n  const legendItems: LegendItem[] = useMemo(() => {\n    if (!legend) {\n      return [];\n    }\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons, legend]);\n\n  const yAxis = useMemo(() => {\n    if (!showYAxis) {\n      return null;\n    }\n    return (\n      <div className=\"openui-line-chart-condensed-y-axis-container\">\n        {/* Y-axis only chart - synchronized with main chart */}\n        <RechartsLineChart\n          key={`y-axis-line-chart-condensed-${id}`}\n          width={yAxisWidth}\n          height={effectiveHeight}\n          data={data}\n          margin={{\n            top: chartMargin.top,\n            bottom: xAxisHeight + chartMargin.bottom, // this is required to give space for x-axis\n            left: 0,\n            right: 0,\n          }}\n        >\n          <YAxis\n            width={yAxisWidth}\n            tickLine={false}\n            axisLine={false}\n            tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n          />\n          {/* Invisible lines to maintain scale synchronization */}\n          {dataKeys.map((key) => {\n            return (\n              <Line\n                key={`yaxis-line-chart-condensed-${key}`}\n                dataKey={key}\n                stroke=\"transparent\"\n                strokeWidth={0}\n                dot={false}\n                isAnimationActive={false}\n              />\n            );\n          })}\n        </RechartsLineChart>\n      </div>\n    );\n  }, [\n    showYAxis,\n    effectiveHeight,\n    data,\n    dataKeys,\n    id,\n    yAxisWidth,\n    chartMargin,\n    xAxisHeight,\n    setLabelWidth,\n  ]);\n\n  return (\n    <LabelTooltipProvider>\n      <SideBarTooltipProvider\n        isSideBarTooltipOpen={isSideBarTooltipOpen}\n        setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n        data={sideBarTooltipData}\n        setData={setSideBarTooltipData}\n      >\n        <div\n          className={clsx(\"openui-line-chart-condensed-container\", className)}\n          data-openui-chart={exportData}\n          style={{\n            width: width ? `${width}px` : undefined,\n          }}\n        >\n          {yAxisLabel && (\n            <div className=\"openui-line-chart-condensed-y-axis-label\">{yAxisLabel}</div>\n          )}\n          <div className=\"openui-line-chart-condensed-container-inner\" ref={containerRef}>\n            {/* Y-axis of the chart */}\n            {yAxis}\n            <div className=\"openui-line-chart-condensed\" ref={chartContainerRef}>\n              <ChartContainer\n                config={chartConfig}\n                style={{ width: \"100%\", height: effectiveHeight }}\n                rechartsProps={{\n                  width: \"100%\",\n                  height: \"100%\",\n                }}\n              >\n                <RechartsLineChart\n                  accessibilityLayer\n                  key={`line-chart-condensed-${id}`}\n                  data={data}\n                  margin={chartMargin}\n                  onClick={onLineClick}\n                >\n                  {grid && cartesianGrid()}\n\n                  <XAxis\n                    dataKey={categoryKey as string}\n                    tickLine={false}\n                    axisLine={false}\n                    textAnchor={isAngled ? \"end\" : \"middle\"}\n                    interval=\"preserveStartEnd\"\n                    minTickGap={5}\n                    height={xAxisHeight}\n                    tick={<SVGXAxisTick />}\n                    angle={calculatedAngle}\n                    orientation=\"bottom\"\n                    padding={{\n                      left: X_AXIS_PADDING,\n                      right: X_AXIS_PADDING,\n                    }}\n                  />\n                  {/* Y-axis is rendered in the separate synchronized chart */}\n\n                  <ChartTooltip\n                    content={<CustomTooltipContent parentRef={containerRef} />}\n                    offset={10}\n                  />\n\n                  {dataKeys.map((key) => {\n                    const transformedKey = transformedKeys[key];\n                    const color = `var(--color-${transformedKey})`;\n                    return (\n                      <Line\n                        key={`line-${key}`}\n                        dataKey={key}\n                        type={variant}\n                        stroke={color}\n                        strokeWidth={strokeWidth}\n                        dot={false}\n                        activeDot={<ActiveDot key={`active-dot-${key}-${id}`} />}\n                        isAnimationActive={isAnimationActive}\n                      />\n                    );\n                  })}\n                </RechartsLineChart>\n              </ChartContainer>\n            </div>\n            {isSideBarTooltipOpen && <SideBarTooltip height={effectiveHeight} />}\n          </div>\n          {xAxisLabel && (\n            <div className=\"openui-line-chart-condensed-x-axis-label\">{xAxisLabel}</div>\n          )}\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              containerWidth={effectiveWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </SideBarTooltipProvider>\n    </LabelTooltipProvider>\n  );\n};\n\n// Added React.memo for performance optimization to avoid unnecessary re-renders\nexport const LineChartCondensed = React.memo(\n  LineChartCondensedComponent,\n) as typeof LineChartCondensedComponent;\n","// Common utility functions for Mini Area and Line charts\n// These functions are shared between MiniAreaChart and MiniLineChart components\n\nimport { MiniAreaChartData } from \"../../MiniAreaChart/types\";\nimport { MiniLineChartData } from \"../../MiniLineChart/types\";\n\n// Element spacing constant for both chart types\nexport const MINI_ELEMENT_SPACING: number = 20;\n\ntype ChartData = Array<{\n  value: number;\n  label: string;\n}>;\n\n// Common type for mini chart data - both area and line use the same structure\nexport type MiniChartData = MiniAreaChartData | MiniLineChartData;\n\n/**\n * Transforms mini chart data into a standardized format for rendering.\n * Handles both numeric values and objects with value/label properties.\n * Works for both MiniAreaChart and MiniLineChart components.\n *\n * @param data - The mini chart data array (can contain numbers or objects with value/label)\n * @returns An array of chart data objects with value and label properties\n */\nexport const transformDataForChart = (data: MiniChartData): ChartData => {\n  return data.map((item, index) => {\n    if (typeof item === \"number\") {\n      return { value: item, label: `Item ${index + 1}` };\n    } else {\n      return { value: item.value, label: item.label || `Item ${index + 1}` };\n    }\n  });\n};\n\n/**\n * Filters data to include only the most recent items that can fit within the container width.\n * This function ensures the chart displays the latest data when space is limited.\n * Works for both MiniAreaChart and MiniLineChart components.\n *\n * @param data - The complete mini chart data array\n * @param containerWidth - The total width of the container in pixels\n * @returns A filtered array containing only the most recent data items that fit in the container\n */\nexport const getRecentDataThatFits = (\n  data: MiniChartData,\n  containerWidth: number,\n): MiniChartData => {\n  if (containerWidth <= 0 || data.length === 0) {\n    return data;\n  }\n\n  // Calculate how many items can fit in the available space\n  const maxItems = Math.floor((containerWidth + 20) / MINI_ELEMENT_SPACING);\n  // +20 because the element spacing is between so if we have 2 element then its data 20px data\n  // so we need to add 20px to the container width to get the actual width of the data\n\n  // If all items fit, return all data\n  if (maxItems >= data.length) {\n    return data;\n  }\n\n  // Return the most recent items that fit\n  return data.slice(-maxItems);\n};\n\nexport const DATA_KEY = \"value\";\n","import clsx from \"clsx\";\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Area, AreaChart as RechartsAreaChart, XAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { AreaChartVariant } from \"../AreaChart/types\";\nimport { ChartConfig, ChartContainer } from \"../Charts\";\nimport {\n  DATA_KEY,\n  getRecentDataThatFits,\n  transformDataForChart,\n} from \"../utils/AreaAndLine/MiniAreaAndLineUtils\";\nimport { getLineType } from \"../utils/AreaAndLine/common\";\nimport { useChartPalette, type PaletteName } from \"../utils/PalletUtils\";\nimport { get2dChartConfig } from \"../utils/dataUtils\";\nimport { MiniAreaChartData } from \"./types\";\n\nexport interface MiniAreaChartProps {\n  data: MiniAreaChartData;\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: AreaChartVariant;\n  opacity?: number;\n  isAnimationActive?: boolean;\n  onAreaClick?: (data: any) => void;\n  size?: number | string;\n  className?: string;\n  areaColor?: string;\n  useGradient?: boolean;\n}\n\nexport const MiniAreaChart = ({\n  data,\n  theme = \"ocean\",\n  customPalette,\n  variant: areaChartVariant = \"natural\",\n  opacity = 0.5,\n  isAnimationActive = false,\n  onAreaClick,\n  size = \"100%\",\n  className,\n  areaColor,\n  useGradient = true,\n}: MiniAreaChartProps) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n\n  const variant = getLineType(areaChartVariant);\n\n  useEffect(() => {\n    if (!containerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are only observing the chart container\n      for (const entry of entries) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    resizeObserver.observe(containerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, []);\n\n  // Get the most recent data that fits in the container\n  const filteredData = useMemo(() => {\n    return getRecentDataThatFits(data, containerWidth);\n  }, [data, containerWidth]);\n\n  // Transform the filtered data to a consistent format for recharts\n  const chartData = useMemo(() => {\n    return transformDataForChart(filteredData);\n  }, [filteredData]);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette: customPalette || (areaColor ? [areaColor] : undefined),\n    themePaletteName: \"areaChartPalette\",\n    dataLength: 1,\n  });\n\n  const transformedKeys = useMemo(() => ({ [DATA_KEY]: DATA_KEY }), []);\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig([DATA_KEY], colors, transformedKeys);\n  }, [colors, transformedKeys]);\n\n  const id = useId();\n\n  // Generate unique gradient ID to avoid conflicts when multiple charts are on the same page\n  const gradientId = useMemo(() => `miniAreaGradient-${id}`, [id]);\n  const color = `var(--color-${DATA_KEY})`;\n\n  return (\n    <ChartContainer\n      config={chartConfig}\n      style={{\n        width: size,\n        height: size,\n        aspectRatio: 1 / 1,\n        minHeight: 100,\n        minWidth: 100,\n      }}\n      rechartsProps={{\n        aspect: 1 / 1,\n      }}\n      onClick={onAreaClick}\n      ref={containerRef}\n      className={clsx(\"openui-charts-mini-area-chart-container\", className)}\n    >\n      <RechartsAreaChart\n        accessibilityLayer\n        data={chartData}\n        margin={{\n          top: 10,\n        }}\n      >\n        {useGradient && (\n          <defs>\n            <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n              <stop offset=\"5%\" stopColor={color} stopOpacity={0.6} />\n              <stop offset=\"95%\" stopColor={color} stopOpacity={0} />\n            </linearGradient>\n          </defs>\n        )}\n\n        <XAxis dataKey=\"label\" hide={true} />\n\n        <Area\n          dataKey={DATA_KEY}\n          type={variant}\n          stroke={color}\n          fill={useGradient ? `url(#${gradientId})` : color}\n          fillOpacity={useGradient ? 1 : opacity}\n          isAnimationActive={isAnimationActive}\n          strokeWidth={1.5}\n        />\n      </RechartsAreaChart>\n    </ChartContainer>\n  );\n};\n","import { type MiniBarChartData } from \"../types\";\n\nexport const MINI_BAR_WIDTH: number = 8;\nexport const MINI_ELEMENT_SPACING: number = 10;\n\nconst CONTAINER_HORIZONTAL_PADDING: number = 8; // 4px left + 4px right\n\n/**\n * Calculates the total width of the data.\n *\n * @param data - The mini bar chart data array\n * @returns The total width needed in pixels to display all data items\n */\nconst getWidthOfData = (data: MiniBarChartData) => {\n  return data.length * (MINI_ELEMENT_SPACING + MINI_BAR_WIDTH);\n};\n\n/**\n * Calculates the left and right padding for the chart container based on available space.\n * If the chart data exceeds the container width, no padding is applied.\n *\n * @param data - The mini bar chart data array\n * @param containerWidth - The total width of the container in pixels\n * @returns An object with left and right padding values in pixels\n */\nexport const getPadding = (data: MiniBarChartData, containerWidth: number) => {\n  const availableWidth = containerWidth - CONTAINER_HORIZONTAL_PADDING;\n  const chartWidth = getWidthOfData(data);\n  const paddingValue = availableWidth - chartWidth;\n\n  if (paddingValue < 0) {\n    return {\n      left: 0,\n      right: 0,\n    };\n  }\n  return {\n    left: paddingValue,\n    right: 0,\n  };\n};\n\n/**\n * Filters the data to include only the most recent items that can fit within the container width.\n * This function ensures the chart displays the latest data when space is limited.\n *\n * @param data - The complete mini bar chart data array\n * @param containerWidth - The total width of the container in pixels\n * @returns A filtered array containing only the most recent data items that fit in the container\n */\nexport const getRecentDataThatFits = (\n  data: MiniBarChartData,\n  containerWidth: number,\n): MiniBarChartData => {\n  if (containerWidth <= 0 || data.length === 0) {\n    return data;\n  }\n\n  // Subtract padding to get actual available width for chart content\n  const availableWidth = containerWidth - CONTAINER_HORIZONTAL_PADDING;\n\n  // Calculate how many items can fit in the available space\n  const itemWidth = MINI_BAR_WIDTH + MINI_ELEMENT_SPACING;\n  const maxItems = Math.floor(availableWidth / itemWidth);\n\n  // If all items fit, return all data\n  if (maxItems >= data.length) {\n    return data;\n  }\n\n  // Return the most recent items that fit\n  return data.slice(-maxItems);\n};\n\ntype ChartData = Array<{\n  value: number;\n  label: string;\n}>;\n\n/**\n * Transforms the mini bar chart data into a standardized format for rendering.\n * Handles both numeric values and objects with value/label properties.\n *\n * @param data - The mini bar chart data array (can contain numbers or objects with value/label)\n * @returns An array of chart data objects with value and label properties\n */\nexport const transformDataForChart = (data: MiniBarChartData): ChartData => {\n  return data.map((item, index) => {\n    if (typeof item === \"number\") {\n      return { value: item, label: `Item ${index + 1}` };\n    } else {\n      return { value: item.value, label: item.label || `Item ${index + 1}` };\n    }\n  });\n};\n\nexport const DATA_KEY = \"value\";\n","import clsx from \"clsx\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Bar, BarChart, XAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { ChartConfig, ChartContainer } from \"../Charts\";\nimport { LineInBarShape } from \"../shared\";\nimport { useChartPalette, type PaletteName } from \"../utils/PalletUtils\";\nimport { get2dChartConfig } from \"../utils/dataUtils\";\nimport { type MiniBarChartData } from \"./types\";\nimport {\n  DATA_KEY,\n  getPadding,\n  getRecentDataThatFits,\n  MINI_BAR_WIDTH,\n  transformDataForChart,\n} from \"./utils/miniBarChartUtils\";\n\nexport interface MiniBarChartProps {\n  data: MiniBarChartData;\n  theme?: PaletteName;\n  customPalette?: string[];\n  radius?: number;\n  isAnimationActive?: boolean;\n  onBarsClick?: (data: any) => void;\n  size?: number | string;\n  className?: string;\n  barColor?: string;\n}\n\nconst MINI_BAR_CHART_INNER_LINE_WIDTH = 1;\n\nexport const MiniBarChart = ({\n  data,\n  theme = \"ocean\",\n  customPalette,\n  radius = 1,\n  isAnimationActive = false,\n  onBarsClick,\n  size = \"100%\",\n  className,\n  barColor,\n}: MiniBarChartProps) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n\n  useEffect(() => {\n    if (!containerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      // there is only one entry in the entries array because we are only observing the chart container\n      for (const entry of entries) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    resizeObserver.observe(containerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, []);\n\n  // Get the most recent data that fits in the container\n  const filteredData = useMemo(() => {\n    return getRecentDataThatFits(data, containerWidth);\n  }, [data, containerWidth]);\n\n  // Transform the filtered data to a consistent format for recharts\n  const chartData = useMemo(() => {\n    return transformDataForChart(filteredData);\n  }, [filteredData]);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette: customPalette || (barColor ? [barColor] : undefined),\n    themePaletteName: \"barChartPalette\",\n    dataLength: 1,\n  });\n\n  const transformedKeys = useMemo(() => ({ [DATA_KEY]: DATA_KEY }), []);\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig([DATA_KEY], colors, transformedKeys);\n  }, [colors, transformedKeys]);\n\n  const { mode } = useTheme();\n\n  const barInternalLineColor = useMemo(() => {\n    if (mode === \"light\") {\n      return \"rgba(255, 255, 255, 0.3)\";\n    }\n    return \"rgba(0, 0, 0, 0.3)\";\n  }, [mode]);\n\n  return (\n    <ChartContainer\n      config={chartConfig}\n      style={{\n        width: size,\n        height: size,\n        aspectRatio: 1 / 1,\n        minHeight: 100,\n        minWidth: 100,\n      }}\n      rechartsProps={{\n        aspect: 1 / 1,\n      }}\n      onClick={onBarsClick}\n      ref={containerRef}\n      className={clsx(\"openui-charts-mini-bar-chart-container\", className)}\n    >\n      <BarChart accessibilityLayer data={chartData}>\n        <XAxis hide={true} padding={getPadding(filteredData, containerWidth)} />\n        <Bar\n          dataKey={DATA_KEY}\n          fill={`var(--color-${DATA_KEY})`}\n          radius={[radius, radius, 0, 0]}\n          isAnimationActive={isAnimationActive}\n          maxBarSize={MINI_BAR_WIDTH}\n          barSize={MINI_BAR_WIDTH}\n          shape={\n            <LineInBarShape\n              internalLineWidth={MINI_BAR_CHART_INNER_LINE_WIDTH}\n              internalLineColor={barInternalLineColor}\n            />\n          }\n        />\n      </BarChart>\n    </ChartContainer>\n  );\n};\n","import clsx from \"clsx\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Line, LineChart as RechartsLineChart, XAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ChartConfig, ChartContainer } from \"../Charts\";\nimport { LineChartVariant } from \"../LineChart/types\";\nimport {\n  DATA_KEY,\n  getRecentDataThatFits,\n  transformDataForChart,\n} from \"../utils/AreaAndLine/MiniAreaAndLineUtils\";\nimport { getLineType } from \"../utils/AreaAndLine/common\";\nimport { useChartPalette, type PaletteName } from \"../utils/PalletUtils\";\nimport { get2dChartConfig } from \"../utils/dataUtils\";\nimport { MiniLineChartData } from \"./types\";\n\nexport interface MiniLineChartProps {\n  data: MiniLineChartData;\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: LineChartVariant;\n  strokeWidth?: number;\n  isAnimationActive?: boolean;\n  onLineClick?: (data: any) => void;\n  size?: number | string;\n  className?: string;\n  lineColor?: string;\n}\n\nexport const MiniLineChart = ({\n  data,\n  theme = \"ocean\",\n  customPalette,\n  variant: lineChartVariant = \"natural\",\n  strokeWidth = 2,\n  isAnimationActive = true,\n  onLineClick,\n  size = \"100%\",\n  className,\n  lineColor,\n}: MiniLineChartProps) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n\n  const variant = getLineType(lineChartVariant);\n\n  useEffect(() => {\n    if (!containerRef.current) {\n      return () => {};\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      for (const entry of entries) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    resizeObserver.observe(containerRef.current);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, []);\n\n  // Get the most recent data that fits in the container\n  const filteredData = useMemo(() => {\n    return getRecentDataThatFits(data, containerWidth);\n  }, [data, containerWidth]);\n\n  // Transform the filtered data to a consistent format for recharts\n  const chartData = useMemo(() => {\n    return transformDataForChart(filteredData);\n  }, [filteredData]);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette: customPalette || (lineColor ? [lineColor] : undefined),\n    themePaletteName: \"lineChartPalette\",\n    dataLength: 1,\n  });\n\n  const transformedKeys = useMemo(() => ({ [DATA_KEY]: DATA_KEY }), []);\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig([DATA_KEY], colors, transformedKeys);\n  }, [colors, transformedKeys]);\n\n  return (\n    <ChartContainer\n      config={chartConfig}\n      style={{\n        width: size,\n        height: size,\n        aspectRatio: 1 / 1,\n        minHeight: 100,\n        minWidth: 100,\n      }}\n      rechartsProps={{\n        aspect: 1 / 1,\n      }}\n      onClick={onLineClick}\n      ref={containerRef}\n      className={clsx(\"openui-charts-mini-line-chart-container\", className)}\n    >\n      <RechartsLineChart\n        accessibilityLayer\n        data={chartData}\n        margin={{\n          top: 10,\n        }}\n      >\n        <XAxis dataKey=\"label\" hide={true} />\n\n        <Line\n          dataKey={DATA_KEY}\n          type={variant}\n          stroke={`var(--color-${DATA_KEY})`}\n          strokeWidth={strokeWidth}\n          dot={false}\n          isAnimationActive={isAnimationActive}\n        />\n      </RechartsLineChart>\n    </ChartContainer>\n  );\n};\n","/**\n * Utility functions for pie charts\n */\nimport { useState } from \"react\";\nimport { PieChartData } from \"../types\";\n\nexport interface ChartDimensions {\n  outerRadius: number;\n  innerRadius: number;\n}\n\nexport interface TwoLevelChartDimensions extends ChartDimensions {\n  middleRadius: number;\n}\n\nexport interface HoverStyles {\n  opacity: number;\n  stroke: string;\n  strokeWidth: number;\n}\n\nexport interface ChartHoverHook {\n  activeIndex: number | null;\n  handleMouseEnter: (event: any, index: number) => void;\n  handleMouseLeave: () => void;\n}\n\nexport interface AnimationConfig {\n  isAnimationActive: boolean;\n  animationBegin: number;\n  animationDuration: number;\n  animationEasing: \"ease\" | \"ease-in\" | \"ease-out\" | \"ease-in-out\" | \"linear\";\n}\n\n// ==========================================\n// Core Calculation Utilities\n// ==========================================\n\n/**\n * Calculates the percentage value of a number relative to a total\n * @param value - The value to calculate percentage for\n * @param total - The total value to calculate percentage against\n * @returns The calculated percentage rounded to 2 decimal places\n */\nconst calculatePercentage = (value: number, total: number): number => {\n  if (total === 0) {\n    return 0;\n  }\n  return Number(((value / total) * 100).toFixed(2));\n};\n\n// ==========================================\n// Chart Dimension Calculations\n// ==========================================\n\n/**\n * Calculates dimensions for standard pie/donut charts\n * @param width - The container width\n * @param variant - The chart variant ('pie' or 'donut')\n * @returns Object containing outer and inner radius values\n */\nconst calculateChartDimensions = (width: number, variant: string): ChartDimensions => {\n  const baseRadiusPercentage = 0.45; // Prefer a larger base to better utilize available width\n  let outerRadius = Math.round(width * baseRadiusPercentage);\n\n  // Set minimum and maximum bounds for radius\n  outerRadius = Math.max(50, Math.min(outerRadius, width / 2 - 10)); // Ensure radius isn't too small or too large\n\n  // Calculate inner radius for donut variant - consistent ratio regardless of layout\n  let innerRadius = 0;\n  if (variant === \"donut\") {\n    innerRadius = Math.round(outerRadius * 0.6);\n  }\n\n  return { outerRadius, innerRadius };\n};\n\n/**\n * Calculates dimensions for two-level pie charts\n * @param width - The container width\n * @returns Object containing outer, middle, and inner radius values\n */\nconst calculateTwoLevelChartDimensions = (width: number): TwoLevelChartDimensions => {\n  const baseRadiusPercentage = 0.45; // Prefer a larger base to better utilize available width\n  let outerRadius = Math.round(width * baseRadiusPercentage);\n\n  // Set minimum and maximum bounds for radius\n  outerRadius = Math.max(50, Math.min(outerRadius, width / 2 - 10));\n\n  // Calculate middle radius (inner ring's outer boundary)\n  const middleRadius = Math.round(outerRadius * 0.9);\n\n  // Calculate inner radius - always has a value in two-level chart\n  const innerRadius = Math.round(middleRadius * 0.28);\n\n  return { outerRadius, middleRadius, innerRadius };\n};\n\n// ==========================================\n// Layout and Styling Utilities\n// ==========================================\n\n/**\n * Generates hover style properties for chart cells\n * @param index - The index of the current cell\n * @param activeIndex - The index of the currently hovered cell\n * @returns Object containing hover style properties\n */\nconst getHoverStyles = (index: number, activeIndex: number | null): HoverStyles => {\n  return {\n    opacity: activeIndex === null || activeIndex === index ? 1 : 0.5,\n    stroke: activeIndex === index ? \"#fff\" : \"none\",\n    strokeWidth: activeIndex === index ? 2 : 0,\n  };\n};\n\n// ==========================================\n// Data Transformation Utilities\n// ==========================================\n\n/**\n * Transforms data by adding percentage calculations\n * @param data - The input data array\n * @param dataKey - The key to use for value calculations\n * @returns Transformed data with added percentage and original value\n */\nconst transformDataWithPercentages = <T extends PieChartData>(\n  data: T,\n  dataKey: keyof T[number],\n) => {\n  const total = data.reduce((sum, item) => sum + Number(item[dataKey]), 0);\n  return data.map((item) => ({\n    ...item,\n    percentage: calculatePercentage(Number(item[dataKey as string]), total),\n    originalValue: item[dataKey as string],\n  }));\n};\n\n// ==========================================\n// Hover Effect Utilities\n// ==========================================\n\n/**\n * Custom hook for managing chart hover effects\n * @returns Object containing hover state and handlers\n */\nconst useChartHover = (): ChartHoverHook => {\n  const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n  const handleMouseEnter = (_: any, index: number) => {\n    setActiveIndex(index);\n  };\n\n  const handleMouseLeave = () => {\n    setActiveIndex(null);\n  };\n\n  return {\n    activeIndex,\n    handleMouseEnter,\n    handleMouseLeave,\n  };\n};\n\n// ==========================================\n// Animation Utilities\n// ==========================================\n\n/**\n * Creates animation configuration for pie chart\n * @param config - Animation configuration options\n * @returns Animation configuration object\n */\nconst createAnimationConfig = (config: Partial<AnimationConfig> = {}): AnimationConfig => {\n  return {\n    isAnimationActive: config.isAnimationActive ?? true,\n    animationBegin: config.animationBegin ?? 0,\n    animationDuration: config.animationDuration ?? 1500,\n    animationEasing: config.animationEasing ?? \"ease\",\n  };\n};\n\n// ==========================================\n// Event Handler Utilities\n// ==========================================\n\n/**\n * Creates event handlers for pie chart\n * @param onMouseEnter - Mouse enter handler\n * @param onMouseLeave - Mouse leave handler\n * @param onClick - Click handler\n * @returns Object containing event handlers\n */\nconst createEventHandlers = (\n  onMouseEnter?: (data: any, index: number) => void,\n  onMouseLeave?: () => void,\n  onClick?: (data: any, index: number) => void,\n) => {\n  return {\n    onMouseEnter: onMouseEnter\n      ? (data: any, index: number) => onMouseEnter(data, index)\n      : undefined,\n    onMouseLeave: onMouseLeave ? () => onMouseLeave() : undefined,\n    onClick: onClick ? (data: any, index: number) => onClick(data, index) : undefined,\n  };\n};\n\n// ==========================================\n// Export all utility functions\n// ==========================================\n\nexport {\n  calculateChartDimensions,\n  calculatePercentage,\n  calculateTwoLevelChartDimensions,\n  createAnimationConfig,\n  createEventHandlers,\n  getHoverStyles,\n  transformDataWithPercentages,\n  useChartHover,\n};\n","import clsx from \"clsx\";\nimport { memo, useCallback, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { Cell, Pie, PieChart as RechartsPieChart } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext.js\";\nimport { useTheme } from \"../../ThemeProvider/ThemeProvider.js\";\nimport { ChartContainer, ChartTooltip, ChartTooltipContent } from \"../Charts.js\";\nimport { useExportChartData, useTransformedKeys } from \"../hooks/index.js\";\nimport { DefaultLegend } from \"../shared/DefaultLegend/DefaultLegend.js\";\nimport { StackedLegend } from \"../shared/StackedLegend/StackedLegend.js\";\nimport { LegendItem } from \"../types/Legend.js\";\nimport { getCategoricalChartConfig } from \"../utils/dataUtils.js\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils.js\";\nimport { PieChartData } from \"./types/index.js\";\nimport {\n  calculateChartDimensions,\n  calculateTwoLevelChartDimensions,\n  createAnimationConfig,\n  createEventHandlers,\n  getHoverStyles,\n  transformDataWithPercentages,\n  useChartHover,\n} from \"./utils/PieChartUtils.js\";\n\nexport interface PieChartProps<T extends PieChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  dataKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: \"pie\" | \"donut\";\n  format?: \"percentage\" | \"number\";\n  legend?: boolean;\n  legendVariant?: \"default\" | \"stacked\";\n  isAnimationActive?: boolean;\n  appearance?: \"circular\" | \"semiCircular\";\n  cornerRadius?: number;\n  paddingAngle?: number;\n  onMouseEnter?: (data: any, index: number) => void;\n  onMouseLeave?: () => void;\n  onClick?: (data: any, index: number) => void;\n  className?: string;\n  maxChartSize?: number;\n  minChartSize?: number;\n  // Add height and width props\n  height?: number | string;\n  width?: number | string;\n}\n\nconst STACKED_LEGEND_BREAKPOINT = 400;\nconst MIN_CHART_SIZE = 150;\nconst MAX_CHART_SIZE = 500;\nconst CORNER_RADIUS = 0;\n\nconst PieChartComponent = <T extends PieChartData>({\n  data,\n  categoryKey,\n  dataKey,\n  theme = \"ocean\",\n  customPalette,\n  variant = \"pie\",\n  format = \"number\",\n  legend = true,\n  legendVariant = \"stacked\",\n  isAnimationActive = true,\n  appearance = \"circular\",\n  cornerRadius,\n  paddingAngle = 0,\n  onMouseEnter,\n  onMouseLeave,\n  onClick,\n  className,\n  maxChartSize = MAX_CHART_SIZE,\n  minChartSize = MIN_CHART_SIZE,\n  height,\n  width,\n}: PieChartProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const wrapperRef = useRef<HTMLDivElement>(null);\n  const [wrapperRect, setWrapperRect] = useState({ width: 0, height: 0 });\n  const [hoveredLegendKey, setHoveredLegendKey] = useState<string | null>(null);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const { activeIndex, handleMouseEnter, handleMouseLeave } = useChartHover();\n  const { theme: userTheme } = useTheme();\n\n  // Determine layout mode based on container width\n  const isRowLayout =\n    legend && legendVariant === \"stacked\" && wrapperRect.width >= STACKED_LEGEND_BREAKPOINT;\n\n  // Sort data by value (highest to lowest) for pie chart rendering\n  const sortedProcessedData = useMemo(\n    () => [...data].sort((a, b) => Number(b[dataKey]) - Number(a[dataKey])),\n    [data, dataKey],\n  );\n\n  const categories = useMemo(\n    () => sortedProcessedData.map((item) => String(item[categoryKey])),\n    [sortedProcessedData, categoryKey],\n  );\n  const transformedKeys = useTransformedKeys(categories);\n\n  // Memoize string conversions to avoid repeated calls\n  const categoryKeyString = useMemo(() => String(categoryKey), [categoryKey]);\n  const dataKeyString = useMemo(() => String(dataKey), [dataKey]);\n  const formatKey = useMemo(\n    () => (format === \"percentage\" ? \"percentage\" : dataKeyString),\n    [format, dataKeyString],\n  );\n\n  // Use provided dimensions or observed dimensions from the wrapper\n  const effectiveWidth = wrapperRect.width;\n  const effectiveHeight = wrapperRect.height;\n\n  // Calculate chart dimensions based on the smaller dimension of the container\n  const chartSize = useMemo(() => {\n    // Compute the available width for the chart. In row layout, chart and legend are side-by-side.\n    // Subtract the 20px gap defined in CSS to avoid over-estimating available width.\n    const containerWidth = isRowLayout ? Math.max(0, (effectiveWidth - 20) / 2) : effectiveWidth;\n\n    // If wrapper height isn't explicitly provided (or is very small), it will be driven by the\n    // chart's own content, creating a feedback loop that pins the size to the minimum.\n    // Prefer width in that case to size the chart sensibly.\n    const heightIsUsable = effectiveHeight >= minChartSize;\n\n    let size = heightIsUsable ? Math.min(containerWidth, effectiveHeight) : containerWidth;\n    size = Math.min(size, maxChartSize);\n    return Math.max(minChartSize, size);\n  }, [effectiveWidth, effectiveHeight, isRowLayout]);\n\n  const isSemiCircular = appearance === \"semiCircular\";\n  const chartViewportHeight = useMemo(\n    () => (isSemiCircular ? Math.max(1, Math.ceil(chartSize / 2)) : chartSize),\n    [chartSize, isSemiCircular],\n  );\n  const chartSizeStyle = useMemo(\n    () => ({ width: chartSize, height: chartViewportHeight }),\n    [chartSize, chartViewportHeight],\n  );\n  const rechartsProps = useMemo(\n    () => ({\n      width: \"100%\",\n      height: \"100%\",\n      minWidth: 1,\n      minHeight: 1,\n      initialDimension: { width: 1, height: 1 },\n    }),\n    [],\n  );\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"pieChartPalette\",\n    dataLength: sortedProcessedData.length,\n  });\n\n  const exportData = useExportChartData({\n    type: \"pie\",\n    data: sortedProcessedData,\n    categoryKey: categoryKey as string,\n    dataKeys: [dataKey as string],\n    colors,\n    legend,\n  });\n\n  // Memoize expensive data transformations and configurations\n  const transformedData = useMemo(\n    () => transformDataWithPercentages(sortedProcessedData as T, dataKey),\n    [sortedProcessedData, dataKey],\n  );\n\n  const chartConfig = useMemo(\n    () => getCategoricalChartConfig(sortedProcessedData as T, categoryKey, colors, transformedKeys),\n    [sortedProcessedData, categoryKey, colors, transformedKeys],\n  );\n\n  const animationConfig = useMemo(\n    () => createAnimationConfig({ isAnimationActive }),\n    [isAnimationActive],\n  );\n\n  const eventHandlers = useMemo(\n    () => createEventHandlers(onMouseEnter, onMouseLeave, onClick),\n    [onMouseEnter, onMouseLeave, onClick],\n  );\n\n  const sectorStyle = useMemo(() => {\n    let cornerRadiusValue: number = CORNER_RADIUS;\n\n    if (typeof cornerRadius === \"number\") {\n      cornerRadiusValue = cornerRadius;\n    } else {\n      const cornerRadiusTheme = userTheme.radius2xs;\n      if (cornerRadiusTheme) {\n        cornerRadiusValue =\n          typeof cornerRadiusTheme === \"string\" ? parseInt(cornerRadiusTheme) : cornerRadiusTheme;\n      }\n    }\n\n    return {\n      cornerRadius: cornerRadiusValue,\n      paddingAngle: variant === \"donut\" ? 0.5 : paddingAngle,\n    };\n  }, [cornerRadius, variant, paddingAngle, userTheme.radius2xs]);\n\n  const legendItems = useMemo(\n    () =>\n      sortedProcessedData.map((item, index) => ({\n        key: String(item[categoryKey]),\n        label: String(item[categoryKey]),\n        value: Number(item[dataKey]),\n        color: colors[index] || \"#000000\",\n      })),\n    [sortedProcessedData, categoryKey, dataKey, colors],\n  );\n\n  const defaultLegendItems = useMemo((): LegendItem[] => {\n    return legendItems.map(({ key, label, color }) => ({ key, label, color }));\n  }, [legendItems]);\n\n  const handleLegendItemHover = useCallback(\n    (index: number | null) => {\n      if (legendVariant !== \"stacked\") return;\n      if (index !== null) {\n        const item = sortedProcessedData[index];\n        if (item) {\n          const categoryValue = String(item[categoryKey]);\n          setHoveredLegendKey(categoryValue);\n          const transformedIndex = transformedData.findIndex(\n            (d) => String((d as any)[categoryKey]) === categoryValue,\n          );\n          if (transformedIndex !== -1) {\n            handleMouseEnter(transformedData[transformedIndex], transformedIndex);\n          }\n        }\n      } else {\n        setHoveredLegendKey(null);\n        handleMouseLeave();\n      }\n    },\n    [\n      sortedProcessedData,\n      categoryKey,\n      transformedData,\n      handleMouseEnter,\n      handleMouseLeave,\n      legendVariant,\n    ],\n  );\n\n  const handleChartMouseEnter = useCallback(\n    (entry: any, index: number) => {\n      handleMouseEnter(entry, index);\n      if (legend && legendVariant === \"stacked\") {\n        setHoveredLegendKey(String(entry[categoryKey]));\n      }\n      eventHandlers.onMouseEnter?.(entry, index);\n    },\n    [handleMouseEnter, categoryKey, legend, legendVariant, eventHandlers.onMouseEnter],\n  );\n\n  const handleChartMouseLeave = useCallback(() => {\n    handleMouseLeave();\n    if (legend && legendVariant === \"stacked\") {\n      setHoveredLegendKey(null);\n    }\n    eventHandlers.onMouseLeave?.();\n  }, [handleMouseLeave, legend, legendVariant, eventHandlers.onMouseLeave]);\n\n  const dimensions = useMemo(() => {\n    if (variant === \"donut\") {\n      return calculateTwoLevelChartDimensions(chartSize);\n    }\n    if (isSemiCircular) {\n      return { ...calculateChartDimensions(chartSize, variant), middleRadius: 0 };\n    }\n    return { outerRadius: \"90%\", innerRadius: 0, middleRadius: 0 };\n  }, [variant, chartSize, isSemiCircular]);\n\n  const startAngle = useMemo(() => (appearance === \"semiCircular\" ? 180 : 0), [appearance]);\n  const endAngle = useMemo(() => (appearance === \"semiCircular\" ? 0 : 360), [appearance]);\n\n  const commonPieProps = useMemo(\n    () => ({\n      data: transformedData,\n      dataKey: formatKey,\n      nameKey: categoryKeyString,\n      labelLine: false,\n      label: false,\n      ...animationConfig,\n      ...eventHandlers,\n      ...sectorStyle,\n      startAngle,\n      endAngle,\n      cx: \"50%\",\n      cy: isSemiCircular ? chartViewportHeight : \"50%\",\n      onMouseEnter: handleChartMouseEnter,\n      onMouseLeave: handleChartMouseLeave,\n    }),\n    [\n      transformedData,\n      formatKey,\n      categoryKeyString,\n      animationConfig,\n      eventHandlers,\n      sectorStyle,\n      startAngle,\n      endAngle,\n      isSemiCircular,\n      chartViewportHeight,\n      handleChartMouseEnter,\n      handleChartMouseLeave,\n    ],\n  );\n\n  // Use ResizeObserver for subsequent size changes\n  useLayoutEffect(() => {\n    const wrapper = wrapperRef.current;\n    if (!wrapper) return;\n\n    const observer = new ResizeObserver((entries) => {\n      const entry = entries[0];\n      if (entry) {\n        setWrapperRect({\n          width: entry.contentRect.width,\n          height: entry.contentRect.height,\n        });\n      }\n    });\n    observer.observe(wrapper);\n\n    // Read initial dimensions synchronously before first paint to avoid size jump\n    const rect = wrapper.getBoundingClientRect();\n    setWrapperRect({ width: rect.width, height: rect.height });\n    return () => observer.disconnect();\n  }, []);\n\n  const renderPieCharts = useCallback(() => {\n    if (variant === \"donut\") {\n      return [\n        <Pie\n          key=\"inner-pie\"\n          {...commonPieProps}\n          innerRadius={dimensions.innerRadius}\n          outerRadius={dimensions.middleRadius}\n        >\n          {transformedData.map((entry, index: number) => {\n            const categoryValue = String(entry[categoryKey as keyof typeof entry] || \"\");\n            const transformedKey = transformedKeys[categoryValue] ?? categoryValue;\n            const config = chartConfig[transformedKey];\n            const hoverStyles = getHoverStyles(index, activeIndex);\n            const fill = config?.color || colors[index];\n            return (\n              <Cell\n                key={`inner-cell-${index}`}\n                fill={fill}\n                {...hoverStyles}\n                stroke=\"none\"\n                className=\"openui-pie-chart__inner-cell\"\n              />\n            );\n          })}\n        </Pie>,\n        <Pie\n          key=\"outer-pie\"\n          {...commonPieProps}\n          innerRadius={dimensions.middleRadius}\n          outerRadius={dimensions.outerRadius}\n        >\n          {transformedData.map((entry, index: number) => {\n            const categoryValue = String(entry[categoryKey as keyof typeof entry] || \"\");\n            const transformedKey = transformedKeys[categoryValue] ?? categoryValue;\n            const config = chartConfig[transformedKey];\n            const hoverStyles = getHoverStyles(index, activeIndex);\n            const fill = config?.color || colors[index];\n            return <Cell key={`outer-cell-${index}`} fill={fill} {...hoverStyles} stroke=\"none\" />;\n          })}\n        </Pie>,\n      ];\n    }\n    return (\n      <Pie\n        {...commonPieProps}\n        outerRadius={dimensions.outerRadius}\n        innerRadius={dimensions.innerRadius}\n        activeIndex={activeIndex ?? undefined}\n      >\n        {transformedData.map((entry, index: number) => {\n          const categoryValue = String(entry[categoryKey as keyof typeof entry] || \"\");\n          const transformedKey = transformedKeys[categoryValue] ?? categoryValue;\n          const config = chartConfig[transformedKey];\n          const hoverStyles = getHoverStyles(index, activeIndex);\n          const fill = config?.color || colors[index];\n          return <Cell key={`cell-${index}`} fill={fill} {...hoverStyles} stroke=\"none\" />;\n        })}\n      </Pie>\n    );\n  }, [\n    variant,\n    commonPieProps,\n    dimensions,\n    transformedData,\n    categoryKey,\n    chartConfig,\n    activeIndex,\n    colors,\n    transformedKeys,\n  ]);\n\n  const renderLegend = useCallback(() => {\n    if (!legend) return null;\n    if (legendVariant === \"stacked\") {\n      return (\n        <div className=\"openui-pie-chart-legend-container\">\n          <StackedLegend\n            items={legendItems}\n            onItemHover={setHoveredLegendKey}\n            activeKey={hoveredLegendKey}\n            onLegendItemHover={handleLegendItemHover}\n            containerWidth={isRowLayout ? undefined : wrapperRect.width}\n          />\n        </div>\n      );\n    }\n    return (\n      <DefaultLegend\n        items={defaultLegendItems}\n        containerWidth={wrapperRect.width}\n        isExpanded={isLegendExpanded}\n        setIsExpanded={setIsLegendExpanded}\n      />\n    );\n  }, [\n    legend,\n    legendVariant,\n    legendItems,\n    hoveredLegendKey,\n    handleLegendItemHover,\n    wrapperRect.width,\n    isRowLayout,\n    defaultLegendItems,\n    isLegendExpanded,\n  ]);\n\n  const wrapperClassName = useMemo(\n    () =>\n      clsx(\"openui-pie-chart-container-wrapper\", className, {\n        \"layout-row\": isRowLayout,\n        \"layout-column\": !isRowLayout,\n        \"legend-default\": legend && legendVariant === \"default\",\n        \"legend-stacked\": legend && legendVariant === \"stacked\",\n      }),\n    [className, legend, legendVariant, isRowLayout],\n  );\n\n  const wrapperStyle = useMemo(() => {\n    const formatDimension = (value: number | string | undefined) => {\n      if (typeof value === \"number\") {\n        return `${value}px`;\n      }\n      return value;\n    };\n    const dimensions = {\n      width: formatDimension(width),\n      height: formatDimension(height),\n    };\n\n    return dimensions;\n  }, [width, height]);\n\n  return (\n    <div\n      ref={wrapperRef}\n      className={wrapperClassName}\n      style={wrapperStyle}\n      data-openui-chart={exportData}\n    >\n      <div className=\"openui-pie-chart-container\">\n        <div className=\"openui-pie-chart-container-inner\">\n          <div style={chartSizeStyle}>\n            <ChartContainer\n              config={chartConfig}\n              className=\"openui-pie-chart\"\n              rechartsProps={rechartsProps}\n            >\n              <RechartsPieChart>\n                <ChartTooltip\n                  content={<ChartTooltipContent showPercentage={format === \"percentage\"} />}\n                />\n                {renderPieCharts()}\n              </RechartsPieChart>\n            </ChartContainer>\n          </div>\n        </div>\n      </div>\n      {renderLegend()}\n    </div>\n  );\n};\n\nexport const PieChart = memo(PieChartComponent);\n\nPieChart.displayName = \"PieChart\";\n","/**\n * Truncates text to fit within specified width bounds\n * @param text - The original text\n * @param maxWidth - Maximum width in pixels\n * @param fontSize - Font size for measurement\n * @returns Truncated text with ellipsis if needed\n */\nconst truncateText = (text: string, maxWidth: number, fontSize = 10): string => {\n  if (maxWidth <= 0) return text;\n\n  // Create a temporary canvas to measure text width\n  const canvas = document.createElement(\"canvas\");\n  const context = canvas.getContext(\"2d\");\n  if (!context) return text;\n\n  context.font = `${fontSize}px Inter`;\n\n  // If text fits, return as is\n  if (context.measureText(text).width <= maxWidth) {\n    return text;\n  }\n\n  // Binary search for the longest text that fits\n  let low = 0;\n  let high = text.length;\n  let result = text;\n\n  while (low <= high) {\n    const mid = Math.floor((low + high) / 2);\n    const truncated = text.substring(0, mid) + \"...\";\n    const width = context.measureText(truncated).width;\n\n    if (width <= maxWidth) {\n      result = truncated;\n      low = mid + 1;\n    } else {\n      high = mid - 1;\n    }\n  }\n\n  return result;\n};\n\n/**\n * Calculates the available width for a text label based on its position and anchor point\n *\n * This function determines how much horizontal space is available for a text label\n * by checking its position relative to the container bounds. The calculation varies\n * based on the text anchor position:\n *\n * - For \"start\" anchored text: Available space is from labelX to container right edge\n * - For \"end\" anchored text: Available space is from container left edge to labelX\n * - For \"middle\" anchored text: Takes minimum of left/right space and doubles it\n *\n * @param labelX - X coordinate of the label position\n * @param containerWidth - Total width of the container\n * @param textAnchor - How text is anchored (\"start\", \"end\", or \"middle\")\n * @param padding - Optional padding to maintain from container edges (default 10px)\n * @returns The maximum width available for the label in pixels\n */\nconst calculateAvailableWidth = (\n  labelX: number,\n  containerWidth: number,\n  textAnchor: string,\n  padding = 0,\n): number => {\n  switch (textAnchor) {\n    case \"start\":\n      // Text starts at labelX, extends to the right\n      return Math.max(0, containerWidth - labelX - padding);\n    case \"end\":\n      // Text ends at labelX, extends to the left\n      return Math.max(0, labelX - padding);\n    case \"middle\":\n    default:\n      // Text is centered at labelX\n      const leftSpace = labelX - padding;\n      const rightSpace = containerWidth - labelX - padding;\n      return Math.max(0, Math.min(leftSpace, rightSpace) * 2);\n  }\n};\n\nexport { calculateAvailableWidth, truncateText };\n","import clsx from \"clsx\";\nimport React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport { calculateAvailableWidth, truncateText } from \"../utils\";\n\n// This is the props that are passed by recharts to the custom tick component\ninterface AxisLabelProps {\n  x?: number;\n  y?: number;\n  textAnchor?: string;\n  payload?: {\n    value: string;\n  };\n  className?: string;\n  portalContainerRef?: React.RefObject<HTMLDivElement | null>;\n\n  [key: string]: any; // To allow other props from recharts\n}\n\nexport const AxisLabel: React.FC<AxisLabelProps> = (props) => {\n  const { x, y, payload, textAnchor, portalContainerRef, className } = props;\n  const anchorRef = useRef<SVGGElement>(null);\n\n  /**\n   * Memoizes the calculation of truncated text for axis labels\n   *\n   * This hook handles text truncation based on available space in the chart container:\n   * 1. Returns empty string or original value if payload/container is missing\n   * 2. Calculates container width and available space based on text anchor position\n   * 3. Truncates text to fit within available width using specified font size\n   *\n   * @returns {string} Truncated text that fits within available space\n   *\n   * Dependencies:\n   * - payload?.value: The text content to truncate\n   * - x: X-coordinate of the label\n   * - textAnchor: Text anchor position ('start', 'middle', 'end')\n   * - portalContainerRef: Reference to container element\n   */\n  const truncatedText = useMemo(() => {\n    if (!payload?.value || !portalContainerRef?.current) {\n      return payload?.value || \"\";\n    }\n\n    const container = portalContainerRef.current;\n    // Get the width of the container\n    const containerWidth = container.getBoundingClientRect().width;\n    // Get the padding of the container\n    const padding = 0;\n    // Get the font size of the text\n    const fontSize = 10;\n\n    // Calculate available width based on text anchor and position, and padding\n    const availableWidth = calculateAvailableWidth(\n      x || 0,\n      containerWidth,\n      textAnchor || \"middle\",\n      padding,\n    );\n\n    return truncateText(payload.value, availableWidth, fontSize);\n  }, [payload?.value, x, textAnchor, portalContainerRef]);\n\n  useLayoutEffect(() => {\n    const container = portalContainerRef?.current;\n    const anchor = anchorRef.current;\n\n    if (!container || !anchor || !truncatedText) {\n      return;\n    }\n\n    // Create the label element\n    const labelEl = document.createElement(\"div\");\n    labelEl.textContent = truncatedText;\n    container.appendChild(labelEl);\n\n    // Function to calculate and apply styles\n    const updatePosition = () => {\n      const anchorRect = anchor.getBoundingClientRect();\n      const containerRect = container.getBoundingClientRect();\n      const left = anchorRect.left - containerRect.left;\n      const top = anchorRect.top - containerRect.top;\n\n      const padding = 0;\n      let transform = \"\";\n      if (textAnchor === \"end\") {\n        transform = `translate(calc(-100% - ${padding}px), -50%)`;\n      } else if (textAnchor === \"start\") {\n        transform = `translate(${padding}px, -50%)`;\n      } else {\n        transform = \"translate(-50%, -50%)\";\n      }\n\n      labelEl.style.position = \"absolute\";\n      labelEl.style.left = `${left}px`;\n      labelEl.style.top = `${top}px`;\n      labelEl.style.transform = transform;\n      labelEl.style.pointerEvents = \"none\";\n      labelEl.style.zIndex = \"0\";\n      labelEl.className = clsx(\"openui-chart-polar-angle-axis-label\", className);\n\n      // Update text content if it has changed due to container resize\n      const containerWidth = containerRect.width;\n      const availableWidth = calculateAvailableWidth(\n        left,\n        containerWidth,\n        textAnchor ?? \"middle\",\n        0,\n      );\n      const newTruncatedText = truncateText(payload?.value ?? \"\", availableWidth, 10);\n      if (labelEl.textContent !== newTruncatedText) {\n        labelEl.textContent = newTruncatedText;\n      }\n    };\n\n    updatePosition();\n\n    const resizeObserver = new ResizeObserver(updatePosition);\n    resizeObserver.observe(container);\n\n    // Cleanup function to run when the component unmounts or deps change\n    return () => {\n      resizeObserver.disconnect();\n      if (container.contains(labelEl)) {\n        container.removeChild(labelEl);\n      }\n    };\n  }, [x, y, textAnchor, truncatedText, portalContainerRef, className, payload?.value]);\n\n  return <g ref={anchorRef} transform={`translate(${x || 0}, ${y || 0})`} />;\n};\n","import clsx from \"clsx\";\nimport React, { memo, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport {\n  PolarAngleAxis,\n  PolarGrid,\n  Radar,\n  RadarChart as RechartsRadarChart,\n  ResponsiveContainer,\n} from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport { useExportChartData, useTransformedKeys } from \"../hooks\";\nimport { ActiveDot, CustomTooltipContent, DefaultLegend } from \"../shared\";\nimport { LegendItem } from \"../types\";\nimport { useChartPalette } from \"../utils/PalletUtils\";\nimport { get2dChartConfig, getDataKeys, getLegendItems } from \"../utils/dataUtils\";\nimport { AxisLabel } from \"./components/AxisLabel\";\nimport { RadarChartData } from \"./types\";\n\nconst MIN_CHART_SIZE = 150;\nconst MAX_CHART_SIZE = 296;\n\nexport interface RadarChartProps<T extends RadarChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  theme?: \"ocean\" | \"orchid\" | \"emerald\" | \"sunset\" | \"spectrum\" | \"vivid\";\n  customPalette?: string[];\n  variant?: \"line\" | \"area\";\n  grid?: boolean;\n  legend?: boolean;\n  strokeWidth?: number;\n  areaOpacity?: number;\n  icons?: Partial<Record<keyof T[number], React.ComponentType>>;\n  isAnimationActive?: boolean;\n  height?: number;\n  width?: number;\n}\n\nconst RadarChartComponent = <T extends RadarChartData>({\n  data,\n  categoryKey,\n  theme = \"ocean\",\n  customPalette,\n  variant = \"line\",\n  grid = true,\n  legend = true,\n  strokeWidth = 2,\n  areaOpacity = 0.2,\n  icons = {},\n  isAnimationActive = false,\n  height,\n  width,\n}: RadarChartProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const dataKeys = useMemo(() => {\n    return getDataKeys(data, categoryKey as string);\n  }, [data, categoryKey]);\n\n  const transformedKeys = useTransformedKeys(dataKeys);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"radarChartPalette\",\n    dataLength: dataKeys.length,\n  });\n\n  // Create Config\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(dataKeys, colors, transformedKeys, undefined, icons);\n  }, [dataKeys, icons, colors, transformedKeys]);\n\n  const legendItems: LegendItem[] = useMemo(() => {\n    return getLegendItems(dataKeys, colors, icons);\n  }, [dataKeys, colors, icons]);\n\n  const exportData = useExportChartData({\n    type: \"radar\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys,\n    colors,\n    legend,\n  });\n\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const wrapperRef = useRef<HTMLDivElement>(null);\n  const [wrapperRect, setWrapperRect] = useState({ width: 0, height: 0 });\n\n  useLayoutEffect(() => {\n    const wrapper = wrapperRef.current;\n    if (!wrapper) return;\n\n    const observer = new ResizeObserver((entries) => {\n      const entry = entries[0];\n      if (entry) {\n        setWrapperRect({\n          width: entry.contentRect.width,\n          height: entry.contentRect.height,\n        });\n      }\n    });\n\n    // Read initial dimensions synchronously before first paint to avoid size jump\n    const rect = wrapper.getBoundingClientRect();\n    setWrapperRect({ width: rect.width, height: rect.height });\n\n    observer.observe(wrapper);\n    return () => observer.disconnect();\n  }, []);\n\n  const chartSize = useMemo(() => {\n    const effectiveWidth = wrapperRect.width;\n    const effectiveHeight = wrapperRect.height;\n    let charts = Math.min(effectiveWidth, effectiveHeight);\n    charts = Math.min(charts, MAX_CHART_SIZE);\n    return Math.max(MIN_CHART_SIZE, charts);\n  }, [wrapperRect]);\n\n  const chartSizeStyle = useMemo(() => ({ width: chartSize, height: chartSize }), [chartSize]);\n  const rechartsProps: Omit<React.ComponentProps<typeof ResponsiveContainer>, \"children\"> = useMemo(\n    () => ({\n      width: \"100%\",\n      height: \"100%\",\n      minWidth: 1,\n      minHeight: 1,\n      initialDimension: { width: 1, height: 1 },\n    }),\n    [],\n  );\n\n  const radars = useMemo(() => {\n    return dataKeys.map((key) => {\n      const transformedKey = transformedKeys[key];\n      const color = `var(--color-${transformedKey})`;\n      if (variant === \"line\") {\n        return (\n          <Radar\n            key={key}\n            dataKey={key}\n            fill={color}\n            fillOpacity={0}\n            stroke={color}\n            strokeWidth={strokeWidth}\n            isAnimationActive={isAnimationActive}\n            activeDot={<ActiveDot />}\n          />\n        );\n      } else {\n        return (\n          <Radar\n            key={key}\n            dataKey={key}\n            fill={color}\n            stroke={color}\n            strokeWidth={strokeWidth}\n            fillOpacity={areaOpacity}\n            isAnimationActive={isAnimationActive}\n            activeDot={<ActiveDot />}\n          />\n        );\n      }\n    });\n  }, [dataKeys, transformedKeys, variant, strokeWidth, areaOpacity, isAnimationActive]);\n\n  const wrapperClassName = useMemo(\n    () =>\n      clsx(\"openui-radar-chart-container-wrapper\", {\n        \"layout-column\": true,\n      }),\n    [],\n  );\n\n  const wrapperStyle = useMemo(() => {\n    const formatDimension = (value: number | string | undefined) => {\n      if (typeof value === \"number\") {\n        return `${value}px`;\n      }\n      return value;\n    };\n    const dimensions = {\n      width: formatDimension(width),\n      height: formatDimension(height),\n    };\n\n    if (dimensions.width === undefined) {\n      delete dimensions.width;\n    }\n\n    if (dimensions.height === undefined) {\n      delete dimensions.height;\n    }\n\n    return dimensions;\n  }, [width, height]);\n\n  return (\n    <SideBarTooltipProvider\n      isSideBarTooltipOpen={false}\n      setIsSideBarTooltipOpen={() => {}}\n      data={undefined}\n      setData={() => {}}\n    >\n      <div\n        ref={wrapperRef}\n        className={wrapperClassName}\n        style={wrapperStyle}\n        data-openui-chart={exportData}\n      >\n        <div className=\"openui-radar-chart-container\">\n          <div className=\"openui-radar-chart-container-inner\">\n            <div style={chartSizeStyle}>\n              <ChartContainer\n                config={chartConfig}\n                className=\"openui-radar-chart\"\n                rechartsProps={rechartsProps}\n              >\n                <RechartsRadarChart\n                  data={data}\n                  margin={{\n                    left: 10,\n                    right: 10,\n                    top: 10,\n                    bottom: 10,\n                  }}\n                >\n                  {grid && <PolarGrid className=\"openui-chart-polar-grid\" stroke=\"currentColor\" />}\n                  <PolarAngleAxis\n                    dataKey={categoryKey as string}\n                    tick={<AxisLabel portalContainerRef={wrapperRef} />}\n                  />\n\n                  <ChartTooltip\n                    cursor={false}\n                    content={<CustomTooltipContent parentRef={wrapperRef} />}\n                  />\n                  {/* rendering the radars here */}\n                  {radars}\n                </RechartsRadarChart>\n              </ChartContainer>\n            </div>\n          </div>\n        </div>\n        {legend && (\n          <DefaultLegend\n            items={legendItems}\n            containerWidth={wrapperRect.width}\n            isExpanded={isLegendExpanded}\n            setIsExpanded={setIsLegendExpanded}\n            style={{ paddingTop: 0 }}\n          />\n        )}\n      </div>\n    </SideBarTooltipProvider>\n  );\n};\n\nexport const RadarChart = memo(RadarChartComponent);\n\nRadarChart.displayName = \"RadarChart\";\n","/**\n * Utility functions for radial charts\n */\nimport { useState } from \"react\";\nimport { RadialChartData } from \"../types\";\n\n// ==========================================\n\nexport interface RadialChartDimensions {\n  outerRadius: number;\n  innerRadius: number;\n}\n\nexport interface RadialHoverStyles {\n  opacity: number;\n  stroke: string;\n  strokeWidth: number;\n}\n\nexport interface RadialChartHoverHook {\n  activeIndex: number | null;\n  handleMouseEnter: (event: any, index: number) => void;\n  handleMouseLeave: () => void;\n}\n\nexport interface RadialAnimationConfig {\n  isAnimationActive: boolean;\n  animationBegin: number;\n  animationDuration: number;\n  animationEasing: \"ease\" | \"ease-in\" | \"ease-out\" | \"ease-in-out\" | \"linear\";\n}\n\n// ==========================================\n// Core Calculation Utilities\n// ==========================================\n\n/**\n * Calculates the percentage value of a number relative to a total\n * @param value - The value to calculate percentage for\n * @param total - The total value to calculate percentage against\n * @returns The calculated percentage rounded to 2 decimal places\n */\nexport const calculatePercentage = (value: number, total: number): number => {\n  if (total === 0) {\n    return 0;\n  }\n  return Number(((value / total) * 100).toFixed(2));\n};\n\n// ==========================================\n// Chart Dimension Calculations\n// ==========================================\n\n/**\n * Calculates dimensions for radial charts based on container size\n * @param width - The container width\n * @param variant - The chart variant ('semicircle' or 'circular')\n * @returns Object containing outer and inner radius values\n */\nexport const calculateRadialChartDimensions = (width: number): RadialChartDimensions => {\n  // Prefer a base that better utilizes width while leaving a small margin to prevent clipping\n  const baseRadiusPercentage = 0.45;\n  let outerRadius = Math.round(width * baseRadiusPercentage);\n\n  // Clamp radius within sensible bounds and leave ~10px margin from the edge\n  outerRadius = Math.max(50, Math.min(outerRadius, Math.round(width / 2) - 10));\n\n  // The inner radius is 30% of the outer radius\n  const innerRadius = Math.round(outerRadius * 0.3);\n\n  return { outerRadius, innerRadius };\n};\n\n// ==========================================\n// Layout and Styling Utilities\n// ==========================================\n\n/**\n * Generates hover style properties for radial chart cells\n * @param index - The index of the current cell\n * @param activeIndex - The index of the currently hovered cell\n * @returns Object containing hover style properties\n */\nexport const getRadialHoverStyles = (\n  index: number,\n  activeIndex: number | null,\n): RadialHoverStyles => {\n  return {\n    opacity: activeIndex === null || activeIndex === index ? 1 : 0.6,\n    stroke: activeIndex === index ? \"#fff\" : \"none\",\n    strokeWidth: activeIndex === index ? 2 : 0,\n  };\n};\n\n// ==========================================\n// Data Transformation Utilities\n// ==========================================\n\n/**\n * Transforms data by adding percentage calculations and colors\n * @param data - The input data array\n * @param dataKey - The key to use for value calculations\n * @param theme - The color theme to use\n * @returns Transformed data with added percentage, original value, and fill color\n */\nexport const transformRadialDataWithPercentages = <T extends RadialChartData>(\n  data: T,\n  dataKey: keyof T[number],\n  colors: string[], // Change this from 'theme: string' to 'colors: string[]'\n) => {\n  const total = data.reduce((sum, item) => sum + Number(item[dataKey]), 0);\n\n  return data.map((item, index) => ({\n    ...item,\n    percentage: calculatePercentage(Number(item[dataKey as string]), total),\n    originalValue: item[dataKey as string],\n    fill: colors[index],\n  }));\n};\n\n// ==========================================\n// Hover Effect Utilities\n// ==========================================\n\n/**\n * Custom hook for managing radial chart hover effects\n * @returns Object containing hover state and handlers\n */\nexport const useRadialChartHover = (): RadialChartHoverHook => {\n  const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n  const handleMouseEnter = (_: any, index: number) => {\n    setActiveIndex(index);\n  };\n\n  const handleMouseLeave = () => {\n    setActiveIndex(null);\n  };\n\n  return {\n    activeIndex,\n    handleMouseEnter,\n    handleMouseLeave,\n  };\n};\n\n// ==========================================\n// Animation Utilities\n// ==========================================\n\n/**\n * Creates animation configuration for radial chart\n * @param config - Animation configuration options\n * @returns Animation configuration object\n */\nexport const createRadialAnimationConfig = (\n  config: Partial<RadialAnimationConfig> = {},\n): RadialAnimationConfig => {\n  return {\n    isAnimationActive: config.isAnimationActive ?? true,\n    animationBegin: config.animationBegin ?? 0,\n    animationDuration: config.animationDuration ?? 1500,\n    animationEasing: config.animationEasing ?? \"ease\",\n  };\n};\n\n// ==========================================\n// Event Handler Utilities\n// ==========================================\n\n/**\n * Creates event handlers for radial chart\n * @param onMouseEnter - Mouse enter handler\n * @param onMouseLeave - Mouse leave handler\n * @param onClick - Click handler\n * @returns Object containing event handlers\n */\nexport const createRadialEventHandlers = (\n  onMouseEnter?: (data: any, index: number) => void,\n  onMouseLeave?: () => void,\n  onClick?: (data: any, index: number) => void,\n) => {\n  return {\n    onMouseEnter: onMouseEnter\n      ? (data: any, index: number) => onMouseEnter(data, index)\n      : undefined,\n    onMouseLeave: onMouseLeave ? () => onMouseLeave() : undefined,\n    onClick: onClick ? (data: any, index: number) => onClick(data, index) : undefined,\n  };\n};\n\n// ==========================================\n// Backward compatibility - keeping old function names\n// ==========================================\n\n// Keep old function names for backward compatibility\nexport const transformRadialData = transformRadialDataWithPercentages;\nexport const useChartHover = useRadialChartHover;\nexport const getHoverStyles = getRadialHoverStyles;\n","import clsx from \"clsx\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Cell, PolarGrid, RadialBar, RadialBarChart, ResponsiveContainer } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ChartContainer, ChartTooltip, ChartTooltipContent } from \"../Charts\";\nimport { useExportChartData, useTransformedKeys } from \"../hooks\";\nimport { DefaultLegend } from \"../shared/DefaultLegend/DefaultLegend\";\nimport { StackedLegend } from \"../shared/StackedLegend/StackedLegend\";\nimport { LegendItem } from \"../types/Legend\";\nimport { getCategoricalChartConfig } from \"../utils/dataUtils\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\nimport { RadialChartData } from \"./types\";\nimport {\n  calculateRadialChartDimensions,\n  createRadialAnimationConfig,\n  createRadialEventHandlers,\n  getRadialHoverStyles,\n  transformRadialDataWithPercentages,\n  useRadialChartHover,\n} from \"./utils/RadialChartUtils\";\n\nexport interface RadialChartProps<T extends RadialChartData> {\n  data: T;\n  categoryKey: keyof T[number];\n  dataKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  variant?: \"semicircle\" | \"circular\";\n  format?: \"percentage\" | \"number\";\n  legend?: boolean;\n  legendVariant?: \"default\" | \"stacked\";\n  grid?: boolean;\n  isAnimationActive?: boolean;\n  cornerRadius?: number;\n  onMouseEnter?: (data: any, index: number) => void;\n  onMouseLeave?: () => void;\n  onClick?: (data: any, index: number) => void;\n  className?: string;\n  maxChartSize?: number;\n  minChartSize?: number;\n  height?: number | string;\n  width?: number | string;\n}\n\nconst STACKED_LEGEND_BREAKPOINT = 400;\nconst MIN_CHART_SIZE = 150;\nconst MAX_CHART_SIZE = 500;\n\nexport const RadialChart = <T extends RadialChartData>({\n  data,\n  categoryKey,\n  dataKey,\n  theme = \"ocean\",\n  customPalette,\n  variant = \"circular\",\n  format = \"number\",\n  legend = true,\n  legendVariant = \"stacked\",\n  grid = false,\n  isAnimationActive = false,\n  cornerRadius = 10,\n  onMouseEnter,\n  onMouseLeave,\n  onClick,\n  className,\n  maxChartSize = MAX_CHART_SIZE,\n  minChartSize = MIN_CHART_SIZE,\n  height,\n  width,\n}: RadialChartProps<T>) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const wrapperRef = useRef<HTMLDivElement>(null);\n  const [wrapperRect, setWrapperRect] = useState({ width: 0, height: 0 });\n  const [hoveredLegendKey, setHoveredLegendKey] = useState<string | null>(null);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const { activeIndex, handleMouseEnter, handleMouseLeave } = useRadialChartHover();\n\n  // Determine layout mode based on container width\n  const isRowLayout =\n    legend && legendVariant === \"stacked\" && wrapperRect.width >= STACKED_LEGEND_BREAKPOINT;\n\n  // Sort data by value (highest to lowest) for radial chart rendering\n  const sortedProcessedData = useMemo(\n    () => [...data].sort((a, b) => Number(b[dataKey]) - Number(a[dataKey])),\n    [data, dataKey],\n  );\n\n  const categories = useMemo(\n    () => sortedProcessedData.map((item) => String(item[categoryKey])),\n    [sortedProcessedData, categoryKey],\n  );\n  const transformedKeys = useTransformedKeys(categories);\n\n  // Memoize string conversions to avoid repeated calls\n  const categoryKeyString = useMemo(() => String(categoryKey), [categoryKey]);\n  const dataKeyString = useMemo(() => String(dataKey), [dataKey]);\n  const formatKey = useMemo(\n    () => (format === \"percentage\" ? \"percentage\" : dataKeyString),\n    [format, dataKeyString],\n  );\n\n  // Use provided dimensions or observed dimensions from the wrapper\n  const effectiveWidth = wrapperRect.width;\n  const effectiveHeight = wrapperRect.height;\n\n  // Calculate chart dimensions based on the smaller dimension of the container\n  const chartSize = useMemo(() => {\n    // Compute the available width for the chart. In row layout, chart and legend sit side-by-side.\n    // Subtract the 20px gap defined in CSS to avoid over-estimating available width.\n    const containerWidth = isRowLayout ? Math.max(0, (effectiveWidth - 20) / 2) : effectiveWidth;\n\n    // If wrapper height isn't explicitly provided (or is very small), prefer sizing by width to\n    // avoid a feedback loop where height depends on the chart, which then clamps the size.\n    const heightIsUsable = effectiveHeight >= minChartSize;\n\n    let size = heightIsUsable ? Math.min(containerWidth, effectiveHeight) : containerWidth;\n    size = Math.min(size, maxChartSize);\n    return Math.max(minChartSize, size);\n  }, [effectiveWidth, effectiveHeight, isRowLayout]);\n\n  const chartSizeStyle = useMemo(\n    () => ({\n      width: chartSize,\n      height: chartSize,\n    }),\n    [chartSize],\n  );\n\n  const rechartsProps: Omit<React.ComponentProps<typeof ResponsiveContainer>, \"children\"> = useMemo(\n    () => ({\n      width: \"100%\",\n      height: \"100%\",\n      minWidth: 1,\n      minHeight: 1,\n      initialDimension: { width: 1, height: 1 },\n    }),\n    [],\n  );\n\n  // Calculate chart radii\n  const dimensions = useMemo(() => calculateRadialChartDimensions(chartSize), [chartSize]);\n\n  // Get color palette and distribute colors\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"radialChartPalette\",\n    dataLength: sortedProcessedData.length,\n  });\n\n  const exportData = useExportChartData({\n    type: \"pie\",\n    data: sortedProcessedData,\n    categoryKey: categoryKey as string,\n    dataKeys: [dataKey as string],\n    colors,\n    legend,\n  });\n\n  // Memoize expensive data transformations and configurations\n  const transformedData = useMemo(\n    () => transformRadialDataWithPercentages(sortedProcessedData as T, dataKey, colors),\n    [sortedProcessedData, dataKey, colors],\n  );\n\n  const chartConfig = useMemo(\n    () => getCategoricalChartConfig(sortedProcessedData as T, categoryKey, colors, transformedKeys),\n    [sortedProcessedData, categoryKey, colors, transformedKeys],\n  );\n\n  const animationConfig = useMemo(\n    () => createRadialAnimationConfig({ isAnimationActive }),\n    [isAnimationActive],\n  );\n\n  const eventHandlers = useMemo(\n    () => createRadialEventHandlers(onMouseEnter, onMouseLeave, onClick),\n    [onMouseEnter, onMouseLeave, onClick],\n  );\n\n  // Create legend items for both variants\n  const legendItems = useMemo(\n    () =>\n      sortedProcessedData.map((item, index) => ({\n        key: String(item[categoryKey]),\n        label: String(item[categoryKey]),\n        value: Number(item[dataKey]),\n        color: colors[index] || \"#000000\",\n      })),\n    [sortedProcessedData, categoryKey, dataKey, colors],\n  );\n\n  const defaultLegendItems = useMemo((): LegendItem[] => {\n    return legendItems.map(({ key, label, color }) => ({ key, label, color }));\n  }, [legendItems]);\n\n  // Handle legend item hover to highlight radial bar\n  const handleLegendItemHover = useCallback(\n    (index: number | null) => {\n      if (legendVariant !== \"stacked\") return;\n      if (index !== null) {\n        const item = sortedProcessedData[index];\n        if (item) {\n          const categoryValue = String(item[categoryKey]);\n          setHoveredLegendKey(categoryValue);\n          // Find the index in the transformed data (which is also sorted)\n          const transformedIndex = transformedData.findIndex(\n            (d) => String((d as any)[categoryKey]) === categoryValue,\n          );\n          if (transformedIndex !== -1) {\n            handleMouseEnter(transformedData[transformedIndex], transformedIndex);\n          }\n        }\n      } else {\n        setHoveredLegendKey(null);\n        handleMouseLeave();\n      }\n    },\n    [\n      sortedProcessedData,\n      categoryKey,\n      transformedData,\n      handleMouseEnter,\n      handleMouseLeave,\n      legendVariant,\n    ],\n  );\n\n  // Enhanced chart hover handlers\n  const handleChartMouseEnter = useCallback(\n    (entry: any, index: number) => {\n      handleMouseEnter(entry, index);\n      if (legend && legendVariant === \"stacked\") {\n        setHoveredLegendKey(String(entry[categoryKey]));\n      }\n      eventHandlers.onMouseEnter?.(entry, index);\n    },\n    [handleMouseEnter, categoryKey, legend, legendVariant, eventHandlers.onMouseEnter],\n  );\n\n  const handleChartMouseLeave = useCallback(() => {\n    handleMouseLeave();\n    if (legend && legendVariant === \"stacked\") {\n      setHoveredLegendKey(null);\n    }\n    eventHandlers.onMouseLeave?.();\n  }, [handleMouseLeave, legend, legendVariant, eventHandlers.onMouseLeave]);\n\n  // Setup ResizeObserver to watch the wrapper element\n  useEffect(() => {\n    const wrapper = wrapperRef.current;\n    if (!wrapper) return;\n\n    // Use ResizeObserver if component is in responsive mode (no fixed width/height)\n    const observer = new ResizeObserver((entries) => {\n      const entry = entries[0];\n      if (entry) {\n        setWrapperRect({\n          width: entry.contentRect.width,\n          height: entry.contentRect.height,\n        });\n      }\n    });\n    observer.observe(wrapper);\n    return () => observer.disconnect();\n  }, []);\n\n  const renderLegend = useCallback(() => {\n    if (!legend) return null;\n    if (legendVariant === \"stacked\") {\n      return (\n        <div className=\"openui-radial-chart-legend-container\">\n          <StackedLegend\n            items={legendItems}\n            onItemHover={setHoveredLegendKey}\n            activeKey={hoveredLegendKey}\n            onLegendItemHover={handleLegendItemHover}\n            containerWidth={isRowLayout ? undefined : wrapperRect.width}\n          />\n        </div>\n      );\n    }\n    return (\n      <DefaultLegend\n        items={defaultLegendItems}\n        containerWidth={wrapperRect.width}\n        isExpanded={isLegendExpanded}\n        setIsExpanded={setIsLegendExpanded}\n      />\n    );\n  }, [\n    legend,\n    legendVariant,\n    legendItems,\n    hoveredLegendKey,\n    handleLegendItemHover,\n    wrapperRect.width,\n    isRowLayout,\n    defaultLegendItems,\n    isLegendExpanded,\n  ]);\n\n  const wrapperClassName = clsx(\"openui-radial-chart-container-wrapper\", className, {\n    \"layout-row\": isRowLayout,\n    \"layout-column\": !isRowLayout,\n    \"legend-default\": legend && legendVariant === \"default\",\n    \"legend-stacked\": legend && legendVariant === \"stacked\",\n  });\n\n  // Correct angles for semicircle (top half)\n  const startAngle = variant === \"semicircle\" ? 180 : 0;\n  const endAngle = variant === \"semicircle\" ? 0 : 360;\n\n  const wrapperStyle = useMemo(() => {\n    const formatDimension = (value: number | string | undefined) => {\n      if (typeof value === \"number\") {\n        return `${value}px`;\n      }\n      return value;\n    };\n    const dimensions = {\n      width: formatDimension(width),\n      height: formatDimension(height),\n    };\n\n    if (dimensions.width === undefined) {\n      delete dimensions.width;\n    }\n\n    if (dimensions.height === undefined) {\n      delete dimensions.height;\n    }\n    return dimensions;\n  }, [width, height]);\n\n  return (\n    <div\n      ref={wrapperRef}\n      className={wrapperClassName}\n      style={wrapperStyle}\n      aria-description=\"radial-chart-wrapper\"\n      data-openui-chart={exportData}\n    >\n      <div className=\"openui-radial-chart-container\">\n        <div className=\"openui-radial-chart-container-inner\">\n          <div style={chartSizeStyle}>\n            <ChartContainer\n              config={chartConfig}\n              className=\"openui-radial-chart\"\n              rechartsProps={rechartsProps}\n            >\n              <RadialBarChart\n                data={transformedData}\n                startAngle={startAngle}\n                endAngle={endAngle}\n                innerRadius={dimensions.innerRadius}\n                outerRadius={dimensions.outerRadius}\n              >\n                {grid && <PolarGrid gridType=\"circle\" />}\n                <ChartTooltip\n                  cursor={false}\n                  content={\n                    <ChartTooltipContent\n                      showPercentage={format === \"percentage\"}\n                      nameKey={categoryKeyString}\n                    />\n                  }\n                />\n                <RadialBar\n                  dataKey={formatKey}\n                  background={!grid}\n                  cornerRadius={cornerRadius}\n                  {...animationConfig}\n                  activeIndex={activeIndex ?? undefined}\n                  onMouseEnter={handleChartMouseEnter}\n                  onMouseLeave={handleChartMouseLeave}\n                  onClick={eventHandlers.onClick}\n                >\n                  {transformedData.map((entry, index) => {\n                    const categoryValue = String(entry[categoryKey as keyof typeof entry] || \"\");\n                    const config = chartConfig[categoryValue];\n                    const hoverStyles = getRadialHoverStyles(index, activeIndex);\n                    const fill = config?.color || colors[index];\n                    return (\n                      <Cell key={`cell-${index}`} fill={fill} {...hoverStyles} stroke=\"none\" />\n                    );\n                  })}\n                </RadialBar>\n              </RadialBarChart>\n            </ChartContainer>\n          </div>\n        </div>\n      </div>\n      {renderLegend()}\n    </div>\n  );\n};\n","import React, { useState } from \"react\";\n\nexport interface ScatterDotProps {\n  cx?: number;\n  cy?: number;\n  fill?: string;\n  radius?: number;\n  variant?: \"circle\" | \"square\";\n}\n\nconst ScatterDot: React.FC<ScatterDotProps> = ({ cx, cy, fill, variant = \"circle\" }) => {\n  const [active, setActive] = useState(false);\n  if (typeof cx !== \"number\" || typeof cy !== \"number\") {\n    return null;\n  }\n\n  const OUTLINE_COLOR = \"var(--openui-highlight)\";\n  const OUTLINE_WIDTH = 2;\n  const displayRadius = active ? 5 : 3;\n\n  if (variant === \"square\") {\n    const sideLength = displayRadius * 2;\n    return (\n      <rect\n        x={cx - displayRadius}\n        y={cy - displayRadius}\n        width={sideLength}\n        height={sideLength}\n        fill={fill}\n        stroke={active ? OUTLINE_COLOR : \"none\"}\n        strokeWidth={OUTLINE_WIDTH}\n        strokeLinejoin=\"round\"\n        vectorEffect=\"non-scaling-stroke\"\n        rx={2}\n        onPointerEnter={() => {\n          setActive(true);\n        }}\n        onPointerLeave={() => {\n          setActive(false);\n        }}\n      />\n    );\n  }\n\n  return (\n    <circle\n      cx={cx}\n      cy={cy}\n      r={displayRadius}\n      fill={fill}\n      stroke={active ? OUTLINE_COLOR : \"none\"}\n      strokeWidth={OUTLINE_WIDTH}\n      vectorEffect=\"non-scaling-stroke\"\n      onPointerEnter={() => {\n        setActive(true);\n      }}\n      onPointerLeave={() => {\n        setActive(false);\n      }}\n    />\n  );\n};\n\nexport default ScatterDot;\n","import { ScatterChartData, ScatterPoint } from \"../types\";\n\n/**\n * Extracts dataset names from scatter chart data\n * @param data - The scatter chart data (array of datasets)\n * @returns Array of dataset names\n */\nexport const getScatterDatasets = (data: ScatterChartData): string[] => {\n  if (!data || !Array.isArray(data)) {\n    return [];\n  }\n  return data.map((dataset) => dataset.name);\n};\n\n/**\n * Transforms scatter chart data for recharts consumption\n * @param data - The scatter chart data (array of datasets)\n * @param datasets - Array of dataset names to include\n * @param colors - Array of colors for datasets\n * @returns Flattened array of all points with color and dataset info\n */\nexport const transformScatterData = (\n  data: ScatterChartData,\n  datasets: string[],\n  colors: string[],\n) => {\n  // Guard against undefined or null data\n  if (!data || !Array.isArray(data) || data.length === 0) {\n    return [];\n  }\n\n  const datasetColors: { [key: string]: string } = {};\n  datasets.forEach((ds, i) => {\n    datasetColors[ds] = colors[i] ?? \"transparent\";\n  });\n\n  // Flatten all datasets into a single array with dataset info\n  const transformedPoints: Array<ScatterPoint & { color: string; dataset: string }> = [];\n\n  data.forEach((dataset) => {\n    // Use only palette colors, ignore any hardcoded colors in datasets\n    const color = datasetColors[dataset.name] || \"transparent\";\n\n    dataset.data.forEach((point) => {\n      transformedPoints.push({\n        ...point,\n        x: Number(point.x),\n        y: Number(point.y),\n        z: point.z ? Number(point.z) : undefined,\n        color,\n        dataset: dataset.name,\n      });\n    });\n  });\n\n  return transformedPoints;\n};\n\n/**\n * Calculates the domain for scatter chart axes\n * @param data - The scatter chart data (array of datasets)\n * @param axis - Which axis ('x' or 'y')\n * @returns Domain array [min, max] with padding\n */\nexport const calculateScatterDomain = (\n  data: ScatterChartData,\n  axis: \"x\" | \"y\",\n): [number, number] => {\n  if (!data || !Array.isArray(data) || !data.length) return [0, 100];\n\n  // Flatten all data points from all datasets\n  const allPoints = data.flatMap((dataset) => dataset.data);\n\n  const values = allPoints.map((point) => Number(point[axis])).filter((val) => !isNaN(val));\n  if (!values.length) return [0, 100];\n\n  const min = Math.min(...values);\n  const max = Math.max(...values);\n  const padding = (max - min) * 0.1; // 10% padding\n\n  return [Math.max(0, min - padding), max + padding];\n};\n\n/**\n * Formats scatter chart data for tooltip display\n * @param dataKey - The data key being displayed\n * @param value - The value to format\n * @param unit - Optional unit to append\n * @returns Formatted string\n */\nexport const formatScatterTooltipValue = (value: number | string, unit?: string): string => {\n  const formattedValue = typeof value === \"number\" ? value.toLocaleString() : value;\n  return unit ? `${formattedValue} ${unit}` : formattedValue;\n};\n","import clsx from \"clsx\";\nimport React, { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Cell, ScatterChart as RechartsScatterChart, Scatter, XAxis, YAxis } from \"recharts\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { ChartConfig, ChartContainer, ChartTooltip } from \"../Charts\";\nimport { SideBarChartData, SideBarTooltipProvider } from \"../context/SideBarTooltipContext\";\nimport { useExportChartData, useYAxisLabelWidth } from \"../hooks\";\nimport {\n  CustomTooltipContent,\n  DefaultLegend,\n  gridCartesianGrid,\n  SideBarTooltip,\n  SVGXAxisTick,\n  YAxisTick,\n} from \"../shared\";\nimport { LegendItem } from \"../types\";\nimport { get2dChartConfig, getLegendItems } from \"../utils/dataUtils\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\nimport { numberTickFormatter } from \"../utils/styleUtils\";\nimport ScatterDot from \"./components/ScatterDot\";\nimport { ScatterChartData, ScatterPoint } from \"./types\";\nimport {\n  calculateScatterDomain,\n  getScatterDatasets,\n  transformScatterData,\n} from \"./utils/ScatterChartUtils\";\n\nexport interface ScatterChartProps {\n  data: ScatterChartData;\n  xAxisDataKey?: string;\n  yAxisDataKey?: string;\n  theme?: PaletteName;\n  customPalette?: string[];\n  grid?: boolean;\n  legend?: boolean;\n  isAnimationActive?: boolean;\n  xAxisLabel?: React.ReactNode;\n  yAxisLabel?: React.ReactNode;\n  className?: string;\n  height?: number | string;\n  width?: number | string;\n  shape?: \"circle\" | \"square\";\n}\n\nconst DEFAULT_CHART_HEIGHT = 296;\nconst X_AXIS_HEIGHT = 40;\n\nexport const ScatterChart = ({\n  data,\n  xAxisDataKey = \"x\",\n  yAxisDataKey = \"y\",\n  theme = \"ocean\",\n  customPalette,\n  grid = true,\n  xAxisLabel,\n  yAxisLabel,\n  legend = true,\n  isAnimationActive = false,\n  className,\n  height,\n  width,\n  shape = \"circle\",\n}: ScatterChartProps) => {\n  const printContext = usePrintContext();\n  isAnimationActive = printContext ? false : isAnimationActive;\n\n  const datasets = useMemo(() => {\n    return getScatterDatasets(data);\n  }, [data]);\n\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"lineChartPalette\",\n    dataLength: datasets.length,\n  });\n\n  const transformedData: ScatterPoint[] = useMemo(() => {\n    if (!data || !Array.isArray(data)) {\n      return [];\n    }\n    return transformScatterData(data, datasets, colors);\n  }, [data, datasets, colors]);\n\n  const { yAxisWidth, setLabelWidth } = useYAxisLabelWidth(transformedData, [yAxisDataKey]);\n\n  const chartConfig: ChartConfig = useMemo(() => {\n    return get2dChartConfig(\n      datasets,\n      colors,\n      datasets.reduce((acc, key) => ({ ...acc, [key]: key }), {}),\n      undefined,\n    );\n  }, [datasets, colors]);\n\n  const chartWrapperRef = useRef<HTMLDivElement>(null);\n  const legendContainerRef = useRef<HTMLDivElement>(null);\n  const xAxisContainerRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState<number>(0);\n  const [isSideBarTooltipOpen, setIsSideBarTooltipOpen] = useState(false);\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const [sideBarTooltipData, setSideBarTooltipData] = useState<SideBarChartData>({\n    title: \"\",\n    values: [],\n  });\n\n  const chartWidth = useMemo(() => {\n    if (!containerWidth) {\n      return undefined;\n    }\n    return containerWidth - yAxisWidth;\n  }, [containerWidth, yAxisWidth]);\n\n  const chartHeight = useMemo(() => {\n    const legendHeight = legendContainerRef.current?.offsetHeight ?? 0;\n    const xAxisHeight = xAxisContainerRef.current?.offsetHeight ?? 0;\n\n    if (typeof height === \"number\") {\n      return height - legendHeight - xAxisHeight;\n    }\n\n    if (typeof height === \"string\" && height.endsWith(\"px\")) {\n      const numericHeight = parseInt(height, 10);\n      if (!isNaN(numericHeight)) {\n        return numericHeight - legendHeight - xAxisHeight;\n      }\n    }\n\n    if (!height || !chartWrapperRef.current) {\n      return DEFAULT_CHART_HEIGHT;\n    }\n\n    return chartWrapperRef.current.offsetHeight - legendHeight - xAxisHeight;\n  }, [containerWidth, height]);\n\n  const isFixedNumericHeight = useMemo(() => {\n    if (typeof height === \"number\") return true;\n    if (typeof height === \"string\" && height.endsWith(\"px\")) return true;\n    return false;\n  }, [height]);\n\n  // Calculate domains for x and y axes\n  const xDomain = useMemo(() => {\n    return calculateScatterDomain(data, xAxisDataKey as \"x\" | \"y\");\n  }, [data, xAxisDataKey]);\n\n  const yDomain = useMemo(() => {\n    return calculateScatterDomain(data, yAxisDataKey as \"x\" | \"y\");\n  }, [data, yAxisDataKey]);\n\n  const renderDotShape = useMemo(() => {\n    return (props: unknown) => {\n      return <ScatterDot {...(props as object)} variant={shape} />;\n    };\n  }, [shape]);\n\n  useEffect(() => {\n    const chartElement = chartWrapperRef.current;\n\n    if (!chartElement) {\n      return;\n    }\n\n    const resizeObserver = new ResizeObserver((entries) => {\n      for (const entry of entries) {\n        if (entry.target === chartElement) {\n          setContainerWidth(entry.contentRect.width);\n        }\n      }\n    });\n\n    resizeObserver.observe(chartElement);\n\n    return () => {\n      resizeObserver.disconnect();\n    };\n  }, []);\n\n  useEffect(() => {\n    setIsSideBarTooltipOpen(false);\n    setIsLegendExpanded(false);\n  }, [datasets]);\n\n  const legendItems: LegendItem[] = useMemo(() => {\n    return getLegendItems(datasets, colors);\n  }, [datasets, colors]);\n\n  const exportData = useExportChartData({\n    type: \"scatter\",\n    data,\n    colors,\n    legend,\n    xAxisLabel,\n    yAxisLabel,\n    customDataTransform: () =>\n      data.map((dataset) => ({\n        name: dataset.name,\n        x: dataset.data.map((p) => p[xAxisDataKey] as number),\n        y: dataset.data.map((p) => p[yAxisDataKey] as number),\n      })),\n  });\n\n  const id = useId();\n\n  const xAxis = useMemo(() => {\n    return (\n      <div className=\"openui-scatter-chart-x-axis-container\" ref={xAxisContainerRef}>\n        <ChartContainer\n          config={chartConfig}\n          style={{ width: \"100%\", height: X_AXIS_HEIGHT }}\n          rechartsProps={{\n            height: X_AXIS_HEIGHT,\n          }}\n        >\n          <RechartsScatterChart\n            key={`x-axis-scatter-chart-${id}`}\n            data={transformedData}\n            margin={{\n              top: 10,\n              bottom: 0,\n              left: yAxisWidth,\n              right: 0,\n            }}\n          >\n            <XAxis\n              type=\"number\"\n              height={X_AXIS_HEIGHT}\n              name={xAxisLabel as string}\n              tickLine={false}\n              axisLine={false}\n              tickFormatter={numberTickFormatter}\n              tick={<SVGXAxisTick dy={10} />}\n              domain={xDomain}\n              dataKey={xAxisDataKey}\n            />\n            {/* Invisible scatter to maintain scale synchronization */}\n            <Scatter\n              data={transformedData}\n              fill=\"transparent\"\n              isAnimationActive={isAnimationActive}\n              shape=\"circle\"\n            />\n          </RechartsScatterChart>\n        </ChartContainer>\n      </div>\n    );\n  }, [\n    chartConfig,\n    transformedData,\n    id,\n    xDomain,\n    xAxisDataKey,\n    isAnimationActive,\n    xAxisLabel,\n    yAxisWidth,\n  ]);\n  const yAxis = useMemo(() => {\n    return (\n      <div className=\"openui-scatter-chart-y-axis-container\" style={{ height: chartHeight + 20 }}>\n        <RechartsScatterChart\n          key={`y-axis-scatter-chart-${id}`}\n          width={yAxisWidth}\n          height={chartHeight + 10}\n          data={transformedData}\n          margin={{\n            top: 10,\n            bottom: 12,\n            left: 0,\n            right: 0,\n          }}\n        >\n          <YAxis\n            type=\"number\"\n            width={yAxisWidth}\n            dataKey={yAxisDataKey}\n            name={yAxisLabel as string}\n            domain={yDomain}\n            tickLine={false}\n            axisLine={false}\n            tick={<YAxisTick setLabelWidth={setLabelWidth} />}\n            tickFormatter={numberTickFormatter}\n          />\n          {/* Invisible scatter to maintain scale synchronization */}\n          <Scatter\n            data={transformedData}\n            fill=\"transparent\"\n            isAnimationActive={isAnimationActive}\n            shape=\"circle\"\n          />\n        </RechartsScatterChart>\n      </div>\n    );\n  }, [\n    transformedData,\n    id,\n    yAxisWidth,\n    chartHeight,\n    yDomain,\n    yAxisDataKey,\n    yAxisLabel,\n    isAnimationActive,\n    setLabelWidth,\n  ]);\n  return (\n    <SideBarTooltipProvider\n      isSideBarTooltipOpen={isSideBarTooltipOpen}\n      setIsSideBarTooltipOpen={setIsSideBarTooltipOpen}\n      data={sideBarTooltipData}\n      setData={setSideBarTooltipData}\n    >\n      <div\n        className={clsx(\"openui-scatter-chart-container\", className)}\n        data-openui-chart={exportData}\n        style={{\n          width: typeof width === \"number\" ? `${width}px` : width || \"100%\",\n          height: isFixedNumericHeight ? \"auto\" : (height ?? \"auto\"),\n        }}\n        ref={chartWrapperRef}\n      >\n        <div className=\"openui-scatter-chart-container-inner\">\n          {yAxis}\n          <div\n            className=\"openui-scatter-chart-main-and-x-axis-container\"\n            style={{ width: chartWidth }}\n          >\n            <div\n              className=\"openui-scatter-chart-main-container\"\n              style={{\n                width: \"100%\",\n                height: chartHeight,\n              }}\n            >\n              <ChartContainer\n                config={chartConfig}\n                style={{\n                  width: \"100%\",\n                  height: \"100%\",\n                  aspectRatio: 0,\n                }}\n                rechartsProps={{\n                  width: \"100%\",\n                  height: \"100%\",\n                }}\n              >\n                <RechartsScatterChart\n                  key={`scatter-chart-${id}`}\n                  margin={{\n                    top: 10,\n                    right: 2,\n                    bottom: 2,\n                    left: 2,\n                  }}\n                >\n                  {grid && gridCartesianGrid({ horizontal: true, vertical: true })}\n                  <XAxis\n                    type=\"number\"\n                    name={xAxisLabel as string}\n                    domain={xDomain}\n                    dataKey={xAxisDataKey}\n                    hide\n                  />\n\n                  <YAxis\n                    type=\"number\"\n                    dataKey={yAxisDataKey}\n                    name={yAxisLabel as string}\n                    domain={yDomain}\n                    hide\n                  />\n\n                  <ChartTooltip\n                    content={\n                      <CustomTooltipContent\n                        parentRef={chartWrapperRef}\n                        hideIndicator\n                        labelKey=\"dataset\"\n                      />\n                    }\n                    offset={15}\n                  />\n\n                  <Scatter\n                    key={`scatter-${id}`}\n                    data={transformedData}\n                    shape={renderDotShape}\n                    isAnimationActive={isAnimationActive}\n                  >\n                    {transformedData.map((entry, index) => (\n                      <Cell key={`cell-${index}`} fill={entry[\"color\"] as string} />\n                    ))}\n                  </Scatter>\n                </RechartsScatterChart>\n              </ChartContainer>\n            </div>\n          </div>\n          {xAxis}\n          {isSideBarTooltipOpen && chartHeight > 0 && <SideBarTooltip height={chartHeight} />}\n        </div>\n        <div className=\"openui-scatter-chart-legend-container\" ref={legendContainerRef}>\n          {legend && (\n            <DefaultLegend\n              items={legendItems}\n              yAxisLabel={yAxisLabel}\n              xAxisLabel={xAxisLabel}\n              containerWidth={containerWidth}\n              isExpanded={isLegendExpanded}\n              setIsExpanded={setIsLegendExpanded}\n            />\n          )}\n        </div>\n      </div>\n    </SideBarTooltipProvider>\n  );\n};\n","import React from \"react\";\nimport { numberTickFormatter } from \"../../utils\";\n\ninterface ToolTipProps {\n  label: string;\n  color: string;\n  value: number | string;\n  percentage?: number;\n}\n\nexport const ToolTip: React.FC<ToolTipProps> = ({ label, color, value, percentage }) => {\n  return (\n    <div className=\"openui-chart-tooltip\">\n      <div className=\"openui-chart-tooltip-label\">{label}</div>\n      <div className=\"openui-chart-tooltip-content\">\n        <div className=\"openui-chart-tooltip-content-item\">\n          <div\n            className=\"openui-chart-tooltip-content-indicator openui-chart-tooltip-content-indicator--dot\"\n            style={{\n              [\"--color-bg\" as any]: color,\n              [\"--color-border\" as any]: color,\n            }}\n          />\n          <div className=\"openui-chart-tooltip-content-value-wrapper\">\n            <div className=\"openui-chart-tooltip-content-label\">\n              <span>Value</span>\n            </div>\n            <span className=\"openui-chart-tooltip-content-value\">\n              {typeof value === \"number\" ? numberTickFormatter(value) : value}\n            </span>\n          </div>\n        </div>\n        <div className=\"openui-chart-tooltip-content-item-separator\" />\n        <div className=\"openui-chart-tooltip-content-item\">\n          <div className=\"openui-chart-tooltip-content-value-wrapper\">\n            <div className=\"openui-chart-tooltip-content-label\">\n              <span>Percentage</span>\n            </div>\n            <span className=\"openui-chart-tooltip-content-value percentage\">\n              {typeof percentage === \"number\" ? `${percentage.toFixed(1)}%` : \"-\"}\n            </span>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n};\n","import clsx from \"clsx\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { usePrintContext } from \"../../../context/PrintContext\";\nimport { Separator } from \"../../Separator\";\nimport { useExportChartData } from \"../hooks\";\nimport { DefaultLegend } from \"../shared/DefaultLegend/DefaultLegend\";\nimport { FloatingUIPortal } from \"../shared/PortalTooltip\";\nimport { StackedLegend } from \"../shared/StackedLegend/StackedLegend\";\nimport { LegendItem, StackedLegendItem } from \"../types\";\nimport { PaletteName, useChartPalette } from \"../utils/PalletUtils\";\nimport { ToolTip } from \"./components\";\nimport { SingleStackedBarData } from \"./types\";\n\nexport interface SingleStackedBarProps<T extends SingleStackedBarData> {\n  data: T;\n  categoryKey: keyof T[number];\n  dataKey: keyof T[number];\n  theme?: PaletteName;\n  customPalette?: string[];\n  legend?: boolean;\n  legendVariant?: \"default\" | \"stacked\";\n  className?: string;\n  style?: React.CSSProperties;\n  animated?: boolean;\n}\n\nexport const SingleStackedBar = <T extends SingleStackedBarData>({\n  data,\n  categoryKey,\n  dataKey,\n  theme = \"ocean\",\n  customPalette,\n  legend = true,\n  legendVariant = \"default\",\n  className,\n  style,\n  animated = true,\n}: SingleStackedBarProps<T>) => {\n  const [isLegendExpanded, setIsLegendExpanded] = useState(false);\n  const [activeIndex, setActiveIndex] = useState<number | null>(null);\n  const [hoveredLegendKey, setHoveredLegendKey] = useState<string | null>(null);\n  const wrapperRef = useRef<HTMLDivElement>(null);\n  const [containerWidth, setContainerWidth] = useState(0);\n  const [tooltipPosition, setTooltipPosition] = useState<{ x: number; y: number } | null>(null);\n\n  useEffect(() => {\n    const wrapper = wrapperRef.current;\n    if (!wrapper) return;\n\n    const observer = new ResizeObserver((entries) => {\n      const entry = entries[0];\n      if (entry) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    observer.observe(wrapper);\n    return () => observer.disconnect();\n  }, []);\n  // Calculate percentages\n  const segments = useMemo(() => {\n    if (!data || data.length === 0) {\n      return [];\n    }\n\n    const total = data.reduce((acc, item) => acc + Number(item[dataKey]), 0);\n\n    return data.map((item, index) => ({\n      value: Number(item[dataKey]),\n      category: String(item[categoryKey]),\n      index,\n      percentage: total > 0 ? (Number(item[dataKey]) / total) * 100 : 0,\n    }));\n  }, [data, dataKey, categoryKey]);\n\n  // Get theme colors for each segment\n  const colors = useChartPalette({\n    chartThemeName: theme,\n    customPalette,\n    themePaletteName: \"barChartPalette\",\n    dataLength: Math.max(segments.length, 1),\n  });\n\n  // Create legend items\n  const legendItems = useMemo((): LegendItem[] => {\n    return segments.map((segment, index) => ({\n      key: `${segment.category}-${index}`,\n      label: segment.category,\n      color: colors[index % colors.length] || \"\",\n      percentage: segment.percentage,\n    }));\n  }, [segments, colors]);\n\n  // Create stacked legend items with values\n  const stackedLegendItems = useMemo(\n    (): StackedLegendItem[] =>\n      segments.map((segment, index) => ({\n        key: `${segment.category}-${index}`,\n        label: segment.category,\n        value: segment.value,\n        color: colors[index % colors.length] || \"\",\n      })),\n    [segments, colors],\n  );\n\n  const printContext = usePrintContext();\n  animated = printContext ? false : animated;\n\n  const exportData = useExportChartData({\n    type: \"bar\",\n    data,\n    categoryKey: categoryKey as string,\n    dataKeys: [dataKey as string],\n    colors,\n    legend,\n    extraOptions: {\n      barDir: \"bar\",\n      barGrouping: \"stacked\",\n    },\n  });\n\n  // Handle legend item hover with tooltip positioning\n  const handleLegendItemHover = useCallback(\n    (hoverIndex: number | null) => {\n      setActiveIndex(hoverIndex);\n      if (hoverIndex !== null) {\n        const segment = segments[hoverIndex];\n        if (segment) {\n          const legendKey = `${segment.category}-${hoverIndex}`;\n          setHoveredLegendKey(legendKey);\n        }\n        // Try to position tooltip above the hovered segment\n        const segmentEl = wrapperRef.current?.querySelectorAll(\n          \".openui-single-stacked-bar-chart-segment\",\n        )?.[hoverIndex] as HTMLDivElement | undefined;\n        if (segmentEl) {\n          const rect = segmentEl.getBoundingClientRect();\n          const containerRect = wrapperRef.current?.getBoundingClientRect();\n          if (containerRect) {\n            const relativeX = rect.left + rect.width / 2 - containerRect.left;\n            const relativeY = rect.top - containerRect.top;\n            setTooltipPosition({ x: relativeX, y: relativeY });\n          } else {\n            setTooltipPosition({ x: rect.left + rect.width / 2, y: rect.top });\n          }\n        }\n      } else {\n        setHoveredLegendKey(null);\n        setTooltipPosition(null);\n      }\n    },\n    [segments],\n  );\n\n  // Segmented progress bar\n  return (\n    <div\n      ref={wrapperRef}\n      className={clsx(\"openui-single-stacked-bar-chart-container\", className, {\n        \"openui-single-stacked-bar-chart-container-gap\": legend && legendVariant === \"default\",\n      })}\n      style={style}\n      data-openui-chart={exportData}\n    >\n      <div className=\"openui-single-stacked-bar-chart\">\n        {segments.map((segment, index) => {\n          const isActive = activeIndex === null || activeIndex === index;\n          return (\n            <div\n              key={`segment-${index}`}\n              className={clsx(\"openui-single-stacked-bar-chart-segment\", {\n                \"openui-single-stacked-bar-chart-animated\": animated,\n              })}\n              style={{\n                width: `${segment.percentage}%`,\n                backgroundColor: colors[index % colors.length],\n                opacity: isActive ? 1 : 0.5,\n              }}\n              onMouseEnter={(e) => {\n                setActiveIndex(index);\n                const legendKey = `${segment.category}-${index}`;\n                setHoveredLegendKey(legendKey);\n                const rect = (e.currentTarget as HTMLDivElement).getBoundingClientRect();\n                const containerRect = wrapperRef.current?.getBoundingClientRect();\n                if (containerRect) {\n                  // Position relative to container so FloatingUIPortal aligns correctly\n                  const relativeX = rect.left + rect.width / 2 - containerRect.left;\n                  const relativeY = rect.top - containerRect.top;\n                  setTooltipPosition({ x: relativeX, y: relativeY });\n                } else {\n                  setTooltipPosition({ x: rect.left + rect.width / 2, y: rect.top });\n                }\n              }}\n              onMouseLeave={() => {\n                setActiveIndex(null);\n                setHoveredLegendKey(null);\n              }}\n            >\n              <div className=\"openui-single-stacked-bar-chart-segment-line\" />\n            </div>\n          );\n        })}\n      </div>\n      {activeIndex !== null && tooltipPosition && (\n        <FloatingUIPortal position={tooltipPosition} placement=\"top\" offsetDistance={10}>\n          <ToolTip\n            label={legendItems[activeIndex]?.label ?? \"\"}\n            color={stackedLegendItems[activeIndex]?.color ?? \"#000000\"}\n            value={stackedLegendItems[activeIndex]?.value ?? 0}\n            percentage={segments[activeIndex]?.percentage ?? 0}\n          />\n        </FloatingUIPortal>\n      )}\n\n      {legend && legendVariant === \"default\" && <Separator />}\n\n      {legend && legendVariant === \"default\" && (\n        <DefaultLegend\n          items={legendItems}\n          isExpanded={isLegendExpanded}\n          setIsExpanded={setIsLegendExpanded}\n          containerWidth={containerWidth}\n          style={{ paddingTop: 0 }}\n        />\n      )}\n      {legend && legendVariant === \"stacked\" && (\n        <StackedLegend\n          items={stackedLegendItems}\n          containerWidth={containerWidth}\n          onItemHover={setHoveredLegendKey}\n          activeKey={hoveredLegendKey}\n          onLegendItemHover={handleLegendItemHover}\n          separator\n          showTitle={false}\n          layout=\"showMore\"\n          className=\"openui-single-stacked-bar-chart-stacked-legend\"\n        />\n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AO,KAAK,QAAqB,QAAQ,MAAM,UAAU;EACvD,MAAM,cAAc,OAAO,KAAK,aAAa;EAC7C,MAAM,iBAAiB,OAAO,gBAAgB,gBAAgB;AAC9D,SAAO;GACL,GAAG;IACF,iBAAiB;IAChB,OAAO,OAAO,KAAK,aAAuB;IAC1C,OAAO,OAAO;IACd,gBAAgB,OAAO,KAAK,SAAS,QAAQ;IAC9C;GACF;IACA,EAAE,CAAC;;;;;;;;;AAWR,MAAa,kBACX,UACA,QACA,UACiB;AACjB,QAAO,SAAS,KAAK,KAAK,WAAW;EACnC;EACA,OAAO;EACP,OAAO,OAAO,UAAU;EACxB,MAAM,QAAQ;EACf,EAAE;;;;;;;;;;AAWL,MAAa,sBACX,SACA,UACA,WACW;AAEX,QAAO,OADO,SAAS,QAAQ,QACZ,KAAK;;;;AC5F1B,MAAM,gBAA4B;CAChC,OAAO;EACL,MAAM;EACN,QAAQ;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACD,QAAQ;EACN,MAAM;EACN,QAAQ;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACD,SAAS;EACP,MAAM;EACN,QAAQ;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACD,UAAU;EACR,MAAM;EACN,QAAQ;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACD,QAAQ;EACN,MAAM;EACN,QAAQ;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACD,OAAO;EACL,MAAM;EACN,QAAQ;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACF;AAID,MAAa,cAAc,QAAkC;CAC3D,MAAM,UAAU,cAAc;AAC9B,EAAA,GAAA,eAAA,SAAU,SAAS,WAAW,IAAI,YAAY;AAC9C,Q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