@mechane-ai/elements 0.65.0 → 0.68.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 (129) hide show
  1. package/README.md +21 -10
  2. package/dist/ai.js +288 -205
  3. package/dist/{article-BrUa4Wz1.js → article-Ni152e-v.js} +107 -92
  4. package/dist/article.js +1 -1
  5. package/dist/catalog.json +151 -34
  6. package/dist/{categorical-values-AXJkMt-Y.js → categorical-values-6Iz03F1i.js} +1 -1
  7. package/dist/{cells-X8SVrZBc.js → cells-BRI8LpMU.js} +1 -1
  8. package/dist/charts/cartesian.js +1 -1
  9. package/dist/charts/cells.js +1 -1
  10. package/dist/charts/comparison.js +1 -1
  11. package/dist/charts/distribution.js +1 -1
  12. package/dist/charts/figure.js +12 -12
  13. package/dist/charts/graph.js +1 -1
  14. package/dist/charts/hierarchy.js +1 -1
  15. package/dist/charts/image.js +1 -1
  16. package/dist/charts/matrix.js +2 -2
  17. package/dist/charts/plot.js +16 -15
  18. package/dist/charts/relationship.js +1 -1
  19. package/dist/charts/text.js +1 -1
  20. package/dist/charts/timeline.js +2 -2
  21. package/dist/charts/trend.js +1 -1
  22. package/dist/charts.js +3 -3
  23. package/dist/{code-block-BDRmjlES.js → code-block-DbW_t9U4.js} +1 -1
  24. package/dist/collections.js +1 -1
  25. package/dist/{color-legend-CIo7DhXB.js → color-legend-4As8881l.js} +1 -1
  26. package/dist/{commands-rzsDElrG.js → commands-C7Zrp-tG.js} +2 -2
  27. package/dist/content/code.js +1 -1
  28. package/dist/content/diff.js +3 -3
  29. package/dist/content/link.js +1 -1
  30. package/dist/content/markdown.js +1 -1
  31. package/dist/content/tree.js +2 -2
  32. package/dist/{content-link-DRaNf1mD.js → content-link-BN4NPp0u.js} +1 -1
  33. package/dist/content.js +1 -1
  34. package/dist/{dates-wu-gKO2C.js → dates-OTq-xU33.js} +2 -2
  35. package/dist/{dumbbell-plot-VFajQtEW.js → dumbbell-plot-jaQvOctJ.js} +4 -4
  36. package/dist/{embedding-map-BqDEmy88.js → embedding-map-DnZL1kvY.js} +8 -8
  37. package/dist/feedback.js +1 -1
  38. package/dist/figure-format-BVb7yFCA.js +46 -0
  39. package/dist/{figure-frame-Dd-pOeZN.js → figure-frame-96zFqsWz.js} +22 -21
  40. package/dist/forms/dates.js +1 -1
  41. package/dist/{forms-Bjx7JQ30.js → forms-iAOjGRTO.js} +1 -1
  42. package/dist/forms.js +2 -2
  43. package/dist/{image-grid-Dpyqxgwy.js → image-grid-B6fdmE9c.js} +4 -4
  44. package/dist/index.js +1 -1
  45. package/dist/kits/evaluation.js +15 -15
  46. package/dist/kits/interpretability.js +49 -45
  47. package/dist/kits/operations.js +81 -80
  48. package/dist/kits/research.js +776 -499
  49. package/dist/kits/training.js +108 -107
  50. package/dist/layout.js +1 -1
  51. package/dist/lesson.js +3 -3
  52. package/dist/markdown-JeuBeMDZ.js +293 -0
  53. package/dist/mdx.js +6 -6
  54. package/dist/navigation/commands.js +1 -1
  55. package/dist/{navigation-Cp3p0gss.js → navigation-CTnYtVD8.js} +1 -1
  56. package/dist/navigation.js +3 -3
  57. package/dist/packages/ai/src/index.d.ts +2 -0
  58. package/dist/packages/ai/src/message-reactions.d.ts +51 -0
  59. package/dist/packages/ai/src/message.d.ts +3 -1
  60. package/dist/packages/charts/src/plot/index.d.ts +2 -0
  61. package/dist/packages/charts/src/plot/plot-layout.d.ts +2 -2
  62. package/dist/packages/charts/src/plot/spatial-layer.d.ts +32 -0
  63. package/dist/packages/charts/src/plot/ticks.d.ts +2 -2
  64. package/dist/packages/collections/src/card-columns-model.d.ts +50 -0
  65. package/dist/packages/collections/src/card-columns.d.ts +30 -0
  66. package/dist/packages/collections/src/collection-page.d.ts +43 -0
  67. package/dist/packages/collections/src/column-card.d.ts +15 -0
  68. package/dist/packages/collections/src/data-table-layout.d.ts +2 -0
  69. package/dist/packages/collections/src/data-table-rows.d.ts +4 -3
  70. package/dist/packages/collections/src/data-table.d.ts +2 -2
  71. package/dist/packages/collections/src/index.d.ts +5 -0
  72. package/dist/packages/collections/src/table-query.d.ts +9 -1
  73. package/dist/packages/feedback/src/feedback.d.ts +0 -4
  74. package/dist/packages/feedback/src/index.d.ts +1 -1
  75. package/dist/packages/foundations/src/visible-motion.d.ts +1 -1
  76. package/dist/packages/kits/src/research/index.d.ts +7 -2
  77. package/dist/packages/kits/src/research/motion-clip.d.ts +41 -0
  78. package/dist/packages/kits/src/research/motion-error.d.ts +8 -0
  79. package/dist/packages/kits/src/research/motion-figure.d.ts +9 -0
  80. package/dist/packages/kits/src/research/motion-frame.d.ts +22 -0
  81. package/dist/packages/kits/src/research/motion-scene.d.ts +22 -0
  82. package/dist/packages/teaching/src/article/uncover.d.ts +2 -0
  83. package/dist/{param-CwT1RvUS.js → param-Dk92C-K1.js} +2 -2
  84. package/dist/{pierre-diff-DuvK3kLF.js → pierre-diff-DXVIwW7o.js} +1 -1
  85. package/dist/plot-CpTwLIYN.js +101 -0
  86. package/dist/{plot-layout-CvkeUuG6.js → plot-layout-1MG72ZWn.js} +175 -124
  87. package/dist/{plot-surface-yy37R4vs.js → plot-surface-8-FZI94y.js} +1 -1
  88. package/dist/{reference-lines-AMeDkYlo.js → reference-lines-C18o1yEY.js} +1 -1
  89. package/dist/{scene-BRhI8XSy.js → scene-B8dppj5V.js} +7 -7
  90. package/dist/scene.js +1 -1
  91. package/dist/{slope-chart-BMOCaa8R.js → slope-chart-CELflRJd.js} +5 -5
  92. package/dist/{src-9n2M1V_y.js → src-BCAelv4f.js} +3 -3
  93. package/dist/{src-BgmAkau8.js → src-Bkov5TTa.js} +171 -164
  94. package/dist/{src-Bns-5joF.js → src-BsqbWDxS.js} +4 -4
  95. package/dist/{src-BdyO4PgQ.js → src-CIyuaSCi.js} +101 -107
  96. package/dist/{src-Tu6d_Pm8.js → src-Dc1t1ugL.js} +958 -585
  97. package/dist/{src-C5SH3jjU.js → src-DceyVyL0.js} +2 -2
  98. package/dist/{src-C_E29-DX.js → src-Dlh99sPD.js} +1 -1
  99. package/dist/styles2.css +33 -1
  100. package/dist/{time-series-CTNVqoUQ.js → time-series-DtAtGoT_.js} +9 -9
  101. package/dist/{timeline-DrsDtEIW.js → timeline-CzianQir.js} +5 -5
  102. package/dist/{token-heatmap-DddArdH8.js → token-heatmap-m6oaMwkK.js} +274 -289
  103. package/dist/{token-predictions-CBykmPID.js → token-predictions-CpGVjOIs.js} +4 -4
  104. package/dist/{transport-r1QgELf8.js → transport-DQ1yzsQl.js} +5 -5
  105. package/dist/{tree-diagram-BIJFK4pl.js → tree-diagram-D9ekymCQ.js} +5 -5
  106. package/dist/{treemap-DgmEw_mr.js → treemap-DT8q65LQ.js} +5 -5
  107. package/dist/{use-tween-BWf44Jy4.js → use-tween-DbXVZBR8.js} +1 -1
  108. package/dist/{violin-plot-BYJnv6sG.js → violin-plot-83HSjnQM.js} +4 -4
  109. package/dist/visible-motion-D6NwjGNz.js +24 -0
  110. package/dist/{waterfall-BNseqMas.js → waterfall-DmApvdrY.js} +5 -5
  111. package/package.json +1 -1
  112. package/recipes/recorded-motion.tsx +14 -0
  113. package/recipes/searchable-collection.tsx +74 -76
  114. package/skills/extend-elements/SKILL.md +2 -1
  115. package/skills/review-elements/SKILL.md +15 -7
  116. package/skills/review-explainer/SKILL.md +4 -0
  117. package/skills/upgrade-elements/SKILL.md +3 -1
  118. package/skills/upgrade-elements/references/releases.md +20 -0
  119. package/skills/use-elements/SKILL.md +10 -6
  120. package/skills/use-elements/references/collections.md +59 -12
  121. package/skills/use-elements/references/conversations.md +32 -0
  122. package/skills/use-elements/references/editorial-restraint.md +17 -29
  123. package/skills/use-elements/references/figures.md +6 -2
  124. package/skills/use-elements/references/kits.md +23 -0
  125. package/skills/use-elements/references/workspace.md +5 -5
  126. package/skills/write-explainer/SKILL.md +5 -0
  127. package/dist/figure-format-B8kRZMlo.js +0 -36
  128. package/dist/markdown--nfaDoR1.js +0 -313
  129. package/dist/packages/kits/src/research/collection-page.d.ts +0 -71
@@ -1,155 +1,21 @@
1
- import { d as e, f as t, g as n, h as r, m as i, n as a, o, u as s, y as c } from "../src-Tu6d_Pm8.js";
2
- import { c as l, f as u, h as d, l as f, m as p, o as m, p as h, r as g, t as _, v } from "../src-BgmAkau8.js";
3
- import { m as y, p as b, s as x, t as S } from "../src-BdyO4PgQ.js";
4
- import { u as C } from "../src-C5SH3jjU.js";
5
- import { D as w, _ as T, i as E, n as D } from "../src-9n2M1V_y.js";
6
- import { r as O } from "../figure-format-B8kRZMlo.js";
7
- import { n as k } from "../src-na2DdkKI.js";
8
- import { a as A, t as j } from "../tree-diagram-BIJFK4pl.js";
9
- import { f as M } from "../time-series-CTNVqoUQ.js";
10
- import { i as N } from "../src-Bns-5joF.js";
1
+ import { r as e } from "../figure-format-BVb7yFCA.js";
2
+ import { d as t, h as n, n as r, o as i } from "../src-Dc1t1ugL.js";
3
+ import { E as a, c as o, f as s, h as c, m as l, o as u, p as d, r as f, t as p, v as m } from "../src-Bkov5TTa.js";
4
+ import { n as h } from "../src-na2DdkKI.js";
5
+ import { a as g, t as _ } from "../tree-diagram-D9ekymCQ.js";
6
+ import { p as v, s as y } from "../src-CIyuaSCi.js";
7
+ import { p as b, u as x } from "../src-DceyVyL0.js";
8
+ import { f as S } from "../time-series-DtAtGoT_.js";
9
+ import { i as C, l as w, r as ee } from "../src-BsqbWDxS.js";
10
+ import { n as T, r as E } from "../figure-frame-96zFqsWz.js";
11
+ import { r as D } from "../tone-scope-DKiSw-JR.js";
12
+ import { t as O } from "../plot-CpTwLIYN.js";
13
+ import { t as te } from "../visible-motion-D6NwjGNz.js";
11
14
  import "@stylexjs/stylex";
12
- import { useState as P } from "react";
13
- import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
14
- // packages/kits/src/research/collection-page.tsx
15
- var ee = 8;
16
- function R({ title: n, caption: i, rows: a, getRowId: o, columns: c, sort: l, onSortChange: u, search: d, filters: f, transformRows: p, scopes: m, defaultScopeId: h, rowAction: g, activeRowId: _, rowSizing: v, empty: b, filteredEmpty: x, status: T = "ready", failure: E, placeholderRows: D = ee }) {
17
- let O = T === "loading", k = T === "failed", A = T === "ready", j = m?.[0]?.id ?? "", [M, N] = P(() => h ?? j), F = m === void 0 || m.length === 0 ? void 0 : m.find((e) => e.id === M) ?? m[0], R = F === void 0 ? a : a.filter(F.match), z = m === void 0 || m.length <= 1 ? null : /* @__PURE__ */ I(C.Root, {
18
- "aria-label": `${n} scope`,
19
- value: F?.id ?? j,
20
- onValueChange: (e) => N(e),
21
- children: m.map((e) => /* @__PURE__ */ I(C.Item, {
22
- value: e.id,
23
- children: O ? e.label : `${e.label} (${a.filter(e.match).length})`
24
- }, e.id))
25
- }), B = r(R, {
26
- mode: "local",
27
- search: d,
28
- filters: f
29
- }), { actions: V, chips: te, findRegion: H } = t({
30
- label: `${n} controls`,
31
- ...B.search !== void 0 && { search: B.search },
32
- filters: B.filters,
33
- isPlaceholder: O,
34
- isReady: A
35
- }), U = p === void 0 ? B.rows : p(B.rows), W = i ?? n, G = typeof d == "function", K = !("reason" in f), q = {
36
- caption: W,
37
- hideCaption: !0,
38
- rows: U,
39
- getRowId: o,
40
- query: { mode: "frame" },
41
- ...g !== void 0 && { rowAction: g },
42
- ..._ !== void 0 && { activeRowId: _ },
43
- ...v !== void 0 && { rowSizing: v },
44
- empty: b,
45
- ...x !== void 0 && { filteredEmpty: x }
46
- }, J = u === void 0 ? /* @__PURE__ */ I(s, {
47
- ...q,
48
- columns: c
49
- }) : /* @__PURE__ */ I(s, {
50
- ...q,
51
- columns: c,
52
- sort: l,
53
- onSortChange: u
54
- }), Y = /* @__PURE__ */ I(e, {
55
- caption: W,
56
- hideCaption: !0,
57
- columns: c,
58
- rows: D,
59
- ...v !== void 0 && { rowSizing: v }
60
- }), X = E ?? /* @__PURE__ */ I(w, { children: /* @__PURE__ */ L(y, {
61
- hasError: !0,
62
- children: [
63
- "Could not load ",
64
- n.toLowerCase(),
65
- "."
66
- ]
67
- }) });
68
- return {
69
- scopeControl: z,
70
- controlActions: V,
71
- chips: te,
72
- findRegion: H,
73
- content: O ? /* @__PURE__ */ I(S, {
74
- state: "pending",
75
- label: n,
76
- placeholder: Y
77
- }) : /* @__PURE__ */ I(S, {
78
- state: k ? "failed" : "ready",
79
- label: n,
80
- placeholder: Y,
81
- children: k ? X : J
82
- }),
83
- frameProps: {
84
- search: G ? !0 : d,
85
- filters: K ? !0 : f,
86
- isFiltered: B.isFiltered
87
- }
88
- };
89
- }
90
- function z(e) {
91
- let { title: t, navigation: n, actions: r, notice: a, inspector: o } = e, { scopeControl: s, controlActions: l, chips: u, findRegion: d, content: f, frameProps: p } = R(e), m = a != null, h = /* @__PURE__ */ L(F, { children: [
92
- s,
93
- n === void 0 && l,
94
- r
95
- ] }), g = /* @__PURE__ */ I(D, {
96
- header: /* @__PURE__ */ L(F, { children: [m && /* @__PURE__ */ I(w, { children: a }), u !== !1 && /* @__PURE__ */ I(c, {
97
- label: "Applied filters",
98
- children: u
99
- })] }),
100
- children: f
101
- });
102
- return /* @__PURE__ */ I(i, {
103
- ...p,
104
- children: /* @__PURE__ */ I("section", {
105
- ...d,
106
- className: "x12lumcd xeuugli x2lwn1j x78zum5 xdt5ytf",
107
- children: /* @__PURE__ */ I(T, {
108
- title: t,
109
- actions: h,
110
- navigation: n === void 0 ? void 0 : {
111
- ...n,
112
- actions: /* @__PURE__ */ L(F, { children: [l, n.actions] })
113
- },
114
- children: /* @__PURE__ */ I(E, {
115
- inspector: o,
116
- children: g
117
- })
118
- })
119
- })
120
- });
121
- }
122
- function B(e) {
123
- let { id: t, title: n, meta: r, actions: a, notice: o } = e, { scopeControl: s, controlActions: l, chips: u, findRegion: d, content: p, frameProps: m } = R(e), h = o != null;
124
- return /* @__PURE__ */ I(i, {
125
- ...m,
126
- children: /* @__PURE__ */ L("section", {
127
- ...d,
128
- "aria-label": n,
129
- className: "xeuugli x78zum5 xdt5ytf",
130
- children: [
131
- /* @__PURE__ */ I(f, {
132
- ...t !== void 0 && { id: t },
133
- title: n,
134
- meta: r,
135
- actions: /* @__PURE__ */ L(F, { children: [
136
- s,
137
- l,
138
- a
139
- ] })
140
- }),
141
- h && /* @__PURE__ */ I(w, { children: o }),
142
- u !== !1 && /* @__PURE__ */ I(c, {
143
- label: "Applied filters",
144
- children: u
145
- }),
146
- p
147
- ]
148
- })
149
- });
150
- }
15
+ import { useEffect as ne, useEffectEvent as k, useMemo as re, useState as A } from "react";
16
+ import { Fragment as ie, jsx as j, jsxs as M } from "react/jsx-runtime";
151
17
  // packages/kits/src/research/finding-card.tsx
152
- var V = {
18
+ var N = {
153
19
  limitation: "Limitation",
154
20
  details: "Full notes & evidence",
155
21
  sources: "Sources",
@@ -159,100 +25,100 @@ var V = {
159
25
  falsified: "Falsified",
160
26
  open: "Open"
161
27
  }
162
- }, te = {
28
+ }, P = {
163
29
  supported: "positive",
164
30
  mixed: "warning",
165
31
  falsified: "negative",
166
32
  open: "neutral"
167
33
  };
168
- function H({ title: e, claim: t, locale: n, status: r, index: i, limitation: o, metrics: s = [], sources: c = [], author: u, recordedAt: f, recordedLabel: m, details: y, actions: b, labels: x }) {
169
- let S = {
170
- ...V,
171
- ...x,
34
+ function ae({ title: t, claim: n, locale: i, status: a, index: s, limitation: u, metrics: g = [], sources: _ = [], author: v, recordedAt: y, recordedLabel: b, details: x, actions: S, labels: C }) {
35
+ let w = {
36
+ ...N,
37
+ ...C,
172
38
  statusLabels: {
173
- ...V.statusLabels,
174
- ...x?.statusLabels
39
+ ...N.statusLabels,
40
+ ...C?.statusLabels
175
41
  }
176
42
  };
177
- return /* @__PURE__ */ I(h, {
178
- title: e,
179
- index: i,
180
- meta: /* @__PURE__ */ L(p, { children: [/* @__PURE__ */ I(_, {
181
- tone: te[r],
182
- children: S.statusLabels[r]
183
- }), b] }),
184
- footer: u !== void 0 || f !== void 0 || c.length > 0 ? /* @__PURE__ */ L(p, {
43
+ return /* @__PURE__ */ j(d, {
44
+ title: t,
45
+ index: s,
46
+ meta: /* @__PURE__ */ M(l, { children: [/* @__PURE__ */ j(p, {
47
+ tone: P[a],
48
+ children: w.statusLabels[a]
49
+ }), S] }),
50
+ footer: v !== void 0 || y !== void 0 || _.length > 0 ? /* @__PURE__ */ M(l, {
185
51
  shouldSpaceBetween: !0,
186
- children: [/* @__PURE__ */ L(p, { children: [u !== void 0 && /* @__PURE__ */ I(l, {
52
+ children: [/* @__PURE__ */ M(l, { children: [v !== void 0 && /* @__PURE__ */ j(o, {
187
53
  variant: "caption",
188
54
  tone: "muted",
189
- children: u
190
- }), f !== void 0 && /* @__PURE__ */ I(a, {
191
- dateTime: f,
192
- label: m ?? f
193
- })] }), c.length > 0 && /* @__PURE__ */ L(p, { children: [/* @__PURE__ */ L(l, {
55
+ children: v
56
+ }), y !== void 0 && /* @__PURE__ */ j(r, {
57
+ dateTime: y,
58
+ label: b ?? y
59
+ })] }), _.length > 0 && /* @__PURE__ */ M(l, { children: [/* @__PURE__ */ M(o, {
194
60
  variant: "caption",
195
61
  tone: "muted",
196
- children: [S.sources, ":"]
197
- }), c.map((e) => e.summary !== void 0 && e.href !== void 0 ? /* @__PURE__ */ L(k.Root, { children: [/* @__PURE__ */ I(k.Trigger, {
62
+ children: [w.sources, ":"]
63
+ }), _.map((e) => e.summary !== void 0 && e.href !== void 0 ? /* @__PURE__ */ M(h.Root, { children: [/* @__PURE__ */ j(h.Trigger, {
198
64
  href: e.href,
199
- children: /* @__PURE__ */ I(g, { children: e.label })
200
- }), /* @__PURE__ */ I(k.Popup, { children: /* @__PURE__ */ L(d, {
65
+ children: /* @__PURE__ */ j(f, { children: e.label })
66
+ }), /* @__PURE__ */ j(h.Popup, { children: /* @__PURE__ */ M(c, {
201
67
  isCompact: !0,
202
- children: [/* @__PURE__ */ I(l, { children: e.label }), /* @__PURE__ */ I(l, {
68
+ children: [/* @__PURE__ */ j(o, { children: e.label }), /* @__PURE__ */ j(o, {
203
69
  variant: "caption",
204
70
  tone: "muted",
205
71
  children: e.summary
206
72
  })]
207
- }) })] }, e.id) : /* @__PURE__ */ I(g, { children: e.label }, e.id))] })]
73
+ }) })] }, e.id) : /* @__PURE__ */ j(f, { children: e.label }, e.id))] })]
208
74
  }) : void 0,
209
- children: /* @__PURE__ */ L(d, {
75
+ children: /* @__PURE__ */ M(c, {
210
76
  isCompact: !0,
211
77
  children: [
212
- /* @__PURE__ */ I(l, { children: t }),
213
- s.length > 0 && /* @__PURE__ */ I(p, { children: s.map((e) => /* @__PURE__ */ L(_, {
214
- tone: e.tone ?? "neutral",
78
+ /* @__PURE__ */ j(o, { children: n }),
79
+ g.length > 0 && /* @__PURE__ */ j(l, { children: g.map((t) => /* @__PURE__ */ M(p, {
80
+ tone: t.tone ?? "neutral",
215
81
  children: [
216
- e.label,
82
+ t.label,
217
83
  ": ",
218
- O({
219
- value: e.value,
220
- locale: n,
221
- format: e.format
84
+ e({
85
+ value: t.value,
86
+ locale: i,
87
+ format: t.format
222
88
  })
223
89
  ]
224
- }, e.label)) }),
225
- o !== void 0 && /* @__PURE__ */ L(l, {
90
+ }, t.label)) }),
91
+ u !== void 0 && /* @__PURE__ */ M(o, {
226
92
  variant: "caption",
227
93
  tone: "muted",
228
94
  children: [
229
- S.limitation,
95
+ w.limitation,
230
96
  ": ",
231
- o
97
+ u
232
98
  ]
233
99
  }),
234
- y !== void 0 && /* @__PURE__ */ L(v.Root, { children: [/* @__PURE__ */ I(v.Trigger, {
100
+ x !== void 0 && /* @__PURE__ */ M(m.Root, { children: [/* @__PURE__ */ j(m.Trigger, {
235
101
  variant: "inline",
236
- children: S.details
237
- }), /* @__PURE__ */ I(v.Panel, { children: y })] })
102
+ children: w.details
103
+ }), /* @__PURE__ */ j(m.Panel, { children: x })] })
238
104
  ]
239
105
  })
240
106
  });
241
107
  }
242
108
  // packages/kits/src/research/lineage-graph.tsx
243
- var U = 152, W = 56, G = 32, K = 12, q = 16, J = 32, Y = 16, X = 16, Z = 12, ne = 640, Q = 240, re = 64, $ = "General", ie = {
109
+ var oe = 152, se = 56, ce = 32, F = 12, I = 16, L = 32, le = 16, ue = 16, R = 12, de = 640, z = 240, fe = 64, B = "General", pe = {
244
110
  baseline: "series5",
245
111
  milestone: "positive",
246
112
  branch: "series1",
247
113
  merge: "series3",
248
114
  killed: "negative"
249
- }, ae = {
115
+ }, me = {
250
116
  baseline: "neutral",
251
117
  milestone: "positive",
252
118
  branch: "neutral",
253
119
  merge: "warning",
254
120
  killed: "negative"
255
- }, oe = {
121
+ }, V = {
256
122
  frontier: "Frontier",
257
123
  all: "All",
258
124
  metric: "Score",
@@ -269,7 +135,7 @@ var U = 152, W = 56, G = 32, K = 12, q = 16, J = 32, Y = 16, X = 16, Z = 12, ne
269
135
  killed: "Killed"
270
136
  }
271
137
  };
272
- function se(e, t, n) {
138
+ function he(e, t, n) {
273
139
  let r = t.get(e.id) ?? 0;
274
140
  for (let i of e.parentIds) if (n.has(i)) {
275
141
  let e = (t.get(i) ?? 0) + 1;
@@ -277,13 +143,13 @@ function se(e, t, n) {
277
143
  }
278
144
  return r;
279
145
  }
280
- function ce(e) {
146
+ function ge(e) {
281
147
  let t = /* @__PURE__ */ new Map(), n = new Set(e.map((e) => e.id));
282
148
  for (let n of e) t.set(n.id, 0);
283
- for (let r = 0; r < re; r += 1) {
149
+ for (let r = 0; r < fe; r += 1) {
284
150
  let r = [];
285
151
  for (let i of e) {
286
- let e = se(i, t, n);
152
+ let e = he(i, t, n);
287
153
  e !== t.get(i.id) && r.push([i.id, e]);
288
154
  }
289
155
  if (r.length === 0) break;
@@ -291,7 +157,7 @@ function ce(e) {
291
157
  }
292
158
  return t;
293
159
  }
294
- function le(e) {
160
+ function _e(e) {
295
161
  let t = /* @__PURE__ */ new Set(), n = new Map(e.map((e) => [e.id, e]));
296
162
  function r(e) {
297
163
  if (t.has(e)) return;
@@ -302,50 +168,50 @@ function le(e) {
302
168
  for (let t of e) t.kind !== "killed" && r(t.id);
303
169
  return e.filter((e) => t.has(e.id));
304
170
  }
305
- function ue({ node: e, locale: t, valueFormat: n, deltaFormat: r }) {
306
- let i = [];
307
- if (e.metric !== null && e.metric !== void 0 && i.push(n === void 0 ? String(e.metric) : O({
308
- value: e.metric,
309
- locale: t,
310
- format: n
311
- })), e.delta !== null && e.delta !== void 0) {
312
- let a = r ?? n;
313
- a === void 0 ? i.push(e.delta > 0 ? `+${e.delta}` : String(e.delta)) : i.push(O({
314
- value: e.delta,
315
- locale: t,
316
- format: a
171
+ function ve({ node: t, locale: n, valueFormat: r, deltaFormat: i }) {
172
+ let a = [];
173
+ if (t.metric !== null && t.metric !== void 0 && a.push(r === void 0 ? String(t.metric) : e({
174
+ value: t.metric,
175
+ locale: n,
176
+ format: r
177
+ })), t.delta !== null && t.delta !== void 0) {
178
+ let o = i ?? r;
179
+ o === void 0 ? a.push(t.delta > 0 ? `+${t.delta}` : String(t.delta)) : a.push(e({
180
+ value: t.delta,
181
+ locale: n,
182
+ format: o
317
183
  }));
318
184
  }
319
- return e.caption === void 0 ? i.length > 0 ? i.join(" · ") : e.summary : e.caption;
185
+ return t.caption === void 0 ? a.length > 0 ? a.join(" · ") : t.summary : t.caption;
320
186
  }
321
- function de(e) {
322
- let t = ce(e), n = /* @__PURE__ */ new Map();
187
+ function ye(e) {
188
+ let t = ge(e), n = /* @__PURE__ */ new Map();
323
189
  for (let r of e) n.set(r.id, r.column ?? t.get(r.id) ?? 0);
324
190
  return n;
325
191
  }
326
- function fe({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
327
- let i = de(e), a = Math.max(0, ...Array.from(i.values())), o = e.some((e) => e.lane !== void 0), s = [];
192
+ function be({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
193
+ let i = ye(e), a = Math.max(0, ...Array.from(i.values())), o = e.some((e) => e.lane !== void 0), s = [];
328
194
  if (o) for (let t of e) {
329
- let e = t.lane ?? $;
195
+ let e = t.lane ?? B;
330
196
  s.includes(e) || s.push(e);
331
197
  }
332
- else s.push($);
333
- let c = (a + 1) * U + a * G, l = [], u = [], d = q;
198
+ else s.push(B);
199
+ let c = (a + 1) * oe + a * ce, l = [], u = [], d = I;
334
200
  for (let a of s) {
335
- let s = o ? e.filter((e) => (e.lane ?? $) === a) : e, f = /* @__PURE__ */ new Map();
201
+ let s = o ? e.filter((e) => (e.lane ?? B) === a) : e, f = /* @__PURE__ */ new Map();
336
202
  for (let e of s) {
337
203
  let t = i.get(e.id) ?? 0, n = f.get(t) ?? [];
338
204
  n.push(e), f.set(t, n);
339
205
  }
340
- let p = Math.max(1, ...Array.from(f.values(), (e) => e.length)), m = p * W + (p - 1) * K, h = d, g = o ? h + J : h, _ = o ? J + m + Y : m;
206
+ let p = Math.max(1, ...Array.from(f.values(), (e) => e.length)), m = p * se + (p - 1) * F, h = d, g = o ? h + L : h, _ = o ? L + m + le : m;
341
207
  for (let [e, i] of f.entries()) {
342
- let a = q + (o ? X : 0) + e * 184;
208
+ let a = I + (o ? ue : 0) + e * 184;
343
209
  for (let [e, o] of i.entries()) {
344
210
  let i = g + e * 68;
345
211
  l.push({
346
212
  id: o.id,
347
213
  label: o.label,
348
- description: ue({
214
+ description: ve({
349
215
  node: o,
350
216
  locale: t,
351
217
  valueFormat: n,
@@ -353,21 +219,21 @@ function fe({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
353
219
  }),
354
220
  x: a,
355
221
  y: i,
356
- width: U,
357
- height: W,
358
- tone: ie[o.kind]
222
+ width: oe,
223
+ height: se,
224
+ tone: pe[o.kind]
359
225
  });
360
226
  }
361
227
  }
362
228
  o && u.push({
363
229
  id: `lane:${a}`,
364
230
  label: a,
365
- x: q,
231
+ x: I,
366
232
  y: h,
367
233
  width: c + 32,
368
234
  height: _,
369
235
  nodeIds: s.map((e) => e.id)
370
- }), d = h + _ + (o ? Z : K);
236
+ }), d = h + _ + (o ? R : F);
371
237
  }
372
238
  let f = new Set(e.map((e) => e.id)), p = [];
373
239
  for (let t of e) for (let e of t.parentIds) f.has(e) && p.push({
@@ -382,137 +248,138 @@ function fe({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
382
248
  relationEdges: p,
383
249
  relationGroups: u,
384
250
  width: c + 32 + (o ? 32 : 0),
385
- height: Math.max(Q, d + q - (o ? Z : K))
251
+ height: Math.max(z, d + I - (o ? R : F))
386
252
  };
387
253
  }
388
- function pe({ node: e, labels: t, detailItems: n }) {
389
- return /* @__PURE__ */ L(d, {
254
+ function xe({ node: e, labels: t, detailItems: n }) {
255
+ return /* @__PURE__ */ M(c, {
390
256
  isCompact: !0,
391
257
  children: [
392
- /* @__PURE__ */ I(u, {}),
393
- /* @__PURE__ */ L(p, {
258
+ /* @__PURE__ */ j(s, {}),
259
+ /* @__PURE__ */ M(l, {
394
260
  shouldSpaceBetween: !0,
395
- children: [/* @__PURE__ */ L(p, { children: [/* @__PURE__ */ I(l, { children: /* @__PURE__ */ I("strong", { children: e.label }) }), e.timestamp === void 0 ? null : /* @__PURE__ */ I(_, {
261
+ children: [/* @__PURE__ */ M(l, { children: [/* @__PURE__ */ j(o, { children: /* @__PURE__ */ j("strong", { children: e.label }) }), e.timestamp === void 0 ? null : /* @__PURE__ */ j(p, {
396
262
  tone: "neutral",
397
263
  children: e.timestamp
398
- })] }), /* @__PURE__ */ I(_, {
399
- tone: ae[e.kind],
264
+ })] }), /* @__PURE__ */ j(p, {
265
+ tone: me[e.kind],
400
266
  children: t.kinds[e.kind]
401
267
  })]
402
268
  }),
403
- e.summary === void 0 ? null : /* @__PURE__ */ I(l, { children: e.summary }),
404
- e.detail === void 0 ? null : /* @__PURE__ */ I(l, {
269
+ e.summary === void 0 ? null : /* @__PURE__ */ j(o, { children: e.summary }),
270
+ e.detail === void 0 ? null : /* @__PURE__ */ j(o, {
405
271
  tone: "muted",
406
272
  children: e.detail
407
273
  }),
408
- n.length === 0 ? null : /* @__PURE__ */ I(o, { items: n })
274
+ n.length === 0 ? null : /* @__PURE__ */ j(i, { items: n })
409
275
  ]
410
276
  });
411
277
  }
412
- function me({ nodes: e, valueLabel: t, valueFormat: n, deltaFormat: r, defaultScope: i = "frontier", selected: a, onSelectedChange: o, labels: s, actions: c, ...l }) {
413
- let [u, f] = P(i), [p, m] = P(null), h = {
414
- ...oe,
415
- ...s,
278
+ function Se({ nodes: t, valueLabel: n, valueFormat: r, deltaFormat: i, defaultScope: a = "frontier", selected: o, onSelectedChange: s, labels: l, actions: d, ...f }) {
279
+ let [p, m] = A(a), [h, _] = A(null), y = {
280
+ ...V,
281
+ ...l,
416
282
  kinds: {
417
- ...oe.kinds,
418
- ...s?.kinds
283
+ ...V.kinds,
284
+ ...l?.kinds
419
285
  }
420
286
  };
421
- if (l.status === "loading") return /* @__PURE__ */ I(A, {
422
- ...l,
287
+ if (f.status === "loading") return /* @__PURE__ */ j(g, {
288
+ ...f,
423
289
  nodes: [],
424
290
  edges: [],
425
- width: ne,
426
- height: Q
291
+ width: de,
292
+ height: z
427
293
  });
428
- if (e.length === 0) return /* @__PURE__ */ I(b, {
429
- title: l.title,
430
- children: h.empty
294
+ if (t.length === 0) return /* @__PURE__ */ j(v, {
295
+ title: f.title,
296
+ children: y.empty
431
297
  });
432
- if (new Set(e.map((e) => e.id)).size !== e.length) return /* @__PURE__ */ I(y, {
433
- hasError: !0,
298
+ if (new Set(t.map((e) => e.id)).size !== t.length) return /* @__PURE__ */ j(u, {
299
+ tone: "negative",
300
+ role: "alert",
434
301
  children: "Lineage nodes must have unique identifiers."
435
302
  });
436
- let g = le(e), _ = g.length < e.length, v = u === "frontier" && _ ? g : e, x = a === void 0 ? p : a;
437
- function S(e, t) {
438
- a === void 0 && m(e), o?.(e, t);
303
+ let b = _e(t), S = b.length < t.length, C = p === "frontier" && S ? b : t, w = o === void 0 ? h : o;
304
+ function ee(e, t) {
305
+ o === void 0 && _(e), s?.(e, t);
439
306
  }
440
- let w = fe({
441
- nodes: v,
442
- locale: l.locale,
443
- valueFormat: n,
444
- deltaFormat: r
445
- }), T = x === null ? void 0 : v.find((e) => e.id === x), E = new Map(e.map((e) => [e.id, e])), D = _ ? /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ L(C.Root, {
446
- "aria-label": `${l.title} scope`,
447
- value: u,
448
- onValueChange: (e) => f(e === "all" ? "all" : "frontier"),
449
- children: [/* @__PURE__ */ I(C.Item, {
307
+ let T = be({
308
+ nodes: C,
309
+ locale: f.locale,
310
+ valueFormat: r,
311
+ deltaFormat: i
312
+ }), E = w === null ? void 0 : C.find((e) => e.id === w), D = new Map(t.map((e) => [e.id, e])), O = S ? /* @__PURE__ */ M(ie, { children: [/* @__PURE__ */ M(x.Root, {
313
+ "aria-label": `${f.title} scope`,
314
+ value: p,
315
+ onValueChange: (e) => m(e === "all" ? "all" : "frontier"),
316
+ children: [/* @__PURE__ */ j(x.Item, {
450
317
  value: "frontier",
451
- children: `${h.frontier} (${g.length})`
452
- }), /* @__PURE__ */ I(C.Item, {
318
+ children: `${y.frontier} (${b.length})`
319
+ }), /* @__PURE__ */ j(x.Item, {
453
320
  value: "all",
454
- children: `${h.all} (${e.length})`
321
+ children: `${y.all} (${t.length})`
455
322
  })]
456
- }), c] }) : c, k = T === void 0 ? [] : [
457
- ...T.lane === void 0 ? [] : [{
458
- label: h.lane,
459
- value: T.lane
323
+ }), d] }) : d, te = E === void 0 ? [] : [
324
+ ...E.lane === void 0 ? [] : [{
325
+ label: y.lane,
326
+ value: E.lane
460
327
  }],
461
- ...T.metric === null || T.metric === void 0 ? [] : [{
462
- label: t ?? h.metric,
463
- value: n === void 0 ? String(T.metric) : O({
464
- value: T.metric,
465
- locale: l.locale,
466
- format: n
328
+ ...E.metric === null || E.metric === void 0 ? [] : [{
329
+ label: n ?? y.metric,
330
+ value: r === void 0 ? String(E.metric) : e({
331
+ value: E.metric,
332
+ locale: f.locale,
333
+ format: r
467
334
  })
468
335
  }],
469
- ...T.delta === null || T.delta === void 0 ? [] : [{
470
- label: h.delta,
471
- value: (r ?? n) === void 0 ? T.delta > 0 ? `+${T.delta}` : String(T.delta) : O({
472
- value: T.delta,
473
- locale: l.locale,
474
- format: r ?? n ?? { style: "decimal" }
336
+ ...E.delta === null || E.delta === void 0 ? [] : [{
337
+ label: y.delta,
338
+ value: (i ?? r) === void 0 ? E.delta > 0 ? `+${E.delta}` : String(E.delta) : e({
339
+ value: E.delta,
340
+ locale: f.locale,
341
+ format: i ?? r ?? { style: "decimal" }
475
342
  })
476
343
  }],
477
- ...T.parentIds.length === 0 ? [] : [{
478
- label: h.parents,
479
- value: T.parentIds.map((e) => E.get(e)?.label ?? e).join(", ")
344
+ ...E.parentIds.length === 0 ? [] : [{
345
+ label: y.parents,
346
+ value: E.parentIds.map((e) => D.get(e)?.label ?? e).join(", ")
480
347
  }],
481
- ...T.source === void 0 ? [] : [{
482
- label: h.source,
483
- value: T.source
348
+ ...E.source === void 0 ? [] : [{
349
+ label: y.source,
350
+ value: E.source
484
351
  }]
485
352
  ];
486
- return /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ I(A, {
487
- ...l,
488
- actions: D,
489
- nodes: w.relationNodes,
490
- edges: w.relationEdges,
491
- groups: w.relationGroups.length > 0 ? w.relationGroups : void 0,
492
- width: w.width,
493
- height: w.height,
494
- selected: x,
495
- onSelectedChange: S
496
- }), T === void 0 ? null : /* @__PURE__ */ I(pe, {
497
- node: T,
498
- labels: h,
499
- detailItems: k
353
+ return /* @__PURE__ */ M(c, { children: [/* @__PURE__ */ j(g, {
354
+ ...f,
355
+ actions: O,
356
+ nodes: T.relationNodes,
357
+ edges: T.relationEdges,
358
+ groups: T.relationGroups.length > 0 ? T.relationGroups : void 0,
359
+ width: T.width,
360
+ height: T.height,
361
+ selected: w,
362
+ onSelectedChange: ee
363
+ }), E === void 0 ? null : /* @__PURE__ */ j(xe, {
364
+ node: E,
365
+ labels: y,
366
+ detailItems: te
500
367
  })] });
501
368
  }
502
369
  // packages/kits/src/research/milestone-path.tsx
503
- var he = {
370
+ var H = {
504
371
  baseline: "series5",
505
372
  result: "series1",
506
373
  breakthrough: "positive",
507
374
  counterexample: "negative",
508
375
  decision: "series3"
509
- }, ge = {
376
+ }, Ce = {
510
377
  baseline: "neutral",
511
378
  result: "neutral",
512
379
  breakthrough: "positive",
513
380
  counterexample: "negative",
514
381
  decision: "warning"
515
- }, _e = {
382
+ }, we = {
516
383
  metric: "Score",
517
384
  delta: "Change",
518
385
  limitation: "Limitation",
@@ -526,106 +393,108 @@ var he = {
526
393
  decision: "Decision"
527
394
  }
528
395
  };
529
- function ve({ milestones: e, valueLabel: t, valueFormat: n, deltaFormat: r, selected: i, onSelectedChange: a, labels: s, ...c }) {
530
- let f = {
531
- ..._e,
532
- ...s,
396
+ function Te({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: a, selected: d, onSelectedChange: f, labels: m, ...h }) {
397
+ let g = {
398
+ ...we,
399
+ ...m,
533
400
  kinds: {
534
- ..._e.kinds,
535
- ...s?.kinds
401
+ ...we.kinds,
402
+ ...m?.kinds
536
403
  }
537
404
  };
538
- if (c.status === "loading") return /* @__PURE__ */ I(j, {
539
- ...c,
405
+ if (h.status === "loading") return /* @__PURE__ */ j(_, {
406
+ ...h,
540
407
  nodes: [],
541
408
  direction: "right",
542
409
  link: "elbow",
543
- valueLabel: t,
544
- valueFormat: n
410
+ valueLabel: n,
411
+ valueFormat: r
545
412
  });
546
- if (e.length === 0) return /* @__PURE__ */ I(b, {
547
- title: c.title,
548
- children: f.empty
413
+ if (t.length === 0) return /* @__PURE__ */ j(v, {
414
+ title: h.title,
415
+ children: g.empty
549
416
  });
550
- if (new Set(e.map((e) => e.id)).size !== e.length) return /* @__PURE__ */ I(y, {
551
- hasError: !0,
417
+ if (new Set(t.map((e) => e.id)).size !== t.length) return /* @__PURE__ */ j(u, {
418
+ tone: "negative",
419
+ role: "alert",
552
420
  children: "Milestones must have unique identifiers."
553
421
  });
554
- if (e.filter((e) => e.parentId === null).length !== 1) return /* @__PURE__ */ I(y, {
555
- hasError: !0,
422
+ if (t.filter((e) => e.parentId === null).length !== 1) return /* @__PURE__ */ j(u, {
423
+ tone: "negative",
424
+ role: "alert",
556
425
  children: "MilestonePath requires exactly one root milestone (parentId: null)."
557
426
  });
558
- let m = e.map((e) => ({
427
+ let y = t.map((e) => ({
559
428
  id: e.id,
560
429
  parentId: e.parentId,
561
430
  label: e.label,
562
- detail: e.wave === void 0 ? f.kinds[e.kind] : `${e.wave} · ${f.kinds[e.kind]}`,
431
+ detail: e.wave === void 0 ? g.kinds[e.kind] : `${e.wave} · ${g.kinds[e.kind]}`,
563
432
  value: e.metric ?? null,
564
- tone: he[e.kind]
565
- })), h = Array.from(new Set(e.map((e) => e.kind))).map((e) => ({
433
+ tone: H[e.kind]
434
+ })), b = Array.from(new Set(t.map((e) => e.kind))).map((e) => ({
566
435
  id: e,
567
- label: f.kinds[e],
568
- tone: he[e]
569
- })), g = e.find((e) => e.id === i) ?? null;
570
- return /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ I(j, {
571
- ...c,
572
- nodes: m,
436
+ label: g.kinds[e],
437
+ tone: H[e]
438
+ })), x = t.find((e) => e.id === d) ?? null;
439
+ return /* @__PURE__ */ M(c, { children: [/* @__PURE__ */ j(_, {
440
+ ...h,
441
+ nodes: y,
573
442
  direction: "right",
574
443
  link: "elbow",
575
- valueLabel: t,
576
- valueFormat: n,
577
- toneLegend: h,
578
- selected: i,
579
- onSelectedChange: a
580
- }), g !== null && /* @__PURE__ */ L(d, {
444
+ valueLabel: n,
445
+ valueFormat: r,
446
+ toneLegend: b,
447
+ selected: d,
448
+ onSelectedChange: f
449
+ }), x !== null && /* @__PURE__ */ M(c, {
581
450
  isCompact: !0,
582
451
  children: [
583
- /* @__PURE__ */ I(u, {}),
584
- /* @__PURE__ */ L(p, {
452
+ /* @__PURE__ */ j(s, {}),
453
+ /* @__PURE__ */ M(l, {
585
454
  shouldSpaceBetween: !0,
586
- children: [/* @__PURE__ */ L(p, { children: [g.wave !== void 0 && /* @__PURE__ */ I(_, {
455
+ children: [/* @__PURE__ */ M(l, { children: [x.wave !== void 0 && /* @__PURE__ */ j(p, {
587
456
  tone: "neutral",
588
- children: g.wave
589
- }), /* @__PURE__ */ I(l, { children: /* @__PURE__ */ I("strong", { children: g.label }) })] }), /* @__PURE__ */ I(_, {
590
- tone: ge[g.kind],
591
- children: f.kinds[g.kind]
457
+ children: x.wave
458
+ }), /* @__PURE__ */ j(o, { children: /* @__PURE__ */ j("strong", { children: x.label }) })] }), /* @__PURE__ */ j(p, {
459
+ tone: Ce[x.kind],
460
+ children: g.kinds[x.kind]
592
461
  })]
593
462
  }),
594
- /* @__PURE__ */ I(l, {
463
+ /* @__PURE__ */ j(o, {
595
464
  tone: "muted",
596
- children: g.claim
465
+ children: x.claim
597
466
  }),
598
- /* @__PURE__ */ I(o, { items: [
599
- ...g.metric === void 0 ? [] : [{
600
- label: f.metric,
601
- value: O({
602
- value: g.metric,
603
- locale: c.locale,
604
- format: n
467
+ /* @__PURE__ */ j(i, { items: [
468
+ ...x.metric === void 0 ? [] : [{
469
+ label: g.metric,
470
+ value: e({
471
+ value: x.metric,
472
+ locale: h.locale,
473
+ format: r
605
474
  })
606
475
  }],
607
- ...g.delta === void 0 ? [] : [{
608
- label: f.delta,
609
- value: O({
610
- value: g.delta,
611
- locale: c.locale,
612
- format: r ?? n
476
+ ...x.delta === void 0 ? [] : [{
477
+ label: g.delta,
478
+ value: e({
479
+ value: x.delta,
480
+ locale: h.locale,
481
+ format: a ?? r
613
482
  })
614
483
  }],
615
- ...g.limitation === void 0 ? [] : [{
616
- label: f.limitation,
617
- value: g.limitation
484
+ ...x.limitation === void 0 ? [] : [{
485
+ label: g.limitation,
486
+ value: x.limitation
618
487
  }],
619
- ...g.source === void 0 ? [] : [{
620
- label: f.source,
621
- value: g.source
488
+ ...x.source === void 0 ? [] : [{
489
+ label: g.source,
490
+ value: x.source
622
491
  }]
623
492
  ] })
624
493
  ]
625
494
  })] });
626
495
  }
627
496
  // packages/kits/src/research/specimen-diff.tsx
628
- var ye = {
497
+ var Ee = {
629
498
  breakdownTitle: "Paired outcome flips",
630
499
  all: "All",
631
500
  gained: "Gained",
@@ -638,65 +507,65 @@ var ye = {
638
507
  candidate: "Candidate",
639
508
  outcome: "Outcome",
640
509
  empty: "No paired specimens available for these two runs."
641
- }, be = {
510
+ }, De = {
642
511
  gained: "positive",
643
512
  regressed: "negative",
644
513
  both_pass: "neutral",
645
514
  both_fail: "neutral"
646
- }, xe = /* @__PURE__ */ new Set([
515
+ }, Oe = /* @__PURE__ */ new Set([
647
516
  "gained",
648
517
  "regressed",
649
518
  "both_pass",
650
519
  "both_fail"
651
520
  ]);
652
- function Se(e) {
653
- return e !== null && xe.has(e);
521
+ function ke(e) {
522
+ return e !== null && Oe.has(e);
654
523
  }
655
- function Ce({ rows: e, baselineLabel: t, candidateLabel: r, filter: i, onFilterChange: a, onSelectRow: o, labels: c, ...u }) {
656
- let f = {
657
- ...ye,
658
- ...c
524
+ function Ae({ rows: e, baselineLabel: r, candidateLabel: i, filter: a, onFilterChange: s, onSelectRow: l, labels: u, ...d }) {
525
+ let m = {
526
+ ...Ee,
527
+ ...u
659
528
  };
660
- if (e.length === 0) return /* @__PURE__ */ I(b, {
661
- title: u.title,
662
- children: f.empty
529
+ if (e.length === 0) return /* @__PURE__ */ j(v, {
530
+ title: d.title,
531
+ children: m.empty
663
532
  });
664
- let p = {
533
+ let h = {
665
534
  gained: 0,
666
535
  regressed: 0,
667
536
  both_pass: 0,
668
537
  both_fail: 0
669
538
  };
670
- for (let t of e) p[t.outcome] += 1;
671
- let m = i === "all" ? e : e.filter((e) => e.outcome === i), h = {
672
- gained: f.gained,
673
- regressed: f.regressed,
674
- both_pass: f.bothPass,
675
- both_fail: f.bothFail
676
- }, v = [
539
+ for (let t of e) h[t.outcome] += 1;
540
+ let g = a === "all" ? e : e.filter((e) => e.outcome === a), _ = {
541
+ gained: m.gained,
542
+ regressed: m.regressed,
543
+ both_pass: m.bothPass,
544
+ both_fail: m.bothFail
545
+ }, y = [
677
546
  {
678
547
  id: "specimen",
679
- label: f.specimen,
548
+ label: m.specimen,
680
549
  role: "primary",
681
- cell: (e) => /* @__PURE__ */ I(n, {
550
+ cell: (e) => /* @__PURE__ */ j(t, {
682
551
  secondary: e.family,
683
552
  children: e.prompt
684
553
  })
685
554
  },
686
555
  {
687
556
  id: "expected",
688
- label: f.expected,
557
+ label: m.expected,
689
558
  role: "text",
690
- cell: (e) => /* @__PURE__ */ I(g, { children: e.expected })
559
+ cell: (e) => /* @__PURE__ */ j(f, { children: e.expected })
691
560
  },
692
561
  {
693
562
  id: "baseline",
694
- label: t.trim() === "" ? f.baseline : t,
563
+ label: r.trim() === "" ? m.baseline : r,
695
564
  role: "text",
696
565
  isSecondary: !0,
697
- cell: (e) => /* @__PURE__ */ I(l, {
566
+ cell: (e) => /* @__PURE__ */ j(o, {
698
567
  variant: "mono",
699
- children: /* @__PURE__ */ I(N, {
568
+ children: /* @__PURE__ */ j(C, {
700
569
  text: e.baselineOutput,
701
570
  query: e.expected,
702
571
  tone: "accent"
@@ -705,11 +574,11 @@ function Ce({ rows: e, baselineLabel: t, candidateLabel: r, filter: i, onFilterC
705
574
  },
706
575
  {
707
576
  id: "candidate",
708
- label: r.trim() === "" ? f.candidate : r,
577
+ label: i.trim() === "" ? m.candidate : i,
709
578
  role: "text",
710
- cell: (e) => /* @__PURE__ */ I(l, {
579
+ cell: (e) => /* @__PURE__ */ j(o, {
711
580
  variant: "mono",
712
- children: /* @__PURE__ */ I(N, {
581
+ children: /* @__PURE__ */ j(C, {
713
582
  text: e.candidateOutput,
714
583
  query: e.expected,
715
584
  tone: "accent"
@@ -718,119 +587,119 @@ function Ce({ rows: e, baselineLabel: t, candidateLabel: r, filter: i, onFilterC
718
587
  },
719
588
  {
720
589
  id: "outcome",
721
- label: f.outcome,
590
+ label: m.outcome,
722
591
  role: "status",
723
- cell: (e) => /* @__PURE__ */ I(_, {
724
- tone: be[e.outcome],
725
- children: h[e.outcome]
592
+ cell: (e) => /* @__PURE__ */ j(p, {
593
+ tone: De[e.outcome],
594
+ children: _[e.outcome]
726
595
  })
727
596
  }
728
597
  ];
729
- return /* @__PURE__ */ L(d, {
598
+ return /* @__PURE__ */ M(c, {
730
599
  isCompact: !0,
731
600
  children: [
732
- /* @__PURE__ */ I(M, {
733
- title: f.breakdownTitle,
734
- description: u.description,
735
- locale: u.locale,
736
- status: u.status,
737
- source: u.source,
601
+ /* @__PURE__ */ j(S, {
602
+ title: m.breakdownTitle,
603
+ description: d.description,
604
+ locale: d.locale,
605
+ status: d.status,
606
+ source: d.source,
738
607
  total: e.length,
739
608
  valueFormat: { maximumFractionDigits: 0 },
740
609
  items: [
741
610
  {
742
611
  id: "gained",
743
- label: f.gained,
744
- value: p.gained,
612
+ label: m.gained,
613
+ value: h.gained,
745
614
  tone: "positive"
746
615
  },
747
616
  {
748
617
  id: "both_pass",
749
- label: f.bothPass,
750
- value: p.both_pass,
618
+ label: m.bothPass,
619
+ value: h.both_pass,
751
620
  tone: "series1"
752
621
  },
753
622
  {
754
623
  id: "regressed",
755
- label: f.regressed,
756
- value: p.regressed,
624
+ label: m.regressed,
625
+ value: h.regressed,
757
626
  tone: "negative"
758
627
  },
759
628
  {
760
629
  id: "both_fail",
761
- label: f.bothFail,
762
- value: p.both_fail,
630
+ label: m.bothFail,
631
+ value: h.both_fail,
763
632
  tone: "series5"
764
633
  }
765
634
  ],
766
- selected: i === "all" ? null : i,
635
+ selected: a === "all" ? null : a,
767
636
  onSelectedChange: (e) => {
768
- Se(e) ? a(e === i ? "all" : e) : a("all");
637
+ ke(e) ? s(e === a ? "all" : e) : s("all");
769
638
  }
770
639
  }),
771
- /* @__PURE__ */ L(C.Root, {
772
- "aria-label": f.outcome,
773
- value: i,
640
+ /* @__PURE__ */ M(x.Root, {
641
+ "aria-label": m.outcome,
642
+ value: a,
774
643
  onValueChange: (e) => {
775
- a(e);
644
+ s(e);
776
645
  },
777
646
  children: [
778
- /* @__PURE__ */ L(C.Item, {
647
+ /* @__PURE__ */ M(x.Item, {
779
648
  value: "all",
780
649
  children: [
781
- f.all,
650
+ m.all,
782
651
  " (",
783
652
  e.length,
784
653
  ")"
785
654
  ]
786
655
  }),
787
- /* @__PURE__ */ L(C.Item, {
656
+ /* @__PURE__ */ M(x.Item, {
788
657
  value: "gained",
789
658
  children: [
790
- f.gained,
659
+ m.gained,
791
660
  " (",
792
- p.gained,
661
+ h.gained,
793
662
  ")"
794
663
  ]
795
664
  }),
796
- /* @__PURE__ */ L(C.Item, {
665
+ /* @__PURE__ */ M(x.Item, {
797
666
  value: "regressed",
798
667
  children: [
799
- f.regressed,
668
+ m.regressed,
800
669
  " (",
801
- p.regressed,
670
+ h.regressed,
802
671
  ")"
803
672
  ]
804
673
  }),
805
- /* @__PURE__ */ L(C.Item, {
674
+ /* @__PURE__ */ M(x.Item, {
806
675
  value: "both_pass",
807
676
  children: [
808
- f.bothPass,
677
+ m.bothPass,
809
678
  " (",
810
- p.both_pass,
679
+ h.both_pass,
811
680
  ")"
812
681
  ]
813
682
  }),
814
- /* @__PURE__ */ L(C.Item, {
683
+ /* @__PURE__ */ M(x.Item, {
815
684
  value: "both_fail",
816
685
  children: [
817
- f.bothFail,
686
+ m.bothFail,
818
687
  " (",
819
- p.both_fail,
688
+ h.both_fail,
820
689
  ")"
821
690
  ]
822
691
  })
823
692
  ]
824
693
  }),
825
- /* @__PURE__ */ I(s, {
826
- caption: u.title,
694
+ /* @__PURE__ */ j(n, {
695
+ caption: d.title,
827
696
  hideCaption: !0,
828
- columns: v,
829
- rows: m,
697
+ columns: y,
698
+ rows: g,
830
699
  getRowId: (e) => e.id,
831
- ...o !== void 0 && { rowAction: {
700
+ ...l !== void 0 && { rowAction: {
832
701
  label: (e) => `Inspect ${e.id}`,
833
- onActivate: o
702
+ onActivate: l
834
703
  } },
835
704
  query: {
836
705
  mode: "local",
@@ -841,14 +710,14 @@ function Ce({ rows: e, baselineLabel: t, candidateLabel: r, filter: i, onFilterC
841
710
  value: (e) => e.family
842
711
  }]
843
712
  },
844
- empty: f.empty,
713
+ empty: m.empty,
845
714
  filteredEmpty: "No specimens match the current filter."
846
715
  })
847
716
  ]
848
717
  });
849
718
  }
850
719
  // packages/kits/src/research/work-heartbeat.tsx
851
- var we = {
720
+ var je = {
852
721
  title: "Active work reports",
853
722
  empty: "No active or recent work reports.",
854
723
  nextCheckpoint: "Next checkpoint",
@@ -859,90 +728,90 @@ var we = {
859
728
  overdue: "Update overdue",
860
729
  stopped: "Stopped"
861
730
  }
862
- }, Te = {
731
+ }, Me = {
863
732
  running: "positive",
864
733
  completed: "neutral",
865
734
  blocked: "negative",
866
735
  overdue: "warning",
867
736
  stopped: "neutral"
868
737
  };
869
- function Ee(e) {
738
+ function Ne(e) {
870
739
  return e === void 0 ? null : Number.isFinite(e.completed) && Number.isFinite(e.total) && e.total > 0 ? e : null;
871
740
  }
872
- function De({ reports: e, locale: t, labels: n }) {
873
- let r = {
874
- ...we,
875
- ...n,
741
+ function Pe({ reports: t, locale: n, labels: i }) {
742
+ let a = {
743
+ ...je,
744
+ ...i,
876
745
  states: {
877
- ...we.states,
878
- ...n?.states
746
+ ...je.states,
747
+ ...i?.states
879
748
  }
880
749
  };
881
- return e.length === 0 ? /* @__PURE__ */ I("div", {
750
+ return t.length === 0 ? /* @__PURE__ */ j("div", {
882
751
  className: "x1qokhjc",
883
- children: /* @__PURE__ */ I(l, {
752
+ children: /* @__PURE__ */ j(o, {
884
753
  variant: "caption",
885
754
  tone: "muted",
886
- children: r.empty
755
+ children: a.empty
887
756
  })
888
- }) : /* @__PURE__ */ I("ul", {
757
+ }) : /* @__PURE__ */ j("ul", {
889
758
  className: "xe8uvvx x1ghz6dp x1717udv x178xt8z x13fuv20 xhjagg4",
890
- children: e.map((e) => {
891
- let n = Ee(e.progress), i = n === null ? null : Math.max(0, Math.min(100, n.completed / n.total * 100)), o = e.nextCheckpoint !== void 0 || e.executionRef !== void 0;
892
- return /* @__PURE__ */ L("li", {
759
+ children: t.map((t) => {
760
+ let i = Ne(t.progress), s = i === null ? null : Math.max(0, Math.min(100, i.completed / i.total * 100)), d = t.nextCheckpoint !== void 0 || t.executionRef !== void 0;
761
+ return /* @__PURE__ */ M("li", {
893
762
  className: "x78zum5 xdt5ytf x1hnptsi x1qokhjc xso031l x1q0q8m5 x1qndepd",
894
763
  children: [
895
- /* @__PURE__ */ L(p, {
764
+ /* @__PURE__ */ M(l, {
896
765
  shouldSpaceBetween: !0,
897
- children: [/* @__PURE__ */ I(l, { children: /* @__PURE__ */ I("strong", { children: e.title }) }), /* @__PURE__ */ L(p, { children: [/* @__PURE__ */ I(m, {
898
- tone: Te[e.state],
899
- children: r.states[e.state]
900
- }), /* @__PURE__ */ I(a, {
901
- dateTime: e.observedAt,
902
- label: e.observedLabel
766
+ children: [/* @__PURE__ */ j(o, { children: /* @__PURE__ */ j("strong", { children: t.title }) }), /* @__PURE__ */ M(l, { children: [/* @__PURE__ */ j(u, {
767
+ tone: Me[t.state],
768
+ children: a.states[t.state]
769
+ }), /* @__PURE__ */ j(r, {
770
+ dateTime: t.observedAt,
771
+ label: t.observedLabel
903
772
  })] })]
904
773
  }),
905
- n !== null && i !== null && /* @__PURE__ */ L(d, {
774
+ i !== null && s !== null && /* @__PURE__ */ M(c, {
906
775
  isCompact: !0,
907
- children: [/* @__PURE__ */ L(p, {
776
+ children: [/* @__PURE__ */ M(l, {
908
777
  shouldSpaceBetween: !0,
909
- children: [/* @__PURE__ */ L(l, {
778
+ children: [/* @__PURE__ */ M(o, {
910
779
  variant: "caption",
911
780
  tone: "muted",
912
781
  children: [
913
- O({
914
- value: n.completed,
915
- locale: t,
782
+ e({
783
+ value: i.completed,
784
+ locale: n,
916
785
  format: { maximumFractionDigits: 0 }
917
786
  }),
918
787
  " /",
919
788
  " ",
920
- O({
921
- value: n.total,
922
- locale: t,
789
+ e({
790
+ value: i.total,
791
+ locale: n,
923
792
  format: { maximumFractionDigits: 0 }
924
793
  }),
925
794
  " ",
926
- n.unit
795
+ i.unit
927
796
  ]
928
- }), /* @__PURE__ */ I(_, {
797
+ }), /* @__PURE__ */ j(p, {
929
798
  tone: "neutral",
930
- children: O({
931
- value: i / 100,
932
- locale: t,
799
+ children: e({
800
+ value: s / 100,
801
+ locale: n,
933
802
  format: {
934
803
  style: "percent",
935
804
  maximumFractionDigits: 0
936
805
  }
937
806
  })
938
807
  })]
939
- }), /* @__PURE__ */ I(x, {
940
- label: e.title,
941
- value: n.completed,
942
- max: n.total,
943
- valueLabel: O({
944
- value: i / 100,
945
- locale: t,
808
+ }), /* @__PURE__ */ j(y, {
809
+ label: t.title,
810
+ value: i.completed,
811
+ max: i.total,
812
+ valueLabel: e({
813
+ value: s / 100,
814
+ locale: n,
946
815
  format: {
947
816
  style: "percent",
948
817
  maximumFractionDigits: 0
@@ -950,21 +819,429 @@ function De({ reports: e, locale: t, labels: n }) {
950
819
  })
951
820
  })]
952
821
  }),
953
- o && /* @__PURE__ */ L(p, {
822
+ d && /* @__PURE__ */ M(l, {
954
823
  shouldSpaceBetween: !0,
955
- children: [e.nextCheckpoint === void 0 ? /* @__PURE__ */ I("span", {}) : /* @__PURE__ */ L(l, {
824
+ children: [t.nextCheckpoint === void 0 ? /* @__PURE__ */ j("span", {}) : /* @__PURE__ */ M(o, {
956
825
  variant: "caption",
957
826
  tone: "muted",
958
827
  children: [
959
- r.nextCheckpoint,
828
+ a.nextCheckpoint,
960
829
  ": ",
961
- e.nextCheckpoint
830
+ t.nextCheckpoint
962
831
  ]
963
- }), e.executionRef !== void 0 && /* @__PURE__ */ I(g, { children: e.executionRef })]
832
+ }), t.executionRef !== void 0 && /* @__PURE__ */ j(f, { children: t.executionRef })]
964
833
  })
965
834
  ]
966
- }, e.id);
835
+ }, t.id);
836
+ })
837
+ });
838
+ }
839
+ // packages/kits/src/research/motion-error.tsx
840
+ function U(e) {
841
+ throw Error(e);
842
+ }
843
+ function Fe({ title: e, locale: t, first: n, last: r }) {
844
+ return /* @__PURE__ */ j(E, {
845
+ title: e,
846
+ locale: t,
847
+ message: `Choose an integer tick from ${n} through ${r}.`
848
+ });
849
+ }
850
+ // packages/kits/src/research/motion-clip.ts
851
+ var W = {
852
+ text: 4096,
853
+ span: 1e-9,
854
+ rate: 1e9,
855
+ samples: 1e6,
856
+ tracks: 4096,
857
+ regions: 64,
858
+ metrics: 64,
859
+ moments: 512,
860
+ arms: 8
861
+ }, G = {
862
+ bounds: 4,
863
+ point: 3,
864
+ pair: 2
865
+ };
866
+ function K(e, t) {
867
+ e || U(t);
868
+ }
869
+ function q(e) {
870
+ return typeof e != "object" || !e || Array.isArray(e) ? U("Expected a motion record.") : Object.fromEntries(Object.entries(e));
871
+ }
872
+ function J(e, t, n = 0) {
873
+ return !Array.isArray(e) || e.length < n || e.length > t ? U(`Expected between ${n} and ${t} motion items.`) : e;
874
+ }
875
+ function Y(e) {
876
+ return typeof e != "string" || e.length > W.text || e.trim().length === 0 ? U("Expected a nonempty motion label or ID.") : e;
877
+ }
878
+ function X(e) {
879
+ return typeof e != "number" || !Number.isFinite(e) || Math.abs(e) > 2 ** 53 - 1 ? U("Expected a finite motion value in range.") : e;
880
+ }
881
+ function Ie(e) {
882
+ let [t, n, r, i] = J(e, G.bounds, G.bounds), a = [
883
+ X(t),
884
+ X(n),
885
+ X(r),
886
+ X(i)
887
+ ];
888
+ return K(a[2] - a[0] >= W.span && a[3] - a[1] >= W.span, "Motion bounds must increase along both axes."), a;
889
+ }
890
+ function Z(e) {
891
+ let t = X(e);
892
+ return K(Number.isSafeInteger(t), "Motion ticks must be integers."), t;
893
+ }
894
+ function Le(e) {
895
+ let t = q(e);
896
+ K(t.version === 1, "Unsupported motion clip version.");
897
+ let n = Z(t.first), r = Z(t.last);
898
+ K(r >= n && Number.isSafeInteger(r - n), "Invalid motion tick range.");
899
+ let i = X(t.hz), a = X(t.speed);
900
+ K(i > 0 && a > 0 && i * a <= W.rate, "Expected a positive motion tick rate and speed in range.");
901
+ function o(e) {
902
+ let t = Z(e);
903
+ return K(t >= n && t <= r, "Tick outside the motion window."), t;
904
+ }
905
+ let s = { remaining: W.samples };
906
+ function c(e, t, n) {
907
+ let r = J(e, s.remaining, 1);
908
+ s.remaining -= r.length;
909
+ let i = -Infinity;
910
+ return r.map((e) => {
911
+ let r = J(e, t, t), a = o(r[0]);
912
+ return K(a > i, "Sample ticks must increase within each series."), i = a, n(a, r);
913
+ });
914
+ }
915
+ function l(e) {
916
+ let t = q(e), r = J(t.tracks, W.tracks).map((e) => {
917
+ let t = q(e), r = c(t.points, G.point, (e, t) => [
918
+ e,
919
+ X(t[1]),
920
+ X(t[2])
921
+ ]), i = o(t.end);
922
+ K(i >= (r.at(-1)?.[0] ?? n), "Track ends before its last sample.");
923
+ let a = t.notes === void 0 ? [] : c(t.notes, G.pair, (e, t) => [e, Y(t[1])]);
924
+ return {
925
+ id: Y(t.id),
926
+ label: Y(t.label),
927
+ points: r,
928
+ end: i,
929
+ notes: a
930
+ };
931
+ }), i = r.toSorted((e, t) => e.id === t.id ? e.end - t.end : e.id > t.id ? 1 : -1);
932
+ K(i.every((e, t) => {
933
+ let r = i[t - 1];
934
+ return r === void 0 || r.id !== e.id || r.end < (e.points[0]?.[0] ?? n);
935
+ }), "Segments of the same track overlap.");
936
+ let a = J(t.regions === void 0 ? [] : t.regions, W.regions).map((e) => {
937
+ let t = q(e);
938
+ return {
939
+ label: Y(t.label),
940
+ bounds: Ie(t.bounds)
941
+ };
942
+ }), s = J(t.metrics === void 0 ? [] : t.metrics, W.metrics).map((e) => {
943
+ let t = q(e);
944
+ return {
945
+ label: Y(t.label),
946
+ values: c(t.values, G.pair, (e, t) => [e, X(t[1])])
947
+ };
948
+ });
949
+ return {
950
+ label: Y(t.label),
951
+ tracks: r,
952
+ regions: a,
953
+ metrics: s
954
+ };
955
+ }
956
+ let u = J(t.moments, W.moments).map((e) => {
957
+ let t = q(e), n = t.detail;
958
+ return {
959
+ id: Y(t.id),
960
+ label: Y(t.label),
961
+ tick: o(t.tick),
962
+ ...n === void 0 ? {} : { detail: Y(n) }
963
+ };
964
+ });
965
+ return K(new Set(u.map((e) => e.id)).size === u.length, "Motion moment IDs must be unique."), {
966
+ version: 1,
967
+ title: Y(t.title),
968
+ first: n,
969
+ last: r,
970
+ hz: i,
971
+ speed: a,
972
+ bounds: Ie(t.bounds),
973
+ arms: J(t.arms, W.arms, 1).map(l),
974
+ moments: u,
975
+ source: t.source
976
+ };
977
+ }
978
+ // packages/kits/src/research/motion-frame.ts
979
+ var Re = 2, ze = 12;
980
+ function Q(e, t) {
981
+ let n = 0, r = e.length;
982
+ for (; n < r;) {
983
+ let i = Math.floor((n + r) / Re);
984
+ (e[i]?.[0] ?? Infinity) <= t ? n = i + 1 : r = i;
985
+ }
986
+ return n - 1;
987
+ }
988
+ function Be(e, t) {
989
+ let n = Q(e, t), r = e[n];
990
+ if (r === void 0) return null;
991
+ let i = e[n + 1] ?? r, a = i === r ? 0 : (t - r[0]) / (i[0] - r[0]);
992
+ return {
993
+ x: r[1] + a * (i[1] - r[1]),
994
+ y: r[2] + a * (i[2] - r[2]),
995
+ sampled: r[0] === t
996
+ };
997
+ }
998
+ function Ve(e, t, n) {
999
+ return e.flatMap(({ id: e, label: r, points: i, end: a, notes: o = [] }) => {
1000
+ if (t > a) return [];
1001
+ let s = Be(i, t);
1002
+ if (s === null) return [];
1003
+ let c = Math.max(i[0]?.[0] ?? t, t - n), l = Array.from({ length: 13 }, (e, n) => Be(i, c + (t - c) * n / ze)), u = l.flatMap((e, t) => {
1004
+ let n = l[t - 1];
1005
+ return e === null || n?.x === e.x && n.y === e.y ? [] : [[e.x, e.y]];
1006
+ });
1007
+ return [{
1008
+ id: e,
1009
+ label: r,
1010
+ ...s,
1011
+ trail: u,
1012
+ note: o[Q(o, t)]
1013
+ }];
1014
+ });
1015
+ }
1016
+ function He(e, t) {
1017
+ return !Number.isSafeInteger(t) || t < e.first || t > e.last ? U("Choose an integer tick inside the motion window.") : e.arms.map((n) => ({
1018
+ label: n.label,
1019
+ regions: n.regions ?? [],
1020
+ actors: Ve(n.tracks, t, e.hz),
1021
+ metrics: (n.metrics ?? []).map(({ label: e, values: n }) => ({
1022
+ label: e,
1023
+ value: n[Q(n, t)]?.[1] ?? null
1024
+ }))
1025
+ }));
1026
+ }
1027
+ // packages/kits/src/research/motion-scene.tsx
1028
+ var Ue = {
1029
+ tick: "Tick",
1030
+ start: "Start",
1031
+ moment: "Jump to moment",
1032
+ actor: "Inspect actor",
1033
+ sampled: "Recorded",
1034
+ interpolated: "Estimated",
1035
+ absent: "No position recorded"
1036
+ };
1037
+ function We({ frame: e, arm: t, isCompact: n, index: r, bounds: i, isInspecting: a, format: s, labels: u }) {
1038
+ let [d, f] = A(null), p = a ? d : null, m = e.actors.find((e) => e.id === p), h = t.tracks.length === 1 ? t.tracks[0]?.points[0] : void 0, g = m?.note === void 0 ? null : /* @__PURE__ */ M(o, {
1039
+ variant: "caption",
1040
+ children: [
1041
+ s.format(m.note[0]),
1042
+ " · ",
1043
+ m.note[1]
1044
+ ]
1045
+ }), _ = a && t.tracks.length > 0, v = [
1046
+ e.label,
1047
+ ...e.regions.map((e) => e.label),
1048
+ ...e.actors.map((e) => `${e.label} (${s.format(e.x)}, ${s.format(e.y)})`)
1049
+ ].join(", ");
1050
+ return /* @__PURE__ */ M(c, {
1051
+ isCompact: !0,
1052
+ children: [
1053
+ /* @__PURE__ */ M(l, {
1054
+ shouldSpaceBetween: !0,
1055
+ children: [/* @__PURE__ */ j(o, { children: /* @__PURE__ */ j("strong", { children: e.label }) }), e.metrics.map(({ label: e, value: t }) => /* @__PURE__ */ M(o, { children: [
1056
+ e,
1057
+ " ",
1058
+ /* @__PURE__ */ j("strong", { children: t === null ? "—" : s.format(t) })
1059
+ ] }, e))]
1060
+ }),
1061
+ /* @__PURE__ */ j(O, {
1062
+ isCompact: n,
1063
+ origin: h === void 0 ? void 0 : {
1064
+ x: h[1],
1065
+ y: h[2],
1066
+ label: u.start
1067
+ },
1068
+ locale: s.resolvedOptions().locale,
1069
+ isDense: t.tracks.length > 6,
1070
+ bounds: i,
1071
+ label: v,
1072
+ regions: e.regions,
1073
+ points: e.actors,
1074
+ tone: D(r),
1075
+ shape: r % 2 == 0 ? "circle" : "diamond",
1076
+ selected: p
1077
+ }),
1078
+ _ && /* @__PURE__ */ M(l, { children: [
1079
+ /* @__PURE__ */ j(b, {
1080
+ label: u.actor,
1081
+ placeholder: u.actor,
1082
+ items: Array.from(new Map(t.tracks.map((e) => [e.id, e.label])), ([e, t]) => ({
1083
+ value: e,
1084
+ label: `${t} · ${e}`
1085
+ })),
1086
+ value: p,
1087
+ onValueChange: f
1088
+ }),
1089
+ p !== null && /* @__PURE__ */ j(o, {
1090
+ variant: "caption",
1091
+ children: m === void 0 ? u.absent : `${m.sampled ? u.sampled : u.interpolated} · ${s.format(m.x)}, ${s.format(m.y)}`
1092
+ }),
1093
+ g
1094
+ ] })
1095
+ ]
1096
+ });
1097
+ }
1098
+ function $({ clip: e, tick: t, isInspecting: n = !1, isGuided: r = !1, locale: i = "en-US", labels: a }) {
1099
+ let s = {
1100
+ ...Ue,
1101
+ ...a
1102
+ }, c = new Intl.NumberFormat(i, { maximumFractionDigits: 6 });
1103
+ if (!Number.isSafeInteger(t) || t < e.first || t > e.last) return /* @__PURE__ */ j(Fe, {
1104
+ title: e.title,
1105
+ locale: i,
1106
+ first: e.first,
1107
+ last: e.last
1108
+ });
1109
+ let l = He(e, t);
1110
+ return /* @__PURE__ */ j(T, {
1111
+ title: e.title,
1112
+ locale: i,
1113
+ actions: /* @__PURE__ */ M(o, {
1114
+ variant: "caption",
1115
+ children: [
1116
+ s.tick,
1117
+ " ",
1118
+ c.format(t)
1119
+ ]
1120
+ }),
1121
+ children: /* @__PURE__ */ j("div", {
1122
+ ...{
1123
+ 0: { className: "xrvj5dj x1yqo59v x1j825kq xeuugli" },
1124
+ 1: { className: "xrvj5dj xeuugli xnby9oq x1j825kq" }
1125
+ }[!!(r && e.arms.length === 2) | 0],
1126
+ children: e.arms.map((t, i) => {
1127
+ let a = l[i];
1128
+ return a === void 0 ? null : /* @__PURE__ */ j(We, {
1129
+ isCompact: r,
1130
+ arm: t,
1131
+ index: i,
1132
+ bounds: e.bounds,
1133
+ frame: a,
1134
+ isInspecting: n,
1135
+ format: c,
1136
+ labels: s
1137
+ }, t.label);
1138
+ })
1139
+ })
1140
+ });
1141
+ }
1142
+ // packages/kits/src/research/motion-figure.tsx
1143
+ function Ge({ clip: e, tick: t, onTickChange: n, isPlaying: r, onPlayingChange: i, isInspecting: s = !1, isGuided: u = !1, locale: d = "en-US", labels: f }) {
1144
+ let p = {
1145
+ ...Ue,
1146
+ ...f
1147
+ }, [m, h] = A(!1), [g, _] = A(e.speed), v = r ?? m, { ref: y, isActive: x } = te(v, !0), S = re(() => e.moments.map(({ id: e, label: t, tick: n }) => ({
1148
+ id: e,
1149
+ label: t,
1150
+ position: n
1151
+ })), [e]), C = re(() => new Intl.NumberFormat(d), [d]);
1152
+ function T(a) {
1153
+ a && t === e.last && n(e.first), r === void 0 && h(a), i?.(a);
1154
+ }
1155
+ function E(t) {
1156
+ T(!1), n(Math.min(e.last, Math.max(e.first, t)));
1157
+ }
1158
+ let D = k(() => T(!1));
1159
+ ne(() => {
1160
+ let e = matchMedia("(prefers-reduced-motion: reduce)");
1161
+ function t() {
1162
+ e.matches && D();
1163
+ }
1164
+ return e.addEventListener("change", t), () => e.removeEventListener("change", t);
1165
+ }, []);
1166
+ let O = k(() => t), ie = k((r) => {
1167
+ r !== t && n(r), r === e.last && T(!1);
1168
+ });
1169
+ ne(() => {
1170
+ if (!x) return;
1171
+ let t = performance.now(), n = O(), r = requestAnimationFrame(i);
1172
+ function i(a) {
1173
+ let o = Math.max(0, a - t), s = Math.floor(o * e.hz * g / 1e3), c = Math.min(e.last, n + s);
1174
+ ie(c), c !== e.last && (r = requestAnimationFrame(i));
1175
+ }
1176
+ return () => cancelAnimationFrame(r);
1177
+ }, [
1178
+ e.hz,
1179
+ e.last,
1180
+ x,
1181
+ g
1182
+ ]);
1183
+ let N = e.moments.find((e) => e.tick === t), P = e.moments.filter((e) => e.tick <= t).toSorted((e, t) => t.tick - e.tick)[0];
1184
+ return /* @__PURE__ */ j("div", {
1185
+ ref: y,
1186
+ children: /* @__PURE__ */ M(c, {
1187
+ isCompact: !0,
1188
+ children: [
1189
+ /* @__PURE__ */ j($, {
1190
+ isGuided: u,
1191
+ clip: e,
1192
+ tick: t,
1193
+ isInspecting: s,
1194
+ locale: d,
1195
+ labels: p
1196
+ }),
1197
+ /* @__PURE__ */ j(ee, {
1198
+ label: p.tick,
1199
+ min: e.first,
1200
+ max: e.last,
1201
+ value: t,
1202
+ markers: S,
1203
+ onValueChange: E,
1204
+ onScrubStart: () => T(!1),
1205
+ onMarkerSelect: () => T(!1),
1206
+ formatValue: (e) => C.format(e)
1207
+ }),
1208
+ /* @__PURE__ */ j(w, {
1209
+ isPlaying: v,
1210
+ onPlayingChange: T,
1211
+ speed: g,
1212
+ onSpeedChange: _,
1213
+ onStepBackward: () => E(t - 1),
1214
+ onStepForward: () => E(t + 1),
1215
+ isDisabled: e.first === e.last
1216
+ }),
1217
+ u || e.moments.length === 0 ? null : e.moments.length <= 5 ? /* @__PURE__ */ j(l, { children: e.moments.map((e) => /* @__PURE__ */ j(a, {
1218
+ variant: e === N ? "outline" : "ghost",
1219
+ onClick: () => E(e.tick),
1220
+ children: e.label
1221
+ }, e.id)) }) : /* @__PURE__ */ j(b, {
1222
+ label: p.moment,
1223
+ placeholder: p.moment,
1224
+ items: e.moments.map(({ id: e, label: t, tick: n }) => ({
1225
+ value: e,
1226
+ label: `${C.format(n)} · ${t}`
1227
+ })),
1228
+ value: N?.id ?? null,
1229
+ onValueChange: (t) => {
1230
+ let n = e.moments.find((e) => e.id === t);
1231
+ n !== void 0 && E(n.tick);
1232
+ }
1233
+ }),
1234
+ s && P !== void 0 && /* @__PURE__ */ M(o, {
1235
+ variant: "caption",
1236
+ children: [
1237
+ C.format(P.tick),
1238
+ " · ",
1239
+ P.label,
1240
+ P.detail === void 0 ? "" : ` · ${P.detail}`
1241
+ ]
1242
+ })
1243
+ ]
967
1244
  })
968
1245
  });
969
1246
  }
970
- export { z as CollectionPage, B as CollectionSection, H as FindingCard, me as LineageGraph, ve as MilestonePath, Ce as SpecimenDiff, De as WorkHeartbeat };
1247
+ export { ae as FindingCard, Se as LineageGraph, Te as MilestonePath, Ge as MotionFigure, $ as MotionScene, Ae as SpecimenDiff, Pe as WorkHeartbeat, He as motionSceneAt, Le as parseMotionClip };