@mechane-ai/elements 0.41.0 → 0.43.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.
Files changed (92) hide show
  1. package/README.md +72 -41
  2. package/bin/catalog.d.mts +17 -0
  3. package/bin/mechane-elements-catalog.mjs +60 -0
  4. package/dist/agent.js +1 -1
  5. package/dist/ai.js +23 -23
  6. package/dist/catalog.json +1984 -0
  7. package/dist/{categorical-values-DnGR_pQx.js → categorical-values-DzhbfZ5w.js} +3 -3
  8. package/dist/{chart-frame-BsyI1Zc8.js → chart-frame-9dQQNF3F.js} +74 -22
  9. package/dist/{chart-input-r4S3-QCT.js → chart-input-DT0STflx.js} +2 -2
  10. package/dist/{chart-navigation-D7OkLdSx.js → chart-navigation-BAbb5PV9.js} +67 -32
  11. package/dist/charts/cartesian.js +1728 -559
  12. package/dist/charts/distribution.js +5 -5
  13. package/dist/charts/graph.js +443 -76
  14. package/dist/charts/hierarchy.js +5 -5
  15. package/dist/charts/matrix.js +232 -63
  16. package/dist/charts/timeline.js +3 -3
  17. package/dist/charts.js +2 -2
  18. package/dist/{code-block-C4K1sM9O.js → code-block-Cpfr7B6a.js} +1 -1
  19. package/dist/collections.js +475 -354
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +3 -3
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +2 -2
  25. package/dist/{content-link-CBDqSvgP.js → content-link-CGeFFb9F.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/feedback.js +1 -1
  28. package/dist/forms/dates.js +11 -11
  29. package/dist/{forms-I-WMHTkr.js → forms-DeU0Tiv3.js} +6 -2
  30. package/dist/forms.js +3 -3
  31. package/dist/index.js +1 -1
  32. package/dist/label-spacing-BncjePGb.js +6 -0
  33. package/dist/layout.js +275 -249
  34. package/dist/mechane-elements-catalog.mjs +4 -0
  35. package/dist/navigation.js +2 -2
  36. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +15 -3
  37. package/dist/packages/charts/src/cartesian/bar-data.d.ts +43 -0
  38. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +32 -0
  39. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +29 -0
  40. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +40 -0
  41. package/dist/packages/charts/src/cartesian/index.d.ts +7 -2
  42. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +34 -0
  43. package/dist/packages/charts/src/cartesian/sparkline.d.ts +10 -1
  44. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +66 -0
  45. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +11 -1
  46. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +35 -0
  47. package/dist/packages/charts/src/cartesian/time-series.d.ts +6 -1
  48. package/dist/packages/charts/src/chart-inspection.d.ts +4 -1
  49. package/dist/packages/charts/src/chart-navigation.d.ts +5 -1
  50. package/dist/packages/charts/src/chart-series-marker.d.ts +8 -1
  51. package/dist/packages/charts/src/chart-surface.d.ts +4 -0
  52. package/dist/packages/charts/src/chart-theme.d.ts +26 -0
  53. package/dist/packages/charts/src/graph/flow-diagram.d.ts +26 -0
  54. package/dist/packages/charts/src/graph/flow-layout.d.ts +70 -0
  55. package/dist/packages/charts/src/graph/index.d.ts +2 -0
  56. package/dist/packages/charts/src/index.d.ts +1 -1
  57. package/dist/packages/charts/src/label-spacing.d.ts +15 -0
  58. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +4 -0
  59. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +20 -0
  60. package/dist/packages/charts/src/matrix/matrix-types.d.ts +21 -0
  61. package/dist/packages/charts/src/matrix/matrix.d.ts +8 -19
  62. package/dist/packages/collections/src/collection-controls.d.ts +2 -1
  63. package/dist/packages/collections/src/data-table.d.ts +12 -8
  64. package/dist/packages/collections/src/index.d.ts +1 -0
  65. package/dist/packages/collections/src/table-results.d.ts +26 -0
  66. package/dist/packages/core/src/actions.d.ts +6 -0
  67. package/dist/packages/core/src/index.d.ts +1 -1
  68. package/dist/packages/forms/src/form-status.d.ts +7 -0
  69. package/dist/packages/forms/src/forms.d.ts +3 -1
  70. package/dist/packages/forms/src/index.d.ts +2 -0
  71. package/dist/packages/foundations/src/agent/index.d.ts +2 -2
  72. package/dist/packages/layout/src/page-context.d.ts +4 -0
  73. package/dist/packages/navigation/src/index.d.ts +1 -0
  74. package/dist/packages/navigation/src/route-link.d.ts +2 -0
  75. package/dist/{pierre-diff-DJ3oOfPX.js → pierre-diff-B3tD3-6z.js} +1 -1
  76. package/dist/{plot-width-BQQS-mw9.js → plot-width-DzCmthQW.js} +28 -0
  77. package/dist/{src-D2OHco8V.js → src-Bk7M67zy.js} +3 -3
  78. package/dist/{src-DfOAlAd2.js → src-BpvnBWrF.js} +1 -1
  79. package/dist/{src-CQQvXi7a.js → src-DBNncL7_.js} +70 -50
  80. package/dist/{src-s3tWwnN4.js → src-DcW_gMX8.js} +178 -168
  81. package/dist/{src-CNV1ewzb.js → src-gqEebHEa.js} +319 -285
  82. package/dist/styles2.css +115 -0
  83. package/package.json +9 -2
  84. package/recipes/allocation-report.tsx +115 -0
  85. package/recipes/consequential-form.tsx +132 -0
  86. package/recipes/searchable-collection.tsx +106 -0
  87. package/recipes/sectioned-report.tsx +58 -0
  88. package/recipes/tabbed-workspace.tsx +84 -0
  89. package/skills/extend-elements/SKILL.md +28 -0
  90. package/skills/use-elements/SKILL.md +36 -0
  91. package/skills/{elements-presentation/SKILL.md → use-elements/references/reports.md} +0 -6
  92. package/skills/{elements-workspace/SKILL.md → use-elements/references/workspace.md} +0 -6
@@ -1,31 +1,32 @@
1
- import { c as e, d as t, f as n } from "../src-DfOAlAd2.js";
2
- import { i as r, n as i, r as a, t as o } from "../categorical-values-DnGR_pQx.js";
3
- import { a as s, n as c, r as l, t as u } from "../chart-navigation-D7OkLdSx.js";
4
- import { a as d, i as f, n as p } from "../chart-frame-BsyI1Zc8.js";
5
- import { n as m, r as h, t as g } from "../chart-input-r4S3-QCT.js";
1
+ import { c as e, d as t, f as n } from "../src-BpvnBWrF.js";
2
+ import { i as r, n as i, r as a, t as o } from "../categorical-values-DzhbfZ5w.js";
3
+ import { a as s, n as c, r as l, t as u } from "../chart-navigation-BAbb5PV9.js";
4
+ import { a as d, i as f, n as p } from "../chart-frame-9dQQNF3F.js";
5
+ import { n as m, r as h, t as g } from "../chart-input-DT0STflx.js";
6
6
  import { r as _ } from "../tokens.stylex-dF5CACEJ.js";
7
- import { n as v, t as ee } from "../plot-width-BQQS-mw9.js";
8
- import { D as y } from "../src-s3tWwnN4.js";
9
- import { m as b } from "../src-CNV1ewzb.js";
10
- import * as x from "@stylexjs/stylex";
11
- import { Button as te } from "@ui-sdk/react/button";
12
- import { useEffect as S, useId as C, useMemo as ne, useRef as w, useState as T } from "react";
13
- import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
14
- import { bindDrag as k } from "@ui-sdk/core";
15
- import { scaleBand as A, scaleLinear as j } from "@visx/scale";
16
- import { AreaClosed as re, Bar as M, LinePath as ie } from "@visx/shape";
7
+ import { n as v, t as ee } from "../plot-width-DzCmthQW.js";
8
+ import { t as y } from "../label-spacing-BncjePGb.js";
9
+ import { O as b } from "../src-DcW_gMX8.js";
10
+ import { h as x } from "../src-gqEebHEa.js";
11
+ import * as S from "@stylexjs/stylex";
12
+ import { Button as C } from "@ui-sdk/react/button";
13
+ import { useEffect as te, useId as w, useMemo as T, useRef as ne, useState as E } from "react";
14
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
15
+ import { bindDrag as A } from "@ui-sdk/core";
16
+ import { scaleBand as re, scaleLinear as j } from "@visx/scale";
17
+ import { Area as ie, AreaClosed as M, Bar as N, LinePath as P } from "@visx/shape";
17
18
  // packages/charts/src/chart-cursor.tsx
18
19
  function ae({ x: e, top: t, bottom: n, width: r }) {
19
- return /* @__PURE__ */ O("g", {
20
+ return /* @__PURE__ */ k("g", {
20
21
  "aria-hidden": !0,
21
22
  className: "xlshs6z xgs60n x17y187c xbabvq0 x47corl",
22
- children: [/* @__PURE__ */ D("line", {
23
+ children: [/* @__PURE__ */ O("line", {
23
24
  x1: e,
24
25
  x2: e,
25
26
  y1: t,
26
27
  y2: n,
27
28
  className: "xnpr05h x1ntoi03 x13efnbd"
28
- }), /* @__PURE__ */ D("line", {
29
+ }), /* @__PURE__ */ O("line", {
29
30
  x1: e - r / 2,
30
31
  x2: e + r / 2,
31
32
  y1: n + 4,
@@ -35,14 +36,14 @@ function ae({ x: e, top: t, bottom: n, width: r }) {
35
36
  });
36
37
  }
37
38
  // packages/charts/src/chart-inspection.tsx
38
- var N = {
39
+ var F = {
39
40
  kzqmXN: "x1xc55vz",
40
41
  kZKoxP: "xdk7pt",
41
42
  kmuXW: "x2lah0s",
42
43
  $$css: !0
43
- }, P = {
44
+ }, I = {
44
45
  swatch: (e) => [
45
- N,
46
+ F,
46
47
  {
47
48
  kWkggS: e == null ? e : "xl8spv7",
48
49
  $$css: !0
@@ -84,73 +85,82 @@ var N = {
84
85
  }]
85
86
  }, oe = 4;
86
87
  function se() {
87
- return /* @__PURE__ */ D("ul", {
88
+ return /* @__PURE__ */ O("ul", {
88
89
  "aria-hidden": !0,
89
90
  inert: !0,
90
91
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k",
91
- children: Array.from({ length: oe }, (e, t) => /* @__PURE__ */ O("li", {
92
+ children: Array.from({ length: oe }, (e, t) => /* @__PURE__ */ k("li", {
92
93
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe x1f394nn x43dure",
93
- children: [/* @__PURE__ */ D("span", { ...x.props(P.swatch(_.line)) }), /* @__PURE__ */ O("span", {
94
+ children: [/* @__PURE__ */ O("span", { ...S.props(I.swatch(_.line)) }), /* @__PURE__ */ k("span", {
94
95
  className: "x1cqoux5 xeuugli",
95
96
  children: [
96
- /* @__PURE__ */ D(n, {}),
97
- /* @__PURE__ */ D("span", {
97
+ /* @__PURE__ */ O(n, {}),
98
+ /* @__PURE__ */ O("span", {
98
99
  className: "x1s85apg xannxpe",
99
- children: /* @__PURE__ */ D(n, {})
100
+ children: /* @__PURE__ */ O(n, {})
100
101
  }),
101
- /* @__PURE__ */ D("span", {
102
+ /* @__PURE__ */ O("span", {
102
103
  className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
103
- children: /* @__PURE__ */ D(n, {})
104
+ children: /* @__PURE__ */ O(n, {})
104
105
  })
105
106
  ]
106
107
  })]
107
108
  }, t))
108
109
  });
109
110
  }
110
- function F({ title: e, detail: t }) {
111
- return t === void 0 ? e : /* @__PURE__ */ O("span", {
111
+ function ce({ title: e, detail: t }) {
112
+ return t === void 0 ? e : /* @__PURE__ */ k("span", {
112
113
  "aria-label": e,
113
114
  className: "x1lliihq xb3r6kr xlyipyv xuxw1ft",
114
- children: [/* @__PURE__ */ D("span", {
115
+ children: [/* @__PURE__ */ O("span", {
115
116
  className: "xt0psk2 x1boff50",
116
117
  children: e
117
- }), /* @__PURE__ */ D("span", {
118
+ }), /* @__PURE__ */ O("span", {
118
119
  className: "x1s85apg xfodcyb",
119
120
  children: t
120
121
  })]
121
122
  });
122
123
  }
123
- function ce({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: o, width: s, offset: c = 16, source: l, notes: u = [], hasSeriesSummary: f = !1 }) {
124
- let p = Math.min(260, s), m = o > s / 2 ? o - p - c : o + c, h = Math.max(0, Math.min(s - p, m)), g = t === void 0 ? [] : [
124
+ function le({ label: e, summary: t, rows: n, notes: r = [] }) {
125
+ if (e !== void 0) return [
126
+ e,
125
127
  t,
126
- n,
127
- ...a.map((e) => `${e.label}: ${e.value}`),
128
- ...u
129
- ].filter((e) => e !== void 0);
130
- return /* @__PURE__ */ O("div", {
128
+ ...n.map((e) => `${e.label}: ${e.value}`),
129
+ ...r
130
+ ].filter((e) => e !== void 0).join(" · ");
131
+ }
132
+ function ue({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: o, width: s, offset: c = 16, source: l, notes: u = [], hasSeriesSummary: f = !1, hasLegend: p = !0 }) {
133
+ let m = p && !f, h = Math.min(260, s), g = o > s / 2 ? o - h - c : o + c, _ = Math.max(0, Math.min(s - h, g));
134
+ return /* @__PURE__ */ k("div", {
131
135
  className: "xeuugli",
132
136
  children: [
133
- !f && /* @__PURE__ */ O("div", {
137
+ m && /* @__PURE__ */ k("div", {
134
138
  className: "xrvj5dj xeuugli",
135
- children: [i !== void 0 && /* @__PURE__ */ D("ul", {
139
+ children: [i !== void 0 && /* @__PURE__ */ O("ul", {
136
140
  "aria-hidden": !0,
137
141
  inert: !0,
138
142
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc xlshs6z x47corl",
139
- children: i.map((e) => /* @__PURE__ */ O("li", {
143
+ children: i.map((e) => /* @__PURE__ */ k("li", {
140
144
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
141
- children: [/* @__PURE__ */ D(d, { tone: e.tone }), /* @__PURE__ */ O("span", {
145
+ children: [/* @__PURE__ */ O(d, {
146
+ tone: e.tone,
147
+ shape: e.shape
148
+ }), /* @__PURE__ */ k("span", {
142
149
  className: "xeuugli",
143
- children: [e.label, /* @__PURE__ */ D("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
150
+ children: [e.label, /* @__PURE__ */ O("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
144
151
  })]
145
152
  }, e.id))
146
- }), /* @__PURE__ */ D("ul", {
153
+ }), /* @__PURE__ */ O("ul", {
147
154
  "aria-label": "Legend",
148
155
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc",
149
- children: r.map((e) => /* @__PURE__ */ O("li", {
156
+ children: r.map((e) => /* @__PURE__ */ k("li", {
150
157
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
151
- children: [/* @__PURE__ */ D(d, { tone: e.tone }), /* @__PURE__ */ O("span", {
158
+ children: [/* @__PURE__ */ O(d, {
159
+ tone: e.tone,
160
+ shape: e.shape
161
+ }), /* @__PURE__ */ k("span", {
152
162
  className: "xeuugli",
153
- children: [e.label, /* @__PURE__ */ D("span", {
163
+ children: [e.label, /* @__PURE__ */ O("span", {
154
164
  className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
155
165
  children: t === void 0 ? "" : a.find((t) => t.id === e.id)?.value ?? "—"
156
166
  })]
@@ -158,36 +168,44 @@ function ce({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a,
158
168
  }, e.id))
159
169
  })]
160
170
  }),
161
- /* @__PURE__ */ D("span", {
171
+ /* @__PURE__ */ O("span", {
162
172
  id: e,
163
173
  "aria-live": l === "keyboard" ? "polite" : "off",
164
174
  className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xb3r6kr x1hyvwdk xuxw1ft",
165
- children: g.join(" · ")
175
+ children: le({
176
+ label: t,
177
+ summary: n,
178
+ rows: a,
179
+ notes: u
180
+ })
166
181
  }),
167
- t !== void 0 && /* @__PURE__ */ D("div", {
182
+ t !== void 0 && /* @__PURE__ */ O("div", {
168
183
  "aria-hidden": !0,
169
184
  className: "x1n2onr6 xqtp20y x1vjfegm",
170
- children: /* @__PURE__ */ O("div", {
171
- ...x.props(P.inspector, f && P.summaryInspector, P.position(h, p)),
185
+ children: /* @__PURE__ */ k("div", {
186
+ ...S.props(I.inspector, !m && I.summaryInspector, I.position(_, h)),
172
187
  children: [
173
- /* @__PURE__ */ O("div", {
188
+ /* @__PURE__ */ k("div", {
174
189
  className: "x78zum5 x1qughib x1hnptsi xk4h15q",
175
- children: [/* @__PURE__ */ D("span", { children: t }), n !== void 0 && /* @__PURE__ */ D("span", { children: n })]
190
+ children: [/* @__PURE__ */ O("span", { children: t }), n !== void 0 && /* @__PURE__ */ O("span", { children: n })]
176
191
  }),
177
- /* @__PURE__ */ D("dl", {
192
+ /* @__PURE__ */ O("dl", {
178
193
  className: "xrvj5dj xunmzkg x1ghz6dp",
179
- children: a.map((e) => /* @__PURE__ */ O("div", {
194
+ children: a.map((e) => /* @__PURE__ */ k("div", {
180
195
  className: "x78zum5 x1qughib x1pha0wt x1hnptsi",
181
- children: [/* @__PURE__ */ O("dt", {
196
+ children: [/* @__PURE__ */ k("dt", {
182
197
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
183
- children: [/* @__PURE__ */ D(d, { tone: e.tone }), e.label]
184
- }), /* @__PURE__ */ D("dd", {
198
+ children: [/* @__PURE__ */ O(d, {
199
+ tone: e.tone,
200
+ shape: e.shape
201
+ }), e.label]
202
+ }), /* @__PURE__ */ O("dd", {
185
203
  className: "x1ghz6dp xuxw1ft",
186
204
  children: e.value
187
205
  })]
188
206
  }, e.id))
189
207
  }),
190
- u.map((e) => /* @__PURE__ */ D("span", { children: e }, e))
208
+ u.map((e) => /* @__PURE__ */ O("span", { children: e }, e))
191
209
  ]
192
210
  })
193
211
  })
@@ -195,7 +213,7 @@ function ce({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a,
195
213
  });
196
214
  }
197
215
  // packages/charts/src/cartesian/bar-data.ts
198
- function le({ composition: e, series: t, categoryIds: n, domain: r }) {
216
+ function de({ composition: e, series: t, categoryIds: n, domain: r }) {
199
217
  if (e === void 0) return;
200
218
  if (e.buckets.length !== n.length) return "Composition requires one explicit bucket per category.";
201
219
  let i = e.annotation;
@@ -212,28 +230,157 @@ function le({ composition: e, series: t, categoryIds: n, domain: r }) {
212
230
  }
213
231
  }
214
232
  }
233
+ var L = 6;
234
+ function fe(e, t) {
235
+ return e === null ? !0 : e === void 0 || !Number.isFinite(e) ? !1 : e >= t[0] && e <= t[1];
236
+ }
237
+ function R({ marker: e, categoryCount: t, domain: n }) {
238
+ let r = e.kind === "tick" ? [e.values] : [e.lower, e.upper];
239
+ if (r.some((e) => e.length !== t)) return "Every bar marker requires one explicit value per category.";
240
+ if (r.some((e) => e.some((e) => !fe(e, n)))) return "Bar marker values must be finite and within the supplied domain.";
241
+ if (e.kind === "range") for (let [t, n] of e.lower.entries()) {
242
+ let r = e.upper[t] ?? null;
243
+ if (n === null != (r === null) || n !== null && r !== null && n > r) return "A range marker needs both bounds, with the lower bound at most the upper bound, or neither.";
244
+ }
245
+ }
246
+ function pe({ markers: e, annotations: t, emphasizedCategoryIds: n, seriesIds: r, categoryIds: i, domain: a }) {
247
+ if (e.length > L) return `Supply at most ${L} bar markers.`;
248
+ let o = [...e, ...t];
249
+ if (new Set(o.map((e) => e.id)).size !== o.length || r.some((e) => o.some((t) => t.id === e))) return "Bar series, markers, and annotations require distinct identifiers.";
250
+ for (let t of e) {
251
+ if (!r.includes(t.seriesId)) return "Each bar marker must refer to a supplied series.";
252
+ let e = R({
253
+ marker: t,
254
+ categoryCount: i.length,
255
+ domain: a
256
+ });
257
+ if (e !== void 0) return e;
258
+ }
259
+ for (let e of t) {
260
+ let t = e.seriesId === void 0 || r.includes(e.seriesId), n = e.label.trim() !== "";
261
+ if (!(i.includes(e.categoryId) && t && n)) return "Each bar annotation needs a label, a supplied category, and a supplied series when it names one.";
262
+ }
263
+ if (new Set(t.map((e) => JSON.stringify([e.categoryId, e.seriesId ?? null]))).size !== t.length) return "Each bar can hold one annotation.";
264
+ if (new Set(n).size !== n.length || n.some((e) => !i.includes(e))) return "Emphasized categories must be unique supplied categories.";
265
+ }
266
+ function z({ marker: e, index: t, formatValue: n }) {
267
+ if (e.kind === "tick") {
268
+ let r = e.values[t] ?? null;
269
+ return r === null ? "Unavailable" : n(r);
270
+ }
271
+ let r = e.lower[t] ?? null, i = e.upper[t] ?? null;
272
+ return r === null || i === null ? "Unavailable" : `${n(r)} – ${n(i)}`;
273
+ }
274
+ function B(e, t) {
275
+ return e.kind === "tick" ? e.values[t] ?? null : e.upper[t] ?? null;
276
+ }
277
+ // packages/charts/src/cartesian/bar-overlays.tsx
278
+ var me = {
279
+ kU5bRw: "x5lxx2x",
280
+ kREpy8: "x13efnbd",
281
+ $$css: !0
282
+ }, V = { stroke: (e) => [
283
+ me,
284
+ {
285
+ kjVXCG: e == null ? e : "x6mkzkt",
286
+ $$css: !0
287
+ },
288
+ { "--x-stroke": e ?? void 0 }
289
+ ] }, he = 3, H = 1, U = 1.5, ge = 3, W = 14, _e = 6.5;
290
+ function ve({ path: e, color: t, width: n }) {
291
+ return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("path", {
292
+ d: e,
293
+ strokeWidth: n + 4,
294
+ className: "xaep1og x5lxx2x x13efnbd"
295
+ }), /* @__PURE__ */ O("path", {
296
+ d: e,
297
+ strokeWidth: n,
298
+ ...S.props(V.stroke(t))
299
+ })] });
300
+ }
301
+ function ye({ marker: e, index: t, span: n, base: r, y: i }) {
302
+ let a = e.kind === "tick" ? e.values[t] ?? null : null;
303
+ if (a !== null && r !== null && a !== r) return `M${n.x + n.width / 2},${i(r)} V${i(a)}`;
304
+ }
305
+ function be({ marker: e, index: t, span: n, y: r }) {
306
+ if (e.kind === "tick") {
307
+ let i = e.values[t] ?? null;
308
+ if (i === null) return;
309
+ let a = r(i);
310
+ return `M${n.x - ge},${a} H${n.x + n.width + ge}`;
311
+ }
312
+ let i = e.lower[t] ?? null, a = e.upper[t] ?? null;
313
+ if (i === null || a === null) return;
314
+ let o = n.x + n.width / 2, s = Math.min(W, n.width * .6) / 2, c = r(i), l = r(a);
315
+ return `M${o - s},${l} H${o + s} M${o},${l} V${c} M${o - s},${c} H${o + s}`;
316
+ }
317
+ function xe({ markers: t, categoryIds: n, span: r, barTop: i, y: a, isReceded: o }) {
318
+ return /* @__PURE__ */ O("g", { children: t.map((t) => /* @__PURE__ */ O("g", { children: n.map((n, s) => {
319
+ let c = r(n, t.seriesId), l = be({
320
+ marker: t,
321
+ index: s,
322
+ span: c,
323
+ y: a
324
+ });
325
+ if (l === void 0) return null;
326
+ let u = e[t.tone ?? "neutral"], d = ye({
327
+ marker: t,
328
+ index: s,
329
+ span: c,
330
+ base: i(s, t.seriesId),
331
+ y: a
332
+ });
333
+ return /* @__PURE__ */ k("g", {
334
+ ...S.props(v.emphasis, o(n) && v.receded),
335
+ children: [d !== void 0 && /* @__PURE__ */ O(ve, {
336
+ path: d,
337
+ color: u,
338
+ width: H
339
+ }), /* @__PURE__ */ O(ve, {
340
+ path: l,
341
+ color: u,
342
+ width: t.kind === "tick" ? he : U
343
+ })]
344
+ }, n);
345
+ }) }, t.id)) });
346
+ }
347
+ function Se({ annotations: e, left: t, right: n }) {
348
+ return /* @__PURE__ */ O("g", {
349
+ "aria-hidden": !0,
350
+ children: e.map((e) => {
351
+ let r = e.label.length * _e / 2, i = e.x - r < t, a = e.x + r > n, o = i ? "start" : a ? "end" : "middle", s = i ? t : a ? n : e.x;
352
+ return /* @__PURE__ */ O("text", {
353
+ x: s,
354
+ y: e.y,
355
+ textAnchor: o,
356
+ ...S.props(v.label, v.strongLabel, v.haloLabel, v.emphasis, e.isReceded && v.receded),
357
+ children: e.label
358
+ }, e.id);
359
+ })
360
+ });
361
+ }
215
362
  // packages/charts/src/cartesian/composition-bars.tsx
216
- var ue = { mark: {
363
+ var G = { mark: {
217
364
  k3nNDw: "x1hj3fc7",
218
365
  k1ekBW: "xwcsmn1",
219
366
  kIyJzY: "xtitasy x12w9bfk",
220
367
  kAMwcw: "x1faw7qm",
221
368
  $$css: !0
222
369
  } };
223
- function de({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s, y: c, isHighlighted: l, highlightedSeriesId: u }) {
370
+ function Ce({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s, y: c, isHighlighted: l, highlightedSeriesId: u }) {
224
371
  let d = r !== void 0, f = r !== void 0 && !n.some((e) => e.id === r.id) ? [...n, r] : n;
225
372
  function p(e, t) {
226
373
  let n = c(t), r = c(t + e);
227
374
  return `translateY(${Math.min(n, r)}px) scaleY(${Math.max(+(e === 0), Math.abs(r - n))})`;
228
375
  }
229
- return /* @__PURE__ */ O(E, { children: [t.kind !== "gap" && /* @__PURE__ */ D("rect", {
376
+ return /* @__PURE__ */ k(D, { children: [t.kind !== "gap" && /* @__PURE__ */ O("rect", {
230
377
  x: o,
231
378
  y: 0,
232
379
  width: s,
233
380
  height: 1,
234
381
  vectorEffect: "non-scaling-stroke",
235
382
  fill: e.neutral,
236
- ...x.props(ue.mark, l && v.selected),
383
+ ...S.props(G.mark, l && v.selected),
237
384
  style: {
238
385
  transform: p(t.total, 0),
239
386
  opacity: d ? .18 : +(t.kind === "total")
@@ -242,14 +389,14 @@ function de({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s,
242
389
  let m = c.values[i];
243
390
  if (m == null) return null;
244
391
  let h = r?.id === c.id, g = d ? 0 : n.slice(0, f).reduce((e, t) => e + (t.values[i] ?? 0), 0), _ = d ? h : t.kind === "parts", ee = !d && u !== void 0 && u !== c.id;
245
- return /* @__PURE__ */ D("rect", {
392
+ return /* @__PURE__ */ O("rect", {
246
393
  x: o,
247
394
  y: 0,
248
395
  width: s,
249
396
  height: 1,
250
397
  vectorEffect: "non-scaling-stroke",
251
398
  fill: e[a(c.tone, f)],
252
- ...x.props(ue.mark, l && v.selected),
399
+ ...S.props(G.mark, l && v.selected),
253
400
  style: {
254
401
  transform: p(m, g),
255
402
  opacity: _ ? ee ? .3 : 1 : 0
@@ -257,8 +404,100 @@ function de({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s,
257
404
  }, c.id);
258
405
  })] });
259
406
  }
407
+ // packages/charts/src/cartesian/reference-lines.tsx
408
+ var we = {
409
+ kfJifR: "xhr4kjn",
410
+ k5rJSQ: "x1dz65qj",
411
+ kREpy8: "x13efnbd",
412
+ $$css: !0
413
+ }, Te = {
414
+ kfJifR: "xnpr05h",
415
+ kREpy8: "x13efnbd",
416
+ $$css: !0
417
+ }, K = {
418
+ line: (e) => [
419
+ we,
420
+ {
421
+ kjVXCG: e == null ? e : "x6mkzkt",
422
+ $$css: !0
423
+ },
424
+ { "--x-stroke": e ?? void 0 }
425
+ ],
426
+ leader: (e) => [
427
+ Te,
428
+ {
429
+ kjVXCG: e == null ? e : "x6mkzkt",
430
+ $$css: !0
431
+ },
432
+ { "--x-stroke": e ?? void 0 }
433
+ ]
434
+ }, Ee = 30, De = 13, q = 8, Oe = 4, J = 6.5, Y = 40, X = 112, ke = 16, Z = 8;
435
+ function Q({ lines: e, domain: t }) {
436
+ if (e.length > Z) return `Supply at most ${Z} reference lines.`;
437
+ if (!m(e)) return "Reference lines require unique identifiers.";
438
+ for (let n of e) if (!(Number.isFinite(n.value) && n.value >= t[0] && n.value <= t[1]) || n.label.trim() === "") return "Each reference line needs a label and a finite value inside the value domain.";
439
+ }
440
+ function Ae(e) {
441
+ return e.length > ke ? `${e.slice(0, 15)}…` : e;
442
+ }
443
+ function je({ lines: e, formatValue: t }) {
444
+ if (e.length === 0) return 0;
445
+ let n = Math.max(...e.map((e) => Math.max(Ae(e.label).length, t(e.value).length)));
446
+ return Math.min(X, Math.max(Y, n * J)) + q;
447
+ }
448
+ function Me({ lines: e, y: t, top: n, bottom: r }) {
449
+ let i = e.map((e) => ({
450
+ line: e,
451
+ position: t(e.value)
452
+ })).toSorted((e, t) => e.position - t.position), a = y({
453
+ positions: i.map((e) => e.position),
454
+ gap: Ee,
455
+ start: n + Ee / 2,
456
+ end: r - Ee / 2
457
+ });
458
+ return i.map((e, t) => ({
459
+ ...e,
460
+ center: a[t] ?? e.position
461
+ }));
462
+ }
463
+ function Ne({ lines: t, y: n, left: r, right: i, top: a, bottom: o, formatValue: s }) {
464
+ return /* @__PURE__ */ O("g", { children: Me({
465
+ lines: t,
466
+ y: n,
467
+ top: a,
468
+ bottom: o
469
+ }).map(({ line: t, position: n, center: a }) => {
470
+ let o = e[t.tone ?? "neutral"], c = i + q;
471
+ return /* @__PURE__ */ k("g", { children: [
472
+ /* @__PURE__ */ O("line", {
473
+ x1: r,
474
+ x2: i,
475
+ y1: n,
476
+ y2: n,
477
+ ...S.props(K.line(o))
478
+ }),
479
+ /* @__PURE__ */ O("path", {
480
+ d: `M${i},${n} L${i + Oe},${a} H${i + Oe + 1}`,
481
+ fill: "none",
482
+ ...S.props(K.leader(o))
483
+ }),
484
+ /* @__PURE__ */ O("text", {
485
+ x: c,
486
+ y: a - 2,
487
+ ...S.props(v.label, v.strongLabel),
488
+ children: Ae(t.label)
489
+ }),
490
+ /* @__PURE__ */ O("text", {
491
+ x: c,
492
+ y: a + De - 2,
493
+ ...S.props(v.label),
494
+ children: s(t.value)
495
+ })
496
+ ] }, t.id);
497
+ }) });
498
+ }
260
499
  // packages/charts/src/cartesian/bar-chart.tsx
261
- var I = {
500
+ var Pe = {
262
501
  plot: {
263
502
  kqGvvJ: "x1we84gm",
264
503
  $$css: !0
@@ -267,77 +506,73 @@ var I = {
267
506
  kSiTet: "xuzhngd",
268
507
  $$css: !0
269
508
  }
270
- }, fe = 200;
271
- function L({ title: e, description: t, report: n, series: r, layoutSeries: i, children: o, inspectionId: c, label: l, detail: u, summary: d, rows: f = [], index: m = -1, formatValue: h = String, x: g = 0, width: _ = 0, offset: v, source: ee, data: y, isLoading: b = !1 }) {
509
+ }, Fe = 200, Ie = 12, Le = 30, Re = 8, ze = 14;
510
+ function Be({ title: e, description: t, report: n, series: r, layoutSeries: i, markerLegend: o = [], notes: c, children: l, inspectionId: u, label: d, detail: f, summary: m, rows: h = [], x: g = 0, width: _ = 0, offset: v, source: ee, data: y, isLoading: b = !1 }) {
272
511
  let x = r.map((e, t) => ({
273
512
  id: e.id,
274
513
  label: e.label,
275
514
  tone: a(e.tone, t)
276
- })), te = i?.map((e, t) => ({
515
+ })), S = i?.map((e, t) => ({
277
516
  id: e.id,
278
517
  label: e.label,
279
518
  tone: a(e.tone, t)
280
- })), S = b && r.length === 0 && n?.seriesValues === void 0;
281
- return /* @__PURE__ */ O(p, {
282
- title: /* @__PURE__ */ D(F, {
519
+ })), C = b && r.length === 0 && n?.seriesValues === void 0;
520
+ return /* @__PURE__ */ k(p, {
521
+ title: /* @__PURE__ */ O(ce, {
283
522
  title: e,
284
- detail: u
523
+ detail: f
285
524
  }),
286
525
  description: t,
287
526
  report: n,
288
527
  series: x,
289
528
  children: [
290
- y !== void 0 && /* @__PURE__ */ D(s, { ...y }),
291
- S ? /* @__PURE__ */ D(se, {}) : /* @__PURE__ */ D(ce, {
292
- id: c,
293
- label: l,
294
- summary: d,
295
- legend: x,
529
+ y !== void 0 && /* @__PURE__ */ O(s, { ...y }),
530
+ C ? /* @__PURE__ */ O(se, {}) : /* @__PURE__ */ O(ue, {
531
+ id: u,
532
+ label: d,
533
+ summary: m,
534
+ legend: [...x, ...o],
296
535
  hasSeriesSummary: n?.seriesValues !== void 0,
297
- layoutLegend: te,
298
- rows: f.map((e, t) => ({
299
- id: e.id,
300
- label: e.label,
301
- tone: a(e.tone, t),
302
- value: e.values[m] === null || e.values[m] === void 0 ? "Unavailable" : h(e.values[m])
303
- })),
536
+ layoutLegend: S === void 0 ? void 0 : [...S, ...o],
537
+ rows: h,
538
+ notes: c,
304
539
  x: g,
305
540
  width: _,
306
541
  offset: v,
307
542
  source: ee
308
543
  }),
309
- o
544
+ l
310
545
  ]
311
546
  });
312
547
  }
313
- function R({ title: e = "Loading chart", description: n, report: r, series: i = [], height: a = fe }) {
314
- let o = z(a), s = C();
315
- return o === void 0 ? /* @__PURE__ */ D("div", {
548
+ function Ve({ title: e = "Loading chart", description: n, report: r, series: i = [], height: a = Fe }) {
549
+ let o = He(a), s = w();
550
+ return o === void 0 ? /* @__PURE__ */ O("div", {
316
551
  "aria-hidden": !0,
317
552
  inert: !0,
318
- children: /* @__PURE__ */ D(L, {
553
+ children: /* @__PURE__ */ O(Be, {
319
554
  title: e,
320
555
  description: n,
321
556
  report: r,
322
557
  series: i,
323
558
  inspectionId: s,
324
559
  isLoading: !0,
325
- children: /* @__PURE__ */ D("div", {
326
- ...x.props(v.plot, I.plot),
327
- children: /* @__PURE__ */ D(t, { height: a })
560
+ children: /* @__PURE__ */ O("div", {
561
+ ...S.props(v.plot, Pe.plot),
562
+ children: /* @__PURE__ */ O(t, { height: a })
328
563
  })
329
564
  })
330
- }) : /* @__PURE__ */ D(g, {
565
+ }) : /* @__PURE__ */ O(g, {
331
566
  title: e,
332
567
  description: n,
333
568
  report: r,
334
569
  message: o
335
570
  });
336
571
  }
337
- function z(e) {
572
+ function He(e) {
338
573
  if (!Number.isFinite(e) || e < 48) return "Chart height must be at least 48 pixels.";
339
574
  }
340
- function pe({ categories: e, series: t, domain: n, mode: r }) {
575
+ function Ue({ categories: e, series: t, domain: n, mode: r }) {
341
576
  if (e.length > i.items || t.length > i.series) return `Choose a window with at most ${i.items} categories and ${i.series} series.`;
342
577
  if (!h(n) || n[0] > 0 || n[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
343
578
  if (!m(e) || !m(t)) return "Bar categories and series require unique identifiers.";
@@ -350,85 +585,167 @@ function pe({ categories: e, series: t, domain: n, mode: r }) {
350
585
  }
351
586
  if (r === "stacked" && e.some((e, r) => t.reduce((e, t) => e + (t.values[r] ?? 0), 0) > n[1])) return "Stacked bar totals must fit the supplied domain.";
352
587
  }
353
- var me = {
588
+ var We = {
354
589
  "x-default-marker": "x-default-marker",
355
590
  $$css: !0
356
591
  };
357
- function B({ title: t, description: n, report: r, categories: i, series: o, domain: s, mode: c = "grouped", formatValue: u, formatTick: d = u, highlightedSeriesId: f, selection: p, height: m = fe, composition: h }) {
358
- let _ = h?.focusedSeries, y = C(), b = _ === void 0 ? void 0 : pe({
592
+ function Ge({ title: t, description: n, report: r, categories: i, series: o, domain: s, mode: c = "grouped", formatValue: u, formatTick: d = u, highlightedSeriesId: f, selection: p, height: m = Fe, composition: h, referenceLines: _ = [], markers: y = [], annotations: b = [], emphasizedCategoryIds: x = [] }) {
593
+ let C = h?.focusedSeries, T = w(), ne = C === void 0 ? void 0 : Ue({
359
594
  categories: i,
360
- series: [_],
595
+ series: [C],
361
596
  domain: s,
362
597
  mode: "grouped"
363
- }), te = pe({
598
+ }), D = Ue({
364
599
  categories: i,
365
600
  series: o,
366
601
  domain: s,
367
602
  mode: c
368
- }) ?? b, ne = le({
603
+ }) ?? ne, A = i.map((e) => e.id), ie = pe({
604
+ markers: y,
605
+ annotations: b,
606
+ emphasizedCategoryIds: x,
607
+ seriesIds: [...o, ...C === void 0 ? [] : [C]].map((e) => e.id),
608
+ categoryIds: A,
609
+ domain: s
610
+ }) ?? Q({
611
+ lines: _,
612
+ domain: s
613
+ }), M = de({
369
614
  composition: h,
370
615
  series: o,
371
- categoryIds: i.map((e) => e.id),
616
+ categoryIds: A,
372
617
  domain: s
373
- }) ?? z(m), w = te ?? ne, E = h === void 0 ? void 0 : {
374
- id: y,
618
+ }) ?? ie ?? He(m), P = D ?? M, F = h === void 0 ? void 0 : {
619
+ id: T,
375
620
  label: h.contextLabel,
376
621
  tone: "neutral",
377
622
  values: h.buckets.map((e) => e.kind === "gap" ? null : e.total)
378
- }, k = E === void 0 ? o : [
379
- E,
623
+ }, I = F === void 0 ? o : [
624
+ F,
380
625
  ...o,
381
- ..._ === void 0 || o.some((e) => e.id === _.id) ? [] : [_]
382
- ], re = _ !== void 0 && E !== void 0 ? [_, E] : o, { ref: ie, width: N, element: P } = ee(), oe = C(), [se, F] = T(), [ce, ue] = T();
383
- S(() => {
626
+ ...C === void 0 || o.some((e) => e.id === C.id) ? [] : [C]
627
+ ], oe = C !== void 0 && F !== void 0 ? [C, F] : o, { ref: se, width: ce, element: ue } = ee(), L = w(), [fe, R] = E(), [me, V] = E();
628
+ te(() => {
384
629
  function e(e) {
385
- e.target instanceof Node && P?.contains(e.target) !== !0 && F(void 0);
630
+ e.target instanceof Node && ue?.contains(e.target) !== !0 && R(void 0);
386
631
  }
387
632
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
388
- }, [P]);
389
- let R = i.findIndex((e) => e.id === se?.id), B = i[R], ge = i[i.findIndex((e) => e.id === p?.selectedId)], V = i.find((e) => e.id === ce) ?? ge ?? i[0], H = B, U = R, W = h?.buckets[U], G = _ !== void 0 && E !== void 0 ? [_, E] : E === void 0 || W?.kind === "parts" ? o : [], K = W === void 0 ? void 0 : W.kind === "gap" ? "No reported value" : u(W.total);
390
- if (w !== void 0) return /* @__PURE__ */ D(g, {
633
+ }, [ue]);
634
+ let he = i.findIndex((e) => e.id === fe?.id), H = i[he], U = i[i.findIndex((e) => e.id === p?.selectedId)], ge = i.find((e) => e.id === me) ?? U ?? i[0], W = H, _e = he, ve = h?.buckets[_e], ye = C !== void 0 && F !== void 0 ? [C, F] : F === void 0 || ve?.kind === "parts" ? o : [], be = ve === void 0 ? void 0 : ve.kind === "gap" ? "No reported value" : u(ve.total);
635
+ if (P !== void 0) return /* @__PURE__ */ O(g, {
391
636
  title: t,
392
637
  description: n,
393
638
  report: r,
394
- message: w
639
+ message: P
395
640
  });
396
- let _e = m - 28, q = j({
641
+ let G = ye.map((e, t) => {
642
+ let n = e.values[_e];
643
+ return {
644
+ id: e.id,
645
+ label: e.label,
646
+ tone: a(e.tone, t),
647
+ value: n == null ? "Unavailable" : u(n)
648
+ };
649
+ }), we = y.map((e) => ({
650
+ id: e.id,
651
+ label: e.label,
652
+ tone: e.tone ?? "neutral",
653
+ shape: e.kind
654
+ })), Te = y.map((e) => ({
655
+ id: e.id,
656
+ label: e.label,
657
+ tone: e.tone ?? "neutral",
658
+ shape: e.kind,
659
+ value: z({
660
+ marker: e,
661
+ index: _e,
662
+ formatValue: u
663
+ })
664
+ })), K = _.map((e) => ({
665
+ id: e.id,
666
+ label: e.label,
667
+ tone: e.tone ?? "neutral",
668
+ shape: "dashed",
669
+ value: u(e.value)
670
+ })), Ee = W === void 0 ? [] : [
671
+ ...G,
672
+ ...Te,
673
+ ...K
674
+ ], De = b.filter((e) => e.categoryId === W?.id).map((e) => e.label), q = b.length > 0 ? Le : Ie, Oe = m - 28, J = j({
397
675
  domain: [...s],
398
- range: [_e, 12]
399
- }), J = Math.max(44, ...q.ticks(3).map((e) => d(e).length * 7 + 12)), Y = Math.max(J + 1, N - 16), X = A({
676
+ range: [Oe, q]
677
+ }), Y = Math.max(44, ...J.ticks(3).map((e) => d(e).length * 7 + 12)), X = je({
678
+ lines: _,
679
+ formatValue: d
680
+ }), ke = Math.max(Y + 1, ce - 16 - X), Z = re({
400
681
  domain: i.map((e) => e.id),
401
- range: [J, Y],
682
+ range: [Y, ke],
402
683
  padding: .3
403
- }), Z = A({
684
+ }), Ae = re({
404
685
  domain: o.map((e) => e.id),
405
- range: [0, X.bandwidth()],
686
+ range: [0, Z.bandwidth()],
406
687
  padding: .08
407
- }), ve = Math.min(120, Math.max(40, ...i.map((e) => (e.axisLabel ?? e.label).length * 7))), Q = Math.max(1, Math.ceil((ve + 16) / X.step())), $ = Math.max(1, Math.floor((X.step() * Q - 16) / 7));
408
- function ye(e) {
409
- let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * N, r = Math.floor((n - J) / X.step()), a = i[Math.max(0, Math.min(i.length - 1, r))];
410
- a !== void 0 && (e.type === "pointerdown" && ue(a.id), F({
688
+ }), Me = Math.min(120, Math.max(40, ...i.map((e) => (e.axisLabel ?? e.label).length * 7))), Ve = Math.max(1, Math.ceil((Me + 16) / Z.step())), Ge = c === "stacked" || h !== void 0;
689
+ function qe(e, t) {
690
+ let n = Z(e) ?? Y;
691
+ return Ge ? {
692
+ x: n,
693
+ width: Z.bandwidth()
694
+ } : {
695
+ x: n + (Ae(t) ?? 0),
696
+ width: Ae.bandwidth()
697
+ };
698
+ }
699
+ function Je(e, t) {
700
+ if (!Ge) return o.find((e) => e.id === t)?.values[e] ?? null;
701
+ let n = o.flatMap((t) => [t.values[e] ?? null].filter((e) => e !== null));
702
+ return n.length === 0 ? null : n.reduce((e, t) => e + t, 0);
703
+ }
704
+ function Ye(e) {
705
+ let t = x.includes(e);
706
+ return x.length > 0 && !t && H?.id !== e;
707
+ }
708
+ function Xe(e, t) {
709
+ let n = (t === void 0 ? o : o.filter((e) => e.id === t)).flatMap((t) => [t.values[e] ?? null].filter((e) => e !== null)), r = Ge ? n.reduce((e, t) => e + Math.max(0, t), 0) : Math.max(0, ...n), i = h?.buckets[e], a = i === void 0 || i.kind === "gap" ? 0 : i.total, s = y.filter((e) => t === void 0 || e.seriesId === t).flatMap((t) => [B(t, e)].filter((e) => e !== null));
710
+ return Math.max(0, r, a, ...s);
711
+ }
712
+ let Ze = b.map((e) => {
713
+ let t = Xe(A.indexOf(e.categoryId), e.seriesId), n = e.seriesId === void 0 ? {
714
+ x: Z(e.categoryId) ?? Y,
715
+ width: Z.bandwidth()
716
+ } : qe(e.categoryId, e.seriesId);
717
+ return {
718
+ id: e.id,
719
+ label: e.label,
720
+ x: n.x + n.width / 2,
721
+ y: Math.max(ze, J(t) - Re),
722
+ isReceded: Ye(e.categoryId)
723
+ };
724
+ }), Qe = Math.max(1, Math.floor((Z.step() * Ve - 16) / 7));
725
+ function $e(e) {
726
+ let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * ce, r = Math.floor((n - Y) / Z.step()), a = i[Math.max(0, Math.min(i.length - 1, r))];
727
+ a !== void 0 && (e.type === "pointerdown" && V(a.id), R({
411
728
  id: a.id,
412
729
  source: "pointer"
413
730
  }));
414
731
  }
415
- return /* @__PURE__ */ D(L, {
732
+ return /* @__PURE__ */ O(Be, {
416
733
  title: t,
417
734
  description: n,
418
735
  report: r,
419
- series: re,
736
+ series: oe,
420
737
  layoutSeries: o,
421
- inspectionId: oe,
422
- label: H?.label,
423
- detail: H === void 0 ? void 0 : [H.axisLabel ?? H.label, K].filter(Boolean).join(" · "),
424
- summary: K,
425
- rows: G,
426
- index: U,
427
- formatValue: u,
428
- x: (X(H?.id ?? "") ?? J) + X.bandwidth() / 2,
429
- width: N,
430
- offset: X.bandwidth() / 2 + 8,
431
- source: se?.source,
738
+ markerLegend: we,
739
+ notes: De,
740
+ inspectionId: L,
741
+ label: W?.label,
742
+ detail: W === void 0 ? void 0 : [W.axisLabel ?? W.label, be].filter(Boolean).join(" · "),
743
+ summary: be,
744
+ rows: Ee,
745
+ x: (Z(W?.id ?? "") ?? Y) + Z.bandwidth() / 2,
746
+ width: ce,
747
+ offset: Z.bandwidth() / 2 + 8,
748
+ source: fe?.source,
432
749
  data: {
433
750
  label: `${t} observations`,
434
751
  columns: [{
@@ -438,142 +755,185 @@ function B({ title: t, description: n, report: r, categories: i, series: o, doma
438
755
  id: "value",
439
756
  label: "Value"
440
757
  }],
441
- rows: i.map((e, t) => ({
758
+ rows: [...i.map((e, t) => ({
442
759
  id: e.id,
443
- values: [e.label, he(k, t, u)]
444
- }))
760
+ values: [e.label, [
761
+ Ke(I, t, u),
762
+ ...y.map((e) => `${e.label}: ${z({
763
+ marker: e,
764
+ index: t,
765
+ formatValue: u
766
+ })}`),
767
+ ...b.filter((t) => t.categoryId === e.id).map((e) => e.label)
768
+ ].join(" · ")]
769
+ })), ..._.map((e) => ({
770
+ id: `reference:${e.id}`,
771
+ values: [e.label, u(e.value)]
772
+ }))]
445
773
  },
446
- children: /* @__PURE__ */ D("div", {
447
- ref: ie,
448
- ...x.props(v.plot, I.plot),
449
- children: i.length === 0 || o.length === 0 && h === void 0 ? /* @__PURE__ */ D("p", {
774
+ children: /* @__PURE__ */ O("div", {
775
+ ref: se,
776
+ ...S.props(v.plot, Pe.plot),
777
+ children: i.length === 0 || o.length === 0 && h === void 0 ? /* @__PURE__ */ O("p", {
450
778
  className: "x153jb6y x1ghz6dp xy8obcc",
451
779
  children: "No categories"
452
- }) : /* @__PURE__ */ O(l, {
780
+ }) : /* @__PURE__ */ k(l, {
453
781
  role: "img",
454
782
  "aria-label": `${t}. Use arrow keys to inspect categories.${p === void 0 ? "" : " Press Enter to select."}`,
455
- "aria-describedby": oe,
783
+ "aria-describedby": L,
456
784
  tabIndex: 0,
457
- viewBox: `0 0 ${N} ${m}`,
785
+ viewBox: `0 0 ${ce} ${m}`,
458
786
  height: m,
459
787
  controls: {
460
788
  items: i,
461
- cursor: V?.id,
462
- inspected: B?.id,
789
+ cursor: ge?.id,
790
+ inspected: H?.id,
791
+ selected: U?.id,
792
+ readout: le({
793
+ label: H?.label,
794
+ summary: be,
795
+ rows: Ee,
796
+ notes: De
797
+ }),
463
798
  onInspect: (e) => {
464
- ue(e), F({
799
+ V(e), R({
465
800
  id: e,
466
801
  source: "keyboard"
467
802
  });
468
803
  },
469
- onDismiss: () => F(void 0),
804
+ onDismiss: () => R(void 0),
470
805
  onSelect: p?.onSelect
471
806
  },
472
807
  onFocus: (e) => {
473
808
  if (e.currentTarget.matches(":focus-visible")) {
474
- let e = ge ?? i[0];
475
- ue(e?.id), F(e === void 0 ? void 0 : {
809
+ let e = U ?? i[0];
810
+ V(e?.id), R(e === void 0 ? void 0 : {
476
811
  id: e.id,
477
812
  source: "keyboard"
478
813
  });
479
814
  }
480
815
  },
481
816
  onPointerMove: (e) => {
482
- e.pointerType === "mouse" && ye(e);
817
+ e.pointerType === "mouse" && $e(e);
483
818
  },
484
- onPointerDown: ye,
819
+ onPointerDown: $e,
485
820
  onPointerLeave: (e) => {
486
- e.pointerType === "mouse" && se?.source === "pointer" && F(void 0);
821
+ e.pointerType === "mouse" && fe?.source === "pointer" && R(void 0);
487
822
  },
488
- onBlur: () => F(void 0),
823
+ onBlur: () => R(void 0),
489
824
  onClick: () => {
490
- B !== void 0 && p?.onSelect(B.id);
825
+ H !== void 0 && p?.onSelect(H.id);
491
826
  },
492
- ...x.props(v.svg, v.inspectable, me),
827
+ ...S.props(v.svg, v.inspectable, We),
493
828
  children: [
494
- B !== void 0 && /* @__PURE__ */ D("rect", {
495
- x: (X(B.id) ?? J) - (X.step() - X.bandwidth()) / 2,
496
- y: 12,
497
- width: X.step(),
498
- height: _e - 12,
829
+ H !== void 0 && /* @__PURE__ */ O("rect", {
830
+ x: (Z(H.id) ?? Y) - (Z.step() - Z.bandwidth()) / 2,
831
+ y: q,
832
+ width: Z.step(),
833
+ height: Oe - q,
499
834
  className: "x2wnxhi"
500
835
  }),
501
- q.ticks(3).map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
502
- x1: J,
503
- x2: Y,
504
- y1: q(e),
505
- y2: q(e),
506
- ...x.props(v.grid)
507
- }), /* @__PURE__ */ D("text", {
508
- x: J - 8,
509
- y: q(e),
836
+ J.ticks(3).map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
837
+ x1: Y,
838
+ x2: ke,
839
+ y1: J(e),
840
+ y2: J(e),
841
+ ...S.props(v.grid)
842
+ }), /* @__PURE__ */ O("text", {
843
+ x: Y - 8,
844
+ y: J(e),
510
845
  textAnchor: "end",
511
846
  dominantBaseline: "middle",
512
- ...x.props(v.label),
847
+ ...S.props(v.label),
513
848
  children: d(e)
514
849
  })] }, e)),
515
- h?.annotation !== void 0 && i.some((e) => e.id === h.annotation?.categoryId) && /* @__PURE__ */ D("text", {
516
- x: X(h.annotation.categoryId),
517
- y: Math.max(12, q(h.annotation.value) - 8),
518
- ...x.props(v.label),
850
+ h?.annotation !== void 0 && i.some((e) => e.id === h.annotation?.categoryId) && /* @__PURE__ */ O("text", {
851
+ x: Z(h.annotation.categoryId),
852
+ y: Math.max(q, J(h.annotation.value) - 8),
853
+ ...S.props(v.label),
519
854
  children: h.annotation.label
520
855
  }),
521
856
  i.map((t, n) => {
522
857
  let r = t.axisLabel ?? t.label, i = h?.buckets[n];
523
- return /* @__PURE__ */ O("g", { children: [i === void 0 ? o.map((r, i) => {
524
- let s = r.values[n];
525
- if (s == null) return null;
526
- let l = c === "stacked" ? o.slice(0, i).reduce((e, t) => e + (t.values[n] ?? 0), 0) : 0, u = q(l), d = q(l + s), m = p?.selectedId === t.id || B?.id === t.id;
527
- return /* @__PURE__ */ D(M, {
528
- x: (X(t.id) ?? J) + (c === "stacked" ? 0 : Z(r.id) ?? 0),
529
- y: Math.min(u, d),
530
- width: c === "stacked" ? X.bandwidth() : Z.bandwidth(),
531
- height: Math.max(+(s === 0), Math.abs(d - u)),
532
- fill: e[a(r.tone, i)],
533
- ...x.props(m && v.selected, f !== void 0 && f !== r.id && I.mutedMark)
534
- }, r.id);
535
- }) : /* @__PURE__ */ D(de, {
536
- bucket: i,
537
- series: o,
538
- focusedSeries: _,
539
- index: n,
540
- x: X(t.id) ?? J,
541
- width: X.bandwidth(),
542
- y: q,
543
- isHighlighted: p?.selectedId === t.id || B?.id === t.id,
544
- highlightedSeriesId: f
545
- }), n % Q === 0 && /* @__PURE__ */ D("text", {
546
- x: (X(t.id) ?? J) + X.bandwidth() / 2,
858
+ return /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("g", {
859
+ ...S.props(v.emphasis, Ye(t.id) && v.receded),
860
+ children: i === void 0 ? o.map((r, i) => {
861
+ let s = r.values[n];
862
+ if (s == null) return null;
863
+ let l = c === "stacked" ? o.slice(0, i).reduce((e, t) => e + (t.values[n] ?? 0), 0) : 0, u = J(l), d = J(l + s), m = p?.selectedId === t.id || H?.id === t.id;
864
+ return /* @__PURE__ */ O(N, {
865
+ x: (Z(t.id) ?? Y) + (c === "stacked" ? 0 : Ae(r.id) ?? 0),
866
+ y: Math.min(u, d),
867
+ width: c === "stacked" ? Z.bandwidth() : Ae.bandwidth(),
868
+ height: Math.max(+(s === 0), Math.abs(d - u)),
869
+ fill: e[a(r.tone, i)],
870
+ ...S.props(m && v.selected, f !== void 0 && f !== r.id && Pe.mutedMark)
871
+ }, r.id);
872
+ }) : /* @__PURE__ */ O(Ce, {
873
+ bucket: i,
874
+ series: o,
875
+ focusedSeries: C,
876
+ index: n,
877
+ x: Z(t.id) ?? Y,
878
+ width: Z.bandwidth(),
879
+ y: J,
880
+ isHighlighted: p?.selectedId === t.id || H?.id === t.id,
881
+ highlightedSeriesId: f
882
+ })
883
+ }), n % Ve === 0 && /* @__PURE__ */ O("text", {
884
+ x: (Z(t.id) ?? Y) + Z.bandwidth() / 2,
547
885
  y: m - 4,
548
886
  textAnchor: "middle",
549
- ...x.props(v.label),
550
- children: r.length > $ ? `${r.slice(0, $ - 1)}…` : r
887
+ ...S.props(v.label),
888
+ children: r.length > Qe ? `${r.slice(0, Qe - 1)}…` : r
551
889
  })] }, t.id);
552
890
  }),
553
- V !== void 0 && /* @__PURE__ */ D(ae, {
554
- x: (X(V.id) ?? J) + X.bandwidth() / 2,
555
- top: 12,
556
- bottom: _e,
557
- width: Math.max(8, X.bandwidth())
891
+ /* @__PURE__ */ O(Ne, {
892
+ lines: _,
893
+ y: J,
894
+ left: Y,
895
+ right: ke,
896
+ top: q,
897
+ bottom: Oe,
898
+ formatValue: d
899
+ }),
900
+ /* @__PURE__ */ O(xe, {
901
+ markers: y,
902
+ categoryIds: A,
903
+ span: qe,
904
+ barTop: Je,
905
+ y: J,
906
+ isReceded: Ye
907
+ }),
908
+ /* @__PURE__ */ O(Se, {
909
+ annotations: Ze,
910
+ left: Y,
911
+ right: ke
912
+ }),
913
+ ge !== void 0 && /* @__PURE__ */ O(ae, {
914
+ x: (Z(ge.id) ?? Y) + Z.bandwidth() / 2,
915
+ top: q,
916
+ bottom: Oe,
917
+ width: Math.max(8, Z.bandwidth())
558
918
  })
559
919
  ]
560
920
  })
561
921
  })
562
922
  });
563
923
  }
564
- function he(e, t, n) {
924
+ function Ke(e, t, n) {
565
925
  return e.map((e) => {
566
926
  let r = e.values[t];
567
927
  return `${e.label}: ${r == null ? "Unavailable" : n(r)}`;
568
928
  }).join(" · ");
569
929
  }
570
930
  // packages/charts/src/cartesian/breakdown-bar.tsx
571
- var ge = {
931
+ var qe = {
572
932
  kzqmXN: "x5lhr3w",
573
933
  kZKoxP: "x5yr21d",
574
934
  $$css: !0
575
- }, V = { segment: (e, t) => [
576
- ge,
935
+ }, Je = { segment: (e, t) => [
936
+ qe,
577
937
  {
578
938
  kWkggS: t == null ? t : "xl8spv7",
579
939
  $$css: !0
@@ -583,27 +943,27 @@ var ge = {
583
943
  "--x-backgroundColor": t ?? void 0
584
944
  }
585
945
  ] };
586
- function H({ title: t, report: n, description: i, items: s, total: c, formatValue: l, selection: u }) {
946
+ function Ye({ title: t, report: n, description: i, items: s, total: c, formatValue: l, selection: u }) {
587
947
  let d = r(s), f = s.reduce((e, t) => e + (t.value ?? 0), 0), m = 2 ** -52 * Math.max(f, c, 1) * s.length;
588
- return d === void 0 ? !Number.isFinite(c) || c < 0 || f - c > m ? /* @__PURE__ */ D(g, {
948
+ return d === void 0 ? !Number.isFinite(c) || c < 0 || f - c > m ? /* @__PURE__ */ O(g, {
589
949
  title: t,
590
950
  report: n,
591
951
  description: i,
592
952
  message: "The total must be finite and at least the sum of recorded values."
593
- }) : /* @__PURE__ */ D(p, {
953
+ }) : /* @__PURE__ */ O(p, {
594
954
  title: t,
595
955
  report: n,
596
956
  description: i,
597
- children: s.length === 0 ? /* @__PURE__ */ D("p", {
957
+ children: s.length === 0 ? /* @__PURE__ */ O("p", {
598
958
  className: "x153jb6y x1ghz6dp xy8obcc",
599
959
  children: "No values"
600
- }) : /* @__PURE__ */ O(E, { children: [
601
- /* @__PURE__ */ D("div", {
960
+ }) : /* @__PURE__ */ k(D, { children: [
961
+ /* @__PURE__ */ O("div", {
602
962
  "aria-hidden": !0,
603
963
  className: "x78zum5 x170jfvy xb3r6kr x1r7kqkb xmkeg23 x1y0btm7 x1ey3b81 x1jfksii",
604
- children: s.map((t, n) => t.value === null ? null : /* @__PURE__ */ D("span", { ...x.props(V.segment(c === 0 ? 0 : t.value / c * 100, e[a(t.tone, n)])) }, t.id))
964
+ children: s.map((t, n) => t.value === null ? null : /* @__PURE__ */ O("span", { ...S.props(Je.segment(c === 0 ? 0 : t.value / c * 100, e[a(t.tone, n)])) }, t.id))
605
965
  }),
606
- /* @__PURE__ */ D(o, {
966
+ /* @__PURE__ */ O(o, {
607
967
  items: s.map((e, t) => ({
608
968
  id: e.id,
609
969
  label: e.label,
@@ -612,7 +972,7 @@ function H({ title: t, report: n, description: i, items: s, total: c, formatValu
612
972
  })),
613
973
  selection: u
614
974
  }),
615
- c - f > m && /* @__PURE__ */ O("p", {
975
+ c - f > m && /* @__PURE__ */ k("p", {
616
976
  className: "x153jb6y x1ghz6dp xy8obcc",
617
977
  children: [
618
978
  "Unassigned portion: ",
@@ -622,20 +982,402 @@ function H({ title: t, report: n, description: i, items: s, total: c, formatValu
622
982
  ]
623
983
  })
624
984
  ] })
625
- }) : /* @__PURE__ */ D(g, {
985
+ }) : /* @__PURE__ */ O(g, {
626
986
  title: t,
627
987
  report: n,
628
988
  description: i,
629
989
  message: d
630
990
  });
631
991
  }
992
+ // packages/charts/src/cartesian/bridge-data.ts
993
+ function Xe(e) {
994
+ return e.kind !== "change" || e.value === null ? "neutral" : e.value < 0 ? "negative" : "positive";
995
+ }
996
+ function Ze(e) {
997
+ let t = e.map((e) => e.kind === "total" ? 0 : e.value);
998
+ return e[0]?.kind !== "start" || t.includes(null) ? null : t.reduce((e, t) => e + (t ?? 0), 0);
999
+ }
1000
+ function Qe({ step: e, before: t, after: n }) {
1001
+ let r = e.tone ?? Xe(e);
1002
+ switch (e.kind) {
1003
+ case "start": return {
1004
+ step: e,
1005
+ from: 0,
1006
+ to: e.value,
1007
+ tone: r
1008
+ };
1009
+ case "total": return {
1010
+ step: e,
1011
+ from: n === null ? null : 0,
1012
+ to: n,
1013
+ tone: r
1014
+ };
1015
+ case "change": return {
1016
+ step: e,
1017
+ from: t,
1018
+ to: n,
1019
+ tone: r
1020
+ };
1021
+ }
1022
+ }
1023
+ function $e(e) {
1024
+ return e.map((t, n) => Qe({
1025
+ step: t,
1026
+ before: Ze(e.slice(0, n)),
1027
+ after: Ze(e.slice(0, n + 1))
1028
+ }));
1029
+ }
1030
+ function et(e) {
1031
+ let t = e.flatMap((e) => [e.from, e.to].filter((e) => e !== null)), n = Math.min(0, ...t), r = Math.max(0, ...t);
1032
+ return n === r ? [n, n + 1] : [n, r];
1033
+ }
1034
+ function tt({ steps: e, domain: t }) {
1035
+ if (e.length > i.items) return `Choose a bridge with at most ${i.items} steps.`;
1036
+ if (!m(e)) return "Bridge steps require unique identifiers.";
1037
+ if (e.length > 0 && e[0]?.kind !== "start") return "A bridge begins with one start step.";
1038
+ if (e.filter((e) => e.kind === "start").length > 1) return "A bridge has exactly one start step.";
1039
+ if (e.some((e) => {
1040
+ let t = e.kind === "total" ? null : e.value;
1041
+ return t !== null && !Number.isFinite(t);
1042
+ })) return "Bridge values must be finite numbers or explicit missing changes.";
1043
+ let n = et($e(e));
1044
+ if (t === void 0) return Number.isFinite(n[0]) && Number.isFinite(n[1]) ? void 0 : "Running totals must stay finite.";
1045
+ let r = t[0] <= n[0] && t[1] >= n[1];
1046
+ if (!h(t) || !r) return "The bridge domain must be finite, increasing, and contain zero and every running total.";
1047
+ }
1048
+ // packages/charts/src/cartesian/bridge-chart.tsx
1049
+ var nt = {
1050
+ plot: {
1051
+ kqGvvJ: "x1we84gm",
1052
+ $$css: !0
1053
+ },
1054
+ bar: (e) => [{
1055
+ kDwRjp: e == null ? e : "x19zyb68",
1056
+ $$css: !0
1057
+ }, { "--x-fill": e ?? void 0 }]
1058
+ }, rt = 240, it = 24, at = 28, ot = 6, st = 14, ct = 12, lt = 7, ut = {
1059
+ start: v.strongLabel,
1060
+ change: void 0,
1061
+ total: v.strongLabel
1062
+ };
1063
+ function dt(e) {
1064
+ return (t) => t === 0 ? e(0) : `${t > 0 ? "+" : "−"}${e(Math.abs(t))}`;
1065
+ }
1066
+ function ft({ level: e, formatValue: t, formatChange: n }) {
1067
+ return e.step.kind === "change" && e.step.value !== null ? n(e.step.value) : e.to === null ? "—" : t(e.to);
1068
+ }
1069
+ function pt({ level: e, formatValue: t, formatChange: n }) {
1070
+ return e.step.kind === "change" ? e.step.value === null ? "Unavailable" : n(e.step.value) : e.to === null ? "Unavailable" : t(e.to);
1071
+ }
1072
+ function mt({ level: e, formatValue: t }) {
1073
+ return e.from === null || e.to === null ? "Unavailable" : `${t(e.from)} → ${t(e.to)}`;
1074
+ }
1075
+ var ht = {
1076
+ "x-default-marker": "x-default-marker",
1077
+ $$css: !0
1078
+ };
1079
+ function gt({ title: e, description: t, report: n, steps: r, formatValue: i, formatChange: a = dt(i), formatTick: o = i, domain: c, referenceLines: u = [], selection: d, height: f = rt }) {
1080
+ let { ref: m, width: h, element: _ } = ee(), y = w(), [b, x] = E(), [C, T] = E();
1081
+ te(() => {
1082
+ function e(e) {
1083
+ e.target instanceof Node && _?.contains(e.target) !== !0 && x(void 0);
1084
+ }
1085
+ return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1086
+ }, [_]);
1087
+ let ne = !Number.isFinite(f) || f < 96 ? "Chart height must be at least 96 pixels." : void 0, D = $e(r), A = c ?? et(D), ie = ne ?? tt({
1088
+ steps: r,
1089
+ domain: c
1090
+ }) ?? Q({
1091
+ lines: u,
1092
+ domain: A
1093
+ });
1094
+ if (ie !== void 0) return /* @__PURE__ */ O(g, {
1095
+ title: e,
1096
+ description: t,
1097
+ report: n,
1098
+ message: ie
1099
+ });
1100
+ let M = D.find((e) => e.step.id === b?.id), N = D.find((e) => e.step.id === d?.selectedId), P = D.find((e) => e.step.id === C) ?? N ?? D[0], F = M === void 0 ? void 0 : pt({
1101
+ level: M,
1102
+ formatValue: i,
1103
+ formatChange: a
1104
+ }), I = M?.step.kind === "change" ? [{
1105
+ id: "running",
1106
+ label: "Running total",
1107
+ tone: "neutral",
1108
+ value: mt({
1109
+ level: M,
1110
+ formatValue: i
1111
+ })
1112
+ }] : [], oe = u.map((e) => ({
1113
+ id: e.id,
1114
+ label: e.label,
1115
+ tone: e.tone ?? "neutral",
1116
+ shape: "dashed",
1117
+ value: i(e.value)
1118
+ })), se = M === void 0 ? [] : [...I, ...oe], de = f - at, L = j({
1119
+ domain: [...A],
1120
+ range: [de, it]
1121
+ }), fe = L.ticks(4), R = Math.max(44, ...fe.map((e) => o(e).length * lt + 12)), pe = je({
1122
+ lines: u,
1123
+ formatValue: o
1124
+ }), z = Math.max(R + 1, h - 16 - pe), B = re({
1125
+ domain: D.map((e) => e.step.id),
1126
+ range: [R, z],
1127
+ padding: .28
1128
+ }), me = D.map((e) => ({
1129
+ id: e.step.id,
1130
+ label: e.step.label
1131
+ })), V = Math.max(1, Math.floor((B.step() - 8) / lt));
1132
+ function he(e) {
1133
+ let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * h, r = Math.floor((n - R) / B.step()), i = D[Math.max(0, Math.min(D.length - 1, r))];
1134
+ i !== void 0 && (e.type === "pointerdown" && T(i.step.id), x({
1135
+ id: i.step.id,
1136
+ source: "pointer"
1137
+ }));
1138
+ }
1139
+ function H(e) {
1140
+ let t = e.axisLabel ?? e.label;
1141
+ return t.length > V ? `${t.slice(0, V - 1)}…` : t;
1142
+ }
1143
+ return /* @__PURE__ */ k(p, {
1144
+ title: /* @__PURE__ */ O(ce, {
1145
+ title: e,
1146
+ detail: M === void 0 ? void 0 : `${M.step.label} · ${F ?? ""}`
1147
+ }),
1148
+ description: t,
1149
+ report: n,
1150
+ children: [
1151
+ /* @__PURE__ */ O(s, {
1152
+ label: `${e} steps`,
1153
+ columns: [
1154
+ {
1155
+ id: "step",
1156
+ label: "Step"
1157
+ },
1158
+ {
1159
+ id: "value",
1160
+ label: "Value"
1161
+ },
1162
+ {
1163
+ id: "running",
1164
+ label: "Running total"
1165
+ }
1166
+ ],
1167
+ rows: [...D.map((e) => ({
1168
+ id: e.step.id,
1169
+ values: [
1170
+ e.step.label,
1171
+ pt({
1172
+ level: e,
1173
+ formatValue: i,
1174
+ formatChange: a
1175
+ }),
1176
+ e.step.kind === "change" ? mt({
1177
+ level: e,
1178
+ formatValue: i
1179
+ }) : pt({
1180
+ level: e,
1181
+ formatValue: i,
1182
+ formatChange: a
1183
+ })
1184
+ ]
1185
+ })), ...u.map((e) => ({
1186
+ id: `reference:${e.id}`,
1187
+ values: [
1188
+ e.label,
1189
+ i(e.value),
1190
+ ""
1191
+ ]
1192
+ }))]
1193
+ }),
1194
+ /* @__PURE__ */ O(ue, {
1195
+ id: y,
1196
+ label: M?.step.label,
1197
+ summary: F,
1198
+ legend: [],
1199
+ hasLegend: !1,
1200
+ rows: se,
1201
+ x: (B(M?.step.id ?? "") ?? R) + B.bandwidth() / 2,
1202
+ width: h,
1203
+ offset: B.bandwidth() / 2 + 8,
1204
+ source: b?.source
1205
+ }),
1206
+ /* @__PURE__ */ O("div", {
1207
+ ref: m,
1208
+ ...S.props(v.plot, nt.plot),
1209
+ children: D.length === 0 ? /* @__PURE__ */ O("p", {
1210
+ className: "x153jb6y x1ghz6dp xy8obcc",
1211
+ children: "No steps"
1212
+ }) : /* @__PURE__ */ k(l, {
1213
+ role: "img",
1214
+ "aria-label": `${e}. Use arrow keys to inspect steps.${d === void 0 ? "" : " Press Enter to select."}`,
1215
+ "aria-describedby": y,
1216
+ tabIndex: 0,
1217
+ viewBox: `0 0 ${h} ${f}`,
1218
+ height: f,
1219
+ controls: {
1220
+ items: me,
1221
+ cursor: P?.step.id,
1222
+ inspected: M?.step.id,
1223
+ selected: N?.step.id,
1224
+ readout: le({
1225
+ label: M?.step.label,
1226
+ summary: F,
1227
+ rows: se
1228
+ }),
1229
+ onInspect: (e) => {
1230
+ T(e), x({
1231
+ id: e,
1232
+ source: "keyboard"
1233
+ });
1234
+ },
1235
+ onDismiss: () => x(void 0),
1236
+ onSelect: d?.onSelect
1237
+ },
1238
+ onFocus: (e) => {
1239
+ if (e.currentTarget.matches(":focus-visible")) {
1240
+ let e = N ?? D[0];
1241
+ T(e?.step.id), x(e === void 0 ? void 0 : {
1242
+ id: e.step.id,
1243
+ source: "keyboard"
1244
+ });
1245
+ }
1246
+ },
1247
+ onPointerMove: (e) => {
1248
+ e.pointerType === "mouse" && he(e);
1249
+ },
1250
+ onPointerDown: he,
1251
+ onPointerLeave: (e) => {
1252
+ e.pointerType === "mouse" && b?.source === "pointer" && x(void 0);
1253
+ },
1254
+ onBlur: () => x(void 0),
1255
+ onClick: () => {
1256
+ M !== void 0 && d?.onSelect(M.step.id);
1257
+ },
1258
+ ...S.props(v.svg, v.inspectable, ht),
1259
+ children: [
1260
+ M !== void 0 && /* @__PURE__ */ O("rect", {
1261
+ x: (B(M.step.id) ?? R) - (B.step() - B.bandwidth()) / 2,
1262
+ y: it,
1263
+ width: B.step(),
1264
+ height: de - it,
1265
+ className: "x2wnxhi"
1266
+ }),
1267
+ fe.map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
1268
+ x1: R,
1269
+ x2: z,
1270
+ y1: L(e),
1271
+ y2: L(e),
1272
+ ...S.props(e === 0 ? v.baseline : v.grid)
1273
+ }), /* @__PURE__ */ O("text", {
1274
+ x: R - 8,
1275
+ y: L(e),
1276
+ textAnchor: "end",
1277
+ dominantBaseline: "middle",
1278
+ ...S.props(v.label),
1279
+ children: o(e)
1280
+ })] }, e)),
1281
+ D.map((e, t) => {
1282
+ let n = D[t + 1], r = B(e.step.id) ?? R;
1283
+ return n === void 0 || e.to === null || n.from === null ? null : /* @__PURE__ */ O("line", {
1284
+ x1: r + B.bandwidth(),
1285
+ x2: B(n.step.id) ?? r,
1286
+ y1: L(e.to),
1287
+ y2: L(e.to),
1288
+ className: "x1crw9hw xnpr05h x1ypbokr x13efnbd"
1289
+ }, `connector:${e.step.id}`);
1290
+ }),
1291
+ D.map((e) => /* @__PURE__ */ O(_t, {
1292
+ level: e,
1293
+ x: B(e.step.id) ?? R,
1294
+ width: B.bandwidth(),
1295
+ y: L,
1296
+ bottom: de,
1297
+ height: f,
1298
+ label: ft({
1299
+ level: e,
1300
+ formatValue: i,
1301
+ formatChange: a
1302
+ }),
1303
+ axisLabel: H(e.step),
1304
+ isHighlighted: M?.step.id === e.step.id || N?.step.id === e.step.id
1305
+ }, e.step.id)),
1306
+ /* @__PURE__ */ O(Ne, {
1307
+ lines: u,
1308
+ y: L,
1309
+ left: R,
1310
+ right: z,
1311
+ top: it,
1312
+ bottom: de,
1313
+ formatValue: o
1314
+ }),
1315
+ P !== void 0 && /* @__PURE__ */ O(ae, {
1316
+ x: (B(P.step.id) ?? R) + B.bandwidth() / 2,
1317
+ top: it,
1318
+ bottom: de,
1319
+ width: Math.max(8, B.bandwidth())
1320
+ })
1321
+ ]
1322
+ })
1323
+ })
1324
+ ]
1325
+ });
1326
+ }
1327
+ function _t({ level: t, x: n, width: r, y: i, bottom: a, height: o, label: s, axisLabel: c, isHighlighted: l }) {
1328
+ let u = n + r / 2, d = /* @__PURE__ */ O("text", {
1329
+ x: u,
1330
+ y: o - 4,
1331
+ textAnchor: "middle",
1332
+ ...S.props(v.label),
1333
+ children: c
1334
+ });
1335
+ if (t.from === null || t.to === null) {
1336
+ let e = t.from ?? 0, o = Math.min(a - ct, i(e) - ct / 2);
1337
+ return /* @__PURE__ */ k("g", { children: [
1338
+ /* @__PURE__ */ O("rect", {
1339
+ x: n,
1340
+ y: o,
1341
+ width: r,
1342
+ height: ct,
1343
+ className: "xbh8q5q x1crw9hw xnpr05h x1ypbokr x13efnbd"
1344
+ }),
1345
+ /* @__PURE__ */ O("text", {
1346
+ x: u,
1347
+ y: o - ot,
1348
+ textAnchor: "middle",
1349
+ ...S.props(v.label),
1350
+ children: s
1351
+ }),
1352
+ d
1353
+ ] });
1354
+ }
1355
+ let f = Math.max(t.from, t.to), p = Math.min(t.from, t.to), m = i(f), h = Math.max(1, i(p) - m), g = f <= 0 && p < 0 ? i(p) + st : m - ot;
1356
+ return /* @__PURE__ */ k("g", { children: [
1357
+ /* @__PURE__ */ O("rect", {
1358
+ x: n,
1359
+ y: m,
1360
+ width: r,
1361
+ height: h,
1362
+ ...S.props(nt.bar(e[t.tone]), l && v.selected)
1363
+ }),
1364
+ /* @__PURE__ */ O("text", {
1365
+ x: u,
1366
+ y: g,
1367
+ textAnchor: "middle",
1368
+ ...S.props(v.label, ut[t.step.kind], v.haloLabel),
1369
+ children: s
1370
+ }),
1371
+ d
1372
+ ] });
1373
+ }
632
1374
  // packages/charts/src/cartesian/scatter-plot.tsx
633
- var U = 260, W = 56, G = 20, K = 12, _e = 1e3, q = {
1375
+ var vt = 260, yt = 56, bt = 20, xt = 12, St = 1e3, Ct = {
634
1376
  kzqmXN: "x1xc55vz",
635
1377
  kZKoxP: "xdk7pt",
636
1378
  kaIpWk: "x16rqkct",
637
1379
  $$css: !0
638
- }, J = {
1380
+ }, wt = {
639
1381
  brush: {
640
1382
  kFalU9: "xx69xxh",
641
1383
  kkrTdU: "xsid9ct",
@@ -673,7 +1415,7 @@ var U = 260, W = 56, G = 20, K = 12, _e = 1e3, q = {
673
1415
  "--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
674
1416
  }],
675
1417
  dot: (e) => [
676
- q,
1418
+ Ct,
677
1419
  {
678
1420
  kWkggS: e == null ? e : "xl8spv7",
679
1421
  $$css: !0
@@ -688,77 +1430,77 @@ var U = 260, W = 56, G = 20, K = 12, _e = 1e3, q = {
688
1430
  $$css: !0
689
1431
  }
690
1432
  };
691
- function Y(t) {
692
- let { title: n, report: r, description: i, points: a, xDomain: o, yDomain: l, xLabel: d, yLabel: m, formatX: h, formatY: _, selection: v, rangeSelection: y, emptyLabel: b } = t, S = u({
1433
+ function Tt(t) {
1434
+ let { title: n, report: r, description: i, points: a, xDomain: o, yDomain: l, xLabel: d, yLabel: m, formatX: h, formatY: _, selection: v, rangeSelection: y, emptyLabel: b } = t, x = u({
693
1435
  title: n,
694
1436
  selection: v,
695
1437
  items: a.map((e) => ({
696
1438
  id: e.id,
697
1439
  label: `${e.label}, ${d}: ${h(e.x)}, ${m}: ${_(e.y)}`
698
1440
  }))
699
- }), { ref: C, width: ne } = ee(), w = ve(t);
700
- if (w !== null) return /* @__PURE__ */ D(g, {
1441
+ }), { ref: te, width: w } = ee(), T = Ot(t);
1442
+ if (T !== null) return /* @__PURE__ */ O(g, {
701
1443
  title: n,
702
1444
  report: r,
703
1445
  description: i,
704
- message: w
1446
+ message: T
705
1447
  });
706
- let T = j({
1448
+ let ne = j({
707
1449
  domain: [...o],
708
- range: [W, Math.max(W, ne - G)]
1450
+ range: [yt, Math.max(yt, w - bt)]
709
1451
  }), E = j({
710
1452
  domain: [...l],
711
- range: [216, K]
1453
+ range: [216, xt]
712
1454
  });
713
- return /* @__PURE__ */ O(p, {
1455
+ return /* @__PURE__ */ k(p, {
714
1456
  title: n,
715
1457
  report: r,
716
1458
  description: i,
717
- footer: /* @__PURE__ */ D(f, {
718
- id: S.id,
719
- children: S.label ?? "\xA0"
1459
+ footer: /* @__PURE__ */ O(f, {
1460
+ id: x.id,
1461
+ children: x.label ?? "\xA0"
720
1462
  }),
721
1463
  children: [
722
- a.length === 0 ? /* @__PURE__ */ D("p", {
1464
+ a.length === 0 ? /* @__PURE__ */ O("p", {
723
1465
  className: "x1ghz6dp x153jb6y",
724
1466
  children: b
725
- }) : /* @__PURE__ */ O(c, {
726
- ref: C,
727
- ...S.props,
1467
+ }) : /* @__PURE__ */ k(c, {
1468
+ ref: te,
1469
+ ...x.props,
728
1470
  className: "x1n2onr6 xeuugli",
729
- children: [/* @__PURE__ */ D(X, {
730
- width: ne,
731
- scaleX: T,
1471
+ children: [/* @__PURE__ */ O(Et, {
1472
+ width: w,
1473
+ scaleX: ne,
732
1474
  scaleY: E,
733
1475
  ...t
734
- }, `${o[0]}:${o[1]}:${l[0]}:${l[1]}:${ne}`), a.length > 0 && /* @__PURE__ */ D("div", {
1476
+ }, `${o[0]}:${o[1]}:${l[0]}:${l[1]}:${w}`), a.length > 0 && /* @__PURE__ */ O("div", {
735
1477
  className: "x10l6tqk x10a8y8t x1n71m9f x47corl",
736
1478
  children: a.map((t) => {
737
- let n = S.label !== void 0 && S.activeId === t.id;
738
- return /* @__PURE__ */ D(te, {
1479
+ let n = x.label !== void 0 && x.activeId === t.id;
1480
+ return /* @__PURE__ */ O(C, {
739
1481
  type: "button",
740
1482
  tabIndex: -1,
741
- onPointerEnter: () => S.inspect(t.id),
1483
+ onPointerEnter: () => x.inspect(t.id),
742
1484
  title: t.label,
743
1485
  "aria-label": `${t.label}, ${d}: ${h(t.x)}, ${m}: ${_(t.y)}`,
744
1486
  "aria-pressed": v === void 0 ? void 0 : v.selectedId === t.id,
745
1487
  onClick: () => {
746
- S.inspect(t.id), v?.onSelect(t.id);
1488
+ x.inspect(t.id), v?.onSelect(t.id);
747
1489
  },
748
- ...x.props(J.target, J.location(T(t.x), E(t.y))),
749
- children: /* @__PURE__ */ D("span", {
1490
+ ...S.props(wt.target, wt.location(ne(t.x), E(t.y))),
1491
+ children: /* @__PURE__ */ O("span", {
750
1492
  "aria-hidden": !0,
751
- ...x.props(J.dot(e[t.tone]), (v?.selectedId === t.id || n) && J.selected)
1493
+ ...S.props(wt.dot(e[t.tone]), (v?.selectedId === t.id || n) && wt.selected)
752
1494
  })
753
1495
  }, t.id);
754
1496
  })
755
1497
  })]
756
1498
  }),
757
- y !== void 0 && /* @__PURE__ */ D(Z, {
1499
+ y !== void 0 && /* @__PURE__ */ O(Dt, {
758
1500
  ...t,
759
1501
  rangeSelection: y
760
1502
  }),
761
- /* @__PURE__ */ D(s, {
1503
+ /* @__PURE__ */ O(s, {
762
1504
  label: `${n} points`,
763
1505
  columns: [
764
1506
  {
@@ -786,9 +1528,9 @@ function Y(t) {
786
1528
  ]
787
1529
  });
788
1530
  }
789
- function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, formatY: o, rangeSelection: s }) {
790
- let c = C(), [l, u] = T(null), d = w(null);
791
- S(() => () => d.current?.(), []);
1531
+ function Et({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, formatY: o, rangeSelection: s }) {
1532
+ let c = w(), [l, u] = E(null), d = ne(null);
1533
+ te(() => () => d.current?.(), []);
792
1534
  let f = l === null ? s?.value : {
793
1535
  x: [Math.min(l.start.x, l.end.x), Math.max(l.start.x, l.end.x)],
794
1536
  y: [Math.min(l.start.y, l.end.y), Math.max(l.start.y, l.end.y)]
@@ -796,21 +1538,21 @@ function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, f
796
1538
  function p(r, i, a) {
797
1539
  return {
798
1540
  x: t.copy().clamp(!0).invert((i - r.left) / r.width * e),
799
- y: n.copy().clamp(!0).invert((a - r.top) / r.height * U)
1541
+ y: n.copy().clamp(!0).invert((a - r.top) / r.height * vt)
800
1542
  };
801
1543
  }
802
1544
  function m(t) {
803
1545
  let n = t.button === 0 && t.pointerType !== "touch";
804
1546
  if (s === void 0 || d.current !== null || !n) return;
805
- let r = t.currentTarget.getBoundingClientRect(), i = (t.clientX - r.left) / r.width * e, a = (t.clientY - r.top) / r.height * U;
806
- if (i < W || i > e - G || a < K || a > 216) return;
1547
+ let r = t.currentTarget.getBoundingClientRect(), i = (t.clientX - r.left) / r.width * e, a = (t.clientY - r.top) / r.height * vt;
1548
+ if (i < yt || i > e - bt || a < xt || a > 216) return;
807
1549
  let o = t.currentTarget, c = o.parentElement;
808
1550
  if (c === null) return;
809
1551
  let l = p(r, t.clientX, t.clientY);
810
1552
  u({
811
1553
  start: l,
812
1554
  end: l
813
- }), d.current = k(c, t.nativeEvent, {
1555
+ }), d.current = A(c, t.nativeEvent, {
814
1556
  cancelOnEscape: !0,
815
1557
  onMove: ({ x: e, y: t }) => u({
816
1558
  start: l,
@@ -826,67 +1568,67 @@ function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, f
826
1568
  }
827
1569
  });
828
1570
  }
829
- return /* @__PURE__ */ O("svg", {
1571
+ return /* @__PURE__ */ k("svg", {
830
1572
  width: e,
831
- height: U,
832
- viewBox: `0 0 ${e} ${U}`,
1573
+ height: vt,
1574
+ viewBox: `0 0 ${e} ${vt}`,
833
1575
  "aria-hidden": !0,
834
1576
  onPointerDown: m,
835
- ...x.props(v.svg, s !== void 0 && J.brush),
1577
+ ...S.props(v.svg, s !== void 0 && wt.brush),
836
1578
  children: [
837
- /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", {
1579
+ /* @__PURE__ */ O("defs", { children: /* @__PURE__ */ O("clipPath", {
838
1580
  id: c,
839
- children: /* @__PURE__ */ D("rect", {
840
- x: W,
841
- y: K,
842
- width: Math.max(0, e - W - G),
1581
+ children: /* @__PURE__ */ O("rect", {
1582
+ x: yt,
1583
+ y: xt,
1584
+ width: Math.max(0, e - yt - bt),
843
1585
  height: 204
844
1586
  })
845
1587
  }) }),
846
- t.ticks(5).map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
1588
+ t.ticks(5).map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
847
1589
  x1: t(e),
848
1590
  x2: t(e),
849
- y1: K,
1591
+ y1: xt,
850
1592
  y2: 216,
851
- ...x.props(v.grid)
852
- }), /* @__PURE__ */ D("text", {
1593
+ ...S.props(v.grid)
1594
+ }), /* @__PURE__ */ O("text", {
853
1595
  x: t(e),
854
1596
  y: 234,
855
1597
  textAnchor: "middle",
856
- ...x.props(v.label),
1598
+ ...S.props(v.label),
857
1599
  children: a(e)
858
1600
  })] }, e)),
859
- n.ticks(4).map((t) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
860
- x1: W,
861
- x2: e - G,
1601
+ n.ticks(4).map((t) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
1602
+ x1: yt,
1603
+ x2: e - bt,
862
1604
  y1: n(t),
863
1605
  y2: n(t),
864
- ...x.props(v.grid)
865
- }), /* @__PURE__ */ D("text", {
1606
+ ...S.props(v.grid)
1607
+ }), /* @__PURE__ */ O("text", {
866
1608
  x: 48,
867
1609
  y: n(t) + 4,
868
1610
  textAnchor: "end",
869
- ...x.props(v.label),
1611
+ ...S.props(v.label),
870
1612
  children: o(t)
871
1613
  })] }, t)),
872
- /* @__PURE__ */ D("text", {
873
- x: (W + e - G) / 2,
1614
+ /* @__PURE__ */ O("text", {
1615
+ x: (yt + e - bt) / 2,
874
1616
  y: 256,
875
1617
  textAnchor: "middle",
876
- ...x.props(v.label),
1618
+ ...S.props(v.label),
877
1619
  children: r
878
1620
  }),
879
- /* @__PURE__ */ D("text", {
1621
+ /* @__PURE__ */ O("text", {
880
1622
  x: 12,
881
1623
  y: 108,
882
1624
  textAnchor: "middle",
883
1625
  transform: "rotate(-90 12 108)",
884
- ...x.props(v.label),
1626
+ ...S.props(v.label),
885
1627
  children: i
886
1628
  }),
887
- /* @__PURE__ */ D("g", {
1629
+ /* @__PURE__ */ O("g", {
888
1630
  clipPath: `url(#${c})`,
889
- children: f != null && /* @__PURE__ */ D("rect", {
1631
+ children: f != null && /* @__PURE__ */ O("rect", {
890
1632
  x: t(f.x[0]),
891
1633
  y: n(f.y[1]),
892
1634
  width: t(f.x[1]) - t(f.x[0]),
@@ -897,19 +1639,19 @@ function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, f
897
1639
  ]
898
1640
  });
899
1641
  }
900
- function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
1642
+ function Dt({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
901
1643
  let s = e.value ?? {
902
1644
  x: t,
903
1645
  y: n
904
1646
  };
905
- return /* @__PURE__ */ O("fieldset", {
1647
+ return /* @__PURE__ */ k("fieldset", {
906
1648
  className: "xrvj5dj x1n8ia3y x1xxf3xd xc342km x1717udv xeuugli",
907
1649
  children: [
908
- /* @__PURE__ */ D("legend", {
1650
+ /* @__PURE__ */ O("legend", {
909
1651
  className: "x153jb6y xy8obcc x1jfksii",
910
1652
  children: "Drag with a mouse, or adjust these bounds to select a coordinate range."
911
1653
  }),
912
- /* @__PURE__ */ O(b.Root, {
1654
+ /* @__PURE__ */ k(x.Root, {
913
1655
  value: [...s.x],
914
1656
  format: a,
915
1657
  min: t[0],
@@ -920,26 +1662,26 @@ function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
920
1662
  x: t,
921
1663
  y: s.y
922
1664
  }),
923
- children: [/* @__PURE__ */ O("div", {
1665
+ children: [/* @__PURE__ */ k("div", {
924
1666
  className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
925
- children: [/* @__PURE__ */ D(b.Label, { children: r }), /* @__PURE__ */ O("span", { children: [
1667
+ children: [/* @__PURE__ */ O(x.Label, { children: r }), /* @__PURE__ */ k("span", { children: [
926
1668
  a(s.x[0]),
927
1669
  " – ",
928
1670
  a(s.x[1])
929
1671
  ] })]
930
- }), /* @__PURE__ */ D(b.Control, { children: /* @__PURE__ */ O(b.Track, { children: [
931
- /* @__PURE__ */ D(b.Indicator, {}),
932
- /* @__PURE__ */ D(b.Thumb, {
1672
+ }), /* @__PURE__ */ O(x.Control, { children: /* @__PURE__ */ k(x.Track, { children: [
1673
+ /* @__PURE__ */ O(x.Indicator, {}),
1674
+ /* @__PURE__ */ O(x.Thumb, {
933
1675
  index: 0,
934
1676
  "aria-label": `${r} minimum`
935
1677
  }),
936
- /* @__PURE__ */ D(b.Thumb, {
1678
+ /* @__PURE__ */ O(x.Thumb, {
937
1679
  index: 1,
938
1680
  "aria-label": `${r} maximum`
939
1681
  })
940
1682
  ] }) })]
941
1683
  }),
942
- /* @__PURE__ */ O(b.Root, {
1684
+ /* @__PURE__ */ k(x.Root, {
943
1685
  value: [...s.y],
944
1686
  format: o,
945
1687
  min: n[0],
@@ -950,26 +1692,26 @@ function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
950
1692
  x: s.x,
951
1693
  y: t
952
1694
  }),
953
- children: [/* @__PURE__ */ O("div", {
1695
+ children: [/* @__PURE__ */ k("div", {
954
1696
  className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
955
- children: [/* @__PURE__ */ D(b.Label, { children: i }), /* @__PURE__ */ O("span", { children: [
1697
+ children: [/* @__PURE__ */ O(x.Label, { children: i }), /* @__PURE__ */ k("span", { children: [
956
1698
  o(s.y[0]),
957
1699
  " – ",
958
1700
  o(s.y[1])
959
1701
  ] })]
960
- }), /* @__PURE__ */ D(b.Control, { children: /* @__PURE__ */ O(b.Track, { children: [
961
- /* @__PURE__ */ D(b.Indicator, {}),
962
- /* @__PURE__ */ D(b.Thumb, {
1702
+ }), /* @__PURE__ */ O(x.Control, { children: /* @__PURE__ */ k(x.Track, { children: [
1703
+ /* @__PURE__ */ O(x.Indicator, {}),
1704
+ /* @__PURE__ */ O(x.Thumb, {
963
1705
  index: 0,
964
1706
  "aria-label": `${i} minimum`
965
1707
  }),
966
- /* @__PURE__ */ D(b.Thumb, {
1708
+ /* @__PURE__ */ O(x.Thumb, {
967
1709
  index: 1,
968
1710
  "aria-label": `${i} maximum`
969
1711
  })
970
1712
  ] }) })]
971
1713
  }),
972
- /* @__PURE__ */ D(y, {
1714
+ /* @__PURE__ */ O(b, {
973
1715
  type: "button",
974
1716
  disabled: e.value === null,
975
1717
  onClick: () => e.onChange(null),
@@ -978,9 +1720,9 @@ function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
978
1720
  ]
979
1721
  });
980
1722
  }
981
- function ve({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
1723
+ function Ot({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
982
1724
  if (!h(t) || !h(n)) return "Scatter domains must contain finite, increasing endpoints.";
983
- if (e.length > 1e3) return `This plot exceeds the ${_e}-point render limit. Supply a smaller, labelled sample.`;
1725
+ if (e.length > 1e3) return `This plot exceeds the ${St}-point render limit. Supply a smaller, labelled sample.`;
984
1726
  if (!m(e)) return "Scatter points must have unique identifiers.";
985
1727
  if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
986
1728
  if (e.some((e) => {
@@ -991,9 +1733,9 @@ function ve({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
991
1733
  let i = Number.isFinite(r.xStep) && r.xStep > 0 && r.xStep <= t[1] - t[0], a = Number.isFinite(r.yStep) && r.yStep > 0 && r.yStep <= n[1] - n[0];
992
1734
  if (!i || !a) return "Range selection steps must be finite, positive, and no larger than their domain span.";
993
1735
  let o = r.value;
994
- return o === null ? null : !Q(o.x, t) || !Q(o.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
1736
+ return o === null ? null : !kt(o.x, t) || !kt(o.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
995
1737
  }
996
- function Q(e, t) {
1738
+ function kt(e, t) {
997
1739
  return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
998
1740
  }
999
1741
  // packages/charts/src/cartesian/time-series-data.ts
@@ -1002,7 +1744,7 @@ var $ = {
1002
1744
  pointsPerSeries: 2e3,
1003
1745
  markers: 200,
1004
1746
  panels: 12
1005
- }, ye = .01, be = [
1747
+ }, At = .01, jt = [
1006
1748
  "series1",
1007
1749
  "series2",
1008
1750
  "series3",
@@ -1010,31 +1752,40 @@ var $ = {
1010
1752
  "series5",
1011
1753
  "series6"
1012
1754
  ];
1013
- function xe({ series: e, isStacked: t, markers: n }) {
1014
- let r = e[0]?.points.map((e) => e.timestamp) ?? [];
1015
- if (e.length > $.series || r.length > $.pointsPerSeries || n.length > $.markers) return `Choose a window with at most ${$.series} series, ${$.pointsPerSeries} observations per series, and ${$.markers} markers.`;
1755
+ function Mt({ series: e, isStacked: t, markers: n, timeline: r = [] }) {
1756
+ let i = e[0]?.points.map((e) => e.timestamp) ?? r;
1757
+ if (e.length > $.series || i.length > $.pointsPerSeries || n.length > $.markers) return `Choose a window with at most ${$.series} series, ${$.pointsPerSeries} observations per series, and ${$.markers} markers.`;
1016
1758
  if (!m(e) || !m(n)) return "Series and markers require unique identifiers.";
1017
1759
  for (let n of e) {
1018
- if (n.points.length !== r.length) return "Every series must supply the same observation timestamps.";
1019
- let e = Te({
1760
+ if (n.points.length !== i.length) return "Every series must supply the same observation timestamps.";
1761
+ let e = Lt({
1020
1762
  points: n.points,
1021
- timestamps: r,
1763
+ timestamps: i,
1022
1764
  isStacked: t
1023
1765
  });
1024
1766
  if (e !== void 0) return e;
1025
1767
  }
1026
1768
  for (let t of n) {
1027
- if (!r.includes(t.timestamp)) return "Every marker must align with an observation timestamp.";
1028
- if (t.kind === "point") {
1029
- let n = e.find((e) => e.id === t.seriesId)?.points.find((e) => e.timestamp === t.timestamp);
1030
- if (n === void 0 || n.value !== t.value) return "Point markers must reference the recorded series value.";
1031
- }
1769
+ let n = Nt({
1770
+ marker: t,
1771
+ series: e,
1772
+ timestamps: i
1773
+ });
1774
+ if (n !== void 0) return n;
1775
+ }
1776
+ let a = e.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value])), o = Math.max(0, ...a) - Math.min(0, ...a), s = (i.at(-1) ?? 0) - (i[0] ?? 0);
1777
+ if (!Number.isFinite(o) || !Number.isFinite(s)) return "The elapsed-time and value ranges must be finite.";
1778
+ if (t && i.some((t, n) => !Number.isFinite(e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)))) return "Stacked observation totals must be finite.";
1779
+ }
1780
+ function Nt({ marker: e, series: t, timestamps: n }) {
1781
+ if (e.kind === "event") {
1782
+ let t = n[0] ?? 0, r = n.at(-1) ?? t, i = e.timestamp >= t && e.timestamp <= r;
1783
+ return Number.isFinite(e.timestamp) && i ? void 0 : "Every event marker must fall inside the observed time range.";
1032
1784
  }
1033
- let i = e.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value])), a = Math.max(0, ...i) - Math.min(0, ...i), o = (r.at(-1) ?? 0) - (r[0] ?? 0);
1034
- if (!Number.isFinite(a) || !Number.isFinite(o)) return "The elapsed-time and value ranges must be finite.";
1035
- if (t && r.some((t, n) => !Number.isFinite(e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)))) return "Stacked observation totals must be finite.";
1785
+ if (!n.includes(e.timestamp)) return "Every time and point marker must align with an observation timestamp.";
1786
+ if (e.kind !== "time") return t.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.value === e.value ? void 0 : "Point markers must reference the recorded series value.";
1036
1787
  }
1037
- function Se({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1788
+ function Pt({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1038
1789
  return JSON.stringify([
1039
1790
  n,
1040
1791
  r,
@@ -1054,15 +1805,15 @@ function Se({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1054
1805
  ])
1055
1806
  ]);
1056
1807
  }
1057
- function Ce(e, t, n = !1) {
1808
+ function Ft(e, t, n = !1) {
1058
1809
  if (e !== t) return [e, t];
1059
- let r = Math.max(1, Math.abs(e) * ye), i = n ? 0 : e - r, a = t + r;
1810
+ let r = Math.max(1, Math.abs(e) * At), i = n ? 0 : e - r, a = t + r;
1060
1811
  return [Number.isFinite(i) ? i : e, Number.isFinite(a) ? a : t];
1061
1812
  }
1062
- function we(e, t) {
1813
+ function It(e, t) {
1063
1814
  let n = e.filter((e) => e.tone === void 0);
1064
1815
  return e.map((r, i) => {
1065
- let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? be[a % be.length] ?? "series1", s = r.points.map((n, r) => {
1816
+ let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? jt[a % jt.length] ?? "series1", s = r.points.map((n, r) => {
1066
1817
  let a = t ? e.slice(0, i).reduce((e, t) => e + (t.points[r]?.value ?? 0), 0) : 0;
1067
1818
  return {
1068
1819
  ...n,
@@ -1077,7 +1828,7 @@ function we(e, t) {
1077
1828
  };
1078
1829
  });
1079
1830
  }
1080
- function Te({ points: e, timestamps: t, isStacked: n }) {
1831
+ function Lt({ points: e, timestamps: t, isStacked: n }) {
1081
1832
  for (let [r, i] of e.entries()) {
1082
1833
  let a = e[r - 1], o = a !== void 0 && i.timestamp <= a.timestamp;
1083
1834
  if (!Number.isFinite(i.timestamp) || i.timestamp !== t[r] || o) return "Observation timestamps must be finite, aligned, and strictly increasing.";
@@ -1086,19 +1837,19 @@ function Te({ points: e, timestamps: t, isStacked: n }) {
1086
1837
  }
1087
1838
  }
1088
1839
  // packages/charts/src/cartesian/time-series-line.tsx
1089
- function Ee({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }) {
1090
- return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(ie, {
1840
+ function Rt({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }) {
1841
+ return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(P, {
1091
1842
  data: [...t.points],
1092
1843
  defined: (e) => e.value !== null,
1093
1844
  x: (e) => n(e.timestamp),
1094
1845
  y: (e) => r((e.value ?? 0) + e.base),
1095
1846
  stroke: e[t.tone],
1096
- ...x.props(v.mark)
1847
+ ...S.props(v.mark)
1097
1848
  }), t.points.filter((e, n) => {
1098
1849
  if (e.value === null) return !1;
1099
1850
  let r = t.points[n - 1]?.value === null || t.points[n + 1]?.value === null;
1100
1851
  return t.points.length === 1 || r || e.timestamp === i;
1101
- }).map((i) => /* @__PURE__ */ D("circle", {
1852
+ }).map((i) => /* @__PURE__ */ O("circle", {
1102
1853
  cx: n(i.timestamp),
1103
1854
  cy: r((i.value ?? 0) + i.base),
1104
1855
  r: a,
@@ -1106,82 +1857,370 @@ function Ee({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }
1106
1857
  }, i.timestamp))] });
1107
1858
  }
1108
1859
  // packages/charts/src/cartesian/sparkline.tsx
1109
- function De({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
1110
- let o = C(), s = C(), c = Oe({
1111
- title: e,
1112
- summary: t,
1113
- unit: n,
1114
- series: i,
1115
- valueDomain: a
1116
- }), l = i.points.some((e) => e.value !== null);
1117
- if (c !== void 0 || !l) return /* @__PURE__ */ D("span", {
1860
+ var zt = {
1861
+ minimum: "Lowest",
1862
+ maximum: "Highest",
1863
+ last: "Latest"
1864
+ }, Bt = 2.5;
1865
+ function Vt({ points: e, marked: t }) {
1866
+ let n = e.flatMap((e) => e.value === null ? [] : [{
1867
+ ...e,
1868
+ value: e.value
1869
+ }]), r = n.map((e) => e.value), i = {
1870
+ minimum: n.find((e) => e.value === Math.min(...r)),
1871
+ maximum: n.find((e) => e.value === Math.max(...r)),
1872
+ last: n.at(-1)
1873
+ };
1874
+ return t.flatMap((e) => {
1875
+ let t = i[e];
1876
+ return t === void 0 ? [] : [{
1877
+ kind: e,
1878
+ point: t
1879
+ }];
1880
+ });
1881
+ }
1882
+ function Ht({ title: t, summary: n, unit: r, timestampUnit: i, series: a, valueDomain: o, markedPoints: s = [], baseline: c }) {
1883
+ let l = w(), u = w(), d = Ut({
1884
+ title: t,
1885
+ summary: n,
1886
+ unit: r,
1887
+ series: a,
1888
+ valueDomain: o,
1889
+ markedPoints: s,
1890
+ baseline: c
1891
+ }), f = a.points.some((e) => e.value !== null);
1892
+ if (d !== void 0 || !f) return /* @__PURE__ */ O("span", {
1118
1893
  role: "img",
1119
- "aria-label": `${e}. ${t} Values in ${n}; timestamps in ${r}. ${c ?? "No recorded values. Missing observations remain unavailable."}`,
1120
- title: c ?? "No recorded values",
1894
+ "aria-label": `${t}. ${n} Values in ${r}; timestamps in ${i}. ${d ?? "No recorded values. Missing observations remain unavailable."}`,
1895
+ title: d ?? "No recorded values",
1121
1896
  className: "x2pejg6 x10w6t97 x2lah0s xxymvpz x3nfvp2 x6s0dn4 xl56j7k x153jb6y x1hz01jw xy8obcc",
1122
- children: c === void 0 ? "No data" : "Invalid trend"
1897
+ children: d === void 0 ? "No data" : "Invalid trend"
1123
1898
  });
1124
- let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f = j({
1125
- domain: [...Ce(u, d)],
1899
+ let p = a.points[0]?.timestamp ?? 0, m = a.points.at(-1)?.timestamp ?? p, h = j({
1900
+ domain: [...Ft(p, m)],
1126
1901
  range: [3, 125]
1127
- }), p = j({
1128
- domain: [...a],
1902
+ }), g = j({
1903
+ domain: [...o],
1129
1904
  range: [29, 3]
1130
- }), m = we([i], !1)[0];
1131
- return /* @__PURE__ */ O("svg", {
1905
+ }), _ = It([a], !1)[0], v = e[_?.tone ?? "series1"], ee = Vt({
1906
+ points: a.points,
1907
+ marked: s
1908
+ }), y = ee.map(({ kind: e, point: t }) => `${zt[e]}: ${t.value} ${r}.`).join(" "), b = c === void 0 ? "" : `Reference: ${c} ${r}.`;
1909
+ return /* @__PURE__ */ k("svg", {
1132
1910
  role: "img",
1133
- "aria-labelledby": o,
1134
- "aria-describedby": s,
1911
+ "aria-labelledby": l,
1912
+ "aria-describedby": u,
1135
1913
  focusable: "false",
1136
1914
  viewBox: "0 0 128 32",
1137
1915
  width: 128,
1138
1916
  height: 32,
1139
1917
  className: "x1rg5ohu x2pejg6 x10w6t97 x2lah0s xxymvpz",
1140
1918
  children: [
1141
- /* @__PURE__ */ D("title", {
1142
- id: o,
1143
- children: e
1919
+ /* @__PURE__ */ O("title", {
1920
+ id: l,
1921
+ children: t
1144
1922
  }),
1145
- /* @__PURE__ */ O("desc", {
1146
- id: s,
1923
+ /* @__PURE__ */ k("desc", {
1924
+ id: u,
1147
1925
  children: [
1148
- t,
1149
- " Values in ",
1150
1926
  n,
1151
- "; timestamps in ",
1927
+ " Values in ",
1152
1928
  r,
1929
+ "; timestamps in ",
1930
+ i,
1153
1931
  ". Displayed value domain: ",
1154
- a[0],
1932
+ o[0],
1155
1933
  " to",
1156
1934
  " ",
1157
- a[1],
1935
+ o[1],
1158
1936
  " ",
1159
- n,
1160
- "."
1937
+ r,
1938
+ ". ",
1939
+ y,
1940
+ " ",
1941
+ b
1161
1942
  ]
1162
1943
  }),
1163
- m !== void 0 && /* @__PURE__ */ D(Ee, {
1164
- series: m,
1165
- x: f,
1166
- y: p,
1944
+ c !== void 0 && /* @__PURE__ */ O("line", {
1945
+ x1: 3,
1946
+ x2: 125,
1947
+ y1: g(c),
1948
+ y2: g(c),
1949
+ className: "x1crw9hw xnpr05h xbw2l0c x13efnbd"
1950
+ }),
1951
+ _ !== void 0 && /* @__PURE__ */ O(Rt, {
1952
+ series: _,
1953
+ x: h,
1954
+ y: g,
1167
1955
  pointRadius: 2
1168
- })
1956
+ }),
1957
+ ee.map(({ kind: e, point: t }) => e === "last" ? /* @__PURE__ */ O("circle", {
1958
+ cx: h(t.timestamp),
1959
+ cy: g(t.value),
1960
+ r: Bt,
1961
+ fill: v
1962
+ }, e) : /* @__PURE__ */ O("circle", {
1963
+ cx: h(t.timestamp),
1964
+ cy: g(t.value),
1965
+ r: Bt,
1966
+ stroke: v,
1967
+ className: "x1fytgo2 x1r6sdyr x13efnbd"
1968
+ }, e))
1169
1969
  ]
1170
1970
  });
1171
1971
  }
1172
- function Oe({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
1972
+ function Ut({ title: e, summary: t, unit: n, series: r, valueDomain: i, markedPoints: a, baseline: o }) {
1173
1973
  if (e.trim() === "" || t.trim() === "" || n.trim() === "") return "A trend requires a title, a readable summary, and a value unit.";
1174
1974
  if (!h(i)) return "The displayed value domain must have finite, increasing bounds.";
1175
- let a = xe({
1975
+ let s = Mt({
1176
1976
  series: [r],
1177
1977
  isStacked: !1,
1178
1978
  markers: []
1179
1979
  });
1180
- if (a !== void 0) return a;
1980
+ if (s !== void 0) return s;
1181
1981
  if (r.points.some((e) => e.value !== null && (e.value < i[0] || e.value > i[1]))) return "Every recorded value must be inside the declared value domain.";
1982
+ if (new Set(a).size !== a.length) return "Mark each recorded point at most once.";
1983
+ if (!(o === void 0 || o >= i[0] && o <= i[1])) return "The reference value must be inside the declared value domain.";
1984
+ }
1985
+ // packages/charts/src/cartesian/time-series-bands.ts
1986
+ var Wt = {
1987
+ bands: 4,
1988
+ crossings: 4
1989
+ }, Gt = [
1990
+ "series1",
1991
+ "series2",
1992
+ "series3",
1993
+ "series4",
1994
+ "series5",
1995
+ "series6"
1996
+ ];
1997
+ function Kt(e) {
1998
+ let t = [
1999
+ e.lower,
2000
+ e.center,
2001
+ e.upper
2002
+ ].filter((e) => e !== null);
2003
+ return t.some((e) => !Number.isFinite(e)) ? "Band values must be finite numbers or explicit missing values." : e.lower === null == (e.upper === null) ? t.every((e, n) => n === 0 || (t[n - 1] ?? e) <= e) ? void 0 : "Band values must satisfy lower ≤ center ≤ upper." : "A band observation needs both bounds or neither.";
2004
+ }
2005
+ function qt({ bands: e, crossings: t, series: n, timestamps: r }) {
2006
+ if (e.length > Wt.bands || t.length > Wt.crossings) return `Supply at most ${Wt.bands} bands and ${Wt.crossings} crossings.`;
2007
+ if (!m([...n, ...e]) || !m(t)) return "Series, bands, and crossings require unique identifiers.";
2008
+ for (let t of e) {
2009
+ if (t.points.length !== r.length || t.points.some((e, t) => e.timestamp !== r[t])) return "Every band must supply the same observation timestamps as the series.";
2010
+ let e = t.points.map(Kt).find((e) => e !== void 0);
2011
+ if (e !== void 0) return e;
2012
+ }
2013
+ let i = new Set([...n, ...e].map((e) => e.id));
2014
+ for (let e of t) if (!(i.has(e.seriesId) && e.label.trim() !== "") || !Number.isFinite(e.value)) return "Each crossing needs a label, a finite value, and a supplied series or band.";
2015
+ }
2016
+ function Jt({ series: e, bands: t }) {
2017
+ let n = e.filter((e) => e.tone === void 0).length, r = t.filter((e) => e.tone === void 0);
2018
+ return t.map((e) => {
2019
+ let t = n + r.findIndex((t) => t.id === e.id);
2020
+ return {
2021
+ ...e,
2022
+ tone: e.tone ?? Gt[t % Gt.length] ?? "series1"
2023
+ };
2024
+ });
2025
+ }
2026
+ function Yt({ start: e, end: t, value: n, direction: r }) {
2027
+ let i = e > n && t <= n, a = e < n && t >= n;
2028
+ switch (r) {
2029
+ case "falling": return i;
2030
+ case "rising": return a;
2031
+ case void 0: return i || a;
2032
+ }
2033
+ }
2034
+ function Xt({ points: e, crossing: t }) {
2035
+ let n = e.flatMap((t, n) => {
2036
+ let r = e[n + 1];
2037
+ return t.value === null || r === void 0 || r.value === null ? [] : [{
2038
+ start: t.timestamp,
2039
+ end: r.timestamp,
2040
+ from: t.value,
2041
+ to: r.value
2042
+ }];
2043
+ }).find(({ from: e, to: n }) => Yt({
2044
+ start: e,
2045
+ end: n,
2046
+ value: t.value,
2047
+ direction: t.direction
2048
+ }));
2049
+ if (n === void 0) return;
2050
+ let r = (t.value - n.from) / (n.to - n.from);
2051
+ return n.start + r * (n.end - n.start);
2052
+ }
2053
+ function Zt({ crossings: e, series: t, bands: n }) {
2054
+ return e.map((e) => ({
2055
+ crossing: e,
2056
+ timestamp: Xt({
2057
+ points: t.find((t) => t.id === e.seriesId)?.points ?? n.find((t) => t.id === e.seriesId)?.points.map((e) => ({
2058
+ timestamp: e.timestamp,
2059
+ value: e.center
2060
+ })) ?? [],
2061
+ crossing: e
2062
+ })
2063
+ }));
2064
+ }
2065
+ function Qt(e, t) {
2066
+ let n = Math.min(...e.map((e) => Math.abs(e - t)));
2067
+ return e.find((e) => Math.abs(e - t) === n);
2068
+ }
2069
+ function $t(e) {
2070
+ return e.flatMap((e) => e.points.flatMap((e) => [
2071
+ e.lower,
2072
+ e.center,
2073
+ e.upper
2074
+ ].filter((e) => e !== null)));
2075
+ }
2076
+ // packages/charts/src/cartesian/time-series-overlays.tsx
2077
+ var en = {
2078
+ kDd8S0: "x1bsw5e1",
2079
+ kfJifR: "xnpr05h",
2080
+ kDwRjp: "xbh8q5q",
2081
+ $$css: !0
2082
+ }, tn = {
2083
+ kVYP8I: "xd6etog",
2084
+ $$css: !0
2085
+ }, nn = {
2086
+ kfJifR: "xvlca1e",
2087
+ kDwRjp: "xbh8q5q",
2088
+ kREpy8: "x13efnbd",
2089
+ $$css: !0
2090
+ }, rn = {
2091
+ bandEdge: (e) => [
2092
+ en,
2093
+ {
2094
+ kjVXCG: e == null ? e : "x6mkzkt",
2095
+ $$css: !0
2096
+ },
2097
+ { "--x-stroke": e ?? void 0 }
2098
+ ],
2099
+ bandFill: (e) => [
2100
+ tn,
2101
+ {
2102
+ kDwRjp: e == null ? e : "x19zyb68",
2103
+ $$css: !0
2104
+ },
2105
+ { "--x-fill": e ?? void 0 }
2106
+ ],
2107
+ center: (e) => [
2108
+ nn,
2109
+ {
2110
+ kjVXCG: e == null ? e : "x6mkzkt",
2111
+ $$css: !0
2112
+ },
2113
+ { "--x-stroke": e ?? void 0 }
2114
+ ]
2115
+ }, an = 16, on = 6, sn = 6.5, cn = 2.5, ln = 4, un = 12;
2116
+ function dn({ instants: e, x: t, right: n, ends: r }) {
2117
+ let [i, ...a] = e;
2118
+ if (i === void 0) return [];
2119
+ let o = t(i.timestamp), s = i.label.length * sn + on, c = o + s > n ? "end" : "start", l = c === "start" ? o : o - s, u = c === "start" ? o + s : o, d = r.findIndex((e) => l > e), f = d === -1 ? Math.min(r.length, 1) : d, p = [
2120
+ ...r.slice(0, f),
2121
+ Math.max(u, r[f] ?? u),
2122
+ ...r.slice(f + 1)
2123
+ ];
2124
+ return [{
2125
+ ...i,
2126
+ lane: f,
2127
+ anchor: c
2128
+ }, ...dn({
2129
+ instants: a,
2130
+ x: t,
2131
+ right: n,
2132
+ ends: p
2133
+ })];
2134
+ }
2135
+ function fn({ instants: e, x: t, right: n }) {
2136
+ return dn({
2137
+ instants: e.toSorted((e, t) => e.timestamp - t.timestamp),
2138
+ x: t,
2139
+ right: n,
2140
+ ends: []
2141
+ });
2142
+ }
2143
+ function pn(e) {
2144
+ return un + Math.max(0, ...e.map((e) => e.lane + 1)) * an;
2145
+ }
2146
+ function mn(e) {
2147
+ return e.lower !== null && e.upper !== null;
2148
+ }
2149
+ function hn({ bands: t, x: n, y: r }) {
2150
+ return /* @__PURE__ */ O("g", { children: t.map((t) => {
2151
+ let i = e[t.tone], a = [...t.points];
2152
+ return /* @__PURE__ */ k("g", { children: [
2153
+ /* @__PURE__ */ O(ie, {
2154
+ data: a,
2155
+ defined: mn,
2156
+ x: (e) => n(e.timestamp),
2157
+ y0: (e) => r(e.lower ?? 0),
2158
+ y1: (e) => r(e.upper ?? 0),
2159
+ ...S.props(rn.bandFill(i))
2160
+ }),
2161
+ /* @__PURE__ */ O(P, {
2162
+ data: a,
2163
+ defined: mn,
2164
+ x: (e) => n(e.timestamp),
2165
+ y: (e) => r(e.upper ?? 0),
2166
+ ...S.props(rn.bandEdge(i))
2167
+ }),
2168
+ /* @__PURE__ */ O(P, {
2169
+ data: a,
2170
+ defined: mn,
2171
+ x: (e) => n(e.timestamp),
2172
+ y: (e) => r(e.lower ?? 0),
2173
+ ...S.props(rn.bandEdge(i))
2174
+ }),
2175
+ /* @__PURE__ */ O(P, {
2176
+ data: a,
2177
+ defined: (e) => e.center !== null,
2178
+ x: (e) => n(e.timestamp),
2179
+ y: (e) => r(e.center ?? 0),
2180
+ ...S.props(rn.center(i))
2181
+ })
2182
+ ] }, t.id);
2183
+ }) });
2184
+ }
2185
+ function gn({ placed: e, x: t, y: n, bottom: r }) {
2186
+ return /* @__PURE__ */ O("g", {
2187
+ "aria-hidden": !0,
2188
+ children: e.map((e) => {
2189
+ let i = t(e.timestamp), a = un + e.lane * an, o = e.anchor === "start" ? i + on : i - on;
2190
+ return /* @__PURE__ */ k("g", { children: [
2191
+ /* @__PURE__ */ O("line", {
2192
+ x1: i,
2193
+ x2: i,
2194
+ y1: a,
2195
+ y2: r,
2196
+ className: "xhq4mlf xnpr05h x1bpwu3k x13efnbd"
2197
+ }),
2198
+ /* @__PURE__ */ O("circle", {
2199
+ cx: i,
2200
+ cy: a,
2201
+ r: cn,
2202
+ className: "xlrhuyr"
2203
+ }),
2204
+ /* @__PURE__ */ O("text", {
2205
+ x: o,
2206
+ y: a,
2207
+ textAnchor: e.anchor,
2208
+ dominantBaseline: "middle",
2209
+ ...S.props(v.label, v.strongLabel, v.haloLabel),
2210
+ children: e.label
2211
+ }),
2212
+ e.value !== void 0 && /* @__PURE__ */ O("circle", {
2213
+ cx: i,
2214
+ cy: n(e.value),
2215
+ r: ln,
2216
+ className: "x1fytgo2 x17y187c xvlca1e x13efnbd"
2217
+ })
2218
+ ] }, e.id);
2219
+ })
2220
+ });
1182
2221
  }
1183
2222
  // packages/charts/src/cartesian/time-series.tsx
1184
- var ke = {
2223
+ var _n = {
1185
2224
  timeAxis: {
1186
2225
  k1xSpc: "x78zum5",
1187
2226
  kjj79g: "x1qughib",
@@ -1202,46 +2241,87 @@ var ke = {
1202
2241
  "--x-paddingInlineEnd": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
1203
2242
  }]
1204
2243
  };
1205
- function Ae(e) {
1206
- return /* @__PURE__ */ D(Le, {
2244
+ function vn({ bands: e, crossings: t }) {
2245
+ return JSON.stringify([e.map((e) => [
2246
+ e.id,
2247
+ e.label,
2248
+ e.rangeLabel,
2249
+ e.tone,
2250
+ e.points.map((e) => [
2251
+ e.timestamp,
2252
+ e.lower,
2253
+ e.center,
2254
+ e.upper
2255
+ ])
2256
+ ]), t.map((e) => [
2257
+ e.id,
2258
+ e.seriesId,
2259
+ e.value,
2260
+ e.label,
2261
+ e.direction
2262
+ ])]);
2263
+ }
2264
+ function yn({ bands: e, timestamp: t, formatValue: n }) {
2265
+ return e.flatMap((e) => {
2266
+ let r = e.points.find((e) => e.timestamp === t), i = r?.center ?? null, a = r?.lower !== null && r?.upper !== null && r !== void 0;
2267
+ return [{
2268
+ id: e.id,
2269
+ label: e.label,
2270
+ tone: e.tone,
2271
+ shape: "band",
2272
+ value: i === null ? "Unavailable" : n(i)
2273
+ }, {
2274
+ id: `${e.id}:range`,
2275
+ label: e.rangeLabel,
2276
+ tone: e.tone,
2277
+ shape: "band",
2278
+ value: a ? `${n(r.lower)} – ${n(r.upper)}` : "Unavailable"
2279
+ }];
2280
+ });
2281
+ }
2282
+ function bn({ found: e, formatTimestamp: t }) {
2283
+ return e.timestamp === void 0 ? `${e.crossing.label} · Not reached in this range` : `About ${t(e.timestamp)} · ${e.crossing.label}`;
2284
+ }
2285
+ function xn(e) {
2286
+ return /* @__PURE__ */ O(On, {
1207
2287
  ...e,
1208
2288
  kind: "line",
1209
2289
  isStacked: !1
1210
2290
  });
1211
2291
  }
1212
- function je({ isStacked: e = !1, ...t }) {
1213
- return /* @__PURE__ */ D(Le, {
2292
+ function Sn({ isStacked: e = !1, ...t }) {
2293
+ return /* @__PURE__ */ O(On, {
1214
2294
  ...t,
1215
2295
  kind: "area",
1216
2296
  isStacked: e
1217
2297
  });
1218
2298
  }
1219
- function Me(e) {
1220
- return /* @__PURE__ */ D(Ne, { ...e });
2299
+ function Cn(e) {
2300
+ return /* @__PURE__ */ O(wn, { ...e });
1221
2301
  }
1222
- function Ne({ title: e, description: r, series: i, actions: a, report: o, height: s = 180, showTimeAxis: c = !0 }) {
1223
- let l = C(), u = we(i.map((e) => ({
2302
+ function wn({ title: e, description: r, series: i, actions: a, report: o, height: s = 180, showTimeAxis: c = !0 }) {
2303
+ let l = w(), u = It(i.map((e) => ({
1224
2304
  ...e,
1225
2305
  points: []
1226
2306
  })), !1);
1227
- return !Number.isFinite(s) || s < 48 ? /* @__PURE__ */ D(g, {
2307
+ return !Number.isFinite(s) || s < 48 ? /* @__PURE__ */ O(g, {
1228
2308
  title: e,
1229
2309
  description: r,
1230
2310
  report: o,
1231
2311
  message: "Chart height must be at least 48 pixels."
1232
- }) : /* @__PURE__ */ D("div", {
2312
+ }) : /* @__PURE__ */ O("div", {
1233
2313
  "aria-hidden": !0,
1234
2314
  inert: !0,
1235
2315
  className: "xeuugli",
1236
- children: /* @__PURE__ */ D(p, {
2316
+ children: /* @__PURE__ */ O(p, {
1237
2317
  title: e,
1238
2318
  description: r,
1239
2319
  report: o,
1240
2320
  series: u,
1241
2321
  actions: a,
1242
- children: /* @__PURE__ */ O("div", {
2322
+ children: /* @__PURE__ */ k("div", {
1243
2323
  className: "xrvj5dj x1n8ia3y",
1244
- children: [/* @__PURE__ */ D(ce, {
2324
+ children: [/* @__PURE__ */ O(ue, {
1245
2325
  id: l,
1246
2326
  label: void 0,
1247
2327
  legend: u,
@@ -1250,61 +2330,61 @@ function Ne({ title: e, description: r, series: i, actions: a, report: o, height
1250
2330
  width: 0,
1251
2331
  source: void 0,
1252
2332
  hasSeriesSummary: o?.seriesValues !== void 0
1253
- }), /* @__PURE__ */ O("div", {
1254
- ...x.props(v.plot),
1255
- children: [/* @__PURE__ */ D(t, { height: s - 16 }), c && /* @__PURE__ */ O("div", {
2333
+ }), /* @__PURE__ */ k("div", {
2334
+ ...S.props(v.plot),
2335
+ children: [/* @__PURE__ */ O(t, { height: s - 16 }), c && /* @__PURE__ */ k("div", {
1256
2336
  className: "x78zum5 x1qughib x8zbtdt x1c87qhr xy8obcc xas2l8k x153jb6y xss6m8b",
1257
- children: [/* @__PURE__ */ D(n, { width: "8ch" }), /* @__PURE__ */ D(n, { width: "8ch" })]
2337
+ children: [/* @__PURE__ */ O(n, { width: "8ch" }), /* @__PURE__ */ O(n, { width: "8ch" })]
1258
2338
  })]
1259
2339
  })]
1260
2340
  })
1261
2341
  })
1262
2342
  });
1263
2343
  }
1264
- function Pe({ charts: e, ...t }) {
1265
- let n = w(null), [r, i] = T(), a = JSON.stringify(e.map((e) => [
2344
+ function Tn({ charts: e, ...t }) {
2345
+ let n = ne(null), [r, i] = E(), a = JSON.stringify(e.map((e) => [
1266
2346
  e.id,
1267
2347
  e.title,
1268
- Se({
2348
+ Pt({
1269
2349
  series: e.series,
1270
2350
  markers: e.markers ?? [],
1271
2351
  timestampUnit: t.timestampUnit,
1272
2352
  isStacked: !1
1273
2353
  })
1274
2354
  ])), o = JSON.stringify(e[0]?.series[0]?.points.map((e) => e.timestamp) ?? []), s = e.every((e) => JSON.stringify(e.series[0]?.points.map((e) => e.timestamp) ?? []) === o);
1275
- if (r !== void 0 && r.signature !== a && i(void 0), S(() => {
2355
+ if (r !== void 0 && r.signature !== a && i(void 0), te(() => {
1276
2356
  function e(e) {
1277
2357
  e.target instanceof Node && n.current?.contains(e.target) !== !0 && i(void 0);
1278
2358
  }
1279
2359
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1280
- }, []), !s || !m(e)) return /* @__PURE__ */ D(g, {
2360
+ }, []), !s || !m(e)) return /* @__PURE__ */ O(g, {
1281
2361
  title: "Small multiples",
1282
2362
  message: "Charts need unique identifiers and aligned observation timestamps."
1283
2363
  });
1284
- if (e.length > $.panels) return /* @__PURE__ */ D(g, {
2364
+ if (e.length > $.panels) return /* @__PURE__ */ O(g, {
1285
2365
  title: "Small multiples",
1286
2366
  message: `Choose at most ${$.panels} panels.`
1287
2367
  });
1288
- if (e.length === 0) return /* @__PURE__ */ D(p, {
2368
+ if (e.length === 0) return /* @__PURE__ */ O(p, {
1289
2369
  title: "Small multiples",
1290
- children: /* @__PURE__ */ D("p", {
2370
+ children: /* @__PURE__ */ O("p", {
1291
2371
  className: "x153jb6y",
1292
2372
  children: "No charts"
1293
2373
  })
1294
2374
  });
1295
2375
  let c = Math.max(52, ...e.flatMap((e) => e.series.flatMap((t) => t.points.flatMap((t) => t.value === null || !Number.isFinite(t.value) ? [] : [(e.formatTick ?? e.formatValue)(t.value).length * 7 + 12])))), l = e.every((e) => e.report !== void 0);
1296
- return /* @__PURE__ */ D("div", {
2376
+ return /* @__PURE__ */ O("div", {
1297
2377
  ref: n,
1298
2378
  ...{
1299
2379
  0: { className: "xrvj5dj x1j825kq" },
1300
2380
  1: { className: "xrvj5dj xxhr3t" }
1301
2381
  }[!!l | 0],
1302
- children: e.map((n, o) => /* @__PURE__ */ D("div", {
2382
+ children: e.map((n, o) => /* @__PURE__ */ O("div", {
1303
2383
  ...{
1304
2384
  0: {},
1305
2385
  1: { className: "x1y332i5" }
1306
2386
  }[!!(l && o > 0) | 0],
1307
- children: /* @__PURE__ */ D(Le, {
2387
+ children: /* @__PURE__ */ O(On, {
1308
2388
  ...t,
1309
2389
  title: n.title,
1310
2390
  description: n.description,
@@ -1330,25 +2410,25 @@ function Pe({ charts: e, ...t }) {
1330
2410
  }, n.id))
1331
2411
  });
1332
2412
  }
1333
- function Fe({ charts: e, height: t }) {
1334
- if (!m(e) || e.length > $.panels) return /* @__PURE__ */ D(g, {
2413
+ function En({ charts: e, height: t }) {
2414
+ if (!m(e) || e.length > $.panels) return /* @__PURE__ */ O(g, {
1335
2415
  title: "Small multiples",
1336
2416
  message: `Choose at most ${$.panels} panels with unique identifiers.`
1337
2417
  });
1338
2418
  let n = e.every((e) => e.report !== void 0);
1339
- return /* @__PURE__ */ D("div", {
2419
+ return /* @__PURE__ */ O("div", {
1340
2420
  "aria-hidden": !0,
1341
2421
  inert: !0,
1342
2422
  ...{
1343
2423
  0: { className: "xrvj5dj x1j825kq" },
1344
2424
  1: { className: "xrvj5dj xxhr3t" }
1345
2425
  }[!!n | 0],
1346
- children: e.map((r, i) => /* @__PURE__ */ D("div", {
2426
+ children: e.map((r, i) => /* @__PURE__ */ O("div", {
1347
2427
  ...{
1348
2428
  0: {},
1349
2429
  1: { className: "x1y332i5" }
1350
2430
  }[!!(n && i > 0) | 0],
1351
- children: /* @__PURE__ */ D(Ne, {
2431
+ children: /* @__PURE__ */ O(wn, {
1352
2432
  ...r,
1353
2433
  height: t,
1354
2434
  showTimeAxis: i === e.length - 1
@@ -1356,251 +2436,340 @@ function Fe({ charts: e, height: t }) {
1356
2436
  }, r.id))
1357
2437
  });
1358
2438
  }
1359
- var Ie = {
2439
+ var Dn = {
1360
2440
  "x-default-marker": "x-default-marker",
1361
2441
  $$css: !0
1362
2442
  };
1363
- function Le({ title: t, description: n, series: r, timestampUnit: i, formatTimestamp: a, formatValue: o, formatTick: c = o, markers: u = [], height: d = 180, actions: f, report: m, kind: h, isStacked: y, sharedInspection: b, axisWidth: te, showTimeAxis: E = !0 }) {
1364
- let k = !Number.isFinite(d) || d < 48 ? "Chart height must be at least 48 pixels." : xe({
2443
+ function On({ title: t, description: n, series: r, timestampUnit: i, formatTimestamp: a, formatValue: o, formatTick: c = o, markers: u = [], height: d = 180, actions: f, report: m, kind: h, isStacked: y, sharedInspection: b, axisWidth: x, showTimeAxis: C = !0, bands: D = [], crossings: A = [] }) {
2444
+ let re = D[0]?.points.map((e) => e.timestamp) ?? [], ie = r[0]?.points.map((e) => e.timestamp) ?? re, N = !Number.isFinite(d) || d < 48 ? "Chart height must be at least 48 pixels." : Mt({
1365
2445
  series: r,
1366
2446
  isStacked: y,
1367
- markers: u
1368
- }), A = ne(() => k === void 0 ? we(r, y) : [], [
2447
+ markers: u,
2448
+ timeline: re
2449
+ }) ?? qt({
2450
+ bands: D,
2451
+ crossings: A,
2452
+ series: r,
2453
+ timestamps: ie
2454
+ }), P = T(() => N === void 0 ? It(r, y) : [], [
1369
2455
  r,
1370
2456
  y,
1371
- k
1372
- ]), M = A[0]?.points ?? [], { ref: ie, width: N, element: P } = ee(), oe = w(null), [se, le] = T(), ue = ne(() => M.map(({ timestamp: e }) => ({
2457
+ N
2458
+ ]), F = T(() => N === void 0 ? Jt({
2459
+ series: r,
2460
+ bands: D
2461
+ }) : [], [
2462
+ r,
2463
+ D,
2464
+ N
2465
+ ]), I = P[0]?.points ?? F[0]?.points ?? [], { ref: oe, width: se, element: de } = ee(), L = ne(null), [fe, R] = E(), pe = T(() => I.map(({ timestamp: e }) => ({
1373
2466
  id: String(e),
1374
2467
  label: a(e)
1375
- })), [M, a]), de = M.find((e) => e.timestamp === se) ?? M[0], [I, fe] = T(), L = Se({
2468
+ })), [I, a]), z = I.find((e) => e.timestamp === fe) ?? I[0], [B, me] = E(), V = `${Pt({
1376
2469
  series: r,
1377
2470
  markers: u,
1378
2471
  timestampUnit: i,
1379
2472
  isStacked: y
1380
- }), R = b === void 0 ? I?.signature === L ? I : void 0 : b.value, z = b === void 0 || b.isSource ? R : void 0, pe = m?.seriesValues !== void 0, me = C();
1381
- I !== void 0 && (I.signature !== L || k !== void 0) && fe(void 0);
1382
- let B = b !== void 0;
1383
- if (S(() => {
1384
- if (B) return;
2473
+ })}${vn({
2474
+ bands: D,
2475
+ crossings: A
2476
+ })}`, he = [...P.map(({ id: e, label: t, tone: n }) => ({
2477
+ id: e,
2478
+ label: t,
2479
+ tone: n
2480
+ })), ...F.map(({ id: e, label: t, tone: n }) => ({
2481
+ id: e,
2482
+ label: t,
2483
+ tone: n,
2484
+ shape: "band"
2485
+ }))], H = b === void 0 ? B?.signature === V ? B : void 0 : b.value, U = b === void 0 || b.isSource ? H : void 0, ge = m?.seriesValues !== void 0, W = w();
2486
+ B !== void 0 && (B.signature !== V || N !== void 0) && me(void 0);
2487
+ let _e = b !== void 0;
2488
+ if (te(() => {
2489
+ if (_e) return;
1385
2490
  function e(e) {
1386
- e.target instanceof Node && oe.current?.contains(e.target) !== !0 && fe(void 0);
2491
+ e.target instanceof Node && L.current?.contains(e.target) !== !0 && me(void 0);
1387
2492
  }
1388
2493
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1389
- }, [B]), k !== void 0) return /* @__PURE__ */ D(g, {
2494
+ }, [_e]), N !== void 0) return /* @__PURE__ */ O(g, {
1390
2495
  title: t,
1391
2496
  description: n,
1392
2497
  report: m,
1393
- message: k
2498
+ message: N
1394
2499
  });
1395
- if (M.length === 0) return /* @__PURE__ */ D(p, {
2500
+ if (I.length === 0) return /* @__PURE__ */ O(p, {
1396
2501
  title: t,
1397
2502
  description: n,
1398
2503
  actions: f,
1399
2504
  report: m,
1400
- series: A,
1401
- children: /* @__PURE__ */ D("p", {
2505
+ series: he,
2506
+ children: /* @__PURE__ */ O("p", {
1402
2507
  className: "x153jb6y",
1403
2508
  children: "No observations"
1404
2509
  })
1405
2510
  });
1406
- let he = d - 28, ge = he + 12, V = M[0]?.timestamp ?? 0, H = M.at(-1)?.timestamp ?? V, U = A.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), W = h === "area" ? Math.min(0, ...U) : Math.min(...U), G = h === "area" ? Math.max(0, ...U) : Math.max(...U), K = U.length === 0 ? 0 : W, _e = U.length === 0 ? 1 : G, q = j({
1407
- domain: [...Ce(K, _e, h === "area")],
1408
- range: [he, 12]
1409
- }), J = q.ticks(3), Y = te ?? Math.max(44, ...J.map((e) => c(e).length * 7 + 12)), X = Math.max(Y + 1, N - 16), Z = j({
1410
- domain: [...Ce(V, H)],
1411
- range: [Y, X]
1412
- });
1413
- function ve(e) {
1414
- let t = P?.getBoundingClientRect();
2511
+ let ve = I.map((e) => e.timestamp), ye = Zt({
2512
+ crossings: A,
2513
+ series: r,
2514
+ bands: D
2515
+ }), be = [...u.flatMap((e) => e.kind === "event" ? [e] : []), ...ye.flatMap(({ crossing: e, timestamp: t }) => t === void 0 ? [] : [{
2516
+ id: e.id,
2517
+ timestamp: t,
2518
+ label: e.label,
2519
+ value: e.value
2520
+ }])], xe = be.filter((e) => Qt(ve, e.timestamp) === U?.timestamp).map((e) => `${e.label} · ${a(e.timestamp)}`), Se = {
2521
+ label: U === void 0 ? void 0 : a(U.timestamp),
2522
+ rows: [...P.map((e) => {
2523
+ let t = e.points.find((e) => e.timestamp === U?.timestamp);
2524
+ return {
2525
+ id: e.id,
2526
+ label: e.label,
2527
+ tone: e.tone,
2528
+ value: t?.value === null || t === void 0 ? "Unavailable" : o(t.value)
2529
+ };
2530
+ }), ...yn({
2531
+ bands: F,
2532
+ timestamp: U?.timestamp,
2533
+ formatValue: o
2534
+ })],
2535
+ notes: [...u.filter((e) => e.kind !== "event" && e.timestamp === U?.timestamp).map((e) => e.label), ...xe]
2536
+ }, G = d - 28, Ce = G + 12, we = I[0]?.timestamp ?? 0, Te = I.at(-1)?.timestamp ?? we, K = [
2537
+ ...P.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])),
2538
+ ...$t(D),
2539
+ ...A.map((e) => e.value)
2540
+ ], Ee = h === "area" ? Math.min(0, ...K) : Math.min(...K), De = h === "area" ? Math.max(0, ...K) : Math.max(...K), q = Ft(K.length === 0 ? 0 : Ee, K.length === 0 ? 1 : De, h === "area"), Oe = j({
2541
+ domain: [...q],
2542
+ range: [G, 0]
2543
+ }), J = x ?? Math.max(44, ...Oe.ticks(3).map((e) => c(e).length * 7 + 12)), Y = Math.max(J + 1, se - 16), X = j({
2544
+ domain: [...Ft(we, Te)],
2545
+ range: [J, Y]
2546
+ }), ke = fn({
2547
+ instants: be,
2548
+ x: X,
2549
+ right: Y
2550
+ }), Z = pn(ke), Q = j({
2551
+ domain: [...q],
2552
+ range: [G, Z]
2553
+ }), Ae = Q.ticks(3);
2554
+ function je(e) {
2555
+ let t = de?.getBoundingClientRect();
1415
2556
  if (t === void 0) return;
1416
- let n = Z.invert(e - t.left), r = M.find((e, t) => {
1417
- let r = M[t + 1];
2557
+ let n = X.invert(e - t.left), r = I.find((e, t) => {
2558
+ let r = I[t + 1];
1418
2559
  return r === void 0 || n <= e.timestamp + (r.timestamp - e.timestamp) / 2;
1419
2560
  });
1420
- r !== void 0 && Q({
1421
- signature: L,
2561
+ r !== void 0 && Me({
2562
+ signature: V,
1422
2563
  timestamp: r.timestamp,
1423
2564
  source: "pointer"
1424
2565
  });
1425
2566
  }
1426
- function Q(e) {
1427
- b === void 0 ? fe(e) : b.onChange(e);
2567
+ function Me(e) {
2568
+ b === void 0 ? me(e) : b.onChange(e);
1428
2569
  }
1429
- return /* @__PURE__ */ D("div", {
1430
- ref: oe,
2570
+ return /* @__PURE__ */ O("div", {
2571
+ ref: L,
1431
2572
  className: "xeuugli",
1432
- children: /* @__PURE__ */ O(p, {
1433
- title: pe ? t : /* @__PURE__ */ D(F, {
2573
+ children: /* @__PURE__ */ k(p, {
2574
+ title: ge ? t : /* @__PURE__ */ O(ce, {
1434
2575
  title: t,
1435
- detail: z === void 0 ? void 0 : a(z.timestamp)
2576
+ detail: U === void 0 ? void 0 : a(U.timestamp)
1436
2577
  }),
1437
2578
  description: n,
1438
2579
  report: m,
1439
- series: A,
2580
+ series: he,
1440
2581
  actions: f,
1441
- children: [/* @__PURE__ */ D(s, {
2582
+ children: [/* @__PURE__ */ O(s, {
1442
2583
  label: `${t} observations`,
1443
- columns: [{
1444
- id: "time",
1445
- label: `Time (${i})`
1446
- }, ...A.map((e) => ({
1447
- id: `series:${e.id}`,
1448
- label: e.label
1449
- }))],
1450
- rows: M.map((e, t) => ({
2584
+ columns: [
2585
+ {
2586
+ id: "time",
2587
+ label: `Time (${i})`
2588
+ },
2589
+ ...P.map((e) => ({
2590
+ id: `series:${e.id}`,
2591
+ label: e.label
2592
+ })),
2593
+ ...F.flatMap((e) => [{
2594
+ id: `band:${e.id}`,
2595
+ label: e.label
2596
+ }, {
2597
+ id: `band-range:${e.id}`,
2598
+ label: `${e.label}: ${e.rangeLabel}`
2599
+ }])
2600
+ ],
2601
+ rows: I.map((e, t) => ({
1451
2602
  id: e.timestamp,
1452
- values: [a(e.timestamp), ...A.map((e) => e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : o(e.points[t].value))]
2603
+ values: [
2604
+ a(e.timestamp),
2605
+ ...P.map((e) => e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : o(e.points[t].value)),
2606
+ ...yn({
2607
+ bands: F,
2608
+ timestamp: e.timestamp,
2609
+ formatValue: o
2610
+ }).map((e) => e.value)
2611
+ ]
1453
2612
  }))
1454
- }), /* @__PURE__ */ O("div", {
2613
+ }), /* @__PURE__ */ k("div", {
1455
2614
  className: "xrvj5dj x1n8ia3y",
1456
2615
  children: [
1457
- /* @__PURE__ */ D(ce, {
1458
- id: me,
1459
- label: z === void 0 ? void 0 : a(z.timestamp),
1460
- legend: A.map(({ id: e, label: t, tone: n }) => ({
1461
- id: e,
1462
- label: t,
1463
- tone: n
1464
- })),
1465
- rows: A.map((e) => {
1466
- let t = e.points.find((e) => e.timestamp === z?.timestamp);
1467
- return {
1468
- id: e.id,
1469
- label: e.label,
1470
- tone: e.tone,
1471
- value: t?.value === null || t === void 0 ? "Unavailable" : o(t.value)
1472
- };
1473
- }),
1474
- x: Z(R?.timestamp ?? V),
1475
- width: N,
1476
- source: z?.source,
1477
- notes: u.filter((e) => e.timestamp === z?.timestamp).map((e) => e.label),
1478
- hasSeriesSummary: pe
2616
+ /* @__PURE__ */ O(ue, {
2617
+ id: W,
2618
+ label: Se.label,
2619
+ legend: he,
2620
+ rows: Se.rows,
2621
+ x: X(H?.timestamp ?? we),
2622
+ width: se,
2623
+ source: U?.source,
2624
+ notes: Se.notes,
2625
+ hasSeriesSummary: ge
1479
2626
  }),
1480
- /* @__PURE__ */ O("div", {
1481
- ref: ie,
1482
- ...x.props(v.plot),
1483
- children: [/* @__PURE__ */ O(l, {
2627
+ /* @__PURE__ */ k("div", {
2628
+ ref: oe,
2629
+ ...S.props(v.plot),
2630
+ children: [/* @__PURE__ */ k(l, {
1484
2631
  role: "img",
1485
2632
  "aria-label": `${t}. Use arrow keys to inspect observations.`,
1486
- "aria-describedby": me,
2633
+ "aria-describedby": W,
1487
2634
  tabIndex: 0,
1488
- viewBox: `0 0 ${N} ${ge}`,
1489
- height: ge,
2635
+ viewBox: `0 0 ${se} ${Ce}`,
2636
+ height: Ce,
1490
2637
  controls: {
1491
- items: ue,
1492
- cursor: de === void 0 ? void 0 : String(de.timestamp),
1493
- inspected: R === void 0 ? void 0 : String(R.timestamp),
2638
+ items: pe,
2639
+ cursor: z === void 0 ? void 0 : String(z.timestamp),
2640
+ inspected: U === void 0 ? void 0 : String(U.timestamp),
2641
+ readout: le(Se),
1494
2642
  onInspect: (e) => {
1495
2643
  let t = Number(e);
1496
- le(t), Q({
1497
- signature: L,
2644
+ R(t), Me({
2645
+ signature: V,
1498
2646
  timestamp: t,
1499
2647
  source: "keyboard"
1500
2648
  });
1501
2649
  },
1502
- onDismiss: () => Q(void 0)
2650
+ onDismiss: () => Me(void 0)
1503
2651
  },
1504
2652
  onFocus: (e) => {
1505
2653
  if (e.currentTarget.matches(":focus-visible")) {
1506
- let e = R?.timestamp ?? V;
1507
- le(e), Q({
1508
- signature: L,
2654
+ let e = H?.timestamp ?? we;
2655
+ R(e), Me({
2656
+ signature: V,
1509
2657
  timestamp: e,
1510
2658
  source: "keyboard"
1511
2659
  });
1512
2660
  }
1513
2661
  },
1514
2662
  onPointerMove: (e) => {
1515
- e.pointerType === "mouse" && ve(e.clientX);
2663
+ e.pointerType === "mouse" && je(e.clientX);
1516
2664
  },
1517
- onPointerDown: (e) => ve(e.clientX),
2665
+ onPointerDown: (e) => je(e.clientX),
1518
2666
  onPointerLeave: (e) => {
1519
- e.pointerType === "mouse" && R?.source === "pointer" && Q(void 0);
2667
+ e.pointerType === "mouse" && H?.source === "pointer" && Me(void 0);
1520
2668
  },
1521
- onBlur: () => Q(void 0),
1522
- ...x.props(v.svg, v.inspectable, Ie),
2669
+ onBlur: () => Me(void 0),
2670
+ ...S.props(v.svg, v.inspectable, Dn),
1523
2671
  children: [
1524
- J.map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
1525
- x1: Y,
1526
- x2: X,
1527
- y1: q(e),
1528
- y2: q(e),
1529
- ...x.props(v.grid)
1530
- }), /* @__PURE__ */ D("text", {
1531
- x: Y - 8,
1532
- y: q(e),
2672
+ Ae.map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
2673
+ x1: J,
2674
+ x2: Y,
2675
+ y1: Q(e),
2676
+ y2: Q(e),
2677
+ ...S.props(v.grid)
2678
+ }), /* @__PURE__ */ O("text", {
2679
+ x: J - 8,
2680
+ y: Q(e),
1533
2681
  textAnchor: "end",
1534
2682
  dominantBaseline: "middle",
1535
- ...x.props(v.label),
2683
+ ...S.props(v.label),
1536
2684
  children: c(e)
1537
2685
  })] }, e)),
1538
- A.map((t) => /* @__PURE__ */ O("g", { children: [h === "area" && /* @__PURE__ */ D(re, {
2686
+ A.map((e) => /* @__PURE__ */ O("line", {
2687
+ x1: J,
2688
+ x2: Y,
2689
+ y1: Q(e.value),
2690
+ y2: Q(e.value),
2691
+ ...S.props(v.baseline)
2692
+ }, e.id)),
2693
+ /* @__PURE__ */ O(hn, {
2694
+ bands: F,
2695
+ x: X,
2696
+ y: Q
2697
+ }),
2698
+ P.map((t) => /* @__PURE__ */ k("g", { children: [h === "area" && /* @__PURE__ */ O(M, {
1539
2699
  data: [...t.points],
1540
2700
  defined: (e) => e.value !== null,
1541
- x: (e) => Z(e.timestamp),
1542
- y0: (e) => q(e.base),
1543
- y1: (e) => q((e.value ?? 0) + e.base),
1544
- yScale: q,
2701
+ x: (e) => X(e.timestamp),
2702
+ y0: (e) => Q(e.base),
2703
+ y1: (e) => Q((e.value ?? 0) + e.base),
2704
+ yScale: Q,
1545
2705
  fill: e[t.tone],
1546
2706
  fillOpacity: y ? .65 : .15
1547
- }), /* @__PURE__ */ D(Ee, {
2707
+ }), /* @__PURE__ */ O(Rt, {
1548
2708
  series: t,
1549
- x: Z,
1550
- y: q,
1551
- inspectedTimestamp: R?.timestamp
2709
+ x: X,
2710
+ y: Q,
2711
+ inspectedTimestamp: H?.timestamp
1552
2712
  })] }, t.id)),
1553
- u.map((e) => /* @__PURE__ */ O("g", { children: [e.kind === "time" ? /* @__PURE__ */ D("line", {
1554
- x1: Z(e.timestamp),
1555
- x2: Z(e.timestamp),
1556
- y1: 12,
1557
- y2: he,
2713
+ /* @__PURE__ */ O(gn, {
2714
+ placed: ke,
2715
+ x: X,
2716
+ y: Q,
2717
+ bottom: G
2718
+ }),
2719
+ u.filter((e) => e.kind !== "event").map((e) => /* @__PURE__ */ k("g", { children: [e.kind === "time" ? /* @__PURE__ */ O("line", {
2720
+ x1: X(e.timestamp),
2721
+ x2: X(e.timestamp),
2722
+ y1: Z,
2723
+ y2: G,
1558
2724
  className: "xhq4mlf x1ntoi03 x13efnbd"
1559
- }) : /* @__PURE__ */ D("circle", {
1560
- cx: Z(e.timestamp),
1561
- cy: q(e.value + (A.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
2725
+ }) : /* @__PURE__ */ O("circle", {
2726
+ cx: X(e.timestamp),
2727
+ cy: Q(e.value + (P.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
1562
2728
  r: 4,
1563
2729
  fill: _.surface,
1564
- ...x.props(v.selected)
1565
- }), /* @__PURE__ */ D("title", { children: e.kind === "point" ? `${e.label}: ${o(e.value)}` : e.label })] }, e.id)),
1566
- R !== void 0 && /* @__PURE__ */ D("line", {
1567
- x1: Z(R.timestamp),
1568
- x2: Z(R.timestamp),
1569
- y1: 12,
1570
- y2: he,
2730
+ ...S.props(v.selected)
2731
+ }), /* @__PURE__ */ O("title", { children: e.kind === "point" ? `${e.label}: ${o(e.value)}` : e.label })] }, e.id)),
2732
+ H !== void 0 && /* @__PURE__ */ O("line", {
2733
+ x1: X(H.timestamp),
2734
+ x2: X(H.timestamp),
2735
+ y1: Z,
2736
+ y2: G,
1571
2737
  className: "xhq4mlf x1ntoi03 x13efnbd"
1572
2738
  }),
1573
- de !== void 0 && /* @__PURE__ */ D(ae, {
1574
- x: Z(de.timestamp),
1575
- top: 12,
1576
- bottom: he,
1577
- width: Math.min(16, (X - Y) / 2)
2739
+ z !== void 0 && /* @__PURE__ */ O(ae, {
2740
+ x: X(z.timestamp),
2741
+ top: Z,
2742
+ bottom: G,
2743
+ width: Math.min(16, (Y - J) / 2)
1578
2744
  })
1579
2745
  ]
1580
- }), E && /* @__PURE__ */ O("div", {
2746
+ }), C && /* @__PURE__ */ k("div", {
1581
2747
  "aria-hidden": !0,
1582
- ...x.props(ke.timeAxis, ke.timeAxisInset(Y, Math.max(0, N - X))),
1583
- children: [/* @__PURE__ */ D("span", {
2748
+ ...S.props(_n.timeAxis, _n.timeAxisInset(J, Math.max(0, se - Y))),
2749
+ children: [/* @__PURE__ */ O("span", {
1584
2750
  className: "x1cqoux5 xeuugli xj0a0fe",
1585
- children: a(V)
1586
- }), H !== V && /* @__PURE__ */ D("span", {
2751
+ children: a(we)
2752
+ }), Te !== we && /* @__PURE__ */ O("span", {
1587
2753
  className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
1588
- children: a(H)
2754
+ children: a(Te)
1589
2755
  })]
1590
2756
  })]
1591
2757
  }),
1592
- u.length > 0 && /* @__PURE__ */ D("ul", {
2758
+ u.length + ye.length > 0 && /* @__PURE__ */ k("ul", {
1593
2759
  className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx xy8obcc x153jb6y xj0a0fe",
1594
- children: u.map((e) => /* @__PURE__ */ O("li", { children: [
2760
+ children: [u.map((e) => /* @__PURE__ */ k("li", { children: [
1595
2761
  a(e.timestamp),
1596
2762
  " · ",
1597
2763
  e.label,
1598
2764
  e.kind === "point" && ` · ${o(e.value)}`
1599
- ] }, e.id))
2765
+ ] }, e.id)), ye.map((e) => /* @__PURE__ */ O("li", { children: bn({
2766
+ found: e,
2767
+ formatTimestamp: a
2768
+ }) }, e.crossing.id))]
1600
2769
  })
1601
2770
  ]
1602
2771
  })]
1603
2772
  })
1604
2773
  });
1605
2774
  }
1606
- export { je as AreaChart, B as BarChart, R as BarChartPlaceholder, H as BreakdownBar, Ae as LineChart, _e as MAX_SCATTER_POINTS, Y as ScatterPlot, Pe as SmallMultiples, Fe as SmallMultiplesPlaceholder, De as Sparkline, Me as TimeSeriesChartPlaceholder, $ as timeSeriesLimits };
2775
+ export { Sn as AreaChart, Ge as BarChart, Ve as BarChartPlaceholder, Ye as BreakdownBar, gt as BridgeChart, xn as LineChart, St as MAX_SCATTER_POINTS, Tt as ScatterPlot, Tn as SmallMultiples, En as SmallMultiplesPlaceholder, Ht as Sparkline, Cn as TimeSeriesChartPlaceholder, Wt as timeSeriesBandLimits, $ as timeSeriesLimits };