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