@gntik-ai/charts 0.5.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["RAreaChart","RBarChart","RLineChart","RFunnelChart","RRadarChart"],"sources":["../src/format.ts","../src/ChartLegend.tsx","../src/ChartTooltip.tsx","../src/states.tsx","../src/shared.tsx","../src/ChartBrush.tsx","../src/live.ts","../src/overlays.tsx","../src/cartesian-extras.tsx","../src/theme.ts","../src/AreaChart.tsx","../src/BarChart.tsx","../src/LineChart.tsx","../src/ComboChart.tsx","../src/DonutChart.tsx","../src/BarList.tsx","../src/palette.ts","../src/FunnelChart.tsx","../src/SankeyChart.tsx","../src/RadarChart.tsx","../src/Heatmap.tsx","../src/MiniBar.tsx"],"sourcesContent":["/** Formats a numeric value for axes, tooltips and legends. */\nexport type ValueFormatter = (value: number) => string;\n\nconst nf = (opts?: Intl.NumberFormatOptions) => new Intl.NumberFormat('en-US', opts);\n\n/** Ready-made value formatters (en-US). */\nexport const chartFmt = {\n usd: (n: number) => '$' + nf({ maximumFractionDigits: 0 }).format(n),\n usd2: (n: number) => '$' + nf({ minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(n),\n usdCompact: (n: number) => '$' + nf({ notation: 'compact', maximumFractionDigits: 1 }).format(n),\n num: (n: number) => nf().format(n),\n compact: (n: number) => nf({ notation: 'compact', maximumFractionDigits: 1 }).format(n),\n ms: (n: number) => nf().format(n) + ' ms',\n pct: (n: number) => `${n}%`,\n /** Ratio (0–1) → percent with up to one decimal: `0.125` → `12.5%`. */\n percent: (n: number) => nf({ style: 'percent', maximumFractionDigits: 1 }).format(n),\n /** Signed ratio for deltas: `0.042` → `+4.2%`, `-0.1` → `−10%`. */\n percentDelta: (n: number) =>\n nf({ style: 'percent', maximumFractionDigits: 1, signDisplay: 'exceptZero' }).format(n).replace('-', '−'),\n /** Milliseconds → the two largest units: `850` → `850 ms`, `2400` → `2.4 s`, `3_723_000` → `1h 2m`. */\n duration: (n: number) => formatDuration(n),\n /** Seconds → like `duration`: `90` → `1m 30s`. */\n durationS: (n: number) => formatDuration(n * 1000),\n /** Bytes → decimal SI units: `1536` → `1.5 kB`, `2_000_000_000` → `2 GB`. */\n bytes: (n: number) => formatBytes(n),\n} satisfies Record<string, ValueFormatter>;\n\nfunction formatDuration(ms: number): string {\n if (!Number.isFinite(ms)) return '—';\n const sign = ms < 0 ? '−' : '';\n const a = Math.abs(ms);\n if (a < 1000) return `${sign}${nf({ maximumFractionDigits: a < 10 ? 2 : 0 }).format(a)} ms`;\n if (a < 60_000) return `${sign}${nf({ maximumFractionDigits: 1 }).format(a / 1000)} s`;\n const parts: Array<[number, string]> = [\n [86_400_000, 'd'],\n [3_600_000, 'h'],\n [60_000, 'm'],\n [1000, 's'],\n ];\n const total = Math.round(a / 1000) * 1000;\n const first = parts.findIndex(([size]) => total >= size);\n const out: string[] = [];\n let rest = total;\n for (const [size, unit] of parts.slice(first, first + 2)) {\n const q = Math.floor(rest / size);\n rest -= q * size;\n if (q > 0) out.push(`${q}${unit}`);\n }\n return sign + out.join(' ');\n}\n\nconst BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'] as const;\n\nfunction formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes)) return '—';\n const sign = bytes < 0 ? '−' : '';\n let v = Math.abs(bytes);\n let u = 0;\n while (v >= 1000 && u < BYTE_UNITS.length - 1) {\n v /= 1000;\n u += 1;\n }\n return `${sign}${nf({ maximumFractionDigits: u === 0 ? 0 : 1 }).format(v)} ${BYTE_UNITS[u]}`;\n}\n\nexport const identity: ValueFormatter = (n) => String(n);\n\n/** Applies a formatter to whatever Recharts hands over (number, string or range). */\nexport function formatAny(value: unknown, fmt: ValueFormatter): string {\n if (typeof value === 'number') return fmt(value);\n if (Array.isArray(value)) return value.map((v) => formatAny(v, fmt)).join(' – ');\n return value == null ? '' : String(value);\n}\n\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ');\n}\n","import { useCallback, useState } from 'react';\nimport { cx } from './format';\n\nexport interface ChartLegendItem {\n key: string;\n label: string;\n /** Resolved colour (from `useChartTheme().color`). */\n color: string;\n}\n\nexport interface ChartLegendProps {\n items: readonly ChartLegendItem[];\n hidden: ReadonlySet<string>;\n onToggle: (key: string) => void;\n className?: string;\n}\n\nconst legendFocus =\n 'rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring';\n\n/** Interactive legend: each entry is a toggle button that shows/hides its series. */\nexport function ChartLegend({ items, hidden, onToggle, className }: ChartLegendProps) {\n return (\n <div className={cx('flex flex-wrap items-center gap-x-4 gap-y-1.5', className)}>\n {items.map((it) => {\n const off = hidden.has(it.key);\n return (\n <button\n key={it.key}\n type=\"button\"\n aria-pressed={!off}\n onClick={() => onToggle(it.key)}\n className={cx('group flex items-center gap-1.5 transition-opacity', off && 'opacity-40', legendFocus)}\n >\n <span\n aria-hidden\n className={cx('h-2.5 w-2.5 shrink-0 rounded-[3px]', off && 'grayscale')}\n style={{ background: it.color }}\n />\n <span\n className={cx(\n 'text-[12.5px] text-muted-foreground transition-colors',\n off ? 'line-through' : 'group-hover:text-foreground',\n )}\n >\n {it.label}\n </span>\n </button>\n );\n })}\n </div>\n );\n}\n\n/** Legend state: the set of hidden series keys plus a toggle. */\nexport function useHiddenSeries(): [ReadonlySet<string>, (key: string) => void] {\n const [hidden, setHidden] = useState<ReadonlySet<string>>(() => new Set());\n const toggle = useCallback((key: string) => {\n setHidden((s) => {\n const next = new Set(s);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }, []);\n return [hidden, toggle];\n}\n\nexport { legendFocus };\n","import type { ReactNode } from 'react';\nimport type { TooltipContentProps } from 'recharts';\nimport { formatAny, identity, type ValueFormatter } from './format';\n\n/** The subset of a Recharts tooltip payload entry the brand tooltip reads. */\nexport interface ChartTooltipEntry {\n name?: string | number;\n value?: unknown;\n color?: string;\n fill?: string;\n payload?: unknown;\n}\n\nexport interface ChartTooltipProps {\n active?: boolean;\n payload?: ReadonlyArray<ChartTooltipEntry>;\n label?: string | number;\n valueFormatter?: ValueFormatter;\n /** Per-series formatter; wins over `valueFormatter` (used by ComboChart). */\n seriesFormatter?: (value: unknown, name: string) => string;\n labelFormatter?: (label: string | number) => ReactNode;\n}\n\nfunction swatchOf(entry: ChartTooltipEntry): string | undefined {\n if (entry.color) return entry.color;\n if (entry.fill) return entry.fill;\n const inner = entry.payload;\n if (inner && typeof inner === 'object' && 'fill' in inner) {\n const fill = (inner as { fill?: unknown }).fill;\n return typeof fill === 'string' ? fill : undefined;\n }\n return undefined;\n}\n\n/** Brand tooltip card: label header + one row per series, values in mono. */\nexport function ChartTooltip({\n active,\n payload,\n label,\n valueFormatter = identity,\n seriesFormatter,\n labelFormatter,\n}: ChartTooltipProps) {\n if (!active || !payload || payload.length === 0) return null;\n const rows = payload.filter((p) => p.value != null);\n return (\n <div className=\"min-w-[150px] rounded-md border border-border bg-popover px-3 py-2.5 font-sans shadow-md\">\n {label != null && label !== '' && (\n <div className=\"mb-2 border-b border-border pb-2 text-[11px] font-medium text-muted-foreground\">\n {labelFormatter ? labelFormatter(label) : label}\n </div>\n )}\n <div className=\"flex flex-col gap-1.5\">\n {rows.map((p, i) => {\n const name = p.name == null ? '' : String(p.name);\n return (\n <div key={`${name}-${i}`} className=\"flex items-center justify-between gap-5\">\n <span className=\"flex min-w-0 items-center gap-2\">\n <span aria-hidden className=\"h-2.5 w-2.5 shrink-0 rounded-[3px]\" style={{ background: swatchOf(p) }} />\n <span className=\"truncate text-[12px] text-muted-foreground\">{name}</span>\n </span>\n <span className=\"font-mono text-[12px] font-semibold tabular-nums text-foreground\">\n {seriesFormatter ? seriesFormatter(p.value, name) : formatAny(p.value, valueFormatter)}\n </span>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\n/** Adapts Recharts 3 `<Tooltip content>` to the brand tooltip: `content={tooltipContent({ valueFormatter })}`. */\nexport function tooltipContent(options: Omit<ChartTooltipProps, 'active' | 'payload' | 'label'>) {\n return function BrandTooltipContent(p: TooltipContentProps) {\n return <ChartTooltip active={p.active} payload={p.payload} label={p.label} {...options} />;\n };\n}\n","import type { ReactNode } from 'react';\nimport { cx } from './format';\n\n/** Lifecycle of a chart's data. `ready` with no rows renders the empty state. */\nexport type ChartState = 'ready' | 'loading' | 'empty' | 'error';\n\n/** State props shared by every chart. */\nexport interface ChartStateProps {\n /** Data lifecycle. Default `ready` (an empty `data` array still shows the empty state). */\n state?: ChartState;\n /** Message of the empty state. */\n emptyMessage?: ReactNode;\n /** Message of the error state. */\n errorMessage?: ReactNode;\n /** Shows a \"Retry\" button in the error state. */\n onRetry?: () => void;\n /** Renders a visually hidden data table (screen-reader fallback of the plotted values). */\n dataTable?: boolean;\n}\n\nconst stateBox =\n 'flex w-full flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border px-4 text-center';\n\nexport interface ChartEmptyProps {\n height?: number;\n children?: ReactNode;\n className?: string;\n}\n\n/** Placeholder for a chart without data. */\nexport function ChartEmpty({ height = 240, children = 'No data for this period', className }: ChartEmptyProps) {\n return (\n <div data-chart-state=\"empty\" className={cx(stateBox, className)} style={{ height }}>\n <svg aria-hidden viewBox=\"0 0 24 24\" className=\"h-5 w-5 fill-none stroke-muted-foreground\" strokeWidth={1.75}>\n <path d=\"M3 3v18h18\" />\n <path d=\"M7 15h2M12 11h2M17 7h2\" strokeLinecap=\"round\" />\n </svg>\n <p className=\"text-[13px] text-muted-foreground\">{children}</p>\n </div>\n );\n}\n\nexport interface ChartLoadingProps {\n height?: number;\n /** Accessible label of the busy region. */\n label?: string;\n className?: string;\n}\n\nconst SKELETON_BARS = [42, 64, 50, 78, 58, 88, 70, 54];\n\n/** Skeleton plot (bars over a baseline); the pulse stops under prefers-reduced-motion. */\nexport function ChartLoading({ height = 240, label = 'Loading chart', className }: ChartLoadingProps) {\n return (\n <div\n role=\"status\"\n aria-label={label}\n data-chart-state=\"loading\"\n className={cx('flex w-full items-end gap-2 border-b border-border px-2', className)}\n style={{ height }}\n >\n {SKELETON_BARS.map((h, i) => (\n <div\n key={i}\n aria-hidden\n className=\"flex-1 animate-pulse rounded-t-sm bg-muted motion-reduce:animate-none\"\n style={{ height: `${h}%` }}\n />\n ))}\n <span className=\"sr-only\">{label}…</span>\n </div>\n );\n}\n\nexport interface ChartErrorProps {\n height?: number;\n children?: ReactNode;\n onRetry?: () => void;\n className?: string;\n}\n\n/** Error placeholder with an optional retry action. */\nexport function ChartError({\n height = 240,\n children = 'The chart could not be loaded.',\n onRetry,\n className,\n}: ChartErrorProps) {\n return (\n <div\n role=\"alert\"\n data-chart-state=\"error\"\n className={cx(stateBox, 'border-destructive/40', className)}\n style={{ height }}\n >\n <p className=\"text-[13px] text-destructive-text\">{children}</p>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"h-8 rounded-md border border-border bg-card px-3 text-[12.5px] font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring motion-reduce:transition-none\"\n >\n Retry\n </button>\n )}\n </div>\n );\n}\n\n/** Resolves the effective state: `ready` with no rows is `empty`. */\nexport function resolveState(state: ChartState | undefined, rows: number): ChartState {\n const s = state ?? 'ready';\n return s === 'ready' && rows === 0 ? 'empty' : s;\n}\n\n/** The placeholder for a non-ready state, or `null` when the chart should render. */\nexport function chartStateView(\n state: ChartState,\n {\n height,\n emptyMessage,\n errorMessage,\n onRetry,\n }: Pick<ChartStateProps, 'emptyMessage' | 'errorMessage' | 'onRetry'> & {\n height: number;\n },\n): ReactNode {\n if (state === 'loading') return <ChartLoading height={height} />;\n if (state === 'empty') return <ChartEmpty height={height}>{emptyMessage}</ChartEmpty>;\n if (state === 'error')\n return (\n <ChartError height={height} onRetry={onRetry}>\n {errorMessage}\n </ChartError>\n );\n return null;\n}\n\nexport interface ChartDataTableProps {\n caption: string;\n /** Column headers; the first column is the row header. */\n columns: readonly string[];\n rows: ReadonlyArray<readonly ReactNode[]>;\n /** Show the table instead of hiding it visually. */\n visible?: boolean;\n}\n\n/** Plain data table: a screen-reader fallback for a chart (visually hidden by default). */\nexport function ChartDataTable({ caption, columns, rows, visible = false }: ChartDataTableProps) {\n return (\n <table data-chart-table=\"\" className={cx(visible ? 'mt-3 w-full text-[12px]' : 'sr-only')}>\n <caption className={visible ? 'mb-1 text-left text-muted-foreground' : undefined}>{caption}</caption>\n <thead>\n <tr>\n {columns.map((c, i) => (\n <th key={i} scope=\"col\" className={visible ? 'text-left font-medium text-muted-foreground' : undefined}>\n {c}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r, i) => (\n <tr key={i}>\n {r.map((cell, j) =>\n j === 0 ? (\n <th key={j} scope=\"row\" className={visible ? 'text-left font-normal text-foreground' : undefined}>\n {cell}\n </th>\n ) : (\n <td key={j} className={visible ? 'font-mono tabular-nums text-foreground' : undefined}>\n {cell}\n </td>\n ),\n )}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n","import type { HTMLAttributes, ReactElement, ReactNode } from 'react';\nimport { ResponsiveContainer } from 'recharts';\nimport type { ChartColor, ChartTheme } from './theme';\nimport { cx, type ValueFormatter } from './format';\nimport { ChartDataTable, chartStateView, type ChartState, type ChartStateProps } from './states';\n\n/** Keys of a datum (string keys only). */\nexport type DataKey<T> = Extract<keyof T, string>;\n\n/** Props shared by every cartesian chart (Tremor-like API). */\nexport interface BaseChartProps<T extends object> extends ChartStateProps {\n data: readonly T[];\n /** Key of the x-axis (category) field. */\n index: DataKey<T>;\n /** Accessible name of the chart. Falls back to `title`, then to a generated summary. */\n 'aria-label'?: string;\n /** Title rendered inside the SVG (`<title>`), also used as accessible name fallback. */\n title?: string;\n /** Longer description rendered inside the SVG (`<desc>`). */\n description?: string;\n colors?: readonly ChartColor[];\n valueFormatter?: ValueFormatter;\n showLegend?: boolean;\n showGrid?: boolean;\n /** Plot height in px (legend excluded). */\n height?: number;\n className?: string;\n}\n\n/** Reads a field from a datum without widening the public generic. */\nexport function field<T extends object>(d: T, key: string): unknown {\n return (d as Record<string, unknown>)[key];\n}\n\nexport function numField<T extends object>(d: T, key: string): number {\n const v = field(d, key);\n return typeof v === 'number' ? v : 0;\n}\n\nexport function accessibleName(\n kind: string,\n explicit: string | undefined,\n title: string | undefined,\n series: readonly string[],\n): string {\n return explicit ?? title ?? (series.length ? `${kind}: ${series.join(', ')}` : kind);\n}\n\n/** Shared axis styling: no tick lines, no axis line, muted labels. */\nexport function axisProps(t: ChartTheme) {\n return {\n stroke: t.axis,\n tickLine: false,\n axisLine: false,\n tick: { fill: t.text, fontSize: 11 },\n } as const;\n}\n\nexport const CHART_MARGIN = { top: 6, right: 10, left: 0, bottom: 0 } as const;\n\nexport interface ChartFrameProps extends Pick<ChartStateProps, 'emptyMessage' | 'errorMessage' | 'onRetry'> {\n label: string;\n height: number;\n legend?: ReactNode;\n className?: string;\n /** Effective state (see `resolveState`). Default `ready`. */\n state?: ChartState;\n /** Data table fallback, rendered only when the chart is ready. */\n table?: ReactNode;\n /** Rendered under the plot when the chart is ready (marker list, brush). */\n footer?: ReactNode;\n /** Extra props for the figure (e.g. `useLiveSeries().pauseProps`). */\n figureProps?: HTMLAttributes<HTMLDivElement>;\n children: ReactElement;\n}\n\n/** Figure wrapper: accessible name, optional legend above, responsive plot area, state placeholders. */\nexport function ChartFrame({\n label,\n height,\n legend,\n className,\n state = 'ready',\n table,\n footer,\n figureProps,\n emptyMessage,\n errorMessage,\n onRetry,\n children,\n}: ChartFrameProps) {\n const placeholder = chartStateView(state, { height, emptyMessage, errorMessage, onRetry });\n return (\n <div\n {...figureProps}\n role=\"figure\"\n aria-label={label}\n aria-busy={state === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder ?? (\n <>\n {legend}\n <div className=\"w-full\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {children}\n </ResponsiveContainer>\n </div>\n {footer}\n {table}\n </>\n )}\n </div>\n );\n}\n\n/** Data table fallback for an index × categories dataset. */\nexport function cartesianTable<T extends object>(\n caption: string,\n data: readonly T[],\n index: string,\n categories: readonly string[],\n format: (value: unknown, key: string) => string,\n) {\n return (\n <ChartDataTable\n caption={caption}\n columns={[index, ...categories]}\n rows={data.map((d) => [String(field(d, index)), ...categories.map((c) => format(field(d, c), c))])}\n />\n );\n}\n","import { useRef, useState, type KeyboardEvent, type PointerEvent as ReactPointerEvent } from 'react';\nimport { cx } from './format';\nimport { legendFocus } from './ChartLegend';\n\n/** Inclusive `[start, end]` indices into the chart data. */\nexport type ChartRange = readonly [number, number];\n\n/** Clamps a range to `[0, length - 1]`, ordered, at least `minSpan` points wide when possible. */\nexport function clampRange(range: ChartRange | null | undefined, length: number, minSpan = 1): [number, number] {\n const last = Math.max(0, length - 1);\n if (!range) return [0, last];\n let start = Math.round(Math.min(range[0], range[1]));\n let end = Math.round(Math.max(range[0], range[1]));\n start = Math.min(Math.max(0, start), last);\n end = Math.min(Math.max(0, end), last);\n const span = Math.min(minSpan, last);\n if (end - start < span) {\n if (start + span <= last) end = start + span;\n else start = Math.max(0, end - span);\n }\n return [start, end];\n}\n\nexport interface UseChartRangeOptions {\n length: number;\n range?: ChartRange;\n defaultRange?: ChartRange;\n onRangeChange?: (range: ChartRange) => void;\n}\n\n/** Controlled/uncontrolled brush range; `null` inner state means \"everything\". */\nexport function useChartRange({ length, range, defaultRange, onRangeChange }: UseChartRangeOptions) {\n const [inner, setInner] = useState<ChartRange | null>(defaultRange ?? null);\n const current = clampRange(range ?? inner, length);\n const set = (next: ChartRange) => {\n const clamped = clampRange(next, length);\n setInner(clamped);\n onRangeChange?.(clamped);\n };\n return [current, set] as const;\n}\n\nexport interface ChartBrushProps {\n /** Number of data points. */\n length: number;\n range: ChartRange;\n onRangeChange: (range: ChartRange) => void;\n /** Text of the x value at an index (handles' aria-valuetext and the range summary). */\n labelOf: (index: number) => string;\n /** Values of one series, drawn as a faint overview line inside the track. */\n preview?: readonly number[];\n /** Accessible name of the brush group. */\n label?: string;\n className?: string;\n}\n\nconst thumbClass = cx(\n 'absolute top-1/2 z-10 h-7 w-3 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize touch-none rounded-sm border border-primary bg-card shadow-sm',\n 'after:absolute after:inset-y-2 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-primary',\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring',\n);\n\nfunction previewPath(values: readonly number[]): string {\n if (values.length < 2) return '';\n const min = Math.min(...values);\n const max = Math.max(...values);\n const span = max - min || 1;\n return values\n .map(\n (val, i) =>\n `${i === 0 ? 'M' : 'L'}${((i / (values.length - 1)) * 100).toFixed(2)},${(36 - ((val - min) / span) * 32).toFixed(2)}`,\n )\n .join(' ');\n}\n\n/**\n * Range brush under a time-series chart: two keyboard-accessible handles (`role=\"slider\"`,\n * Arrow keys ±1, PageUp/PageDown ±10%, Home/End) and a draggable window to pan.\n */\nexport function ChartBrush({\n length,\n range,\n onRangeChange,\n labelOf,\n preview,\n label = 'Zoom range',\n className,\n}: ChartBrushProps) {\n const track = useRef<HTMLDivElement>(null);\n const drag = useRef<{ kind: 'start' | 'end' | 'window'; originIndex: number; originRange: ChartRange } | null>(null);\n const last = Math.max(1, length - 1);\n const [start, end] = range;\n const pct = (i: number) => `${(i / last) * 100}%`;\n const full = start === 0 && end === length - 1;\n const step = Math.max(1, Math.round(length / 10));\n\n const indexAt = (clientX: number) => {\n const rect = track.current?.getBoundingClientRect();\n if (!rect || rect.width === 0) return 0;\n return Math.round(((clientX - rect.left) / rect.width) * last);\n };\n const begin = (e: ReactPointerEvent<HTMLElement>) => {\n const part = e.currentTarget.dataset.brushHandle ?? 'window';\n const kind = part === 'start' || part === 'end' ? part : 'window';\n e.preventDefault();\n e.stopPropagation();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n drag.current = { kind, originIndex: indexAt(e.clientX), originRange: range };\n };\n const move = (e: ReactPointerEvent<HTMLElement>) => {\n const d = drag.current;\n if (!d) return;\n const i = indexAt(e.clientX);\n const [s0, e0] = d.originRange;\n if (d.kind === 'start') onRangeChange([Math.min(i, e0 - 1), e0]);\n else if (d.kind === 'end') onRangeChange([s0, Math.max(i, s0 + 1)]);\n else {\n const delta = Math.min(Math.max(i - d.originIndex, -s0), length - 1 - e0);\n onRangeChange([s0 + delta, e0 + delta]);\n }\n };\n const stop = () => {\n drag.current = null;\n };\n\n const onKey = (which: 'start' | 'end') => (e: KeyboardEvent<HTMLElement>) => {\n const value = which === 'start' ? start : end;\n const min = which === 'start' ? 0 : start + 1;\n const max = which === 'start' ? end - 1 : length - 1;\n let next: number | null = null;\n if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') next = value - 1;\n else if (e.key === 'ArrowRight' || e.key === 'ArrowUp') next = value + 1;\n else if (e.key === 'PageDown') next = value - step;\n else if (e.key === 'PageUp') next = value + step;\n else if (e.key === 'Home') next = min;\n else if (e.key === 'End') next = max;\n if (next == null) return;\n e.preventDefault();\n const clamped = Math.min(Math.max(next, min), max);\n onRangeChange(which === 'start' ? [clamped, end] : [start, clamped]);\n };\n\n const path = preview ? previewPath(preview) : '';\n const thumb = (which: 'start' | 'end') => {\n const value = which === 'start' ? start : end;\n return (\n <div\n role=\"slider\"\n tabIndex={0}\n aria-label={which === 'start' ? 'Range start' : 'Range end'}\n aria-orientation=\"horizontal\"\n aria-valuemin={which === 'start' ? 0 : start + 1}\n aria-valuemax={which === 'start' ? end - 1 : length - 1}\n aria-valuenow={value}\n aria-valuetext={labelOf(value)}\n data-brush-handle={which}\n className={thumbClass}\n style={{ left: pct(value) }}\n onKeyDown={onKey(which)}\n onPointerDown={begin}\n onPointerMove={move}\n onPointerUp={stop}\n onPointerCancel={stop}\n />\n );\n };\n\n if (length < 2) return null;\n return (\n <div role=\"group\" aria-label={label} data-chart-brush=\"\" className={cx('mt-3 px-1', className)}>\n <div ref={track} className=\"relative mx-1.5 h-10 rounded-md border border-border bg-secondary/30\">\n {path && (\n <svg aria-hidden viewBox=\"0 0 100 40\" preserveAspectRatio=\"none\" className=\"absolute inset-0 h-full w-full\">\n <path\n d={path}\n fill=\"none\"\n stroke=\"hsl(var(--muted-foreground))\"\n strokeOpacity={0.6}\n strokeWidth={1}\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n )}\n <div\n aria-hidden\n data-brush-window=\"\"\n className=\"absolute inset-y-0 cursor-grab touch-none border-y border-primary/60 bg-primary/14 active:cursor-grabbing\"\n style={{ left: pct(start), width: `${((end - start) / last) * 100}%` }}\n onPointerDown={begin}\n onPointerMove={move}\n onPointerUp={stop}\n onPointerCancel={stop}\n />\n {thumb('start')}\n {thumb('end')}\n </div>\n <div className=\"mt-1.5 flex items-center justify-between gap-2 text-[11.5px] text-muted-foreground\">\n <span className=\"font-mono tabular-nums\">\n {labelOf(start)} – {labelOf(end)}\n </span>\n {!full && (\n <button\n type=\"button\"\n onClick={() => onRangeChange([0, length - 1])}\n className={cx('px-1 font-medium text-foreground underline-offset-2 hover:underline', legendFocus)}\n >\n Reset zoom\n </button>\n )}\n </div>\n </div>\n );\n}\n","import { useCallback, useMemo, useReducer, useSyncExternalStore, type FocusEvent } from 'react';\n\nconst REDUCED_QUERY = '(prefers-reduced-motion: reduce)';\n\nfunction subscribeReduced(onChange: () => void) {\n if (typeof window === 'undefined' || !window.matchMedia) return () => {};\n const mq = window.matchMedia(REDUCED_QUERY);\n mq.addEventListener?.('change', onChange);\n return () => mq.removeEventListener?.('change', onChange);\n}\nconst getReduced = () =>\n typeof window !== 'undefined' && window.matchMedia ? window.matchMedia(REDUCED_QUERY).matches : false;\n\n/** `true` when the user asks for reduced motion (false on the server). */\nexport function usePrefersReducedMotion(): boolean {\n return useSyncExternalStore(subscribeReduced, getReduced, () => false);\n}\n\nexport interface UseLiveSeriesOptions<T> {\n /** Points shown before the first `append`. */\n initial?: readonly T[];\n /** Points kept (oldest drop off). Default 60. */\n windowSize?: number;\n /** Freeze the plotted data while the pointer is over the chart or focus is inside it (default true). */\n pauseOnInteraction?: boolean;\n}\n\nexport interface LiveSeriesPauseProps {\n onPointerEnter: () => void;\n onPointerLeave: () => void;\n onFocus: () => void;\n onBlur: (e: FocusEvent<HTMLElement>) => void;\n}\n\nexport interface LiveSeries<T> {\n /** The data to plot: frozen while paused, the latest window otherwise. */\n data: readonly T[];\n /** Appends one point or several (keeps the last `windowSize`). Buffered while paused. */\n append: (points: T | readonly T[]) => void;\n /** Replaces every point. */\n reset: (points?: readonly T[]) => void;\n /** Paused by interaction (hover/focus) or by `pause()`. */\n paused: boolean;\n /** Paused with `pause()` / `togglePaused()` (a visible Pause button — WCAG 2.2.2). */\n manuallyPaused: boolean;\n pause: () => void;\n resume: () => void;\n togglePaused: () => void;\n /** Points received while paused, shown on resume. */\n pending: number;\n /** The user prefers reduced motion: render updates without animation. */\n reducedMotion: boolean;\n /** Spread on the element wrapping the chart to pause on hover and focus. */\n pauseProps: LiveSeriesPauseProps;\n}\n\ninterface LiveState<T> {\n live: T[];\n frozen: T[] | null;\n pending: number;\n hover: boolean;\n focus: boolean;\n manual: boolean;\n}\n\ntype LiveAction<T> =\n | { type: 'append'; points: readonly T[]; size: number }\n | { type: 'reset'; points: readonly T[]; size: number }\n | { type: 'flag'; flag: 'hover' | 'focus' | 'manual'; on: boolean };\n\nfunction reducer<T>(state: LiveState<T>, action: LiveAction<T>): LiveState<T> {\n const paused = state.hover || state.focus || state.manual;\n switch (action.type) {\n case 'append': {\n if (action.points.length === 0) return state;\n const live = [...state.live, ...action.points].slice(-action.size);\n return { ...state, live, pending: paused ? Math.min(action.size, state.pending + action.points.length) : 0 };\n }\n case 'reset': {\n const live = action.points.slice(-action.size);\n return { ...state, live, frozen: paused ? live : null, pending: 0 };\n }\n case 'flag': {\n if (state[action.flag] === action.on) return state;\n const next = { ...state, [action.flag]: action.on };\n const nowPaused = next.hover || next.focus || next.manual;\n if (nowPaused && !paused) return { ...next, frozen: state.live, pending: 0 };\n if (!nowPaused && paused) return { ...next, frozen: null, pending: 0 };\n return next;\n }\n }\n}\n\n/**\n * State for a live-updating chart: a sliding window of points, with updates frozen while the\n * user hovers or focuses the chart (so a tooltip or a value does not move under them) and a\n * manual pause. Render with `animate={!reducedMotion}` for smooth transitions only when the\n * user has not asked for reduced motion.\n */\nexport function useLiveSeries<T>({\n initial = [],\n windowSize = 60,\n pauseOnInteraction = true,\n}: UseLiveSeriesOptions<T> = {}): LiveSeries<T> {\n const size = Math.max(1, Math.floor(windowSize));\n const [state, dispatch] = useReducer(reducer<T>, initial, (init): LiveState<T> => ({\n live: init.slice(-size),\n frozen: null,\n pending: 0,\n hover: false,\n focus: false,\n manual: false,\n }));\n const reducedMotion = usePrefersReducedMotion();\n const append = useCallback(\n (points: T | readonly T[]) =>\n dispatch({ type: 'append', points: Array.isArray(points) ? (points as readonly T[]) : [points as T], size }),\n [size],\n );\n const reset = useCallback((points: readonly T[] = []) => dispatch({ type: 'reset', points, size }), [size]);\n const pause = useCallback(() => dispatch({ type: 'flag', flag: 'manual', on: true }), []);\n const resume = useCallback(() => dispatch({ type: 'flag', flag: 'manual', on: false }), []);\n const pauseProps = useMemo<LiveSeriesPauseProps>(\n () => ({\n onPointerEnter: () => pauseOnInteraction && dispatch({ type: 'flag', flag: 'hover', on: true }),\n onPointerLeave: () => dispatch({ type: 'flag', flag: 'hover', on: false }),\n onFocus: () => pauseOnInteraction && dispatch({ type: 'flag', flag: 'focus', on: true }),\n onBlur: (e) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n dispatch({ type: 'flag', flag: 'focus', on: false });\n },\n }),\n [pauseOnInteraction],\n );\n const paused = state.hover || state.focus || state.manual;\n return {\n data: paused && state.frozen ? state.frozen : state.live,\n append,\n reset,\n paused,\n manuallyPaused: state.manual,\n pause,\n resume,\n togglePaused: state.manual ? resume : pause,\n pending: state.pending,\n reducedMotion,\n pauseProps,\n };\n}\n","import { useId, useState, type ReactElement } from 'react';\nimport { ReferenceLine } from 'recharts';\nimport { cx, type ValueFormatter } from './format';\nimport { legendFocus } from './ChartLegend';\n\n/** Semantic tone of a threshold or annotation (maps to a brand token, never a raw colour). */\nexport type ChartTone = 'neutral' | 'primary' | 'success' | 'warning' | 'destructive' | 'info';\n\n/** A horizontal reference line on the value axis (an SLO, a budget, a limit). */\nexport interface ChartThreshold {\n /** Value on the value axis. */\n value: number;\n /** Visible label drawn next to the line (thresholds are never colour-only). */\n label: string;\n tone?: ChartTone;\n /** ComboChart only: the axis the value belongs to (default `left`, the bar axis). */\n axis?: 'left' | 'right';\n}\n\n/** A vertical marker at an x (category) value: a deploy, an incident, a release. */\nexport interface ChartAnnotation {\n /** Category value on the x axis (must match an `index` value of the data). */\n x: string | number;\n /** Short visible label (drawn on the marker and listed under the chart). */\n label: string;\n /** Longer text shown in the marker tooltip and read by screen readers. */\n description?: string;\n tone?: ChartTone;\n}\n\n/** Stroke token and contrast-safe text token of each tone. */\nexport const TONE_TOKENS: Record<ChartTone, { stroke: string; text: string }> = {\n neutral: { stroke: '--muted-foreground', text: '--muted-foreground' },\n primary: { stroke: '--primary', text: '--primary-text' },\n success: { stroke: '--success', text: '--success-text' },\n warning: { stroke: '--warning', text: '--warning-text' },\n destructive: { stroke: '--destructive', text: '--destructive-text' },\n info: { stroke: '--info', text: '--foreground' },\n};\n\nconst v = (token: string) => `hsl(var(${token}))`;\n/** Dash patterns: thresholds are long dashes, annotations short dots — shape, not only colour. */\nexport const THRESHOLD_DASH = '6 4';\nexport const ANNOTATION_DASH = '2 3';\n\n/** A stable key for an annotation (x + label). */\nexport const annotationKey = (a: ChartAnnotation) => `${String(a.x)}::${a.label}`;\n\ninterface Box {\n x: number;\n y: number;\n width: number;\n height: number;\n}\nfunction boxOf(props: unknown, key: 'viewBox' | 'parentViewBox' = 'viewBox'): Box | null {\n const vb = (props as Record<string, Partial<Box> | undefined> | null)?.[key];\n if (!vb || typeof vb.x !== 'number' || typeof vb.y !== 'number') return null;\n return { x: vb.x, y: vb.y, width: vb.width ?? 0, height: vb.height ?? 0 };\n}\nfunction plotRightOf(props: unknown): number | undefined {\n const parent = boxOf(props, 'parentViewBox');\n return parent ? parent.x + parent.width : undefined;\n}\n\nfunction ThresholdLabel(props: { label: string; tone: ChartTone; vertical: boolean }) {\n const { label, tone, vertical } = props;\n const box = boxOf(props);\n if (!box) return null;\n const fill = v(TONE_TOKENS[tone].text);\n if (vertical) {\n return (\n <text x={box.x + 4} y={box.y + 12} fill={fill} fontSize={11} fontWeight={500} data-chart-threshold-label=\"\">\n {label}\n </text>\n );\n }\n return (\n <text\n x={box.x + box.width - 4}\n y={box.y - 5}\n textAnchor=\"end\"\n fill={fill}\n fontSize={11}\n fontWeight={500}\n data-chart-threshold-label=\"\"\n >\n {label}\n </text>\n );\n}\n\nfunction AnnotationMarker({\n box,\n annotation,\n active,\n onActive,\n plotRight,\n}: {\n box: Box;\n plotRight?: number;\n annotation: ChartAnnotation;\n active: boolean;\n onActive: (key: string | null) => void;\n}) {\n const tone = annotation.tone ?? 'neutral';\n const key = annotationKey(annotation);\n const tip = annotation.description ? `${annotation.label}: ${annotation.description}` : annotation.label;\n const tipWidth = Math.min(240, Math.max(90, tip.length * 6.2 + 16));\n // Keep the tooltip inside the plot: flip it to the left of the marker near the right edge.\n const flip = plotRight != null && box.x + tipWidth + 12 > plotRight;\n const tipX = flip ? box.x - tipWidth - 8 : box.x + 8;\n return (\n // Pointer affordance only: keyboard and screen-reader users get the same text from the marker list.\n <g\n aria-hidden\n data-chart-annotation={key}\n data-active={active || undefined}\n onPointerEnter={() => onActive(key)}\n onPointerLeave={() => onActive(null)}\n style={{ cursor: 'default' }}\n >\n <title>{tip}</title>\n {/* Flag glyph at the top of the marker (a shape cue besides the colour). */}\n <path d={`M${box.x},${box.y} l7,4 l-7,4 z`} fill={v(TONE_TOKENS[tone].stroke)} />\n <text x={box.x + 10} y={box.y + 8} fill={v(TONE_TOKENS[tone].text)} fontSize={11} fontWeight={active ? 600 : 500}>\n {annotation.label}\n </text>\n {/* Wide invisible hit area along the line. */}\n <rect x={box.x - 6} y={box.y} width={12} height={Math.max(box.height, 1)} fill=\"transparent\" />\n {active && (\n <g data-chart-annotation-tooltip=\"\">\n <rect\n x={tipX}\n y={box.y + 14}\n width={tipWidth}\n height={24}\n rx={6}\n fill={v('--popover')}\n stroke={v('--border')}\n />\n <text x={tipX + 8} y={box.y + 30} fill={v('--popover-foreground')} fontSize={11.5}>\n {tip}\n </text>\n </g>\n )}\n </g>\n );\n}\n\n/** Recharts clones a label element with the line's `viewBox` (and the plot's `parentViewBox`). */\nfunction AnnotationLabel(props: {\n annotation: ChartAnnotation;\n active: boolean;\n onActive: (key: string | null) => void;\n}) {\n const box = boxOf(props);\n if (!box) return null;\n return (\n <AnnotationMarker\n box={box}\n plotRight={plotRightOf(props)}\n annotation={props.annotation}\n active={props.active}\n onActive={props.onActive}\n />\n );\n}\n\nexport interface ReferenceElementsOptions {\n thresholds?: readonly ChartThreshold[];\n annotations?: readonly ChartAnnotation[];\n /** Bar charts with `layout=\"vertical\"` swap the axes (value on x, categories on y). */\n vertical?: boolean;\n /** Category values currently plotted (annotations outside are skipped). */\n categories: ReadonlySet<string>;\n activeAnnotation: string | null;\n onActiveAnnotation: (key: string | null) => void;\n /** ComboChart: map a threshold axis to the Recharts yAxisId. */\n yAxisIdOf?: (axis: 'left' | 'right') => string;\n}\n\n/**\n * Recharts `<ReferenceLine>` elements for thresholds and annotations. Returned as an array so\n * they are direct children of the chart.\n */\nexport function referenceElements({\n thresholds = [],\n annotations = [],\n vertical = false,\n categories,\n activeAnnotation,\n onActiveAnnotation,\n yAxisIdOf,\n}: ReferenceElementsOptions): ReactElement[] {\n const out: ReactElement[] = [];\n thresholds.forEach((th, i) => {\n const tone = th.tone ?? 'neutral';\n const pos = vertical ? { x: th.value } : { y: th.value };\n out.push(\n <ReferenceLine\n key={`threshold-${i}`}\n {...pos}\n {...(yAxisIdOf ? { yAxisId: yAxisIdOf(th.axis ?? 'left') } : {})}\n stroke={v(TONE_TOKENS[tone].stroke)}\n strokeWidth={1.5}\n strokeDasharray={THRESHOLD_DASH}\n ifOverflow=\"extendDomain\"\n label={<ThresholdLabel label={th.label} tone={tone} vertical={vertical} />}\n />,\n );\n });\n annotations.forEach((a) => {\n if (!categories.has(String(a.x))) return;\n const key = annotationKey(a);\n const active = activeAnnotation === key;\n const pos = vertical ? { y: a.x } : { x: a.x };\n out.push(\n <ReferenceLine\n key={`annotation-${key}`}\n {...pos}\n {...(yAxisIdOf ? { yAxisId: yAxisIdOf('left') } : {})}\n stroke={v(TONE_TOKENS[a.tone ?? 'neutral'].stroke)}\n strokeWidth={active ? 2 : 1.5}\n strokeDasharray={ANNOTATION_DASH}\n label={<AnnotationLabel annotation={a} active={active} onActive={onActiveAnnotation} />}\n />,\n );\n });\n return out;\n}\n\nexport interface ChartMarkersProps {\n thresholds?: readonly ChartThreshold[];\n annotations?: readonly ChartAnnotation[];\n /** Formats threshold values (the chart's value formatter). */\n valueFormatter?: ValueFormatter;\n /** Key of the annotation highlighted in the plot. */\n active?: string | null;\n onActiveChange?: (key: string | null) => void;\n className?: string;\n}\n\n/**\n * Text list of the thresholds and annotations under a chart: the keyboard and screen-reader\n * route to the same information as the in-plot markers. Focusing or hovering an annotation\n * highlights its marker and opens its tooltip in the plot.\n */\nexport function ChartMarkers({\n thresholds = [],\n annotations = [],\n valueFormatter,\n active = null,\n onActiveChange,\n className,\n}: ChartMarkersProps) {\n const id = useId();\n if (thresholds.length === 0 && annotations.length === 0) return null;\n const fmt = (n: number) => (valueFormatter ? valueFormatter(n) : String(n));\n return (\n <ul\n aria-label=\"Chart markers\"\n className={cx(\n 'mt-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 px-1 text-[12px] text-muted-foreground',\n className,\n )}\n >\n {thresholds.map((th, i) => (\n <li key={`t-${i}`} className=\"flex items-center gap-1.5\" data-chart-marker=\"threshold\">\n <svg aria-hidden width=\"18\" height=\"4\" className=\"shrink-0\">\n <line\n x1=\"0\"\n y1=\"2\"\n x2=\"18\"\n y2=\"2\"\n stroke={v(TONE_TOKENS[th.tone ?? 'neutral'].stroke)}\n strokeWidth={1.5}\n strokeDasharray={THRESHOLD_DASH}\n />\n </svg>\n <span>\n <span className=\"sr-only\">Threshold:</span> {th.label}{' '}\n <span className=\"font-mono tabular-nums\">({fmt(th.value)})</span>\n </span>\n </li>\n ))}\n {annotations.map((a) => {\n const key = annotationKey(a);\n const descId = `${id}-${key}`;\n return (\n <li key={key} data-chart-marker=\"annotation\">\n <button\n type=\"button\"\n aria-describedby={a.description ? descId : undefined}\n onFocus={() => onActiveChange?.(key)}\n onBlur={() => onActiveChange?.(null)}\n onPointerEnter={() => onActiveChange?.(key)}\n onPointerLeave={() => onActiveChange?.(null)}\n onKeyDown={(e) => {\n if (e.key === 'Escape') onActiveChange?.(null);\n }}\n className={cx(\n 'flex items-center gap-1.5 hover:text-foreground',\n active === key && 'text-foreground',\n legendFocus,\n )}\n >\n <svg aria-hidden width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" className=\"shrink-0\">\n <path d=\"M1,1 l8,4 l-8,4 z\" fill={v(TONE_TOKENS[a.tone ?? 'neutral'].stroke)} />\n </svg>\n <span>\n <span className=\"sr-only\">{`Marker at ${String(a.x)}:`}</span> {a.label}\n </span>\n </button>\n {a.description && (\n <span id={descId} className=\"sr-only\">\n {a.description}\n </span>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\n/** State of the highlighted annotation (shared by the plot markers and the marker list). */\nexport function useActiveAnnotation() {\n return useState<string | null>(null);\n}\n","import type { ReactElement, ReactNode } from 'react';\nimport { ChartBrush, useChartRange, type ChartRange } from './ChartBrush';\nimport type { ValueFormatter } from './format';\nimport { usePrefersReducedMotion } from './live';\nimport {\n annotationKey,\n ChartMarkers,\n referenceElements,\n useActiveAnnotation,\n type ChartAnnotation,\n type ChartThreshold,\n} from './overlays';\nimport { field, numField } from './shared';\n\n/** Thresholds, annotations, brush zoom and animation: shared by Line, Area, Bar and Combo charts. */\nexport interface CartesianExtrasProps {\n /** Horizontal reference lines on the value axis, each with a visible label and a tone. */\n thresholds?: readonly ChartThreshold[];\n /** Vertical markers at x values (deploys, incidents), with a label and a tooltip. */\n annotations?: readonly ChartAnnotation[];\n /** Shows a range brush under the plot to zoom into part of the series. */\n brush?: boolean;\n /** Controlled brush range: inclusive `[start, end]` indices into `data`. */\n range?: ChartRange;\n /** Initial brush range (uncontrolled). Default: every point. */\n defaultRange?: ChartRange;\n onRangeChange?: (range: ChartRange) => void;\n /** Animate data changes (e.g. a live series). Always off under prefers-reduced-motion. Default false. */\n animate?: boolean;\n}\n\nexport interface CartesianExtrasOptions {\n valueFormatter?: ValueFormatter;\n /** Series drawn in the brush overview. */\n previewKey?: string;\n /** Bar charts with `layout=\"vertical\"`. */\n vertical?: boolean;\n /** ComboChart: Recharts yAxisId for a threshold axis. */\n yAxisIdOf?: (axis: 'left' | 'right') => string;\n}\n\nexport interface CartesianExtras<T> {\n /** The data to plot (the brushed slice when `brush` is on). */\n view: readonly T[];\n /** `<ReferenceLine>` children for thresholds and annotations. */\n references: ReactElement[];\n /** Marker list and brush, rendered under the plot. */\n footer: ReactNode;\n /** Spread on Recharts series: animation only when asked for and motion is allowed. */\n animation: { isAnimationActive: boolean; animationDuration: number };\n}\n\nexport function useCartesianExtras<T extends object>(\n data: readonly T[],\n index: string,\n {\n thresholds = [],\n annotations = [],\n brush = false,\n range,\n defaultRange,\n onRangeChange,\n animate = false,\n }: CartesianExtrasProps,\n { valueFormatter, previewKey, vertical = false, yAxisIdOf }: CartesianExtrasOptions = {},\n): CartesianExtras<T> {\n const [current, setRange] = useChartRange({ length: data.length, range, defaultRange, onRangeChange });\n const [active, setActive] = useActiveAnnotation();\n const reduced = usePrefersReducedMotion();\n const view = brush ? data.slice(current[0], current[1] + 1) : data;\n const categories = new Set(view.map((d) => String(field(d, index))));\n const shown = annotations.filter((a) => categories.has(String(a.x)));\n const references = referenceElements({\n thresholds,\n annotations: shown,\n vertical,\n categories,\n activeAnnotation: active,\n onActiveAnnotation: setActive,\n yAxisIdOf,\n });\n const labelOf = (i: number) => {\n const d = data[i];\n return d ? String(field(d, index)) : '';\n };\n const footer = (\n <>\n <ChartMarkers\n thresholds={thresholds}\n annotations={shown}\n valueFormatter={valueFormatter}\n active={active && shown.some((a) => annotationKey(a) === active) ? active : null}\n onActiveChange={setActive}\n />\n {brush && (\n <ChartBrush\n length={data.length}\n range={current}\n onRangeChange={setRange}\n labelOf={labelOf}\n preview={previewKey ? data.map((d) => numField(d, previewKey)) : undefined}\n />\n )}\n </>\n );\n return { view, references, footer, animation: { isAnimationActive: animate && !reduced, animationDuration: 300 } };\n}\n","import { useSyncExternalStore } from 'react';\nimport { currentTheme, observeTheme, tokenColor, type Theme } from '@gntik-ai/tokens/runtime';\n\n/** Series colour name → brand token. Green primary is the hero; the rest are categorical accents. */\nexport const SERIES_TOKENS = {\n primary: '--primary',\n emerald: '--brand-accent',\n violet: '--category-violet',\n cyan: '--category-cyan',\n amber: '--category-amber',\n rose: '--category-rose',\n info: '--info',\n} as const;\n\nexport type ChartColor = keyof typeof SERIES_TOKENS;\n\n/**\n * Default series order: primary first, then the categorical accents ordered so every adjacent\n * pair differs in luminance by ≥ 1.5:1 in all three themes (see `palette.ts`).\n */\nexport const CHART_COLORS: readonly ChartColor[] = ['primary', 'violet', 'cyan', 'rose', 'amber'];\n\nexport interface ChartTheme {\n /** Active theme (\"dark\" | \"light\" | \"high_contrast\"); \"dark\" on the server and during hydration. */\n theme: Theme;\n grid: string;\n axis: string;\n text: string;\n /** Line/area hover cursor. */\n cursor: string;\n /** Bar hover band. */\n barCursor: string;\n /** Card surface (donut slice separators). */\n surface: string;\n /** Colour for a series name, with optional alpha (0–1). */\n color: (name: ChartColor, alpha?: number) => string;\n}\n\ntype ColorFn = (token: string, alpha?: number) => string;\n\n/** `hsl(var(--token))`: resolved by the browser (SVG fill/stroke and inline styles), so it is SSR-safe and follows theme switches. */\nconst cssVarColor: ColorFn = (token, alpha) => (alpha == null ? `hsl(var(${token}))` : `hsl(var(${token}) / ${alpha})`);\n\nfunction buildTheme(theme: Theme, c: ColorFn): ChartTheme {\n return {\n theme,\n grid: c('--border'),\n axis: c('--muted-foreground', 0.5),\n text: c('--muted-foreground'),\n cursor: c('--muted-foreground', 0.32),\n barCursor: c('--secondary', 0.55),\n surface: c('--card'),\n color: (name, alpha) => c(SERIES_TOKENS[name] ?? SERIES_TOKENS.primary, alpha),\n };\n}\n\n// Snapshots are cached so useSyncExternalStore gets a stable object between theme changes.\nconst varThemes = new Map<Theme, ChartTheme>();\nlet resolvedSnapshot: ChartTheme | null = null;\n\nfunction varTheme(theme: Theme): ChartTheme {\n let t = varThemes.get(theme);\n if (!t) {\n t = buildTheme(theme, cssVarColor);\n varThemes.set(theme, t);\n }\n return t;\n}\n\nfunction subscribe(onChange: () => void) {\n // Invalidate the resolved snapshot on every class change, even when the theme name stays the same.\n return observeTheme(() => {\n resolvedSnapshot = null;\n onChange();\n });\n}\n\nconst SERVER_THEME = varTheme('dark');\nconst getServerSnapshot = () => SERVER_THEME;\nconst getVarSnapshot = () => varTheme(currentTheme());\nfunction getResolvedSnapshot() {\n const theme = currentTheme();\n if (!resolvedSnapshot || resolvedSnapshot.theme !== theme)\n resolvedSnapshot = buildTheme(theme, (token, alpha) => tokenColor(token, alpha));\n return resolvedSnapshot;\n}\n\nexport interface UseChartThemeOptions {\n /**\n * Resolve the tokens to concrete `hsl(h s% l%)` strings (read from the DOM after hydration),\n * for consumers that cannot use `var()` (canvas, colour maths). Default: `hsl(var(--token))`.\n */\n resolved?: boolean;\n}\n\n/**\n * Brand colours for Recharts. By default every colour is a `hsl(var(--token))` string: SVG\n * fill/stroke attributes and inline styles resolve it, so server and client render the same\n * markup and a theme switch re-skins the chart without re-rendering. `theme` follows the\n * <html> class after mount. With `{ resolved: true }` colours are read from the live CSS\n * variables once mounted (the server and hydration render use the `var()` strings).\n */\nexport function useChartTheme({ resolved = false }: UseChartThemeOptions = {}): ChartTheme {\n return useSyncExternalStore(subscribe, resolved ? getResolvedSnapshot : getVarSnapshot, getServerSnapshot);\n}\n\n/** Colour for the i-th series, cycling through `colors`. */\nexport function seriesColor(t: ChartTheme, colors: readonly ChartColor[], i: number): string {\n const name = colors.length ? colors[i % colors.length] : undefined;\n return t.color(name ?? 'primary');\n}\n","import { Area, AreaChart as RAreaChart, CartesianGrid, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport {\n accessibleName,\n cartesianTable,\n axisProps,\n CHART_MARGIN,\n ChartFrame,\n type BaseChartProps,\n type DataKey,\n} from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { CHART_COLORS, seriesColor, useChartTheme } from './theme';\n\nexport interface AreaChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {\n categories: ReadonlyArray<DataKey<T>>;\n stacked?: boolean;\n showYAxis?: boolean;\n curve?: 'monotone' | 'linear' | 'step' | 'natural';\n}\n\n/** Area chart: flat fills (no gradient), no entry animation, interactive legend. */\nexport function AreaChart<T extends object>({\n data,\n index,\n categories,\n colors = CHART_COLORS,\n valueFormatter = identity,\n stacked = false,\n showLegend = true,\n showGrid = true,\n showYAxis = true,\n curve = 'monotone',\n height = 288,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: AreaChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter, previewKey: categories[0] },\n );\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({ key: c, label: c, color: col(i) }));\n const name = accessibleName('Area chart', ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n footer={x.footer}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <RAreaChart data={x.view} margin={CHART_MARGIN} accessibilityLayer title={title} desc={description}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={false} />}\n <XAxis dataKey={index} {...axisProps(t)} dy={8} minTickGap={20} />\n {showYAxis && <YAxis {...axisProps(t)} width={50} tickFormatter={valueFormatter} />}\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ stroke: t.cursor, strokeWidth: 1 }}\n content={tooltipContent({ valueFormatter })}\n />\n {categories.map((c, i) => (\n <Area\n key={c}\n type={curve}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stackId={stacked ? '1' : undefined}\n stroke={col(i)}\n strokeWidth={2}\n fill={col(i)}\n fillOpacity={stacked ? 0.82 : 0.14}\n dot={false}\n activeDot={{ r: 3.5, strokeWidth: 0 }}\n {...x.animation}\n />\n ))}\n </RAreaChart>\n </ChartFrame>\n );\n}\n","import { Bar, BarChart as RBarChart, CartesianGrid, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport {\n accessibleName,\n cartesianTable,\n axisProps,\n CHART_MARGIN,\n ChartFrame,\n type BaseChartProps,\n type DataKey,\n} from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { CHART_COLORS, seriesColor, useChartTheme } from './theme';\n\nexport interface BarChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {\n categories: ReadonlyArray<DataKey<T>>;\n stacked?: boolean;\n /** \"horizontal\" = vertical bars (categories on X); \"vertical\" = horizontal bars (categories on Y). */\n layout?: 'horizontal' | 'vertical';\n showYAxis?: boolean;\n}\n\ntype Radius = number | [number, number, number, number];\n\n/** Bar chart: vertical, horizontal or stacked; flat fills, no animation. */\nexport function BarChart<T extends object>({\n data,\n index,\n categories,\n colors = CHART_COLORS,\n valueFormatter = identity,\n stacked = false,\n layout = 'horizontal',\n showLegend = true,\n showGrid = true,\n showYAxis = true,\n height = 288,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: BarChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({ key: c, label: c, color: col(i) }));\n const vertical = layout === 'vertical';\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter, previewKey: categories[0], vertical },\n );\n const radius: Radius = stacked ? 0 : vertical ? [0, 3, 3, 0] : [3, 3, 0, 0];\n const name = accessibleName('Bar chart', ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n footer={x.footer}\n legend={\n showLegend &&\n categories.length > 1 && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />\n }\n >\n <RBarChart\n data={x.view}\n layout={layout}\n margin={CHART_MARGIN}\n barCategoryGap={vertical ? '22%' : '28%'}\n accessibilityLayer\n title={title}\n desc={description}\n >\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={vertical} horizontal={!vertical} />}\n {vertical ? (\n <>\n <XAxis type=\"number\" {...axisProps(t)} tickFormatter={valueFormatter} />\n <YAxis type=\"category\" dataKey={index} {...axisProps(t)} width={92} />\n </>\n ) : (\n <>\n <XAxis dataKey={index} {...axisProps(t)} dy={8} minTickGap={16} />\n {showYAxis && <YAxis {...axisProps(t)} width={50} tickFormatter={valueFormatter} />}\n </>\n )}\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ fill: t.barCursor }}\n content={tooltipContent({ valueFormatter })}\n />\n {categories.map((c, i) => (\n <Bar\n key={c}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stackId={stacked ? '1' : undefined}\n fill={col(i)}\n radius={radius}\n maxBarSize={vertical ? 22 : 46}\n {...x.animation}\n />\n ))}\n </RBarChart>\n </ChartFrame>\n );\n}\n","import { CartesianGrid, Line, LineChart as RLineChart, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport {\n accessibleName,\n cartesianTable,\n axisProps,\n CHART_MARGIN,\n ChartFrame,\n field,\n type BaseChartProps,\n type DataKey,\n} from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { CHART_COLORS, seriesColor, useChartTheme } from './theme';\n\nexport interface LineChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {\n categories: ReadonlyArray<DataKey<T>>;\n showYAxis?: boolean;\n /** Only label the first and last x ticks. */\n startEndOnly?: boolean;\n curve?: 'monotone' | 'linear' | 'step' | 'natural';\n}\n\ntype Tick = string | number;\nconst asTick = (v: unknown): Tick => (typeof v === 'number' ? v : String(v));\n\n/** Line chart: 2px strokes, no dots until hover, no animation. */\nexport function LineChart<T extends object>({\n data,\n index,\n categories,\n colors = CHART_COLORS,\n valueFormatter = identity,\n showLegend = true,\n showGrid = true,\n showYAxis = true,\n startEndOnly = false,\n curve = 'monotone',\n height = 288,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: LineChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter, previewKey: categories[0] },\n );\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({ key: c, label: c, color: col(i) }));\n const first = x.view[0];\n const last = x.view[x.view.length - 1];\n const xTicks: Tick[] | undefined =\n startEndOnly && first && last ? [asTick(field(first, index)), asTick(field(last, index))] : undefined;\n const name = accessibleName('Line chart', ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n footer={x.footer}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <RLineChart data={x.view} margin={CHART_MARGIN} accessibilityLayer title={title} desc={description}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={false} />}\n <XAxis\n dataKey={index}\n {...axisProps(t)}\n dy={8}\n minTickGap={startEndOnly ? 0 : 20}\n ticks={xTicks}\n interval={startEndOnly ? 'preserveStartEnd' : undefined}\n />\n {showYAxis && <YAxis {...axisProps(t)} width={50} tickFormatter={valueFormatter} />}\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ stroke: t.cursor, strokeWidth: 1 }}\n content={tooltipContent({ valueFormatter })}\n />\n {categories.map((c, i) => (\n <Line\n key={c}\n type={curve}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stroke={col(i)}\n strokeWidth={2}\n dot={false}\n activeDot={{ r: 3.5, strokeWidth: 0 }}\n {...x.animation}\n />\n ))}\n </RLineChart>\n </ChartFrame>\n );\n}\n","import { Bar, CartesianGrid, ComposedChart, Line, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity, type ValueFormatter } from './format';\nimport { accessibleName, cartesianTable, axisProps, ChartFrame, type BaseChartProps, type DataKey } from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { useChartTheme, type ChartColor } from './theme';\n\nexport interface ComboChartProps<T extends object>\n extends CartesianExtrasProps, Omit<BaseChartProps<T>, 'colors' | 'valueFormatter'> {\n /** Series drawn as bars on the left axis. */\n barSeries: DataKey<T>;\n /** Series drawn as a line on the right axis. */\n lineSeries: DataKey<T>;\n barColor?: ChartColor;\n lineColor?: ChartColor;\n barFormatter?: ValueFormatter;\n lineFormatter?: ValueFormatter;\n}\n\n/** Combo chart: bars on the left axis, a line on the right axis. */\nexport function ComboChart<T extends object>({\n data,\n index,\n barSeries,\n lineSeries,\n barColor = 'primary',\n lineColor = 'amber',\n barFormatter = identity,\n lineFormatter = identity,\n showLegend = true,\n showGrid = true,\n height = 300,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: ComboChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter: barFormatter, previewKey: barSeries, yAxisIdOf: (axis) => axis },\n );\n const bc = t.color(barColor);\n const lc = t.color(lineColor);\n const legend = [\n { key: barSeries, label: barSeries, color: bc },\n { key: lineSeries, label: lineSeries, color: lc },\n ];\n const fmtSeries = (v: unknown, name: string) => formatAny(v, name === lineSeries ? lineFormatter : barFormatter);\n const name = accessibleName('Combo chart', ariaLabel, title, [barSeries, lineSeries]);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, [barSeries, lineSeries], fmtSeries)}\n height={height}\n className={className}\n footer={x.footer}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <ComposedChart\n data={x.view}\n margin={{ top: 6, right: 6, left: 0, bottom: 0 }}\n barCategoryGap=\"30%\"\n accessibilityLayer\n title={title}\n desc={description}\n >\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={false} />}\n <XAxis dataKey={index} {...axisProps(t)} dy={8} minTickGap={16} />\n <YAxis yAxisId=\"left\" {...axisProps(t)} width={48} tickFormatter={barFormatter} />\n <YAxis yAxisId=\"right\" orientation=\"right\" {...axisProps(t)} width={48} tickFormatter={lineFormatter} />\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ fill: t.barCursor }}\n content={tooltipContent({ seriesFormatter: fmtSeries })}\n />\n <Bar\n yAxisId=\"left\"\n dataKey={barSeries}\n name={barSeries}\n hide={hidden.has(barSeries)}\n fill={bc}\n radius={[3, 3, 0, 0]}\n maxBarSize={42}\n {...x.animation}\n />\n <Line\n yAxisId=\"right\"\n type=\"monotone\"\n dataKey={lineSeries}\n name={lineSeries}\n hide={hidden.has(lineSeries)}\n stroke={lc}\n strokeWidth={2}\n dot={false}\n activeDot={{ r: 3.5, strokeWidth: 0 }}\n {...x.animation}\n />\n </ComposedChart>\n </ChartFrame>\n );\n}\n","import { Pie, PieChart, ResponsiveContainer, Tooltip } from 'recharts';\nimport { useHiddenSeries, legendFocus } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { cx, identity, type ValueFormatter } from './format';\nimport { accessibleName, field, numField, type DataKey } from './shared';\nimport { ChartDataTable, chartStateView, resolveState, type ChartStateProps } from './states';\nimport { CHART_COLORS, seriesColor, useChartTheme, type ChartColor } from './theme';\n\nexport interface DonutChartProps<T extends object> extends ChartStateProps {\n data: readonly T[];\n /** Key of the slice name field. */\n index: DataKey<T>;\n /** Key of the slice value field. */\n category: DataKey<T>;\n colors?: readonly ChartColor[];\n valueFormatter?: ValueFormatter;\n variant?: 'donut' | 'pie';\n showLegend?: boolean;\n /** Caption under the total in the donut hole (donut variant only). */\n centerLabel?: string;\n /** Diameter in px. */\n height?: number;\n 'aria-label'?: string;\n title?: string;\n description?: string;\n className?: string;\n}\n\ninterface Slice {\n name: string;\n value: number;\n fill: string;\n}\n\n/** Donut / pie with a clickable value legend; hidden slices drop out of the total. */\nexport function DonutChart<T extends object>({\n data,\n index,\n category,\n colors = CHART_COLORS,\n valueFormatter = identity,\n variant = 'donut',\n showLegend = true,\n centerLabel,\n height = 264,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: DonutChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n // Per-slice `fill` on the datum replaces the deprecated <Cell> of Recharts 2.\n const slices: Slice[] = data.map((d, i) => ({\n name: String(field(d, index)),\n value: numField(d, category),\n fill: seriesColor(t, colors, i),\n }));\n const shown = slices.filter((s) => !hidden.has(s.name));\n const total = shown.reduce((sum, s) => sum + s.value, 0);\n const isDonut = variant === 'donut';\n const name = accessibleName(\n isDonut ? 'Donut chart' : 'Pie chart',\n ariaLabel,\n title,\n slices.map((s) => s.name),\n );\n const effective = resolveState(state, slices.length);\n const placeholder = chartStateView(effective, { height, emptyMessage, errorMessage, onRetry });\n if (placeholder)\n return (\n <div\n role=\"figure\"\n aria-label={name}\n aria-busy={effective === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder}\n </div>\n );\n return (\n <div\n role=\"figure\"\n aria-label={name}\n className={cx('flex flex-col items-center gap-6 font-sans sm:flex-row', className)}\n >\n <div className=\"relative shrink-0\" style={{ width: height, height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <PieChart accessibilityLayer title={title} desc={description}>\n <Pie\n data={shown}\n dataKey=\"value\"\n nameKey=\"name\"\n cx=\"50%\"\n cy=\"50%\"\n innerRadius={isDonut ? '64%' : 0}\n outerRadius=\"94%\"\n paddingAngle={shown.length > 1 ? 1.5 : 0}\n stroke={t.surface}\n strokeWidth={2}\n isAnimationActive={false}\n />\n <Tooltip isAnimationActive={false} content={tooltipContent({ valueFormatter })} />\n </PieChart>\n </ResponsiveContainer>\n {isDonut && centerLabel && (\n <div className=\"pointer-events-none absolute inset-0 flex flex-col items-center justify-center\">\n <div className=\"font-mono text-[20px] font-semibold tabular-nums text-foreground\">\n {valueFormatter(total)}\n </div>\n <div className=\"mt-0.5 text-[11px] text-muted-foreground\">{centerLabel}</div>\n </div>\n )}\n </div>\n {showLegend && (\n <div className=\"flex w-full min-w-0 flex-1 flex-col gap-2\">\n {slices.map((s) => {\n const off = hidden.has(s.name);\n return (\n <button\n key={s.name}\n type=\"button\"\n aria-pressed={!off}\n onClick={() => toggle(s.name)}\n className={cx('group flex items-center justify-between gap-3', off && 'opacity-40', legendFocus)}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <span\n aria-hidden\n className={cx('h-2.5 w-2.5 shrink-0 rounded-[3px]', off && 'grayscale')}\n style={{ background: s.fill }}\n />\n <span\n className={cx(\n 'truncate text-[12.5px] text-muted-foreground',\n off ? 'line-through' : 'transition-colors group-hover:text-foreground',\n )}\n >\n {s.name}\n </span>\n </span>\n <span className=\"shrink-0 font-mono text-[12px] font-medium tabular-nums text-foreground\">\n {valueFormatter(s.value)}\n </span>\n </button>\n );\n })}\n </div>\n )}\n {dataTable && (\n <ChartDataTable\n caption={name}\n columns={[index, category]}\n rows={slices.map((sl) => [sl.name, valueFormatter(sl.value)])}\n />\n )}\n </div>\n );\n}\n","import { cx, identity, type ValueFormatter } from './format';\nimport { chartStateView, resolveState, type ChartStateProps } from './states';\nimport { field, numField, type DataKey } from './shared';\n\nconst BAR_LIST_BG = {\n primary: 'bg-primary/20',\n violet: 'bg-category-violet/20',\n cyan: 'bg-category-cyan/20',\n amber: 'bg-category-amber/20',\n rose: 'bg-category-rose/20',\n} as const;\n\nexport interface BarListProps<T extends object> extends Omit<ChartStateProps, 'dataTable'> {\n data: readonly T[];\n index: DataKey<T>;\n category: DataKey<T>;\n valueFormatter?: ValueFormatter;\n color?: keyof typeof BAR_LIST_BG;\n sortOrder?: 'desc' | 'asc' | 'none';\n 'aria-label'?: string;\n className?: string;\n}\n\n/** Axis-less ranked list: label inside a token-tinted bar, value on the right. */\nexport function BarList<T extends object>({\n data,\n index,\n category,\n valueFormatter = identity,\n color = 'primary',\n sortOrder = 'desc',\n className,\n 'aria-label': ariaLabel = 'Bar list',\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n}: BarListProps<T>) {\n const effective = resolveState(state, data.length);\n const placeholder = chartStateView(effective, { height: 160, emptyMessage, errorMessage, onRetry });\n if (placeholder)\n return (\n <div\n role=\"figure\"\n aria-label={ariaLabel}\n aria-busy={effective === 'loading' || undefined}\n className={cx('font-sans', className)}\n >\n {placeholder}\n </div>\n );\n const rows = data.slice();\n if (sortOrder === 'desc') rows.sort((a, b) => numField(b, category) - numField(a, category));\n else if (sortOrder === 'asc') rows.sort((a, b) => numField(a, category) - numField(b, category));\n const max = Math.max(...rows.map((d) => numField(d, category)), 1);\n return (\n <ul aria-label={ariaLabel} className={cx('flex flex-col gap-2 font-sans', className)}>\n {rows.map((r, i) => {\n const value = numField(r, category);\n const pct = Math.max((value / max) * 100, 1.5);\n return (\n <li key={i} className=\"flex items-center gap-3\">\n <div className=\"relative h-9 min-w-0 flex-1\">\n <div\n aria-hidden\n className={cx('absolute inset-y-0 left-0 rounded-md', BAR_LIST_BG[color])}\n style={{ width: `${pct}%` }}\n />\n <div className=\"relative z-10 flex h-full items-center px-2.5\">\n <span className=\"truncate text-[13px] text-foreground\">{String(field(r, index))}</span>\n </div>\n </div>\n <span className=\"w-16 shrink-0 text-right font-mono text-[13px] tabular-nums text-foreground\">\n {valueFormatter(value)}\n </span>\n </li>\n );\n })}\n </ul>\n );\n}\n","import { CHART_COLORS, SERIES_TOKENS, type ChartColor } from './theme';\n\n/**\n * Data-viz palette built ONLY from the frozen brand tokens.\n *\n * Categorical: `SAFE_CHART_COLORS` orders the five accents so that every adjacent pair differs\n * in relative luminance by at least 1.5:1 in dark, light and high_contrast (asserted by\n * `palette.test.ts` against `@gntik-ai/tokens/brand.css`). It is the default `CHART_COLORS`\n * order of every chart; this name is kept as an alias.\n *\n * Colour-blind safety: hue alone is never the only channel. Charts pair colour with position,\n * labels or the legend text; use at most five categorical series, prefer a sequential ramp\n * (one hue, varying lightness) for ordered data, and a diverging ramp (destructive ↔ muted ↔\n * primary, i.e. red ↔ green, which deutan/protan viewers confuse) only together with value\n * labels, a signed legend or the `dataTable` fallback — lightness still separates the ends.\n */\nexport const SAFE_CHART_COLORS: readonly ChartColor[] = CHART_COLORS;\n\n/** A CSS custom property name of a brand token (`--primary`, `--destructive`…). */\nexport type TokenName = `--${string}`;\n\nexport interface SequentialRampOptions {\n /** Hue of the ramp (series colour name). Default `primary`. */\n color?: ChartColor;\n /** Surface the ramp fades into. Default `--card`. */\n surface?: TokenName;\n /**\n * `mix` (default): opaque `color-mix(in oklab, …)` steps — safe for overlapping marks and text on top.\n * `alpha`: `hsl(var(--token) / a)` steps that let the underlying surface show through.\n */\n mode?: 'mix' | 'alpha';\n /** Strength of the weakest step, 0–1. Default 0.14. */\n min?: number;\n}\n\nexport interface DivergingRampOptions {\n /** Token for the low end. Default `--destructive`. */\n negative?: TokenName;\n /** Token for the high end. Default `--primary`. */\n positive?: TokenName;\n /** Token for the neutral midpoint. Default `--muted`. */\n mid?: TokenName;\n mode?: 'mix' | 'alpha';\n /** Strength of the weakest non-neutral step, 0–1. Default 0.18. */\n min?: number;\n}\n\nconst round = (n: number) => Math.round(n * 1000) / 1000;\nconst pct = (n: number) => `${Math.round(n * 1000) / 10}%`;\nconst solid = (token: TokenName) => `hsl(var(${token}))`;\n\n/** Mixes `token` into `base` at `weight` (0–1); `weight` 1 is the plain token. */\nfunction mix(token: TokenName, base: TokenName, weight: number, mode: 'mix' | 'alpha'): string {\n if (weight >= 1) return solid(token);\n if (mode === 'alpha') return `hsl(var(${token}) / ${round(weight)})`;\n return `color-mix(in oklab, ${solid(token)} ${pct(weight)}, ${solid(base)})`;\n}\n\nfunction clamp01(n: number) {\n return Math.min(1, Math.max(0, n));\n}\n\n/**\n * `n` colours from faint to the full token, for ordered magnitudes (heatmaps, choropleths,\n * funnel stages). Every value is a CSS colour string usable as SVG fill/stroke or inline style.\n */\nexport function sequentialRamp(n: number, options: SequentialRampOptions = {}): string[] {\n const { color = 'primary', surface = '--card', mode = 'mix', min = 0.14 } = options;\n const token = SERIES_TOKENS[color] as TokenName;\n const count = Math.max(0, Math.floor(n));\n const lo = clamp01(min);\n return Array.from({ length: count }, (_, i) => {\n const t = count === 1 ? 1 : lo + ((1 - lo) * i) / (count - 1);\n return mix(token, surface, t, mode);\n });\n}\n\n/**\n * `n` colours from `negative` (index 0) through the neutral `mid` to `positive` (last index),\n * for signed values around a meaningful centre (deltas, budgets, sentiment). With an odd `n`\n * the middle step is the plain neutral token.\n */\nexport function divergingRamp(n: number, options: DivergingRampOptions = {}): string[] {\n const { negative = '--destructive', positive = '--primary', mid = '--muted', mode = 'mix', min = 0.18 } = options;\n const count = Math.max(0, Math.floor(n));\n const lo = clamp01(min);\n // Smallest non-zero distance from the centre (odd counts have an exact neutral step).\n const dMin = count % 2 ? 2 / (count - 1) : 1 / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n if (count === 1) return solid(mid);\n const d = (i / (count - 1)) * 2 - 1; // −1 … 1\n const a = Math.abs(d);\n if (a < 1e-9) return solid(mid);\n const strength = a >= 1 - 1e-9 ? 1 : lo + ((1 - lo) * (a - dMin)) / (1 - dMin);\n return mix(d < 0 ? negative : positive, mid, strength, mode);\n });\n}\n\n/**\n * Index of the ramp step for `value`. `domain` is `[min, max]` (sequential) or\n * `[min, mid, max]` (diverging: `mid` maps to the centre of the ramp).\n */\nexport function rampIndex(\n value: number,\n domain: readonly [number, number] | readonly [number, number, number],\n steps: number,\n): number {\n if (steps <= 1 || !Number.isFinite(value)) return 0;\n let t: number;\n if (domain.length === 3) {\n const [lo, mid, hi] = domain;\n t =\n value <= mid\n ? 0.5 * (mid === lo ? 1 : (value - lo) / (mid - lo))\n : 0.5 + 0.5 * (hi === mid ? 1 : (value - mid) / (hi - mid));\n } else {\n const [lo, hi] = domain;\n t = hi === lo ? 1 : (value - lo) / (hi - lo);\n }\n return Math.min(steps - 1, Math.floor(clamp01(t) * steps));\n}\n\n/** Colour of `value` on `ramp` (see `rampIndex`). */\nexport function rampColor(\n value: number,\n domain: readonly [number, number] | readonly [number, number, number],\n ramp: readonly string[],\n): string {\n return ramp[rampIndex(value, domain, ramp.length)] ?? ramp[0] ?? solid('--muted');\n}\n","import { Funnel, FunnelChart as RFunnelChart, ResponsiveContainer, Tooltip } from 'recharts';\nimport { tooltipContent } from './ChartTooltip';\nimport { chartFmt, cx, identity, type ValueFormatter } from './format';\nimport { sequentialRamp } from './palette';\nimport { accessibleName, field, numField, type DataKey } from './shared';\nimport { ChartDataTable, chartStateView, resolveState, type ChartStateProps } from './states';\nimport { useChartTheme, type ChartColor } from './theme';\n\nexport interface FunnelChartProps<T extends object> extends ChartStateProps {\n /** Stages in order, widest first. */\n data: readonly T[];\n /** Key of the stage name. */\n index: DataKey<T>;\n /** Key of the stage count. */\n category: DataKey<T>;\n /** Hue of the stages (a sequential ramp, strongest first). Default `primary`. */\n color?: ChartColor;\n valueFormatter?: ValueFormatter;\n /** Show the stage list with conversion and drop-off. Default `true`. */\n showStages?: boolean;\n /** Funnel height in px. */\n height?: number;\n 'aria-label'?: string;\n title?: string;\n description?: string;\n className?: string;\n}\n\nexport interface FunnelStage {\n name: string;\n value: number;\n /** Share of the first stage (0–1). */\n conversion: number;\n /** Loss from the previous stage (0–1); 0 for the first stage. */\n dropOff: number;\n fill: string;\n}\n\n/** Stage maths: conversion against the first stage and drop-off against the previous one. */\nexport function funnelStages(\n values: ReadonlyArray<{ name: string; value: number }>,\n fills: readonly string[] = [],\n): FunnelStage[] {\n const first = values[0]?.value ?? 0;\n return values.map((s, i) => {\n const prev = i === 0 ? s.value : (values[i - 1]?.value ?? 0);\n return {\n name: s.name,\n value: s.value,\n conversion: first > 0 ? s.value / first : 0,\n dropOff: i === 0 || prev <= 0 ? 0 : Math.max(0, (prev - s.value) / prev),\n fill: fills[i] ?? fills[fills.length - 1] ?? 'hsl(var(--primary))',\n };\n });\n}\n\n/** Staged conversion funnel: trapezoids in a one-hue ramp plus a stage list with drop-off. */\nexport function FunnelChart<T extends object>({\n data,\n index,\n category,\n color = 'primary',\n valueFormatter = identity,\n showStages = true,\n height = 260,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: FunnelChartProps<T>) {\n const t = useChartTheme();\n const ramp = sequentialRamp(Math.max(data.length, 1), {\n color,\n min: 0.35,\n }).reverse();\n const stages = funnelStages(\n data.map((d) => ({\n name: String(field(d, index)),\n value: numField(d, category),\n })),\n ramp,\n );\n const name = accessibleName(\n 'Funnel chart',\n ariaLabel,\n title,\n stages.map((s) => s.name),\n );\n const effective = resolveState(state, data.length);\n const placeholder = chartStateView(effective, {\n height,\n emptyMessage,\n errorMessage,\n onRetry,\n });\n const byName = new Map(stages.map((s) => [s.name, s]));\n const fmtStage = (v: unknown, stage: string) => {\n const s = byName.get(stage);\n const base = typeof v === 'number' ? valueFormatter(v) : String(v ?? '');\n return s ? `${base} · ${chartFmt.percent(s.conversion)}` : base;\n };\n return (\n <div\n role=\"figure\"\n aria-label={name}\n aria-busy={effective === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder ?? (\n <div className=\"flex flex-col gap-5 sm:flex-row sm:items-center\">\n <div className=\"min-w-0 flex-1\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <RFunnelChart\n margin={{ top: 4, right: 4, bottom: 4, left: 4 }}\n accessibilityLayer\n title={title}\n desc={description}\n >\n <Funnel\n data={stages}\n dataKey=\"value\"\n nameKey=\"name\"\n stroke={t.surface}\n strokeWidth={2}\n lastShapeType=\"rectangle\"\n isAnimationActive={false}\n />\n <Tooltip isAnimationActive={false} content={tooltipContent({ seriesFormatter: fmtStage })} />\n </RFunnelChart>\n </ResponsiveContainer>\n </div>\n {showStages && (\n <ol aria-label=\"Stages\" className=\"flex w-full flex-col gap-2 sm:w-64\">\n {stages.map((s, i) => (\n <li\n key={s.name}\n className=\"flex items-center justify-between gap-3 border-b border-border pb-2 last:border-b-0\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <span aria-hidden className=\"h-2.5 w-2.5 shrink-0 rounded-[3px]\" style={{ background: s.fill }} />\n <span className=\"truncate text-[12.5px] text-foreground\">{s.name}</span>\n </span>\n <span className=\"flex shrink-0 items-baseline gap-2 font-mono text-[12px] tabular-nums\">\n <span className=\"font-medium text-foreground\">{valueFormatter(s.value)}</span>\n <span className=\"text-muted-foreground\">{chartFmt.percent(s.conversion)}</span>\n {i > 0 && (\n <span className=\"text-destructive-text\">\n <span className=\"sr-only\">drop-off </span>−{chartFmt.percent(s.dropOff)}\n </span>\n )}\n </span>\n </li>\n ))}\n </ol>\n )}\n {dataTable && (\n <ChartDataTable\n caption={name}\n columns={['Stage', category, 'Conversion', 'Drop-off']}\n rows={stages.map((s) => [\n s.name,\n valueFormatter(s.value),\n chartFmt.percent(s.conversion),\n chartFmt.percent(s.dropOff),\n ])}\n />\n )}\n </div>\n )}\n </div>\n );\n}\n","import { Sankey, Tooltip, type SankeyLinkProps as LinkProps, type SankeyNodeProps as NodeProps } from 'recharts';\nimport { tooltipContent } from './ChartTooltip';\nimport { identity, type ValueFormatter } from './format';\nimport { SAFE_CHART_COLORS } from './palette';\nimport { accessibleName, ChartFrame } from './shared';\nimport { ChartDataTable, resolveState, type ChartStateProps } from './states';\nimport { seriesColor, useChartTheme, type ChartColor } from './theme';\n\nexport interface SankeyNodeDatum {\n name: string;\n /** Series colour of the node (and of its outgoing flows). Default: cycles `colors`. */\n color?: ChartColor;\n}\n\nexport interface SankeyLinkDatum {\n /** Source node: its name or its index in `nodes`. */\n source: string | number;\n /** Target node: its name or its index in `nodes`. */\n target: string | number;\n value: number;\n}\n\nexport interface SankeyChartProps extends ChartStateProps {\n nodes: readonly SankeyNodeDatum[];\n links: readonly SankeyLinkDatum[];\n colors?: readonly ChartColor[];\n valueFormatter?: ValueFormatter;\n /** Plot height in px. */\n height?: number;\n nodeWidth?: number;\n nodePadding?: number;\n 'aria-label'?: string;\n title?: string;\n description?: string;\n className?: string;\n}\n\ninterface ResolvedLink {\n source: number;\n target: number;\n value: number;\n}\n\n/** Turns name-or-index links into the index links Recharts expects; drops unknown endpoints and non-positive values. */\nexport function resolveSankeyLinks(\n nodes: readonly SankeyNodeDatum[],\n links: readonly SankeyLinkDatum[],\n): ResolvedLink[] {\n const byName = new Map(nodes.map((n, i) => [n.name, i]));\n const idx = (ref: string | number) =>\n typeof ref === 'number' ? (ref >= 0 && ref < nodes.length ? ref : undefined) : byName.get(ref);\n const out: ResolvedLink[] = [];\n for (const l of links) {\n const source = idx(l.source);\n const target = idx(l.target);\n if (source === undefined || target === undefined || source === target || !(l.value > 0)) continue;\n out.push({ source, target, value: l.value });\n }\n return out;\n}\n\n/** Flow diagram: nodes as token-coloured bars, links tinted with their source colour. */\nexport function SankeyChart({\n nodes,\n links,\n colors = SAFE_CHART_COLORS,\n valueFormatter = identity,\n height = 320,\n nodeWidth = 10,\n nodePadding = 18,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: SankeyChartProps) {\n const t = useChartTheme();\n const resolved = resolveSankeyLinks(nodes, links);\n const fills = nodes.map((n, i) => (n.color ? t.color(n.color) : seriesColor(t, colors, i)));\n const sources = new Set(resolved.map((l) => l.source));\n const name = accessibleName(\n 'Sankey chart',\n ariaLabel,\n title,\n nodes.map((n) => n.name),\n );\n const data = {\n nodes: nodes.map((n, i) => ({ name: n.name, fill: fills[i] })),\n links: resolved,\n };\n\n const renderNode = ({ x, y, width, height: h, index }: NodeProps) => {\n const sink = !sources.has(index);\n return (\n <g>\n <rect x={x} y={y} width={width} height={Math.max(h, 1)} rx={2} fill={fills[index]} />\n <text\n x={sink ? x - 6 : x + width + 6}\n y={y + h / 2}\n dy=\"0.35em\"\n textAnchor={sink ? 'end' : 'start'}\n fontSize={11}\n fill={t.text}\n >\n {nodes[index]?.name}\n </text>\n </g>\n );\n };\n const renderLink = (p: LinkProps) => {\n const source = resolved[p.index]?.source ?? 0;\n return (\n <path\n d={`M${p.sourceX},${p.sourceY} C${p.sourceControlX},${p.sourceY} ${p.targetControlX},${p.targetY} ${p.targetX},${p.targetY}`}\n fill=\"none\"\n stroke={fills[source] ?? t.color('primary')}\n strokeOpacity={0.28}\n strokeWidth={Math.max(p.linkWidth, 1)}\n />\n );\n };\n\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, resolved.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n height={height}\n className={className}\n table={\n dataTable && (\n <ChartDataTable\n caption={name}\n columns={['From', 'To', 'Value']}\n rows={resolved.map((l) => [\n nodes[l.source]?.name ?? '',\n nodes[l.target]?.name ?? '',\n valueFormatter(l.value),\n ])}\n />\n )\n }\n >\n <Sankey\n data={data}\n nameKey=\"name\"\n nodeWidth={nodeWidth}\n nodePadding={nodePadding}\n margin={{ top: 6, right: 96, bottom: 6, left: 6 }}\n node={renderNode}\n link={renderLink}\n accessibilityLayer\n title={title}\n desc={description}\n >\n <Tooltip isAnimationActive={false} content={tooltipContent({ valueFormatter })} />\n </Sankey>\n </ChartFrame>\n );\n}\n","import { PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart as RRadarChart, Tooltip } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport { SAFE_CHART_COLORS } from './palette';\nimport { accessibleName, cartesianTable, ChartFrame, type BaseChartProps, type DataKey } from './shared';\nimport { resolveState } from './states';\nimport { seriesColor, useChartTheme } from './theme';\n\nexport interface RadarChartProps<T extends object> extends Omit<BaseChartProps<T>, 'showGrid'> {\n /** One key per compared entity (a polygon each). `index` holds the axis names. */\n categories: ReadonlyArray<DataKey<T>>;\n /** Upper bound of the radial scale (e.g. 100 for scores). Default: data max. */\n max?: number;\n /** Show the concentric grid. Default `true`. */\n showGrid?: boolean;\n /** Show the radial scale ticks. Default `false`. */\n showRadiusAxis?: boolean;\n}\n\n/** Multi-axis scores: one translucent polygon per category over a polygonal grid. */\nexport function RadarChart<T extends object>({\n data,\n index,\n categories,\n colors = SAFE_CHART_COLORS,\n valueFormatter = identity,\n max,\n showLegend = true,\n showGrid = true,\n showRadiusAxis = false,\n height = 300,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: RadarChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({\n key: c,\n label: c,\n color: col(i),\n }));\n const name = accessibleName('Radar chart', ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, data, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <RRadarChart data={data} outerRadius=\"76%\" accessibilityLayer title={title} desc={description}>\n {showGrid && <PolarGrid stroke={t.grid} />}\n <PolarAngleAxis dataKey={index} tick={{ fill: t.text, fontSize: 11 }} />\n <PolarRadiusAxis\n domain={[0, max ?? 'auto']}\n angle={90}\n axisLine={false}\n tick={showRadiusAxis ? { fill: t.text, fontSize: 10 } : false}\n tickFormatter={valueFormatter}\n />\n <Tooltip isAnimationActive={false} content={tooltipContent({ valueFormatter })} />\n {categories.map((c, i) => (\n <Radar\n key={c}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stroke={col(i)}\n strokeWidth={2}\n fill={col(i)}\n fillOpacity={0.14}\n dot={{ r: 2.5, strokeWidth: 0, fill: col(i) }}\n isAnimationActive={false}\n />\n ))}\n </RRadarChart>\n </ChartFrame>\n );\n}\n","import { useId, useState, type KeyboardEvent } from 'react';\nimport { cx, identity, type ValueFormatter } from './format';\nimport { divergingRamp, rampIndex, sequentialRamp } from './palette';\nimport { accessibleName, field, type DataKey } from './shared';\nimport { ChartDataTable, chartStateView, resolveState, type ChartStateProps } from './states';\nimport type { ChartColor } from './theme';\n\nexport interface HeatmapProps<T extends object> extends ChartStateProps {\n /** One row per datum (cohort, day…). */\n data: readonly T[];\n /** Key of the row label. */\n index: DataKey<T>;\n /** Column keys (weeks, hours…), in display order. Missing / non-numeric values render as empty cells. */\n categories: ReadonlyArray<DataKey<T>>;\n /** `sequential` (default) for magnitudes, `diverging` for signed values around `domain[1]`. */\n scale?: 'sequential' | 'diverging';\n /** `[min, max]` or, for diverging, `[min, mid, max]`. Default: the data extent (mid 0). */\n domain?: readonly [number, number] | readonly [number, number, number];\n /** Number of colour steps. Default 6 (sequential) / 7 (diverging). */\n steps?: number;\n /** Hue of the sequential scale. Default `primary`. */\n color?: ChartColor;\n valueFormatter?: ValueFormatter;\n /** Print the value inside each cell. */\n showValues?: boolean;\n /** Show the colour scale under the grid. Default `true`. */\n showScale?: boolean;\n /** Cell height in px (default 28). Ignored when `height` is set. */\n cellHeight?: number;\n /**\n * Height of the grid in px (column labels included): cells shrink or grow to fill it (16–48 px\n * each). Use it to match sibling charts, e.g. inside a ChartCard.\n */\n height?: number;\n /** Row header column label (table fallback). Default: `index`. */\n rowHeader?: string;\n 'aria-label'?: string;\n title?: string;\n className?: string;\n}\n\nfunction extent(values: readonly number[]): [number, number] {\n if (!values.length) return [0, 1];\n return [Math.min(...values), Math.max(...values)];\n}\n\n/** Column-label row height + inter-row gap, used to fit rows into a fixed `height`. */\nconst LABEL_ROW = 20;\nconst GAP = 3;\n\n/** Cell height that fits `rows` rows in `height` px (clamped to 16–48), or undefined without a height. */\nexport function cellHeightFor(height: number | undefined, rows: number): number | undefined {\n if (height === undefined) return undefined;\n const n = Math.max(rows, 1);\n return Math.min(48, Math.max(16, Math.floor((height - LABEL_ROW - GAP * n) / n)));\n}\n\nconst cellFocus = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring';\n\n/**\n * Cohort / time grid coloured with a sequential or diverging token ramp. The colour grid is\n * a single keyboard stop (arrow keys move the active cell, Home/End jump within the row) with a\n * live readout; screen readers get the full data table (`dataTable`, on by default).\n */\nexport function Heatmap<T extends object>({\n data,\n index,\n categories,\n scale = 'sequential',\n domain,\n steps,\n color = 'primary',\n valueFormatter = identity,\n showValues = false,\n showScale = true,\n cellHeight: cellHeightProp = 28,\n height,\n rowHeader,\n title,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = true,\n}: HeatmapProps<T>) {\n const id = useId();\n const cellHeight = cellHeightFor(height, data.length) ?? cellHeightProp;\n const [active, setActive] = useState<readonly [number, number] | null>(null);\n const name = accessibleName('Heatmap', ariaLabel, title, []);\n const diverging = scale === 'diverging';\n const count = steps ?? (diverging ? 7 : 6);\n const ramp = diverging ? divergingRamp(count) : sequentialRamp(count, { color });\n const value = (r: number, c: number): number | null => {\n const row = data[r];\n const key = categories[c];\n if (!row || key === undefined) return null;\n const v = field(row, key);\n return typeof v === 'number' && Number.isFinite(v) ? v : null;\n };\n const all = data.flatMap((_, r) => categories.map((__, c) => value(r, c))).filter((v): v is number => v !== null);\n const [lo, hi] = extent(all);\n const dom: readonly [number, number] | readonly [number, number, number] =\n domain ?? (diverging ? [Math.min(lo, 0), 0, Math.max(hi, 0)] : [lo, hi]);\n const effective = resolveState(state, all.length);\n const placeholder = chartStateView(effective, {\n height: height ?? Math.max(data.length, 4) * (cellHeight + 3),\n emptyMessage,\n errorMessage,\n onRetry,\n });\n\n // Value labels sit on a card-coloured chip: foreground on card is AA in every theme,\n // whatever ramp step is underneath (mid steps fail with any single on-colour text).\n const cellStyle = (v: number) => ({ fill: ramp[rampIndex(v, dom, count)] ?? ramp[0] });\n\n const rowLabel = (r: number) => {\n const row = data[r];\n return row ? String(field(row, index)) : '';\n };\n const describe = ([r, c]: readonly [number, number]) => {\n const v = value(r, c);\n return `${rowLabel(r)} · ${categories[c] ?? ''}: ${v === null ? 'no data' : valueFormatter(v)}`;\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n const [r, c] = active ?? [0, 0];\n const lastR = data.length - 1;\n const lastC = categories.length - 1;\n const next: Record<string, readonly [number, number]> = {\n ArrowRight: [r, Math.min(lastC, c + 1)],\n ArrowLeft: [r, Math.max(0, c - 1)],\n ArrowDown: [Math.min(lastR, r + 1), c],\n ArrowUp: [Math.max(0, r - 1), c],\n Home: [r, 0],\n End: [r, lastC],\n };\n const to = next[e.key];\n if (to) {\n e.preventDefault();\n setActive(active ? to : [0, 0]);\n } else if (e.key === 'Escape') setActive(null);\n };\n\n if (placeholder)\n return (\n <div\n role=\"figure\"\n aria-label={name}\n aria-busy={effective === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder}\n </div>\n );\n\n const columns = `minmax(4.5rem, max-content) repeat(${categories.length}, minmax(1.75rem, 1fr))`;\n return (\n <div role=\"figure\" aria-label={name} className={cx('w-full font-sans', className)}>\n <div\n role=\"group\"\n tabIndex={0}\n aria-label={`${name}: colour grid, use the arrow keys to read cells`}\n onKeyDown={onKeyDown}\n onFocus={() => setActive((a) => a ?? [0, 0])}\n onBlur={() => setActive(null)}\n onMouseLeave={() => setActive(null)}\n className={cx('overflow-x-auto rounded-md', cellFocus)}\n >\n {/* Narrow containers (cards, phones) scroll the grid sideways instead of squeezing cells. */}\n <div aria-hidden className=\"grid gap-[3px]\" style={{ gridTemplateColumns: columns }}>\n <div />\n {categories.map((c) => (\n <div key={c} className=\"truncate pb-1 text-center text-[11px] text-muted-foreground\">\n {c}\n </div>\n ))}\n {data.map((_, r) => [\n <div\n key={`h${r}`}\n className=\"flex items-center truncate pr-2 text-[11.5px] text-muted-foreground\"\n style={{ height: cellHeight }}\n >\n {rowLabel(r)}\n </div>,\n ...categories.map((c, ci) => {\n const v = value(r, ci);\n const s = v === null ? null : cellStyle(v);\n const on = active?.[0] === r && active[1] === ci;\n return (\n <div\n key={`${r}-${c}`}\n data-cell={`${r}-${ci}`}\n data-fill={s?.fill}\n onMouseEnter={() => setActive([r, ci])}\n className={cx(\n 'flex items-center justify-center rounded-[3px] font-mono text-[10.5px] tabular-nums',\n !s && 'border border-dashed border-border',\n on && 'outline-2 outline-offset-1 outline-foreground',\n )}\n style={{ height: cellHeight, background: s?.fill }}\n >\n {showValues && v !== null ? (\n <span className=\"rounded-[2px] bg-card px-1 leading-4 text-foreground\">{valueFormatter(v)}</span>\n ) : null}\n </div>\n );\n }),\n ])}\n </div>\n </div>\n <div className=\"mt-2 flex flex-wrap items-center justify-between gap-3\">\n <p\n id={`${id}-readout`}\n data-heatmap-readout=\"\"\n aria-live=\"polite\"\n className=\"min-h-[1.25rem] text-[12px] text-muted-foreground\"\n >\n {active ? describe(active) : ''}\n </p>\n {showScale && (\n <div aria-hidden className=\"flex items-center gap-1.5 text-[11px] text-muted-foreground\">\n <span className=\"font-mono tabular-nums\">{valueFormatter(dom[0])}</span>\n <span className=\"flex\">\n {ramp.map((f, i) => (\n <span key={i} className=\"h-2.5 w-4 first:rounded-l-sm last:rounded-r-sm\" style={{ background: f }} />\n ))}\n </span>\n <span className=\"font-mono tabular-nums\">{valueFormatter(dom[dom.length - 1] ?? dom[0])}</span>\n </div>\n )}\n </div>\n {dataTable && (\n <ChartDataTable\n caption={name}\n columns={[rowHeader ?? index, ...categories]}\n rows={data.map((_, r) => [\n rowLabel(r),\n ...categories.map((__, c) => {\n const v = value(r, c);\n return v === null ? '—' : valueFormatter(v);\n }),\n ])}\n />\n )}\n </div>\n );\n}\n","import type { Ref, SVGAttributes } from 'react';\nimport { cx } from './format';\n\n/** Same tones as the `@gntik-ai/ui` Sparkline, so the two can sit side by side in stat cards. */\nexport type MiniBarTone = 'primary' | 'success' | 'warning' | 'destructive' | 'info' | 'neutral';\n\nconst TONE_TOKEN: Record<MiniBarTone, string> = {\n primary: '--primary',\n success: '--success',\n warning: '--warning',\n destructive: '--destructive',\n info: '--info',\n neutral: '--muted-foreground',\n};\n\nexport interface MiniBarProps extends Omit<SVGAttributes<SVGSVGElement>, 'className' | 'width' | 'height'> {\n className?: string;\n ref?: Ref<SVGSVGElement>;\n /** The series, oldest first. */\n data: readonly number[];\n /** Per-bar labels (e.g. dates) for hover titles and the accessible summary. */\n labels?: readonly string[];\n tone?: MiniBarTone;\n /** Which bar is drawn at full strength; the rest are muted. Default `last`. */\n highlight?: 'last' | 'max' | 'min' | 'none' | number;\n width?: number;\n height?: number;\n /** What the series measures, used in the generated accessible name (\"Deployments\"). */\n label?: string;\n formatValue?: (value: number) => string;\n}\n\nconst fmtDefault = (v: number) => new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 }).format(v);\n\n/** \"Deployments: 12 bars, latest 9, low 2, high 14, total 84\". */\nexport function describeBars(data: readonly number[], label = 'Bars', format = fmtDefault): string {\n const last = data[data.length - 1];\n if (last === undefined) return `${label}: no data`;\n const total = data.reduce((s, v) => s + v, 0);\n return `${label}: ${data.length} bars, latest ${format(last)}, low ${format(Math.min(...data))}, high ${format(Math.max(...data))}, total ${format(total)}`;\n}\n\nfunction highlightIndex(data: readonly number[], h: MiniBarProps['highlight']): number {\n if (typeof h === 'number') return h;\n if (h === 'last') return data.length - 1;\n if (h === 'max') return data.indexOf(Math.max(...data));\n if (h === 'min') return data.indexOf(Math.min(...data));\n return -1;\n}\n\n/**\n * Sparkline-sized bar chart (pure SVG, no axes): drop-in next to `Sparkline variant=\"bar\"`,\n * with a highlighted bar, per-bar hover titles and a generated `role=\"img\"` summary.\n */\nexport function MiniBar({\n data,\n labels,\n tone = 'primary',\n highlight = 'last',\n width = 120,\n height = 32,\n label,\n formatValue = fmtDefault,\n className,\n ...props\n}: MiniBarProps) {\n const name = props['aria-label'] ?? describeBars(data, label, formatValue);\n const token = TONE_TOKEN[tone];\n const n = data.length;\n const lo = n ? Math.min(0, ...data) : 0;\n const hi = n ? Math.max(0, ...data) : 0;\n const span = hi - lo || 1;\n const zero = height - ((0 - lo) / span) * height;\n const slot = n ? width / n : width;\n const gap = Math.min(2, slot * 0.25);\n const hl = highlightIndex(data, highlight);\n return (\n <svg\n role=\"img\"\n viewBox={`0 0 ${width} ${height}`}\n width={width}\n height={height}\n className={cx('inline-block shrink-0 overflow-visible align-middle', className)}\n {...props}\n aria-label={name}\n >\n {data.map((v, i) => {\n const h = Math.max(1, (Math.abs(v) / span) * height);\n const y = v >= 0 ? zero - h : zero;\n return (\n <rect\n key={i}\n data-highlight={i === hl || undefined}\n x={i * slot + gap / 2}\n y={y}\n width={Math.max(1, slot - gap)}\n height={h}\n rx={1}\n fill={i === hl || hl < 0 ? `hsl(var(${token}))` : `hsl(var(${token}) / 0.4)`}\n >\n <title>{`${labels?.[i] ?? `#${i + 1}`}: ${formatValue(v)}`}</title>\n </rect>\n );\n })}\n </svg>\n );\n}\n"],"mappings":";;;;;;AAGA,MAAM,MAAM,SAAoC,IAAI,KAAK,aAAa,SAAS,IAA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BAAiB,aAAa,MAAM,OAAO,WAAW;CACzE,MAAM,QAAQ,WAAW;CACzB,MAAM,IAAI,KAAK;CACf,MAAM,KAAK,IAAI,KAAK,IAAI,GAAG,GAAG,IAAI,IAAI;CAEtC,MAAM,QADK,IAAI,KAAK,IAAI,GAAG,GAAG,IAAI,IAAI,KACpB,MAAM;CACxB,MAAM,OAAO,UAAW,IAAI,MAAM,OAAQ;CAC1C,MAAM,OAAO,IAAI,QAAQ,IAAI;CAC7B,MAAM,MAAM,KAAK,IAAI,GAAG,OAAO,GAAI;CACnC,MAAM,KAAK,eAAe,MAAM,SAAS;CACzC,OACE,oBAAC,OAAD;EACE,MAAK;EACL,SAAS,OAAO,MAAM,GAAG;EAClB;EACC;EACR,WAAW,GAAG,uDAAuD,SAAS;EAC9E,GAAI;EACJ,cAAY;EAEX,UAAA,KAAK,KAAK,GAAG,MAAM;GAClB,MAAM,IAAI,KAAK,IAAI,GAAI,KAAK,IAAI,CAAC,IAAI,OAAQ,MAAM;GACnD,MAAM,IAAI,KAAK,IAAI,OAAO,IAAI;GAC9B,OACE,oBAAC,QAAD;IAEE,kBAAgB,MAAM,MAAM,KAAA;IAC5B,GAAG,IAAI,OAAO,MAAM;IACjB;IACH,OAAO,KAAK,IAAI,GAAG,OAAO,GAAG;IAC7B,QAAQ;IACR,IAAI;IACJ,MAAM,MAAM,MAAM,KAAK,IAAI,WAAW,MAAM,MAAM,WAAW,MAAM;IAEnE,UAAA,oBAAC,SAAD,EAAA,UAAQ,GAAG,SAAS,MAAM,IAAI,IAAI,IAAI,IAAI,YAAY,CAAC,IAAW,CAAA;GAC9D,GAVC,CAUD;EAEV,CAAC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"index.js","names":["RAreaChart","RBarChart","RLineChart","RFunnelChart","RRadarChart"],"sources":["../src/i18n.tsx","../src/format.ts","../src/ChartLegend.tsx","../src/ChartTooltip.tsx","../src/states.tsx","../src/shared.tsx","../src/ChartBrush.tsx","../src/live.ts","../src/overlays.tsx","../src/cartesian-extras.tsx","../src/theme.ts","../src/AreaChart.tsx","../src/BarChart.tsx","../src/LineChart.tsx","../src/ComboChart.tsx","../src/DonutChart.tsx","../src/BarList.tsx","../src/palette.ts","../src/FunnelChart.tsx","../src/SankeyChart.tsx","../src/RadarChart.tsx","../src/Heatmap.tsx","../src/MiniBar.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from 'react';\n\n/** Strings rendered by charts; series names and number/date formatting belong to the caller. */\nexport interface ChartLabels {\n loading: string;\n empty: string;\n error: string;\n retry: string;\n zoomRange: string;\n rangeStart: string;\n rangeEnd: string;\n resetZoom: string;\n markers: string;\n threshold: string;\n /** Prefix with an `{x}` placeholder for the annotation's x value. */\n markerAt: string;\n stages: string;\n stage: string;\n conversion: string;\n dropOff: string;\n dropOffPrefix: string;\n from: string;\n to: string;\n value: string;\n barChart: string;\n lineChart: string;\n areaChart: string;\n comboChart: string;\n donutChart: string;\n pieChart: string;\n funnelChart: string;\n sankeyChart: string;\n heatmap: string;\n colourGrid: string;\n radarChart: string;\n barList: string;\n bars: string;\n}\n\nexport const en: Readonly<ChartLabels> = {\n loading: 'Loading chart',\n empty: 'No data for this period',\n error: 'The chart could not be loaded.',\n retry: 'Retry',\n zoomRange: 'Zoom range',\n rangeStart: 'Range start',\n rangeEnd: 'Range end',\n resetZoom: 'Reset zoom',\n markers: 'Chart markers',\n threshold: 'Threshold:',\n markerAt: 'Marker at {x}:',\n stages: 'Stages',\n stage: 'Stage',\n conversion: 'Conversion',\n dropOff: 'Drop-off',\n dropOffPrefix: 'drop-off ',\n from: 'From',\n to: 'To',\n value: 'Value',\n barChart: 'Bar chart',\n lineChart: 'Line chart',\n areaChart: 'Area chart',\n comboChart: 'Combo chart',\n donutChart: 'Donut chart',\n pieChart: 'Pie chart',\n funnelChart: 'Funnel chart',\n sankeyChart: 'Sankey chart',\n heatmap: 'Heatmap',\n colourGrid: 'colour grid, use the arrow keys to read cells',\n radarChart: 'Radar chart',\n barList: 'Bar list',\n bars: 'Bars',\n};\n\nexport const es: Readonly<ChartLabels> = {\n loading: 'Cargando gráfico',\n empty: 'Sin datos para este periodo',\n error: 'No se pudo cargar el gráfico.',\n retry: 'Reintentar',\n zoomRange: 'Rango de zoom',\n rangeStart: 'Inicio del rango',\n rangeEnd: 'Fin del rango',\n resetZoom: 'Restablecer zoom',\n markers: 'Marcadores del gráfico',\n threshold: 'Umbral:',\n markerAt: 'Marcador en {x}:',\n stages: 'Etapas',\n stage: 'Etapa',\n conversion: 'Conversión',\n dropOff: 'Abandono',\n dropOffPrefix: 'abandono ',\n from: 'Origen',\n to: 'Destino',\n value: 'Valor',\n barChart: 'Gráfico de barras',\n lineChart: 'Gráfico de líneas',\n areaChart: 'Gráfico de áreas',\n comboChart: 'Gráfico combinado',\n donutChart: 'Gráfico de anillo',\n pieChart: 'Gráfico circular',\n funnelChart: 'Gráfico de embudo',\n sankeyChart: 'Diagrama de Sankey',\n heatmap: 'Mapa de calor',\n colourGrid: 'cuadrícula de colores, usa las flechas para leer las celdas',\n radarChart: 'Gráfico de radar',\n barList: 'Lista de barras',\n bars: 'Barras',\n};\n\nexport const chartLabelSets = { en, es };\nconst ChartLabelsContext = createContext<Readonly<ChartLabels>>(en);\n\nexport interface ChartLocaleProviderProps {\n /** Language subtag selects en/es; unknown locales fall back to English. */\n locale?: string;\n /** Per-key overrides, after selecting the built-in language. Explicit chart props still win. */\n labels?: Partial<ChartLabels>;\n children?: ReactNode;\n}\n\n/** Strings-only locale provider for standalone charts, independent of @gntik-ai/ui. */\nexport function ChartLocaleProvider({ locale = 'en', labels, children }: ChartLocaleProviderProps) {\n const value = useMemo(() => {\n const language = locale.split(/[-_]/)[0]?.toLowerCase() ?? '';\n const builtIn = Object.hasOwn(chartLabelSets, language)\n ? chartLabelSets[language as keyof typeof chartLabelSets]\n : en;\n return { ...builtIn, ...labels };\n }, [locale, labels]);\n return <ChartLabelsContext.Provider value={value}>{children}</ChartLabelsContext.Provider>;\n}\n\n/** Active chart labels, or English outside a ChartLocaleProvider. */\nexport function useChartLabels(): Readonly<ChartLabels> {\n return useContext(ChartLabelsContext);\n}\n","/** Formats a numeric value for axes, tooltips and legends. */\nexport type ValueFormatter = (value: number) => string;\n\nconst nf = (opts?: Intl.NumberFormatOptions) => new Intl.NumberFormat('en-US', opts);\n\n/** Ready-made value formatters (en-US). */\nexport const chartFmt = {\n usd: (n: number) => '$' + nf({ maximumFractionDigits: 0 }).format(n),\n usd2: (n: number) => '$' + nf({ minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(n),\n usdCompact: (n: number) => '$' + nf({ notation: 'compact', maximumFractionDigits: 1 }).format(n),\n num: (n: number) => nf().format(n),\n compact: (n: number) => nf({ notation: 'compact', maximumFractionDigits: 1 }).format(n),\n ms: (n: number) => nf().format(n) + ' ms',\n pct: (n: number) => `${n}%`,\n /** Ratio (0–1) → percent with up to one decimal: `0.125` → `12.5%`. */\n percent: (n: number) => nf({ style: 'percent', maximumFractionDigits: 1 }).format(n),\n /** Signed ratio for deltas: `0.042` → `+4.2%`, `-0.1` → `−10%`. */\n percentDelta: (n: number) =>\n nf({ style: 'percent', maximumFractionDigits: 1, signDisplay: 'exceptZero' }).format(n).replace('-', '−'),\n /** Milliseconds → the two largest units: `850` → `850 ms`, `2400` → `2.4 s`, `3_723_000` → `1h 2m`. */\n duration: (n: number) => formatDuration(n),\n /** Seconds → like `duration`: `90` → `1m 30s`. */\n durationS: (n: number) => formatDuration(n * 1000),\n /** Bytes → decimal SI units: `1536` → `1.5 kB`, `2_000_000_000` → `2 GB`. */\n bytes: (n: number) => formatBytes(n),\n} satisfies Record<string, ValueFormatter>;\n\nfunction formatDuration(ms: number): string {\n if (!Number.isFinite(ms)) return '—';\n const sign = ms < 0 ? '−' : '';\n const a = Math.abs(ms);\n if (a < 1000) return `${sign}${nf({ maximumFractionDigits: a < 10 ? 2 : 0 }).format(a)} ms`;\n if (a < 60_000) return `${sign}${nf({ maximumFractionDigits: 1 }).format(a / 1000)} s`;\n const parts: Array<[number, string]> = [\n [86_400_000, 'd'],\n [3_600_000, 'h'],\n [60_000, 'm'],\n [1000, 's'],\n ];\n const total = Math.round(a / 1000) * 1000;\n const first = parts.findIndex(([size]) => total >= size);\n const out: string[] = [];\n let rest = total;\n for (const [size, unit] of parts.slice(first, first + 2)) {\n const q = Math.floor(rest / size);\n rest -= q * size;\n if (q > 0) out.push(`${q}${unit}`);\n }\n return sign + out.join(' ');\n}\n\nconst BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'] as const;\n\nfunction formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes)) return '—';\n const sign = bytes < 0 ? '−' : '';\n let v = Math.abs(bytes);\n let u = 0;\n while (v >= 1000 && u < BYTE_UNITS.length - 1) {\n v /= 1000;\n u += 1;\n }\n if (\n Number(nf({ maximumFractionDigits: u === 0 ? 0 : 1, useGrouping: false }).format(v)) >= 1000 &&\n u < BYTE_UNITS.length - 1\n ) {\n v /= 1000;\n u += 1;\n }\n return `${sign}${nf({ maximumFractionDigits: u === 0 ? 0 : 1 }).format(v)} ${BYTE_UNITS[u]}`;\n}\n\nexport const identity: ValueFormatter = (n) => String(n);\n\n/** Applies a formatter to whatever Recharts hands over (number, string or range). */\nexport function formatAny(value: unknown, fmt: ValueFormatter): string {\n if (typeof value === 'number') return fmt(value);\n if (Array.isArray(value)) return value.map((v) => formatAny(v, fmt)).join(' – ');\n return value == null ? '' : String(value);\n}\n\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ');\n}\n","import { useCallback, useState } from 'react';\nimport { cx } from './format';\n\nexport interface ChartLegendItem {\n key: string;\n label: string;\n /** Resolved colour (from `useChartTheme().color`). */\n color: string;\n}\n\nexport interface ChartLegendProps {\n items: readonly ChartLegendItem[];\n hidden: ReadonlySet<string>;\n onToggle: (key: string) => void;\n className?: string;\n}\n\nconst legendFocus =\n 'rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring';\n\n/** Interactive legend: each entry is a toggle button that shows/hides its series. */\nexport function ChartLegend({ items, hidden, onToggle, className }: ChartLegendProps) {\n return (\n <div className={cx('flex flex-wrap items-center gap-x-4 gap-y-1.5', className)}>\n {items.map((it) => {\n const off = hidden.has(it.key);\n return (\n <button\n key={it.key}\n type=\"button\"\n aria-pressed={!off}\n onClick={() => onToggle(it.key)}\n className={cx('group flex items-center gap-1.5 transition-opacity', off && 'opacity-40', legendFocus)}\n >\n <span\n aria-hidden\n className={cx('h-2.5 w-2.5 shrink-0 rounded-[3px]', off && 'grayscale')}\n style={{ background: it.color }}\n />\n <span\n className={cx(\n 'text-[12.5px] text-muted-foreground transition-colors',\n off ? 'line-through' : 'group-hover:text-foreground',\n )}\n >\n {it.label}\n </span>\n </button>\n );\n })}\n </div>\n );\n}\n\n/** Legend state: the set of hidden series keys plus a toggle. */\nexport function useHiddenSeries(): [ReadonlySet<string>, (key: string) => void] {\n const [hidden, setHidden] = useState<ReadonlySet<string>>(() => new Set());\n const toggle = useCallback((key: string) => {\n setHidden((s) => {\n const next = new Set(s);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }, []);\n return [hidden, toggle];\n}\n\nexport { legendFocus };\n","import type { ReactNode } from 'react';\nimport type { TooltipContentProps } from 'recharts';\nimport { formatAny, identity, type ValueFormatter } from './format';\n\n/** The subset of a Recharts tooltip payload entry the brand tooltip reads. */\nexport interface ChartTooltipEntry {\n name?: string | number;\n value?: unknown;\n color?: string;\n fill?: string;\n payload?: unknown;\n}\n\nexport interface ChartTooltipProps {\n active?: boolean;\n payload?: ReadonlyArray<ChartTooltipEntry>;\n label?: string | number;\n valueFormatter?: ValueFormatter;\n /** Per-series formatter; wins over `valueFormatter` (used by ComboChart). */\n seriesFormatter?: (value: unknown, name: string) => string;\n labelFormatter?: (label: string | number) => ReactNode;\n}\n\nfunction swatchOf(entry: ChartTooltipEntry): string | undefined {\n if (entry.color) return entry.color;\n if (entry.fill) return entry.fill;\n const inner = entry.payload;\n if (inner && typeof inner === 'object' && 'fill' in inner) {\n const fill = (inner as { fill?: unknown }).fill;\n return typeof fill === 'string' ? fill : undefined;\n }\n return undefined;\n}\n\n/** Brand tooltip card: label header + one row per series, values in mono. */\nexport function ChartTooltip({\n active,\n payload,\n label,\n valueFormatter = identity,\n seriesFormatter,\n labelFormatter,\n}: ChartTooltipProps) {\n if (!active || !payload || payload.length === 0) return null;\n const rows = payload.filter((p) => p.value != null);\n return (\n <div className=\"min-w-[150px] rounded-md border border-border bg-popover px-3 py-2.5 font-sans shadow-md\">\n {label != null && label !== '' && (\n <div className=\"mb-2 border-b border-border pb-2 text-[11px] font-medium text-muted-foreground\">\n {labelFormatter ? labelFormatter(label) : label}\n </div>\n )}\n <div className=\"flex flex-col gap-1.5\">\n {rows.map((p, i) => {\n const name = p.name == null ? '' : String(p.name);\n return (\n <div key={`${name}-${i}`} className=\"flex items-center justify-between gap-5\">\n <span className=\"flex min-w-0 items-center gap-2\">\n <span aria-hidden className=\"h-2.5 w-2.5 shrink-0 rounded-[3px]\" style={{ background: swatchOf(p) }} />\n <span className=\"truncate text-[12px] text-muted-foreground\">{name}</span>\n </span>\n <span className=\"font-mono text-[12px] font-semibold tabular-nums text-foreground\">\n {seriesFormatter ? seriesFormatter(p.value, name) : formatAny(p.value, valueFormatter)}\n </span>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\n/** Adapts Recharts 3 `<Tooltip content>` to the brand tooltip: `content={tooltipContent({ valueFormatter })}`. */\nexport function tooltipContent(options: Omit<ChartTooltipProps, 'active' | 'payload' | 'label'>) {\n return function BrandTooltipContent(p: TooltipContentProps) {\n return <ChartTooltip active={p.active} payload={p.payload} label={p.label} {...options} />;\n };\n}\n","import { useChartLabels } from './i18n';\nimport type { ReactNode } from 'react';\nimport { cx } from './format';\n\n/** Lifecycle of a chart's data. `ready` with no rows renders the empty state. */\nexport type ChartState = 'ready' | 'loading' | 'empty' | 'error';\n\n/** State props shared by every chart. */\nexport interface ChartStateProps {\n /** Data lifecycle. Default `ready` (an empty `data` array still shows the empty state). */\n state?: ChartState;\n /** Message of the empty state. */\n emptyMessage?: ReactNode;\n /** Message of the error state. */\n errorMessage?: ReactNode;\n /** Shows a \"Retry\" button in the error state. */\n onRetry?: () => void;\n /** Renders a visually hidden data table (screen-reader fallback of the plotted values). */\n dataTable?: boolean;\n}\n\nconst stateBox =\n 'flex w-full flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border px-4 text-center';\n\nexport interface ChartEmptyProps {\n height?: number;\n children?: ReactNode;\n className?: string;\n}\n\n/** Placeholder for a chart without data. */\nexport function ChartEmpty({ height = 240, children, className }: ChartEmptyProps) {\n const { empty } = useChartLabels();\n return (\n <div data-chart-state=\"empty\" className={cx(stateBox, className)} style={{ height }}>\n <svg aria-hidden viewBox=\"0 0 24 24\" className=\"h-5 w-5 fill-none stroke-muted-foreground\" strokeWidth={1.75}>\n <path d=\"M3 3v18h18\" />\n <path d=\"M7 15h2M12 11h2M17 7h2\" strokeLinecap=\"round\" />\n </svg>\n <p className=\"text-[13px] text-muted-foreground\">{children === undefined ? empty : children}</p>\n </div>\n );\n}\n\nexport interface ChartLoadingProps {\n height?: number;\n /** Accessible label of the busy region. */\n label?: string;\n className?: string;\n}\n\nconst SKELETON_BARS = [42, 64, 50, 78, 58, 88, 70, 54];\n\n/** Skeleton plot (bars over a baseline); the pulse stops under prefers-reduced-motion. */\nexport function ChartLoading({ height = 240, label: labelProp, className }: ChartLoadingProps) {\n const { loading } = useChartLabels();\n const label = labelProp ?? loading;\n return (\n <div\n role=\"status\"\n aria-label={label}\n data-chart-state=\"loading\"\n className={cx('flex w-full items-end gap-2 border-b border-border px-2', className)}\n style={{ height }}\n >\n {SKELETON_BARS.map((h, i) => (\n <div\n key={i}\n aria-hidden\n className=\"flex-1 animate-pulse rounded-t-sm bg-muted motion-reduce:animate-none\"\n style={{ height: `${h}%` }}\n />\n ))}\n <span className=\"sr-only\">{label}…</span>\n </div>\n );\n}\n\nexport interface ChartErrorProps {\n height?: number;\n children?: ReactNode;\n onRetry?: () => void;\n className?: string;\n}\n\n/** Error placeholder with an optional retry action. */\nexport function ChartError({ height = 240, children, onRetry, className }: ChartErrorProps) {\n const { error, retry } = useChartLabels();\n return (\n <div\n role=\"alert\"\n data-chart-state=\"error\"\n className={cx(stateBox, 'border-destructive/40', className)}\n style={{ height }}\n >\n <p className=\"text-[13px] text-destructive-text\">{children === undefined ? error : children}</p>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"h-8 rounded-md border border-border bg-card px-3 text-[12.5px] font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring motion-reduce:transition-none\"\n >\n {retry}\n </button>\n )}\n </div>\n );\n}\n\n/** Resolves the effective state: `ready` with no rows is `empty`. */\nexport function resolveState(state: ChartState | undefined, rows: number): ChartState {\n const s = state ?? 'ready';\n return s === 'ready' && rows === 0 ? 'empty' : s;\n}\n\n/** The placeholder for a non-ready state, or `null` when the chart should render. */\nexport function chartStateView(\n state: ChartState,\n {\n height,\n emptyMessage,\n errorMessage,\n onRetry,\n }: Pick<ChartStateProps, 'emptyMessage' | 'errorMessage' | 'onRetry'> & {\n height: number;\n },\n): ReactNode {\n if (state === 'loading') return <ChartLoading height={height} />;\n if (state === 'empty') return <ChartEmpty height={height}>{emptyMessage}</ChartEmpty>;\n if (state === 'error')\n return (\n <ChartError height={height} onRetry={onRetry}>\n {errorMessage}\n </ChartError>\n );\n return null;\n}\n\nexport interface ChartDataTableProps {\n caption: string;\n /** Column headers; the first column is the row header. */\n columns: readonly string[];\n rows: ReadonlyArray<readonly ReactNode[]>;\n /** Show the table instead of hiding it visually. */\n visible?: boolean;\n}\n\n/** Plain data table: a screen-reader fallback for a chart (visually hidden by default). */\nexport function ChartDataTable({ caption, columns, rows, visible = false }: ChartDataTableProps) {\n return (\n <table data-chart-table=\"\" className={cx(visible ? 'mt-3 w-full text-[12px]' : 'sr-only')}>\n <caption className={visible ? 'mb-1 text-left text-muted-foreground' : undefined}>{caption}</caption>\n <thead>\n <tr>\n {columns.map((c, i) => (\n <th key={i} scope=\"col\" className={visible ? 'text-left font-medium text-muted-foreground' : undefined}>\n {c}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r, i) => (\n <tr key={i}>\n {r.map((cell, j) =>\n j === 0 ? (\n <th key={j} scope=\"row\" className={visible ? 'text-left font-normal text-foreground' : undefined}>\n {cell}\n </th>\n ) : (\n <td key={j} className={visible ? 'font-mono tabular-nums text-foreground' : undefined}>\n {cell}\n </td>\n ),\n )}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n","import type { HTMLAttributes, ReactElement, ReactNode } from 'react';\nimport { ResponsiveContainer } from 'recharts';\nimport type { ChartColor, ChartTheme } from './theme';\nimport { cx, type ValueFormatter } from './format';\nimport { ChartDataTable, chartStateView, type ChartState, type ChartStateProps } from './states';\n\n/** Keys of a datum (string keys only). */\nexport type DataKey<T> = Extract<keyof T, string>;\n\n/** Props shared by every cartesian chart (Tremor-like API). */\nexport interface BaseChartProps<T extends object> extends ChartStateProps {\n data: readonly T[];\n /** Key of the x-axis (category) field. */\n index: DataKey<T>;\n /** Accessible name of the chart. Falls back to `title`, then to a generated summary. */\n 'aria-label'?: string;\n /** Title rendered inside the SVG (`<title>`), also used as accessible name fallback. */\n title?: string;\n /** Longer description rendered inside the SVG (`<desc>`). */\n description?: string;\n colors?: readonly ChartColor[];\n valueFormatter?: ValueFormatter;\n showLegend?: boolean;\n showGrid?: boolean;\n /** Plot height in px (legend excluded). */\n height?: number;\n className?: string;\n}\n\n/** Reads a field from a datum without widening the public generic. */\nexport function field<T extends object>(d: T, key: string): unknown {\n return (d as Record<string, unknown>)[key];\n}\n\nexport function numField<T extends object>(d: T, key: string): number {\n const v = field(d, key);\n return typeof v === 'number' ? v : 0;\n}\n\nexport function accessibleName(\n kind: string,\n explicit: string | undefined,\n title: string | undefined,\n series: readonly string[],\n): string {\n return explicit ?? title ?? (series.length ? `${kind}: ${series.join(', ')}` : kind);\n}\n\n/** Shared axis styling: no tick lines, no axis line, muted labels. */\nexport function axisProps(t: ChartTheme) {\n return {\n stroke: t.axis,\n tickLine: false,\n axisLine: false,\n tick: { fill: t.text, fontSize: 11 },\n } as const;\n}\n\nexport const CHART_MARGIN = { top: 6, right: 10, left: 0, bottom: 0 } as const;\n\nexport interface ChartFrameProps extends Pick<ChartStateProps, 'emptyMessage' | 'errorMessage' | 'onRetry'> {\n label: string;\n height: number;\n legend?: ReactNode;\n className?: string;\n /** Effective state (see `resolveState`). Default `ready`. */\n state?: ChartState;\n /** Data table fallback, rendered only when the chart is ready. */\n table?: ReactNode;\n /** Rendered under the plot when the chart is ready (marker list, brush). */\n footer?: ReactNode;\n /** Extra props for the figure (e.g. `useLiveSeries().pauseProps`). */\n figureProps?: HTMLAttributes<HTMLDivElement>;\n children: ReactElement;\n}\n\n/** Figure wrapper: accessible name, optional legend above, responsive plot area, state placeholders. */\nexport function ChartFrame({\n label,\n height,\n legend,\n className,\n state = 'ready',\n table,\n footer,\n figureProps,\n emptyMessage,\n errorMessage,\n onRetry,\n children,\n}: ChartFrameProps) {\n const placeholder = chartStateView(state, { height, emptyMessage, errorMessage, onRetry });\n return (\n <div\n {...figureProps}\n role=\"figure\"\n aria-label={label}\n aria-busy={state === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder ?? (\n <>\n {legend}\n <div className=\"w-full\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {children}\n </ResponsiveContainer>\n </div>\n {footer}\n {table}\n </>\n )}\n </div>\n );\n}\n\n/** Data table fallback for an index × categories dataset. */\nexport function cartesianTable<T extends object>(\n caption: string,\n data: readonly T[],\n index: string,\n categories: readonly string[],\n format: (value: unknown, key: string) => string,\n) {\n return (\n <ChartDataTable\n caption={caption}\n columns={[index, ...categories]}\n rows={data.map((d) => [String(field(d, index)), ...categories.map((c) => format(field(d, c), c))])}\n />\n );\n}\n","import { useChartLabels } from './i18n';\nimport { useRef, useState, type KeyboardEvent, type PointerEvent as ReactPointerEvent } from 'react';\nimport { cx } from './format';\nimport { legendFocus } from './ChartLegend';\n\n/** Inclusive `[start, end]` indices into the chart data. */\nexport type ChartRange = readonly [number, number];\n\n/** Clamps a range to `[0, length - 1]`, ordered, at least `minSpan` points wide when possible. */\nexport function clampRange(range: ChartRange | null | undefined, length: number, minSpan = 1): [number, number] {\n const last = Math.max(0, length - 1);\n if (!range) return [0, last];\n let start = Math.round(Math.min(range[0], range[1]));\n let end = Math.round(Math.max(range[0], range[1]));\n start = Math.min(Math.max(0, start), last);\n end = Math.min(Math.max(0, end), last);\n const span = Math.min(minSpan, last);\n if (end - start < span) {\n if (start + span <= last) end = start + span;\n else start = Math.max(0, end - span);\n }\n return [start, end];\n}\n\nexport interface UseChartRangeOptions {\n length: number;\n range?: ChartRange;\n defaultRange?: ChartRange;\n onRangeChange?: (range: ChartRange) => void;\n}\n\n/** Controlled/uncontrolled brush range; `null` inner state means \"everything\". */\nexport function useChartRange({ length, range, defaultRange, onRangeChange }: UseChartRangeOptions) {\n const [inner, setInner] = useState<ChartRange | null>(defaultRange ?? null);\n const current = clampRange(range ?? inner, length);\n const set = (next: ChartRange) => {\n const clamped = clampRange(next, length);\n setInner(clamped);\n onRangeChange?.(clamped);\n };\n return [current, set] as const;\n}\n\nexport interface ChartBrushProps {\n /** Number of data points. */\n length: number;\n range: ChartRange;\n onRangeChange: (range: ChartRange) => void;\n /** Text of the x value at an index (handles' aria-valuetext and the range summary). */\n labelOf: (index: number) => string;\n /** Values of one series, drawn as a faint overview line inside the track. */\n preview?: readonly number[];\n /** Accessible name of the brush group. */\n label?: string;\n className?: string;\n}\n\nconst thumbClass = cx(\n 'absolute top-1/2 z-10 h-7 w-3 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize touch-none rounded-sm border border-primary bg-card shadow-sm',\n 'after:absolute after:inset-y-2 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-primary',\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring',\n);\n\nfunction previewPath(values: readonly number[]): string {\n if (values.length < 2) return '';\n const min = Math.min(...values);\n const max = Math.max(...values);\n const span = max - min || 1;\n return values\n .map(\n (val, i) =>\n `${i === 0 ? 'M' : 'L'}${((i / (values.length - 1)) * 100).toFixed(2)},${(36 - ((val - min) / span) * 32).toFixed(2)}`,\n )\n .join(' ');\n}\n\n/**\n * Range brush under a time-series chart: two keyboard-accessible handles (`role=\"slider\"`,\n * Arrow keys ±1, PageUp/PageDown ±10%, Home/End) and a draggable window to pan.\n */\nexport function ChartBrush({\n length,\n range,\n onRangeChange,\n labelOf,\n preview,\n label: labelProp,\n className,\n}: ChartBrushProps) {\n const labels = useChartLabels();\n const label = labelProp ?? labels.zoomRange;\n const track = useRef<HTMLDivElement>(null);\n const drag = useRef<{ kind: 'start' | 'end' | 'window'; originIndex: number; originRange: ChartRange } | null>(null);\n const last = Math.max(1, length - 1);\n const [start, end] = range;\n const pct = (i: number) => `${(i / last) * 100}%`;\n const full = start === 0 && end === length - 1;\n const step = Math.max(1, Math.round(length / 10));\n\n const indexAt = (clientX: number) => {\n const rect = track.current?.getBoundingClientRect();\n if (!rect || rect.width === 0) return 0;\n return Math.round(((clientX - rect.left) / rect.width) * last);\n };\n const begin = (e: ReactPointerEvent<HTMLElement>) => {\n const part = e.currentTarget.dataset.brushHandle ?? 'window';\n const kind = part === 'start' || part === 'end' ? part : 'window';\n e.preventDefault();\n e.stopPropagation();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n drag.current = { kind, originIndex: indexAt(e.clientX), originRange: range };\n };\n const move = (e: ReactPointerEvent<HTMLElement>) => {\n const d = drag.current;\n if (!d) return;\n const i = indexAt(e.clientX);\n const [s0, e0] = d.originRange;\n if (d.kind === 'start') onRangeChange([Math.min(i, e0 - 1), e0]);\n else if (d.kind === 'end') onRangeChange([s0, Math.max(i, s0 + 1)]);\n else {\n const delta = Math.min(Math.max(i - d.originIndex, -s0), length - 1 - e0);\n onRangeChange([s0 + delta, e0 + delta]);\n }\n };\n const stop = () => {\n drag.current = null;\n };\n\n const onKey = (which: 'start' | 'end') => (e: KeyboardEvent<HTMLElement>) => {\n const value = which === 'start' ? start : end;\n const min = which === 'start' ? 0 : start + 1;\n const max = which === 'start' ? end - 1 : length - 1;\n let next: number | null = null;\n if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') next = value - 1;\n else if (e.key === 'ArrowRight' || e.key === 'ArrowUp') next = value + 1;\n else if (e.key === 'PageDown') next = value - step;\n else if (e.key === 'PageUp') next = value + step;\n else if (e.key === 'Home') next = min;\n else if (e.key === 'End') next = max;\n if (next == null) return;\n e.preventDefault();\n const clamped = Math.min(Math.max(next, min), max);\n onRangeChange(which === 'start' ? [clamped, end] : [start, clamped]);\n };\n\n const path = preview ? previewPath(preview) : '';\n const thumb = (which: 'start' | 'end') => {\n const value = which === 'start' ? start : end;\n return (\n <div\n role=\"slider\"\n tabIndex={0}\n aria-label={which === 'start' ? labels.rangeStart : labels.rangeEnd}\n aria-orientation=\"horizontal\"\n aria-valuemin={which === 'start' ? 0 : start + 1}\n aria-valuemax={which === 'start' ? end - 1 : length - 1}\n aria-valuenow={value}\n aria-valuetext={labelOf(value)}\n data-brush-handle={which}\n className={thumbClass}\n style={{ left: pct(value) }}\n onKeyDown={onKey(which)}\n onPointerDown={begin}\n onPointerMove={move}\n onPointerUp={stop}\n onPointerCancel={stop}\n />\n );\n };\n\n if (length < 2) return null;\n return (\n <div role=\"group\" aria-label={label} data-chart-brush=\"\" className={cx('mt-3 px-1', className)}>\n <div ref={track} className=\"relative mx-1.5 h-10 rounded-md border border-border bg-secondary/30\">\n {path && (\n <svg aria-hidden viewBox=\"0 0 100 40\" preserveAspectRatio=\"none\" className=\"absolute inset-0 h-full w-full\">\n <path\n d={path}\n fill=\"none\"\n stroke=\"hsl(var(--muted-foreground))\"\n strokeOpacity={0.6}\n strokeWidth={1}\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n )}\n <div\n aria-hidden\n data-brush-window=\"\"\n className=\"absolute inset-y-0 cursor-grab touch-none border-y border-primary/60 bg-primary/14 active:cursor-grabbing\"\n style={{ left: pct(start), width: `${((end - start) / last) * 100}%` }}\n onPointerDown={begin}\n onPointerMove={move}\n onPointerUp={stop}\n onPointerCancel={stop}\n />\n {thumb('start')}\n {thumb('end')}\n </div>\n <div className=\"mt-1.5 flex items-center justify-between gap-2 text-[11.5px] text-muted-foreground\">\n <span className=\"font-mono tabular-nums\">\n {labelOf(start)} – {labelOf(end)}\n </span>\n {!full && (\n <button\n type=\"button\"\n onClick={() => onRangeChange([0, length - 1])}\n className={cx('px-1 font-medium text-foreground underline-offset-2 hover:underline', legendFocus)}\n >\n {labels.resetZoom}\n </button>\n )}\n </div>\n </div>\n );\n}\n","import { useCallback, useMemo, useReducer, useSyncExternalStore, type FocusEvent } from 'react';\n\nconst REDUCED_QUERY = '(prefers-reduced-motion: reduce)';\n\nfunction subscribeReduced(onChange: () => void) {\n if (typeof window === 'undefined' || !window.matchMedia) return () => {};\n const mq = window.matchMedia(REDUCED_QUERY);\n mq.addEventListener?.('change', onChange);\n return () => mq.removeEventListener?.('change', onChange);\n}\nconst getReduced = () =>\n typeof window !== 'undefined' && window.matchMedia ? window.matchMedia(REDUCED_QUERY).matches : false;\n\n/** `true` when the user asks for reduced motion (false on the server). */\nexport function usePrefersReducedMotion(): boolean {\n return useSyncExternalStore(subscribeReduced, getReduced, () => false);\n}\n\nexport interface UseLiveSeriesOptions<T> {\n /** Points shown before the first `append`. */\n initial?: readonly T[];\n /** Points kept (oldest drop off). Default 60. */\n windowSize?: number;\n /** Freeze the plotted data while the pointer is over the chart or focus is inside it (default true). */\n pauseOnInteraction?: boolean;\n}\n\nexport interface LiveSeriesPauseProps {\n onPointerEnter: () => void;\n onPointerLeave: () => void;\n onFocus: () => void;\n onBlur: (e: FocusEvent<HTMLElement>) => void;\n}\n\nexport interface LiveSeries<T> {\n /** The data to plot: frozen while paused, the latest window otherwise. */\n data: readonly T[];\n /** Appends one point or several (keeps the last `windowSize`). Buffered while paused. */\n append: (points: T | readonly T[]) => void;\n /** Replaces every point. */\n reset: (points?: readonly T[]) => void;\n /** Paused by interaction (hover/focus) or by `pause()`. */\n paused: boolean;\n /** Paused with `pause()` / `togglePaused()` (a visible Pause button — WCAG 2.2.2). */\n manuallyPaused: boolean;\n pause: () => void;\n resume: () => void;\n togglePaused: () => void;\n /** Points received while paused, shown on resume. */\n pending: number;\n /** The user prefers reduced motion: render updates without animation. */\n reducedMotion: boolean;\n /** Spread on the element wrapping the chart to pause on hover and focus. */\n pauseProps: LiveSeriesPauseProps;\n}\n\ninterface LiveState<T> {\n live: T[];\n frozen: T[] | null;\n pending: number;\n hover: boolean;\n focus: boolean;\n manual: boolean;\n}\n\ntype LiveAction<T> =\n | { type: 'append'; points: readonly T[]; size: number }\n | { type: 'reset'; points: readonly T[]; size: number }\n | { type: 'flag'; flag: 'hover' | 'focus' | 'manual'; on: boolean };\n\nfunction reducer<T>(state: LiveState<T>, action: LiveAction<T>): LiveState<T> {\n const paused = state.hover || state.focus || state.manual;\n switch (action.type) {\n case 'append': {\n if (action.points.length === 0) return state;\n const live = [...state.live, ...action.points].slice(-action.size);\n return { ...state, live, pending: paused ? Math.min(action.size, state.pending + action.points.length) : 0 };\n }\n case 'reset': {\n const live = action.points.slice(-action.size);\n return { ...state, live, frozen: paused ? live : null, pending: 0 };\n }\n case 'flag': {\n if (state[action.flag] === action.on) return state;\n const next = { ...state, [action.flag]: action.on };\n const nowPaused = next.hover || next.focus || next.manual;\n if (nowPaused && !paused) return { ...next, frozen: state.live, pending: 0 };\n if (!nowPaused && paused) return { ...next, frozen: null, pending: 0 };\n return next;\n }\n }\n}\n\n/**\n * State for a live-updating chart: a sliding window of points, with updates frozen while the\n * user hovers or focuses the chart (so a tooltip or a value does not move under them) and a\n * manual pause. Render with `animate={!reducedMotion}` for smooth transitions only when the\n * user has not asked for reduced motion.\n */\nexport function useLiveSeries<T>({\n initial = [],\n windowSize = 60,\n pauseOnInteraction = true,\n}: UseLiveSeriesOptions<T> = {}): LiveSeries<T> {\n const size = Math.max(1, Math.floor(windowSize));\n const [state, dispatch] = useReducer(reducer<T>, initial, (init): LiveState<T> => ({\n live: init.slice(-size),\n frozen: null,\n pending: 0,\n hover: false,\n focus: false,\n manual: false,\n }));\n const reducedMotion = usePrefersReducedMotion();\n const append = useCallback(\n (points: T | readonly T[]) =>\n dispatch({ type: 'append', points: Array.isArray(points) ? (points as readonly T[]) : [points as T], size }),\n [size],\n );\n const reset = useCallback((points: readonly T[] = []) => dispatch({ type: 'reset', points, size }), [size]);\n const pause = useCallback(() => dispatch({ type: 'flag', flag: 'manual', on: true }), []);\n const resume = useCallback(() => dispatch({ type: 'flag', flag: 'manual', on: false }), []);\n const pauseProps = useMemo<LiveSeriesPauseProps>(\n () => ({\n onPointerEnter: () => pauseOnInteraction && dispatch({ type: 'flag', flag: 'hover', on: true }),\n onPointerLeave: () => dispatch({ type: 'flag', flag: 'hover', on: false }),\n onFocus: () => pauseOnInteraction && dispatch({ type: 'flag', flag: 'focus', on: true }),\n onBlur: (e) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n dispatch({ type: 'flag', flag: 'focus', on: false });\n },\n }),\n [pauseOnInteraction],\n );\n const paused = state.hover || state.focus || state.manual;\n return {\n data: paused && state.frozen ? state.frozen : state.live,\n append,\n reset,\n paused,\n manuallyPaused: state.manual,\n pause,\n resume,\n togglePaused: state.manual ? resume : pause,\n pending: state.pending,\n reducedMotion,\n pauseProps,\n };\n}\n","import { useChartLabels } from './i18n';\nimport { useId, useState, type ReactElement } from 'react';\nimport { ReferenceLine } from 'recharts';\nimport { cx, type ValueFormatter } from './format';\nimport { legendFocus } from './ChartLegend';\n\n/** Semantic tone of a threshold or annotation (maps to a brand token, never a raw colour). */\nexport type ChartTone = 'neutral' | 'primary' | 'success' | 'warning' | 'destructive' | 'info';\n\n/** A horizontal reference line on the value axis (an SLO, a budget, a limit). */\nexport interface ChartThreshold {\n /** Value on the value axis. */\n value: number;\n /** Visible label drawn next to the line (thresholds are never colour-only). */\n label: string;\n tone?: ChartTone;\n /** ComboChart only: the axis the value belongs to (default `left`, the bar axis). */\n axis?: 'left' | 'right';\n}\n\n/** A vertical marker at an x (category) value: a deploy, an incident, a release. */\nexport interface ChartAnnotation {\n /** Category value on the x axis (must match an `index` value of the data). */\n x: string | number;\n /** Short visible label (drawn on the marker and listed under the chart). */\n label: string;\n /** Longer text shown in the marker tooltip and read by screen readers. */\n description?: string;\n tone?: ChartTone;\n}\n\n/** Stroke token and contrast-safe text token of each tone. */\nexport const TONE_TOKENS: Record<ChartTone, { stroke: string; text: string }> = {\n neutral: { stroke: '--muted-foreground', text: '--muted-foreground' },\n primary: { stroke: '--primary', text: '--primary-text' },\n success: { stroke: '--success', text: '--success-text' },\n warning: { stroke: '--warning', text: '--warning-text' },\n destructive: { stroke: '--destructive', text: '--destructive-text' },\n info: { stroke: '--info', text: '--foreground' },\n};\n\nconst v = (token: string) => `hsl(var(${token}))`;\n/** Dash patterns: thresholds are long dashes, annotations short dots — shape, not only colour. */\nexport const THRESHOLD_DASH = '6 4';\nexport const ANNOTATION_DASH = '2 3';\n\n/** A stable key for an annotation (x + label). */\nexport const annotationKey = (a: ChartAnnotation) => `${String(a.x)}::${a.label}`;\n\ninterface Box {\n x: number;\n y: number;\n width: number;\n height: number;\n}\nfunction boxOf(props: unknown, key: 'viewBox' | 'parentViewBox' = 'viewBox'): Box | null {\n const vb = (props as Record<string, Partial<Box> | undefined> | null)?.[key];\n if (!vb || typeof vb.x !== 'number' || typeof vb.y !== 'number') return null;\n return { x: vb.x, y: vb.y, width: vb.width ?? 0, height: vb.height ?? 0 };\n}\nfunction plotRightOf(props: unknown): number | undefined {\n const parent = boxOf(props, 'parentViewBox');\n return parent ? parent.x + parent.width : undefined;\n}\n\nfunction ThresholdLabel(props: { label: string; tone: ChartTone; vertical: boolean }) {\n const { label, tone, vertical } = props;\n const box = boxOf(props);\n if (!box) return null;\n const fill = v(TONE_TOKENS[tone].text);\n if (vertical) {\n return (\n <text x={box.x + 4} y={box.y + 12} fill={fill} fontSize={11} fontWeight={500} data-chart-threshold-label=\"\">\n {label}\n </text>\n );\n }\n return (\n <text\n x={box.x + box.width - 4}\n y={box.y - 5}\n textAnchor=\"end\"\n fill={fill}\n fontSize={11}\n fontWeight={500}\n data-chart-threshold-label=\"\"\n >\n {label}\n </text>\n );\n}\n\nfunction AnnotationMarker({\n box,\n annotation,\n active,\n onActive,\n plotRight,\n}: {\n box: Box;\n plotRight?: number;\n annotation: ChartAnnotation;\n active: boolean;\n onActive: (key: string | null) => void;\n}) {\n const tone = annotation.tone ?? 'neutral';\n const key = annotationKey(annotation);\n const tip = annotation.description ? `${annotation.label}: ${annotation.description}` : annotation.label;\n const tipWidth = Math.min(240, Math.max(90, tip.length * 6.2 + 16));\n // Keep the tooltip inside the plot: flip it to the left of the marker near the right edge.\n const flip = plotRight != null && box.x + tipWidth + 12 > plotRight;\n const tipX = flip ? box.x - tipWidth - 8 : box.x + 8;\n return (\n // Pointer affordance only: keyboard and screen-reader users get the same text from the marker list.\n <g\n aria-hidden\n data-chart-annotation={key}\n data-active={active || undefined}\n onPointerEnter={() => onActive(key)}\n onPointerLeave={() => onActive(null)}\n style={{ cursor: 'default' }}\n >\n <title>{tip}</title>\n {/* Flag glyph at the top of the marker (a shape cue besides the colour). */}\n <path d={`M${box.x},${box.y} l7,4 l-7,4 z`} fill={v(TONE_TOKENS[tone].stroke)} />\n <text x={box.x + 10} y={box.y + 8} fill={v(TONE_TOKENS[tone].text)} fontSize={11} fontWeight={active ? 600 : 500}>\n {annotation.label}\n </text>\n {/* Wide invisible hit area along the line. */}\n <rect x={box.x - 6} y={box.y} width={12} height={Math.max(box.height, 1)} fill=\"transparent\" />\n {active && (\n <g data-chart-annotation-tooltip=\"\">\n <rect\n x={tipX}\n y={box.y + 14}\n width={tipWidth}\n height={24}\n rx={6}\n fill={v('--popover')}\n stroke={v('--border')}\n />\n <text x={tipX + 8} y={box.y + 30} fill={v('--popover-foreground')} fontSize={11.5}>\n {tip}\n </text>\n </g>\n )}\n </g>\n );\n}\n\n/** Recharts clones a label element with the line's `viewBox` (and the plot's `parentViewBox`). */\nfunction AnnotationLabel(props: {\n annotation: ChartAnnotation;\n active: boolean;\n onActive: (key: string | null) => void;\n}) {\n const box = boxOf(props);\n if (!box) return null;\n return (\n <AnnotationMarker\n box={box}\n plotRight={plotRightOf(props)}\n annotation={props.annotation}\n active={props.active}\n onActive={props.onActive}\n />\n );\n}\n\nexport interface ReferenceElementsOptions {\n thresholds?: readonly ChartThreshold[];\n annotations?: readonly ChartAnnotation[];\n /** Bar charts with `layout=\"vertical\"` swap the axes (value on x, categories on y). */\n vertical?: boolean;\n /** Category values currently plotted (annotations outside are skipped). */\n categories: ReadonlySet<string>;\n activeAnnotation: string | null;\n onActiveAnnotation: (key: string | null) => void;\n /** ComboChart: map a threshold axis to the Recharts yAxisId. */\n yAxisIdOf?: (axis: 'left' | 'right') => string;\n}\n\n/**\n * Recharts `<ReferenceLine>` elements for thresholds and annotations. Returned as an array so\n * they are direct children of the chart.\n */\nexport function referenceElements({\n thresholds = [],\n annotations = [],\n vertical = false,\n categories,\n activeAnnotation,\n onActiveAnnotation,\n yAxisIdOf,\n}: ReferenceElementsOptions): ReactElement[] {\n const out: ReactElement[] = [];\n thresholds.forEach((th, i) => {\n const tone = th.tone ?? 'neutral';\n const pos = vertical ? { x: th.value } : { y: th.value };\n out.push(\n <ReferenceLine\n key={`threshold-${i}`}\n {...pos}\n {...(yAxisIdOf ? { yAxisId: yAxisIdOf(th.axis ?? 'left') } : {})}\n stroke={v(TONE_TOKENS[tone].stroke)}\n strokeWidth={1.5}\n strokeDasharray={THRESHOLD_DASH}\n ifOverflow=\"extendDomain\"\n label={<ThresholdLabel label={th.label} tone={tone} vertical={vertical} />}\n />,\n );\n });\n annotations.forEach((a) => {\n if (!categories.has(String(a.x))) return;\n const key = annotationKey(a);\n const active = activeAnnotation === key;\n const pos = vertical ? { y: a.x } : { x: a.x };\n out.push(\n <ReferenceLine\n key={`annotation-${key}`}\n {...pos}\n {...(yAxisIdOf ? { yAxisId: yAxisIdOf('left') } : {})}\n stroke={v(TONE_TOKENS[a.tone ?? 'neutral'].stroke)}\n strokeWidth={active ? 2 : 1.5}\n strokeDasharray={ANNOTATION_DASH}\n label={<AnnotationLabel annotation={a} active={active} onActive={onActiveAnnotation} />}\n />,\n );\n });\n return out;\n}\n\nexport interface ChartMarkersProps {\n thresholds?: readonly ChartThreshold[];\n annotations?: readonly ChartAnnotation[];\n /** Formats threshold values (the chart's value formatter). */\n valueFormatter?: ValueFormatter;\n /** Key of the annotation highlighted in the plot. */\n active?: string | null;\n onActiveChange?: (key: string | null) => void;\n className?: string;\n}\n\n/**\n * Text list of the thresholds and annotations under a chart: the keyboard and screen-reader\n * route to the same information as the in-plot markers. Focusing or hovering an annotation\n * highlights its marker and opens its tooltip in the plot.\n */\nexport function ChartMarkers({\n thresholds = [],\n annotations = [],\n valueFormatter,\n active = null,\n onActiveChange,\n className,\n}: ChartMarkersProps) {\n const labels = useChartLabels();\n const id = useId();\n if (thresholds.length === 0 && annotations.length === 0) return null;\n const fmt = (n: number) => (valueFormatter ? valueFormatter(n) : String(n));\n return (\n <ul\n aria-label={labels.markers}\n className={cx(\n 'mt-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 px-1 text-[12px] text-muted-foreground',\n className,\n )}\n >\n {thresholds.map((th, i) => (\n <li key={`t-${i}`} className=\"flex items-center gap-1.5\" data-chart-marker=\"threshold\">\n <svg aria-hidden width=\"18\" height=\"4\" className=\"shrink-0\">\n <line\n x1=\"0\"\n y1=\"2\"\n x2=\"18\"\n y2=\"2\"\n stroke={v(TONE_TOKENS[th.tone ?? 'neutral'].stroke)}\n strokeWidth={1.5}\n strokeDasharray={THRESHOLD_DASH}\n />\n </svg>\n <span>\n <span className=\"sr-only\">{labels.threshold}</span> {th.label}{' '}\n <span className=\"font-mono tabular-nums\">({fmt(th.value)})</span>\n </span>\n </li>\n ))}\n {annotations.map((a) => {\n const key = annotationKey(a);\n const descId = `${id}-${key}`;\n return (\n <li key={key} data-chart-marker=\"annotation\">\n <button\n type=\"button\"\n aria-describedby={a.description ? descId : undefined}\n onFocus={() => onActiveChange?.(key)}\n onBlur={() => onActiveChange?.(null)}\n onPointerEnter={() => onActiveChange?.(key)}\n onPointerLeave={() => onActiveChange?.(null)}\n onKeyDown={(e) => {\n if (e.key === 'Escape') onActiveChange?.(null);\n }}\n className={cx(\n 'flex items-center gap-1.5 hover:text-foreground',\n active === key && 'text-foreground',\n legendFocus,\n )}\n >\n <svg aria-hidden width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" className=\"shrink-0\">\n <path d=\"M1,1 l8,4 l-8,4 z\" fill={v(TONE_TOKENS[a.tone ?? 'neutral'].stroke)} />\n </svg>\n <span>\n <span className=\"sr-only\">{labels.markerAt.replace('{x}', String(a.x))}</span> {a.label}\n </span>\n </button>\n {a.description && (\n <span id={descId} className=\"sr-only\">\n {a.description}\n </span>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\n/** State of the highlighted annotation (shared by the plot markers and the marker list). */\nexport function useActiveAnnotation() {\n return useState<string | null>(null);\n}\n","import type { ReactElement, ReactNode } from 'react';\nimport { ChartBrush, useChartRange, type ChartRange } from './ChartBrush';\nimport type { ValueFormatter } from './format';\nimport { usePrefersReducedMotion } from './live';\nimport {\n annotationKey,\n ChartMarkers,\n referenceElements,\n useActiveAnnotation,\n type ChartAnnotation,\n type ChartThreshold,\n} from './overlays';\nimport { field, numField } from './shared';\n\n/** Thresholds, annotations, brush zoom and animation: shared by Line, Area, Bar and Combo charts. */\nexport interface CartesianExtrasProps {\n /** Horizontal reference lines on the value axis, each with a visible label and a tone. */\n thresholds?: readonly ChartThreshold[];\n /** Vertical markers at x values (deploys, incidents), with a label and a tooltip. */\n annotations?: readonly ChartAnnotation[];\n /** Shows a range brush under the plot to zoom into part of the series. */\n brush?: boolean;\n /** Controlled brush range: inclusive `[start, end]` indices into `data`. */\n range?: ChartRange;\n /** Initial brush range (uncontrolled). Default: every point. */\n defaultRange?: ChartRange;\n onRangeChange?: (range: ChartRange) => void;\n /** Animate data changes (e.g. a live series). Always off under prefers-reduced-motion. Default false. */\n animate?: boolean;\n}\n\nexport interface CartesianExtrasOptions {\n valueFormatter?: ValueFormatter;\n /** Series drawn in the brush overview. */\n previewKey?: string;\n /** Bar charts with `layout=\"vertical\"`. */\n vertical?: boolean;\n /** ComboChart: Recharts yAxisId for a threshold axis. */\n yAxisIdOf?: (axis: 'left' | 'right') => string;\n}\n\nexport interface CartesianExtras<T> {\n /** The data to plot (the brushed slice when `brush` is on). */\n view: readonly T[];\n /** `<ReferenceLine>` children for thresholds and annotations. */\n references: ReactElement[];\n /** Marker list and brush, rendered under the plot. */\n footer: ReactNode;\n /** Spread on Recharts series: animation only when asked for and motion is allowed. */\n animation: { isAnimationActive: boolean; animationDuration: number };\n}\n\nexport function useCartesianExtras<T extends object>(\n data: readonly T[],\n index: string,\n {\n thresholds = [],\n annotations = [],\n brush = false,\n range,\n defaultRange,\n onRangeChange,\n animate = false,\n }: CartesianExtrasProps,\n { valueFormatter, previewKey, vertical = false, yAxisIdOf }: CartesianExtrasOptions = {},\n): CartesianExtras<T> {\n const [current, setRange] = useChartRange({ length: data.length, range, defaultRange, onRangeChange });\n const [active, setActive] = useActiveAnnotation();\n const reduced = usePrefersReducedMotion();\n const view = brush ? data.slice(current[0], current[1] + 1) : data;\n const categories = new Set(view.map((d) => String(field(d, index))));\n const shown = annotations.filter((a) => categories.has(String(a.x)));\n const references = referenceElements({\n thresholds,\n annotations: shown,\n vertical,\n categories,\n activeAnnotation: active,\n onActiveAnnotation: setActive,\n yAxisIdOf,\n });\n const labelOf = (i: number) => {\n const d = data[i];\n return d ? String(field(d, index)) : '';\n };\n const footer = (\n <>\n <ChartMarkers\n thresholds={thresholds}\n annotations={shown}\n valueFormatter={valueFormatter}\n active={active && shown.some((a) => annotationKey(a) === active) ? active : null}\n onActiveChange={setActive}\n />\n {brush && (\n <ChartBrush\n length={data.length}\n range={current}\n onRangeChange={setRange}\n labelOf={labelOf}\n preview={previewKey ? data.map((d) => numField(d, previewKey)) : undefined}\n />\n )}\n </>\n );\n return { view, references, footer, animation: { isAnimationActive: animate && !reduced, animationDuration: 300 } };\n}\n","import { useSyncExternalStore } from 'react';\nimport { currentTheme, observeTheme, tokenColor, type Theme } from '@gntik-ai/tokens/runtime';\n\n/** Series colour name → brand token. Green primary is the hero; the rest are categorical accents. */\nexport const SERIES_TOKENS = {\n primary: '--primary',\n emerald: '--brand-accent',\n violet: '--category-violet',\n cyan: '--category-cyan',\n amber: '--category-amber',\n rose: '--category-rose',\n info: '--info',\n} as const;\n\nexport type ChartColor = keyof typeof SERIES_TOKENS;\n\n/**\n * Default series order: primary first, then the categorical accents ordered so every adjacent\n * pair differs in luminance by ≥ 1.5:1 in all three themes (see `palette.ts`).\n */\nexport const CHART_COLORS: readonly ChartColor[] = ['primary', 'violet', 'cyan', 'rose', 'amber'];\n\nexport interface ChartTheme {\n /** Active theme (\"dark\" | \"light\" | \"high_contrast\"); \"dark\" on the server and during hydration. */\n theme: Theme;\n grid: string;\n axis: string;\n text: string;\n /** Line/area hover cursor. */\n cursor: string;\n /** Bar hover band. */\n barCursor: string;\n /** Card surface (donut slice separators). */\n surface: string;\n /** Colour for a series name, with optional alpha (0–1). */\n color: (name: ChartColor, alpha?: number) => string;\n}\n\ntype ColorFn = (token: string, alpha?: number) => string;\n\n/** `hsl(var(--token))`: resolved by the browser (SVG fill/stroke and inline styles), so it is SSR-safe and follows theme switches. */\nconst cssVarColor: ColorFn = (token, alpha) => (alpha == null ? `hsl(var(${token}))` : `hsl(var(${token}) / ${alpha})`);\n\nfunction buildTheme(theme: Theme, c: ColorFn): ChartTheme {\n return {\n theme,\n grid: c('--border'),\n axis: c('--muted-foreground', 0.5),\n text: c('--muted-foreground'),\n cursor: c('--muted-foreground', 0.32),\n barCursor: c('--secondary', 0.55),\n surface: c('--card'),\n color: (name, alpha) => c(SERIES_TOKENS[name] ?? SERIES_TOKENS.primary, alpha),\n };\n}\n\n// Snapshots are cached so useSyncExternalStore gets a stable object between theme changes.\nconst varThemes = new Map<Theme, ChartTheme>();\nlet resolvedSnapshot: ChartTheme | null = null;\n\nfunction varTheme(theme: Theme): ChartTheme {\n let t = varThemes.get(theme);\n if (!t) {\n t = buildTheme(theme, cssVarColor);\n varThemes.set(theme, t);\n }\n return t;\n}\n\nfunction subscribe(onChange: () => void) {\n // Invalidate the resolved snapshot on every class change, even when the theme name stays the same.\n return observeTheme(() => {\n resolvedSnapshot = null;\n onChange();\n });\n}\n\nconst SERVER_THEME = varTheme('dark');\nconst getServerSnapshot = () => SERVER_THEME;\nconst getVarSnapshot = () => varTheme(currentTheme());\nfunction getResolvedSnapshot() {\n const theme = currentTheme();\n if (!resolvedSnapshot || resolvedSnapshot.theme !== theme)\n resolvedSnapshot = buildTheme(theme, (token, alpha) => tokenColor(token, alpha));\n return resolvedSnapshot;\n}\n\nexport interface UseChartThemeOptions {\n /**\n * Resolve the tokens to concrete `hsl(h s% l%)` strings (read from the DOM after hydration),\n * for consumers that cannot use `var()` (canvas, colour maths). Default: `hsl(var(--token))`.\n */\n resolved?: boolean;\n}\n\n/**\n * Brand colours for Recharts. By default every colour is a `hsl(var(--token))` string: SVG\n * fill/stroke attributes and inline styles resolve it, so server and client render the same\n * markup and a theme switch re-skins the chart without re-rendering. `theme` follows the\n * <html> class after mount. With `{ resolved: true }` colours are read from the live CSS\n * variables once mounted (the server and hydration render use the `var()` strings).\n */\nexport function useChartTheme({ resolved = false }: UseChartThemeOptions = {}): ChartTheme {\n return useSyncExternalStore(subscribe, resolved ? getResolvedSnapshot : getVarSnapshot, getServerSnapshot);\n}\n\n/** Colour for the i-th series, cycling through `colors`. */\nexport function seriesColor(t: ChartTheme, colors: readonly ChartColor[], i: number): string {\n const name = colors.length ? colors[i % colors.length] : undefined;\n return t.color(name ?? 'primary');\n}\n","import { useChartLabels } from './i18n';\nimport { Area, AreaChart as RAreaChart, CartesianGrid, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport {\n accessibleName,\n cartesianTable,\n axisProps,\n CHART_MARGIN,\n ChartFrame,\n type BaseChartProps,\n type DataKey,\n} from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { CHART_COLORS, seriesColor, useChartTheme } from './theme';\n\nexport interface AreaChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {\n categories: ReadonlyArray<DataKey<T>>;\n stacked?: boolean;\n showYAxis?: boolean;\n curve?: 'monotone' | 'linear' | 'step' | 'natural';\n}\n\n/** Area chart: flat fills (no gradient), no entry animation, interactive legend. */\nexport function AreaChart<T extends object>({\n data,\n index,\n categories,\n colors = CHART_COLORS,\n valueFormatter = identity,\n stacked = false,\n showLegend = true,\n showGrid = true,\n showYAxis = true,\n curve = 'monotone',\n height = 288,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: AreaChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter, previewKey: categories[0] },\n );\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({ key: c, label: c, color: col(i) }));\n const labels = useChartLabels();\n const name = accessibleName(labels.areaChart, ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n footer={x.footer}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <RAreaChart data={x.view} margin={CHART_MARGIN} accessibilityLayer title={title} desc={description}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={false} />}\n <XAxis dataKey={index} {...axisProps(t)} dy={8} minTickGap={20} />\n {showYAxis && <YAxis {...axisProps(t)} width={50} tickFormatter={valueFormatter} />}\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ stroke: t.cursor, strokeWidth: 1 }}\n content={tooltipContent({ valueFormatter })}\n />\n {categories.map((c, i) => (\n <Area\n key={c}\n type={curve}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stackId={stacked ? '1' : undefined}\n stroke={col(i)}\n strokeWidth={2}\n fill={col(i)}\n fillOpacity={stacked ? 0.82 : 0.14}\n dot={false}\n activeDot={{ r: 3.5, strokeWidth: 0 }}\n {...x.animation}\n />\n ))}\n </RAreaChart>\n </ChartFrame>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { Bar, BarChart as RBarChart, CartesianGrid, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport {\n accessibleName,\n cartesianTable,\n axisProps,\n CHART_MARGIN,\n ChartFrame,\n type BaseChartProps,\n type DataKey,\n} from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { CHART_COLORS, seriesColor, useChartTheme } from './theme';\n\nexport interface BarChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {\n categories: ReadonlyArray<DataKey<T>>;\n stacked?: boolean;\n /** \"horizontal\" = vertical bars (categories on X); \"vertical\" = horizontal bars (categories on Y). */\n layout?: 'horizontal' | 'vertical';\n showYAxis?: boolean;\n}\n\ntype Radius = number | [number, number, number, number];\n\n/** Bar chart: vertical, horizontal or stacked; flat fills, no animation. */\nexport function BarChart<T extends object>({\n data,\n index,\n categories,\n colors = CHART_COLORS,\n valueFormatter = identity,\n stacked = false,\n layout = 'horizontal',\n showLegend = true,\n showGrid = true,\n showYAxis = true,\n height = 288,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: BarChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({ key: c, label: c, color: col(i) }));\n const vertical = layout === 'vertical';\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter, previewKey: categories[0], vertical },\n );\n const radius: Radius = stacked ? 0 : vertical ? [0, 3, 3, 0] : [3, 3, 0, 0];\n const labels = useChartLabels();\n const name = accessibleName(labels.barChart, ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n footer={x.footer}\n legend={\n showLegend &&\n categories.length > 1 && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />\n }\n >\n <RBarChart\n data={x.view}\n layout={layout}\n margin={CHART_MARGIN}\n barCategoryGap={vertical ? '22%' : '28%'}\n accessibilityLayer\n title={title}\n desc={description}\n >\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={vertical} horizontal={!vertical} />}\n {vertical ? (\n <>\n <XAxis type=\"number\" {...axisProps(t)} tickFormatter={valueFormatter} />\n <YAxis type=\"category\" dataKey={index} {...axisProps(t)} width={92} />\n </>\n ) : (\n <>\n <XAxis dataKey={index} {...axisProps(t)} dy={8} minTickGap={16} />\n {showYAxis && <YAxis {...axisProps(t)} width={50} tickFormatter={valueFormatter} />}\n </>\n )}\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ fill: t.barCursor }}\n content={tooltipContent({ valueFormatter })}\n />\n {categories.map((c, i) => (\n <Bar\n key={c}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stackId={stacked ? '1' : undefined}\n fill={col(i)}\n radius={radius}\n maxBarSize={vertical ? 22 : 46}\n {...x.animation}\n />\n ))}\n </RBarChart>\n </ChartFrame>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { CartesianGrid, Line, LineChart as RLineChart, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport {\n accessibleName,\n cartesianTable,\n axisProps,\n CHART_MARGIN,\n ChartFrame,\n field,\n type BaseChartProps,\n type DataKey,\n} from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { CHART_COLORS, seriesColor, useChartTheme } from './theme';\n\nexport interface LineChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {\n categories: ReadonlyArray<DataKey<T>>;\n showYAxis?: boolean;\n /** Only label the first and last x ticks. */\n startEndOnly?: boolean;\n curve?: 'monotone' | 'linear' | 'step' | 'natural';\n}\n\ntype Tick = string | number;\nconst asTick = (v: unknown): Tick => (typeof v === 'number' ? v : String(v));\n\n/** Line chart: 2px strokes, no dots until hover, no animation. */\nexport function LineChart<T extends object>({\n data,\n index,\n categories,\n colors = CHART_COLORS,\n valueFormatter = identity,\n showLegend = true,\n showGrid = true,\n showYAxis = true,\n startEndOnly = false,\n curve = 'monotone',\n height = 288,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: LineChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter, previewKey: categories[0] },\n );\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({ key: c, label: c, color: col(i) }));\n const first = x.view[0];\n const last = x.view[x.view.length - 1];\n const xTicks: Tick[] | undefined =\n startEndOnly && first && last ? [asTick(field(first, index)), asTick(field(last, index))] : undefined;\n const labels = useChartLabels();\n const name = accessibleName(labels.lineChart, ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n footer={x.footer}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <RLineChart data={x.view} margin={CHART_MARGIN} accessibilityLayer title={title} desc={description}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={false} />}\n <XAxis\n dataKey={index}\n {...axisProps(t)}\n dy={8}\n minTickGap={startEndOnly ? 0 : 20}\n ticks={xTicks}\n interval={startEndOnly ? 'preserveStartEnd' : undefined}\n />\n {showYAxis && <YAxis {...axisProps(t)} width={50} tickFormatter={valueFormatter} />}\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ stroke: t.cursor, strokeWidth: 1 }}\n content={tooltipContent({ valueFormatter })}\n />\n {categories.map((c, i) => (\n <Line\n key={c}\n type={curve}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stroke={col(i)}\n strokeWidth={2}\n dot={false}\n activeDot={{ r: 3.5, strokeWidth: 0 }}\n {...x.animation}\n />\n ))}\n </RLineChart>\n </ChartFrame>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { Bar, CartesianGrid, ComposedChart, Line, Tooltip, XAxis, YAxis } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity, type ValueFormatter } from './format';\nimport { accessibleName, cartesianTable, axisProps, ChartFrame, type BaseChartProps, type DataKey } from './shared';\nimport { resolveState } from './states';\nimport { useCartesianExtras, type CartesianExtrasProps } from './cartesian-extras';\nimport { useChartTheme, type ChartColor } from './theme';\n\nexport interface ComboChartProps<T extends object>\n extends CartesianExtrasProps, Omit<BaseChartProps<T>, 'colors' | 'valueFormatter'> {\n /** Series drawn as bars on the left axis. */\n barSeries: DataKey<T>;\n /** Series drawn as a line on the right axis. */\n lineSeries: DataKey<T>;\n barColor?: ChartColor;\n lineColor?: ChartColor;\n barFormatter?: ValueFormatter;\n lineFormatter?: ValueFormatter;\n}\n\n/** Combo chart: bars on the left axis, a line on the right axis. */\nexport function ComboChart<T extends object>({\n data,\n index,\n barSeries,\n lineSeries,\n barColor = 'primary',\n lineColor = 'amber',\n barFormatter = identity,\n lineFormatter = identity,\n showLegend = true,\n showGrid = true,\n height = 300,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n thresholds,\n annotations,\n brush,\n range,\n defaultRange,\n onRangeChange,\n animate,\n}: ComboChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const x = useCartesianExtras(\n data,\n index,\n { thresholds, annotations, brush, range, defaultRange, onRangeChange, animate },\n { valueFormatter: barFormatter, previewKey: barSeries, yAxisIdOf: (axis) => axis },\n );\n const bc = t.color(barColor);\n const lc = t.color(lineColor);\n const legend = [\n { key: barSeries, label: barSeries, color: bc },\n { key: lineSeries, label: lineSeries, color: lc },\n ];\n const fmtSeries = (v: unknown, name: string) => formatAny(v, name === lineSeries ? lineFormatter : barFormatter);\n const labels = useChartLabels();\n const name = accessibleName(labels.comboChart, ariaLabel, title, [barSeries, lineSeries]);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, x.view, index, [barSeries, lineSeries], fmtSeries)}\n height={height}\n className={className}\n footer={x.footer}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <ComposedChart\n data={x.view}\n margin={{ top: 6, right: 6, left: 0, bottom: 0 }}\n barCategoryGap=\"30%\"\n accessibilityLayer\n title={title}\n desc={description}\n >\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" stroke={t.grid} vertical={false} />}\n <XAxis dataKey={index} {...axisProps(t)} dy={8} minTickGap={16} />\n <YAxis yAxisId=\"left\" {...axisProps(t)} width={48} tickFormatter={barFormatter} />\n <YAxis yAxisId=\"right\" orientation=\"right\" {...axisProps(t)} width={48} tickFormatter={lineFormatter} />\n {x.references}\n <Tooltip\n isAnimationActive={false}\n cursor={{ fill: t.barCursor }}\n content={tooltipContent({ seriesFormatter: fmtSeries })}\n />\n <Bar\n yAxisId=\"left\"\n dataKey={barSeries}\n name={barSeries}\n hide={hidden.has(barSeries)}\n fill={bc}\n radius={[3, 3, 0, 0]}\n maxBarSize={42}\n {...x.animation}\n />\n <Line\n yAxisId=\"right\"\n type=\"monotone\"\n dataKey={lineSeries}\n name={lineSeries}\n hide={hidden.has(lineSeries)}\n stroke={lc}\n strokeWidth={2}\n dot={false}\n activeDot={{ r: 3.5, strokeWidth: 0 }}\n {...x.animation}\n />\n </ComposedChart>\n </ChartFrame>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { Pie, PieChart, ResponsiveContainer, Tooltip } from 'recharts';\nimport { useHiddenSeries, legendFocus } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { cx, identity, type ValueFormatter } from './format';\nimport { accessibleName, field, numField, type DataKey } from './shared';\nimport { ChartDataTable, chartStateView, resolveState, type ChartStateProps } from './states';\nimport { CHART_COLORS, seriesColor, useChartTheme, type ChartColor } from './theme';\n\nexport interface DonutChartProps<T extends object> extends ChartStateProps {\n data: readonly T[];\n /** Key of the slice name field. */\n index: DataKey<T>;\n /** Key of the slice value field. */\n category: DataKey<T>;\n colors?: readonly ChartColor[];\n valueFormatter?: ValueFormatter;\n variant?: 'donut' | 'pie';\n showLegend?: boolean;\n /** Caption under the total in the donut hole (donut variant only). */\n centerLabel?: string;\n /** Diameter in px. */\n height?: number;\n 'aria-label'?: string;\n title?: string;\n description?: string;\n className?: string;\n}\n\ninterface Slice {\n name: string;\n value: number;\n fill: string;\n}\n\n/** Donut / pie with a clickable value legend; hidden slices drop out of the total. */\nexport function DonutChart<T extends object>({\n data,\n index,\n category,\n colors = CHART_COLORS,\n valueFormatter = identity,\n variant = 'donut',\n showLegend = true,\n centerLabel,\n height = 264,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: DonutChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n // Per-slice `fill` on the datum replaces the deprecated <Cell> of Recharts 2.\n const slices: Slice[] = data.map((d, i) => ({\n name: String(field(d, index)),\n value: numField(d, category),\n fill: seriesColor(t, colors, i),\n }));\n const shown = slices.filter((s) => !hidden.has(s.name));\n const total = shown.reduce((sum, s) => sum + s.value, 0);\n const isDonut = variant === 'donut';\n const labels = useChartLabels();\n const name = accessibleName(\n isDonut ? labels.donutChart : labels.pieChart,\n ariaLabel,\n title,\n slices.map((s) => s.name),\n );\n const effective = resolveState(state, slices.length);\n const placeholder = chartStateView(effective, { height, emptyMessage, errorMessage, onRetry });\n if (placeholder)\n return (\n <div\n role=\"figure\"\n aria-label={name}\n aria-busy={effective === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder}\n </div>\n );\n return (\n <div\n role=\"figure\"\n aria-label={name}\n className={cx('flex flex-col items-center gap-6 font-sans sm:flex-row', className)}\n >\n <div className=\"relative shrink-0\" style={{ width: height, height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <PieChart accessibilityLayer title={title} desc={description}>\n <Pie\n data={shown}\n dataKey=\"value\"\n nameKey=\"name\"\n cx=\"50%\"\n cy=\"50%\"\n innerRadius={isDonut ? '64%' : 0}\n outerRadius=\"94%\"\n paddingAngle={shown.length > 1 ? 1.5 : 0}\n stroke={t.surface}\n strokeWidth={2}\n isAnimationActive={false}\n />\n <Tooltip isAnimationActive={false} content={tooltipContent({ valueFormatter })} />\n </PieChart>\n </ResponsiveContainer>\n {isDonut && centerLabel && (\n <div className=\"pointer-events-none absolute inset-0 flex flex-col items-center justify-center\">\n <div className=\"font-mono text-[20px] font-semibold tabular-nums text-foreground\">\n {valueFormatter(total)}\n </div>\n <div className=\"mt-0.5 text-[11px] text-muted-foreground\">{centerLabel}</div>\n </div>\n )}\n </div>\n {showLegend && (\n <div className=\"flex w-full min-w-0 flex-1 flex-col gap-2\">\n {slices.map((s) => {\n const off = hidden.has(s.name);\n return (\n <button\n key={s.name}\n type=\"button\"\n aria-pressed={!off}\n onClick={() => toggle(s.name)}\n className={cx('group flex items-center justify-between gap-3', off && 'opacity-40', legendFocus)}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <span\n aria-hidden\n className={cx('h-2.5 w-2.5 shrink-0 rounded-[3px]', off && 'grayscale')}\n style={{ background: s.fill }}\n />\n <span\n className={cx(\n 'truncate text-[12.5px] text-muted-foreground',\n off ? 'line-through' : 'transition-colors group-hover:text-foreground',\n )}\n >\n {s.name}\n </span>\n </span>\n <span className=\"shrink-0 font-mono text-[12px] font-medium tabular-nums text-foreground\">\n {valueFormatter(s.value)}\n </span>\n </button>\n );\n })}\n </div>\n )}\n {dataTable && (\n <ChartDataTable\n caption={name}\n columns={[index, category]}\n rows={slices.map((sl) => [sl.name, valueFormatter(sl.value)])}\n />\n )}\n </div>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { cx, identity, type ValueFormatter } from './format';\nimport { chartStateView, resolveState, type ChartStateProps } from './states';\nimport { field, numField, type DataKey } from './shared';\n\nconst BAR_LIST_BG = {\n primary: 'bg-primary/20',\n violet: 'bg-category-violet/20',\n cyan: 'bg-category-cyan/20',\n amber: 'bg-category-amber/20',\n rose: 'bg-category-rose/20',\n} as const;\n\nexport interface BarListProps<T extends object> extends Omit<ChartStateProps, 'dataTable'> {\n data: readonly T[];\n index: DataKey<T>;\n category: DataKey<T>;\n valueFormatter?: ValueFormatter;\n color?: keyof typeof BAR_LIST_BG;\n sortOrder?: 'desc' | 'asc' | 'none';\n 'aria-label'?: string;\n className?: string;\n}\n\n/** Axis-less ranked list: label inside a token-tinted bar, value on the right. */\nexport function BarList<T extends object>({\n data,\n index,\n category,\n valueFormatter = identity,\n color = 'primary',\n sortOrder = 'desc',\n className,\n 'aria-label': ariaLabelProp,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n}: BarListProps<T>) {\n const labels = useChartLabels();\n const ariaLabel = ariaLabelProp ?? labels.barList;\n const effective = resolveState(state, data.length);\n const placeholder = chartStateView(effective, { height: 160, emptyMessage, errorMessage, onRetry });\n if (placeholder)\n return (\n <div\n role=\"figure\"\n aria-label={ariaLabel}\n aria-busy={effective === 'loading' || undefined}\n className={cx('font-sans', className)}\n >\n {placeholder}\n </div>\n );\n const rows = data.slice();\n if (sortOrder === 'desc') rows.sort((a, b) => numField(b, category) - numField(a, category));\n else if (sortOrder === 'asc') rows.sort((a, b) => numField(a, category) - numField(b, category));\n const max = Math.max(...rows.map((d) => numField(d, category)), 1);\n return (\n <ul aria-label={ariaLabel} className={cx('flex flex-col gap-2 font-sans', className)}>\n {rows.map((r, i) => {\n const value = numField(r, category);\n const pct = Math.max((value / max) * 100, 1.5);\n return (\n <li key={i} className=\"flex items-center gap-3\">\n <div className=\"relative h-9 min-w-0 flex-1\">\n <div\n aria-hidden\n className={cx('absolute inset-y-0 left-0 rounded-md', BAR_LIST_BG[color])}\n style={{ width: `${pct}%` }}\n />\n <div className=\"relative z-10 flex h-full items-center px-2.5\">\n <span className=\"truncate text-[13px] text-foreground\">{String(field(r, index))}</span>\n </div>\n </div>\n <span className=\"w-16 shrink-0 text-right font-mono text-[13px] tabular-nums text-foreground\">\n {valueFormatter(value)}\n </span>\n </li>\n );\n })}\n </ul>\n );\n}\n","import { CHART_COLORS, SERIES_TOKENS, type ChartColor } from './theme';\n\n/**\n * Data-viz palette built ONLY from the frozen brand tokens.\n *\n * Categorical: `SAFE_CHART_COLORS` orders the five accents so that every adjacent pair differs\n * in relative luminance by at least 1.5:1 in dark, light and high_contrast (asserted by\n * `palette.test.ts` against `@gntik-ai/tokens/brand.css`). It is the default `CHART_COLORS`\n * order of every chart; this name is kept as an alias.\n *\n * Colour-blind safety: hue alone is never the only channel. Charts pair colour with position,\n * labels or the legend text; use at most five categorical series, prefer a sequential ramp\n * (one hue, varying lightness) for ordered data, and a diverging ramp (destructive ↔ muted ↔\n * primary, i.e. red ↔ green, which deutan/protan viewers confuse) only together with value\n * labels, a signed legend or the `dataTable` fallback — lightness still separates the ends.\n */\nexport const SAFE_CHART_COLORS: readonly ChartColor[] = CHART_COLORS;\n\n/** A CSS custom property name of a brand token (`--primary`, `--destructive`…). */\nexport type TokenName = `--${string}`;\n\nexport interface SequentialRampOptions {\n /** Hue of the ramp (series colour name). Default `primary`. */\n color?: ChartColor;\n /** Surface the ramp fades into. Default `--card`. */\n surface?: TokenName;\n /**\n * `mix` (default): opaque `color-mix(in oklab, …)` steps — safe for overlapping marks and text on top.\n * `alpha`: `hsl(var(--token) / a)` steps that let the underlying surface show through.\n */\n mode?: 'mix' | 'alpha';\n /** Strength of the weakest step, 0–1. Default 0.14. */\n min?: number;\n}\n\nexport interface DivergingRampOptions {\n /** Token for the low end. Default `--destructive`. */\n negative?: TokenName;\n /** Token for the high end. Default `--primary`. */\n positive?: TokenName;\n /** Token for the neutral midpoint. Default `--muted`. */\n mid?: TokenName;\n mode?: 'mix' | 'alpha';\n /** Strength of the weakest non-neutral step, 0–1. Default 0.18. */\n min?: number;\n}\n\nconst round = (n: number) => Math.round(n * 1000) / 1000;\nconst pct = (n: number) => `${Math.round(n * 1000) / 10}%`;\nconst solid = (token: TokenName) => `hsl(var(${token}))`;\n\n/** Mixes `token` into `base` at `weight` (0–1); `weight` 1 is the plain token. */\nfunction mix(token: TokenName, base: TokenName, weight: number, mode: 'mix' | 'alpha'): string {\n if (weight >= 1) return solid(token);\n if (mode === 'alpha') return `hsl(var(${token}) / ${round(weight)})`;\n return `color-mix(in oklab, ${solid(token)} ${pct(weight)}, ${solid(base)})`;\n}\n\nfunction clamp01(n: number) {\n return Math.min(1, Math.max(0, n));\n}\n\n/**\n * `n` colours from faint to the full token, for ordered magnitudes (heatmaps, choropleths,\n * funnel stages). Every value is a CSS colour string usable as SVG fill/stroke or inline style.\n */\nexport function sequentialRamp(n: number, options: SequentialRampOptions = {}): string[] {\n const { color = 'primary', surface = '--card', mode = 'mix', min = 0.14 } = options;\n const token = SERIES_TOKENS[color] as TokenName;\n const count = Math.max(0, Math.floor(n));\n const lo = clamp01(min);\n return Array.from({ length: count }, (_, i) => {\n const t = count === 1 ? 1 : lo + ((1 - lo) * i) / (count - 1);\n return mix(token, surface, t, mode);\n });\n}\n\n/**\n * `n` colours from `negative` (index 0) through the neutral `mid` to `positive` (last index),\n * for signed values around a meaningful centre (deltas, budgets, sentiment). With an odd `n`\n * the middle step is the plain neutral token.\n */\nexport function divergingRamp(n: number, options: DivergingRampOptions = {}): string[] {\n const { negative = '--destructive', positive = '--primary', mid = '--muted', mode = 'mix', min = 0.18 } = options;\n const count = Math.max(0, Math.floor(n));\n const lo = clamp01(min);\n // Smallest non-zero distance from the centre (odd counts have an exact neutral step).\n const dMin = count % 2 ? 2 / (count - 1) : 1 / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n if (count === 1) return solid(mid);\n const d = (i / (count - 1)) * 2 - 1; // −1 … 1\n const a = Math.abs(d);\n if (a < 1e-9) return solid(mid);\n const strength = a >= 1 - 1e-9 ? 1 : lo + ((1 - lo) * (a - dMin)) / (1 - dMin);\n return mix(d < 0 ? negative : positive, mid, strength, mode);\n });\n}\n\n/**\n * Index of the ramp step for `value`. `domain` is `[min, max]` (sequential) or\n * `[min, mid, max]` (diverging: `mid` maps to the centre of the ramp).\n */\nexport function rampIndex(\n value: number,\n domain: readonly [number, number] | readonly [number, number, number],\n steps: number,\n): number {\n if (steps <= 1 || !Number.isFinite(value)) return 0;\n let t: number;\n if (domain.length === 3) {\n const [lo, mid, hi] = domain;\n t =\n value <= mid\n ? 0.5 * (mid === lo ? 1 : (value - lo) / (mid - lo))\n : 0.5 + 0.5 * (hi === mid ? 1 : (value - mid) / (hi - mid));\n } else {\n const [lo, hi] = domain;\n t = hi === lo ? 1 : (value - lo) / (hi - lo);\n }\n return Math.min(steps - 1, Math.floor(clamp01(t) * steps));\n}\n\n/** Colour of `value` on `ramp` (see `rampIndex`). */\nexport function rampColor(\n value: number,\n domain: readonly [number, number] | readonly [number, number, number],\n ramp: readonly string[],\n): string {\n return ramp[rampIndex(value, domain, ramp.length)] ?? ramp[0] ?? solid('--muted');\n}\n","import { useChartLabels } from './i18n';\nimport { Funnel, FunnelChart as RFunnelChart, ResponsiveContainer, Tooltip } from 'recharts';\nimport { tooltipContent } from './ChartTooltip';\nimport { chartFmt, cx, identity, type ValueFormatter } from './format';\nimport { sequentialRamp } from './palette';\nimport { accessibleName, field, numField, type DataKey } from './shared';\nimport { ChartDataTable, chartStateView, resolveState, type ChartStateProps } from './states';\nimport { useChartTheme, type ChartColor } from './theme';\n\nexport interface FunnelChartProps<T extends object> extends ChartStateProps {\n /** Stages in order, widest first. */\n data: readonly T[];\n /** Key of the stage name. */\n index: DataKey<T>;\n /** Key of the stage count. */\n category: DataKey<T>;\n /** Hue of the stages (a sequential ramp, strongest first). Default `primary`. */\n color?: ChartColor;\n valueFormatter?: ValueFormatter;\n /** Show the stage list with conversion and drop-off. Default `true`. */\n showStages?: boolean;\n /** Funnel height in px. */\n height?: number;\n 'aria-label'?: string;\n title?: string;\n description?: string;\n className?: string;\n}\n\nexport interface FunnelStage {\n name: string;\n value: number;\n /** Share of the first stage (0–1). */\n conversion: number;\n /** Loss from the previous stage (0–1); 0 for the first stage. */\n dropOff: number;\n fill: string;\n}\n\n/** Stage maths: conversion against the first stage and drop-off against the previous one. */\nexport function funnelStages(\n values: ReadonlyArray<{ name: string; value: number }>,\n fills: readonly string[] = [],\n): FunnelStage[] {\n const first = values[0]?.value ?? 0;\n return values.map((s, i) => {\n const prev = i === 0 ? s.value : (values[i - 1]?.value ?? 0);\n return {\n name: s.name,\n value: s.value,\n conversion: first > 0 ? s.value / first : 0,\n dropOff: i === 0 || prev <= 0 ? 0 : Math.max(0, (prev - s.value) / prev),\n fill: fills[i] ?? fills[fills.length - 1] ?? 'hsl(var(--primary))',\n };\n });\n}\n\n/** Staged conversion funnel: trapezoids in a one-hue ramp plus a stage list with drop-off. */\nexport function FunnelChart<T extends object>({\n data,\n index,\n category,\n color = 'primary',\n valueFormatter = identity,\n showStages = true,\n height = 260,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: FunnelChartProps<T>) {\n const t = useChartTheme();\n const ramp = sequentialRamp(Math.max(data.length, 1), {\n color,\n min: 0.35,\n }).reverse();\n const stages = funnelStages(\n data.map((d) => ({\n name: String(field(d, index)),\n value: numField(d, category),\n })),\n ramp,\n );\n const labels = useChartLabels();\n const name = accessibleName(\n labels.funnelChart,\n ariaLabel,\n title,\n stages.map((s) => s.name),\n );\n const effective = resolveState(state, data.length);\n const placeholder = chartStateView(effective, {\n height,\n emptyMessage,\n errorMessage,\n onRetry,\n });\n const byName = new Map(stages.map((s) => [s.name, s]));\n const fmtStage = (v: unknown, stage: string) => {\n const s = byName.get(stage);\n const base = typeof v === 'number' ? valueFormatter(v) : String(v ?? '');\n return s ? `${base} · ${chartFmt.percent(s.conversion)}` : base;\n };\n return (\n <div\n role=\"figure\"\n aria-label={name}\n aria-busy={effective === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder ?? (\n <div className=\"flex flex-col gap-5 sm:flex-row sm:items-center\">\n <div className=\"min-w-0 flex-1\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <RFunnelChart\n margin={{ top: 4, right: 4, bottom: 4, left: 4 }}\n accessibilityLayer\n title={title}\n desc={description}\n >\n <Funnel\n data={stages}\n dataKey=\"value\"\n nameKey=\"name\"\n stroke={t.surface}\n strokeWidth={2}\n lastShapeType=\"rectangle\"\n isAnimationActive={false}\n />\n <Tooltip isAnimationActive={false} content={tooltipContent({ seriesFormatter: fmtStage })} />\n </RFunnelChart>\n </ResponsiveContainer>\n </div>\n {showStages && (\n <ol aria-label={labels.stages} className=\"flex w-full flex-col gap-2 sm:w-64\">\n {stages.map((s, i) => (\n <li\n key={s.name}\n className=\"flex items-center justify-between gap-3 border-b border-border pb-2 last:border-b-0\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <span aria-hidden className=\"h-2.5 w-2.5 shrink-0 rounded-[3px]\" style={{ background: s.fill }} />\n <span className=\"truncate text-[12.5px] text-foreground\">{s.name}</span>\n </span>\n <span className=\"flex shrink-0 items-baseline gap-2 font-mono text-[12px] tabular-nums\">\n <span className=\"font-medium text-foreground\">{valueFormatter(s.value)}</span>\n <span className=\"text-muted-foreground\">{chartFmt.percent(s.conversion)}</span>\n {i > 0 && (\n <span className=\"text-destructive-text\">\n <span className=\"sr-only\">{labels.dropOffPrefix}</span>−{chartFmt.percent(s.dropOff)}\n </span>\n )}\n </span>\n </li>\n ))}\n </ol>\n )}\n {dataTable && (\n <ChartDataTable\n caption={name}\n columns={[labels.stage, category, labels.conversion, labels.dropOff]}\n rows={stages.map((s) => [\n s.name,\n valueFormatter(s.value),\n chartFmt.percent(s.conversion),\n chartFmt.percent(s.dropOff),\n ])}\n />\n )}\n </div>\n )}\n </div>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { Sankey, Tooltip, type SankeyLinkProps as LinkProps, type SankeyNodeProps as NodeProps } from 'recharts';\nimport { tooltipContent } from './ChartTooltip';\nimport { identity, type ValueFormatter } from './format';\nimport { SAFE_CHART_COLORS } from './palette';\nimport { accessibleName, ChartFrame } from './shared';\nimport { ChartDataTable, resolveState, type ChartStateProps } from './states';\nimport { seriesColor, useChartTheme, type ChartColor } from './theme';\n\nexport interface SankeyNodeDatum {\n name: string;\n /** Series colour of the node (and of its outgoing flows). Default: cycles `colors`. */\n color?: ChartColor;\n}\n\nexport interface SankeyLinkDatum {\n /** Source node: its name or its index in `nodes`. */\n source: string | number;\n /** Target node: its name or its index in `nodes`. */\n target: string | number;\n value: number;\n}\n\nexport interface SankeyChartProps extends ChartStateProps {\n nodes: readonly SankeyNodeDatum[];\n links: readonly SankeyLinkDatum[];\n colors?: readonly ChartColor[];\n valueFormatter?: ValueFormatter;\n /** Plot height in px. */\n height?: number;\n nodeWidth?: number;\n nodePadding?: number;\n 'aria-label'?: string;\n title?: string;\n description?: string;\n className?: string;\n}\n\ninterface ResolvedLink {\n source: number;\n target: number;\n value: number;\n}\n\n/** Turns name-or-index links into the index links Recharts expects; drops unknown endpoints and non-positive values. */\nexport function resolveSankeyLinks(\n nodes: readonly SankeyNodeDatum[],\n links: readonly SankeyLinkDatum[],\n): ResolvedLink[] {\n const byName = new Map(nodes.map((n, i) => [n.name, i]));\n const idx = (ref: string | number) =>\n typeof ref === 'number' ? (ref >= 0 && ref < nodes.length ? ref : undefined) : byName.get(ref);\n const out: ResolvedLink[] = [];\n for (const l of links) {\n const source = idx(l.source);\n const target = idx(l.target);\n if (source === undefined || target === undefined || source === target || !(l.value > 0)) continue;\n out.push({ source, target, value: l.value });\n }\n return out;\n}\n\n/** Flow diagram: nodes as token-coloured bars, links tinted with their source colour. */\nexport function SankeyChart({\n nodes,\n links,\n colors = SAFE_CHART_COLORS,\n valueFormatter = identity,\n height = 320,\n nodeWidth = 10,\n nodePadding = 18,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: SankeyChartProps) {\n const t = useChartTheme();\n const resolved = resolveSankeyLinks(nodes, links);\n const fills = nodes.map((n, i) => (n.color ? t.color(n.color) : seriesColor(t, colors, i)));\n const sources = new Set(resolved.map((l) => l.source));\n const labels = useChartLabels();\n const name = accessibleName(\n labels.sankeyChart,\n ariaLabel,\n title,\n nodes.map((n) => n.name),\n );\n const data = {\n nodes: nodes.map((n, i) => ({ name: n.name, fill: fills[i] })),\n links: resolved,\n };\n\n const renderNode = ({ x, y, width, height: h, index }: NodeProps) => {\n const sink = !sources.has(index);\n return (\n <g>\n <rect x={x} y={y} width={width} height={Math.max(h, 1)} rx={2} fill={fills[index]} />\n <text\n x={sink ? x - 6 : x + width + 6}\n y={y + h / 2}\n dy=\"0.35em\"\n textAnchor={sink ? 'end' : 'start'}\n fontSize={11}\n fill={t.text}\n >\n {nodes[index]?.name}\n </text>\n </g>\n );\n };\n const renderLink = (p: LinkProps) => {\n const source = resolved[p.index]?.source ?? 0;\n return (\n <path\n d={`M${p.sourceX},${p.sourceY} C${p.sourceControlX},${p.sourceY} ${p.targetControlX},${p.targetY} ${p.targetX},${p.targetY}`}\n fill=\"none\"\n stroke={fills[source] ?? t.color('primary')}\n strokeOpacity={0.28}\n strokeWidth={Math.max(p.linkWidth, 1)}\n />\n );\n };\n\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, resolved.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n height={height}\n className={className}\n table={\n dataTable && (\n <ChartDataTable\n caption={name}\n columns={[labels.from, labels.to, labels.value]}\n rows={resolved.map((l) => [\n nodes[l.source]?.name ?? '',\n nodes[l.target]?.name ?? '',\n valueFormatter(l.value),\n ])}\n />\n )\n }\n >\n <Sankey\n data={data}\n nameKey=\"name\"\n nodeWidth={nodeWidth}\n nodePadding={nodePadding}\n margin={{ top: 6, right: 96, bottom: 6, left: 6 }}\n node={renderNode}\n link={renderLink}\n accessibilityLayer\n title={title}\n desc={description}\n >\n <Tooltip isAnimationActive={false} content={tooltipContent({ valueFormatter })} />\n </Sankey>\n </ChartFrame>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart as RRadarChart, Tooltip } from 'recharts';\nimport { ChartLegend, useHiddenSeries } from './ChartLegend';\nimport { tooltipContent } from './ChartTooltip';\nimport { formatAny, identity } from './format';\nimport { SAFE_CHART_COLORS } from './palette';\nimport { accessibleName, cartesianTable, ChartFrame, type BaseChartProps, type DataKey } from './shared';\nimport { resolveState } from './states';\nimport { seriesColor, useChartTheme } from './theme';\n\nexport interface RadarChartProps<T extends object> extends Omit<BaseChartProps<T>, 'showGrid'> {\n /** One key per compared entity (a polygon each). `index` holds the axis names. */\n categories: ReadonlyArray<DataKey<T>>;\n /** Upper bound of the radial scale (e.g. 100 for scores). Default: data max. */\n max?: number;\n /** Show the concentric grid. Default `true`. */\n showGrid?: boolean;\n /** Show the radial scale ticks. Default `false`. */\n showRadiusAxis?: boolean;\n}\n\n/** Multi-axis scores: one translucent polygon per category over a polygonal grid. */\nexport function RadarChart<T extends object>({\n data,\n index,\n categories,\n colors = SAFE_CHART_COLORS,\n valueFormatter = identity,\n max,\n showLegend = true,\n showGrid = true,\n showRadiusAxis = false,\n height = 300,\n title,\n description,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = false,\n}: RadarChartProps<T>) {\n const t = useChartTheme();\n const [hidden, toggle] = useHiddenSeries();\n const col = (i: number) => seriesColor(t, colors, i);\n const legend = categories.map((c, i) => ({\n key: c,\n label: c,\n color: col(i),\n }));\n const labels = useChartLabels();\n const name = accessibleName(labels.radarChart, ariaLabel, title, categories);\n return (\n <ChartFrame\n label={name}\n state={resolveState(state, data.length)}\n emptyMessage={emptyMessage}\n errorMessage={errorMessage}\n onRetry={onRetry}\n table={dataTable && cartesianTable(name, data, index, categories, (v) => formatAny(v, valueFormatter))}\n height={height}\n className={className}\n legend={showLegend && <ChartLegend className=\"mb-3 px-1\" items={legend} hidden={hidden} onToggle={toggle} />}\n >\n <RRadarChart data={data} outerRadius=\"76%\" accessibilityLayer title={title} desc={description}>\n {showGrid && <PolarGrid stroke={t.grid} />}\n <PolarAngleAxis dataKey={index} tick={{ fill: t.text, fontSize: 11 }} />\n <PolarRadiusAxis\n domain={[0, max ?? 'auto']}\n angle={90}\n axisLine={false}\n tick={showRadiusAxis ? { fill: t.text, fontSize: 10 } : false}\n tickFormatter={valueFormatter}\n />\n <Tooltip isAnimationActive={false} content={tooltipContent({ valueFormatter })} />\n {categories.map((c, i) => (\n <Radar\n key={c}\n dataKey={c}\n name={c}\n hide={hidden.has(c)}\n stroke={col(i)}\n strokeWidth={2}\n fill={col(i)}\n fillOpacity={0.14}\n dot={{ r: 2.5, strokeWidth: 0, fill: col(i) }}\n isAnimationActive={false}\n />\n ))}\n </RRadarChart>\n </ChartFrame>\n );\n}\n","import { useChartLabels } from './i18n';\nimport { useId, useState, type KeyboardEvent } from 'react';\nimport { cx, identity, type ValueFormatter } from './format';\nimport { divergingRamp, rampIndex, sequentialRamp } from './palette';\nimport { accessibleName, field, type DataKey } from './shared';\nimport { ChartDataTable, chartStateView, resolveState, type ChartStateProps } from './states';\nimport type { ChartColor } from './theme';\n\nexport interface HeatmapProps<T extends object> extends ChartStateProps {\n /** One row per datum (cohort, day…). */\n data: readonly T[];\n /** Key of the row label. */\n index: DataKey<T>;\n /** Column keys (weeks, hours…), in display order. Missing / non-numeric values render as empty cells. */\n categories: ReadonlyArray<DataKey<T>>;\n /** `sequential` (default) for magnitudes, `diverging` for signed values around `domain[1]`. */\n scale?: 'sequential' | 'diverging';\n /** `[min, max]` or, for diverging, `[min, mid, max]`. Default: the data extent (mid 0). */\n domain?: readonly [number, number] | readonly [number, number, number];\n /** Number of colour steps. Default 6 (sequential) / 7 (diverging). */\n steps?: number;\n /** Hue of the sequential scale. Default `primary`. */\n color?: ChartColor;\n valueFormatter?: ValueFormatter;\n /** Print the value inside each cell. */\n showValues?: boolean;\n /** Show the colour scale under the grid. Default `true`. */\n showScale?: boolean;\n /** Cell height in px (default 28). Ignored when `height` is set. */\n cellHeight?: number;\n /**\n * Height of the grid in px (column labels included): cells shrink or grow to fill it (16–48 px\n * each). Use it to match sibling charts, e.g. inside a ChartCard.\n */\n height?: number;\n /** Row header column label (table fallback). Default: `index`. */\n rowHeader?: string;\n 'aria-label'?: string;\n title?: string;\n className?: string;\n}\n\nfunction extent(values: readonly number[]): [number, number] {\n if (!values.length) return [0, 1];\n return [Math.min(...values), Math.max(...values)];\n}\n\n/** Column-label row height + inter-row gap, used to fit rows into a fixed `height`. */\nconst LABEL_ROW = 20;\nconst GAP = 3;\n\n/** Cell height that fits `rows` rows in `height` px (clamped to 16–48), or undefined without a height. */\nexport function cellHeightFor(height: number | undefined, rows: number): number | undefined {\n if (height === undefined) return undefined;\n const n = Math.max(rows, 1);\n return Math.min(48, Math.max(16, Math.floor((height - LABEL_ROW - GAP * n) / n)));\n}\n\nconst cellFocus = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring';\n\n/**\n * Cohort / time grid coloured with a sequential or diverging token ramp. The colour grid is\n * a single keyboard stop (arrow keys move the active cell, Home/End jump within the row) with a\n * live readout; screen readers get the full data table (`dataTable`, on by default).\n */\nexport function Heatmap<T extends object>({\n data,\n index,\n categories,\n scale = 'sequential',\n domain,\n steps,\n color = 'primary',\n valueFormatter = identity,\n showValues = false,\n showScale = true,\n cellHeight: cellHeightProp = 28,\n height,\n rowHeader,\n title,\n className,\n 'aria-label': ariaLabel,\n state,\n emptyMessage,\n errorMessage,\n onRetry,\n dataTable = true,\n}: HeatmapProps<T>) {\n const id = useId();\n const cellHeight = cellHeightFor(height, data.length) ?? cellHeightProp;\n const [active, setActive] = useState<readonly [number, number] | null>(null);\n const labels = useChartLabels();\n const name = accessibleName(labels.heatmap, ariaLabel, title, []);\n const diverging = scale === 'diverging';\n const count = steps ?? (diverging ? 7 : 6);\n const ramp = diverging ? divergingRamp(count) : sequentialRamp(count, { color });\n const value = (r: number, c: number): number | null => {\n const row = data[r];\n const key = categories[c];\n if (!row || key === undefined) return null;\n const v = field(row, key);\n return typeof v === 'number' && Number.isFinite(v) ? v : null;\n };\n const all = data.flatMap((_, r) => categories.map((__, c) => value(r, c))).filter((v): v is number => v !== null);\n const [lo, hi] = extent(all);\n const dom: readonly [number, number] | readonly [number, number, number] =\n domain ?? (diverging ? [Math.min(lo, 0), 0, Math.max(hi, 0)] : [lo, hi]);\n const effective = resolveState(state, all.length);\n const placeholder = chartStateView(effective, {\n height: height ?? Math.max(data.length, 4) * (cellHeight + 3),\n emptyMessage,\n errorMessage,\n onRetry,\n });\n\n // Value labels sit on a card-coloured chip: foreground on card is AA in every theme,\n // whatever ramp step is underneath (mid steps fail with any single on-colour text).\n const cellStyle = (v: number) => ({ fill: ramp[rampIndex(v, dom, count)] ?? ramp[0] });\n\n const rowLabel = (r: number) => {\n const row = data[r];\n return row ? String(field(row, index)) : '';\n };\n const describe = ([r, c]: readonly [number, number]) => {\n const v = value(r, c);\n return `${rowLabel(r)} · ${categories[c] ?? ''}: ${v === null ? 'no data' : valueFormatter(v)}`;\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n const [r, c] = active ?? [0, 0];\n const lastR = data.length - 1;\n const lastC = categories.length - 1;\n const next: Record<string, readonly [number, number]> = {\n ArrowRight: [r, Math.min(lastC, c + 1)],\n ArrowLeft: [r, Math.max(0, c - 1)],\n ArrowDown: [Math.min(lastR, r + 1), c],\n ArrowUp: [Math.max(0, r - 1), c],\n Home: [r, 0],\n End: [r, lastC],\n };\n const to = next[e.key];\n if (to) {\n e.preventDefault();\n setActive(active ? to : [0, 0]);\n } else if (e.key === 'Escape') setActive(null);\n };\n\n if (placeholder)\n return (\n <div\n role=\"figure\"\n aria-label={name}\n aria-busy={effective === 'loading' || undefined}\n className={cx('w-full font-sans', className)}\n >\n {placeholder}\n </div>\n );\n\n const columns = `minmax(4.5rem, max-content) repeat(${categories.length}, minmax(1.75rem, 1fr))`;\n return (\n <div role=\"figure\" aria-label={name} className={cx('w-full font-sans', className)}>\n <div\n role=\"group\"\n tabIndex={0}\n aria-label={`${name}: ${labels.colourGrid}`}\n onKeyDown={onKeyDown}\n onFocus={() => setActive((a) => a ?? [0, 0])}\n onBlur={() => setActive(null)}\n onMouseLeave={() => setActive(null)}\n className={cx('overflow-x-auto rounded-md', cellFocus)}\n >\n {/* Narrow containers (cards, phones) scroll the grid sideways instead of squeezing cells. */}\n <div aria-hidden className=\"grid gap-[3px]\" style={{ gridTemplateColumns: columns }}>\n <div />\n {categories.map((c) => (\n <div key={c} className=\"truncate pb-1 text-center text-[11px] text-muted-foreground\">\n {c}\n </div>\n ))}\n {data.map((_, r) => [\n <div\n key={`h${r}`}\n className=\"flex items-center truncate pr-2 text-[11.5px] text-muted-foreground\"\n style={{ height: cellHeight }}\n >\n {rowLabel(r)}\n </div>,\n ...categories.map((c, ci) => {\n const v = value(r, ci);\n const s = v === null ? null : cellStyle(v);\n const on = active?.[0] === r && active[1] === ci;\n return (\n <div\n key={`${r}-${c}`}\n data-cell={`${r}-${ci}`}\n data-fill={s?.fill}\n onMouseEnter={() => setActive([r, ci])}\n className={cx(\n 'flex items-center justify-center rounded-[3px] font-mono text-[10.5px] tabular-nums',\n !s && 'border border-dashed border-border',\n on && 'outline-2 outline-offset-1 outline-foreground',\n )}\n style={{ height: cellHeight, background: s?.fill }}\n >\n {showValues && v !== null ? (\n <span className=\"rounded-[2px] bg-card px-1 leading-4 text-foreground\">{valueFormatter(v)}</span>\n ) : null}\n </div>\n );\n }),\n ])}\n </div>\n </div>\n <div className=\"mt-2 flex flex-wrap items-center justify-between gap-3\">\n <p\n id={`${id}-readout`}\n data-heatmap-readout=\"\"\n aria-live=\"polite\"\n className=\"min-h-[1.25rem] text-[12px] text-muted-foreground\"\n >\n {active ? describe(active) : ''}\n </p>\n {showScale && (\n <div aria-hidden className=\"flex items-center gap-1.5 text-[11px] text-muted-foreground\">\n <span className=\"font-mono tabular-nums\">{valueFormatter(dom[0])}</span>\n <span className=\"flex\">\n {ramp.map((f, i) => (\n <span key={i} className=\"h-2.5 w-4 first:rounded-l-sm last:rounded-r-sm\" style={{ background: f }} />\n ))}\n </span>\n <span className=\"font-mono tabular-nums\">{valueFormatter(dom[dom.length - 1] ?? dom[0])}</span>\n </div>\n )}\n </div>\n {dataTable && (\n <ChartDataTable\n caption={name}\n columns={[rowHeader ?? index, ...categories]}\n rows={data.map((_, r) => [\n rowLabel(r),\n ...categories.map((__, c) => {\n const v = value(r, c);\n return v === null ? '—' : valueFormatter(v);\n }),\n ])}\n />\n )}\n </div>\n );\n}\n","import { useChartLabels } from './i18n';\nimport type { Ref, SVGAttributes } from 'react';\nimport { cx } from './format';\n\n/** Same tones as the `@gntik-ai/ui` Sparkline, so the two can sit side by side in stat cards. */\nexport type MiniBarTone = 'primary' | 'success' | 'warning' | 'destructive' | 'info' | 'neutral';\n\nconst TONE_TOKEN: Record<MiniBarTone, string> = {\n primary: '--primary',\n success: '--success',\n warning: '--warning',\n destructive: '--destructive',\n info: '--info',\n neutral: '--muted-foreground',\n};\n\nexport interface MiniBarProps extends Omit<SVGAttributes<SVGSVGElement>, 'className' | 'width' | 'height'> {\n className?: string;\n ref?: Ref<SVGSVGElement>;\n /** The series, oldest first. */\n data: readonly number[];\n /** Per-bar labels (e.g. dates) for hover titles and the accessible summary. */\n labels?: readonly string[];\n tone?: MiniBarTone;\n /** Which bar is drawn at full strength; the rest are muted. Default `last`. */\n highlight?: 'last' | 'max' | 'min' | 'none' | number;\n width?: number;\n height?: number;\n /** What the series measures, used in the generated accessible name (\"Deployments\"). */\n label?: string;\n formatValue?: (value: number) => string;\n}\n\nconst fmtDefault = (v: number) => new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 }).format(v);\n\n/** \"Deployments: 12 bars, latest 9, low 2, high 14, total 84\". */\nexport function describeBars(data: readonly number[], label = 'Bars', format = fmtDefault): string {\n const last = data[data.length - 1];\n if (last === undefined) return `${label}: no data`;\n const total = data.reduce((s, v) => s + v, 0);\n return `${label}: ${data.length} bars, latest ${format(last)}, low ${format(Math.min(...data))}, high ${format(Math.max(...data))}, total ${format(total)}`;\n}\n\nfunction highlightIndex(data: readonly number[], h: MiniBarProps['highlight']): number {\n if (typeof h === 'number') return h;\n if (h === 'last') return data.length - 1;\n if (h === 'max') return data.indexOf(Math.max(...data));\n if (h === 'min') return data.indexOf(Math.min(...data));\n return -1;\n}\n\n/**\n * Sparkline-sized bar chart (pure SVG, no axes): drop-in next to `Sparkline variant=\"bar\"`,\n * with a highlighted bar, per-bar hover titles and a generated `role=\"img\"` summary.\n */\nexport function MiniBar({\n data,\n labels,\n tone = 'primary',\n highlight = 'last',\n width = 120,\n height = 32,\n label,\n formatValue = fmtDefault,\n className,\n ...props\n}: MiniBarProps) {\n const chartLabels = useChartLabels();\n const name = props['aria-label'] ?? describeBars(data, label ?? chartLabels.bars, formatValue);\n const token = TONE_TOKEN[tone];\n const n = data.length;\n const lo = n ? Math.min(0, ...data) : 0;\n const hi = n ? Math.max(0, ...data) : 0;\n const span = hi - lo || 1;\n const zero = height - ((0 - lo) / span) * height;\n const slot = n ? width / n : width;\n const gap = Math.min(2, slot * 0.25);\n const hl = highlightIndex(data, highlight);\n return (\n <svg\n role=\"img\"\n viewBox={`0 0 ${width} ${height}`}\n width={width}\n height={height}\n className={cx('inline-block shrink-0 overflow-visible align-middle', className)}\n {...props}\n aria-label={name}\n >\n {data.map((v, i) => {\n const h = Math.max(1, (Math.abs(v) / span) * height);\n const y = v >= 0 ? zero - h : zero;\n return (\n <rect\n key={i}\n data-highlight={i === hl || undefined}\n x={i * slot + gap / 2}\n y={y}\n width={Math.max(1, slot - gap)}\n height={h}\n rx={1}\n fill={i === hl || hl < 0 ? `hsl(var(${token}))` : `hsl(var(${token}) / 0.4)`}\n >\n <title>{`${labels?.[i] ?? `#${i + 1}`}: ${formatValue(v)}`}</title>\n </rect>\n );\n })}\n </svg>\n );\n}\n"],"mappings":";;;;;;AAuCA,MAAa,KAA4B;CACvC,SAAS;CACT,OAAO;CACP,OAAO;CACP,OAAO;CACP,WAAW;CACX,YAAY;CACZ,UAAU;CACV,WAAW;CACX,SAAS;CACT,WAAW;CACX,UAAU;CACV,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,SAAS;CACT,eAAe;CACf,MAAM;CACN,IAAI;CACJ,OAAO;CACP,UAAU;CACV,WAAW;CACX,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,aAAa;CACb,aAAa;CACb,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,MAAM;AACR;AAEA,MAAa,KAA4B;CACvC,SAAS;CACT,OAAO;CACP,OAAO;CACP,OAAO;CACP,WAAW;CACX,YAAY;CACZ,UAAU;CACV,WAAW;CACX,SAAS;CACT,WAAW;CACX,UAAU;CACV,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,SAAS;CACT,eAAe;CACf,MAAM;CACN,IAAI;CACJ,OAAO;CACP,UAAU;CACV,WAAW;CACX,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,aAAa;CACb,aAAa;CACb,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,MAAM;AACR;AAEA,MAAa,iBAAiB;CAAE;CAAI;AAAG;AACvC,MAAM,qBAAqB,cAAqC,EAAE;;AAWlE,SAAgB,oBAAoB,EAAE,SAAS,MAAM,QAAQ,YAAsC;CACjG,MAAM,QAAQ,cAAc;EAC1B,MAAM,WAAW,OAAO,MAAM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