@mechane-ai/elements 0.46.0 → 0.47.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 (276) hide show
  1. package/README.md +306 -33
  2. package/dist/ai.js +4 -4
  3. package/dist/catalog.json +2382 -33
  4. package/dist/categorical-values-DdfGIowV.js +107 -0
  5. package/dist/cells--Bd1fQFR.js +384 -0
  6. package/dist/chart-link-AE_xuxiP.js +35 -0
  7. package/dist/chart-tones-ei3BC2AL.js +27 -0
  8. package/dist/charts/cartesian.js +1 -2958
  9. package/dist/charts/cells.js +1 -0
  10. package/dist/charts/comparison.js +1 -0
  11. package/dist/charts/distribution.js +1 -781
  12. package/dist/charts/figure.js +3404 -0
  13. package/dist/charts/graph.js +1 -655
  14. package/dist/charts/hierarchy.js +1 -121
  15. package/dist/charts/image.js +1 -0
  16. package/dist/charts/matrix.js +3 -644
  17. package/dist/charts/plot.js +15 -0
  18. package/dist/charts/relationship.js +1 -0
  19. package/dist/charts/text.js +1 -0
  20. package/dist/charts/timeline.js +1 -266
  21. package/dist/charts/transforms.js +677 -0
  22. package/dist/charts/trend.js +1 -0
  23. package/dist/charts.js +8 -3
  24. package/dist/collections.js +1 -2195
  25. package/dist/color-legend-CIo7DhXB.js +62 -0
  26. package/dist/dates-Cww8UR_n.js +810 -0
  27. package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
  28. package/dist/embedding-map-CGM_k6lC.js +1929 -0
  29. package/dist/feedback.js +1 -1
  30. package/dist/figure-format-B8kRZMlo.js +36 -0
  31. package/dist/figure-frame-wRkIEAwe.js +270 -0
  32. package/dist/forms/dates.js +1 -810
  33. package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
  34. package/dist/image-grid-CVA4SOy_.js +598 -0
  35. package/dist/kits/evaluation.js +431 -0
  36. package/dist/kits/explainers.js +452 -0
  37. package/dist/kits/interpretability.js +1033 -0
  38. package/dist/kits/operations.js +239 -0
  39. package/dist/kits/training.js +335 -0
  40. package/dist/label-place-Z0fryBZb.js +42 -0
  41. package/dist/locate-Bcg3QcP4.js +11 -0
  42. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
  43. package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
  44. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
  45. package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
  46. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
  47. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
  48. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
  49. package/dist/packages/charts/src/cartesian/index.d.ts +5 -5
  50. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
  51. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
  52. package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
  53. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
  54. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
  55. package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
  56. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
  57. package/dist/packages/charts/src/cartesian/time-series.d.ts +60 -36
  58. package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
  59. package/dist/packages/charts/src/categorical-values.d.ts +1 -1
  60. package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
  61. package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
  62. package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
  63. package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
  64. package/dist/packages/charts/src/cells/index.d.ts +11 -0
  65. package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
  66. package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
  67. package/dist/packages/charts/src/chart-frame.d.ts +14 -7
  68. package/dist/packages/charts/src/chart-grid.d.ts +19 -0
  69. package/dist/packages/charts/src/chart-input.d.ts +1 -9
  70. package/dist/packages/charts/src/chart-link.d.ts +56 -0
  71. package/dist/packages/charts/src/chart.d.ts +0 -8
  72. package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
  73. package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
  74. package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
  75. package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
  76. package/dist/packages/charts/src/comparison/index.d.ts +6 -0
  77. package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
  78. package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
  79. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
  80. package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
  81. package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
  82. package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
  83. package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
  84. package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
  85. package/dist/packages/charts/src/distribution/index.d.ts +11 -0
  86. package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
  87. package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
  88. package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
  89. package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
  90. package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
  91. package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
  92. package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
  93. package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
  94. package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
  95. package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
  96. package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
  97. package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
  98. package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
  99. package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
  100. package/dist/packages/charts/src/graph/index.d.ts +6 -2
  101. package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
  102. package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
  103. package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
  104. package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
  105. package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
  106. package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
  107. package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
  108. package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
  109. package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
  110. package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
  111. package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
  112. package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
  113. package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
  114. package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
  115. package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
  116. package/dist/packages/charts/src/image/image-input.d.ts +27 -0
  117. package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
  118. package/dist/packages/charts/src/image/index.d.ts +7 -0
  119. package/dist/packages/charts/src/index.d.ts +15 -1
  120. package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
  121. package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
  122. package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
  123. package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
  124. package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
  125. package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
  126. package/dist/packages/charts/src/matrix/index.d.ts +14 -3
  127. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
  128. package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
  129. package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
  130. package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
  131. package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
  132. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
  133. package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
  134. package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
  135. package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
  136. package/dist/packages/charts/src/plot/contours.d.ts +45 -0
  137. package/dist/packages/charts/src/plot/index.d.ts +49 -0
  138. package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
  139. package/dist/packages/charts/src/plot/locate.d.ts +18 -0
  140. package/dist/packages/charts/src/plot/path.d.ts +39 -0
  141. package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
  142. package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
  143. package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
  144. package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
  145. package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
  146. package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
  147. package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
  148. package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
  149. package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
  150. package/dist/packages/charts/src/plot/scale.d.ts +48 -0
  151. package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
  152. package/dist/packages/charts/src/plot-width.d.ts +3 -2
  153. package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
  154. package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
  155. package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
  156. package/dist/packages/charts/src/relationship/index.d.ts +11 -0
  157. package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
  158. package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
  159. package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
  160. package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
  161. package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
  162. package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
  163. package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
  164. package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
  165. package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
  166. package/dist/packages/charts/src/spec/figure.d.ts +12 -0
  167. package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
  168. package/dist/packages/charts/src/spec/index.d.ts +10 -0
  169. package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
  170. package/dist/packages/charts/src/text/index.d.ts +11 -0
  171. package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
  172. package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
  173. package/dist/packages/charts/src/text/token-links.d.ts +49 -0
  174. package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
  175. package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
  176. package/dist/packages/charts/src/text/token-text.d.ts +39 -0
  177. package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
  178. package/dist/packages/charts/src/timeline/index.d.ts +3 -1
  179. package/dist/packages/charts/src/timeline/waterfall.d.ts +24 -13
  180. package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
  181. package/dist/packages/charts/src/transforms/density.d.ts +53 -0
  182. package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
  183. package/dist/packages/charts/src/transforms/index.d.ts +19 -0
  184. package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
  185. package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
  186. package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
  187. package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
  188. package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
  189. package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
  190. package/dist/packages/charts/src/transforms/values.d.ts +70 -0
  191. package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
  192. package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
  193. package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
  194. package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
  195. package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
  196. package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
  197. package/dist/packages/charts/src/trend/index.d.ts +10 -0
  198. package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
  199. package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
  200. package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
  201. package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
  202. package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
  203. package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
  204. package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
  205. package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
  206. package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
  207. package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
  208. package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
  209. package/dist/packages/kits/src/explainers/index.d.ts +8 -0
  210. package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
  211. package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
  212. package/dist/packages/kits/src/explainers/term.d.ts +29 -0
  213. package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
  214. package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
  215. package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
  216. package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
  217. package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
  218. package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
  219. package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
  220. package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
  221. package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
  222. package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
  223. package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
  224. package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
  225. package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
  226. package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
  227. package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
  228. package/dist/packages/kits/src/operations/index.d.ts +6 -0
  229. package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
  230. package/dist/packages/kits/src/training/index.d.ts +8 -0
  231. package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
  232. package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
  233. package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
  234. package/dist/packages/kits/src/training/run-state.d.ts +7 -0
  235. package/dist/packages/kits/src/training/run-table.d.ts +63 -0
  236. package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
  237. package/dist/packages/kits/src/training/runs.d.ts +34 -0
  238. package/dist/path-BglsXpnO.js +59 -0
  239. package/dist/plot-axes-DJkLW4wk.js +100 -0
  240. package/dist/plot-layout-BEuoOHbs.js +911 -0
  241. package/dist/plot-marks-A64v7aTw.js +226 -0
  242. package/dist/plot-surface-CJTIqtck.js +51 -0
  243. package/dist/plot-width-DcqtSgzb.js +124 -0
  244. package/dist/point-layer-C-EYETAt.js +655 -0
  245. package/dist/reference-lines-CWA8VeUR.js +82 -0
  246. package/dist/scale-C2xgZyZN.js +63 -0
  247. package/dist/slope-chart-DT22h_ym.js +1279 -0
  248. package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
  249. package/dist/src-D5NXRJZe.js +2195 -0
  250. package/dist/src-DIS0YOj0.js +44 -0
  251. package/dist/styles2.css +453 -62
  252. package/dist/time-series-IB3CB93O.js +2668 -0
  253. package/dist/token-heatmap-C00DnoNO.js +1354 -0
  254. package/dist/token-predictions-Cxx29iDr.js +1093 -0
  255. package/dist/tone-scope-DKiSw-JR.js +32 -0
  256. package/dist/tree-diagram-DsckNKaW.js +1629 -0
  257. package/dist/treemap-9_DpLCW9.js +472 -0
  258. package/dist/values-963L6n1m.js +65 -0
  259. package/dist/violin-plot-BhPHKXsN.js +1291 -0
  260. package/dist/waterfall-CGksuTy5.js +576 -0
  261. package/package.json +57 -4
  262. package/recipes/allocation-report.tsx +15 -7
  263. package/skills/extend-elements/SKILL.md +60 -0
  264. package/skills/review-elements/SKILL.md +43 -1
  265. package/skills/upgrade-elements/SKILL.md +3 -1
  266. package/skills/upgrade-elements/references/releases.md +184 -0
  267. package/skills/use-elements/SKILL.md +19 -13
  268. package/skills/use-elements/references/charts.md +362 -41
  269. package/skills/use-elements/references/figures.md +173 -0
  270. package/skills/use-elements/references/kits.md +198 -0
  271. package/dist/categorical-values-BXi-rJuv.js +0 -74
  272. package/dist/chart-data-CIJVWCYt.js +0 -21
  273. package/dist/chart-frame-BaxKn_MB.js +0 -236
  274. package/dist/chart-input-Bm82_9Rd.js +0 -22
  275. package/dist/chart-theme-4zprJ3rW.js +0 -404
  276. package/dist/plot-width-v2c_rA20.js +0 -63
@@ -0,0 +1,472 @@
1
+ import { t as e } from "./chart-tones-ei3BC2AL.js";
2
+ import { A as t, O as n, S as r, k as i, s as a, w as o } from "./plot-layout-BEuoOHbs.js";
3
+ import { i as s, n as c, t as l } from "./categorical-values-DdfGIowV.js";
4
+ import { i as u } from "./chart-link-AE_xuxiP.js";
5
+ import { a as d } from "./tone-scope-DKiSw-JR.js";
6
+ import { r as f } from "./figure-format-B8kRZMlo.js";
7
+ import { i as p, l as m, n as h, r as g, t as _ } from "./figure-frame-wRkIEAwe.js";
8
+ import { n as v } from "./plot-width-DcqtSgzb.js";
9
+ import { n as y, r as b } from "./plot-surface-CJTIqtck.js";
10
+ import * as x from "@stylexjs/stylex";
11
+ import { useId as S } from "react";
12
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
13
+ // packages/charts/src/hierarchy/area-mark.tsx
14
+ var E = {
15
+ rect: {
16
+ kjVXCG: "xaep1og",
17
+ kfJifR: "xnpr05h",
18
+ kVYP8I: "x1k77tgw",
19
+ $$css: !0
20
+ },
21
+ fill: (e) => [{
22
+ kDwRjp: e == null ? e : "x19zyb68",
23
+ $$css: !0
24
+ }, { "--x-fill": e ?? void 0 }],
25
+ cursor: {
26
+ kDwRjp: "xbh8q5q",
27
+ kfzvcC: "x47corl",
28
+ $$css: !0
29
+ }
30
+ }, D = 8, O = 18, k = 34, A = 40, j = 6.5, M = 12, N = 22;
31
+ function P({ cell: t, tone: n, label: r, valueLabel: i, labelWidth: a, isInspected: o = !1, isSelected: s = !1, isCursor: c = !1 }) {
32
+ let l = t.x1 - t.x0, u = t.y1 - t.y0, d = l > a && u >= N, f = Math.max(1, Math.floor((l - 16) / j)), p = r.length > f ? `${r.slice(0, f - 1)}…` : r, m = u < A, h = !m && i.length * M < l - 16, g = m ? u / 2 + 4 : O;
33
+ return /* @__PURE__ */ T("g", { children: [
34
+ /* @__PURE__ */ w("rect", {
35
+ x: t.x0,
36
+ y: t.y0,
37
+ width: Math.max(0, l),
38
+ height: Math.max(0, u),
39
+ ...x.props(E.rect, E.fill(e[n]), o && v.inspected, s && v.selected),
40
+ children: /* @__PURE__ */ w("title", { children: `${r}: ${i}` })
41
+ }),
42
+ c && /* @__PURE__ */ w("rect", {
43
+ x: t.x0 + 2,
44
+ y: t.y0 + 2,
45
+ width: Math.max(0, l - 4),
46
+ height: Math.max(0, u - 4),
47
+ ...x.props(E.cursor, v.shapeCursor)
48
+ }),
49
+ d && /* @__PURE__ */ T("svg", {
50
+ x: t.x0,
51
+ y: t.y0,
52
+ width: l,
53
+ height: u,
54
+ overflow: "hidden",
55
+ "aria-hidden": !0,
56
+ children: [/* @__PURE__ */ w("text", {
57
+ x: D,
58
+ y: g,
59
+ className: "xlrhuyr x1hz01jw xy8obcc",
60
+ children: p
61
+ }), h && /* @__PURE__ */ w("text", {
62
+ x: D,
63
+ y: k,
64
+ className: "xlrhuyr x1hz01jw xy8obcc",
65
+ children: i
66
+ })]
67
+ })
68
+ ] });
69
+ }
70
+ // packages/charts/src/hierarchy/partition-layout.ts
71
+ function F(e) {
72
+ return e.reduce((e, t) => e + t.value, 0);
73
+ }
74
+ function I({ nodes: e, width: t, height: n }) {
75
+ function r(t) {
76
+ let n = e.filter((e) => e.parentId === t.node.id), r = t.node.value === 0 ? 0 : (t.x1 - t.x0) / t.node.value;
77
+ return n.map((e, i) => {
78
+ let a = t.x0 + F(n.slice(0, i)) * r;
79
+ return {
80
+ node: e,
81
+ x0: a,
82
+ x1: a + e.value * r,
83
+ depth: t.depth + 1
84
+ };
85
+ });
86
+ }
87
+ let i = e.filter((e) => e.parentId === null).map((e) => ({
88
+ node: e,
89
+ x0: 0,
90
+ x1: t,
91
+ depth: 0
92
+ }));
93
+ function* a() {
94
+ let e = { spans: i };
95
+ for (; e.spans.length > 0;) yield e.spans, e.spans = e.spans.flatMap(r);
96
+ }
97
+ let o = Array.from(a()).flat(), s = n / (Math.max(0, ...o.map((e) => e.depth)) + 1);
98
+ return o.map(({ node: e, x0: t, x1: n, depth: r }) => ({
99
+ id: e.id,
100
+ depth: r,
101
+ x0: t,
102
+ x1: n,
103
+ y0: r * s,
104
+ y1: (r + 1) * s
105
+ }));
106
+ }
107
+ function L(e, t, n) {
108
+ return e.find((e) => {
109
+ let r = t >= e.x0 && t < e.x1, i = n >= e.y0 && n < e.y1;
110
+ return r && i;
111
+ });
112
+ }
113
+ // packages/charts/src/hierarchy/icicle.tsx
114
+ var R = {
115
+ nodes: 500,
116
+ depth: 8
117
+ }, z = {
118
+ style: "percent",
119
+ maximumFractionDigits: 1
120
+ }, B = 48, V = " › ";
121
+ function H(e, t, n) {
122
+ if (t.parentId === null) return 0;
123
+ let r = e.find((e) => e.id === t.parentId);
124
+ if (r === void 0 || n.has(r.id)) return;
125
+ let i = H(e, r, /* @__PURE__ */ new Set([...n, t.id]));
126
+ return i === void 0 ? void 0 : i + 1;
127
+ }
128
+ function ee(e) {
129
+ if (e.length > R.nodes) return `This chart draws at most ${R.nodes} nodes. Supply a coarser hierarchy.`;
130
+ if (!t(e)) return "Hierarchy nodes must have unique identifiers.";
131
+ if (e.filter((e) => e.parentId === null).length !== 1) return "A hierarchy needs exactly one root node with a null parent.";
132
+ let n = e.map((t) => H(e, t, /* @__PURE__ */ new Set([t.id])));
133
+ if (n.includes(void 0)) return "Every node must name a supplied parent, and the parents must not form a cycle.";
134
+ if (n.some((e) => e !== void 0 && e > R.depth)) return `This chart draws at most ${R.depth} levels below the root.`;
135
+ if (e.some((e) => e.value !== null && (!Number.isFinite(e.value) || e.value < 0))) return "Node values must be finite and nonnegative, or explicitly missing.";
136
+ let r = e.find((t) => {
137
+ let n = e.filter((e) => e.parentId === t.id), r = n.reduce((e, t) => e + (t.value ?? 0), 0);
138
+ return t.value !== null && r > t.value * (1 + 2 ** -52 * n.length);
139
+ });
140
+ return r === void 0 ? void 0 : `${r.label} is less than the sum of its children. Supply each node's own total.`;
141
+ }
142
+ function U({ nodes: e, valueFormat: t, selected: s, onSelectedChange: c, height: l = "regular", ...v }) {
143
+ let { emptyLabel: x = "No hierarchy was supplied.", ...E } = v, { locale: D, title: O } = E, k = b(l), A = S(), j = d(), M = u();
144
+ if (E.status === "loading") return /* @__PURE__ */ w(p, {
145
+ ...E,
146
+ height: l
147
+ });
148
+ let N = e.length === 0 ? void 0 : ee(e);
149
+ if (N !== void 0) return /* @__PURE__ */ w(g, {
150
+ ...E,
151
+ message: N
152
+ });
153
+ let F = new Map(e.map((e) => [e.id, e]));
154
+ function R(e) {
155
+ let t = e.parentId === null ? void 0 : F.get(e.parentId);
156
+ return t === void 0 ? [] : [...R(t), t];
157
+ }
158
+ let H = e.find((e) => e.parentId === null), U = e.filter((e) => e.parentId === H?.id);
159
+ function W(e) {
160
+ let t = [...R(e), e].find((e) => e.parentId === H?.id), n = t === void 0 ? -1 : U.indexOf(t), r = [e, ...R(e).toReversed()].find((e) => e.tone !== void 0)?.tone;
161
+ return r !== void 0 || t === void 0 ? r ?? "neutral" : j({
162
+ id: t.id,
163
+ tone: t.tone,
164
+ index: n
165
+ });
166
+ }
167
+ let G = e.flatMap((e) => [e, ...R(e)].every((e) => e.value !== null) && e.value !== null ? [{
168
+ id: e.id,
169
+ parentId: e.parentId,
170
+ value: e.value
171
+ }] : []), K = a({
172
+ width: k.width,
173
+ height: k.height,
174
+ margins: {
175
+ top: 0,
176
+ right: 0,
177
+ bottom: 0,
178
+ left: 0
179
+ }
180
+ }), q = I({
181
+ nodes: G,
182
+ width: K.width,
183
+ height: K.height
184
+ });
185
+ function J(e) {
186
+ return f({
187
+ value: e,
188
+ locale: D,
189
+ format: t
190
+ });
191
+ }
192
+ function Y(e) {
193
+ let t = R(e).map((e) => e.label), n = t.length === 0 ? "" : ` (${t.join(V)})`, r = H?.value ?? null, i = r !== null && r > 0, a = e.value !== null && i && e !== H ? `, ${f({
194
+ value: e.value / r,
195
+ locale: D,
196
+ format: z
197
+ })} of ${H?.label ?? ""}` : "";
198
+ return `${e.label}${n}: ${J(e.value)}${a}`;
199
+ }
200
+ let X = q.flatMap((e) => {
201
+ let t = F.get(e.id);
202
+ return t === void 0 ? [] : [{
203
+ cell: e,
204
+ node: t,
205
+ tone: W(t),
206
+ label: Y(t)
207
+ }];
208
+ }), Z = X.map((e) => ({
209
+ id: e.node.id,
210
+ label: e.label
211
+ })), Q = new Map(X.map(({ cell: e }) => [e.id, {
212
+ left: e.x0,
213
+ top: e.y0,
214
+ right: e.x1,
215
+ bottom: e.y1
216
+ }])), $ = e.length - G.length;
217
+ return /* @__PURE__ */ w(o, {
218
+ ...M,
219
+ items: Z,
220
+ place: (e) => Q.get(e),
221
+ locate: (e) => L(q, e.x / e.width * K.width, e.y / e.height * K.height)?.id,
222
+ selected: s ?? null,
223
+ onSelect: c,
224
+ render: (t, { inspected: a, cursor: o }) => /* @__PURE__ */ w(h, {
225
+ ...E,
226
+ figure: t,
227
+ footer: /* @__PURE__ */ w(r, {
228
+ id: A,
229
+ children: n(Z, a)
230
+ }),
231
+ children: e.length === 0 ? /* @__PURE__ */ w(_, { children: x }) : /* @__PURE__ */ T(C, { children: [
232
+ /* @__PURE__ */ w(y, {
233
+ plotRef: k.ref,
234
+ box: K,
235
+ label: i({
236
+ title: O,
237
+ marks: "nodes",
238
+ isSelectable: c !== void 0
239
+ }),
240
+ readoutId: A,
241
+ children: X.map(({ cell: e, node: t, tone: n }) => /* @__PURE__ */ w(P, {
242
+ cell: e,
243
+ tone: n,
244
+ label: t.label,
245
+ valueLabel: J(t.value),
246
+ labelWidth: B,
247
+ isInspected: a === t.id,
248
+ isSelected: s === t.id,
249
+ isCursor: o === t.id
250
+ }, t.id))
251
+ }),
252
+ $ > 0 && /* @__PURE__ */ T("p", {
253
+ className: "x153jb6y x1ghz6dp xyrmp21 xy8obcc",
254
+ children: [
255
+ $ === 1 ? "One node has" : `${$} nodes have`,
256
+ " no area: its value or a parent's value is",
257
+ " ",
258
+ "unavailable",
259
+ "."
260
+ ]
261
+ }),
262
+ /* @__PURE__ */ w(m, {
263
+ label: `${O} nodes`,
264
+ columns: [
265
+ {
266
+ id: "node",
267
+ label: "Node"
268
+ },
269
+ {
270
+ id: "parent",
271
+ label: "Parent"
272
+ },
273
+ {
274
+ id: "value",
275
+ label: "Value"
276
+ }
277
+ ],
278
+ rows: e.map((e) => ({
279
+ id: e.id,
280
+ values: [
281
+ e.label,
282
+ e.parentId === null ? "" : F.get(e.parentId)?.label ?? "",
283
+ Y(e)
284
+ ]
285
+ }))
286
+ })
287
+ ] })
288
+ })
289
+ });
290
+ }
291
+ // packages/charts/src/hierarchy/treemap-layout.ts
292
+ var W = Math.sqrt(5), G = .5, K = (1 + W) * G;
293
+ function q(e) {
294
+ return e.reduce((e, t) => e + t.value, 0);
295
+ }
296
+ function J(e, t, n) {
297
+ let r = t.x1 - t.x0, i = t.y1 - t.y0, a = Math.max(i / r, r / i) / (n * K), o = e.map((t, n) => {
298
+ let r = e.slice(0, n + 1).map((e) => e.value), i = r.reduce((e, t) => e + t, 0), o = i * i * a;
299
+ return Math.max(Math.max(...r) / o, o / Math.min(...r));
300
+ }), s = o.findIndex((e, t) => t > 0 && e > (o[t - 1] ?? e));
301
+ return s === -1 ? e.length : s;
302
+ }
303
+ function Y(e, t, n) {
304
+ let r = q(e);
305
+ return e.map((i, a) => {
306
+ let o = q(e.slice(0, a)), s = r === 0 ? 0 : o / r, c = r === 0 ? 0 : (o + i.value) / r;
307
+ if (n) {
308
+ let e = t.x1 - t.x0;
309
+ return {
310
+ id: i.id,
311
+ x0: t.x0 + e * s,
312
+ x1: t.x0 + e * c,
313
+ y0: t.y0,
314
+ y1: t.y1
315
+ };
316
+ }
317
+ let l = t.y1 - t.y0;
318
+ return {
319
+ id: i.id,
320
+ x0: t.x0,
321
+ x1: t.x1,
322
+ y0: t.y0 + l * s,
323
+ y1: t.y0 + l * c
324
+ };
325
+ });
326
+ }
327
+ function X({ items: e, rect: t, remaining: n }) {
328
+ let r = J(e, t, n), i = e.slice(0, r), a = q(i), o = n === 0 ? 1 : a / n, s = t.x1 - t.x0, c = t.y1 - t.y0, l = {
329
+ items: e.slice(r),
330
+ remaining: n - a
331
+ };
332
+ if (s < c) {
333
+ let e = t.y0 + c * o;
334
+ return {
335
+ cells: Y(i, {
336
+ ...t,
337
+ y1: e
338
+ }, !0),
339
+ rest: {
340
+ ...l,
341
+ rect: {
342
+ ...t,
343
+ y0: e
344
+ }
345
+ }
346
+ };
347
+ }
348
+ let u = t.x0 + s * o;
349
+ return {
350
+ cells: Y(i, {
351
+ ...t,
352
+ x1: u
353
+ }, !1),
354
+ rest: {
355
+ ...l,
356
+ rect: {
357
+ ...t,
358
+ x0: u
359
+ }
360
+ }
361
+ };
362
+ }
363
+ function* Z(e) {
364
+ let t = { pending: e };
365
+ for (; t.pending.items.length > 0;) {
366
+ let e = X(t.pending);
367
+ yield* e.cells, t.pending = e.rest;
368
+ }
369
+ }
370
+ function Q({ items: e, width: t, height: n, gap: r = 0 }) {
371
+ let i = r * G, a = {
372
+ x0: -i,
373
+ y0: -i,
374
+ x1: t + i,
375
+ y1: n + i
376
+ };
377
+ return Array.from(Z({
378
+ items: e,
379
+ rect: a,
380
+ remaining: q(e)
381
+ }), (e) => {
382
+ let t = e.x0 + i, n = e.x1 - i, r = e.y0 + i, a = e.y1 - i;
383
+ return {
384
+ id: e.id,
385
+ x0: n < t ? (t + n) * G : t,
386
+ x1: n < t ? (t + n) * G : n,
387
+ y0: a < r ? (r + a) * G : r,
388
+ y1: a < r ? (r + a) * G : a
389
+ };
390
+ });
391
+ }
392
+ // packages/charts/src/hierarchy/treemap.tsx
393
+ var $ = 2, te = 96;
394
+ function ne({ items: e, valueFormat: t, selected: n, onSelectedChange: r, height: i = "compact", ...a }) {
395
+ let { emptyLabel: u = "No positive values to size the areas", ...m } = a, { locale: y, title: S } = m, { ref: C, width: E, height: D } = b(i), O = d();
396
+ if (m.status === "loading") return /* @__PURE__ */ w(p, {
397
+ ...m,
398
+ height: i
399
+ });
400
+ let k = s(e);
401
+ if (k !== void 0) return /* @__PURE__ */ w(g, {
402
+ ...m,
403
+ message: k
404
+ });
405
+ let A = e.map((e, n) => ({
406
+ id: e.id,
407
+ label: e.label,
408
+ valueLabel: f({
409
+ value: e.value,
410
+ locale: y,
411
+ format: t
412
+ }),
413
+ tone: O({
414
+ id: e.id,
415
+ tone: e.tone,
416
+ index: n
417
+ })
418
+ })), j = e.flatMap((e) => e.value === null || e.value === 0 ? [] : [{
419
+ id: e.id,
420
+ value: e.value
421
+ }]), M = Q({
422
+ items: j,
423
+ width: E,
424
+ height: D,
425
+ gap: $
426
+ });
427
+ return /* @__PURE__ */ w(o, {
428
+ items: c(A),
429
+ arrows: "both",
430
+ selected: n ?? null,
431
+ onSelect: r,
432
+ render: (t, n) => /* @__PURE__ */ T(h, {
433
+ ...m,
434
+ figure: t,
435
+ children: [
436
+ /* @__PURE__ */ w("div", {
437
+ ref: C,
438
+ ...x.props(v.plot),
439
+ children: j.length === 0 ? /* @__PURE__ */ w(_, { children: u }) : /* @__PURE__ */ w("svg", {
440
+ role: "img",
441
+ "aria-label": `${S}. Areas compare recorded values.`,
442
+ viewBox: `0 0 ${E} ${D}`,
443
+ height: D,
444
+ ...x.props(v.svg),
445
+ children: M.map((e) => {
446
+ let t = A.find((t) => t.id === e.id);
447
+ return t === void 0 ? null : /* @__PURE__ */ w(P, {
448
+ cell: e,
449
+ tone: t.tone,
450
+ label: t.label,
451
+ valueLabel: t.valueLabel,
452
+ labelWidth: te,
453
+ isInspected: n.inspected === e.id,
454
+ isSelected: n.selected === e.id
455
+ }, e.id);
456
+ })
457
+ })
458
+ }),
459
+ /* @__PURE__ */ w(l, {
460
+ title: S,
461
+ items: A,
462
+ view: r === void 0 ? void 0 : n
463
+ }),
464
+ e.some((e) => e.value === null) && /* @__PURE__ */ w("p", {
465
+ className: "x153jb6y x1ghz6dp xy8obcc",
466
+ children: "Unavailable values have no area."
467
+ })
468
+ ]
469
+ })
470
+ });
471
+ }
472
+ export { U as n, R as r, ne as t };
@@ -0,0 +1,65 @@
1
+ function e(e) {
2
+ return {
3
+ kind: "invalid",
4
+ message: e
5
+ };
6
+ }
7
+ function t(e) {
8
+ return e != null && Number.isFinite(e) ? e : null;
9
+ }
10
+ function n(e) {
11
+ return e.flatMap((e) => e !== null && Number.isFinite(e) ? [e] : []);
12
+ }
13
+ function r(e) {
14
+ return n(e).toSorted((e, t) => e - t);
15
+ }
16
+ function i(e) {
17
+ return e.flatMap((e) => e.y !== null && Number.isFinite(e.x) && Number.isFinite(e.y) ? [{
18
+ x: e.x,
19
+ y: e.y
20
+ }] : []);
21
+ }
22
+ function a({ items: e, initial: t, step: n }) {
23
+ let r = { state: t };
24
+ return e.map((e, t) => (r.state = n(r.state, e, t), r.state));
25
+ }
26
+ function o(e) {
27
+ return a({
28
+ items: e,
29
+ initial: 0,
30
+ step: (e, t) => e + t
31
+ }).at(-1) ?? 0;
32
+ }
33
+ function s(e) {
34
+ return o(e) / e.length;
35
+ }
36
+ function c(e) {
37
+ let t = s(e);
38
+ return o(e.map((e) => (e - t) * (e - t)));
39
+ }
40
+ function l(e, t) {
41
+ let n = Map.groupBy(e, (e) => e);
42
+ return Array.from({ length: t }, (e, t) => n.get(t)?.length ?? 0);
43
+ }
44
+ function u(e, t) {
45
+ return Number.isInteger(e) && e >= t[0] && e <= t[1];
46
+ }
47
+ function d(e) {
48
+ return new Set(e).size === e.length;
49
+ }
50
+ function f(e) {
51
+ let t = e.toSorted((e, t) => e - t);
52
+ return t.filter((e, n) => n === 0 || t[n - 1] !== e);
53
+ }
54
+ function p(e, t) {
55
+ let n = Number.isInteger(e) ? {} : { maximumSignificantDigits: 3 };
56
+ return new Intl.NumberFormat(t, n).format(e);
57
+ }
58
+ var m = {
59
+ one: "missing value",
60
+ other: "missing values"
61
+ };
62
+ function h({ count: e, noun: t = m, reason: n = "skipped", locale: r }) {
63
+ return e === 0 ? "" : ` ${p(e, r)} ${e === 1 ? t.one : t.other} ${n}.`;
64
+ }
65
+ export { u as a, p as c, a as d, r as f, l as h, e as i, i as l, o as m, t as n, h as o, c as p, d as r, s, f as t, n as u };