@altertable/data-app-react 0.77.0 → 0.78.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/README.md +3 -4
- package/dist/chunks/{SectionHeading-Bz5RIXit.js → SectionHeading-BKvi7HVv.js} +250 -103
- package/dist/chunks/SectionHeading-BKvi7HVv.js.map +1 -0
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/types/chunks/DateTimeRangePicker.d.ts +19 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/ui/index.d.ts +20 -9
- package/dist/ui/index.js +449 -152
- package/dist/ui/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunks/SectionHeading-Bz5RIXit.js.map +0 -1
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["registerContext","Button","timeTicks","Tooltip","RechartsAreaChart","RechartsLineChart","ChartTooltip","MenuButton","MenuButton","formatNumber","RechartsBarChart","ChartTooltip","MenuButton","AriaRadioGroup","AriaRadio","CartesianGrid","NativeCartesianGrid","NativeLine","NativeBar","NativeArea","NativeScatter","XAxis","NativeXAxis","YAxis","NativeYAxis","Legend","NativeLegend","RechartsComposedChart","Button","TextWidgetContent","VisualizationWidgetContent","TableWidgetContent","MetricWidgetContent"],"sources":["../../src/ui/StaticDataApp.tsx","../../src/ui/GettingStarted.tsx","../../src/ui/GlossaryExplanation.tsx","../../src/ui/GlossaryDefinition.tsx","../../src/ui/Checkbox.tsx","../../src/ui/chart-data.ts","../../src/ui/time-interval.ts","../../src/ui/chart-time.ts","../../src/ui/use-chart-cursor-group.tsx","../../src/ui/chart-date-axis.tsx","../../src/ui/chart-interaction.tsx","../../src/ui/chart-legend-interaction.tsx","../../src/ui/chart-value-format.ts","../../src/ui/ChartLegend.tsx","../../src/ui/chart-primitives.tsx","../../src/ui/use-chart-scroll-to-end.ts","../../src/ui/TrendChart.tsx","../../src/ui/LineChart.tsx","../../src/ui/AreaChart.tsx","../../src/ui/PieChart.tsx","../../src/ui/ScatterChart.tsx","../../src/ui/BarChart.tsx","../../src/ui/RadioGroup.tsx","../../src/ui/CheckboxGroup.tsx","../../src/ui/ComposedChartLegend.tsx","../../src/ui/ComposedChart.tsx","../../src/ui/useSvgId.ts","../../src/ui/FunnelChart.tsx","../../src/ui/RetentionChart.tsx","../../src/ui/journey-flow.ts","../../src/ui/JourneyChart.tsx","../../src/ui/index.ts"],"sourcesContent":["import { DataAppFrame, type StaticDataAppProps } from './DataAppFrame.tsx';\n\nexport type DataAppProps = StaticDataAppProps;\n\n/** Setup and static screens; fetched data uses the declared-view DataApp. */\nexport function DataApp({ csvExport, ...props }: DataAppProps) {\n return (\n <DataAppFrame\n {...props}\n csvExport={csvExport && { loading: false, value: csvExport }}\n />\n );\n}\n","import { createDataClient } from '@altertable/data-app/client';\nimport type { ConnectionOperation } from '@altertable/data-app/contract';\n\nimport { createDataHooks } from '../hooks.ts';\nimport { useDeclaredResult } from '../view-runtime.tsx';\nimport { Button } from './Button.tsx';\nimport { createDataContext as registerContext } from './data-context.ts';\nimport type { DataContext } from './data-context.ts';\nimport { AppIcon } from './icons.ts';\nimport { DataApp } from './StaticDataApp.tsx';\n\nconst connectionContext = registerContext({})({\n description: 'Connection setup',\n glossary: {},\n});\n\nconst client = /* @__PURE__ */ createDataClient<{\n connection: ConnectionOperation;\n}>();\nconst { defineView } = /* @__PURE__ */ createDataHooks(client);\n\nconst connectionView = defineView({\n dataContext: connectionContext,\n operation: 'connection',\n describeInput: () => 'the connection',\n});\n\n/** Query-backed connection state and next steps for a newly created app. Mount within\n * `DataAppProvider` and register `connection: connectionCheck(app.queries)` on the server. */\nexport function GettingStarted({ dataContext }: { dataContext: DataContext }) {\n const connection = useDeclaredResult(connectionView);\n const state =\n connection.view.kind === 'error' || connection.view.kind === 'stale-error'\n ? 'error'\n : connection.refreshing || !connection.snapshot\n ? 'checking'\n : 'connected';\n\n return (\n <DataApp\n dataContext={dataContext}\n description=\"Check your lakehouse connection, then build a view around a real question.\"\n queries={connection.queries}\n toolbarActions={\n <Button\n disabled={connection.refreshing}\n onClick={() => connection.refetch()}\n >\n Check connection\n </Button>\n }\n >\n <section\n className=\"starter-connection\"\n data-state={state}\n role={state === 'error' ? 'alert' : 'status'}\n >\n <div className=\"starter-connection-icon\">\n <AppIcon\n name={\n state === 'connected'\n ? 'check'\n : state === 'error'\n ? 'error'\n : 'loading'\n }\n size={24}\n />\n </div>\n <div className=\"starter-connection-copy\">\n <span className=\"starter-eyebrow\">Lakehouse connection</span>\n <h2>\n {state === 'connected'\n ? 'Connected'\n : state === 'error'\n ? 'Connection not verified'\n : 'Checking connection…'}\n </h2>\n <p>\n {state === 'connected'\n ? 'A query completed successfully using this app’s current profile. You’re ready to build your first view.'\n : state === 'error'\n ? connection.snapshot\n ? 'An earlier query succeeded, but the latest check failed. Check the profile and try again.'\n : 'The query could not complete. Check the profile and lakehouse access, then try again.'\n : 'Running a lightweight query with this app’s current profile.'}\n </p>\n {state === 'connected' && (\n <small>This check does not verify access to every dataset.</small>\n )}\n </div>\n {state === 'error' && (\n <Button onClick={() => connection.refetch()}>Try again</Button>\n )}\n </section>\n\n <section className=\"starter-next\" aria-labelledby=\"starter-next-title\">\n <div className=\"starter-next-heading\">\n <span className=\"starter-eyebrow\">Next steps</span>\n <h2 id=\"starter-next-title\">Turn this starter into a useful app</h2>\n <p>Start with one question your readers need answered.</p>\n </div>\n <ol className=\"starter-steps\">\n <li>\n <strong>Choose a question</strong>\n <p>\n Decide what someone should learn or do after opening this app.\n </p>\n </li>\n <li>\n <strong>Find the right data</strong>\n <p>\n Inspect the relevant catalogs, tables, and columns before writing\n the query.\n </p>\n </li>\n <li>\n <strong>Build the first view</strong>\n <p>\n Replace the connection check in <code>src/operations.ts</code>,\n then render its result in <code>src/App.tsx</code>.\n </p>\n </li>\n </ol>\n </section>\n </DataApp>\n );\n}\n","import { type DisclosedQuery } from '@altertable/data-app/contract';\nimport { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { AboutData, type AboutEmpty } from './AboutData.tsx';\nimport { type DataContext, type GlossaryEntry } from './data-context.ts';\nimport { AppIcon } from './icons.ts';\n\nexport type GlossaryExplanationProps = {\n entry: GlossaryEntry;\n empty?: AboutEmpty;\n title?: ReactNode;\n description?: ReactNode;\n visual?: ReactNode;\n queries?: DisclosedQuery[];\n dataContext?: DataContext;\n} & Omit<ComponentPropsWithRef<'button'>, 'children' | 'title'>;\n\n/** Opens the inspect sheet for one glossary term. Prefer a card's evidence slot\n * when the surface already has a title, description, and visual. */\nexport function GlossaryExplanation({\n entry,\n empty,\n title,\n description,\n visual,\n queries,\n dataContext,\n className,\n ...props\n}: GlossaryExplanationProps) {\n return (\n <AboutData\n {...props}\n shortcut={false}\n iconOnly\n variant=\"ghost\"\n title={title ?? entry.term}\n description={description}\n visual={visual}\n references={{ kind: 'entries', entries: [entry] }}\n empty={empty}\n dataContext={dataContext}\n queries={queries}\n className={className ?? 'altertable-inspect-trigger'}\n tooltip=\"Explore this term\"\n aria-label={props['aria-label'] ?? `Explore ${entry.term}`}\n >\n <AppIcon name=\"openDetails\" />\n </AboutData>\n );\n}\n","import { type ReactNode } from 'react';\n\nimport { type GlossaryEntry } from './data-context.ts';\nimport { HelpPopover } from './HelpPopover.tsx';\n\nexport type GlossaryDefinitionProps = {\n entry: GlossaryEntry;\n children?: ReactNode;\n};\n\nexport function GlossaryDefinition({\n entry,\n children,\n}: GlossaryDefinitionProps) {\n return (\n <HelpPopover\n trigger={children ?? entry.term}\n triggerLabel={`Explain ${entry.term}`}\n label={entry.term}\n triggerProps={{\n className: 'altertable-glossary-definition-trigger',\n 'data-atbl-control': 'help',\n }}\n panelProps={{ className: 'altertable-glossary-definition-popover' }}\n >\n <strong>{entry.term}</strong>\n <div>{entry.definition}</div>\n </HelpPopover>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\nimport { createContext, useContext, useId, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\nimport { SelectionMark } from './SelectionMark.tsx';\n\nexport const CheckboxGroupContext = createContext<{\n values: readonly string[];\n disabled?: boolean;\n onChange: (value: string, checked: boolean) => void;\n} | null>(null);\nexport type CheckboxProps = {\n label: string;\n description?: ReactNode;\n disabled?: boolean;\n className?: string;\n} & (\n | { value: string; checked?: never; onChange?: never }\n | { value?: never; checked: boolean; onChange: (checked: boolean) => void }\n);\nexport function Checkbox({\n label,\n description,\n checked,\n value,\n onChange,\n disabled,\n className,\n}: CheckboxProps) {\n const group = useContext(CheckboxGroupContext);\n const descriptionId = useId();\n invariant(\n value === undefined || group,\n 'A checkbox with value must belong to a CheckboxGroup.'\n );\n const selected =\n value === undefined ? checked : group!.values.includes(value);\n return (\n <label\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n className={classNames('altertable-checkbox', className)}\n >\n <input\n type=\"checkbox\"\n value={value}\n checked={selected}\n aria-label={label}\n aria-describedby={description ? descriptionId : undefined}\n disabled={disabled || group?.disabled}\n onChange={event => {\n if (value === undefined) onChange!(event.currentTarget.checked);\n else group!.onChange(value, event.currentTarget.checked);\n }}\n />\n <SelectionMark selected={selected} />\n <span>\n {label}\n {description && <small id={descriptionId}>{description}</small>}\n </span>\n </label>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\n\nimport type { ItemActions } from './ExplorationActionControl.tsx';\nimport type { ChartCursorGroup } from './use-chart-cursor-group.tsx';\n\n/** Ordered category or time-series sample. IDs are unique and nonblank; values are finite. */\nexport type ChartItem = { id: string; label: string; value: number };\nexport type CartesianChartItem = ChartItem & {\n /** Optional timestamp in epoch milliseconds for cursor linking. Omit for category samples. */\n time?: number;\n};\nexport type HorizontalGridProps = {\n /** Draw horizontal grid lines behind the plotted values. */\n horizontalGrid?: boolean;\n};\nexport type CartesianChartProps<Row extends CartesianChartItem> =\n ValueChartProps<Row> &\n HorizontalGridProps & {\n /** Share mouse-hover timestamps with charts receiving the same handle. Matches each item's time exactly. */\n cursorGroup?: ChartCursorGroup;\n };\nexport type ValueChartProps<Row extends ChartItem = ChartItem> = {\n /** Ordered samples; the chart validates IDs and values when rendering. */\n items: readonly Row[];\n /** Actions available for each displayed item. Domain fields remain available to this callback. */\n itemActions?: ItemActions<Row>;\n unit: string;\n ariaLabel: string;\n formatValue?: (value: number) => string;\n};\n\nexport type CountChartProps = {\n /** Accessible measure and scope description. */\n ariaLabel: string;\n /** Population unit, such as users or sessions. */\n unit: string;\n /** Formats counts; rates use percentage formatting. */\n formatValue?: (value: number) => string;\n className?: string;\n};\n\n/** Independent observation on two finite numeric axes. */\nexport type ScatterChartItem = {\n id: string;\n label: string;\n x: number;\n y: number;\n};\ntype ValueChartKind = 'bar' | 'line' | 'area' | 'pie';\n\nfunction validateChartIds(kind: string, items: readonly { id: string }[]) {\n const ids = new Set<string>();\n for (const item of items) {\n invariant(\n item.id.trim().length > 0,\n `${kind} chart IDs must be nonempty and unique: blank ID.`\n );\n invariant(\n !ids.has(item.id),\n `${kind} chart IDs must be nonempty and unique: duplicate \"${item.id}\".`\n );\n ids.add(item.id);\n }\n}\n\nexport function validateValueChartItems(\n kind: ValueChartKind,\n items: readonly ChartItem[]\n): void {\n validateChartIds(kind, items);\n for (const item of items) {\n invariant(\n Number.isFinite(item.value),\n `${kind} chart \"${item.id}\" requires finite values.`\n );\n invariant(\n (kind !== 'bar' && kind !== 'pie') || item.value >= 0,\n `${kind} chart \"${item.id}\" requires nonnegative values.`\n );\n }\n}\n\nexport function validateScatterChartItems(\n items: readonly ScatterChartItem[]\n): void {\n validateChartIds('scatter', items);\n for (const item of items) {\n invariant(\n Number.isFinite(item.x) && Number.isFinite(item.y),\n `scatter chart \"${item.id}\" requires finite values for x and y.`\n );\n }\n}\n","/*!\n * TypeScript port of d3-time 3.1.0 (ISC), https://github.com/d3/d3-time/tree/v3.1.0\n * Numeric tick-step helpers adapted from d3-array 3.2.4 (ISC).\n *\n * Copyright 2010-2022 Mike Bostock (d3-time)\n * Copyright 2010-2023 Mike Bostock (d3-array tick-step helpers)\n *\n * Permission to use, copy, modify, and/or distribute this software for any purpose\n * with or without fee is hereby granted, provided that the above copyright notice\n * and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n * THIS SOFTWARE.\n */\n\ntype DateValue = Date | number;\ntype DateMutation = (date: Date) => void;\ntype DateOffset = (date: Date, step: number) => void;\ntype DateCount = (start: Date, end: Date) => number;\n\nexport interface TimeInterval {\n (date?: DateValue): Date;\n floor(this: void, date: DateValue): Date;\n ceil(this: void, date: DateValue): Date;\n round(this: void, date: DateValue): Date;\n offset(this: void, date: DateValue, step?: number): Date;\n range(this: void, start: DateValue, stop: DateValue, step?: number): Date[];\n filter(this: void, test: (date: Date) => boolean): TimeInterval;\n}\n\nexport interface CountableTimeInterval extends TimeInterval {\n count(this: void, start: DateValue, end: DateValue): number;\n every(this: void, step: number): TimeInterval | null;\n}\n\nexport function timeInterval(\n floor: DateMutation,\n offset: DateOffset\n): TimeInterval;\nexport function timeInterval(\n floor: DateMutation,\n offset: DateOffset,\n count: DateCount,\n field?: (date: Date) => number\n): CountableTimeInterval;\nexport function timeInterval(\n floor: DateMutation,\n offset: DateOffset,\n count?: DateCount,\n field?: (date: Date) => number\n): TimeInterval {\n function interval(value?: DateValue): Date {\n const date = arguments.length === 0 ? new Date() : new Date(+value!);\n floor(date);\n return date;\n }\n interval.floor = (value: DateValue): Date => {\n const date = new Date(+value);\n floor(date);\n return date;\n };\n interval.ceil = (value: DateValue): Date => {\n const date = new Date(+value - 1);\n floor(date);\n offset(date, 1);\n floor(date);\n return date;\n };\n interval.round = (value: DateValue): Date => {\n const before = interval(value);\n const after = interval.ceil(value);\n return +value - +before < +after - +value ? before : after;\n };\n interval.offset = (value: DateValue, step?: number): Date => {\n const date = new Date(+value);\n offset(date, step == null ? 1 : Math.floor(step));\n return date;\n };\n interval.range = (\n start: DateValue,\n stop: DateValue,\n step?: number\n ): Date[] => {\n const range: Date[] = [];\n const date = interval.ceil(start);\n const stride = step == null ? 1 : Math.floor(step);\n if (!(+date < +stop) || !(stride > 0)) return range;\n let previous: Date;\n do {\n previous = new Date(+date);\n range.push(previous);\n offset(date, stride);\n floor(date);\n } while (+previous < +date && +date < +stop);\n return range;\n };\n interval.filter = (test: (date: Date) => boolean): TimeInterval =>\n timeInterval(\n date => {\n if (!Number.isNaN(+date)) {\n floor(date);\n while (!test(date)) {\n date.setTime(+date - 1);\n floor(date);\n }\n }\n },\n (date, step) => {\n if (!Number.isNaN(+date)) {\n const direction = step < 0 ? -1 : 1;\n for (let remaining = Math.abs(step); remaining > 0; --remaining) {\n do {\n offset(date, direction);\n } while (!test(date));\n }\n }\n }\n );\n if (count) {\n interval.count = (start: DateValue, end: DateValue): number => {\n countStart.setTime(+start);\n countEnd.setTime(+end);\n floor(countStart);\n floor(countEnd);\n return Math.floor(count(countStart, countEnd));\n };\n interval.every = (step: number): TimeInterval | null => {\n step = Math.floor(step);\n if (!Number.isFinite(step) || !(step > 0)) return null;\n if (step === 1) return interval;\n return interval.filter(\n field\n ? date => field(date) % step === 0\n : date => interval.count!(0, date) % step === 0\n );\n };\n }\n return interval;\n}\n\nconst countStart = new Date();\nconst countEnd = new Date();\nconst durationSecond = 1000;\nconst durationMinute = durationSecond * 60;\nconst durationHour = durationMinute * 60;\nconst durationDay = durationHour * 24;\nconst durationWeek = durationDay * 7;\nconst durationMonth = durationDay * 30;\nconst durationYear = durationDay * 365;\n\nconst millisecond = timeInterval(\n () => {\n // noop\n },\n (date, step) => {\n date.setTime(+date + step);\n },\n (start, end) => {\n return +end - +start;\n }\n);\n\n// An optimized implementation for this simple case.\nmillisecond.every = k => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval(\n date => {\n date.setTime(Math.floor(+date / k) * k);\n },\n (date, step) => {\n date.setTime(+date + step * k);\n },\n (start, end) => {\n return (+end - +start) / k;\n }\n );\n};\n\nconst second = timeInterval(\n date => {\n date.setTime(+date - date.getMilliseconds());\n },\n (date, step) => {\n date.setTime(+date + step * durationSecond);\n },\n (start, end) => {\n return (+end - +start) / durationSecond;\n },\n date => {\n return date.getUTCSeconds();\n }\n);\n\nexport const timeMinute = timeInterval(\n date => {\n date.setTime(\n +date - date.getMilliseconds() - date.getSeconds() * durationSecond\n );\n },\n (date, step) => {\n date.setTime(+date + step * durationMinute);\n },\n (start, end) => {\n return (+end - +start) / durationMinute;\n },\n date => {\n return date.getMinutes();\n }\n);\n\nexport const utcMinute = timeInterval(\n date => {\n date.setUTCSeconds(0, 0);\n },\n (date, step) => {\n date.setTime(+date + step * durationMinute);\n },\n (start, end) => {\n return (+end - +start) / durationMinute;\n },\n date => {\n return date.getUTCMinutes();\n }\n);\n\nexport const timeHour = timeInterval(\n date => {\n date.setTime(\n +date -\n date.getMilliseconds() -\n date.getSeconds() * durationSecond -\n date.getMinutes() * durationMinute\n );\n },\n (date, step) => {\n date.setTime(+date + step * durationHour);\n },\n (start, end) => {\n return (+end - +start) / durationHour;\n },\n date => {\n return date.getHours();\n }\n);\n\nexport const utcHour = timeInterval(\n date => {\n date.setUTCMinutes(0, 0, 0);\n },\n (date, step) => {\n date.setTime(+date + step * durationHour);\n },\n (start, end) => {\n return (+end - +start) / durationHour;\n },\n date => {\n return date.getUTCHours();\n }\n);\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) =>\n (+end -\n +start -\n (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) /\n durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval(\n date => {\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n },\n (start, end) => {\n return (+end - +start) / durationDay;\n },\n date => {\n return date.getUTCDate() - 1;\n }\n);\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval(\n date => {\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n },\n (start, end) => {\n return (+end - +start) / durationDay;\n },\n date => {\n return Math.floor(+date / durationDay);\n }\n);\n\nexport const unixDays = unixDay.range;\n\nfunction timeWeekday(i: number) {\n return timeInterval(\n date => {\n date.setDate(date.getDate() - ((date.getDay() + 7 - i) % 7));\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setDate(date.getDate() + step * 7);\n },\n (start, end) => {\n return (\n (+end -\n +start -\n (end.getTimezoneOffset() - start.getTimezoneOffset()) *\n durationMinute) /\n durationWeek\n );\n }\n );\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i: number) {\n return timeInterval(\n date => {\n date.setUTCDate(date.getUTCDate() - ((date.getUTCDay() + 7 - i) % 7));\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n },\n (start, end) => {\n return (+end - +start) / durationWeek;\n }\n );\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n\nexport const timeMonth = timeInterval(\n date => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setMonth(date.getMonth() + step);\n },\n (start, end) => {\n return (\n end.getMonth() -\n start.getMonth() +\n (end.getFullYear() - start.getFullYear()) * 12\n );\n },\n date => {\n return date.getMonth();\n }\n);\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval(\n date => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n },\n (start, end) => {\n return (\n end.getUTCMonth() -\n start.getUTCMonth() +\n (end.getUTCFullYear() - start.getUTCFullYear()) * 12\n );\n },\n date => {\n return date.getUTCMonth();\n }\n);\n\nexport const utcMonths = utcMonth.range;\n\nexport const timeYear = timeInterval(\n date => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n },\n (start, end) => {\n return end.getFullYear() - start.getFullYear();\n },\n date => {\n return date.getFullYear();\n }\n);\n\n// An optimized implementation for this simple case.\ntimeYear.every = k => {\n return !isFinite((k = Math.floor(k))) || !(k > 0)\n ? null\n : timeInterval(\n date => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n }\n );\n};\n\nexport const utcYear = timeInterval(\n date => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n },\n (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n },\n date => {\n return date.getUTCFullYear();\n }\n);\n\n// An optimized implementation for this simple case.\nutcYear.every = k => {\n return !isFinite((k = Math.floor(k))) || !(k > 0)\n ? null\n : timeInterval(\n date => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n }\n );\n};\n\nconst e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(\n start: number,\n stop: number,\n count: number\n): [number, number, number] {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2)\n return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nfunction tickIncrement(start: number, stop: number, count: number): number {\n return tickSpec(start, stop, count)[2];\n}\n\nfunction tickStep(start: number, stop: number, count: number): number {\n const reverse = stop < start,\n inc = reverse\n ? tickIncrement(stop, start, count)\n : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n\nfunction ticker(\n year: CountableTimeInterval,\n month: CountableTimeInterval,\n week: CountableTimeInterval,\n day: CountableTimeInterval,\n hour: CountableTimeInterval,\n minute: CountableTimeInterval\n) {\n const tickIntervals: [CountableTimeInterval, number, number][] = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [hour, 1, durationHour],\n [hour, 3, 3 * durationHour],\n [hour, 6, 6 * durationHour],\n [hour, 12, 12 * durationHour],\n [day, 1, durationDay],\n [day, 2, 2 * durationDay],\n [week, 1, durationWeek],\n [month, 1, durationMonth],\n [month, 3, 3 * durationMonth],\n [year, 1, durationYear],\n ];\n\n function ticks(\n start: DateValue,\n stop: DateValue,\n count: number | TimeInterval\n ): Date[] {\n const reverse = +stop < +start;\n if (reverse) [start, stop] = [stop, start];\n const interval =\n typeof count !== 'number' ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(\n start: DateValue,\n stop: DateValue,\n count: number\n ): TimeInterval | null {\n const target = Math.abs(+stop - +start) / count;\n let low = 0;\n let high = tickIntervals.length;\n if (Number.isNaN(target)) low = high;\n while (low < high) {\n const middle = (low + high) >>> 1;\n // Binary-search bounds keep the midpoint within the interval table.\n if (tickIntervals[middle]![2] <= target) low = middle + 1;\n else high = middle;\n }\n const i = low;\n if (i === tickIntervals.length)\n return year.every(\n tickStep(+start / durationYear, +stop / durationYear, count)\n );\n if (i === 0)\n return millisecond.every(Math.max(tickStep(+start, +stop, count), 1));\n // The edge cases above leave an interval on both sides of i.\n const previous = tickIntervals[i - 1]!;\n const next = tickIntervals[i]!;\n const [t, step] = target / previous[2] < next[2] / target ? previous : next;\n return t.every(step);\n }\n\n return [ticks, tickInterval] as const;\n}\n\nconst [utcTicks] = ticker(\n utcYear,\n utcMonth,\n utcSunday,\n unixDay,\n utcHour,\n utcMinute\n);\nconst [timeTicks] = ticker(\n timeYear,\n timeMonth,\n timeSunday,\n timeDay,\n timeHour,\n timeMinute\n);\n\nexport { utcTicks, timeTicks };\nexport {\n millisecond as timeMillisecond,\n millisecond as utcMillisecond,\n second as timeSecond,\n second as utcSecond,\n timeSunday as timeWeek,\n utcSunday as utcWeek,\n};\n","import {\n formatDate,\n formatDateTime,\n parseDateTime,\n} from '@altertable/data-app/format';\n\nimport { utcTicks } from './time-interval.ts';\n\nconst day = 86_400_000;\nconst calendarDatePattern = /^\\d{4}-\\d{2}-\\d{2}$/;\nfunction isCalendarDate(value: unknown): value is string {\n return typeof value === 'string' && calendarDatePattern.test(value);\n}\n/** Only ISO calendar dates and zoned instants are inferred. Numbers require scale=\"utc\". */\nexport function chartTimestamp(value: unknown, numeric = false): number | null {\n if (isCalendarDate(value)) {\n return parseDateTime(`${value}T00:00:00Z`)?.getTime() ?? null;\n }\n if (\n value instanceof Date ||\n typeof value === 'string' ||\n (numeric && typeof value === 'number')\n ) {\n return parseDateTime(value)?.getTime() ?? null;\n }\n return null;\n}\n\ntype ChartTimeModel = {\n start: number;\n end: number;\n times: readonly number[];\n /** Smallest gap in milliseconds; a single instant uses a one-day extent. */\n minimumInterval: number;\n tooltip: (value: unknown) => string;\n};\n\nexport function timeModel(\n values: readonly unknown[],\n numeric = false\n): ChartTimeModel | null {\n const timestamps = new Set<number>();\n for (const value of values) {\n const timestamp = chartTimestamp(value, numeric);\n if (timestamp == null) return null;\n timestamps.add(timestamp);\n }\n const times = [...timestamps].sort((a, b) => a - b);\n const start = times[0];\n const end = times.at(-1);\n if (start == null || end == null) return null;\n let minimumInterval = Infinity;\n for (let index = 1; index < times.length; index++) {\n minimumInterval = Math.min(\n minimumInterval,\n times[index]! - times[index - 1]!\n );\n }\n if (times.length === 1) minimumInterval = day;\n const dateOnly = values.every(isCalendarDate);\n const seconds =\n times.some(value => value % 60_000 !== 0) || minimumInterval < 60_000;\n const milliseconds =\n times.some(value => value % 1_000 !== 0) || minimumInterval < 1_000;\n function tooltip(value: unknown) {\n const time = chartTimestamp(value, true);\n if (time == null)\n return typeof value === 'string' || typeof value === 'number'\n ? String(value)\n : '';\n if (dateOnly) return formatDate(new Date(time).toISOString().slice(0, 10));\n if (milliseconds) {\n return new Intl.DateTimeFormat('en-US', {\n timeZone: 'UTC',\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n fractionalSecondDigits: 3,\n hourCycle: 'h23',\n }).format(time);\n }\n return formatDateTime(time, {\n precision: seconds ? 'second' : 'minute',\n timeZone: 'UTC',\n });\n }\n return {\n start,\n end,\n times,\n minimumInterval,\n tooltip,\n };\n}\n\nfunction datePart(value: number, options: Intl.DateTimeFormatOptions) {\n return new Intl.DateTimeFormat('en-US', {\n ...options,\n timeZone: 'UTC',\n }).format(value);\n}\n\nexport function timeTicks(model: ChartTimeModel, width: number) {\n const { start, end } = model;\n const firstDate = new Date(start);\n const lastDate = new Date(end);\n // Context distinguishes calendar boundaries within the displayed extent.\n // Constant context belongs in the exact tooltip, not repeated axis labels.\n const spansYears = firstDate.getUTCFullYear() !== lastDate.getUTCFullYear();\n const spansDates =\n firstDate.toISOString().slice(0, 10) !==\n lastDate.toISOString().slice(0, 10);\n const count = Math.max(\n 2,\n Math.min(12, Math.floor(width / 80), model.times.length)\n );\n let ticks =\n start === end\n ? [start]\n : utcTicks(\n new Date(start),\n new Date(end),\n Math.min(count, (end - start) / model.minimumInterval)\n ).map(Number);\n const step =\n ticks.length > 1\n ? ticks[1]! - ticks[0]!\n : Math.max(end - start, model.minimumInterval);\n // Calendar intervals are a hint. Keep the actual extent visible, then thin by pixel distance.\n const candidates = [...new Set([start, ...ticks, end])].sort((a, b) => a - b);\n ticks = [start];\n const gap = step < 1_000 ? 110 : 80;\n for (const value of candidates.slice(1)) {\n if (((value - ticks.at(-1)!) / (end - start)) * width >= gap)\n ticks.push(value);\n }\n if (end !== start && ticks.at(-1) !== end) {\n if (\n ticks.length > 1 &&\n ((end - ticks.at(-1)!) / (end - start)) * width < gap\n )\n ticks.pop();\n ticks.push(end);\n }\n function label(value: number, index: number) {\n const previous = index > 0 ? new Date(ticks[index - 1]!) : undefined;\n const date = new Date(value);\n const yearChanged =\n !previous || previous.getUTCFullYear() !== date.getUTCFullYear();\n const dateChanged =\n !previous ||\n previous.toISOString().slice(0, 10) !== date.toISOString().slice(0, 10);\n if (step >= 300 * day)\n return { main: String(date.getUTCFullYear()), context: '' };\n if (\n step >= 28 * day &&\n (model.minimumInterval >= 28 * day || end - start >= 180 * day)\n )\n return {\n main: datePart(value, { month: 'short' }),\n context: spansYears && yearChanged ? String(date.getUTCFullYear()) : '',\n };\n if (step >= day && !(model.minimumInterval < day && end - start <= 3 * day))\n return {\n main: datePart(value, { month: 'short', day: 'numeric' }),\n context: spansYears && yearChanged ? String(date.getUTCFullYear()) : '',\n };\n return {\n main: datePart(value, {\n hour: '2-digit',\n minute: '2-digit',\n ...(step < 60_000 ? { second: '2-digit' as const } : {}),\n ...(step < 1_000 ? { fractionalSecondDigits: 3 as const } : {}),\n hourCycle: 'h23',\n }),\n context:\n spansDates && dateChanged\n ? datePart(value, {\n month: 'short',\n day: 'numeric',\n ...(spansYears && yearChanged\n ? { year: 'numeric' as const }\n : {}),\n })\n : '',\n };\n }\n return { ticks, label };\n}\n","import {\n createContext,\n useCallback,\n useEffect,\n useId,\n useState,\n useSyncExternalStore,\n} from 'react';\n\ntype Cursor = { source: string; time: number };\ntype CursorStore = {\n snapshot: () => Cursor | null;\n subscribe: (listener: () => void) => () => void;\n publish: (source: string, time: number) => void;\n clear: (source: string) => void;\n};\nconst groupBrand: unique symbol = Symbol('ChartCursorGroup');\n/** Opaque shared-cursor handle. Create with useChartCursorGroup and pass through chart cursorGroup props. */\nexport type ChartCursorGroup = { readonly [groupBrand]: true };\nconst stores = new WeakMap<ChartCursorGroup, CursorStore>();\n\nfunction createGroup(): ChartCursorGroup {\n const group: ChartCursorGroup = { [groupBrand]: true };\n let cursor: Cursor | null = null;\n const listeners = new Set<() => void>();\n function notify() {\n for (const listener of listeners) listener();\n }\n stores.set(group, {\n snapshot: () => cursor,\n subscribe: listener => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n publish: (source, time) => {\n if (\n !Number.isFinite(time) ||\n (cursor?.source === source && cursor.time === time)\n )\n return;\n cursor = { source, time };\n notify();\n },\n clear: source => {\n if (cursor?.source !== source) return;\n cursor = null;\n notify();\n },\n });\n return group;\n}\n\n/** Creates a stable shared mouse-hover cursor handle. Pass it explicitly to each participating chart's cursorGroup prop.\n * Peers indicate exact timestamp matches while tooltips remain local. Mouse leave clears the cursor.\n * Each hook call creates an independent group; handles can be passed through component props.\n * @example\n * function Dashboard() {\n * const operations = useChartCursorGroup();\n * const samples = [{ id: 'noon', label: '12:00', time: 1767268800000, value: 42 }];\n * return <>\n * <BarChart cursorGroup={operations} items={samples} unit=\"requests\" ariaLabel=\"Traffic\" />\n * <LineChart cursorGroup={operations} items={samples} unit=\"ms\" ariaLabel=\"Latency\" />\n * </>;\n * }\n */\nexport function useChartCursorGroup(): ChartCursorGroup {\n const [group] = useState(createGroup);\n return group;\n}\n\nfunction emptySnapshot() {\n return null;\n}\nfunction emptySubscribe() {\n return () => {};\n}\n\nexport function useLinkedChartCursor(group?: ChartCursorGroup) {\n const store = group == null ? undefined : stores.get(group);\n const cursor = useSyncExternalStore(\n store?.subscribe ?? emptySubscribe,\n store?.snapshot ?? emptySnapshot,\n emptySnapshot\n );\n const id = useId();\n const setTime = useCallback(\n (time: number | undefined) => {\n if (time != null) store?.publish(id, time);\n else store?.clear(id);\n },\n [store, id]\n );\n const reset = useCallback(() => store?.clear(id), [store, id]);\n useEffect(() => reset, [reset]);\n return {\n time: cursor?.source !== id ? cursor?.time : undefined,\n setTime,\n reset,\n };\n}\n\nexport const ChartCursorChartContext = createContext<{\n mouseHover: boolean;\n cursor: ReturnType<typeof useLinkedChartCursor>;\n} | null>(null);\n","import { formatNumber } from '@altertable/data-app/format';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useLayoutEffect,\n useState,\n type ComponentProps,\n type ReactNode,\n} from 'react';\nimport {\n XAxis,\n useActiveTooltipLabel,\n useIsTooltipActive,\n useXAxisScale,\n usePlotArea,\n type XAxisTickContentProps,\n} from 'recharts';\n\nimport { chartTimestamp, timeModel, timeTicks } from './chart-time.ts';\nimport { ChartCursorChartContext } from './use-chart-cursor-group.tsx';\n\ntype LabelFormatter = (value: unknown) => string;\ntype ChartDateAxesApi = {\n data: readonly unknown[];\n barAxes: ReadonlyMap<string | number, number>;\n registerBar: (id: string | number) => () => void;\n formatters: ReadonlyMap<string | number, LabelFormatter>;\n register: (id: string | number, formatter: LabelFormatter) => () => void;\n};\nconst ChartDateAxesContext = createContext<ChartDateAxesApi | null>(null);\n\nexport function ChartDateAxes({\n data,\n children,\n}: {\n data: readonly unknown[];\n children: ReactNode;\n}) {\n const [formatters, setFormatters] = useState<\n ReadonlyMap<string | number, LabelFormatter>\n >(() => new Map());\n const register = useCallback(\n (id: string | number, formatter: LabelFormatter) => {\n setFormatters(current => new Map(current).set(id, formatter));\n return () =>\n setFormatters(current => {\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n },\n []\n );\n const [barAxes, setBarAxes] = useState<ReadonlyMap<string | number, number>>(\n () => new Map()\n );\n const registerBar = useCallback((id: string | number) => {\n setBarAxes(current => new Map(current).set(id, (current.get(id) ?? 0) + 1));\n return () =>\n setBarAxes(current => {\n const next = new Map(current);\n const count = (next.get(id) ?? 1) - 1;\n if (count) next.set(id, count);\n else next.delete(id);\n return next;\n });\n }, []);\n return (\n <ChartDateAxesContext.Provider\n value={{ data, formatters, register, barAxes, registerBar }}\n >\n {children}\n </ChartDateAxesContext.Provider>\n );\n}\nexport function useDateAxisBar(id: string | number = 0) {\n const registerBar = useContext(ChartDateAxesContext)?.registerBar;\n useLayoutEffect(() => registerBar?.(id), [registerBar, id]);\n}\nexport function useDateAxisLabel(id: string | number = 0) {\n return useContext(ChartDateAxesContext)?.formatters.get(id);\n}\nfunction field(row: unknown, key: string | number): unknown {\n if (row == null || typeof row !== 'object') return undefined;\n if (key in row) return (row as Record<string | number, unknown>)[key];\n return String(key)\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .split('.')\n .reduce<unknown>(\n (value, part) =>\n value != null && typeof value === 'object'\n ? (value as Record<string, unknown>)[part]\n : undefined,\n row\n );\n}\n\nconst xAxisDefaults = {\n interval: 'preserveStartEnd' as const,\n stroke: 'var(--atbl-muted)',\n tickFormatter: (value: unknown) =>\n typeof value === 'number' ? formatNumber(value) : String(value),\n tickLine: false,\n axisLine: { stroke: 'var(--atbl-border)' },\n tick: { fontSize: 'var(--atbl-type-meta-size)' },\n};\n\nfunction LinkedTimeCursor({\n times,\n axisId,\n}: {\n times: readonly number[];\n axisId: string | number;\n}) {\n const context = useContext(ChartCursorChartContext);\n const label = useActiveTooltipLabel();\n const active = useIsTooltipActive();\n const scale = useXAxisScale(axisId);\n const plot = usePlotArea();\n const mouseHover = context?.mouseHover;\n const setTime = context?.cursor.setTime;\n const reset = context?.cursor.reset;\n useEffect(() => {\n if (!mouseHover || !active) {\n reset?.();\n } else {\n const time = chartTimestamp(label, true);\n if (time != null && times.includes(time)) setTime?.(time);\n }\n }, [mouseHover, active, label, times, setTime, reset]);\n const time = context?.cursor.time;\n if (time == null || !times.includes(time)) return null;\n const x = scale?.(time);\n if (\n !plot ||\n x == null ||\n !Number.isFinite(x) ||\n x < plot.x ||\n x > plot.x + plot.width\n )\n return null;\n return (\n <line\n aria-hidden=\"true\"\n x1={x}\n x2={x}\n y1={plot.y}\n y2={plot.y + plot.height}\n stroke=\"var(--atbl-muted)\"\n strokeOpacity={0.3}\n pointerEvents=\"none\"\n data-atbl-internal-linked-cursor=\"true\"\n />\n );\n}\n\n/**\n * Infers temporal input from ISO dates, zoned ISO timestamps, and Date values.\n * Use scale=\"utc\" for epoch milliseconds or type=\"category\" for date-like categories.\n * Explicit tick formatters and tick lists retain authored axis behavior.\n */\nexport function ChartXAxis<Row = unknown, Value = string | number | Date>(\n props: ComponentProps<typeof XAxis<Row, Value>>\n) {\n const context = useContext(ChartDateAxesContext);\n const plot = usePlotArea();\n const data = context?.data;\n const { dataKey, ...axisProps } = props;\n const numeric = props.scale === 'utc';\n const enabled =\n numeric ||\n (props.type == null &&\n props.scale == null &&\n props.tickFormatter == null &&\n props.ticks == null);\n const model = useMemo(() => {\n if (!enabled || !data?.length || dataKey == null) return null;\n return timeModel(\n data.map(row =>\n typeof dataKey === 'function'\n ? dataKey(row as Row)\n : field(row, dataKey)\n ),\n numeric\n );\n }, [data, dataKey, enabled, numeric]);\n const cursorModel = useMemo(() => {\n if (!data?.length || dataKey == null || props.type === 'category')\n return null;\n if (props.scale !== 'utc' && props.scale !== 'time') return null;\n return timeModel(\n data.map(row =>\n typeof dataKey === 'function'\n ? dataKey(row as Row)\n : field(row, dataKey)\n ),\n props.scale === 'utc' || props.scale === 'time'\n );\n }, [data, dataKey, props.type, props.scale]);\n const register = context?.register;\n const id = props.xAxisId ?? 0;\n useEffect(\n () => (model ? register?.(id, model.tooltip) : undefined),\n [register, id, model]\n );\n if (!model || dataKey == null) {\n return (\n <>\n <XAxis<Row, Value> {...xAxisDefaults} {...props} />\n {cursorModel && (\n <LinkedTimeCursor times={cursorModel.times} axisId={id} />\n )}\n </>\n );\n }\n const automaticTicks =\n props.ticks == null && props.tickFormatter == null\n ? timeTicks(model, plot?.width ?? 400)\n : null;\n return (\n <>\n <XAxis<Row, number | null>\n {...xAxisDefaults}\n scale=\"utc\"\n domain={\n model.start === model.end || context?.barAxes.has(id)\n ? [\n model.start - model.minimumInterval / 2,\n model.end + model.minimumInterval / 2,\n ]\n : [model.start, model.end]\n }\n ticks={automaticTicks?.ticks}\n interval={automaticTicks ? 0 : undefined}\n height={48}\n tickFormatter={model.tooltip}\n tick={\n automaticTicks\n ? ({ x, y, payload, index }: XAxisTickContentProps) => {\n const label = automaticTicks.label(\n Number(payload.value),\n index\n );\n return (\n <text\n x={x}\n y={Number(y) + 5}\n fill=\"var(--atbl-muted)\"\n fontSize=\"var(--atbl-type-meta-size)\"\n textAnchor={\n index === 0\n ? 'start'\n : index === automaticTicks.ticks.length - 1\n ? 'end'\n : 'middle'\n }\n >\n <tspan x={x} dy=\"0.8em\">\n {label.main}\n </tspan>\n {label.context && (\n <tspan x={x} dy=\"1.4em\">\n {label.context}\n </tspan>\n )}\n </text>\n );\n }\n : xAxisDefaults.tick\n }\n {...axisProps}\n type=\"number\"\n dataKey={row =>\n chartTimestamp(\n typeof dataKey === 'function' ? dataKey(row) : field(row, dataKey),\n numeric\n )\n }\n />\n <LinkedTimeCursor times={model.times} axisId={id} />\n </>\n );\n}\n","import {\n createContext,\n useContext,\n useId,\n useEffect,\n type ReactNode,\n} from 'react';\n\n/** Coordinates in the chart SVG, shared by pointer tracking and active samples. */\nexport type ChartPoint = { x: number; y: number };\n\ntype ChartInteractionApi = {\n isPointerInspection: boolean;\n activePoint: ChartPoint | undefined;\n seriesCount: number;\n /** Line and area series register the sample at the current inspection position. */\n registerPoint: (id: string, x: number, y: number) => () => void;\n registerSeries: (id: string) => () => void;\n activeSeriesId: string | null;\n setHoveredSeriesId: (id: string | null) => void;\n};\n\nexport const ChartInteractionContext =\n createContext<ChartInteractionApi | null>(null);\n\nexport function isChartSeriesActive(\n interaction: ChartInteractionApi | null,\n seriesId: string\n) {\n return (\n !interaction?.isPointerInspection ||\n interaction.seriesCount === 1 ||\n interaction.activeSeriesId === seriesId\n );\n}\n\nexport function useChartSeries(id?: string) {\n const generatedId = useId();\n const interaction = useContext(ChartInteractionContext);\n const seriesId = id ?? generatedId;\n const registerSeries = interaction?.registerSeries;\n useEffect(() => registerSeries?.(seriesId), [registerSeries, seriesId]);\n return {\n id: seriesId,\n active: isChartSeriesActive(interaction, seriesId),\n };\n}\n\nexport function ChartSeries({\n id,\n children,\n}: {\n id: string;\n children: ReactNode;\n}) {\n const interaction = useContext(ChartInteractionContext);\n return (\n <g\n onPointerOver={() => interaction?.setHoveredSeriesId(id)}\n onPointerDown={() => interaction?.setHoveredSeriesId(id)}\n >\n {children}\n </g>\n );\n}\n","import { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport { createContext, useContext, useState } from 'react';\n\nexport function chartLegendSeriesKey(id: unknown, dataKey: unknown) {\n if (typeof id === 'string' || typeof id === 'number')\n return ['series', typeof id, id].join(KEY_SEPARATOR);\n if (typeof dataKey === 'string' || typeof dataKey === 'number')\n return ['data', typeof dataKey, dataKey].join(KEY_SEPARATOR);\n return null;\n}\n\nexport type ChartLegendInteraction = {\n hoveredKey: string | null;\n focusedKeys: ReadonlySet<string> | null;\n suppressPlotInspection: boolean;\n hover: (key: string | null) => void;\n toggle: (key: string, keys: readonly string[]) => void;\n reconcile: (keys: readonly string[]) => void;\n registerBarAxis: (key: string, axisId: string | number) => () => void;\n};\n\nexport function reconcileLegendFocus(\n focused: ReadonlySet<string> | null,\n keys: readonly string[]\n) {\n if (!focused) return null;\n const available = new Set(keys);\n const next = new Set([...focused].filter(key => available.has(key)));\n if (next.size === 0 || next.size === available.size) return null;\n return next.size === focused.size ? focused : next;\n}\n\nexport function toggleLegendFocus(\n focused: ReadonlySet<string> | null,\n key: string,\n keys: readonly string[]\n) {\n const current = reconcileLegendFocus(focused, keys);\n if (!current) return new Set([key]);\n const next = new Set(current);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next.size === 0 || next.size === new Set(keys).size ? null : next;\n}\n\nexport const ChartLegendInteractionContext =\n createContext<ChartLegendInteraction | null>(null);\n\nexport function useChartLegendSeries(id: unknown, dataKey: unknown) {\n const interaction = useContext(ChartLegendInteractionContext);\n const key = chartLegendSeriesKey(id, dataKey);\n return {\n inspectingLegend: !!interaction?.suppressPlotInspection,\n hidden: !!(\n key &&\n interaction?.focusedKeys &&\n !interaction.focusedKeys.has(key)\n ),\n dimmed: !!(\n key &&\n interaction?.hoveredKey &&\n (!interaction.focusedKeys ||\n interaction.focusedKeys.has(interaction.hoveredKey)) &&\n interaction.hoveredKey !== key\n ),\n };\n}\n\nexport function useChartLegendFocus(ids: readonly string[]) {\n const [hoveredId, setHoveredId] = useState<string | null>(null);\n const [storedFocusedIds, setStoredFocusedIds] =\n useState<ReadonlySet<string> | null>(null);\n const focusedIds = reconcileLegendFocus(storedFocusedIds, ids);\n function toggle(id: string) {\n setStoredFocusedIds(current => toggleLegendFocus(current, id, ids));\n }\n return {\n hoveredId,\n setHoveredId,\n focusedIds,\n toggle,\n visible: (id: string) => !focusedIds || focusedIds.has(id),\n opacity: (id: string) =>\n focusedIds && !focusedIds.has(id)\n ? 0\n : hoveredId &&\n (!focusedIds || focusedIds.has(hoveredId)) &&\n hoveredId !== id\n ? 0.2\n : 1,\n };\n}\n","import { formatNumber, type MetricFormat } from '@altertable/data-app/format';\nimport { createContext } from 'react';\n\nexport const ChartValueFormat = createContext<MetricFormat | undefined>(\n undefined\n);\n\n/** Use one magnitude for every tick, and enough precision to distinguish them. */\nexport function axisValueFormatter(\n values: readonly number[],\n format?: MetricFormat\n) {\n const magnitude = Math.max(0, ...values.map(Math.abs));\n const compact =\n format?.kind !== 'ratio' &&\n !(format?.kind === 'count' && format.compact === false);\n const exponent =\n compact && magnitude >= 1000\n ? Math.min(12, Math.floor(Math.log10(magnitude) / 3) * 3)\n : 0;\n const divisor = 10 ** exponent;\n const sorted = [...new Set(values)].sort((a, b) => a - b);\n const step = sorted\n .slice(1)\n .reduce(\n (minimum, value, index) => Math.min(minimum, value - sorted[index]!),\n Infinity\n );\n const displayStep = (step / divisor) * (format?.kind === 'ratio' ? 100 : 1);\n const digits =\n Number.isFinite(displayStep) && displayStep > 0\n ? Math.min(20, Math.max(0, -Math.floor(Math.log10(displayStep)) + 1))\n : 2;\n const locale = format?.locale ?? 'en-US';\n const options: Intl.NumberFormatOptions = {\n maximumFractionDigits: digits,\n minimumFractionDigits: 0,\n ...(format?.kind === 'currency'\n ? { style: 'currency', currency: format.currency }\n : {}),\n ...(format?.kind === 'ratio' ? { style: 'percent' } : {}),\n };\n const suffix = ['', 'k', 'M', 'B', 'T'][exponent / 3]!;\n const formatter = new Intl.NumberFormat(locale, options);\n return (value: unknown) => {\n if (typeof value !== 'number') return String(value);\n if (!Number.isFinite(value)) return formatNumber(value);\n const parts = formatter.formatToParts(value === 0 ? 0 : value / divisor);\n const index = parts.findLastIndex(\n part => part.type === 'integer' || part.type === 'fraction'\n );\n return parts\n .map((part, i) => part.value + (i === index && value !== 0 ? suffix : ''))\n .join('');\n };\n}\n","import {\n type ComponentRef,\n Children,\n useId,\n useEffect,\n useRef,\n useState,\n type ComponentPropsWithRef,\n type ReactNode,\n} from 'react';\n\nimport { chartBarFill } from './chartColor.ts';\nimport { classNames } from './classNames.ts';\n\nexport type ChartLegendProps = {\n children: ReactNode;\n /** Single-row fits up to four cells before expansion, adapting to available width. */\n layout?: 'horizontal' | 'vertical' | 'single-row';\n align?: 'start' | 'center' | 'end';\n /** Optional cell cap, including expansion. Horizontal legends default to two rows. */\n maxVisibleItems?: number;\n} & Omit<ComponentPropsWithRef<'ul'>, 'children'>;\n\n/** Optional chart key, placed beside any chart with the app's layout components.\n * Items describe displayed series or categories; the caller owns series visibility and interactions. */\nfunction ChartLegendRoot({\n children,\n layout = 'horizontal',\n align = 'start',\n maxVisibleItems,\n className,\n 'aria-label': ariaLabel = 'Chart legend',\n ...props\n}: ChartLegendProps) {\n const [expanded, setExpanded] = useState(false);\n const listId = useId();\n const containerRef = useRef<ComponentRef<'div'>>(null);\n const [columns, setColumns] = useState(2);\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n function measure() {\n const list = containerRef.current?.querySelector(\n '.altertable-chart-legend'\n );\n if (list) {\n setColumns(\n getComputedStyle(list).gridTemplateColumns.split(' ').length\n );\n }\n }\n const observer = new ResizeObserver(measure);\n observer.observe(container);\n measure();\n return () => observer.disconnect();\n }, [layout]);\n const items = Children.toArray(children);\n const rowCapacity =\n layout === 'vertical' ? 6 : columns * (layout === 'single-row' ? 1 : 2);\n const configuredLimit =\n typeof maxVisibleItems === 'number' && Number.isFinite(maxVisibleItems)\n ? Math.max(1, Math.floor(maxVisibleItems))\n : rowCapacity;\n const cappedLimit = Math.min(configuredLimit, rowCapacity);\n const limit =\n layout === 'vertical'\n ? configuredLimit\n : cappedLimit >= columns\n ? Math.floor(cappedLimit / columns) * columns\n : cappedLimit;\n const visibleCount = items.length > limit ? limit - 1 : limit;\n const hiddenCount = Math.max(0, items.length - visibleCount);\n return (\n <div ref={containerRef} className=\"altertable-chart-legend-container\">\n <ul\n id={listId}\n {...props}\n aria-label={ariaLabel}\n data-layout={layout}\n data-align={align}\n className={classNames('altertable-chart-legend', className)}\n >\n {expanded ? items : items.slice(0, visibleCount)}\n {hiddenCount > 0 && (\n <li className=\"altertable-chart-legend-overflow\">\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action\"\n aria-expanded={expanded}\n aria-controls={props.id ?? listId}\n onClick={() => setExpanded(value => !value)}\n >\n {expanded ? 'Show fewer' : `+${hiddenCount} more`}\n </button>\n </li>\n )}\n </ul>\n </div>\n );\n}\n\nexport type ChartLegendItemProps = ComponentPropsWithRef<'li'> & {\n inactive?: boolean;\n};\n\n/** Descriptive by default; compose a button inside the item for an authored series toggle. */\nfunction ChartLegendItem({\n inactive,\n className,\n ...props\n}: ChartLegendItemProps) {\n return (\n <li\n {...props}\n data-inactive={inactive || undefined}\n className={classNames('altertable-chart-legend-item', className)}\n />\n );\n}\n\nexport type ChartLegendMarkerKind =\n | 'square'\n | 'bar'\n | 'line'\n | 'area'\n | 'point'\n | 'slice';\nexport type ChartLegendMarkerProps = Omit<\n ComponentPropsWithRef<'svg'>,\n 'children'\n> & {\n kind: ChartLegendMarkerKind;\n};\n\n/** Decorative mark; color accepts public palette tokens or any CSS color.\n * Defaults match the shared bar or accent-colored series primitives. */\nfunction ChartLegendMarker({\n kind,\n color = kind === 'bar' ? chartBarFill : 'var(--atbl-chart-1)',\n className,\n style,\n ...props\n}: ChartLegendMarkerProps) {\n return (\n <svg\n {...props}\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox={kind === 'square' ? '0 0 8 8' : '0 0 20 12'}\n data-kind={kind}\n className={classNames('altertable-chart-legend-marker', className)}\n style={{ color, ...style }}\n >\n {kind === 'square' && <rect width=\"8\" height=\"8\" fill=\"currentColor\" />}\n {kind === 'bar' && (\n <path d=\"M6 11V3Q6 1 8 1H12Q14 1 14 3V11Z\" fill=\"currentColor\" />\n )}\n {kind === 'slice' && (\n <rect x=\"5\" y=\"1\" width=\"10\" height=\"10\" rx=\"2\" fill=\"currentColor\" />\n )}\n {kind === 'point' && <circle cx=\"10\" cy=\"6\" r=\"3\" fill=\"currentColor\" />}\n {kind === 'line' && (\n <>\n <path\n d=\"M1 6H19\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n <circle\n cx=\"10\"\n cy=\"6\"\n r=\"2.5\"\n fill=\"var(--atbl-surface)\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n </>\n )}\n {kind === 'area' && (\n <>\n <path\n d=\"M1 10L7 5L13 7L19 2V11H1Z\"\n fill=\"currentColor\"\n fillOpacity=\"0.14\"\n />\n <path\n d=\"M1 10L7 5L13 7L19 2\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </>\n )}\n </svg>\n );\n}\n\nexport type ChartLegendLabelProps = ComponentPropsWithRef<'span'>;\nfunction ChartLegendLabel({\n className,\n children,\n title,\n ...props\n}: ChartLegendLabelProps) {\n return (\n <span\n {...props}\n title={title ?? (typeof children === 'string' ? children : undefined)}\n className={classNames('altertable-chart-legend-label', className)}\n >\n {children}\n </span>\n );\n}\n\nexport const ChartLegend = Object.assign(ChartLegendRoot, {\n Item: ChartLegendItem,\n Marker: ChartLegendMarker,\n Label: ChartLegendLabel,\n});\n","import { useDateAxisLabel, useDateAxisBar } from './chart-date-axis.tsx';\nexport { ChartXAxis } from './chart-date-axis.tsx';\nimport { formatMetric, formatNumber } from '@altertable/data-app/format';\nimport {\n cloneElement,\n isValidElement,\n useContext,\n useLayoutEffect,\n type ComponentProps,\n} from 'react';\nimport {\n Area,\n Dot,\n type DotProps,\n Bar,\n Line,\n Scatter,\n YAxis,\n useYAxisTicks,\n useCartesianChartLayout,\n CartesianGrid,\n Tooltip,\n DefaultTooltipContent,\n type TooltipContentProps,\n type BarProps,\n type LineProps,\n type AreaProps,\n} from 'recharts';\n\nimport {\n ChartInteractionContext,\n ChartSeries,\n useChartSeries,\n isChartSeriesActive,\n} from './chart-interaction.tsx';\nimport {\n ChartLegendInteractionContext,\n chartLegendSeriesKey,\n useChartLegendSeries,\n} from './chart-legend-interaction.tsx';\nimport { ChartValueFormat, axisValueFormatter } from './chart-value-format.ts';\nimport { chartBarFill } from './chartColor.ts';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport { TooltipSurface } from './TooltipSurface.tsx';\nconst seriesColor = 'var(--atbl-chart-1)';\n/** Hollow sample marker shared by standalone and composed series. */\nexport function ChartDot({\n active = false,\n stroke = seriesColor,\n fill = active ? stroke : 'var(--atbl-surface)',\n r = active ? 4.5 : 3,\n ...props\n}: DotProps & { active?: boolean }) {\n return <Dot stroke={stroke} fill={fill} r={r} strokeWidth={2} {...props} />;\n}\n\nfunction NearestChartDot({\n seriesId,\n cx,\n cy,\n stroke,\n}: DotProps & { seriesId: string }) {\n const interaction = useContext(ChartInteractionContext);\n const registerPoint = interaction?.registerPoint;\n const legend = useChartLegendSeries(seriesId, undefined);\n useLayoutEffect(() => {\n if (legend.hidden || cx == null || cy == null) return;\n return registerPoint?.(seriesId, cx, cy);\n }, [registerPoint, seriesId, cx, cy, legend.hidden]);\n const active = !legend.hidden && isChartSeriesActive(interaction, seriesId);\n return active ? (\n <ChartDot\n cx={cx}\n cy={cy}\n stroke={stroke}\n active\n style={{ pointerEvents: 'none' }}\n />\n ) : null;\n}\n\n/** Shared series defaults; native props override every authored choice. */\nexport function ChartBar<Row = unknown, Value = number | null>(\n props: BarProps<Row, Value>\n) {\n useDateAxisBar(props.xAxisId);\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n const interaction = useContext(ChartLegendInteractionContext);\n const layout = useCartesianChartLayout();\n const registerBarAxis = interaction?.registerBarAxis;\n const key = chartLegendSeriesKey(series.id, props.dataKey);\n const axisId =\n layout === 'vertical' ? (props.xAxisId ?? 0) : (props.yAxisId ?? 0);\n useLayoutEffect(\n () => (key && !props.hide ? registerBarAxis?.(key, axisId) : undefined),\n [registerBarAxis, key, axisId, props.hide]\n );\n return (\n <ChartSeries id={series.id}>\n <Bar<Row, Value>\n fill={chartBarFill}\n radius={props.stackId == null ? [5, 5, 0, 0] : 0}\n maxBarSize={30}\n activeBar={series.active ? { opacity: 0.75 } : false}\n isAnimationActive={false}\n {...props}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\n/** Sample dots are opt-in with dot=true.\n * activeDot independently controls the hovered point. Native dot props and renderers remain available. */\nexport function ChartLine<Row = unknown, Value = number | null>({\n stroke = seriesColor,\n dot = false,\n activeDot,\n ...props\n}: LineProps<Row, Value>) {\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n return (\n <ChartSeries id={series.id}>\n <Line<Row, Value>\n type=\"linear\"\n stroke={stroke}\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n dot={\n legend.hidden\n ? false\n : dot === true\n ? ({ cx, cy }) => <ChartDot cx={cx} cy={cy} stroke={stroke} />\n : dot\n }\n activeDot={\n legend.hidden || legend.inspectingLegend\n ? false\n : activeDot === undefined || activeDot === true\n ? ({ cx, cy }) => (\n <NearestChartDot\n seriesId={series.id}\n cx={cx}\n cy={cy}\n stroke={stroke}\n />\n )\n : activeDot\n }\n isAnimationActive={false}\n {...props}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\n/** Filled series with the same sample-dot and activeDot options as ChartLine. */\nexport function ChartArea<Row = unknown, Value = number | null>({\n stroke = seriesColor,\n dot = false,\n activeDot,\n ...props\n}: AreaProps<Row, Value>) {\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n return (\n <ChartSeries id={series.id}>\n <Area<Row, Value>\n legendType=\"square\"\n type=\"linear\"\n stroke={stroke}\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill={stroke}\n fillOpacity={0.14}\n dot={\n legend.hidden\n ? false\n : dot === true\n ? ({ cx, cy }) => <ChartDot cx={cx} cy={cy} stroke={stroke} />\n : dot\n }\n activeDot={\n legend.hidden || legend.inspectingLegend\n ? false\n : activeDot === undefined || activeDot === true\n ? ({ cx, cy }) => (\n <NearestChartDot\n seriesId={series.id}\n cx={cx}\n cy={cy}\n stroke={stroke}\n />\n )\n : activeDot\n }\n isAnimationActive={false}\n {...props}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\nexport function ChartScatter<Row = unknown, Value = number>(\n props: ComponentProps<typeof Scatter<Row, Value>>\n) {\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n return (\n <ChartSeries id={series.id}>\n <Scatter<Row, Value>\n fill={seriesColor}\n isAnimationActive={false}\n {...props}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\nexport function ChartYAxis<Row = unknown, Value = number>(\n props: ComponentProps<typeof YAxis<Row, Value>>\n) {\n const format = useContext(ChartValueFormat);\n const ticks = useYAxisTicks(props.yAxisId);\n const formatter = axisValueFormatter(\n (ticks ?? [])\n .map(tick => tick.value)\n .filter((value): value is number => typeof value === 'number'),\n format\n );\n return (\n <YAxis<Row, Value>\n width=\"auto\"\n stroke=\"var(--atbl-muted)\"\n tickFormatter={formatter}\n tickLine={false}\n axisLine={false}\n tick={{ fontSize: 'var(--atbl-type-meta-size)' }}\n {...props}\n />\n );\n}\n\nexport function ChartGrid(props: ComponentProps<typeof CartesianGrid>) {\n return (\n <CartesianGrid stroke=\"var(--atbl-border)\" vertical={false} {...props} />\n );\n}\n\nexport function ChartTooltipContent(\n props: ComponentProps<typeof DefaultTooltipContent> & { active?: boolean }\n) {\n const valueFormat = useContext(ChartValueFormat);\n function formatValue(value: number) {\n return valueFormat ? formatMetric(value, valueFormat) : formatNumber(value);\n }\n if (!props.active || !props.payload?.length) return null;\n return (\n <TooltipSurface data-variant=\"chart\" role=\"tooltip\">\n <DefaultTooltipContent\n {...props}\n separator=\"\"\n payload={props.payload?.map(entry => ({\n ...entry,\n unit: undefined,\n formatter: (value, name, _item, index, payload) => {\n const formatter = entry.formatter ?? props.formatter;\n const formatted = formatter\n ? formatter(value, name, entry, index, props.payload ?? payload)\n : Array.isArray(value)\n ? value\n .map(item =>\n typeof item === 'number' ? formatValue(item) : item\n )\n .join(' ~ ')\n : typeof value === 'number'\n ? formatValue(value)\n : value;\n if (formatted == null) return null;\n const [displayValue, displayName] = Array.isArray(formatted)\n ? formatted\n : [formatted, name];\n return [\n <span\n key={entry.graphicalItemId}\n className=\"altertable-chart-tooltip-row\"\n >\n <ChartLegend.Marker\n kind=\"square\"\n className=\"altertable-chart-tooltip-marker\"\n color={\n entry.color ??\n entry.stroke ??\n entry.fill ??\n 'var(--atbl-chart-1)'\n }\n />\n <span className=\"altertable-chart-tooltip-reading\">\n {displayName}\n {displayName !== undefined && displayName !== ''\n ? (props.separator ?? ' : ')\n : ''}\n {displayValue}\n {entry.unit}\n </span>\n </span>,\n '',\n ];\n },\n }))}\n contentStyle={{\n margin: 0,\n padding: 0,\n background: 'transparent',\n border: 0,\n whiteSpace: 'normal',\n ...props.contentStyle,\n }}\n labelStyle={{\n color: 'var(--atbl-text)',\n fontSize: 'var(--atbl-type-body-size)',\n fontWeight: 650,\n lineHeight: 1.2,\n ...props.labelStyle,\n }}\n itemStyle={{\n color: 'var(--atbl-text)',\n paddingTop: 2,\n paddingBottom: 0,\n ...props.itemStyle,\n }}\n />\n </TooltipSurface>\n );\n}\n\n/** Uses the same surface as single-series inspection; Recharts owns interaction. */\nexport function ChartTooltip(props: ComponentProps<typeof Tooltip>) {\n const dateLabel = useDateAxisLabel(props.axisId);\n const interaction = useContext(ChartInteractionContext);\n const legendInteraction = useContext(ChartLegendInteractionContext);\n const { content: authoredContent, ...tooltipProps } = props;\n return (\n <Tooltip\n labelFormatter={dateLabel}\n position={\n interaction?.isPointerInspection && interaction.activePoint\n ? { y: interaction.activePoint.y }\n : undefined\n }\n cursor={false}\n isAnimationActive={false}\n {...tooltipProps}\n content={content => {\n if (legendInteraction?.suppressPlotInspection) return null;\n const payload = (\n interaction?.isPointerInspection &&\n interaction.seriesCount !== 1 &&\n props.shared !== true\n ? content.payload.filter(\n entry => entry.graphicalItemId === interaction.activeSeriesId\n )\n : content.payload\n ).filter(entry => {\n if (!legendInteraction?.focusedKeys) return true;\n const key = chartLegendSeriesKey(\n entry.graphicalItemId,\n entry.dataKey\n );\n return key == null || legendInteraction.focusedKeys.has(key);\n });\n const filtered: TooltipContentProps = { ...content, payload };\n if (typeof authoredContent === 'function')\n return authoredContent(filtered);\n if (isValidElement<TooltipContentProps>(authoredContent))\n return cloneElement(authoredContent, filtered);\n return <ChartTooltipContent {...filtered} />;\n }}\n />\n );\n}\n","import { useLayoutEffect, useRef, type ComponentRef } from 'react';\n\n/** Keep the latest supplied samples visible when the displayed items change. */\nexport function useChartScrollToEnd(items: readonly unknown[]) {\n const scrollport = useRef<ComponentRef<'div'>>(null);\n useLayoutEffect(() => {\n const element = scrollport.current;\n if (element) element.scrollLeft = element.scrollWidth - element.clientWidth;\n }, [items]);\n return scrollport;\n}\n","import { formatNumber } from '@altertable/data-app/format';\nimport {\n Fragment,\n useRef,\n useState,\n type ComponentRef,\n type RefObject,\n type PointerEvent,\n type MouseEvent as ReactMouseEvent,\n} from 'react';\nimport {\n AreaChart as RechartsAreaChart,\n LineChart as RechartsLineChart,\n ReferenceLine,\n} from 'recharts';\n\nimport type { CartesianChartItem, CartesianChartProps } from './chart-data.ts';\nimport { validateValueChartItems } from './chart-data.ts';\nimport {\n ChartArea,\n ChartLine,\n ChartDot,\n ChartXAxis,\n ChartYAxis,\n ChartGrid,\n} from './chart-primitives.tsx';\nimport { ChartTooltip } from './ChartTooltip.tsx';\nimport {\n ExplorationActionControl,\n useChartActions,\n explorationMenuEvents,\n ExplorationActionMenu,\n getPrimaryExplorationAction,\n} from './ExplorationActionControl.tsx';\nimport { MenuButton, MenuTrigger } from './Menu.tsx';\nimport { useLinkedChartCursor } from './use-chart-cursor-group.tsx';\nimport { useChartScrollToEnd } from './use-chart-scroll-to-end.ts';\n\n/** Ordered, equally spaced samples; negative values share an explicit zero baseline. */\nexport function TrendChart<Row extends CartesianChartItem>({\n items,\n unit,\n ariaLabel,\n formatValue = formatNumber,\n kind,\n itemActions,\n cursorGroup,\n horizontalGrid = false,\n}: CartesianChartProps<Row> & { kind: 'line' | 'area' }) {\n validateValueChartItems(kind, items);\n const Plot = kind === 'area' ? RechartsAreaChart : RechartsLineChart;\n const chartActions = useChartActions();\n const cursor = useLinkedChartCursor(cursorGroup);\n const linkedItem = items.find(\n item => item.time === cursor.time && cursor.time != null\n );\n const [activeIndex, setActiveIndex] = useState<number>();\n const [nearestIndex, setNearestIndex] = useState<number>();\n const [mouseVisible, setMouseVisible] = useState(false);\n const nearest = useRef<number | undefined>(undefined);\n const points = useRef(new Map<number, { x: number; y: number }>());\n const plotRef = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLDivElement>(null);\n const highlightedIndex = mouseVisible ? nearestIndex : activeIndex;\n const scrollport = useChartScrollToEnd(items);\n const menuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n const magnitude = items.reduce(\n (max, item) => Math.max(max, Math.abs(item.value)),\n 1\n );\n const low = items.reduce(\n (min, item) => Math.min(min, item.value / magnitude),\n 0\n );\n const high = items.reduce(\n (max, item) => Math.max(max, item.value / magnitude),\n 0\n );\n function screenPoint(index: number | undefined) {\n if (index == null) return null;\n const point = points.current.get(index);\n const matrix = plotRef.current?.querySelector('svg')?.getScreenCTM();\n return point && matrix\n ? new DOMPoint(point.x, point.y).matrixTransform(matrix)\n : null;\n }\n function inspectNearest(event: PointerEvent<HTMLSpanElement>) {\n if (event.pointerType !== 'mouse') return;\n const matrix = plotRef.current?.querySelector('svg')?.getScreenCTM();\n if (!matrix) return;\n let distance = Infinity;\n let selected: number | undefined;\n const viewport = scrollport.current?.getBoundingClientRect();\n const overLabels =\n event.clientY >=\n (plotRef.current?.getBoundingClientRect().top ?? 0) + 220;\n for (let index = 0; index < items.length; index++) {\n const sample = points.current.get(index);\n if (!sample) continue;\n const point = new DOMPoint(sample.x, sample.y).matrixTransform(matrix);\n if (viewport && (point.x < viewport.left || point.x > viewport.right))\n continue;\n const candidate = overLabels\n ? Math.abs(point.x - event.clientX)\n : Math.hypot(point.x - event.clientX, point.y - event.clientY);\n if (candidate < distance) {\n distance = candidate;\n selected = index;\n }\n }\n nearest.current = selected;\n setNearestIndex(selected);\n cursor.setTime(selected == null ? undefined : items[selected]?.time);\n }\n function inspectAction(event: ReactMouseEvent<HTMLDivElement>) {\n if (\n !mouseVisible ||\n nearest.current == null ||\n !(event.target instanceof Element)\n )\n return;\n if (\n event.clientY >=\n (plotRef.current?.getBoundingClientRect().top ?? 0) + 220\n )\n return;\n if (event.type === 'click' && event.detail === 0) return;\n if (\n event.type === 'contextmenu' &&\n event.clientX === 0 &&\n event.clientY === 0\n )\n return;\n const target = event.target.closest('.altertable-trend-point');\n const selected = plotRef.current?.querySelectorAll<HTMLButtonElement>(\n '.altertable-trend-point'\n )[nearest.current];\n if (!target || !selected || target === selected) return;\n event.preventDefault();\n event.stopPropagation();\n if (event.type === 'click') selected.click();\n else\n selected.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n cancelable: true,\n button: 2,\n clientX: event.clientX,\n clientY: event.clientY,\n })\n );\n }\n return (\n <section\n className=\"altertable-trend-chart\"\n aria-label={ariaLabel}\n onPointerLeave={cursor.reset}\n onKeyDownCapture={cursor.reset}\n onPointerDownCapture={event => {\n if (event.pointerType !== 'mouse') cursor.reset();\n }}\n >\n {items.length === 0 && <span>No data</span>}\n {items.length > 0 && (\n <>\n <div className=\"altertable-trend-scroll\" ref={scrollport}>\n <div\n className=\"altertable-trend-plot\"\n ref={plotRef}\n style={{ minWidth: items.length * 40 }}\n >\n <div\n className=\"altertable-chart-canvas\"\n aria-hidden=\"true\"\n ref={canvasRef}\n >\n <Plot\n data={items.map(item => ({\n ...item,\n plotValue: item.value / magnitude,\n }))}\n responsive\n width=\"100%\"\n height={220}\n margin={{ top: 12, right: 0, bottom: 12, left: 0 }}\n accessibilityLayer={false}\n tabIndex={-1}\n >\n <ChartXAxis hide dataKey=\"id\" scale=\"band\" />\n <ChartYAxis\n hide\n domain={[low, high === low ? low + 1 : high]}\n />\n <ReferenceLine y={0} stroke=\"var(--atbl-border)\" />\n {horizontalGrid && <ChartGrid />}\n {kind === 'area' && (\n <ChartArea\n dataKey=\"plotValue\"\n stroke=\"none\"\n fill=\"var(--atbl-chart-1)\"\n dot={false}\n activeDot={false}\n />\n )}\n <ChartLine\n dataKey=\"plotValue\"\n dot={({ cx, cy, index }) => {\n if (index != null && cx != null && cy != null)\n points.current.set(index, { x: cx, y: cy });\n return (\n <g\n data-atbl-internal-sample={index}\n transform={`translate(${cx}, ${cy})`}\n >\n {index === highlightedIndex && (\n <ChartDot cx={0} cy={0} active />\n )}\n </g>\n );\n }}\n activeDot={false}\n />\n {linkedItem && (\n <ReferenceLine\n x={linkedItem.id}\n stroke=\"var(--atbl-muted)\"\n strokeOpacity={0.3}\n pointerEvents=\"none\"\n data-atbl-internal-linked-cursor=\"true\"\n />\n )}\n </Plot>\n </div>\n <ChartTooltip\n variant=\"chart\"\n touchInspection={false}\n boundaryRefs={[canvasRef, scrollport]}\n onPointerEnter={inspectNearest}\n onPointerMove={inspectNearest}\n onPointerLeave={cursor.reset}\n onOpenChange={setMouseVisible}\n anchorRect={() => {\n const point = screenPoint(nearest.current);\n return point ? new DOMRect(point.x, point.y, 0, 0) : null;\n }}\n content={\n nearestIndex == null || !items[nearestIndex] ? null : (\n <>\n <strong>{items[nearestIndex].label}</strong>\n <span>\n {formatValue(items[nearestIndex].value)} {unit}\n </span>\n </>\n )\n }\n >\n <div\n className=\"altertable-trend-points\"\n onClickCapture={inspectAction}\n onContextMenuCapture={inspectAction}\n >\n {items.map((item, index) => {\n const declaredActions = itemActions?.(item) ?? [];\n const actions = chartActions.actions(\n declaredActions,\n item.label,\n `${formatValue(item.value)} ${unit}`\n );\n const action = getPrimaryExplorationAction(actions);\n const menuTrigger: RefObject<ComponentRef<'button'> | null> =\n {\n get current() {\n return menuTriggers.current.get(item.id) ?? null;\n },\n };\n return (\n <Fragment key={item.id}>\n <div className=\"altertable-chart-item-actions\">\n <ChartTooltip\n variant=\"chart\"\n mouseHover={false}\n followCursor={false}\n onOpenChange={open =>\n setActiveIndex(current =>\n open\n ? index\n : current === index\n ? undefined\n : current\n )\n }\n content={\n <>\n <strong>{item.label}</strong>\n <span>\n {formatValue(item.value)} {unit}\n </span>\n </>\n }\n className=\"altertable-chart-column\"\n >\n {action ? (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n type=\"button\"\n className=\"altertable-trend-point\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. ${action.label}`}\n {...explorationMenuEvents(menuTrigger)}\n onClick={event =>\n action.onSelect(event.currentTarget)\n }\n >\n <span className=\"altertable-trend-hit\" />\n <span className=\"altertable-trend-label\">\n {item.label}\n </span>\n </button>\n ) : actions.length > 1 ? (\n <MenuTrigger>\n <MenuButton\n {...explorationMenuEvents(menuTrigger)}\n ref={element => {\n if (element)\n menuTriggers.current.set(\n item.id,\n element\n );\n else menuTriggers.current.delete(item.id);\n }}\n className=\"altertable-trend-point\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. Actions`}\n >\n <span className=\"altertable-trend-hit\" />\n <span className=\"altertable-trend-label\">\n {item.label}\n </span>\n </MenuButton>\n <ExplorationActionMenu\n actions={actions}\n ariaLabel={`${item.label} actions`}\n triggerRef={menuTrigger}\n />\n </MenuTrigger>\n ) : (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n type=\"button\"\n tabIndex={-1}\n className=\"altertable-trend-point\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}`}\n >\n <span className=\"altertable-trend-hit\" />\n <span className=\"altertable-trend-label\">\n {item.label}\n </span>\n </button>\n )}\n </ChartTooltip>\n {action && (\n <ExplorationActionControl\n contextOnly={declaredActions.length === 1}\n indicator=\"chevron\"\n ref={element => {\n if (element)\n menuTriggers.current.set(item.id, element);\n else menuTriggers.current.delete(item.id);\n }}\n actions={actions}\n ariaLabel={`${item.label} actions`}\n hidePrimary={Boolean(action)}\n />\n )}\n </div>\n </Fragment>\n );\n })}\n </div>\n </ChartTooltip>\n </div>\n </div>\n </>\n )}\n {chartActions.feedback}\n </section>\n );\n}\n","import {\n type CartesianChartItem,\n type CartesianChartProps,\n} from './chart-data.ts';\nimport { TrendChart } from './TrendChart.tsx';\n\nexport type LineChartItem = CartesianChartItem;\nexport type LineChartProps<Row extends LineChartItem = LineChartItem> =\n CartesianChartProps<Row>;\n\n/** Equally spaced finite samples in supplied order; fill missing periods explicitly.\n * Supports negative values, single points, and horizontal scrolling for long series.\n * Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */\nexport function LineChart<Row extends LineChartItem>(\n props: LineChartProps<Row>\n) {\n return <TrendChart {...props} kind=\"line\" />;\n}\n","import {\n type CartesianChartItem,\n type CartesianChartProps,\n} from './chart-data.ts';\nimport { TrendChart } from './TrendChart.tsx';\n\nexport type AreaChartItem = CartesianChartItem;\nexport type AreaChartProps<Row extends AreaChartItem = AreaChartItem> =\n CartesianChartProps<Row>;\n\n/** Ordered finite samples filled to a zero baseline, including negative values.\n * Samples are equally spaced; supply missing periods explicitly.\n * Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */\nexport function AreaChart<Row extends AreaChartItem>(\n props: AreaChartProps<Row>\n) {\n return <TrendChart {...props} kind=\"area\" />;\n}\n","import { useRef, useState, type ComponentRef, type RefObject } from 'react';\n\nimport type { ChartItem, ValueChartProps } from './chart-data.ts';\nimport { validateValueChartItems } from './chart-data.ts';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport {\n ExplorationActionControl,\n useChartActions,\n explorationMenuEvents,\n ExplorationActionMenu,\n getPrimaryExplorationAction,\n} from './ExplorationActionControl.tsx';\nimport { AppIcon } from './icons.ts';\nimport { MenuButton, MenuTrigger } from './Menu.tsx';\nimport { Tooltip } from './Tooltip.tsx';\n\nexport type PieChartItem = ChartItem;\nexport type PieChartProps<Row extends PieChartItem = PieChartItem> =\n ValueChartProps<Row> & {\n /** Omit the built-in key when composing a separate ChartLegend. */\n showLegend?: boolean;\n };\n\n/** Nonnegative, mutually exclusive parts; shares use the sum of supplied items.\n * Include Other to represent the whole. Zero values remain in the legend; all-zero\n * data shows an empty circle. Colors follow item order. Compose inside VisualizationWidget;\n * hover/touch tooltips coordinate slice and legend emphasis without caller state. */\nexport function PieChart<Row extends PieChartItem>({\n items,\n unit,\n ariaLabel,\n showLegend = true,\n formatValue = value => new Intl.NumberFormat().format(value),\n itemActions,\n}: PieChartProps<Row>) {\n validateValueChartItems('pie', items);\n const chartActions = useChartActions();\n const [previewId, setPreviewId] = useState<string | null>(null);\n const [plotOpen, setPlotOpen] = useState(false);\n const [legendId, setLegendId] = useState<string | null>(null);\n const menuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n const plotMenuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n const maximum = items.reduce((max, item) => Math.max(max, item.value), 0);\n const total = maximum\n ? items.reduce((sum, item) => sum + item.value / maximum, 0)\n : 0;\n let cursor = -Math.PI / 2;\n const slices: {\n row: Row;\n share: number;\n color: string;\n path: string;\n }[] = [];\n for (const [index, item] of items.entries()) {\n const share = total ? item.value / maximum / total : 0;\n const start = cursor;\n cursor += share * Math.PI * 2;\n const middle = (start + cursor) / 2;\n function point(angle: number) {\n return `${110 + Math.cos(angle) * 100},${110 + Math.sin(angle) * 100}`;\n }\n slices.push({\n row: item,\n share,\n color: `var(--atbl-chart-${(index % 8) + 1})`,\n path: `${share === 1 ? 'M' : 'M110,110 L'}${point(start)} A100,100 0 0 1 ${point(middle)} A100,100 0 0 1 ${point(cursor)} Z`,\n });\n }\n function percent(share: number) {\n return new Intl.NumberFormat('en-US', {\n style: 'percent',\n maximumFractionDigits: 1,\n }).format(share);\n }\n function detail(slice: (typeof slices)[number]) {\n const item = slice.row;\n return (\n <>\n <strong>{item.label}</strong>\n <span>\n {formatValue(item.value)} {unit} · {percent(slice.share)}\n </span>\n </>\n );\n }\n function actionsFor(slice: (typeof slices)[number]) {\n const item = slice.row;\n return chartActions.actions(\n itemActions?.(item) ?? [],\n item.label,\n `${formatValue(item.value)} ${unit} · ${percent(slice.share)}`\n );\n }\n const preview = slices.find(slice => slice.row.id === previewId);\n return (\n <section className=\"altertable-pie-chart\" aria-label={ariaLabel}>\n {items.length === 0 && <span>No data</span>}\n {items.length > 0 && (\n <>\n <div className=\"altertable-pie-plot\">\n <Tooltip\n variant=\"chart\"\n className=\"altertable-pie-tooltip\"\n onOpenChange={setPlotOpen}\n content={preview ? detail(preview) : null}\n >\n <svg\n viewBox=\"0 0 220 220\"\n aria-hidden={itemActions ? undefined : true}\n aria-label={itemActions ? ariaLabel : undefined}\n focusable={itemActions ? undefined : false}\n role={itemActions ? 'group' : undefined}\n >\n {total === 0 ? (\n <circle\n cx=\"110\"\n cy=\"110\"\n r=\"100\"\n className=\"altertable-pie-empty\"\n />\n ) : (\n slices\n .filter(slice => slice.share > 0)\n .map(slice => {\n const item = slice.row;\n const menuTrigger = {\n get current() {\n return (\n menuTriggers.current.get(item.id) ??\n plotMenuTriggers.current.get(item.id) ??\n null\n );\n },\n };\n const action = getPrimaryExplorationAction(\n actionsFor(slice)\n );\n const opensMenu =\n !action && (itemActions?.(item).length ?? 0) > 1;\n return (\n <path\n key={item.id}\n d={slice.path}\n fill={slice.color}\n className=\"altertable-pie-slice\"\n data-active={\n item.id ===\n (plotOpen && previewId\n ? previewId\n : showLegend\n ? legendId\n : null) || undefined\n }\n onPointerDown={event => {\n if (plotOpen && previewId !== item.id)\n event.preventDefault();\n setPreviewId(item.id);\n }}\n onClick={event => {\n if (action) action.onSelect(event.currentTarget);\n else if (opensMenu) menuTrigger.current?.click();\n }}\n onContextMenu={\n explorationMenuEvents(menuTrigger).onContextMenu\n }\n onKeyDown={event => {\n explorationMenuEvents(menuTrigger).onKeyDown(event);\n if (\n (action || opensMenu) &&\n (event.key === 'Enter' || event.key === ' ')\n ) {\n event.preventDefault();\n if (action) action.onSelect(event.currentTarget);\n else menuTrigger.current?.click();\n }\n }}\n aria-label={\n action\n ? `${item.label}: ${formatValue(item.value)} ${unit}. ${action.label}`\n : opensMenu\n ? `${item.label}: ${formatValue(item.value)} ${unit}. Actions`\n : undefined\n }\n role={action || opensMenu ? 'button' : undefined}\n data-atbl-control={\n action || opensMenu ? 'action' : undefined\n }\n tabIndex={action || opensMenu ? 0 : undefined}\n onPointerEnter={event => {\n if (event.pointerType === 'mouse')\n setPreviewId(item.id);\n }}\n onPointerLeave={event => {\n if (event.pointerType === 'mouse')\n setPreviewId(null);\n }}\n />\n );\n })\n )}\n </svg>\n </Tooltip>\n {slices.map(slice => {\n const item = slice.row;\n const actions = actionsFor(slice);\n if (actions.length === 0) return null;\n return (\n <span key={item.id} className=\"altertable-sr-only\">\n <ExplorationActionControl\n ref={element => {\n if (element)\n plotMenuTriggers.current.set(item.id, element);\n else plotMenuTriggers.current.delete(item.id);\n }}\n actions={actions}\n ariaLabel={`${item.label} actions`}\n contextOnly\n hidePrimary\n />\n </span>\n );\n })}\n {total === 0 && (\n <span className=\"altertable-pie-empty-label\">\n No nonzero values\n </span>\n )}\n </div>\n {showLegend && (\n <ChartLegend\n layout=\"vertical\"\n aria-label={`${ariaLabel} legend`}\n className=\"altertable-pie-legend\"\n >\n {slices.map(slice => {\n const item = slice.row;\n const actions = actionsFor(slice);\n const menuTrigger: RefObject<ComponentRef<'button'> | null> = {\n get current() {\n return menuTriggers.current.get(item.id) ?? null;\n },\n };\n const label = `${item.label}: ${formatValue(item.value)} ${unit}, ${percent(slice.share)}${actions.length ? '. Actions' : ''}`;\n const contents = (\n <>\n <ChartLegend.Marker kind=\"square\" color={slice.color} />\n <ChartLegend.Label className=\"altertable-pie-label\">\n {item.label}\n </ChartLegend.Label>\n {actions.length > 0 && (\n <AppIcon\n name=\"moreActions\"\n size={14}\n className=\"altertable-pie-menu-indicator\"\n />\n )}\n <strong className=\"altertable-pie-value\">\n {formatValue(item.value)}\n </strong>\n <span className=\"altertable-pie-share\">\n {percent(slice.share)}\n </span>\n </>\n );\n return (\n <ChartLegend.Item key={item.id}>\n <Tooltip\n variant=\"chart\"\n content={detail(slice)}\n onOpenChange={open =>\n setLegendId(current =>\n open ? item.id : current === item.id ? null : current\n )\n }\n >\n {actions.length ? (\n <MenuTrigger>\n <MenuButton\n {...explorationMenuEvents(menuTrigger)}\n ref={element => {\n if (element)\n menuTriggers.current.set(item.id, element);\n else menuTriggers.current.delete(item.id);\n }}\n aria-label={label}\n >\n {contents}\n </MenuButton>\n <ExplorationActionMenu\n actions={actions}\n ariaLabel={item.label}\n triggerRef={menuTrigger}\n placement=\"bottom start\"\n />\n </MenuTrigger>\n ) : (\n <button\n type=\"button\"\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n tabIndex={-1}\n aria-label={label}\n >\n {contents}\n </button>\n )}\n </Tooltip>\n </ChartLegend.Item>\n );\n })}\n </ChartLegend>\n )}\n </>\n )}\n {chartActions.feedback}\n </section>\n );\n}\n","import { validateScatterChartItems } from './chart-data.ts';\nimport type { ScatterChartItem, HorizontalGridProps } from './chart-data.ts';\nimport { Tooltip } from './Tooltip.tsx';\nexport type { ScatterChartItem } from './chart-data.ts';\nexport type ScatterChartProps = HorizontalGridProps & {\n items: readonly ScatterChartItem[];\n xLabel: string;\n yLabel: string;\n xUnit: string;\n yUnit: string;\n ariaLabel: string;\n formatX?: (value: number) => string;\n formatY?: (value: number) => string;\n};\n\nfunction formatNumber(value: number) {\n return new Intl.NumberFormat(undefined, { maximumFractionDigits: 1 }).format(\n value\n );\n}\n\nfunction scale(values: readonly number[]) {\n const magnitude = values.reduce(\n (max, value) => Math.max(max, Math.abs(value)),\n 1\n );\n const low = values.reduce(\n (min, value) => Math.min(min, value / magnitude),\n 0\n );\n const high =\n values.reduce((max, value) => Math.max(max, value / magnitude), 0) ||\n (low === 0 ? 1 : 0);\n const span = high - low;\n return {\n position(value: number) {\n return ((value / magnitude - low) / span) * 100;\n },\n ticks: [low, low + span / 2, high].map(value => value * magnitude),\n };\n}\n\n/** Independent finite X/Y observations on linear axes that include zero.\n * Negative and constant coordinates are supported. Axis labels and units describe\n * tooltips as well as the plot; formatX/formatY format ticks and tooltip values.\n * Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */\nexport function ScatterChart({\n items,\n xLabel,\n yLabel,\n xUnit,\n yUnit,\n ariaLabel,\n formatX = formatNumber,\n formatY = formatNumber,\n horizontalGrid = true,\n}: ScatterChartProps) {\n validateScatterChartItems(items);\n const xScale = scale(items.map(item => item.x));\n const yScale = scale(items.map(item => item.y));\n return (\n <section className=\"altertable-scatter-chart\" aria-label={ariaLabel}>\n {items.length === 0 && <span>No data</span>}\n {items.length > 0 && (\n <>\n <p className=\"altertable-scatter-axis-title\">\n {yLabel}\n {yUnit && ` (${yUnit})`}\n </p>\n <div className=\"altertable-scatter-axes\">\n <div className=\"altertable-scatter-plot\">\n {yScale.ticks.map((value, index) => (\n <div\n key={index}\n className=\"altertable-scatter-gridline\"\n style={{\n bottom: `${index * 50}%`,\n borderTopStyle: horizontalGrid ? undefined : 'none',\n }}\n aria-hidden=\"true\"\n >\n <span title={formatY(value)}>{formatY(value)}</span>\n </div>\n ))}\n {xScale.ticks.map((value, index) => (\n <span\n key={index}\n className=\"altertable-scatter-x-tick\"\n data-edge={index}\n style={{ left: `${index * 50}%` }}\n aria-hidden=\"true\"\n title={formatX(value)}\n >\n {formatX(value)}\n </span>\n ))}\n {items.map(item => (\n <Tooltip\n key={item.id}\n variant=\"chart\"\n content={\n <>\n <strong>{item.label}</strong>\n <span>\n {xLabel}: {formatX(item.x)} {xUnit}\n </span>\n <span>\n {yLabel}: {formatY(item.y)} {yUnit}\n </span>\n </>\n }\n className=\"altertable-scatter-tooltip\"\n style={{\n left: `${xScale.position(item.x)}%`,\n bottom: `${yScale.position(item.y)}%`,\n }}\n >\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n type=\"button\"\n tabIndex={-1}\n className=\"altertable-scatter-point\"\n aria-label={`${item.label}: ${xLabel} ${formatX(item.x)} ${xUnit}, ${yLabel} ${formatY(item.y)} ${yUnit}`}\n >\n <span />\n </button>\n </Tooltip>\n ))}\n </div>\n </div>\n <p className=\"altertable-scatter-axis-title altertable-scatter-x-title\">\n {xLabel}\n {xUnit && ` (${xUnit})`}\n </p>\n </>\n )}\n </section>\n );\n}\n","import { formatNumber } from '@altertable/data-app/format';\nimport {\n Fragment,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentRef,\n type RefObject,\n} from 'react';\nimport {\n BarChart as RechartsBarChart,\n Cell,\n type BarShapeProps,\n} from 'recharts';\n\nimport {\n validateValueChartItems,\n type ChartItem,\n type CartesianChartProps,\n} from './chart-data.ts';\nimport {\n ChartBar,\n ChartGrid,\n ChartXAxis,\n ChartYAxis,\n} from './chart-primitives.tsx';\nimport { chartBarFill } from './chartColor.ts';\nimport { ChartTooltip } from './ChartTooltip.tsx';\nimport {\n openExplorationMenu,\n useChartActions,\n explorationMenuEvents,\n ExplorationActionMenu,\n getPrimaryExplorationAction,\n} from './ExplorationActionControl.tsx';\nimport { AppIcon } from './icons.ts';\nimport { MenuButton, MenuTrigger } from './Menu.tsx';\nimport { useLinkedChartCursor } from './use-chart-cursor-group.tsx';\nimport { useChartScrollToEnd } from './use-chart-scroll-to-end.ts';\n\nexport type BarChartItem = ChartItem & {\n /** Milliseconds since the Unix epoch. Enables adaptive time ticks when no item actions are supplied. */\n time?: number;\n};\n\nconst timeTickIntervals = [\n 60_000,\n 2 * 60_000,\n 5 * 60_000,\n 10 * 60_000,\n 15 * 60_000,\n 30 * 60_000,\n 60 * 60_000,\n 2 * 60 * 60_000,\n 6 * 60 * 60_000,\n 12 * 60 * 60_000,\n 24 * 60 * 60_000,\n 2 * 24 * 60 * 60_000,\n 7 * 24 * 60 * 60_000,\n 14 * 24 * 60 * 60_000,\n];\n\nfunction timeTickIndices(items: readonly BarChartItem[], width: number) {\n if (items.length === 1) return new Set([0]);\n if (items.length < 2 || width <= 0) return new Set<number>();\n const slotWidth = width / items.length;\n const cadence = (items.at(-1)!.time! - items[0]!.time!) / (items.length - 1);\n const minimumInterval = Math.max(cadence, (100 / slotWidth) * cadence);\n const interval =\n timeTickIntervals.find(candidate => candidate >= minimumInterval) ??\n Math.ceil(minimumInterval / timeTickIntervals.at(-1)!) *\n timeTickIntervals.at(-1)!;\n const indices = new Set<number>();\n const stride = Math.max(1, Math.ceil(interval / cadence));\n const count = Math.max(\n 1,\n Math.min(\n Math.floor((items.length - 1) / stride) + 1,\n Math.floor(Math.max(0, width - 60) / (stride * slotWidth)) + 1\n )\n );\n // Center the tick sequence within the supplied window so rolling windows\n // have balanced edge margins as well as a consistent interval.\n const start = Math.floor((items.length - 1 - (count - 1) * stride) / 2);\n for (let tick = 0; tick < count; tick++) {\n indices.add(start + tick * stride);\n }\n return indices;\n}\n\nexport type BarChartProps<Row extends BarChartItem = BarChartItem> =\n CartesianChartProps<Row>;\n\n/** Nonnegative category values. Compose inside VisualizationWidget for a titled panel.\n * Owns hover/touch tooltips; no selection state or keyboard navigation. */\nexport function BarChart<Row extends BarChartItem>({\n items,\n unit,\n ariaLabel,\n formatValue = formatNumber,\n itemActions,\n cursorGroup,\n horizontalGrid = false,\n}: BarChartProps<Row>) {\n validateValueChartItems('bar', items);\n const chartActions = useChartActions();\n const cursor = useLinkedChartCursor(cursorGroup);\n const linkedItem = items.find(\n item => item.time === cursor.time && cursor.time != null\n );\n const [activeId, setActiveId] = useState<string>();\n const [viewportWidth, setViewportWidth] = useState(0);\n const scrollport = useChartScrollToEnd(items);\n const plotRef = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLDivElement>(null);\n const menuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n\n const maximum = items.reduce((max, item) => Math.max(max, item.value), 1);\n const hasTimeAxis =\n items.length > 0 &&\n items.every(\n (item, index) =>\n typeof item.time === 'number' &&\n Number.isFinite(item.time) &&\n (index === 0 || item.time > items[index - 1]!.time!)\n );\n const compactTimeAxis = hasTimeAxis && !itemActions;\n const minimumSlotWidth = compactTimeAxis ? 3.5 : 45;\n const plotWidth = Math.max(viewportWidth, items.length * minimumSlotWidth);\n const ticks = compactTimeAxis ? timeTickIndices(items, plotWidth) : null;\n\n useLayoutEffect(() => {\n const element = scrollport.current;\n if (!element) return;\n function updateWidth() {\n // clientWidth rounds up fractional grid widths, which can create a\n // scrollbar and feed a different width back into this observer.\n setViewportWidth(Math.floor(element!.getBoundingClientRect().width));\n }\n updateWidth();\n const observer = new ResizeObserver(updateWidth);\n observer.observe(element);\n return () => observer.disconnect();\n }, [scrollport]);\n\n return (\n <section\n className=\"altertable-selectable-bars\"\n aria-label={ariaLabel}\n onPointerLeave={cursor.reset}\n onKeyDownCapture={cursor.reset}\n onPointerDownCapture={event => {\n if (event.pointerType !== 'mouse') cursor.reset();\n }}\n >\n {items.length === 0 && <span>No data</span>}\n <div\n className=\"altertable-selectable-bars-scroll\"\n data-time-axis={compactTimeAxis || undefined}\n ref={scrollport}\n >\n <div\n className=\"altertable-selectable-bars-plot\"\n ref={plotRef}\n style={{ width: plotWidth }}\n >\n <div\n className=\"altertable-chart-canvas\"\n aria-hidden=\"true\"\n ref={canvasRef}\n >\n <RechartsBarChart\n data={items.map(item => ({\n ...item,\n plotValue: item.value / maximum,\n }))}\n responsive\n width=\"100%\"\n height={220}\n margin={{ top: 0, right: 0, bottom: 0, left: 0 }}\n accessibilityLayer={false}\n tabIndex={-1}\n barCategoryGap=\"24%\"\n >\n <ChartXAxis hide dataKey=\"id\" scale=\"band\" />\n <ChartYAxis hide domain={[0, 1]} allowDataOverflow />\n {horizontalGrid && <ChartGrid />}\n <ChartBar\n dataKey=\"plotValue\"\n minPointSize={value => ((value ?? 0) > 0 ? 7 : 0)}\n background={\n linkedItem\n ? ({ index, x, y, width, height }: BarShapeProps) => (\n <g>\n {items[index]?.id === linkedItem.id && (\n <rect\n x={x}\n y={y}\n width={width}\n height={height}\n fill=\"var(--atbl-muted)\"\n fillOpacity={0.14}\n pointerEvents=\"none\"\n aria-hidden=\"true\"\n data-atbl-internal-linked-cursor=\"true\"\n />\n )}\n </g>\n )\n : false\n }\n >\n {items.map(item => (\n <Cell\n key={item.id}\n fill={chartBarFill}\n opacity={activeId === item.id ? 0.75 : 1}\n data-atbl-internal-bar-id={item.id}\n />\n ))}\n </ChartBar>\n </RechartsBarChart>\n </div>\n <div className=\"altertable-selectable-bars-items\">\n {items.map((item, index) => {\n const actions = chartActions.actions(\n itemActions?.(item) ?? [],\n item.label,\n `${formatValue(item.value)} ${unit}`\n );\n const action = getPrimaryExplorationAction(actions);\n const menuTrigger: RefObject<ComponentRef<'button'> | null> = {\n get current() {\n return menuTriggers.current.get(item.id) ?? null;\n },\n };\n return (\n <Fragment key={item.id}>\n <div\n className=\"altertable-chart-item-actions\"\n onPointerMove={event => {\n if (event.pointerType === 'mouse')\n cursor.setTime(item.time);\n }}\n >\n <ChartTooltip\n variant=\"chart\"\n followCursor={false}\n boundaryRefs={[canvasRef, scrollport]}\n anchorRect={trigger => {\n const bar = plotRef.current?.querySelector(\n `[data-atbl-internal-bar-id=\"${CSS.escape(item.id)}\"]`\n );\n const bounds =\n bar?.getBoundingClientRect() ??\n trigger?.getBoundingClientRect();\n if (!bounds) return null;\n const top = bar ? bounds.top : bounds.top + 220;\n return new DOMRect(\n bounds.left + bounds.width / 2,\n top,\n 0,\n 0\n );\n }}\n onOpenChange={open =>\n setActiveId(current =>\n open\n ? item.id\n : current === item.id\n ? undefined\n : current\n )\n }\n content={\n <>\n <strong>{item.label}</strong>\n <span>\n {formatValue(item.value)} {unit}\n </span>\n </>\n }\n className=\"altertable-chart-column\"\n >\n {action ? (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n type=\"button\"\n className=\"altertable-selectable-bars-item\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. ${action.label}`}\n {...explorationMenuEvents(menuTrigger)}\n onClick={event =>\n action.onSelect(event.currentTarget)\n }\n >\n <span className=\"altertable-selectable-bars-area\" />\n </button>\n ) : actions.length ? (\n <button\n type=\"button\"\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n className=\"altertable-selectable-bars-item\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. Actions`}\n {...explorationMenuEvents(menuTrigger)}\n onClick={event =>\n openExplorationMenu(menuTrigger, event)\n }\n >\n <span className=\"altertable-selectable-bars-area\" />\n </button>\n ) : (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n type=\"button\"\n tabIndex={-1}\n className=\"altertable-selectable-bars-item\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}`}\n >\n <span className=\"altertable-selectable-bars-area\" />\n </button>\n )}\n </ChartTooltip>\n <div\n className=\"altertable-chart-item-label-row\"\n data-time-tick={ticks?.has(index) || undefined}\n >\n {actions.length ? (\n <MenuTrigger>\n <MenuButton\n className=\"altertable-selectable-bars-label\"\n variant=\"ghost\"\n size=\"compact\"\n {...explorationMenuEvents(menuTrigger)}\n ref={element => {\n if (element)\n menuTriggers.current.set(item.id, element);\n else menuTriggers.current.delete(item.id);\n }}\n aria-label={`${item.label}: Actions`}\n >\n <span title={item.label}>{item.label}</span>\n <AppIcon name=\"disclosure\" size={12} />\n </MenuButton>\n <ExplorationActionMenu\n actions={actions}\n ariaLabel={item.label}\n triggerRef={menuTrigger}\n placement=\"bottom\"\n />\n </MenuTrigger>\n ) : (\n <span className=\"altertable-selectable-bars-label\">\n <span title={item.label}>{item.label}</span>\n </span>\n )}\n </div>\n </div>\n </Fragment>\n );\n })}\n </div>\n </div>\n </div>\n {chartActions.feedback}\n </section>\n );\n}\n","import {\n validateChoiceOptions,\n type ChoiceOption,\n} from '@altertable/data-app/internal';\nimport { type ComponentPropsWithRef, type ReactNode } from 'react';\nimport {\n RadioGroup as AriaRadioGroup,\n Radio as AriaRadio,\n Label,\n} from 'react-aria-components';\n\nimport { classNames } from './classNames.ts';\n\nexport type RadioGroupProps = Omit<\n ComponentPropsWithRef<typeof AriaRadioGroup>,\n 'className' | 'children'\n> & { children: ReactNode; label: string; className?: string };\nexport function RadioGroup({\n label,\n className,\n children,\n ...props\n}: RadioGroupProps) {\n return (\n <AriaRadioGroup\n {...props}\n className={classNames('altertable-radio-group', className)}\n >\n <Label className=\"altertable-control-label\">{label}</Label>\n {children}\n </AriaRadioGroup>\n );\n}\nexport type RadioProps = Omit<\n ComponentPropsWithRef<typeof AriaRadio>,\n 'className'\n> & { className?: string };\nexport function Radio({ className, children, ...props }: RadioProps) {\n return (\n <AriaRadio\n {...props}\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className={classNames('altertable-radio', className)}\n >\n {state => (\n <>\n <span className=\"altertable-radio-mark\" aria-hidden=\"true\" />\n {typeof children === 'function' ? children(state) : children}\n </>\n )}\n </AriaRadio>\n );\n}\nexport type SegmentedControlProps = Omit<RadioGroupProps, 'children'> & {\n options: readonly ChoiceOption[];\n};\n/** A compact radio group; arrow keys follow standard radio selection behavior. */\nexport function SegmentedControl({\n options,\n className,\n ...props\n}: SegmentedControlProps) {\n validateChoiceOptions(options);\n return (\n <RadioGroup\n {...props}\n orientation=\"horizontal\"\n className={classNames('altertable-segmented-control', className)}\n >\n <div className=\"altertable-segmented-options\">\n {options.map(option => (\n <Radio\n key={option.id}\n value={option.id}\n data-atbl-internal-surface=\"option\"\n >\n {option.label}\n </Radio>\n ))}\n </div>\n </RadioGroup>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\nimport { type ComponentPropsWithRef } from 'react';\n\nimport { CheckboxGroupContext } from './Checkbox.tsx';\nimport { classNames } from './classNames.ts';\n\nexport type CheckboxGroupProps = Omit<\n ComponentPropsWithRef<'fieldset'>,\n 'onChange'\n> & {\n label: string;\n values: readonly string[];\n onChange: (values: string[]) => void;\n};\nexport function CheckboxGroup({\n label,\n values,\n onChange,\n className,\n children,\n disabled,\n ...props\n}: CheckboxGroupProps) {\n invariant(\n new Set(values).size === values.length,\n 'Checkbox group values must be unique.'\n );\n return (\n <fieldset\n {...props}\n disabled={disabled}\n className={classNames('altertable-checkbox-group', className)}\n >\n <legend>{label}</legend>\n <CheckboxGroupContext\n value={{\n values,\n disabled,\n onChange(value, checked) {\n onChange(\n checked\n ? [...values.filter(item => item !== value), value]\n : values.filter(item => item !== value)\n );\n },\n }}\n >\n {children}\n </CheckboxGroupContext>\n </fieldset>\n );\n}\n","import { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport {\n useContext,\n useLayoutEffect,\n useState,\n type ComponentProps,\n} from 'react';\nimport { Legend, type LegendPayload } from 'recharts';\n\nimport {\n ChartLegendInteractionContext,\n chartLegendSeriesKey,\n} from './chart-legend-interaction.tsx';\nimport { ChartLegend, type ChartLegendMarkerKind } from './ChartLegend.tsx';\n\nexport type ComposedChartLegendProps = ComponentProps<typeof Legend> & {\n maxVisibleItems?: number;\n /** Enable hover emphasis and click to focus one or more series. */\n interactive?: boolean;\n};\ntype LegendContentProps = ComposedChartLegendProps & {\n payload?: readonly LegendPayload[];\n};\n\nconst legendMarkerKinds: Partial<\n Record<NonNullable<LegendPayload['type']>, ChartLegendMarkerKind>\n> = {\n square: 'area',\n rect: 'bar',\n line: 'line',\n plainline: 'line',\n};\n\n// Series IDs survive sorting, renaming, and removal. Native series without IDs\n// can use a unique data key. Ambiguous entries may remount when Recharts replaces\n// their payload; object identity prevents them inheriting another series’ state.\nfunction createLegendItemKeys() {\n const identities = new WeakMap<object, number>();\n let nextIdentity = 0;\n function identity(value: object) {\n let id = identities.get(value);\n if (id === undefined) {\n id = nextIdentity++;\n identities.set(value, id);\n }\n return id;\n }\n return (payload: readonly LegendPayload[]) => {\n const keys = payload.map(entry => {\n const source: unknown = entry.payload;\n const id =\n source && typeof source === 'object' && 'id' in source\n ? source.id\n : undefined;\n const key = entry.dataKey;\n const seriesKey = chartLegendSeriesKey(id, key);\n if (seriesKey) return seriesKey;\n return ['object', identity(typeof key === 'function' ? key : entry)].join(\n KEY_SEPARATOR\n );\n });\n const counts = new Map<string, number>();\n for (const key of keys) counts.set(key, (counts.get(key) ?? 0) + 1);\n return keys.map((key, index) => {\n if (counts.get(key) === 1) return key;\n const entry = payload[index]!;\n const source: unknown = entry.payload;\n return [\n key,\n 'object',\n identity(source && typeof source === 'object' ? source : entry),\n ].join(KEY_SEPARATOR);\n });\n };\n}\n\nfunction LegendContent({\n payload = [],\n maxVisibleItems,\n formatter,\n layout,\n align,\n labelStyle,\n iconType,\n iconSize = 8,\n inactiveColor = 'var(--atbl-muted)',\n position,\n verticalAlign,\n onClick,\n onMouseEnter,\n onMouseLeave,\n interactive = true,\n 'aria-label': ariaLabel,\n}: LegendContentProps) {\n const [getItemKeys] = useState(createLegendItemKeys);\n const interaction = useContext(ChartLegendInteractionContext);\n const itemKeys = getItemKeys(payload);\n const selectableKeys = itemKeys.filter(\n (_, index) => payload[index]?.type !== 'none'\n );\n useLayoutEffect(() => {\n interaction?.reconcile(selectableKeys);\n });\n const canInteract =\n interactive &&\n !onClick &&\n interaction &&\n (payload.filter(entry => entry.type !== 'none').length > 1 ||\n interaction.focusedKeys !== null);\n if (!payload.some(entry => entry.type !== 'none')) return null;\n const vertical =\n layout === 'vertical' ||\n (layout === 'auto' && (position === 'left' || position === 'right'));\n return (\n <ChartLegend\n aria-label={ariaLabel}\n className={\n position === 'top' || (position == null && verticalAlign === 'top')\n ? 'altertable-composed-chart-legend-above'\n : position === 'bottom' ||\n (position == null && verticalAlign !== 'middle' && !vertical)\n ? 'altertable-composed-chart-legend-below'\n : undefined\n }\n maxVisibleItems={maxVisibleItems}\n layout={vertical ? 'vertical' : 'horizontal'}\n align={align === 'right' ? 'end' : align === 'left' ? 'start' : 'center'}\n >\n {payload.map((entry, index) => {\n if (entry.type === 'none') return null;\n const type = iconType ?? entry.type;\n const kind = iconType\n ? (legendMarkerKinds[type ?? 'none'] ?? 'point')\n : 'square';\n const formatLabel = entry.formatter ?? formatter;\n const label = formatLabel\n ? formatLabel(entry.value, entry, index)\n : entry.value;\n const content = (\n <>\n {type !== 'none' &&\n (entry.legendIcon ?? (\n <ChartLegend.Marker\n kind={kind}\n color={entry.inactive ? inactiveColor : entry.color}\n style={{\n width: iconSize,\n height: kind === 'square' ? iconSize : iconSize * 0.6,\n }}\n />\n ))}\n <ChartLegend.Label style={labelStyle}>{label}</ChartLegend.Label>\n </>\n );\n return (\n <ChartLegend.Item\n key={itemKeys[index]}\n inactive={entry.inactive}\n data-legend-muted={\n canInteract &&\n interaction.hoveredKey &&\n (!interaction.focusedKeys ||\n interaction.focusedKeys.has(interaction.hoveredKey)) &&\n interaction.hoveredKey !== itemKeys[index]\n ? true\n : undefined\n }\n data-legend-excluded={\n canInteract &&\n interaction.focusedKeys &&\n !interaction.focusedKeys.has(itemKeys[index]!)\n ? true\n : undefined\n }\n onMouseEnter={event => {\n if (canInteract) interaction.hover(itemKeys[index]!);\n onMouseEnter?.(entry, index, event);\n }}\n onMouseLeave={event => {\n if (canInteract) interaction.hover(null);\n onMouseLeave?.(entry, index, event);\n }}\n >\n {canInteract || onClick ? (\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action\"\n aria-pressed={\n canInteract\n ? !!interaction.focusedKeys?.has(itemKeys[index]!)\n : undefined\n }\n onFocus={() => {\n if (canInteract) interaction.hover(itemKeys[index]!);\n }}\n onBlur={() => {\n if (canInteract) interaction.hover(null);\n }}\n onClick={event => {\n if (canInteract)\n interaction.toggle(itemKeys[index]!, selectableKeys);\n onClick?.(entry, index, event);\n }}\n >\n {content}\n </button>\n ) : (\n content\n )}\n </ChartLegend.Item>\n );\n })}\n </ChartLegend>\n );\n}\n\n/** Opt in inside ComposedChart to derive the shared legend from its displayed series.\n * Native positioning, sorting, formatters, callbacks, and custom content remain available. */\nexport function ComposedChartLegend({\n maxVisibleItems,\n interactive = true,\n ...props\n}: ComposedChartLegendProps) {\n return (\n <Legend\n iconSize={8}\n inactiveColor=\"var(--atbl-muted)\"\n content={\n <LegendContent\n maxVisibleItems={maxVisibleItems}\n interactive={interactive}\n />\n }\n {...props}\n />\n );\n}\n","import { type MetricFormat } from '@altertable/data-app/format';\nimport {\n Children,\n Fragment,\n isValidElement,\n cloneElement,\n useState,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n type PointerEvent,\n type ComponentProps,\n type ReactNode,\n type ReactElement,\n} from 'react';\nimport {\n ComposedChart as RechartsComposedChart,\n CartesianGrid as NativeCartesianGrid,\n ZAxis,\n ReferenceLine,\n ReferenceArea,\n ReferenceDot,\n Brush,\n Cell,\n Line as NativeLine,\n Bar as NativeBar,\n Area as NativeArea,\n Scatter as NativeScatter,\n XAxis as NativeXAxis,\n YAxis as NativeYAxis,\n Legend as NativeLegend,\n useOffset,\n useMargin,\n Label,\n LabelList,\n ErrorBar,\n} from 'recharts';\n\nimport type { HorizontalGridProps } from './chart-data.ts';\nimport { ChartDateAxes } from './chart-date-axis.tsx';\nimport {\n ChartInteractionContext,\n type ChartPoint,\n} from './chart-interaction.tsx';\nimport {\n ChartLegendInteractionContext,\n chartLegendSeriesKey,\n reconcileLegendFocus,\n toggleLegendFocus,\n} from './chart-legend-interaction.tsx';\nimport {\n ChartBar as Bar,\n ChartDot as Dot,\n ChartLine as Line,\n ChartArea as Area,\n ChartScatter as Scatter,\n ChartXAxis as XAxis,\n ChartYAxis as YAxis,\n ChartGrid as CartesianGrid,\n ChartTooltip as Tooltip,\n} from './chart-primitives.tsx';\nimport { ChartValueFormat } from './chart-value-format.ts';\nimport { classNames } from './classNames.ts';\nimport { ComposedChartLegend as Legend } from './ComposedChartLegend.tsx';\nimport {\n type ChartCursorGroup,\n ChartCursorChartContext,\n useLinkedChartCursor,\n} from './use-chart-cursor-group.tsx';\n\nfunction findNearestSeriesId(\n hoveredSeriesId: string | null,\n points: ReadonlyMap<string, ChartPoint>,\n position: ChartPoint | null\n) {\n // Bars and scatter points use direct hits; line and area samples use distance.\n if (!position || (hoveredSeriesId != null && !points.has(hoveredSeriesId)))\n return hoveredSeriesId;\n let selected = hoveredSeriesId;\n let distance = Infinity;\n for (const [id, point] of points) {\n const candidate = Math.hypot(point.x - position.x, point.y - position.y);\n if (candidate < distance) {\n distance = candidate;\n selected = id;\n }\n }\n return selected;\n}\n\nexport type ComposedChartProps<Row = unknown> = HorizontalGridProps &\n Omit<ComponentProps<typeof RechartsComposedChart<Row>>, 'data' | 'title'> & {\n /** Displayed rows; series and axes select fields with Recharts dataKey props. */\n data: readonly Row[];\n /** Describes the measures and scope for assistive technology. */\n ariaLabel: string;\n /** Shared measure semantics: compact numeric axes and precise tooltips.\n * For mixed units, use explicit axis tickFormatter and series/tooltip formatters. */\n valueFormat?: MetricFormat;\n /** Share mouse-hover timestamps with charts receiving the same handle, using the temporal X axis. */\n cursorGroup?: ChartCursorGroup;\n };\n\nfunction hasAuthoredGrid(children: ReactNode): boolean {\n return Children.toArray(children).some(\n child =>\n isValidElement<{ children?: ReactNode }>(child) &&\n (child.type === CartesianGrid ||\n child.type === NativeCartesianGrid ||\n (child.type === Fragment && hasAuthoredGrid(child.props.children)))\n );\n}\n\nfunction countNativeSeriesKeys(\n children: ReactNode,\n counts = new Map<string, number>()\n) {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return;\n if (child.type === Fragment) {\n countNativeSeriesKeys(\n (child.props as { children?: ReactNode }).children,\n counts\n );\n } else if (\n child.type === NativeLine ||\n child.type === NativeBar ||\n child.type === NativeArea ||\n child.type === NativeScatter\n ) {\n const props = child.props as { id?: string; dataKey?: unknown };\n const key = chartLegendSeriesKey(props.id, props.dataKey);\n if (key) counts.set(key, (counts.get(key) ?? 0) + 1);\n }\n });\n return counts;\n}\n\nfunction nativeSeriesId(\n props: { id?: string; dataKey?: unknown },\n child: ReactElement,\n index: number,\n path: string,\n keyCounts: ReadonlyMap<string, number>\n) {\n if (props.id != null) return props.id;\n const key = chartLegendSeriesKey(undefined, props.dataKey);\n return !key || (keyCounts.get(key) ?? 0) > 1\n ? `atbl-native-${path}-${child.key ?? index}`\n : undefined;\n}\n\nfunction applyNativeLegendInteraction(\n children: ReactNode,\n focusedKeys: ReadonlySet<string> | null,\n hoveredKey: string | null,\n suppressPlotInspection: boolean,\n valueAxis: 'x' | 'y',\n visibleBarAxisIds: ReadonlySet<string | number>,\n fullAxisSpace: { left: number; right: number } | null,\n yAxisSideCounts: { left: number; right: number },\n keyCounts: ReadonlyMap<string, number>,\n path = 'root'\n): ReactNode {\n return Children.map(children, (child, index) => {\n if (!isValidElement(child)) return child;\n if (child.type === Fragment) {\n const props = child.props as { children?: ReactNode };\n return cloneElement(child, {\n children: applyNativeLegendInteraction(\n props.children,\n focusedKeys,\n hoveredKey,\n suppressPlotInspection,\n valueAxis,\n visibleBarAxisIds,\n fullAxisSpace,\n yAxisSideCounts,\n keyCounts,\n `${path}-${child.key ?? index}`\n ),\n } as { children: ReactNode });\n }\n if (child.type === XAxis || child.type === NativeXAxis) {\n const axis = child as ReactElement<{\n xAxisId?: string | number;\n includeHidden?: boolean;\n domain?: unknown;\n ticks?: unknown;\n }>;\n if (valueAxis === 'y')\n return cloneElement(axis, {\n includeHidden: axis.props.includeHidden ?? true,\n });\n if (!focusedKeys || axis.props.domain != null || axis.props.ticks != null)\n return child;\n return cloneElement(axis, {\n domain: visibleBarAxisIds.has(axis.props.xAxisId ?? 0)\n ? [0, 'auto']\n : ['auto', 'auto'],\n });\n }\n if (child.type === YAxis || child.type === NativeYAxis) {\n const axis = child as ReactElement<{\n yAxisId?: string | number;\n includeHidden?: boolean;\n domain?: unknown;\n ticks?: unknown;\n width?: number | 'auto';\n orientation?: 'left' | 'right';\n }>;\n if (valueAxis === 'x')\n return cloneElement(axis, {\n includeHidden: axis.props.includeHidden ?? true,\n });\n if (!focusedKeys || axis.props.domain != null || axis.props.ticks != null)\n return child;\n const side = axis.props.orientation ?? 'left';\n const reservedWidth =\n (axis.props.width === 'auto' ||\n (child.type === YAxis && axis.props.width == null)) &&\n yAxisSideCounts[side] === 1\n ? fullAxisSpace?.[side]\n : undefined;\n return cloneElement(axis, {\n domain: visibleBarAxisIds.has(axis.props.yAxisId ?? 0)\n ? [0, 'auto']\n : ['auto', 'auto'],\n ...(reservedWidth != null && { width: reservedWidth }),\n });\n }\n if (\n child.type !== NativeLine &&\n child.type !== NativeBar &&\n child.type !== NativeArea &&\n child.type !== NativeScatter\n )\n return child;\n const series = child as ReactElement<{\n id?: string;\n dataKey?: unknown;\n hide?: boolean;\n opacity?: number;\n style?: { pointerEvents?: string };\n dot?: unknown;\n activeDot?: unknown;\n }>;\n const id = nativeSeriesId(series.props, child, index, path, keyCounts);\n const key = chartLegendSeriesKey(id, series.props.dataKey)!;\n const excluded = !!(focusedKeys && !focusedKeys.has(key));\n return cloneElement(series, {\n id,\n hide: excluded || series.props.hide,\n opacity: excluded\n ? 0\n : hoveredKey &&\n (!focusedKeys || focusedKeys.has(hoveredKey)) &&\n hoveredKey !== key\n ? 0.2\n : series.props.opacity,\n style: {\n ...series.props.style,\n pointerEvents: excluded ? 'none' : series.props.style?.pointerEvents,\n },\n ...(excluded && (child.type === NativeLine || child.type === NativeArea)\n ? { dot: false, activeDot: false }\n : {}),\n ...(suppressPlotInspection &&\n (child.type === NativeLine || child.type === NativeArea)\n ? { activeDot: false }\n : {}),\n });\n });\n}\n\nfunction collectVisibleNativeBarAxisIds(\n children: ReactNode,\n focusedKeys: ReadonlySet<string> | null,\n valueAxis: 'x' | 'y',\n keyCounts: ReadonlyMap<string, number>,\n path = 'root',\n ids = new Set<string | number>()\n) {\n Children.forEach(children, (child, index) => {\n if (!isValidElement(child)) return;\n if (child.type === Fragment) {\n collectVisibleNativeBarAxisIds(\n (child.props as { children?: ReactNode }).children,\n focusedKeys,\n valueAxis,\n keyCounts,\n `${path}-${child.key ?? index}`,\n ids\n );\n } else if (child.type === NativeBar) {\n const props = child.props as {\n id?: string;\n dataKey?: unknown;\n hide?: boolean;\n xAxisId?: string | number;\n yAxisId?: string | number;\n };\n const id = nativeSeriesId(props, child, index, path, keyCounts);\n const key = chartLegendSeriesKey(id, props.dataKey)!;\n if (!props.hide && (!focusedKeys || focusedKeys.has(key))) {\n ids.add(\n valueAxis === 'x' ? (props.xAxisId ?? 0) : (props.yAxisId ?? 0)\n );\n }\n }\n });\n return ids;\n}\n\nfunction inspectAxisLayout(\n children: ReactNode,\n layout = { left: 0, right: 0, autoYAxis: false, interactiveLegend: false }\n) {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return;\n if (child.type === Fragment) {\n inspectAxisLayout(\n (child.props as { children?: ReactNode }).children,\n layout\n );\n } else if (child.type === YAxis || child.type === NativeYAxis) {\n const props = child.props as {\n hide?: boolean;\n mirror?: boolean;\n orientation?: 'left' | 'right';\n width?: number | 'auto';\n };\n if (!props.hide && !props.mirror) {\n layout[props.orientation ?? 'left']++;\n if (\n props.width === 'auto' ||\n (child.type === YAxis && props.width == null)\n )\n layout.autoYAxis = true;\n }\n } else if (child.type === Legend || child.type === NativeLegend) {\n const props = child.props as {\n position?: string;\n align?: string;\n layout?: string;\n interactive?: boolean;\n };\n if (child.type === Legend && props.interactive !== false)\n layout.interactiveLegend = true;\n const side =\n props.position === 'left' || props.position === 'right'\n ? props.position\n : props.layout === 'vertical' &&\n (props.align === 'left' || props.align === 'right')\n ? props.align\n : null;\n if (side) layout[side]++;\n }\n });\n return layout;\n}\n\nfunction PlotOffsets({\n onChange,\n}: {\n onChange: (left: number, right: number) => void;\n}) {\n const offset = useOffset();\n const margin = useMargin();\n const left = offset?.left;\n const right = offset?.right;\n const marginLeft = margin?.left ?? 5;\n const marginRight = margin?.right ?? 5;\n useLayoutEffect(() => {\n if (left != null && right != null)\n onChange(left - marginLeft, right - marginRight);\n }, [left, right, marginLeft, marginRight, onChange]);\n return null;\n}\n\n/** Compose Cartesian series inside VisualizationWidget. Defaults to responsive\n * full width and 300px height. Children retain native Recharts props and behavior,\n * including stacking, numeric/time axes, missing values, tooltips, and keyboard\n * navigation. Match yAxisId on axes and series for different units; use stackId\n * for stacks. Preserve missing measures as null and choose connectNulls deliberately.\n * Use public chart tokens for series colors. Dataset bindings own\n * loading, empty results, evidence, and CSV; this primitive owns only the plot. */\nfunction ComposedChartRoot<Row>({\n data,\n ariaLabel,\n valueFormat,\n cursorGroup,\n horizontalGrid = false,\n children,\n width = '100%',\n height = 300,\n responsive = true,\n layout = 'horizontal',\n className,\n ...props\n}: ComposedChartProps<Row>) {\n const cursor = useLinkedChartCursor(cursorGroup);\n const [mouseHover, setMouseHover] = useState(false);\n const [hasPointerFocus, setHasPointerFocus] = useState(false);\n const [isPointerInspection, setIsPointerInspection] = useState(false);\n const [hoveredSeriesId, setHoveredSeriesId] = useState<string | null>(null);\n const [pointerPosition, setPointerPosition] = useState<ChartPoint | null>(\n null\n );\n const latestPointerPosition = useRef<ChartPoint | null>(null);\n const [points, setPoints] = useState<ReadonlyMap<string, ChartPoint>>(\n () => new Map()\n );\n const registerPoint = useCallback((id: string, x: number, y: number) => {\n setPoints(current => new Map(current).set(id, { x, y }));\n return () =>\n setPoints(current => {\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n }, []);\n useEffect(() => {\n // A new active sample moves the registered dots; re-evaluate the latest\n // pointer position even if its previous nearest series was unchanged.\n setPointerPosition(latestPointerPosition.current);\n }, [points]);\n function trackPointer(event: PointerEvent<HTMLElement>) {\n setMouseHover(event.pointerType === 'mouse');\n const svg = event.currentTarget.querySelector('svg[role=\"application\"]');\n if (\n !(svg instanceof SVGSVGElement) ||\n !(event.target instanceof Node) ||\n !svg.contains(event.target)\n ) {\n resetPointerInspection();\n return false;\n }\n setSuppressPlotInspection(false);\n setIsPointerInspection(true);\n // Direct-hit series do not need pointer coordinates to select a sample.\n if (hoveredSeriesId != null && !points.has(hoveredSeriesId)) {\n latestPointerPosition.current = null;\n setPointerPosition(null);\n return true;\n }\n const matrix = svg.getScreenCTM();\n if (!matrix) return true;\n const point = new DOMPoint(event.clientX, event.clientY).matrixTransform(\n matrix.inverse()\n );\n const nextPosition = { x: point.x, y: point.y };\n latestPointerPosition.current = nextPosition;\n setPointerPosition(current =>\n findNearestSeriesId(hoveredSeriesId, points, current) ===\n findNearestSeriesId(hoveredSeriesId, points, nextPosition)\n ? current\n : nextPosition\n );\n return true;\n }\n function resetPointerInspection() {\n setMouseHover(false);\n cursor.reset();\n setIsPointerInspection(false);\n setHoveredSeriesId(null);\n latestPointerPosition.current = null;\n setPointerPosition(null);\n }\n const activeSeriesId = findNearestSeriesId(\n hoveredSeriesId,\n points,\n pointerPosition\n );\n const [seriesIds, setSeriesIds] = useState<ReadonlySet<string>>(\n () => new Set()\n );\n const registerSeries = useCallback((id: string) => {\n setSeriesIds(current => new Set(current).add(id));\n return () => {\n setSeriesIds(current => {\n const next = new Set(current);\n next.delete(id);\n return next;\n });\n };\n }, []);\n const [legendHoveredKey, setLegendHoveredKey] = useState<string | null>(null);\n const [suppressPlotInspection, setSuppressPlotInspection] = useState(false);\n const [focusedLegendKeys, setFocusedLegendKeys] =\n useState<ReadonlySet<string> | null>(null);\n const [barAxisByKey, setBarAxisByKey] = useState<\n ReadonlyMap<string, string | number>\n >(() => new Map());\n const registerBarAxis = useCallback(\n (key: string, axisId: string | number) => {\n setBarAxisByKey(current => {\n if (current.get(key) === axisId) return current;\n return new Map(current).set(key, axisId);\n });\n return () =>\n setBarAxisByKey(current => {\n if (current.get(key) !== axisId) return current;\n const next = new Map(current);\n next.delete(key);\n return next;\n });\n },\n []\n );\n const valueAxis = layout === 'vertical' ? 'x' : 'y';\n const [fullAxisSpace, setFullAxisSpace] = useState<{\n left: number;\n right: number;\n } | null>(null);\n const trackPlotOffsets = useCallback(\n (left: number, right: number) => {\n if (focusedLegendKeys) return;\n setFullAxisSpace(current =>\n current?.left === left && current.right === right\n ? current\n : { left, right }\n );\n },\n [focusedLegendKeys]\n );\n const axisLayout = inspectAxisLayout(children);\n const nativeKeyCounts = countNativeSeriesKeys(children);\n const visibleBarAxisIds = collectVisibleNativeBarAxisIds(\n children,\n focusedLegendKeys,\n valueAxis,\n nativeKeyCounts\n );\n for (const [key, axisId] of barAxisByKey) {\n if (!focusedLegendKeys || focusedLegendKeys.has(key))\n visibleBarAxisIds.add(axisId);\n }\n const reconcileLegendKeys = useCallback((keys: readonly string[]) => {\n setFocusedLegendKeys(current => reconcileLegendFocus(current, keys));\n }, []);\n const toggleLegendKey = useCallback(\n (key: string, keys: readonly string[]) => {\n setSuppressPlotInspection(true);\n setFocusedLegendKeys(current => toggleLegendFocus(current, key, keys));\n },\n []\n );\n return (\n <ChartCursorChartContext.Provider value={{ cursor, mouseHover }}>\n <ChartLegendInteractionContext.Provider\n value={{\n hoveredKey: legendHoveredKey,\n focusedKeys: focusedLegendKeys,\n suppressPlotInspection,\n hover: key => {\n setLegendHoveredKey(key);\n if (key) setSuppressPlotInspection(true);\n },\n toggle: toggleLegendKey,\n reconcile: reconcileLegendKeys,\n registerBarAxis,\n }}\n >\n <ChartInteractionContext.Provider\n value={{\n isPointerInspection,\n activeSeriesId,\n activePoint:\n activeSeriesId == null ? undefined : points.get(activeSeriesId),\n registerPoint,\n setHoveredSeriesId,\n seriesCount: seriesIds.size,\n registerSeries,\n }}\n >\n <section\n className={classNames('altertable-composed-chart', className)}\n aria-label={ariaLabel}\n data-atbl-internal-pointer-focus={hasPointerFocus || undefined}\n onPointerDownCapture={event => {\n setHasPointerFocus(trackPointer(event));\n }}\n onPointerOverCapture={trackPointer}\n onPointerMoveCapture={trackPointer}\n onPointerLeave={event => {\n if (event.pointerType !== 'touch') {\n resetPointerInspection();\n }\n }}\n onKeyDownCapture={() => {\n setHasPointerFocus(false);\n resetPointerInspection();\n }}\n onFocusCapture={event => {\n const svg = event.currentTarget.querySelector(\n 'svg[role=\"application\"]'\n );\n if (svg?.contains(event.target)) setSuppressPlotInspection(false);\n }}\n onBlurCapture={event => {\n if (!event.currentTarget.contains(event.relatedTarget)) {\n setHasPointerFocus(false);\n resetPointerInspection();\n }\n }}\n >\n <ChartValueFormat.Provider value={valueFormat}>\n <ChartDateAxes data={data}>\n <RechartsComposedChart\n data-atbl-focus=\"inset\"\n {...props}\n data={data}\n width={width}\n height={height}\n responsive={responsive}\n layout={layout}\n aria-label={ariaLabel}\n >\n {valueAxis === 'y' &&\n axisLayout.autoYAxis &&\n axisLayout.interactiveLegend && (\n <PlotOffsets onChange={trackPlotOffsets} />\n )}\n {horizontalGrid && !hasAuthoredGrid(children) && (\n <CartesianGrid />\n )}\n {applyNativeLegendInteraction(\n children,\n focusedLegendKeys,\n legendHoveredKey,\n suppressPlotInspection,\n valueAxis,\n visibleBarAxisIds,\n fullAxisSpace,\n axisLayout,\n nativeKeyCounts\n )}\n </RechartsComposedChart>\n </ChartDateAxes>\n </ChartValueFormat.Provider>\n </section>\n </ChartInteractionContext.Provider>\n </ChartLegendInteractionContext.Provider>\n </ChartCursorChartContext.Provider>\n );\n}\n\n/** Shared themed series and controls; other children retain native Recharts defaults. */\nexport const ComposedChart = Object.assign(ComposedChartRoot, {\n Dot,\n Area,\n Bar,\n Line,\n Scatter,\n XAxis,\n YAxis,\n ZAxis,\n CartesianGrid,\n Tooltip,\n Legend,\n ReferenceLine,\n ReferenceArea,\n ReferenceDot,\n Brush,\n Cell,\n Label,\n LabelList,\n ErrorBar,\n});\n","import { useId } from 'react';\n\nconst svgIdCharacterPattern = /[a-zA-Z0-9-]/;\n\n/** Stable React ID for SVG definitions and their URL references; safe with identifier prefixes. */\nexport function useSvgId(): string {\n const id = useId();\n const encodedId = Array.from(id, character =>\n svgIdCharacterPattern.test(character)\n ? character\n : `_${character.codePointAt(0)!.toString(16)}_`\n ).join('');\n return ['svg', encodedId].join('-');\n}\n","import { formatNumber, formatPercent } from '@altertable/data-app/format';\nimport { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport { invariant } from '@altertable/data-app/internal';\nimport { Fragment, useEffect, useRef, useState } from 'react';\n\nimport {\n type CountChartProps,\n type HorizontalGridProps,\n} from './chart-data.ts';\nimport { useChartLegendFocus } from './chart-legend-interaction.tsx';\nimport { ChartTooltipContent } from './chart-primitives.tsx';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport { classNames } from './classNames.ts';\nimport { ComposedChart } from './ComposedChart.tsx';\nimport { useSvgId } from './useSvgId.ts';\n\n/** Ordered step with a unique, nonblank ID. */\nexport type FunnelChartStep = { id: string; label: string };\nexport type FunnelChartSeries = {\n /** Unique, nonblank population ID. */\n id: string;\n label: string;\n /** Finite, nonnegative counts aligned with steps and nonincreasing. */\n values: readonly number[];\n};\nexport type FunnelChartProps = CountChartProps &\n HorizontalGridProps & {\n steps: readonly FunnelChartStep[];\n series: readonly FunnelChartSeries[];\n /** Disable legend hover and focus controls. */\n interactiveLegend?: boolean;\n };\n\ntype FunnelPopulation = {\n id: string;\n label: string;\n color: string;\n hatchId: string;\n};\ntype FunnelReading = {\n population: FunnelPopulation;\n current: number;\n previous: number;\n dropped: number;\n conversion: number | null;\n dropOff: number | null;\n conversionPercent: number;\n dropOffPercent: number;\n};\ntype FunnelRow = {\n id: string;\n label: string;\n index: number;\n readings: ReadonlyMap<string, FunnelReading>;\n};\n\nfunction createFunnelModel(\n steps: readonly FunnelChartStep[],\n series: readonly FunnelChartSeries[],\n chartId: string\n) {\n for (const [kind, items] of [\n ['funnel step', steps],\n ['funnel series', series],\n ] as const) {\n const ids = new Set<string>();\n for (const item of items) {\n invariant(\n item.id.trim().length > 0 && !ids.has(item.id),\n `${kind} chart IDs must be nonblank and unique.`\n );\n ids.add(item.id);\n }\n }\n for (const item of series) {\n invariant(\n item.values.length === steps.length,\n 'funnel chart counts must align with steps.'\n );\n item.values.forEach((value, index) => {\n invariant(\n Number.isFinite(value) && value >= 0,\n 'funnel chart counts must be finite and nonnegative.'\n );\n invariant(\n index === 0 || value <= item.values[index - 1]!,\n 'funnel chart counts must be nonincreasing.'\n );\n });\n }\n const populations: FunnelPopulation[] = series.map((item, index) => ({\n id: item.id,\n label: item.label,\n color: `var(--atbl-chart-${(index % 8) + 1})`,\n hatchId: [chartId, 'hatch', index].join('-'),\n }));\n const rows: FunnelRow[] = steps.map((step, index) => ({\n id: step.id,\n label: step.label,\n index,\n readings: new Map(\n series.map((item, seriesIndex) => {\n const first = item.values[0] ?? 0;\n const current = item.values[index]!;\n const previous = item.values[Math.max(0, index - 1)]!;\n const dropped = previous - current;\n const conversion = first > 0 ? current / first : null;\n const dropOff = first > 0 ? dropped / first : null;\n return [\n item.id,\n {\n population: populations[seriesIndex]!,\n current,\n previous,\n dropped,\n conversion,\n dropOff,\n conversionPercent: (conversion ?? 0) * 100,\n dropOffPercent: (dropOff ?? (index === 0 ? 1 : 0)) * 100,\n },\n ];\n })\n ),\n }));\n return { populations, rows };\n}\n\n/** Conversion columns with previous-step drop-off, normalized to each series' first step.\n * Owns series highlighting and portion-specific inspection; compose inside VisualizationWidget. */\nexport function FunnelChart({\n steps,\n series,\n unit,\n ariaLabel,\n className,\n formatValue = formatNumber,\n horizontalGrid = true,\n interactiveLegend = true,\n}: FunnelChartProps) {\n const legendFocus = useChartLegendFocus(series.map(item => item.id));\n const chartId = useSvgId();\n const [highlighted, setHighlighted] = useState<{\n id: string;\n conversion: boolean;\n step: number;\n } | null>(null);\n const clearTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n function cancelClear() {\n if (clearTimer.current !== null) clearTimeout(clearTimer.current);\n clearTimer.current = null;\n }\n useEffect(() => cancelClear, []);\n function highlight(id: string, conversion: boolean, step: number) {\n cancelClear();\n setHighlighted({ id, conversion, step });\n }\n function clearHighlight() {\n cancelClear();\n setHighlighted(null);\n }\n function scheduleClear() {\n cancelClear();\n clearTimer.current = setTimeout(() => setHighlighted(null), 100);\n }\n const { populations, rows } = createFunnelModel(steps, series, chartId);\n return (\n <section\n className={classNames('altertable-funnel-chart', className)}\n aria-label={ariaLabel}\n onKeyDownCapture={clearHighlight}\n >\n {steps.length === 0 || series.length === 0 ? (\n <span>No data</span>\n ) : (\n <>\n <div className=\"altertable-funnel-header\">\n <ChartLegend aria-label=\"Funnel series\" layout=\"single-row\">\n {populations.map(item => (\n <ChartLegend.Item\n key={item.id}\n className=\"altertable-funnel-summary-item\"\n data-legend-muted={\n (interactiveLegend &&\n legendFocus.hoveredId &&\n (!legendFocus.focusedIds ||\n legendFocus.focusedIds.has(legendFocus.hoveredId)) &&\n legendFocus.hoveredId !== item.id) ||\n undefined\n }\n data-legend-excluded={\n (interactiveLegend && !legendFocus.visible(item.id)) ||\n undefined\n }\n >\n {interactiveLegend && populations.length > 1 ? (\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action altertable-funnel-legend-button\"\n aria-pressed={!!legendFocus.focusedIds?.has(item.id)}\n onPointerEnter={() => legendFocus.setHoveredId(item.id)}\n onPointerLeave={() => legendFocus.setHoveredId(null)}\n onFocus={() => legendFocus.setHoveredId(item.id)}\n onBlur={() => legendFocus.setHoveredId(null)}\n onClick={() => legendFocus.toggle(item.id)}\n >\n <span className=\"altertable-funnel-series-label\">\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </span>\n <strong className=\"altertable-funnel-series-value\">\n {formatPercent(\n rows.at(-1)?.readings.get(item.id)?.conversion ?? null\n )}\n </strong>\n </button>\n ) : (\n <span className=\"altertable-funnel-series-label\">\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </span>\n )}\n {(!interactiveLegend || populations.length <= 1) && (\n <strong className=\"altertable-funnel-series-value\">\n {formatPercent(\n rows.at(-1)?.readings.get(item.id)?.conversion ?? null\n )}\n </strong>\n )}\n </ChartLegend.Item>\n ))}\n </ChartLegend>\n <p className=\"altertable-funnel-path\">\n {steps[0]!.label} → {steps.at(-1)!.label}\n </p>\n </div>\n <div className=\"altertable-funnel-scroll\">\n <div\n style={{\n minWidth: steps.length * Math.max(96, series.length * 40),\n }}\n >\n <ComposedChart\n data={rows}\n ariaLabel={`${ariaLabel} plot`}\n height={300}\n barCategoryGap=\"4%\"\n barGap={1}\n onMouseLeave={clearHighlight}\n >\n {horizontalGrid && <ComposedChart.CartesianGrid />}\n <ComposedChart.XAxis dataKey=\"label\" interval={0} height={48} />\n <ComposedChart.YAxis\n domain={[0, 100]}\n width={42}\n tickFormatter={value => formatPercent(value / 100)}\n />\n <defs>\n {populations.map(item => (\n <pattern\n key={item.id}\n id={item.hatchId}\n patternUnits=\"userSpaceOnUse\"\n width=\"6\"\n height=\"6\"\n patternTransform=\"rotate(45)\"\n >\n <rect\n width=\"8\"\n height=\"8\"\n fill={item.color}\n fillOpacity={0.16}\n />\n <line\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"8\"\n stroke={item.color}\n strokeOpacity={0.4}\n strokeWidth=\"2\"\n />\n </pattern>\n ))}\n </defs>\n {populations.map(item => (\n <Fragment key={item.id}>\n <ComposedChart.Bar\n dataKey={(row: FunnelRow) =>\n row.readings.get(item.id)?.conversionPercent ?? 0\n }\n name={item.label}\n stackId={item.id}\n fill={item.color}\n radius={0}\n maxBarSize={undefined}\n activeBar={false}\n minPointSize={0}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n opacity={\n interactiveLegend\n ? legendFocus.opacity(item.id) *\n (!highlighted || highlighted.id === item.id\n ? 1\n : 0.2)\n : !highlighted || highlighted.id === item.id\n ? 1\n : 0.2\n }\n onMouseEnter={bar =>\n highlight(item.id, true, bar.payload.index)\n }\n onMouseLeave={scheduleClear}\n onClick={bar =>\n highlight(item.id, true, bar.payload.index)\n }\n />\n <ComposedChart.Bar\n dataKey={(row: FunnelRow) =>\n row.readings.get(item.id)?.dropOffPercent ?? 0\n }\n name={`${item.label} drop-off`}\n stackId={item.id}\n fill={`url(#${item.hatchId})`}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n opacity={\n interactiveLegend\n ? legendFocus.opacity(item.id) *\n (!highlighted || highlighted.id === item.id\n ? 1\n : 0.2)\n : !highlighted || highlighted.id === item.id\n ? 1\n : 0.2\n }\n onMouseEnter={bar =>\n highlight(item.id, false, bar.payload.index)\n }\n onMouseLeave={scheduleClear}\n onClick={bar =>\n highlight(item.id, false, bar.payload.index)\n }\n radius={0}\n maxBarSize={undefined}\n activeBar={false}\n />\n </Fragment>\n ))}\n <ComposedChart.Tooltip\n content={({ active, activeIndex }) => {\n const row =\n activeIndex == null\n ? undefined\n : rows[Number(activeIndex)];\n if (!active || !row) return null;\n const tooltipItems = [...row.readings.values()]\n .filter(\n value =>\n (!interactiveLegend ||\n legendFocus.visible(value.population.id)) &&\n (!highlighted ||\n highlighted.step !== row.index ||\n value.population.id === highlighted.id)\n )\n .flatMap(value => {\n const item = value.population;\n const selected = highlighted?.step === row.index;\n const readings = selected\n ? [highlighted.conversion]\n : [true, false];\n return readings.map(conversion => {\n const key = [\n item.id,\n conversion ? 'conversion' : 'drop-off',\n ].join(KEY_SEPARATOR);\n return {\n name: item.label,\n graphicalItemId: key,\n dataKey: key,\n color: item.color,\n value:\n (conversion ? value.conversion : value.dropOff) ??\n 0,\n formatter: () => (\n <>\n {formatPercent(\n conversion ? value.conversion : value.dropOff\n )}{' '}\n {conversion ? 'conversion' : 'drop-off'}\n <span className=\"altertable-funnel-tooltip-detail\">\n {formatValue(\n conversion ? value.current : value.dropped\n )}{' '}\n of {formatValue(value.previous)} {unit}\n </span>\n </>\n ),\n };\n });\n });\n return (\n <ChartTooltipContent\n active\n label={row.label}\n payload={tooltipItems}\n />\n );\n }}\n />\n </ComposedChart>\n </div>\n </div>\n <ul className=\"altertable-sr-only\">\n {rows.map(row => (\n <li key={row.id}>\n {row.label}\n {[...row.readings.values()].map(value => (\n <span key={value.population.id}>\n {' '}\n · {value.population.label}: {formatValue(value.current)}{' '}\n {unit}, {formatPercent(value.conversion)} conversion,{' '}\n {formatValue(value.dropped)} dropped off\n </span>\n ))}\n </li>\n ))}\n </ul>\n </>\n )}\n </section>\n );\n}\n","import { formatNumber, formatPercent } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport { Fragment } from 'react';\n\nimport {\n type CountChartProps,\n type HorizontalGridProps,\n} from './chart-data.ts';\nimport { useChartLegendFocus } from './chart-legend-interaction.tsx';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport { classNames } from './classNames.ts';\nimport { ComposedChart } from './ComposedChart.tsx';\nimport { TooltipSurface } from './TooltipSurface.tsx';\n\nexport type RetentionChartPoint = {\n /** Nonnegative integer, unique per series; uneven offsets retain their distance. */\n offset: number;\n /** Must agree across series for the same offset. */\n label: string;\n /** Observed retention fraction in [0, 1], or null for an unobserved period. */\n rate: number | null;\n /** Finite count in [0, cohortSize]; null exactly when rate is null. */\n retainedCount: number | null;\n /** Observed but still accumulating; drawn as a dotted tail. */\n incomplete?: boolean;\n};\nexport type RetentionChartSeries = {\n /** Unique, nonblank cohort or segment ID. */\n id: string;\n label: string;\n /** Finite, nonnegative starting population. */\n cohortSize: number;\n points: readonly RetentionChartPoint[];\n};\nexport type RetentionChartProps = CountChartProps &\n HorizontalGridProps & {\n series: readonly RetentionChartSeries[];\n /** Disable legend hover and focus controls. */\n interactiveLegend?: boolean;\n };\n\ntype RetentionReading = {\n point: RetentionChartPoint;\n completePercent: number | null;\n incompletePercent: number | null;\n description: string;\n};\ntype RetentionRow = {\n offset: number;\n label: string;\n readings: Map<string, RetentionReading>;\n};\n\nfunction createRetentionModel(\n series: readonly RetentionChartSeries[],\n unit: string,\n formatValue: (value: number) => string\n) {\n const ids = new Set<string>();\n const rowsByOffset = new Map<number, RetentionRow>();\n const cohorts = series.map((item, index) => {\n invariant(\n item.id.trim().length > 0 && !ids.has(item.id),\n 'retention series chart IDs must be nonblank and unique.'\n );\n ids.add(item.id);\n invariant(\n Number.isFinite(item.cohortSize) && item.cohortSize >= 0,\n 'retention chart counts must be finite and nonnegative.'\n );\n const seen = new Set<number>();\n let previous: RetentionReading | undefined;\n const readings = [...item.points]\n .sort((a, b) => a.offset - b.offset)\n .map(point => {\n invariant(\n Number.isSafeInteger(point.offset) &&\n point.offset >= 0 &&\n !seen.has(point.offset),\n 'retention chart offsets must be unique nonnegative integers within each series.'\n );\n seen.add(point.offset);\n invariant(\n point.rate === null ||\n (Number.isFinite(point.rate) && point.rate >= 0 && point.rate <= 1),\n 'retention chart rates must be finite fractions between 0 and 1, or null.'\n );\n invariant(\n (point.rate === null) === (point.retainedCount === null),\n 'retention chart unobserved rates and counts must both be null.'\n );\n if (point.retainedCount !== null) {\n invariant(\n Number.isFinite(point.retainedCount) && point.retainedCount >= 0,\n 'retention chart counts must be finite and nonnegative.'\n );\n invariant(\n point.retainedCount <= item.cohortSize,\n 'retention chart retained counts cannot exceed cohort size.'\n );\n }\n let row = rowsByOffset.get(point.offset);\n invariant(\n !row || row.label === point.label,\n 'retention chart labels must agree for the same offset.'\n );\n if (!row) {\n row = {\n offset: point.offset,\n label: point.label,\n readings: new Map(),\n };\n rowsByOffset.set(point.offset, row);\n }\n const percent = point.rate === null ? null : point.rate * 100;\n const reading: RetentionReading = {\n point,\n completePercent: point.incomplete ? null : percent,\n incompletePercent: point.incomplete ? percent : null,\n description:\n point.rate === null || point.retainedCount === null\n ? 'Not observed'\n : `${formatPercent(point.rate)} · ${formatValue(point.retainedCount)} / ${formatValue(item.cohortSize)} ${unit}${point.incomplete ? ' · Incomplete period' : ''}`,\n };\n // The dotted tail starts at the preceding supplied observation.\n if (point.incomplete && previous) {\n previous.incompletePercent =\n previous.completePercent ?? previous.incompletePercent;\n }\n row.readings.set(item.id, reading);\n previous = reading;\n return reading;\n });\n return {\n id: item.id,\n label: item.label,\n color: `var(--atbl-chart-${(index % 8) + 1})`,\n readings,\n };\n });\n const rows = [...rowsByOffset.values()].sort((a, b) => a.offset - b.offset);\n return { rows, rowsByOffset, cohorts };\n}\n\n/** Query-defined retention curves with count inspection and dotted incomplete periods.\n * Rates are not recomputed from counts. Compose inside VisualizationWidget. */\nexport function RetentionChart({\n series,\n unit,\n ariaLabel,\n className,\n formatValue = formatNumber,\n horizontalGrid = true,\n interactiveLegend = true,\n}: RetentionChartProps) {\n const legendFocus = useChartLegendFocus(series.map(item => item.id));\n const { rows, rowsByOffset, cohorts } = createRetentionModel(\n series,\n unit,\n formatValue\n );\n return (\n <section\n className={classNames('altertable-retention-chart', className)}\n aria-label={ariaLabel}\n >\n {rows.length === 0 ? (\n <span>No data</span>\n ) : (\n <>\n <ComposedChart data={rows} ariaLabel={`${ariaLabel} plot`}>\n {horizontalGrid && <ComposedChart.CartesianGrid />}\n <ComposedChart.XAxis\n dataKey=\"offset\"\n type=\"number\"\n domain={[0, Math.max(1, rows.at(-1)?.offset ?? 0)]}\n ticks={rows.map(row => row.offset)}\n tickFormatter={value =>\n rowsByOffset.get(Number(value))?.label ?? ''\n }\n />\n <ComposedChart.YAxis\n domain={[0, 100]}\n width={42}\n tickFormatter={value => `${value}%`}\n />\n {cohorts.map(item => (\n <Fragment key={item.id}>\n <ComposedChart.Line\n dataKey={(row: RetentionRow) =>\n row.readings.get(item.id)?.completePercent ?? null\n }\n name={item.label}\n stroke={item.color}\n opacity={interactiveLegend ? legendFocus.opacity(item.id) : 1}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n connectNulls={false}\n />\n <ComposedChart.Line\n dataKey={(row: RetentionRow) =>\n row.readings.get(item.id)?.incompletePercent ?? null\n }\n name={item.label}\n stroke={item.color}\n opacity={interactiveLegend ? legendFocus.opacity(item.id) : 1}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n strokeDasharray=\"3 3\"\n dot={false}\n activeDot={false}\n connectNulls={false}\n />\n </Fragment>\n ))}\n <ComposedChart.Tooltip\n filterNull={false}\n content={({ active, label }) => {\n const row =\n typeof label === 'number'\n ? rowsByOffset.get(label)\n : undefined;\n if (!active || !row) return null;\n return (\n <TooltipSurface data-variant=\"chart\" role=\"tooltip\">\n <strong>{row.label}</strong>\n {cohorts.map(item => {\n const reading = row.readings.get(item.id);\n if (\n !reading ||\n (interactiveLegend && !legendFocus.visible(item.id))\n )\n return null;\n return (\n <span key={item.id}>\n {item.label}: {reading.description}\n </span>\n );\n })}\n </TooltipSurface>\n );\n }}\n />\n </ComposedChart>\n <ChartLegend aria-label={`${ariaLabel} cohorts`}>\n {cohorts.map(item => (\n <ChartLegend.Item\n key={item.id}\n data-legend-muted={\n (interactiveLegend &&\n legendFocus.hoveredId &&\n (!legendFocus.focusedIds ||\n legendFocus.focusedIds.has(legendFocus.hoveredId)) &&\n legendFocus.hoveredId !== item.id) ||\n undefined\n }\n data-legend-excluded={\n (interactiveLegend && !legendFocus.visible(item.id)) ||\n undefined\n }\n >\n {interactiveLegend && cohorts.length > 1 ? (\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action\"\n aria-pressed={!!legendFocus.focusedIds?.has(item.id)}\n onPointerEnter={() => legendFocus.setHoveredId(item.id)}\n onPointerLeave={() => legendFocus.setHoveredId(null)}\n onFocus={() => legendFocus.setHoveredId(item.id)}\n onBlur={() => legendFocus.setHoveredId(null)}\n onClick={() => legendFocus.toggle(item.id)}\n >\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </button>\n ) : (\n <>\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </>\n )}\n </ChartLegend.Item>\n ))}\n </ChartLegend>\n <ul\n className=\"altertable-sr-only\"\n aria-label={`${ariaLabel} readings`}\n >\n {cohorts.map(item => (\n <li key={item.id}>\n {item.label}\n {item.readings.map(reading => (\n <span key={reading.point.offset}>\n {' '}\n · {reading.point.label}: {reading.description}\n </span>\n ))}\n </li>\n ))}\n </ul>\n </>\n )}\n </section>\n );\n}\n","/** Aggregated route; repeated events remain distinct by depth and prefix. */\nexport type JourneyChartPath = {\n /** Unique, nonblank path ID. */\n id: string;\n /** At least one nonblank event; null property means no property grouping. */\n steps: readonly { event: string; property: string | null }[];\n /** Finite, nonnegative population following this route. */\n count: number;\n /** True: converted; false: dropped off; null: no conversion classification. */\n converted: boolean | null;\n /** Stops at the last loaded event, without adding an outcome or expand control. */\n truncated: boolean;\n};\n\nexport type JourneyNode = {\n key: string;\n label: string;\n depth: number;\n outcome: 'event' | 'converted' | 'drop-off' | 'truncated' | 'end' | 'other';\n count: number;\n pathKeys: string[];\n branchKeys?: string[];\n expandable?: boolean;\n expanded?: boolean;\n hiddenBranchCount?: number;\n};\n\nconst journeyOutcomeLabels = {\n truncated: 'More steps',\n 'drop-off': 'Drop-off',\n converted: 'Converted',\n end: 'End of path',\n} as const;\n\nfunction journeyNodes(\n path: JourneyChartPath\n): Omit<JourneyNode, 'count' | 'pathKeys'>[] {\n const nodes: Omit<JourneyNode, 'count' | 'pathKeys'>[] = path.steps.map(\n (step, depth) => ({\n key: JSON.stringify([depth, 'event', step.event, step.property]),\n label:\n step.property === null\n ? step.event\n : `${step.event} · ${step.property}`,\n depth,\n outcome: 'event',\n })\n );\n const outcome = path.truncated\n ? 'truncated'\n : path.converted === false\n ? 'drop-off'\n : path.converted === true\n ? 'converted'\n : 'end';\n nodes.push({\n key: JSON.stringify([nodes.length, outcome]),\n label: journeyOutcomeLabels[outcome],\n depth: nodes.length,\n outcome,\n });\n return nodes;\n}\n\nexport function buildJourneyFlow(\n paths: readonly JourneyChartPath[],\n expandedBranch?: string[]\n) {\n const nodes = new Map<string, JourneyNode>();\n const links = new Map<\n string,\n {\n key: string;\n source: string;\n target: string;\n count: number;\n pathKeys: string[];\n }\n >();\n for (const path of paths) {\n const fullSequence = journeyNodes(path);\n if (path.truncated) fullSequence.pop();\n const sequence =\n expandedBranch === undefined\n ? fullSequence\n : fullSequence.flatMap((node, index) => {\n const branchKeys = fullSequence\n .slice(0, index + 1)\n .map(step => step.key);\n const parentExpanded =\n index <= 1 ||\n branchKeys\n .slice(0, index)\n .every((key, depth) => expandedBranch[depth] === key);\n if (!parentExpanded) return [];\n return [\n {\n ...node,\n key: JSON.stringify(branchKeys),\n branchKeys,\n expandable: index >= 1 && index < fullSequence.length - 1,\n expanded: branchKeys.every(\n (key, depth) => expandedBranch[depth] === key\n ),\n },\n ];\n });\n sequence.forEach((node, index) => {\n const current = nodes.get(node.key) ?? {\n ...node,\n count: 0,\n pathKeys: [],\n };\n current.count += path.count;\n if ('expandable' in node && node.expandable) current.expandable = true;\n current.pathKeys.push(path.id);\n nodes.set(node.key, current);\n const previous = sequence[index - 1];\n if (!previous) return;\n const key = JSON.stringify([previous.key, node.key]);\n const link = links.get(key) ?? {\n key,\n source: previous.key,\n target: node.key,\n count: 0,\n pathKeys: [],\n };\n link.count += path.count;\n link.pathKeys.push(path.id);\n links.set(key, link);\n });\n }\n return { nodes: [...nodes.values()], links: [...links.values()] };\n}\n\nexport function limitJourneyFlow(\n graph: ReturnType<typeof buildJourneyFlow>,\n visibleEventsByDepth: Record<number, number> = {}\n) {\n const nodes: JourneyNode[] = [];\n const replacements = new Map<string, string>();\n for (const depth of new Set(graph.nodes.map(node => node.depth))) {\n const column = graph.nodes\n .filter(node => node.depth === depth)\n .sort(\n (a, b) =>\n Number(Boolean(b.expanded)) - Number(Boolean(a.expanded)) ||\n b.count - a.count ||\n a.key.localeCompare(b.key)\n );\n const events = column.filter(node => node.outcome === 'event');\n const outcomes = column.filter(node => node.outcome !== 'event');\n const limit = visibleEventsByDepth[depth] ?? 3;\n if (events.length <= limit) {\n nodes.push(...column);\n continue;\n }\n nodes.push(...events.slice(0, limit), ...outcomes);\n const hidden = events.slice(limit);\n const key = JSON.stringify(['other', depth]);\n hidden.forEach(node => replacements.set(node.key, key));\n nodes.push({\n key,\n label: 'More events',\n depth,\n outcome: 'other',\n hiddenBranchCount: hidden.length,\n count: hidden.reduce((sum, node) => sum + node.count, 0),\n pathKeys: [...new Set(hidden.flatMap(node => node.pathKeys))],\n });\n }\n const links = new Map<string, (typeof graph.links)[number]>();\n for (const link of graph.links) {\n const source = replacements.get(link.source) ?? link.source;\n const target = replacements.get(link.target) ?? link.target;\n const key = JSON.stringify([source, target]);\n const existing = links.get(key);\n if (existing) {\n existing.count += link.count;\n existing.pathKeys.push(...link.pathKeys);\n } else {\n links.set(key, {\n ...link,\n key,\n source,\n target,\n pathKeys: [...link.pathKeys],\n });\n }\n }\n return { nodes, links: [...links.values()] };\n}\n","import { formatNumber, formatPercent } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport { type ComponentRef, useLayoutEffect, useRef, useState } from 'react';\n\nimport { Button } from './Button.tsx';\nimport type { CountChartProps } from './chart-data.ts';\nimport { classNames } from './classNames.ts';\nimport {\n buildJourneyFlow,\n limitJourneyFlow,\n type JourneyChartPath,\n type JourneyNode,\n} from './journey-flow.ts';\n\nexport type { JourneyChartPath } from './journey-flow.ts';\nexport type JourneyChartProps = CountChartProps & {\n /** Full paths and their population counts. Branches and outcomes are derived internally. */\n paths: readonly JourneyChartPath[];\n};\n\n/** Path exploration with two initial steps, expandable prefixes, and three events per depth.\n * Counts and flows use the Step 1 population. Compose inside VisualizationWidget. */\nexport function JourneyChart({\n paths,\n unit,\n ariaLabel,\n className,\n formatValue = formatNumber,\n}: JourneyChartProps) {\n const ids = new Set<string>();\n let total = 0;\n for (const path of paths) {\n invariant(\n path.id.trim().length > 0 && !ids.has(path.id),\n 'journey path chart IDs must be nonblank and unique.'\n );\n ids.add(path.id);\n invariant(\n Number.isFinite(path.count) && path.count >= 0,\n 'journey chart counts must be finite and nonnegative.'\n );\n total += path.count;\n invariant(\n path.steps.length > 0 &&\n path.steps.every(step => step.event.trim().length > 0),\n 'journey chart paths require nonblank events.'\n );\n }\n invariant(\n Number.isFinite(total),\n 'journey chart total count must be finite.'\n );\n // A changed displayed result starts a new exploration, including in inspection views.\n return (\n <section\n className={classNames('altertable-journey-chart', className)}\n aria-label={ariaLabel}\n >\n {paths.length === 0 ? (\n <span>No data</span>\n ) : (\n <JourneyFlow\n key={JSON.stringify(paths)}\n paths={paths}\n unit={unit}\n formatValue={formatValue}\n />\n )}\n </section>\n );\n}\n\nfunction JourneyFlow({\n paths,\n unit,\n formatValue,\n}: Pick<JourneyChartProps, 'paths' | 'unit'> & {\n formatValue: (value: number) => string;\n}) {\n const [expandedBranch, setExpandedBranch] = useState<string[]>([]);\n const [visibleEventsByDepth, setVisibleEventsByDepth] = useState<\n Record<number, number>\n >({});\n const graph = limitJourneyFlow(\n buildJourneyFlow(paths, expandedBranch),\n visibleEventsByDepth\n );\n const scrollRef = useRef<ComponentRef<'div'>>(null);\n const pendingDepth = useRef<number | null>(null);\n const depthCount = Math.max(0, ...graph.nodes.map(node => node.depth)) + 1;\n const startingCount = graph.nodes\n .filter(node => node.depth === 0)\n .reduce((sum, node) => sum + node.count, 0);\n function percent(count: number) {\n return formatPercent(startingCount > 0 ? count / startingCount : null);\n }\n const nodeWidth = 176;\n const nodeHeight = 96;\n const barWidth = 16;\n const rowSpacing = nodeHeight + 80;\n const columnSpacing = nodeWidth + 112;\n const width = 34 + nodeWidth + (depthCount - 1) * columnSpacing;\n function columnX(depth: number) {\n return 10 + depth * columnSpacing;\n }\n useLayoutEffect(() => {\n const depth = pendingDepth.current;\n const container = scrollRef.current;\n if (depth === null || !container || depth >= depthCount) return;\n pendingDepth.current = null;\n const left = columnX(depth);\n const right = left + nodeWidth + 24;\n const nextLeft =\n left < container.scrollLeft\n ? left - 24\n : right > container.scrollLeft + container.clientWidth\n ? right - container.clientWidth\n : container.scrollLeft;\n if (nextLeft !== container.scrollLeft)\n container.scrollTo({\n left: Math.max(0, nextLeft),\n behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches\n ? 'instant'\n : 'smooth',\n });\n });\n const columns = Array.from({ length: depthCount }, (_, depth) =>\n graph.nodes\n .filter(node => node.depth === depth)\n .sort((a, b) => {\n function rank(node: JourneyNode) {\n return node.outcome === 'event'\n ? 0\n : node.outcome === 'other'\n ? 1\n : 2;\n }\n return (\n rank(a) - rank(b) || b.count - a.count || a.key.localeCompare(b.key)\n );\n })\n );\n const positions = new Map<\n string,\n { node: JourneyNode; x: number; y: number }\n >();\n columns.forEach((column, depth) => {\n const parent = columns[depth - 1]?.find(node => node.expanded);\n const parentY = parent ? positions.get(parent.key)?.y : undefined;\n const top = Math.max(\n 104,\n (parentY ?? 104) - (column.length > 1 ? rowSpacing : 0)\n );\n column.forEach((node, index) =>\n positions.set(node.key, {\n node,\n x: columnX(depth),\n y: top + index * rowSpacing,\n })\n );\n });\n const height = Math.max(\n 280,\n ...[...positions.values()].map(position => position.y + nodeHeight + 40)\n );\n const outgoingOffsets = new Map<string, number>();\n const incomingOffsets = new Map<string, number>();\n const orderedLinks = [...graph.links].sort(\n (a, b) =>\n (positions.get(a.source)?.y ?? 0) - (positions.get(b.source)?.y ?? 0) ||\n (positions.get(a.target)?.y ?? 0) - (positions.get(b.target)?.y ?? 0)\n );\n const links = orderedLinks.flatMap(link => {\n const source = positions.get(link.source);\n const target = positions.get(link.target);\n if (!source || !target || link.count <= 0 || startingCount <= 0) return [];\n const x0 = source.x + barWidth;\n const x1 = target.x;\n const mid = (x0 + x1) / 2;\n const sourceTop = source.y + (outgoingOffsets.get(link.source) ?? 0);\n const targetTop = target.y + (incomingOffsets.get(link.target) ?? 0);\n const thickness = (link.count / startingCount) * nodeHeight;\n outgoingOffsets.set(\n link.source,\n (outgoingOffsets.get(link.source) ?? 0) + thickness\n );\n incomingOffsets.set(\n link.target,\n (incomingOffsets.get(link.target) ?? 0) + thickness\n );\n return [\n {\n muted: target.node.outcome === 'end' || target.node.outcome === 'other',\n d: `M${x0},${sourceTop} C${mid},${sourceTop} ${mid},${targetTop} ${x1},${targetTop} L${x1},${targetTop + thickness} C${mid},${targetTop + thickness} ${mid},${sourceTop + thickness} ${x0},${sourceTop + thickness} Z`,\n },\n ];\n });\n return (\n <div ref={scrollRef} className=\"altertable-journey-scroll\">\n <div\n className=\"altertable-journey-plot\"\n style={{ minWidth: width, minHeight: height }}\n >\n <svg width=\"100%\" height=\"100%\" aria-hidden=\"true\" focusable=\"false\">\n <path\n d={links\n .filter(link => !link.muted)\n .map(link => link.d)\n .join(' ')}\n fill=\"color-mix(in srgb, var(--atbl-chart-5) 22%, var(--atbl-surface))\"\n />\n <path\n d={links\n .filter(link => link.muted)\n .map(link => link.d)\n .join(' ')}\n fill=\"color-mix(in srgb, var(--atbl-muted) 22%, var(--atbl-surface))\"\n />\n </svg>\n {columns.map((column, depth) => (\n <span\n key={depth}\n className=\"altertable-journey-stage\"\n style={{ left: columnX(depth) }}\n >\n {column.length > 0 &&\n column.every(\n node => node.outcome !== 'event' && node.outcome !== 'other'\n )\n ? 'Outcome'\n : `Step ${depth + 1}`}\n </span>\n ))}\n {[...positions.values()].map(({ node, x, y }) => (\n <div\n key={node.key}\n className=\"altertable-journey-node\"\n style={{\n left: x,\n top: y,\n width: nodeWidth,\n height:\n startingCount > 0\n ? (node.count / startingCount) * nodeHeight\n : 0,\n }}\n >\n <div\n className=\"altertable-journey-bar\"\n data-event={node.outcome === 'event' || undefined}\n aria-hidden=\"true\"\n style={{ width: barWidth }}\n />\n <section\n aria-label={`${node.label}, step ${node.depth + 1}, ${formatValue(node.count)} ${unit}`}\n className=\"altertable-journey-label\"\n >\n <span className=\"altertable-journey-name\" title={node.label}>\n {node.label}\n </span>\n <span>\n {formatValue(node.count)} {unit} · {percent(node.count)}\n </span>\n {node.hiddenBranchCount ? (\n <span>\n {node.hiddenBranchCount} hidden{' '}\n {node.hiddenBranchCount === 1 ? 'event' : 'events'}\n </span>\n ) : null}\n </section>\n {node.expandable && (\n <Button\n variant=\"outline\"\n size=\"icon-compact\"\n className=\"altertable-journey-expand\"\n aria-label={`${node.expanded ? 'Less' : 'More'} after ${node.label}, step ${node.depth + 1}`}\n aria-expanded={Boolean(node.expanded)}\n onClick={() => {\n pendingDepth.current = node.expanded ? null : node.depth + 1;\n setVisibleEventsByDepth(limits =>\n Object.fromEntries(\n Object.entries(limits).filter(\n ([depth]) => Number(depth) <= node.depth\n )\n )\n );\n setExpandedBranch(\n node.expanded\n ? (node.branchKeys ?? []).slice(0, -1)\n : (node.branchKeys ?? [])\n );\n }}\n >\n {node.expanded ? '−' : '›'}\n </Button>\n )}\n {node.outcome === 'other' && (\n <Button\n size=\"compact\"\n variant=\"ghost\"\n className=\"altertable-journey-more\"\n aria-label={`Show more events at step ${node.depth + 1}`}\n onClick={() =>\n setVisibleEventsByDepth(limits => ({\n ...limits,\n [node.depth]: (limits[node.depth] ?? 3) + 3,\n }))\n }\n >\n Show more events\n </Button>\n )}\n </div>\n ))}\n </div>\n </div>\n );\n}\n","/** Direct UI composition and static screens. Requests use declared views from /react. */\nimport { withWidgetBoundary } from './DataWidget.tsx';\nimport { MetricWidget as MetricWidgetContent } from './MetricWidget.tsx';\nimport { TableWidget as TableWidgetContent } from './TableWidget.tsx';\nimport { TextWidget as TextWidgetContent } from './TextWidget.tsx';\nimport { VisualizationWidget as VisualizationWidgetContent } from './VisualizationWidget.tsx';\n\nexport { DataAppProvider } from '../mount.tsx';\nexport { isPlainKeyEvent } from './keyboard.ts';\nexport { GettingStarted } from './GettingStarted.tsx';\nexport { DataWidget } from './DataWidget.tsx';\nexport type { WidgetStatus } from './RequestHint.tsx';\nexport type { DataWidgetProps } from './DataWidget.tsx';\nexport const TextWidget = withWidgetBoundary(TextWidgetContent);\nexport type { TextWidgetProps } from './TextWidget.tsx';\n/** Compose an unframed visual with the shared heading and inspection. */\nexport const VisualizationWidget = withWidgetBoundary(\n VisualizationWidgetContent\n);\nexport type { VisualizationWidgetProps } from './VisualizationWidget.tsx';\nexport const TableWidget = withWidgetBoundary(TableWidgetContent);\nexport type { TableWidgetProps } from './TableWidget.tsx';\nexport {\n DataTable,\n DataTableEmptyRow,\n DataTableTimestamp,\n DataTableShare,\n} from './DataTable.tsx';\nexport type {\n DataTableProps,\n DataTableSearch,\n DataTableEmptyRowProps,\n DataTableTimestampProps,\n} from './DataTable.tsx';\nexport const MetricWidget = withWidgetBoundary(MetricWidgetContent);\nexport type { MetricWidgetProps } from './MetricWidget.tsx';\nexport { DimensionPicker } from './DimensionPicker.tsx';\nexport { LiveControl } from './LiveControl.tsx';\nexport type { LiveControlProps, LiveIntervalSeconds } from './LiveControl.tsx';\nexport { useAppFilters } from './app-filters.ts';\nexport { SearchField } from './SearchField.tsx';\nexport type { SearchFieldProps } from './SearchField.tsx';\nexport { searchItems, matchSearchText } from './searchItems.ts';\nexport type {\n SearchAttribute,\n SearchHit,\n SearchItemsOptions,\n SearchMatchValue,\n SearchRange,\n} from './searchItems.ts';\nexport { SearchMatch } from './SearchMatch.tsx';\nexport type { SearchMatchProps } from './SearchMatch.tsx';\nexport { ShimmerText } from './ShimmerText.tsx';\nexport type { ShimmerTextProps } from './ShimmerText.tsx';\nexport { ChoicePicker } from './ChoicePicker.tsx';\nexport type { ChoiceOption, ChoicePickerProps } from './ChoicePicker.tsx';\nexport {\n MenuTrigger,\n MenuButton,\n MenuPopover,\n Menu,\n MenuItem,\n MenuSection,\n MenuSeparator,\n} from './Menu.tsx';\nexport type {\n MenuTriggerProps,\n MenuPopoverProps,\n MenuProps,\n MenuItemProps,\n} from './Menu.tsx';\nexport { GradientScroll } from './GradientScroll.tsx';\nexport type { GradientScrollProps } from './GradientScroll.tsx';\nexport {\n Tabs,\n TabList,\n Tab,\n TabPanels,\n TabPanel,\n useViewTab,\n} from './Tabs.tsx';\nexport { GlossaryExplanation } from './GlossaryExplanation.tsx';\nexport type { GlossaryExplanationProps } from './GlossaryExplanation.tsx';\nexport { GlossaryDefinition } from './GlossaryDefinition.tsx';\nexport type { GlossaryDefinitionProps } from './GlossaryDefinition.tsx';\nexport { AboutData } from './AboutData.tsx';\nexport type {\n AboutDataProps,\n AboutEmpty,\n AboutSubject,\n AboutTab,\n} from './AboutData.tsx';\nexport { PresentStory } from './PresentStory.tsx';\nexport type { PresentStoryProps } from './PresentStory.tsx';\nexport type { StoryFinding, BoundStory } from './story.ts';\nexport { Checkbox } from './Checkbox.tsx';\nexport type { CheckboxProps } from './Checkbox.tsx';\nexport { AppIcon } from './icons.ts';\nexport type { AppIconName, AppIconProps } from './icons.ts';\nexport { Sheet } from './Sheet.tsx';\nexport type { SheetProps } from './Sheet.tsx';\nexport { HelpPopover } from './HelpPopover.tsx';\nexport type { HelpPopoverProps } from './HelpPopover.tsx';\nexport { DataApp } from './StaticDataApp.tsx';\nexport type { DataAppProps } from './StaticDataApp.tsx';\nexport { injectDataAppStyles } from '../styles.ts';\nexport { Tooltip, TooltipProvider } from './Tooltip.tsx';\nexport type { TooltipProps, TooltipProviderProps } from './Tooltip.tsx';\n\nexport { LineChart } from './LineChart.tsx';\nexport type { LineChartProps, LineChartItem } from './LineChart.tsx';\nexport { AreaChart } from './AreaChart.tsx';\nexport type { AreaChartProps, AreaChartItem } from './AreaChart.tsx';\nexport { PieChart } from './PieChart.tsx';\nexport type { PieChartProps, PieChartItem } from './PieChart.tsx';\nexport { ScatterChart } from './ScatterChart.tsx';\nexport type { ScatterChartProps, ScatterChartItem } from './ScatterChart.tsx';\nexport { BarChart } from './BarChart.tsx';\nexport { useChartCursorGroup } from './use-chart-cursor-group.tsx';\nexport type { ChartCursorGroup } from './use-chart-cursor-group.tsx';\nexport type { BarChartProps, BarChartItem } from './BarChart.tsx';\n\nexport { DataValue } from './DataValue.tsx';\nexport type { DataValueProps } from './DataValue.tsx';\nexport type { CsvExport, CsvTable } from './csv-export.ts';\nexport type { TableWidgetColumn } from './TableWidget.tsx';\n\nexport type { DataReading, MetricReading } from '@altertable/data-app/internal';\n\nexport type {\n DataAppStyle,\n DataAppStyleToken,\n DataAppStyleHooks,\n} from '../style-contract.ts';\n\nexport { Select } from './Select.tsx';\nexport type { SelectProps } from './Select.tsx';\nexport { RadioGroup, Radio, SegmentedControl } from './RadioGroup.tsx';\nexport type {\n RadioGroupProps,\n RadioProps,\n SegmentedControlProps,\n} from './RadioGroup.tsx';\nexport { CheckboxGroup } from './CheckboxGroup.tsx';\nexport type { CheckboxGroupProps } from './CheckboxGroup.tsx';\nexport { NumberField, NumberRangeField } from './NumberField.tsx';\nexport type {\n NumberFieldProps,\n NumberRangeFieldProps,\n NumberRange,\n} from './NumberField.tsx';\nexport { FilterBar } from './FilterBar.tsx';\nexport type { FilterBarProps } from './FilterBar.tsx';\nexport { ControlBar } from './ControlBar.tsx';\nexport type { ControlBarProps } from './ControlBar.tsx';\nexport { FilterActions } from './FilterActions.tsx';\nexport type { FilterActionsProps } from './FilterActions.tsx';\n\nexport { NumberFilterPicker } from './NumberFilterPicker.tsx';\nexport type { NumberFilterPickerProps } from './NumberFilterPicker.tsx';\n\nexport { ComposedChart } from './ComposedChart.tsx';\nexport type { ComposedChartProps } from './ComposedChart.tsx';\n\nexport { ChartLegend } from './ChartLegend.tsx';\nexport type {\n ChartLegendProps,\n ChartLegendItemProps,\n ChartLegendMarkerProps,\n ChartLegendLabelProps,\n ChartLegendMarkerKind,\n} from './ChartLegend.tsx';\nexport type { ComposedChartLegendProps } from './ComposedChartLegend.tsx';\n\nexport { FunnelChart } from './FunnelChart.tsx';\nexport type {\n FunnelChartProps,\n FunnelChartStep,\n FunnelChartSeries,\n} from './FunnelChart.tsx';\nexport { RetentionChart } from './RetentionChart.tsx';\nexport type {\n RetentionChartProps,\n RetentionChartPoint,\n RetentionChartSeries,\n} from './RetentionChart.tsx';\nexport { JourneyChart } from './JourneyChart.tsx';\nexport type { JourneyChartProps, JourneyChartPath } from './JourneyChart.tsx';\n\nexport { useSvgId } from './useSvgId.ts';\n\nexport { SearchTypeahead } from './SearchTypeahead.tsx';\nexport type {\n SearchTypeaheadProps,\n SearchSuggestion,\n} from './SearchTypeahead.tsx';\n\nexport { SectionHeading } from './SectionHeading.tsx';\nexport type { SectionHeadingProps } from './SectionHeading.tsx';\nexport { DateDisplay } from './DateDisplay.tsx';\nexport type { DateDisplayProps } from './DateDisplay.tsx';\nexport { useDateFormatting } from '../date-formatting.ts';\n\nexport { ExplorationActionControl } from './ExplorationActionControl.tsx';\nexport type {\n ExplorationActionControlProps,\n ExplorationAction,\n ItemActions,\n} from './ExplorationActionControl.tsx';\n\nexport {\n dateTimeRangeFilter,\n dateTimeRangePresets,\n type DateTimeRangePreset,\n type DateTimeRangeFilter,\n type DateTimeRangeFilterOptions,\n type DateTimeRangeComparison,\n type DateTimeRangeSelection,\n} from './app-filters.ts';\n\nexport {\n DateTimeRangePicker,\n type DateTimeRangePickerProps,\n} from './DateTimeRangePicker.tsx';\n"],"mappings":";;;;;;;;;;AAKA,SAAgB,QAAQ,EAAE,WAAW,GAAG,SAAuB;CAC7D,OACE,oBAAC,cAAD;EACE,GAAI;EACJ,WAAW,aAAa;GAAE,SAAS;GAAO,OAAO;EAAU;CAC5D,CAAA;AAEL;;;ACDA,MAAM,oBAAoBA,kBAAgB,CAAC,CAAC,CAAC,CAAC;CAC5C,aAAa;CACb,UAAU,CAAC;AACb,CAAC;AAKD,MAAM,EAAE,eAA+B,gCAHR,iCAG6B,CAAC;AAE7D,MAAM,iBAAiB,WAAW;CAChC,aAAa;CACb,WAAW;CACX,qBAAqB;AACvB,CAAC;;;AAID,SAAgB,eAAe,EAAE,eAA6C;CAC5E,MAAM,aAAa,kBAAkB,cAAc;CACnD,MAAM,QACJ,WAAW,KAAK,SAAS,WAAW,WAAW,KAAK,SAAS,gBACzD,UACA,WAAW,cAAc,CAAC,WAAW,WACnC,aACA;CAER,OACE,qBAAC,SAAD;EACe;EACb,aAAY;EACZ,SAAS,WAAW;EACpB,gBACE,oBAACC,UAAD;GACE,UAAU,WAAW;GACrB,eAAe,WAAW,QAAQ;GACnC,UAAA;EAEO,CAAA;EAVZ,UAAA,CAaE,qBAAC,WAAD;GACE,WAAU;GACV,cAAY;GACZ,MAAM,UAAU,UAAU,UAAU;GAHtC,UAAA;IAKE,oBAAC,OAAD;KAAK,WAAU;KACb,UAAA,oBAAC,SAAD;MACE,MACE,UAAU,cACN,UACA,UAAU,UACR,UACA;MAER,MAAM;KACP,CAAA;IACE,CAAA;IACL,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,oBAAC,QA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K,oBACJ,qBAAC,QAAD,EAAA,UAAA;SACG,KAAK;SAAkB;SAAQ;SAC/B,KAAK,sBAAsB,IAAI,UAAU;QACtC,EAAA,CAAA,IACJ;OACG;;MACR,KAAK,cACJ,oBAACa,UAAD;OACE,SAAQ;OACR,MAAK;OACL,WAAU;OACV,cAAY,GAAG,KAAK,WAAW,SAAS,OAAO,SAAS,KAAK,MAAM,SAAS,KAAK,QAAQ;OACzF,iBAAe,QAAQ,KAAK,QAAQ;OACpC,eAAe;QACb,aAAa,UAAU,KAAK,WAAW,OAAO,KAAK,QAAQ;QAC3D,yBAAwB,WACtB,OAAO,YACL,OAAO,QAAQ,MAAM,CAAC,CAAC,QACpB,CAAC,WAAW,OAAO,KAAK,KAAK,KAAK,KACrC,CACF,CACF;QACA,kBACE,KAAK,YACA,KAAK,cAAc,CAAC,EAAA,CAAG,MAAM,GAAG,EAAE,IAClC,KAAK,cAAc,CAAC,CAC3B;OACF;OAEC,UAAA,KAAK,WAAW,MAAM;MACjB,CAAA;MAET,KAAK,YAAY,WAChB,oBAACA,UAAD;OACE,MAAK;OACL,SAAQ;OACR,WAAU;OACV,cAAY,4BAA4B,KAAK,QAAQ;OACrD,eACE,yBAAwB,YAAW;QACjC,GAAG;SACF,KAAK,SAAS,OAAO,KAAK,UAAU,KAAK;OAC5C,EAAE;OAEL,UAAA;MAEO,CAAA;KAEP;IA7EE,GAAA,KAAK,GA6EP,CACN;GACE;;CACF,CAAA;AAET;;;;AChTA,MAAa,aAAa,mBAAmBC,YAAiB;;AAG9D,MAAa,sBAAsB,mBACjCC,qBACF;AAEA,MAAa,cAAc,mBAAmBC,aAAkB;AAchE,MAAa,eAAe,mBAAmBC,cAAmB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["registerContext","Button","timeTicks","field","Tooltip","RechartsAreaChart","RechartsLineChart","ChartTooltip","MenuButton","MenuButton","formatNumber","RechartsBarChart","ChartTooltip","MenuButton","AriaRadioGroup","AriaRadio","XAxis","YAxis","NativeXAxis","NativeYAxis","CartesianGrid","NativeCartesianGrid","NativeLine","NativeBar","NativeArea","NativeScatter","Legend","NativeLegend","RechartsComposedChart","Button","TextWidgetContent","VisualizationWidgetContent","TableWidgetContent","MetricWidgetContent"],"sources":["../../src/ui/StaticDataApp.tsx","../../src/ui/GettingStarted.tsx","../../src/ui/GlossaryExplanation.tsx","../../src/ui/GlossaryDefinition.tsx","../../src/ui/Checkbox.tsx","../../src/ui/chart-data.ts","../../src/ui/chart-interaction.tsx","../../src/ui/time-interval.ts","../../src/ui/chart-time.ts","../../src/ui/use-chart-cursor-group.tsx","../../src/ui/chart-date-axis.tsx","../../src/ui/chart-legend-interaction.tsx","../../src/ui/chart-value-format.ts","../../src/ui/ChartLegend.tsx","../../src/ui/chart-primitives.tsx","../../src/ui/use-chart-scroll-to-end.ts","../../src/ui/TrendChart.tsx","../../src/ui/LineChart.tsx","../../src/ui/AreaChart.tsx","../../src/ui/PieChart.tsx","../../src/ui/ScatterChart.tsx","../../src/ui/BarChart.tsx","../../src/ui/RadioGroup.tsx","../../src/ui/CheckboxGroup.tsx","../../src/ui/ComposedChartLegend.tsx","../../src/ui/ComposedChart.tsx","../../src/ui/useSvgId.ts","../../src/ui/FunnelChart.tsx","../../src/ui/RetentionChart.tsx","../../src/ui/journey-flow.ts","../../src/ui/JourneyChart.tsx","../../src/ui/index.ts"],"sourcesContent":["import { DataAppFrame, type StaticDataAppProps } from './DataAppFrame.tsx';\n\nexport type DataAppProps = StaticDataAppProps;\n\n/** Setup and static screens; fetched data uses the declared-view DataApp. */\nexport function DataApp({ csvExport, ...props }: DataAppProps) {\n return (\n <DataAppFrame\n {...props}\n csvExport={csvExport && { loading: false, value: csvExport }}\n />\n );\n}\n","import type { DataClient } from '@altertable/data-app/client';\nimport type { ConnectionOperation } from '@altertable/data-app/contract';\nimport { useMemo } from 'react';\n\nimport { createDataHooks } from '../hooks.ts';\nimport { useDeclaredResult } from '../view-runtime.tsx';\nimport { Button } from './Button.tsx';\nimport { createDataContext as registerContext } from './data-context.ts';\nimport type { DataContext } from './data-context.ts';\nimport { AppIcon } from './icons.ts';\nimport { DataApp } from './StaticDataApp.tsx';\n\nconst connectionContext = registerContext({})({\n description: 'Connection setup',\n glossary: {},\n});\n\n/** Query-backed connection state and next steps for a newly created app. Mount within\n * `DataAppProvider` and supply the app's registered connection operation. */\nexport function GettingStarted({\n dataContext,\n client,\n}: {\n dataContext: DataContext;\n client: DataClient<{ connection: ConnectionOperation }>;\n}) {\n const connectionView = useMemo(\n () =>\n createDataHooks(client).defineView({\n dataContext: connectionContext,\n operation: 'connection',\n describeInput: () => 'the connection',\n }),\n [client]\n );\n const connection = useDeclaredResult(connectionView);\n const state =\n connection.view.kind === 'error' || connection.view.kind === 'stale-error'\n ? 'error'\n : connection.refreshing || !connection.snapshot\n ? 'checking'\n : 'connected';\n\n return (\n <DataApp\n dataContext={dataContext}\n description=\"Check your lakehouse connection, then build a view around a real question.\"\n queries={connection.queries}\n toolbarActions={\n <Button\n disabled={connection.refreshing}\n onClick={() => connection.refetch()}\n >\n Check connection\n </Button>\n }\n >\n <section\n className=\"starter-connection\"\n data-state={state}\n role={state === 'error' ? 'alert' : 'status'}\n >\n <div className=\"starter-connection-icon\">\n <AppIcon\n name={\n state === 'connected'\n ? 'check'\n : state === 'error'\n ? 'error'\n : 'loading'\n }\n size={24}\n />\n </div>\n <div className=\"starter-connection-copy\">\n <span className=\"starter-eyebrow\">Lakehouse connection</span>\n <h2>\n {state === 'connected'\n ? 'Connected'\n : state === 'error'\n ? 'Connection not verified'\n : 'Checking connection…'}\n </h2>\n <p>\n {state === 'connected'\n ? 'A query completed successfully using this app’s current profile. You’re ready to build your first view.'\n : state === 'error'\n ? connection.snapshot\n ? 'An earlier query succeeded, but the latest check failed. Check the profile and try again.'\n : 'The query could not complete. Check the profile and lakehouse access, then try again.'\n : 'Running a lightweight query with this app’s current profile.'}\n </p>\n {state === 'connected' && (\n <small>This check does not verify access to every dataset.</small>\n )}\n </div>\n {state === 'error' && (\n <Button onClick={() => connection.refetch()}>Try again</Button>\n )}\n </section>\n\n <section className=\"starter-next\" aria-labelledby=\"starter-next-title\">\n <div className=\"starter-next-heading\">\n <span className=\"starter-eyebrow\">Next steps</span>\n <h2 id=\"starter-next-title\">Turn this starter into a useful app</h2>\n <p>Start with one question your readers need answered.</p>\n </div>\n <ol className=\"starter-steps\">\n <li>\n <strong>Choose a question</strong>\n <p>\n Decide what someone should learn or do after opening this app.\n </p>\n </li>\n <li>\n <strong>Find the right data</strong>\n <p>\n Inspect the relevant catalogs, tables, and columns before writing\n the query.\n </p>\n </li>\n <li>\n <strong>Build the first view</strong>\n <p>\n Replace the connection check in <code>src/operations.ts</code>,\n then render its result in <code>src/App.tsx</code>.\n </p>\n </li>\n </ol>\n </section>\n </DataApp>\n );\n}\n","import { type DisclosedQuery } from '@altertable/data-app/contract';\nimport { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { AboutData, type AboutEmpty } from './AboutData.tsx';\nimport { type DataContext, type GlossaryEntry } from './data-context.ts';\nimport { AppIcon } from './icons.ts';\n\nexport type GlossaryExplanationProps = {\n entry: GlossaryEntry;\n empty?: AboutEmpty;\n title?: ReactNode;\n description?: ReactNode;\n visual?: ReactNode;\n queries?: DisclosedQuery[];\n dataContext?: DataContext;\n} & Omit<ComponentPropsWithRef<'button'>, 'children' | 'title'>;\n\n/** Opens the inspect sheet for one glossary term. Prefer a card's evidence slot\n * when the surface already has a title, description, and visual. */\nexport function GlossaryExplanation({\n entry,\n empty,\n title,\n description,\n visual,\n queries,\n dataContext,\n className,\n ...props\n}: GlossaryExplanationProps) {\n return (\n <AboutData\n {...props}\n shortcut={false}\n iconOnly\n variant=\"ghost\"\n title={title ?? entry.term}\n description={description}\n visual={visual}\n references={{ kind: 'entries', entries: [entry] }}\n empty={empty}\n dataContext={dataContext}\n queries={queries}\n className={className ?? 'altertable-inspect-trigger'}\n tooltip=\"Explore this term\"\n aria-label={props['aria-label'] ?? `Explore ${entry.term}`}\n >\n <AppIcon name=\"openDetails\" />\n </AboutData>\n );\n}\n","import { type ReactNode } from 'react';\n\nimport { type GlossaryEntry } from './data-context.ts';\nimport { HelpPopover } from './HelpPopover.tsx';\n\nexport type GlossaryDefinitionProps = {\n entry: GlossaryEntry;\n children?: ReactNode;\n};\n\nexport function GlossaryDefinition({\n entry,\n children,\n}: GlossaryDefinitionProps) {\n return (\n <HelpPopover\n trigger={children ?? entry.term}\n triggerLabel={`Explain ${entry.term}`}\n label={entry.term}\n triggerProps={{\n className: 'altertable-glossary-definition-trigger',\n 'data-atbl-control': 'help',\n }}\n panelProps={{ className: 'altertable-glossary-definition-popover' }}\n >\n <strong>{entry.term}</strong>\n <div>{entry.definition}</div>\n </HelpPopover>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\nimport { createContext, useContext, useId, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\nimport { SelectionMark } from './SelectionMark.tsx';\n\nexport const CheckboxGroupContext = createContext<{\n values: readonly string[];\n disabled?: boolean;\n onChange: (value: string, checked: boolean) => void;\n} | null>(null);\nexport type CheckboxProps = {\n label: string;\n description?: ReactNode;\n disabled?: boolean;\n className?: string;\n} & (\n | { value: string; checked?: never; onChange?: never }\n | { value?: never; checked: boolean; onChange: (checked: boolean) => void }\n);\nexport function Checkbox({\n label,\n description,\n checked,\n value,\n onChange,\n disabled,\n className,\n}: CheckboxProps) {\n const group = useContext(CheckboxGroupContext);\n const descriptionId = useId();\n invariant(\n value === undefined || group,\n 'A checkbox with value must belong to a CheckboxGroup.'\n );\n const selected =\n value === undefined ? checked : group!.values.includes(value);\n return (\n <label\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n className={classNames('altertable-checkbox', className)}\n >\n <input\n type=\"checkbox\"\n value={value}\n checked={selected}\n aria-label={label}\n aria-describedby={description ? descriptionId : undefined}\n disabled={disabled || group?.disabled}\n onChange={event => {\n if (value === undefined) onChange!(event.currentTarget.checked);\n else group!.onChange(value, event.currentTarget.checked);\n }}\n />\n <SelectionMark selected={selected} />\n <span>\n {label}\n {description && <small id={descriptionId}>{description}</small>}\n </span>\n </label>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\n\nimport type { ItemActions } from './ExplorationActionControl.tsx';\nimport type { ChartCursorGroup } from './use-chart-cursor-group.tsx';\n\n/** Match Recharts data keys, including nested paths and literal dotted keys. */\nexport function chartField(row: unknown, key: string | number): unknown {\n if (row == null || typeof row !== 'object') return undefined;\n if (key in row) return (row as Record<string | number, unknown>)[key];\n return String(key)\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .split('.')\n .reduce<unknown>(\n (value, part) =>\n value != null && typeof value === 'object'\n ? (value as Record<string, unknown>)[part]\n : undefined,\n row\n );\n}\n\n/** Ordered category or time-series sample. IDs are unique and nonblank; values are finite. */\nexport type ChartItem = { id: string; label: string; value: number };\nexport type CartesianChartItem = ChartItem & {\n /** Optional timestamp in epoch milliseconds for cursor linking. Omit for category samples. */\n time?: number;\n};\nexport type HorizontalGridProps = {\n /** Draw horizontal grid lines behind the plotted values. */\n horizontalGrid?: boolean;\n};\nexport type CartesianChartProps<Row extends CartesianChartItem> =\n ValueChartProps<Row> &\n HorizontalGridProps & {\n /** Share mouse-hover timestamps with charts receiving the same handle. Matches each item's time exactly. */\n cursorGroup?: ChartCursorGroup;\n };\nexport type ValueChartProps<Row extends ChartItem = ChartItem> = {\n /** Ordered samples; the chart validates IDs and values when rendering. */\n items: readonly Row[];\n /** Actions available for each displayed item. Domain fields remain available to this callback. */\n itemActions?: ItemActions<Row>;\n unit: string;\n ariaLabel: string;\n formatValue?: (value: number) => string;\n};\n\nexport type CountChartProps = {\n /** Accessible measure and scope description. */\n ariaLabel: string;\n /** Population unit, such as users or sessions. */\n unit: string;\n /** Formats counts; rates use percentage formatting. */\n formatValue?: (value: number) => string;\n className?: string;\n};\n\n/** Independent observation on two finite numeric axes. */\nexport type ScatterChartItem = {\n id: string;\n label: string;\n x: number;\n y: number;\n};\ntype ValueChartKind = 'bar' | 'line' | 'area' | 'pie';\n\nfunction validateChartIds(kind: string, items: readonly { id: string }[]) {\n const ids = new Set<string>();\n for (const item of items) {\n invariant(\n item.id.trim().length > 0,\n `${kind} chart IDs must be nonempty and unique: blank ID.`\n );\n invariant(\n !ids.has(item.id),\n `${kind} chart IDs must be nonempty and unique: duplicate \"${item.id}\".`\n );\n ids.add(item.id);\n }\n}\n\nexport function validateValueChartItems(\n kind: ValueChartKind,\n items: readonly ChartItem[]\n): void {\n validateChartIds(kind, items);\n for (const item of items) {\n invariant(\n Number.isFinite(item.value),\n `${kind} chart \"${item.id}\" requires finite values.`\n );\n invariant(\n (kind !== 'bar' && kind !== 'pie') || item.value >= 0,\n `${kind} chart \"${item.id}\" requires nonnegative values.`\n );\n }\n}\n\nexport function validateScatterChartItems(\n items: readonly ScatterChartItem[]\n): void {\n validateChartIds('scatter', items);\n for (const item of items) {\n invariant(\n Number.isFinite(item.x) && Number.isFinite(item.y),\n `scatter chart \"${item.id}\" requires finite values for x and y.`\n );\n }\n}\n","import {\n createContext,\n useContext,\n useId,\n useEffect,\n type ReactNode,\n} from 'react';\n\n/** Coordinates in the chart SVG, shared by pointer tracking and active samples. */\nexport type ChartPoint = { x: number; y: number };\nexport type ChartBarPoint = ChartPoint & {\n width: number;\n height: number;\n index: number;\n seriesId: string;\n payload: unknown;\n};\nexport type ChartDataKey = string | number | ((row: unknown) => unknown);\nexport type ChartAxis = 'x' | 'y';\n\nexport function chartAxisKey(axis: ChartAxis, id: string | number) {\n return `${axis}:${typeof id}:${id}`;\n}\n\ntype ChartInteractionApi = {\n isPointerInspection: boolean;\n activePoint: ChartPoint | undefined;\n seriesCount: number;\n activeBar: ChartBarPoint | null;\n getCategoryDataKey: (axisId: string | number) => ChartDataKey | undefined;\n activeSeriesId: string | null;\n};\n\ntype ChartRegistrationApi = {\n /** Line and area series register the sample at the current inspection position. */\n registerPoint: (id: string, x: number, y: number) => () => void;\n registerBar: (bar: ChartBarPoint) => () => void;\n registerSeries: (id: string) => () => void;\n registerCategoryAxis: (\n axis: ChartAxis,\n id: string | number,\n dataKey: ChartDataKey\n ) => () => void;\n setHoveredSeriesId: (id: string | null) => void;\n};\n\nexport const ChartInteractionContext =\n createContext<ChartInteractionApi | null>(null);\nexport const ChartRegistrationContext =\n createContext<ChartRegistrationApi | null>(null);\n\nexport function isChartSeriesActive(\n interaction: ChartInteractionApi | null,\n seriesId: string\n) {\n return (\n !interaction?.isPointerInspection ||\n interaction.seriesCount === 1 ||\n interaction.activeSeriesId === seriesId\n );\n}\n\nexport function useChartSeries(id?: string) {\n const generatedId = useId();\n const interaction = useContext(ChartInteractionContext);\n const registration = useContext(ChartRegistrationContext);\n const seriesId = id ?? generatedId;\n const registerSeries = registration?.registerSeries;\n useEffect(() => registerSeries?.(seriesId), [registerSeries, seriesId]);\n return {\n id: seriesId,\n active: isChartSeriesActive(interaction, seriesId),\n };\n}\n\nexport function ChartSeries({\n id,\n children,\n}: {\n id: string;\n children: ReactNode;\n}) {\n const registration = useContext(ChartRegistrationContext);\n return (\n <g\n onPointerOver={() => registration?.setHoveredSeriesId(id)}\n onPointerDown={() => registration?.setHoveredSeriesId(id)}\n >\n {children}\n </g>\n );\n}\n","/*!\n * TypeScript port of d3-time 3.1.0 (ISC), https://github.com/d3/d3-time/tree/v3.1.0\n * Numeric tick-step helpers adapted from d3-array 3.2.4 (ISC).\n *\n * Copyright 2010-2022 Mike Bostock (d3-time)\n * Copyright 2010-2023 Mike Bostock (d3-array tick-step helpers)\n *\n * Permission to use, copy, modify, and/or distribute this software for any purpose\n * with or without fee is hereby granted, provided that the above copyright notice\n * and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n * THIS SOFTWARE.\n */\n\ntype DateValue = Date | number;\ntype DateMutation = (date: Date) => void;\ntype DateOffset = (date: Date, step: number) => void;\ntype DateCount = (start: Date, end: Date) => number;\n\nexport interface TimeInterval {\n (date?: DateValue): Date;\n floor(this: void, date: DateValue): Date;\n ceil(this: void, date: DateValue): Date;\n round(this: void, date: DateValue): Date;\n offset(this: void, date: DateValue, step?: number): Date;\n range(this: void, start: DateValue, stop: DateValue, step?: number): Date[];\n filter(this: void, test: (date: Date) => boolean): TimeInterval;\n}\n\nexport interface CountableTimeInterval extends TimeInterval {\n count(this: void, start: DateValue, end: DateValue): number;\n every(this: void, step: number): TimeInterval | null;\n}\n\nexport function timeInterval(\n floor: DateMutation,\n offset: DateOffset\n): TimeInterval;\nexport function timeInterval(\n floor: DateMutation,\n offset: DateOffset,\n count: DateCount,\n field?: (date: Date) => number\n): CountableTimeInterval;\nexport function timeInterval(\n floor: DateMutation,\n offset: DateOffset,\n count?: DateCount,\n field?: (date: Date) => number\n): TimeInterval {\n function interval(value?: DateValue): Date {\n const date = arguments.length === 0 ? new Date() : new Date(+value!);\n floor(date);\n return date;\n }\n interval.floor = (value: DateValue): Date => {\n const date = new Date(+value);\n floor(date);\n return date;\n };\n interval.ceil = (value: DateValue): Date => {\n const date = new Date(+value - 1);\n floor(date);\n offset(date, 1);\n floor(date);\n return date;\n };\n interval.round = (value: DateValue): Date => {\n const before = interval(value);\n const after = interval.ceil(value);\n return +value - +before < +after - +value ? before : after;\n };\n interval.offset = (value: DateValue, step?: number): Date => {\n const date = new Date(+value);\n offset(date, step == null ? 1 : Math.floor(step));\n return date;\n };\n interval.range = (\n start: DateValue,\n stop: DateValue,\n step?: number\n ): Date[] => {\n const range: Date[] = [];\n const date = interval.ceil(start);\n const stride = step == null ? 1 : Math.floor(step);\n if (!(+date < +stop) || !(stride > 0)) return range;\n let previous: Date;\n do {\n previous = new Date(+date);\n range.push(previous);\n offset(date, stride);\n floor(date);\n } while (+previous < +date && +date < +stop);\n return range;\n };\n interval.filter = (test: (date: Date) => boolean): TimeInterval =>\n timeInterval(\n date => {\n if (!Number.isNaN(+date)) {\n floor(date);\n while (!test(date)) {\n date.setTime(+date - 1);\n floor(date);\n }\n }\n },\n (date, step) => {\n if (!Number.isNaN(+date)) {\n const direction = step < 0 ? -1 : 1;\n for (let remaining = Math.abs(step); remaining > 0; --remaining) {\n do {\n offset(date, direction);\n } while (!test(date));\n }\n }\n }\n );\n if (count) {\n interval.count = (start: DateValue, end: DateValue): number => {\n countStart.setTime(+start);\n countEnd.setTime(+end);\n floor(countStart);\n floor(countEnd);\n return Math.floor(count(countStart, countEnd));\n };\n interval.every = (step: number): TimeInterval | null => {\n step = Math.floor(step);\n if (!Number.isFinite(step) || !(step > 0)) return null;\n if (step === 1) return interval;\n return interval.filter(\n field\n ? date => field(date) % step === 0\n : date => interval.count!(0, date) % step === 0\n );\n };\n }\n return interval;\n}\n\nconst countStart = new Date();\nconst countEnd = new Date();\nconst durationSecond = 1000;\nconst durationMinute = durationSecond * 60;\nconst durationHour = durationMinute * 60;\nconst durationDay = durationHour * 24;\nconst durationWeek = durationDay * 7;\nconst durationMonth = durationDay * 30;\nconst durationYear = durationDay * 365;\n\nconst millisecond = timeInterval(\n () => {\n // noop\n },\n (date, step) => {\n date.setTime(+date + step);\n },\n (start, end) => {\n return +end - +start;\n }\n);\n\n// An optimized implementation for this simple case.\nmillisecond.every = k => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval(\n date => {\n date.setTime(Math.floor(+date / k) * k);\n },\n (date, step) => {\n date.setTime(+date + step * k);\n },\n (start, end) => {\n return (+end - +start) / k;\n }\n );\n};\n\nconst second = timeInterval(\n date => {\n date.setTime(+date - date.getMilliseconds());\n },\n (date, step) => {\n date.setTime(+date + step * durationSecond);\n },\n (start, end) => {\n return (+end - +start) / durationSecond;\n },\n date => {\n return date.getUTCSeconds();\n }\n);\n\nexport const timeMinute = timeInterval(\n date => {\n date.setTime(\n +date - date.getMilliseconds() - date.getSeconds() * durationSecond\n );\n },\n (date, step) => {\n date.setTime(+date + step * durationMinute);\n },\n (start, end) => {\n return (+end - +start) / durationMinute;\n },\n date => {\n return date.getMinutes();\n }\n);\n\nexport const utcMinute = timeInterval(\n date => {\n date.setUTCSeconds(0, 0);\n },\n (date, step) => {\n date.setTime(+date + step * durationMinute);\n },\n (start, end) => {\n return (+end - +start) / durationMinute;\n },\n date => {\n return date.getUTCMinutes();\n }\n);\n\nexport const timeHour = timeInterval(\n date => {\n date.setTime(\n +date -\n date.getMilliseconds() -\n date.getSeconds() * durationSecond -\n date.getMinutes() * durationMinute\n );\n },\n (date, step) => {\n date.setTime(+date + step * durationHour);\n },\n (start, end) => {\n return (+end - +start) / durationHour;\n },\n date => {\n return date.getHours();\n }\n);\n\nexport const utcHour = timeInterval(\n date => {\n date.setUTCMinutes(0, 0, 0);\n },\n (date, step) => {\n date.setTime(+date + step * durationHour);\n },\n (start, end) => {\n return (+end - +start) / durationHour;\n },\n date => {\n return date.getUTCHours();\n }\n);\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) =>\n (+end -\n +start -\n (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) /\n durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval(\n date => {\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n },\n (start, end) => {\n return (+end - +start) / durationDay;\n },\n date => {\n return date.getUTCDate() - 1;\n }\n);\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval(\n date => {\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n },\n (start, end) => {\n return (+end - +start) / durationDay;\n },\n date => {\n return Math.floor(+date / durationDay);\n }\n);\n\nexport const unixDays = unixDay.range;\n\nfunction timeWeekday(i: number) {\n return timeInterval(\n date => {\n date.setDate(date.getDate() - ((date.getDay() + 7 - i) % 7));\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setDate(date.getDate() + step * 7);\n },\n (start, end) => {\n return (\n (+end -\n +start -\n (end.getTimezoneOffset() - start.getTimezoneOffset()) *\n durationMinute) /\n durationWeek\n );\n }\n );\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i: number) {\n return timeInterval(\n date => {\n date.setUTCDate(date.getUTCDate() - ((date.getUTCDay() + 7 - i) % 7));\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n },\n (start, end) => {\n return (+end - +start) / durationWeek;\n }\n );\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n\nexport const timeMonth = timeInterval(\n date => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setMonth(date.getMonth() + step);\n },\n (start, end) => {\n return (\n end.getMonth() -\n start.getMonth() +\n (end.getFullYear() - start.getFullYear()) * 12\n );\n },\n date => {\n return date.getMonth();\n }\n);\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval(\n date => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n },\n (start, end) => {\n return (\n end.getUTCMonth() -\n start.getUTCMonth() +\n (end.getUTCFullYear() - start.getUTCFullYear()) * 12\n );\n },\n date => {\n return date.getUTCMonth();\n }\n);\n\nexport const utcMonths = utcMonth.range;\n\nexport const timeYear = timeInterval(\n date => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n },\n (start, end) => {\n return end.getFullYear() - start.getFullYear();\n },\n date => {\n return date.getFullYear();\n }\n);\n\n// An optimized implementation for this simple case.\ntimeYear.every = k => {\n return !isFinite((k = Math.floor(k))) || !(k > 0)\n ? null\n : timeInterval(\n date => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n }\n );\n};\n\nexport const utcYear = timeInterval(\n date => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n },\n (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n },\n date => {\n return date.getUTCFullYear();\n }\n);\n\n// An optimized implementation for this simple case.\nutcYear.every = k => {\n return !isFinite((k = Math.floor(k))) || !(k > 0)\n ? null\n : timeInterval(\n date => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n },\n (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n }\n );\n};\n\nconst e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(\n start: number,\n stop: number,\n count: number\n): [number, number, number] {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2)\n return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nfunction tickIncrement(start: number, stop: number, count: number): number {\n return tickSpec(start, stop, count)[2];\n}\n\nfunction tickStep(start: number, stop: number, count: number): number {\n const reverse = stop < start,\n inc = reverse\n ? tickIncrement(stop, start, count)\n : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n\nfunction ticker(\n year: CountableTimeInterval,\n month: CountableTimeInterval,\n week: CountableTimeInterval,\n day: CountableTimeInterval,\n hour: CountableTimeInterval,\n minute: CountableTimeInterval\n) {\n const tickIntervals: [CountableTimeInterval, number, number][] = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [hour, 1, durationHour],\n [hour, 3, 3 * durationHour],\n [hour, 6, 6 * durationHour],\n [hour, 12, 12 * durationHour],\n [day, 1, durationDay],\n [day, 2, 2 * durationDay],\n [week, 1, durationWeek],\n [month, 1, durationMonth],\n [month, 3, 3 * durationMonth],\n [year, 1, durationYear],\n ];\n\n function ticks(\n start: DateValue,\n stop: DateValue,\n count: number | TimeInterval\n ): Date[] {\n const reverse = +stop < +start;\n if (reverse) [start, stop] = [stop, start];\n const interval =\n typeof count !== 'number' ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(\n start: DateValue,\n stop: DateValue,\n count: number\n ): TimeInterval | null {\n const target = Math.abs(+stop - +start) / count;\n let low = 0;\n let high = tickIntervals.length;\n if (Number.isNaN(target)) low = high;\n while (low < high) {\n const middle = (low + high) >>> 1;\n // Binary-search bounds keep the midpoint within the interval table.\n if (tickIntervals[middle]![2] <= target) low = middle + 1;\n else high = middle;\n }\n const i = low;\n if (i === tickIntervals.length)\n return year.every(\n tickStep(+start / durationYear, +stop / durationYear, count)\n );\n if (i === 0)\n return millisecond.every(Math.max(tickStep(+start, +stop, count), 1));\n // The edge cases above leave an interval on both sides of i.\n const previous = tickIntervals[i - 1]!;\n const next = tickIntervals[i]!;\n const [t, step] = target / previous[2] < next[2] / target ? previous : next;\n return t.every(step);\n }\n\n return [ticks, tickInterval] as const;\n}\n\nconst [utcTicks] = ticker(\n utcYear,\n utcMonth,\n utcSunday,\n unixDay,\n utcHour,\n utcMinute\n);\nconst [timeTicks] = ticker(\n timeYear,\n timeMonth,\n timeSunday,\n timeDay,\n timeHour,\n timeMinute\n);\n\nexport { utcTicks, timeTicks };\nexport {\n millisecond as timeMillisecond,\n millisecond as utcMillisecond,\n second as timeSecond,\n second as utcSecond,\n timeSunday as timeWeek,\n utcSunday as utcWeek,\n};\n","import {\n formatDate,\n formatDateTime,\n parseDateTime,\n} from '@altertable/data-app/format';\n\nimport { utcTicks } from './time-interval.ts';\n\nconst day = 86_400_000;\nconst calendarDatePattern = /^\\d{4}-\\d{2}-\\d{2}$/;\nfunction isCalendarDate(value: unknown): value is string {\n return typeof value === 'string' && calendarDatePattern.test(value);\n}\n/** Only ISO calendar dates and zoned instants are inferred. Numbers require scale=\"utc\". */\nexport function chartTimestamp(value: unknown, numeric = false): number | null {\n if (isCalendarDate(value)) {\n return parseDateTime(`${value}T00:00:00Z`)?.getTime() ?? null;\n }\n if (\n value instanceof Date ||\n typeof value === 'string' ||\n (numeric && typeof value === 'number')\n ) {\n return parseDateTime(value)?.getTime() ?? null;\n }\n return null;\n}\n\ntype ChartTimeModel = {\n start: number;\n end: number;\n times: readonly number[];\n /** Smallest gap in milliseconds; a single instant uses a one-day extent. */\n minimumInterval: number;\n tooltip: (value: unknown) => string;\n};\n\nexport function timeModel(\n values: readonly unknown[],\n numeric = false\n): ChartTimeModel | null {\n const timestamps = new Set<number>();\n for (const value of values) {\n const timestamp = chartTimestamp(value, numeric);\n if (timestamp == null) return null;\n timestamps.add(timestamp);\n }\n const times = [...timestamps].sort((a, b) => a - b);\n const start = times[0];\n const end = times.at(-1);\n if (start == null || end == null) return null;\n let minimumInterval = Infinity;\n for (let index = 1; index < times.length; index++) {\n minimumInterval = Math.min(\n minimumInterval,\n times[index]! - times[index - 1]!\n );\n }\n if (times.length === 1) minimumInterval = day;\n const dateOnly = values.every(isCalendarDate);\n const seconds =\n times.some(value => value % 60_000 !== 0) || minimumInterval < 60_000;\n const milliseconds =\n times.some(value => value % 1_000 !== 0) || minimumInterval < 1_000;\n function tooltip(value: unknown) {\n const time = chartTimestamp(value, true);\n if (time == null)\n return typeof value === 'string' || typeof value === 'number'\n ? String(value)\n : '';\n if (dateOnly) return formatDate(new Date(time).toISOString().slice(0, 10));\n if (milliseconds) {\n return new Intl.DateTimeFormat('en-US', {\n timeZone: 'UTC',\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n fractionalSecondDigits: 3,\n hourCycle: 'h23',\n }).format(time);\n }\n return formatDateTime(time, {\n precision: seconds ? 'second' : 'minute',\n timeZone: 'UTC',\n });\n }\n return {\n start,\n end,\n times,\n minimumInterval,\n tooltip,\n };\n}\n\nfunction datePart(value: number, options: Intl.DateTimeFormatOptions) {\n return new Intl.DateTimeFormat('en-US', {\n ...options,\n timeZone: 'UTC',\n }).format(value);\n}\n\nexport function timeTicks(model: ChartTimeModel, width: number) {\n const { start, end } = model;\n const firstDate = new Date(start);\n const lastDate = new Date(end);\n // Context distinguishes calendar boundaries within the displayed extent.\n // Constant context belongs in the exact tooltip, not repeated axis labels.\n const spansYears = firstDate.getUTCFullYear() !== lastDate.getUTCFullYear();\n const spansDates =\n firstDate.toISOString().slice(0, 10) !==\n lastDate.toISOString().slice(0, 10);\n const count = Math.max(\n 2,\n Math.min(12, Math.floor(width / 80), model.times.length)\n );\n let ticks =\n start === end\n ? [start]\n : utcTicks(\n new Date(start),\n new Date(end),\n Math.min(count, (end - start) / model.minimumInterval)\n ).map(Number);\n const step =\n ticks.length > 1\n ? ticks[1]! - ticks[0]!\n : Math.max(end - start, model.minimumInterval);\n // Calendar intervals are a hint. Keep the actual extent visible, then thin by pixel distance.\n const candidates = [...new Set([start, ...ticks, end])].sort((a, b) => a - b);\n ticks = [start];\n const gap = step < 1_000 ? 110 : 80;\n for (const value of candidates.slice(1)) {\n if (((value - ticks.at(-1)!) / (end - start)) * width >= gap)\n ticks.push(value);\n }\n if (end !== start && ticks.at(-1) !== end) {\n if (\n ticks.length > 1 &&\n ((end - ticks.at(-1)!) / (end - start)) * width < gap\n )\n ticks.pop();\n ticks.push(end);\n }\n function label(value: number, index: number) {\n const previous = index > 0 ? new Date(ticks[index - 1]!) : undefined;\n const date = new Date(value);\n const yearChanged =\n !previous || previous.getUTCFullYear() !== date.getUTCFullYear();\n const dateChanged =\n !previous ||\n previous.toISOString().slice(0, 10) !== date.toISOString().slice(0, 10);\n if (step >= 300 * day)\n return { main: String(date.getUTCFullYear()), context: '' };\n if (\n step >= 28 * day &&\n (model.minimumInterval >= 28 * day || end - start >= 180 * day)\n )\n return {\n main: datePart(value, { month: 'short' }),\n context: spansYears && yearChanged ? String(date.getUTCFullYear()) : '',\n };\n if (step >= day && !(model.minimumInterval < day && end - start <= 3 * day))\n return {\n main: datePart(value, { month: 'short', day: 'numeric' }),\n context: spansYears && yearChanged ? String(date.getUTCFullYear()) : '',\n };\n return {\n main: datePart(value, {\n hour: '2-digit',\n minute: '2-digit',\n ...(step < 60_000 ? { second: '2-digit' as const } : {}),\n ...(step < 1_000 ? { fractionalSecondDigits: 3 as const } : {}),\n hourCycle: 'h23',\n }),\n context:\n spansDates && dateChanged\n ? datePart(value, {\n month: 'short',\n day: 'numeric',\n ...(spansYears && yearChanged\n ? { year: 'numeric' as const }\n : {}),\n })\n : '',\n };\n }\n return { ticks, label };\n}\n","import {\n createContext,\n useCallback,\n useEffect,\n useId,\n useState,\n useSyncExternalStore,\n} from 'react';\n\ntype Cursor = { source: string; time: number };\ntype CursorStore = {\n snapshot: () => Cursor | null;\n subscribe: (listener: () => void) => () => void;\n publish: (source: string, time: number) => void;\n clear: (source: string) => void;\n};\nconst groupBrand: unique symbol = Symbol('ChartCursorGroup');\n/** Opaque shared-cursor handle. Create with useChartCursorGroup and pass through chart cursorGroup props. */\nexport type ChartCursorGroup = { readonly [groupBrand]: true };\nconst stores = new WeakMap<ChartCursorGroup, CursorStore>();\n\nfunction createGroup(): ChartCursorGroup {\n const group: ChartCursorGroup = { [groupBrand]: true };\n let cursor: Cursor | null = null;\n const listeners = new Set<() => void>();\n function notify() {\n for (const listener of listeners) listener();\n }\n stores.set(group, {\n snapshot: () => cursor,\n subscribe: listener => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n publish: (source, time) => {\n if (\n !Number.isFinite(time) ||\n (cursor?.source === source && cursor.time === time)\n )\n return;\n cursor = { source, time };\n notify();\n },\n clear: source => {\n if (cursor?.source !== source) return;\n cursor = null;\n notify();\n },\n });\n return group;\n}\n\n/** Creates a stable shared mouse-hover cursor handle. Pass it explicitly to each participating chart's cursorGroup prop.\n * Peers indicate exact timestamp matches while tooltips remain local. Mouse leave clears the cursor.\n * Each hook call creates an independent group; handles can be passed through component props.\n * @example\n * function Dashboard() {\n * const operations = useChartCursorGroup();\n * const samples = [{ id: 'noon', label: '12:00', time: 1767268800000, value: 42 }];\n * return <>\n * <BarChart cursorGroup={operations} items={samples} unit=\"requests\" ariaLabel=\"Traffic\" />\n * <LineChart cursorGroup={operations} items={samples} unit=\"ms\" ariaLabel=\"Latency\" />\n * </>;\n * }\n */\nexport function useChartCursorGroup(): ChartCursorGroup {\n const [group] = useState(createGroup);\n return group;\n}\n\nfunction emptySnapshot() {\n return null;\n}\nfunction emptySubscribe() {\n return () => {};\n}\n\nexport function useLinkedChartCursor(group?: ChartCursorGroup) {\n const store = group == null ? undefined : stores.get(group);\n const cursor = useSyncExternalStore(\n store?.subscribe ?? emptySubscribe,\n store?.snapshot ?? emptySnapshot,\n emptySnapshot\n );\n const id = useId();\n const setTime = useCallback(\n (time: number | undefined) => {\n if (time != null) store?.publish(id, time);\n else store?.clear(id);\n },\n [store, id]\n );\n const reset = useCallback(() => store?.clear(id), [store, id]);\n useEffect(() => reset, [reset]);\n return {\n time: cursor?.source !== id ? cursor?.time : undefined,\n setTime,\n reset,\n };\n}\n\nexport const ChartCursorChartContext = createContext<{\n mouseHover: boolean;\n cursor: ReturnType<typeof useLinkedChartCursor>;\n} | null>(null);\n","import { formatNumber } from '@altertable/data-app/format';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useLayoutEffect,\n useState,\n type ComponentProps,\n type ReactNode,\n} from 'react';\nimport {\n XAxis,\n useActiveTooltipLabel,\n useIsTooltipActive,\n useXAxisScale,\n usePlotArea,\n type XAxisTickContentProps,\n} from 'recharts';\n\nimport { chartField as field } from './chart-data.ts';\nimport {\n ChartRegistrationContext,\n type ChartDataKey,\n} from './chart-interaction.tsx';\nimport { chartTimestamp, timeModel, timeTicks } from './chart-time.ts';\nimport { ChartCursorChartContext } from './use-chart-cursor-group.tsx';\n\ntype LabelFormatter = (value: unknown) => string;\ntype ChartDateAxesApi = {\n data: readonly unknown[];\n barAxes: ReadonlyMap<string | number, number>;\n registerBar: (id: string | number) => () => void;\n formatters: ReadonlyMap<string | number, LabelFormatter>;\n register: (id: string | number, formatter: LabelFormatter) => () => void;\n};\nconst ChartDateAxesContext = createContext<ChartDateAxesApi | null>(null);\n\nexport function ChartDateAxes({\n data,\n children,\n}: {\n data: readonly unknown[];\n children: ReactNode;\n}) {\n const [formatters, setFormatters] = useState<\n ReadonlyMap<string | number, LabelFormatter>\n >(() => new Map());\n const register = useCallback(\n (id: string | number, formatter: LabelFormatter) => {\n setFormatters(current => new Map(current).set(id, formatter));\n return () =>\n setFormatters(current => {\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n },\n []\n );\n const [barAxes, setBarAxes] = useState<ReadonlyMap<string | number, number>>(\n () => new Map()\n );\n const registerBar = useCallback((id: string | number) => {\n setBarAxes(current => new Map(current).set(id, (current.get(id) ?? 0) + 1));\n return () =>\n setBarAxes(current => {\n const next = new Map(current);\n const count = (next.get(id) ?? 1) - 1;\n if (count) next.set(id, count);\n else next.delete(id);\n return next;\n });\n }, []);\n return (\n <ChartDateAxesContext.Provider\n value={{ data, formatters, register, barAxes, registerBar }}\n >\n {children}\n </ChartDateAxesContext.Provider>\n );\n}\nexport function useDateAxisBar(id: string | number = 0) {\n const registerBar = useContext(ChartDateAxesContext)?.registerBar;\n useLayoutEffect(() => registerBar?.(id), [registerBar, id]);\n}\nexport function useDateAxisLabel(id: string | number = 0) {\n return useContext(ChartDateAxesContext)?.formatters.get(id);\n}\nconst xAxisDefaults = {\n interval: 'preserveStartEnd' as const,\n stroke: 'var(--atbl-muted)',\n tickFormatter: (value: unknown) =>\n typeof value === 'number' ? formatNumber(value) : String(value),\n tickLine: false,\n axisLine: { stroke: 'var(--atbl-border)' },\n tick: { fontSize: 'var(--atbl-type-meta-size)' },\n};\n\nfunction LinkedTimeCursor({\n times,\n axisId,\n}: {\n times: readonly number[];\n axisId: string | number;\n}) {\n const context = useContext(ChartCursorChartContext);\n const label = useActiveTooltipLabel();\n const active = useIsTooltipActive();\n const scale = useXAxisScale(axisId);\n const plot = usePlotArea();\n const mouseHover = context?.mouseHover;\n const setTime = context?.cursor.setTime;\n const reset = context?.cursor.reset;\n useEffect(() => {\n if (!mouseHover || !active) {\n reset?.();\n } else {\n const time = chartTimestamp(label, true);\n if (time != null && times.includes(time)) setTime?.(time);\n }\n }, [mouseHover, active, label, times, setTime, reset]);\n const time = context?.cursor.time;\n if (time == null || !times.includes(time)) return null;\n const x = scale?.(time);\n if (\n !plot ||\n x == null ||\n !Number.isFinite(x) ||\n x < plot.x ||\n x > plot.x + plot.width\n )\n return null;\n return (\n <line\n aria-hidden=\"true\"\n x1={x}\n x2={x}\n y1={plot.y}\n y2={plot.y + plot.height}\n stroke=\"var(--atbl-muted)\"\n strokeOpacity={0.3}\n pointerEvents=\"none\"\n data-atbl-internal-linked-cursor=\"true\"\n />\n );\n}\n\n/**\n * Infers temporal input from ISO dates, zoned ISO timestamps, and Date values.\n * Use scale=\"utc\" for epoch milliseconds or type=\"category\" for date-like categories.\n * Explicit tick formatters and tick lists retain authored axis behavior while\n * date-like values still receive readable tooltip labels.\n */\nexport function ChartXAxis<Row = unknown, Value = string | number | Date>(\n props: ComponentProps<typeof XAxis<Row, Value>>\n) {\n const context = useContext(ChartDateAxesContext);\n const plot = usePlotArea();\n const data = context?.data;\n const { dataKey, ...axisProps } = props;\n const numeric = props.scale === 'utc';\n const enabled =\n numeric ||\n (props.type == null &&\n props.scale == null &&\n props.tickFormatter == null &&\n props.ticks == null);\n const dateLabelModel = useMemo(() => {\n if (!data?.length || dataKey == null) return null;\n if (props.type === 'category' && props.scale !== 'utc') return null;\n if (\n props.type === 'number' &&\n props.scale !== 'utc' &&\n props.scale !== 'time'\n )\n return null;\n return timeModel(\n data.map(row =>\n typeof dataKey === 'function'\n ? dataKey(row as Row)\n : field(row, dataKey)\n ),\n props.scale === 'utc' || props.scale === 'time'\n );\n }, [data, dataKey, props.type, props.scale]);\n const model = enabled ? dateLabelModel : null;\n const cursorModel =\n props.type !== 'category' &&\n (props.scale === 'utc' || props.scale === 'time')\n ? dateLabelModel\n : null;\n const register = context?.register;\n const id = props.xAxisId ?? 0;\n const registerCategoryAxis = useContext(\n ChartRegistrationContext\n )?.registerCategoryAxis;\n useLayoutEffect(() => {\n if (dataKey == null) return;\n return registerCategoryAxis?.('x', id, dataKey as ChartDataKey);\n }, [registerCategoryAxis, id, dataKey]);\n useEffect(\n () => (dateLabelModel ? register?.(id, dateLabelModel.tooltip) : undefined),\n [register, id, dateLabelModel]\n );\n if (!model || dataKey == null) {\n return (\n <>\n <XAxis<Row, Value> {...xAxisDefaults} {...props} />\n {cursorModel && (\n <LinkedTimeCursor times={cursorModel.times} axisId={id} />\n )}\n </>\n );\n }\n const automaticTicks =\n props.ticks == null && props.tickFormatter == null\n ? timeTicks(model, plot?.width ?? 400)\n : null;\n return (\n <>\n <XAxis<Row, number | null>\n {...xAxisDefaults}\n scale=\"utc\"\n domain={\n model.start === model.end || context?.barAxes.has(id)\n ? [\n model.start - model.minimumInterval / 2,\n model.end + model.minimumInterval / 2,\n ]\n : [model.start, model.end]\n }\n ticks={automaticTicks?.ticks}\n interval={automaticTicks ? 0 : undefined}\n height={48}\n tickFormatter={model.tooltip}\n tick={\n automaticTicks\n ? ({ x, y, payload, index }: XAxisTickContentProps) => {\n const label = automaticTicks.label(\n Number(payload.value),\n index\n );\n return (\n <text\n x={x}\n y={Number(y) + 5}\n fill=\"var(--atbl-muted)\"\n fontSize=\"var(--atbl-type-meta-size)\"\n textAnchor={\n index === 0\n ? 'start'\n : index === automaticTicks.ticks.length - 1\n ? 'end'\n : 'middle'\n }\n >\n <tspan x={x} dy=\"0.8em\">\n {label.main}\n </tspan>\n {label.context && (\n <tspan x={x} dy=\"1.4em\">\n {label.context}\n </tspan>\n )}\n </text>\n );\n }\n : xAxisDefaults.tick\n }\n {...axisProps}\n type=\"number\"\n dataKey={row =>\n chartTimestamp(\n typeof dataKey === 'function' ? dataKey(row) : field(row, dataKey),\n numeric\n )\n }\n />\n <LinkedTimeCursor times={model.times} axisId={id} />\n </>\n );\n}\n","import { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport { createContext, useContext, useState } from 'react';\n\nexport function chartLegendSeriesKey(id: unknown, dataKey: unknown) {\n if (typeof id === 'string' || typeof id === 'number')\n return ['series', typeof id, id].join(KEY_SEPARATOR);\n if (typeof dataKey === 'string' || typeof dataKey === 'number')\n return ['data', typeof dataKey, dataKey].join(KEY_SEPARATOR);\n return null;\n}\n\nexport type ChartLegendInteraction = {\n hoveredKey: string | null;\n focusedKeys: ReadonlySet<string> | null;\n suppressPlotInspection: boolean;\n hover: (key: string | null) => void;\n toggle: (key: string, keys: readonly string[]) => void;\n reconcile: (keys: readonly string[]) => void;\n registerBarAxis: (key: string, axisId: string | number) => () => void;\n};\n\nexport function reconcileLegendFocus(\n focused: ReadonlySet<string> | null,\n keys: readonly string[]\n) {\n if (!focused) return null;\n const available = new Set(keys);\n const next = new Set([...focused].filter(key => available.has(key)));\n if (next.size === 0 || next.size === available.size) return null;\n return next.size === focused.size ? focused : next;\n}\n\nexport function toggleLegendFocus(\n focused: ReadonlySet<string> | null,\n key: string,\n keys: readonly string[]\n) {\n const current = reconcileLegendFocus(focused, keys);\n if (!current) return new Set([key]);\n const next = new Set(current);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next.size === 0 || next.size === new Set(keys).size ? null : next;\n}\n\nexport const ChartLegendInteractionContext =\n createContext<ChartLegendInteraction | null>(null);\n\nexport function useChartLegendSeries(id: unknown, dataKey: unknown) {\n const interaction = useContext(ChartLegendInteractionContext);\n const key = chartLegendSeriesKey(id, dataKey);\n return {\n inspectingLegend: !!interaction?.suppressPlotInspection,\n hidden: !!(\n key &&\n interaction?.focusedKeys &&\n !interaction.focusedKeys.has(key)\n ),\n dimmed: !!(\n key &&\n interaction?.hoveredKey &&\n (!interaction.focusedKeys ||\n interaction.focusedKeys.has(interaction.hoveredKey)) &&\n interaction.hoveredKey !== key\n ),\n };\n}\n\nexport function useChartLegendFocus(ids: readonly string[]) {\n const [hoveredId, setHoveredId] = useState<string | null>(null);\n const [storedFocusedIds, setStoredFocusedIds] =\n useState<ReadonlySet<string> | null>(null);\n const focusedIds = reconcileLegendFocus(storedFocusedIds, ids);\n function toggle(id: string) {\n setStoredFocusedIds(current => toggleLegendFocus(current, id, ids));\n }\n return {\n hoveredId,\n setHoveredId,\n focusedIds,\n toggle,\n visible: (id: string) => !focusedIds || focusedIds.has(id),\n opacity: (id: string) =>\n focusedIds && !focusedIds.has(id)\n ? 0\n : hoveredId &&\n (!focusedIds || focusedIds.has(hoveredId)) &&\n hoveredId !== id\n ? 0.2\n : 1,\n };\n}\n","import { formatNumber, type MetricFormat } from '@altertable/data-app/format';\nimport { createContext } from 'react';\n\nexport const ChartValueFormat = createContext<MetricFormat | undefined>(\n undefined\n);\n\n/** Use one magnitude for every tick, and enough precision to distinguish them. */\nexport function axisValueFormatter(\n values: readonly number[],\n format?: MetricFormat\n) {\n const magnitude = Math.max(0, ...values.map(Math.abs));\n const compact =\n format?.kind !== 'ratio' &&\n !(format?.kind === 'count' && format.compact === false);\n const exponent =\n compact && magnitude >= 1000\n ? Math.min(12, Math.floor(Math.log10(magnitude) / 3) * 3)\n : 0;\n const divisor = 10 ** exponent;\n const sorted = [...new Set(values)].sort((a, b) => a - b);\n const step = sorted\n .slice(1)\n .reduce(\n (minimum, value, index) => Math.min(minimum, value - sorted[index]!),\n Infinity\n );\n const displayStep = (step / divisor) * (format?.kind === 'ratio' ? 100 : 1);\n const digits =\n Number.isFinite(displayStep) && displayStep > 0\n ? Math.min(20, Math.max(0, -Math.floor(Math.log10(displayStep)) + 1))\n : 2;\n const locale = format?.locale ?? 'en-US';\n const options: Intl.NumberFormatOptions = {\n maximumFractionDigits: digits,\n minimumFractionDigits: 0,\n ...(format?.kind === 'currency'\n ? { style: 'currency', currency: format.currency }\n : {}),\n ...(format?.kind === 'ratio' ? { style: 'percent' } : {}),\n };\n const suffix = ['', 'k', 'M', 'B', 'T'][exponent / 3]!;\n const formatter = new Intl.NumberFormat(locale, options);\n return (value: unknown) => {\n if (typeof value !== 'number') return String(value);\n if (!Number.isFinite(value)) return formatNumber(value);\n const parts = formatter.formatToParts(value === 0 ? 0 : value / divisor);\n const index = parts.findLastIndex(\n part => part.type === 'integer' || part.type === 'fraction'\n );\n return parts\n .map((part, i) => part.value + (i === index && value !== 0 ? suffix : ''))\n .join('');\n };\n}\n","import {\n type ComponentRef,\n Children,\n useId,\n useEffect,\n useRef,\n useState,\n type ComponentPropsWithRef,\n type ReactNode,\n} from 'react';\n\nimport { chartBarFill } from './chartColor.ts';\nimport { classNames } from './classNames.ts';\n\nexport type ChartLegendProps = {\n children: ReactNode;\n /** Single-row fits up to four cells before expansion, adapting to available width. */\n layout?: 'horizontal' | 'vertical' | 'single-row';\n align?: 'start' | 'center' | 'end';\n /** Optional cell cap, including expansion. Horizontal legends default to two rows. */\n maxVisibleItems?: number;\n} & Omit<ComponentPropsWithRef<'ul'>, 'children'>;\n\n/** Optional chart key, placed beside any chart with the app's layout components.\n * Items describe displayed series or categories; the caller owns series visibility and interactions. */\nfunction ChartLegendRoot({\n children,\n layout = 'horizontal',\n align = 'start',\n maxVisibleItems,\n className,\n 'aria-label': ariaLabel = 'Chart legend',\n ...props\n}: ChartLegendProps) {\n const [expanded, setExpanded] = useState(false);\n const listId = useId();\n const containerRef = useRef<ComponentRef<'div'>>(null);\n const [columns, setColumns] = useState(2);\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n function measure() {\n const list = containerRef.current?.querySelector(\n '.altertable-chart-legend'\n );\n if (list) {\n setColumns(\n getComputedStyle(list).gridTemplateColumns.split(' ').length\n );\n }\n }\n const observer = new ResizeObserver(measure);\n observer.observe(container);\n measure();\n return () => observer.disconnect();\n }, [layout]);\n const items = Children.toArray(children);\n const rowCapacity =\n layout === 'vertical' ? 6 : columns * (layout === 'single-row' ? 1 : 2);\n const configuredLimit =\n typeof maxVisibleItems === 'number' && Number.isFinite(maxVisibleItems)\n ? Math.max(1, Math.floor(maxVisibleItems))\n : rowCapacity;\n const cappedLimit = Math.min(configuredLimit, rowCapacity);\n const limit =\n layout === 'vertical'\n ? configuredLimit\n : cappedLimit >= columns\n ? Math.floor(cappedLimit / columns) * columns\n : cappedLimit;\n const visibleCount = items.length > limit ? limit - 1 : limit;\n const hiddenCount = Math.max(0, items.length - visibleCount);\n return (\n <div ref={containerRef} className=\"altertable-chart-legend-container\">\n <ul\n id={listId}\n {...props}\n aria-label={ariaLabel}\n data-layout={layout}\n data-align={align}\n className={classNames('altertable-chart-legend', className)}\n >\n {expanded ? items : items.slice(0, visibleCount)}\n {hiddenCount > 0 && (\n <li className=\"altertable-chart-legend-overflow\">\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action\"\n aria-expanded={expanded}\n aria-controls={props.id ?? listId}\n onClick={() => setExpanded(value => !value)}\n >\n {expanded ? 'Show fewer' : `+${hiddenCount} more`}\n </button>\n </li>\n )}\n </ul>\n </div>\n );\n}\n\nexport type ChartLegendItemProps = ComponentPropsWithRef<'li'> & {\n inactive?: boolean;\n};\n\n/** Descriptive by default; compose a button inside the item for an authored series toggle. */\nfunction ChartLegendItem({\n inactive,\n className,\n ...props\n}: ChartLegendItemProps) {\n return (\n <li\n {...props}\n data-inactive={inactive || undefined}\n className={classNames('altertable-chart-legend-item', className)}\n />\n );\n}\n\nexport type ChartLegendMarkerKind =\n | 'square'\n | 'bar'\n | 'line'\n | 'area'\n | 'point'\n | 'slice';\nexport type ChartLegendMarkerProps = Omit<\n ComponentPropsWithRef<'svg'>,\n 'children'\n> & {\n kind: ChartLegendMarkerKind;\n};\n\n/** Decorative mark; color accepts public palette tokens or any CSS color.\n * Defaults match the shared bar or accent-colored series primitives. */\nfunction ChartLegendMarker({\n kind,\n color = kind === 'bar' ? chartBarFill : 'var(--atbl-chart-1)',\n className,\n style,\n ...props\n}: ChartLegendMarkerProps) {\n return (\n <svg\n {...props}\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox={kind === 'square' ? '0 0 8 8' : '0 0 20 12'}\n data-kind={kind}\n className={classNames('altertable-chart-legend-marker', className)}\n style={{ color, ...style }}\n >\n {kind === 'square' && <rect width=\"8\" height=\"8\" fill=\"currentColor\" />}\n {kind === 'bar' && (\n <path d=\"M6 11V3Q6 1 8 1H12Q14 1 14 3V11Z\" fill=\"currentColor\" />\n )}\n {kind === 'slice' && (\n <rect x=\"5\" y=\"1\" width=\"10\" height=\"10\" rx=\"2\" fill=\"currentColor\" />\n )}\n {kind === 'point' && <circle cx=\"10\" cy=\"6\" r=\"3\" fill=\"currentColor\" />}\n {kind === 'line' && (\n <>\n <path\n d=\"M1 6H19\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n <circle\n cx=\"10\"\n cy=\"6\"\n r=\"2.5\"\n fill=\"var(--atbl-surface)\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n </>\n )}\n {kind === 'area' && (\n <>\n <path\n d=\"M1 10L7 5L13 7L19 2V11H1Z\"\n fill=\"currentColor\"\n fillOpacity=\"0.14\"\n />\n <path\n d=\"M1 10L7 5L13 7L19 2\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </>\n )}\n </svg>\n );\n}\n\nexport type ChartLegendLabelProps = ComponentPropsWithRef<'span'>;\nfunction ChartLegendLabel({\n className,\n children,\n title,\n ...props\n}: ChartLegendLabelProps) {\n return (\n <span\n {...props}\n title={title ?? (typeof children === 'string' ? children : undefined)}\n className={classNames('altertable-chart-legend-label', className)}\n >\n {children}\n </span>\n );\n}\n\nexport const ChartLegend = Object.assign(ChartLegendRoot, {\n Item: ChartLegendItem,\n Marker: ChartLegendMarker,\n Label: ChartLegendLabel,\n});\n","import { useDateAxisLabel, useDateAxisBar } from './chart-date-axis.tsx';\nexport { ChartXAxis } from './chart-date-axis.tsx';\nimport { formatMetric, formatNumber } from '@altertable/data-app/format';\nimport {\n cloneElement,\n isValidElement,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport {\n Area,\n Dot,\n type DotProps,\n Bar,\n Rectangle,\n Line,\n Scatter,\n YAxis,\n useYAxisTicks,\n useCartesianChartLayout,\n usePlotArea,\n CartesianGrid,\n ReferenceLine,\n Tooltip,\n DefaultTooltipContent,\n type TooltipContentProps,\n type BarProps,\n type BarShapeProps,\n type LineProps,\n type AreaProps,\n} from 'recharts';\n\nimport { chartField } from './chart-data.ts';\nimport {\n ChartInteractionContext,\n ChartRegistrationContext,\n type ChartDataKey,\n ChartSeries,\n useChartSeries,\n isChartSeriesActive,\n} from './chart-interaction.tsx';\nimport {\n ChartLegendInteractionContext,\n chartLegendSeriesKey,\n useChartLegendSeries,\n} from './chart-legend-interaction.tsx';\nimport { ChartValueFormat, axisValueFormatter } from './chart-value-format.ts';\nimport { chartBarFill } from './chartColor.ts';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport { TooltipSurface } from './TooltipSurface.tsx';\nconst seriesColor = 'var(--atbl-chart-1)';\n/** Hollow sample marker shared by standalone and composed series. */\nexport function ChartDot({\n active = false,\n stroke = seriesColor,\n fill = active ? stroke : 'var(--atbl-surface)',\n r = active ? 4.5 : 3,\n ...props\n}: DotProps & { active?: boolean }) {\n return <Dot stroke={stroke} fill={fill} r={r} strokeWidth={2} {...props} />;\n}\n\nfunction NearestChartDot({\n seriesId,\n cx,\n cy,\n stroke,\n}: DotProps & { seriesId: string }) {\n const interaction = useContext(ChartInteractionContext);\n const registerPoint = useContext(ChartRegistrationContext)?.registerPoint;\n const legend = useChartLegendSeries(seriesId, undefined);\n useLayoutEffect(() => {\n if (legend.hidden || cx == null || cy == null) return;\n return registerPoint?.(seriesId, cx, cy);\n }, [registerPoint, seriesId, cx, cy, legend.hidden]);\n const active = !legend.hidden && isChartSeriesActive(interaction, seriesId);\n return active ? (\n <ChartDot\n cx={cx}\n cy={cy}\n stroke={stroke}\n active\n style={{ pointerEvents: 'none' }}\n />\n ) : null;\n}\n\ntype InspectedBarProps = BarShapeProps & {\n seriesId: string;\n shape: BarProps<unknown, number | null>['shape'];\n activeShape: BarProps<unknown, number | null>['activeBar'];\n dimmed: boolean;\n};\n\n/** Recharts does not export its bar-shape dispatcher; keep this adapter isolated. */\nfunction renderBarShape(\n option: InspectedBarProps['shape'],\n props: BarShapeProps\n) {\n if (isValidElement(option))\n return cloneElement(option as ReactElement<BarShapeProps>, {\n ...props,\n ...option.props,\n });\n if (option === Rectangle) return <Rectangle {...props} />;\n if (typeof option === 'function') return option(props, props.index);\n if (option && typeof option === 'object')\n return <Rectangle {...props} {...option} />;\n return <Rectangle {...props} />;\n}\n\nfunction InspectedBarVisual({\n seriesId,\n shape,\n activeShape,\n dimmed,\n ...props\n}: InspectedBarProps) {\n const interaction = useContext(ChartInteractionContext);\n const selected =\n interaction?.isPointerInspection &&\n interaction.activeBar?.seriesId === seriesId &&\n interaction.activeBar.index === props.originalDataIndex;\n const renderedProps = {\n ...props,\n isActive: Boolean(selected || props.isActive),\n opacity: dimmed ? undefined : selected ? 0.75 : props.opacity,\n };\n const option =\n selected && activeShape && activeShape !== true ? activeShape : shape;\n const rendered = renderBarShape(option, renderedProps);\n return dimmed ? <g opacity={0.2}>{rendered}</g> : rendered;\n}\n\n/** Shared series defaults; native props override every authored choice. */\nfunction InspectedBarShape({\n seriesId,\n shape,\n activeShape,\n dimmed,\n ...props\n}: InspectedBarProps) {\n const registerBar = useContext(ChartRegistrationContext)?.registerBar;\n const { x, y, width, height, originalDataIndex, value, payload } = props;\n const reading = Array.isArray(value) ? value[1] - value[0] : value;\n useLayoutEffect(() => {\n if (reading === 0 || width <= 0 || height <= 0) return;\n return registerBar?.({\n seriesId,\n index: originalDataIndex,\n x,\n y,\n width,\n height,\n payload,\n });\n }, [\n registerBar,\n seriesId,\n originalDataIndex,\n x,\n y,\n width,\n height,\n reading,\n payload,\n ]);\n return (\n <InspectedBarVisual\n {...props}\n seriesId={seriesId}\n shape={shape}\n activeShape={activeShape}\n dimmed={dimmed}\n />\n );\n}\n\nexport function ChartBar<Row = unknown, Value = number | null>(\n props: BarProps<Row, Value>\n) {\n useDateAxisBar(props.xAxisId);\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n const interaction = useContext(ChartLegendInteractionContext);\n const layout = useCartesianChartLayout();\n const registerBarAxis = interaction?.registerBarAxis;\n const key = chartLegendSeriesKey(series.id, props.dataKey);\n const axisId =\n layout === 'vertical' ? (props.xAxisId ?? 0) : (props.yAxisId ?? 0);\n const inspectStack = props.stackId != null;\n const inspectedShape = useCallback(\n (shapeProps: BarShapeProps) => (\n <InspectedBarShape\n {...shapeProps}\n seriesId={series.id}\n shape={props.shape}\n activeShape={props.activeBar}\n dimmed={legend.dimmed}\n />\n ),\n [series.id, props.shape, props.activeBar, legend.dimmed]\n );\n useLayoutEffect(\n () => (key && !props.hide ? registerBarAxis?.(key, axisId) : undefined),\n [registerBarAxis, key, axisId, props.hide]\n );\n return (\n <ChartSeries id={series.id}>\n <Bar<Row, Value>\n fill={chartBarFill}\n radius={props.stackId == null ? [5, 5, 0, 0] : 0}\n maxBarSize={30}\n isAnimationActive={false}\n {...props}\n activeBar={\n inspectStack\n ? false\n : (props.activeBar ?? (series.active ? { opacity: 0.75 } : false))\n }\n shape={inspectStack ? inspectedShape : props.shape}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\n/** Sample dots are opt-in with dot=true.\n * activeDot independently controls the hovered point. Native dot props and renderers remain available. */\nexport function ChartLine<Row = unknown, Value = number | null>({\n stroke = seriesColor,\n dot = false,\n activeDot,\n ...props\n}: LineProps<Row, Value>) {\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n return (\n <ChartSeries id={series.id}>\n <Line<Row, Value>\n type=\"linear\"\n stroke={stroke}\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n dot={\n legend.hidden\n ? false\n : dot === true\n ? ({ cx, cy }) => <ChartDot cx={cx} cy={cy} stroke={stroke} />\n : dot\n }\n activeDot={\n legend.hidden || legend.inspectingLegend\n ? false\n : activeDot === undefined || activeDot === true\n ? ({ cx, cy }) => (\n <NearestChartDot\n seriesId={series.id}\n cx={cx}\n cy={cy}\n stroke={stroke}\n />\n )\n : activeDot\n }\n isAnimationActive={false}\n {...props}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\n/** Filled series with the same sample-dot and activeDot options as ChartLine. */\nexport function ChartArea<Row = unknown, Value = number | null>({\n stroke = seriesColor,\n dot = false,\n activeDot,\n ...props\n}: AreaProps<Row, Value>) {\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n return (\n <ChartSeries id={series.id}>\n <Area<Row, Value>\n legendType=\"square\"\n type=\"linear\"\n stroke={stroke}\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill={stroke}\n fillOpacity={0.14}\n dot={\n legend.hidden\n ? false\n : dot === true\n ? ({ cx, cy }) => <ChartDot cx={cx} cy={cy} stroke={stroke} />\n : dot\n }\n activeDot={\n legend.hidden || legend.inspectingLegend\n ? false\n : activeDot === undefined || activeDot === true\n ? ({ cx, cy }) => (\n <NearestChartDot\n seriesId={series.id}\n cx={cx}\n cy={cy}\n stroke={stroke}\n />\n )\n : activeDot\n }\n isAnimationActive={false}\n {...props}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\nexport function ChartScatter<Row = unknown, Value = number>(\n props: ComponentProps<typeof Scatter<Row, Value>>\n) {\n const series = useChartSeries(props.id);\n const legend = useChartLegendSeries(series.id, props.dataKey);\n return (\n <ChartSeries id={series.id}>\n <Scatter<Row, Value>\n fill={seriesColor}\n isAnimationActive={false}\n {...props}\n id={series.id}\n hide={legend.hidden || props.hide}\n opacity={legend.hidden ? 0 : legend.dimmed ? 0.2 : props.opacity}\n style={{\n ...props.style,\n pointerEvents: legend.hidden ? 'none' : props.style?.pointerEvents,\n }}\n />\n </ChartSeries>\n );\n}\n\nexport function ChartYAxis<Row = unknown, Value = number>(\n props: ComponentProps<typeof YAxis<Row, Value>>\n) {\n const registerCategoryAxis = useContext(\n ChartRegistrationContext\n )?.registerCategoryAxis;\n const id = props.yAxisId ?? 0;\n useLayoutEffect(() => {\n if (props.dataKey == null) return;\n return registerCategoryAxis?.('y', id, props.dataKey as ChartDataKey);\n }, [registerCategoryAxis, id, props.dataKey]);\n const format = useContext(ChartValueFormat);\n const ticks = useYAxisTicks(props.yAxisId);\n const formatter = axisValueFormatter(\n (ticks ?? [])\n .map(tick => tick.value)\n .filter((value): value is number => typeof value === 'number'),\n format\n );\n return (\n <YAxis<Row, Value>\n width=\"auto\"\n stroke=\"var(--atbl-muted)\"\n tickFormatter={formatter}\n tickLine={false}\n axisLine={false}\n tick={{ fontSize: 'var(--atbl-type-meta-size)' }}\n {...props}\n />\n );\n}\n\nexport function ChartGrid(props: ComponentProps<typeof CartesianGrid>) {\n const vertical = useCartesianChartLayout() === 'vertical';\n const showZero = vertical\n ? props.vertical === true\n : props.horizontal === undefined || props.horizontal === true;\n return (\n <>\n <CartesianGrid stroke=\"var(--atbl-border)\" vertical={false} {...props} />\n {showZero && (\n <ReferenceLine\n {...(vertical ? { x: 0 } : { y: 0 })}\n xAxisId={props.xAxisId}\n yAxisId={props.yAxisId}\n ifOverflow=\"discard\"\n stroke={props.stroke ?? 'var(--atbl-muted)'}\n strokeOpacity={props.strokeOpacity ?? 0.55}\n strokeWidth={props.strokeWidth ?? 1.5}\n />\n )}\n </>\n );\n}\n\nexport function ChartTooltipContent(\n props: ComponentProps<typeof DefaultTooltipContent> & { active?: boolean }\n) {\n const valueFormat = useContext(ChartValueFormat);\n function formatValue(value: number) {\n return valueFormat ? formatMetric(value, valueFormat) : formatNumber(value);\n }\n if (!props.active || !props.payload?.length) return null;\n return (\n <TooltipSurface data-variant=\"chart\" role=\"tooltip\">\n <DefaultTooltipContent\n {...props}\n separator=\"\"\n payload={props.payload?.map(entry => ({\n ...entry,\n unit: undefined,\n formatter: (value, name, _item, index, payload) => {\n const formatter = entry.formatter ?? props.formatter;\n const formatted = formatter\n ? formatter(value, name, entry, index, props.payload ?? payload)\n : Array.isArray(value)\n ? value\n .map(item =>\n typeof item === 'number' ? formatValue(item) : item\n )\n .join(' ~ ')\n : typeof value === 'number'\n ? formatValue(value)\n : value;\n if (formatted == null) return null;\n const [displayValue, displayName] = Array.isArray(formatted)\n ? formatted\n : [formatted, name];\n return [\n <span\n key={entry.graphicalItemId}\n className=\"altertable-chart-tooltip-row\"\n >\n <ChartLegend.Marker\n kind=\"square\"\n className=\"altertable-chart-tooltip-marker\"\n color={\n entry.color ??\n entry.stroke ??\n entry.fill ??\n 'var(--atbl-chart-1)'\n }\n />\n <span className=\"altertable-chart-tooltip-reading\">\n {displayName}\n {displayName !== undefined && displayName !== ''\n ? (props.separator ?? ' : ')\n : ''}\n {displayValue}\n {entry.unit}\n </span>\n </span>,\n '',\n ];\n },\n }))}\n contentStyle={{\n margin: 0,\n padding: 0,\n background: 'transparent',\n border: 0,\n whiteSpace: 'normal',\n ...props.contentStyle,\n }}\n labelStyle={{\n color: 'var(--atbl-text)',\n fontSize: 'var(--atbl-type-body-size)',\n fontWeight: 650,\n lineHeight: 1.2,\n ...props.labelStyle,\n }}\n itemStyle={{\n color: 'var(--atbl-text)',\n paddingTop: 2,\n paddingBottom: 0,\n ...props.itemStyle,\n }}\n />\n </TooltipSurface>\n );\n}\n\nfunction MeasuredTooltipContent({\n children,\n onMeasure,\n}: {\n children: ReactNode;\n onMeasure: (width: number, height: number) => void;\n}) {\n const ref = useRef<HTMLSpanElement>(null);\n useLayoutEffect(() => {\n const element = ref.current;\n if (!element) return;\n const target = element;\n function measure() {\n onMeasure(target.offsetWidth, target.offsetHeight);\n }\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [onMeasure]);\n return (\n <span ref={ref} style={{ display: 'block' }}>\n {children}\n </span>\n );\n}\n\nfunction barTooltipPosition(\n bar: { x: number; y: number; width: number; height: number },\n plot: { x: number; y: number; width: number; height: number },\n size: { width: number; height: number }\n) {\n const gap = 10;\n const right = bar.x + bar.width + gap;\n const left = bar.x - size.width - gap;\n const plotRight = plot.x + plot.width;\n const x =\n right + size.width <= plotRight\n ? right\n : left >= plot.x\n ? left\n : Math.max(plot.x, Math.min(right, plotRight - size.width));\n const edgeInset = Math.min(8, Math.max(0, (plot.height - size.height) / 2));\n const y = Math.max(\n plot.y + edgeInset,\n Math.min(\n bar.y + bar.height / 2 - size.height / 2,\n plot.y + plot.height - size.height - edgeInset\n )\n );\n return { x, y };\n}\n\n/** Uses the same surface as single-series inspection; Recharts owns interaction. */\nexport function ChartTooltip(props: ComponentProps<typeof Tooltip>) {\n const dateLabel = useDateAxisLabel(props.axisId);\n const interaction = useContext(ChartInteractionContext);\n const legendInteraction = useContext(ChartLegendInteractionContext);\n const plot = usePlotArea();\n const [tooltipSize, setTooltipSize] = useState({ width: 0, height: 0 });\n const measureTooltip = useCallback((width: number, height: number) => {\n setTooltipSize(current =>\n current.width === width && current.height === height\n ? current\n : { width, height }\n );\n }, []);\n const { content: authoredContent, ...tooltipProps } = props;\n const activeBar = interaction?.isPointerInspection\n ? interaction.activeBar\n : null;\n const position =\n activeBar && plot && tooltipSize.width && tooltipSize.height\n ? barTooltipPosition(activeBar, plot, tooltipSize)\n : interaction?.isPointerInspection && interaction.activePoint\n ? { y: interaction.activePoint.y }\n : undefined;\n return (\n <Tooltip\n labelFormatter={dateLabel}\n position={position}\n cursor={false}\n isAnimationActive={false}\n {...tooltipProps}\n filterNull={activeBar ? false : props.filterNull}\n content={content => {\n if (legendInteraction?.suppressPlotInspection) return null;\n const selectedRow = activeBar?.payload;\n const payload = (\n interaction?.isPointerInspection &&\n interaction.seriesCount !== 1 &&\n props.shared !== true\n ? content.payload.filter(\n entry => entry.graphicalItemId === interaction.activeSeriesId\n )\n : content.payload\n ).filter(entry => {\n if (!legendInteraction?.focusedKeys) return true;\n const key = chartLegendSeriesKey(\n entry.graphicalItemId,\n entry.dataKey\n );\n return key == null || legendInteraction.focusedKeys.has(key);\n });\n const selectedPayload =\n selectedRow == null\n ? payload\n : payload.map(entry => {\n const key = entry.dataKey;\n const value =\n typeof key === 'function'\n ? key(selectedRow)\n : key == null\n ? entry.value\n : chartField(selectedRow, key);\n return {\n ...entry,\n payload: selectedRow,\n value: value as typeof entry.value,\n };\n });\n const categoryKey = interaction?.getCategoryDataKey(props.axisId ?? 0);\n const label =\n selectedRow == null || categoryKey == null\n ? content.label\n : typeof categoryKey === 'function'\n ? categoryKey(selectedRow)\n : chartField(selectedRow, categoryKey);\n const filtered: TooltipContentProps = {\n ...content,\n payload: selectedPayload,\n label: label as string | number | undefined,\n };\n const rendered =\n typeof authoredContent === 'function' ? (\n authoredContent(filtered)\n ) : isValidElement<TooltipContentProps>(authoredContent) ? (\n cloneElement(authoredContent, filtered)\n ) : (\n <ChartTooltipContent {...filtered} />\n );\n return (\n <MeasuredTooltipContent onMeasure={measureTooltip}>\n {rendered}\n </MeasuredTooltipContent>\n );\n }}\n />\n );\n}\n","import { useLayoutEffect, useRef, type ComponentRef } from 'react';\n\n/** Keep the latest supplied samples visible when the displayed items change. */\nexport function useChartScrollToEnd(items: readonly unknown[], enabled = true) {\n const scrollport = useRef<ComponentRef<'div'>>(null);\n useLayoutEffect(() => {\n const element = scrollport.current;\n if (element && enabled)\n element.scrollLeft = element.scrollWidth - element.clientWidth;\n }, [items, enabled]);\n return scrollport;\n}\n","import { formatNumber } from '@altertable/data-app/format';\nimport {\n Fragment,\n useRef,\n useState,\n type ComponentRef,\n type RefObject,\n type PointerEvent,\n type MouseEvent as ReactMouseEvent,\n} from 'react';\nimport {\n AreaChart as RechartsAreaChart,\n LineChart as RechartsLineChart,\n ReferenceLine,\n} from 'recharts';\n\nimport type { CartesianChartItem, CartesianChartProps } from './chart-data.ts';\nimport { validateValueChartItems } from './chart-data.ts';\nimport {\n ChartArea,\n ChartLine,\n ChartDot,\n ChartXAxis,\n ChartYAxis,\n ChartGrid,\n} from './chart-primitives.tsx';\nimport { ChartTooltip } from './ChartTooltip.tsx';\nimport {\n ExplorationActionControl,\n useChartActions,\n explorationMenuEvents,\n ExplorationActionMenu,\n getPrimaryExplorationAction,\n} from './ExplorationActionControl.tsx';\nimport { MenuButton, MenuTrigger } from './Menu.tsx';\nimport { useLinkedChartCursor } from './use-chart-cursor-group.tsx';\nimport { useChartScrollToEnd } from './use-chart-scroll-to-end.ts';\n\n/** Ordered, equally spaced samples; negative values share an explicit zero baseline. */\nexport function TrendChart<Row extends CartesianChartItem>({\n items,\n unit,\n ariaLabel,\n formatValue = formatNumber,\n kind,\n itemActions,\n cursorGroup,\n horizontalGrid = true,\n}: CartesianChartProps<Row> & { kind: 'line' | 'area' }) {\n validateValueChartItems(kind, items);\n const Plot = kind === 'area' ? RechartsAreaChart : RechartsLineChart;\n const chartActions = useChartActions();\n const cursor = useLinkedChartCursor(cursorGroup);\n const linkedItem = items.find(\n item => item.time === cursor.time && cursor.time != null\n );\n const [activeIndex, setActiveIndex] = useState<number>();\n const [nearestIndex, setNearestIndex] = useState<number>();\n const [mouseVisible, setMouseVisible] = useState(false);\n const nearest = useRef<number | undefined>(undefined);\n const points = useRef(new Map<number, { x: number; y: number }>());\n const plotRef = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLDivElement>(null);\n const highlightedIndex = mouseVisible ? nearestIndex : activeIndex;\n const scrollport = useChartScrollToEnd(items);\n const menuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n const magnitude = items.reduce(\n (max, item) => Math.max(max, Math.abs(item.value)),\n 1\n );\n const low = items.reduce(\n (min, item) => Math.min(min, item.value / magnitude),\n 0\n );\n const high = items.reduce(\n (max, item) => Math.max(max, item.value / magnitude),\n 0\n );\n function screenPoint(index: number | undefined) {\n if (index == null) return null;\n const point = points.current.get(index);\n const matrix = plotRef.current?.querySelector('svg')?.getScreenCTM();\n return point && matrix\n ? new DOMPoint(point.x, point.y).matrixTransform(matrix)\n : null;\n }\n function inspectNearest(event: PointerEvent<HTMLSpanElement>) {\n if (event.pointerType !== 'mouse') return;\n const matrix = plotRef.current?.querySelector('svg')?.getScreenCTM();\n if (!matrix) return;\n let distance = Infinity;\n let selected: number | undefined;\n const viewport = scrollport.current?.getBoundingClientRect();\n const overLabels =\n event.clientY >=\n (plotRef.current?.getBoundingClientRect().top ?? 0) + 220;\n for (let index = 0; index < items.length; index++) {\n const sample = points.current.get(index);\n if (!sample) continue;\n const point = new DOMPoint(sample.x, sample.y).matrixTransform(matrix);\n if (viewport && (point.x < viewport.left || point.x > viewport.right))\n continue;\n const candidate = overLabels\n ? Math.abs(point.x - event.clientX)\n : Math.hypot(point.x - event.clientX, point.y - event.clientY);\n if (candidate < distance) {\n distance = candidate;\n selected = index;\n }\n }\n nearest.current = selected;\n setNearestIndex(selected);\n cursor.setTime(selected == null ? undefined : items[selected]?.time);\n }\n function inspectAction(event: ReactMouseEvent<HTMLDivElement>) {\n if (\n !mouseVisible ||\n nearest.current == null ||\n !(event.target instanceof Element)\n )\n return;\n if (\n event.clientY >=\n (plotRef.current?.getBoundingClientRect().top ?? 0) + 220\n )\n return;\n if (event.type === 'click' && event.detail === 0) return;\n if (\n event.type === 'contextmenu' &&\n event.clientX === 0 &&\n event.clientY === 0\n )\n return;\n const target = event.target.closest('.altertable-trend-point');\n const selected = plotRef.current?.querySelectorAll<HTMLButtonElement>(\n '.altertable-trend-point'\n )[nearest.current];\n if (!target || !selected || target === selected) return;\n event.preventDefault();\n event.stopPropagation();\n if (event.type === 'click') selected.click();\n else\n selected.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n cancelable: true,\n button: 2,\n clientX: event.clientX,\n clientY: event.clientY,\n })\n );\n }\n return (\n <section\n className=\"altertable-trend-chart\"\n aria-label={ariaLabel}\n onPointerLeave={cursor.reset}\n onKeyDownCapture={cursor.reset}\n onPointerDownCapture={event => {\n if (event.pointerType !== 'mouse') cursor.reset();\n }}\n >\n {items.length === 0 && <span>No data</span>}\n {items.length > 0 && (\n <>\n <div className=\"altertable-trend-scroll\" ref={scrollport}>\n <div\n className=\"altertable-trend-plot\"\n ref={plotRef}\n style={{ minWidth: items.length * 40 }}\n >\n <div\n className=\"altertable-chart-canvas\"\n aria-hidden=\"true\"\n ref={canvasRef}\n >\n <Plot\n data={items.map(item => ({\n ...item,\n plotValue: item.value / magnitude,\n }))}\n responsive\n width=\"100%\"\n height={220}\n margin={{ top: 12, right: 0, bottom: 12, left: 0 }}\n accessibilityLayer={false}\n tabIndex={-1}\n >\n <ChartXAxis hide dataKey=\"id\" scale=\"band\" />\n <ChartYAxis\n hide\n domain={[low, high === low ? low + 1 : high]}\n />\n <ReferenceLine y={0} stroke=\"var(--atbl-border)\" />\n {horizontalGrid && <ChartGrid />}\n {kind === 'area' && (\n <ChartArea\n dataKey=\"plotValue\"\n stroke=\"none\"\n fill=\"var(--atbl-chart-1)\"\n dot={false}\n activeDot={false}\n />\n )}\n <ChartLine\n dataKey=\"plotValue\"\n dot={({ cx, cy, index }) => {\n if (index != null && cx != null && cy != null)\n points.current.set(index, { x: cx, y: cy });\n return (\n <g\n data-atbl-internal-sample={index}\n transform={`translate(${cx}, ${cy})`}\n >\n {index === highlightedIndex && (\n <ChartDot cx={0} cy={0} active />\n )}\n </g>\n );\n }}\n activeDot={false}\n />\n {linkedItem && (\n <ReferenceLine\n x={linkedItem.id}\n stroke=\"var(--atbl-muted)\"\n strokeOpacity={0.3}\n pointerEvents=\"none\"\n data-atbl-internal-linked-cursor=\"true\"\n />\n )}\n </Plot>\n </div>\n <ChartTooltip\n variant=\"chart\"\n touchInspection={false}\n boundaryRefs={[canvasRef, scrollport]}\n onPointerEnter={inspectNearest}\n onPointerMove={inspectNearest}\n onPointerLeave={cursor.reset}\n onOpenChange={setMouseVisible}\n anchorRect={() => {\n const point = screenPoint(nearest.current);\n return point ? new DOMRect(point.x, point.y, 0, 0) : null;\n }}\n content={\n nearestIndex == null || !items[nearestIndex] ? null : (\n <>\n <strong>{items[nearestIndex].label}</strong>\n <span>\n {formatValue(items[nearestIndex].value)} {unit}\n </span>\n </>\n )\n }\n >\n <div\n className=\"altertable-trend-points\"\n onClickCapture={inspectAction}\n onContextMenuCapture={inspectAction}\n >\n {items.map((item, index) => {\n const declaredActions = itemActions?.(item) ?? [];\n const actions = chartActions.actions(\n declaredActions,\n item.label,\n `${formatValue(item.value)} ${unit}`\n );\n const action = getPrimaryExplorationAction(actions);\n const menuTrigger: RefObject<ComponentRef<'button'> | null> =\n {\n get current() {\n return menuTriggers.current.get(item.id) ?? null;\n },\n };\n return (\n <Fragment key={item.id}>\n <div className=\"altertable-chart-item-actions\">\n <ChartTooltip\n variant=\"chart\"\n mouseHover={false}\n followCursor={false}\n onOpenChange={open =>\n setActiveIndex(current =>\n open\n ? index\n : current === index\n ? undefined\n : current\n )\n }\n content={\n <>\n <strong>{item.label}</strong>\n <span>\n {formatValue(item.value)} {unit}\n </span>\n </>\n }\n className=\"altertable-chart-column\"\n >\n {action ? (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n type=\"button\"\n className=\"altertable-trend-point\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. ${action.label}`}\n {...explorationMenuEvents(menuTrigger)}\n onClick={event =>\n action.onSelect(event.currentTarget)\n }\n >\n <span className=\"altertable-trend-hit\" />\n <span className=\"altertable-trend-label\">\n {item.label}\n </span>\n </button>\n ) : actions.length > 1 ? (\n <MenuTrigger>\n <MenuButton\n {...explorationMenuEvents(menuTrigger)}\n ref={element => {\n if (element)\n menuTriggers.current.set(\n item.id,\n element\n );\n else menuTriggers.current.delete(item.id);\n }}\n className=\"altertable-trend-point\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. Actions`}\n >\n <span className=\"altertable-trend-hit\" />\n <span className=\"altertable-trend-label\">\n {item.label}\n </span>\n </MenuButton>\n <ExplorationActionMenu\n actions={actions}\n ariaLabel={`${item.label} actions`}\n triggerRef={menuTrigger}\n />\n </MenuTrigger>\n ) : (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n type=\"button\"\n tabIndex={-1}\n className=\"altertable-trend-point\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}`}\n >\n <span className=\"altertable-trend-hit\" />\n <span className=\"altertable-trend-label\">\n {item.label}\n </span>\n </button>\n )}\n </ChartTooltip>\n {action && (\n <ExplorationActionControl\n contextOnly={declaredActions.length === 1}\n indicator=\"chevron\"\n ref={element => {\n if (element)\n menuTriggers.current.set(item.id, element);\n else menuTriggers.current.delete(item.id);\n }}\n actions={actions}\n ariaLabel={`${item.label} actions`}\n hidePrimary={Boolean(action)}\n />\n )}\n </div>\n </Fragment>\n );\n })}\n </div>\n </ChartTooltip>\n </div>\n </div>\n </>\n )}\n {chartActions.feedback}\n </section>\n );\n}\n","import {\n type CartesianChartItem,\n type CartesianChartProps,\n} from './chart-data.ts';\nimport { TrendChart } from './TrendChart.tsx';\n\nexport type LineChartItem = CartesianChartItem;\nexport type LineChartProps<Row extends LineChartItem = LineChartItem> =\n CartesianChartProps<Row>;\n\n/** Equally spaced finite samples in supplied order; fill missing periods explicitly.\n * Supports negative values, single points, and horizontal scrolling for long series.\n * Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */\nexport function LineChart<Row extends LineChartItem>(\n props: LineChartProps<Row>\n) {\n return <TrendChart {...props} kind=\"line\" />;\n}\n","import {\n type CartesianChartItem,\n type CartesianChartProps,\n} from './chart-data.ts';\nimport { TrendChart } from './TrendChart.tsx';\n\nexport type AreaChartItem = CartesianChartItem;\nexport type AreaChartProps<Row extends AreaChartItem = AreaChartItem> =\n CartesianChartProps<Row>;\n\n/** Ordered finite samples filled to a zero baseline, including negative values.\n * Samples are equally spaced; supply missing periods explicitly.\n * Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */\nexport function AreaChart<Row extends AreaChartItem>(\n props: AreaChartProps<Row>\n) {\n return <TrendChart {...props} kind=\"area\" />;\n}\n","import { formatNumber } from '@altertable/data-app/format';\nimport { useRef, useState, type ComponentRef, type RefObject } from 'react';\n\nimport type { ChartItem, ValueChartProps } from './chart-data.ts';\nimport { validateValueChartItems } from './chart-data.ts';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport {\n ExplorationActionControl,\n useChartActions,\n explorationMenuEvents,\n ExplorationActionMenu,\n getPrimaryExplorationAction,\n} from './ExplorationActionControl.tsx';\nimport { AppIcon } from './icons.ts';\nimport { MenuButton, MenuTrigger } from './Menu.tsx';\nimport { Tooltip } from './Tooltip.tsx';\n\nexport type PieChartItem = ChartItem;\nexport type PieChartProps<Row extends PieChartItem = PieChartItem> =\n ValueChartProps<Row> & {\n /** Omit the built-in key when composing a separate ChartLegend. */\n showLegend?: boolean;\n };\n\n/** Nonnegative, mutually exclusive parts; shares use the sum of supplied items.\n * Include Other to represent the whole. Zero values remain in the legend; all-zero\n * data shows an empty circle. Colors follow item order. Compose inside VisualizationWidget;\n * hover/touch tooltips coordinate slice and legend emphasis without caller state. */\nexport function PieChart<Row extends PieChartItem>({\n items,\n unit,\n ariaLabel,\n showLegend = true,\n formatValue = formatNumber,\n itemActions,\n}: PieChartProps<Row>) {\n validateValueChartItems('pie', items);\n const chartActions = useChartActions();\n const [previewId, setPreviewId] = useState<string | null>(null);\n const [plotOpen, setPlotOpen] = useState(false);\n const [legendId, setLegendId] = useState<string | null>(null);\n const menuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n const plotMenuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n const maximum = items.reduce((max, item) => Math.max(max, item.value), 0);\n const total = maximum\n ? items.reduce((sum, item) => sum + item.value / maximum, 0)\n : 0;\n let cursor = -Math.PI / 2;\n const slices: {\n row: Row;\n share: number;\n color: string;\n path: string;\n }[] = [];\n for (const [index, item] of items.entries()) {\n const share = total ? item.value / maximum / total : 0;\n const start = cursor;\n cursor += share * Math.PI * 2;\n const middle = (start + cursor) / 2;\n function point(angle: number) {\n return `${110 + Math.cos(angle) * 100},${110 + Math.sin(angle) * 100}`;\n }\n slices.push({\n row: item,\n share,\n color: `var(--atbl-chart-${(index % 8) + 1})`,\n path: `${share === 1 ? 'M' : 'M110,110 L'}${point(start)} A100,100 0 0 1 ${point(middle)} A100,100 0 0 1 ${point(cursor)} Z`,\n });\n }\n function percent(share: number) {\n return new Intl.NumberFormat('en-US', {\n style: 'percent',\n maximumFractionDigits: 1,\n }).format(share);\n }\n function detail(slice: (typeof slices)[number]) {\n const item = slice.row;\n return (\n <>\n <strong>{item.label}</strong>\n <span>\n {formatValue(item.value)} {unit} · {percent(slice.share)}\n </span>\n </>\n );\n }\n function actionsFor(slice: (typeof slices)[number]) {\n const item = slice.row;\n return chartActions.actions(\n itemActions?.(item) ?? [],\n item.label,\n `${formatValue(item.value)} ${unit} · ${percent(slice.share)}`\n );\n }\n const preview = slices.find(slice => slice.row.id === previewId);\n return (\n <section className=\"altertable-pie-chart\" aria-label={ariaLabel}>\n {items.length === 0 && <span>No data</span>}\n {items.length > 0 && (\n <>\n <div className=\"altertable-pie-plot\">\n <Tooltip\n variant=\"chart\"\n className=\"altertable-pie-tooltip\"\n onOpenChange={setPlotOpen}\n content={preview ? detail(preview) : null}\n >\n <svg\n viewBox=\"0 0 220 220\"\n aria-hidden={itemActions ? undefined : true}\n aria-label={itemActions ? ariaLabel : undefined}\n focusable={itemActions ? undefined : false}\n role={itemActions ? 'group' : undefined}\n >\n {total === 0 ? (\n <circle\n cx=\"110\"\n cy=\"110\"\n r=\"100\"\n className=\"altertable-pie-empty\"\n />\n ) : (\n slices\n .filter(slice => slice.share > 0)\n .map(slice => {\n const item = slice.row;\n const menuTrigger = {\n get current() {\n return (\n menuTriggers.current.get(item.id) ??\n plotMenuTriggers.current.get(item.id) ??\n null\n );\n },\n };\n const action = getPrimaryExplorationAction(\n actionsFor(slice)\n );\n const opensMenu =\n !action && (itemActions?.(item).length ?? 0) > 1;\n return (\n <path\n key={item.id}\n d={slice.path}\n fill={slice.color}\n className=\"altertable-pie-slice\"\n data-active={\n item.id ===\n (plotOpen && previewId\n ? previewId\n : showLegend\n ? legendId\n : null) || undefined\n }\n onPointerDown={event => {\n if (plotOpen && previewId !== item.id)\n event.preventDefault();\n setPreviewId(item.id);\n }}\n onClick={event => {\n if (action) action.onSelect(event.currentTarget);\n else if (opensMenu) menuTrigger.current?.click();\n }}\n onContextMenu={\n explorationMenuEvents(menuTrigger).onContextMenu\n }\n onKeyDown={event => {\n explorationMenuEvents(menuTrigger).onKeyDown(event);\n if (\n (action || opensMenu) &&\n (event.key === 'Enter' || event.key === ' ')\n ) {\n event.preventDefault();\n if (action) action.onSelect(event.currentTarget);\n else menuTrigger.current?.click();\n }\n }}\n aria-label={\n action\n ? `${item.label}: ${formatValue(item.value)} ${unit}. ${action.label}`\n : opensMenu\n ? `${item.label}: ${formatValue(item.value)} ${unit}. Actions`\n : undefined\n }\n role={action || opensMenu ? 'button' : undefined}\n data-atbl-control={\n action || opensMenu ? 'action' : undefined\n }\n tabIndex={action || opensMenu ? 0 : undefined}\n onPointerEnter={event => {\n if (event.pointerType === 'mouse')\n setPreviewId(item.id);\n }}\n onPointerLeave={event => {\n if (event.pointerType === 'mouse')\n setPreviewId(null);\n }}\n />\n );\n })\n )}\n </svg>\n </Tooltip>\n {slices.map(slice => {\n const item = slice.row;\n const actions = actionsFor(slice);\n if (actions.length === 0) return null;\n return (\n <span key={item.id} className=\"altertable-sr-only\">\n <ExplorationActionControl\n ref={element => {\n if (element)\n plotMenuTriggers.current.set(item.id, element);\n else plotMenuTriggers.current.delete(item.id);\n }}\n actions={actions}\n ariaLabel={`${item.label} actions`}\n contextOnly\n hidePrimary\n />\n </span>\n );\n })}\n {total === 0 && (\n <span className=\"altertable-pie-empty-label\">\n No nonzero values\n </span>\n )}\n </div>\n {showLegend && (\n <ChartLegend\n layout=\"vertical\"\n aria-label={`${ariaLabel} legend`}\n className=\"altertable-pie-legend\"\n >\n {slices.map(slice => {\n const item = slice.row;\n const actions = actionsFor(slice);\n const menuTrigger: RefObject<ComponentRef<'button'> | null> = {\n get current() {\n return menuTriggers.current.get(item.id) ?? null;\n },\n };\n const label = `${item.label}: ${formatValue(item.value)} ${unit}, ${percent(slice.share)}${actions.length ? '. Actions' : ''}`;\n const contents = (\n <>\n <ChartLegend.Marker kind=\"square\" color={slice.color} />\n <ChartLegend.Label className=\"altertable-pie-label\">\n {item.label}\n </ChartLegend.Label>\n {actions.length > 0 && (\n <AppIcon\n name=\"moreActions\"\n size={14}\n className=\"altertable-pie-menu-indicator\"\n />\n )}\n <strong className=\"altertable-pie-value\">\n {formatValue(item.value)}\n </strong>\n <span className=\"altertable-pie-share\">\n {percent(slice.share)}\n </span>\n </>\n );\n return (\n <ChartLegend.Item key={item.id}>\n <Tooltip\n variant=\"chart\"\n content={detail(slice)}\n onOpenChange={open =>\n setLegendId(current =>\n open ? item.id : current === item.id ? null : current\n )\n }\n >\n {actions.length ? (\n <MenuTrigger>\n <MenuButton\n {...explorationMenuEvents(menuTrigger)}\n ref={element => {\n if (element)\n menuTriggers.current.set(item.id, element);\n else menuTriggers.current.delete(item.id);\n }}\n aria-label={label}\n >\n {contents}\n </MenuButton>\n <ExplorationActionMenu\n actions={actions}\n ariaLabel={item.label}\n triggerRef={menuTrigger}\n placement=\"bottom start\"\n />\n </MenuTrigger>\n ) : (\n <button\n type=\"button\"\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n tabIndex={-1}\n aria-label={label}\n >\n {contents}\n </button>\n )}\n </Tooltip>\n </ChartLegend.Item>\n );\n })}\n </ChartLegend>\n )}\n </>\n )}\n {chartActions.feedback}\n </section>\n );\n}\n","import { validateScatterChartItems } from './chart-data.ts';\nimport type { ScatterChartItem, HorizontalGridProps } from './chart-data.ts';\nimport { Tooltip } from './Tooltip.tsx';\nexport type { ScatterChartItem } from './chart-data.ts';\nexport type ScatterChartProps = HorizontalGridProps & {\n items: readonly ScatterChartItem[];\n xLabel: string;\n yLabel: string;\n xUnit: string;\n yUnit: string;\n ariaLabel: string;\n formatX?: (value: number) => string;\n formatY?: (value: number) => string;\n};\n\nfunction formatNumber(value: number) {\n return new Intl.NumberFormat(undefined, { maximumFractionDigits: 1 }).format(\n value\n );\n}\n\nfunction scale(values: readonly number[]) {\n const magnitude = values.reduce(\n (max, value) => Math.max(max, Math.abs(value)),\n 1\n );\n const low = values.reduce(\n (min, value) => Math.min(min, value / magnitude),\n 0\n );\n const high =\n values.reduce((max, value) => Math.max(max, value / magnitude), 0) ||\n (low === 0 ? 1 : 0);\n const span = high - low;\n return {\n position(value: number) {\n return ((value / magnitude - low) / span) * 100;\n },\n ticks: [low, low + span / 2, high].map(value => value * magnitude),\n };\n}\n\n/** Independent finite X/Y observations on linear axes that include zero.\n * Negative and constant coordinates are supported. Axis labels and units describe\n * tooltips as well as the plot; formatX/formatY format ticks and tooltip values.\n * Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */\nexport function ScatterChart({\n items,\n xLabel,\n yLabel,\n xUnit,\n yUnit,\n ariaLabel,\n formatX = formatNumber,\n formatY = formatNumber,\n horizontalGrid = true,\n}: ScatterChartProps) {\n validateScatterChartItems(items);\n const xScale = scale(items.map(item => item.x));\n const yScale = scale(items.map(item => item.y));\n return (\n <section className=\"altertable-scatter-chart\" aria-label={ariaLabel}>\n {items.length === 0 && <span>No data</span>}\n {items.length > 0 && (\n <>\n <p className=\"altertable-scatter-axis-title\">\n {yLabel}\n {yUnit && ` (${yUnit})`}\n </p>\n <div className=\"altertable-scatter-axes\">\n <div className=\"altertable-scatter-plot\">\n {yScale.ticks.map((value, index) => (\n <div\n key={index}\n className=\"altertable-scatter-gridline\"\n style={{\n bottom: `${index * 50}%`,\n borderTopStyle: horizontalGrid ? undefined : 'none',\n }}\n aria-hidden=\"true\"\n >\n <span title={formatY(value)}>{formatY(value)}</span>\n </div>\n ))}\n {xScale.ticks.map((value, index) => (\n <span\n key={index}\n className=\"altertable-scatter-x-tick\"\n data-edge={index}\n style={{ left: `${index * 50}%` }}\n aria-hidden=\"true\"\n title={formatX(value)}\n >\n {formatX(value)}\n </span>\n ))}\n {items.map(item => (\n <Tooltip\n key={item.id}\n variant=\"chart\"\n content={\n <>\n <strong>{item.label}</strong>\n <span>\n {xLabel}: {formatX(item.x)} {xUnit}\n </span>\n <span>\n {yLabel}: {formatY(item.y)} {yUnit}\n </span>\n </>\n }\n className=\"altertable-scatter-tooltip\"\n style={{\n left: `${xScale.position(item.x)}%`,\n bottom: `${yScale.position(item.y)}%`,\n }}\n >\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n type=\"button\"\n tabIndex={-1}\n className=\"altertable-scatter-point\"\n aria-label={`${item.label}: ${xLabel} ${formatX(item.x)} ${xUnit}, ${yLabel} ${formatY(item.y)} ${yUnit}`}\n >\n <span />\n </button>\n </Tooltip>\n ))}\n </div>\n </div>\n <p className=\"altertable-scatter-axis-title altertable-scatter-x-title\">\n {xLabel}\n {xUnit && ` (${xUnit})`}\n </p>\n </>\n )}\n </section>\n );\n}\n","import {\n formatMetric,\n formatNumber,\n type MetricFormat,\n} from '@altertable/data-app/format';\nimport {\n Fragment,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentRef,\n type RefObject,\n} from 'react';\nimport {\n BarChart as RechartsBarChart,\n Cell,\n type BarShapeProps,\n usePlotArea,\n} from 'recharts';\n\nimport {\n validateValueChartItems,\n type ChartItem,\n type CartesianChartProps,\n} from './chart-data.ts';\nimport {\n ChartBar,\n ChartGrid,\n ChartXAxis,\n ChartYAxis,\n} from './chart-primitives.tsx';\nimport { ChartValueFormat } from './chart-value-format.ts';\nimport { chartBarFill } from './chartColor.ts';\nimport { ChartTooltip } from './ChartTooltip.tsx';\nimport {\n openExplorationMenu,\n useChartActions,\n explorationMenuEvents,\n ExplorationActionMenu,\n getPrimaryExplorationAction,\n} from './ExplorationActionControl.tsx';\nimport { AppIcon } from './icons.ts';\nimport { MenuButton, MenuTrigger } from './Menu.tsx';\nimport { useLinkedChartCursor } from './use-chart-cursor-group.tsx';\nimport { useChartScrollToEnd } from './use-chart-scroll-to-end.ts';\n\nexport type BarChartItem = ChartItem & {\n /** Milliseconds since the Unix epoch. Enables adaptive time ticks when no item actions are supplied. */\n time?: number;\n};\n\nconst timeTickIntervals = [\n 60_000,\n 2 * 60_000,\n 5 * 60_000,\n 10 * 60_000,\n 15 * 60_000,\n 30 * 60_000,\n 60 * 60_000,\n 2 * 60 * 60_000,\n 6 * 60 * 60_000,\n 12 * 60 * 60_000,\n 24 * 60 * 60_000,\n 2 * 24 * 60 * 60_000,\n 7 * 24 * 60 * 60_000,\n 14 * 24 * 60 * 60_000,\n];\n\nfunction timeTickIndices(items: readonly BarChartItem[], width: number) {\n if (items.length === 1) return new Set([0]);\n if (items.length < 2 || width <= 0) return new Set<number>();\n const slotWidth = width / items.length;\n const cadence = (items.at(-1)!.time! - items[0]!.time!) / (items.length - 1);\n const minimumInterval = Math.max(cadence, (100 / slotWidth) * cadence);\n const interval =\n timeTickIntervals.find(candidate => candidate >= minimumInterval) ??\n Math.ceil(minimumInterval / timeTickIntervals.at(-1)!) *\n timeTickIntervals.at(-1)!;\n const indices = new Set<number>();\n const stride = Math.max(1, Math.ceil(interval / cadence));\n const count = Math.max(\n 1,\n Math.min(\n Math.floor((items.length - 1) / stride) + 1,\n Math.floor(Math.max(0, width - 60) / (stride * slotWidth)) + 1\n )\n );\n // Center the tick sequence within the supplied window so rolling windows\n // have balanced edge margins as well as a consistent interval.\n const start = Math.floor((items.length - 1 - (count - 1) * stride) / 2);\n for (let tick = 0; tick < count; tick++) {\n indices.add(start + tick * stride);\n }\n return indices;\n}\n\nexport type BarChartProps<Row extends BarChartItem = BarChartItem> =\n CartesianChartProps<Row> & {\n /** Show a vertical value scale beside the bars. */\n showYAxis?: boolean;\n /** Automatically reveal the last items after updates. Disable for ranked categories. */\n scrollToEnd?: boolean;\n /** Formats the vertical axis and, unless overridden, inspected values. */\n valueFormat?: MetricFormat;\n };\n\nfunction PlotBoundsObserver({\n overlayRef,\n}: {\n overlayRef: RefObject<HTMLDivElement | null>;\n}) {\n const plot = usePlotArea();\n const left = plot?.x;\n const width = plot?.width;\n\n useLayoutEffect(() => {\n if (\n left === undefined ||\n width === undefined ||\n !Number.isFinite(left) ||\n !Number.isFinite(width) ||\n !overlayRef.current\n )\n return;\n const overlay = overlayRef.current;\n overlay.style.marginLeft = `${left}px`;\n overlay.style.width = `${width}px`;\n return () => {\n overlay.style.marginLeft = '';\n overlay.style.width = '';\n };\n }, [overlayRef, left, width]);\n\n return null;\n}\n\n/** Nonnegative category values. Compose inside VisualizationWidget for a titled panel.\n * Owns hover/touch tooltips; no selection state or keyboard navigation. */\nexport function BarChart<Row extends BarChartItem>({\n items,\n unit,\n ariaLabel,\n formatValue: authoredFormatValue,\n itemActions,\n cursorGroup,\n horizontalGrid = true,\n showYAxis = false,\n scrollToEnd = true,\n valueFormat,\n}: BarChartProps<Row>) {\n const formatValue =\n authoredFormatValue ??\n (valueFormat\n ? (value: number) => formatMetric(value, valueFormat)\n : formatNumber);\n // Leave space for the zero tick without moving the plot or its hit targets.\n const axisLabelSpace = showYAxis ? 10 : 0;\n validateValueChartItems('bar', items);\n const chartActions = useChartActions();\n const cursor = useLinkedChartCursor(cursorGroup);\n const linkedItem = items.find(\n item => item.time === cursor.time && cursor.time != null\n );\n const [activeId, setActiveId] = useState<string>();\n const [viewportWidth, setViewportWidth] = useState(0);\n const plotRef = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLDivElement>(null);\n const itemOverlayRef = useRef<HTMLDivElement>(null);\n const menuTriggers = useRef(new Map<string, ComponentRef<'button'>>());\n\n const maximum =\n items.reduce((max, item) => Math.max(max, item.value), 0) || 1;\n const hasTimeAxis =\n items.length > 0 &&\n items.every(\n (item, index) =>\n typeof item.time === 'number' &&\n Number.isFinite(item.time) &&\n (index === 0 || item.time > items[index - 1]!.time!)\n );\n const scrollport = useChartScrollToEnd(items, scrollToEnd);\n const compactTimeAxis = hasTimeAxis && !itemActions;\n const minimumSlotWidth = compactTimeAxis ? 3.5 : 120;\n const plotWidth = Math.max(viewportWidth, items.length * minimumSlotWidth);\n const ticks = compactTimeAxis ? timeTickIndices(items, plotWidth) : null;\n\n useLayoutEffect(() => {\n const element = scrollport.current;\n if (!element) return;\n function updateWidth() {\n // clientWidth rounds up fractional grid widths, which can create a\n // scrollbar and feed a different width back into this observer. The\n // plot fills the content box, inside the padding kept for focus rings.\n const style = getComputedStyle(element!);\n const padding =\n parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\n setViewportWidth(\n Math.floor(element!.getBoundingClientRect().width - padding)\n );\n }\n updateWidth();\n const observer = new ResizeObserver(updateWidth);\n observer.observe(element);\n return () => observer.disconnect();\n }, [scrollport]);\n\n return (\n <section\n className=\"altertable-selectable-bars\"\n aria-label={ariaLabel}\n onPointerLeave={cursor.reset}\n onKeyDownCapture={cursor.reset}\n onPointerDownCapture={event => {\n if (event.pointerType !== 'mouse') cursor.reset();\n }}\n >\n {items.length === 0 && <span>No data</span>}\n <div\n className=\"altertable-selectable-bars-scroll\"\n data-time-axis={compactTimeAxis || undefined}\n ref={scrollport}\n >\n <div\n className=\"altertable-selectable-bars-plot\"\n ref={plotRef}\n style={{ width: plotWidth }}\n >\n <div\n className=\"altertable-chart-canvas\"\n aria-hidden=\"true\"\n ref={canvasRef}\n >\n <ChartValueFormat.Provider value={valueFormat}>\n <RechartsBarChart\n data={\n showYAxis\n ? items\n : items.map(item => ({\n ...item,\n plotValue: item.value / maximum,\n }))\n }\n responsive\n width=\"100%\"\n height={220 + axisLabelSpace}\n margin={{ top: 0, right: 0, bottom: axisLabelSpace, left: 0 }}\n accessibilityLayer={false}\n tabIndex={-1}\n barCategoryGap=\"24%\"\n >\n {showYAxis && (\n <PlotBoundsObserver overlayRef={itemOverlayRef} />\n )}\n <ChartXAxis hide dataKey=\"id\" scale=\"band\" />\n {showYAxis ? (\n <ChartYAxis domain={[0, 'auto']} />\n ) : (\n <ChartYAxis hide domain={[0, 1]} allowDataOverflow />\n )}\n {horizontalGrid && <ChartGrid />}\n <ChartBar\n dataKey={showYAxis ? 'value' : 'plotValue'}\n minPointSize={value => ((value ?? 0) > 0 ? 7 : 0)}\n background={\n linkedItem\n ? ({ index, x, y, width, height }: BarShapeProps) => (\n <g>\n {items[index]?.id === linkedItem.id && (\n <rect\n x={x}\n y={y}\n width={width}\n height={height}\n fill=\"var(--atbl-muted)\"\n fillOpacity={0.14}\n pointerEvents=\"none\"\n aria-hidden=\"true\"\n data-atbl-internal-linked-cursor=\"true\"\n />\n )}\n </g>\n )\n : false\n }\n >\n {items.map(item => (\n <Cell\n key={item.id}\n fill={chartBarFill}\n opacity={activeId === item.id ? 0.75 : 1}\n data-atbl-internal-bar-id={item.id}\n />\n ))}\n </ChartBar>\n </RechartsBarChart>\n </ChartValueFormat.Provider>\n </div>\n <div\n className=\"altertable-selectable-bars-items\"\n ref={itemOverlayRef}\n >\n {items.map((item, index) => {\n const actions = chartActions.actions(\n itemActions?.(item) ?? [],\n item.label,\n `${formatValue(item.value)} ${unit}`\n );\n const action = getPrimaryExplorationAction(actions);\n const menuTrigger: RefObject<ComponentRef<'button'> | null> = {\n get current() {\n return menuTriggers.current.get(item.id) ?? null;\n },\n };\n return (\n <Fragment key={item.id}>\n <div\n className=\"altertable-chart-item-actions\"\n onPointerMove={event => {\n if (event.pointerType === 'mouse')\n cursor.setTime(item.time);\n }}\n >\n <ChartTooltip\n variant=\"chart\"\n followCursor={false}\n boundaryRefs={[canvasRef, scrollport]}\n anchorRect={trigger => {\n const bar = plotRef.current?.querySelector(\n `[data-atbl-internal-bar-id=\"${CSS.escape(item.id)}\"]`\n );\n const bounds =\n bar?.getBoundingClientRect() ??\n trigger?.getBoundingClientRect();\n if (!bounds) return null;\n const top = bar ? bounds.top : bounds.top + 220;\n return new DOMRect(\n bounds.left + bounds.width / 2,\n top,\n 0,\n 0\n );\n }}\n onOpenChange={open =>\n setActiveId(current =>\n open\n ? item.id\n : current === item.id\n ? undefined\n : current\n )\n }\n content={\n <>\n <strong>{item.label}</strong>\n <span>\n {formatValue(item.value)} {unit}\n </span>\n </>\n }\n className=\"altertable-chart-column\"\n >\n {action ? (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n type=\"button\"\n className=\"altertable-selectable-bars-item\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. ${action.label}`}\n {...explorationMenuEvents(menuTrigger)}\n onClick={event =>\n action.onSelect(event.currentTarget)\n }\n >\n <span className=\"altertable-selectable-bars-area\" />\n </button>\n ) : actions.length ? (\n <button\n type=\"button\"\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n className=\"altertable-selectable-bars-item\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}. Actions`}\n {...explorationMenuEvents(menuTrigger)}\n onClick={event =>\n openExplorationMenu(menuTrigger, event)\n }\n >\n <span className=\"altertable-selectable-bars-area\" />\n </button>\n ) : (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"default\"\n type=\"button\"\n tabIndex={-1}\n className=\"altertable-selectable-bars-item\"\n aria-label={`${item.label}: ${formatValue(item.value)} ${unit}`}\n >\n <span className=\"altertable-selectable-bars-area\" />\n </button>\n )}\n </ChartTooltip>\n <div\n className=\"altertable-chart-item-label-row\"\n data-time-tick={ticks?.has(index) || undefined}\n >\n {actions.length ? (\n <MenuTrigger>\n <MenuButton\n className=\"altertable-selectable-bars-label\"\n variant=\"ghost\"\n size=\"compact\"\n {...explorationMenuEvents(menuTrigger)}\n ref={element => {\n if (element)\n menuTriggers.current.set(item.id, element);\n else menuTriggers.current.delete(item.id);\n }}\n aria-label={`${item.label}: Actions`}\n >\n <span title={item.label}>{item.label}</span>\n <AppIcon name=\"disclosure\" size={12} />\n </MenuButton>\n <ExplorationActionMenu\n actions={actions}\n ariaLabel={item.label}\n triggerRef={menuTrigger}\n placement=\"bottom\"\n />\n </MenuTrigger>\n ) : (\n <span className=\"altertable-selectable-bars-label\">\n <span title={item.label}>{item.label}</span>\n </span>\n )}\n </div>\n </div>\n </Fragment>\n );\n })}\n </div>\n </div>\n </div>\n {chartActions.feedback}\n </section>\n );\n}\n","import {\n validateChoiceOptions,\n type ChoiceOption,\n} from '@altertable/data-app/internal';\nimport { type ComponentPropsWithRef, type ReactNode } from 'react';\nimport {\n RadioGroup as AriaRadioGroup,\n Radio as AriaRadio,\n Label,\n} from 'react-aria-components';\n\nimport { classNames } from './classNames.ts';\n\nexport type RadioGroupProps = Omit<\n ComponentPropsWithRef<typeof AriaRadioGroup>,\n 'className' | 'children'\n> & { children: ReactNode; label: string; className?: string };\nexport function RadioGroup({\n label,\n className,\n children,\n ...props\n}: RadioGroupProps) {\n return (\n <AriaRadioGroup\n {...props}\n className={classNames('altertable-radio-group', className)}\n >\n <Label className=\"altertable-control-label\">{label}</Label>\n {children}\n </AriaRadioGroup>\n );\n}\nexport type RadioProps = Omit<\n ComponentPropsWithRef<typeof AriaRadio>,\n 'className'\n> & { className?: string };\nexport function Radio({ className, children, ...props }: RadioProps) {\n return (\n <AriaRadio\n data-atbl-focus=\"ring\"\n {...props}\n data-atbl-control=\"action\"\n className={classNames('altertable-radio', className)}\n >\n {state => (\n <>\n <span className=\"altertable-radio-mark\" aria-hidden=\"true\" />\n {typeof children === 'function' ? children(state) : children}\n </>\n )}\n </AriaRadio>\n );\n}\nexport type SegmentedControlProps = Omit<RadioGroupProps, 'children'> & {\n options: readonly ChoiceOption[];\n};\n/** A compact radio group; arrow keys follow standard radio selection behavior. */\nexport function SegmentedControl({\n options,\n className,\n ...props\n}: SegmentedControlProps) {\n validateChoiceOptions(options);\n return (\n <RadioGroup\n {...props}\n orientation=\"horizontal\"\n className={classNames('altertable-segmented-control', className)}\n >\n <div className=\"altertable-segmented-options\">\n {options.map(option => (\n <Radio\n key={option.id}\n value={option.id}\n data-atbl-internal-surface=\"option\"\n data-atbl-focus=\"inset\"\n >\n {option.label}\n </Radio>\n ))}\n </div>\n </RadioGroup>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\nimport { type ComponentPropsWithRef } from 'react';\n\nimport { CheckboxGroupContext } from './Checkbox.tsx';\nimport { classNames } from './classNames.ts';\n\nexport type CheckboxGroupProps = Omit<\n ComponentPropsWithRef<'fieldset'>,\n 'onChange'\n> & {\n label: string;\n values: readonly string[];\n onChange: (values: string[]) => void;\n};\nexport function CheckboxGroup({\n label,\n values,\n onChange,\n className,\n children,\n disabled,\n ...props\n}: CheckboxGroupProps) {\n invariant(\n new Set(values).size === values.length,\n 'Checkbox group values must be unique.'\n );\n return (\n <fieldset\n {...props}\n disabled={disabled}\n className={classNames('altertable-checkbox-group', className)}\n >\n <legend>{label}</legend>\n <CheckboxGroupContext\n value={{\n values,\n disabled,\n onChange(value, checked) {\n onChange(\n checked\n ? [...values.filter(item => item !== value), value]\n : values.filter(item => item !== value)\n );\n },\n }}\n >\n {children}\n </CheckboxGroupContext>\n </fieldset>\n );\n}\n","import { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport {\n useContext,\n useLayoutEffect,\n useState,\n type ComponentProps,\n} from 'react';\nimport { Legend, type LegendPayload } from 'recharts';\n\nimport {\n ChartLegendInteractionContext,\n chartLegendSeriesKey,\n} from './chart-legend-interaction.tsx';\nimport { ChartLegend, type ChartLegendMarkerKind } from './ChartLegend.tsx';\n\nexport type ComposedChartLegendProps = ComponentProps<typeof Legend> & {\n maxVisibleItems?: number;\n /** Enable hover emphasis and click to focus one or more series. */\n interactive?: boolean;\n};\ntype LegendContentProps = ComposedChartLegendProps & {\n payload?: readonly LegendPayload[];\n};\n\nconst legendMarkerKinds: Partial<\n Record<NonNullable<LegendPayload['type']>, ChartLegendMarkerKind>\n> = {\n square: 'area',\n rect: 'bar',\n line: 'line',\n plainline: 'line',\n};\n\n// Series IDs survive sorting, renaming, and removal. Native series without IDs\n// can use a unique data key. Ambiguous entries may remount when Recharts replaces\n// their payload; object identity prevents them inheriting another series’ state.\nfunction createLegendItemKeys() {\n const identities = new WeakMap<object, number>();\n let nextIdentity = 0;\n function identity(value: object) {\n let id = identities.get(value);\n if (id === undefined) {\n id = nextIdentity++;\n identities.set(value, id);\n }\n return id;\n }\n return (payload: readonly LegendPayload[]) => {\n const keys = payload.map(entry => {\n const source: unknown = entry.payload;\n const id =\n source && typeof source === 'object' && 'id' in source\n ? source.id\n : undefined;\n const key = entry.dataKey;\n const seriesKey = chartLegendSeriesKey(id, key);\n if (seriesKey) return seriesKey;\n return ['object', identity(typeof key === 'function' ? key : entry)].join(\n KEY_SEPARATOR\n );\n });\n const counts = new Map<string, number>();\n for (const key of keys) counts.set(key, (counts.get(key) ?? 0) + 1);\n return keys.map((key, index) => {\n if (counts.get(key) === 1) return key;\n const entry = payload[index]!;\n const source: unknown = entry.payload;\n return [\n key,\n 'object',\n identity(source && typeof source === 'object' ? source : entry),\n ].join(KEY_SEPARATOR);\n });\n };\n}\n\nfunction LegendContent({\n payload = [],\n maxVisibleItems,\n formatter,\n layout,\n align,\n labelStyle,\n iconType,\n iconSize = 8,\n inactiveColor = 'var(--atbl-muted)',\n position,\n verticalAlign,\n onClick,\n onMouseEnter,\n onMouseLeave,\n interactive = true,\n 'aria-label': ariaLabel,\n}: LegendContentProps) {\n const [getItemKeys] = useState(createLegendItemKeys);\n const interaction = useContext(ChartLegendInteractionContext);\n const itemKeys = getItemKeys(payload);\n const selectableKeys = itemKeys.filter(\n (_, index) => payload[index]?.type !== 'none'\n );\n useLayoutEffect(() => {\n interaction?.reconcile(selectableKeys);\n });\n const canInteract =\n interactive &&\n !onClick &&\n interaction &&\n (payload.filter(entry => entry.type !== 'none').length > 1 ||\n interaction.focusedKeys !== null);\n if (!payload.some(entry => entry.type !== 'none')) return null;\n const vertical =\n layout === 'vertical' ||\n (layout === 'auto' && (position === 'left' || position === 'right'));\n return (\n <ChartLegend\n aria-label={ariaLabel}\n className={\n position === 'top' || (position == null && verticalAlign === 'top')\n ? 'altertable-composed-chart-legend-above'\n : position === 'bottom' ||\n (position == null && verticalAlign !== 'middle' && !vertical)\n ? 'altertable-composed-chart-legend-below'\n : undefined\n }\n maxVisibleItems={maxVisibleItems}\n layout={vertical ? 'vertical' : 'horizontal'}\n align={align === 'right' ? 'end' : align === 'left' ? 'start' : 'center'}\n >\n {payload.map((entry, index) => {\n if (entry.type === 'none') return null;\n const type = iconType ?? entry.type;\n const kind = iconType\n ? (legendMarkerKinds[type ?? 'none'] ?? 'point')\n : 'square';\n const formatLabel = entry.formatter ?? formatter;\n const label = formatLabel\n ? formatLabel(entry.value, entry, index)\n : entry.value;\n const content = (\n <>\n {type !== 'none' &&\n (entry.legendIcon ?? (\n <ChartLegend.Marker\n kind={kind}\n color={entry.inactive ? inactiveColor : entry.color}\n style={{\n width: iconSize,\n height: kind === 'square' ? iconSize : iconSize * 0.6,\n }}\n />\n ))}\n <ChartLegend.Label style={labelStyle}>{label}</ChartLegend.Label>\n </>\n );\n return (\n <ChartLegend.Item\n key={itemKeys[index]}\n inactive={entry.inactive}\n data-legend-muted={\n canInteract &&\n interaction.hoveredKey &&\n (!interaction.focusedKeys ||\n interaction.focusedKeys.has(interaction.hoveredKey)) &&\n interaction.hoveredKey !== itemKeys[index]\n ? true\n : undefined\n }\n data-legend-excluded={\n canInteract &&\n interaction.focusedKeys &&\n !interaction.focusedKeys.has(itemKeys[index]!)\n ? true\n : undefined\n }\n onMouseEnter={event => {\n if (canInteract) interaction.hover(itemKeys[index]!);\n onMouseEnter?.(entry, index, event);\n }}\n onMouseLeave={event => {\n if (canInteract) interaction.hover(null);\n onMouseLeave?.(entry, index, event);\n }}\n >\n {canInteract || onClick ? (\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action\"\n aria-pressed={\n canInteract\n ? !!interaction.focusedKeys?.has(itemKeys[index]!)\n : undefined\n }\n onFocus={() => {\n if (canInteract) interaction.hover(itemKeys[index]!);\n }}\n onBlur={() => {\n if (canInteract) interaction.hover(null);\n }}\n onClick={event => {\n if (canInteract)\n interaction.toggle(itemKeys[index]!, selectableKeys);\n onClick?.(entry, index, event);\n }}\n >\n {content}\n </button>\n ) : (\n content\n )}\n </ChartLegend.Item>\n );\n })}\n </ChartLegend>\n );\n}\n\n/** Opt in inside ComposedChart to derive the shared legend from its displayed series.\n * Native positioning, sorting, formatters, callbacks, and custom content remain available. */\nexport function ComposedChartLegend({\n maxVisibleItems,\n interactive = true,\n ...props\n}: ComposedChartLegendProps) {\n return (\n <Legend\n iconSize={8}\n inactiveColor=\"var(--atbl-muted)\"\n content={\n <LegendContent\n maxVisibleItems={maxVisibleItems}\n interactive={interactive}\n />\n }\n {...props}\n />\n );\n}\n","import { type MetricFormat } from '@altertable/data-app/format';\nimport {\n Children,\n Fragment,\n isValidElement,\n cloneElement,\n useState,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n type PointerEvent,\n type ComponentProps,\n type ReactNode,\n type ReactElement,\n} from 'react';\nimport {\n ComposedChart as RechartsComposedChart,\n CartesianGrid as NativeCartesianGrid,\n ZAxis,\n ReferenceLine,\n ReferenceArea,\n ReferenceDot,\n Brush,\n Cell,\n Line as NativeLine,\n Bar as NativeBar,\n Area as NativeArea,\n Scatter as NativeScatter,\n XAxis as NativeXAxis,\n YAxis as NativeYAxis,\n Legend as NativeLegend,\n useOffset,\n useMargin,\n Label,\n LabelList,\n ErrorBar,\n} from 'recharts';\n\nimport type { HorizontalGridProps } from './chart-data.ts';\nimport { ChartDateAxes } from './chart-date-axis.tsx';\nimport {\n ChartInteractionContext,\n ChartRegistrationContext,\n chartAxisKey,\n type ChartBarPoint,\n type ChartDataKey,\n type ChartPoint,\n} from './chart-interaction.tsx';\nimport {\n ChartLegendInteractionContext,\n chartLegendSeriesKey,\n reconcileLegendFocus,\n toggleLegendFocus,\n} from './chart-legend-interaction.tsx';\nimport {\n ChartBar as Bar,\n ChartDot as Dot,\n ChartLine as Line,\n ChartArea as Area,\n ChartScatter as Scatter,\n ChartXAxis as XAxis,\n ChartYAxis as YAxis,\n ChartGrid as CartesianGrid,\n ChartTooltip as Tooltip,\n} from './chart-primitives.tsx';\nimport { ChartValueFormat } from './chart-value-format.ts';\nimport { classNames } from './classNames.ts';\nimport { ComposedChartLegend as Legend } from './ComposedChartLegend.tsx';\nimport {\n type ChartCursorGroup,\n ChartCursorChartContext,\n useLinkedChartCursor,\n} from './use-chart-cursor-group.tsx';\n\nfunction findNearestSeriesId(\n hoveredSeriesId: string | null,\n points: ReadonlyMap<string, ChartPoint>,\n position: ChartPoint | null\n) {\n // Bars and scatter points use direct hits; line and area samples use distance.\n if (!position || (hoveredSeriesId != null && !points.has(hoveredSeriesId)))\n return hoveredSeriesId;\n let selected = hoveredSeriesId;\n let distance = Infinity;\n for (const [id, point] of points) {\n const candidate = Math.hypot(point.x - position.x, point.y - position.y);\n if (candidate < distance) {\n distance = candidate;\n selected = id;\n }\n }\n return selected;\n}\n\nfunction findNearestBar(\n bars: ReadonlyMap<string, ChartBarPoint>,\n position: ChartPoint | null,\n layout: 'horizontal' | 'vertical'\n) {\n if (!position) return null;\n let nearest: ChartBarPoint | null = null;\n let categoryDistance = Infinity;\n let valueDistance = Infinity;\n for (const bar of bars.values()) {\n const category =\n layout === 'horizontal'\n ? Math.abs(position.x - (bar.x + bar.width / 2))\n : Math.abs(position.y - (bar.y + bar.height / 2));\n const value =\n layout === 'horizontal'\n ? Math.max(bar.y - position.y, 0, position.y - bar.y - bar.height)\n : Math.max(bar.x - position.x, 0, position.x - bar.x - bar.width);\n if (\n category < categoryDistance ||\n (category === categoryDistance && value < valueDistance)\n ) {\n nearest = bar;\n categoryDistance = category;\n valueDistance = value;\n }\n }\n return nearest;\n}\n\nfunction barCloserThanPoints(\n bar: ChartBarPoint | null,\n points: ReadonlyMap<string, ChartPoint>,\n position: ChartPoint | null\n) {\n if (!bar || !position) return false;\n const dx = Math.max(bar.x - position.x, 0, position.x - bar.x - bar.width);\n const dy = Math.max(bar.y - position.y, 0, position.y - bar.y - bar.height);\n const barDistance = Math.hypot(dx, dy);\n let pointDistance = Infinity;\n for (const point of points.values()) {\n pointDistance = Math.min(\n pointDistance,\n Math.hypot(point.x - position.x, point.y - position.y)\n );\n }\n return barDistance <= pointDistance;\n}\n\nfunction categoryDataKey(\n children: ReactNode,\n layout: 'horizontal' | 'vertical',\n axisId: string | number\n): ChartDataKey | undefined {\n for (const child of Children.toArray(children)) {\n if (\n !isValidElement<{\n children?: ReactNode;\n dataKey?: unknown;\n xAxisId?: string | number;\n yAxisId?: string | number;\n }>(child)\n )\n continue;\n if (child.type === Fragment) {\n const nested = categoryDataKey(child.props.children, layout, axisId);\n if (nested != null) return nested;\n }\n if (\n child.type !== (layout === 'horizontal' ? XAxis : YAxis) &&\n child.type !== (layout === 'horizontal' ? NativeXAxis : NativeYAxis)\n )\n continue;\n if (\n ((layout === 'horizontal' ? child.props.xAxisId : child.props.yAxisId) ??\n 0) !== axisId\n )\n continue;\n const key = child.props.dataKey;\n if (\n typeof key === 'string' ||\n typeof key === 'number' ||\n typeof key === 'function'\n )\n return key as ChartDataKey;\n }\n return undefined;\n}\n\nexport type ComposedChartProps<Row = unknown> = HorizontalGridProps &\n Omit<ComponentProps<typeof RechartsComposedChart<Row>>, 'data' | 'title'> & {\n /** Displayed rows; series and axes select fields with Recharts dataKey props. */\n data: readonly Row[];\n /** Describes the measures and scope for assistive technology. */\n ariaLabel: string;\n /** Shared measure semantics: compact numeric axes and precise tooltips.\n * For mixed units, use explicit axis tickFormatter and series/tooltip formatters. */\n valueFormat?: MetricFormat;\n /** Share mouse-hover timestamps with charts receiving the same handle, using the temporal X axis. */\n cursorGroup?: ChartCursorGroup;\n };\n\nfunction hasAuthoredGrid(children: ReactNode): boolean {\n return Children.toArray(children).some(\n child =>\n isValidElement<{ children?: ReactNode }>(child) &&\n (child.type === CartesianGrid ||\n child.type === NativeCartesianGrid ||\n (child.type === Fragment && hasAuthoredGrid(child.props.children)))\n );\n}\n\nfunction countNativeSeriesKeys(\n children: ReactNode,\n counts = new Map<string, number>()\n) {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return;\n if (child.type === Fragment) {\n countNativeSeriesKeys(\n (child.props as { children?: ReactNode }).children,\n counts\n );\n } else if (\n child.type === NativeLine ||\n child.type === NativeBar ||\n child.type === NativeArea ||\n child.type === NativeScatter\n ) {\n const props = child.props as { id?: string; dataKey?: unknown };\n const key = chartLegendSeriesKey(props.id, props.dataKey);\n if (key) counts.set(key, (counts.get(key) ?? 0) + 1);\n }\n });\n return counts;\n}\n\nfunction nativeSeriesId(\n props: { id?: string; dataKey?: unknown },\n child: ReactElement,\n index: number,\n path: string,\n keyCounts: ReadonlyMap<string, number>\n) {\n if (props.id != null) return props.id;\n const key = chartLegendSeriesKey(undefined, props.dataKey);\n return !key || (keyCounts.get(key) ?? 0) > 1\n ? `atbl-native-${path}-${child.key ?? index}`\n : undefined;\n}\n\nfunction applyNativeLegendInteraction(\n children: ReactNode,\n focusedKeys: ReadonlySet<string> | null,\n hoveredKey: string | null,\n suppressPlotInspection: boolean,\n valueAxis: 'x' | 'y',\n visibleBarAxisIds: ReadonlySet<string | number>,\n fullAxisSpace: { left: number; right: number } | null,\n yAxisSideCounts: { left: number; right: number },\n keyCounts: ReadonlyMap<string, number>,\n path = 'root'\n): ReactNode {\n return Children.map(children, (child, index) => {\n if (!isValidElement(child)) return child;\n if (child.type === Fragment) {\n const props = child.props as { children?: ReactNode };\n return cloneElement(child, {\n children: applyNativeLegendInteraction(\n props.children,\n focusedKeys,\n hoveredKey,\n suppressPlotInspection,\n valueAxis,\n visibleBarAxisIds,\n fullAxisSpace,\n yAxisSideCounts,\n keyCounts,\n `${path}-${child.key ?? index}`\n ),\n } as { children: ReactNode });\n }\n if (child.type === XAxis || child.type === NativeXAxis) {\n const axis = child as ReactElement<{\n xAxisId?: string | number;\n includeHidden?: boolean;\n domain?: unknown;\n ticks?: unknown;\n }>;\n if (valueAxis === 'y')\n return cloneElement(axis, {\n includeHidden: axis.props.includeHidden ?? true,\n });\n if (!focusedKeys || axis.props.domain != null || axis.props.ticks != null)\n return child;\n return cloneElement(axis, {\n domain: visibleBarAxisIds.has(axis.props.xAxisId ?? 0)\n ? [0, 'auto']\n : ['auto', 'auto'],\n });\n }\n if (child.type === YAxis || child.type === NativeYAxis) {\n const axis = child as ReactElement<{\n yAxisId?: string | number;\n includeHidden?: boolean;\n domain?: unknown;\n ticks?: unknown;\n width?: number | 'auto';\n orientation?: 'left' | 'right';\n }>;\n if (valueAxis === 'x')\n return cloneElement(axis, {\n includeHidden: axis.props.includeHidden ?? true,\n });\n if (!focusedKeys || axis.props.domain != null || axis.props.ticks != null)\n return child;\n const side = axis.props.orientation ?? 'left';\n const reservedWidth =\n (axis.props.width === 'auto' ||\n (child.type === YAxis && axis.props.width == null)) &&\n yAxisSideCounts[side] === 1\n ? fullAxisSpace?.[side]\n : undefined;\n return cloneElement(axis, {\n domain: visibleBarAxisIds.has(axis.props.yAxisId ?? 0)\n ? [0, 'auto']\n : ['auto', 'auto'],\n ...(reservedWidth != null && { width: reservedWidth }),\n });\n }\n if (\n child.type !== NativeLine &&\n child.type !== NativeBar &&\n child.type !== NativeArea &&\n child.type !== NativeScatter\n )\n return child;\n const series = child as ReactElement<{\n id?: string;\n dataKey?: unknown;\n hide?: boolean;\n opacity?: number;\n style?: { pointerEvents?: string };\n dot?: unknown;\n activeDot?: unknown;\n }>;\n const id = nativeSeriesId(series.props, child, index, path, keyCounts);\n const key = chartLegendSeriesKey(id, series.props.dataKey)!;\n const excluded = !!(focusedKeys && !focusedKeys.has(key));\n return cloneElement(series, {\n id,\n hide: excluded || series.props.hide,\n opacity: excluded\n ? 0\n : hoveredKey &&\n (!focusedKeys || focusedKeys.has(hoveredKey)) &&\n hoveredKey !== key\n ? 0.2\n : series.props.opacity,\n style: {\n ...series.props.style,\n pointerEvents: excluded ? 'none' : series.props.style?.pointerEvents,\n },\n ...(excluded && (child.type === NativeLine || child.type === NativeArea)\n ? { dot: false, activeDot: false }\n : {}),\n ...(suppressPlotInspection &&\n (child.type === NativeLine || child.type === NativeArea)\n ? { activeDot: false }\n : {}),\n });\n });\n}\n\nfunction collectVisibleNativeBarAxisIds(\n children: ReactNode,\n focusedKeys: ReadonlySet<string> | null,\n valueAxis: 'x' | 'y',\n keyCounts: ReadonlyMap<string, number>,\n path = 'root',\n ids = new Set<string | number>()\n) {\n Children.forEach(children, (child, index) => {\n if (!isValidElement(child)) return;\n if (child.type === Fragment) {\n collectVisibleNativeBarAxisIds(\n (child.props as { children?: ReactNode }).children,\n focusedKeys,\n valueAxis,\n keyCounts,\n `${path}-${child.key ?? index}`,\n ids\n );\n } else if (child.type === NativeBar) {\n const props = child.props as {\n id?: string;\n dataKey?: unknown;\n hide?: boolean;\n xAxisId?: string | number;\n yAxisId?: string | number;\n };\n const id = nativeSeriesId(props, child, index, path, keyCounts);\n const key = chartLegendSeriesKey(id, props.dataKey)!;\n if (!props.hide && (!focusedKeys || focusedKeys.has(key))) {\n ids.add(\n valueAxis === 'x' ? (props.xAxisId ?? 0) : (props.yAxisId ?? 0)\n );\n }\n }\n });\n return ids;\n}\n\nfunction inspectAxisLayout(\n children: ReactNode,\n layout = { left: 0, right: 0, autoYAxis: false, interactiveLegend: false }\n) {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return;\n if (child.type === Fragment) {\n inspectAxisLayout(\n (child.props as { children?: ReactNode }).children,\n layout\n );\n } else if (child.type === YAxis || child.type === NativeYAxis) {\n const props = child.props as {\n hide?: boolean;\n mirror?: boolean;\n orientation?: 'left' | 'right';\n width?: number | 'auto';\n };\n if (!props.hide && !props.mirror) {\n layout[props.orientation ?? 'left']++;\n if (\n props.width === 'auto' ||\n (child.type === YAxis && props.width == null)\n )\n layout.autoYAxis = true;\n }\n } else if (child.type === Legend || child.type === NativeLegend) {\n const props = child.props as {\n position?: string;\n align?: string;\n layout?: string;\n interactive?: boolean;\n };\n if (child.type === Legend && props.interactive !== false)\n layout.interactiveLegend = true;\n const side =\n props.position === 'left' || props.position === 'right'\n ? props.position\n : props.layout === 'vertical' &&\n (props.align === 'left' || props.align === 'right')\n ? props.align\n : null;\n if (side) layout[side]++;\n }\n });\n return layout;\n}\n\nfunction PlotOffsets({\n onChange,\n}: {\n onChange: (left: number, right: number) => void;\n}) {\n const offset = useOffset();\n const margin = useMargin();\n const left = offset?.left;\n const right = offset?.right;\n const marginLeft = margin?.left ?? 5;\n const marginRight = margin?.right ?? 5;\n useLayoutEffect(() => {\n if (left != null && right != null)\n onChange(left - marginLeft, right - marginRight);\n }, [left, right, marginLeft, marginRight, onChange]);\n return null;\n}\n\n/** Compose Cartesian series inside VisualizationWidget. Defaults to responsive\n * full width and 300px height. Children retain native Recharts props and behavior,\n * including stacking, numeric/time axes, missing values, tooltips, and keyboard\n * navigation. Match yAxisId on axes and series for different units; use stackId\n * for stacks. Preserve missing measures as null and choose connectNulls deliberately.\n * Use public chart tokens for series colors. Dataset bindings own\n * loading, empty results, evidence, and CSV; this primitive owns only the plot. */\nfunction ComposedChartRoot<Row>({\n data,\n ariaLabel,\n valueFormat,\n cursorGroup,\n horizontalGrid = true,\n children,\n width = '100%',\n height = 300,\n responsive = true,\n layout = 'horizontal',\n className,\n ...props\n}: ComposedChartProps<Row>) {\n const cursor = useLinkedChartCursor(cursorGroup);\n const [mouseHover, setMouseHover] = useState(false);\n const [hasPointerFocus, setHasPointerFocus] = useState(false);\n const [isPointerInspection, setIsPointerInspection] = useState(false);\n const [hoveredSeriesId, setHoveredSeriesId] = useState<string | null>(null);\n const [pointerPosition, setPointerPosition] = useState<ChartPoint | null>(\n null\n );\n const [nearestBar, setNearestBar] = useState<ChartBarPoint | null>(null);\n const latestPointerPosition = useRef<ChartPoint | null>(null);\n const [points, setPoints] = useState<ReadonlyMap<string, ChartPoint>>(\n () => new Map()\n );\n const bars = useRef(new Map<string, ChartBarPoint>());\n const barRefreshFrame = useRef<number | null>(null);\n const refreshNearestBar = useCallback(() => {\n if (barRefreshFrame.current != null || !latestPointerPosition.current)\n return;\n // Bar shapes register in separate layout effects; inspect the complete\n // geometry once per frame instead of updating the chart for every bar.\n barRefreshFrame.current = requestAnimationFrame(() => {\n barRefreshFrame.current = null;\n const selected = findNearestBar(\n bars.current,\n latestPointerPosition.current,\n layout\n );\n setNearestBar(selected);\n setPointerPosition(latestPointerPosition.current);\n });\n }, [layout]);\n useEffect(\n () => () => {\n if (barRefreshFrame.current != null)\n cancelAnimationFrame(barRefreshFrame.current);\n },\n []\n );\n const registerBar = useCallback(\n (bar: ChartBarPoint) => {\n const key = `${bar.seriesId}:${bar.index}`;\n bars.current.set(key, bar);\n refreshNearestBar();\n return () => {\n if (bars.current.get(key) === bar) {\n bars.current.delete(key);\n refreshNearestBar();\n }\n };\n },\n [refreshNearestBar]\n );\n const registerPoint = useCallback((id: string, x: number, y: number) => {\n setPoints(current => new Map(current).set(id, { x, y }));\n return () =>\n setPoints(current => {\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n }, []);\n const [categoryAxisKeys, setCategoryAxisKeys] = useState<\n ReadonlyMap<string, ChartDataKey>\n >(() => new Map());\n const registerCategoryAxis = useCallback(\n (axis: 'x' | 'y', id: string | number, dataKey: ChartDataKey) => {\n const key = chartAxisKey(axis, id);\n setCategoryAxisKeys(current =>\n current.get(key) === dataKey\n ? current\n : new Map(current).set(key, dataKey)\n );\n return () =>\n setCategoryAxisKeys(current => {\n if (current.get(key) !== dataKey) return current;\n const next = new Map(current);\n next.delete(key);\n return next;\n });\n },\n []\n );\n useEffect(() => {\n // A new active sample moves the registered dots; re-evaluate the latest\n // pointer position even if its previous nearest series was unchanged.\n setPointerPosition(latestPointerPosition.current);\n }, [points]);\n function trackPointer(event: PointerEvent<HTMLElement>) {\n setMouseHover(event.pointerType === 'mouse');\n const svg = event.currentTarget.querySelector('svg[role=\"application\"]');\n if (\n !(svg instanceof SVGSVGElement) ||\n !(event.target instanceof Node) ||\n !svg.contains(event.target)\n ) {\n resetPointerInspection();\n return false;\n }\n setSuppressPlotInspection(false);\n setIsPointerInspection(true);\n // Direct-hit series do not need pointer coordinates to select a sample.\n if (\n bars.current.size === 0 &&\n hoveredSeriesId != null &&\n !points.has(hoveredSeriesId)\n ) {\n latestPointerPosition.current = null;\n setPointerPosition(null);\n setNearestBar(null);\n return true;\n }\n const matrix = svg.getScreenCTM();\n if (!matrix) return true;\n const point = new DOMPoint(event.clientX, event.clientY).matrixTransform(\n matrix.inverse()\n );\n const nextPosition = { x: point.x, y: point.y };\n latestPointerPosition.current = nextPosition;\n const selected = findNearestBar(bars.current, nextPosition, layout);\n setNearestBar(selected);\n setPointerPosition(current => {\n const currentBar = findNearestBar(bars.current, current, layout);\n const currentTarget = barCloserThanPoints(currentBar, points, current)\n ? currentBar\n : findNearestSeriesId(hoveredSeriesId, points, current);\n const nextTarget = barCloserThanPoints(selected, points, nextPosition)\n ? selected\n : findNearestSeriesId(hoveredSeriesId, points, nextPosition);\n return currentTarget === nextTarget ? current : nextPosition;\n });\n return true;\n }\n function resetPointerInspection() {\n setMouseHover(false);\n cursor.reset();\n setIsPointerInspection(false);\n setHoveredSeriesId(null);\n latestPointerPosition.current = null;\n setPointerPosition(null);\n setNearestBar(null);\n }\n const activeBar = barCloserThanPoints(nearestBar, points, pointerPosition)\n ? nearestBar\n : null;\n const activeSeriesId =\n activeBar?.seriesId ??\n findNearestSeriesId(hoveredSeriesId, points, pointerPosition);\n const [seriesIds, setSeriesIds] = useState<ReadonlySet<string>>(\n () => new Set()\n );\n const registerSeries = useCallback((id: string) => {\n setSeriesIds(current => new Set(current).add(id));\n return () => {\n setSeriesIds(current => {\n const next = new Set(current);\n next.delete(id);\n return next;\n });\n };\n }, []);\n const [legendHoveredKey, setLegendHoveredKey] = useState<string | null>(null);\n const [suppressPlotInspection, setSuppressPlotInspection] = useState(false);\n const [focusedLegendKeys, setFocusedLegendKeys] =\n useState<ReadonlySet<string> | null>(null);\n const [barAxisByKey, setBarAxisByKey] = useState<\n ReadonlyMap<string, string | number>\n >(() => new Map());\n const registerBarAxis = useCallback(\n (key: string, axisId: string | number) => {\n setBarAxisByKey(current => {\n if (current.get(key) === axisId) return current;\n return new Map(current).set(key, axisId);\n });\n return () =>\n setBarAxisByKey(current => {\n if (current.get(key) !== axisId) return current;\n const next = new Map(current);\n next.delete(key);\n return next;\n });\n },\n []\n );\n const valueAxis = layout === 'vertical' ? 'x' : 'y';\n const [fullAxisSpace, setFullAxisSpace] = useState<{\n left: number;\n right: number;\n } | null>(null);\n const trackPlotOffsets = useCallback(\n (left: number, right: number) => {\n if (focusedLegendKeys) return;\n setFullAxisSpace(current =>\n current?.left === left && current.right === right\n ? current\n : { left, right }\n );\n },\n [focusedLegendKeys]\n );\n const axisLayout = inspectAxisLayout(children);\n const nativeKeyCounts = countNativeSeriesKeys(children);\n const visibleBarAxisIds = collectVisibleNativeBarAxisIds(\n children,\n focusedLegendKeys,\n valueAxis,\n nativeKeyCounts\n );\n for (const [key, axisId] of barAxisByKey) {\n if (!focusedLegendKeys || focusedLegendKeys.has(key))\n visibleBarAxisIds.add(axisId);\n }\n const reconcileLegendKeys = useCallback((keys: readonly string[]) => {\n setFocusedLegendKeys(current => reconcileLegendFocus(current, keys));\n }, []);\n const toggleLegendKey = useCallback(\n (key: string, keys: readonly string[]) => {\n setSuppressPlotInspection(true);\n setFocusedLegendKeys(current => toggleLegendFocus(current, key, keys));\n },\n []\n );\n const registration = useMemo(\n () => ({\n registerPoint,\n registerBar,\n registerSeries,\n registerCategoryAxis,\n setHoveredSeriesId,\n }),\n [registerPoint, registerBar, registerSeries, registerCategoryAxis]\n );\n return (\n <ChartCursorChartContext.Provider value={{ cursor, mouseHover }}>\n <ChartLegendInteractionContext.Provider\n value={{\n hoveredKey: legendHoveredKey,\n focusedKeys: focusedLegendKeys,\n suppressPlotInspection,\n hover: key => {\n setLegendHoveredKey(key);\n if (key) setSuppressPlotInspection(true);\n },\n toggle: toggleLegendKey,\n reconcile: reconcileLegendKeys,\n registerBarAxis,\n }}\n >\n <ChartInteractionContext.Provider\n value={{\n isPointerInspection,\n activeSeriesId,\n activePoint:\n activeSeriesId == null ? undefined : points.get(activeSeriesId),\n activeBar,\n getCategoryDataKey: axisId =>\n categoryAxisKeys.get(\n chartAxisKey(layout === 'horizontal' ? 'x' : 'y', axisId)\n ) ?? categoryDataKey(children, layout, axisId),\n seriesCount: seriesIds.size,\n }}\n >\n <section\n className={classNames('altertable-composed-chart', className)}\n aria-label={ariaLabel}\n data-atbl-internal-pointer-focus={hasPointerFocus || undefined}\n onPointerDownCapture={event => {\n setHasPointerFocus(trackPointer(event));\n }}\n onPointerOverCapture={trackPointer}\n onPointerMoveCapture={trackPointer}\n onPointerLeave={event => {\n if (event.pointerType !== 'touch') {\n resetPointerInspection();\n }\n }}\n onKeyDownCapture={() => {\n setHasPointerFocus(false);\n resetPointerInspection();\n }}\n onFocusCapture={event => {\n const svg = event.currentTarget.querySelector(\n 'svg[role=\"application\"]'\n );\n if (svg?.contains(event.target)) setSuppressPlotInspection(false);\n }}\n onBlurCapture={event => {\n if (!event.currentTarget.contains(event.relatedTarget)) {\n setHasPointerFocus(false);\n resetPointerInspection();\n }\n }}\n >\n <ChartValueFormat.Provider value={valueFormat}>\n <ChartDateAxes data={data}>\n <ChartRegistrationContext.Provider value={registration}>\n <RechartsComposedChart\n data-atbl-focus=\"inset\"\n {...props}\n data={data}\n width={width}\n height={height}\n responsive={responsive}\n layout={layout}\n aria-label={ariaLabel}\n >\n {valueAxis === 'y' &&\n axisLayout.autoYAxis &&\n axisLayout.interactiveLegend && (\n <PlotOffsets onChange={trackPlotOffsets} />\n )}\n {horizontalGrid && !hasAuthoredGrid(children) && (\n <CartesianGrid />\n )}\n {applyNativeLegendInteraction(\n children,\n focusedLegendKeys,\n legendHoveredKey,\n suppressPlotInspection,\n valueAxis,\n visibleBarAxisIds,\n fullAxisSpace,\n axisLayout,\n nativeKeyCounts\n )}\n </RechartsComposedChart>\n </ChartRegistrationContext.Provider>\n </ChartDateAxes>\n </ChartValueFormat.Provider>\n </section>\n </ChartInteractionContext.Provider>\n </ChartLegendInteractionContext.Provider>\n </ChartCursorChartContext.Provider>\n );\n}\n\n/** Shared themed series and controls; other children retain native Recharts defaults. */\nexport const ComposedChart = Object.assign(ComposedChartRoot, {\n Dot,\n Area,\n Bar,\n Line,\n Scatter,\n XAxis,\n YAxis,\n ZAxis,\n CartesianGrid,\n Tooltip,\n Legend,\n ReferenceLine,\n ReferenceArea,\n ReferenceDot,\n Brush,\n Cell,\n Label,\n LabelList,\n ErrorBar,\n});\n","import { useId } from 'react';\n\nconst svgIdCharacterPattern = /[a-zA-Z0-9-]/;\n\n/** Stable React ID for SVG definitions and their URL references; safe with identifier prefixes. */\nexport function useSvgId(): string {\n const id = useId();\n const encodedId = Array.from(id, character =>\n svgIdCharacterPattern.test(character)\n ? character\n : `_${character.codePointAt(0)!.toString(16)}_`\n ).join('');\n return ['svg', encodedId].join('-');\n}\n","import { formatNumber, formatPercent } from '@altertable/data-app/format';\nimport { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport { invariant } from '@altertable/data-app/internal';\nimport { Fragment, useEffect, useRef, useState } from 'react';\n\nimport {\n type CountChartProps,\n type HorizontalGridProps,\n} from './chart-data.ts';\nimport { useChartLegendFocus } from './chart-legend-interaction.tsx';\nimport { ChartTooltipContent } from './chart-primitives.tsx';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport { classNames } from './classNames.ts';\nimport { ComposedChart } from './ComposedChart.tsx';\nimport { useSvgId } from './useSvgId.ts';\n\n/** Ordered step with a unique, nonblank ID. */\nexport type FunnelChartStep = { id: string; label: string };\nexport type FunnelChartSeries = {\n /** Unique, nonblank population ID. */\n id: string;\n label: string;\n /** Finite, nonnegative counts aligned with steps and nonincreasing. */\n values: readonly number[];\n};\nexport type FunnelChartProps = CountChartProps &\n HorizontalGridProps & {\n steps: readonly FunnelChartStep[];\n series: readonly FunnelChartSeries[];\n /** Disable legend hover and focus controls. */\n interactiveLegend?: boolean;\n };\n\ntype FunnelPopulation = {\n id: string;\n label: string;\n color: string;\n hatchId: string;\n};\ntype FunnelReading = {\n population: FunnelPopulation;\n current: number;\n previous: number;\n dropped: number;\n conversion: number | null;\n dropOff: number | null;\n conversionPercent: number;\n dropOffPercent: number;\n};\ntype FunnelRow = {\n id: string;\n label: string;\n index: number;\n readings: ReadonlyMap<string, FunnelReading>;\n};\n\nfunction createFunnelModel(\n steps: readonly FunnelChartStep[],\n series: readonly FunnelChartSeries[],\n chartId: string\n) {\n for (const [kind, items] of [\n ['funnel step', steps],\n ['funnel series', series],\n ] as const) {\n const ids = new Set<string>();\n for (const item of items) {\n invariant(\n item.id.trim().length > 0 && !ids.has(item.id),\n `${kind} chart IDs must be nonblank and unique.`\n );\n ids.add(item.id);\n }\n }\n for (const item of series) {\n invariant(\n item.values.length === steps.length,\n 'funnel chart counts must align with steps.'\n );\n item.values.forEach((value, index) => {\n invariant(\n Number.isFinite(value) && value >= 0,\n 'funnel chart counts must be finite and nonnegative.'\n );\n invariant(\n index === 0 || value <= item.values[index - 1]!,\n 'funnel chart counts must be nonincreasing.'\n );\n });\n }\n const populations: FunnelPopulation[] = series.map((item, index) => ({\n id: item.id,\n label: item.label,\n color: `var(--atbl-chart-${(index % 8) + 1})`,\n hatchId: [chartId, 'hatch', index].join('-'),\n }));\n const rows: FunnelRow[] = steps.map((step, index) => ({\n id: step.id,\n label: step.label,\n index,\n readings: new Map(\n series.map((item, seriesIndex) => {\n const first = item.values[0] ?? 0;\n const current = item.values[index]!;\n const previous = item.values[Math.max(0, index - 1)]!;\n const dropped = previous - current;\n const conversion = first > 0 ? current / first : null;\n const dropOff = first > 0 ? dropped / first : null;\n return [\n item.id,\n {\n population: populations[seriesIndex]!,\n current,\n previous,\n dropped,\n conversion,\n dropOff,\n conversionPercent: (conversion ?? 0) * 100,\n dropOffPercent: (dropOff ?? (index === 0 ? 1 : 0)) * 100,\n },\n ];\n })\n ),\n }));\n return { populations, rows };\n}\n\n/** Conversion columns with previous-step drop-off, normalized to each series' first step.\n * Owns series highlighting and portion-specific inspection; compose inside VisualizationWidget. */\nexport function FunnelChart({\n steps,\n series,\n unit,\n ariaLabel,\n className,\n formatValue = formatNumber,\n horizontalGrid = true,\n interactiveLegend = true,\n}: FunnelChartProps) {\n const legendFocus = useChartLegendFocus(series.map(item => item.id));\n const chartId = useSvgId();\n const [highlighted, setHighlighted] = useState<{\n id: string;\n conversion: boolean;\n step: number;\n } | null>(null);\n const clearTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n function cancelClear() {\n if (clearTimer.current !== null) clearTimeout(clearTimer.current);\n clearTimer.current = null;\n }\n useEffect(() => cancelClear, []);\n function highlight(id: string, conversion: boolean, step: number) {\n cancelClear();\n setHighlighted({ id, conversion, step });\n }\n function clearHighlight() {\n cancelClear();\n setHighlighted(null);\n }\n function scheduleClear() {\n cancelClear();\n clearTimer.current = setTimeout(() => setHighlighted(null), 100);\n }\n const { populations, rows } = createFunnelModel(steps, series, chartId);\n return (\n <section\n className={classNames('altertable-funnel-chart', className)}\n aria-label={ariaLabel}\n onKeyDownCapture={clearHighlight}\n >\n {steps.length === 0 || series.length === 0 ? (\n <span>No data</span>\n ) : (\n <>\n <div className=\"altertable-funnel-header\">\n <ChartLegend aria-label=\"Funnel series\" layout=\"single-row\">\n {populations.map(item => (\n <ChartLegend.Item\n key={item.id}\n className=\"altertable-funnel-summary-item\"\n data-legend-muted={\n (interactiveLegend &&\n legendFocus.hoveredId &&\n (!legendFocus.focusedIds ||\n legendFocus.focusedIds.has(legendFocus.hoveredId)) &&\n legendFocus.hoveredId !== item.id) ||\n undefined\n }\n data-legend-excluded={\n (interactiveLegend && !legendFocus.visible(item.id)) ||\n undefined\n }\n >\n {interactiveLegend && populations.length > 1 ? (\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action altertable-funnel-legend-button\"\n aria-pressed={!!legendFocus.focusedIds?.has(item.id)}\n onPointerEnter={() => legendFocus.setHoveredId(item.id)}\n onPointerLeave={() => legendFocus.setHoveredId(null)}\n onFocus={() => legendFocus.setHoveredId(item.id)}\n onBlur={() => legendFocus.setHoveredId(null)}\n onClick={() => legendFocus.toggle(item.id)}\n >\n <span className=\"altertable-funnel-series-label\">\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </span>\n <strong className=\"altertable-funnel-series-value\">\n {formatPercent(\n rows.at(-1)?.readings.get(item.id)?.conversion ?? null\n )}\n </strong>\n </button>\n ) : (\n <span className=\"altertable-funnel-series-label\">\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </span>\n )}\n {(!interactiveLegend || populations.length <= 1) && (\n <strong className=\"altertable-funnel-series-value\">\n {formatPercent(\n rows.at(-1)?.readings.get(item.id)?.conversion ?? null\n )}\n </strong>\n )}\n </ChartLegend.Item>\n ))}\n </ChartLegend>\n <p className=\"altertable-funnel-path\">\n {steps[0]!.label} → {steps.at(-1)!.label}\n </p>\n </div>\n <div className=\"altertable-funnel-scroll\">\n <div\n style={{\n minWidth: steps.length * Math.max(96, series.length * 40),\n }}\n >\n <ComposedChart\n data={rows}\n ariaLabel={`${ariaLabel} plot`}\n horizontalGrid={horizontalGrid}\n height={300}\n barCategoryGap=\"4%\"\n barGap={1}\n onMouseLeave={clearHighlight}\n >\n {horizontalGrid && <ComposedChart.CartesianGrid />}\n <ComposedChart.XAxis dataKey=\"label\" interval={0} height={48} />\n <ComposedChart.YAxis\n domain={[0, 100]}\n width={42}\n tickFormatter={value => formatPercent(value / 100)}\n />\n <defs>\n {populations.map(item => (\n <pattern\n key={item.id}\n id={item.hatchId}\n patternUnits=\"userSpaceOnUse\"\n width=\"6\"\n height=\"6\"\n patternTransform=\"rotate(45)\"\n >\n <rect\n width=\"8\"\n height=\"8\"\n fill={item.color}\n fillOpacity={0.16}\n />\n <line\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"8\"\n stroke={item.color}\n strokeOpacity={0.4}\n strokeWidth=\"2\"\n />\n </pattern>\n ))}\n </defs>\n {populations.map(item => (\n <Fragment key={item.id}>\n <ComposedChart.Bar\n dataKey={(row: FunnelRow) =>\n row.readings.get(item.id)?.conversionPercent ?? 0\n }\n name={item.label}\n stackId={item.id}\n fill={item.color}\n radius={0}\n maxBarSize={undefined}\n activeBar={false}\n minPointSize={0}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n opacity={\n interactiveLegend\n ? legendFocus.opacity(item.id) *\n (!highlighted || highlighted.id === item.id\n ? 1\n : 0.2)\n : !highlighted || highlighted.id === item.id\n ? 1\n : 0.2\n }\n onMouseEnter={bar =>\n highlight(item.id, true, bar.payload.index)\n }\n onMouseLeave={scheduleClear}\n onClick={bar =>\n highlight(item.id, true, bar.payload.index)\n }\n />\n <ComposedChart.Bar\n dataKey={(row: FunnelRow) =>\n row.readings.get(item.id)?.dropOffPercent ?? 0\n }\n name={`${item.label} drop-off`}\n stackId={item.id}\n fill={`url(#${item.hatchId})`}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n opacity={\n interactiveLegend\n ? legendFocus.opacity(item.id) *\n (!highlighted || highlighted.id === item.id\n ? 1\n : 0.2)\n : !highlighted || highlighted.id === item.id\n ? 1\n : 0.2\n }\n onMouseEnter={bar =>\n highlight(item.id, false, bar.payload.index)\n }\n onMouseLeave={scheduleClear}\n onClick={bar =>\n highlight(item.id, false, bar.payload.index)\n }\n radius={0}\n maxBarSize={undefined}\n activeBar={false}\n />\n </Fragment>\n ))}\n <ComposedChart.Tooltip\n content={({ active, activeIndex }) => {\n const row =\n activeIndex == null\n ? undefined\n : rows[Number(activeIndex)];\n if (!active || !row) return null;\n const tooltipItems = [...row.readings.values()]\n .filter(\n value =>\n (!interactiveLegend ||\n legendFocus.visible(value.population.id)) &&\n (!highlighted ||\n highlighted.step !== row.index ||\n value.population.id === highlighted.id)\n )\n .flatMap(value => {\n const item = value.population;\n const selected = highlighted?.step === row.index;\n const readings = selected\n ? [highlighted.conversion]\n : [true, false];\n return readings.map(conversion => {\n const key = [\n item.id,\n conversion ? 'conversion' : 'drop-off',\n ].join(KEY_SEPARATOR);\n return {\n name: item.label,\n graphicalItemId: key,\n dataKey: key,\n color: item.color,\n value:\n (conversion ? value.conversion : value.dropOff) ??\n 0,\n formatter: () => (\n <>\n {formatPercent(\n conversion ? value.conversion : value.dropOff\n )}{' '}\n {conversion ? 'conversion' : 'drop-off'}\n <span className=\"altertable-funnel-tooltip-detail\">\n {formatValue(\n conversion ? value.current : value.dropped\n )}{' '}\n of {formatValue(value.previous)} {unit}\n </span>\n </>\n ),\n };\n });\n });\n return (\n <ChartTooltipContent\n active\n label={row.label}\n payload={tooltipItems}\n />\n );\n }}\n />\n </ComposedChart>\n </div>\n </div>\n <ul className=\"altertable-sr-only\">\n {rows.map(row => (\n <li key={row.id}>\n {row.label}\n {[...row.readings.values()].map(value => (\n <span key={value.population.id}>\n {' '}\n · {value.population.label}: {formatValue(value.current)}{' '}\n {unit}, {formatPercent(value.conversion)} conversion,{' '}\n {formatValue(value.dropped)} dropped off\n </span>\n ))}\n </li>\n ))}\n </ul>\n </>\n )}\n </section>\n );\n}\n","import { formatNumber, formatPercent } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport { Fragment } from 'react';\n\nimport {\n type CountChartProps,\n type HorizontalGridProps,\n} from './chart-data.ts';\nimport { useChartLegendFocus } from './chart-legend-interaction.tsx';\nimport { ChartLegend } from './ChartLegend.tsx';\nimport { classNames } from './classNames.ts';\nimport { ComposedChart } from './ComposedChart.tsx';\nimport { TooltipSurface } from './TooltipSurface.tsx';\n\nexport type RetentionChartPoint = {\n /** Nonnegative integer, unique per series; uneven offsets retain their distance. */\n offset: number;\n /** Must agree across series for the same offset. */\n label: string;\n /** Observed retention fraction in [0, 1], or null for an unobserved period. */\n rate: number | null;\n /** Finite count in [0, cohortSize]; null exactly when rate is null. */\n retainedCount: number | null;\n /** Observed but still accumulating; drawn as a dotted tail. */\n incomplete?: boolean;\n};\nexport type RetentionChartSeries = {\n /** Unique, nonblank cohort or segment ID. */\n id: string;\n label: string;\n /** Finite, nonnegative starting population. */\n cohortSize: number;\n points: readonly RetentionChartPoint[];\n};\nexport type RetentionChartProps = CountChartProps &\n HorizontalGridProps & {\n series: readonly RetentionChartSeries[];\n /** Disable legend hover and focus controls. */\n interactiveLegend?: boolean;\n };\n\ntype RetentionReading = {\n point: RetentionChartPoint;\n completePercent: number | null;\n incompletePercent: number | null;\n description: string;\n};\ntype RetentionRow = {\n offset: number;\n label: string;\n readings: Map<string, RetentionReading>;\n};\n\nfunction createRetentionModel(\n series: readonly RetentionChartSeries[],\n unit: string,\n formatValue: (value: number) => string\n) {\n const ids = new Set<string>();\n const rowsByOffset = new Map<number, RetentionRow>();\n const cohorts = series.map((item, index) => {\n invariant(\n item.id.trim().length > 0 && !ids.has(item.id),\n 'retention series chart IDs must be nonblank and unique.'\n );\n ids.add(item.id);\n invariant(\n Number.isFinite(item.cohortSize) && item.cohortSize >= 0,\n 'retention chart counts must be finite and nonnegative.'\n );\n const seen = new Set<number>();\n let previous: RetentionReading | undefined;\n const readings = [...item.points]\n .sort((a, b) => a.offset - b.offset)\n .map(point => {\n invariant(\n Number.isSafeInteger(point.offset) &&\n point.offset >= 0 &&\n !seen.has(point.offset),\n 'retention chart offsets must be unique nonnegative integers within each series.'\n );\n seen.add(point.offset);\n invariant(\n point.rate === null ||\n (Number.isFinite(point.rate) && point.rate >= 0 && point.rate <= 1),\n 'retention chart rates must be finite fractions between 0 and 1, or null.'\n );\n invariant(\n (point.rate === null) === (point.retainedCount === null),\n 'retention chart unobserved rates and counts must both be null.'\n );\n if (point.retainedCount !== null) {\n invariant(\n Number.isFinite(point.retainedCount) && point.retainedCount >= 0,\n 'retention chart counts must be finite and nonnegative.'\n );\n invariant(\n point.retainedCount <= item.cohortSize,\n 'retention chart retained counts cannot exceed cohort size.'\n );\n }\n let row = rowsByOffset.get(point.offset);\n invariant(\n !row || row.label === point.label,\n 'retention chart labels must agree for the same offset.'\n );\n if (!row) {\n row = {\n offset: point.offset,\n label: point.label,\n readings: new Map(),\n };\n rowsByOffset.set(point.offset, row);\n }\n const percent = point.rate === null ? null : point.rate * 100;\n const reading: RetentionReading = {\n point,\n completePercent: point.incomplete ? null : percent,\n incompletePercent: point.incomplete ? percent : null,\n description:\n point.rate === null || point.retainedCount === null\n ? 'Not observed'\n : `${formatPercent(point.rate)} · ${formatValue(point.retainedCount)} / ${formatValue(item.cohortSize)} ${unit}${point.incomplete ? ' · Incomplete period' : ''}`,\n };\n // The dotted tail starts at the preceding supplied observation.\n if (point.incomplete && previous) {\n previous.incompletePercent =\n previous.completePercent ?? previous.incompletePercent;\n }\n row.readings.set(item.id, reading);\n previous = reading;\n return reading;\n });\n return {\n id: item.id,\n label: item.label,\n color: `var(--atbl-chart-${(index % 8) + 1})`,\n readings,\n };\n });\n const rows = [...rowsByOffset.values()].sort((a, b) => a.offset - b.offset);\n return { rows, rowsByOffset, cohorts };\n}\n\n/** Query-defined retention curves with count inspection and dotted incomplete periods.\n * Rates are not recomputed from counts. Compose inside VisualizationWidget. */\nexport function RetentionChart({\n series,\n unit,\n ariaLabel,\n className,\n formatValue = formatNumber,\n horizontalGrid = true,\n interactiveLegend = true,\n}: RetentionChartProps) {\n const legendFocus = useChartLegendFocus(series.map(item => item.id));\n const { rows, rowsByOffset, cohorts } = createRetentionModel(\n series,\n unit,\n formatValue\n );\n return (\n <section\n className={classNames('altertable-retention-chart', className)}\n aria-label={ariaLabel}\n >\n {rows.length === 0 ? (\n <span>No data</span>\n ) : (\n <>\n <ComposedChart\n data={rows}\n ariaLabel={`${ariaLabel} plot`}\n horizontalGrid={horizontalGrid}\n >\n {horizontalGrid && <ComposedChart.CartesianGrid />}\n <ComposedChart.XAxis\n dataKey=\"offset\"\n type=\"number\"\n domain={[0, Math.max(1, rows.at(-1)?.offset ?? 0)]}\n ticks={rows.map(row => row.offset)}\n tickFormatter={value =>\n rowsByOffset.get(Number(value))?.label ?? ''\n }\n />\n <ComposedChart.YAxis\n domain={[0, 100]}\n width={42}\n tickFormatter={value => `${value}%`}\n />\n {cohorts.map(item => (\n <Fragment key={item.id}>\n <ComposedChart.Line\n dataKey={(row: RetentionRow) =>\n row.readings.get(item.id)?.completePercent ?? null\n }\n name={item.label}\n stroke={item.color}\n opacity={interactiveLegend ? legendFocus.opacity(item.id) : 1}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n connectNulls={false}\n />\n <ComposedChart.Line\n dataKey={(row: RetentionRow) =>\n row.readings.get(item.id)?.incompletePercent ?? null\n }\n name={item.label}\n stroke={item.color}\n opacity={interactiveLegend ? legendFocus.opacity(item.id) : 1}\n style={{\n pointerEvents:\n interactiveLegend && !legendFocus.visible(item.id)\n ? 'none'\n : undefined,\n }}\n strokeDasharray=\"3 3\"\n dot={false}\n activeDot={false}\n connectNulls={false}\n />\n </Fragment>\n ))}\n <ComposedChart.Tooltip\n filterNull={false}\n content={({ active, label }) => {\n const row =\n typeof label === 'number'\n ? rowsByOffset.get(label)\n : undefined;\n if (!active || !row) return null;\n return (\n <TooltipSurface data-variant=\"chart\" role=\"tooltip\">\n <strong>{row.label}</strong>\n {cohorts.map(item => {\n const reading = row.readings.get(item.id);\n if (\n !reading ||\n (interactiveLegend && !legendFocus.visible(item.id))\n )\n return null;\n return (\n <span key={item.id}>\n {item.label}: {reading.description}\n </span>\n );\n })}\n </TooltipSurface>\n );\n }}\n />\n </ComposedChart>\n <ChartLegend aria-label={`${ariaLabel} cohorts`}>\n {cohorts.map(item => (\n <ChartLegend.Item\n key={item.id}\n data-legend-muted={\n (interactiveLegend &&\n legendFocus.hoveredId &&\n (!legendFocus.focusedIds ||\n legendFocus.focusedIds.has(legendFocus.hoveredId)) &&\n legendFocus.hoveredId !== item.id) ||\n undefined\n }\n data-legend-excluded={\n (interactiveLegend && !legendFocus.visible(item.id)) ||\n undefined\n }\n >\n {interactiveLegend && cohorts.length > 1 ? (\n <button\n type=\"button\"\n data-atbl-control=\"action\"\n data-atbl-focus=\"ring\"\n className=\"altertable-chart-legend-action\"\n aria-pressed={!!legendFocus.focusedIds?.has(item.id)}\n onPointerEnter={() => legendFocus.setHoveredId(item.id)}\n onPointerLeave={() => legendFocus.setHoveredId(null)}\n onFocus={() => legendFocus.setHoveredId(item.id)}\n onBlur={() => legendFocus.setHoveredId(null)}\n onClick={() => legendFocus.toggle(item.id)}\n >\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </button>\n ) : (\n <>\n <ChartLegend.Marker kind=\"square\" color={item.color} />\n <ChartLegend.Label>{item.label}</ChartLegend.Label>\n </>\n )}\n </ChartLegend.Item>\n ))}\n </ChartLegend>\n <ul\n className=\"altertable-sr-only\"\n aria-label={`${ariaLabel} readings`}\n >\n {cohorts.map(item => (\n <li key={item.id}>\n {item.label}\n {item.readings.map(reading => (\n <span key={reading.point.offset}>\n {' '}\n · {reading.point.label}: {reading.description}\n </span>\n ))}\n </li>\n ))}\n </ul>\n </>\n )}\n </section>\n );\n}\n","/** Aggregated route; repeated events remain distinct by depth and prefix. */\nexport type JourneyChartPath = {\n /** Unique, nonblank path ID. */\n id: string;\n /** At least one nonblank event; null property means no property grouping. */\n steps: readonly { event: string; property: string | null }[];\n /** Finite, nonnegative population following this route. */\n count: number;\n /** True: converted; false: dropped off; null: no conversion classification. */\n converted: boolean | null;\n /** Stops at the last loaded event, without adding an outcome or expand control. */\n truncated: boolean;\n};\n\nexport type JourneyNode = {\n key: string;\n label: string;\n depth: number;\n outcome: 'event' | 'converted' | 'drop-off' | 'truncated' | 'end' | 'other';\n count: number;\n pathKeys: string[];\n branchKeys?: string[];\n expandable?: boolean;\n expanded?: boolean;\n hiddenBranchCount?: number;\n};\n\nconst journeyOutcomeLabels = {\n truncated: 'More steps',\n 'drop-off': 'Drop-off',\n converted: 'Converted',\n end: 'End of path',\n} as const;\n\nfunction journeyNodes(\n path: JourneyChartPath\n): Omit<JourneyNode, 'count' | 'pathKeys'>[] {\n const nodes: Omit<JourneyNode, 'count' | 'pathKeys'>[] = path.steps.map(\n (step, depth) => ({\n key: JSON.stringify([depth, 'event', step.event, step.property]),\n label:\n step.property === null\n ? step.event\n : `${step.event} · ${step.property}`,\n depth,\n outcome: 'event',\n })\n );\n const outcome = path.truncated\n ? 'truncated'\n : path.converted === false\n ? 'drop-off'\n : path.converted === true\n ? 'converted'\n : 'end';\n nodes.push({\n key: JSON.stringify([nodes.length, outcome]),\n label: journeyOutcomeLabels[outcome],\n depth: nodes.length,\n outcome,\n });\n return nodes;\n}\n\nexport function buildJourneyFlow(\n paths: readonly JourneyChartPath[],\n expandedBranch?: string[]\n) {\n const nodes = new Map<string, JourneyNode>();\n const links = new Map<\n string,\n {\n key: string;\n source: string;\n target: string;\n count: number;\n pathKeys: string[];\n }\n >();\n for (const path of paths) {\n const fullSequence = journeyNodes(path);\n if (path.truncated) fullSequence.pop();\n const sequence =\n expandedBranch === undefined\n ? fullSequence\n : fullSequence.flatMap((node, index) => {\n const branchKeys = fullSequence\n .slice(0, index + 1)\n .map(step => step.key);\n const parentExpanded =\n index <= 1 ||\n branchKeys\n .slice(0, index)\n .every((key, depth) => expandedBranch[depth] === key);\n if (!parentExpanded) return [];\n return [\n {\n ...node,\n key: JSON.stringify(branchKeys),\n branchKeys,\n expandable: index >= 1 && index < fullSequence.length - 1,\n expanded: branchKeys.every(\n (key, depth) => expandedBranch[depth] === key\n ),\n },\n ];\n });\n sequence.forEach((node, index) => {\n const current = nodes.get(node.key) ?? {\n ...node,\n count: 0,\n pathKeys: [],\n };\n current.count += path.count;\n if ('expandable' in node && node.expandable) current.expandable = true;\n current.pathKeys.push(path.id);\n nodes.set(node.key, current);\n const previous = sequence[index - 1];\n if (!previous) return;\n const key = JSON.stringify([previous.key, node.key]);\n const link = links.get(key) ?? {\n key,\n source: previous.key,\n target: node.key,\n count: 0,\n pathKeys: [],\n };\n link.count += path.count;\n link.pathKeys.push(path.id);\n links.set(key, link);\n });\n }\n return { nodes: [...nodes.values()], links: [...links.values()] };\n}\n\nexport function limitJourneyFlow(\n graph: ReturnType<typeof buildJourneyFlow>,\n visibleEventsByDepth: Record<number, number> = {}\n) {\n const nodes: JourneyNode[] = [];\n const replacements = new Map<string, string>();\n for (const depth of new Set(graph.nodes.map(node => node.depth))) {\n const column = graph.nodes\n .filter(node => node.depth === depth)\n .sort(\n (a, b) =>\n Number(Boolean(b.expanded)) - Number(Boolean(a.expanded)) ||\n b.count - a.count ||\n a.key.localeCompare(b.key)\n );\n const events = column.filter(node => node.outcome === 'event');\n const outcomes = column.filter(node => node.outcome !== 'event');\n const limit = visibleEventsByDepth[depth] ?? 3;\n if (events.length <= limit) {\n nodes.push(...column);\n continue;\n }\n nodes.push(...events.slice(0, limit), ...outcomes);\n const hidden = events.slice(limit);\n const key = JSON.stringify(['other', depth]);\n hidden.forEach(node => replacements.set(node.key, key));\n nodes.push({\n key,\n label: 'More events',\n depth,\n outcome: 'other',\n hiddenBranchCount: hidden.length,\n count: hidden.reduce((sum, node) => sum + node.count, 0),\n pathKeys: [...new Set(hidden.flatMap(node => node.pathKeys))],\n });\n }\n const links = new Map<string, (typeof graph.links)[number]>();\n for (const link of graph.links) {\n const source = replacements.get(link.source) ?? link.source;\n const target = replacements.get(link.target) ?? link.target;\n const key = JSON.stringify([source, target]);\n const existing = links.get(key);\n if (existing) {\n existing.count += link.count;\n existing.pathKeys.push(...link.pathKeys);\n } else {\n links.set(key, {\n ...link,\n key,\n source,\n target,\n pathKeys: [...link.pathKeys],\n });\n }\n }\n return { nodes, links: [...links.values()] };\n}\n","import { formatNumber, formatPercent } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport { type ComponentRef, useLayoutEffect, useRef, useState } from 'react';\n\nimport { Button } from './Button.tsx';\nimport type { CountChartProps } from './chart-data.ts';\nimport { classNames } from './classNames.ts';\nimport {\n buildJourneyFlow,\n limitJourneyFlow,\n type JourneyChartPath,\n type JourneyNode,\n} from './journey-flow.ts';\n\nexport type { JourneyChartPath } from './journey-flow.ts';\nexport type JourneyChartProps = CountChartProps & {\n /** Full paths and their population counts. Branches and outcomes are derived internally. */\n paths: readonly JourneyChartPath[];\n};\n\n/** Path exploration with two initial steps, expandable prefixes, and three events per depth.\n * Counts and flows use the Step 1 population. Compose inside VisualizationWidget. */\nexport function JourneyChart({\n paths,\n unit,\n ariaLabel,\n className,\n formatValue = formatNumber,\n}: JourneyChartProps) {\n const ids = new Set<string>();\n let total = 0;\n for (const path of paths) {\n invariant(\n path.id.trim().length > 0 && !ids.has(path.id),\n 'journey path chart IDs must be nonblank and unique.'\n );\n ids.add(path.id);\n invariant(\n Number.isFinite(path.count) && path.count >= 0,\n 'journey chart counts must be finite and nonnegative.'\n );\n total += path.count;\n invariant(\n path.steps.length > 0 &&\n path.steps.every(step => step.event.trim().length > 0),\n 'journey chart paths require nonblank events.'\n );\n }\n invariant(\n Number.isFinite(total),\n 'journey chart total count must be finite.'\n );\n // A changed displayed result starts a new exploration, including in inspection views.\n return (\n <section\n className={classNames('altertable-journey-chart', className)}\n aria-label={ariaLabel}\n >\n {paths.length === 0 ? (\n <span>No data</span>\n ) : (\n <JourneyFlow\n key={JSON.stringify(paths)}\n paths={paths}\n unit={unit}\n formatValue={formatValue}\n />\n )}\n </section>\n );\n}\n\nfunction JourneyFlow({\n paths,\n unit,\n formatValue,\n}: Pick<JourneyChartProps, 'paths' | 'unit'> & {\n formatValue: (value: number) => string;\n}) {\n const [expandedBranch, setExpandedBranch] = useState<string[]>([]);\n const [visibleEventsByDepth, setVisibleEventsByDepth] = useState<\n Record<number, number>\n >({});\n const graph = limitJourneyFlow(\n buildJourneyFlow(paths, expandedBranch),\n visibleEventsByDepth\n );\n const scrollRef = useRef<ComponentRef<'div'>>(null);\n const pendingDepth = useRef<number | null>(null);\n const depthCount = Math.max(0, ...graph.nodes.map(node => node.depth)) + 1;\n const startingCount = graph.nodes\n .filter(node => node.depth === 0)\n .reduce((sum, node) => sum + node.count, 0);\n function percent(count: number) {\n return formatPercent(startingCount > 0 ? count / startingCount : null);\n }\n const nodeWidth = 176;\n const nodeHeight = 96;\n const barWidth = 16;\n const rowSpacing = nodeHeight + 80;\n const columnSpacing = nodeWidth + 112;\n const width = 34 + nodeWidth + (depthCount - 1) * columnSpacing;\n function columnX(depth: number) {\n return 10 + depth * columnSpacing;\n }\n useLayoutEffect(() => {\n const depth = pendingDepth.current;\n const container = scrollRef.current;\n if (depth === null || !container || depth >= depthCount) return;\n pendingDepth.current = null;\n const left = columnX(depth);\n const right = left + nodeWidth + 24;\n const nextLeft =\n left < container.scrollLeft\n ? left - 24\n : right > container.scrollLeft + container.clientWidth\n ? right - container.clientWidth\n : container.scrollLeft;\n if (nextLeft !== container.scrollLeft)\n container.scrollTo({\n left: Math.max(0, nextLeft),\n behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches\n ? 'instant'\n : 'smooth',\n });\n });\n const columns = Array.from({ length: depthCount }, (_, depth) =>\n graph.nodes\n .filter(node => node.depth === depth)\n .sort((a, b) => {\n function rank(node: JourneyNode) {\n return node.outcome === 'event'\n ? 0\n : node.outcome === 'other'\n ? 1\n : 2;\n }\n return (\n rank(a) - rank(b) || b.count - a.count || a.key.localeCompare(b.key)\n );\n })\n );\n const positions = new Map<\n string,\n { node: JourneyNode; x: number; y: number }\n >();\n columns.forEach((column, depth) => {\n const parent = columns[depth - 1]?.find(node => node.expanded);\n const parentY = parent ? positions.get(parent.key)?.y : undefined;\n const top = Math.max(\n 104,\n (parentY ?? 104) - (column.length > 1 ? rowSpacing : 0)\n );\n column.forEach((node, index) =>\n positions.set(node.key, {\n node,\n x: columnX(depth),\n y: top + index * rowSpacing,\n })\n );\n });\n const height = Math.max(\n 280,\n ...[...positions.values()].map(position => position.y + nodeHeight + 40)\n );\n const outgoingOffsets = new Map<string, number>();\n const incomingOffsets = new Map<string, number>();\n const orderedLinks = [...graph.links].sort(\n (a, b) =>\n (positions.get(a.source)?.y ?? 0) - (positions.get(b.source)?.y ?? 0) ||\n (positions.get(a.target)?.y ?? 0) - (positions.get(b.target)?.y ?? 0)\n );\n const links = orderedLinks.flatMap(link => {\n const source = positions.get(link.source);\n const target = positions.get(link.target);\n if (!source || !target || link.count <= 0 || startingCount <= 0) return [];\n const x0 = source.x + barWidth;\n const x1 = target.x;\n const mid = (x0 + x1) / 2;\n const sourceTop = source.y + (outgoingOffsets.get(link.source) ?? 0);\n const targetTop = target.y + (incomingOffsets.get(link.target) ?? 0);\n const thickness = (link.count / startingCount) * nodeHeight;\n outgoingOffsets.set(\n link.source,\n (outgoingOffsets.get(link.source) ?? 0) + thickness\n );\n incomingOffsets.set(\n link.target,\n (incomingOffsets.get(link.target) ?? 0) + thickness\n );\n return [\n {\n muted: target.node.outcome === 'end' || target.node.outcome === 'other',\n d: `M${x0},${sourceTop} C${mid},${sourceTop} ${mid},${targetTop} ${x1},${targetTop} L${x1},${targetTop + thickness} C${mid},${targetTop + thickness} ${mid},${sourceTop + thickness} ${x0},${sourceTop + thickness} Z`,\n },\n ];\n });\n return (\n <div ref={scrollRef} className=\"altertable-journey-scroll\">\n <div\n className=\"altertable-journey-plot\"\n style={{ minWidth: width, minHeight: height }}\n >\n <svg width=\"100%\" height=\"100%\" aria-hidden=\"true\" focusable=\"false\">\n <path\n d={links\n .filter(link => !link.muted)\n .map(link => link.d)\n .join(' ')}\n fill=\"color-mix(in srgb, var(--atbl-chart-5) 22%, var(--atbl-surface))\"\n />\n <path\n d={links\n .filter(link => link.muted)\n .map(link => link.d)\n .join(' ')}\n fill=\"color-mix(in srgb, var(--atbl-muted) 22%, var(--atbl-surface))\"\n />\n </svg>\n {columns.map((column, depth) => (\n <span\n key={depth}\n className=\"altertable-journey-stage\"\n style={{ left: columnX(depth) }}\n >\n {column.length > 0 &&\n column.every(\n node => node.outcome !== 'event' && node.outcome !== 'other'\n )\n ? 'Outcome'\n : `Step ${depth + 1}`}\n </span>\n ))}\n {[...positions.values()].map(({ node, x, y }) => (\n <div\n key={node.key}\n className=\"altertable-journey-node\"\n style={{\n left: x,\n top: y,\n width: nodeWidth,\n height:\n startingCount > 0\n ? (node.count / startingCount) * nodeHeight\n : 0,\n }}\n >\n <div\n className=\"altertable-journey-bar\"\n data-event={node.outcome === 'event' || undefined}\n aria-hidden=\"true\"\n style={{ width: barWidth }}\n />\n <section\n aria-label={`${node.label}, step ${node.depth + 1}, ${formatValue(node.count)} ${unit}`}\n className=\"altertable-journey-label\"\n >\n <span className=\"altertable-journey-name\" title={node.label}>\n {node.label}\n </span>\n <span>\n {formatValue(node.count)} {unit} · {percent(node.count)}\n </span>\n {node.hiddenBranchCount ? (\n <span>\n {node.hiddenBranchCount} hidden{' '}\n {node.hiddenBranchCount === 1 ? 'event' : 'events'}\n </span>\n ) : null}\n </section>\n {node.expandable && (\n <Button\n variant=\"outline\"\n size=\"icon-compact\"\n className=\"altertable-journey-expand\"\n aria-label={`${node.expanded ? 'Less' : 'More'} after ${node.label}, step ${node.depth + 1}`}\n aria-expanded={Boolean(node.expanded)}\n onClick={() => {\n pendingDepth.current = node.expanded ? null : node.depth + 1;\n setVisibleEventsByDepth(limits =>\n Object.fromEntries(\n Object.entries(limits).filter(\n ([depth]) => Number(depth) <= node.depth\n )\n )\n );\n setExpandedBranch(\n node.expanded\n ? (node.branchKeys ?? []).slice(0, -1)\n : (node.branchKeys ?? [])\n );\n }}\n >\n {node.expanded ? '−' : '›'}\n </Button>\n )}\n {node.outcome === 'other' && (\n <Button\n size=\"compact\"\n variant=\"ghost\"\n className=\"altertable-journey-more\"\n aria-label={`Show more events at step ${node.depth + 1}`}\n onClick={() =>\n setVisibleEventsByDepth(limits => ({\n ...limits,\n [node.depth]: (limits[node.depth] ?? 3) + 3,\n }))\n }\n >\n Show more events\n </Button>\n )}\n </div>\n ))}\n </div>\n </div>\n );\n}\n","/** Direct UI composition and static screens. Requests use declared views from /react. */\nimport { withWidgetBoundary } from './DataWidget.tsx';\nimport { MetricWidget as MetricWidgetContent } from './MetricWidget.tsx';\nimport { TableWidget as TableWidgetContent } from './TableWidget.tsx';\nimport { TextWidget as TextWidgetContent } from './TextWidget.tsx';\nimport { VisualizationWidget as VisualizationWidgetContent } from './VisualizationWidget.tsx';\n\nexport { DataAppProvider } from '../mount.tsx';\nexport { isPlainKeyEvent } from './keyboard.ts';\nexport { GettingStarted } from './GettingStarted.tsx';\nexport { DataWidget } from './DataWidget.tsx';\nexport type { WidgetStatus } from './RequestHint.tsx';\nexport type { DataWidgetProps } from './DataWidget.tsx';\nexport const TextWidget = withWidgetBoundary(TextWidgetContent);\nexport type { TextWidgetProps } from './TextWidget.tsx';\n/** Compose an unframed visual with the shared heading and inspection. */\nexport const VisualizationWidget = withWidgetBoundary(\n VisualizationWidgetContent\n);\nexport type { VisualizationWidgetProps } from './VisualizationWidget.tsx';\nexport const TableWidget = withWidgetBoundary(TableWidgetContent);\nexport type { TableWidgetProps } from './TableWidget.tsx';\nexport {\n DataTable,\n DataTableEmptyRow,\n DataTableTimestamp,\n DataTableShare,\n} from './DataTable.tsx';\nexport type {\n DataTableProps,\n DataTableSearch,\n DataTableEmptyRowProps,\n DataTableTimestampProps,\n} from './DataTable.tsx';\nexport const MetricWidget = withWidgetBoundary(MetricWidgetContent);\nexport type { MetricWidgetProps } from './MetricWidget.tsx';\nexport { DimensionPicker } from './DimensionPicker.tsx';\nexport { LiveControl } from './LiveControl.tsx';\nexport type { LiveControlProps, LiveIntervalSeconds } from './LiveControl.tsx';\nexport { useAppFilters } from './app-filters.ts';\nexport { SearchField } from './SearchField.tsx';\nexport type { SearchFieldProps } from './SearchField.tsx';\nexport { searchItems, matchSearchText } from './searchItems.ts';\nexport type {\n SearchAttribute,\n SearchHit,\n SearchItemsOptions,\n SearchMatchValue,\n SearchRange,\n} from './searchItems.ts';\nexport { SearchMatch } from './SearchMatch.tsx';\nexport type { SearchMatchProps } from './SearchMatch.tsx';\nexport { ShimmerText } from './ShimmerText.tsx';\nexport type { ShimmerTextProps } from './ShimmerText.tsx';\nexport { ChoicePicker } from './ChoicePicker.tsx';\nexport type { ChoiceOption, ChoicePickerProps } from './ChoicePicker.tsx';\nexport {\n MenuTrigger,\n MenuButton,\n MenuPopover,\n Menu,\n MenuItem,\n MenuSection,\n MenuSeparator,\n} from './Menu.tsx';\nexport type {\n MenuTriggerProps,\n MenuPopoverProps,\n MenuProps,\n MenuItemProps,\n} from './Menu.tsx';\nexport { GradientScroll } from './GradientScroll.tsx';\nexport type { GradientScrollProps } from './GradientScroll.tsx';\nexport {\n Tabs,\n TabList,\n Tab,\n TabPanels,\n TabPanel,\n useViewTab,\n} from './Tabs.tsx';\nexport { GlossaryExplanation } from './GlossaryExplanation.tsx';\nexport type { GlossaryExplanationProps } from './GlossaryExplanation.tsx';\nexport { GlossaryDefinition } from './GlossaryDefinition.tsx';\nexport type { GlossaryDefinitionProps } from './GlossaryDefinition.tsx';\nexport { AboutData } from './AboutData.tsx';\nexport type {\n AboutDataProps,\n AboutEmpty,\n AboutSubject,\n AboutTab,\n} from './AboutData.tsx';\nexport { PresentStory } from './PresentStory.tsx';\nexport type { PresentStoryProps } from './PresentStory.tsx';\nexport type { StoryFinding, BoundStory } from './story.ts';\nexport { Checkbox } from './Checkbox.tsx';\nexport type { CheckboxProps } from './Checkbox.tsx';\nexport { AppIcon } from './icons.ts';\nexport type { AppIconName, AppIconProps } from './icons.ts';\nexport { Sheet } from './Sheet.tsx';\nexport type { SheetProps } from './Sheet.tsx';\nexport { HelpPopover } from './HelpPopover.tsx';\nexport type { HelpPopoverProps } from './HelpPopover.tsx';\nexport { DataApp } from './StaticDataApp.tsx';\nexport type { DataAppProps } from './StaticDataApp.tsx';\nexport { injectDataAppStyles } from '../styles.ts';\nexport { Tooltip, TooltipProvider } from './Tooltip.tsx';\nexport type { TooltipProps, TooltipProviderProps } from './Tooltip.tsx';\n\nexport { LineChart } from './LineChart.tsx';\nexport type { LineChartProps, LineChartItem } from './LineChart.tsx';\nexport { AreaChart } from './AreaChart.tsx';\nexport type { AreaChartProps, AreaChartItem } from './AreaChart.tsx';\nexport { PieChart } from './PieChart.tsx';\nexport type { PieChartProps, PieChartItem } from './PieChart.tsx';\nexport { ScatterChart } from './ScatterChart.tsx';\nexport type { ScatterChartProps, ScatterChartItem } from './ScatterChart.tsx';\nexport { BarChart } from './BarChart.tsx';\nexport { useChartCursorGroup } from './use-chart-cursor-group.tsx';\nexport type { ChartCursorGroup } from './use-chart-cursor-group.tsx';\nexport type { BarChartProps, BarChartItem } from './BarChart.tsx';\n\nexport { DataValue } from './DataValue.tsx';\nexport type { DataValueProps } from './DataValue.tsx';\nexport type { CsvExport, CsvTable } from './csv-export.ts';\nexport type { TableWidgetColumn } from './TableWidget.tsx';\n\nexport type { DataReading, MetricReading } from '@altertable/data-app/internal';\n\nexport type {\n DataAppStyle,\n DataAppStyleToken,\n DataAppStyleHooks,\n} from '../style-contract.ts';\n\nexport { Select } from './Select.tsx';\nexport type { SelectProps } from './Select.tsx';\nexport { RadioGroup, Radio, SegmentedControl } from './RadioGroup.tsx';\nexport type {\n RadioGroupProps,\n RadioProps,\n SegmentedControlProps,\n} from './RadioGroup.tsx';\nexport { CheckboxGroup } from './CheckboxGroup.tsx';\nexport type { CheckboxGroupProps } from './CheckboxGroup.tsx';\nexport { NumberField, NumberRangeField } from './NumberField.tsx';\nexport type {\n NumberFieldProps,\n NumberRangeFieldProps,\n NumberRange,\n} from './NumberField.tsx';\nexport { FilterBar } from './FilterBar.tsx';\nexport type { FilterBarProps } from './FilterBar.tsx';\nexport { ControlBar } from './ControlBar.tsx';\nexport type { ControlBarProps } from './ControlBar.tsx';\nexport { FilterActions } from './FilterActions.tsx';\nexport type { FilterActionsProps } from './FilterActions.tsx';\n\nexport { NumberFilterPicker } from './NumberFilterPicker.tsx';\nexport type { NumberFilterPickerProps } from './NumberFilterPicker.tsx';\n\nexport { ComposedChart } from './ComposedChart.tsx';\nexport type { ComposedChartProps } from './ComposedChart.tsx';\n\nexport { ChartLegend } from './ChartLegend.tsx';\nexport type {\n ChartLegendProps,\n ChartLegendItemProps,\n ChartLegendMarkerProps,\n ChartLegendLabelProps,\n ChartLegendMarkerKind,\n} from './ChartLegend.tsx';\nexport type { ComposedChartLegendProps } from './ComposedChartLegend.tsx';\n\nexport { FunnelChart } from './FunnelChart.tsx';\nexport type {\n FunnelChartProps,\n FunnelChartStep,\n FunnelChartSeries,\n} from './FunnelChart.tsx';\nexport { RetentionChart } from './RetentionChart.tsx';\nexport type {\n RetentionChartProps,\n RetentionChartPoint,\n RetentionChartSeries,\n} from './RetentionChart.tsx';\nexport { JourneyChart } from './JourneyChart.tsx';\nexport type { JourneyChartProps, JourneyChartPath } from './JourneyChart.tsx';\n\nexport { useSvgId } from './useSvgId.ts';\n\nexport { SearchTypeahead } from './SearchTypeahead.tsx';\nexport type {\n SearchTypeaheadProps,\n SearchSuggestion,\n} from './SearchTypeahead.tsx';\n\nexport { SectionHeading } from './SectionHeading.tsx';\nexport type { SectionHeadingProps } from './SectionHeading.tsx';\nexport { DateDisplay } from './DateDisplay.tsx';\nexport type { DateDisplayProps } from './DateDisplay.tsx';\nexport { useDateFormatting } from '../date-formatting.ts';\n\nexport { ExplorationActionControl } from './ExplorationActionControl.tsx';\nexport type {\n ExplorationActionControlProps,\n ExplorationAction,\n ItemActions,\n} from './ExplorationActionControl.tsx';\n\nexport {\n dateTimeRangeFilter,\n dateTimeRangePresets,\n type DateTimeRangePreset,\n type DateTimeRangeFilter,\n type DateTimeRangeFilterOptions,\n type DateTimeRangeComparison,\n type DateTimeRangeSelection,\n} from './app-filters.ts';\n\nexport {\n DateTimeRangePicker,\n type DateTimeRangePickerProps,\n} from './DateTimeRangePicker.tsx';\n\nexport { Notice } from './Notice.tsx';\nexport type { NoticeProps } from './Notice.tsx';\n"],"mappings":";;;;;;;;;AAKA,SAAgB,QAAQ,EAAE,WAAW,GAAG,SAAuB;CAC7D,OACE,oBAAC,cAAD;EACE,GAAI;EACJ,WAAW,aAAa;GAAE,SAAS;GAAO,OAAO;EAAU;CAC5D,CAAA;AAEL;;;ACAA,MAAM,oBAAoBA,kBAAgB,CAAC,CAAC,CAAC,CAAC;CAC5C,aAAa;CACb,UAAU,CAAC;AACb,CAAC;;;AAID,SAAgB,eAAe,EAC7B,aACA,UAIC;CACD,MAAM,iBAAiB,cAEnB,gBAAgB,MAAM,CAAC,CAAC,WAAW;EACjC,aAAa;EACb,WAAW;EACX,qBAAqB;CACvB,CAAC,GACH,CAAC,MAAM,CACT;CACA,MAAM,aAAa,kBAAkB,cAAc;CACnD,MAAM,QAC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