@mechane-ai/elements 0.67.0 → 0.69.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 (90) hide show
  1. package/dist/ai.js +226 -225
  2. package/dist/{article-anMy8fA5.js → article-CTSxWe4y.js} +104 -89
  3. package/dist/article.js +1 -1
  4. package/dist/catalog.json +131 -1
  5. package/dist/{categorical-values-Bh7ZkEQn.js → categorical-values-DwomVcSd.js} +1 -1
  6. package/dist/{cells-X8SVrZBc.js → cells-BRI8LpMU.js} +1 -1
  7. package/dist/charts/cartesian.js +1 -1
  8. package/dist/charts/cells.js +1 -1
  9. package/dist/charts/comparison.js +1 -1
  10. package/dist/charts/distribution.js +1 -1
  11. package/dist/charts/figure.js +12 -12
  12. package/dist/charts/graph.js +1 -1
  13. package/dist/charts/hierarchy.js +1 -1
  14. package/dist/charts/image.js +1 -1
  15. package/dist/charts/matrix.js +2 -2
  16. package/dist/charts/plot.js +16 -15
  17. package/dist/charts/relationship.js +1 -1
  18. package/dist/charts/text.js +1 -1
  19. package/dist/charts/timeline.js +2 -2
  20. package/dist/charts/trend.js +1 -1
  21. package/dist/charts.js +3 -3
  22. package/dist/{color-legend-CIo7DhXB.js → color-legend-4As8881l.js} +1 -1
  23. package/dist/content/markdown.js +1 -1
  24. package/dist/content.js +1 -1
  25. package/dist/{dumbbell-plot-BQDGe0sQ.js → dumbbell-plot-S4RyfxmW.js} +5 -5
  26. package/dist/{embedding-map-DmmknG7A.js → embedding-map-Bm7aTA6z.js} +5 -5
  27. package/dist/figure-format-BVb7yFCA.js +46 -0
  28. package/dist/{figure-frame-DlyNTDzh.js → figure-frame-BHCNceS4.js} +1 -1
  29. package/dist/{image-grid-CxEAQvTf.js → image-grid-TTrLxvaI.js} +3 -3
  30. package/dist/kits/evaluation.js +5 -5
  31. package/dist/kits/interpretability.js +8 -8
  32. package/dist/kits/operations.js +4 -4
  33. package/dist/kits/research.js +1087 -230
  34. package/dist/kits/training.js +4 -4
  35. package/dist/lesson.js +3 -3
  36. package/dist/locate-Dcq5ZZSk.js +14 -0
  37. package/dist/markdown-JeuBeMDZ.js +293 -0
  38. package/dist/mdx.js +4 -4
  39. package/dist/packages/charts/src/plot/index.d.ts +3 -0
  40. package/dist/packages/charts/src/plot/locate.d.ts +3 -1
  41. package/dist/packages/charts/src/plot/plot-layout.d.ts +2 -2
  42. package/dist/packages/charts/src/plot/spatial-layer.d.ts +36 -0
  43. package/dist/packages/charts/src/plot/step-history.d.ts +13 -0
  44. package/dist/packages/charts/src/plot/ticks.d.ts +2 -2
  45. package/dist/packages/content/src/timeline-scrubber.d.ts +3 -1
  46. package/dist/packages/foundations/src/visible-motion.d.ts +1 -1
  47. package/dist/packages/kits/src/research/index.d.ts +14 -0
  48. package/dist/packages/kits/src/research/motion-clip.d.ts +3 -0
  49. package/dist/packages/kits/src/research/motion-error.d.ts +8 -0
  50. package/dist/packages/kits/src/research/motion-figure.d.ts +12 -0
  51. package/dist/packages/kits/src/research/motion-frame.d.ts +22 -0
  52. package/dist/packages/kits/src/research/motion-inspection.d.ts +14 -0
  53. package/dist/packages/kits/src/research/motion-location.d.ts +9 -0
  54. package/dist/packages/kits/src/research/motion-scene.d.ts +29 -0
  55. package/dist/packages/kits/src/research/motion-types.d.ts +54 -0
  56. package/dist/packages/kits/src/research/motion-view.d.ts +9 -0
  57. package/dist/packages/kits/src/research/native-motion-figure.d.ts +17 -0
  58. package/dist/packages/kits/src/research/native-motion.d.ts +18 -0
  59. package/dist/packages/teaching/src/article/uncover.d.ts +2 -0
  60. package/dist/{param-CKr8EYxF.js → param-Dk92C-K1.js} +1 -1
  61. package/dist/plot-BIYlgY2B.js +223 -0
  62. package/dist/{plot-layout-CVzSbcU7.js → plot-layout-CNNFMC8H.js} +152 -102
  63. package/dist/{plot-surface-CBhI1alw.js → plot-surface-BSjoNIva.js} +1 -1
  64. package/dist/{reference-lines-C970JwWZ.js → reference-lines-Bet_hRyA.js} +1 -1
  65. package/dist/{scene-C3dCxckI.js → scene-C88Xkz4l.js} +7 -7
  66. package/dist/scene.js +1 -1
  67. package/dist/{slope-chart-DekEJxsy.js → slope-chart-B6Mtcta2.js} +6 -6
  68. package/dist/{src-BsqbWDxS.js → src-DCozYUGI.js} +146 -131
  69. package/dist/styles2.css +16 -4
  70. package/dist/{time-series-BSNnijxf.js → time-series-DJk-2Mt0.js} +7 -7
  71. package/dist/{timeline-CnxfYSIg.js → timeline-BHpj7i7K.js} +4 -4
  72. package/dist/{token-heatmap-CJaXo56P.js → token-heatmap-DEqEaoGE.js} +273 -288
  73. package/dist/{token-predictions-Bi7aKPnh.js → token-predictions-Bjdh0K-A.js} +5 -5
  74. package/dist/{transport-CXj0DV6o.js → transport-DQ1yzsQl.js} +2 -2
  75. package/dist/{tree-diagram-BxOZsjr1.js → tree-diagram-BxSDOBFj.js} +4 -4
  76. package/dist/{treemap-B2yOAetT.js → treemap-DzHAp4ia.js} +5 -5
  77. package/dist/{use-tween-C1TWJwce.js → use-tween-DbXVZBR8.js} +1 -1
  78. package/dist/{violin-plot-W2L_2JRo.js → violin-plot-B4Cf38Y9.js} +5 -5
  79. package/dist/visible-motion-D6NwjGNz.js +24 -0
  80. package/dist/{waterfall-Bt73N2Ng.js → waterfall-C9_pHZzv.js} +4 -4
  81. package/package.json +1 -1
  82. package/recipes/recorded-motion.tsx +14 -0
  83. package/skills/review-elements/SKILL.md +6 -0
  84. package/skills/review-explainer/SKILL.md +4 -0
  85. package/skills/use-elements/SKILL.md +2 -0
  86. package/skills/use-elements/references/kits.md +33 -0
  87. package/skills/write-explainer/SKILL.md +5 -0
  88. package/dist/figure-format-B8kRZMlo.js +0 -36
  89. package/dist/locate-Bcg3QcP4.js +0 -11
  90. package/dist/markdown-Diffqqm7.js +0 -313
@@ -1,17 +1,23 @@
1
- import { r as e } from "../figure-format-B8kRZMlo.js";
1
+ import { r as e } from "../figure-format-BVb7yFCA.js";
2
2
  import { d as t, h as n, n as r, o as i } from "../src-Dc1t1ugL.js";
3
- import { c as a, f as o, h as s, m as c, o as l, p as u, r as d, t as f, v as p } from "../src-Bkov5TTa.js";
4
- import { n as m } from "../src-na2DdkKI.js";
5
- import { a as h, t as g } from "../tree-diagram-BxOZsjr1.js";
6
- import { p as _, s as v } from "../src-CIyuaSCi.js";
7
- import { u as y } from "../src-DceyVyL0.js";
8
- import { f as b } from "../time-series-BSNnijxf.js";
9
- import { i as x } from "../src-BsqbWDxS.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-BxSDOBFj.js";
6
+ import { p as v, s as y } from "../src-CIyuaSCi.js";
7
+ import { c as b, p as x, u as S } from "../src-DceyVyL0.js";
8
+ import { f as C } from "../time-series-DJk-2Mt0.js";
9
+ import { i as w, l as ee, r as T } from "../src-DCozYUGI.js";
10
+ import { n as E, r as D } from "../figure-frame-BHCNceS4.js";
11
+ import { T as O } from "../plot-layout-CNNFMC8H.js";
12
+ import { r as k } from "../tone-scope-DKiSw-JR.js";
13
+ import { n as A, t as te } from "../plot-BIYlgY2B.js";
14
+ import { t as ne } from "../visible-motion-D6NwjGNz.js";
15
+ import { t as re } from "../forms-iAOjGRTO.js";
10
16
  import "@stylexjs/stylex";
11
- import { useState as S } from "react";
12
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
17
+ import { useEffect as ie, useEffectEvent as ae, useMemo as j, useRef as M, useState as N } from "react";
18
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
13
19
  // packages/kits/src/research/finding-card.tsx
14
- var E = {
20
+ var oe = {
15
21
  limitation: "Limitation",
16
22
  details: "Full notes & evidence",
17
23
  sources: "Sources",
@@ -21,58 +27,58 @@ var E = {
21
27
  falsified: "Falsified",
22
28
  open: "Open"
23
29
  }
24
- }, D = {
30
+ }, L = {
25
31
  supported: "positive",
26
32
  mixed: "warning",
27
33
  falsified: "negative",
28
34
  open: "neutral"
29
35
  };
30
- function O({ title: t, claim: n, locale: i, status: o, index: l, limitation: h, metrics: g = [], sources: _ = [], author: v, recordedAt: y, recordedLabel: b, details: x, actions: S, labels: C }) {
31
- let O = {
32
- ...E,
36
+ function R({ 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 }) {
37
+ let w = {
38
+ ...oe,
33
39
  ...C,
34
40
  statusLabels: {
35
- ...E.statusLabels,
41
+ ...oe.statusLabels,
36
42
  ...C?.statusLabels
37
43
  }
38
44
  };
39
- return /* @__PURE__ */ w(u, {
45
+ return /* @__PURE__ */ F(d, {
40
46
  title: t,
41
- index: l,
42
- meta: /* @__PURE__ */ T(c, { children: [/* @__PURE__ */ w(f, {
43
- tone: D[o],
44
- children: O.statusLabels[o]
47
+ index: s,
48
+ meta: /* @__PURE__ */ I(l, { children: [/* @__PURE__ */ F(p, {
49
+ tone: L[a],
50
+ children: w.statusLabels[a]
45
51
  }), S] }),
46
- footer: v !== void 0 || y !== void 0 || _.length > 0 ? /* @__PURE__ */ T(c, {
52
+ footer: v !== void 0 || y !== void 0 || _.length > 0 ? /* @__PURE__ */ I(l, {
47
53
  shouldSpaceBetween: !0,
48
- children: [/* @__PURE__ */ T(c, { children: [v !== void 0 && /* @__PURE__ */ w(a, {
54
+ children: [/* @__PURE__ */ I(l, { children: [v !== void 0 && /* @__PURE__ */ F(o, {
49
55
  variant: "caption",
50
56
  tone: "muted",
51
57
  children: v
52
- }), y !== void 0 && /* @__PURE__ */ w(r, {
58
+ }), y !== void 0 && /* @__PURE__ */ F(r, {
53
59
  dateTime: y,
54
60
  label: b ?? y
55
- })] }), _.length > 0 && /* @__PURE__ */ T(c, { children: [/* @__PURE__ */ T(a, {
61
+ })] }), _.length > 0 && /* @__PURE__ */ I(l, { children: [/* @__PURE__ */ I(o, {
56
62
  variant: "caption",
57
63
  tone: "muted",
58
- children: [O.sources, ":"]
59
- }), _.map((e) => e.summary !== void 0 && e.href !== void 0 ? /* @__PURE__ */ T(m.Root, { children: [/* @__PURE__ */ w(m.Trigger, {
64
+ children: [w.sources, ":"]
65
+ }), _.map((e) => e.summary !== void 0 && e.href !== void 0 ? /* @__PURE__ */ I(h.Root, { children: [/* @__PURE__ */ F(h.Trigger, {
60
66
  href: e.href,
61
- children: /* @__PURE__ */ w(d, { children: e.label })
62
- }), /* @__PURE__ */ w(m.Popup, { children: /* @__PURE__ */ T(s, {
67
+ children: /* @__PURE__ */ F(f, { children: e.label })
68
+ }), /* @__PURE__ */ F(h.Popup, { children: /* @__PURE__ */ I(c, {
63
69
  isCompact: !0,
64
- children: [/* @__PURE__ */ w(a, { children: e.label }), /* @__PURE__ */ w(a, {
70
+ children: [/* @__PURE__ */ F(o, { children: e.label }), /* @__PURE__ */ F(o, {
65
71
  variant: "caption",
66
72
  tone: "muted",
67
73
  children: e.summary
68
74
  })]
69
- }) })] }, e.id) : /* @__PURE__ */ w(d, { children: e.label }, e.id))] })]
75
+ }) })] }, e.id) : /* @__PURE__ */ F(f, { children: e.label }, e.id))] })]
70
76
  }) : void 0,
71
- children: /* @__PURE__ */ T(s, {
77
+ children: /* @__PURE__ */ I(c, {
72
78
  isCompact: !0,
73
79
  children: [
74
- /* @__PURE__ */ w(a, { children: n }),
75
- g.length > 0 && /* @__PURE__ */ w(c, { children: g.map((t) => /* @__PURE__ */ T(f, {
80
+ /* @__PURE__ */ F(o, { children: n }),
81
+ g.length > 0 && /* @__PURE__ */ F(l, { children: g.map((t) => /* @__PURE__ */ I(p, {
76
82
  tone: t.tone ?? "neutral",
77
83
  children: [
78
84
  t.label,
@@ -84,37 +90,37 @@ function O({ title: t, claim: n, locale: i, status: o, index: l, limitation: h,
84
90
  })
85
91
  ]
86
92
  }, t.label)) }),
87
- h !== void 0 && /* @__PURE__ */ T(a, {
93
+ u !== void 0 && /* @__PURE__ */ I(o, {
88
94
  variant: "caption",
89
95
  tone: "muted",
90
96
  children: [
91
- O.limitation,
97
+ w.limitation,
92
98
  ": ",
93
- h
99
+ u
94
100
  ]
95
101
  }),
96
- x !== void 0 && /* @__PURE__ */ T(p.Root, { children: [/* @__PURE__ */ w(p.Trigger, {
102
+ x !== void 0 && /* @__PURE__ */ I(m.Root, { children: [/* @__PURE__ */ F(m.Trigger, {
97
103
  variant: "inline",
98
- children: O.details
99
- }), /* @__PURE__ */ w(p.Panel, { children: x })] })
104
+ children: w.details
105
+ }), /* @__PURE__ */ F(m.Panel, { children: x })] })
100
106
  ]
101
107
  })
102
108
  });
103
109
  }
104
110
  // packages/kits/src/research/lineage-graph.tsx
105
- var k = 152, A = 56, j = 32, M = 12, N = 16, P = 32, F = 16, I = 16, L = 12, R = 640, z = 240, B = 64, V = "General", H = {
111
+ var z = 152, B = 56, se = 32, ce = 12, V = 16, le = 32, H = 16, ue = 16, de = 12, fe = 640, pe = 240, me = 64, he = "General", ge = {
106
112
  baseline: "series5",
107
113
  milestone: "positive",
108
114
  branch: "series1",
109
115
  merge: "series3",
110
116
  killed: "negative"
111
- }, U = {
117
+ }, _e = {
112
118
  baseline: "neutral",
113
119
  milestone: "positive",
114
120
  branch: "neutral",
115
121
  merge: "warning",
116
122
  killed: "negative"
117
- }, W = {
123
+ }, ve = {
118
124
  frontier: "Frontier",
119
125
  all: "All",
120
126
  metric: "Score",
@@ -131,7 +137,7 @@ var k = 152, A = 56, j = 32, M = 12, N = 16, P = 32, F = 16, I = 16, L = 12, R =
131
137
  killed: "Killed"
132
138
  }
133
139
  };
134
- function G(e, t, n) {
140
+ function ye(e, t, n) {
135
141
  let r = t.get(e.id) ?? 0;
136
142
  for (let i of e.parentIds) if (n.has(i)) {
137
143
  let e = (t.get(i) ?? 0) + 1;
@@ -139,13 +145,13 @@ function G(e, t, n) {
139
145
  }
140
146
  return r;
141
147
  }
142
- function K(e) {
148
+ function be(e) {
143
149
  let t = /* @__PURE__ */ new Map(), n = new Set(e.map((e) => e.id));
144
150
  for (let n of e) t.set(n.id, 0);
145
- for (let r = 0; r < B; r += 1) {
151
+ for (let r = 0; r < me; r += 1) {
146
152
  let r = [];
147
153
  for (let i of e) {
148
- let e = G(i, t, n);
154
+ let e = ye(i, t, n);
149
155
  e !== t.get(i.id) && r.push([i.id, e]);
150
156
  }
151
157
  if (r.length === 0) break;
@@ -153,7 +159,7 @@ function K(e) {
153
159
  }
154
160
  return t;
155
161
  }
156
- function q(e) {
162
+ function xe(e) {
157
163
  let t = /* @__PURE__ */ new Set(), n = new Map(e.map((e) => [e.id, e]));
158
164
  function r(e) {
159
165
  if (t.has(e)) return;
@@ -164,7 +170,7 @@ function q(e) {
164
170
  for (let t of e) t.kind !== "killed" && r(t.id);
165
171
  return e.filter((e) => t.has(e.id));
166
172
  }
167
- function J({ node: t, locale: n, valueFormat: r, deltaFormat: i }) {
173
+ function Se({ node: t, locale: n, valueFormat: r, deltaFormat: i }) {
168
174
  let a = [];
169
175
  if (t.metric !== null && t.metric !== void 0 && a.push(r === void 0 ? String(t.metric) : e({
170
176
  value: t.metric,
@@ -180,34 +186,34 @@ function J({ node: t, locale: n, valueFormat: r, deltaFormat: i }) {
180
186
  }
181
187
  return t.caption === void 0 ? a.length > 0 ? a.join(" · ") : t.summary : t.caption;
182
188
  }
183
- function Y(e) {
184
- let t = K(e), n = /* @__PURE__ */ new Map();
189
+ function Ce(e) {
190
+ let t = be(e), n = /* @__PURE__ */ new Map();
185
191
  for (let r of e) n.set(r.id, r.column ?? t.get(r.id) ?? 0);
186
192
  return n;
187
193
  }
188
- function X({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
189
- let i = Y(e), a = Math.max(0, ...Array.from(i.values())), o = e.some((e) => e.lane !== void 0), s = [];
194
+ function we({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
195
+ let i = Ce(e), a = Math.max(0, ...Array.from(i.values())), o = e.some((e) => e.lane !== void 0), s = [];
190
196
  if (o) for (let t of e) {
191
- let e = t.lane ?? V;
197
+ let e = t.lane ?? he;
192
198
  s.includes(e) || s.push(e);
193
199
  }
194
- else s.push(V);
195
- let c = (a + 1) * k + a * j, l = [], u = [], d = N;
200
+ else s.push(he);
201
+ let c = (a + 1) * z + a * se, l = [], u = [], d = V;
196
202
  for (let a of s) {
197
- let s = o ? e.filter((e) => (e.lane ?? V) === a) : e, f = /* @__PURE__ */ new Map();
203
+ let s = o ? e.filter((e) => (e.lane ?? he) === a) : e, f = /* @__PURE__ */ new Map();
198
204
  for (let e of s) {
199
205
  let t = i.get(e.id) ?? 0, n = f.get(t) ?? [];
200
206
  n.push(e), f.set(t, n);
201
207
  }
202
- let p = Math.max(1, ...Array.from(f.values(), (e) => e.length)), m = p * A + (p - 1) * M, h = d, g = o ? h + P : h, _ = o ? P + m + F : m;
208
+ let p = Math.max(1, ...Array.from(f.values(), (e) => e.length)), m = p * B + (p - 1) * ce, h = d, g = o ? h + le : h, _ = o ? le + m + H : m;
203
209
  for (let [e, i] of f.entries()) {
204
- let a = N + (o ? I : 0) + e * 184;
210
+ let a = V + (o ? ue : 0) + e * 184;
205
211
  for (let [e, o] of i.entries()) {
206
212
  let i = g + e * 68;
207
213
  l.push({
208
214
  id: o.id,
209
215
  label: o.label,
210
- description: J({
216
+ description: Se({
211
217
  node: o,
212
218
  locale: t,
213
219
  valueFormat: n,
@@ -215,21 +221,21 @@ function X({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
215
221
  }),
216
222
  x: a,
217
223
  y: i,
218
- width: k,
219
- height: A,
220
- tone: H[o.kind]
224
+ width: z,
225
+ height: B,
226
+ tone: ge[o.kind]
221
227
  });
222
228
  }
223
229
  }
224
230
  o && u.push({
225
231
  id: `lane:${a}`,
226
232
  label: a,
227
- x: N,
233
+ x: V,
228
234
  y: h,
229
235
  width: c + 32,
230
236
  height: _,
231
237
  nodeIds: s.map((e) => e.id)
232
- }), d = h + _ + (o ? L : M);
238
+ }), d = h + _ + (o ? de : ce);
233
239
  }
234
240
  let f = new Set(e.map((e) => e.id)), p = [];
235
241
  for (let t of e) for (let e of t.parentIds) f.has(e) && p.push({
@@ -244,138 +250,138 @@ function X({ nodes: e, locale: t, valueFormat: n, deltaFormat: r }) {
244
250
  relationEdges: p,
245
251
  relationGroups: u,
246
252
  width: c + 32 + (o ? 32 : 0),
247
- height: Math.max(z, d + N - (o ? L : M))
253
+ height: Math.max(pe, d + V - (o ? de : ce))
248
254
  };
249
255
  }
250
- function ee({ node: e, labels: t, detailItems: n }) {
251
- return /* @__PURE__ */ T(s, {
256
+ function Te({ node: e, labels: t, detailItems: n }) {
257
+ return /* @__PURE__ */ I(c, {
252
258
  isCompact: !0,
253
259
  children: [
254
- /* @__PURE__ */ w(o, {}),
255
- /* @__PURE__ */ T(c, {
260
+ /* @__PURE__ */ F(s, {}),
261
+ /* @__PURE__ */ I(l, {
256
262
  shouldSpaceBetween: !0,
257
- children: [/* @__PURE__ */ T(c, { children: [/* @__PURE__ */ w(a, { children: /* @__PURE__ */ w("strong", { children: e.label }) }), e.timestamp === void 0 ? null : /* @__PURE__ */ w(f, {
263
+ children: [/* @__PURE__ */ I(l, { children: [/* @__PURE__ */ F(o, { children: /* @__PURE__ */ F("strong", { children: e.label }) }), e.timestamp === void 0 ? null : /* @__PURE__ */ F(p, {
258
264
  tone: "neutral",
259
265
  children: e.timestamp
260
- })] }), /* @__PURE__ */ w(f, {
261
- tone: U[e.kind],
266
+ })] }), /* @__PURE__ */ F(p, {
267
+ tone: _e[e.kind],
262
268
  children: t.kinds[e.kind]
263
269
  })]
264
270
  }),
265
- e.summary === void 0 ? null : /* @__PURE__ */ w(a, { children: e.summary }),
266
- e.detail === void 0 ? null : /* @__PURE__ */ w(a, {
271
+ e.summary === void 0 ? null : /* @__PURE__ */ F(o, { children: e.summary }),
272
+ e.detail === void 0 ? null : /* @__PURE__ */ F(o, {
267
273
  tone: "muted",
268
274
  children: e.detail
269
275
  }),
270
- n.length === 0 ? null : /* @__PURE__ */ w(i, { items: n })
276
+ n.length === 0 ? null : /* @__PURE__ */ F(i, { items: n })
271
277
  ]
272
278
  });
273
279
  }
274
- function te({ nodes: t, valueLabel: n, valueFormat: r, deltaFormat: i, defaultScope: a = "frontier", selected: o, onSelectedChange: c, labels: u, actions: d, ...f }) {
275
- let [p, m] = S(a), [g, v] = S(null), b = {
276
- ...W,
277
- ...u,
280
+ function Ee({ nodes: t, valueLabel: n, valueFormat: r, deltaFormat: i, defaultScope: a = "frontier", selected: o, onSelectedChange: s, labels: l, actions: d, ...f }) {
281
+ let [p, m] = N(a), [h, _] = N(null), y = {
282
+ ...ve,
283
+ ...l,
278
284
  kinds: {
279
- ...W.kinds,
280
- ...u?.kinds
285
+ ...ve.kinds,
286
+ ...l?.kinds
281
287
  }
282
288
  };
283
- if (f.status === "loading") return /* @__PURE__ */ w(h, {
289
+ if (f.status === "loading") return /* @__PURE__ */ F(g, {
284
290
  ...f,
285
291
  nodes: [],
286
292
  edges: [],
287
- width: R,
288
- height: z
293
+ width: fe,
294
+ height: pe
289
295
  });
290
- if (t.length === 0) return /* @__PURE__ */ w(_, {
296
+ if (t.length === 0) return /* @__PURE__ */ F(v, {
291
297
  title: f.title,
292
- children: b.empty
298
+ children: y.empty
293
299
  });
294
- if (new Set(t.map((e) => e.id)).size !== t.length) return /* @__PURE__ */ w(l, {
300
+ if (new Set(t.map((e) => e.id)).size !== t.length) return /* @__PURE__ */ F(u, {
295
301
  tone: "negative",
296
302
  role: "alert",
297
303
  children: "Lineage nodes must have unique identifiers."
298
304
  });
299
- let x = q(t), E = x.length < t.length, D = p === "frontier" && E ? x : t, O = o === void 0 ? g : o;
300
- function k(e, t) {
301
- o === void 0 && v(e), c?.(e, t);
305
+ let b = xe(t), x = b.length < t.length, C = p === "frontier" && x ? b : t, w = o === void 0 ? h : o;
306
+ function ee(e, t) {
307
+ o === void 0 && _(e), s?.(e, t);
302
308
  }
303
- let A = X({
304
- nodes: D,
309
+ let T = we({
310
+ nodes: C,
305
311
  locale: f.locale,
306
312
  valueFormat: r,
307
313
  deltaFormat: i
308
- }), j = O === null ? void 0 : D.find((e) => e.id === O), M = new Map(t.map((e) => [e.id, e])), N = E ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T(y.Root, {
314
+ }), E = w === null ? void 0 : C.find((e) => e.id === w), D = new Map(t.map((e) => [e.id, e])), O = x ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ I(S.Root, {
309
315
  "aria-label": `${f.title} scope`,
310
316
  value: p,
311
317
  onValueChange: (e) => m(e === "all" ? "all" : "frontier"),
312
- children: [/* @__PURE__ */ w(y.Item, {
318
+ children: [/* @__PURE__ */ F(S.Item, {
313
319
  value: "frontier",
314
- children: `${b.frontier} (${x.length})`
315
- }), /* @__PURE__ */ w(y.Item, {
320
+ children: `${y.frontier} (${b.length})`
321
+ }), /* @__PURE__ */ F(S.Item, {
316
322
  value: "all",
317
- children: `${b.all} (${t.length})`
323
+ children: `${y.all} (${t.length})`
318
324
  })]
319
- }), d] }) : d, P = j === void 0 ? [] : [
320
- ...j.lane === void 0 ? [] : [{
321
- label: b.lane,
322
- value: j.lane
325
+ }), d] }) : d, k = E === void 0 ? [] : [
326
+ ...E.lane === void 0 ? [] : [{
327
+ label: y.lane,
328
+ value: E.lane
323
329
  }],
324
- ...j.metric === null || j.metric === void 0 ? [] : [{
325
- label: n ?? b.metric,
326
- value: r === void 0 ? String(j.metric) : e({
327
- value: j.metric,
330
+ ...E.metric === null || E.metric === void 0 ? [] : [{
331
+ label: n ?? y.metric,
332
+ value: r === void 0 ? String(E.metric) : e({
333
+ value: E.metric,
328
334
  locale: f.locale,
329
335
  format: r
330
336
  })
331
337
  }],
332
- ...j.delta === null || j.delta === void 0 ? [] : [{
333
- label: b.delta,
334
- value: (i ?? r) === void 0 ? j.delta > 0 ? `+${j.delta}` : String(j.delta) : e({
335
- value: j.delta,
338
+ ...E.delta === null || E.delta === void 0 ? [] : [{
339
+ label: y.delta,
340
+ value: (i ?? r) === void 0 ? E.delta > 0 ? `+${E.delta}` : String(E.delta) : e({
341
+ value: E.delta,
336
342
  locale: f.locale,
337
343
  format: i ?? r ?? { style: "decimal" }
338
344
  })
339
345
  }],
340
- ...j.parentIds.length === 0 ? [] : [{
341
- label: b.parents,
342
- value: j.parentIds.map((e) => M.get(e)?.label ?? e).join(", ")
346
+ ...E.parentIds.length === 0 ? [] : [{
347
+ label: y.parents,
348
+ value: E.parentIds.map((e) => D.get(e)?.label ?? e).join(", ")
343
349
  }],
344
- ...j.source === void 0 ? [] : [{
345
- label: b.source,
346
- value: j.source
350
+ ...E.source === void 0 ? [] : [{
351
+ label: y.source,
352
+ value: E.source
347
353
  }]
348
354
  ];
349
- return /* @__PURE__ */ T(s, { children: [/* @__PURE__ */ w(h, {
355
+ return /* @__PURE__ */ I(c, { children: [/* @__PURE__ */ F(g, {
350
356
  ...f,
351
- actions: N,
352
- nodes: A.relationNodes,
353
- edges: A.relationEdges,
354
- groups: A.relationGroups.length > 0 ? A.relationGroups : void 0,
355
- width: A.width,
356
- height: A.height,
357
- selected: O,
358
- onSelectedChange: k
359
- }), j === void 0 ? null : /* @__PURE__ */ w(ee, {
360
- node: j,
361
- labels: b,
362
- detailItems: P
357
+ actions: O,
358
+ nodes: T.relationNodes,
359
+ edges: T.relationEdges,
360
+ groups: T.relationGroups.length > 0 ? T.relationGroups : void 0,
361
+ width: T.width,
362
+ height: T.height,
363
+ selected: w,
364
+ onSelectedChange: ee
365
+ }), E === void 0 ? null : /* @__PURE__ */ F(Te, {
366
+ node: E,
367
+ labels: y,
368
+ detailItems: k
363
369
  })] });
364
370
  }
365
371
  // packages/kits/src/research/milestone-path.tsx
366
- var Z = {
372
+ var De = {
367
373
  baseline: "series5",
368
374
  result: "series1",
369
375
  breakthrough: "positive",
370
376
  counterexample: "negative",
371
377
  decision: "series3"
372
- }, ne = {
378
+ }, Oe = {
373
379
  baseline: "neutral",
374
380
  result: "neutral",
375
381
  breakthrough: "positive",
376
382
  counterexample: "negative",
377
383
  decision: "warning"
378
- }, Q = {
384
+ }, ke = {
379
385
  metric: "Score",
380
386
  delta: "Change",
381
387
  limitation: "Limitation",
@@ -389,16 +395,16 @@ var Z = {
389
395
  decision: "Decision"
390
396
  }
391
397
  };
392
- function re({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: u, selected: d, onSelectedChange: p, labels: m, ...h }) {
393
- let v = {
394
- ...Q,
398
+ function Ae({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: a, selected: d, onSelectedChange: f, labels: m, ...h }) {
399
+ let g = {
400
+ ...ke,
395
401
  ...m,
396
402
  kinds: {
397
- ...Q.kinds,
403
+ ...ke.kinds,
398
404
  ...m?.kinds
399
405
  }
400
406
  };
401
- if (h.status === "loading") return /* @__PURE__ */ w(g, {
407
+ if (h.status === "loading") return /* @__PURE__ */ F(_, {
402
408
  ...h,
403
409
  nodes: [],
404
410
  direction: "right",
@@ -406,16 +412,16 @@ function re({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: u, sele
406
412
  valueLabel: n,
407
413
  valueFormat: r
408
414
  });
409
- if (t.length === 0) return /* @__PURE__ */ w(_, {
415
+ if (t.length === 0) return /* @__PURE__ */ F(v, {
410
416
  title: h.title,
411
- children: v.empty
417
+ children: g.empty
412
418
  });
413
- if (new Set(t.map((e) => e.id)).size !== t.length) return /* @__PURE__ */ w(l, {
419
+ if (new Set(t.map((e) => e.id)).size !== t.length) return /* @__PURE__ */ F(u, {
414
420
  tone: "negative",
415
421
  role: "alert",
416
422
  children: "Milestones must have unique identifiers."
417
423
  });
418
- if (t.filter((e) => e.parentId === null).length !== 1) return /* @__PURE__ */ w(l, {
424
+ if (t.filter((e) => e.parentId === null).length !== 1) return /* @__PURE__ */ F(u, {
419
425
  tone: "negative",
420
426
  role: "alert",
421
427
  children: "MilestonePath requires exactly one root milestone (parentId: null)."
@@ -424,15 +430,15 @@ function re({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: u, sele
424
430
  id: e.id,
425
431
  parentId: e.parentId,
426
432
  label: e.label,
427
- detail: e.wave === void 0 ? v.kinds[e.kind] : `${e.wave} · ${v.kinds[e.kind]}`,
433
+ detail: e.wave === void 0 ? g.kinds[e.kind] : `${e.wave} · ${g.kinds[e.kind]}`,
428
434
  value: e.metric ?? null,
429
- tone: Z[e.kind]
435
+ tone: De[e.kind]
430
436
  })), b = Array.from(new Set(t.map((e) => e.kind))).map((e) => ({
431
437
  id: e,
432
- label: v.kinds[e],
433
- tone: Z[e]
438
+ label: g.kinds[e],
439
+ tone: De[e]
434
440
  })), x = t.find((e) => e.id === d) ?? null;
435
- return /* @__PURE__ */ T(s, { children: [/* @__PURE__ */ w(g, {
441
+ return /* @__PURE__ */ I(c, { children: [/* @__PURE__ */ F(_, {
436
442
  ...h,
437
443
  nodes: y,
438
444
  direction: "right",
@@ -441,28 +447,28 @@ function re({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: u, sele
441
447
  valueFormat: r,
442
448
  toneLegend: b,
443
449
  selected: d,
444
- onSelectedChange: p
445
- }), x !== null && /* @__PURE__ */ T(s, {
450
+ onSelectedChange: f
451
+ }), x !== null && /* @__PURE__ */ I(c, {
446
452
  isCompact: !0,
447
453
  children: [
448
- /* @__PURE__ */ w(o, {}),
449
- /* @__PURE__ */ T(c, {
454
+ /* @__PURE__ */ F(s, {}),
455
+ /* @__PURE__ */ I(l, {
450
456
  shouldSpaceBetween: !0,
451
- children: [/* @__PURE__ */ T(c, { children: [x.wave !== void 0 && /* @__PURE__ */ w(f, {
457
+ children: [/* @__PURE__ */ I(l, { children: [x.wave !== void 0 && /* @__PURE__ */ F(p, {
452
458
  tone: "neutral",
453
459
  children: x.wave
454
- }), /* @__PURE__ */ w(a, { children: /* @__PURE__ */ w("strong", { children: x.label }) })] }), /* @__PURE__ */ w(f, {
455
- tone: ne[x.kind],
456
- children: v.kinds[x.kind]
460
+ }), /* @__PURE__ */ F(o, { children: /* @__PURE__ */ F("strong", { children: x.label }) })] }), /* @__PURE__ */ F(p, {
461
+ tone: Oe[x.kind],
462
+ children: g.kinds[x.kind]
457
463
  })]
458
464
  }),
459
- /* @__PURE__ */ w(a, {
465
+ /* @__PURE__ */ F(o, {
460
466
  tone: "muted",
461
467
  children: x.claim
462
468
  }),
463
- /* @__PURE__ */ w(i, { items: [
469
+ /* @__PURE__ */ F(i, { items: [
464
470
  ...x.metric === void 0 ? [] : [{
465
- label: v.metric,
471
+ label: g.metric,
466
472
  value: e({
467
473
  value: x.metric,
468
474
  locale: h.locale,
@@ -470,19 +476,19 @@ function re({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: u, sele
470
476
  })
471
477
  }],
472
478
  ...x.delta === void 0 ? [] : [{
473
- label: v.delta,
479
+ label: g.delta,
474
480
  value: e({
475
481
  value: x.delta,
476
482
  locale: h.locale,
477
- format: u ?? r
483
+ format: a ?? r
478
484
  })
479
485
  }],
480
486
  ...x.limitation === void 0 ? [] : [{
481
- label: v.limitation,
487
+ label: g.limitation,
482
488
  value: x.limitation
483
489
  }],
484
490
  ...x.source === void 0 ? [] : [{
485
- label: v.source,
491
+ label: g.source,
486
492
  value: x.source
487
493
  }]
488
494
  ] })
@@ -490,7 +496,7 @@ function re({ milestones: t, valueLabel: n, valueFormat: r, deltaFormat: u, sele
490
496
  })] });
491
497
  }
492
498
  // packages/kits/src/research/specimen-diff.tsx
493
- var ie = {
499
+ var je = {
494
500
  breakdownTitle: "Paired outcome flips",
495
501
  all: "All",
496
502
  gained: "Gained",
@@ -503,27 +509,27 @@ var ie = {
503
509
  candidate: "Candidate",
504
510
  outcome: "Outcome",
505
511
  empty: "No paired specimens available for these two runs."
506
- }, ae = {
512
+ }, Me = {
507
513
  gained: "positive",
508
514
  regressed: "negative",
509
515
  both_pass: "neutral",
510
516
  both_fail: "neutral"
511
- }, oe = /* @__PURE__ */ new Set([
517
+ }, Ne = /* @__PURE__ */ new Set([
512
518
  "gained",
513
519
  "regressed",
514
520
  "both_pass",
515
521
  "both_fail"
516
522
  ]);
517
- function se(e) {
518
- return e !== null && oe.has(e);
523
+ function Pe(e) {
524
+ return e !== null && Ne.has(e);
519
525
  }
520
- function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterChange: c, onSelectRow: l, labels: u, ...p }) {
526
+ function Fe({ rows: e, baselineLabel: r, candidateLabel: i, filter: a, onFilterChange: s, onSelectRow: l, labels: u, ...d }) {
521
527
  let m = {
522
- ...ie,
528
+ ...je,
523
529
  ...u
524
530
  };
525
- if (e.length === 0) return /* @__PURE__ */ w(_, {
526
- title: p.title,
531
+ if (e.length === 0) return /* @__PURE__ */ F(v, {
532
+ title: d.title,
527
533
  children: m.empty
528
534
  });
529
535
  let h = {
@@ -533,17 +539,17 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
533
539
  both_fail: 0
534
540
  };
535
541
  for (let t of e) h[t.outcome] += 1;
536
- let g = o === "all" ? e : e.filter((e) => e.outcome === o), v = {
542
+ let g = a === "all" ? e : e.filter((e) => e.outcome === a), _ = {
537
543
  gained: m.gained,
538
544
  regressed: m.regressed,
539
545
  both_pass: m.bothPass,
540
546
  both_fail: m.bothFail
541
- }, S = [
547
+ }, y = [
542
548
  {
543
549
  id: "specimen",
544
550
  label: m.specimen,
545
551
  role: "primary",
546
- cell: (e) => /* @__PURE__ */ w(t, {
552
+ cell: (e) => /* @__PURE__ */ F(t, {
547
553
  secondary: e.family,
548
554
  children: e.prompt
549
555
  })
@@ -552,16 +558,16 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
552
558
  id: "expected",
553
559
  label: m.expected,
554
560
  role: "text",
555
- cell: (e) => /* @__PURE__ */ w(d, { children: e.expected })
561
+ cell: (e) => /* @__PURE__ */ F(f, { children: e.expected })
556
562
  },
557
563
  {
558
564
  id: "baseline",
559
565
  label: r.trim() === "" ? m.baseline : r,
560
566
  role: "text",
561
567
  isSecondary: !0,
562
- cell: (e) => /* @__PURE__ */ w(a, {
568
+ cell: (e) => /* @__PURE__ */ F(o, {
563
569
  variant: "mono",
564
- children: /* @__PURE__ */ w(x, {
570
+ children: /* @__PURE__ */ F(w, {
565
571
  text: e.baselineOutput,
566
572
  query: e.expected,
567
573
  tone: "accent"
@@ -572,9 +578,9 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
572
578
  id: "candidate",
573
579
  label: i.trim() === "" ? m.candidate : i,
574
580
  role: "text",
575
- cell: (e) => /* @__PURE__ */ w(a, {
581
+ cell: (e) => /* @__PURE__ */ F(o, {
576
582
  variant: "mono",
577
- children: /* @__PURE__ */ w(x, {
583
+ children: /* @__PURE__ */ F(w, {
578
584
  text: e.candidateOutput,
579
585
  query: e.expected,
580
586
  tone: "accent"
@@ -585,21 +591,21 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
585
591
  id: "outcome",
586
592
  label: m.outcome,
587
593
  role: "status",
588
- cell: (e) => /* @__PURE__ */ w(f, {
589
- tone: ae[e.outcome],
590
- children: v[e.outcome]
594
+ cell: (e) => /* @__PURE__ */ F(p, {
595
+ tone: Me[e.outcome],
596
+ children: _[e.outcome]
591
597
  })
592
598
  }
593
599
  ];
594
- return /* @__PURE__ */ T(s, {
600
+ return /* @__PURE__ */ I(c, {
595
601
  isCompact: !0,
596
602
  children: [
597
- /* @__PURE__ */ w(b, {
603
+ /* @__PURE__ */ F(C, {
598
604
  title: m.breakdownTitle,
599
- description: p.description,
600
- locale: p.locale,
601
- status: p.status,
602
- source: p.source,
605
+ description: d.description,
606
+ locale: d.locale,
607
+ status: d.status,
608
+ source: d.source,
603
609
  total: e.length,
604
610
  valueFormat: { maximumFractionDigits: 0 },
605
611
  items: [
@@ -628,19 +634,19 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
628
634
  tone: "series5"
629
635
  }
630
636
  ],
631
- selected: o === "all" ? null : o,
637
+ selected: a === "all" ? null : a,
632
638
  onSelectedChange: (e) => {
633
- se(e) ? c(e === o ? "all" : e) : c("all");
639
+ Pe(e) ? s(e === a ? "all" : e) : s("all");
634
640
  }
635
641
  }),
636
- /* @__PURE__ */ T(y.Root, {
642
+ /* @__PURE__ */ I(S.Root, {
637
643
  "aria-label": m.outcome,
638
- value: o,
644
+ value: a,
639
645
  onValueChange: (e) => {
640
- c(e);
646
+ s(e);
641
647
  },
642
648
  children: [
643
- /* @__PURE__ */ T(y.Item, {
649
+ /* @__PURE__ */ I(S.Item, {
644
650
  value: "all",
645
651
  children: [
646
652
  m.all,
@@ -649,7 +655,7 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
649
655
  ")"
650
656
  ]
651
657
  }),
652
- /* @__PURE__ */ T(y.Item, {
658
+ /* @__PURE__ */ I(S.Item, {
653
659
  value: "gained",
654
660
  children: [
655
661
  m.gained,
@@ -658,7 +664,7 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
658
664
  ")"
659
665
  ]
660
666
  }),
661
- /* @__PURE__ */ T(y.Item, {
667
+ /* @__PURE__ */ I(S.Item, {
662
668
  value: "regressed",
663
669
  children: [
664
670
  m.regressed,
@@ -667,7 +673,7 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
667
673
  ")"
668
674
  ]
669
675
  }),
670
- /* @__PURE__ */ T(y.Item, {
676
+ /* @__PURE__ */ I(S.Item, {
671
677
  value: "both_pass",
672
678
  children: [
673
679
  m.bothPass,
@@ -676,7 +682,7 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
676
682
  ")"
677
683
  ]
678
684
  }),
679
- /* @__PURE__ */ T(y.Item, {
685
+ /* @__PURE__ */ I(S.Item, {
680
686
  value: "both_fail",
681
687
  children: [
682
688
  m.bothFail,
@@ -687,10 +693,10 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
687
693
  })
688
694
  ]
689
695
  }),
690
- /* @__PURE__ */ w(n, {
691
- caption: p.title,
696
+ /* @__PURE__ */ F(n, {
697
+ caption: d.title,
692
698
  hideCaption: !0,
693
- columns: S,
699
+ columns: y,
694
700
  rows: g,
695
701
  getRowId: (e) => e.id,
696
702
  ...l !== void 0 && { rowAction: {
@@ -713,7 +719,7 @@ function ce({ rows: e, baselineLabel: r, candidateLabel: i, filter: o, onFilterC
713
719
  });
714
720
  }
715
721
  // packages/kits/src/research/work-heartbeat.tsx
716
- var $ = {
722
+ var Ie = {
717
723
  title: "Active work reports",
718
724
  empty: "No active or recent work reports.",
719
725
  nextCheckpoint: "Next checkpoint",
@@ -724,54 +730,54 @@ var $ = {
724
730
  overdue: "Update overdue",
725
731
  stopped: "Stopped"
726
732
  }
727
- }, le = {
733
+ }, Le = {
728
734
  running: "positive",
729
735
  completed: "neutral",
730
736
  blocked: "negative",
731
737
  overdue: "warning",
732
738
  stopped: "neutral"
733
739
  };
734
- function ue(e) {
740
+ function Re(e) {
735
741
  return e === void 0 ? null : Number.isFinite(e.completed) && Number.isFinite(e.total) && e.total > 0 ? e : null;
736
742
  }
737
- function de({ reports: t, locale: n, labels: i }) {
738
- let o = {
739
- ...$,
743
+ function ze({ reports: t, locale: n, labels: i }) {
744
+ let a = {
745
+ ...Ie,
740
746
  ...i,
741
747
  states: {
742
- ...$.states,
748
+ ...Ie.states,
743
749
  ...i?.states
744
750
  }
745
751
  };
746
- return t.length === 0 ? /* @__PURE__ */ w("div", {
752
+ return t.length === 0 ? /* @__PURE__ */ F("div", {
747
753
  className: "x1qokhjc",
748
- children: /* @__PURE__ */ w(a, {
754
+ children: /* @__PURE__ */ F(o, {
749
755
  variant: "caption",
750
756
  tone: "muted",
751
- children: o.empty
757
+ children: a.empty
752
758
  })
753
- }) : /* @__PURE__ */ w("ul", {
759
+ }) : /* @__PURE__ */ F("ul", {
754
760
  className: "xe8uvvx x1ghz6dp x1717udv x178xt8z x13fuv20 xhjagg4",
755
761
  children: t.map((t) => {
756
- let i = ue(t.progress), u = i === null ? null : Math.max(0, Math.min(100, i.completed / i.total * 100)), p = t.nextCheckpoint !== void 0 || t.executionRef !== void 0;
757
- return /* @__PURE__ */ T("li", {
762
+ let i = Re(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;
763
+ return /* @__PURE__ */ I("li", {
758
764
  className: "x78zum5 xdt5ytf x1hnptsi x1qokhjc xso031l x1q0q8m5 x1qndepd",
759
765
  children: [
760
- /* @__PURE__ */ T(c, {
766
+ /* @__PURE__ */ I(l, {
761
767
  shouldSpaceBetween: !0,
762
- children: [/* @__PURE__ */ w(a, { children: /* @__PURE__ */ w("strong", { children: t.title }) }), /* @__PURE__ */ T(c, { children: [/* @__PURE__ */ w(l, {
763
- tone: le[t.state],
764
- children: o.states[t.state]
765
- }), /* @__PURE__ */ w(r, {
768
+ children: [/* @__PURE__ */ F(o, { children: /* @__PURE__ */ F("strong", { children: t.title }) }), /* @__PURE__ */ I(l, { children: [/* @__PURE__ */ F(u, {
769
+ tone: Le[t.state],
770
+ children: a.states[t.state]
771
+ }), /* @__PURE__ */ F(r, {
766
772
  dateTime: t.observedAt,
767
773
  label: t.observedLabel
768
774
  })] })]
769
775
  }),
770
- i !== null && u !== null && /* @__PURE__ */ T(s, {
776
+ i !== null && s !== null && /* @__PURE__ */ I(c, {
771
777
  isCompact: !0,
772
- children: [/* @__PURE__ */ T(c, {
778
+ children: [/* @__PURE__ */ I(l, {
773
779
  shouldSpaceBetween: !0,
774
- children: [/* @__PURE__ */ T(a, {
780
+ children: [/* @__PURE__ */ I(o, {
775
781
  variant: "caption",
776
782
  tone: "muted",
777
783
  children: [
@@ -790,10 +796,10 @@ function de({ reports: t, locale: n, labels: i }) {
790
796
  " ",
791
797
  i.unit
792
798
  ]
793
- }), /* @__PURE__ */ w(f, {
799
+ }), /* @__PURE__ */ F(p, {
794
800
  tone: "neutral",
795
801
  children: e({
796
- value: u / 100,
802
+ value: s / 100,
797
803
  locale: n,
798
804
  format: {
799
805
  style: "percent",
@@ -801,12 +807,12 @@ function de({ reports: t, locale: n, labels: i }) {
801
807
  }
802
808
  })
803
809
  })]
804
- }), /* @__PURE__ */ w(v, {
810
+ }), /* @__PURE__ */ F(y, {
805
811
  label: t.title,
806
812
  value: i.completed,
807
813
  max: i.total,
808
814
  valueLabel: e({
809
- value: u / 100,
815
+ value: s / 100,
810
816
  locale: n,
811
817
  format: {
812
818
  style: "percent",
@@ -815,21 +821,872 @@ function de({ reports: t, locale: n, labels: i }) {
815
821
  })
816
822
  })]
817
823
  }),
818
- p && /* @__PURE__ */ T(c, {
824
+ d && /* @__PURE__ */ I(l, {
819
825
  shouldSpaceBetween: !0,
820
- children: [t.nextCheckpoint === void 0 ? /* @__PURE__ */ w("span", {}) : /* @__PURE__ */ T(a, {
826
+ children: [t.nextCheckpoint === void 0 ? /* @__PURE__ */ F("span", {}) : /* @__PURE__ */ I(o, {
821
827
  variant: "caption",
822
828
  tone: "muted",
823
829
  children: [
824
- o.nextCheckpoint,
830
+ a.nextCheckpoint,
825
831
  ": ",
826
832
  t.nextCheckpoint
827
833
  ]
828
- }), t.executionRef !== void 0 && /* @__PURE__ */ w(d, { children: t.executionRef })]
834
+ }), t.executionRef !== void 0 && /* @__PURE__ */ F(f, { children: t.executionRef })]
829
835
  })
830
836
  ]
831
837
  }, t.id);
832
838
  })
833
839
  });
834
840
  }
835
- export { O as FindingCard, te as LineageGraph, re as MilestonePath, ce as SpecimenDiff, de as WorkHeartbeat };
841
+ // packages/kits/src/research/motion-error.tsx
842
+ function U(e) {
843
+ throw Error(e);
844
+ }
845
+ function Be({ title: e, locale: t, first: n, last: r }) {
846
+ return /* @__PURE__ */ F(D, {
847
+ title: e,
848
+ locale: t,
849
+ message: `Choose an integer tick from ${n} through ${r}.`
850
+ });
851
+ }
852
+ var W = [
853
+ 1,
854
+ 2,
855
+ 4,
856
+ 8
857
+ ], Ve = {
858
+ selected: null,
859
+ zoom: 1,
860
+ isFollowing: !1,
861
+ showTrails: !0,
862
+ showRegions: !0
863
+ };
864
+ function G(e, t) {
865
+ let n = t.selected, r = (n == null ? void 0 : e.arms[n.arm])?.tracks.some((e) => e.id === n?.id) === !0 ? n ?? null : null, i = W.find((e) => e === t.zoom) ?? 1, a = e.arms.some((e) => e.metrics?.some((e) => e.label === t.metric) === !0);
866
+ return {
867
+ selected: r,
868
+ zoom: i,
869
+ isFollowing: i > 1 && r !== null && t.isFollowing === !0,
870
+ showTrails: t.showTrails !== !1,
871
+ showRegions: t.showRegions !== !1,
872
+ ...a && t.metric !== void 0 ? { metric: t.metric } : {}
873
+ };
874
+ }
875
+ function He(e, t) {
876
+ return t.metric ?? e.arms.find((e) => (e.metrics?.length ?? 0) > 0)?.metrics?.[0]?.label;
877
+ }
878
+ var Ue = 2;
879
+ function We([e, t], n, r) {
880
+ let i = (t - e) / r, a = Math.max(e, Math.min(t - i, n - i / Ue));
881
+ return [a, a + i];
882
+ }
883
+ function Ge(e, t, n) {
884
+ if (t.zoom === 1) return e;
885
+ let [r, i, a, o] = e, s = t.isFollowing ? n : void 0, [c, l] = We([r, a], s?.x ?? (r + a) / Ue, t.zoom), [u, d] = We([i, o], s?.y ?? (i + o) / Ue, t.zoom);
886
+ return [
887
+ c,
888
+ u,
889
+ l,
890
+ d
891
+ ];
892
+ }
893
+ // packages/kits/src/research/motion-clip.ts
894
+ var K = {
895
+ text: 4096,
896
+ span: 1e-9,
897
+ rate: 1e9,
898
+ samples: 1e6,
899
+ tracks: 4096,
900
+ regions: 64,
901
+ metrics: 64,
902
+ moments: 512,
903
+ arms: 8
904
+ }, q = {
905
+ bounds: 4,
906
+ point: 3,
907
+ pair: 2
908
+ };
909
+ function J(e, t) {
910
+ e || U(t);
911
+ }
912
+ function Y(e) {
913
+ return typeof e != "object" || !e || Array.isArray(e) ? U("Expected a motion record.") : Object.fromEntries(Object.entries(e));
914
+ }
915
+ function X(e, t, n = 0) {
916
+ return !Array.isArray(e) || e.length < n || e.length > t ? U(`Expected between ${n} and ${t} motion items.`) : e;
917
+ }
918
+ function Z(e) {
919
+ return typeof e != "string" || e.length > K.text || e.trim().length === 0 ? U("Expected a nonempty motion label or ID.") : e;
920
+ }
921
+ function Q(e) {
922
+ return typeof e != "number" || !Number.isFinite(e) || Math.abs(e) > 2 ** 53 - 1 ? U("Expected a finite motion value in range.") : e;
923
+ }
924
+ function Ke(e) {
925
+ let [t, n, r, i] = X(e, q.bounds, q.bounds), a = [
926
+ Q(t),
927
+ Q(n),
928
+ Q(r),
929
+ Q(i)
930
+ ];
931
+ return J(a[2] - a[0] >= K.span && a[3] - a[1] >= K.span, "Motion bounds must increase along both axes."), a;
932
+ }
933
+ function qe(e) {
934
+ let t = Q(e);
935
+ return J(Number.isSafeInteger(t), "Motion ticks must be integers."), t;
936
+ }
937
+ function Je(e) {
938
+ let t = Y(e);
939
+ J(t.version === 1, "Unsupported motion clip version.");
940
+ let n = qe(t.first), r = qe(t.last);
941
+ J(r >= n && Number.isSafeInteger(r - n), "Invalid motion tick range.");
942
+ let i = Q(t.hz), a = Q(t.speed);
943
+ J(i > 0 && a > 0 && i * a <= K.rate, "Expected a positive motion tick rate and speed in range.");
944
+ function o(e) {
945
+ let t = qe(e);
946
+ return J(t >= n && t <= r, "Tick outside the motion window."), t;
947
+ }
948
+ let s = { remaining: K.samples };
949
+ function c(e, t, n) {
950
+ let [r, i] = typeof t == "number" ? [t, t] : t, a = X(e, s.remaining, 1);
951
+ s.remaining -= a.length;
952
+ let c = -Infinity;
953
+ return a.map((e) => {
954
+ let t = X(e, i, r), a = o(t[0]);
955
+ return J(a > c, "Sample ticks must increase within each series."), c = a, n(a, t);
956
+ });
957
+ }
958
+ function l(e) {
959
+ let t = Y(e), r = X(t.tracks, K.tracks).map((e) => {
960
+ let t = Y(e), r = c(t.points, q.point, (e, t) => [
961
+ e,
962
+ Q(t[1]),
963
+ Q(t[2])
964
+ ]), i = o(t.end);
965
+ J(i >= (r.at(-1)?.[0] ?? n), "Track ends before its last sample.");
966
+ let a = t.notes === void 0 ? [] : c(t.notes, [q.pair, q.point], (e, t) => {
967
+ let n = Z(t[1]);
968
+ if (t.length === q.pair) return [e, n];
969
+ let r = X(t[2], q.pair, q.pair);
970
+ return [
971
+ e,
972
+ n,
973
+ [Q(r[0]), Q(r[1])]
974
+ ];
975
+ });
976
+ return {
977
+ id: Z(t.id),
978
+ label: Z(t.label),
979
+ points: r,
980
+ end: i,
981
+ notes: a
982
+ };
983
+ }), i = r.toSorted((e, t) => e.id === t.id ? e.end - t.end : e.id > t.id ? 1 : -1);
984
+ J(i.every((e, t) => {
985
+ let r = i[t - 1];
986
+ return r === void 0 || r.id !== e.id || r.end < (e.points[0]?.[0] ?? n);
987
+ }), "Segments of the same track overlap.");
988
+ let a = X(t.regions === void 0 ? [] : t.regions, K.regions).map((e) => {
989
+ let t = Y(e);
990
+ return {
991
+ label: Z(t.label),
992
+ bounds: Ke(t.bounds)
993
+ };
994
+ }), s = X(t.metrics === void 0 ? [] : t.metrics, K.metrics).map((e) => {
995
+ let t = Y(e);
996
+ return {
997
+ label: Z(t.label),
998
+ values: c(t.values, q.pair, (e, t) => [e, Q(t[1])])
999
+ };
1000
+ });
1001
+ return {
1002
+ label: Z(t.label),
1003
+ tracks: r,
1004
+ regions: a,
1005
+ metrics: s
1006
+ };
1007
+ }
1008
+ let u = X(t.arms, K.arms, 1).map(l);
1009
+ function d(e) {
1010
+ let t = Y(e), n = W.find((e) => e === t.zoom);
1011
+ J(t.zoom === void 0 || n !== void 0, "Moment zoom must be a listed level.");
1012
+ let r = t.selected, i = r == null ? null : Y(r), a = t.metric;
1013
+ function o(e, n) {
1014
+ let r = t[e];
1015
+ return r === void 0 ? n : typeof r == "boolean" ? r : U("Moment layer settings must be true or false.");
1016
+ }
1017
+ let s = G({ arms: u }, {
1018
+ selected: i === null ? null : {
1019
+ arm: qe(i.arm),
1020
+ id: Z(i.id)
1021
+ },
1022
+ zoom: n ?? 1,
1023
+ isFollowing: o("isFollowing", !1),
1024
+ showTrails: o("showTrails", !0),
1025
+ showRegions: o("showRegions", !0),
1026
+ ...a === void 0 ? {} : { metric: Z(a) }
1027
+ });
1028
+ return J(i === null || s.selected !== null, "Moment selection must name an existing track and arm."), J(t.isFollowing !== !0 || s.isFollowing, "Following a moment needs an actor and a zoomed camera."), J(a === void 0 || s.metric === a, "Moment metric must name a recorded measure."), s;
1029
+ }
1030
+ let f = X(t.moments, K.moments).map((e) => {
1031
+ let t = Y(e), n = t.detail;
1032
+ return {
1033
+ id: Z(t.id),
1034
+ label: Z(t.label),
1035
+ tick: o(t.tick),
1036
+ ...t.view === void 0 ? {} : { view: d(t.view) },
1037
+ ...n === void 0 ? {} : { detail: Z(n) }
1038
+ };
1039
+ });
1040
+ return J(new Set(f.map((e) => e.id)).size === f.length, "Motion moment IDs must be unique."), {
1041
+ version: 1,
1042
+ title: Z(t.title),
1043
+ first: n,
1044
+ last: r,
1045
+ hz: i,
1046
+ speed: a,
1047
+ bounds: Ke(t.bounds),
1048
+ arms: u,
1049
+ moments: f,
1050
+ source: t.source
1051
+ };
1052
+ }
1053
+ // packages/kits/src/research/motion-frame.ts
1054
+ var Ye = 2, Xe = 12;
1055
+ function Ze(e, t) {
1056
+ let n = 0, r = e.length;
1057
+ for (; n < r;) {
1058
+ let i = Math.floor((n + r) / Ye);
1059
+ (e[i]?.[0] ?? Infinity) <= t ? n = i + 1 : r = i;
1060
+ }
1061
+ return n - 1;
1062
+ }
1063
+ function Qe(e, t) {
1064
+ let n = Ze(e, t), r = e[n];
1065
+ if (r === void 0) return null;
1066
+ let i = e[n + 1] ?? r, a = i === r ? 0 : (t - r[0]) / (i[0] - r[0]);
1067
+ return {
1068
+ x: r[1] + a * (i[1] - r[1]),
1069
+ y: r[2] + a * (i[2] - r[2]),
1070
+ sampled: r[0] === t
1071
+ };
1072
+ }
1073
+ function $e(e, t, n) {
1074
+ return e.flatMap(({ id: e, label: r, points: i, end: a, notes: o = [] }) => {
1075
+ if (t > a) return [];
1076
+ let s = Qe(i, t);
1077
+ if (s === null) return [];
1078
+ let c = Math.max(i[0]?.[0] ?? t, t - n), l = Array.from({ length: 13 }, (e, n) => Qe(i, c + (t - c) * n / Xe)), u = l.flatMap((e, t) => {
1079
+ let n = l[t - 1];
1080
+ return e === null || n?.x === e.x && n.y === e.y ? [] : [[e.x, e.y]];
1081
+ });
1082
+ return [{
1083
+ id: e,
1084
+ label: r,
1085
+ ...s,
1086
+ trail: u,
1087
+ note: o[Ze(o, t)]
1088
+ }];
1089
+ });
1090
+ }
1091
+ function et(e, t) {
1092
+ return !Number.isSafeInteger(t) || t < e.first || t > e.last ? U("Choose an integer tick inside the motion window.") : e.arms.map((n) => ({
1093
+ label: n.label,
1094
+ regions: n.regions ?? [],
1095
+ actors: $e(n.tracks, t, e.hz),
1096
+ metrics: (n.metrics ?? []).map(({ label: e, values: n }) => ({
1097
+ label: e,
1098
+ value: n[Ze(n, t)]?.[1] ?? null
1099
+ }))
1100
+ }));
1101
+ }
1102
+ // packages/kits/src/research/motion-scene.tsx
1103
+ var tt = {
1104
+ tick: "Tick",
1105
+ metric: "Metric history",
1106
+ zoom: "Zoom",
1107
+ follow: "Follow actor",
1108
+ trails: "Trails",
1109
+ regions: "Regions",
1110
+ start: "Start",
1111
+ moment: "Jump to moment",
1112
+ actor: "Inspect actor",
1113
+ sampled: "Recorded",
1114
+ interpolated: "Estimated",
1115
+ absent: "No position recorded"
1116
+ };
1117
+ function nt({ frame: e, view: t, onSelect: n, arm: r, isCompact: i, index: a, bounds: s, isInspecting: u, format: d, labels: f, metric: p }) {
1118
+ let m = t.selected?.arm === a ? t.selected.id : null, h = e.actors.find((e) => e.id === m), g = r.tracks.length === 1 ? r.tracks[0]?.points[0] : void 0, _ = h?.note === void 0 ? null : /* @__PURE__ */ I(o, {
1119
+ variant: "caption",
1120
+ children: [
1121
+ d.format(h.note[0]),
1122
+ " · ",
1123
+ h.note[1]
1124
+ ]
1125
+ }), v = u ? e.metrics.filter((e) => e.label === p) : e.metrics.slice(0, 2), y = u && r.tracks.length > 0, b = u ? r.label : [
1126
+ e.label,
1127
+ ...e.regions.map((e) => e.label),
1128
+ ...e.actors.map((e) => `${e.label} (${d.format(e.x)}, ${d.format(e.y)})`)
1129
+ ].join(", ");
1130
+ return /* @__PURE__ */ I(c, {
1131
+ isCompact: !0,
1132
+ children: [
1133
+ /* @__PURE__ */ I(l, {
1134
+ shouldSpaceBetween: !0,
1135
+ children: [/* @__PURE__ */ I(l, { children: [/* @__PURE__ */ F(O, { tone: k(a) }), /* @__PURE__ */ F(o, { children: /* @__PURE__ */ F("strong", { children: e.label }) })] }), v.map(({ label: e, value: t }) => /* @__PURE__ */ I(o, { children: [
1136
+ e,
1137
+ " ",
1138
+ /* @__PURE__ */ F("strong", { children: t === null ? "—" : d.format(t) })
1139
+ ] }, e))]
1140
+ }),
1141
+ /* @__PURE__ */ F(A, {
1142
+ destination: h?.note?.[2],
1143
+ isCompact: i,
1144
+ origin: g === void 0 ? void 0 : {
1145
+ x: g[1],
1146
+ y: g[2],
1147
+ label: f.start
1148
+ },
1149
+ locale: d.resolvedOptions().locale,
1150
+ isDense: r.tracks.length > 6,
1151
+ bounds: s,
1152
+ label: b,
1153
+ regions: t.showRegions ? e.regions : [],
1154
+ showTrails: t.showTrails,
1155
+ onSelectedChange: u ? n : void 0,
1156
+ points: e.actors,
1157
+ tone: k(a),
1158
+ shape: a % 2 == 0 ? "circle" : "diamond",
1159
+ selected: m
1160
+ }),
1161
+ y && /* @__PURE__ */ I(l, { children: [
1162
+ /* @__PURE__ */ F(x, {
1163
+ label: f.actor,
1164
+ placeholder: f.actor,
1165
+ items: Array.from(new Map(r.tracks.map((e) => [e.id, e.label])), ([e, t]) => ({
1166
+ value: e,
1167
+ label: `${t} · ${e}`
1168
+ })),
1169
+ value: m,
1170
+ onValueChange: n
1171
+ }),
1172
+ m !== null && /* @__PURE__ */ F(o, {
1173
+ variant: "caption",
1174
+ children: h === void 0 ? f.absent : `${h.sampled ? f.sampled : f.interpolated} · ${d.format(h.x)}, ${d.format(h.y)}`
1175
+ }),
1176
+ _
1177
+ ] })
1178
+ ]
1179
+ });
1180
+ }
1181
+ function rt({ clip: e, view: t, onViewChange: n, tick: r, isInspecting: i = !1, isGuided: a = !1, locale: s = "en-US", labels: c }) {
1182
+ let l = {
1183
+ ...tt,
1184
+ ...c
1185
+ }, u = new Intl.NumberFormat(s, { maximumFractionDigits: 6 }), [d, f] = N(Ve), p = j(() => G(e, t ?? d), [
1186
+ e,
1187
+ t,
1188
+ d
1189
+ ]);
1190
+ if (!Number.isSafeInteger(r) || r < e.first || r > e.last) return /* @__PURE__ */ F(Be, {
1191
+ title: e.title,
1192
+ locale: s,
1193
+ first: e.first,
1194
+ last: e.last
1195
+ });
1196
+ let m = He(e, p), h = et(e, r), g = p.selected, _ = g === null ? void 0 : h[g.arm]?.actors.find((e) => e.id === g.id), v = Ge(e.bounds, p, _);
1197
+ function y(e, r) {
1198
+ let i = {
1199
+ ...p,
1200
+ selected: r === null ? null : {
1201
+ arm: e,
1202
+ id: r
1203
+ },
1204
+ isFollowing: r !== null && p.isFollowing
1205
+ };
1206
+ t === void 0 && f(i), n?.(i);
1207
+ }
1208
+ return /* @__PURE__ */ F(E, {
1209
+ title: e.title,
1210
+ locale: s,
1211
+ actions: /* @__PURE__ */ I(o, {
1212
+ variant: "caption",
1213
+ children: [
1214
+ l.tick,
1215
+ " ",
1216
+ u.format(r)
1217
+ ]
1218
+ }),
1219
+ children: /* @__PURE__ */ F("div", {
1220
+ ...{
1221
+ 0: { className: "xrvj5dj x1yqo59v x1j825kq xeuugli" },
1222
+ 1: { className: "xrvj5dj xeuugli xnby9oq x1j825kq" }
1223
+ }[!!(a && e.arms.length === 2) | 0],
1224
+ children: e.arms.map((e, t) => {
1225
+ let n = h[t];
1226
+ return n === void 0 ? null : /* @__PURE__ */ F(nt, {
1227
+ isCompact: a,
1228
+ arm: e,
1229
+ metric: m,
1230
+ index: t,
1231
+ view: p,
1232
+ onSelect: (e) => y(t, e),
1233
+ bounds: v,
1234
+ frame: n,
1235
+ isInspecting: i,
1236
+ format: u,
1237
+ labels: l
1238
+ }, e.label);
1239
+ })
1240
+ })
1241
+ });
1242
+ }
1243
+ // packages/kits/src/research/motion-inspection.tsx
1244
+ function it({ label: e, isChecked: t, onChange: n, isDisabled: r = !1 }) {
1245
+ return /* @__PURE__ */ F(re.Root, {
1246
+ disabled: r,
1247
+ children: /* @__PURE__ */ F(re.Label, { children: /* @__PURE__ */ I(l, { children: [/* @__PURE__ */ F(b.Root, {
1248
+ checked: t,
1249
+ onCheckedChange: n,
1250
+ disabled: r,
1251
+ children: /* @__PURE__ */ F(b.Indicator, {})
1252
+ }), e] }) })
1253
+ });
1254
+ }
1255
+ function at({ clip: e, view: t, onChange: n, labels: r, hasMap: i }) {
1256
+ let a = j(() => [...new Set(e.arms.flatMap((e) => (e.metrics ?? []).map((e) => e.label)))], [e]), o = t.metric ?? a[0] ?? null, s = e.arms.some((e) => (e.regions?.length ?? 0) > 0);
1257
+ return /* @__PURE__ */ I(l, { children: [a.length > 0 && /* @__PURE__ */ F(x, {
1258
+ label: r.metric,
1259
+ items: a.map((e) => ({
1260
+ value: e,
1261
+ label: e
1262
+ })),
1263
+ value: o,
1264
+ onValueChange: (e) => {
1265
+ e !== null && n({
1266
+ ...t,
1267
+ metric: e
1268
+ });
1269
+ }
1270
+ }), i && /* @__PURE__ */ I(P, { children: [
1271
+ /* @__PURE__ */ F(x, {
1272
+ label: r.zoom,
1273
+ items: W.map((e) => ({
1274
+ value: String(e),
1275
+ label: `${e}×`
1276
+ })),
1277
+ value: String(t.zoom),
1278
+ onValueChange: (e) => {
1279
+ let r = W.find((t) => String(t) === e);
1280
+ r !== void 0 && n({
1281
+ ...t,
1282
+ zoom: r,
1283
+ isFollowing: r > 1 && t.isFollowing
1284
+ });
1285
+ }
1286
+ }),
1287
+ /* @__PURE__ */ F(it, {
1288
+ label: r.trails,
1289
+ isChecked: t.showTrails,
1290
+ onChange: (e) => n({
1291
+ ...t,
1292
+ showTrails: e
1293
+ })
1294
+ }),
1295
+ s && /* @__PURE__ */ F(it, {
1296
+ label: r.regions,
1297
+ isChecked: t.showRegions,
1298
+ onChange: (e) => n({
1299
+ ...t,
1300
+ showRegions: e
1301
+ })
1302
+ }),
1303
+ /* @__PURE__ */ F(it, {
1304
+ label: r.follow,
1305
+ isChecked: t.isFollowing,
1306
+ isDisabled: t.selected === null,
1307
+ onChange: (e) => n({
1308
+ ...t,
1309
+ isFollowing: e,
1310
+ zoom: e && t.zoom === 1 ? 2 : t.zoom
1311
+ })
1312
+ })
1313
+ ] })] });
1314
+ }
1315
+ function ot({ clip: e, metric: t }) {
1316
+ let n = j(() => e.arms.flatMap((e, n) => {
1317
+ let r = e.metrics?.find((e) => e.label === t);
1318
+ return r === void 0 ? [] : [{
1319
+ id: String(n),
1320
+ tone: k(n),
1321
+ values: r.values
1322
+ }];
1323
+ }), [e, t]);
1324
+ return /* @__PURE__ */ F(te, {
1325
+ series: n,
1326
+ first: e.first,
1327
+ last: e.last
1328
+ });
1329
+ }
1330
+ // packages/kits/src/research/motion-figure.tsx
1331
+ function st({ clip: e, scene: t, speed: n, onSpeedChange: r, view: i, onViewChange: s, tick: u, onTickChange: d, isPlaying: f, onPlayingChange: p, isInspecting: m = !1, isGuided: h = !1, locale: g = "en-US", labels: _ }) {
1332
+ let v = {
1333
+ ...tt,
1334
+ ..._
1335
+ }, [y, b] = N(!1), [S, C] = N(e.speed), w = n ?? S, [E, D] = N(Ve), O = j(() => G(e, i ?? E), [
1336
+ e,
1337
+ i,
1338
+ E
1339
+ ]), k = He(e, O);
1340
+ function A(e) {
1341
+ i === void 0 && D(e), s?.(e), (e.selected?.id !== O.selected?.id || e.selected?.arm !== O.selected?.arm) && R(!1);
1342
+ }
1343
+ function te(e) {
1344
+ n === void 0 && C(e), r?.(e);
1345
+ }
1346
+ let re = f ?? y, { ref: M, isActive: P } = ne(re, !0), oe = j(() => e.moments.map(({ id: e, label: t, tick: n }) => ({
1347
+ id: e,
1348
+ label: t,
1349
+ position: n
1350
+ })), [e]), L = j(() => new Intl.NumberFormat(g), [g]);
1351
+ function R(t) {
1352
+ t && u === e.last && d(e.first), f === void 0 && b(t), p?.(t);
1353
+ }
1354
+ function z(t) {
1355
+ R(!1), d(Math.min(e.last, Math.max(e.first, t)));
1356
+ }
1357
+ function B(t) {
1358
+ z(t.tick), t.view !== void 0 && A(G(e, t.view));
1359
+ }
1360
+ let se = ae(() => R(!1));
1361
+ ie(() => {
1362
+ let e = matchMedia("(prefers-reduced-motion: reduce)");
1363
+ function t() {
1364
+ e.matches && se();
1365
+ }
1366
+ return e.addEventListener("change", t), () => e.removeEventListener("change", t);
1367
+ }, []);
1368
+ let ce = ae(() => u), V = ae((t) => {
1369
+ t !== u && d(t), t === e.last && R(!1);
1370
+ });
1371
+ ie(() => {
1372
+ if (!P) return;
1373
+ let t = performance.now(), n = ce(), r = requestAnimationFrame(i);
1374
+ function i(a) {
1375
+ let o = Math.max(0, a - t), s = Math.floor(o * e.hz * w / 1e3), c = Math.min(e.last, n + s);
1376
+ V(c), c !== e.last && (r = requestAnimationFrame(i));
1377
+ }
1378
+ return () => cancelAnimationFrame(r);
1379
+ }, [
1380
+ e.hz,
1381
+ e.last,
1382
+ P,
1383
+ w
1384
+ ]);
1385
+ let le = e.moments.find((e) => e.tick === u), H = e.moments.filter((e) => e.tick <= u).toSorted((e, t) => t.tick - e.tick)[0];
1386
+ return /* @__PURE__ */ F("div", {
1387
+ ref: M,
1388
+ children: /* @__PURE__ */ I(c, {
1389
+ isCompact: !0,
1390
+ children: [
1391
+ t ?? /* @__PURE__ */ F(rt, {
1392
+ view: O,
1393
+ onViewChange: A,
1394
+ isGuided: h,
1395
+ clip: e,
1396
+ tick: u,
1397
+ isInspecting: m,
1398
+ locale: g,
1399
+ labels: v
1400
+ }),
1401
+ m && /* @__PURE__ */ F(at, {
1402
+ hasMap: t == null,
1403
+ clip: e,
1404
+ view: O,
1405
+ onChange: A,
1406
+ labels: v
1407
+ }),
1408
+ /* @__PURE__ */ F(T, {
1409
+ backdrop: m && k !== void 0 ? /* @__PURE__ */ F(ot, {
1410
+ clip: e,
1411
+ metric: k
1412
+ }) : void 0,
1413
+ label: v.tick,
1414
+ min: e.first,
1415
+ max: e.last,
1416
+ value: u,
1417
+ markers: oe,
1418
+ onValueChange: z,
1419
+ onScrubStart: () => R(!1),
1420
+ onMarkerSelect: (t) => {
1421
+ let n = e.moments.find((e) => e.id === t.id);
1422
+ n !== void 0 && B(n);
1423
+ },
1424
+ formatValue: (e) => L.format(e)
1425
+ }),
1426
+ /* @__PURE__ */ F(ee, {
1427
+ isPlaying: re,
1428
+ onPlayingChange: R,
1429
+ speed: w,
1430
+ onSpeedChange: te,
1431
+ onStepBackward: () => z(u - 1),
1432
+ onStepForward: () => z(u + 1),
1433
+ isDisabled: e.first === e.last
1434
+ }),
1435
+ h || e.moments.length === 0 ? null : e.moments.length <= 5 ? /* @__PURE__ */ F(l, { children: e.moments.map((e) => /* @__PURE__ */ F(a, {
1436
+ variant: e === le ? "outline" : "ghost",
1437
+ onClick: () => B(e),
1438
+ children: e.label
1439
+ }, e.id)) }) : /* @__PURE__ */ F(x, {
1440
+ label: v.moment,
1441
+ placeholder: v.moment,
1442
+ items: e.moments.map(({ id: e, label: t, tick: n }) => ({
1443
+ value: e,
1444
+ label: `${L.format(n)} · ${t}`
1445
+ })),
1446
+ value: le?.id ?? null,
1447
+ onValueChange: (t) => {
1448
+ let n = e.moments.find((e) => e.id === t);
1449
+ n !== void 0 && B(n);
1450
+ }
1451
+ }),
1452
+ m && H !== void 0 && /* @__PURE__ */ I(o, {
1453
+ variant: "caption",
1454
+ children: [
1455
+ L.format(H.tick),
1456
+ " · ",
1457
+ H.label,
1458
+ H.detail === void 0 ? "" : ` · ${H.detail}`
1459
+ ]
1460
+ })
1461
+ ]
1462
+ })
1463
+ });
1464
+ }
1465
+ // packages/kits/src/research/motion-location.ts
1466
+ function ct(e, t) {
1467
+ let n = e.get(t);
1468
+ if (n === null || !/^-?\d+$/.test(n)) return;
1469
+ let r = Number(n);
1470
+ return Number.isSafeInteger(r) ? r : void 0;
1471
+ }
1472
+ function lt(e, t) {
1473
+ let n = ct(t, "arm"), r = t.get("actor")?.replace(/^~/u, "") ?? null, i = t.get("metric")?.replace(/^~/u, "") ?? null, a = W.find((e) => e === ct(t, "zoom")) ?? 1;
1474
+ return {
1475
+ tick: Math.max(e.first, Math.min(e.last, ct(t, "tick") ?? e.first)),
1476
+ isNative: t.get("footage") === "1",
1477
+ view: G(e, {
1478
+ selected: n !== void 0 && r !== null ? {
1479
+ arm: n,
1480
+ id: r
1481
+ } : null,
1482
+ zoom: a,
1483
+ isFollowing: t.get("follow") === "1",
1484
+ showTrails: t.get("trails") !== "0",
1485
+ showRegions: t.get("regions") !== "0",
1486
+ ...i === null ? {} : { metric: i }
1487
+ })
1488
+ };
1489
+ }
1490
+ function ut(e, t, n = !1) {
1491
+ let r = new URLSearchParams({ tick: String(e) });
1492
+ return t.selected !== null && (r.set("arm", String(t.selected.arm)), r.set("actor", `~${t.selected.id}`)), t.zoom !== 1 && r.set("zoom", String(t.zoom)), t.isFollowing && r.set("follow", "1"), t.showTrails || r.set("trails", "0"), t.showRegions || r.set("regions", "0"), t.metric !== void 0 && r.set("metric", `~${t.metric}`), n && r.set("footage", "1"), r;
1493
+ }
1494
+ // packages/kits/src/research/native-motion.ts
1495
+ var dt = 16, ft = 2, pt = 2, mt = 2701, ht = 64, gt = /[^a-f0-9]/u;
1496
+ function _t(e) {
1497
+ return typeof e != "string" || e.length !== ht || gt.test(e) ? U("Invalid native footage fingerprint.") : e;
1498
+ }
1499
+ function vt(e) {
1500
+ return typeof e == "number" && Number.isFinite(e) ? e : U("Expected finite native footage timing.");
1501
+ }
1502
+ function yt(e) {
1503
+ let t = vt(e);
1504
+ return Number.isSafeInteger(t) ? t : U("Expected an integer frame tick or arm.");
1505
+ }
1506
+ function bt(e, t) {
1507
+ if (typeof e != "object" || !e || Array.isArray(e)) return U("Expected a native footage mapping.");
1508
+ let n = Object.fromEntries(Object.entries(e)), { version: r, ticks: i } = n, a = _t(n.clipSha256), o = _t(n.movieSha256), s = yt(n.arm), c = yt(n.firstTick), l = yt(n.lastTick), u = vt(n.fps), d = vt(n.secondsPerTick), f = vt(n.startSeconds);
1509
+ if (r !== 1 || s < 0 || s >= t.arms.length) return U("Unknown native footage version or recording arm.");
1510
+ if (c < t.first || l > t.last || l < c) return U("Native footage lies outside the recording.");
1511
+ if (u <= 0 || f < 0 || d <= 0) return U("Invalid native footage timing.");
1512
+ if (!Array.isArray(i) || i.length === 0 || i.length > mt) return U("Invalid native footage frame count.");
1513
+ if (i[0] !== c || i.at(-1) !== l || !Number.isFinite(f + i.length / u)) return U("Invalid native footage frame range.");
1514
+ let p = c;
1515
+ return {
1516
+ version: r,
1517
+ arm: s,
1518
+ firstTick: c,
1519
+ lastTick: l,
1520
+ secondsPerTick: d,
1521
+ startSeconds: f,
1522
+ fps: u,
1523
+ ticks: i.map((e) => {
1524
+ let t = yt(e);
1525
+ return t < p || t > l ? U("Native footage ticks must be ordered.") : (p = t, t);
1526
+ }),
1527
+ clipSha256: a,
1528
+ movieSha256: o
1529
+ };
1530
+ }
1531
+ async function xt(e) {
1532
+ let t = await crypto.subtle.digest("SHA-256", await e.arrayBuffer());
1533
+ return Array.from(new Uint8Array(t), (e) => e.toString(dt).padStart(ft, "0")).join("");
1534
+ }
1535
+ async function St(e, t, n) {
1536
+ let [r, i] = await Promise.all([xt(e), xt(t)]);
1537
+ (r !== n.clipSha256 || i !== n.movieSha256) && U("Native footage does not match the recording.");
1538
+ }
1539
+ function Ct(e, t) {
1540
+ let n = 0, r = e.ticks.length;
1541
+ for (; n + 1 < r;) {
1542
+ let i = n + Math.floor((r - n) / pt);
1543
+ (e.ticks[i] ?? e.lastTick) <= t ? n = i : r = i;
1544
+ }
1545
+ return e.startSeconds + n / e.fps;
1546
+ }
1547
+ // packages/kits/src/research/native-motion-figure.tsx
1548
+ var $ = {
1549
+ minRate: .25,
1550
+ maxRate: 4,
1551
+ driftFrames: 2,
1552
+ seekTolerance: .001
1553
+ };
1554
+ function wt({ source: e, tick: t, rate: n, isPlaying: r, label: i, onError: a }) {
1555
+ let o = M(null), { ref: s, isActive: c } = ne(r, !0), [l, u] = N(!1), [d, f] = N(!0), { mapping: p } = e, m = n * p.secondsPerTick, h = m >= $.minRate && m <= $.maxRate, g = c && t < p.lastTick && d && h, _ = Ct(p, t), v = g ? $.driftFrames / p.fps : $.seekTolerance;
1556
+ return ie(() => {
1557
+ let e = o.current;
1558
+ e !== null && l && Math.abs(e.currentTime - _) > v && (e.currentTime = _);
1559
+ }, [
1560
+ _,
1561
+ v,
1562
+ l
1563
+ ]), ie(() => {
1564
+ let e = o.current;
1565
+ if (e === null || !l || !g) return;
1566
+ let t = !0;
1567
+ return e.playbackRate = m, e.play().catch(() => {
1568
+ t && f(!1);
1569
+ }), () => {
1570
+ t = !1, e.pause();
1571
+ };
1572
+ }, [
1573
+ g,
1574
+ m,
1575
+ l
1576
+ ]), /* @__PURE__ */ F("div", {
1577
+ ref: s,
1578
+ children: /* @__PURE__ */ F("video", {
1579
+ ref: o,
1580
+ src: e.src,
1581
+ muted: !0,
1582
+ playsInline: !0,
1583
+ preload: "auto",
1584
+ "aria-label": i,
1585
+ onError: a,
1586
+ onLoadedMetadata: (e) => {
1587
+ let t = Ct(p, p.lastTick);
1588
+ !Number.isFinite(e.currentTarget.duration) || t >= e.currentTarget.duration + $.seekTolerance ? a() : u(!0);
1589
+ },
1590
+ className: "x1lliihq xh8yej3 x186iv6y xcwfpss x19kjcj4"
1591
+ })
1592
+ });
1593
+ }
1594
+ function Tt({ native: e, isNative: t, onNativeChange: n, isPlaying: r, onPlayingChange: i, speed: s, onSpeedChange: u, ...d }) {
1595
+ let f = d.locale ?? "en-US", p = j(() => new Intl.NumberFormat(f), [f]), [m, h] = N(!1), [g, _] = N(!1), [v, y] = N(d.clip.speed), b = t ?? m, x = r ?? g, C = s ?? v, [w, ee] = N(null), [T, D] = N(void 0), O = e !== void 0 && "load" in e ? e : void 0, k = e !== void 0 && "src" in e ? e : w?.request === O ? w?.source : void 0;
1596
+ function A(e) {
1597
+ D(void 0), h(e), n?.(e);
1598
+ }
1599
+ let te = ae(() => D(e));
1600
+ ie(() => {
1601
+ if (!b || O === void 0 || w?.request === O) return;
1602
+ let e = !0;
1603
+ return O.load().then((t) => {
1604
+ e && ee({
1605
+ request: O,
1606
+ source: t
1607
+ });
1608
+ }, () => {
1609
+ e && te();
1610
+ }), () => {
1611
+ e = !1;
1612
+ };
1613
+ }, [
1614
+ O,
1615
+ b,
1616
+ w?.request
1617
+ ]);
1618
+ function ne(e) {
1619
+ _(e), i?.(e);
1620
+ }
1621
+ function re(e) {
1622
+ y(e), u?.(e);
1623
+ }
1624
+ let M = k?.mapping, P = M !== void 0 && d.tick >= M.firstTick && d.tick <= M.lastTick, oe = e !== void 0 && T === e, L = b && !oe ? k : void 0, R = L !== void 0 && P, z = L !== void 0 && M !== void 0 && !P;
1625
+ return /* @__PURE__ */ I(c, {
1626
+ isCompact: !0,
1627
+ children: [
1628
+ e !== void 0 && /* @__PURE__ */ I(S.Root, {
1629
+ "aria-label": "Replay view",
1630
+ value: b ? "footage" : "map",
1631
+ onValueChange: (e) => A(e === "footage"),
1632
+ children: [/* @__PURE__ */ F(S.Item, {
1633
+ value: "map",
1634
+ children: "Map"
1635
+ }), /* @__PURE__ */ F(S.Item, {
1636
+ value: "footage",
1637
+ children: "Footage"
1638
+ })]
1639
+ }),
1640
+ b && oe && /* @__PURE__ */ F(o, {
1641
+ role: "status",
1642
+ variant: "caption",
1643
+ children: "Footage unavailable. Showing the map."
1644
+ }),
1645
+ z && /* @__PURE__ */ I(l, { children: [/* @__PURE__ */ I(o, {
1646
+ variant: "caption",
1647
+ children: [
1648
+ "Footage covers ticks ",
1649
+ M.firstTick,
1650
+ "–",
1651
+ M.lastTick,
1652
+ "."
1653
+ ]
1654
+ }), /* @__PURE__ */ F(a, {
1655
+ variant: "ghost",
1656
+ onClick: () => {
1657
+ ne(!1), d.onTickChange(M.firstTick);
1658
+ },
1659
+ children: "Go to footage"
1660
+ })] }),
1661
+ /* @__PURE__ */ F(st, {
1662
+ ...d,
1663
+ isPlaying: x,
1664
+ onPlayingChange: ne,
1665
+ speed: C,
1666
+ onSpeedChange: re,
1667
+ scene: R ? /* @__PURE__ */ F(E, {
1668
+ title: d.clip.title,
1669
+ locale: f,
1670
+ description: d.clip.arms[L.mapping.arm]?.label,
1671
+ actions: /* @__PURE__ */ I(o, {
1672
+ variant: "caption",
1673
+ children: [
1674
+ d.labels?.tick ?? "Tick",
1675
+ " ",
1676
+ p.format(d.tick)
1677
+ ]
1678
+ }),
1679
+ children: /* @__PURE__ */ F(wt, {
1680
+ source: L,
1681
+ tick: d.tick,
1682
+ isPlaying: x,
1683
+ rate: C * d.clip.hz,
1684
+ label: d.clip.arms[L.mapping.arm]?.label ?? d.clip.title,
1685
+ onError: () => D(e)
1686
+ }, L.src)
1687
+ }) : d.scene
1688
+ })
1689
+ ]
1690
+ });
1691
+ }
1692
+ export { R as FindingCard, Ee as LineageGraph, Ae as MilestonePath, st as MotionFigure, rt as MotionScene, Tt as NativeMotionFigure, Fe as SpecimenDiff, ze as WorkHeartbeat, Ve as defaultMotionView, et as motionSceneAt, xt as motionSha256, Ct as nativeMotionTime, G as normalizeMotionView, Je as parseMotionClip, bt as parseNativeMotionMapping, lt as readMotionLocation, St as verifyNativeMotion, ut as writeMotionLocation };