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