@mechane-ai/elements 0.60.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai.js +269 -200
- package/dist/catalog.json +9 -1
- package/dist/charts/timeline.js +1 -1
- package/dist/packages/ai/src/command-activity.d.ts +5 -1
- package/dist/packages/ai/src/index.d.ts +1 -1
- package/dist/packages/ai/src/message.d.ts +9 -1
- package/dist/packages/charts/src/timeline/index.d.ts +1 -1
- package/dist/packages/charts/src/timeline/trace-timeline-layout.d.ts +22 -1
- package/dist/packages/charts/src/timeline/trace-timeline.d.ts +4 -2
- package/dist/styles2.css +20 -0
- package/dist/timeline-kDb6bY7M.js +712 -0
- package/package.json +1 -1
- package/dist/timeline-C1d9YJlJ.js +0 -620
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
import { A as e, E as t, M as n, S as r, h as i, j as a, l as o, s } from "./plot-layout-B-b6tioh.js";
|
|
2
|
+
import { T as c, c as l, m as u, t as d } from "./src-9EJskqB_.js";
|
|
3
|
+
import { t as f } from "./chart-tones-ei3BC2AL.js";
|
|
4
|
+
import { t as p } from "./chart-cursor-1mFd48Jc.js";
|
|
5
|
+
import { i as m, l as h, n as g, r as ee, t as te } from "./figure-frame-ClYRIRAq.js";
|
|
6
|
+
import { i as ne } from "./chart-link-AE_xuxiP.js";
|
|
7
|
+
import { t as re } from "./chart-range-Du1gDxCY.js";
|
|
8
|
+
import { n as ie } from "./plot-width-D3hTycYX.js";
|
|
9
|
+
import { r as ae } from "./figure-format-B8kRZMlo.js";
|
|
10
|
+
import { a as oe } from "./tone-scope-DKiSw-JR.js";
|
|
11
|
+
import { t as se } from "./plot-axes-D5S9BnBa.js";
|
|
12
|
+
import { r as ce } from "./plot-marks-FVsbFkUs.js";
|
|
13
|
+
import { n as le, r as ue, t as de } from "./plot-surface-BlR44uTL.js";
|
|
14
|
+
import { r as fe } from "./scale-C2xgZyZN.js";
|
|
15
|
+
import * as _ from "@stylexjs/stylex";
|
|
16
|
+
import { useId as pe, useRef as me, useState as v } from "react";
|
|
17
|
+
import { stackSpans as y } from "@ui-sdk/core";
|
|
18
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
19
|
+
// packages/charts/src/timeline/trace-timeline-layout.ts
|
|
20
|
+
var S = {
|
|
21
|
+
lanes: 24,
|
|
22
|
+
spans: 2e3
|
|
23
|
+
}, C = .5, w = .005, T = .5, he = .2, ge = .15, E = 6.2, D = 10, O = 36, k = 3, _e = 18, ve = 72, ye = .45, be = 2, A = 6, j = 3.2;
|
|
24
|
+
function xe({ lanes: e, spans: t, domain: r }) {
|
|
25
|
+
let [i, a] = r;
|
|
26
|
+
if (!Number.isFinite(i) || !Number.isFinite(a) || a < i) return "The trace domain must have finite, ordered endpoints.";
|
|
27
|
+
if (e.length === 0) return "A trace timeline needs at least one lane.";
|
|
28
|
+
if (e.length > S.lanes) return `This chart draws at most ${S.lanes} lanes.`;
|
|
29
|
+
if (t.length > S.spans) return `This chart draws at most ${S.spans} spans.`;
|
|
30
|
+
if (!n(e)) return "Trace lanes must have unique identifiers.";
|
|
31
|
+
if (!n(t)) return "Trace spans must have unique identifiers.";
|
|
32
|
+
let o = new Set(e.map((e) => e.id));
|
|
33
|
+
for (let e of t) {
|
|
34
|
+
if (!o.has(e.laneId)) return `Span "${e.id}" references an unknown lane "${e.laneId}".`;
|
|
35
|
+
if (!Number.isFinite(e.start) || !Number.isFinite(e.end) || e.end < e.start) return `Span "${e.id}" must have finite, ordered endpoints.`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function Se(e, t) {
|
|
39
|
+
let [n, r] = t, i = Math.max(r - n, 0);
|
|
40
|
+
if (i === 0) return [n, r];
|
|
41
|
+
let a = i * w, o = Math.max(n, Math.min(r, e[0])), s = Math.max(n, Math.min(r, e[1]));
|
|
42
|
+
if (s < o && ([o, s] = [s, o]), s - o < a) {
|
|
43
|
+
let e = (o + s) * C;
|
|
44
|
+
o = Math.max(n, e - a * C), s = Math.min(r, o + a), o = Math.max(n, s - a);
|
|
45
|
+
}
|
|
46
|
+
return [o, s];
|
|
47
|
+
}
|
|
48
|
+
function M({ visible: e, domain: t, direction: n, anchorRatio: r = C }) {
|
|
49
|
+
let [i, a] = t, o = e[1] - e[0], s = a - i;
|
|
50
|
+
if (s <= 0) return t;
|
|
51
|
+
let c = n === "in" ? T : 1 / T, l = Math.min(s, Math.max(s * w, o * c)), u = e[0] + o * r - l * r, d = u + l;
|
|
52
|
+
return u < i && (u = i, d = Math.min(a, i + l)), d > a && (d = a, u = Math.max(i, a - l)), [u, d];
|
|
53
|
+
}
|
|
54
|
+
function Ce({ visible: e, domain: t, direction: n }) {
|
|
55
|
+
return we({
|
|
56
|
+
visible: e,
|
|
57
|
+
domain: t,
|
|
58
|
+
delta: (e[1] - e[0]) * he * (n === "left" ? -1 : 1)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function we({ visible: e, domain: t, delta: n }) {
|
|
62
|
+
let [r, i] = t, a = e[1] - e[0], o = e[0] + n, s = o + a;
|
|
63
|
+
return o < r && (o = r, s = Math.min(i, r + a)), s > i && (s = i, o = Math.max(r, i - a)), [o, s];
|
|
64
|
+
}
|
|
65
|
+
function Te(e, t) {
|
|
66
|
+
let [n, r] = t, i = r - n, a = Math.max(e.end - e.start, i * w) * ge;
|
|
67
|
+
return Se([e.start - a, e.end + a], t);
|
|
68
|
+
}
|
|
69
|
+
var N = 32;
|
|
70
|
+
function P(e, t) {
|
|
71
|
+
let n = t.get(e)?.parentId;
|
|
72
|
+
return Array.from({ length: N }, () => {
|
|
73
|
+
if (n === void 0) return null;
|
|
74
|
+
let e = n;
|
|
75
|
+
return n = t.get(e)?.parentId, e;
|
|
76
|
+
}).filter((e) => e !== null);
|
|
77
|
+
}
|
|
78
|
+
function Ee(e, t, n) {
|
|
79
|
+
if (e == null) return;
|
|
80
|
+
let r = new Map(t.map((e) => [e.id, e])), i = r.get(e);
|
|
81
|
+
if (i === void 0) return;
|
|
82
|
+
let a = P(i.id, r), o = i.relatedIds ?? [], s = (n ?? []).flatMap((e) => e.fromSpanId === i.id ? [e.toSpanId] : e.toSpanId === i.id ? [e.fromSpanId] : []), c = t.filter((e) => e.relatedIds?.includes(i.id) === !0 || P(e.id, r).includes(i.id)).map((e) => e.id);
|
|
83
|
+
return /* @__PURE__ */ new Set([
|
|
84
|
+
i.id,
|
|
85
|
+
...a,
|
|
86
|
+
...o,
|
|
87
|
+
...s,
|
|
88
|
+
...c
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
function De({ from: e, to: t }) {
|
|
92
|
+
let n = Math.abs(e.y - t.y) < 1;
|
|
93
|
+
if (t.x1 >= e.x2 - be || n) {
|
|
94
|
+
let n = e.x2, r = e.y, i = t.x1, a = t.y, o = Math.max(_e, Math.min(ve, Math.abs(i - n) * ye));
|
|
95
|
+
return {
|
|
96
|
+
sx: n,
|
|
97
|
+
sy: r,
|
|
98
|
+
c1x: n + o,
|
|
99
|
+
c1y: r,
|
|
100
|
+
c2x: i - o,
|
|
101
|
+
c2y: a,
|
|
102
|
+
ex: i,
|
|
103
|
+
ey: a
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
let r = t.y > e.y ? 1 : -1, i = Math.max(e.x1, Math.min(e.x2, t.x1)), a = e.y + r * 18 * C, o = t.x1, s = t.y - r * 18 * C, c = (a + s) * C;
|
|
107
|
+
return {
|
|
108
|
+
sx: i,
|
|
109
|
+
sy: a,
|
|
110
|
+
c1x: i,
|
|
111
|
+
c1y: c,
|
|
112
|
+
c2x: o,
|
|
113
|
+
c2y: c,
|
|
114
|
+
ex: o,
|
|
115
|
+
ey: s
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function Oe({ from: e, to: t }) {
|
|
119
|
+
let { sx: n, sy: r, c1x: i, c1y: a, c2x: o, c2y: s, ex: c, ey: l } = De({
|
|
120
|
+
from: e,
|
|
121
|
+
to: t
|
|
122
|
+
}), u = c - o, d = l - s, f = Math.hypot(u, d), p = f > 0 ? u / f : 1, m = f > 0 ? d / f : 0, h = c - p * A, g = l - m * A, ee = h - m * j, te = g + p * j, ne = h + m * j, re = g - p * j;
|
|
123
|
+
return {
|
|
124
|
+
path: `M ${n} ${r} C ${i} ${a}, ${o} ${s}, ${c - p * 5} ${l - m * 5}`,
|
|
125
|
+
arrowPoints: `${c},${l} ${ee},${te} ${ne},${re}`
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function F({ lane: e, spans: t, minExtent: n }) {
|
|
129
|
+
let r = t.filter((t) => t.laneId === e.id).map((t) => ({
|
|
130
|
+
id: t.id,
|
|
131
|
+
track: e.id,
|
|
132
|
+
start: t.start,
|
|
133
|
+
end: Math.max(t.end, t.start + n)
|
|
134
|
+
})), i = [...y(r).entries()].map(([e, t]) => [e, t.lane]), a = Math.max(0, ...i.map(([, e]) => e));
|
|
135
|
+
return {
|
|
136
|
+
entries: i,
|
|
137
|
+
rowCount: r.length === 0 ? 1 : a + 1
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function ke({ lanes: e, spans: t, minExtent: n }) {
|
|
141
|
+
let r = e.map((e) => F({
|
|
142
|
+
lane: e,
|
|
143
|
+
spans: t,
|
|
144
|
+
minExtent: n
|
|
145
|
+
}));
|
|
146
|
+
return {
|
|
147
|
+
rowBySpanId: new Map(r.flatMap((e) => e.entries)),
|
|
148
|
+
rowCountByLane: r.map((e) => e.rowCount)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function Ae(e, t, n) {
|
|
152
|
+
let r = n - D;
|
|
153
|
+
if (r < O) return;
|
|
154
|
+
let i = Math.floor(r / E), a = `${e} · ${t}`;
|
|
155
|
+
if (a.length <= i) return a;
|
|
156
|
+
if (e.length <= i) return e;
|
|
157
|
+
if (!(i <= k)) return `${e.slice(0, i - 1)}…`;
|
|
158
|
+
}
|
|
159
|
+
// packages/charts/src/timeline/trace-timeline.tsx
|
|
160
|
+
var je = 42, Me = 4, Ne = 6, I = .5, Pe = 4, Fe = 10, Ie = 96, Le = 3, Re = 5, ze = 200, Be = {
|
|
161
|
+
k1xSpc: "x1rg5ohu",
|
|
162
|
+
kzqmXN: "x1xc55vz",
|
|
163
|
+
kZKoxP: "xdk7pt",
|
|
164
|
+
kaIpWk: "x1ok0vyi",
|
|
165
|
+
kmuXW: "x2lah0s",
|
|
166
|
+
$$css: !0
|
|
167
|
+
}, Ve = {
|
|
168
|
+
kVYP8I: "xsn0423",
|
|
169
|
+
$$css: !0
|
|
170
|
+
}, L = {
|
|
171
|
+
swatch: (e) => [
|
|
172
|
+
Be,
|
|
173
|
+
{
|
|
174
|
+
kWkggS: e == null ? e : "xl8spv7",
|
|
175
|
+
$$css: !0
|
|
176
|
+
},
|
|
177
|
+
{ "--x-backgroundColor": e ?? void 0 }
|
|
178
|
+
],
|
|
179
|
+
minimapBar: (e) => [
|
|
180
|
+
Ve,
|
|
181
|
+
{
|
|
182
|
+
kDwRjp: e == null ? e : "x19zyb68",
|
|
183
|
+
$$css: !0
|
|
184
|
+
},
|
|
185
|
+
{ "--x-fill": e ?? void 0 }
|
|
186
|
+
],
|
|
187
|
+
separator: {
|
|
188
|
+
kfzvcC: "x47corl",
|
|
189
|
+
$$css: !0
|
|
190
|
+
},
|
|
191
|
+
linkGroup: {
|
|
192
|
+
kSiTet: "x1iy03kw",
|
|
193
|
+
$$css: !0
|
|
194
|
+
},
|
|
195
|
+
linkGroupReceded: {
|
|
196
|
+
kSiTet: "xvpkmg4",
|
|
197
|
+
$$css: !0
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
function He({ lanes: n, spans: y, links: S, domain: C, categories: w, visibleRange: T, onVisibleRangeChange: he, offsetFormat: ge, selected: E, onSelectedChange: D, highlightedIds: O, onActivateSpan: k, spanActions: _e, isMinimapVisible: ve = !0, xTitle: ye = "Elapsed", ...be }) {
|
|
201
|
+
let { emptyLabel: A = "No spans were recorded.", actions: j, ...N } = be, { title: P, locale: De } = N, F = ue("regular"), Be = pe(), Ve = oe(), He = ne(), [Ue, We] = v(C), [R, Ge] = v(null), [Ke, qe] = v(!1), z = me(null);
|
|
202
|
+
if (N.status === "loading") return /* @__PURE__ */ b(m, {
|
|
203
|
+
...N,
|
|
204
|
+
height: "regular"
|
|
205
|
+
});
|
|
206
|
+
let Je = xe({
|
|
207
|
+
lanes: n,
|
|
208
|
+
spans: y,
|
|
209
|
+
domain: C
|
|
210
|
+
});
|
|
211
|
+
if (Je !== void 0) return /* @__PURE__ */ b(ee, {
|
|
212
|
+
...N,
|
|
213
|
+
message: Je
|
|
214
|
+
});
|
|
215
|
+
let B = Se(T ?? Ue, C), V = Math.max(C[1] - C[0], 0), H = Math.max(B[1] - B[0], 0), U = V > 0 && H < V * .999;
|
|
216
|
+
function W(e) {
|
|
217
|
+
let t = Se(e, C);
|
|
218
|
+
T === void 0 && We(t), he?.(t);
|
|
219
|
+
}
|
|
220
|
+
let Ye = new Map((w ?? []).map((e) => [e.id, e])), G = o({
|
|
221
|
+
width: F.width,
|
|
222
|
+
valueLabels: n.map((e) => e.label),
|
|
223
|
+
hasXTitle: !0,
|
|
224
|
+
hasYTitle: !1
|
|
225
|
+
}), Xe = Math.max(1, F.width - G.left - G.right), { rowBySpanId: Ze, rowCountByLane: Qe } = ke({
|
|
226
|
+
lanes: n,
|
|
227
|
+
spans: y,
|
|
228
|
+
minExtent: H > 0 ? H / Xe * 6 : 0
|
|
229
|
+
}), $e = 0;
|
|
230
|
+
for (let e of Qe) $e += e;
|
|
231
|
+
let et = G.top + $e * 26 + n.length * 6 * 2 + G.bottom, K = s({
|
|
232
|
+
width: F.width,
|
|
233
|
+
height: et,
|
|
234
|
+
margins: G
|
|
235
|
+
}), q = fe({
|
|
236
|
+
domain: B,
|
|
237
|
+
range: [K.left, K.right]
|
|
238
|
+
}), tt = fe({
|
|
239
|
+
domain: C,
|
|
240
|
+
range: [K.left, K.right]
|
|
241
|
+
}), J = [], Y = K.top;
|
|
242
|
+
for (let [e, t] of n.entries()) {
|
|
243
|
+
let n = Qe[e] ?? 1, r = n * 26 + 12;
|
|
244
|
+
J.push({
|
|
245
|
+
lane: t,
|
|
246
|
+
index: e,
|
|
247
|
+
rowCount: n,
|
|
248
|
+
start: Y,
|
|
249
|
+
end: Y + r
|
|
250
|
+
}), Y += r;
|
|
251
|
+
}
|
|
252
|
+
let nt = new Map(J.map((e) => [e.lane.id, e])), rt = J.map((e) => ({
|
|
253
|
+
key: e.lane.id,
|
|
254
|
+
position: (e.start + e.end) * I,
|
|
255
|
+
label: e.lane.label
|
|
256
|
+
}));
|
|
257
|
+
function X(e) {
|
|
258
|
+
return ae({
|
|
259
|
+
value: e,
|
|
260
|
+
locale: De,
|
|
261
|
+
format: ge
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
let it = Math.max(Le, Math.floor(K.innerWidth / Ie)), at = i(B, it), ot = (at.length > 0 ? at : [B[0]]).map((e) => ({
|
|
265
|
+
key: String(e),
|
|
266
|
+
position: q.position(e),
|
|
267
|
+
label: X(e - C[0])
|
|
268
|
+
})), st = O !== void 0 && O.length > 0 ? new Set(O) : null, ct = Ee(E, y, S), Z = st ?? ct ?? null;
|
|
269
|
+
function lt(e, t) {
|
|
270
|
+
if (e.tone !== void 0) return e.tone;
|
|
271
|
+
let r = e.category === void 0 ? void 0 : Ye.get(e.category);
|
|
272
|
+
return r === void 0 ? Ve({
|
|
273
|
+
id: e.laneId,
|
|
274
|
+
tone: n[t]?.tone,
|
|
275
|
+
index: t
|
|
276
|
+
}) : r.tone;
|
|
277
|
+
}
|
|
278
|
+
let Q = y.map((e, t) => ({
|
|
279
|
+
span: e,
|
|
280
|
+
index: t
|
|
281
|
+
})).toSorted((e, t) => e.span.start === t.span.start ? e.index - t.index : e.span.start - t.span.start).map((e) => e.span).map((e, t) => {
|
|
282
|
+
let n = nt.get(e.laneId), r = n?.index ?? 0, i = Ze.get(e.id) ?? 0, a = (n?.start ?? K.top) + 6 + (i + I) * 26, o = q.position(e.start), s = Math.max(o + 4, q.position(e.end)), c = Math.max(K.left, o), l = Math.min(K.right, s), u = s >= K.left - 4 && o <= K.right + 4, d = lt(e, r), f = X(e.end - e.start), p = X(e.start - C[0]), m = R === null || e.category === R, h = Z === null || Z.has(e.id), g = m && h;
|
|
283
|
+
return {
|
|
284
|
+
span: e,
|
|
285
|
+
rank: t,
|
|
286
|
+
laneIndex: r,
|
|
287
|
+
laneLabel: n?.lane.label ?? e.laneId,
|
|
288
|
+
rawX1: o,
|
|
289
|
+
rawX2: s,
|
|
290
|
+
x1: c,
|
|
291
|
+
x2: l,
|
|
292
|
+
y: a,
|
|
293
|
+
isVisible: u,
|
|
294
|
+
tone: d,
|
|
295
|
+
duration: f,
|
|
296
|
+
offset: p,
|
|
297
|
+
isEmphasized: g
|
|
298
|
+
};
|
|
299
|
+
}), ut = new Map(Q.map((e) => [e.span.id, e])), dt = Q.map(({ span: e, laneLabel: t, duration: n, offset: r }) => ({
|
|
300
|
+
id: e.id,
|
|
301
|
+
label: [
|
|
302
|
+
t,
|
|
303
|
+
e.label,
|
|
304
|
+
n,
|
|
305
|
+
`at +${r}`,
|
|
306
|
+
e.badge,
|
|
307
|
+
e.detail
|
|
308
|
+
].filter((e) => e !== void 0 && e !== "").join(" · ")
|
|
309
|
+
})), $ = Q.find((e) => e.span.id === E), ft = 1 / (n.length * 2 + 1);
|
|
310
|
+
function pt(e) {
|
|
311
|
+
let t = e.x / e.width * K.width, n = e.y / e.height * K.height, r, i = Infinity;
|
|
312
|
+
for (let e of Q) {
|
|
313
|
+
let a = t >= e.x1 - Pe && t <= e.x2 + Pe, o = Math.abs(n - e.y) <= 26 * I;
|
|
314
|
+
if (e.isVisible && a && o) {
|
|
315
|
+
let a = Math.max(e.x1, Math.min(e.x2, t)), o = Math.hypot(t - a, n - e.y);
|
|
316
|
+
o <= i && (i = o, r = e.span.id);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return r;
|
|
320
|
+
}
|
|
321
|
+
function mt(e) {
|
|
322
|
+
if (V <= 0) return;
|
|
323
|
+
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = Math.max(0, Math.min(1, (n - K.left) / Math.max(1, K.innerWidth)));
|
|
324
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
325
|
+
e.preventDefault();
|
|
326
|
+
let t = e.deltaY < 0 ? "in" : "out";
|
|
327
|
+
W(M({
|
|
328
|
+
visible: B,
|
|
329
|
+
domain: C,
|
|
330
|
+
direction: t,
|
|
331
|
+
anchorRatio: r
|
|
332
|
+
}));
|
|
333
|
+
} else if (U && Math.abs(e.deltaX) > Math.abs(e.deltaY)) {
|
|
334
|
+
e.preventDefault();
|
|
335
|
+
let t = e.deltaX / Math.max(1, K.innerWidth) * H;
|
|
336
|
+
W(we({
|
|
337
|
+
visible: B,
|
|
338
|
+
domain: C,
|
|
339
|
+
delta: t
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function ht(e) {
|
|
344
|
+
if (!U || e.button !== 0 || e.pointerType === "touch") return;
|
|
345
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
346
|
+
pt({
|
|
347
|
+
x: e.clientX - t.left,
|
|
348
|
+
y: e.clientY - t.top,
|
|
349
|
+
width: t.width,
|
|
350
|
+
height: t.height
|
|
351
|
+
}) === void 0 && (z.current = {
|
|
352
|
+
clientX: e.clientX,
|
|
353
|
+
range: B
|
|
354
|
+
}, qe(!0), e.currentTarget.setPointerCapture(e.pointerId));
|
|
355
|
+
}
|
|
356
|
+
function gt(e) {
|
|
357
|
+
let t = z.current;
|
|
358
|
+
if (t === null) return;
|
|
359
|
+
let n = e.clientX - t.clientX, r = t.range[1] - t.range[0], i = -(n / Math.max(1, K.innerWidth)) * r;
|
|
360
|
+
W(we({
|
|
361
|
+
visible: t.range,
|
|
362
|
+
domain: C,
|
|
363
|
+
delta: i
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
366
|
+
function _t() {
|
|
367
|
+
z.current = null, qe(!1);
|
|
368
|
+
}
|
|
369
|
+
function vt(e) {
|
|
370
|
+
switch (e.key) {
|
|
371
|
+
case "+":
|
|
372
|
+
case "=":
|
|
373
|
+
e.preventDefault(), W(M({
|
|
374
|
+
visible: B,
|
|
375
|
+
domain: C,
|
|
376
|
+
direction: "in"
|
|
377
|
+
}));
|
|
378
|
+
break;
|
|
379
|
+
case "-":
|
|
380
|
+
e.preventDefault(), W(M({
|
|
381
|
+
visible: B,
|
|
382
|
+
domain: C,
|
|
383
|
+
direction: "out"
|
|
384
|
+
}));
|
|
385
|
+
break;
|
|
386
|
+
case "0":
|
|
387
|
+
e.preventDefault(), W(C);
|
|
388
|
+
break;
|
|
389
|
+
case "[":
|
|
390
|
+
U && (e.preventDefault(), W(Ce({
|
|
391
|
+
visible: B,
|
|
392
|
+
domain: C,
|
|
393
|
+
direction: "left"
|
|
394
|
+
})));
|
|
395
|
+
break;
|
|
396
|
+
case "]":
|
|
397
|
+
U && (e.preventDefault(), W(Ce({
|
|
398
|
+
visible: B,
|
|
399
|
+
domain: C,
|
|
400
|
+
direction: "right"
|
|
401
|
+
})));
|
|
402
|
+
break;
|
|
403
|
+
case "Enter": $ !== void 0 && k !== void 0 && (e.preventDefault(), k($.span));
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
let yt = `${X(B[0] - C[0])} – ${X(B[1] - C[0])}`, bt = /* @__PURE__ */ x(u, { children: [
|
|
407
|
+
/* @__PURE__ */ b("span", {
|
|
408
|
+
className: "xy8obcc x153jb6y xss6m8b xuxw1ft",
|
|
409
|
+
children: yt
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ b(c, {
|
|
412
|
+
variant: "outline",
|
|
413
|
+
onClick: () => W(M({
|
|
414
|
+
visible: B,
|
|
415
|
+
domain: C,
|
|
416
|
+
direction: "out"
|
|
417
|
+
})),
|
|
418
|
+
disabled: !U,
|
|
419
|
+
"aria-label": "Zoom out",
|
|
420
|
+
children: "−"
|
|
421
|
+
}),
|
|
422
|
+
/* @__PURE__ */ b(c, {
|
|
423
|
+
variant: "outline",
|
|
424
|
+
onClick: () => W(M({
|
|
425
|
+
visible: B,
|
|
426
|
+
domain: C,
|
|
427
|
+
direction: "in"
|
|
428
|
+
})),
|
|
429
|
+
disabled: V <= 0,
|
|
430
|
+
"aria-label": "Zoom in",
|
|
431
|
+
children: "+"
|
|
432
|
+
}),
|
|
433
|
+
$ !== void 0 && /* @__PURE__ */ b(c, {
|
|
434
|
+
variant: "outline",
|
|
435
|
+
onClick: () => W(Te($.span, C)),
|
|
436
|
+
"aria-label": "Zoom to selected span",
|
|
437
|
+
children: "Fit span"
|
|
438
|
+
}),
|
|
439
|
+
U && /* @__PURE__ */ b(c, {
|
|
440
|
+
variant: "ghost",
|
|
441
|
+
onClick: () => W(C),
|
|
442
|
+
"aria-label": "Reset zoom",
|
|
443
|
+
children: "Reset"
|
|
444
|
+
}),
|
|
445
|
+
j
|
|
446
|
+
] }), xt = $ !== void 0 && _e !== void 0 ? _e($.span) : [], St = w ?? [], Ct = St.length > 0, wt = k !== void 0 && xt.length === 0, Tt = $ === void 0 ? null : /* @__PURE__ */ x("div", {
|
|
447
|
+
role: "region",
|
|
448
|
+
"aria-label": "Selected span actions",
|
|
449
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi xn9t2bk x1doqdfy xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb xeuugli",
|
|
450
|
+
children: [/* @__PURE__ */ x("div", {
|
|
451
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli xk30mkq",
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ b("span", { ..._.props(L.swatch(f[$.tone])) }),
|
|
454
|
+
/* @__PURE__ */ b("span", {
|
|
455
|
+
title: $.span.label,
|
|
456
|
+
className: "xb3r6kr xlyipyv xuxw1ft xyq1l15",
|
|
457
|
+
children: /* @__PURE__ */ b(l, { children: $.span.label })
|
|
458
|
+
}),
|
|
459
|
+
/* @__PURE__ */ b("span", {
|
|
460
|
+
className: "xy8obcc x153jb6y xss6m8b xuxw1ft",
|
|
461
|
+
children: `${$.duration} (+${$.offset})`
|
|
462
|
+
}),
|
|
463
|
+
$.span.badge !== void 0 && /* @__PURE__ */ b(d, { children: $.span.badge }),
|
|
464
|
+
$.span.detail !== void 0 && /* @__PURE__ */ b("span", {
|
|
465
|
+
title: $.span.detail,
|
|
466
|
+
className: "xy8obcc x153jb6y xb3r6kr xlyipyv xuxw1ft xxc7z9f",
|
|
467
|
+
children: $.span.detail
|
|
468
|
+
})
|
|
469
|
+
]
|
|
470
|
+
}), /* @__PURE__ */ x(u, { children: [xt.map((e) => e.href === void 0 ? /* @__PURE__ */ b(c, {
|
|
471
|
+
variant: "outline",
|
|
472
|
+
onClick: e.onSelect,
|
|
473
|
+
children: e.label
|
|
474
|
+
}, e.id) : /* @__PURE__ */ b("a", {
|
|
475
|
+
href: e.href,
|
|
476
|
+
target: e.isExternal === !0 ? "_blank" : void 0,
|
|
477
|
+
rel: e.isExternal === !0 ? "noreferrer" : void 0,
|
|
478
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg x1fgtraw x5g2kb4 xy32g2j xmkeg23 x1y0btm7 x1ey3b81 xpvm0e4 xbixft x1hz01jw xy8obcc x1hl2dhg x1ypdohk x1mkwuse",
|
|
479
|
+
children: e.label
|
|
480
|
+
}, e.id)), wt && /* @__PURE__ */ b(c, {
|
|
481
|
+
variant: "solid",
|
|
482
|
+
onClick: () => k($.span),
|
|
483
|
+
children: "Inspect span"
|
|
484
|
+
})] })]
|
|
485
|
+
}), Et = V > 0 ? V / ze : 1;
|
|
486
|
+
return /* @__PURE__ */ b(t, {
|
|
487
|
+
...He,
|
|
488
|
+
items: dt,
|
|
489
|
+
place: (e) => {
|
|
490
|
+
let t = Q.find((t) => t.span.id === e), n = t?.rank ?? 0, r = (t?.laneIndex ?? 0) * ft;
|
|
491
|
+
return t === void 0 ? void 0 : {
|
|
492
|
+
left: n,
|
|
493
|
+
right: n,
|
|
494
|
+
top: r,
|
|
495
|
+
bottom: r
|
|
496
|
+
};
|
|
497
|
+
},
|
|
498
|
+
locate: pt,
|
|
499
|
+
selected: E ?? null,
|
|
500
|
+
onSelect: D,
|
|
501
|
+
render: (t, { inspected: i, cursor: o }) => {
|
|
502
|
+
let s = Q.find((e) => e.span.id === o);
|
|
503
|
+
return /* @__PURE__ */ b(g, {
|
|
504
|
+
...N,
|
|
505
|
+
actions: bt,
|
|
506
|
+
figure: t,
|
|
507
|
+
footer: y.length === 0 ? void 0 : /* @__PURE__ */ b(r, {
|
|
508
|
+
id: Be,
|
|
509
|
+
children: e(dt, i)
|
|
510
|
+
}),
|
|
511
|
+
children: y.length === 0 ? /* @__PURE__ */ b(te, { children: A }) : /* @__PURE__ */ x("div", {
|
|
512
|
+
className: "xrvj5dj xunmzkg xeuugli",
|
|
513
|
+
children: [
|
|
514
|
+
Ct && /* @__PURE__ */ x("div", {
|
|
515
|
+
role: "group",
|
|
516
|
+
"aria-label": "Filter by span category",
|
|
517
|
+
className: "x78zum5 x1a02dak x6s0dn4 xunmzkg x14w6jbu",
|
|
518
|
+
children: [St.map((e) => {
|
|
519
|
+
let t = R === e.id;
|
|
520
|
+
return /* @__PURE__ */ x("button", {
|
|
521
|
+
type: "button",
|
|
522
|
+
"aria-pressed": t,
|
|
523
|
+
onClick: () => Ge((t) => t === e.id ? null : e.id),
|
|
524
|
+
...{
|
|
525
|
+
0: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 x1ey3b81 xpvm0e4 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60" },
|
|
526
|
+
2: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60 x159tnba x1r7kqkb" },
|
|
527
|
+
1: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 x1ey3b81 xpvm0e4 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60 xyd83as" },
|
|
528
|
+
3: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60 x159tnba x1r7kqkb xyd83as" }
|
|
529
|
+
}[!!t << 1 | !(R === null || t)],
|
|
530
|
+
children: [/* @__PURE__ */ b("span", { ..._.props(L.swatch(f[e.tone])) }), /* @__PURE__ */ b("span", { children: e.label })]
|
|
531
|
+
}, e.id);
|
|
532
|
+
}), R !== null && /* @__PURE__ */ b(c, {
|
|
533
|
+
variant: "ghost",
|
|
534
|
+
onClick: () => Ge(null),
|
|
535
|
+
children: "Show all"
|
|
536
|
+
})]
|
|
537
|
+
}),
|
|
538
|
+
ve && V > 0 && /* @__PURE__ */ b("div", {
|
|
539
|
+
className: "x1n2onr6 xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb xb3r6kr",
|
|
540
|
+
children: /* @__PURE__ */ b(re, {
|
|
541
|
+
value: U ? B : null,
|
|
542
|
+
onValueChange: (e) => W(e ?? C),
|
|
543
|
+
min: C[0],
|
|
544
|
+
max: C[1],
|
|
545
|
+
step: Et,
|
|
546
|
+
describe: (e) => `${X(e[0] - C[0])} to ${X(e[1] - C[0])}`,
|
|
547
|
+
label: `${P} zoom minimap`,
|
|
548
|
+
left: K.left,
|
|
549
|
+
width: K.innerWidth,
|
|
550
|
+
height: je,
|
|
551
|
+
children: /* @__PURE__ */ b("svg", {
|
|
552
|
+
"aria-hidden": !0,
|
|
553
|
+
viewBox: `0 0 ${K.width} ${je}`,
|
|
554
|
+
className: "x1lliihq xh8yej3 x5kalc8 x87ps6o",
|
|
555
|
+
children: Q.map((e) => {
|
|
556
|
+
let t = tt.position(e.span.start), r = Math.max(t + 2, tt.position(e.span.end)), i = Ne + (n.length > 1 ? e.laneIndex / (n.length - 1) : .5) * 26;
|
|
557
|
+
return /* @__PURE__ */ b("rect", {
|
|
558
|
+
x: t,
|
|
559
|
+
y: i,
|
|
560
|
+
width: Math.max(2, r - t),
|
|
561
|
+
height: Me,
|
|
562
|
+
rx: 1.5,
|
|
563
|
+
..._.props(L.minimapBar(f[e.tone]))
|
|
564
|
+
}, `mini-${e.span.id}`);
|
|
565
|
+
})
|
|
566
|
+
})
|
|
567
|
+
})
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ b("div", {
|
|
570
|
+
onWheel: mt,
|
|
571
|
+
onPointerDown: ht,
|
|
572
|
+
onPointerMove: gt,
|
|
573
|
+
onPointerUp: _t,
|
|
574
|
+
onPointerCancel: _t,
|
|
575
|
+
onKeyDown: vt,
|
|
576
|
+
onDoubleClick: () => {
|
|
577
|
+
$ !== void 0 && k !== void 0 && k($.span);
|
|
578
|
+
},
|
|
579
|
+
...{
|
|
580
|
+
0: { className: "x1n2onr6 xeuugli x1t137rt" },
|
|
581
|
+
2: { className: "x1n2onr6 xeuugli x1t137rt x1jm3nie" },
|
|
582
|
+
1: { className: "x1n2onr6 xeuugli x1t137rt xi9pz9s x87ps6o" },
|
|
583
|
+
3: { className: "x1n2onr6 xeuugli x1t137rt xi9pz9s x87ps6o" }
|
|
584
|
+
}[!!U << 1 | !!Ke],
|
|
585
|
+
children: /* @__PURE__ */ x(le, {
|
|
586
|
+
plotRef: F.ref,
|
|
587
|
+
box: K,
|
|
588
|
+
label: a({
|
|
589
|
+
title: P,
|
|
590
|
+
marks: "spans",
|
|
591
|
+
isSelectable: D !== void 0
|
|
592
|
+
}),
|
|
593
|
+
readoutId: Be,
|
|
594
|
+
children: [
|
|
595
|
+
J.map((e, t) => t % 2 == 1 ? /* @__PURE__ */ b("rect", {
|
|
596
|
+
x: K.left,
|
|
597
|
+
y: e.start,
|
|
598
|
+
width: K.innerWidth,
|
|
599
|
+
height: e.end - e.start,
|
|
600
|
+
className: "x2wnxhi x6b6j1m x47corl"
|
|
601
|
+
}, `band-${e.lane.id}`) : null),
|
|
602
|
+
/* @__PURE__ */ b(se, {
|
|
603
|
+
box: K,
|
|
604
|
+
xTicks: ot,
|
|
605
|
+
yTicks: rt,
|
|
606
|
+
xTitle: ye,
|
|
607
|
+
grid: "x"
|
|
608
|
+
}),
|
|
609
|
+
J.slice(1).map((e) => /* @__PURE__ */ b("line", {
|
|
610
|
+
x1: K.left,
|
|
611
|
+
x2: K.right,
|
|
612
|
+
y1: e.start,
|
|
613
|
+
y2: e.start,
|
|
614
|
+
..._.props(ie.grid, L.separator)
|
|
615
|
+
}, e.lane.id)),
|
|
616
|
+
/* @__PURE__ */ x(de, {
|
|
617
|
+
box: K,
|
|
618
|
+
children: [
|
|
619
|
+
J.map((e) => Array.from({ length: e.rowCount }, (t, n) => /* @__PURE__ */ b("rect", {
|
|
620
|
+
x: K.left,
|
|
621
|
+
y: e.start + 6 + n * 26 + 8 * I,
|
|
622
|
+
width: K.innerWidth,
|
|
623
|
+
height: 18,
|
|
624
|
+
rx: 4,
|
|
625
|
+
className: "xzmcrz1 xbd1tli x47corl"
|
|
626
|
+
}, `track-${e.lane.id}-${n}`))),
|
|
627
|
+
Q.map((e) => {
|
|
628
|
+
if (!e.isVisible) return null;
|
|
629
|
+
let t = Math.max(4, e.x2 - e.x1), n = Ae(e.span.label, e.duration, t);
|
|
630
|
+
return /* @__PURE__ */ x("g", { children: [/* @__PURE__ */ b(ce, {
|
|
631
|
+
mark: e.span.id,
|
|
632
|
+
x: e.x1,
|
|
633
|
+
y: e.y - 18 * I,
|
|
634
|
+
width: t,
|
|
635
|
+
height: 18,
|
|
636
|
+
tone: e.tone,
|
|
637
|
+
emphasis: e.isEmphasized ? "normal" : "receded",
|
|
638
|
+
isInspected: i === e.span.id,
|
|
639
|
+
isSelected: E === e.span.id
|
|
640
|
+
}), n !== void 0 && /* @__PURE__ */ b("text", {
|
|
641
|
+
x: e.x1 + Re,
|
|
642
|
+
y: e.y + 4,
|
|
643
|
+
...{
|
|
644
|
+
0: { className: "xtefokc x1hz01jw xy8obcc xss6m8b x47corl x87ps6o" },
|
|
645
|
+
1: { className: "xtefokc x1hz01jw xy8obcc xss6m8b x47corl x87ps6o xyd83as" }
|
|
646
|
+
}[!e.isEmphasized | 0],
|
|
647
|
+
children: n
|
|
648
|
+
})] }, e.span.id);
|
|
649
|
+
}),
|
|
650
|
+
(S ?? []).map((e) => {
|
|
651
|
+
let t = ut.get(e.fromSpanId), n = ut.get(e.toSpanId);
|
|
652
|
+
if (t === void 0 || n === void 0) return null;
|
|
653
|
+
let r = Math.min(t.rawX1, n.rawX1);
|
|
654
|
+
if (Math.max(t.rawX2, n.rawX2) < K.left - 4 || r > K.right + 4) return null;
|
|
655
|
+
let i = Oe({
|
|
656
|
+
from: {
|
|
657
|
+
x1: t.rawX1,
|
|
658
|
+
x2: t.rawX2,
|
|
659
|
+
y: t.y
|
|
660
|
+
},
|
|
661
|
+
to: {
|
|
662
|
+
x1: n.rawX1,
|
|
663
|
+
x2: n.rawX2,
|
|
664
|
+
y: n.y
|
|
665
|
+
}
|
|
666
|
+
}), a = f[e.tone ?? "positive"], o = Z === null ? t.isEmphasized || n.isEmphasized : Z.has(e.fromSpanId) || Z.has(e.toSpanId);
|
|
667
|
+
return /* @__PURE__ */ x("g", {
|
|
668
|
+
..._.props(ie.emphasis, L.linkGroup, !o && L.linkGroupReceded),
|
|
669
|
+
children: [
|
|
670
|
+
e.label !== void 0 && e.label.length > 0 && /* @__PURE__ */ b("title", { children: e.label }),
|
|
671
|
+
/* @__PURE__ */ b("path", {
|
|
672
|
+
d: i.path,
|
|
673
|
+
stroke: a,
|
|
674
|
+
className: "xbh8q5q xhr4kjn x1owpc8m x1f6yumg x13efnbd"
|
|
675
|
+
}),
|
|
676
|
+
/* @__PURE__ */ b("polygon", {
|
|
677
|
+
points: i.arrowPoints,
|
|
678
|
+
fill: a
|
|
679
|
+
})
|
|
680
|
+
]
|
|
681
|
+
}, e.id);
|
|
682
|
+
})
|
|
683
|
+
]
|
|
684
|
+
}),
|
|
685
|
+
s !== void 0 && s.isVisible && /* @__PURE__ */ b(p, {
|
|
686
|
+
x: (s.x1 + s.x2) * I,
|
|
687
|
+
top: K.top,
|
|
688
|
+
bottom: K.bottom,
|
|
689
|
+
width: Fe
|
|
690
|
+
})
|
|
691
|
+
]
|
|
692
|
+
})
|
|
693
|
+
}),
|
|
694
|
+
Tt,
|
|
695
|
+
/* @__PURE__ */ b(h, {
|
|
696
|
+
label: `${P} spans`,
|
|
697
|
+
columns: [{
|
|
698
|
+
id: "span",
|
|
699
|
+
label: "Span"
|
|
700
|
+
}],
|
|
701
|
+
rows: dt.map((e) => ({
|
|
702
|
+
id: e.id,
|
|
703
|
+
values: [e.label]
|
|
704
|
+
}))
|
|
705
|
+
})
|
|
706
|
+
]
|
|
707
|
+
})
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
export { S as n, He as t };
|