@overdoser/react-toolkit 0.12.0 → 0.14.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.
@@ -1,355 +1,361 @@
1
- import { jsx as t, jsxs as a, Fragment as P } from "react/jsx-runtime";
2
- import { forwardRef as vt, useRef as p, useState as f, useEffect as ae, useCallback as ie, useLayoutEffect as Nt, useMemo as Bl } from "react";
3
- import c from "clsx";
1
+ import { jsx as n, jsxs as a, Fragment as D } from "react/jsx-runtime";
2
+ import { forwardRef as xl, useRef as p, useState as f, useEffect as le, useCallback as ne, useLayoutEffect as Cl, useMemo as Et } from "react";
3
+ import o from "clsx";
4
4
  import i from "./Timeline.module.scss.js";
5
- import l from "./TraceTimeline.module.scss.js";
6
- import { fmtDateISO as we, fmtClockUTC as z, fmtISO as A, ticks as yt, tickSubdiv as bt, TL_COLORS as S, fmtDur as xe, eventMatches as wt, tint as D, TIMELINE_PALETTE_VARS as Hl } from "./timelineCore.js";
7
- import { traceChipWidth as xt, layoutTraceBand as St } from "./traceLayout.js";
8
- import { TimelineSummary as Ct, TimelineZoomControls as kt, TimelineLegend as Tt, HighlightText as El, TimelineResizer as Qe, TimelineTooltip as Mt } from "./TimelineShared.js";
9
- import { useNowTicker as Rt, useContainerWidth as Lt, useTimelinePan as Bt, useWheelZoom as Ht, animateScrollTo as Pl, wheelZoomAllowed as Et } from "./useTimeline.js";
10
- import { CopyButton as Se } from "../ActionButton/CopyButton.js";
11
- const N = 84, Dl = 24, F = 400, Pt = 51, Ce = 300, Jt = vt(
12
- function(Wl, ql) {
5
+ import t from "./TraceTimeline.module.scss.js";
6
+ import { fmtDateISO as Ne, fmtClockUTC as A, fmtISO as be, ticks as Tl, tickSubdiv as Ml, TL_COLORS as C, fmtDur as Ke, eventMatches as Sl, tint as W, TIMELINE_PALETTE_VARS as Bt } from "./timelineCore.js";
7
+ import { traceChipWidth as kl, layoutTraceBand as Ll } from "./traceLayout.js";
8
+ import { TimelineSummary as Rl, TimelineZoomControls as Pl, TimelineLegend as El, HighlightText as je, TimelineResizer as Ye, TimelineTooltip as Bl } from "./TimelineShared.js";
9
+ import { TraceEventDetails as Dl, EventBadge as Wl, FieldRow as Hl } from "./TraceEventDetails.js";
10
+ import { ridOf as se, srcOf as Dt, isRequestEvent as Wt, routeOf as Ht, toText as q } from "./traceEvent.js";
11
+ import { useNowTicker as zl, useContainerWidth as Il, useTimelinePan as Al, useWheelZoom as ql, animateScrollTo as zt, wheelZoomAllowed as Fl } from "./useTimeline.js";
12
+ import { CopyButton as Je } from "../ActionButton/CopyButton.js";
13
+ const N = 84, It = 24, F = 400, Ol = 51, we = 300, tn = xl(
14
+ function(At, qt) {
13
15
  const {
14
16
  events: u,
15
- title: ke,
16
- meta: Te,
17
- highlight: Me,
18
- defaultHighlight: Ol,
19
- onHighlightChange: Il,
20
- showSearch: zl = !0,
21
- renderSearch: el,
22
- services: ll,
23
- serviceColors: Al,
24
- compactRows: Fl = !1,
25
- showGridlines: Vl = !0,
26
- showControls: tl = !0,
27
- wheelZoom: Re = "ctrl",
28
- showLegend: Ul = !0,
29
- showSummary: re = !0,
30
- summaryPlacement: B = "bubble",
31
- summaryDefaultPosition: $l,
32
- showDock: C = !0,
33
- defaultDock: Jl = null,
34
- maxHeight: Kl = "80vh",
35
- minHeight: Xl = 420,
36
- selectedEventId: V,
37
- defaultSelectedEventId: sl = null,
38
- onEventSelect: Zl,
39
- renderChip: nl,
40
- renderTooltip: Le,
41
- renderDetails: Be,
17
+ title: xe,
18
+ meta: Ce,
19
+ highlight: Te,
20
+ defaultHighlight: Ft,
21
+ onHighlightChange: Ot,
22
+ showSearch: Ut = !0,
23
+ renderSearch: Qe,
24
+ services: et,
25
+ serviceColors: Vt,
26
+ compactRows: $t = !1,
27
+ showGridlines: Xt = !0,
28
+ showControls: tt = !0,
29
+ wheelZoom: Me = "ctrl",
30
+ showLegend: Zt = !0,
31
+ showSummary: ae = !0,
32
+ summaryPlacement: P = "bubble",
33
+ summaryDefaultPosition: Gt,
34
+ showDock: T = !0,
35
+ defaultDock: _t = null,
36
+ showExtraFields: Kt = !0,
37
+ hiddenFields: lt,
38
+ maxHeight: jt = "80vh",
39
+ minHeight: Yt = 420,
40
+ selectedEventId: O,
41
+ defaultSelectedEventId: nt = null,
42
+ onEventSelect: Jt,
43
+ renderChip: st,
44
+ renderTooltip: Se,
45
+ renderDetails: ke,
42
46
  classes: m,
43
- className: jl,
44
- style: Gl
45
- } = Wl, g = p(null), [al, il] = f(null), [rl, cl] = f(!0), [y, He] = f(null), [_l, ol] = f(null), [H, Ee] = f(null), [U, dl] = f(null), [Yl, Ql] = f(null), [et, lt] = f(null), ul = p(!1), [tt, st] = f(sl), v = V !== void 0 ? V : tt, [x, $] = f(
46
- () => C ? Jl ?? ((V !== void 0 ? V : sl) != null ? "details" : null) : null
47
- ), [ce, ml] = f(360), [hl, nt] = f(420), pl = p(v);
48
- ae(() => {
49
- v != null && v !== pl.current && C && x == null && $("details"), pl.current = v;
50
- }, [v, C, x]);
51
- const [oe, at] = f({ l: 0, w: 0 }), fl = p(re);
52
- fl.current = re;
53
- const Pe = ie(() => {
47
+ className: Qt,
48
+ style: el
49
+ } = At, g = p(null), [at, it] = f(null), [ot, rt] = f(!0), [v, Le] = f(null), [tl, ct] = f(null), [E, Re] = f(null), [U, dt] = f(null), [ll, nl] = f(null), [sl, al] = f(null), ut = p(!1), [il, ol] = f(nt), y = O !== void 0 ? O : il, [w, V] = f(
50
+ () => T ? _t ?? ((O !== void 0 ? O : nt) != null ? "details" : null) : null
51
+ ), [ie, mt] = f(360), [ht, rl] = f(420), pt = p(y);
52
+ le(() => {
53
+ y != null && y !== pt.current && T && w == null && V("details"), pt.current = y;
54
+ }, [y, T, w]);
55
+ const [oe, cl] = f({ l: 0, w: 0 }), ft = p(ae);
56
+ ft.current = ae;
57
+ const Pe = ne(() => {
54
58
  const e = g.current;
55
- e && at(
56
- (s) => s.l === e.scrollLeft && s.w === e.clientWidth ? s : { l: e.scrollLeft, w: e.clientWidth }
59
+ e && cl(
60
+ (l) => l.l === e.scrollLeft && l.w === e.clientWidth ? l : { l: e.scrollLeft, w: e.clientWidth }
57
61
  );
58
62
  }, []);
59
- ae(() => {
60
- re && Pe();
63
+ le(() => {
64
+ ae && Pe();
61
65
  });
62
- const [J, it] = f({ l: 0, w: 2e3 }), De = p(J);
63
- De.current = J;
64
- const We = ie(() => {
66
+ const [$, dl] = f({ l: 0, w: 2e3 }), Ee = p($);
67
+ Ee.current = $;
68
+ const Be = ne(() => {
65
69
  const e = g.current;
66
70
  if (!e) return;
67
- const s = Math.floor(e.scrollLeft / F) * F, n = (Math.ceil((e.clientWidth || 1600) / F) + 1) * F;
68
- (s !== De.current.l || n !== De.current.w) && it({ l: s, w: n });
69
- }, []), gl = u.some((e) => e.end == null), M = Rt(gl, 400), de = Lt(g), K = Bt(g), X = p(null), Z = p(null), vl = p(null), [rt, Nl] = f(null), j = p(null);
70
- ae(
71
+ const l = Math.floor(e.scrollLeft / F) * F, s = (Math.ceil((e.clientWidth || 1600) / F) + 1) * F;
72
+ (l !== Ee.current.l || s !== Ee.current.w) && dl({ l, w: s });
73
+ }, []), gt = u.some((e) => e.end == null), k = zl(gt, 400), re = Il(g), X = Al(g), Z = p(null), G = p(null), vt = p(null), [ul, yt] = f(null), _ = p(null);
74
+ le(
71
75
  () => () => {
72
- j.current && clearTimeout(j.current);
76
+ _.current && clearTimeout(_.current);
73
77
  },
74
78
  []
75
79
  );
76
- const [ct, ot] = f(Ol ?? ""), qe = Me !== void 0 ? Me : ct, L = qe.trim(), yl = (e) => {
77
- Me === void 0 && ot(e), Il?.(e);
78
- }, bl = el ? el({ value: qe, setValue: yl }) : zl ? /* @__PURE__ */ t(
80
+ const [ml, hl] = f(Ft ?? ""), De = Te !== void 0 ? Te : ml, M = De.trim(), Nt = (e) => {
81
+ Te === void 0 && hl(e), Ot?.(e);
82
+ }, bt = Qe ? Qe({ value: De, setValue: Nt }) : Ut ? /* @__PURE__ */ n(
79
83
  "input",
80
84
  {
81
- className: c(i.searchInput, m?.search),
85
+ className: o(i.searchInput, m?.search),
82
86
  placeholder: "Highlight keyword in events…",
83
87
  "aria-label": "Highlight keyword",
84
- value: qe,
85
- onChange: (e) => yl(e.target.value)
88
+ value: De,
89
+ onChange: (e) => Nt(e.target.value)
86
90
  }
87
- ) : null, W = (e) => e.op || e.requestId || e.reqHeaders && e.reqHeaders["x-request-id"] || e.id, G = (e) => e.source || "client";
88
- let d, _;
89
- u.length ? (d = Math.min(...u.map((e) => e.start)), _ = Math.max(d + 1e3, ...u.map((e) => e.end ?? M))) : (d = M - 3e4, _ = M + 5e3);
90
- const Oe = (_ - d) * 0.03;
91
- d -= Oe, _ += Oe;
92
- const Ie = _ - d, wl = Math.max(240, de - N - Dl), ue = Math.max(wl * 0.45, wl - 210) / Ie, b = rl || !al ? ue : al, ze = p(ue), q = p(b), Ae = p(d), Fe = p(1e9);
93
- ze.current = ue, q.current = b, Ae.current = d;
94
- const me = p(null);
95
- Nt(() => {
96
- me.current != null && g.current && (g.current.scrollLeft = me.current, me.current = null), We();
91
+ ) : null;
92
+ let d, K;
93
+ u.length ? (d = Math.min(...u.map((e) => e.start)), K = Math.max(d + 1e3, ...u.map((e) => e.end ?? k))) : (d = k - 3e4, K = k + 5e3);
94
+ const We = (K - d) * 0.03;
95
+ d -= We, K += We;
96
+ const He = K - d, wt = Math.max(240, re - N - It), ce = Math.max(wt * 0.45, wt - 210) / He, b = ot || !at ? ce : at, ze = p(ce), H = p(b), Ie = p(d), Ae = p(1e9);
97
+ ze.current = ce, H.current = b, Ie.current = d;
98
+ const de = p(null);
99
+ Cl(() => {
100
+ de.current != null && g.current && (g.current.scrollLeft = de.current, de.current = null), Be();
97
101
  });
98
- const Ve = ie((e, s) => {
99
- const n = g.current;
100
- if (!n) return;
101
- const h = q.current || 1e-3, o = Math.max(ze.current ? ze.current * 0.2 : 1e-7, Math.min(10, h * e)), w = (n.scrollLeft + s - N) / h;
102
- me.current = w * o + N - s, cl(!1), il(o);
102
+ const qe = ne((e, l) => {
103
+ const s = g.current;
104
+ if (!s) return;
105
+ const h = H.current || 1e-3, c = Math.max(ze.current ? ze.current * 0.2 : 1e-7, Math.min(10, h * e)), r = (s.scrollLeft + l - N) / h;
106
+ de.current = r * c + N - l, rt(!1), it(c);
103
107
  }, []);
104
- Ht(g, (e) => {
105
- if (!Et(Re, e)) return;
108
+ ql(g, (e) => {
109
+ if (!Fl(Me, e)) return;
106
110
  e.preventDefault();
107
- const s = g.current;
108
- s && Ve(
111
+ const l = g.current;
112
+ l && qe(
109
113
  Math.exp(-(e.deltaY || e.deltaX) * 22e-4),
110
- e.clientX - s.getBoundingClientRect().left
114
+ e.clientX - l.getBoundingClientRect().left
111
115
  );
112
116
  });
113
- const Ue = p(null), dt = ie(() => {
114
- Ue.current == null && (Ue.current = requestAnimationFrame(() => {
115
- Ue.current = null;
117
+ const Fe = p(null), pl = ne(() => {
118
+ Fe.current == null && (Fe.current = requestAnimationFrame(() => {
119
+ Fe.current = null;
116
120
  const e = g.current;
117
- if (!e || !q.current) return;
118
- const s = Ae.current + Math.max(0, e.scrollLeft + 117 - N) / q.current;
119
- Ql(we(s)), lt(ul.current ? z(s) : null), We(), fl.current && Pe();
121
+ if (!e || !H.current) return;
122
+ const l = Ie.current + Math.max(0, e.scrollLeft + 117 - N) / H.current;
123
+ nl(Ne(l)), al(ut.current ? A(l) : null), Be(), ft.current && Pe();
120
124
  }));
121
- }, [Pe, We]), $e = p(null), ut = ie((e) => {
122
- const s = e.clientX;
123
- $e.current == null && ($e.current = requestAnimationFrame(() => {
124
- $e.current = null;
125
- const n = g.current;
126
- if (!n) return;
127
- const h = n.getBoundingClientRect(), o = s - h.left + n.scrollLeft;
128
- if (o < N + 5 || !q.current) {
129
- Ee(null);
125
+ }, [Pe, Be]), Oe = p(null), fl = ne((e) => {
126
+ const l = e.clientX;
127
+ Oe.current == null && (Oe.current = requestAnimationFrame(() => {
128
+ Oe.current = null;
129
+ const s = g.current;
130
+ if (!s) return;
131
+ const h = s.getBoundingClientRect(), c = l - h.left + s.scrollLeft;
132
+ if (c < N + 5 || !H.current) {
133
+ Re(null);
130
134
  return;
131
135
  }
132
- const w = Ae.current + (o - N) / q.current, T = Math.max(88, Math.min(Math.round(o), Fe.current - 88));
133
- Ee({ left: Math.round(o), chipLeft: T, label: A(w, !0), t: w });
136
+ const r = Ie.current + (c - N) / H.current, x = Math.max(88, Math.min(Math.round(c), Ae.current - 88));
137
+ Re({ left: Math.round(c), chipLeft: x, label: be(r, !0), t: r });
134
138
  }));
135
- }, []), he = (e) => {
136
- V === void 0 && st(e ? e.id : null), Zl?.(e);
137
- }, Je = Bl(() => {
139
+ }, []), ue = (e) => {
140
+ O === void 0 && ol(e ? e.id : null), Jt?.(e);
141
+ }, Ue = Et(() => {
138
142
  const e = [];
139
- return (ll || []).forEach((s) => {
140
- u.some((n) => n.service === s) && e.push(s);
141
- }), u.forEach((s) => {
142
- e.includes(s.service) || e.push(s.service);
143
+ return (et || []).forEach((l) => {
144
+ u.some((s) => s.service === l) && e.push(l);
145
+ }), u.forEach((l) => {
146
+ e.includes(l.service) || e.push(l.service);
143
147
  }), e;
144
- }, [u, ll]), R = {};
145
- Je.forEach((e, s) => {
146
- R[e] = Hl[s % Hl.length];
147
- }), Object.assign(R, Al);
148
- const xl = Fl, Sl = xl ? 20 : 26, mt = xl ? 60 : 66, ht = u.map((e) => ({
148
+ }, [u, et]), L = {};
149
+ Ue.forEach((e, l) => {
150
+ L[e] = Bt[l % Bt.length];
151
+ }), Object.assign(L, Vt);
152
+ const xt = $t, Ct = xt ? 20 : 26, gl = xt ? 60 : 66, vl = u.map((e) => ({
149
153
  id: e.id,
150
154
  left: Math.round(N + (e.start - d) * b),
151
- width: Math.round(Math.max(12, ((e.end ?? M) - e.start) * b)),
152
- labelW: xt(G(e), e.service, String(W(e)))
153
- })), pe = St(ht, {
154
- barH: Sl,
155
- rowH: mt,
156
- chipH: Pt,
157
- minH: Xl
158
- }), fe = new Map(pe.items.map((e) => [e.id, e])), Ke = Math.ceil(Math.max(N + Ie * b + Dl + 60, pe.maxExt + 26));
159
- Fe.current = Ke;
160
- const pt = d + (Ke - N) / b, Y = Math.max(d, d + (J.l - F - N) / b), ge = Math.min(pt, d + (J.l + J.w + F - N) / b), E = yt(Y, ge, Math.max(1, (ge - Y) * b), 64), ve = E.step < 1e3;
161
- ul.current = ve;
162
- const Xe = [], Cl = Math.max(d, (E.list.length ? E.list[0].t : Y) - E.step);
163
- let kl = we(Cl), Tl = z(Cl);
164
- E.list.forEach((e) => {
165
- const s = we(e.t), n = z(e.t);
166
- Xe.push({
155
+ width: Math.round(Math.max(12, ((e.end ?? k) - e.start) * b)),
156
+ labelW: kl(Dt(e), e.service, String(se(e)))
157
+ })), me = Ll(vl, {
158
+ barH: Ct,
159
+ rowH: gl,
160
+ chipH: Ol,
161
+ minH: Yt
162
+ }), he = new Map(me.items.map((e) => [e.id, e])), Ve = Math.ceil(Math.max(N + He * b + It + 60, me.maxExt + 26));
163
+ Ae.current = Ve;
164
+ const yl = d + (Ve - N) / b, j = Math.max(d, d + ($.l - F - N) / b), pe = Math.min(yl, d + ($.l + $.w + F - N) / b), B = Tl(j, pe, Math.max(1, (pe - j) * b), 64), fe = B.step < 1e3;
165
+ ut.current = fe;
166
+ const $e = [], Tt = Math.max(d, (B.list.length ? B.list[0].t : j) - B.step);
167
+ let Mt = Ne(Tt), St = A(Tt);
168
+ B.list.forEach((e) => {
169
+ const l = Ne(e.t), s = A(e.t);
170
+ $e.push({
167
171
  left: Math.round(N + (e.t - d) * b),
168
- date: s !== kl ? s : null,
169
- time: !ve || n !== Tl ? n : null,
170
- sub: ve ? "." + String(new Date(e.t).getUTCMilliseconds()).padStart(3, "0") : null
171
- }), kl = s, Tl = n;
172
+ date: l !== Mt ? l : null,
173
+ time: !fe || s !== St ? s : null,
174
+ sub: fe ? "." + String(new Date(e.t).getUTCMilliseconds()).padStart(3, "0") : null
175
+ }), Mt = l, St = s;
172
176
  });
173
- const Ml = [], O = bt(E.step);
174
- if (O.parts > 1) {
175
- const e = E.step / O.parts;
176
- if ((ge - Y) / e < 2e3)
177
- for (let s = Math.ceil(Y / e); s * e <= ge; s++)
178
- s % O.parts !== 0 && Ml.push({
179
- left: Math.round(N + (s * e - d) * b),
180
- medium: O.medium > 0 && s % O.parts === O.medium
177
+ const kt = [], z = Ml(B.step);
178
+ if (z.parts > 1) {
179
+ const e = B.step / z.parts;
180
+ if ((pe - j) / e < 2e3)
181
+ for (let l = Math.ceil(j / e); l * e <= pe; l++)
182
+ l % z.parts !== 0 && kt.push({
183
+ left: Math.round(N + (l * e - d) * b),
184
+ medium: z.medium > 0 && l % z.parts === z.medium
181
185
  });
182
186
  }
183
- const Ze = H ? H.t : null, r = v != null && u.find((e) => e.id === v) || null;
184
- ae(() => {
185
- const e = X.current;
187
+ const Xe = E ? E.t : null, R = y != null && u.find((e) => e.id === y) || null;
188
+ le(() => {
189
+ const e = Z.current;
186
190
  if (e == null) return;
187
- const s = g.current;
188
- if (!s) {
189
- X.current = null;
191
+ const l = g.current;
192
+ if (!l) {
193
+ Z.current = null;
190
194
  return;
191
195
  }
192
- if (s.clientWidth && s.clientWidth !== de) return;
193
- X.current = null;
194
- const n = fe.get(e);
195
- n && Pl(s, { left: Math.max(0, n.left + n.width / 2 - s.clientWidth / 2) });
196
- }), ae(() => {
197
- const e = Z.current;
198
- if (e == null) return;
199
- const s = vl.current;
200
- if (!s) return;
196
+ if (l.clientWidth && l.clientWidth !== re) return;
201
197
  Z.current = null;
202
- const n = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/"/g, '\\"'), h = s.querySelector(`[data-crk-log-id="${n}"]`);
198
+ const s = he.get(e);
199
+ s && zt(l, { left: Math.max(0, s.left + s.width / 2 - l.clientWidth / 2) });
200
+ }), le(() => {
201
+ const e = G.current;
202
+ if (e == null) return;
203
+ const l = vt.current;
204
+ if (!l) return;
205
+ G.current = null;
206
+ const s = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/"/g, '\\"'), h = l.querySelector(`[data-crk-log-id="${s}"]`);
203
207
  if (!h) return;
204
- const o = Math.max(
208
+ const c = Math.max(
205
209
  0,
206
- s.scrollTop + h.getBoundingClientRect().top - s.getBoundingClientRect().top - 8
210
+ l.scrollTop + h.getBoundingClientRect().top - l.getBoundingClientRect().top - 8
207
211
  );
208
- Pl(s, { top: o }, 600), Nl(e), j.current && clearTimeout(j.current), j.current = setTimeout(() => Nl(null), 1200);
212
+ zt(l, { top: c }, 600), yt(e), _.current && clearTimeout(_.current), _.current = setTimeout(() => yt(null), 1200);
209
213
  });
210
- const ft = (e, s) => {
211
- const n = fe.get(e.id);
212
- if (!n) return;
213
- const h = e.end == null, o = (e.end ?? M) - e.start;
214
- if (dl({
215
- left: n.left,
216
- chipLeft: Math.max(88, Math.min(n.left, Fe.current - 88)),
217
- label: A(e.start, !0)
218
- }), ol(e.id), v === e.id) return;
219
- const w = g.current, T = w ? w.getBoundingClientRect() : { left: 0 }, ee = w ? w.scrollLeft : 0, Ne = window.innerWidth || 1200, le = window.innerHeight || 800, ye = n.showLabel ? n.labelW : 0, te = n.showLabel ? n.labelX : n.left, Ye = T.left - ee + Math.min(n.left, te), se = T.left - ee + Math.max(n.left + n.width, te + ye), ne = s.currentTarget.getBoundingClientRect();
220
- let k = se + 28, be = Math.max(95, Math.min(s.clientY, le - 120));
221
- k + Ce > Ne - 12 && (k = Ye - Ce - 28), k < 12 && (k = Math.max(12, Math.min(Ne - Ce - 12, s.clientX - Ce / 2)), be = ne.bottom + 108, be > le - 95 && (be = Math.max(95, ne.top - 108))), He({
214
+ const Nl = (e, l) => {
215
+ const s = he.get(e.id);
216
+ if (!s) return;
217
+ const h = e.end == null, c = (e.end ?? k) - e.start;
218
+ if (dt({
219
+ left: s.left,
220
+ chipLeft: Math.max(88, Math.min(s.left, Ae.current - 88)),
221
+ label: be(e.start, !0)
222
+ }), ct(e.id), y === e.id) return;
223
+ const r = g.current, x = r ? r.getBoundingClientRect() : { left: 0 }, J = r ? r.scrollLeft : 0, ge = window.innerWidth || 1200, I = window.innerHeight || 800, ve = s.showLabel ? s.labelW : 0, Q = s.showLabel ? s.labelX : s.left, _e = x.left - J + Math.min(s.left, Q), ee = x.left - J + Math.max(s.left + s.width, Q + ve), te = l.currentTarget.getBoundingClientRect();
224
+ let S = ee + 28, ye = Math.max(95, Math.min(l.clientY, I - 120));
225
+ S + we > ge - 12 && (S = _e - we - 28), S < 12 && (S = Math.max(12, Math.min(ge - we - 12, l.clientX - we / 2)), ye = te.bottom + 108, ye > I - 95 && (ye = Math.max(95, te.top - 108)));
226
+ const Pt = Wt(e);
227
+ Le({
222
228
  id: e.id,
223
- x: k,
224
- y: be,
225
- rid: String(W(e)),
226
- route: G(e) + " → " + e.service,
227
- label: e.label || (e.method || "GET") + " " + (e.url ? e.url.replace(/^https?:\/\/[^/]+/, "") : e.id),
228
- time: A(e.start, !0),
229
- durLine: h ? "in flight · " + xe(o) + " so far" : xe(o) + " · status " + (e.status ?? "—"),
229
+ x: S,
230
+ y: ye,
231
+ rid: String(se(e)),
232
+ route: Ht(e),
233
+ label: e.label || (Pt ? (e.method || "GET") + " " + (e.url ? e.url.replace(/^https?:\/\/[^/]+/, "") : e.id) : e.message || ""),
234
+ time: be(e.start, !0),
235
+ durLine: h ? (Pt ? "in flight · " : "ongoing · ") + Ke(c) + " so far" : Ke(c) + (typeof e.status == "number" ? " · status " + e.status : e.level ? " · " + e.level : ""),
230
236
  url: e.url || ""
231
237
  });
232
- }, gt = () => {
233
- He(null), dl(null), ol(null);
234
- }, je = (e) => Object.entries(e || {}).map(([s, n]) => ({ k: s, v: String(n) })), I = r ? r.end == null : !1, Ge = C ? x === "details" : r != null, Rl = C && x === "log", _e = () => {
235
- he(null), C && $(null);
236
- }, Ll = Bl(() => u.slice().sort((e, s) => e.start - s.start), [u]), Q = re ? /* @__PURE__ */ t(
237
- Ct,
238
+ }, bl = () => {
239
+ Le(null), dt(null), ct(null);
240
+ }, wl = R ? R.end == null : !1, Ze = T ? w === "details" : R != null, Lt = T && w === "log", Ge = () => {
241
+ ue(null), T && V(null);
242
+ }, Rt = Et(() => u.slice().sort((e, l) => e.start - l.start), [u]), Y = ae ? /* @__PURE__ */ n(
243
+ Rl,
238
244
  {
239
245
  className: m?.summary,
240
- placement: B,
241
- floatingDefaultPosition: $l,
242
- bubbleGlyphColors: Je.slice(0, 3).map((e) => R[e]),
243
- items: Ll.map((e, s) => {
244
- const n = fe.get(e.id);
246
+ placement: P,
247
+ floatingDefaultPosition: Gt,
248
+ bubbleGlyphColors: Ue.slice(0, 3).map((e) => L[e]),
249
+ items: Rt.map((e, l) => {
250
+ const s = he.get(e.id);
245
251
  return {
246
252
  id: e.id,
247
- number: String(s + 1).padStart(2, "0"),
248
- label: String(W(e)),
249
- color: R[e.service] || S.body,
250
- time: z(e.start),
251
- inView: !n || !oe.w ? !0 : n.left < oe.l + oe.w && n.left + n.width > oe.l,
252
- selected: v === e.id
253
+ number: String(l + 1).padStart(2, "0"),
254
+ label: String(se(e)),
255
+ color: L[e.service] || C.body,
256
+ time: A(e.start),
257
+ inView: !s || !oe.w ? !0 : s.left < oe.l + oe.w && s.left + s.width > oe.l,
258
+ selected: y === e.id
253
259
  };
254
260
  }),
255
261
  onPick: (e) => {
256
- const s = u.find((n) => n.id === e);
257
- s && (he(s), x === "log" && (Z.current = e)), X.current = e;
262
+ const l = u.find((s) => s.id === e);
263
+ l && (ue(l), w === "log" && (G.current = e)), Z.current = e;
258
264
  }
259
265
  }
260
266
  ) : null;
261
- return /* @__PURE__ */ a("div", { ref: ql, className: c(i.root, m?.root, jl), style: Gl, children: [
262
- (tl || bl || ke != null || Te != null) && /* @__PURE__ */ a("div", { className: c(i.toolbar, m?.toolbar), children: [
267
+ return /* @__PURE__ */ a("div", { ref: qt, className: o(i.root, m?.root, Qt), style: el, children: [
268
+ (tt || bt || xe != null || Ce != null) && /* @__PURE__ */ a("div", { className: o(i.toolbar, m?.toolbar), children: [
263
269
  /* @__PURE__ */ a("div", { className: i.toolbarText, children: [
264
- ke != null && /* @__PURE__ */ t("span", { className: i.toolbarTitle, children: ke }),
265
- /* @__PURE__ */ t("span", { className: i.toolbarMeta, children: Te ?? (u.length ? `${u.length} events · span ${xe(Ie - 2 * Oe)} · times in UTC` : "No events") })
270
+ xe != null && /* @__PURE__ */ n("span", { className: i.toolbarTitle, children: xe }),
271
+ /* @__PURE__ */ n("span", { className: i.toolbarMeta, children: Ce ?? (u.length ? `${u.length} events · span ${Ke(He - 2 * We)} · times in UTC` : "No events") })
266
272
  ] }),
267
- bl,
268
- tl && /* @__PURE__ */ t(
269
- kt,
273
+ bt,
274
+ tt && /* @__PURE__ */ n(
275
+ Pl,
270
276
  {
271
- zoomPct: `${Math.round(b / ue * 100)}%`,
272
- fitActive: rl,
273
- onZoomIn: () => Ve(1.5, de / 2),
274
- onZoomOut: () => Ve(1 / 1.5, de / 2),
277
+ zoomPct: `${Math.round(b / ce * 100)}%`,
278
+ fitActive: ot,
279
+ onZoomIn: () => qe(1.5, re / 2),
280
+ onZoomOut: () => qe(1 / 1.5, re / 2),
275
281
  onFit: () => {
276
- cl(!0), il(null);
282
+ rt(!0), it(null);
277
283
  },
278
- hint: Re === "none" ? "drag pans" : (Re === "ctrl" ? "Ctrl+scroll zooms" : "scroll zooms") + " · drag pans"
284
+ hint: Me === "none" ? "drag pans" : (Me === "ctrl" ? "Ctrl+scroll zooms" : "scroll zooms") + " · drag pans"
279
285
  }
280
286
  )
281
287
  ] }),
282
- Ul && /* @__PURE__ */ t(
283
- Tt,
288
+ Zt && /* @__PURE__ */ n(
289
+ El,
284
290
  {
285
291
  className: m?.legend,
286
- items: Je.map((e) => ({ name: e, color: R[e] }))
292
+ items: Ue.map((e) => ({ name: e, color: L[e] }))
287
293
  }
288
294
  ),
289
- B === "top" && Q,
295
+ P === "top" && Y,
290
296
  /* @__PURE__ */ a("div", { className: i.layout, children: [
291
- B === "left" && Q,
297
+ P === "left" && Y,
292
298
  /* @__PURE__ */ a("div", { className: i.main, children: [
293
299
  /* @__PURE__ */ a("div", { className: i.cardWrap, children: [
294
- /* @__PURE__ */ t(
300
+ /* @__PURE__ */ n(
295
301
  "div",
296
302
  {
297
- className: c(
303
+ className: o(
298
304
  i.card,
299
- (Ge || Rl) && l.cardFlushRight,
305
+ (Ze || Lt) && t.cardFlushRight,
300
306
  m?.card
301
307
  ),
302
- children: /* @__PURE__ */ t(
308
+ children: /* @__PURE__ */ n(
303
309
  "div",
304
310
  {
305
311
  ref: g,
306
- className: c(i.scroller, l.scroller, m?.scroller),
307
- style: { maxHeight: Kl },
308
- onPointerDown: K.onPointerDown,
309
- onPointerMove: K.onPointerMove,
310
- onPointerUp: K.onPointerUp,
312
+ className: o(i.scroller, t.scroller, m?.scroller),
313
+ style: { maxHeight: jt },
314
+ onPointerDown: X.onPointerDown,
315
+ onPointerMove: X.onPointerMove,
316
+ onPointerUp: X.onPointerUp,
311
317
  onPointerLeave: () => {
312
- K.onPointerUp(), Ee(null);
318
+ X.onPointerUp(), Re(null);
313
319
  },
314
- onMouseMove: ut,
315
- onScroll: dt,
316
- children: /* @__PURE__ */ a("div", { className: l.inner, style: { width: Ke }, children: [
317
- Vl && Xe.map((e, s) => /* @__PURE__ */ t("div", { className: l.gridline, style: { left: e.left } }, s)),
318
- gl && /* @__PURE__ */ t(
320
+ onMouseMove: fl,
321
+ onScroll: pl,
322
+ children: /* @__PURE__ */ a("div", { className: t.inner, style: { width: Ve }, children: [
323
+ Xt && $e.map((e, l) => /* @__PURE__ */ n("div", { className: t.gridline, style: { left: e.left } }, l)),
324
+ gt && /* @__PURE__ */ n(
319
325
  "div",
320
326
  {
321
- className: l.nowLine,
322
- style: { left: Math.round(N + (M - d) * b) }
327
+ className: t.nowLine,
328
+ style: { left: Math.round(N + (k - d) * b) }
323
329
  }
324
330
  ),
325
- H && !y && /* @__PURE__ */ t("div", { className: l.cursorLine, style: { left: H.left } }),
326
- U && /* @__PURE__ */ t("div", { className: l.eventLine, style: { left: U.left } }),
327
- /* @__PURE__ */ a("div", { className: c(l.axis, m?.axis), children: [
328
- /* @__PURE__ */ t("div", { className: l.axisDivider }),
329
- /* @__PURE__ */ a("div", { className: l.axisSticky, children: [
330
- /* @__PURE__ */ t("span", { className: l.axisUtc, children: "UTC" }),
331
- /* @__PURE__ */ t("span", { className: l.axisViewDate, children: Yl || (u.length ? we(d) : "") }),
332
- ve && /* @__PURE__ */ t("span", { className: l.axisViewTime, children: et || z(d) })
331
+ E && !v && /* @__PURE__ */ n("div", { className: t.cursorLine, style: { left: E.left } }),
332
+ U && /* @__PURE__ */ n("div", { className: t.eventLine, style: { left: U.left } }),
333
+ /* @__PURE__ */ a("div", { className: o(t.axis, m?.axis), children: [
334
+ /* @__PURE__ */ n("div", { className: t.axisDivider }),
335
+ /* @__PURE__ */ a("div", { className: t.axisSticky, children: [
336
+ /* @__PURE__ */ n("span", { className: t.axisUtc, children: "UTC" }),
337
+ /* @__PURE__ */ n("span", { className: t.axisViewDate, children: ll || (u.length ? Ne(d) : "") }),
338
+ fe && /* @__PURE__ */ n("span", { className: t.axisViewTime, children: sl || A(d) })
333
339
  ] }),
334
- Xe.map((e, s) => /* @__PURE__ */ a("span", { children: [
335
- e.date && /* @__PURE__ */ t("span", { className: l.axisDateLabel, style: { left: e.left }, children: e.date }),
336
- e.time && /* @__PURE__ */ t("span", { className: l.axisTickLabel, style: { left: e.left }, children: e.time }),
337
- e.sub && /* @__PURE__ */ t("span", { className: l.axisSubLabel, style: { left: e.left }, children: e.sub }),
338
- /* @__PURE__ */ t("span", { className: l.axisTickMark, style: { left: e.left } })
339
- ] }, s)),
340
- Ml.map((e, s) => /* @__PURE__ */ t(
340
+ $e.map((e, l) => /* @__PURE__ */ a("span", { children: [
341
+ e.date && /* @__PURE__ */ n("span", { className: t.axisDateLabel, style: { left: e.left }, children: e.date }),
342
+ e.time && /* @__PURE__ */ n("span", { className: t.axisTickLabel, style: { left: e.left }, children: e.time }),
343
+ e.sub && /* @__PURE__ */ n("span", { className: t.axisSubLabel, style: { left: e.left }, children: e.sub }),
344
+ /* @__PURE__ */ n("span", { className: t.axisTickMark, style: { left: e.left } })
345
+ ] }, l)),
346
+ kt.map((e, l) => /* @__PURE__ */ n(
341
347
  "span",
342
348
  {
343
- className: c(l.axisMinorMark, e.medium && l.axisMinorMedium),
349
+ className: o(t.axisMinorMark, e.medium && t.axisMinorMedium),
344
350
  style: { left: e.left }
345
351
  },
346
- s
352
+ l
347
353
  )),
348
- H && !y && /* @__PURE__ */ t("div", { className: l.axisChip, style: { left: H.chipLeft }, children: H.label }),
354
+ E && !v && /* @__PURE__ */ n("div", { className: t.axisChip, style: { left: E.chipLeft }, children: E.label }),
349
355
  U && /* @__PURE__ */ a(
350
356
  "div",
351
357
  {
352
- className: c(l.axisChip, l.axisChipEvent),
358
+ className: o(t.axisChip, t.axisChipEvent),
353
359
  style: { left: U.chipLeft },
354
360
  children: [
355
361
  "▸ ",
@@ -358,124 +364,129 @@ const N = 84, Dl = 24, F = 400, Pt = 51, Ce = 300, Jt = vt(
358
364
  }
359
365
  )
360
366
  ] }),
361
- /* @__PURE__ */ a("div", { className: l.lane, style: { height: pe.h }, children: [
362
- /* @__PURE__ */ t("div", { className: l.axisLine, style: { top: pe.axisY } }),
367
+ /* @__PURE__ */ a("div", { className: t.lane, style: { height: me.h }, children: [
368
+ /* @__PURE__ */ n("div", { className: t.axisLine, style: { top: me.axisY } }),
363
369
  u.map((e) => {
364
- const s = fe.get(e.id);
365
- if (!s) return null;
366
- const n = R[e.service] || S.body, h = e.end == null, o = wt(e, L), w = Ze != null && Ze >= e.start && Ze <= (e.end ?? M), T = _l === e.id, ee = L && !o ? 0.25 : 1, Ne = String(W(e)), le = G(e), ye = R[le] || S.body, te = R[e.service] || S.body, Ye = T ? `0 0 0 3px ${D(n, 55)}, 0 4px 14px rgba(35,32,28,.22)` : L && o ? `0 0 0 3px ${S.hlRing}` : v === e.id ? `0 0 0 3px ${S.selectedRing}` : w ? `0 0 0 3px ${D(n, 30)}` : "none", se = T ? n : w ? S.stemHot : S.stem, ne = {
370
+ const l = he.get(e.id);
371
+ if (!l) return null;
372
+ const s = L[e.service] || C.body, h = e.end == null, c = Sl(e, M, lt), r = Xe != null && Xe >= e.start && Xe <= (e.end ?? k), x = tl === e.id, J = M && !c ? 0.25 : 1, ge = String(se(e)), I = Dt(e), ve = L[I] || C.body, Q = L[e.service] || C.body, _e = x ? `0 0 0 3px ${W(s, 55)}, 0 4px 14px rgba(35,32,28,.22)` : M && c ? `0 0 0 3px ${C.hlRing}` : y === e.id ? `0 0 0 3px ${C.selectedRing}` : r ? `0 0 0 3px ${W(s, 30)}` : "none", ee = x ? s : r ? C.stemHot : C.stem, te = {
367
373
  onClick: () => {
368
- if (K.wasDragSuppressed()) return;
369
- He(null);
370
- const k = v === e.id ? null : e;
371
- he(k), k && x === "log" && (Z.current = k.id);
374
+ if (X.wasDragSuppressed()) return;
375
+ Le(null);
376
+ const S = y === e.id ? null : e;
377
+ ue(S), S && w === "log" && (G.current = S.id);
372
378
  },
373
- onMouseEnter: (k) => ft(e, k),
374
- onMouseLeave: gt
379
+ onMouseEnter: (S) => Nl(e, S),
380
+ onMouseLeave: bl
375
381
  };
376
382
  return /* @__PURE__ */ a("span", { children: [
377
- s.showLabel && /* @__PURE__ */ a(P, { children: [
378
- s.conn && !s.hconn && /* @__PURE__ */ t(
383
+ l.showLabel && /* @__PURE__ */ a(D, { children: [
384
+ l.conn && !l.hconn && /* @__PURE__ */ n(
379
385
  "div",
380
386
  {
381
- className: l.stem,
387
+ className: t.stem,
382
388
  style: {
383
- left: s.left,
384
- top: s.connTop,
385
- height: s.connH,
386
- background: se
389
+ left: l.left,
390
+ top: l.connTop,
391
+ height: l.connH,
392
+ background: ee
387
393
  }
388
394
  }
389
395
  ),
390
- s.conn && s.hconn && /* @__PURE__ */ a(P, { children: [
391
- /* @__PURE__ */ t(
396
+ l.conn && l.hconn && /* @__PURE__ */ a(D, { children: [
397
+ /* @__PURE__ */ n(
392
398
  "div",
393
399
  {
394
- className: l.stem,
400
+ className: t.stem,
395
401
  style: {
396
- left: s.left,
397
- top: s.connTop,
398
- height: s.connH,
399
- background: se
402
+ left: l.left,
403
+ top: l.connTop,
404
+ height: l.connH,
405
+ background: ee
400
406
  }
401
407
  }
402
408
  ),
403
- /* @__PURE__ */ t(
409
+ /* @__PURE__ */ n(
404
410
  "div",
405
411
  {
406
- className: l.elbow,
412
+ className: t.elbow,
407
413
  style: {
408
- left: s.hconnLeft,
409
- top: s.hconnTop,
410
- width: s.hconnW,
411
- background: se
414
+ left: l.hconnLeft,
415
+ top: l.hconnTop,
416
+ width: l.hconnW,
417
+ background: ee
412
418
  }
413
419
  }
414
420
  )
415
421
  ] }),
416
- /* @__PURE__ */ t(
422
+ /* @__PURE__ */ n(
417
423
  "div",
418
424
  {
419
- ...ne,
420
- className: c(l.chip, m?.chip),
425
+ ...te,
426
+ className: o(t.chip, m?.chip),
421
427
  style: {
422
- left: s.labelX,
423
- top: s.labelTop,
424
- opacity: ee,
425
- background: T ? D(n, 7) : L && o ? S.hlWashSoft : void 0,
426
- borderColor: T ? n : L && o ? S.hlBorder : w ? n : void 0,
427
- boxShadow: T ? `0 0 0 2px ${D(n, 40)}, 0 4px 12px rgba(35,32,28,.16)` : "0 1px 2px rgba(35,32,28,.06)"
428
+ left: l.labelX,
429
+ top: l.labelTop,
430
+ opacity: J,
431
+ background: x ? W(s, 7) : M && c ? C.hlWashSoft : void 0,
432
+ borderColor: x ? s : M && c ? C.hlBorder : r ? s : void 0,
433
+ boxShadow: x ? `0 0 0 2px ${W(s, 40)}, 0 4px 12px rgba(35,32,28,.16)` : "0 1px 2px rgba(35,32,28,.06)"
428
434
  },
429
- children: nl ? nl(e, {
430
- color: n,
435
+ children: st ? st(e, {
436
+ color: s,
431
437
  pending: h,
432
- durationMs: (e.end ?? M) - e.start
433
- }) : /* @__PURE__ */ a(P, { children: [
438
+ durationMs: (e.end ?? k) - e.start
439
+ }) : /* @__PURE__ */ a(D, { children: [
434
440
  /* @__PURE__ */ a("div", { children: [
435
- /* @__PURE__ */ t(
441
+ I && /* @__PURE__ */ a(D, { children: [
442
+ /* @__PURE__ */ n(
443
+ "span",
444
+ {
445
+ className: t.chipBadge,
446
+ style: {
447
+ background: W(ve, 14),
448
+ color: ve
449
+ },
450
+ children: I
451
+ }
452
+ ),
453
+ /* @__PURE__ */ n("span", { className: t.chipArrow, children: " → " })
454
+ ] }),
455
+ /* @__PURE__ */ n(
436
456
  "span",
437
457
  {
438
- className: l.chipBadge,
439
- style: { background: D(ye, 14), color: ye },
440
- children: le
441
- }
442
- ),
443
- /* @__PURE__ */ t("span", { className: l.chipArrow, children: " → " }),
444
- /* @__PURE__ */ t(
445
- "span",
446
- {
447
- className: l.chipBadge,
448
- style: { background: D(te, 14), color: te },
458
+ className: t.chipBadge,
459
+ style: { background: W(Q, 14), color: Q },
449
460
  children: e.service
450
461
  }
451
462
  )
452
463
  ] }),
453
- /* @__PURE__ */ t("div", { className: l.chipOp, children: /* @__PURE__ */ t(El, { text: Ne, query: L }) }),
454
- /* @__PURE__ */ t("div", { className: l.chipTime, children: A(e.start, !0) })
464
+ /* @__PURE__ */ n("div", { className: t.chipOp, children: /* @__PURE__ */ n(je, { text: ge, query: M }) }),
465
+ /* @__PURE__ */ n("div", { className: t.chipTime, children: be(e.start, !0) })
455
466
  ] })
456
467
  }
457
468
  )
458
469
  ] }),
459
- /* @__PURE__ */ t(
470
+ /* @__PURE__ */ n(
460
471
  "div",
461
472
  {
462
- ...ne,
463
- className: c(l.bar, h && l.barPending, m?.bar),
473
+ ...te,
474
+ className: o(t.bar, h && t.barPending, m?.bar),
464
475
  style: {
465
- left: s.left,
466
- top: s.barTop,
467
- width: s.width,
468
- height: Sl,
469
- background: L && o ? S.hlBarBg : D(n, 22),
470
- borderColor: n,
471
- opacity: ee,
472
- boxShadow: Ye
476
+ left: l.left,
477
+ top: l.barTop,
478
+ width: l.width,
479
+ height: Ct,
480
+ background: M && c ? C.hlBarBg : W(s, 22),
481
+ borderColor: s,
482
+ opacity: J,
483
+ boxShadow: _e
473
484
  },
474
- children: h && /* @__PURE__ */ t(
485
+ children: h && /* @__PURE__ */ n(
475
486
  "span",
476
487
  {
477
- className: c(i.pulseDot, l.barDot),
478
- style: { background: n }
488
+ className: o(i.pulseDot, t.barDot),
489
+ style: { background: s }
479
490
  }
480
491
  )
481
492
  }
@@ -488,250 +499,202 @@ const N = 84, Dl = 24, F = 400, Pt = 51, Ce = 300, Jt = vt(
488
499
  )
489
500
  }
490
501
  ),
491
- Ge && r && Be && /* @__PURE__ */ a("div", { className: l.dockCol, style: { flexBasis: ce }, children: [
492
- /* @__PURE__ */ t(
493
- Qe,
502
+ Ze && R && ke && /* @__PURE__ */ a("div", { className: t.dockCol, style: { flexBasis: ie }, children: [
503
+ /* @__PURE__ */ n(
504
+ Ye,
494
505
  {
495
506
  panel: "right",
496
- width: ce,
507
+ width: ie,
497
508
  min: 280,
498
509
  max: 640,
499
- onResize: ml,
510
+ onResize: mt,
500
511
  label: "Resize details drawer",
501
- className: l.dockColResizer
512
+ className: t.dockColResizer
502
513
  }
503
514
  ),
504
- /* @__PURE__ */ t("aside", { className: c(i.aside, l.drawerCustom, m?.drawer), children: Be(r, { close: _e, pending: I }) })
515
+ /* @__PURE__ */ n("aside", { className: o(i.aside, t.drawerCustom, m?.drawer), children: ke(R, { close: Ge, pending: wl }) })
505
516
  ] }),
506
- Ge && !(r && Be) && /* @__PURE__ */ a("div", { className: l.dockCol, style: { flexBasis: ce }, children: [
507
- /* @__PURE__ */ t(
508
- Qe,
517
+ Ze && !(R && ke) && /* @__PURE__ */ a("div", { className: t.dockCol, style: { flexBasis: ie }, children: [
518
+ /* @__PURE__ */ n(
519
+ Ye,
509
520
  {
510
521
  panel: "right",
511
- width: ce,
522
+ width: ie,
512
523
  min: 280,
513
524
  max: 640,
514
- onResize: ml,
525
+ onResize: mt,
515
526
  label: "Resize details drawer",
516
- className: l.dockColResizer
527
+ className: t.dockColResizer
517
528
  }
518
529
  ),
519
- /* @__PURE__ */ a("aside", { className: c(i.aside, C && l.dockAside, m?.drawer), children: [
520
- C && /* @__PURE__ */ a("div", { className: l.dockHead, children: [
521
- /* @__PURE__ */ t("span", { className: l.dockTitle, children: "Event details" }),
522
- /* @__PURE__ */ t("div", { className: l.drawerSpacer }),
523
- /* @__PURE__ */ t(
530
+ /* @__PURE__ */ a("aside", { className: o(i.aside, T && t.dockAside, m?.drawer), children: [
531
+ T && /* @__PURE__ */ a("div", { className: t.dockHead, children: [
532
+ /* @__PURE__ */ n("span", { className: t.dockTitle, children: "Event details" }),
533
+ /* @__PURE__ */ n("div", { className: t.drawerSpacer }),
534
+ /* @__PURE__ */ n(
524
535
  "button",
525
536
  {
526
537
  type: "button",
527
538
  className: i.asideClose,
528
539
  "aria-label": "Close details",
529
- onClick: _e,
540
+ onClick: Ge,
530
541
  children: "✕"
531
542
  }
532
543
  )
533
544
  ] }),
534
- r ? /* @__PURE__ */ a("div", { className: C ? l.dockScroll : void 0, children: [
535
- /* @__PURE__ */ a("div", { className: l.drawerHead, children: [
536
- /* @__PURE__ */ a("div", { className: l.drawerHeadRow, children: [
537
- /* @__PURE__ */ t("span", { className: l.methodBadge, children: r.method || "—" }),
538
- /* @__PURE__ */ t(
539
- "span",
540
- {
541
- className: c(
542
- l.statusBadge,
543
- I && l.statusPending,
544
- !I && (r.status ?? 0) >= 400 && l.statusError
545
- ),
546
- children: I ? "pending" : String(r.status ?? "—")
547
- }
548
- ),
549
- /* @__PURE__ */ t("span", { className: l.drawerRoute, children: G(r) + " → " + r.service }),
550
- /* @__PURE__ */ t("div", { className: l.drawerSpacer }),
551
- !C && /* @__PURE__ */ t(
552
- "button",
553
- {
554
- type: "button",
555
- className: i.asideClose,
556
- "aria-label": "Close details",
557
- onClick: _e,
558
- children: "✕"
559
- }
560
- )
561
- ] }),
562
- /* @__PURE__ */ t("div", { className: l.drawerUrl, children: r.url || r.label || r.id }),
563
- /* @__PURE__ */ t("div", { className: l.drawerRid, children: String(W(r)) }),
564
- /* @__PURE__ */ t("div", { className: l.drawerXrid, children: r.reqHeaders && r.reqHeaders["x-request-id"] || r.requestId || r.id }),
565
- /* @__PURE__ */ t("div", { className: l.drawerTiming, children: A(r.start, !0) + (I ? " · in flight" : " → " + A(r.end, !0) + " · " + xe(r.end - r.start)) })
566
- ] }),
567
- /* @__PURE__ */ a("div", { className: l.drawerBody, children: [
568
- /* @__PURE__ */ t("div", { className: l.drawerSection, children: "Request" }),
569
- !!Object.keys(r.query || {}).length && /* @__PURE__ */ a(P, { children: [
570
- /* @__PURE__ */ t("div", { className: i.asideSection, children: "Query parameters" }),
571
- je(r.query).map((e) => /* @__PURE__ */ a("div", { className: l.kvRow, children: [
572
- /* @__PURE__ */ t("span", { className: c(l.kvKey, l.kvKeyQuery), children: e.k }),
573
- /* @__PURE__ */ t("span", { className: l.kvVal, children: e.v })
574
- ] }, e.k))
575
- ] }),
576
- /* @__PURE__ */ t("div", { className: i.asideSection, children: "Headers" }),
577
- je(r.reqHeaders).map((e) => /* @__PURE__ */ a("div", { className: l.kvRow, children: [
578
- /* @__PURE__ */ t("span", { className: l.kvKey, children: e.k }),
579
- /* @__PURE__ */ t("span", { className: l.kvVal, children: e.v })
580
- ] }, e.k)),
581
- r.reqBody != null && /* @__PURE__ */ a(P, { children: [
582
- /* @__PURE__ */ a("div", { className: l.bodyHead, children: [
583
- /* @__PURE__ */ t("span", { className: c(i.asideSection, l.bodyLabel), children: "Body" }),
584
- /* @__PURE__ */ t(
585
- Se,
586
- {
587
- size: "sm",
588
- className: l.payloadCopy,
589
- value: () => JSON.stringify(r.reqBody, null, 2),
590
- "aria-label": "Copy request payload"
591
- }
592
- )
593
- ] }),
594
- /* @__PURE__ */ t("pre", { className: i.asideRaw, children: JSON.stringify(r.reqBody, null, 2) })
595
- ] }),
596
- /* @__PURE__ */ t("div", { className: l.drawerSection, children: "Response" }),
597
- I ? /* @__PURE__ */ a("div", { className: l.awaiting, children: [
598
- /* @__PURE__ */ t("span", { className: c(i.pulseDot, l.awaitingDot) }),
599
- "Awaiting response…"
600
- ] }) : /* @__PURE__ */ a(P, { children: [
601
- /* @__PURE__ */ t("div", { className: i.asideSection, children: "Headers" }),
602
- je(r.resHeaders).map((e) => /* @__PURE__ */ a("div", { className: l.kvRow, children: [
603
- /* @__PURE__ */ t("span", { className: l.kvKey, children: e.k }),
604
- /* @__PURE__ */ t("span", { className: l.kvVal, children: e.v })
605
- ] }, e.k)),
606
- /* @__PURE__ */ a("div", { className: l.bodyHead, children: [
607
- /* @__PURE__ */ t("span", { className: c(i.asideSection, l.bodyLabel), children: "Body" }),
608
- r.resBody != null && /* @__PURE__ */ t(
609
- Se,
610
- {
611
- size: "sm",
612
- className: l.payloadCopy,
613
- value: () => JSON.stringify(r.resBody, null, 2),
614
- "aria-label": "Copy response payload"
615
- }
616
- )
617
- ] }),
618
- /* @__PURE__ */ t("pre", { className: i.asideRaw, children: r.resBody != null ? JSON.stringify(r.resBody, null, 2) : "(empty)" })
619
- ] })
620
- ] })
621
- ] }) : /* @__PURE__ */ t("div", { className: l.dockEmpty, children: "Click an event on the timeline to inspect it." })
545
+ R ? /* @__PURE__ */ n(
546
+ Dl,
547
+ {
548
+ event: R,
549
+ now: k,
550
+ highlight: M,
551
+ showExtraFields: Kt,
552
+ hiddenFields: lt,
553
+ onClose: T ? void 0 : Ge,
554
+ className: T ? t.dockScroll : void 0
555
+ }
556
+ ) : /* @__PURE__ */ n("div", { className: t.dockEmpty, children: "Click an event on the timeline to inspect it." })
622
557
  ] })
623
558
  ] }),
624
- Rl && /* @__PURE__ */ a("div", { className: l.dockCol, style: { flexBasis: hl }, children: [
625
- /* @__PURE__ */ t(
626
- Qe,
559
+ Lt && /* @__PURE__ */ a("div", { className: t.dockCol, style: { flexBasis: ht }, children: [
560
+ /* @__PURE__ */ n(
561
+ Ye,
627
562
  {
628
563
  panel: "right",
629
- width: hl,
564
+ width: ht,
630
565
  min: 320,
631
566
  max: 680,
632
- onResize: nt,
567
+ onResize: rl,
633
568
  label: "Resize log drawer",
634
- className: l.dockColResizer
569
+ className: t.dockColResizer
635
570
  }
636
571
  ),
637
- /* @__PURE__ */ a("aside", { className: c(i.aside, l.dockAside, m?.log), children: [
638
- /* @__PURE__ */ a("div", { className: l.dockHead, children: [
639
- /* @__PURE__ */ t("span", { className: l.dockTitle, children: "Full log" }),
640
- /* @__PURE__ */ a("span", { className: l.dockCount, children: [
572
+ /* @__PURE__ */ a("aside", { className: o(i.aside, t.dockAside, m?.log), children: [
573
+ /* @__PURE__ */ a("div", { className: t.dockHead, children: [
574
+ /* @__PURE__ */ n("span", { className: t.dockTitle, children: "Full log" }),
575
+ /* @__PURE__ */ a("span", { className: t.dockCount, children: [
641
576
  u.length,
642
577
  " events"
643
578
  ] }),
644
- /* @__PURE__ */ t("div", { className: l.drawerSpacer }),
645
- /* @__PURE__ */ t(
579
+ /* @__PURE__ */ n("div", { className: t.drawerSpacer }),
580
+ /* @__PURE__ */ n(
646
581
  "button",
647
582
  {
648
583
  type: "button",
649
584
  className: i.asideClose,
650
585
  "aria-label": "Close full log",
651
- onClick: () => $(null),
586
+ onClick: () => V(null),
652
587
  children: "✕"
653
588
  }
654
589
  )
655
590
  ] }),
656
- /* @__PURE__ */ t("div", { ref: vl, className: c(l.dockScroll, l.logBody), children: Ll.map((e, s) => {
657
- const n = e.end == null, h = e.url ? e.url.replace(/^https?:\/\/[^/]+/, "") : "";
591
+ /* @__PURE__ */ n("div", { ref: vt, className: o(t.dockScroll, t.logBody), children: Rt.map((e, l) => {
592
+ const s = e.end == null, h = e.url ? e.url.replace(/^https?:\/\/[^/]+/, "") : "", c = Wt(e);
658
593
  return /* @__PURE__ */ a(
659
594
  "div",
660
595
  {
661
596
  "data-crk-log-id": e.id,
662
- className: c(
663
- l.logEntry,
664
- v === e.id && l.logEntrySelected,
665
- rt === e.id && l.logEntryFlash
597
+ className: o(
598
+ t.logEntry,
599
+ y === e.id && t.logEntrySelected,
600
+ ul === e.id && t.logEntryFlash
666
601
  ),
667
602
  onClick: () => {
668
- he(e), X.current = e.id;
603
+ ue(e), Z.current = e.id;
669
604
  },
670
605
  children: [
671
- /* @__PURE__ */ a("div", { className: l.logTop, children: [
672
- /* @__PURE__ */ t("span", { className: l.logNum, children: String(s + 1).padStart(2, "0") }),
673
- /* @__PURE__ */ t("span", { className: c(l.methodBadge, l.badgeSm), children: e.method || "—" }),
674
- /* @__PURE__ */ t(
675
- "span",
676
- {
677
- className: c(
678
- l.statusBadge,
679
- l.badgeSm,
680
- n && l.statusPending,
681
- !n && (e.status ?? 0) >= 400 && l.statusError
682
- ),
683
- children: n ? "pending" : String(e.status ?? "—")
684
- }
685
- ),
686
- /* @__PURE__ */ t("span", { className: l.logPair, children: G(e) + " → " + e.service }),
687
- /* @__PURE__ */ t("div", { className: l.drawerSpacer }),
688
- /* @__PURE__ */ t("span", { className: l.logClock, children: z(e.start) })
606
+ /* @__PURE__ */ a("div", { className: t.logTop, children: [
607
+ /* @__PURE__ */ n("span", { className: t.logNum, children: String(l + 1).padStart(2, "0") }),
608
+ e.method && /* @__PURE__ */ n("span", { className: o(t.methodBadge, t.badgeSm), children: e.method }),
609
+ /* @__PURE__ */ n(Wl, { event: e, pending: s, small: !0 }),
610
+ /* @__PURE__ */ n("span", { className: t.logPair, children: Ht(e) }),
611
+ /* @__PURE__ */ n("div", { className: t.drawerSpacer }),
612
+ /* @__PURE__ */ n("span", { className: t.logClock, children: A(e.start) })
689
613
  ] }),
690
- /* @__PURE__ */ t("div", { className: l.logOp, children: /* @__PURE__ */ t(El, { text: String(W(e)), query: L }) }),
691
- h && /* @__PURE__ */ t("div", { className: l.logPath, children: h }),
692
- /* @__PURE__ */ a("div", { className: l.logPayloadHead, children: [
693
- /* @__PURE__ */ t("span", { className: l.logPayloadLabel, children: "Request" }),
694
- e.reqBody != null && /* @__PURE__ */ t(
695
- "span",
696
- {
697
- className: l.copyStop,
698
- onClick: (o) => o.stopPropagation(),
699
- children: /* @__PURE__ */ t(
700
- Se,
701
- {
702
- size: "sm",
703
- className: l.payloadCopy,
704
- value: () => JSON.stringify(e.reqBody, null, 2),
705
- "aria-label": "Copy request payload"
706
- }
707
- )
708
- }
709
- )
614
+ /* @__PURE__ */ n("div", { className: t.logOp, children: /* @__PURE__ */ n(je, { text: String(se(e)), query: M }) }),
615
+ h && /* @__PURE__ */ n("div", { className: t.logPath, children: h }),
616
+ e.message && /* @__PURE__ */ n("div", { className: t.logMessage, children: /* @__PURE__ */ n(je, { text: e.message, query: M }) }),
617
+ !!e.details?.length && // the fields carry their own copy buttons, so the
618
+ // block swallows clicks rather than selecting the row
619
+ /* @__PURE__ */ n(
620
+ "div",
621
+ {
622
+ className: o(t.fieldList, t.logFields),
623
+ onClick: (r) => r.stopPropagation(),
624
+ children: e.details.map((r, x) => /* @__PURE__ */ n(Hl, { field: r, query: M }, r.label + x))
625
+ }
626
+ ),
627
+ e.payload != null && /* @__PURE__ */ a(D, { children: [
628
+ /* @__PURE__ */ a("div", { className: t.logPayloadHead, children: [
629
+ /* @__PURE__ */ n("span", { className: t.logPayloadLabel, children: "Payload" }),
630
+ /* @__PURE__ */ n(
631
+ "span",
632
+ {
633
+ className: t.copyStop,
634
+ onClick: (r) => r.stopPropagation(),
635
+ children: /* @__PURE__ */ n(
636
+ Je,
637
+ {
638
+ size: "sm",
639
+ className: t.payloadCopy,
640
+ value: () => q(e.payload),
641
+ "aria-label": "Copy payload"
642
+ }
643
+ )
644
+ }
645
+ )
646
+ ] }),
647
+ /* @__PURE__ */ n("pre", { className: o(i.asideRaw, t.logPre), children: q(e.payload) })
710
648
  ] }),
711
- /* @__PURE__ */ t("pre", { className: c(i.asideRaw, l.logPre), children: e.reqBody != null ? JSON.stringify(e.reqBody, null, 2) : "(empty)" }),
712
- /* @__PURE__ */ a("div", { className: l.logPayloadHead, children: [
713
- /* @__PURE__ */ t("span", { className: l.logPayloadLabel, children: "Response" }),
714
- !n && e.resBody != null && /* @__PURE__ */ t(
715
- "span",
716
- {
717
- className: l.copyStop,
718
- onClick: (o) => o.stopPropagation(),
719
- children: /* @__PURE__ */ t(
720
- Se,
721
- {
722
- size: "sm",
723
- className: l.payloadCopy,
724
- value: () => JSON.stringify(e.resBody, null, 2),
725
- "aria-label": "Copy response payload"
726
- }
727
- )
728
- }
729
- )
649
+ c && /* @__PURE__ */ a(D, { children: [
650
+ /* @__PURE__ */ a("div", { className: t.logPayloadHead, children: [
651
+ /* @__PURE__ */ n("span", { className: t.logPayloadLabel, children: "Request" }),
652
+ e.reqBody != null && /* @__PURE__ */ n(
653
+ "span",
654
+ {
655
+ className: t.copyStop,
656
+ onClick: (r) => r.stopPropagation(),
657
+ children: /* @__PURE__ */ n(
658
+ Je,
659
+ {
660
+ size: "sm",
661
+ className: t.payloadCopy,
662
+ value: () => q(e.reqBody),
663
+ "aria-label": "Copy request payload"
664
+ }
665
+ )
666
+ }
667
+ )
668
+ ] }),
669
+ /* @__PURE__ */ n("pre", { className: o(i.asideRaw, t.logPre), children: e.reqBody != null ? q(e.reqBody) : "(empty)" }),
670
+ /* @__PURE__ */ a("div", { className: t.logPayloadHead, children: [
671
+ /* @__PURE__ */ n("span", { className: t.logPayloadLabel, children: "Response" }),
672
+ !s && e.resBody != null && /* @__PURE__ */ n(
673
+ "span",
674
+ {
675
+ className: t.copyStop,
676
+ onClick: (r) => r.stopPropagation(),
677
+ children: /* @__PURE__ */ n(
678
+ Je,
679
+ {
680
+ size: "sm",
681
+ className: t.payloadCopy,
682
+ value: () => q(e.resBody),
683
+ "aria-label": "Copy response payload"
684
+ }
685
+ )
686
+ }
687
+ )
688
+ ] }),
689
+ s ? /* @__PURE__ */ a("div", { className: t.awaiting, children: [
690
+ /* @__PURE__ */ n("span", { className: o(i.pulseDot, t.awaitingDot) }),
691
+ "Awaiting response…"
692
+ ] }) : /* @__PURE__ */ n("pre", { className: o(i.asideRaw, t.logPre), children: e.resBody != null ? q(e.resBody) : "(empty)" })
730
693
  ] }),
731
- n ? /* @__PURE__ */ a("div", { className: l.awaiting, children: [
732
- /* @__PURE__ */ t("span", { className: c(i.pulseDot, l.awaitingDot) }),
733
- "Awaiting response…"
734
- ] }) : /* @__PURE__ */ t("pre", { className: c(i.asideRaw, l.logPre), children: e.resBody != null ? JSON.stringify(e.resBody, null, 2) : "(empty)" })
694
+ !c && s && /* @__PURE__ */ a("div", { className: t.awaiting, children: [
695
+ /* @__PURE__ */ n("span", { className: o(i.pulseDot, t.awaitingDot) }),
696
+ "Still ongoing…"
697
+ ] })
735
698
  ]
736
699
  },
737
700
  e.id
@@ -739,75 +702,75 @@ const N = 84, Dl = 24, F = 400, Pt = 51, Ce = 300, Jt = vt(
739
702
  }) })
740
703
  ] })
741
704
  ] }),
742
- B === "bubble" && Q
705
+ P === "bubble" && Y
743
706
  ] }),
744
- /* @__PURE__ */ t("div", { className: c(i.footnote, m?.footnote), children: "Click an event to open its details in the side panel · dashed pills are still in flight" })
707
+ /* @__PURE__ */ n("div", { className: o(i.footnote, m?.footnote), children: "Click an event to open its details in the side panel · dashed pills are still in flight" })
745
708
  ] }),
746
- (B === "right" || B === "floating") && Q,
747
- C && /* @__PURE__ */ a("div", { className: c(l.rail, m?.rail), children: [
748
- /* @__PURE__ */ t(
709
+ (P === "right" || P === "floating") && Y,
710
+ T && /* @__PURE__ */ a("div", { className: o(t.rail, m?.rail), children: [
711
+ /* @__PURE__ */ n(
749
712
  "button",
750
713
  {
751
714
  type: "button",
752
715
  title: "Event details",
753
716
  "aria-label": "Toggle event details drawer",
754
- "aria-pressed": x === "details",
755
- className: c(l.railBtn, x === "details" && l.railBtnActive),
756
- onClick: () => $(x === "details" ? null : "details"),
757
- children: /* @__PURE__ */ a("span", { className: l.railGlyphDetails, "aria-hidden": !0, children: [
758
- /* @__PURE__ */ t("span", {}),
759
- /* @__PURE__ */ t("span", {}),
760
- /* @__PURE__ */ t("span", {})
717
+ "aria-pressed": w === "details",
718
+ className: o(t.railBtn, w === "details" && t.railBtnActive),
719
+ onClick: () => V(w === "details" ? null : "details"),
720
+ children: /* @__PURE__ */ a("span", { className: t.railGlyphDetails, "aria-hidden": !0, children: [
721
+ /* @__PURE__ */ n("span", {}),
722
+ /* @__PURE__ */ n("span", {}),
723
+ /* @__PURE__ */ n("span", {})
761
724
  ] })
762
725
  }
763
726
  ),
764
- /* @__PURE__ */ t(
727
+ /* @__PURE__ */ n(
765
728
  "button",
766
729
  {
767
730
  type: "button",
768
731
  title: "Full log",
769
732
  "aria-label": "Toggle full log drawer",
770
- "aria-pressed": x === "log",
771
- className: c(l.railBtn, x === "log" && l.railBtnActive),
733
+ "aria-pressed": w === "log",
734
+ className: o(t.railBtn, w === "log" && t.railBtnActive),
772
735
  onClick: () => {
773
- const e = x === "log" ? null : "log";
774
- e === "log" && v != null && (Z.current = v), $(e);
736
+ const e = w === "log" ? null : "log";
737
+ e === "log" && y != null && (G.current = y), V(e);
775
738
  },
776
- children: /* @__PURE__ */ a("span", { className: l.railGlyphLog, "aria-hidden": !0, children: [
777
- /* @__PURE__ */ t("span", {}),
778
- /* @__PURE__ */ t("span", {}),
779
- /* @__PURE__ */ t("span", {})
739
+ children: /* @__PURE__ */ a("span", { className: t.railGlyphLog, "aria-hidden": !0, children: [
740
+ /* @__PURE__ */ n("span", {}),
741
+ /* @__PURE__ */ n("span", {}),
742
+ /* @__PURE__ */ n("span", {})
780
743
  ] })
781
744
  }
782
745
  )
783
746
  ] })
784
747
  ] }),
785
- B === "bottom" && Q,
786
- y && (() => {
787
- const e = u.find((n) => n.id === y.id), s = e && Le ? Le(e, {
788
- color: R[e.service] || S.body,
748
+ P === "bottom" && Y,
749
+ v && (() => {
750
+ const e = u.find((s) => s.id === v.id), l = e && Se ? Se(e, {
751
+ color: L[e.service] || C.body,
789
752
  pending: e.end == null,
790
- durationMs: (e.end ?? M) - e.start
753
+ durationMs: (e.end ?? k) - e.start
791
754
  }) : void 0;
792
- return Le && s == null ? null : /* @__PURE__ */ t(Mt, { x: y.x, y: y.y, className: m?.tooltip, children: s !== void 0 ? s : /* @__PURE__ */ a(P, { children: [
793
- /* @__PURE__ */ t("div", { className: c(i.tooltipTitle, i.tooltipMono), children: y.rid }),
794
- /* @__PURE__ */ t("div", { className: i.tooltipLine, style: { marginTop: 4 }, children: y.route }),
795
- /* @__PURE__ */ t(
755
+ return Se && l == null ? null : /* @__PURE__ */ n(Bl, { x: v.x, y: v.y, className: m?.tooltip, children: l !== void 0 ? l : /* @__PURE__ */ a(D, { children: [
756
+ /* @__PURE__ */ n("div", { className: o(i.tooltipTitle, i.tooltipMono), children: v.rid }),
757
+ /* @__PURE__ */ n("div", { className: i.tooltipLine, style: { marginTop: 4 }, children: v.route }),
758
+ v.label && /* @__PURE__ */ n(
796
759
  "div",
797
760
  {
798
- className: c(i.tooltipLine, i.tooltipMono),
761
+ className: o(i.tooltipLine, i.tooltipMono),
799
762
  style: { marginTop: 2 },
800
- children: y.label
763
+ children: v.label
801
764
  }
802
765
  ),
803
- /* @__PURE__ */ t("div", { className: i.tooltipLine, style: { marginTop: 4 }, children: y.time }),
804
- /* @__PURE__ */ t("div", { className: i.tooltipLine, children: y.durLine }),
805
- y.url && /* @__PURE__ */ t(
766
+ /* @__PURE__ */ n("div", { className: i.tooltipLine, style: { marginTop: 4 }, children: v.time }),
767
+ /* @__PURE__ */ n("div", { className: i.tooltipLine, children: v.durLine }),
768
+ v.url && /* @__PURE__ */ n(
806
769
  "div",
807
770
  {
808
- className: c(i.tooltipDim, i.tooltipMono),
771
+ className: o(i.tooltipDim, i.tooltipMono),
809
772
  style: { marginTop: 4, wordBreak: "break-all", fontSize: "10.5px" },
810
- children: y.url
773
+ children: v.url
811
774
  }
812
775
  )
813
776
  ] }) });
@@ -816,5 +779,5 @@ const N = 84, Dl = 24, F = 400, Pt = 51, Ce = 300, Jt = vt(
816
779
  }
817
780
  );
818
781
  export {
819
- Jt as TraceTimeline
782
+ tn as TraceTimeline
820
783
  };