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