@overdoser/react-toolkit 0.10.1 → 0.12.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,529 +1,813 @@
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 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
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 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) {
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: 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,
37
42
  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 }
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(() => {
54
+ const e = g.current;
55
+ e && at(
56
+ (s) => s.l === e.scrollLeft && s.w === e.clientWidth ? s : { l: e.scrollLeft, w: e.clientWidth }
46
57
  );
47
58
  }, []);
48
- Ft(() => {
49
- G && ye();
59
+ ae(() => {
60
+ re && Pe();
50
61
  });
51
- const [A, Bt] = N({ l: 0, w: 2e3 }), be = x(A);
52
- be.current = A;
53
- const Me = _(() => {
54
- const e = h.current;
62
+ const [J, it] = f({ l: 0, w: 2e3 }), De = p(J);
63
+ De.current = J;
64
+ const We = ie(() => {
65
+ const e = g.current;
55
66
  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(
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
+ () => () => {
72
+ j.current && clearTimeout(j.current);
73
+ },
74
+ []
75
+ );
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(
61
79
  "input",
62
80
  {
63
81
  className: c(i.searchInput, m?.search),
64
82
  placeholder: "Highlight keyword in events…",
65
83
  "aria-label": "Highlight keyword",
66
- value: Se,
67
- onChange: (e) => Qe(e.target.value)
84
+ value: qe,
85
+ onChange: (e) => yl(e.target.value)
68
86
  }
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();
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();
79
97
  });
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);
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);
85
103
  }, []);
86
- cn(h, (e) => {
104
+ Ht(g, (e) => {
105
+ if (!Et(Re, e)) return;
87
106
  e.preventDefault();
88
- const t = h.current;
89
- t && Ee(
107
+ const s = g.current;
108
+ s && Ve(
90
109
  Math.exp(-(e.deltaY || e.deltaX) * 22e-4),
91
- e.clientX - t.getBoundingClientRect().left
110
+ e.clientX - s.getBoundingClientRect().left
92
111
  );
93
112
  });
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();
113
+ const Ue = p(null), dt = ie(() => {
114
+ Ue.current == null && (Ue.current = requestAnimationFrame(() => {
115
+ Ue.current = null;
116
+ 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();
101
120
  }));
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);
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);
111
130
  return;
112
131
  }
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 });
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 });
115
134
  }));
116
- }, []), Be = (e) => {
117
- ve === void 0 && Pt(e ? e.id : null), Mt?.(e);
118
- }, nt = zt(() => {
135
+ }, []), he = (e) => {
136
+ V === void 0 && st(e ? e.id : null), Zl?.(e);
137
+ }, Je = Bl(() => {
119
138
  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);
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);
124
143
  }), 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) => ({
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) => ({
130
149
  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;
150
+ 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({
167
+ 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;
153
172
  });
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
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
162
181
  });
163
182
  }
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({
183
+ const Ze = H ? H.t : null, r = v != null && u.find((e) => e.id === v) || null;
184
+ ae(() => {
185
+ const e = X.current;
186
+ if (e == null) return;
187
+ const s = g.current;
188
+ if (!s) {
189
+ X.current = null;
190
+ return;
191
+ }
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;
201
+ 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}"]`);
203
+ if (!h) return;
204
+ const o = Math.max(
205
+ 0,
206
+ s.scrollTop + h.getBoundingClientRect().top - s.getBoundingClientRect().top - 8
207
+ );
208
+ Pl(s, { top: o }, 600), Nl(e), j.current && clearTimeout(j.current), j.current = setTimeout(() => Nl(null), 1200);
209
+ });
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({
176
222
  id: e.id,
177
- x: C,
178
- y: oe,
179
- rid: String(U(e)),
180
- route: Q(e) + " → " + e.service,
223
+ x: k,
224
+ y: be,
225
+ rid: String(W(e)),
226
+ route: G(e) + " → " + e.service,
181
227
  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 ?? "—"),
228
+ time: A(e.start, !0),
229
+ durLine: h ? "in flight · " + xe(o) + " so far" : xe(o) + " · status " + (e.status ?? "—"),
184
230
  url: e.url || ""
185
231
  });
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,
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,
190
238
  {
191
239
  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);
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);
196
245
  return {
197
246
  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
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
204
253
  };
205
254
  }),
206
255
  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
- });
256
+ const s = u.find((n) => n.id === e);
257
+ s && (he(s), x === "log" && (Z.current = e)), X.current = e;
211
258
  }
212
259
  }
213
260
  ) : 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") })
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: [
263
+ /* @__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") })
219
266
  ] }),
220
- et,
221
- Ke && /* @__PURE__ */ n(
222
- en,
267
+ bl,
268
+ tl && /* @__PURE__ */ t(
269
+ kt,
223
270
  {
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),
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),
228
275
  onFit: () => {
229
- ze(!0), Fe(null);
276
+ cl(!0), il(null);
230
277
  },
231
- hint: "scroll zooms · drag pans"
278
+ hint: Re === "none" ? "drag pans" : (Re === "ctrl" ? "Ctrl+scroll zooms" : "scroll zooms") + " · drag pans"
232
279
  }
233
280
  )
234
281
  ] }),
235
- wt && /* @__PURE__ */ n(
236
- tn,
282
+ Ul && /* @__PURE__ */ t(
283
+ Tt,
237
284
  {
238
285
  className: m?.legend,
239
- items: nt.map((e) => ({ name: e, color: T[e] }))
286
+ items: Je.map((e) => ({ name: e, color: R[e] }))
240
287
  }
241
288
  ),
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(
247
- "div",
248
- {
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,
255
- onPointerLeave: () => {
256
- V.onPointerUp(), xe(null);
257
- },
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(
289
+ B === "top" && Q,
290
+ /* @__PURE__ */ a("div", { className: i.layout, children: [
291
+ B === "left" && Q,
292
+ /* @__PURE__ */ a("div", { className: i.main, children: [
293
+ /* @__PURE__ */ a("div", { className: i.cardWrap, children: [
294
+ /* @__PURE__ */ t(
295
+ "div",
296
+ {
297
+ className: c(
298
+ i.card,
299
+ (Ge || Rl) && l.cardFlushRight,
300
+ m?.card
301
+ ),
302
+ children: /* @__PURE__ */ t(
263
303
  "div",
264
304
  {
265
- className: s.nowLine,
266
- style: { left: Math.round(p + (M - o) * v) }
267
- }
268
- ),
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) })
277
- ] }),
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(
285
- "span",
286
- {
287
- className: c(s.axisMinorMark, e.medium && s.axisMinorMedium),
288
- style: { left: e.left }
305
+ 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,
311
+ onPointerLeave: () => {
312
+ K.onPointerUp(), Ee(null);
289
313
  },
290
- t
291
- )),
292
- S && !f && /* @__PURE__ */ n("div", { className: s.axisChip, style: { left: S.chipLeft }, children: S.label }),
293
- O && /* @__PURE__ */ r(
294
- "div",
295
- {
296
- className: c(s.axisChip, s.axisChipEvent),
297
- style: { left: O.chipLeft },
298
- children: [
299
- "▸ ",
300
- O.label
301
- ]
302
- }
303
- )
304
- ] }),
305
- /* @__PURE__ */ r("div", { className: s.lane, style: { height: ne.h }, children: [
306
- /* @__PURE__ */ n("div", { className: s.axisLine, style: { top: ne.axisY } }),
307
- 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 = {
311
- onClick: () => {
312
- V.wasDragSuppressed() || (we(null), Be(P === e.id ? null : e));
313
- },
314
- onMouseEnter: (C) => Kt(e, C),
315
- onMouseLeave: Xt
316
- };
317
- return /* @__PURE__ */ r("span", { children: [
318
- t.showLabel && /* @__PURE__ */ r(R, { children: [
319
- t.conn && !t.hconn && /* @__PURE__ */ n(
320
- "div",
321
- {
322
- className: s.stem,
323
- style: {
324
- left: t.left,
325
- top: t.connTop,
326
- height: t.connH,
327
- background: z
328
- }
329
- }
330
- ),
331
- t.conn && t.hconn && /* @__PURE__ */ r(R, { children: [
332
- /* @__PURE__ */ n(
333
- "div",
334
- {
335
- className: s.stem,
336
- style: {
337
- left: t.left,
338
- top: t.connTop,
339
- height: t.connH,
340
- background: z
341
- }
342
- }
343
- ),
344
- /* @__PURE__ */ n(
345
- "div",
346
- {
347
- className: s.elbow,
348
- style: {
349
- left: t.hconnLeft,
350
- top: t.hconnTop,
351
- width: t.hconnW,
352
- background: z
353
- }
354
- }
355
- )
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(
319
+ "div",
320
+ {
321
+ className: l.nowLine,
322
+ style: { left: Math.round(N + (M - d) * b) }
323
+ }
324
+ ),
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) })
356
333
  ] }),
357
- /* @__PURE__ */ n(
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(
341
+ "span",
342
+ {
343
+ className: c(l.axisMinorMark, e.medium && l.axisMinorMedium),
344
+ style: { left: e.left }
345
+ },
346
+ s
347
+ )),
348
+ H && !y && /* @__PURE__ */ t("div", { className: l.axisChip, style: { left: H.chipLeft }, children: H.label }),
349
+ U && /* @__PURE__ */ a(
358
350
  "div",
359
351
  {
360
- ...Z,
361
- className: c(s.chip, m?.chip),
362
- 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)"
352
+ className: c(l.axisChip, l.axisChipEvent),
353
+ style: { left: U.chipLeft },
354
+ children: [
355
+ "▸ ",
356
+ U.label
357
+ ]
358
+ }
359
+ )
360
+ ] }),
361
+ /* @__PURE__ */ a("div", { className: l.lane, style: { height: pe.h }, children: [
362
+ /* @__PURE__ */ t("div", { className: l.axisLine, style: { top: pe.axisY } }),
363
+ 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 = {
367
+ 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);
369
372
  },
370
- children: Xe ? Xe(e, {
371
- color: l,
372
- pending: y,
373
- durationMs: (e.end ?? M) - e.start
374
- }) : /* @__PURE__ */ r(R, { children: [
375
- /* @__PURE__ */ r("div", { children: [
376
- /* @__PURE__ */ n(
377
- "span",
373
+ onMouseEnter: (k) => ft(e, k),
374
+ onMouseLeave: gt
375
+ };
376
+ return /* @__PURE__ */ a("span", { children: [
377
+ s.showLabel && /* @__PURE__ */ a(P, { children: [
378
+ s.conn && !s.hconn && /* @__PURE__ */ t(
379
+ "div",
380
+ {
381
+ className: l.stem,
382
+ style: {
383
+ left: s.left,
384
+ top: s.connTop,
385
+ height: s.connH,
386
+ background: se
387
+ }
388
+ }
389
+ ),
390
+ s.conn && s.hconn && /* @__PURE__ */ a(P, { children: [
391
+ /* @__PURE__ */ t(
392
+ "div",
378
393
  {
379
- className: s.chipBadge,
380
- style: { background: H(ce, 14), color: ce },
381
- children: F
394
+ className: l.stem,
395
+ style: {
396
+ left: s.left,
397
+ top: s.connTop,
398
+ height: s.connH,
399
+ background: se
400
+ }
382
401
  }
383
402
  ),
384
- /* @__PURE__ */ n("span", { className: s.chipArrow, children: " → " }),
385
- /* @__PURE__ */ n(
386
- "span",
403
+ /* @__PURE__ */ t(
404
+ "div",
387
405
  {
388
- className: s.chipBadge,
389
- style: { background: H(j, 14), color: j },
390
- children: e.service
406
+ className: l.elbow,
407
+ style: {
408
+ left: s.hconnLeft,
409
+ top: s.hconnTop,
410
+ width: s.hconnW,
411
+ background: se
412
+ }
391
413
  }
392
414
  )
393
415
  ] }),
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) })
396
- ] })
416
+ /* @__PURE__ */ t(
417
+ "div",
418
+ {
419
+ ...ne,
420
+ className: c(l.chip, m?.chip),
421
+ 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
+ },
429
+ children: nl ? nl(e, {
430
+ color: n,
431
+ pending: h,
432
+ durationMs: (e.end ?? M) - e.start
433
+ }) : /* @__PURE__ */ a(P, { children: [
434
+ /* @__PURE__ */ a("div", { children: [
435
+ /* @__PURE__ */ t(
436
+ "span",
437
+ {
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 },
449
+ children: e.service
450
+ }
451
+ )
452
+ ] }),
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) })
455
+ ] })
456
+ }
457
+ )
458
+ ] }),
459
+ /* @__PURE__ */ t(
460
+ "div",
461
+ {
462
+ ...ne,
463
+ className: c(l.bar, h && l.barPending, m?.bar),
464
+ 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
473
+ },
474
+ children: h && /* @__PURE__ */ t(
475
+ "span",
476
+ {
477
+ className: c(i.pulseDot, l.barDot),
478
+ style: { background: n }
479
+ }
480
+ )
481
+ }
482
+ )
483
+ ] }, e.id);
484
+ })
485
+ ] })
486
+ ] })
487
+ }
488
+ )
489
+ }
490
+ ),
491
+ Ge && r && Be && /* @__PURE__ */ a("div", { className: l.dockCol, style: { flexBasis: ce }, children: [
492
+ /* @__PURE__ */ t(
493
+ Qe,
494
+ {
495
+ panel: "right",
496
+ width: ce,
497
+ min: 280,
498
+ max: 640,
499
+ onResize: ml,
500
+ label: "Resize details drawer",
501
+ className: l.dockColResizer
502
+ }
503
+ ),
504
+ /* @__PURE__ */ t("aside", { className: c(i.aside, l.drawerCustom, m?.drawer), children: Be(r, { close: _e, pending: I }) })
505
+ ] }),
506
+ Ge && !(r && Be) && /* @__PURE__ */ a("div", { className: l.dockCol, style: { flexBasis: ce }, children: [
507
+ /* @__PURE__ */ t(
508
+ Qe,
509
+ {
510
+ panel: "right",
511
+ width: ce,
512
+ min: 280,
513
+ max: 640,
514
+ onResize: ml,
515
+ label: "Resize details drawer",
516
+ className: l.dockColResizer
517
+ }
518
+ ),
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(
524
+ "button",
525
+ {
526
+ type: "button",
527
+ className: i.asideClose,
528
+ "aria-label": "Close details",
529
+ onClick: _e,
530
+ children: "✕"
531
+ }
532
+ )
533
+ ] }),
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"
397
591
  }
398
592
  )
399
593
  ] }),
400
- /* @__PURE__ */ n(
401
- "div",
402
- {
403
- ...Z,
404
- className: c(s.bar, y && s.barPending, m?.bar),
405
- 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
414
- },
415
- children: y && /* @__PURE__ */ n(
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." })
622
+ ] })
623
+ ] }),
624
+ Rl && /* @__PURE__ */ a("div", { className: l.dockCol, style: { flexBasis: hl }, children: [
625
+ /* @__PURE__ */ t(
626
+ Qe,
627
+ {
628
+ panel: "right",
629
+ width: hl,
630
+ min: 320,
631
+ max: 680,
632
+ onResize: nt,
633
+ label: "Resize log drawer",
634
+ className: l.dockColResizer
635
+ }
636
+ ),
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: [
641
+ u.length,
642
+ " events"
643
+ ] }),
644
+ /* @__PURE__ */ t("div", { className: l.drawerSpacer }),
645
+ /* @__PURE__ */ t(
646
+ "button",
647
+ {
648
+ type: "button",
649
+ className: i.asideClose,
650
+ "aria-label": "Close full log",
651
+ onClick: () => $(null),
652
+ children: "✕"
653
+ }
654
+ )
655
+ ] }),
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?:\/\/[^/]+/, "") : "";
658
+ return /* @__PURE__ */ a(
659
+ "div",
660
+ {
661
+ "data-crk-log-id": e.id,
662
+ className: c(
663
+ l.logEntry,
664
+ v === e.id && l.logEntrySelected,
665
+ rt === e.id && l.logEntryFlash
666
+ ),
667
+ onClick: () => {
668
+ he(e), X.current = e.id;
669
+ },
670
+ 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) })
689
+ ] }),
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(
416
695
  "span",
417
696
  {
418
- className: c(i.pulseDot, s.barDot),
419
- style: { background: l }
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
+ )
420
708
  }
421
709
  )
422
- }
423
- )
424
- ] }, e.id);
425
- })
426
- ] })
710
+ ] }),
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
+ )
730
+ ] }),
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)" })
735
+ ]
736
+ },
737
+ e.id
738
+ );
739
+ }) })
427
740
  ] })
428
- }
429
- ) }),
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" })
431
- ] }),
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
741
  ] }),
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)) })
742
+ B === "bubble" && Q
465
743
  ] }),
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) })
483
- ] }),
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 })
493
- ] }, 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)" })
496
- ] })
497
- ] })
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" })
498
745
  ] }),
499
- (E === "right" || E === "floating") && ae
746
+ (B === "right" || B === "floating") && Q,
747
+ C && /* @__PURE__ */ a("div", { className: c(l.rail, m?.rail), children: [
748
+ /* @__PURE__ */ t(
749
+ "button",
750
+ {
751
+ type: "button",
752
+ title: "Event details",
753
+ "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", {})
761
+ ] })
762
+ }
763
+ ),
764
+ /* @__PURE__ */ t(
765
+ "button",
766
+ {
767
+ type: "button",
768
+ title: "Full log",
769
+ "aria-label": "Toggle full log drawer",
770
+ "aria-pressed": x === "log",
771
+ className: c(l.railBtn, x === "log" && l.railBtnActive),
772
+ onClick: () => {
773
+ const e = x === "log" ? null : "log";
774
+ e === "log" && v != null && (Z.current = v), $(e);
775
+ },
776
+ children: /* @__PURE__ */ a("span", { className: l.railGlyphLog, "aria-hidden": !0, children: [
777
+ /* @__PURE__ */ t("span", {}),
778
+ /* @__PURE__ */ t("span", {}),
779
+ /* @__PURE__ */ t("span", {})
780
+ ] })
781
+ }
782
+ )
783
+ ] })
500
784
  ] }),
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,
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,
505
789
  pending: e.end == null,
506
790
  durationMs: (e.end ?? M) - e.start
507
791
  }) : 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(
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(
512
796
  "div",
513
797
  {
514
798
  className: c(i.tooltipLine, i.tooltipMono),
515
799
  style: { marginTop: 2 },
516
- children: f.label
800
+ children: y.label
517
801
  }
518
802
  ),
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(
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(
522
806
  "div",
523
807
  {
524
808
  className: c(i.tooltipDim, i.tooltipMono),
525
809
  style: { marginTop: 4, wordBreak: "break-all", fontSize: "10.5px" },
526
- children: f.url
810
+ children: y.url
527
811
  }
528
812
  )
529
813
  ] }) });
@@ -532,5 +816,5 @@ const p = 84, dt = 24, q = 400, dn = 51, me = 300, yn = $t(
532
816
  }
533
817
  );
534
818
  export {
535
- yn as TraceTimeline
819
+ Jt as TraceTimeline
536
820
  };