@mechane-ai/ui 0.2.1 → 0.3.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 (139) hide show
  1. package/README.md +38 -13
  2. package/dist/ai.js +315 -0
  3. package/dist/assets/stylex.css +1533 -360
  4. package/dist/cartesian-Bwt6ZnF5.js +847 -0
  5. package/dist/chart-input-Bti0gyzz.js +173 -0
  6. package/dist/charts/cartesian.js +1 -0
  7. package/dist/charts/distribution.js +1 -0
  8. package/dist/charts/graph.js +1 -0
  9. package/dist/charts/matrix.js +1 -0
  10. package/dist/charts.js +98 -93
  11. package/dist/code-BJp-g4Fw.js +172 -0
  12. package/dist/collections.js +666 -0
  13. package/dist/content/code.js +1 -0
  14. package/dist/content/diff.js +101 -0
  15. package/dist/content/link.js +1 -0
  16. package/dist/content/tree.js +77 -0
  17. package/dist/content-link-52aZVX3X.js +26 -0
  18. package/dist/content.js +367 -0
  19. package/dist/distribution-CViLvcPP.js +609 -0
  20. package/dist/graph-DAfo72ZD.js +230 -0
  21. package/dist/index.js +1 -1
  22. package/dist/layout.js +201 -160
  23. package/dist/matrix-B9dybkce.js +785 -0
  24. package/dist/packages/ai/src/approval.d.ts +29 -0
  25. package/dist/packages/ai/src/conversation.d.ts +34 -0
  26. package/dist/packages/ai/src/index.d.ts +10 -0
  27. package/dist/packages/ai/src/message.d.ts +19 -0
  28. package/dist/packages/ai/src/prompt-input.d.ts +25 -0
  29. package/dist/packages/ai/src/sources.d.ts +17 -0
  30. package/dist/packages/charts/src/cartesian/categorical.d.ts +43 -0
  31. package/dist/packages/charts/src/cartesian/index.d.ts +8 -0
  32. package/dist/packages/charts/src/cartesian/sparkline.d.ts +11 -0
  33. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +54 -0
  34. package/dist/packages/charts/src/cartesian/time-series-line.d.ts +9 -0
  35. package/dist/packages/charts/src/cartesian/time-series.d.ts +29 -0
  36. package/dist/packages/charts/src/chart-frame.d.ts +34 -0
  37. package/dist/packages/charts/src/chart-input.d.ts +10 -0
  38. package/dist/packages/charts/src/chart-theme.d.ts +48 -0
  39. package/dist/packages/charts/src/distribution/distribution-input.d.ts +14 -0
  40. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +135 -0
  41. package/dist/packages/charts/src/distribution/ecdf.d.ts +23 -0
  42. package/dist/packages/charts/src/distribution/histogram.d.ts +26 -0
  43. package/dist/packages/charts/src/distribution/index.d.ts +8 -0
  44. package/dist/packages/charts/src/distribution/interval-plot.d.ts +24 -0
  45. package/dist/packages/charts/src/distribution/ranked-bars.d.ts +22 -0
  46. package/dist/packages/charts/src/graph/index.d.ts +2 -0
  47. package/dist/packages/charts/src/graph/relation-graph.d.ts +45 -0
  48. package/dist/packages/charts/src/index.d.ts +13 -0
  49. package/dist/packages/charts/src/matrix/color-legend.d.ts +7 -0
  50. package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -0
  51. package/dist/packages/charts/src/matrix/index.d.ts +9 -0
  52. package/dist/packages/charts/src/matrix/matrix.d.ts +34 -0
  53. package/dist/packages/charts/src/matrix/scatter-plot.d.ts +37 -0
  54. package/dist/packages/charts/src/matrix/token-heatmap.d.ts +20 -0
  55. package/dist/packages/charts/src/plot-width.d.ts +5 -0
  56. package/dist/packages/collections/src/calendar.d.ts +32 -0
  57. package/dist/packages/collections/src/collection-controls.d.ts +41 -0
  58. package/dist/packages/collections/src/command.d.ts +37 -0
  59. package/dist/packages/collections/src/data-table.d.ts +49 -0
  60. package/dist/packages/collections/src/date-range-picker.d.ts +16 -0
  61. package/dist/packages/collections/src/index.d.ts +13 -0
  62. package/dist/packages/content/src/code/code-block.d.ts +22 -0
  63. package/dist/packages/content/src/code/index.d.ts +2 -0
  64. package/dist/packages/content/src/code/use-highlighted-code.d.ts +9 -0
  65. package/dist/packages/content/src/content-link.d.ts +8 -0
  66. package/dist/packages/content/src/diff/diff-source.d.ts +32 -0
  67. package/dist/packages/content/src/diff/diff-viewer.d.ts +3 -0
  68. package/dist/packages/content/src/diff/index.d.ts +2 -0
  69. package/dist/packages/content/src/diff/pierre-diff.d.ts +14 -0
  70. package/dist/packages/content/src/index.d.ts +10 -0
  71. package/dist/packages/content/src/json-viewer.d.ts +11 -0
  72. package/dist/packages/content/src/link.d.ts +2 -0
  73. package/dist/packages/content/src/log-viewer.d.ts +9 -0
  74. package/dist/packages/content/src/markdown.d.ts +7 -0
  75. package/dist/packages/content/src/pierre-theme.d.ts +36 -0
  76. package/dist/packages/content/src/stack-trace.d.ts +16 -0
  77. package/dist/packages/content/src/tree/file-tree-types.d.ts +12 -0
  78. package/dist/packages/content/src/tree/file-tree.d.ts +3 -0
  79. package/dist/packages/content/src/tree/index.d.ts +2 -0
  80. package/dist/packages/content/src/tree/pierre-tree.d.ts +3 -0
  81. package/dist/packages/core/src/alert-dialog.d.ts +18 -0
  82. package/dist/packages/core/src/combobox.d.ts +81 -0
  83. package/dist/{control-state.d.ts → packages/core/src/control-state.d.ts} +18 -2
  84. package/dist/{copy-value.d.ts → packages/core/src/copy-value.d.ts} +2 -1
  85. package/dist/packages/core/src/details-controls.d.ts +23 -0
  86. package/dist/packages/core/src/disclosure.d.ts +33 -0
  87. package/dist/packages/core/src/field-styles.d.ts +66 -0
  88. package/dist/packages/core/src/form-controls.d.ts +81 -0
  89. package/dist/{forms.d.ts → packages/core/src/forms.d.ts} +1 -1
  90. package/dist/packages/core/src/index.d.ts +32 -0
  91. package/dist/packages/core/src/menu.d.ts +51 -0
  92. package/dist/packages/core/src/navigation.d.ts +24 -0
  93. package/dist/packages/core/src/popover.d.ts +24 -0
  94. package/dist/packages/core/src/popup-styles.d.ts +84 -0
  95. package/dist/packages/core/src/preview.d.ts +17 -0
  96. package/dist/packages/core/src/progress.d.ts +10 -0
  97. package/dist/packages/core/src/selection-styles.d.ts +110 -0
  98. package/dist/packages/core/src/selection.d.ts +57 -0
  99. package/dist/packages/core/src/skeleton.d.ts +18 -0
  100. package/dist/packages/core/src/theme.d.ts +16 -0
  101. package/dist/packages/core/src/toast.d.ts +28 -0
  102. package/dist/{tokens.stylex.d.ts → packages/core/src/tokens.stylex.d.ts} +60 -0
  103. package/dist/packages/core/src/trace.d.ts +35 -0
  104. package/dist/{layout → packages/layout/src}/index.d.ts +2 -0
  105. package/dist/{layout → packages/layout/src}/page-toolbar.d.ts +1 -1
  106. package/dist/packages/layout/src/resizable.d.ts +27 -0
  107. package/dist/{layout → packages/layout/src}/sidebar.d.ts +1 -1
  108. package/dist/pierre-diff-D3m4JCu0.js +66 -0
  109. package/dist/pierre-theme-CPlfl-AA.js +96 -0
  110. package/dist/pierre-tree-BaEkz16y.js +105 -0
  111. package/dist/plot-width--OgdohB5.js +18 -0
  112. package/dist/src-E7YRJBMO.js +2821 -0
  113. package/dist/tokens.js +118 -64
  114. package/package.json +67 -10
  115. package/{src → packages/core/src}/tokens.stylex.ts +64 -0
  116. package/dist/charts/index.d.ts +0 -2
  117. package/dist/index.d.ts +0 -16
  118. package/dist/src-Czfi0YQa.js +0 -1319
  119. /package/dist/{charts → packages/charts/src}/waterfall.d.ts +0 -0
  120. /package/dist/{inspector.d.ts → packages/collections/src/inspector.d.ts} +0 -0
  121. /package/dist/{list-footer.d.ts → packages/collections/src/list-footer.d.ts} +0 -0
  122. /package/dist/{table.d.ts → packages/collections/src/table.d.ts} +0 -0
  123. /package/dist/{accessibility.d.ts → packages/core/src/accessibility.d.ts} +0 -0
  124. /package/dist/{actions.d.ts → packages/core/src/actions.d.ts} +0 -0
  125. /package/dist/{dialog.d.ts → packages/core/src/dialog.d.ts} +0 -0
  126. /package/dist/{drawer.d.ts → packages/core/src/drawer.d.ts} +0 -0
  127. /package/dist/{loading.d.ts → packages/core/src/loading.d.ts} +0 -0
  128. /package/dist/{metrics.d.ts → packages/core/src/metrics.d.ts} +0 -0
  129. /package/dist/{overlay-styles.d.ts → packages/core/src/overlay-styles.d.ts} +0 -0
  130. /package/dist/{select.d.ts → packages/core/src/select.d.ts} +0 -0
  131. /package/dist/{skip-link.d.ts → packages/core/src/skip-link.d.ts} +0 -0
  132. /package/dist/{style-composition.d.ts → packages/core/src/style-composition.d.ts} +0 -0
  133. /package/dist/{surfaces.d.ts → packages/core/src/surfaces.d.ts} +0 -0
  134. /package/dist/{tabs.d.ts → packages/core/src/tabs.d.ts} +0 -0
  135. /package/dist/{text.d.ts → packages/core/src/text.d.ts} +0 -0
  136. /package/dist/{tooltip.d.ts → packages/core/src/tooltip.d.ts} +0 -0
  137. /package/dist/{layout → packages/layout/src}/app-shell.d.ts +0 -0
  138. /package/dist/{layout → packages/layout/src}/detail-page.d.ts +0 -0
  139. /package/dist/{layout → packages/layout/src}/frame.stylex.d.ts +0 -0
@@ -0,0 +1,609 @@
1
+ import { a as e, i as t, l as n, n as r, o as i, r as a, t as o } from "./chart-input-Bti0gyzz.js";
2
+ import { t as s } from "./plot-width--OgdohB5.js";
3
+ import * as c from "@stylexjs/stylex";
4
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
5
+ import { scaleLinear as f } from "@visx/scale";
6
+ import { Bar as p } from "@visx/shape";
7
+ // packages/charts/src/distribution/distribution-input.ts
8
+ var m = {
9
+ bins: 200,
10
+ cumulativePoints: 2e3,
11
+ rows: 200
12
+ };
13
+ function h({ items: e, domain: t, maxEntries: n }) {
14
+ if (!a(t)) return "The chart domain must contain two finite, increasing values.";
15
+ if (!r(e)) return "Chart records must have unique identifiers.";
16
+ if (e.length > n) return `This chart supports at most ${n} records. Supply an explicit data window or aggregation.`;
17
+ }
18
+ function g(e, t) {
19
+ return !Number.isFinite(e) || e < t[0] || e > t[1];
20
+ }
21
+ // packages/charts/src/distribution/distribution-plot.tsx
22
+ var _ = { height: 160 }, v = [
23
+ 0,
24
+ .5,
25
+ 1
26
+ ], y = {
27
+ plot: {
28
+ k7Eaqz: "xeuugli",
29
+ k1xSpc: "xrvj5dj",
30
+ kumcoG: "x16lqc3j",
31
+ kOIVth: "xf0fr40",
32
+ $$css: !0
33
+ },
34
+ yAxis: {
35
+ kZKoxP: "x1ymw6g",
36
+ k1xSpc: "x78zum5",
37
+ kXwgrk: "xdt5ytf",
38
+ kjj79g: "x1qughib",
39
+ k9WMMc: "xp4054r",
40
+ kMwMTN: "xv9cywu",
41
+ kGuDYH: "xut3y95",
42
+ kLWn49: "xam3yii",
43
+ kcqcaj: "xss6m8b",
44
+ $$css: !0
45
+ },
46
+ svg: {
47
+ k1xSpc: "x1lliihq",
48
+ kzqmXN: "xh8yej3",
49
+ kZKoxP: "x1ymw6g",
50
+ kVQacm: "xb3r6kr",
51
+ $$css: !0
52
+ },
53
+ grid: {
54
+ kjVXCG: "xouukkm",
55
+ k5rJSQ: "x1ntoi03",
56
+ kREpy8: "x13efnbd",
57
+ $$css: !0
58
+ },
59
+ axis: {
60
+ k1xSpc: "x78zum5",
61
+ kjj79g: "x1qughib",
62
+ kOIVth: "xf0fr40",
63
+ kMwMTN: "xv9cywu",
64
+ kGuDYH: "xut3y95",
65
+ kLWn49: "xam3yii",
66
+ kcqcaj: "xss6m8b",
67
+ $$css: !0
68
+ },
69
+ axisNames: {
70
+ kBCFzs: "x1osaytk",
71
+ k1xSpc: "x78zum5",
72
+ kjj79g: "x1qughib",
73
+ kOIVth: "xtmze7h",
74
+ $$css: !0
75
+ },
76
+ label: {
77
+ kMwMTN: "xv9cywu",
78
+ kGuDYH: "xut3y95",
79
+ kLWn49: "xam3yii",
80
+ kHjlTd: "xj0a0fe",
81
+ $$css: !0
82
+ },
83
+ values: {
84
+ k1xSpc: "xrvj5dj",
85
+ k7Eaqz: "xeuugli",
86
+ $$css: !0
87
+ },
88
+ value: {
89
+ k1xSpc: "x78zum5",
90
+ kjj79g: "x1qughib",
91
+ kOIVth: "xlye18i",
92
+ k7Eaqz: "xeuugli",
93
+ kzqmXN: "xh8yej3",
94
+ $$css: !0
95
+ },
96
+ summary: {
97
+ kcqcaj: "xss6m8b",
98
+ kHjlTd: "xj0a0fe",
99
+ k9WMMc: "xp4054r",
100
+ $$css: !0
101
+ },
102
+ row: {
103
+ k1xSpc: "xrvj5dj",
104
+ kumcoG: "x95ly28 xxqvxzq",
105
+ kOIVth: "xtmze7h",
106
+ kGNEyG: "x6s0dn4",
107
+ k7Eaqz: "xeuugli",
108
+ kzqmXN: "xh8yej3",
109
+ $$css: !0
110
+ },
111
+ rowAxis: {
112
+ kB7OPa: "x9f619",
113
+ kg3NbH: "x13hf59f",
114
+ $$css: !0
115
+ },
116
+ axisSpacer: {
117
+ k1xSpc: "x1lliihq x1xhvs3c",
118
+ $$css: !0
119
+ },
120
+ rowLabel: {
121
+ k7Eaqz: "xeuugli",
122
+ k1xSpc: "xrvj5dj",
123
+ kOIVth: "x1r8op4a",
124
+ kHjlTd: "xj0a0fe",
125
+ $$css: !0
126
+ },
127
+ rowValue: {
128
+ kMwMTN: "xv9cywu",
129
+ kcqcaj: "xss6m8b",
130
+ $$css: !0
131
+ },
132
+ rowSvg: {
133
+ k1xSpc: "x1lliihq",
134
+ kzqmXN: "xh8yej3",
135
+ kZKoxP: "x1fgtraw",
136
+ kVQacm: "xb3r6kr",
137
+ $$css: !0
138
+ },
139
+ empty: {
140
+ kogj98: "x1ghz6dp",
141
+ kMwMTN: "xv9cywu",
142
+ kGuDYH: "x118kxxs",
143
+ kLWn49: "x1hyyzld",
144
+ $$css: !0
145
+ },
146
+ baseline: {
147
+ kjVXCG: "xouukkm",
148
+ kREpy8: "x13efnbd",
149
+ $$css: !0
150
+ },
151
+ missing: {
152
+ kDwRjp: "x14xvmve",
153
+ kjVXCG: "x1ce36ez",
154
+ k5rJSQ: "x1ntoi03",
155
+ kREpy8: "x13efnbd",
156
+ $$css: !0
157
+ }
158
+ };
159
+ function b({ xDomain: e, yDomain: t, xLabel: n, yLabel: r, formatX: i, formatY: a, children: o }) {
160
+ let { ref: c, width: l } = s(), f = v.map((t) => e[0] + t * (e[1] - e[0])), p = v.map((e) => t[1] - e * (t[1] - t[0]));
161
+ return /* @__PURE__ */ d("div", {
162
+ className: "xeuugli xrvj5dj x16lqc3j xf0fr40",
163
+ children: [
164
+ /* @__PURE__ */ d("div", {
165
+ className: "x1osaytk x78zum5 x1qughib xtmze7h",
166
+ children: [/* @__PURE__ */ u("span", {
167
+ className: "xv9cywu xut3y95 xam3yii xj0a0fe",
168
+ children: r
169
+ }), /* @__PURE__ */ u("span", {
170
+ className: "xv9cywu xut3y95 xam3yii xj0a0fe",
171
+ children: n
172
+ })]
173
+ }),
174
+ /* @__PURE__ */ u("div", {
175
+ "aria-hidden": !0,
176
+ className: "x1ymw6g x78zum5 xdt5ytf x1qughib xp4054r xv9cywu xut3y95 xam3yii xss6m8b",
177
+ children: p.map((e) => /* @__PURE__ */ u("span", { children: a(e) }, e))
178
+ }),
179
+ /* @__PURE__ */ u("div", {
180
+ ref: c,
181
+ children: /* @__PURE__ */ d("svg", {
182
+ "aria-hidden": !0,
183
+ viewBox: `0 0 ${l} ${_.height}`,
184
+ preserveAspectRatio: "none",
185
+ className: "x1lliihq xh8yej3 x1ymw6g xb3r6kr",
186
+ children: [v.map((e) => /* @__PURE__ */ u("line", {
187
+ x1: 0,
188
+ x2: l,
189
+ y1: _.height * e,
190
+ y2: _.height * e,
191
+ className: "xouukkm x1ntoi03 x13efnbd"
192
+ }, e)), o(l)]
193
+ })
194
+ }),
195
+ /* @__PURE__ */ u("span", {}),
196
+ /* @__PURE__ */ u("div", {
197
+ "aria-hidden": !0,
198
+ className: "x78zum5 x1qughib xf0fr40 xv9cywu xut3y95 xam3yii xss6m8b",
199
+ children: f.map((e) => /* @__PURE__ */ u("span", { children: i(e) }, e))
200
+ })
201
+ ]
202
+ });
203
+ }
204
+ function x({ domain: e, formatValue: t }) {
205
+ return /* @__PURE__ */ d("div", {
206
+ className: "x78zum5 x1qughib xf0fr40 xv9cywu xut3y95 xam3yii xss6m8b",
207
+ children: [/* @__PURE__ */ u("span", { children: t(e[0]) }), /* @__PURE__ */ u("span", { children: t(e[1]) })]
208
+ });
209
+ }
210
+ // packages/charts/src/distribution/histogram.tsx
211
+ function S({ title: r, description: a, bins: s, domain: m, maximumCount: h, valueLabel: g, countLabel: v, formatValue: x, formatCount: S, tone: w = "series1", selection: T, emptyLabel: E = "No histogram bins are available." }) {
212
+ let D = C({
213
+ bins: s,
214
+ domain: m,
215
+ maximumCount: h
216
+ });
217
+ if (D !== void 0) return /* @__PURE__ */ u(o, {
218
+ title: r,
219
+ description: a,
220
+ message: D
221
+ });
222
+ let O = f({
223
+ domain: [0, h],
224
+ range: [_.height, 0]
225
+ });
226
+ return /* @__PURE__ */ u(i, {
227
+ title: r,
228
+ description: a,
229
+ children: s.length === 0 ? /* @__PURE__ */ u("p", {
230
+ ...c.props(y.empty),
231
+ children: E
232
+ }) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(b, {
233
+ xDomain: m,
234
+ yDomain: [0, h],
235
+ xLabel: g,
236
+ yLabel: v,
237
+ formatX: x,
238
+ formatY: S,
239
+ children: (e) => {
240
+ let t = f({
241
+ domain: [...m],
242
+ range: [0, e]
243
+ });
244
+ return s.map((e) => {
245
+ let r = t(e.lowerBound), i = t(e.upperBound) - r, a = Math.min(2, i * .2), o = T?.selectedId === e.id;
246
+ if (e.count === null) return /* @__PURE__ */ u(p, {
247
+ x: r + a / 2,
248
+ y: _.height - 6,
249
+ width: i - a,
250
+ height: 5,
251
+ ...c.props(y.missing)
252
+ }, e.id);
253
+ let s = O(e.count);
254
+ return /* @__PURE__ */ u(p, {
255
+ x: r + a / 2,
256
+ y: s,
257
+ width: i - a,
258
+ height: _.height - s,
259
+ fill: n[w],
260
+ opacity: T?.selectedId === void 0 || o ? 1 : .45
261
+ }, e.id);
262
+ });
263
+ }
264
+ }), /* @__PURE__ */ u(t, { children: /* @__PURE__ */ u("div", {
265
+ ...c.props(y.values),
266
+ children: s.map((t) => {
267
+ let n = t.count === null ? "Unavailable" : S(t.count), r = `${x(t.lowerBound)} – ${x(t.upperBound)}`;
268
+ return /* @__PURE__ */ u(e, {
269
+ label: `${t.label}, ${r}, ${v}: ${n}`,
270
+ selected: T?.selectedId === t.id,
271
+ onSelect: T === void 0 ? void 0 : () => T.onSelect(t.id),
272
+ children: /* @__PURE__ */ d("span", {
273
+ ...c.props(y.value),
274
+ children: [/* @__PURE__ */ d("span", { children: [
275
+ t.label,
276
+ " · ",
277
+ r
278
+ ] }), /* @__PURE__ */ u("span", {
279
+ ...c.props(y.summary),
280
+ children: n
281
+ })]
282
+ })
283
+ }, t.id);
284
+ })
285
+ }) })] })
286
+ });
287
+ }
288
+ function C({ bins: e, domain: t, maximumCount: n }) {
289
+ let r = h({
290
+ items: e,
291
+ domain: t,
292
+ maxEntries: m.bins
293
+ });
294
+ if (r !== void 0) return r;
295
+ if (!Number.isFinite(n) || n <= 0) return "The histogram count domain must have a finite maximum greater than zero.";
296
+ for (let [r, i] of e.entries()) {
297
+ if (g(i.lowerBound, t) || g(i.upperBound, t)) return `Histogram bin ${i.id} has a non-finite bound or lies outside the declared domain.`;
298
+ let a = e[r - 1];
299
+ if (i.lowerBound >= i.upperBound || a !== void 0 && i.lowerBound < a.upperBound) return `Histogram bin ${i.id} is reversed, overlaps another bin, or is out of order.`;
300
+ if (i.count !== null && (!Number.isFinite(i.count) || i.count < 0 || i.count > n)) return `Histogram bin ${i.id} has a count outside the declared count domain.`;
301
+ }
302
+ }
303
+ // packages/charts/src/distribution/ecdf.tsx
304
+ function w({ title: r, description: a, points: s, domain: p, valueLabel: m, probabilityLabel: h, formatValue: g, formatProbability: v, tone: x = "series1", selection: S, emptyLabel: C = "No cumulative distribution points are available." }) {
305
+ let w = T({
306
+ points: s,
307
+ domain: p
308
+ });
309
+ if (w !== void 0) return /* @__PURE__ */ u(o, {
310
+ title: r,
311
+ description: a,
312
+ message: w
313
+ });
314
+ let E = f({
315
+ domain: [0, 1],
316
+ range: [_.height, 0]
317
+ });
318
+ return /* @__PURE__ */ u(i, {
319
+ title: r,
320
+ description: a,
321
+ children: s.length === 0 ? /* @__PURE__ */ u("p", {
322
+ ...c.props(y.empty),
323
+ children: C
324
+ }) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(b, {
325
+ xDomain: p,
326
+ yDomain: [0, 1],
327
+ xLabel: m,
328
+ yLabel: h,
329
+ formatX: g,
330
+ formatY: v,
331
+ children: (e) => {
332
+ let t = f({
333
+ domain: [...p],
334
+ range: [0, e]
335
+ }), r = s.map((e, n) => {
336
+ if (e.probability === null) return "";
337
+ let r = t(e.value), i = E(e.probability), a = s[n - 1];
338
+ return a === void 0 || a.probability === null ? `M ${r} ${i}` : `H ${r} V ${i}`;
339
+ }).join(" ");
340
+ return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("path", {
341
+ d: r,
342
+ fill: "none",
343
+ stroke: n[x],
344
+ strokeWidth: 2,
345
+ vectorEffect: "non-scaling-stroke"
346
+ }), s.map((e) => e.probability === null ? null : /* @__PURE__ */ u("circle", {
347
+ cx: t(e.value),
348
+ cy: E(e.probability),
349
+ r: S?.selectedId === e.id ? 4 : 2,
350
+ fill: n[x]
351
+ }, e.id))] });
352
+ }
353
+ }), /* @__PURE__ */ u(t, { children: /* @__PURE__ */ u("div", {
354
+ ...c.props(y.values),
355
+ children: s.map((t) => {
356
+ let n = g(t.value), r = t.probability === null ? "Unavailable" : v(t.probability);
357
+ return /* @__PURE__ */ u(e, {
358
+ label: `${m}: ${n}, ${h}: ${r}`,
359
+ selected: S?.selectedId === t.id,
360
+ onSelect: S === void 0 ? void 0 : () => S.onSelect(t.id),
361
+ children: /* @__PURE__ */ d("span", {
362
+ ...c.props(y.value),
363
+ children: [/* @__PURE__ */ u("span", { children: n }), /* @__PURE__ */ u("span", {
364
+ ...c.props(y.summary),
365
+ children: r
366
+ })]
367
+ })
368
+ }, t.id);
369
+ })
370
+ }) })] })
371
+ });
372
+ }
373
+ function T({ points: e, domain: t }) {
374
+ let n = h({
375
+ items: e,
376
+ domain: t,
377
+ maxEntries: m.cumulativePoints
378
+ });
379
+ if (n !== void 0) return n;
380
+ let r = {
381
+ value: t[0],
382
+ probability: 0
383
+ };
384
+ for (let n of e) {
385
+ if (g(n.value, t) || n.value < r.value) return `Cumulative point ${n.id} is non-finite, outside the domain, or out of order.`;
386
+ if (n.probability !== null) {
387
+ if (!Number.isFinite(n.probability) || n.probability < r.probability || n.probability > 1) return `Cumulative point ${n.id} must have a probability from zero to one that does not decrease.`;
388
+ r.probability = n.probability;
389
+ }
390
+ r.value = n.value;
391
+ }
392
+ }
393
+ // packages/charts/src/distribution/interval-plot.tsx
394
+ function E({ title: t, description: r, items: a, domain: l, valueLabel: p, intervalLabel: m, formatValue: h, selection: g, emptyLabel: _ = "No interval estimates are available." }) {
395
+ let { ref: v, width: b } = s(), S = D({
396
+ items: a,
397
+ domain: l
398
+ });
399
+ if (S !== void 0) return /* @__PURE__ */ u(o, {
400
+ title: t,
401
+ description: r,
402
+ message: S
403
+ });
404
+ let C = f({
405
+ domain: [...l],
406
+ range: [0, b]
407
+ });
408
+ return /* @__PURE__ */ u(i, {
409
+ title: t,
410
+ description: r,
411
+ footer: `${p} · ${m}`,
412
+ children: a.length === 0 ? /* @__PURE__ */ u("p", {
413
+ ...c.props(y.empty),
414
+ children: _
415
+ }) : /* @__PURE__ */ d("div", {
416
+ ...c.props(y.values),
417
+ children: [a.map((t) => {
418
+ let r = t.estimate === null ? "Estimate unavailable" : h(t.estimate), i = `${m}: ${t.lower === null ? "Unavailable" : h(t.lower)} – ${t.upper === null ? "Unavailable" : h(t.upper)}`, a = n[t.tone ?? "series1"];
419
+ return /* @__PURE__ */ u(e, {
420
+ label: `${t.label}, ${p}: ${r}, ${i}`,
421
+ selected: g?.selectedId === t.id,
422
+ onSelect: g === void 0 ? void 0 : () => g.onSelect(t.id),
423
+ children: /* @__PURE__ */ d("span", {
424
+ ...c.props(y.row),
425
+ children: [/* @__PURE__ */ d("span", {
426
+ ...c.props(y.rowLabel),
427
+ children: [
428
+ /* @__PURE__ */ u("span", { children: t.label }),
429
+ /* @__PURE__ */ u("span", {
430
+ ...c.props(y.rowValue),
431
+ children: r
432
+ }),
433
+ /* @__PURE__ */ u("span", {
434
+ ...c.props(y.label),
435
+ children: i
436
+ })
437
+ ]
438
+ }), /* @__PURE__ */ d("svg", {
439
+ "aria-hidden": !0,
440
+ viewBox: `0 0 ${b} 28`,
441
+ preserveAspectRatio: "none",
442
+ ...c.props(y.rowSvg),
443
+ children: [
444
+ /* @__PURE__ */ u("line", {
445
+ x1: 0,
446
+ x2: b,
447
+ y1: 14,
448
+ y2: 14,
449
+ ...c.props(y.baseline)
450
+ }),
451
+ t.lower !== null && t.upper !== null && /* @__PURE__ */ d("g", {
452
+ stroke: a,
453
+ strokeWidth: 2,
454
+ vectorEffect: "non-scaling-stroke",
455
+ children: [
456
+ /* @__PURE__ */ u("line", {
457
+ x1: C(t.lower),
458
+ x2: C(t.upper),
459
+ y1: 14,
460
+ y2: 14
461
+ }),
462
+ /* @__PURE__ */ u("line", {
463
+ x1: C(t.lower),
464
+ x2: C(t.lower),
465
+ y1: 9,
466
+ y2: 19
467
+ }),
468
+ /* @__PURE__ */ u("line", {
469
+ x1: C(t.upper),
470
+ x2: C(t.upper),
471
+ y1: 9,
472
+ y2: 19
473
+ })
474
+ ]
475
+ }),
476
+ t.estimate !== null && /* @__PURE__ */ u("circle", {
477
+ cx: C(t.estimate),
478
+ cy: 14,
479
+ r: 4,
480
+ fill: a
481
+ })
482
+ ]
483
+ })]
484
+ })
485
+ }, t.id);
486
+ }), /* @__PURE__ */ d("div", {
487
+ ...c.props(y.row, y.rowAxis),
488
+ children: [/* @__PURE__ */ u("span", { ...c.props(y.axisSpacer) }), /* @__PURE__ */ u("div", {
489
+ ref: v,
490
+ children: /* @__PURE__ */ u(x, {
491
+ domain: l,
492
+ formatValue: h
493
+ })
494
+ })]
495
+ })]
496
+ })
497
+ });
498
+ }
499
+ function D({ items: e, domain: t }) {
500
+ let n = h({
501
+ items: e,
502
+ domain: t,
503
+ maxEntries: m.rows
504
+ });
505
+ if (n !== void 0) return n;
506
+ for (let n of e) {
507
+ if ([
508
+ n.lower,
509
+ n.estimate,
510
+ n.upper
511
+ ].some((e) => e !== null && g(e, t))) return `Interval ${n.id} has a non-finite value or lies outside the declared domain.`;
512
+ if (n.lower !== null && n.upper !== null && n.lower > n.upper) return `Interval ${n.id} has reversed endpoints.`;
513
+ if (n.estimate !== null) {
514
+ if (n.lower !== null && n.estimate < n.lower) return `Interval ${n.id} has an estimate below its lower endpoint.`;
515
+ if (n.upper !== null && n.estimate > n.upper) return `Interval ${n.id} has an estimate above its upper endpoint.`;
516
+ }
517
+ }
518
+ }
519
+ // packages/charts/src/distribution/ranked-bars.tsx
520
+ function O({ title: t, description: r, items: a, domain: l, valueLabel: m, formatValue: h, selection: g, emptyLabel: _ = "No ranked values are available." }) {
521
+ let { ref: v, width: b } = s(), S = k({
522
+ items: a,
523
+ domain: l
524
+ });
525
+ if (S !== void 0) return /* @__PURE__ */ u(o, {
526
+ title: t,
527
+ description: r,
528
+ message: S
529
+ });
530
+ let C = f({
531
+ domain: [...l],
532
+ range: [0, b]
533
+ }), w = C(0);
534
+ return /* @__PURE__ */ u(i, {
535
+ title: t,
536
+ description: r,
537
+ footer: m,
538
+ children: a.length === 0 ? /* @__PURE__ */ u("p", {
539
+ ...c.props(y.empty),
540
+ children: _
541
+ }) : /* @__PURE__ */ d("div", {
542
+ ...c.props(y.values),
543
+ children: [a.map((t) => {
544
+ let r = t.value === null ? "Unavailable" : h(t.value), i = t.rank === void 0 ? t.label : `${t.rank} · ${t.label}`, a = n[t.tone ?? "series1"];
545
+ return /* @__PURE__ */ u(e, {
546
+ label: `${i}, ${m}: ${r}`,
547
+ selected: g?.selectedId === t.id,
548
+ onSelect: g === void 0 ? void 0 : () => g.onSelect(t.id),
549
+ children: /* @__PURE__ */ d("span", {
550
+ ...c.props(y.row),
551
+ children: [/* @__PURE__ */ d("span", {
552
+ ...c.props(y.rowLabel),
553
+ children: [/* @__PURE__ */ u("span", { children: i }), /* @__PURE__ */ u("span", {
554
+ ...c.props(y.rowValue),
555
+ children: r
556
+ })]
557
+ }), /* @__PURE__ */ d("svg", {
558
+ "aria-hidden": !0,
559
+ viewBox: `0 0 ${b} 28`,
560
+ preserveAspectRatio: "none",
561
+ ...c.props(y.rowSvg),
562
+ children: [/* @__PURE__ */ u("line", {
563
+ x1: w,
564
+ x2: w,
565
+ y1: 3,
566
+ y2: 25,
567
+ ...c.props(y.baseline)
568
+ }), t.value !== null && (t.value === 0 ? /* @__PURE__ */ u("line", {
569
+ x1: w,
570
+ x2: w,
571
+ y1: 10,
572
+ y2: 18,
573
+ stroke: a,
574
+ strokeWidth: 2,
575
+ vectorEffect: "non-scaling-stroke"
576
+ }) : /* @__PURE__ */ u(p, {
577
+ x: Math.min(w, C(t.value)),
578
+ y: 10,
579
+ width: Math.abs(C(t.value) - w),
580
+ height: 8,
581
+ fill: a
582
+ }))]
583
+ })]
584
+ })
585
+ }, t.id);
586
+ }), /* @__PURE__ */ d("div", {
587
+ ...c.props(y.row, y.rowAxis),
588
+ children: [/* @__PURE__ */ u("span", { ...c.props(y.axisSpacer) }), /* @__PURE__ */ u("div", {
589
+ ref: v,
590
+ children: /* @__PURE__ */ u(x, {
591
+ domain: l,
592
+ formatValue: h
593
+ })
594
+ })]
595
+ })]
596
+ })
597
+ });
598
+ }
599
+ function k({ items: e, domain: t }) {
600
+ let n = h({
601
+ items: e,
602
+ domain: t,
603
+ maxEntries: m.rows
604
+ });
605
+ if (n !== void 0) return n;
606
+ if (t[0] > 0 || t[1] < 0) return "The ranked-value domain must include zero.";
607
+ for (let n of e) if (n.value !== null && g(n.value, t)) return `Ranked value ${n.id} is non-finite or lies outside the declared domain.`;
608
+ }
609
+ export { S as i, E as n, w as r, O as t };