@tangle-network/sandbox-cli 0.21.64 → 0.21.65

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 (136) hide show
  1. package/README.md +31 -3
  2. package/SKILL.md +29 -1
  3. package/dist/graph-native-CS_TmaCK.mjs +1 -0
  4. package/dist/graph-viewer/Analytics-bWsqhurt.js +1001 -0
  5. package/dist/graph-viewer/{AnswerStrip-DhwqOyxI.js → AnswerStrip-COxV7gLW.js} +2 -2
  6. package/dist/graph-viewer/Checks-CQGmKcQ0.js +164 -0
  7. package/dist/graph-viewer/Conversations-DgCshBAf.js +627 -0
  8. package/dist/graph-viewer/{Files-DtZhf0ii.js → Files-CvIOGrAs.js} +81 -90
  9. package/dist/graph-viewer/LiveRun-DHmsr6F7.js +311 -0
  10. package/dist/graph-viewer/{Outputs-QET3nPPp.js → Outputs-rwBg_x36.js} +4 -4
  11. package/dist/graph-viewer/Overview-C150tkVa.js +194 -0
  12. package/dist/graph-viewer/{RunOverview-DJQDAMIx.js → RunOverview-CSqsunqf.js} +2 -2
  13. package/dist/graph-viewer/RunPage-F_prVwiV.js +286 -0
  14. package/dist/graph-viewer/Timeline-BFDywlmz.js +335 -0
  15. package/dist/graph-viewer/Today-BdDuqZGF.js +623 -0
  16. package/dist/graph-viewer/Topology-SAfGtd5u.js +238 -0
  17. package/dist/graph-viewer/Traces-BYqXaS_s.js +254 -0
  18. package/dist/graph-viewer/{WallPages-4d9QUZDq.js → WallPages-MM70VZrC.js} +48 -30
  19. package/dist/graph-viewer/agent-runtime.js +55 -55
  20. package/dist/graph-viewer/{data-BJmP7F1M.js → data-DTGmre1W.js} +31 -27
  21. package/dist/graph-viewer/harness-sessions.js +1 -1
  22. package/dist/graph-viewer/index.js +1357 -1392
  23. package/dist/graph-viewer/{lazy-pages-DM0cZM10.js → lazy-pages-BYuq_L_n.js} +9 -5
  24. package/dist/graph-viewer/{outputs-model-CGdvjkQh.js → outputs-model-CHTx8rMz.js} +2 -2
  25. package/dist/graph-viewer/{viewer/plain-words-CgvxtEOa.js → plain-words-BrMHl0On.js} +9 -4
  26. package/dist/graph-viewer/receipt.js +2 -2
  27. package/dist/graph-viewer/record-CsP_3NJS.js +612 -0
  28. package/dist/graph-viewer/record-part-CuT9Xw37.js +334 -0
  29. package/dist/graph-viewer/record.js +2 -336
  30. package/dist/graph-viewer/report-viewer.js +65 -65
  31. package/dist/graph-viewer/report.js +1 -1
  32. package/dist/graph-viewer/research-publication.js +1 -1
  33. package/dist/graph-viewer/{run-files-C1NgzM0l.js → run-files-BckQDdTD.js} +1 -1
  34. package/dist/graph-viewer/{run-receipt-Bvi4-KVM.js → run-receipt-Bt2iXJUy.js} +1 -0
  35. package/dist/graph-viewer/schemas/agent-workspace.play.v1.json +3 -0
  36. package/dist/graph-viewer/schemas/agent-workspace.plays.v1.json +2 -0
  37. package/dist/graph-viewer/schemas/agent-workspace.run.v1.json +1 -0
  38. package/dist/graph-viewer/styles.css +4559 -2385
  39. package/dist/graph-viewer/trace-spans.js +1 -1
  40. package/dist/graph-viewer/ui-xa5w5bEN.js +889 -0
  41. package/dist/graph-viewer/viewer/{AgentGraphCanvas-CMdOlSlh-4EervjeC.js → AgentGraphCanvas-B74GN1o6-BZEumF7-.js} +2610 -2707
  42. package/dist/graph-viewer/viewer/Analytics-E3XS570U.js +1002 -0
  43. package/dist/graph-viewer/viewer/{AnswerStrip-CGUyXuYH.js → AnswerStrip-B7xMU57A.js} +2 -2
  44. package/dist/graph-viewer/viewer/Checks-CJ5XSHbv.js +165 -0
  45. package/dist/graph-viewer/viewer/Conversations-AX8G7Qyl.js +904 -0
  46. package/dist/graph-viewer/viewer/Files-DxL1576V.js +630 -0
  47. package/dist/graph-viewer/viewer/LiveRun-B-BckyEj.js +820 -0
  48. package/dist/graph-viewer/viewer/{Outputs-CumGyjQo.js → Outputs-BoIpgfMv.js} +24 -23
  49. package/dist/graph-viewer/viewer/Overview-Dzg5XJgy.js +436 -0
  50. package/dist/graph-viewer/viewer/RunPage-NtevWXBs.js +285 -0
  51. package/dist/graph-viewer/viewer/{Scores-ZS16yk0n.js → Scores-Dgv4WePL.js} +3 -3
  52. package/dist/graph-viewer/viewer/Timeline-CzY3LVDu.js +335 -0
  53. package/dist/graph-viewer/viewer/Today-Bi9IIwuh.js +623 -0
  54. package/dist/graph-viewer/viewer/Topology-CzjqSFXH.js +239 -0
  55. package/dist/graph-viewer/viewer/Traces-CMX0H1VU.js +254 -0
  56. package/dist/graph-viewer/viewer/{WallPages-CzWpyIfp.js → WallPages-Clj4bORg.js} +50 -32
  57. package/dist/graph-viewer/viewer/addon-webgl-BSCscllv.js +4027 -0
  58. package/dist/graph-viewer/viewer/agent-record-BrP-ENHg.css +2 -0
  59. package/dist/graph-viewer/viewer/{bot-D6Nrej7Z.js → bot-BaQU59LG.js} +1 -1
  60. package/dist/graph-viewer/viewer/{chevron-right-D_5IKLxu.js → chevron-right-Xn05jYLT.js} +1 -1
  61. package/dist/graph-viewer/viewer/{createLucideIcon-yH0cxLMy.js → createLucideIcon-BSphcoOJ.js} +1 -1
  62. package/dist/graph-viewer/viewer/dashboard-D3JhmRhe-DSl0zhkw.js +371 -0
  63. package/dist/graph-viewer/viewer/{data-CkWfWr7i.js → data-CVHeKhrh.js} +144 -139
  64. package/dist/graph-viewer/viewer/dist-4_KJz8ZM.js +349 -0
  65. package/dist/graph-viewer/viewer/dist-Dy-wrdTt.js +1615 -0
  66. package/dist/graph-viewer/viewer/es2015-utW4DTOJ.js +3506 -0
  67. package/dist/graph-viewer/viewer/{final-output-kwY11u9X.js → final-output-BYT-g-9j.js} +1 -1
  68. package/dist/graph-viewer/viewer/flow-waterfall-model-DvrgPLGS-BdThSFH-.js +2696 -0
  69. package/dist/graph-viewer/viewer/git-branch-BzTbIcYL.js +28 -0
  70. package/dist/graph-viewer/viewer/{highlights-Btsi5OXl.js → highlights-DWeSCtiR.js} +4 -4
  71. package/dist/graph-viewer/viewer/jsx-runtime-DPT6sCLq.js +319 -0
  72. package/dist/graph-viewer/viewer/lazy-pages-ChiMJ8r_.js +803 -0
  73. package/dist/graph-viewer/viewer/{markdown-CX_sVrXB.js → markdown-lADwhD7y.js} +2324 -2608
  74. package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-RSb7EbGB.js +476 -0
  75. package/dist/graph-viewer/viewer/{page-header-Brq611fd.js → page-header-QbUg8F8i.js} +12 -11
  76. package/dist/graph-viewer/{plain-words-CgvxtEOa.js → viewer/plain-words-BrMHl0On.js} +9 -4
  77. package/dist/graph-viewer/viewer/primitives-znfPK9NP-B6UO7uDr.js +346 -0
  78. package/dist/graph-viewer/viewer/react-DQ7E2Epi.js +4254 -0
  79. package/dist/graph-viewer/viewer/{react-dom-t1L4_-il.js → react-dom-BEusmvQH.js} +1 -1
  80. package/dist/graph-viewer/viewer/record-DZnT6SWN-H-ul3U3a.js +3523 -0
  81. package/dist/graph-viewer/viewer/record-W39D5MO-.js +1 -0
  82. package/dist/graph-viewer/viewer/record-part-CbweyYoV.js +335 -0
  83. package/dist/graph-viewer/viewer/{segmented-control-BaJmvTNd.js → segmented-control-Di1mbQlP.js} +27 -26
  84. package/dist/graph-viewer/viewer/{shiki-Qnby7Sh6.js → shiki-BfNNlmfZ.js} +15 -15
  85. package/dist/graph-viewer/viewer/status-meta-S0kV_RDp.js +273 -0
  86. package/dist/graph-viewer/viewer/{stream-tokenizer-CWtnjmRd.js → stream-tokenizer-B5wWaM3U.js} +12 -12
  87. package/dist/graph-viewer/viewer/{themes-1i1fzpRk.js → themes-DuRxHiga.js} +1 -1
  88. package/dist/graph-viewer/viewer/ui-Co03nZUX.js +889 -0
  89. package/dist/graph-viewer/viewer/utils-BuObIC0n.js +1815 -0
  90. package/dist/graph-viewer/viewer/workbench-E6_5q_oL.js +28351 -0
  91. package/dist/graph-viewer/viewer/workflows--mZpHYqo.js +3298 -0
  92. package/dist/graph-viewer/viewer/workspace-cKs9sGEO.js +2468 -0
  93. package/dist/graph-viewer/{workspace-model-Ewf17pTW.js → workspace-model-BkPl_J8E.js} +1 -1
  94. package/dist/graph-viewer/workspace-viewer.js +7452 -7489
  95. package/dist/graph-viewer/workspace.js +1 -1
  96. package/dist/index.mjs +27 -22
  97. package/package.json +9 -8
  98. package/dist/graph-viewer/Analytics-DFWW8Phh.js +0 -938
  99. package/dist/graph-viewer/Checks-qgqV4xgV.js +0 -155
  100. package/dist/graph-viewer/Conversations-CGB45kpj.js +0 -545
  101. package/dist/graph-viewer/LiveRun-C21wUKAY.js +0 -210
  102. package/dist/graph-viewer/Overview-BjeLsA2I.js +0 -506
  103. package/dist/graph-viewer/RunPage-CkkcBEUe.js +0 -258
  104. package/dist/graph-viewer/Timeline-C2Xolk0t.js +0 -293
  105. package/dist/graph-viewer/Today-BVVDtSVN.js +0 -660
  106. package/dist/graph-viewer/Topology-DO5XX8e4.js +0 -545
  107. package/dist/graph-viewer/Traces-BhMxjNgw.js +0 -259
  108. package/dist/graph-viewer/part-events-BrLrg_EV.js +0 -276
  109. package/dist/graph-viewer/record-part-CZal_IMH.js +0 -1408
  110. package/dist/graph-viewer/ui-D8QZRsC3.js +0 -938
  111. package/dist/graph-viewer/viewer/Analytics-DD__nbLm.js +0 -939
  112. package/dist/graph-viewer/viewer/Checks-Ds5M7eAW.js +0 -156
  113. package/dist/graph-viewer/viewer/Conversations-C1n0EBBd.js +0 -819
  114. package/dist/graph-viewer/viewer/Files-Cjr7NMU_.js +0 -448
  115. package/dist/graph-viewer/viewer/LiveRun-uPTkPSjo.js +0 -6772
  116. package/dist/graph-viewer/viewer/Overview-4Umk14_2.js +0 -507
  117. package/dist/graph-viewer/viewer/RunPage-DZlBW7Va.js +0 -257
  118. package/dist/graph-viewer/viewer/Timeline-BnK6-yBR.js +0 -294
  119. package/dist/graph-viewer/viewer/Today-a_-oNigi.js +0 -660
  120. package/dist/graph-viewer/viewer/Topology-CQPCLQT6.js +0 -546
  121. package/dist/graph-viewer/viewer/Traces-C0IGk0L4.js +0 -259
  122. package/dist/graph-viewer/viewer/WorkflowGraph-DZ3xejKE-jRXKeSrg.js +0 -1559
  123. package/dist/graph-viewer/viewer/agent-record-Dw772ROs.css +0 -2
  124. package/dist/graph-viewer/viewer/agent-timeline-Cs9Qbpvo.js +0 -1798
  125. package/dist/graph-viewer/viewer/dist-C1-7EfoW.js +0 -488
  126. package/dist/graph-viewer/viewer/file-text-m7a3piQF.js +0 -47
  127. package/dist/graph-viewer/viewer/jsx-runtime-DQWyJOhv.js +0 -2136
  128. package/dist/graph-viewer/viewer/lazy-pages-BowaGsg-.js +0 -20
  129. package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-fagiBQam.js +0 -723
  130. package/dist/graph-viewer/viewer/popover-CvOAjlnk.js +0 -5329
  131. package/dist/graph-viewer/viewer/react-CY3IbSNO.js +0 -4262
  132. package/dist/graph-viewer/viewer/record-part-D3_Anfpe.js +0 -1329
  133. package/dist/graph-viewer/viewer/terminal-83J_I4Ne.js +0 -52
  134. package/dist/graph-viewer/viewer/ui-C9b1rIUH.js +0 -938
  135. package/dist/graph-viewer/viewer/workspace-CekmOBs3.js +0 -25100
  136. package/dist/graph-viewer/viewer/x-DOc2URqZ.js +0 -56
@@ -0,0 +1,4254 @@
1
+ import { i as e } from "./rolldown-runtime-DArdT4gl.js";
2
+ import { n as t, t as n } from "./jsx-runtime-DPT6sCLq.js";
3
+ import { A as r, C as i, D as a, E as o, O as s, S as c, T as l, _ as u, a as d, b as f, c as p, d as m, f as h, h as g, i as _, k as v, l as y, m as b, n as x, o as S, p as C, r as w, t as T, u as E, v as D, w as O, x as k, y as A } from "./flow-waterfall-model-DvrgPLGS-BdThSFH-.js";
4
+ //#region node_modules/.pnpm/@tangle-network+charts@2.0.16_@xyflow+react@12.12.0_@types+react-dom@19.3.0_@types+reac_70059c26b484216dc6013bae841a163d/node_modules/@tangle-network/charts/dist/timeline-B7c-cede.js
5
+ function j(e) {
6
+ return String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7
+ }
8
+ var M = [
9
+ 281,
10
+ 288,
11
+ 466,
12
+ 633,
13
+ 642,
14
+ 982,
15
+ 644,
16
+ 300,
17
+ 365,
18
+ 365,
19
+ 501,
20
+ 662,
21
+ 288,
22
+ 460,
23
+ 288,
24
+ 360,
25
+ 631,
26
+ 407,
27
+ 610,
28
+ 618,
29
+ 646,
30
+ 608,
31
+ 620,
32
+ 566,
33
+ 619,
34
+ 620,
35
+ 288,
36
+ 302,
37
+ 662,
38
+ 662,
39
+ 662,
40
+ 511,
41
+ 966,
42
+ 690,
43
+ 654,
44
+ 730,
45
+ 722,
46
+ 601,
47
+ 590,
48
+ 746,
49
+ 743,
50
+ 269,
51
+ 571,
52
+ 672,
53
+ 565,
54
+ 903,
55
+ 753,
56
+ 765,
57
+ 639,
58
+ 765,
59
+ 644,
60
+ 642,
61
+ 646,
62
+ 744,
63
+ 690,
64
+ 985,
65
+ 682,
66
+ 679,
67
+ 629,
68
+ 365,
69
+ 360,
70
+ 365,
71
+ 471,
72
+ 456,
73
+ 323,
74
+ 562,
75
+ 612,
76
+ 571,
77
+ 612,
78
+ 583,
79
+ 370,
80
+ 613,
81
+ 591,
82
+ 242,
83
+ 242,
84
+ 549,
85
+ 242,
86
+ 876,
87
+ 591,
88
+ 600,
89
+ 612,
90
+ 612,
91
+ 376,
92
+ 528,
93
+ 327,
94
+ 591,
95
+ 562,
96
+ 818,
97
+ 546,
98
+ 562,
99
+ 552,
100
+ 426,
101
+ 333,
102
+ 426,
103
+ 662
104
+ ], N = [
105
+ 252,
106
+ 321,
107
+ 523,
108
+ 644,
109
+ 650,
110
+ 1004,
111
+ 663,
112
+ 326,
113
+ 373,
114
+ 373,
115
+ 540,
116
+ 673,
117
+ 319,
118
+ 465,
119
+ 319,
120
+ 379,
121
+ 660,
122
+ 423,
123
+ 623,
124
+ 636,
125
+ 666,
126
+ 629,
127
+ 640,
128
+ 576,
129
+ 640,
130
+ 640,
131
+ 319,
132
+ 329,
133
+ 673,
134
+ 673,
135
+ 673,
136
+ 543,
137
+ 999,
138
+ 728,
139
+ 659,
140
+ 737,
141
+ 722,
142
+ 605,
143
+ 588,
144
+ 749,
145
+ 746,
146
+ 277,
147
+ 580,
148
+ 703,
149
+ 565,
150
+ 922,
151
+ 759,
152
+ 769,
153
+ 645,
154
+ 773,
155
+ 652,
156
+ 650,
157
+ 660,
158
+ 736,
159
+ 728,
160
+ 1020,
161
+ 720,
162
+ 713,
163
+ 652,
164
+ 373,
165
+ 379,
166
+ 373,
167
+ 481,
168
+ 469,
169
+ 351,
170
+ 574,
171
+ 624,
172
+ 583,
173
+ 624,
174
+ 591,
175
+ 389,
176
+ 625,
177
+ 612,
178
+ 262,
179
+ 262,
180
+ 569,
181
+ 262,
182
+ 900,
183
+ 612,
184
+ 609,
185
+ 624,
186
+ 624,
187
+ 397,
188
+ 549,
189
+ 353,
190
+ 612,
191
+ 587,
192
+ 839,
193
+ 569,
194
+ 588,
195
+ 566,
196
+ 455,
197
+ 359,
198
+ 455,
199
+ 673
200
+ ], P = {
201
+ "·": 300,
202
+ "×": 670,
203
+ "—": 1e3,
204
+ "–": 500,
205
+ "…": 900,
206
+ "≥": 670,
207
+ "≤": 670,
208
+ "±": 670,
209
+ "→": 954,
210
+ "−": 662
211
+ }, F = 1.04;
212
+ function I(e, t, n = "sans") {
213
+ if (n === "mono") return e.length * .6 * t * F;
214
+ let r = n === "sans-semibold" ? N : M, i = 0;
215
+ for (let t of e) {
216
+ let e = t.codePointAt(0) ?? 0;
217
+ i += e >= 32 && e <= 126 ? r[e - 32] : P[t] ?? 620;
218
+ }
219
+ return i / 1e3 * t * F;
220
+ }
221
+ function L(e, t, n, r = "sans", i = 2) {
222
+ let a = (e) => I(e, n, r) <= t, o = [], s = [], c = "", l = (e, t) => {
223
+ o.push(c), s.push(t), c = e;
224
+ };
225
+ for (let t of e.split(/\s+/).filter(Boolean)) {
226
+ let e = c ? `${c} ${t}` : t;
227
+ if (a(e)) c = e;
228
+ else if (a(t)) c ? l(t, " ") : c = t;
229
+ else {
230
+ let e = t.match(/[^\-/_·]+[\-/_·]?|[\-/_·]/g) ?? [t];
231
+ for (let [t, n] of e.entries()) {
232
+ let e = t === 0 ? " " : "", r = c ? `${c}${e}${n}` : n;
233
+ a(r) || !c ? c = r : l(n, e);
234
+ }
235
+ }
236
+ }
237
+ if (c && o.push(c), o.length <= i && o.every(a)) return {
238
+ lines: o,
239
+ truncated: !1
240
+ };
241
+ let u = o.slice(0, i), d = o.slice(i - 1).reduce((e, t, n) => n === 0 ? t : `${e}${s[i - 2 + n]}${t}`, "");
242
+ for (; d.length > 1 && !a(`${d}…`);) d = d.slice(0, -1);
243
+ return u[i - 1] = `${d.trimEnd()}…`, {
244
+ lines: u,
245
+ truncated: !0
246
+ };
247
+ }
248
+ function ee(e, t, n, r, i) {
249
+ return e.length === 1 ? `<text x="${t}" y="${n}" ${i}>${j(e[0])}</text>` : `<text x="${t}" y="${n}" ${i}>${e.map((e, n) => `<tspan x="${t}" dy="${n === 0 ? 0 : r}">${j(e)}</tspan>`).join("")}</text>`;
250
+ }
251
+ function te(e, t, n, r = "sans") {
252
+ let i = [];
253
+ for (let a of e) {
254
+ let e = i[i.length - 1];
255
+ e !== void 0 && I(`${e} · ${a}`, n, r) <= t ? i[i.length - 1] = `${e} · ${a}` : i.push(a);
256
+ }
257
+ return i;
258
+ }
259
+ function R(e, t, n = `${t}s`) {
260
+ return e === 1 ? t : n;
261
+ }
262
+ function z(e) {
263
+ return e.charAt(0).toUpperCase() + e.slice(1);
264
+ }
265
+ function ne(e) {
266
+ return e !== void 0 && Number.isFinite(e) && e > 720 ? Math.floor(e) : 720;
267
+ }
268
+ var B = (e) => Math.round(e * 100) / 100;
269
+ function V(e, t, n) {
270
+ let r = Math.ceil(t);
271
+ return `<svg class="tgc-svg" xmlns="http://www.w3.org/2000/svg" width="${e}" height="${r}" viewBox="0 0 ${e} ${r}" aria-hidden="true" focusable="false">${n}</svg>`;
272
+ }
273
+ function H(e, t, n, r, i) {
274
+ if (n <= 0) return "";
275
+ let a = Math.min(4, r / 2, n);
276
+ return `<path class="${i}" d="M${B(e)} ${B(t)}h${B(n - a)}a${a} ${a} 0 0 1 ${a} ${a}v${B(r - 2 * a)}a${a} ${a} 0 0 1 -${a} ${a}h-${B(n - a)}z"/>`;
277
+ }
278
+ function re(e, t, n, r, i, a = "") {
279
+ return n <= 0 || r <= 0 ? "" : `<rect class="${i}" x="${B(e)}" y="${B(t)}" width="${B(n)}" height="${B(r)}"${a ? ` ${a}` : ""}/>`;
280
+ }
281
+ function ie(e, t, n, r, i = 6) {
282
+ if (!(n > 0) || !(r > 0)) return "";
283
+ let a = "";
284
+ for (let o = i / 2; o < n + r; o += i) {
285
+ let i = Math.max(0, o - r), s = Math.min(n, o);
286
+ a += `M${B(e + i)} ${B(t + o - i)}L${B(e + s)} ${B(t + o - s)}`;
287
+ }
288
+ return a;
289
+ }
290
+ function ae(e, t, n, r, i) {
291
+ return n <= 0 || r <= 0 ? "" : `<g class="${i}" data-hatched="true">${re(e, t, n, r, "tgc-hatch-bg")}<path class="tgc-hatch" d="${ie(e, t, n, r)}"/></g>`;
292
+ }
293
+ function U(e, t, n, r, i) {
294
+ return `<line class="${i}" x1="${B(e)}" y1="${B(t)}" x2="${B(n)}" y2="${B(r)}"/>`;
295
+ }
296
+ function oe(e, t, n, r) {
297
+ return `<circle class="${r}" cx="${B(e)}" cy="${B(t)}" r="${n}"/>`;
298
+ }
299
+ var se = [
300
+ "circle",
301
+ "square",
302
+ "triangle",
303
+ "diamond"
304
+ ];
305
+ function ce(e, t, n, r) {
306
+ let [i, a] = [B(t), B(n)];
307
+ if (e === "square") {
308
+ let e = B(r * .9);
309
+ return `M${B(i - e)} ${B(a - e)}h${B(2 * e)}v${B(2 * e)}h${B(-2 * e)}z`;
310
+ }
311
+ if (e === "triangle") {
312
+ let e = B(r * 1.2);
313
+ return `M${i} ${B(a - e)}L${B(i + e)} ${B(a + e * .8)}L${B(i - e)} ${B(a + e * .8)}z`;
314
+ }
315
+ if (e === "diamond") {
316
+ let e = B(r * 1.3);
317
+ return `M${i} ${B(a - e)}L${B(i + e)} ${a}L${i} ${B(a + e)}L${B(i - e)} ${a}z`;
318
+ }
319
+ return `M${B(i - r)} ${a}a${r} ${r} 0 1 0 ${B(2 * r)} 0a${r} ${r} 0 1 0 ${B(-2 * r)} 0`;
320
+ }
321
+ function le(e, t) {
322
+ return `<polyline class="${t}" points="${e.map(([e, t]) => `${B(e)},${B(t)}`).join(" ")}"/>`;
323
+ }
324
+ function ue(e, t, n, r = {}) {
325
+ let i = r.anchor && r.anchor !== "start" ? ` text-anchor="${r.anchor}"` : "", a = r.weight === 600 ? " font-weight=\"600\"" : "";
326
+ return `<text class="${r.cls ?? "tgc-ink"}" x="${B(e)}" y="${B(t)}" font-size="${r.size ?? 12}"${i}${a}>${j(n)}</text>`;
327
+ }
328
+ function de(e, t) {
329
+ return `<g><title>${j(e)}</title>${t}</g>`;
330
+ }
331
+ function fe(e, t, n) {
332
+ let r = t.map((e) => `<th scope="col"${e.numeric ? " class=\"tgc-n\"" : ""}>${j(e.label)}</th>`).join(""), i = n.map((e) => `<tr>${e.map((e, n) => n === 0 ? `<th scope="row">${j(e)}</th>` : `<td${t[n]?.numeric ? " class=\"tgc-n\"" : ""}>${j(e)}</td>`).join("")}</tr>`).join("");
333
+ return `<table class="tgc-table"><caption>${j(e)}</caption><thead><tr>${r}</tr></thead><tbody>${i}</tbody></table>`;
334
+ }
335
+ var pe = [
336
+ "S",
337
+ "A",
338
+ "B",
339
+ "C",
340
+ "F"
341
+ ], W = [
342
+ "F",
343
+ "C",
344
+ "B",
345
+ "A",
346
+ "S"
347
+ ];
348
+ function me(e, t) {
349
+ return W.indexOf(e) >= W.indexOf(t);
350
+ }
351
+ function he(e) {
352
+ return `${Math.round(e * 100)}%`;
353
+ }
354
+ function ge(e) {
355
+ return e >= 100 ? `$${Math.round(e).toLocaleString("en-US")}` : e >= 1 ? `$${e.toFixed(2)}` : e >= .01 ? `$${e.toFixed(3)}` : `$${e.toFixed(4)}`;
356
+ }
357
+ function _e(e) {
358
+ let t = e / 1e3;
359
+ return t < 60 ? `${Math.round(t)} s` : t < 3600 ? `${(t / 60).toFixed(1)} min` : `${(t / 3600).toFixed(1)} h`;
360
+ }
361
+ function ve(e, t) {
362
+ return `${e}/${t}`;
363
+ }
364
+ var ye = {
365
+ "task-cluster-bootstrap": "task-clustered bootstrap",
366
+ "mcnemar-exact": "exact McNemar",
367
+ wilson: "Wilson score"
368
+ };
369
+ function be(e) {
370
+ return `${Math.round((e.level ?? 0) * 100)}% ${e.method ? ye[e.method] : ""}`.trim();
371
+ }
372
+ function G(e) {
373
+ if (!e) return "no interval";
374
+ let t = [e.level === null ? "level" : "", e.method === null ? "method" : ""].filter(Boolean);
375
+ return t.length ? `the interval names no ${t.join(" or ")}` : e.method in ye ? !Number.isFinite(e.level) || e.level <= 0 || e.level >= 1 ? "the interval level is outside 0–1" : !Number.isFinite(e.lower) || !Number.isFinite(e.upper) ? "the interval bounds are not finite" : e.lower <= e.upper ? null : "the interval bounds are out of order" : "the interval method is unknown";
376
+ }
377
+ function xe(e) {
378
+ return e === "descriptive" || e === "bootstrap";
379
+ }
380
+ function K(e, t) {
381
+ return e === "none" ? t === 1 ? "1 unit" : `${t} units` : e === "insufficient" ? "too few units" : "";
382
+ }
383
+ function Se(e) {
384
+ return e.basis !== "unknown" && e.perSolvedUsd !== null && Number.isFinite(e.perSolvedUsd) && e.perSolvedUsd > 0 ? e.perSolvedUsd : null;
385
+ }
386
+ function Ce(e, t) {
387
+ if (t === 0) return "no pass";
388
+ let n = Se(e);
389
+ return n === null ? "unknown" : e.basis === "receipts" ? ge(n) : `${ge(n)} est.`;
390
+ }
391
+ function we(e) {
392
+ return xe(e.estimate) ? !Number.isFinite(e.rate) || e.rate < 0 || e.rate > 1 ? "rate is outside 0–1" : G(e.interval) || (e.interval.method === "mcnemar-exact" ? "exact McNemar applies to paired comparisons, not rates" : e.estimate === "descriptive" && e.interval.method !== "wilson" ? `descriptive estimate does not support ${be(e.interval)}` : e.interval.lower < 0 || e.interval.upper > 1 ? "the rate interval is outside 0–1" : e.rate < e.interval.lower - 1e-6 || e.rate > e.interval.upper + 1e-6 ? "the rate falls outside its interval" : null) : `${e.estimate} estimate`;
393
+ }
394
+ function Te(e) {
395
+ return !Number.isInteger(e.attempts) || e.attempts < 0 || !Number.isInteger(e.solved) || e.solved < 0 || e.solved > e.attempts ? "passed and attempt counts are invalid" : !Number.isFinite(e.rate) || e.rate < 0 || e.rate > 1 ? "rate is outside 0–1" : e.attempts > 0 && Math.abs(e.rate - e.solved / e.attempts) > 1e-6 ? "rate disagrees with passed/attempts" : e.attempts === 0 && e.rate !== 0 ? "rate has no attempts" : xe(e.estimate) && e.attempts === 0 ? "drawable estimate has no attempts" : null;
396
+ }
397
+ function Ee(e) {
398
+ if (e.length > 0 && e.every((e) => e.rank !== null && e.estimate === "bootstrap")) return [...e].sort((e, t) => e.rank - t.rank);
399
+ let t = e.filter((e) => xe(e.estimate)).sort((e, t) => t.rate - e.rate), n = e.filter((e) => !xe(e.estimate)).sort((e, t) => t.attempts - e.attempts);
400
+ return [...t, ...n];
401
+ }
402
+ function De(e, t = 0, n = 0) {
403
+ let r = e ? pe.filter((t) => e[t] > 0).map((t) => `${e[t]}${t}`) : [];
404
+ return n && r.push(`${n} flagged`), t && r.push(`${t}U`), r.join(" ");
405
+ }
406
+ function Oe(e) {
407
+ return e ? W.reduce((t, n) => t + e[n], 0) : 0;
408
+ }
409
+ function ke(e) {
410
+ return "refused" in e;
411
+ }
412
+ var Ae = [
413
+ "pass",
414
+ "deadline",
415
+ "died",
416
+ "event",
417
+ "release",
418
+ "steer",
419
+ "ruling",
420
+ "wake"
421
+ ], je = [
422
+ "pass",
423
+ "fail",
424
+ "unknown"
425
+ ], Me = [
426
+ "after-pass",
427
+ "idle",
428
+ "missing",
429
+ "blocked",
430
+ "group"
431
+ ], Ne = {
432
+ release: "diamond",
433
+ steer: "triangle",
434
+ ruling: "square",
435
+ wake: "circle"
436
+ };
437
+ function q(e = [], t = [], n) {
438
+ let r = (e) => !n || e >= n[0] && e <= n[1];
439
+ for (let t of e) {
440
+ if (!t || typeof t.label != "string" || !t.label.trim()) return "Every mark needs a label.";
441
+ if (!Ae.includes(t.kind)) return `${t.label}: unknown mark kind.`;
442
+ if (t.verdict !== void 0 && !je.includes(t.verdict)) return `${t.label}: a verdict is pass, fail or unknown.`;
443
+ if (t.source !== void 0 && (typeof t.source != "string" || !t.source.trim())) return `${t.label}: a source needs a name.`;
444
+ if (!Number.isFinite(t.at) || !r(t.at)) return `${t.label}: mark position must be finite and inside the axis domain.`;
445
+ }
446
+ for (let e of t) {
447
+ if (!e || typeof e.label != "string" || !e.label.trim()) return "Every band needs a label.";
448
+ if (!Me.includes(e.kind)) return `${e.label}: unknown band kind.`;
449
+ if (!Number.isFinite(e.from) || !Number.isFinite(e.to) || (e.kind === "group" ? e.from > e.to : e.from >= e.to) || !r(e.from) || !r(e.to)) return `${e.label}: a band needs finite, increasing bounds inside the axis domain.`;
450
+ }
451
+ return null;
452
+ }
453
+ function Pe(e) {
454
+ return e.kind === "event" && e.source === "gap";
455
+ }
456
+ function J(e) {
457
+ return e.source ? `${e.label} · ${e.source}` : e.label;
458
+ }
459
+ function Fe(e) {
460
+ return [
461
+ e.kind,
462
+ e.verdict,
463
+ e.lane && `lane ${e.lane}`
464
+ ].filter(Boolean).join(" · ");
465
+ }
466
+ function Y(e, t, n, r, i, a, o) {
467
+ return e.map((e) => {
468
+ if (e.kind === "group") return "";
469
+ let s = a ? Math.max(e.from, a[0]) : e.from, c = a ? Math.min(e.to, a[1]) : e.to;
470
+ if (c <= s) return "";
471
+ let [l, u] = o ? o(s, c) : [t(s), t(c)], d = l, f = u - l, p = `tgc-band tgc-band-${e.kind}`, m = e.kind === "missing" ? ae(d, n, f, r - n, p) : re(d, n, f, r - n, p) + (e.kind === "blocked" ? U(d, n, d + f, n, "tgc-band-wall") : "");
472
+ return de(`${e.label}: ${i(e.from)} to ${i(e.to)}`, `<g data-band="${e.kind}">${m}</g>`);
473
+ }).join("");
474
+ }
475
+ function Ie(e = []) {
476
+ return e.some((e) => e.kind === "group") ? 18 : 0;
477
+ }
478
+ function Le(e, t, n, r, i, a, o, s) {
479
+ return e.filter((e) => e.kind === "group").map((e) => {
480
+ let c = s ? Math.max(e.from, s[0]) : e.from, l = s ? Math.min(e.to, s[1]) : e.to;
481
+ if (l < c) return "";
482
+ let [u, d] = t(c, l), f = d - u, p = f >= 24 ? L(e.label, f - 10, 12, "sans", 1).lines[0] : "", m = [u, d].filter((e) => e > i + .5 && e < a - .5).map((e) => U(e, n - 16, e, r, "tgc-group-edge")).join(""), h = U(u + 2, n - 3, d - 2, n - 3, "tgc-group-rule") + (p ? ue(u + 3, n - 7, p, {
483
+ size: 12,
484
+ cls: "tgc-group-label"
485
+ }) : "");
486
+ return de(`${e.label}: ${o(e.from)} to ${o(e.to)}`, `<g data-band="group">${m}${h}</g>`);
487
+ }).join("");
488
+ }
489
+ function X(e, t) {
490
+ let n = [];
491
+ for (let r of [...e].sort((e, t) => e.at - t.at)) {
492
+ let e = t(r.at), i = n.at(-1), a = i?.marks[0], o = i && t(i.marks.at(-1).at);
493
+ i && r.kind !== "ruling" && a.kind === r.kind && a.verdict === r.verdict && (e - o < 3 || e - o < 12 && J(a) === J(r)) ? i.marks.push(r) : n.push({
494
+ x: e,
495
+ marks: [r]
496
+ });
497
+ }
498
+ return n;
499
+ }
500
+ function Re(e, t, n, r) {
501
+ let i = r.rows ?? 3, a = Math.max(48, Math.min(200, (n - t) * .42)), o = Array.from({ length: i }, () => []), s = (e, t, n) => o[e].every(([e, r]) => n + 6 <= e || t >= r + 6), c = (e, r, c, l, u) => {
502
+ let d = L(e, a, 12, "sans", 1).lines[0], f = I(d, 12);
503
+ for (let e of u ? [l, l === "start" ? "end" : "start"] : [l]) {
504
+ let [a, l] = e === "start" ? [r, r + f] : [c - f, c];
505
+ if (!(a < t - 4 || l > n + 4)) {
506
+ for (let t = 0; t < i; t++) if (s(t, a, l)) return o[t].push([a, l]), {
507
+ row: t,
508
+ x: e === "start" ? r : c,
509
+ anchor: e,
510
+ text: d
511
+ };
512
+ }
513
+ }
514
+ return null;
515
+ }, [l, u] = r.window ?? [-Infinity, Infinity], d = [...(r.after ?? []).map((e) => c(`${J(e)} +${_e(e.at - u)} →`, n, n, "end", !1)), ...(r.before ?? []).map((e) => c(`← ${J(e)} −${_e(l - e.at)}`, t, t, "start", !1))].filter((e) => e !== null), f = /* @__PURE__ */ new Map();
516
+ for (let r of [...e.filter((e) => !Pe(e.marks[0])), ...e.filter((e) => Pe(e.marks[0]))]) {
517
+ let e = r.x > t + (n - t) * .62, i = c(J(r.marks[0]) + (r.marks.length > 1 ? ` (+${r.marks.length - 1})` : ""), r.x + 4, r.x - 4, e ? "end" : "start", !0);
518
+ i && f.set(r, i);
519
+ }
520
+ return {
521
+ placed: f,
522
+ edges: d,
523
+ rows: Math.max(0, ...[...f.values(), ...d].map((e) => e.row + 1))
524
+ };
525
+ }
526
+ function ze(e, t, n, r, i = {}) {
527
+ return Re(X(e, t), n, r, i).rows;
528
+ }
529
+ function Be(e, t, n, r = 3.5) {
530
+ let i = Ne[e];
531
+ return i ? `<path class="tgc-mark-head" d="${ce(i, t, n, r)}"/>` : "";
532
+ }
533
+ function Ve(e, t, n, r, i, a, o, s = n, c = {}) {
534
+ let l = X(e, t), { placed: u, edges: d } = Re(l, i, a, c), f = (e) => s + 12 + e * 14, p = l.map((e) => {
535
+ let { x: t, marks: i } = e, a = i[0], c = Ne[a.kind] !== void 0 && a.kind !== "ruling" || Pe(a), l = U(t, Math.min(n, s), t, c ? n + 4 : r, `tgc-mark tgc-mark-${a.kind}`);
536
+ a.kind === "died" && (l += U(t - 4, r - 8, t + 4, r, "tgc-mark tgc-mark-died") + U(t - 4, r, t + 4, r - 8, "tgc-mark tgc-mark-died")), l += Be(a.kind, t, n + 4);
537
+ let u = a.verdict ? ` data-verdict="${a.verdict}" class="tgc-verdict-${a.verdict}"` : "";
538
+ return de(i.map((e) => `${J(e)}: ${o(e.at)}${e.verdict ? ` · ${e.verdict}` : ""}`).join("\n"), `<g data-mark="${a.kind}"${i.length > 1 ? ` data-merged="${i.length}"` : ""}${u}>${l}</g>`);
539
+ }).join("");
540
+ for (let e of l) {
541
+ let t = u.get(e);
542
+ t && (p += ue(t.x, f(t.row), t.text, {
543
+ size: 12,
544
+ anchor: t.anchor,
545
+ cls: "tgc-mark-label"
546
+ }));
547
+ }
548
+ for (let e of d) p += `<g data-edge="${e.anchor === "end" ? "after" : "before"}">${ue(e.x, f(e.row), e.text, {
549
+ size: 12,
550
+ anchor: e.anchor,
551
+ cls: "tgc-mark-label tgc-mark-edge"
552
+ })}</g>`;
553
+ return p;
554
+ }
555
+ function He(e, t, n, r) {
556
+ if (!e.length && !t.length) return "";
557
+ let i = [...e.map((e) => ({
558
+ at: e.at,
559
+ cells: [
560
+ J(e),
561
+ Fe(e),
562
+ r(e.at),
563
+ ""
564
+ ]
565
+ })), ...t.map((e) => ({
566
+ at: e.from,
567
+ cells: [
568
+ e.label,
569
+ e.kind === "missing" ? "no data" : e.kind,
570
+ r(e.from),
571
+ r(e.to)
572
+ ]
573
+ }))].sort((e, t) => e.at - t.at);
574
+ return fe(`Recorded events by ${n}`, [
575
+ { label: "Event" },
576
+ { label: "Kind" },
577
+ {
578
+ label: `${n} from`,
579
+ numeric: !0
580
+ },
581
+ {
582
+ label: `${n} to`,
583
+ numeric: !0
584
+ }
585
+ ], i.map((e) => e.cells));
586
+ }
587
+ var Ue = "Vertical rules mark recorded events (solid: pass, dashed: deadline, cross: died, dotted: other; a diamond is a release, a triangle a steer, a square a ruling and a circle a wake, coloured by verdict when one is recorded); tinted spans are recorded periods, a wall-topped span is a system-wide block, and hatched spans have no data.", We = [
588
+ "ok",
589
+ "quota",
590
+ "lost",
591
+ "rate-limit",
592
+ "oom",
593
+ "refused",
594
+ "aborted",
595
+ "other"
596
+ ];
597
+ Object.freeze(Object.fromEntries(We.map((e) => [e, `var(--chart-outcome-${e === "aborted" ? "neutral" : e})`])));
598
+ var Ge = [
599
+ "solved",
600
+ "not solved",
601
+ "died",
602
+ "stalled",
603
+ "cancelled",
604
+ "live",
605
+ "never started"
606
+ ], Ke = Object.freeze(Object.fromEntries(Ge.map((e) => [e, `var(--chart-ending-${e.replace(" ", "-")})`])));
607
+ function qe(e) {
608
+ return e === void 0 ? "" : Number.isInteger(e) && e >= 0 && e < 4 ? `tgc-checker-${e}` : "tgc-checker-other";
609
+ }
610
+ var Je = We, Ye = (e) => new Date(e).toISOString().slice(11, 16), Xe = 6e4, Ze = 864e5, Qe = [
611
+ "Jan",
612
+ "Feb",
613
+ "Mar",
614
+ "Apr",
615
+ "May",
616
+ "Jun",
617
+ "Jul",
618
+ "Aug",
619
+ "Sep",
620
+ "Oct",
621
+ "Nov",
622
+ "Dec"
623
+ ], $e = [
624
+ 1,
625
+ 2,
626
+ 5,
627
+ 10,
628
+ 15,
629
+ 30,
630
+ 60,
631
+ 120,
632
+ 180,
633
+ 360,
634
+ 720,
635
+ 1440,
636
+ 2880,
637
+ 10080
638
+ ].map((e) => e * Xe);
639
+ function et(e, t) {
640
+ let n = t.id ?? "timeline";
641
+ if (!e.length) return {
642
+ id: n,
643
+ refused: "No lanes recorded."
644
+ };
645
+ if (!t.measure?.trim()) return {
646
+ id: n,
647
+ refused: "A timeline needs a measure."
648
+ };
649
+ if (new Set(e.map((e) => e.id)).size !== e.length) return {
650
+ id: n,
651
+ refused: "Duplicate lane ids."
652
+ };
653
+ if (t.now !== void 0 && !Number.isFinite(t.now)) return {
654
+ id: n,
655
+ refused: "now must be a finite time."
656
+ };
657
+ let r = new Map(e.map((e) => [e.id, e]));
658
+ for (let t of e) {
659
+ let e = /* @__PURE__ */ new Set();
660
+ for (let i = t; i.parent !== void 0; i = r.get(i.parent)) {
661
+ if (!r.has(i.parent)) return {
662
+ id: n,
663
+ refused: `${i.label}: parent ${i.parent} is not a lane.`
664
+ };
665
+ if (e.has(i.id)) return {
666
+ id: n,
667
+ refused: `${t.label}: its parent chain loops back to ${i.label}.`
668
+ };
669
+ e.add(i.id);
670
+ }
671
+ if (t.depth !== void 0 && (!Number.isInteger(t.depth) || t.depth < 0)) return {
672
+ id: n,
673
+ refused: `${t.label}: depth must be a whole number of at least 0.`
674
+ };
675
+ }
676
+ let i = /* @__PURE__ */ new Map(), a = (e) => i.get(e.id) ?? i.set(e.id, e.parent === void 0 ? e.depth ?? 0 : a(r.get(e.parent)) + 1).get(e.id);
677
+ for (let t of e) {
678
+ let e = a(t);
679
+ if (t.depth !== void 0 && t.depth !== e) return {
680
+ id: n,
681
+ refused: `${t.label}: depth ${t.depth} is not one below its parent's ${e - 1}.`
682
+ };
683
+ }
684
+ let o = e.flatMap((e) => e.spans.map((t) => ({
685
+ lane: e,
686
+ span: t
687
+ })));
688
+ for (let { lane: e, span: r } of o) {
689
+ if (typeof r.state != "string" || !r.state.trim()) return {
690
+ id: n,
691
+ refused: `${e.label}: every span needs a state.`
692
+ };
693
+ if (!Number.isFinite(r.start) || r.end !== null && (!Number.isFinite(r.end) || r.end < r.start)) return {
694
+ id: n,
695
+ refused: `${e.label}: span times must be finite and end at or after their start.`
696
+ };
697
+ if (r.end === null && t.now === void 0) return {
698
+ id: n,
699
+ refused: `${e.label}: an open span needs now.`
700
+ };
701
+ if (r.end === null && t.now < r.start) return {
702
+ id: n,
703
+ refused: `${e.label}: an open span starts after now.`
704
+ };
705
+ }
706
+ for (let t of e) for (let e of t.ticks ?? []) {
707
+ if (!e || !Number.isFinite(e.at)) return {
708
+ id: n,
709
+ refused: `${t.label}: every tick needs a finite time.`
710
+ };
711
+ if (!Je.includes(e.outcome)) return {
712
+ id: n,
713
+ refused: `${t.label}: tick outcome ${String(e.outcome)} is not one of ${Je.join(", ")}.`
714
+ };
715
+ }
716
+ let s = q(t.marks, t.bands);
717
+ if (s) return {
718
+ id: n,
719
+ refused: s
720
+ };
721
+ let c = t.marks ?? [], l = t.bands ?? [], u = c.find((e) => e.lane !== void 0 && !r.has(e.lane));
722
+ if (u) return {
723
+ id: n,
724
+ refused: `${u.label}: lane ${u.lane} is not a lane.`
725
+ };
726
+ let d = (e) => e.end ?? t.now, f = e.flatMap((e) => e.ticks ?? []), p = [
727
+ ...o.flatMap(({ span: e }) => [e.start, d(e)]),
728
+ ...f.map((e) => e.at),
729
+ ...t.now === void 0 ? [] : [t.now]
730
+ ], m = p.length ? p : [...c.map((e) => e.at), ...l.flatMap((e) => [e.from, e.to])];
731
+ if (!m.length) return {
732
+ id: n,
733
+ refused: "No spans, ticks, marks or bands recorded."
734
+ };
735
+ let h = t.start ?? Math.min(...m), g = t.end ?? Math.max(...m);
736
+ if (!Number.isFinite(h) || !Number.isFinite(g) || g <= h) return {
737
+ id: n,
738
+ refused: "The window needs two finite, increasing times."
739
+ };
740
+ if (p.some((e) => e < h || e > g)) return {
741
+ id: n,
742
+ refused: "A span, tick or now falls outside the recorded window."
743
+ };
744
+ let _ = t.formatTime ?? Ye, v = t.formatTime ?? ((e) => e % Ze === 0 ? `${Qe[new Date(e).getUTCMonth()]} ${new Date(e).getUTCDate()}` : Ye(e)), y = new Set(t.hatch ?? ["missing", "untraced"]), b = new Set(t.muted ?? ["idle"]), x = t.collapsed !== void 0, S = new Set(t.collapsed ?? []), C = /* @__PURE__ */ new Map();
745
+ for (let t of e) C.set(t.parent, [...C.get(t.parent) ?? [], t]);
746
+ let w = (e) => (C.get(e.id) ?? []).flatMap((e) => [e, ...w(e)]), T = [], E = (e) => {
747
+ let t = w(e), n = S.has(e.id) && t.length > 0, r = e.ticks, a = n && (r || t.some((e) => e.ticks)) ? [...r ?? [], ...t.flatMap((e) => e.ticks ?? [])] : r;
748
+ T.push({
749
+ lane: e,
750
+ depth: i.get(e.id),
751
+ children: (C.get(e.id) ?? []).length,
752
+ hidden: n ? t.length : 0,
753
+ folded: n,
754
+ ticks: a
755
+ }), n || (C.get(e.id) ?? []).forEach(E);
756
+ };
757
+ (C.get(void 0) ?? []).forEach(E);
758
+ let D = new Map(T.map((e, t) => [e.lane.id, t])), O = (e) => {
759
+ for (let t = r.get(e); t; t = t.parent === void 0 ? void 0 : r.get(t.parent)) if (D.has(t.id)) return D.get(t.id);
760
+ return 0;
761
+ }, k = (e) => e.at >= h && e.at <= g, A = c.filter((e) => e.lane === void 0 && k(e)), M = c.filter((e) => e.lane !== void 0 && k(e)), N = c.filter((e) => e.at < h), P = c.filter((e) => e.at > g), F = o.filter(({ span: e }) => e.end === null).length, ee = o.filter(({ span: e }) => y.has(e.state)), te = ee.reduce((e, { span: t }) => e + d(t) - t.start, 0), B = (e) => {
762
+ let t = /* @__PURE__ */ new Map();
763
+ for (let n of e) t.set(n.outcome, (t.get(n.outcome) ?? 0) + 1);
764
+ let n = t.get("ok") ?? 0, r = e.length - n, i = [...t].filter(([e]) => e !== "ok").sort((e, t) => t[1] - e[1]).map(([e, t]) => `${t} ${e}`).join(", ");
765
+ return {
766
+ ok: n,
767
+ failed: r,
768
+ why: i,
769
+ text: `${n}✓ ${r}✗`,
770
+ sentence: `${n} ok, ${r} failed${i ? ` (${i})` : ""}`
771
+ };
772
+ }, H = (e) => (e.detail ?? []).filter((e) => typeof e == "string" && e.trim()), ie = (e, n) => [`${e.label}: ${n.state} ${_(n.start)} to ${n.end === null ? `now (${_(t.now)}, open)` : _(n.end)}, ${_e(d(n) - n.start)}${n.note ? ` · ${n.note}` : ""}`, ...H(e)].join("\n"), oe = T.some((e) => e.ticks !== void 0), se = oe ? Math.max(...T.filter((e) => e.ticks).map((e) => I(B(e.ticks).text, 12, "mono"))) : 0, ce = (e) => {
773
+ let n = e === 358, r = n ? 10 : 12, i = (e) => 4 + e * r, a = (e) => i(e) + 11, o = (e) => e.hidden ? ` +${e.hidden}` : "", s = n ? 12 : Math.max(120, Math.min(Math.round(e * .34), Math.ceil(Math.max(...T.map((e) => a(e.depth) + I(e.lane.label + o(e), 12))) + 10))), c = n ? e - 12 : e - 16 - (se ? se + 10 : 0), u = (e) => s + (e - h) / (g - h) * (c - s), f = ze(A, u, s, c, {
774
+ before: N,
775
+ after: P,
776
+ window: [h, g]
777
+ }), p = 8 + (f ? f * 14 + 6 : 0) + Ie(l), m = n ? 40 : 24, S = p + T.length * m, C = (e) => e + (n ? 19 : 5), w = Y(l, u, p, S, _, [h, g]) + Le(l, (e, t) => [u(e), u(t)], p, S, s, c, _, [h, g]);
778
+ for (let e of nt(h, g, u, s, c, v)) w += U(u(e), p, u(e), S, "tgc-gridline") + ue(u(e), S + 16, v(e), {
779
+ size: 12,
780
+ cls: "tgc-ink-muted tgc-num",
781
+ anchor: "middle"
782
+ });
783
+ w += Ve(A, u, p - 8, S, s, c, _, 4, {
784
+ before: N,
785
+ after: P,
786
+ window: [h, g]
787
+ }), T.forEach((t, r) => {
788
+ let { lane: c } = t, l = p + r * m, f = l + (n ? 9 : 12), h = l + (n ? 13 : 16), g = c.parent === void 0 ? void 0 : D.get(c.parent);
789
+ if (g !== void 0) {
790
+ let e = i(t.depth - 1) + 3, r = n ? l + 2 : p + g * m + 19;
791
+ w += `<path class="tgc-tree" d="M${e} ${r}V${f}H${a(t.depth) - (t.children ? 13 : 3)}"/>`;
792
+ }
793
+ let v = t.ticks ? B(t.ticks) : void 0, S = (n ? e - 12 - (v ? I(v.text, 12, "mono") + 8 : 0) : s - 8) - a(t.depth) - I(o(t), 12), T = L(c.label, Math.max(24, S), 12, "sans", 1).lines[0], E = `<text class="tgc-ink tgc-lane-label" x="${a(t.depth)}" y="${h}" font-size="12">${j(T)}${t.hidden ? `<tspan class="tgc-ink-muted">${j(o(t))}</tspan>` : ""}</text>`, O = t.children ? `<path class="tgc-caret" d="${t.folded ? `M${i(t.depth)} ${f - 4}l6 4l-6 4z` : `M${i(t.depth) - 1} ${f - 3}h8l-4 6z`}"/>` : "", k = [
794
+ c.label,
795
+ ...H(c),
796
+ ...v ? [`Attempts: ${v.sentence}${t.hidden ? `, including ${t.hidden} folded ${R(t.hidden, "lane")}` : ""}`] : []
797
+ ].join("\n"), A = x && t.children ? ` data-toggle="${j(c.id)}" class="tgc-lane-toggle" role="button" tabindex="0" aria-expanded="${!t.folded}" aria-label="${j(`${t.folded ? "Unfold" : "Fold"} ${c.label}`)}"` : "", M = A ? re(i(t.depth) - 3, l + 1, (n ? e - 12 : s - 4) - i(t.depth) + 3, n ? 16 : m - 2, "tgc-lane-hit", "rx=\"3\"") : "";
798
+ w += `<g data-lane="${j(c.id)}" data-depth="${t.depth}"${t.folded ? ` data-folded="${t.hidden}"` : ""}><g${A}><title>${j(k)}</title>${M}${O}${E}</g>`;
799
+ for (let e of c.spans) {
800
+ let t = u(e.start), n = Math.max(1, u(d(e)) - t), r = y.has(e.state) ? ae(t, C(l), n, 14, "tgc-span tgc-span-missing") : re(t, C(l), n, 14, `tgc-span${b.has(e.state) ? " tgc-span-muted" : ""}${e.end === null ? " tgc-span-open" : ""}`, "rx=\"2\"");
801
+ w += de(ie(c, e), `<g data-state="${e.state.replace(/[^a-z0-9-]/gi, "")}"${e.end === null ? " data-open=\"true\"" : ""}>${r}</g>`);
802
+ }
803
+ if (t.ticks?.length && (w += tt(t.ticks, c.label, u, C(l), 14, _)), v) {
804
+ let r = n ? e - 12 : e - 16;
805
+ w += de(`${c.label}: ${v.sentence}${t.hidden ? ` across ${t.hidden + 1} lanes` : ""}`, `<text class="tgc-num tgc-count" x="${r}" y="${h}" font-size="12" text-anchor="end">${v.ok}<tspan class="tgc-count-ok">✓</tspan> ${v.failed}<tspan class="tgc-count-failed">✗</tspan></text>`);
806
+ }
807
+ w += "</g>";
808
+ });
809
+ for (let e of M) {
810
+ let t = p + O(e.lane) * m, r = C(t) + 7, i = u(e.at), a = Be(e.kind, i, r, n ? 3 : 3.5) || U(i, C(t) - 3, i, C(t) + 14 + 3, `tgc-mark tgc-mark-${e.kind}`), o = e.verdict ? ` data-verdict="${e.verdict}" class="tgc-verdict-${e.verdict}"` : "";
811
+ w += de(`${J(e)}: ${_(e.at)}${e.verdict ? ` · ${e.verdict}` : ""}`, `<g data-mark="${e.kind}" data-lane-mark="${j(e.lane)}"${o}>${a}</g>`);
812
+ }
813
+ return t.now !== void 0 && (w += U(u(t.now), p, u(t.now), S, "tgc-now") + ue(u(t.now), S + 30, `now ${_(t.now)}`, {
814
+ size: 12,
815
+ cls: "tgc-ink tgc-num",
816
+ anchor: u(t.now) > (s + c) / 2 ? "end" : "start"
817
+ })), V(e, S + (t.now === void 0 ? 22 : 36), w);
818
+ }, le = B(f), pe = e.some((e) => e.parent !== void 0 || e.depth), W = x && T.some((e) => e.children), me = pe || f.length || e.some((e) => e.ticks || H(e).length) ? fe(`${z(t.measure)}: lanes`, [
819
+ { label: "Lane" },
820
+ { label: "Started by" },
821
+ {
822
+ label: "Depth",
823
+ numeric: !0
824
+ },
825
+ {
826
+ label: "Attempts ok",
827
+ numeric: !0
828
+ },
829
+ {
830
+ label: "Attempts failed",
831
+ numeric: !0
832
+ },
833
+ { label: "Failed by outcome" },
834
+ { label: "Detail" }
835
+ ], e.map((e) => {
836
+ let t = e.ticks ? B(e.ticks) : void 0;
837
+ return [
838
+ e.label,
839
+ e.parent === void 0 ? "" : r.get(e.parent).label,
840
+ String(i.get(e.id)),
841
+ t ? String(t.ok) : "not recorded",
842
+ t ? String(t.failed) : "not recorded",
843
+ t?.why ?? "",
844
+ H(e).join(" · ")
845
+ ];
846
+ })) : "";
847
+ return {
848
+ id: n,
849
+ finding: `${z(t.measure)} across ${e.length} ${R(e.length, "lane")}, ${_(h)} to ${_(g)}.`,
850
+ lede: `${o.length} recorded ${R(o.length, "span")}; ${F} open${t.now === void 0 ? "" : ` at ${_(t.now)}`}; ${ee.length} without data (${_e(te)}).${f.length ? ` ${f.length} recorded ${R(f.length, "attempt")}: ${le.sentence}.` : ""}`,
851
+ read: [
852
+ `Each lane shows its recorded spans on one time axis. Muted spans are ${[...b].join(", ") || "none"}; hatched spans have no data; an open span runs to now.`,
853
+ ...pe ? [`An indented lane was started by the lane its connector leads to${W ? "; a caret folds a lane's subtree, and a folded lane's ticks and counts include its subtree" : ""}.`] : [],
854
+ ...oe ? ["Each tick is one recorded attempt: ok ticks rise above the bar and failed ticks drop below it in their outcome's colour; the counts at the right are ok (✓) and failed (✗)."] : [],
855
+ ...c.length + l.length ? [Ue] : []
856
+ ].join(" "),
857
+ svg: {
858
+ wide: ce(ne(t.width)),
859
+ narrow: ce(358),
860
+ ...W ? { interactive: !0 } : {}
861
+ },
862
+ table: me + fe(`${z(t.measure)} by lane`, [
863
+ { label: "Lane" },
864
+ { label: "State" },
865
+ {
866
+ label: "Start",
867
+ numeric: !0
868
+ },
869
+ {
870
+ label: "End",
871
+ numeric: !0
872
+ },
873
+ {
874
+ label: "Duration",
875
+ numeric: !0
876
+ },
877
+ { label: "Note" }
878
+ ], o.map(({ lane: e, span: t }) => [
879
+ e.label,
880
+ t.state,
881
+ _(t.start),
882
+ t.end === null ? "open" : _(t.end),
883
+ _e(d(t) - t.start),
884
+ t.note ?? ""
885
+ ])) + He(c, l, "time", _),
886
+ note: {
887
+ method: `Recorded span start and end times as supplied by the producer; open spans are drawn to the supplied now. No span is inferred, merged or reordered.${f.length ? " Ticks are recorded attempts at their recorded times; ticks of one outcome within 2 px are drawn as one, with the count in its hover." : ""}`,
888
+ n: `${o.length} spans${f.length ? ` and ${f.length} attempts` : ""} in ${e.length} lanes.`,
889
+ exclusions: [...ee.map(({ lane: e, span: t }) => `${e.label}: ${t.state} ${_(t.start)} to ${t.end === null ? "now" : _(t.end)} has no data.`), ...[...N, ...P].map((e) => `${J(e)} falls ${e.at < h ? `${_e(h - e.at)} before` : `${_e(e.at - g)} after`} the recorded window; it is named at the edge, not drawn.`)]
890
+ }
891
+ };
892
+ }
893
+ function tt(e, t, n, r, i, a) {
894
+ let o = /* @__PURE__ */ new Map();
895
+ for (let t of [...e].sort((e, t) => e.at - t.at)) {
896
+ let e = `${t.outcome}|${Math.round(n(t.at) / 2)}`;
897
+ o.set(e, [...o.get(e) ?? [], t]);
898
+ }
899
+ return `<g class="tgc-ticks">${[...o.values()].sort((e, t) => Number(e[0].outcome === "ok") - Number(t[0].outcome === "ok")).map((e) => {
900
+ let o = e[0], s = e.at(-1), c = o.outcome === "ok", l = n(e.reduce((e, t) => e + t.at, 0) / e.length), u = /* @__PURE__ */ new Map();
901
+ for (let t of e) t.note && u.set(t.note, (u.get(t.note) ?? 0) + 1);
902
+ let d = [...u].sort((e, t) => t[1] - e[1])[0]?.[0];
903
+ return de(`${t}: ${e.length > 1 ? `${e.length} × ` : ""}${o.outcome} ${a(o.at)}${e.length > 1 ? ` to ${a(s.at)}` : ""}${d ? ` · ${d.length > 160 ? `${d.slice(0, 159)}…` : d}` : ""}`, U(l, c ? r - 4 : r + i / 2, l, c ? r + i / 2 : r + i + 4, `tgc-tick tgc-tick-${o.outcome}`));
904
+ }).join("")}</g>`;
905
+ }
906
+ function nt(e, t, n, r, i, a) {
907
+ let o = (e) => {
908
+ let t = -Infinity;
909
+ for (let o of e) {
910
+ let e = I(a(o), 12, "mono"), s = n(o) - e / 2, c = n(o) + e / 2;
911
+ if (s < r - 14 || c > i + 14 || s < t + 10) return !1;
912
+ t = c;
913
+ }
914
+ return !0;
915
+ };
916
+ for (let n of $e) {
917
+ let r = [];
918
+ for (let i = Math.ceil(e / n) * n; i <= t && r.length <= 12; i += n) r.push(i);
919
+ if (r.length >= 2 && r.length <= 12 && o(r)) return r;
920
+ }
921
+ return o([e, t]) ? [e, t] : [e];
922
+ }
923
+ //#endregion
924
+ //#region node_modules/.pnpm/@tangle-network+charts@2.0.16_@xyflow+react@12.12.0_@types+react-dom@19.3.0_@types+reac_70059c26b484216dc6013bae841a163d/node_modules/@tangle-network/charts/dist/react/index.js
925
+ var Z = n(), Q = /* @__PURE__ */ e(t(), 1);
926
+ new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
927
+ var rt = [
928
+ "#8b7cf6",
929
+ "#0ea5a0",
930
+ "#c98500",
931
+ "#e2508f",
932
+ "#4a90e2"
933
+ ], it = (e) => e == null || !Number.isFinite(e) ? "—" : new Intl.NumberFormat("en-US", {
934
+ notation: "compact",
935
+ maximumFractionDigits: 1
936
+ }).format(e), at = (e) => e === null || !Number.isFinite(e) ? "—" : `${Math.round(e * 100)}%`;
937
+ function ot() {
938
+ let [e, t] = (0, Q.useState)(null), [n, r] = (0, Q.useState)({
939
+ width: 0,
940
+ em: 16
941
+ });
942
+ return (0, Q.useEffect)(() => {
943
+ if (!e) return;
944
+ let t = new ResizeObserver(([t]) => r({
945
+ width: Math.floor(t.contentRect.width),
946
+ em: parseFloat(getComputedStyle(e).fontSize) || 16
947
+ }));
948
+ return t.observe(e), () => t.disconnect();
949
+ }, [e]), [
950
+ t,
951
+ n.width,
952
+ n.em
953
+ ];
954
+ }
955
+ function st(e) {
956
+ if (!(e > 0)) return {
957
+ top: 1,
958
+ ticks: [
959
+ 0,
960
+ .5,
961
+ 1
962
+ ]
963
+ };
964
+ let t = 10 ** Math.floor(Math.log10(e)), n = [
965
+ 1,
966
+ 2,
967
+ 2.5,
968
+ 5,
969
+ 10
970
+ ].map((e) => e * t).find((t) => t * 4 >= e) ?? t * 10, r = Math.ceil(e / n) * n;
971
+ return {
972
+ top: r,
973
+ ticks: [
974
+ 0,
975
+ r / 2,
976
+ r
977
+ ]
978
+ };
979
+ }
980
+ function ct({ tip: e }) {
981
+ let t = (0, Q.useRef)(null), [n, r] = (0, Q.useState)({
982
+ left: 0,
983
+ top: 0
984
+ });
985
+ return (0, Q.useLayoutEffect)(() => {
986
+ let n = t.current, i = n?.parentElement;
987
+ if (!e || !n || !i) return;
988
+ let a = () => {
989
+ let t = {
990
+ left: Math.max(0, Math.min(e.x, i.clientWidth - n.offsetWidth)),
991
+ top: Math.max(0, Math.min(e.y, i.clientHeight - n.offsetHeight))
992
+ };
993
+ r((e) => e.left === t.left && e.top === t.top ? e : t);
994
+ };
995
+ a();
996
+ let o = new ResizeObserver(a);
997
+ return o.observe(n), o.observe(i), () => o.disconnect();
998
+ }, [e]), e ? /* @__PURE__ */ (0, Z.jsxs)("div", {
999
+ ref: t,
1000
+ className: "ov-tip",
1001
+ role: "tooltip",
1002
+ style: n,
1003
+ children: [/* @__PURE__ */ (0, Z.jsx)("strong", { children: e.title }), e.lines.map((e, t) => /* @__PURE__ */ (0, Z.jsxs)("span", {
1004
+ className: "ov-tip-line",
1005
+ children: [/* @__PURE__ */ (0, Z.jsxs)("span", { children: [e.color && /* @__PURE__ */ (0, Z.jsx)("i", { style: { background: e.color } }), e.label] }), /* @__PURE__ */ (0, Z.jsx)("b", { children: e.value })]
1006
+ }, `${e.label}:${t}`))]
1007
+ }) : null;
1008
+ }
1009
+ function lt({ days: e, series: t, format: n = it, rows: r = 13, missing: i = "No runs started", tick: a = (e) => e.slice(5), onOpen: o }) {
1010
+ let [s, c, l] = ot(), u = Math.round(r * l), [d, f] = (0, Q.useState)(null), p = e.map((e, n) => t.reduce((e, t) => e + (t.values[n] ?? 0), 0)), { top: m, ticks: h } = st(Math.max(...p)), g = Math.round(3.4 * l), _ = Math.round(1.8 * l), v = Math.max(0, c - g - 8), y = u - _ - 8, b = e.length ? v / e.length : 0, x = Math.max(3, b * .72), S = Math.max(1, Math.ceil(e.length / Math.max(1, Math.floor(v / (4.5 * l))))), C = Math.ceil(4.5 * l / Math.max(b, 1)), w = (e) => 8 + y - e / m * y;
1011
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
1012
+ ref: s,
1013
+ className: "ov-plot",
1014
+ onMouseLeave: () => f(null),
1015
+ children: [c > 0 && /* @__PURE__ */ (0, Z.jsxs)("svg", {
1016
+ width: c,
1017
+ height: u,
1018
+ role: "img",
1019
+ "aria-label": `${t.map((e) => e.name).join(", ")} per day`,
1020
+ children: [h.map((e) => /* @__PURE__ */ (0, Z.jsxs)("g", { children: [/* @__PURE__ */ (0, Z.jsx)("line", {
1021
+ x1: g,
1022
+ x2: c - 8,
1023
+ y1: w(e),
1024
+ y2: w(e),
1025
+ className: "ov-gridline"
1026
+ }), /* @__PURE__ */ (0, Z.jsx)("text", {
1027
+ x: g - l * .4,
1028
+ y: w(e),
1029
+ dominantBaseline: "middle",
1030
+ className: "ov-axis",
1031
+ textAnchor: "end",
1032
+ children: n(e)
1033
+ })] }, e)), e.map((r, s) => {
1034
+ let d = 0, m = g + s * b + (b - x) / 2, h = () => f({
1035
+ x: Math.min(g + s * b + b + 8, c - l * 14),
1036
+ y: 8,
1037
+ title: `${r} · ${t.every((e) => e.values[s] === null) ? i : n(p[s] ?? 0)}`,
1038
+ lines: t.map((e) => ({
1039
+ label: e.name,
1040
+ value: e.values[s] === null ? i : n(e.values[s] ?? 0),
1041
+ color: e.color
1042
+ }))
1043
+ });
1044
+ return /* @__PURE__ */ (0, Z.jsxs)("g", {
1045
+ role: o ? "button" : void 0,
1046
+ tabIndex: o ? 0 : void 0,
1047
+ "aria-label": o ? `Open ${r}` : void 0,
1048
+ onFocus: o ? h : void 0,
1049
+ onBlur: o ? () => f(null) : void 0,
1050
+ onKeyDown: o ? (e) => {
1051
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o(s));
1052
+ } : void 0,
1053
+ children: [
1054
+ t.map((e) => {
1055
+ let t = e.values[s] ?? 0;
1056
+ if (!t) return null;
1057
+ let n = w(d);
1058
+ d += t;
1059
+ let r = w(d);
1060
+ return /* @__PURE__ */ (0, Z.jsx)("rect", {
1061
+ x: m,
1062
+ y: r,
1063
+ width: x,
1064
+ height: Math.max(2, n - r - 2),
1065
+ rx: 2,
1066
+ fill: e.color
1067
+ }, e.name);
1068
+ }),
1069
+ (s === e.length - 1 || s % S === 0 && s + C <= e.length - 1) && /* @__PURE__ */ (0, Z.jsx)("text", {
1070
+ x: m + x / 2,
1071
+ y: u - l * .35,
1072
+ className: "ov-axis",
1073
+ textAnchor: "middle",
1074
+ children: a(r)
1075
+ }),
1076
+ /* @__PURE__ */ (0, Z.jsx)("rect", {
1077
+ x: g + s * b,
1078
+ y: 8,
1079
+ width: b,
1080
+ height: y,
1081
+ fill: "transparent",
1082
+ style: o ? { cursor: "pointer" } : void 0,
1083
+ onClick: o ? () => o(s) : void 0,
1084
+ onMouseEnter: h
1085
+ })
1086
+ ]
1087
+ }, r);
1088
+ })]
1089
+ }), /* @__PURE__ */ (0, Z.jsx)(ct, { tip: d })]
1090
+ });
1091
+ }
1092
+ function ut({ rows: e, format: t = it, color: n = rt[0], max: r, limit: i = 8 }) {
1093
+ let a = r ?? Math.max(1, ...e.map((e) => e.value));
1094
+ if (!e.length) return /* @__PURE__ */ (0, Z.jsx)("p", {
1095
+ className: "ov-empty",
1096
+ children: "Nothing recorded."
1097
+ });
1098
+ let o = e.slice(i);
1099
+ return /* @__PURE__ */ (0, Z.jsxs)("ol", {
1100
+ className: "ov-hbars",
1101
+ children: [e.slice(0, i).map((e) => {
1102
+ let r = e.title ?? `${e.label}: ${t(e.value)}`, i = /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
1103
+ /* @__PURE__ */ (0, Z.jsx)("span", {
1104
+ className: "ov-hbar-label",
1105
+ children: e.label
1106
+ }),
1107
+ /* @__PURE__ */ (0, Z.jsx)("span", {
1108
+ className: "ov-hbar-track",
1109
+ children: /* @__PURE__ */ (0, Z.jsx)("span", { style: {
1110
+ width: `${Math.max(1, e.value / a * 100)}%`,
1111
+ background: e.color ?? n
1112
+ } })
1113
+ }),
1114
+ /* @__PURE__ */ (0, Z.jsx)("span", {
1115
+ className: "ov-hbar-value",
1116
+ children: t(e.value)
1117
+ }),
1118
+ e.note && /* @__PURE__ */ (0, Z.jsx)("span", {
1119
+ className: "ov-hbar-note",
1120
+ children: e.note
1121
+ })
1122
+ ] });
1123
+ return /* @__PURE__ */ (0, Z.jsx)("li", { children: e.href ? /* @__PURE__ */ (0, Z.jsx)("a", {
1124
+ href: e.href,
1125
+ title: r,
1126
+ children: i
1127
+ }) : /* @__PURE__ */ (0, Z.jsx)("div", {
1128
+ title: r,
1129
+ children: i
1130
+ }) }, e.label);
1131
+ }), o.length > 0 && /* @__PURE__ */ (0, Z.jsxs)("li", {
1132
+ className: "ov-hbars-more",
1133
+ children: [
1134
+ "+",
1135
+ o.length,
1136
+ " more · ",
1137
+ t(o.reduce((e, t) => e + t.value, 0))
1138
+ ]
1139
+ })]
1140
+ });
1141
+ }
1142
+ function dt({ series: e, format: t = it, rows: n = 13, axis: r, marks: i = [], bands: a = [] }) {
1143
+ let [o, s, c] = ot(), l = Math.round(n * c), [u, d] = (0, Q.useState)(null), f = q(i, a);
1144
+ if (f) throw RangeError(f);
1145
+ let p = e.flatMap((e) => e.points);
1146
+ if (!p.length) return /* @__PURE__ */ (0, Z.jsx)("p", {
1147
+ className: "ov-empty",
1148
+ children: "No history yet."
1149
+ });
1150
+ let m = [
1151
+ ...p.map((e) => e[0]),
1152
+ ...i.map((e) => e.at),
1153
+ ...a.flatMap((e) => [e.from, e.to])
1154
+ ], h = Math.min(...m), g = Math.max(...m), { top: _, ticks: v } = st(Math.max(...p.map((e) => e[1]))), y = Math.round(3.4 * c), b = Math.round(1.8 * c), x = Math.max(0, s - y - 10), S = l - b - 8, C = (e) => y + (g > h ? (e - h) / (g - h) * x : 0), w = (e) => 8 + S - e / _ * S, T = (e, t) => e.reduce((e, n) => Math.abs(n[0] - t) < Math.abs(e[0] - t) ? n : e, e[0]), E = (e) => new Date(e).toISOString().slice(5, 16).replace("T", " ");
1155
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
1156
+ ref: o,
1157
+ className: "ov-plot",
1158
+ onMouseMove: (e) => {
1159
+ let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left;
1160
+ d(n >= y ? h + (n - y) / Math.max(1, x) * (g - h) : null);
1161
+ },
1162
+ onMouseLeave: () => d(null),
1163
+ children: [
1164
+ s > 0 && /* @__PURE__ */ (0, Z.jsxs)("svg", {
1165
+ width: s,
1166
+ height: l,
1167
+ role: "img",
1168
+ "aria-label": e.map((e) => e.name).join(", "),
1169
+ children: [
1170
+ v.map((e) => /* @__PURE__ */ (0, Z.jsxs)("g", { children: [/* @__PURE__ */ (0, Z.jsx)("line", {
1171
+ x1: y,
1172
+ x2: s - 10,
1173
+ y1: w(e),
1174
+ y2: w(e),
1175
+ className: "ov-gridline"
1176
+ }), /* @__PURE__ */ (0, Z.jsx)("text", {
1177
+ x: y - c * .4,
1178
+ y: w(e),
1179
+ dominantBaseline: "middle",
1180
+ className: "ov-axis",
1181
+ textAnchor: "end",
1182
+ children: t(e)
1183
+ })] }, e)),
1184
+ [
1185
+ h,
1186
+ (h + g) / 2,
1187
+ g
1188
+ ].map((e, t) => /* @__PURE__ */ (0, Z.jsx)("text", {
1189
+ x: C(e),
1190
+ y: l - c * .35,
1191
+ className: "ov-axis",
1192
+ textAnchor: t === 0 ? "start" : t === 2 ? "end" : "middle",
1193
+ children: r ? r(e) : E(e).slice(0, 5)
1194
+ }, t)),
1195
+ a.map((e, t) => /* @__PURE__ */ (0, Z.jsx)(pt, {
1196
+ band: e,
1197
+ x: C(e.from),
1198
+ y: 8,
1199
+ width: C(e.to) - C(e.from),
1200
+ height: S
1201
+ }, `band-${t}`)),
1202
+ e.map((e) => e.dots ? /* @__PURE__ */ (0, Z.jsx)("g", { children: e.points.map((t) => /* @__PURE__ */ (0, Z.jsx)("circle", {
1203
+ cx: C(t[0]),
1204
+ cy: w(t[1]),
1205
+ r: Math.max(3, c / 5),
1206
+ fill: e.color,
1207
+ stroke: "var(--chart-live-surface, #fff)",
1208
+ strokeWidth: 1.5
1209
+ }, t[0])) }, e.name) : /* @__PURE__ */ (0, Z.jsxs)("g", {
1210
+ "data-series": e.name,
1211
+ "data-dash": e.dash ?? "solid",
1212
+ "data-marker": e.marker,
1213
+ children: [/* @__PURE__ */ (0, Z.jsx)("polyline", {
1214
+ fill: "none",
1215
+ stroke: e.color,
1216
+ strokeWidth: Math.max(2, c / 8),
1217
+ strokeLinejoin: "round",
1218
+ strokeLinecap: e.dash === "dot" ? "round" : void 0,
1219
+ strokeDasharray: ft(e.dash, c),
1220
+ points: e.points.map((e) => `${C(e[0])},${w(e[1])}`).join(" ")
1221
+ }), e.marker && (e.points.length <= 30 ? e.points : e.points.slice(-1)).map((t) => /* @__PURE__ */ (0, Z.jsx)("path", {
1222
+ d: ce(e.marker, C(t[0]), w(t[1]), Math.max(3, c / 5)),
1223
+ fill: e.color,
1224
+ stroke: "var(--chart-live-surface, var(--chart-canvas))",
1225
+ strokeWidth: 1.5
1226
+ }, t[0]))]
1227
+ }, e.name)),
1228
+ [...i].sort((e, t) => e.at - t.at).map((e, t) => /* @__PURE__ */ (0, Z.jsx)(mt, {
1229
+ mark: e,
1230
+ x: C(e.at),
1231
+ top: 8,
1232
+ bottom: 8 + S,
1233
+ row: t % 3,
1234
+ em: c,
1235
+ flip: C(e.at) > y + x * .62
1236
+ }, `mark-${t}`)),
1237
+ u !== null && /* @__PURE__ */ (0, Z.jsx)("line", {
1238
+ x1: C(u),
1239
+ x2: C(u),
1240
+ y1: 8,
1241
+ y2: 8 + S,
1242
+ className: "ov-crosshair"
1243
+ }),
1244
+ u !== null && e.map((e) => {
1245
+ let t = e.points.length ? T(e.points, u) : null;
1246
+ return t ? /* @__PURE__ */ (0, Z.jsx)("circle", {
1247
+ cx: C(t[0]),
1248
+ cy: w(t[1]),
1249
+ r: Math.max(4, c / 4),
1250
+ fill: e.color,
1251
+ stroke: "var(--chart-live-surface, #fff)",
1252
+ strokeWidth: 2
1253
+ }, e.name) : null;
1254
+ })
1255
+ ]
1256
+ }),
1257
+ u !== null && /* @__PURE__ */ (0, Z.jsx)(ct, { tip: {
1258
+ x: Math.min(C(u) + 10, s - c * 14),
1259
+ y: 8,
1260
+ title: r ? r(u) : E(u),
1261
+ lines: e.filter((e) => e.points.length).map((e) => {
1262
+ let n = T(e.points, u);
1263
+ return {
1264
+ label: e.label ? e.label(n[0]) : e.name,
1265
+ value: t(n[1]),
1266
+ color: e.color
1267
+ };
1268
+ })
1269
+ } }),
1270
+ e.length > 1 && e.some((e) => e.dash || e.marker) && /* @__PURE__ */ (0, Z.jsx)("ul", {
1271
+ className: "ov-key",
1272
+ "aria-label": "Series",
1273
+ children: e.map((e) => /* @__PURE__ */ (0, Z.jsxs)("li", { children: [/* @__PURE__ */ (0, Z.jsxs)("svg", {
1274
+ width: c * 2,
1275
+ height: c,
1276
+ "aria-hidden": "true",
1277
+ children: [/* @__PURE__ */ (0, Z.jsx)("line", {
1278
+ x1: 0,
1279
+ x2: c * 2,
1280
+ y1: c / 2,
1281
+ y2: c / 2,
1282
+ stroke: e.color,
1283
+ strokeWidth: Math.max(2, c / 8),
1284
+ strokeDasharray: ft(e.dash, c),
1285
+ strokeLinecap: e.dash === "dot" ? "round" : void 0
1286
+ }), e.marker && /* @__PURE__ */ (0, Z.jsx)("path", {
1287
+ d: ce(e.marker, c, c / 2, Math.max(3, c / 5)),
1288
+ fill: e.color
1289
+ })]
1290
+ }), e.name] }, e.name))
1291
+ }),
1292
+ /* @__PURE__ */ (0, Z.jsx)(ht, {
1293
+ marks: i,
1294
+ bands: a,
1295
+ format: r ?? ((e) => E(e))
1296
+ })
1297
+ ]
1298
+ });
1299
+ }
1300
+ function ft(e, t) {
1301
+ return e === "dash" ? `${Math.round(t * .55)} ${Math.round(t * .3)}` : e === "dot" ? `0.1 ${Math.round(t * .35)}` : void 0;
1302
+ }
1303
+ function pt({ band: e, x: t, y: n, width: r, height: i }) {
1304
+ return /* @__PURE__ */ (0, Z.jsxs)("g", {
1305
+ "data-band": e.kind,
1306
+ "data-hatched": e.kind === "missing" ? "true" : void 0,
1307
+ children: [
1308
+ /* @__PURE__ */ (0, Z.jsx)("title", { children: e.label }),
1309
+ /* @__PURE__ */ (0, Z.jsx)("rect", {
1310
+ x: t,
1311
+ y: n,
1312
+ width: Math.max(0, r),
1313
+ height: i,
1314
+ className: e.kind === "missing" ? "ov-hatch-bg" : `ov-band ov-band-${e.kind}`
1315
+ }),
1316
+ e.kind === "missing" && /* @__PURE__ */ (0, Z.jsx)("path", {
1317
+ d: ie(t, n, r, i),
1318
+ className: "ov-hatch"
1319
+ })
1320
+ ]
1321
+ });
1322
+ }
1323
+ function mt({ mark: e, x: t, top: n, bottom: r, row: i, em: a, flip: o }) {
1324
+ let s = Math.max(3, a / 4), c = Ne[e.kind];
1325
+ return /* @__PURE__ */ (0, Z.jsxs)("g", {
1326
+ "data-mark": e.kind,
1327
+ "data-verdict": e.verdict,
1328
+ className: e.verdict ? `ov-verdict-${e.verdict}` : void 0,
1329
+ children: [
1330
+ /* @__PURE__ */ (0, Z.jsx)("title", { children: J(e) }),
1331
+ /* @__PURE__ */ (0, Z.jsx)("line", {
1332
+ x1: t,
1333
+ x2: t,
1334
+ y1: n,
1335
+ y2: r,
1336
+ className: `ov-mark ov-mark-${e.kind}`
1337
+ }),
1338
+ e.kind === "died" && /* @__PURE__ */ (0, Z.jsx)("path", {
1339
+ d: `M${t - s} ${r - 2 * s}L${t + s} ${r}M${t - s} ${r}L${t + s} ${r - 2 * s}`,
1340
+ className: "ov-mark ov-mark-died"
1341
+ }),
1342
+ c && /* @__PURE__ */ (0, Z.jsx)("path", {
1343
+ d: ce(c, t, n + s, s),
1344
+ className: "ov-mark-head"
1345
+ }),
1346
+ /* @__PURE__ */ (0, Z.jsx)("text", {
1347
+ x: o ? t - a * .3 : t + a * .3,
1348
+ y: n + a * (.9 + i),
1349
+ textAnchor: o ? "end" : "start",
1350
+ className: "ov-mark-label",
1351
+ children: J(e)
1352
+ })
1353
+ ]
1354
+ });
1355
+ }
1356
+ function ht({ marks: e, bands: t, format: n }) {
1357
+ if (!e.length && !t.length) return null;
1358
+ let r = [...e.map((e) => ({
1359
+ at: e.at,
1360
+ kind: e.kind,
1361
+ text: `${J(e)} · ${n(e.at)}${e.verdict ? ` · ${e.verdict}` : ""}`
1362
+ })), ...t.map((e) => ({
1363
+ at: e.from,
1364
+ kind: e.kind,
1365
+ text: `${e.label} · ${n(e.from)} to ${n(e.to)}${e.kind === "missing" ? " · no data" : ""}`
1366
+ }))].sort((e, t) => e.at - t.at);
1367
+ return /* @__PURE__ */ (0, Z.jsx)("ul", {
1368
+ className: "ov-events",
1369
+ "aria-label": "Recorded events",
1370
+ children: r.map((e, t) => /* @__PURE__ */ (0, Z.jsxs)("li", {
1371
+ "data-kind": e.kind,
1372
+ children: [/* @__PURE__ */ (0, Z.jsx)("i", {
1373
+ className: `ov-event-swatch ov-event-${e.kind}`,
1374
+ "aria-hidden": "true"
1375
+ }), e.text]
1376
+ }, t))
1377
+ });
1378
+ }
1379
+ var gt = [
1380
+ "var(--chart-accent)",
1381
+ "var(--chart-tier-c)",
1382
+ "var(--chart-muted)"
1383
+ ];
1384
+ function _t({ used: e, total: t, format: n = it, tone: r, text: i, segments: a, steps: o, untraced: s = "untraced" }) {
1385
+ if (o) {
1386
+ let e = o.findIndex((e) => e.state !== "pass");
1387
+ return /* @__PURE__ */ (0, Z.jsx)("ol", {
1388
+ className: "ov-meter-steps",
1389
+ "aria-label": i ?? "Check steps",
1390
+ children: o.map((t, n) => /* @__PURE__ */ (0, Z.jsxs)("li", {
1391
+ "data-state": t.state,
1392
+ "aria-current": n === e ? "step" : void 0,
1393
+ children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
1394
+ className: "ov-step-head",
1395
+ children: [/* @__PURE__ */ (0, Z.jsx)("strong", { children: n + 1 }), /* @__PURE__ */ (0, Z.jsx)("small", {
1396
+ className: "ov-step-state",
1397
+ children: t.state === "pass" ? "Pass" : t.state === "fail" ? "Stuck" : "Unchecked"
1398
+ })]
1399
+ }), /* @__PURE__ */ (0, Z.jsx)("span", { children: t.label })]
1400
+ }, n))
1401
+ });
1402
+ }
1403
+ if (a) return /* @__PURE__ */ (0, Z.jsx)(vt, {
1404
+ segments: a,
1405
+ total: t,
1406
+ format: n,
1407
+ text: i,
1408
+ untraced: s
1409
+ });
1410
+ let c = e != null && t ? Math.min(1, e / t) : null;
1411
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
1412
+ className: "ov-meter",
1413
+ children: [/* @__PURE__ */ (0, Z.jsx)("span", {
1414
+ className: "ov-meter-track",
1415
+ children: /* @__PURE__ */ (0, Z.jsx)("span", { style: {
1416
+ width: `${(c ?? 0) * 100}%`,
1417
+ background: r ?? (c !== null && c > .9 ? "var(--chart-live-danger, #d85050)" : c !== null && c > .7 ? "var(--chart-live-warning, #c98500)" : rt[0])
1418
+ } })
1419
+ }), /* @__PURE__ */ (0, Z.jsx)("span", {
1420
+ className: "ov-meter-text",
1421
+ children: i ?? `${n(e ?? NaN)} of ${n(t ?? NaN)} · ${at(c)}`
1422
+ })]
1423
+ });
1424
+ }
1425
+ function vt({ segments: e, total: t, format: n, text: r, untraced: i }) {
1426
+ for (let t of e) if (t.value !== null && (!Number.isFinite(t.value) || t.value < 0)) throw RangeError(`${t.label}: a segment value must be a nonnegative finite number or null.`);
1427
+ let a = e.reduce((e, t) => e + (t.value ?? 0), 0), o = t != null && Number.isFinite(t) && t > 0 ? t : null;
1428
+ if (o !== null && a > o * (1 + 1e-9)) throw RangeError(`Segments sum to ${a}, more than the total ${o}.`);
1429
+ let s = o === null ? 0 : o - a, c = [...e.map((e, t) => ({
1430
+ ...e,
1431
+ color: e.color ?? gt[t % gt.length],
1432
+ remainder: !1
1433
+ })), ...s > o * 1e-9 ? [{
1434
+ label: i,
1435
+ value: s,
1436
+ kind: "untraced",
1437
+ color: void 0,
1438
+ remainder: !0
1439
+ }] : []], l = (e) => o === null ? null : e / o;
1440
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
1441
+ className: "ov-meter",
1442
+ "data-segmented": "true",
1443
+ children: [
1444
+ /* @__PURE__ */ (0, Z.jsx)("span", {
1445
+ className: `ov-meter-track${o === null ? " ov-hatched" : ""}`,
1446
+ "data-hatched": o === null ? "true" : void 0,
1447
+ "aria-hidden": "true",
1448
+ children: o !== null && c.filter((e) => e.value !== null && e.value > 0).map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
1449
+ "data-segment": e.label,
1450
+ "data-hatched": e.kind === "untraced" ? "true" : void 0,
1451
+ className: e.kind === "untraced" ? "ov-hatched" : void 0,
1452
+ style: {
1453
+ width: `${e.value / o * 100}%`,
1454
+ background: e.kind === "untraced" ? void 0 : e.color
1455
+ }
1456
+ }, e.label))
1457
+ }),
1458
+ /* @__PURE__ */ (0, Z.jsx)("ul", {
1459
+ className: "ov-meter-key",
1460
+ children: c.map((e) => /* @__PURE__ */ (0, Z.jsxs)("li", {
1461
+ "data-segment": e.label,
1462
+ children: [
1463
+ /* @__PURE__ */ (0, Z.jsx)("i", {
1464
+ className: e.kind === "untraced" || e.value === null ? "ov-hatched" : void 0,
1465
+ style: e.kind === "untraced" || e.value === null ? void 0 : { background: e.color },
1466
+ "aria-hidden": "true"
1467
+ }),
1468
+ /* @__PURE__ */ (0, Z.jsx)("span", { children: e.label }),
1469
+ /* @__PURE__ */ (0, Z.jsx)("b", { children: e.value === null ? "not recorded" : `${n(e.value)}${o === null ? "" : ` · ${at(l(e.value))}`}` })
1470
+ ]
1471
+ }, e.label))
1472
+ }),
1473
+ /* @__PURE__ */ (0, Z.jsx)("span", {
1474
+ className: "ov-meter-text",
1475
+ children: r ?? (o === null ? "total not recorded" : `${n(a)} of ${n(o)} accounted · ${at(a / o)}`)
1476
+ })
1477
+ ]
1478
+ });
1479
+ }
1480
+ function yt({ rows: e, lanes: t, colors: n, axis: r, span: i, marks: a = [], now: o, hatch: s = ["missing", "untraced"], selectedId: c, onSelect: l, bestMark: u, maxHeight: d }) {
1481
+ let [f, p, m] = ot(), [h, g] = (0, Q.useState)(null), _ = (0, Q.useRef)(null), [v, y] = (0, Q.useState)(0), b = t ?? (e ?? []).map((e, t) => ({
1482
+ id: `${e.label}-${t}`,
1483
+ label: e.label,
1484
+ spans: [{
1485
+ start: e.start,
1486
+ end: e.end,
1487
+ state: e.state,
1488
+ note: e.note
1489
+ }]
1490
+ })), x = q(a);
1491
+ if (x) throw RangeError(x);
1492
+ if (o !== void 0 && !Number.isFinite(o)) throw RangeError("now must be a finite time.");
1493
+ if (t) for (let e of b) for (let t of e.spans) {
1494
+ if (!Number.isFinite(t.start) || t.end !== null && (!Number.isFinite(t.end) || t.end < t.start)) throw RangeError(`${e.label}: span times must be finite and end at or after their start.`);
1495
+ if (t.end === null && (o === void 0 || o < t.start)) throw RangeError(`${e.label}: an open span needs a now at or after its start.`);
1496
+ }
1497
+ let S = b.flatMap((e) => e.spans);
1498
+ if (!S.length) return /* @__PURE__ */ (0, Z.jsx)("p", {
1499
+ className: "ov-empty",
1500
+ children: "No agent has started."
1501
+ });
1502
+ let C = (e) => e.end ?? o, w = p < 600, T = Math.round((w ? 2.8 : 2.2) * m), E = w ? 8 : Math.min(Math.round(16 * m), Math.round(p * .28)), D = d ? 4 : a.length ? 48 : 8, O = w ? [
1503
+ 0,
1504
+ .5,
1505
+ 1
1506
+ ] : [
1507
+ 0,
1508
+ .25,
1509
+ .5,
1510
+ .75,
1511
+ 1
1512
+ ], k = Math.round(1.8 * m), A = D + b.length * T + k, j = [
1513
+ ...S.flatMap((e) => [e.start, C(e)]),
1514
+ ...a.map((e) => e.at),
1515
+ ...o === void 0 ? [] : [o]
1516
+ ], M = Math.min(...j), N = Math.max(...j, M + 6e4), P = Math.max(0, p - E - 10), F = (e) => E + (e - M) / (N - M) * P, ee = n.unknown ?? "var(--chart-live-faint, var(--chart-muted))", te = [...a].sort((e, t) => e.at - t.at), R = te.find((e) => e.label === u), z = new Set(R ? [R] : []), ne = R ? [F(R.at)] : [], B = Math.max(1, Math.ceil(a.length / Math.max(1, Math.floor(P / (6 * m)))));
1517
+ te.forEach((e, t) => {
1518
+ t % B === 0 && ne.every((t) => Math.abs(t - F(e.at)) >= 5 * m) && (z.add(e), ne.push(F(e.at)));
1519
+ });
1520
+ let V = new Set(s), H = D + b.length * T, re = d ? Math.max(0, Math.floor((v - D) / T) - 6) : 0, ae = d ? b.slice(re, re + Math.ceil(d / T) + 14) : b, U = (e) => l?.(e), oe = (e) => {
1521
+ let t = Math.max(0, Math.min(b.length - 1, e)), n = t === 0 ? 0 : D + t * T - T;
1522
+ _.current && (_.current.scrollTop = n), y(Math.max(0, n)), requestAnimationFrame(() => _.current?.querySelector(`[data-lane-index="${t}"]`)?.focus());
1523
+ }, se = (e) => Math.max(0, e - (d ? v - 52 : 0) - m), ce = (e) => Math.max(0, Math.min(e + 8, p - Math.min(240, p)));
1524
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
1525
+ ref: f,
1526
+ className: "ov-plot ov-gantt",
1527
+ "data-featured": u ? !0 : void 0,
1528
+ onMouseLeave: () => g(null),
1529
+ children: [
1530
+ d && p > 0 && /* @__PURE__ */ (0, Z.jsxs)("svg", {
1531
+ width: p,
1532
+ height: 52,
1533
+ "aria-label": "Releases and time axis",
1534
+ children: [te.map((e, t) => /* @__PURE__ */ (0, Z.jsxs)("g", {
1535
+ tabIndex: 0,
1536
+ role: "img",
1537
+ "aria-label": J(e),
1538
+ "data-labelled": u ? z.has(e) : void 0,
1539
+ "data-best": e.label === u || void 0,
1540
+ children: [/* @__PURE__ */ (0, Z.jsx)(mt, {
1541
+ mark: e,
1542
+ x: F(e.at),
1543
+ top: 10,
1544
+ bottom: 28,
1545
+ row: 0,
1546
+ em: m,
1547
+ flip: F(e.at) > p * .62
1548
+ }), e.label === u && /* @__PURE__ */ (0, Z.jsx)("circle", {
1549
+ cx: F(e.at),
1550
+ cy: 14,
1551
+ r: 8,
1552
+ fill: "none",
1553
+ stroke: "var(--accent-text)",
1554
+ strokeWidth: 2
1555
+ })]
1556
+ }, t)), O.map((e) => /* @__PURE__ */ (0, Z.jsx)("text", {
1557
+ x: E + e * P,
1558
+ y: 46,
1559
+ className: "ov-axis",
1560
+ textAnchor: e === 0 ? "start" : e === 1 ? "end" : "middle",
1561
+ children: r(M + e * (N - M))
1562
+ }, e))]
1563
+ }),
1564
+ /* @__PURE__ */ (0, Z.jsx)("div", {
1565
+ ref: _,
1566
+ className: "ov-gantt-scroll",
1567
+ style: {
1568
+ maxHeight: d,
1569
+ overflow: d ? "auto" : void 0
1570
+ },
1571
+ onScroll: (e) => {
1572
+ y(e.currentTarget.scrollTop), g(null);
1573
+ },
1574
+ children: p > 0 && /* @__PURE__ */ (0, Z.jsxs)("svg", {
1575
+ width: p,
1576
+ height: A,
1577
+ role: l ? "group" : "img",
1578
+ "aria-label": `${b.length} ${t ? "lanes" : "agents"} over time`,
1579
+ children: [
1580
+ O.map((e) => /* @__PURE__ */ (0, Z.jsxs)("g", { children: [/* @__PURE__ */ (0, Z.jsx)("line", {
1581
+ x1: E + e * P,
1582
+ x2: E + e * P,
1583
+ y1: D,
1584
+ y2: H,
1585
+ className: "ov-gridline"
1586
+ }), !d && /* @__PURE__ */ (0, Z.jsx)("text", {
1587
+ x: E + e * P,
1588
+ y: A - m * .35,
1589
+ className: "ov-axis",
1590
+ textAnchor: e === 0 ? "start" : e === 1 ? "end" : "middle",
1591
+ children: r(M + e * (N - M))
1592
+ })] }, e)),
1593
+ ae.map((e, t) => {
1594
+ let r = re + t, a = D + r * T, o = typeof e.count == "number" && Number.isFinite(e.count) ? ` · ${e.count.toLocaleString()}` : "", s = L(e.label, Math.max(40, (w ? p - 16 : E - m) - I(o, 13)), 13, "sans", 1).lines[0], u = e.spans.length ? e.spans.reduce((e, t) => C(t) >= C(e) ? t : e) : void 0, d = c === e.id && u?.endLabel ? L(u.endLabel, Math.max(40, P - 16), 13, "sans", 1).lines[0] : void 0;
1595
+ return /* @__PURE__ */ (0, Z.jsxs)("g", {
1596
+ "data-lane": e.id,
1597
+ "data-lane-index": r,
1598
+ role: l ? "button" : void 0,
1599
+ tabIndex: l ? 0 : void 0,
1600
+ "aria-label": e.label,
1601
+ "aria-pressed": l ? c === e.id : void 0,
1602
+ onMouseEnter: () => g({
1603
+ x: ce(F(C(e.spans.at(-1) ?? { end: N }))),
1604
+ y: se(a),
1605
+ title: e.label,
1606
+ lines: e.spans.flatMap((e) => [
1607
+ {
1608
+ label: e.end === null ? `${e.state} (open)` : e.state,
1609
+ value: i(e.start, C(e)),
1610
+ color: V.has(e.state) ? void 0 : n[e.state] ?? ee
1611
+ },
1612
+ ...e.note ? [{
1613
+ label: e.note,
1614
+ value: ""
1615
+ }] : [],
1616
+ ...e.endLabel ? [{
1617
+ label: "Duration / cost",
1618
+ value: e.endLabel
1619
+ }] : []
1620
+ ])
1621
+ }),
1622
+ onClick: () => U(e.id),
1623
+ onKeyDown: (t) => {
1624
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), U(e.id));
1625
+ let n = {
1626
+ ArrowDown: r + 1,
1627
+ ArrowUp: r - 1,
1628
+ Home: 0,
1629
+ End: b.length - 1
1630
+ }[t.key];
1631
+ n !== void 0 && (t.preventDefault(), oe(n));
1632
+ },
1633
+ children: [
1634
+ c === e.id && /* @__PURE__ */ (0, Z.jsx)("rect", {
1635
+ x: 0,
1636
+ y: a,
1637
+ width: p,
1638
+ height: T,
1639
+ fill: "var(--ix-sel-bg)",
1640
+ rx: 4
1641
+ }),
1642
+ /* @__PURE__ */ (0, Z.jsx)("rect", {
1643
+ x: 0,
1644
+ y: a,
1645
+ width: p,
1646
+ height: T,
1647
+ fill: "transparent"
1648
+ }),
1649
+ /* @__PURE__ */ (0, Z.jsxs)("text", {
1650
+ x: w ? 8 : E - m * .5,
1651
+ y: w ? a + 13 : a + T / 2,
1652
+ dominantBaseline: "middle",
1653
+ textAnchor: w ? "start" : "end",
1654
+ className: "ov-axis ov-gantt-label",
1655
+ children: [
1656
+ /* @__PURE__ */ (0, Z.jsxs)("title", { children: [
1657
+ e.label,
1658
+ o,
1659
+ o && e.countLabel ? ` ${e.countLabel}` : ""
1660
+ ] }),
1661
+ s,
1662
+ o && /* @__PURE__ */ (0, Z.jsx)("tspan", {
1663
+ className: "ov-gantt-count",
1664
+ children: o
1665
+ })
1666
+ ]
1667
+ }),
1668
+ e.spans.map((t, r) => {
1669
+ let o = n[t.state] ?? ee, s = F(t.start), c = Math.max(2, F(C(t)) - s), l = a + (w ? 24 : T * .25), u = T * .5, d = t.end === null;
1670
+ return /* @__PURE__ */ (0, Z.jsx)("g", {
1671
+ "data-state": t.state,
1672
+ "data-open": d ? "true" : void 0,
1673
+ "data-hatched": V.has(t.state) ? "true" : void 0,
1674
+ onMouseEnter: () => g({
1675
+ x: ce(s + c),
1676
+ y: se(a),
1677
+ title: e.label,
1678
+ lines: [
1679
+ {
1680
+ label: d ? `${t.state} (open)` : t.state,
1681
+ value: i(t.start, C(t)),
1682
+ color: V.has(t.state) ? void 0 : o
1683
+ },
1684
+ ...t.note ? [{
1685
+ label: t.note,
1686
+ value: ""
1687
+ }] : [],
1688
+ ...t.endLabel ? [{
1689
+ label: "Duration / cost",
1690
+ value: t.endLabel
1691
+ }] : []
1692
+ ]
1693
+ }),
1694
+ children: V.has(t.state) ? /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("rect", {
1695
+ x: s,
1696
+ y: l,
1697
+ width: c,
1698
+ height: u,
1699
+ className: "ov-hatch-bg"
1700
+ }), /* @__PURE__ */ (0, Z.jsx)("path", {
1701
+ d: ie(s, l, c, u, 4),
1702
+ className: "ov-hatch"
1703
+ })] }) : /* @__PURE__ */ (0, Z.jsx)("rect", {
1704
+ x: s,
1705
+ y: l,
1706
+ width: c,
1707
+ height: u,
1708
+ rx: 2,
1709
+ fill: o,
1710
+ className: d ? "ov-gantt-open" : void 0
1711
+ })
1712
+ }, r);
1713
+ }),
1714
+ d && /* @__PURE__ */ (0, Z.jsxs)("text", {
1715
+ className: "ov-gantt-end",
1716
+ x: Math.max(E + 8, Math.min(F(C(u)) + 8, p - I(d, 13) - 8)),
1717
+ y: a + (w ? 24 : T * .25) + T * .25,
1718
+ dominantBaseline: "middle",
1719
+ children: [/* @__PURE__ */ (0, Z.jsx)("title", { children: u?.endLabel }), d]
1720
+ })
1721
+ ]
1722
+ }, e.id);
1723
+ }),
1724
+ o !== void 0 && /* @__PURE__ */ (0, Z.jsx)("line", {
1725
+ x1: F(o),
1726
+ x2: F(o),
1727
+ y1: D,
1728
+ y2: H,
1729
+ className: "ov-now",
1730
+ "data-now": "true"
1731
+ }),
1732
+ te.map((e, t) => /* @__PURE__ */ (0, Z.jsxs)("g", {
1733
+ className: e.verdict ? `ov-verdict-${e.verdict}` : void 0,
1734
+ "data-labelled": !d && u ? z.has(e) : void 0,
1735
+ "data-best": e.label === u || void 0,
1736
+ style: d ? { pointerEvents: "none" } : void 0,
1737
+ children: [
1738
+ d && /* @__PURE__ */ (0, Z.jsx)("line", {
1739
+ x1: F(e.at),
1740
+ x2: F(e.at),
1741
+ y1: D,
1742
+ y2: H,
1743
+ className: `ov-mark ov-mark-${e.kind}`,
1744
+ style: { opacity: e.label === u ? .8 : .3 }
1745
+ }),
1746
+ !d && /* @__PURE__ */ (0, Z.jsx)(mt, {
1747
+ mark: e,
1748
+ x: F(e.at),
1749
+ top: 4,
1750
+ bottom: H,
1751
+ row: t % 2,
1752
+ em: m,
1753
+ flip: F(e.at) > E + P * .62
1754
+ }),
1755
+ !d && e.label === u && /* @__PURE__ */ (0, Z.jsx)("circle", {
1756
+ cx: F(e.at),
1757
+ cy: 4 + Math.max(3, m / 4),
1758
+ r: 8,
1759
+ fill: "none",
1760
+ stroke: "var(--accent-text)",
1761
+ strokeWidth: 2
1762
+ })
1763
+ ]
1764
+ }, `mark-${t}`))
1765
+ ]
1766
+ })
1767
+ }),
1768
+ /* @__PURE__ */ (0, Z.jsx)(ct, { tip: h }),
1769
+ /* @__PURE__ */ (0, Z.jsx)(ht, {
1770
+ marks: a,
1771
+ bands: [],
1772
+ format: r
1773
+ })
1774
+ ]
1775
+ });
1776
+ }
1777
+ var bt = 24, xt = bt / 2;
1778
+ function St({ value: e, bound: t = null, target: n, stretch: r = null, scale: i = "log", format: a = it, tone: o = "var(--chart-live-accent, #8b7cf6)", titles: s = {}, label: c }) {
1779
+ let [l, u] = ot(), d = i === "log" && e > 0 && n.min > 0, f = (e) => d ? Math.log10(e) : e, p = [
1780
+ e,
1781
+ n.min,
1782
+ n.max,
1783
+ ...r ? [r.min, r.max] : []
1784
+ ].map(f), m = Math.min(...p), h = Math.max(...p), g = Math.max((h - m) * .08, d ? .15 : Math.abs(h) * .05 || 1), _ = (e) => u ? (f(e) - (m - g)) / (h - m + 2 * g) * u : 0, v = (e) => ({
1785
+ x: _(e.min),
1786
+ w: Math.max(4, _(e.max) - _(e.min))
1787
+ }), y = v(n), b = r ? v(r) : null, x = e < n.min ? _(n.min) : e > n.max ? _(n.max) : _(e), S = _(e), C = (e) => e.min === e.max ? `≈${a(e.min)}` : `${a(e.min)}–${a(e.max)}`, w = d && u ? Array.from({ length: Math.floor(h + g) - Math.ceil(m - g) + 1 }, (e, t) => Math.ceil(m - g) + t) : [], T = t === "upper" ? `M${S + 4},6 L${S - 4},${xt} L${S + 4},18` : `M${S - 4},6 L${S + 4},${xt} L${S - 4},18`;
1788
+ return /* @__PURE__ */ (0, Z.jsx)("div", {
1789
+ ref: l,
1790
+ className: "ov-gap",
1791
+ role: "img",
1792
+ "aria-label": c ?? `${t === "upper" ? "≤" : t === "lower" ? "≥" : ""}${a(e)} against ${C(n)}`,
1793
+ children: u > 0 && /* @__PURE__ */ (0, Z.jsxs)("svg", {
1794
+ width: u,
1795
+ height: bt,
1796
+ viewBox: `0 0 ${u} ${bt}`,
1797
+ "aria-hidden": !0,
1798
+ children: [
1799
+ /* @__PURE__ */ (0, Z.jsx)("line", {
1800
+ className: "ov-gap-track",
1801
+ x1: 0,
1802
+ x2: u,
1803
+ y1: xt,
1804
+ y2: xt
1805
+ }),
1806
+ w.map((e) => /* @__PURE__ */ (0, Z.jsx)("line", {
1807
+ className: "ov-gap-tick",
1808
+ x1: _(10 ** e),
1809
+ x2: _(10 ** e),
1810
+ y1: 8,
1811
+ y2: 16
1812
+ }, e)),
1813
+ b && /* @__PURE__ */ (0, Z.jsx)("rect", {
1814
+ className: "ov-gap-stretch",
1815
+ x: b.x,
1816
+ y: 4,
1817
+ width: b.w,
1818
+ height: 16,
1819
+ rx: 4,
1820
+ children: /* @__PURE__ */ (0, Z.jsx)("title", { children: s.stretch ?? `stretch ${C(r)}` })
1821
+ }),
1822
+ /* @__PURE__ */ (0, Z.jsx)("rect", {
1823
+ className: "ov-gap-target",
1824
+ x: y.x,
1825
+ y: 4,
1826
+ width: y.w,
1827
+ height: 16,
1828
+ rx: 4,
1829
+ children: /* @__PURE__ */ (0, Z.jsx)("title", { children: s.target ?? `target ${C(n)}` })
1830
+ }),
1831
+ Math.abs(x - S) > 1 && /* @__PURE__ */ (0, Z.jsx)("line", {
1832
+ className: "ov-gap-span",
1833
+ x1: S,
1834
+ x2: x,
1835
+ y1: xt,
1836
+ y2: xt,
1837
+ style: { stroke: o }
1838
+ }),
1839
+ /* @__PURE__ */ (0, Z.jsxs)("g", {
1840
+ className: "ov-gap-value",
1841
+ children: [
1842
+ /* @__PURE__ */ (0, Z.jsx)("title", { children: s.value ?? `${t === "upper" ? "≤" : t === "lower" ? "≥" : ""}${a(e)}` }),
1843
+ t ? /* @__PURE__ */ (0, Z.jsx)("path", {
1844
+ d: T,
1845
+ fill: "none",
1846
+ stroke: o,
1847
+ strokeWidth: 2,
1848
+ strokeLinecap: "round",
1849
+ strokeLinejoin: "round"
1850
+ }) : /* @__PURE__ */ (0, Z.jsx)("circle", {
1851
+ cx: S,
1852
+ cy: xt,
1853
+ r: 5,
1854
+ fill: o
1855
+ }),
1856
+ /* @__PURE__ */ (0, Z.jsx)("rect", {
1857
+ x: S - 8,
1858
+ y: 0,
1859
+ width: 16,
1860
+ height: bt,
1861
+ fill: "transparent"
1862
+ })
1863
+ ]
1864
+ })
1865
+ ]
1866
+ })
1867
+ });
1868
+ }
1869
+ function Ct({ figure: e, presentation: t = "chart" }) {
1870
+ let [n, r] = ot(), i = r >= 720 ? Math.floor(r / 32) * 32 : 720, a = (0, Q.useMemo)(() => typeof e == "function" ? e(i) : e, [e, i]);
1871
+ if (ke(a)) return /* @__PURE__ */ (0, Z.jsx)("p", {
1872
+ className: "ov-refusal",
1873
+ role: "note",
1874
+ "data-refused": a.id,
1875
+ children: a.refused
1876
+ });
1877
+ let o = r > 0 && r < 720 ? a.svg.narrow ? "narrow" : "table" : "wide", s = o === "wide" ? a.svg.wide : o === "narrow" ? a.svg.narrow : a.table, c = [
1878
+ a.note.method,
1879
+ a.note.n,
1880
+ ...a.note.exclusions
1881
+ ].join(" ");
1882
+ return /* @__PURE__ */ (0, Z.jsxs)("figure", {
1883
+ ref: n,
1884
+ className: "tgc-figure tgc-figure-chart tgc-figure-view",
1885
+ "data-figure": a.id,
1886
+ "data-layout": o,
1887
+ "aria-label": a.finding,
1888
+ children: [
1889
+ t === "report" && /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("h3", {
1890
+ className: "tgc-finding",
1891
+ children: a.finding
1892
+ }), /* @__PURE__ */ (0, Z.jsx)("p", {
1893
+ className: "tgc-lede",
1894
+ children: a.lede
1895
+ })] }),
1896
+ /* @__PURE__ */ (0, Z.jsx)("div", {
1897
+ className: `tgc-view-plot tgc-view-${o}`,
1898
+ role: a.svg.interactive ? "group" : "img",
1899
+ "aria-label": `${a.finding} ${a.lede}`,
1900
+ style: o === "narrow" ? { maxWidth: 358 } : void 0,
1901
+ dangerouslySetInnerHTML: { __html: s }
1902
+ }),
1903
+ /* @__PURE__ */ (0, Z.jsxs)("details", {
1904
+ className: "tgc-data",
1905
+ children: [
1906
+ /* @__PURE__ */ (0, Z.jsx)("summary", { children: "Data and method" }),
1907
+ /* @__PURE__ */ (0, Z.jsx)("p", {
1908
+ className: "tgc-lede",
1909
+ children: a.lede
1910
+ }),
1911
+ /* @__PURE__ */ (0, Z.jsx)("p", {
1912
+ className: "tgc-read",
1913
+ children: a.read
1914
+ }),
1915
+ /* @__PURE__ */ (0, Z.jsx)("p", {
1916
+ className: "tgc-read",
1917
+ children: c
1918
+ }),
1919
+ /* @__PURE__ */ (0, Z.jsx)("div", {
1920
+ className: "tgc-scroll",
1921
+ role: "region",
1922
+ "aria-label": `${a.finding} data`,
1923
+ tabIndex: 0,
1924
+ dangerouslySetInnerHTML: { __html: a.table }
1925
+ })
1926
+ ]
1927
+ })
1928
+ ]
1929
+ });
1930
+ }
1931
+ var wt = Object.freeze([
1932
+ "var(--chart-category-1)",
1933
+ "var(--chart-category-2)",
1934
+ "var(--chart-category-3)",
1935
+ "var(--chart-category-other)"
1936
+ ]);
1937
+ function Tt(e, t) {
1938
+ let n = document.createElement("span");
1939
+ n.style.display = "none", e.appendChild(n);
1940
+ let r = t.map((e) => (n.style.color = "", n.style.color = e, getComputedStyle(n).color || e));
1941
+ return n.remove(), r;
1942
+ }
1943
+ function Et(e, t, n) {
1944
+ let [r, i, a, o] = t, s = Math.max(1, Math.ceil((a - r) / n)), c = Math.max(1, Math.ceil((o - i) / n)), l = /* @__PURE__ */ new Map();
1945
+ for (let t = 0; t < e.length / 2; t++) {
1946
+ let a = Math.min(s - 1, Math.max(0, Math.floor((e[t * 2] - r) / n))), o = Math.min(c - 1, Math.max(0, Math.floor((e[t * 2 + 1] - i) / n))) * s + a, u = l.get(o);
1947
+ u ? u.push(t) : l.set(o, [t]);
1948
+ }
1949
+ return {
1950
+ cols: s,
1951
+ rows: c,
1952
+ cell: n,
1953
+ cells: l,
1954
+ x0: r,
1955
+ y0: i
1956
+ };
1957
+ }
1958
+ function Dt({ positions: e, radii: t, colors: n, palette: r, extent: i, rects: a, labels: o, dimmed: s, selected: c, minPixelRadius: l = 1.2, onHover: u, onSelect: d, describe: f, height: p = 560, ariaLabel: m }) {
1959
+ let h = (0, Q.useRef)(null), g = (0, Q.useRef)(null), [_, v] = (0, Q.useState)({
1960
+ width: 0,
1961
+ height: p
1962
+ }), y = (0, Q.useRef)({
1963
+ scale: 1,
1964
+ tx: 0,
1965
+ ty: 0
1966
+ }), b = (0, Q.useRef)(""), x = (0, Q.useRef)(0), [S, C] = (0, Q.useState)(null), w = (0, Q.useRef)([]), T = e.length / 2, E = (0, Q.useMemo)(() => typeof t == "number" ? t : t.reduce((e, t) => t > e ? t : e, 0), [t]), D = (0, Q.useMemo)(() => Et(e, i, Math.max(E * 2, (i[2] - i[0]) / 200)), [
1967
+ e,
1968
+ i,
1969
+ E
1970
+ ]);
1971
+ (0, Q.useEffect)(() => {
1972
+ if (!h.current) return;
1973
+ let e = new ResizeObserver(([e]) => v({
1974
+ width: Math.floor(e.contentRect.width),
1975
+ height: p
1976
+ }));
1977
+ return e.observe(h.current), () => e.disconnect();
1978
+ }, [p]);
1979
+ let O = (0, Q.useCallback)(() => {
1980
+ let [e, t, n, r] = i, a = Math.min((_.width - 16) / Math.max(1e-9, n - e), (_.height - 16) / Math.max(1e-9, r - t));
1981
+ y.current = {
1982
+ scale: a,
1983
+ tx: 8 - e * a + (_.width - 16 - (n - e) * a) / 2,
1984
+ ty: 8 - t * a + (_.height - 16 - (r - t) * a) / 2
1985
+ };
1986
+ }, [i, _]), k = (0, Q.useCallback)(() => {
1987
+ x.current = 0;
1988
+ let i = g.current;
1989
+ if (!i || !_.width) return;
1990
+ let u = performance.now(), d = window.devicePixelRatio || 1;
1991
+ (i.width !== Math.round(_.width * d) || i.height !== Math.round(_.height * d)) && (i.width = Math.round(_.width * d), i.height = Math.round(_.height * d));
1992
+ let f = i.getContext("2d");
1993
+ if (!f) return;
1994
+ !w.current.length && h.current && (w.current = Tt(h.current, r));
1995
+ let { scale: p, tx: m, ty: v } = y.current;
1996
+ f.setTransform(d, 0, 0, d, 0, 0), f.clearRect(0, 0, _.width, _.height);
1997
+ let b = h.current ? getComputedStyle(h.current) : null, S = b?.color || "#888";
1998
+ if (a?.length) {
1999
+ f.lineWidth = 1, f.font = "11px ui-sans-serif, system-ui, sans-serif";
2000
+ for (let e of a) {
2001
+ if (e.x1 <= e.x0) continue;
2002
+ let t = e.x0 * p + m, n = e.y0 * p + v, r = (e.x1 - e.x0) * p, i = (e.y1 - e.y0) * p;
2003
+ if (!(t > _.width || n > _.height || t + r < 0 || n + i < 0) && (f.globalAlpha = .35, f.strokeStyle = S, f.strokeRect(t + .5, n + .5, r, i), r > 36)) {
2004
+ f.globalAlpha = .8, f.fillStyle = S;
2005
+ let i = e.note ? `${e.label} · ${e.note}` : e.label;
2006
+ f.save(), f.beginPath(), f.rect(t, n, r - 4, 16), f.clip(), f.fillText(i, t + 4, n + 12), f.restore();
2007
+ }
2008
+ }
2009
+ f.globalAlpha = 1;
2010
+ }
2011
+ let C = /* @__PURE__ */ new Map(), E = new Path2D(), D = typeof t == "number" ? t : 0;
2012
+ for (let r = 0; r < T; r++) {
2013
+ let i = e[r * 2] * p + m, a = e[r * 2 + 1] * p + v;
2014
+ if (i < -8 || a < -8 || i > _.width + 8 || a > _.height + 8) continue;
2015
+ let o = Math.max(l, (typeof t == "number" ? D : t[r]) * p), c = s?.[r] ? E : C.get(n[r]) ?? C.set(n[r], new Path2D()).get(n[r]);
2016
+ c.moveTo(i + o, a), c.arc(i, a, o, 0, Math.PI * 2);
2017
+ }
2018
+ f.globalAlpha = .18, f.fillStyle = S, f.fill(E), f.globalAlpha = .92;
2019
+ for (let [e, t] of C) f.fillStyle = w.current[e] ?? S, f.fill(t);
2020
+ if (f.globalAlpha = 1, c != null && c < T) {
2021
+ let n = e[c * 2] * p + m, r = e[c * 2 + 1] * p + v, i = Math.max(4, (typeof t == "number" ? D : t[c]) * p + 3);
2022
+ f.lineWidth = 2, f.strokeStyle = S, f.beginPath(), f.arc(n, r, i, 0, Math.PI * 2), f.stroke();
2023
+ }
2024
+ if (o?.length) {
2025
+ f.font = "600 12px ui-sans-serif, system-ui, sans-serif", f.textAlign = "center", f.lineWidth = 3;
2026
+ let e = b?.getPropertyValue("--dot-map-surface").trim() || b?.backgroundColor || "#161616", t = [];
2027
+ for (let n of o) {
2028
+ let r = n.x * p + m, i = n.y * p + v;
2029
+ if (r < 0 || i < 0 || r > _.width || i > _.height) continue;
2030
+ let a = f.measureText(n.text).width, o = [
2031
+ r - a / 2 - 2,
2032
+ i - 10,
2033
+ r + a / 2 + 2,
2034
+ i + 4
2035
+ ];
2036
+ t.some(([e, t, n, r]) => o[0] < n && o[2] > e && o[1] < r && o[3] > t) || (t.push(o), f.strokeStyle = e, f.strokeText(n.text, r, i), f.fillStyle = S, f.fillText(n.text, r, i));
2037
+ }
2038
+ f.textAlign = "start";
2039
+ }
2040
+ i.dataset.frameMs = (performance.now() - u).toFixed(2);
2041
+ }, [
2042
+ _,
2043
+ e,
2044
+ t,
2045
+ n,
2046
+ r,
2047
+ a,
2048
+ o,
2049
+ s,
2050
+ c,
2051
+ T,
2052
+ l
2053
+ ]), A = (0, Q.useCallback)(() => {
2054
+ x.current ||= requestAnimationFrame(k);
2055
+ }, [k]);
2056
+ (0, Q.useEffect)(() => {
2057
+ w.current = [];
2058
+ }, [r]), (0, Q.useEffect)(() => {
2059
+ if (!_.width) return;
2060
+ let e = `${i.join(",")}:${_.width}x${_.height}`;
2061
+ b.current !== e && (O(), b.current = e), A();
2062
+ }, [
2063
+ _,
2064
+ i,
2065
+ O,
2066
+ A
2067
+ ]), (0, Q.useEffect)(() => A(), [A]), (0, Q.useEffect)(() => () => cancelAnimationFrame(x.current), []);
2068
+ let j = (0, Q.useCallback)((n, r) => {
2069
+ let i = g.current;
2070
+ if (!i) return null;
2071
+ let a = i.getBoundingClientRect(), { scale: o, tx: s, ty: c } = y.current, l = (n - a.left - s) / o, u = (r - a.top - c) / o, d = Math.floor((l - D.x0) / D.cell), f = Math.floor((u - D.y0) / D.cell), p = null, m = Infinity, h = Math.max(1, Math.ceil(6 / (o * D.cell)));
2072
+ for (let n = -h; n <= h; n++) for (let r = -h; r <= h; r++) if (!(d + r < 0 || f + n < 0 || d + r >= D.cols || f + n >= D.rows)) for (let i of D.cells.get((f + n) * D.cols + (d + r)) ?? []) {
2073
+ let n = e[i * 2] - l, r = e[i * 2 + 1] - u, a = n * n + r * r, s = Math.max(6 / o, typeof t == "number" ? t : t[i]);
2074
+ a < m && a <= s * s && (m = a, p = i);
2075
+ }
2076
+ return p;
2077
+ }, [
2078
+ D,
2079
+ e,
2080
+ t
2081
+ ]), M = (0, Q.useRef)(null), N = (0, Q.useRef)(/* @__PURE__ */ new Map()), P = (0, Q.useRef)(null);
2082
+ (0, Q.useEffect)(() => {
2083
+ let e = g.current;
2084
+ if (!e) return;
2085
+ let t = (t) => {
2086
+ t.preventDefault();
2087
+ let n = e.getBoundingClientRect(), r = t.clientX - n.left, i = t.clientY - n.top, a = Math.exp(-t.deltaY * .0015), o = y.current, s = Math.min(o.scale * 400, Math.max(o.scale * .0025, o.scale * a));
2088
+ y.current = {
2089
+ scale: s,
2090
+ tx: r - (r - o.tx) / o.scale * s,
2091
+ ty: i - (i - o.ty) / o.scale * s
2092
+ }, A();
2093
+ };
2094
+ return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
2095
+ }, [A]);
2096
+ let F = S ? f?.(S.index) ?? null : null;
2097
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
2098
+ ref: h,
2099
+ className: "tgc-dot-map",
2100
+ style: {
2101
+ position: "relative",
2102
+ height: p
2103
+ },
2104
+ "data-points": T,
2105
+ children: [/* @__PURE__ */ (0, Z.jsx)("canvas", {
2106
+ ref: g,
2107
+ role: "img",
2108
+ "aria-label": m,
2109
+ tabIndex: 0,
2110
+ style: {
2111
+ width: "100%",
2112
+ height: p,
2113
+ display: "block",
2114
+ touchAction: "none",
2115
+ cursor: S ? "pointer" : "grab"
2116
+ },
2117
+ onPointerDown: (e) => {
2118
+ if (N.current.set(e.pointerId, {
2119
+ x: e.clientX,
2120
+ y: e.clientY
2121
+ }), N.current.size === 2) {
2122
+ let [e, t] = [...N.current.values()];
2123
+ P.current = {
2124
+ distance: Math.hypot(e.x - t.x, e.y - t.y) || 1,
2125
+ view: { ...y.current }
2126
+ }, M.current = null;
2127
+ } else M.current = {
2128
+ x: e.clientX,
2129
+ y: e.clientY,
2130
+ moved: !1
2131
+ };
2132
+ e.currentTarget.setPointerCapture(e.pointerId);
2133
+ },
2134
+ onPointerMove: (e) => {
2135
+ N.current.has(e.pointerId) && N.current.set(e.pointerId, {
2136
+ x: e.clientX,
2137
+ y: e.clientY
2138
+ });
2139
+ let t = P.current;
2140
+ if (t && N.current.size === 2) {
2141
+ let [n, r] = [...N.current.values()], i = e.currentTarget.getBoundingClientRect(), a = (n.x + r.x) / 2 - i.left, o = (n.y + r.y) / 2 - i.top, s = t.view.scale * ((Math.hypot(n.x - r.x, n.y - r.y) || 1) / t.distance);
2142
+ y.current = {
2143
+ scale: s,
2144
+ tx: a - (a - t.view.tx) / t.view.scale * s,
2145
+ ty: o - (o - t.view.ty) / t.view.scale * s
2146
+ }, A();
2147
+ return;
2148
+ }
2149
+ let n = M.current;
2150
+ if (n) {
2151
+ let t = e.clientX - n.x, r = e.clientY - n.y;
2152
+ if (n.moved || Math.abs(t) + Math.abs(r) > 3) {
2153
+ n.moved = !0, y.current = {
2154
+ ...y.current,
2155
+ tx: y.current.tx + t,
2156
+ ty: y.current.ty + r
2157
+ }, n.x = e.clientX, n.y = e.clientY, A();
2158
+ return;
2159
+ }
2160
+ }
2161
+ let r = j(e.clientX, e.clientY), i = e.currentTarget.getBoundingClientRect();
2162
+ C(r === null ? null : {
2163
+ index: r,
2164
+ x: e.clientX - i.left,
2165
+ y: e.clientY - i.top
2166
+ }), u?.(r);
2167
+ },
2168
+ onPointerUp: (e) => {
2169
+ if (N.current.delete(e.pointerId), P.current) {
2170
+ N.current.size < 2 && (P.current = null), M.current = null;
2171
+ return;
2172
+ }
2173
+ let t = M.current;
2174
+ M.current = null, t && !t.moved && d?.(j(e.clientX, e.clientY));
2175
+ },
2176
+ onPointerCancel: (e) => {
2177
+ N.current.delete(e.pointerId), N.current.size < 2 && (P.current = null), M.current = null;
2178
+ },
2179
+ onPointerLeave: () => {
2180
+ C(null), u?.(null);
2181
+ },
2182
+ onDoubleClick: () => {
2183
+ O(), A();
2184
+ },
2185
+ onKeyDown: (e) => {
2186
+ let t = y.current, n = (e) => {
2187
+ let n = _.width / 2, r = _.height / 2;
2188
+ y.current = {
2189
+ scale: t.scale * e,
2190
+ tx: n - (n - t.tx) / t.scale * t.scale * e,
2191
+ ty: r - (r - t.ty) / t.scale * t.scale * e
2192
+ };
2193
+ };
2194
+ if (e.key === "+" || e.key === "=") n(1.4);
2195
+ else if (e.key === "-") n(1 / 1.4);
2196
+ else if (e.key === "0") O();
2197
+ else if (e.key === "ArrowLeft") y.current = {
2198
+ ...t,
2199
+ tx: t.tx + 60
2200
+ };
2201
+ else if (e.key === "ArrowRight") y.current = {
2202
+ ...t,
2203
+ tx: t.tx - 60
2204
+ };
2205
+ else if (e.key === "ArrowUp") y.current = {
2206
+ ...t,
2207
+ ty: t.ty + 60
2208
+ };
2209
+ else if (e.key === "ArrowDown") y.current = {
2210
+ ...t,
2211
+ ty: t.ty - 60
2212
+ };
2213
+ else return;
2214
+ e.preventDefault(), A();
2215
+ }
2216
+ }), S && F && /* @__PURE__ */ (0, Z.jsx)("div", {
2217
+ className: "tgc-dot-map-tip",
2218
+ role: "tooltip",
2219
+ style: {
2220
+ position: "absolute",
2221
+ left: Math.min(S.x + 12, Math.max(0, _.width - 300)),
2222
+ top: S.y + 12,
2223
+ pointerEvents: "none"
2224
+ },
2225
+ children: F
2226
+ })]
2227
+ });
2228
+ }
2229
+ var $ = (e, t) => /* @__PURE__ */ (0, Z.jsx)("svg", {
2230
+ viewBox: "0 0 16 16",
2231
+ width: "16",
2232
+ height: "16",
2233
+ fill: "none",
2234
+ stroke: "currentColor",
2235
+ strokeWidth: "1.75",
2236
+ strokeLinecap: "round",
2237
+ strokeLinejoin: "round",
2238
+ "aria-hidden": !t || void 0,
2239
+ role: t ? "img" : void 0,
2240
+ "aria-label": t,
2241
+ children: e
2242
+ });
2243
+ function Ot(e) {
2244
+ let t = (e ?? "").toLowerCase();
2245
+ if (/bash|shell|exec|terminal|command|run/.test(t)) return $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("rect", {
2246
+ x: "2",
2247
+ y: "3",
2248
+ width: "12",
2249
+ height: "10",
2250
+ rx: "2"
2251
+ }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "m5 7 2 1.5L5 10M8.5 10.5h2.5" })] }));
2252
+ if (/edit|write|patch|apply/.test(t)) return $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "M3 13l1-3.5L10.5 3a1.4 1.4 0 0 1 2 2L6 11.5 3 13ZM9.5 4l2 2" }));
2253
+ if (/grep|search|find|query/.test(t)) return $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("circle", {
2254
+ cx: "7",
2255
+ cy: "7",
2256
+ r: "4.25"
2257
+ }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "m10.25 10.25 3.25 3.25" })] }));
2258
+ if (/read|glob|list|ls|cat|file|view/.test(t)) return $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("path", { d: "M4 2.5h5l3 3v8H4z" }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "M9 2.5v3h3M6 9h4M6 11h3" })] }));
2259
+ if (/web|fetch|http|browser|url/.test(t)) return $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("circle", {
2260
+ cx: "8",
2261
+ cy: "8",
2262
+ r: "5.5"
2263
+ }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "M2.5 8h11M8 2.5c2 2 2 9 0 11M8 2.5c-2 2-2 9 0 11" })] }));
2264
+ if (/git|commit|branch|merge/.test(t)) return $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
2265
+ /* @__PURE__ */ (0, Z.jsx)("circle", {
2266
+ cx: "5",
2267
+ cy: "4",
2268
+ r: "1.5"
2269
+ }),
2270
+ /* @__PURE__ */ (0, Z.jsx)("circle", {
2271
+ cx: "5",
2272
+ cy: "12",
2273
+ r: "1.5"
2274
+ }),
2275
+ /* @__PURE__ */ (0, Z.jsx)("circle", {
2276
+ cx: "11",
2277
+ cy: "6",
2278
+ r: "1.5"
2279
+ }),
2280
+ /* @__PURE__ */ (0, Z.jsx)("path", { d: "M5 5.5v5M11 7.5c0 2-3 2-6 3" })
2281
+ ] }));
2282
+ }
2283
+ function kt({ kind: e, name: t }) {
2284
+ if (e === "tool") {
2285
+ let e = Ot(t);
2286
+ if (e) return e;
2287
+ }
2288
+ switch (e) {
2289
+ case "pipeline": return $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
2290
+ /* @__PURE__ */ (0, Z.jsx)("circle", {
2291
+ cx: "8",
2292
+ cy: "4",
2293
+ r: "1.75"
2294
+ }),
2295
+ /* @__PURE__ */ (0, Z.jsx)("circle", {
2296
+ cx: "4",
2297
+ cy: "12",
2298
+ r: "1.75"
2299
+ }),
2300
+ /* @__PURE__ */ (0, Z.jsx)("circle", {
2301
+ cx: "12",
2302
+ cy: "12",
2303
+ r: "1.75"
2304
+ }),
2305
+ /* @__PURE__ */ (0, Z.jsx)("path", { d: "M8 5.75v2.5M8 8.25 4.8 10.6M8 8.25l3.2 2.35" })
2306
+ ] }));
2307
+ case "model": return $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "M8 2.5c.5 2.8 2.2 4.6 5 5.5-2.8.9-4.5 2.7-5 5.5-.5-2.8-2.2-4.6-5-5.5 2.8-.9 4.5-2.7 5-5.5Z" }));
2308
+ case "waiting": return $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("path", { d: "M4.5 2.5h7M4.5 13.5h7" }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "M5.5 2.5c0 3 5 3 5 5.5s-5 2.5-5 5.5M10.5 2.5c0 3-5 3-5 5.5" })] }));
2309
+ case "handoff": return $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "M3 3v5.5a2 2 0 0 0 2 2h8M10.5 8l2.5 2.5-2.5 2.5" }));
2310
+ default: return $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "M10.2 2.8a3.2 3.2 0 0 0-4 4L2.8 10.2a1.4 1.4 0 0 0 2 2l3.4-3.4a3.2 3.2 0 0 0 4-4l-1.9 1.9-1.6-.4-.4-1.6 1.9-1.9Z" }));
2311
+ }
2312
+ }
2313
+ var At = () => $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "m6 4 4 4-4 4" })), jt = () => $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("circle", {
2314
+ cx: "7",
2315
+ cy: "7",
2316
+ r: "4.25"
2317
+ }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "m10.25 10.25 3.25 3.25" })] })), Mt = () => /* @__PURE__ */ (0, Z.jsx)("svg", {
2318
+ viewBox: "0 0 16 16",
2319
+ width: "16",
2320
+ height: "16",
2321
+ "aria-hidden": !0,
2322
+ children: /* @__PURE__ */ (0, Z.jsx)("path", {
2323
+ d: "M4.5 3.2v9.6a.6.6 0 0 0 .9.5l7.6-4.8a.6.6 0 0 0 0-1L5.4 2.7a.6.6 0 0 0-.9.5Z",
2324
+ fill: "currentColor"
2325
+ })
2326
+ }), Nt = () => /* @__PURE__ */ (0, Z.jsxs)("svg", {
2327
+ viewBox: "0 0 16 16",
2328
+ width: "16",
2329
+ height: "16",
2330
+ "aria-hidden": !0,
2331
+ children: [/* @__PURE__ */ (0, Z.jsx)("rect", {
2332
+ x: "4",
2333
+ y: "3",
2334
+ width: "2.75",
2335
+ height: "10",
2336
+ rx: ".8",
2337
+ fill: "currentColor"
2338
+ }), /* @__PURE__ */ (0, Z.jsx)("rect", {
2339
+ x: "9.25",
2340
+ y: "3",
2341
+ width: "2.75",
2342
+ height: "10",
2343
+ rx: ".8",
2344
+ fill: "currentColor"
2345
+ })]
2346
+ }), Pt = () => $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("path", { d: "M3 8a5 5 0 1 0 1.5-3.55" }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "M3 2.75V5.5h2.75" })] })), Ft = ({ label: e }) => $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("path", { d: "M12.5 8A4.5 4.5 0 1 1 11 4.6" }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "M11.5 2v3h-3" })] }), e), It = ({ label: e }) => /* @__PURE__ */ (0, Z.jsx)(T, {
2347
+ status: "failed",
2348
+ "aria-label": e,
2349
+ style: { color: "currentColor" }
2350
+ }), Lt = () => $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "m4.5 4.5 7 7m0-7-7 7" })), Rt = () => $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "M8 1.5v3M8 11.5v3M1.5 8h3M11.5 8h3M3.4 3.4l2.1 2.1M10.5 10.5l2.1 2.1M3.4 12.6l2.1-2.1M10.5 5.5l2.1-2.1" })), zt = It, Bt = () => $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("circle", {
2351
+ cx: "7",
2352
+ cy: "7",
2353
+ r: "4.25"
2354
+ }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "m10.25 10.25 3.25 3.25M5 7h4M7 5v4" })] })), Vt = () => $(/* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("circle", {
2355
+ cx: "7",
2356
+ cy: "7",
2357
+ r: "4.25"
2358
+ }), /* @__PURE__ */ (0, Z.jsx)("path", { d: "m10.25 10.25 3.25 3.25M5 7h4" })] })), Ht = () => $(/* @__PURE__ */ (0, Z.jsx)("path", { d: "M2.5 6V3.5a1 1 0 0 1 1-1H6M10 2.5h2.5a1 1 0 0 1 1 1V6M13.5 10v2.5a1 1 0 0 1-1 1H10M6 13.5H3.5a1 1 0 0 1-1-1V10" })), Ut = (e) => e.replace(/-/g, "‑"), Wt = {
2359
+ pipeline: "Agent",
2360
+ model: "Model call",
2361
+ tool: "Tool call",
2362
+ waiting: "Waiting",
2363
+ handoff: "Handoff"
2364
+ }, Gt = (e, t) => /* @__PURE__ */ (0, Z.jsxs)("span", {
2365
+ title: `${e.toLocaleString()} ${t}`,
2366
+ children: [
2367
+ C(e),
2368
+ " ",
2369
+ t
2370
+ ]
2371
+ }), Kt = (e, t, n = `${t}s`) => `${e.toLocaleString()} ${e === 1 ? t : n}`, qt = (e, t) => e[Math.min(e.length - 1, Math.ceil(t * e.length) - 1)], Jt = 4;
2372
+ function Yt(e, t, n) {
2373
+ let r = e.span, a = [];
2374
+ r.detail && a.push([r.kind === "tool" ? "Provider" : "Model", r.detail]);
2375
+ let o = i(r) ? Math.max(r.endMs, t) : r.endMs;
2376
+ a.push(["Ran for", Number.isFinite(o - r.startMs) && o >= r.startMs ? b(o - r.startMs) : "—"]), n && a.push(["Started at", `+${b(Math.max(0, r.startMs))}`]);
2377
+ let s = e.tokens;
2378
+ if (s) {
2379
+ let e = [
2380
+ ["prompt", "in"],
2381
+ ["completion", "out"],
2382
+ ["cached", "cached"]
2383
+ ].flatMap(([e, t]) => s[e] === void 0 ? [] : [Gt(s[e], t)]);
2384
+ a.push(["Tokens", e.length ? /* @__PURE__ */ (0, Z.jsx)("span", {
2385
+ className: `fw-card-parts${e.length > 2 ? " fw-card-stack" : ""}`,
2386
+ children: e.map((e, t) => /* @__PURE__ */ (0, Z.jsx)("span", { children: e }, t))
2387
+ }) : /* @__PURE__ */ (0, Z.jsx)("span", {
2388
+ title: "Tokens not reported",
2389
+ children: "—"
2390
+ })]);
2391
+ }
2392
+ let c = e.modelMs;
2393
+ c?.length && a.push(["Model latency", /* @__PURE__ */ (0, Z.jsxs)("span", {
2394
+ className: "fw-card-parts",
2395
+ children: [/* @__PURE__ */ (0, Z.jsxs)("span", { children: [b(qt(c, .5)), " median"] }), c.length >= 10 && /* @__PURE__ */ (0, Z.jsxs)("span", { children: [b(qt(c, .95)), " p95"] })]
2396
+ })]);
2397
+ let l = r.costUsd ?? e.rollupCostUsd;
2398
+ l !== void 0 && a.push(["Cost", u(e, l)]);
2399
+ let d = e.counts;
2400
+ if (d?.model && a.push(["Model calls", d.model.toLocaleString()]), d?.tool) {
2401
+ let e = Object.entries(d.tools).sort(([e, t], [n, r]) => r - t || e.localeCompare(n)), t = e.length - Jt;
2402
+ a.push(["Tool calls", /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [d.tool.toLocaleString(), /* @__PURE__ */ (0, Z.jsxs)("span", {
2403
+ className: "fw-card-tools",
2404
+ title: e.map(([e, t]) => `${e} ${t}`).join(", "),
2405
+ children: [e.slice(0, t > 1 ? Jt : e.length).map(([e, t]) => /* @__PURE__ */ (0, Z.jsxs)("span", { children: [/* @__PURE__ */ (0, Z.jsx)("span", { children: e }), /* @__PURE__ */ (0, Z.jsx)("span", { children: t.toLocaleString() })] }, e)), t > 1 && /* @__PURE__ */ (0, Z.jsxs)("span", { children: [/* @__PURE__ */ (0, Z.jsxs)("span", { children: [t, " more tools"] }), /* @__PURE__ */ (0, Z.jsx)("span", { children: e.slice(Jt).reduce((e, [, t]) => e + t, 0).toLocaleString() })] })]
2406
+ })] })]);
2407
+ }
2408
+ d?.failed && a.push(["Failures", Kt(d.failed, "failed step")]);
2409
+ let f = r.marks?.filter((e) => e.kind === "restart").length ?? 0;
2410
+ (d?.retried || f) && a.push(["Retries", [d?.retried ? Kt(d.retried, "step retried", "steps retried") : "", f ? Kt(f, "restart") : ""].filter(Boolean).join(" · ")]), n && e.hasChildren && a.push(["Steps", e.descendants.toLocaleString()]);
2411
+ let p = (r.facts ?? []).map(({ label: e, value: t }) => [e, t]);
2412
+ return [...new Map([...a, ...p].map((e) => [e[0].toLowerCase(), e])).values()];
2413
+ }
2414
+ function Xt({ rows: e }) {
2415
+ return /* @__PURE__ */ (0, Z.jsx)("dl", {
2416
+ className: "fw-card-table",
2417
+ children: e.map(([e, t]) => /* @__PURE__ */ (0, Z.jsxs)("div", { children: [/* @__PURE__ */ (0, Z.jsx)("dt", { children: e }), /* @__PURE__ */ (0, Z.jsx)("dd", { children: t })] }, e))
2418
+ });
2419
+ }
2420
+ function Zt({ id: e, row: t, agent: n, clockMs: r, left: a, top: o, pinned: s, onClose: c, renderIcon: u, compact: d }) {
2421
+ let f = t.span, p = k(f, "Failure"), m = D(f.status ?? "unknown"), h = O(m), g = h.label, _ = n && n.id !== t.id ? n : void 0, v = {
2422
+ id: e,
2423
+ role: s ? "dialog" : "tooltip",
2424
+ "aria-label": s ? `${f.name} details` : void 0,
2425
+ style: {
2426
+ left: a,
2427
+ top: o,
2428
+ "--fw-status": `var(${h.token})`
2429
+ },
2430
+ onKeyDown: (e) => {
2431
+ e.key === "Escape" && (e.stopPropagation(), c());
2432
+ }
2433
+ }, y = s && /* @__PURE__ */ (0, Z.jsx)("button", {
2434
+ type: "button",
2435
+ className: "fw-icon-button fw-card-close",
2436
+ "aria-label": "Close details",
2437
+ onClick: c,
2438
+ autoFocus: !0,
2439
+ children: /* @__PURE__ */ (0, Z.jsx)(Lt, {})
2440
+ });
2441
+ if (d) {
2442
+ let e = _ ?? t, n = e.span.outcome, a = e.outcomes ?? (n ? [n] : []), o = f.kind === "model" ? "Thinking" : Wt[f.kind], s = f.name && f.name.toLowerCase() !== o.toLowerCase() && f.name.toLowerCase() !== f.kind ? ` ${f.name}` : "", c = i(f) ? Math.max(f.endMs, r) : f.endMs, u = _ && f.endMs > f.startMs ? `${o}${s} · ${b(c - f.startMs)}${t.ok ? "" : " · failed"}` : void 0, d = !_ && f.output && f.output !== e.name ? f.output : void 0;
2443
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
2444
+ ...v,
2445
+ className: "fw-card fw-card-compact",
2446
+ "data-tone": l(e.tone),
2447
+ "data-outcome": n?.tone,
2448
+ children: [
2449
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
2450
+ className: "fw-card-agent",
2451
+ children: [
2452
+ a.length ? a.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
2453
+ className: "fw-agent-dot",
2454
+ "data-tone": "0",
2455
+ "data-outcome": e.tone,
2456
+ "data-ring": e.ring || void 0,
2457
+ "aria-hidden": !0
2458
+ }, `${e.label}:${e.tone}:${e.ring}`)) : /* @__PURE__ */ (0, Z.jsx)("span", {
2459
+ className: "fw-agent-dot",
2460
+ "aria-hidden": !0
2461
+ }),
2462
+ /* @__PURE__ */ (0, Z.jsx)("span", {
2463
+ className: "fw-card-who",
2464
+ children: Ut(e.name)
2465
+ }),
2466
+ n ? /* @__PURE__ */ (0, Z.jsx)("span", {
2467
+ className: "fw-pill fw-pill-outcome",
2468
+ "data-tone": "0",
2469
+ "data-outcome": n.tone,
2470
+ children: n.label
2471
+ }) : /* @__PURE__ */ (0, Z.jsx)("span", {
2472
+ className: `fw-pill fw-pill-${m}`,
2473
+ children: g
2474
+ }),
2475
+ y
2476
+ ]
2477
+ }),
2478
+ /* @__PURE__ */ (0, Z.jsx)(Xt, { rows: Yt(e, r, !1).filter(([e]) => e.toLowerCase() !== "failure") }),
2479
+ u && /* @__PURE__ */ (0, Z.jsx)("p", {
2480
+ className: "fw-card-step",
2481
+ children: u
2482
+ }),
2483
+ !t.ok && /* @__PURE__ */ (0, Z.jsx)("p", {
2484
+ className: "fw-card-error",
2485
+ children: p ? `Failure: ${p}` : f.output ? `Recorded output: ${f.output}` : "Failure detail not reported"
2486
+ }),
2487
+ d && t.ok && /* @__PURE__ */ (0, Z.jsx)("p", {
2488
+ className: "fw-card-result",
2489
+ children: d
2490
+ })
2491
+ ]
2492
+ });
2493
+ }
2494
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
2495
+ ...v,
2496
+ className: "fw-card",
2497
+ "data-tone": l(t.tone),
2498
+ children: [
2499
+ _ && /* @__PURE__ */ (0, Z.jsxs)("div", {
2500
+ className: "fw-card-agent",
2501
+ children: [/* @__PURE__ */ (0, Z.jsx)("span", {
2502
+ className: "fw-agent-dot",
2503
+ "data-tone": "0",
2504
+ "data-outcome": _.span.outcome?.tone,
2505
+ "data-ring": _.span.outcome?.ring || void 0,
2506
+ "aria-hidden": !0
2507
+ }), _.name]
2508
+ }),
2509
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
2510
+ className: "fw-card-head",
2511
+ children: [
2512
+ /* @__PURE__ */ (0, Z.jsx)("span", {
2513
+ className: "fw-icon-tile",
2514
+ "aria-hidden": !0,
2515
+ children: u?.(f) ?? /* @__PURE__ */ (0, Z.jsx)(kt, {
2516
+ kind: f.kind,
2517
+ name: f.name
2518
+ })
2519
+ }),
2520
+ /* @__PURE__ */ (0, Z.jsx)("div", {
2521
+ className: "fw-card-name",
2522
+ children: Ut(f.name)
2523
+ }),
2524
+ /* @__PURE__ */ (0, Z.jsx)("span", {
2525
+ className: `fw-pill fw-pill-${m}`,
2526
+ children: g
2527
+ }),
2528
+ y
2529
+ ]
2530
+ }),
2531
+ /* @__PURE__ */ (0, Z.jsx)(Xt, { rows: Yt(t, r, !0) }),
2532
+ !t.ok && !f.output && !p && /* @__PURE__ */ (0, Z.jsx)("p", {
2533
+ className: "fw-card-error",
2534
+ children: "Failure detail not reported"
2535
+ }),
2536
+ f.input && /* @__PURE__ */ (0, Z.jsxs)("div", {
2537
+ className: "fw-card-text",
2538
+ children: [/* @__PURE__ */ (0, Z.jsx)("div", {
2539
+ className: "fw-card-label",
2540
+ children: "Input"
2541
+ }), /* @__PURE__ */ (0, Z.jsx)("p", { children: f.input })]
2542
+ }),
2543
+ f.output && /* @__PURE__ */ (0, Z.jsxs)("div", {
2544
+ className: "fw-card-text",
2545
+ children: [/* @__PURE__ */ (0, Z.jsx)("div", {
2546
+ className: "fw-card-label",
2547
+ children: t.ok ? "Output" : "Recorded output"
2548
+ }), /* @__PURE__ */ (0, Z.jsx)("p", { children: f.output })]
2549
+ })
2550
+ ]
2551
+ });
2552
+ }
2553
+ var Qt = 0x9184e72a000, $t = (e, t) => ({
2554
+ "--s": e,
2555
+ "--e": Number.isFinite(t) ? t : Qt
2556
+ }), en = (e) => e.length * 7 + 8;
2557
+ function tn({ mark: e, events: t, agentView: n }) {
2558
+ let r = e.kind === "failed" ? "fail" : e.retry ? "retry" : null, i = s(e) === "model", a = i ? void 0 : e.count === 1 ? e.name : e.tool, o = Number.isFinite(e.endMs) ? b(e.endMs - e.startMs) : "", c = [o, e.costUsd ? h(e.costUsd) : ""].filter(Boolean).join(" · ");
2559
+ return /* @__PURE__ */ (0, Z.jsxs)("span", {
2560
+ className: `fw-seg fw-seg-${e.kind}${e.alt ? " fw-seg-alt" : ""}`,
2561
+ "data-tone": l(e.tone),
2562
+ "data-model": i || void 0,
2563
+ style: $t(e.startMs, e.endMs),
2564
+ title: e.name ? `${e.name}${e.count > 1 ? ` +${e.count - 1} more` : ""}${c ? ` · ${c}` : ""}` : void 0,
2565
+ onPointerEnter: n ? (n) => t.onInspect(e.id, n.currentTarget, n.clientX) : void 0,
2566
+ onClick: n ? (n) => {
2567
+ n.stopPropagation(), t.onPin(e.id, n.currentTarget, n.clientX);
2568
+ } : void 0,
2569
+ children: [r && /* @__PURE__ */ (0, Z.jsx)("span", {
2570
+ className: "fw-glyph",
2571
+ "data-glyph": r,
2572
+ children: r === "fail" ? /* @__PURE__ */ (0, Z.jsx)(It, {}) : /* @__PURE__ */ (0, Z.jsx)(Ft, {})
2573
+ }), n && /* @__PURE__ */ (0, Z.jsxs)("span", {
2574
+ className: "fw-seg-label",
2575
+ children: [
2576
+ /* @__PURE__ */ (0, Z.jsx)("span", {
2577
+ className: "fw-seg-icon",
2578
+ "aria-hidden": !0,
2579
+ children: /* @__PURE__ */ (0, Z.jsx)(kt, {
2580
+ kind: i ? "model" : "tool",
2581
+ name: e.tool ?? e.name
2582
+ })
2583
+ }),
2584
+ a && /* @__PURE__ */ (0, Z.jsx)("span", {
2585
+ className: "fw-seg-name",
2586
+ children: a
2587
+ }),
2588
+ e.count > 1 && a && /* @__PURE__ */ (0, Z.jsxs)("span", {
2589
+ className: "fw-seg-chip",
2590
+ children: ["×", e.count]
2591
+ }),
2592
+ o && /* @__PURE__ */ (0, Z.jsx)("span", {
2593
+ className: "fw-seg-meta",
2594
+ children: o
2595
+ }),
2596
+ e.costUsd ? /* @__PURE__ */ (0, Z.jsx)("span", {
2597
+ className: "fw-seg-meta",
2598
+ children: h(e.costUsd)
2599
+ }) : null
2600
+ ]
2601
+ })]
2602
+ });
2603
+ }
2604
+ var nn = (e, t) => i(e.span) || e.span.startMs <= t && t < e.span.endMs;
2605
+ function rn(e, t) {
2606
+ let n = e.span;
2607
+ return e.durationLabel === "—" ? "—" : e.approx && n.endMs === n.startMs && !i(n) ? u(e, n.costUsd) : [k(n, "Ran for") ?? (!i(n) && t < n.endMs ? `${b(Math.max(0, t - n.startMs))}${e.approx ? "~" : ""}` : i(n) ? `${b(Math.max(n.endMs, t) - n.startMs)}${e.approx ? "~" : ""}` : e.durationLabel), !i(n) && t < n.endMs && k(n, "Cost") === void 0 ? "" : u(e, n.costUsd ?? e.rollupCostUsd)].filter(Boolean).join(" · ");
2608
+ }
2609
+ var an = (0, Q.memo)(function(e) {
2610
+ let { row: t, view: n, top: r, collapsed: a, searching: o, slowest: s, costliest: c, critical: u, matched: d, active: f, focusable: p, selected: m, sticky: h, clockMs: _, renderIcon: v, fillByAgent: y, motion: x } = e, S = t.span, C = D(S.status ?? "unknown"), E = O(C), k = i(S), A = n === "agents", j = t.hasChildren && a && !o, M = t.durationLabel === "—", N = t.kind === "pipeline", P = t.ok ? t.kind : "failed", F = N || t.hasChildren || t.id.startsWith("run:") ? j && !A ? t.segments : t.own : [], I = rn(t, _), L = g(t, _), ee = [...S.detail && S.detail !== e.sharedDetail ? [S.detail] : [], ...w(t).filter((t) => t !== e.sharedOutcome && (C === "unknown" || t !== E.label))], te = (n) => e.onInspect(t.id, n.currentTarget, n.clientX), R = A && t.id.startsWith("family:"), z = A && t.stepOf !== void 0, ne = R || A && N && t.own.length > 0, B = t.outcomes ?? (S.outcome ? [S.outcome] : []), V = N && !R && C === "failed" && Number.isFinite(S.endMs) && S.endMs <= _, H = (s || c) && /* @__PURE__ */ (0, Z.jsx)("span", {
2611
+ className: "fw-badge",
2612
+ title: c ? `${s ? "Longest elapsed; " : ""}highest reported cost among priced leaf agents` : A ? "Longest elapsed leaf agent" : "Longest elapsed leaf step",
2613
+ children: s ? A ? c ? "Longest · costliest leaf" : "Longest leaf" : "Longest step" : "Costliest leaf"
2614
+ });
2615
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
2616
+ role: "row",
2617
+ "data-span-id": t.id,
2618
+ "data-span-kind": P,
2619
+ "data-slowest": s || void 0,
2620
+ "data-critical": u || void 0,
2621
+ "data-search": o ? d ? "match" : "context" : void 0,
2622
+ "data-running": k || void 0,
2623
+ "data-activity": L.quiet ? "quiet" : void 0,
2624
+ "aria-level": A ? void 0 : t.depth + 1,
2625
+ "aria-expanded": t.hasChildren && !A ? !j : void 0,
2626
+ "aria-selected": m,
2627
+ tabIndex: p ? 0 : -1,
2628
+ "data-tone": l(t.tone),
2629
+ "data-outcome": y ? void 0 : S.outcome?.tone,
2630
+ className: `fw-row${f ? " fw-active" : ""}${h ? " fw-sticky-row" : ""}${N ? " fw-agent-row" : ""}${z ? " fw-step" : ""}${x?.enter === void 0 ? "" : " fw-enter"}${x?.settle ? " fw-settle" : ""}`,
2631
+ style: {
2632
+ "--row-y": `${r}px`,
2633
+ "--fw-enter-delay": `${x?.enter ?? 0}ms`,
2634
+ "--fw-end-w": `${en(I) + (V ? 20 : 0)}px`
2635
+ },
2636
+ onFocus: (n) => {
2637
+ n.target === n.currentTarget && e.onActivate(t);
2638
+ },
2639
+ onClick: (n) => {
2640
+ if (e.onActivate(t), R) {
2641
+ e.onToggle(t);
2642
+ return;
2643
+ }
2644
+ let r = A ? n.currentTarget.querySelector(".fw-bar") : null;
2645
+ r && e.onPin(t.id, r, n.target instanceof Element && n.target.closest(".fw-lane") ? n.clientX : void 0);
2646
+ },
2647
+ children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
2648
+ role: "gridcell",
2649
+ className: "fw-label",
2650
+ style: { "--depth": A ? t.inset ?? 0 : t.depth },
2651
+ children: [
2652
+ ne && /* @__PURE__ */ (0, Z.jsx)("button", {
2653
+ type: "button",
2654
+ tabIndex: -1,
2655
+ className: `fw-toggle${e.expanded ? " fw-open" : ""}`,
2656
+ "aria-label": `${e.expanded ? "Collapse" : "Expand"} ${t.name}`,
2657
+ "aria-expanded": !!e.expanded,
2658
+ onClick: (n) => {
2659
+ n.stopPropagation(), e.onToggle(t);
2660
+ },
2661
+ children: /* @__PURE__ */ (0, Z.jsx)(At, {})
2662
+ }),
2663
+ !A && /* @__PURE__ */ (0, Z.jsx)("span", {
2664
+ className: "fw-guides",
2665
+ "aria-hidden": !0
2666
+ }),
2667
+ !A && (t.hasChildren ? /* @__PURE__ */ (0, Z.jsx)("button", {
2668
+ type: "button",
2669
+ tabIndex: -1,
2670
+ className: `fw-toggle${j ? "" : " fw-open"}`,
2671
+ disabled: o,
2672
+ "aria-label": `${j ? "Expand" : "Collapse"} ${t.name}`,
2673
+ "aria-expanded": !j,
2674
+ onClick: (n) => {
2675
+ n.stopPropagation(), e.onToggle(t);
2676
+ },
2677
+ children: /* @__PURE__ */ (0, Z.jsx)(At, {})
2678
+ }) : /* @__PURE__ */ (0, Z.jsx)("span", {
2679
+ className: "fw-toggle-space",
2680
+ "aria-hidden": !0
2681
+ })),
2682
+ A && !ne && /* @__PURE__ */ (0, Z.jsx)("span", {
2683
+ className: "fw-toggle-space",
2684
+ "aria-hidden": !0
2685
+ }),
2686
+ (!A || z) && /* @__PURE__ */ (0, Z.jsx)("span", {
2687
+ className: "fw-icon-tile",
2688
+ "aria-hidden": !0,
2689
+ children: v?.(S) ?? /* @__PURE__ */ (0, Z.jsx)(kt, {
2690
+ kind: S.kind,
2691
+ name: S.name
2692
+ })
2693
+ }),
2694
+ /* @__PURE__ */ (0, Z.jsxs)("span", {
2695
+ className: "fw-names",
2696
+ title: `${t.name}${S.detail ? ` · ${S.detail}` : ""} · ${Wt[S.kind]}${k ? " · running" : ""}${t.ok ? "" : " · failed"}`,
2697
+ children: [/* @__PURE__ */ (0, Z.jsxs)("span", {
2698
+ className: `fw-span-name${N || t.hasChildren ? " fw-strong" : ""}`,
2699
+ children: [
2700
+ (N || A && !z) && B.length ? B.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
2701
+ className: "fw-agent-dot",
2702
+ "data-tone": "0",
2703
+ "data-outcome": e.tone,
2704
+ "data-ring": e.ring || void 0,
2705
+ "data-motion": e.tone === "live" && !L.quiet ? "essential" : void 0,
2706
+ title: e.label,
2707
+ "aria-hidden": !0
2708
+ }, `${e.label}:${e.tone}:${e.ring}`)) : A && !z && /* @__PURE__ */ (0, Z.jsx)("span", {
2709
+ className: "fw-agent-dot",
2710
+ "aria-hidden": !0
2711
+ }),
2712
+ k && !((N || A && !z) && B.length) && /* @__PURE__ */ (0, Z.jsx)("span", {
2713
+ className: "fw-spinner",
2714
+ "data-motion": L.quiet ? void 0 : "essential",
2715
+ role: "status",
2716
+ "aria-label": "running"
2717
+ }),
2718
+ /* @__PURE__ */ (0, Z.jsx)("span", {
2719
+ className: "fw-name-text",
2720
+ children: t.name
2721
+ }),
2722
+ !A && H,
2723
+ C !== "unknown" && !L.quiet && /* @__PURE__ */ (0, Z.jsxs)("span", {
2724
+ className: "fw-row-state",
2725
+ style: { color: `var(${E.token})` },
2726
+ children: [C !== "running" && /* @__PURE__ */ (0, Z.jsx)(T, {
2727
+ status: C,
2728
+ size: 16,
2729
+ "aria-hidden": !0
2730
+ }), E.label]
2731
+ }),
2732
+ L.quiet && /* @__PURE__ */ (0, Z.jsxs)("span", {
2733
+ className: "fw-quiet",
2734
+ title: "Running; no recorded activity during this interval",
2735
+ "aria-label": `Running; Quiet ${b(L.quietMs)} since last recorded activity`,
2736
+ children: ["Quiet ", b(L.quietMs)]
2737
+ })
2738
+ ]
2739
+ }), A && /* @__PURE__ */ (0, Z.jsxs)("span", {
2740
+ className: "fw-subtitle",
2741
+ children: [v && /* @__PURE__ */ (0, Z.jsx)("span", {
2742
+ className: "fw-detail-icon",
2743
+ "aria-hidden": !0,
2744
+ children: v(S)
2745
+ }), /* @__PURE__ */ (0, Z.jsxs)("span", {
2746
+ className: "fw-subtitle-tail",
2747
+ children: [
2748
+ H,
2749
+ /* @__PURE__ */ (0, Z.jsx)("span", {
2750
+ className: "fw-subtitle-text",
2751
+ children: ee[0]
2752
+ }),
2753
+ ee.slice(1).map((e) => /* @__PURE__ */ (0, Z.jsxs)("span", {
2754
+ className: "fw-subtitle-extra",
2755
+ children: ["· ", e]
2756
+ }, e))
2757
+ ]
2758
+ })]
2759
+ })]
2760
+ }),
2761
+ j && /* @__PURE__ */ (0, Z.jsxs)("span", {
2762
+ className: "fw-count",
2763
+ "aria-label": `${t.descendants} hidden steps`,
2764
+ children: ["+", t.descendants]
2765
+ }),
2766
+ !t.ok && !A && /* @__PURE__ */ (0, Z.jsx)("span", {
2767
+ className: "fw-alert",
2768
+ children: /* @__PURE__ */ (0, Z.jsx)(zt, { label: "failed" })
2769
+ })
2770
+ ]
2771
+ }), /* @__PURE__ */ (0, Z.jsx)("div", {
2772
+ role: "gridcell",
2773
+ className: "fw-lane",
2774
+ "data-waterfall-track": !0,
2775
+ "aria-label": `${Wt[S.kind]}, ${I}${s ? `, longest leaf ${A ? "agent" : "step"}` : ""}${c ? ", highest reported leaf-agent cost" : ""}${u ? ", critical path" : ""}`,
2776
+ children: M ? /* @__PURE__ */ (0, Z.jsx)("span", {
2777
+ className: "fw-invalid",
2778
+ children: "—"
2779
+ }) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
2780
+ S.marks?.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
2781
+ className: "fw-mark",
2782
+ "data-mark": e.kind,
2783
+ style: $t(e.at, e.at),
2784
+ title: e.label,
2785
+ "aria-label": e.label,
2786
+ role: "img"
2787
+ }, `m-${e.at}-${e.label}`)),
2788
+ /* @__PURE__ */ (0, Z.jsxs)("span", {
2789
+ className: `fw-bar fw-k-${N ? "pipeline" : P}${t.approx ? " fw-approx" : ""}${F.length ? " fw-has-marks" : ""}${t.hasAgents ? " fw-has-agents" : ""}`,
2790
+ "data-tone": l(t.tone),
2791
+ style: $t(S.startMs, k ? Qt : S.endMs),
2792
+ onPointerEnter: te,
2793
+ onPointerLeave: e.onLeave,
2794
+ onClick: (n) => {
2795
+ n.stopPropagation(), R ? e.onToggle(t) : e.onPin(t.id, n.currentTarget, n.clientX);
2796
+ },
2797
+ children: [!N && !t.ok && /* @__PURE__ */ (0, Z.jsx)("span", {
2798
+ className: "fw-glyph",
2799
+ children: /* @__PURE__ */ (0, Z.jsx)(It, {})
2800
+ }), !N && t.ok && t.retry && /* @__PURE__ */ (0, Z.jsx)("span", {
2801
+ className: "fw-glyph",
2802
+ children: /* @__PURE__ */ (0, Z.jsx)(Ft, {})
2803
+ })]
2804
+ }),
2805
+ L.quiet && /* @__PURE__ */ (0, Z.jsx)("span", {
2806
+ className: "fw-quiet-tail",
2807
+ style: $t(L.last, 0x9184e72a000),
2808
+ "aria-label": `Quiet ${b(L.quietMs)}`
2809
+ }),
2810
+ F.map((t, n) => /* @__PURE__ */ (0, Z.jsx)(tn, {
2811
+ mark: t,
2812
+ events: e,
2813
+ agentView: A
2814
+ }, `${t.id}-${n}`)),
2815
+ /* @__PURE__ */ (0, Z.jsxs)("span", {
2816
+ className: "fw-end",
2817
+ style: $t(S.startMs, k ? Qt : S.endMs),
2818
+ children: [V && /* @__PURE__ */ (0, Z.jsx)("span", {
2819
+ className: "fw-outcome-end",
2820
+ title: "Recorded end of failed agent; failure instant not reported",
2821
+ children: /* @__PURE__ */ (0, Z.jsx)(T, {
2822
+ status: "failed",
2823
+ size: 12
2824
+ })
2825
+ }), /* @__PURE__ */ (0, Z.jsx)("span", {
2826
+ className: "fw-duration",
2827
+ title: I,
2828
+ children: I
2829
+ })]
2830
+ })
2831
+ ] })
2832
+ })]
2833
+ });
2834
+ }, (e, t) => e.row === t.row && e.view === t.view && e.top === t.top && e.collapsed === t.collapsed && e.searching === t.searching && e.slowest === t.slowest && e.costliest === t.costliest && e.critical === t.critical && e.matched === t.matched && e.active === t.active && e.focusable === t.focusable && e.selected === t.selected && e.sticky === t.sticky && e.motion === t.motion && e.renderIcon === t.renderIcon && e.fillByAgent === t.fillByAgent && e.sharedDetail === t.sharedDetail && e.sharedOutcome === t.sharedOutcome && e.expanded === t.expanded && (e.clockMs === t.clockMs || !nn(e.row, e.clockMs) && !nn(t.row, t.clockMs)));
2835
+ function on({ link: e, rowHeight: t, hot: n, short: r }) {
2836
+ let i = Math.max(e.from, e.to), a = r ? Math.max(Math.min(e.from, e.to), i - 1) : Math.min(e.from, e.to), o = {
2837
+ ...$t(e.atMs, e.atMs),
2838
+ top: a * t + t / 2 + 5,
2839
+ height: (i - a) * t - 5
2840
+ };
2841
+ return /* @__PURE__ */ (0, Z.jsx)("span", {
2842
+ className: `fw-link fw-link-${e.dir}${n ? " fw-link-hot" : ""}`,
2843
+ "data-tone": l(e.tone),
2844
+ style: o,
2845
+ "aria-hidden": !0
2846
+ });
2847
+ }
2848
+ var sn = (e, t) => {
2849
+ let n = e?.getPropertyValue(t).trim() ?? "";
2850
+ return (parseFloat(n) || 0) * (n.endsWith("ms") ? 1 : 1e3);
2851
+ };
2852
+ function cn(e, t) {
2853
+ let n = t ? getComputedStyle(t) : void 0, r = sn(n, "--duration-arrive") + sn(n, "--duration-stream"), a = sn(n, "--stagger-step"), o = a * 4, s = (0, Q.useRef)(null), c = (0, Q.useRef)(/* @__PURE__ */ new Set()), l = (0, Q.useRef)(/* @__PURE__ */ new Map()), [u, d] = (0, Q.useState)(0), f = (0, Q.useMemo)(() => {
2854
+ let t = Date.now();
2855
+ for (let [e, n] of l.current) n.until <= t && l.current.delete(e);
2856
+ let n = s.current, u = 0;
2857
+ for (let s of e) {
2858
+ let e = i(s.span);
2859
+ !n || !n.has(s.id) ? l.current.set(s.id, {
2860
+ enter: Math.min(u++ * a, o),
2861
+ until: t + r + o
2862
+ }) : c.current.has(s.id) && !e && l.current.set(s.id, {
2863
+ settle: !0,
2864
+ until: t + r
2865
+ });
2866
+ }
2867
+ return s.current = new Set(e.map((e) => e.id)), c.current = new Set(e.filter((e) => i(e.span)).map((e) => e.id)), new Map(l.current);
2868
+ }, [
2869
+ e,
2870
+ u,
2871
+ t
2872
+ ]);
2873
+ return (0, Q.useEffect)(() => {
2874
+ if (f.size === 0) return;
2875
+ let e = setTimeout(() => d((e) => e + 1), r + o);
2876
+ return () => clearTimeout(e);
2877
+ }, [
2878
+ f,
2879
+ r,
2880
+ o
2881
+ ]), f;
2882
+ }
2883
+ var ln = [
2884
+ 1,
2885
+ 2,
2886
+ 5,
2887
+ 10,
2888
+ 20,
2889
+ 50,
2890
+ 100,
2891
+ 200,
2892
+ 500,
2893
+ 1e3,
2894
+ 2e3,
2895
+ 5e3,
2896
+ 1e4,
2897
+ 15e3,
2898
+ 3e4,
2899
+ 6e4,
2900
+ 12e4,
2901
+ 3e5,
2902
+ 6e5,
2903
+ 9e5,
2904
+ 18e5,
2905
+ 36e5,
2906
+ 72e5,
2907
+ 108e5,
2908
+ 216e5,
2909
+ 432e5,
2910
+ 864e5
2911
+ ];
2912
+ function un(e, t = 72) {
2913
+ let n = e * t;
2914
+ return ln.find((e) => e >= n) ?? Math.ceil(n / 864e5) * 864e5;
2915
+ }
2916
+ function dn(e, t, n, r = 72) {
2917
+ if (!(n > 0) || !(t > e)) return [0];
2918
+ let i = un((t - e) / n, r), a = [];
2919
+ for (let n = Math.ceil(e / i) * i; n <= t && a.length < 400; n += i) a.push(n);
2920
+ return a;
2921
+ }
2922
+ function fn(e) {
2923
+ if (e === 0) return "0s";
2924
+ if (e < 1e3) return `${Math.round(e)}ms`;
2925
+ if (e < 6e4) return `${+(e / 1e3).toFixed(1)}s`;
2926
+ if (e < 36e5) {
2927
+ let t = Math.floor(e / 6e4), n = Math.round(e % 6e4 / 1e3);
2928
+ return n ? `${t}m ${n}s` : `${t}m`;
2929
+ }
2930
+ let t = Math.floor(e / 36e5), n = Math.round(e % 36e5 / 6e4);
2931
+ return n ? `${t}h ${n}m` : `${t}h`;
2932
+ }
2933
+ function pn(e, t, n, r) {
2934
+ let i = e.endMs - e.startMs, a = Math.min(Math.max(50, i * t), Math.max(r, 50)), o = i > 0 ? (n - e.startMs) / i : .5;
2935
+ return mn({
2936
+ startMs: n - o * a,
2937
+ endMs: n - o * a + a
2938
+ }, r);
2939
+ }
2940
+ function mn(e, t) {
2941
+ let n = e.endMs - e.startMs, r = Math.max(0, e.startMs);
2942
+ return r + n > t && (r = Math.max(0, t - n)), {
2943
+ startMs: r,
2944
+ endMs: r + n
2945
+ };
2946
+ }
2947
+ var hn = {
2948
+ spans: 36,
2949
+ agents: 40,
2950
+ graph: 40
2951
+ }, gn = 8, _n = 4, vn = 3;
2952
+ function yn(e, t, n) {
2953
+ let r = new Map(e.map((e, t) => [e.id, t])), a = (i) => {
2954
+ let a = i.parentId;
2955
+ for (; a !== void 0;) {
2956
+ let i = r.get(a);
2957
+ if (i !== void 0 && (n === "spans" || e[i].kind === "pipeline")) return i;
2958
+ a = t.get(a)?.parentId;
2959
+ }
2960
+ }, o = [], s = /* @__PURE__ */ new Set();
2961
+ for (let t of e) {
2962
+ let n = t.span.handoffTo === void 0 ? void 0 : r.get(t.span.handoffTo), i = t.kind === "pipeline" ? r.get(t.id) : a(t);
2963
+ n !== void 0 && i !== void 0 && n !== i && (s.add(e[n].id), o.push({
2964
+ id: `h-${t.id}`,
2965
+ from: i,
2966
+ to: n,
2967
+ atMs: t.span.startMs,
2968
+ tone: e[n].tone,
2969
+ dir: n > i ? "down" : "up"
2970
+ }));
2971
+ }
2972
+ for (let [t, r] of e.entries()) {
2973
+ if (r.kind !== "pipeline" || r.parentId === void 0) continue;
2974
+ let e = a(r);
2975
+ e !== void 0 && (s.has(r.id) || o.push({
2976
+ id: `s-${r.id}`,
2977
+ from: e,
2978
+ to: t,
2979
+ atMs: r.span.startMs,
2980
+ tone: r.tone,
2981
+ dir: "down"
2982
+ }), n === "agents" && !i(r.span) && Number.isFinite(r.span.endMs) && o.push({
2983
+ id: `r-${r.id}`,
2984
+ from: t,
2985
+ to: e,
2986
+ atMs: r.span.endMs,
2987
+ tone: r.tone,
2988
+ dir: "up"
2989
+ }));
2990
+ }
2991
+ return o;
2992
+ }
2993
+ function bn(e) {
2994
+ let { rows: t, view: n, maxHeight: r, collapsed: i, searching: a, slowestId: o, activeId: s, selectedId: c, clockMs: l, window: u, trackPx: d, showCursor: f, zoomed: p } = e, [m, h] = (0, Q.useState)(!1), g = m ? 52 : hn[n], _ = (0, Q.useRef)(null), v = (0, Q.useRef)(null);
2995
+ (0, Q.useEffect)(() => {
2996
+ if (!v.current) return;
2997
+ let e = new ResizeObserver(([e]) => h(e.contentRect.width < 600));
2998
+ return e.observe(v.current), () => e.disconnect();
2999
+ }, []);
3000
+ let [y, b] = (0, Q.useState)(0), [x, S] = (0, Q.useState)(r), C = (0, Q.useRef)(e);
3001
+ C.current = e;
3002
+ let w = (0, Q.useRef)(0);
3003
+ e.holdHeight || (w.current = 0);
3004
+ let T = w.current = Math.max(w.current, Math.min(r, Math.max(t.length, 1) * g)), E = (0, Q.useMemo)(() => yn(t, e.byId, n), [
3005
+ t,
3006
+ e.byId,
3007
+ n
3008
+ ]), D = (0, Q.useMemo)(() => a ? A(t, e.query, e.matchSpan) : void 0, [
3009
+ a,
3010
+ t,
3011
+ e.query,
3012
+ e.matchSpan
3013
+ ]), O = (0, Q.useMemo)(() => new Map(t.map((e, t) => [e.id, t])), [t]), k = cn(t, v.current), [j, M] = (0, Q.useState)(), N = (u.endMs - u.startMs) / Math.max(1, d), P = u.startMs + (d + (n === "spans" ? 72 : 0)) * N, F = m ? Array.from({ length: 4 }, (e, t) => u.startMs + (u.endMs - u.startMs) * t / 3) : dn(u.startMs, P, Math.max(1, d + (n === "spans" ? 72 : 0))), I = (0, Q.useMemo)(() => {
3014
+ let t = /* @__PURE__ */ new Map();
3015
+ if (n === "agents") return t;
3016
+ let r = -Infinity;
3017
+ for (let n of [...e.markers ?? []].sort((e, t) => e.at - t.at)) {
3018
+ let e = (n.at - u.startMs) / N, i = n.label.length * 7 + 16, a = e + i > d ? "left" : "right", o = a === "right" ? e : e - i;
3019
+ e < 0 || e > d || o < r || (t.set(n, a), r = o + i + 8);
3020
+ }
3021
+ return t;
3022
+ }, [
3023
+ e.markers,
3024
+ u.startMs,
3025
+ N,
3026
+ d,
3027
+ n
3028
+ ]);
3029
+ (0, Q.useEffect)(() => {
3030
+ let e = _.current;
3031
+ if (!e) return;
3032
+ let t = new ResizeObserver(() => S(e.clientHeight));
3033
+ return t.observe(e), () => t.disconnect();
3034
+ }, []), (0, Q.useEffect)(() => {
3035
+ let e = v.current;
3036
+ if (!e) return;
3037
+ let t = (t) => {
3038
+ let { window: n, trackPx: r, zoomed: i } = C.current, a = e.querySelector("[data-fw-track]");
3039
+ if (!a) return;
3040
+ let o = a.getBoundingClientRect(), s = (n.endMs - n.startMs) / Math.max(1, r);
3041
+ if (t.ctrlKey || t.metaKey) {
3042
+ t.preventDefault();
3043
+ let e = n.startMs + (t.clientX - o.left - 12) * s;
3044
+ C.current.onZoom(Math.exp(t.deltaY * .0025), e);
3045
+ } else i && (t.shiftKey || Math.abs(t.deltaX) > Math.abs(t.deltaY)) && (t.preventDefault(), C.current.onPan((t.shiftKey ? t.deltaY : t.deltaX) * s));
3046
+ };
3047
+ return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
3048
+ }, []);
3049
+ let L = Math.max(0, y * _n - gn), ee = Math.min(t.length, y * _n + Math.ceil(x / g) + _n + gn), te = (e, r) => {
3050
+ let i = (n === "spans" ? Math.min(vn, t[e].depth) : 0) * g;
3051
+ e * g - i < r.scrollTop ? r.scrollTop = Math.max(0, e * g - i) : (e + 1) * g > r.scrollTop + r.clientHeight && (r.scrollTop = (e + 1) * g - r.clientHeight);
3052
+ }, R = (0, Q.useRef)(void 0);
3053
+ (0, Q.useEffect)(() => {
3054
+ if (!c || c === R.current) return;
3055
+ let e = O.get(c);
3056
+ e !== void 0 && _.current && (R.current = c, te(e, _.current));
3057
+ });
3058
+ let z = (t) => {
3059
+ let n = O.get(t), r = _.current;
3060
+ n !== void 0 && r && (te(n, r), e.onActiveChange(t), requestAnimationFrame(() => r.querySelector(`.fw-canvas [data-span-id="${CSS.escape(t)}"]`)?.focus({ preventScroll: !0 })));
3061
+ }, ne = (r) => {
3062
+ let o = O.get(s ?? "") ?? 0, c = t[o];
3063
+ if (!c) return;
3064
+ let l = Math.max(1, Math.floor(x / g) - 1), u = (e) => {
3065
+ r.preventDefault(), z(t[Math.max(0, Math.min(t.length - 1, e))].id);
3066
+ }, d = i.has(c.id) && !a;
3067
+ switch (r.key) {
3068
+ case "ArrowDown": return u(o + 1);
3069
+ case "ArrowUp": return u(o - 1);
3070
+ case "PageDown": return u(o + l);
3071
+ case "PageUp": return u(o - l);
3072
+ case "Home": return u(0);
3073
+ case "End": return u(t.length - 1);
3074
+ case "ArrowRight":
3075
+ n === "spans" && c.hasChildren && d || n === "agents" && c.hasChildren ? (r.preventDefault(), e.onToggle(c)) : c.hasChildren && u(o + 1);
3076
+ return;
3077
+ case "ArrowLeft":
3078
+ n === "spans" && c.hasChildren && !d ? (r.preventDefault(), e.onToggle(c)) : c.parentId !== void 0 && O.has(c.parentId) && u(O.get(c.parentId));
3079
+ return;
3080
+ case "Enter":
3081
+ case " ": {
3082
+ r.preventDefault();
3083
+ let t = _.current?.querySelector(`[data-span-id="${CSS.escape(c.id)}"] .fw-bar`);
3084
+ t && e.onPin(c.id, t);
3085
+ }
3086
+ }
3087
+ }, B = /* @__PURE__ */ (0, Z.jsxs)("div", {
3088
+ className: "fw-axis fw-axis-top",
3089
+ children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
3090
+ className: "fw-axis-label",
3091
+ children: [n === "spans" && /* @__PURE__ */ (0, Z.jsx)(Z.Fragment, { children: e.onExpandAll && /* @__PURE__ */ (0, Z.jsxs)("span", {
3092
+ className: "fw-branch-controls",
3093
+ children: [/* @__PURE__ */ (0, Z.jsx)("button", {
3094
+ type: "button",
3095
+ className: "fw-text-button",
3096
+ onClick: e.onExpandAll,
3097
+ children: "Expand all"
3098
+ }), /* @__PURE__ */ (0, Z.jsx)("button", {
3099
+ type: "button",
3100
+ className: "fw-text-button",
3101
+ onClick: e.onCollapseAll,
3102
+ children: "Collapse all"
3103
+ })]
3104
+ }) }), /* @__PURE__ */ (0, Z.jsx)("span", {
3105
+ role: "separator",
3106
+ "aria-orientation": "vertical",
3107
+ "aria-label": "Resize the step column",
3108
+ tabIndex: 0,
3109
+ className: "fw-resize",
3110
+ "aria-valuenow": Math.round(e.nameWidth),
3111
+ "aria-valuemin": 140,
3112
+ "aria-valuemax": 560,
3113
+ onPointerDown: (t) => {
3114
+ let n = t.currentTarget, r = t.clientX, i = e.nameWidth;
3115
+ n.setPointerCapture(t.pointerId);
3116
+ let a = (t) => e.onNameWidth(i + t.clientX - r), o = () => {
3117
+ n.removeEventListener("pointermove", a), n.removeEventListener("pointerup", o);
3118
+ };
3119
+ n.addEventListener("pointermove", a), n.addEventListener("pointerup", o);
3120
+ },
3121
+ onKeyDown: (t) => {
3122
+ (t.key === "ArrowLeft" || t.key === "ArrowRight") && (t.preventDefault(), e.onNameWidth(e.nameWidth + (t.key === "ArrowLeft" ? -16 : 16)));
3123
+ }
3124
+ })]
3125
+ }), /* @__PURE__ */ (0, Z.jsxs)("div", {
3126
+ className: "fw-axis-track",
3127
+ "data-fw-track": !0,
3128
+ ref: e.onTrack,
3129
+ onPointerDown: (t) => {
3130
+ let n = t.currentTarget, r = n.getBoundingClientRect(), i = (e) => Math.max(0, u.startMs + (e - r.left - 12) * (u.endMs - u.startMs) / Math.max(1, d));
3131
+ e.onScrub(i(t.clientX)), n.setPointerCapture(t.pointerId);
3132
+ let a = (t) => e.onScrub(i(t.clientX)), o = () => {
3133
+ n.removeEventListener("pointermove", a), n.removeEventListener("pointerup", o);
3134
+ };
3135
+ n.addEventListener("pointermove", a), n.addEventListener("pointerup", o);
3136
+ },
3137
+ title: "Drag to scrub",
3138
+ children: [
3139
+ F.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
3140
+ className: "fw-tick",
3141
+ style: { "--s": e },
3142
+ children: fn(e)
3143
+ }, e)),
3144
+ e.markers?.map((t) => /* @__PURE__ */ (0, Z.jsx)("button", {
3145
+ type: "button",
3146
+ className: "fw-event",
3147
+ "data-tone": t.tone ?? "neutral",
3148
+ style: { "--s": t.at },
3149
+ title: t.kind ? `${t.kind}: ${t.label}` : t.label,
3150
+ "aria-label": `Jump to ${t.kind ? `${t.kind} ` : ""}${t.label}`,
3151
+ "aria-pressed": j === t,
3152
+ onPointerDown: (e) => e.stopPropagation(),
3153
+ onClick: () => {
3154
+ if (j === t) {
3155
+ M(void 0);
3156
+ return;
3157
+ }
3158
+ M(t), e.onScrub(t.at);
3159
+ }
3160
+ }, `e-${t.at}-${t.label}`)),
3161
+ e.pauses?.map((e) => {
3162
+ let t = `${e.label} ${_e(e.endMs - e.startMs)}${e.detail ? `: ${e.detail}` : ""}`;
3163
+ return /* @__PURE__ */ (0, Z.jsx)("span", {
3164
+ className: "fw-pause-mark",
3165
+ style: {
3166
+ "--s": e.startMs,
3167
+ "--e": e.endMs
3168
+ },
3169
+ title: t,
3170
+ "aria-label": t,
3171
+ role: "img",
3172
+ tabIndex: 0,
3173
+ onPointerDown: (e) => e.stopPropagation()
3174
+ }, `pm-${e.startMs}`);
3175
+ }),
3176
+ j && /* @__PURE__ */ (0, Z.jsx)("span", {
3177
+ className: "fw-event-label",
3178
+ "data-tone": j.tone ?? "neutral",
3179
+ style: { "--s": j.at },
3180
+ children: j.label
3181
+ }),
3182
+ f && /* @__PURE__ */ (0, Z.jsx)("span", {
3183
+ className: "fw-cursor-handle",
3184
+ "aria-hidden": !0
3185
+ })
3186
+ ]
3187
+ })]
3188
+ }), V = (t, r, u = !1) => /* @__PURE__ */ (0, Z.jsx)(an, {
3189
+ row: t,
3190
+ view: n,
3191
+ top: r * g,
3192
+ collapsed: i.has(t.id),
3193
+ searching: a,
3194
+ slowest: t.id === o,
3195
+ costliest: t.id === e.costliestId,
3196
+ critical: e.criticalIds?.has(t.id),
3197
+ matched: D?.has(t.id),
3198
+ active: t.id === s,
3199
+ focusable: !u && (t.id === s || (s === void 0 || !O.has(s)) && r === 0),
3200
+ selected: t.id === c,
3201
+ sticky: u,
3202
+ motion: u ? void 0 : k.get(t.id),
3203
+ clockMs: l,
3204
+ renderIcon: e.renderIcon,
3205
+ fillByAgent: e.fillByAgent,
3206
+ sharedDetail: e.sharedDetail,
3207
+ sharedOutcome: e.sharedOutcome,
3208
+ expanded: e.expandedIds?.has(t.id),
3209
+ onToggle: e.onToggle,
3210
+ onInspect: e.onInspect,
3211
+ onLeave: e.onLeave,
3212
+ onPin: e.onPin,
3213
+ onActivate: (t) => e.onActiveChange(t.id)
3214
+ }, u ? `sticky-${t.id}` : t.id);
3215
+ return /* @__PURE__ */ (0, Z.jsxs)("div", {
3216
+ className: `fw-body fw-view-${n}${p ? " fw-zoomed" : ""}`,
3217
+ ref: v,
3218
+ children: [
3219
+ B,
3220
+ !!e.errorEnds?.length && /* @__PURE__ */ (0, Z.jsx)("div", {
3221
+ className: "fw-error-rug",
3222
+ "aria-label": `${e.errorEnds.length} errors`,
3223
+ children: e.errorEnds.map((e, t) => /* @__PURE__ */ (0, Z.jsx)("span", {
3224
+ className: "fw-error-tick",
3225
+ "data-unlocated": e === void 0 || void 0,
3226
+ style: {
3227
+ "--s": e,
3228
+ "--error-index": t
3229
+ },
3230
+ title: e === void 0 ? "Error time not reported" : `Recorded end of failed span at ${fn(e)}; failure instant not reported`
3231
+ }, t))
3232
+ }),
3233
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
3234
+ className: "fw-viewport",
3235
+ children: [
3236
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
3237
+ className: "fw-gridlayer",
3238
+ "aria-hidden": !0,
3239
+ children: [
3240
+ e.pauses?.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
3241
+ className: "fw-pause",
3242
+ style: {
3243
+ "--s": e.startMs,
3244
+ "--e": e.endMs
3245
+ }
3246
+ }, `p-${e.startMs}`)),
3247
+ F.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
3248
+ className: "fw-gridline",
3249
+ style: { "--s": e }
3250
+ }, e)),
3251
+ e.markers?.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
3252
+ className: "fw-marker-line",
3253
+ "data-tone": e.tone ?? "neutral",
3254
+ style: { "--s": e.at }
3255
+ }, `l-${e.at}-${e.label}`))
3256
+ ]
3257
+ }),
3258
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
3259
+ ref: _,
3260
+ role: "treegrid",
3261
+ "aria-label": "Trace timeline",
3262
+ "aria-rowcount": t.length,
3263
+ "aria-multiselectable": !1,
3264
+ tabIndex: -1,
3265
+ className: "fw-scroller",
3266
+ "data-primary-content": "",
3267
+ style: {
3268
+ height: T,
3269
+ maxHeight: r
3270
+ },
3271
+ onKeyDown: ne,
3272
+ onScroll: (e) => {
3273
+ let t = Math.floor(e.currentTarget.scrollTop / g / _n);
3274
+ t !== y && b(t);
3275
+ },
3276
+ children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
3277
+ className: "fw-canvas",
3278
+ style: { height: t.length * g },
3279
+ children: [/* @__PURE__ */ (0, Z.jsx)("div", {
3280
+ className: "fw-links",
3281
+ "aria-hidden": !0,
3282
+ children: E.filter((e) => Math.max(e.from, e.to) >= L && Math.min(e.from, e.to) <= ee).map((r) => {
3283
+ let i = e.focusId !== void 0 && (t[r.from]?.id === e.focusId || t[r.to]?.id === e.focusId);
3284
+ return n === "agents" && !i && r.id.startsWith("r-") ? null : /* @__PURE__ */ (0, Z.jsx)(on, {
3285
+ link: r,
3286
+ rowHeight: g,
3287
+ hot: i,
3288
+ short: n === "agents" && !i
3289
+ }, r.id);
3290
+ })
3291
+ }), t.slice(L, ee).map((e, t) => V(e, L + t))]
3292
+ }), t.length === 0 && /* @__PURE__ */ (0, Z.jsx)("p", {
3293
+ role: "status",
3294
+ className: "fw-empty",
3295
+ children: e.emptyText
3296
+ })]
3297
+ }),
3298
+ n === "spans" && /* @__PURE__ */ (0, Z.jsx)(xn, {
3299
+ scroller: _,
3300
+ rows: t,
3301
+ index: O,
3302
+ rowHeight: g,
3303
+ render: V
3304
+ }),
3305
+ e.markers?.length ? /* @__PURE__ */ (0, Z.jsx)("div", {
3306
+ className: "fw-marker-layer",
3307
+ children: e.markers.map((e) => /* @__PURE__ */ (0, Z.jsx)("span", {
3308
+ className: "fw-marker",
3309
+ "data-tone": e.tone ?? "neutral",
3310
+ style: { "--s": e.at },
3311
+ title: e.label,
3312
+ children: I.has(e) && /* @__PURE__ */ (0, Z.jsx)("span", {
3313
+ className: `fw-marker-label${I.get(e) === "left" ? " fw-marker-label-left" : ""}`,
3314
+ children: e.label
3315
+ })
3316
+ }, `${e.at}-${e.label}`))
3317
+ }) : null,
3318
+ f && e.cursorLine !== !1 && /* @__PURE__ */ (0, Z.jsx)("div", {
3319
+ className: "fw-cursor-layer",
3320
+ "aria-hidden": !0,
3321
+ children: /* @__PURE__ */ (0, Z.jsx)("span", { className: "fw-cursor fw-now" })
3322
+ })
3323
+ ]
3324
+ })
3325
+ ]
3326
+ });
3327
+ }
3328
+ function xn({ scroller: e, rows: t, index: n, rowHeight: r, render: i }) {
3329
+ let [a, o] = (0, Q.useState)(0);
3330
+ (0, Q.useEffect)(() => {
3331
+ let t = e.current;
3332
+ if (!t) return;
3333
+ let n = () => o(t.scrollTop > 0 ? Math.floor(t.scrollTop / r) : -1);
3334
+ return n(), t.addEventListener("scroll", n, { passive: !0 }), () => t.removeEventListener("scroll", n);
3335
+ }, [e, r]);
3336
+ let s = [];
3337
+ if (a >= 0) {
3338
+ let e = [], r = t[Math.min(t.length - 1, a + 1)];
3339
+ for (; r?.parentId !== void 0;) {
3340
+ let i = n.get(r.parentId);
3341
+ if (i === void 0) break;
3342
+ r = t[i], r && e.unshift(r);
3343
+ }
3344
+ for (let [t, r] of e.slice(-3).entries()) (n.get(r.id) ?? 0) < a + t + 1 && s.push(r);
3345
+ }
3346
+ return s.length ? /* @__PURE__ */ (0, Z.jsx)("div", {
3347
+ className: "fw-sticky",
3348
+ style: { height: s.length * r },
3349
+ children: s.map((e, t) => i(e, t, !0))
3350
+ }) : null;
3351
+ }
3352
+ var Sn = 100;
3353
+ function Cn(e) {
3354
+ let { root: t, slider: n, timeOutput: r, observedTotal: i, live: a, startedAt: o, snapshot: s, playing: c, speed: l, position: u, onPlaybackEnd: d, view: f, trackPx: p } = e, [m, h] = (0, Q.useState)(u ?? i), g = (0, Q.useRef)(Date.now()), _ = (0, Q.useRef)(u ?? i), v = (0, Q.useRef)({}), y = (0, Q.useRef)(e);
3355
+ y.current = e, (0, Q.useEffect)(() => {
3356
+ g.current = Date.now();
3357
+ }, [s]);
3358
+ let x = () => {
3359
+ let { observedTotal: e, startedAt: t, live: n } = y.current;
3360
+ return n ? Math.max(e, t === void 0 ? e + Date.now() - g.current : Date.now() - t) : e;
3361
+ }, S = (e, i = x()) => {
3362
+ let a = t.current;
3363
+ if (!a) return;
3364
+ let { startMs: o, endMs: s } = y.current.view(e), c = Math.max(1e-9, y.current.trackPx / Math.max(1, s - o)), l = y.current.live && !y.current.playing && y.current.position === null;
3365
+ for (let [t, n, r] of [
3366
+ [
3367
+ "--fw-t",
3368
+ e,
3369
+ c
3370
+ ],
3371
+ [
3372
+ "--fw-v0",
3373
+ o,
3374
+ c
3375
+ ],
3376
+ [
3377
+ "--fw-k",
3378
+ c,
3379
+ s - o
3380
+ ]
3381
+ ]) {
3382
+ let e = Math.abs(n - (v.current[t] ?? NaN)) * r;
3383
+ l && Number.isFinite(e) && e < .25 || (a.style.setProperty(t, String(n)), v.current[t] = n);
3384
+ }
3385
+ n.current && (n.current.max = String(Math.max(1, i, e)), n.current.value = String(e)), r.current && (r.current.textContent = b(e));
3386
+ };
3387
+ return (0, Q.useLayoutEffect)(() => {
3388
+ if (u !== null && (_.current = u), !a && !c) {
3389
+ let e = u ?? i;
3390
+ S(e), h(e);
3391
+ return;
3392
+ }
3393
+ S(c ? _.current : u ?? x());
3394
+ let e = 0, t = performance.now(), n = 0, r = (i) => {
3395
+ let a = i - t;
3396
+ t = i;
3397
+ let o, s = x();
3398
+ if (c) {
3399
+ if (_.current = Math.min(s, _.current + a * y.current.speed), o = _.current, o >= s && !y.current.live) {
3400
+ S(o, s), h(o), y.current.onPlaybackEnd(o);
3401
+ return;
3402
+ }
3403
+ } else o = y.current.position ?? s;
3404
+ S(o, s), i - n >= Sn && (n = i, h(o)), e = requestAnimationFrame(r);
3405
+ };
3406
+ return e = requestAnimationFrame(r), () => cancelAnimationFrame(e);
3407
+ }, [
3408
+ a,
3409
+ c,
3410
+ u,
3411
+ i,
3412
+ s,
3413
+ f,
3414
+ p
3415
+ ]), {
3416
+ clockMs: m,
3417
+ limitMs: x,
3418
+ positionMs: () => _.current
3419
+ };
3420
+ }
3421
+ var wn = [
3422
+ .5,
3423
+ 1,
3424
+ 1.5,
3425
+ 2,
3426
+ 4
3427
+ ];
3428
+ function Tn({ view: e, playing: t, limit: n, clockMs: r, speed: i, zoom: a, marks: o, slider: s, timeOutput: c, followLabel: u, onTogglePlay: d, onRestart: f, onSpeed: p, onScrub: m, onFollow: h, onZoom: g, onFit: _ }) {
3429
+ return /* @__PURE__ */ (0, Z.jsxs)("footer", {
3430
+ className: "fw-playback",
3431
+ children: [
3432
+ /* @__PURE__ */ (0, Z.jsx)("button", {
3433
+ type: "button",
3434
+ className: "fw-round-button",
3435
+ "aria-label": t ? "Pause" : "Play",
3436
+ disabled: n === 0,
3437
+ onClick: d,
3438
+ children: t ? /* @__PURE__ */ (0, Z.jsx)(Nt, {}) : /* @__PURE__ */ (0, Z.jsx)(Mt, {})
3439
+ }),
3440
+ /* @__PURE__ */ (0, Z.jsx)("button", {
3441
+ type: "button",
3442
+ className: "fw-icon-button",
3443
+ "aria-label": "Restart",
3444
+ title: "Replay from the start",
3445
+ disabled: n === 0,
3446
+ onClick: f,
3447
+ children: /* @__PURE__ */ (0, Z.jsx)(Pt, {})
3448
+ }),
3449
+ e === "agents" ? /* @__PURE__ */ (0, Z.jsx)("div", {
3450
+ className: "fw-segmented",
3451
+ role: "radiogroup",
3452
+ "aria-label": "Playback speed",
3453
+ children: [
3454
+ 1,
3455
+ 2,
3456
+ 4
3457
+ ].map((e) => /* @__PURE__ */ (0, Z.jsxs)("button", {
3458
+ type: "button",
3459
+ role: "radio",
3460
+ "aria-checked": i === e,
3461
+ onClick: () => p(e),
3462
+ children: [e, "x"]
3463
+ }, e))
3464
+ }) : /* @__PURE__ */ (0, Z.jsxs)("label", {
3465
+ className: "fw-speed",
3466
+ children: [/* @__PURE__ */ (0, Z.jsx)("span", {
3467
+ className: "fw-sr-only",
3468
+ children: "Playback speed"
3469
+ }), /* @__PURE__ */ (0, Z.jsx)("select", {
3470
+ "aria-label": "Playback speed",
3471
+ value: i,
3472
+ onChange: (e) => p(Number(e.target.value)),
3473
+ children: wn.map((e) => /* @__PURE__ */ (0, Z.jsxs)("option", {
3474
+ value: e,
3475
+ children: [e, "x"]
3476
+ }, e))
3477
+ })]
3478
+ }),
3479
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
3480
+ className: "fw-overview",
3481
+ style: { "--fw-progress": `${r / Math.max(1, n) * 100}%` },
3482
+ children: [
3483
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
3484
+ className: "fw-overview-marks",
3485
+ "aria-hidden": !0,
3486
+ children: [e !== "agents" && o.map((e, t) => /* @__PURE__ */ (0, Z.jsx)("span", {
3487
+ className: `fw-ov fw-seg-${e.kind}`,
3488
+ "data-tone": l(e.tone),
3489
+ style: {
3490
+ left: `${e.startMs / Math.max(1, n) * 100}%`,
3491
+ width: `${Math.max(.15, (Math.min(e.endMs, n) - e.startMs) / Math.max(1, n) * 100)}%`
3492
+ }
3493
+ }, t)), e !== "agents" && a && /* @__PURE__ */ (0, Z.jsx)("span", {
3494
+ className: "fw-brush",
3495
+ style: {
3496
+ left: `${a.startMs / n * 100}%`,
3497
+ width: `${(a.endMs - a.startMs) / n * 100}%`
3498
+ }
3499
+ })]
3500
+ }),
3501
+ /* @__PURE__ */ (0, Z.jsx)("input", {
3502
+ ref: s,
3503
+ "aria-label": "Playback position",
3504
+ type: "range",
3505
+ min: 0,
3506
+ max: Math.max(1, n),
3507
+ step: "any",
3508
+ defaultValue: r,
3509
+ disabled: n === 0,
3510
+ className: "fw-slider",
3511
+ onChange: (e) => m(Number(e.target.value))
3512
+ }),
3513
+ /* @__PURE__ */ (0, Z.jsx)("output", {
3514
+ ref: c,
3515
+ className: "fw-time",
3516
+ "aria-label": "Playback time",
3517
+ children: b(r)
3518
+ })
3519
+ ]
3520
+ }),
3521
+ u && /* @__PURE__ */ (0, Z.jsx)("button", {
3522
+ type: "button",
3523
+ className: "fw-text-button",
3524
+ onClick: h,
3525
+ children: u
3526
+ }),
3527
+ /* @__PURE__ */ (0, Z.jsxs)("div", {
3528
+ className: "fw-zoom",
3529
+ role: "group",
3530
+ "aria-label": "Zoom",
3531
+ children: [
3532
+ /* @__PURE__ */ (0, Z.jsx)("button", {
3533
+ type: "button",
3534
+ className: "fw-icon-button",
3535
+ "aria-label": "Zoom out",
3536
+ disabled: !a,
3537
+ onClick: () => g(2),
3538
+ children: /* @__PURE__ */ (0, Z.jsx)(Vt, {})
3539
+ }),
3540
+ /* @__PURE__ */ (0, Z.jsx)("button", {
3541
+ type: "button",
3542
+ className: "fw-icon-button",
3543
+ "aria-label": "Zoom in",
3544
+ disabled: n === 0,
3545
+ onClick: () => g(.5),
3546
+ children: /* @__PURE__ */ (0, Z.jsx)(Bt, {})
3547
+ }),
3548
+ /* @__PURE__ */ (0, Z.jsx)("button", {
3549
+ type: "button",
3550
+ className: "fw-icon-button",
3551
+ "aria-label": "Fit the whole trace",
3552
+ disabled: !a,
3553
+ onClick: _,
3554
+ children: /* @__PURE__ */ (0, Z.jsx)(Ht, {})
3555
+ })
3556
+ ]
3557
+ })
3558
+ ]
3559
+ });
3560
+ }
3561
+ var En = 12, Dn = 20, On = 12, kn = {
3562
+ spans: 120,
3563
+ agents: 176,
3564
+ graph: 176
3565
+ }, An = {
3566
+ spans: 320,
3567
+ agents: 240,
3568
+ graph: 240
3569
+ };
3570
+ function jn(e, t, n) {
3571
+ let [r, i] = (0, Q.useState)(n), a = e === void 0 ? r : e, o = (0, Q.useRef)(a);
3572
+ o.current = a;
3573
+ let s = (0, Q.useRef)(t);
3574
+ s.current = t;
3575
+ let c = e !== void 0;
3576
+ return [a, (0, Q.useCallback)((e) => {
3577
+ let t = typeof e == "function" ? e(o.current) : e;
3578
+ o.current = t, c || i(t), s.current?.(t);
3579
+ }, [c])];
3580
+ }
3581
+ var Mn = 320;
3582
+ function Nn(e) {
3583
+ let t = /* @__PURE__ */ new Map();
3584
+ for (let n of e) n && t.set(n, (t.get(n) ?? 0) + 1);
3585
+ let [n, r] = [...t].sort((e, t) => t[1] - e[1])[0] ?? [];
3586
+ return e.length > 1 && r !== void 0 && r >= 2 && r * 2 >= e.length ? n : void 0;
3587
+ }
3588
+ function Pn(e, t, n) {
3589
+ let i = S(t ? t.costUsd : e.costUsd, e), a = t ? t.tokens : r([e.promptTokens, e.completionTokens]), o = v(t ? t.modelCalls : e.modelCalls), s = v(t ? t.toolCalls : e.toolCalls), l = e.spans.filter((e) => c(e) && e.kind !== "pipeline").length || e.spans.filter(c).length, u = t ? t.errors : e.errors === void 0 ? l || void 0 : v(e.errors);
3590
+ return {
3591
+ cost: i,
3592
+ tokens: a,
3593
+ errors: u,
3594
+ summary: [
3595
+ ["Duration", b(n)],
3596
+ [
3597
+ i.label,
3598
+ i.value,
3599
+ i.title
3600
+ ],
3601
+ [
3602
+ "Tokens",
3603
+ a === void 0 ? "—" : C(a),
3604
+ a === void 0 ? "Tokens not reported" : `${a.toLocaleString()} tokens`
3605
+ ],
3606
+ [
3607
+ "Model calls",
3608
+ o === void 0 ? "—" : o.toLocaleString(),
3609
+ o === void 0 ? "Model calls not reported" : t ? "Reported trace total" : void 0
3610
+ ],
3611
+ [
3612
+ "Tool calls",
3613
+ s?.toLocaleString() ?? "—",
3614
+ s === void 0 ? "Tool calls not reported" : t ? "Reported trace total" : void 0
3615
+ ],
3616
+ [
3617
+ "Errors",
3618
+ u?.toLocaleString() ?? "—",
3619
+ u === void 0 ? "Errors not reported" : t ? "Reported trace total" : void 0
3620
+ ]
3621
+ ]
3622
+ };
3623
+ }
3624
+ var Fn = [
3625
+ "failed",
3626
+ "warn",
3627
+ "live",
3628
+ "neutral",
3629
+ "ok"
3630
+ ];
3631
+ function In({ rows: e, fill: t }) {
3632
+ let n = (t) => e.some((e) => e.own.some((e) => s(e) === t) || e.span.kind === t), r = [
3633
+ ["model", "Model call"],
3634
+ ["tool", "Tool call"],
3635
+ ["waiting", "Waiting / untraced"],
3636
+ ["handoff", "Handoff"]
3637
+ ].filter(([t]) => t === "waiting" ? e.some((e) => e.kind === "pipeline") : t === "handoff" ? e.some((e) => e.span.handoffTo || e.hasAgents) : n(t));
3638
+ return r.length === 0 ? null : /* @__PURE__ */ (0, Z.jsx)("ul", {
3639
+ className: "fw-legend fw-kinds",
3640
+ "aria-label": "Key",
3641
+ children: r.map(([n, r]) => {
3642
+ let i = e.flatMap((e) => e.own.flatMap((t) => s(t) === n ? [{
3643
+ owner: e,
3644
+ mark: t
3645
+ }] : [])), a = i.find(({ mark: e }) => l(e.tone) > 0) ?? i[0];
3646
+ return /* @__PURE__ */ (0, Z.jsxs)("li", {
3647
+ "data-tone": t === "agent" ? l(a?.mark.tone ?? 0) : void 0,
3648
+ "data-example": a?.owner.id,
3649
+ children: [/* @__PURE__ */ (0, Z.jsx)("span", {
3650
+ className: `fw-swatch-${n === "waiting" ? "wait" : n}`,
3651
+ "aria-hidden": !0
3652
+ }), r]
3653
+ }, n);
3654
+ })
3655
+ });
3656
+ }
3657
+ function Ln({ markers: e }) {
3658
+ if (!e?.length) return null;
3659
+ let t = [...new Set(e.map((e) => e.kind ?? "event"))], n = t.length === 1 ? `${t[0][0].toUpperCase()}${t[0].slice(1)}` : "Event";
3660
+ return /* @__PURE__ */ (0, Z.jsx)("ul", {
3661
+ className: "fw-legend fw-kinds",
3662
+ "aria-label": "Markers",
3663
+ children: /* @__PURE__ */ (0, Z.jsxs)("li", { children: [
3664
+ /* @__PURE__ */ (0, Z.jsx)("span", {
3665
+ className: "fw-swatch-event",
3666
+ "aria-hidden": !0
3667
+ }),
3668
+ n,
3669
+ " ",
3670
+ /* @__PURE__ */ (0, Z.jsx)("b", { children: e.length })
3671
+ ] })
3672
+ });
3673
+ }
3674
+ function Rn({ agents: e, selected: t, onFilter: n, neutral: r }) {
3675
+ let i = /* @__PURE__ */ new Map();
3676
+ for (let t of e) {
3677
+ let e = t.span.outcome;
3678
+ if (!e) {
3679
+ let e = i.get("Unknown") ?? {
3680
+ tone: "neutral",
3681
+ ring: !0,
3682
+ count: 0
3683
+ };
3684
+ e.count += 1, i.set("Unknown", e);
3685
+ continue;
3686
+ }
3687
+ let n = i.get(e.label) ?? {
3688
+ tone: e.tone,
3689
+ ring: e.ring,
3690
+ count: 0
3691
+ };
3692
+ n.count += 1, i.set(e.label, n);
3693
+ }
3694
+ if (i.size === 0) return null;
3695
+ let a = e.reduce((e, t) => e + t.own.reduce((e, t) => e + (t.kind === "failed" ? t.count : 0), 0), 0);
3696
+ return /* @__PURE__ */ (0, Z.jsxs)("ul", {
3697
+ className: "fw-legend",
3698
+ "aria-label": "Outcomes",
3699
+ children: [
3700
+ r && !i.has("Unknown") && /* @__PURE__ */ (0, Z.jsx)("li", { children: /* @__PURE__ */ (0, Z.jsxs)("button", {
3701
+ type: "button",
3702
+ "aria-pressed": t === null,
3703
+ onClick: () => n("__all"),
3704
+ children: [
3705
+ /* @__PURE__ */ (0, Z.jsx)("span", {
3706
+ className: "fw-swatch",
3707
+ "data-tone": "0",
3708
+ "data-outcome": "neutral",
3709
+ "data-ring": !0,
3710
+ "aria-hidden": !0
3711
+ }),
3712
+ "All outcomes ",
3713
+ /* @__PURE__ */ (0, Z.jsx)("b", { children: e.length })
3714
+ ]
3715
+ }) }),
3716
+ [...i].sort(([e, t], [n, r]) => Fn.indexOf(t.tone) - Fn.indexOf(r.tone) || e.localeCompare(n)).map(([e, r]) => /* @__PURE__ */ (0, Z.jsx)("li", { children: /* @__PURE__ */ (0, Z.jsxs)("button", {
3717
+ type: "button",
3718
+ "aria-pressed": t === e,
3719
+ onClick: () => n(e),
3720
+ children: [
3721
+ /* @__PURE__ */ (0, Z.jsx)("span", {
3722
+ className: "fw-swatch",
3723
+ "data-tone": "0",
3724
+ "data-outcome": r.tone,
3725
+ "data-ring": r.ring || void 0,
3726
+ "aria-hidden": !0
3727
+ }),
3728
+ e,
3729
+ " ",
3730
+ /* @__PURE__ */ (0, Z.jsx)("b", { children: r.count })
3731
+ ]
3732
+ }) }, e)),
3733
+ a > 0 && /* @__PURE__ */ (0, Z.jsx)("li", { children: /* @__PURE__ */ (0, Z.jsxs)("button", {
3734
+ type: "button",
3735
+ "aria-pressed": t === "__errors",
3736
+ onClick: () => n("__errors"),
3737
+ children: [
3738
+ /* @__PURE__ */ (0, Z.jsx)("span", {
3739
+ className: "fw-swatch-step",
3740
+ "aria-hidden": !0,
3741
+ children: /* @__PURE__ */ (0, Z.jsx)(It, {})
3742
+ }),
3743
+ "Failed step ",
3744
+ /* @__PURE__ */ (0, Z.jsx)("b", { children: a })
3745
+ ]
3746
+ }) })
3747
+ ]
3748
+ });
3749
+ }
3750
+ function zn({ view: e, graph: t, onChange: n }) {
3751
+ return /* @__PURE__ */ (0, Z.jsx)("div", {
3752
+ className: "fw-views",
3753
+ role: "radiogroup",
3754
+ "aria-label": "Trace view",
3755
+ children: [
3756
+ "agents",
3757
+ "spans",
3758
+ ...t ? ["graph"] : []
3759
+ ].map((t) => /* @__PURE__ */ (0, Z.jsx)("button", {
3760
+ type: "button",
3761
+ role: "radio",
3762
+ "aria-checked": e === t,
3763
+ disabled: e === t,
3764
+ className: "fw-view-button",
3765
+ onClick: () => n(t),
3766
+ children: t === "agents" ? "Agents" : t === "spans" ? "Steps" : "Graph"
3767
+ }, t))
3768
+ });
3769
+ }
3770
+ function Bn({ trace: e, live: t, startedAt: n, label: r = "Trace waterfall", defaultCollapsed: s = !1, defaultView: l = "spans", graph: u, latestEvents: h, renderIcon: v, maxHeight: b, onSelect: S, markers: C, onTimeChange: w, agentFill: T, selectedId: D, onDeselect: k, description: A, summary: j = !0, criticalPath: M = !1, query: N, onQueryChange: P, collapsed: F, onCollapsedChange: I, zoom: L, onZoomChange: ee, matchSpan: te }) {
3771
+ let R = (0, Q.useRef)(null), z = (0, Q.useRef)(null), ne = (0, Q.useRef)(null), B = (0, Q.useRef)(null), V = (0, Q.useRef)(void 0), H = (0, Q.useId)(), re = (0, Q.useId)(), [ie, ae] = (0, Q.useState)(l), U = ie === "graph" && u == null ? "agents" : ie, [oe, se] = jn(N, P, ""), [ce, le] = jn(F, I, () => new Set(s ? e.spans.flatMap((e) => e.parentId ? [e.parentId] : []) : [])), [ue, de] = (0, Q.useState)(1), [fe, pe] = (0, Q.useState)(!1), [W, me] = (0, Q.useState)(null), [he, ge] = jn(L, ee, null), [_e, ve] = (0, Q.useState)(An[l]), [ye, be] = (0, Q.useState)(0), [G, xe] = (0, Q.useState)(null), [K, Se] = (0, Q.useState)(null), [Ce, we] = (0, Q.useState)(), [Te, Ee] = (0, Q.useState)(null), De = Number.isFinite(e.totalMs) && e.totalMs >= 0 ? e.totalMs : 0, Oe = t ?? e.spans.some(i), ke = T ?? "agent", Ae = (0, Q.useMemo)(() => Math.max(De, ...e.spans.map((e) => Number.isFinite(e.endMs) ? e.endMs : 0)), [e, De]), je = Math.max(40, ye - En - (R.current && R.current.clientWidth < 600 ? En : Math.min(kn[U], ye * .3)));
3772
+ (0, Q.useEffect)(() => {
3773
+ if (!Te) return;
3774
+ let e = new ResizeObserver(([e]) => be(e.contentRect.width));
3775
+ return e.observe(Te), () => e.disconnect();
3776
+ }, [Te]);
3777
+ let Me = (0, Q.useCallback)((e) => he ?? {
3778
+ startMs: 0,
3779
+ endMs: Math.max(Ae, Oe ? e : 0, 1)
3780
+ }, [
3781
+ he,
3782
+ Ae,
3783
+ Oe
3784
+ ]), Ne = Cn({
3785
+ root: R,
3786
+ slider: ne,
3787
+ timeOutput: B,
3788
+ observedTotal: Ae,
3789
+ live: Oe,
3790
+ startedAt: n,
3791
+ snapshot: e,
3792
+ playing: fe,
3793
+ speed: ue,
3794
+ position: W,
3795
+ onPlaybackEnd: (e) => {
3796
+ pe(!1), me(e);
3797
+ },
3798
+ view: Me,
3799
+ trackPx: je
3800
+ });
3801
+ (0, Q.useEffect)(() => {
3802
+ for (let e of R.current?.getAnimations?.({ subtree: !0 }) ?? []) "animationName" in e && e.animationName === "tangle-breathe" && (e.startTime = 0);
3803
+ }, [e, U]);
3804
+ let q = Ne.clockMs, Pe = Me(q), J = Math.max(Ae, Oe ? q : 0), Fe = 2 ** Math.round(Math.log2(Math.max(1, (Pe.endMs - Pe.startMs) / Math.max(200, je) * 1.5))), Y = (0, Q.useMemo)(() => m({
3805
+ ...e,
3806
+ totalMs: Ae
3807
+ }, Fe), [
3808
+ e,
3809
+ Ae,
3810
+ Fe
3811
+ ]), Ie = (0, Q.useMemo)(() => new Map(Y.map((e) => [e.id, e])), [Y]), Le = (0, Q.useMemo)(() => p(Y), [Y]), X = (0, Q.useMemo)(() => {
3812
+ let e = Y.filter((e) => e.kind === "pipeline");
3813
+ return e.length ? e : Y.filter((e) => !e.parentId);
3814
+ }, [Y]), Re = (e) => !K || (K === "__quiet" ? g(e, q).quiet : K === "__errors" ? e.span.outcome?.tone === "failed" || !e.ok || !!e.counts?.failed : (e.span.outcome?.label ?? "Unknown") === K), ze = (0, Q.useMemo)(() => X.filter(Re), [
3815
+ X,
3816
+ K,
3817
+ Math.floor(q / 1e3)
3818
+ ]), Be = Nn(X.map((e) => e.span.detail)), Ve = Nn(X.map((e) => e.span.outcome?.label)), [He, Ue] = (0, Q.useState)(/* @__PURE__ */ new Set()), We = (0, Q.useMemo)(() => y(ze, K ? Infinity : On, He), [
3819
+ ze,
3820
+ K,
3821
+ He
3822
+ ]), [Ge, Ke] = (0, Q.useState)(/* @__PURE__ */ new Set()), qe = (0, Q.useMemo)(() => U === "agents" ? _(ze, Y, We, K ? new Set(ze.map((e) => e.id)) : Ge) : a(Y, oe, ce, te), [
3823
+ U,
3824
+ ze,
3825
+ K,
3826
+ Y,
3827
+ We,
3828
+ Ge,
3829
+ oe,
3830
+ ce,
3831
+ te
3832
+ ]), Je = U === "spans" ? f(Y, q) : void 0, Ye = (0, Q.useMemo)(() => U === "agents" ? x(qe, q) : {}, [
3833
+ U,
3834
+ qe,
3835
+ q
3836
+ ]), Xe = b ?? (U === "agents" ? hn.agents * Dn : 640), Ze = (0, Q.useRef)(!1);
3837
+ (0, Q.useLayoutEffect)(() => {
3838
+ if (U !== "agents" || Ze.current || !R.current) return;
3839
+ let e = 0;
3840
+ for (let t of R.current.querySelectorAll(".fw-view-agents .fw-row:not(.fw-sticky-row) .fw-name-text")) {
3841
+ let n = t.closest(".fw-label"), r = t.parentElement;
3842
+ n && (e = Math.max(e, r.getBoundingClientRect().right - n.getBoundingClientRect().left + t.scrollWidth - t.clientWidth));
3843
+ }
3844
+ e > 0 && ve(Math.max(140, Math.min(560, Math.ceil(e) + 16)));
3845
+ }, [U, X]), (0, Q.useEffect)(() => {
3846
+ let e = (e) => {
3847
+ if (U === "graph") return;
3848
+ let t = document.activeElement, n = R.current?.contains(t);
3849
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "f") {
3850
+ let r = Array.from(document.querySelectorAll("[data-flow-waterfall]")).find((e) => e.getClientRects().length > 0);
3851
+ if (!n && (t !== document.body || r !== R.current)) return;
3852
+ e.preventDefault(), U === "agents" && ae("spans"), requestAnimationFrame(() => {
3853
+ z.current?.focus(), z.current?.select();
3854
+ });
3855
+ return;
3856
+ }
3857
+ if (!(!n || t instanceof HTMLInputElement || t instanceof HTMLSelectElement || e.metaKey || e.ctrlKey || e.altKey)) {
3858
+ if (e.key === "+" || e.key === "=") Qe(.5);
3859
+ else if (e.key === "-" || e.key === "_") Qe(2);
3860
+ else if (e.key === "0") ge(null);
3861
+ else if (e.key === "Escape" && (G || D)) G && ut(), k?.();
3862
+ else if ((e.key === "n" || e.key === "p") && C?.length) {
3863
+ let t = C.map((e) => e.at).sort((e, t) => e - t), n = e.key === "n" ? t.find((e) => e > q + 1) : [...t].reverse().find((e) => e < q - 1);
3864
+ n !== void 0 && (e.preventDefault(), dt(n));
3865
+ }
3866
+ }
3867
+ };
3868
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
3869
+ }), (0, Q.useEffect)(() => {
3870
+ if (!G?.pinned) return;
3871
+ let e = (e) => {
3872
+ let t = e.target;
3873
+ t?.closest(".fw-card") || t?.closest(".fw-bar, .fw-seg") || xe(null);
3874
+ };
3875
+ return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
3876
+ }, [G?.pinned]);
3877
+ let Qe = (e, t) => ge((n) => {
3878
+ let r = n ?? Me(q), i = pn(r, e, t ?? (r.startMs + r.endMs) / 2, J);
3879
+ return i.endMs - i.startMs >= J - 1 ? null : i;
3880
+ }), $e = (0, Q.useRef)(0), et = (e) => {
3881
+ let t = e.span, n = Me(q), r = n.endMs - n.startMs, a = i(t) ? Math.max(t.endMs, q) : t.endMs;
3882
+ if (U !== "spans" || !Number.isFinite(a) || (a - t.startMs) / Math.max(1, r) > .25) return;
3883
+ let o = Math.max((a - t.startMs) * .15, 500, (r / 8 - (a - t.startMs)) / 2), s = mn({
3884
+ startMs: t.startMs - o,
3885
+ endMs: a + o
3886
+ }, J);
3887
+ cancelAnimationFrame($e.current);
3888
+ let c = R.current ? getComputedStyle(R.current) : void 0, l = sn(c, "--duration-base"), u = c?.getPropertyValue("--ease-standard").trim(), d = globalThis.matchMedia?.("(prefers-reduced-motion: reduce)");
3889
+ if (d?.matches || !l || !u) {
3890
+ ge(s);
3891
+ return;
3892
+ }
3893
+ let f = new Animation(new KeyframeEffect(null, [], {
3894
+ duration: l,
3895
+ easing: u,
3896
+ fill: "both"
3897
+ })), p = performance.now(), m = (e) => {
3898
+ if (d?.matches) {
3899
+ f.cancel(), ge(s);
3900
+ return;
3901
+ }
3902
+ let t = Math.min(1, (e - p) / l);
3903
+ f.currentTime = t * l;
3904
+ let r = f.effect?.getComputedTiming().progress ?? t;
3905
+ ge({
3906
+ startMs: n.startMs + (s.startMs - n.startMs) * r,
3907
+ endMs: n.endMs + (s.endMs - n.endMs) * r
3908
+ }), t < 1 ? $e.current = requestAnimationFrame(m) : f.cancel();
3909
+ };
3910
+ $e.current = requestAnimationFrame(m);
3911
+ }, tt = (e) => ge((t) => t && mn({
3912
+ startMs: t.startMs + e,
3913
+ endMs: t.endMs + e
3914
+ }, J)), nt = (0, Q.useRef)({
3915
+ toggle: (e) => {},
3916
+ pin: (e, t, n) => {},
3917
+ inspect: (e, t, n) => {}
3918
+ }), rt = (e) => {
3919
+ let t = (t) => new Set(t.has(e.id) ? [...t].filter((t) => t !== e.id) : [...t, e.id]);
3920
+ if (e.id.startsWith("family:")) {
3921
+ Ue(t);
3922
+ return;
3923
+ }
3924
+ if (S?.(e.span), U === "agents") {
3925
+ Ke(t), we(e.id);
3926
+ return;
3927
+ }
3928
+ ce.has(e.id) && et(e), le((t) => {
3929
+ let n = new Set(t);
3930
+ return n.has(e.id) ? n.delete(e.id) : n.add(e.id), n;
3931
+ });
3932
+ };
3933
+ nt.current.toggle = rt;
3934
+ let it = (0, Q.useCallback)((e) => nt.current.toggle(e), []), at = (e, t, n, r) => {
3935
+ let i = R.current?.getBoundingClientRect();
3936
+ if (!i) return;
3937
+ let a = t.getBoundingClientRect(), o = Math.min(Mn, i.width - 16), s = Math.max(8, Math.min((r ?? a.left + 24) - i.left - 24, i.width - o - 8));
3938
+ clearTimeout(V.current), xe({
3939
+ target: e,
3940
+ pinned: n,
3941
+ left: s,
3942
+ anchorTop: a.top - i.top,
3943
+ anchorBottom: a.bottom - i.top,
3944
+ above: U === "agents"
3945
+ });
3946
+ };
3947
+ (0, Q.useLayoutEffect)(() => {
3948
+ if (!G || G.fitted || !R.current) return;
3949
+ let e = document.getElementById(re)?.getBoundingClientRect();
3950
+ if (!e) return;
3951
+ let t = R.current.getBoundingClientRect().top, n = {
3952
+ above: G.anchorTop - 16,
3953
+ below: globalThis.innerHeight - (t + G.anchorBottom) - 16
3954
+ }, r = G.above ? n.above : n.below, i = G.above ? n.below : n.above, a = e.height <= r || e.height > i && r >= i ? G.above : !G.above, o = globalThis.innerHeight - t - 8 - e.height, s = Math.max(Math.min(a ? G.anchorTop - 8 - e.height : G.anchorBottom + 8, o), Math.max(8, 8 - t));
3955
+ xe({
3956
+ ...G,
3957
+ fitted: !0,
3958
+ above: a,
3959
+ top: s
3960
+ });
3961
+ }, [G, re]), nt.current.inspect = (e, t, n) => {
3962
+ G?.pinned || at(e, t, !1, n);
3963
+ };
3964
+ let ot = (0, Q.useCallback)((e, t, n) => nt.current.inspect(e, t, n), []), st = (0, Q.useCallback)(() => {
3965
+ clearTimeout(V.current), V.current = setTimeout(() => xe((e) => e?.pinned ? e : null), 140);
3966
+ }, []);
3967
+ (0, Q.useEffect)(() => {
3968
+ if (!G || G.pinned) return;
3969
+ let e = (e) => {
3970
+ e.target?.closest(".fw-bar, .fw-seg, .fw-card") || st();
3971
+ };
3972
+ return document.addEventListener("pointermove", e), () => document.removeEventListener("pointermove", e);
3973
+ }, [G, st]), nt.current.pin = (e, t, n) => {
3974
+ if (G?.pinned && G.target === e) {
3975
+ ut();
3976
+ return;
3977
+ }
3978
+ at(e, t, !0, n);
3979
+ let r = Ie.get(e);
3980
+ r && (S?.(r.span), et(r));
3981
+ };
3982
+ let ct = (0, Q.useCallback)((e, t, n) => nt.current.pin(e, t, n), []), lt = D ?? (G?.pinned ? G.target : void 0), ut = () => {
3983
+ let e = G?.target;
3984
+ xe(null), e && R.current?.querySelector(`.fw-canvas [data-span-id="${CSS.escape(e)}"]`)?.focus({ preventScroll: !0 });
3985
+ }, dt = (0, Q.useCallback)((e) => {
3986
+ pe(!1), me(Math.min(e, Ne.limitMs()));
3987
+ }, [Ne]), ft = (0, Q.useRef)(w);
3988
+ ft.current = w, (0, Q.useEffect)(() => {
3989
+ ft.current?.(W);
3990
+ }, [W]);
3991
+ let pt = () => {
3992
+ if (fe) {
3993
+ me(Ne.positionMs()), pe(!1);
3994
+ return;
3995
+ }
3996
+ (W === null || W >= J - 1) && me(0), pe(!0);
3997
+ }, mt = W !== null || fe, { errors: ht, summary: gt } = Pn(e, mt ? o(e, q) : void 0, mt ? q : J), _t = X.reduce((e, t) => e + d(t, J), 0), vt = J > 0 ? _t / J : 0, yt = (e) => {
3998
+ Se((t) => t === e || e === "__all" ? null : e), ae("agents");
3999
+ }, bt = X.filter((e) => e.span.outcome ? e.span.outcome.tone === "failed" : !e.ok).length, xt = X.filter((e) => g(e, q).quiet).length, St = e.spans.filter((e) => c(e) && e.kind !== "pipeline"), Ct = St.length ? St : e.spans.filter(c), wt = Array.from({ length: ht ?? 0 }, (e, t) => Number.isFinite(Ct[t]?.endMs) ? Ct[t].endMs : void 0), Tt = !Oe && !e.spans.some(i), Et = (e) => e && E(e, qe), Dt = Et(G ? Ie.get(G.target) ?? qe.find((e) => e.id === G.target) : void 0), $ = Dt && (() => {
4000
+ for (let e = Dt; e; e = e.parentId ? Ie.get(e.parentId) : void 0) if (e.kind === "pipeline") return Et(e);
4001
+ })(), Ot = Oe || W !== null || fe || U === "agents", kt = (0, Q.useMemo)(() => Y.filter((e) => !e.parentId).flatMap((e) => e.hasChildren ? e.segments : e.kind === "pipeline" ? [] : [{
4002
+ startMs: e.span.startMs,
4003
+ endMs: e.span.endMs,
4004
+ kind: e.ok ? "tool" : "failed",
4005
+ tone: e.tone,
4006
+ id: e.id,
4007
+ count: 1,
4008
+ retry: !1
4009
+ }]), [Y]), At = /* @__PURE__ */ (0, Z.jsx)(Tn, {
4010
+ view: U,
4011
+ playing: fe,
4012
+ limit: J,
4013
+ clockMs: q,
4014
+ speed: ue,
4015
+ zoom: he,
4016
+ marks: kt,
4017
+ slider: ne,
4018
+ timeOutput: B,
4019
+ followLabel: W === null ? void 0 : Oe ? "Follow live" : "Show full trace",
4020
+ onTogglePlay: pt,
4021
+ onRestart: () => {
4022
+ me(0), pe(!1);
4023
+ },
4024
+ onSpeed: de,
4025
+ onScrub: dt,
4026
+ onFollow: () => {
4027
+ me(null), pe(!1);
4028
+ },
4029
+ onZoom: Qe,
4030
+ onFit: () => ge(null)
4031
+ });
4032
+ return /* @__PURE__ */ (0, Z.jsxs)("section", {
4033
+ ref: R,
4034
+ "data-flow-waterfall": !0,
4035
+ "data-follow-live": Oe && W === null && !fe || void 0,
4036
+ "aria-label": r,
4037
+ className: `fw-root fw-root-${U} fw-fill-${ke}`,
4038
+ "data-selection": D ? "" : void 0,
4039
+ style: {
4040
+ "--fw-name-w": `${_e}px`,
4041
+ "--fw-pad": `${En}px`,
4042
+ "--fw-row-h": `${hn[U]}px`,
4043
+ "--fw-live": `var(${O("running").token})`,
4044
+ "--fw-failed": `var(${O("failed").token})`,
4045
+ "--fw-ok": `var(${O("done").token})`,
4046
+ "--fw-amber": `var(${O("needs-you").token})`
4047
+ },
4048
+ children: [
4049
+ /* @__PURE__ */ (0, Z.jsxs)("header", {
4050
+ className: "fw-heading",
4051
+ children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
4052
+ className: "fw-title-block",
4053
+ children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
4054
+ className: "fw-title-line",
4055
+ children: [
4056
+ /* @__PURE__ */ (0, Z.jsx)("span", {
4057
+ className: "fw-title-glyph",
4058
+ "aria-hidden": !0,
4059
+ children: /* @__PURE__ */ (0, Z.jsx)(Rt, {})
4060
+ }),
4061
+ /* @__PURE__ */ (0, Z.jsx)("h3", {
4062
+ className: "fw-title",
4063
+ children: r
4064
+ }),
4065
+ A && /* @__PURE__ */ (0, Z.jsx)("p", {
4066
+ className: "fw-description",
4067
+ title: A,
4068
+ children: A
4069
+ }),
4070
+ U === "agents" && /* @__PURE__ */ (0, Z.jsxs)("p", {
4071
+ className: "fw-headline",
4072
+ "aria-live": "polite",
4073
+ children: [
4074
+ X.length,
4075
+ " ",
4076
+ X.length === 1 ? "agent" : "agents",
4077
+ Be ? ` · ${X.every((e) => e.span.detail === Be) ? "" : "mostly "}${Be}` : "",
4078
+ Tt && vt >= 1.05 ? ` · ${vt.toFixed(1)}x parallel` : ""
4079
+ ]
4080
+ }),
4081
+ U !== "graph" && bt > 0 && /* @__PURE__ */ (0, Z.jsxs)("button", {
4082
+ type: "button",
4083
+ className: "fw-text-button fw-alert",
4084
+ "aria-pressed": K === "__errors",
4085
+ onClick: () => yt("__errors"),
4086
+ children: [
4087
+ bt,
4088
+ " of ",
4089
+ X.length,
4090
+ " failed"
4091
+ ]
4092
+ }),
4093
+ U !== "graph" && xt > 0 && /* @__PURE__ */ (0, Z.jsxs)("button", {
4094
+ type: "button",
4095
+ className: "fw-text-button fw-quiet",
4096
+ "aria-pressed": K === "__quiet",
4097
+ onClick: () => yt("__quiet"),
4098
+ children: [xt, " quiet"]
4099
+ }),
4100
+ Oe && /* @__PURE__ */ (0, Z.jsx)("span", {
4101
+ className: "fw-state fw-state-live",
4102
+ "data-motion": "essential",
4103
+ children: "Live"
4104
+ })
4105
+ ]
4106
+ }), U !== "graph" && /* @__PURE__ */ (0, Z.jsxs)("div", {
4107
+ className: "fw-legends",
4108
+ role: "region",
4109
+ "aria-label": "Timeline key",
4110
+ tabIndex: 0,
4111
+ children: [
4112
+ U === "agents" && /* @__PURE__ */ (0, Z.jsx)(In, {
4113
+ rows: qe,
4114
+ fill: ke
4115
+ }),
4116
+ /* @__PURE__ */ (0, Z.jsx)(Rn, {
4117
+ agents: X,
4118
+ neutral: qe.some((e) => e.kind === "pipeline" && !e.span.outcome && !e.outcomes?.length),
4119
+ selected: K,
4120
+ onFilter: yt
4121
+ }),
4122
+ /* @__PURE__ */ (0, Z.jsx)(Ln, { markers: C })
4123
+ ]
4124
+ })]
4125
+ }), /* @__PURE__ */ (0, Z.jsxs)("div", {
4126
+ className: "fw-tools",
4127
+ children: [/* @__PURE__ */ (0, Z.jsx)(zn, {
4128
+ view: U,
4129
+ graph: u != null,
4130
+ onChange: (e) => {
4131
+ ae(e), ve(An[e]), xe(null);
4132
+ }
4133
+ }), U === "spans" && /* @__PURE__ */ (0, Z.jsxs)("div", {
4134
+ className: "fw-search",
4135
+ children: [
4136
+ /* @__PURE__ */ (0, Z.jsx)("label", {
4137
+ htmlFor: H,
4138
+ className: "fw-sr-only",
4139
+ children: "Search trace"
4140
+ }),
4141
+ /* @__PURE__ */ (0, Z.jsx)("span", {
4142
+ className: "fw-search-glyph",
4143
+ "aria-hidden": !0,
4144
+ children: /* @__PURE__ */ (0, Z.jsx)(jt, {})
4145
+ }),
4146
+ /* @__PURE__ */ (0, Z.jsx)("input", {
4147
+ ref: z,
4148
+ id: H,
4149
+ type: "search",
4150
+ value: oe,
4151
+ placeholder: "Search",
4152
+ "aria-keyshortcuts": "Meta+f Control+f",
4153
+ onChange: (e) => se(e.target.value),
4154
+ onKeyDown: (e) => {
4155
+ e.key === "Escape" && (se(""), e.stopPropagation());
4156
+ },
4157
+ className: "fw-search-input"
4158
+ })
4159
+ ]
4160
+ })]
4161
+ })]
4162
+ }),
4163
+ U === "graph" ? u : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [
4164
+ j && /* @__PURE__ */ (0, Z.jsx)("dl", {
4165
+ className: "fw-summary",
4166
+ children: gt.map(([e, t, n]) => /* @__PURE__ */ (0, Z.jsxs)("div", {
4167
+ className: e === "Errors" && ht !== void 0 && ht > 0 ? "fw-has-errors" : void 0,
4168
+ children: [/* @__PURE__ */ (0, Z.jsx)("dt", { children: e }), /* @__PURE__ */ (0, Z.jsx)("dd", {
4169
+ className: "fw-value",
4170
+ title: n,
4171
+ children: e === "Errors" ? /* @__PURE__ */ (0, Z.jsx)("button", {
4172
+ type: "button",
4173
+ "aria-pressed": K === "__errors",
4174
+ onClick: () => yt("__errors"),
4175
+ children: t
4176
+ }) : t
4177
+ })]
4178
+ }, e))
4179
+ }),
4180
+ U === "agents" && At,
4181
+ /* @__PURE__ */ (0, Z.jsx)(bn, {
4182
+ rows: qe,
4183
+ byId: Ie,
4184
+ totalRows: Y.length,
4185
+ view: U,
4186
+ maxHeight: Xe,
4187
+ collapsed: ce,
4188
+ searching: !!oe.trim(),
4189
+ query: oe,
4190
+ matchSpan: te,
4191
+ pauses: e.pauses,
4192
+ errorEnds: wt,
4193
+ cursorLine: Oe || W !== null || fe,
4194
+ sharedDetail: Be,
4195
+ sharedOutcome: Ve,
4196
+ expandedIds: U === "agents" ? /* @__PURE__ */ new Set([...We, ...Ge]) : void 0,
4197
+ holdHeight: Oe,
4198
+ slowestId: Je?.id ?? Ye.slowestId,
4199
+ costliestId: Ye.costliestId,
4200
+ criticalIds: M && U === "spans" ? Le : void 0,
4201
+ activeId: Ce,
4202
+ selectedId: lt,
4203
+ focusId: $?.id ?? (U === "agents" ? Ce : void 0),
4204
+ clockMs: q,
4205
+ window: Pe,
4206
+ trackPx: je,
4207
+ showCursor: Ot,
4208
+ markers: C,
4209
+ fillByAgent: ke !== "outcome",
4210
+ zoomed: he !== null,
4211
+ renderIcon: v,
4212
+ emptyText: Y.length === 0 ? "No spans yet. Waiting for trace events." : `No matching steps for “${oe}”.`,
4213
+ onToggle: it,
4214
+ onInspect: ot,
4215
+ onLeave: st,
4216
+ onPin: ct,
4217
+ onActivate: (e) => we(e.id),
4218
+ onActiveChange: we,
4219
+ onScrub: dt,
4220
+ onZoom: Qe,
4221
+ onPan: tt,
4222
+ nameWidth: _e,
4223
+ onNameWidth: (e) => {
4224
+ Ze.current = !0, ve(Math.max(140, Math.min(560, e)));
4225
+ },
4226
+ onTrack: Ee,
4227
+ onExpandAll: Y.some((e) => e.hasChildren) ? () => le(/* @__PURE__ */ new Set()) : void 0,
4228
+ onCollapseAll: () => le(new Set(Y.filter((e) => e.hasChildren).map((e) => e.id)))
4229
+ }),
4230
+ G && Dt && /* @__PURE__ */ (0, Z.jsx)("div", {
4231
+ className: `fw-card-anchor${G.above && G.top === void 0 ? " fw-card-above" : ""}`,
4232
+ onPointerEnter: () => clearTimeout(V.current),
4233
+ onPointerLeave: G.pinned ? void 0 : st,
4234
+ children: /* @__PURE__ */ (0, Z.jsx)(Zt, {
4235
+ id: re,
4236
+ row: Dt,
4237
+ agent: $,
4238
+ clockMs: q,
4239
+ left: G.left,
4240
+ top: G.top ?? (G.above ? G.anchorTop - 8 : G.anchorBottom + 8),
4241
+ pinned: G.pinned,
4242
+ onClose: ut,
4243
+ renderIcon: v,
4244
+ compact: U === "agents"
4245
+ })
4246
+ }),
4247
+ U === "spans" && At
4248
+ ] }),
4249
+ h
4250
+ ]
4251
+ });
4252
+ }
4253
+ //#endregion
4254
+ export { ue as $, K as A, U as B, Ce as C, xe as D, Ve as E, ae as F, R as G, ce as H, H as I, we as J, le as K, G as L, He as M, te as N, _e as O, Ie as P, fe as Q, be as R, oe as S, Le as T, he as U, ze as V, Se as W, re as X, Ee as Y, V as Z, ye as _, Bn as a, et as at, z as b, ut as c, L as ct, Ot as d, ee as et, Ke as f, je as g, se as h, Ct as i, Oe as it, q as j, j as k, dt as l, Ue as m, lt as n, me as nt, yt as o, de as ot, Ge as p, Te as q, Dt as r, De as rt, St as s, ne as st, wt as t, I as tt, _t as u, We as v, Y as w, qe as x, pe as y, ve as z };