durable-actors-observer 0.14.0 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13,10 +13,10 @@ import { Drawer as z } from "vaul";
13
13
  import { JsonView as ne } from "react-json-view-lite";
14
14
  import { create as re } from "jsondiffpatch";
15
15
  import { format as ie } from "jsondiffpatch/formatters/html";
16
- import * as ae from "@radix-ui/react-dialog";
17
- import { createParser as oe } from "eventsource-parser";
16
+ import * as B from "@radix-ui/react-dialog";
17
+ import { createParser as ae } from "eventsource-parser";
18
18
  //#region src/ConnectionInventoryNotice.tsx
19
- function se({ inventory: e }) {
19
+ function oe({ inventory: e }) {
20
20
  return e?.connectionsComplete === !1 ? /* @__PURE__ */ A("p", {
21
21
  className: "overview-alert",
22
22
  role: "status",
@@ -25,85 +25,85 @@ function se({ inventory: e }) {
25
25
  }
26
26
  //#endregion
27
27
  //#region src/lib/utils.ts
28
- var ce = P({ prefix: "la" });
29
- function B(...e) {
30
- return ce(N(e));
28
+ var se = P({ prefix: "la" });
29
+ function V(...e) {
30
+ return se(N(e));
31
31
  }
32
32
  //#endregion
33
33
  //#region src/components/ui/command.tsx
34
- function le({ className: e, ...t }) {
34
+ function ce({ className: e, ...t }) {
35
35
  return /* @__PURE__ */ A(M, {
36
36
  "data-slot": "command",
37
- className: B("la:flex la:h-full la:w-full la:flex-col la:overflow-hidden la:rounded-md la:bg-popover la:text-popover-foreground", e),
37
+ className: V("la:flex la:h-full la:w-full la:flex-col la:overflow-hidden la:rounded-md la:bg-popover la:text-popover-foreground", e),
38
38
  ...t
39
39
  });
40
40
  }
41
- function ue({ className: e, ...t }) {
41
+ function le({ className: e, ...t }) {
42
42
  return /* @__PURE__ */ j("div", {
43
43
  "data-slot": "command-input-wrapper",
44
44
  className: "la:flex la:h-9 la:items-center la:gap-2 la:border-b la:px-3",
45
45
  children: [/* @__PURE__ */ A(T, { className: "la:size-4 la:shrink-0 la:opacity-50" }), /* @__PURE__ */ A(M.Input, {
46
46
  "data-slot": "command-input",
47
- className: B("la:flex la:h-10 la:w-full la:rounded-md la:bg-transparent la:py-3 la:text-sm la:outline-hidden la:placeholder:text-muted-foreground la:disabled:cursor-not-allowed la:disabled:opacity-50", e),
47
+ className: V("la:flex la:h-10 la:w-full la:rounded-md la:bg-transparent la:py-3 la:text-sm la:outline-hidden la:placeholder:text-muted-foreground la:disabled:cursor-not-allowed la:disabled:opacity-50", e),
48
48
  ...t
49
49
  })]
50
50
  });
51
51
  }
52
- function de({ className: e, ...t }) {
52
+ function ue({ className: e, ...t }) {
53
53
  return /* @__PURE__ */ A(M.List, {
54
54
  "data-slot": "command-list",
55
- className: B("la:max-h-[300px] la:scroll-py-1 la:overflow-x-hidden la:overflow-y-auto", e),
55
+ className: V("la:max-h-[300px] la:scroll-py-1 la:overflow-x-hidden la:overflow-y-auto", e),
56
56
  ...t
57
57
  });
58
58
  }
59
- function fe({ ...e }) {
59
+ function de({ ...e }) {
60
60
  return /* @__PURE__ */ A(M.Empty, {
61
61
  "data-slot": "command-empty",
62
62
  className: "la:py-6 la:text-center la:text-sm",
63
63
  ...e
64
64
  });
65
65
  }
66
- function pe({ className: e, ...t }) {
66
+ function fe({ className: e, ...t }) {
67
67
  return /* @__PURE__ */ A(M.Group, {
68
68
  "data-slot": "command-group",
69
- className: B("la:overflow-hidden la:p-1 la:text-foreground la:[&_[cmdk-group-heading]]:px-2 la:[&_[cmdk-group-heading]]:py-1.5 la:[&_[cmdk-group-heading]]:text-xs la:[&_[cmdk-group-heading]]:font-medium la:[&_[cmdk-group-heading]]:text-muted-foreground", e),
69
+ className: V("la:overflow-hidden la:p-1 la:text-foreground la:[&_[cmdk-group-heading]]:px-2 la:[&_[cmdk-group-heading]]:py-1.5 la:[&_[cmdk-group-heading]]:text-xs la:[&_[cmdk-group-heading]]:font-medium la:[&_[cmdk-group-heading]]:text-muted-foreground", e),
70
70
  ...t
71
71
  });
72
72
  }
73
- function me({ className: e, ...t }) {
73
+ function pe({ className: e, ...t }) {
74
74
  return /* @__PURE__ */ A(M.Separator, {
75
75
  "data-slot": "command-separator",
76
- className: B("la:-mx-1 la:h-px la:bg-border", e),
76
+ className: V("la:-mx-1 la:h-px la:bg-border", e),
77
77
  ...t
78
78
  });
79
79
  }
80
- function he({ className: e, ...t }) {
80
+ function me({ className: e, ...t }) {
81
81
  return /* @__PURE__ */ A(M.Item, {
82
82
  "data-slot": "command-item",
83
- className: B("la:relative la:flex la:cursor-default la:items-center la:gap-2 la:rounded-sm la:px-2 la:py-1.5 la:text-sm la:outline-hidden la:select-none la:data-[disabled=true]:pointer-events-none la:data-[disabled=true]:opacity-50 la:data-[selected=true]:bg-accent la:data-[selected=true]:text-accent-foreground la:[&_svg]:pointer-events-none la:[&_svg]:shrink-0 la:[&_svg:not([class*='size-'])]:size-4 la:[&_svg:not([class*='text-'])]:text-muted-foreground", e),
83
+ className: V("la:relative la:flex la:cursor-default la:items-center la:gap-2 la:rounded-sm la:px-2 la:py-1.5 la:text-sm la:outline-hidden la:select-none la:data-[disabled=true]:pointer-events-none la:data-[disabled=true]:opacity-50 la:data-[selected=true]:bg-accent la:data-[selected=true]:text-accent-foreground la:[&_svg]:pointer-events-none la:[&_svg]:shrink-0 la:[&_svg:not([class*='size-'])]:size-4 la:[&_svg:not([class*='text-'])]:text-muted-foreground", e),
84
84
  ...t
85
85
  });
86
86
  }
87
- function ge({ className: e, ...t }) {
87
+ function he({ className: e, ...t }) {
88
88
  return /* @__PURE__ */ A("span", {
89
89
  "data-slot": "command-shortcut",
90
- className: B("la:ml-auto la:text-xs la:tracking-widest la:text-muted-foreground", e),
90
+ className: V("la:ml-auto la:text-xs la:tracking-widest la:text-muted-foreground", e),
91
91
  ...t
92
92
  });
93
93
  }
94
94
  //#endregion
95
95
  //#region src/FilterCombobox.tsx
96
- function _e({ label: e, placeholder: t, value: n, onChange: r, onSelectSuggestion: i, suggestions: a, limit: s = 8, className: c }) {
97
- let [l, u] = o(!1), d = ve(a, n, s, !!i), f = d.reduce((e, t) => e.set(t.group, [...e.get(t.group) ?? [], t]), /* @__PURE__ */ new Map()), p = l && d.length > 0;
98
- return /* @__PURE__ */ j(le, {
96
+ function ge({ label: e, placeholder: t, value: n, onChange: r, onSelectSuggestion: i, suggestions: a, limit: s = 8, className: c }) {
97
+ let [l, u] = o(!1), d = _e(a, n, s, !!i), f = d.reduce((e, t) => e.set(t.group, [...e.get(t.group) ?? [], t]), /* @__PURE__ */ new Map()), p = l && d.length > 0;
98
+ return /* @__PURE__ */ j(ce, {
99
99
  label: e,
100
100
  shouldFilter: !1,
101
101
  loop: !0,
102
- className: B("la-combobox la:relative la:overflow-visible la:bg-transparent", c),
102
+ className: V("la-combobox la:relative la:overflow-visible la:bg-transparent", c),
103
103
  onKeyDown: (e) => {
104
104
  e.key === "Escape" && u(!1), e.key === "ArrowDown" && u(!0);
105
105
  },
106
- children: [/* @__PURE__ */ A(ue, {
106
+ children: [/* @__PURE__ */ A(le, {
107
107
  placeholder: t,
108
108
  value: n,
109
109
  onValueChange: (e) => {
@@ -111,13 +111,13 @@ function _e({ label: e, placeholder: t, value: n, onChange: r, onSelectSuggestio
111
111
  },
112
112
  onFocus: () => u(!0),
113
113
  onBlur: () => u(!1)
114
- }), p && /* @__PURE__ */ A(de, {
114
+ }), p && /* @__PURE__ */ A(ue, {
115
115
  label: `${e} suggestions`,
116
116
  className: "la:absolute la:top-full la:right-0 la:left-0 la:z-20 la:mt-1.5 la:rounded-md la:border la:bg-popover la:text-popover-foreground la:shadow-md",
117
117
  onMouseDown: (e) => e.preventDefault(),
118
- children: [...f].map(([e, t]) => /* @__PURE__ */ A(pe, {
118
+ children: [...f].map(([e, t]) => /* @__PURE__ */ A(fe, {
119
119
  heading: e,
120
- children: t.map((t) => /* @__PURE__ */ j(he, {
120
+ children: t.map((t) => /* @__PURE__ */ j(me, {
121
121
  value: t.id ?? `${e}:${t.value}`,
122
122
  onSelect: () => {
123
123
  i ? i(t) : r(t.value), u(!1);
@@ -134,7 +134,7 @@ function _e({ label: e, placeholder: t, value: n, onChange: r, onSelectSuggestio
134
134
  })]
135
135
  });
136
136
  }
137
- function ve(e, t, n, r = !1) {
137
+ function _e(e, t, n, r = !1) {
138
138
  let i = t.trim().toLocaleLowerCase(), a = i.split(/\s+/u).filter(Boolean), o = /* @__PURE__ */ new Set(), s = [];
139
139
  for (let t of e) {
140
140
  let e = t.id ?? `${t.group}:${t.value}`, n = [t.value, ...t.keywords ?? []].join(" ").toLocaleLowerCase(), c = t.value.toLocaleLowerCase() === i && !t.keywords?.length;
@@ -144,7 +144,7 @@ function ve(e, t, n, r = !1) {
144
144
  }
145
145
  //#endregion
146
146
  //#region src/TimelineWheelZoom.ts
147
- function ye(e, n, i, o) {
147
+ function ve(e, n, i, o) {
148
148
  let s = a(i), c = a({
149
149
  control: !1,
150
150
  command: !1
@@ -154,7 +154,7 @@ function ye(e, n, i, o) {
154
154
  }, [i]), t(() => {
155
155
  let t = e.current, r = t.ownerDocument, i = r.defaultView, a = () => t.querySelector(".request-waterfall-axis > div").getBoundingClientRect(), l = (e, t) => {
156
156
  let { left: r, width: i } = a();
157
- return i ? (s.current = be(s.current, n, e, Math.max(0, Math.min(1, (t - r) / i))), o(s.current), !0) : !1;
157
+ return i ? (s.current = ye(s.current, n, e, Math.max(0, Math.min(1, (t - r) / i))), o(s.current), !0) : !1;
158
158
  }, u = (e) => {
159
159
  if (!(e.ctrlKey && c.current.control || e.metaKey && c.current.command) || !e.deltaY) return;
160
160
  let t = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? a().width : 1;
@@ -180,7 +180,7 @@ function ye(e, n, i, o) {
180
180
  o
181
181
  ]);
182
182
  }
183
- function be(e, t, n, r) {
183
+ function ye(e, t, n, r) {
184
184
  let i = e.end - e.start, a = Math.max(1, Math.min(t.end - t.start, i * n)), o = Math.max(t.start, Math.min(e.start + (i - a) * r, t.end - a));
185
185
  return {
186
186
  start: o,
@@ -189,9 +189,9 @@ function be(e, t, n, r) {
189
189
  }
190
190
  //#endregion
191
191
  //#region src/TimelineScroll.tsx
192
- function xe({ bounds: e, range: n, onChange: i, children: o }) {
192
+ function be({ bounds: e, range: n, onChange: i, children: o }) {
193
193
  let s = a(null), c = a(null), l = a(0), u = Math.min(e.start, n.start), d = Math.max(e.end, n.end), f = n.end - n.start, p = d - u - f;
194
- return ye(s, e, n, i), r(() => {
194
+ return ve(s, e, n, i), r(() => {
195
195
  let e = c.current, t = () => {
196
196
  e.scrollLeft = p > 0 ? (n.start - u) / p * (e.scrollWidth - e.clientWidth) : 0, l.current = e.scrollLeft;
197
197
  };
@@ -251,49 +251,81 @@ function xe({ bounds: e, range: n, onChange: i, children: o }) {
251
251
  }
252
252
  //#endregion
253
253
  //#region src/request-timeline.ts
254
- function Se(e) {
255
- let t = [...e].sort((e, t) => e.startedAtMs - t.startedAtMs || e.sequence - t.sequence || (e.eventId ?? "").localeCompare(t.eventId ?? "")), n = t[0]?.startedAtMs ?? 0, r = n, i = /* @__PURE__ */ new Map(), a = t.map((e) => {
254
+ function xe(e, t = []) {
255
+ let n = [...e].sort((e, t) => e.startedAtMs - t.startedAtMs || e.sequence - t.sequence || (e.eventId ?? "").localeCompare(t.eventId ?? "")), r = n[0]?.startedAtMs ?? 0, i = r, a = /* @__PURE__ */ new Map(), o = n.map((e) => {
256
256
  let t = JSON.stringify([
257
257
  e.projectId,
258
258
  e.actorName,
259
259
  e.actorId
260
- ]), a = i.get(t), o = e.startedAtMs + e.durationMs;
261
- return i.set(t, Math.max(a ?? o, o)), r = Math.max(r, o), {
260
+ ]), n = a.get(t), o = e.startedAtMs + e.durationMs;
261
+ return a.set(t, Math.max(n ?? o, o)), i = Math.max(i, o), {
262
262
  record: e,
263
- offsetMs: e.startedAtMs - n,
264
- gapMs: a === void 0 ? null : e.startedAtMs - a
263
+ offsetMs: e.startedAtMs - r,
264
+ gapMs: n === void 0 ? null : e.startedAtMs - n
265
265
  };
266
266
  });
267
267
  return {
268
- start: n,
269
- span: r - n,
270
- calls: a,
271
- rows: Ce(a)
268
+ start: r,
269
+ span: i - r,
270
+ calls: o,
271
+ rows: Se(o, t)
272
272
  };
273
273
  }
274
- function Ce(e) {
275
- let t = /* @__PURE__ */ new Map();
276
- for (let n of e) {
277
- let { record: e } = n, r = JSON.stringify([
278
- e.projectId,
279
- e.actorName,
280
- e.actorId,
281
- e.kind,
282
- e.operation
283
- ]), i = t.get(r);
284
- i || (i = {
285
- key: r,
286
- record: e,
274
+ function Se(e, t) {
275
+ let n = /* @__PURE__ */ new Map(), r = e[0]?.record.projectId ?? t.find((e) => e.projectId)?.projectId ?? "";
276
+ function i(e) {
277
+ let { actorName: t, actorId: i, kind: a, operation: o } = e, s = e.projectId ?? r, c = JSON.stringify([
278
+ s,
279
+ t,
280
+ i,
281
+ a,
282
+ o
283
+ ]);
284
+ return n.has(c) || n.set(c, {
285
+ key: c,
286
+ projectId: s,
287
+ actorName: t,
288
+ actorId: i,
289
+ kind: a,
290
+ operation: o,
287
291
  calls: []
288
- }, t.set(r, i)), i.calls.push(n);
292
+ }), n.get(c);
289
293
  }
290
- return [...t.values()];
294
+ for (let e of t) i(e);
295
+ for (let t of e) i(t.record).calls.push(t);
296
+ return [...n.values()].sort((e, t) => e.key.localeCompare(t.key));
297
+ }
298
+ function Ce(e, t, n) {
299
+ let r = [...t];
300
+ for (let i of e?.actors ?? []) {
301
+ if (n && n.actorName !== i.actorName) continue;
302
+ let e = n ? [n.actorId] : new Set(t.filter((e) => e.actorName === i.actorName).map((e) => e.actorId));
303
+ for (let t of e) {
304
+ for (let e of i.methods ?? []) r.push({
305
+ actorName: i.actorName,
306
+ actorId: t,
307
+ kind: "method",
308
+ operation: e
309
+ });
310
+ if (i.methods) for (let e of [
311
+ "onConnect",
312
+ "onDisconnect",
313
+ "onMessage"
314
+ ]) r.push({
315
+ actorName: i.actorName,
316
+ actorId: t,
317
+ kind: "websocket",
318
+ operation: e
319
+ });
320
+ }
321
+ }
322
+ return r.filter((e) => !n || e.actorName === n.actorName && e.actorId === n.actorId);
291
323
  }
292
- function V(e) {
324
+ function H(e) {
293
325
  return e >= 6e4 ? `${(e / 6e4).toLocaleString(void 0, { maximumFractionDigits: 2 })} min` : e >= 1e3 ? `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 2 })} s` : `${e.toLocaleString(void 0, { maximumFractionDigits: 1 })} ms`;
294
326
  }
295
327
  function we(e) {
296
- return e === null ? "First in view" : e < 0 ? "Overlapping" : e === 0 ? "No gap" : `${V(e)} gap`;
328
+ return e === null ? "First in view" : e < 0 ? "Overlapping" : e === 0 ? "No gap" : `${H(e)} gap`;
297
329
  }
298
330
  //#endregion
299
331
  //#region src/TimelineZoom.tsx
@@ -336,7 +368,7 @@ function De({ bounds: e, range: t, count: n, onChange: r }) {
336
368
  max: 100,
337
369
  step: 1,
338
370
  value: a <= 1 ? 0 : Math.round(Math.log(a / i) / Math.log(a) * 100),
339
- "aria-valuetext": `${V(i)} window`,
371
+ "aria-valuetext": `${H(i)} window`,
340
372
  disabled: a <= 1,
341
373
  onChange: (e) => {
342
374
  let t = e.currentTarget.valueAsNumber;
@@ -346,7 +378,7 @@ function De({ bounds: e, range: t, count: n, onChange: r }) {
346
378
  }), /* @__PURE__ */ j("span", {
347
379
  role: "status",
348
380
  children: [
349
- V(i),
381
+ H(i),
350
382
  " window · ",
351
383
  n.toLocaleString(),
352
384
  " ",
@@ -425,18 +457,18 @@ function Ae(e, t, n) {
425
457
  return Math.max(0, Math.min(1, (e - t) / n));
426
458
  }
427
459
  function je(e, t) {
428
- return t >= 6e4 ? V(e) : e >= 1e3 ? `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 5 })} s` : `${e.toLocaleString(void 0, { maximumFractionDigits: 2 })} ms`;
460
+ return t >= 6e4 ? H(e) : e >= 1e3 ? `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 5 })} s` : `${e.toLocaleString(void 0, { maximumFractionDigits: 2 })} ms`;
429
461
  }
430
462
  //#endregion
431
463
  //#region src/RequestTimeline.tsx
432
- function Me({ records: e, selected: t, onSelect: n }) {
433
- let { start: r, span: i, rows: a } = Se(e), o = {
434
- start: r,
435
- end: r + Math.max(1, i)
436
- }, { range: s, setWindow: c } = Ee(o), l = a.map((e) => ({
464
+ function Me({ records: e, lanes: t, selected: n, onSelect: r }) {
465
+ let { start: i, span: a, rows: o } = xe(e, t), s = {
466
+ start: i,
467
+ end: i + Math.max(1, a)
468
+ }, { range: c, setWindow: l } = Ee(s), u = o.map((e) => ({
437
469
  ...e,
438
- calls: e.calls.filter((e) => Ie(e.record, s))
439
- })).filter((e) => e.calls.length > 0);
470
+ calls: e.calls.filter((e) => Ie(e.record, c))
471
+ })), d = u.reduce((e, t) => e + t.calls.length, 0);
440
472
  return /* @__PURE__ */ j("div", {
441
473
  className: "request-waterfall",
442
474
  role: "group",
@@ -444,42 +476,49 @@ function Me({ records: e, selected: t, onSelect: n }) {
444
476
  children: [
445
477
  /* @__PURE__ */ A(Ne, {
446
478
  count: e.length,
447
- span: i
479
+ span: a
448
480
  }),
449
481
  /* @__PURE__ */ A(De, {
450
- bounds: o,
451
- range: s,
452
- count: l.reduce((e, t) => e + t.calls.length, 0),
453
- onChange: c
482
+ bounds: s,
483
+ range: c,
484
+ count: d,
485
+ onChange: l
454
486
  }),
455
- /* @__PURE__ */ j(xe, {
456
- bounds: o,
457
- range: s,
458
- onChange: c,
487
+ /* @__PURE__ */ j(be, {
488
+ bounds: s,
489
+ range: c,
490
+ onChange: l,
459
491
  children: [
460
492
  /* @__PURE__ */ A(Oe, {
461
- start: r,
462
- range: s,
463
- onChange: c
493
+ start: i,
494
+ range: c,
495
+ onChange: l
464
496
  }),
465
- l.map((e) => /* @__PURE__ */ A(Pe, {
497
+ u.map((e) => /* @__PURE__ */ A(Pe, {
466
498
  row: e,
467
- range: s,
468
- selected: t,
469
- onSelect: n
499
+ range: c,
500
+ selected: n,
501
+ onSelect: r
470
502
  }, e.key)),
471
- !l.length && /* @__PURE__ */ A("div", {
503
+ !u.length && /* @__PURE__ */ A("div", {
472
504
  className: "la-request-empty",
473
- children: "No calls in this time range. Pan or zoom out to find calls."
505
+ children: "No calls yet."
474
506
  })
475
507
  ]
476
508
  }),
477
509
  /* @__PURE__ */ j("div", {
478
510
  className: "request-waterfall-caption",
479
- children: [/* @__PURE__ */ j("span", { children: ["Relative to ", /* @__PURE__ */ A("time", {
480
- dateTime: new Date(r).toISOString(),
481
- children: new Date(r).toLocaleString([], { hour12: !1 })
482
- })] }), /* @__PURE__ */ A("span", { children: "Gaps use preceding loaded calls on the same instance." })]
511
+ children: [
512
+ /* @__PURE__ */ A("span", { children: e.length ? /* @__PURE__ */ j(k, { children: ["Relative to ", /* @__PURE__ */ A("time", {
513
+ dateTime: new Date(i).toISOString(),
514
+ children: new Date(i).toLocaleString([], { hour12: !1 })
515
+ })] }) : "No calls yet." }),
516
+ /* @__PURE__ */ A("span", { children: "Gaps use preceding loaded calls on the same instance." }),
517
+ !d && /* @__PURE__ */ A("span", {
518
+ className: "la:sr-only",
519
+ children: "No calls in this time range. Pan or zoom out to find calls."
520
+ })
521
+ ]
483
522
  })
484
523
  ]
485
524
  });
@@ -490,7 +529,7 @@ function Ne({ count: e, span: t }) {
490
529
  children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("strong", { children: "Invocation waterfall" }), /* @__PURE__ */ j("span", { children: [
491
530
  e.toLocaleString(),
492
531
  " calls · ",
493
- V(t),
532
+ H(t),
494
533
  " elapsed"
495
534
  ] })] }), /* @__PURE__ */ j("ul", {
496
535
  className: "request-waterfall-legend",
@@ -505,19 +544,19 @@ function Ne({ count: e, span: t }) {
505
544
  })]
506
545
  });
507
546
  }
508
- function Pe({ row: { record: e, calls: t }, range: n, selected: r, onSelect: i }) {
547
+ function Pe({ row: { actorName: e, actorId: t, kind: n, operation: r, calls: i }, range: a, selected: o, onSelect: s }) {
509
548
  return /* @__PURE__ */ j("div", {
510
549
  className: "request-waterfall-row",
511
550
  role: "group",
512
- "aria-label": `${e.operation} ${e.kind} calls on ${e.actorName} / ${e.actorId}`,
513
- "data-state": t.some((e) => e.record === r) ? "selected" : void 0,
551
+ "aria-label": `${r} ${n} calls on ${e} / ${t}`,
552
+ "data-state": i.some((e) => e.record === o) ? "selected" : void 0,
514
553
  children: [
515
554
  /* @__PURE__ */ j("span", {
516
555
  className: "request-waterfall-label",
517
- children: [/* @__PURE__ */ A("strong", { children: e.operation }), /* @__PURE__ */ j("span", { children: [
518
- e.actorName,
556
+ children: [/* @__PURE__ */ A("strong", { children: r }), /* @__PURE__ */ j("span", { children: [
557
+ e,
519
558
  " / ",
520
- e.actorId
559
+ t
521
560
  ] })]
522
561
  }),
523
562
  /* @__PURE__ */ j("span", {
@@ -526,20 +565,20 @@ function Pe({ row: { record: e, calls: t }, range: n, selected: r, onSelect: i }
526
565
  className: "request-waterfall-gridline",
527
566
  "aria-hidden": "true",
528
567
  style: { left: `${e * 100}%` }
529
- }, e)), t.map((e) => /* @__PURE__ */ A(Fe, {
568
+ }, e)), i.map((e) => /* @__PURE__ */ A(Fe, {
530
569
  call: e,
531
- range: n,
532
- selected: r === e.record,
533
- onSelect: i
570
+ range: a,
571
+ selected: o === e.record,
572
+ onSelect: s
534
573
  }, e.record.eventId ?? e.record.sequence))]
535
574
  }),
536
575
  /* @__PURE__ */ j("span", {
537
576
  className: "request-waterfall-timing",
538
577
  children: [/* @__PURE__ */ j("strong", { children: [
539
- t.length.toLocaleString(),
578
+ i.length.toLocaleString(),
540
579
  " ",
541
- t.length === 1 ? "call" : "calls"
542
- ] }), /* @__PURE__ */ j("span", { children: [V(t.reduce((e, t) => e + t.record.durationMs, 0)), " total"] })]
580
+ i.length === 1 ? "call" : "calls"
581
+ ] }), /* @__PURE__ */ j("span", { children: [H(i.reduce((e, t) => e + t.record.durationMs, 0)), " total"] })]
543
582
  })
544
583
  ]
545
584
  });
@@ -561,9 +600,9 @@ function Fe({ call: { record: e, offsetMs: t, gapMs: n }, range: r, selected: i,
561
600
  width: `${(c - s) / o * 100}%`
562
601
  },
563
602
  "data-state": i ? "selected" : void 0,
564
- "aria-label": `Inspect ${e.operation} request on ${e.actorName} / ${e.actorId}, ${e.outcome}, ${V(e.durationMs)}, starts +${V(t)}, ${we(n)}`,
603
+ "aria-label": `Inspect ${e.operation} request on ${e.actorName} / ${e.actorId}, ${e.outcome}, ${H(e.durationMs)}, starts +${H(t)}, ${we(n)}`,
565
604
  "aria-haspopup": "dialog",
566
- title: `${e.actorName} / ${e.actorId}\n${e.operation} · ${e.outcome}\nStart: ${new Date(e.startedAtMs).toLocaleString()} (+${V(t)})\nTotal: ${V(e.durationMs)}\nQueue wait: ${e.queueWaitMs === null ? "Did not begin processing" : V(e.queueWaitMs)}\n${we(n)}${n === null ? "" : " relative to preceding calls on this instance"}`,
605
+ title: `${e.actorName} / ${e.actorId}\n${e.operation} · ${e.outcome}\nStart: ${new Date(e.startedAtMs).toLocaleString()} (+${H(t)})\nTotal: ${H(e.durationMs)}\nQueue wait: ${e.queueWaitMs === null ? "Did not begin processing" : H(e.queueWaitMs)}\n${we(n)}${n === null ? "" : " relative to preceding calls on this instance"}`,
567
606
  onClick: (t) => a(e, t.currentTarget),
568
607
  children: l > 0 && /* @__PURE__ */ A("span", {
569
608
  className: "request-waterfall-queue",
@@ -600,10 +639,10 @@ var Le = I("la:inline-flex la:shrink-0 la:items-center la:justify-center la:gap-
600
639
  size: "default"
601
640
  }
602
641
  });
603
- function H({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
642
+ function U({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
604
643
  return /* @__PURE__ */ A(r ? F : "button", {
605
644
  "data-slot": "button",
606
- className: B(Le({
645
+ className: V(Le({
607
646
  variant: t,
608
647
  size: n,
609
648
  className: e
@@ -617,49 +656,49 @@ function Re({ className: e, classNames: t, showOutsideDays: n = !0, captionLayou
617
656
  let c = L();
618
657
  return /* @__PURE__ */ A(te, {
619
658
  showOutsideDays: n,
620
- className: B("la:group/calendar la:bg-background la:p-3 la:[--cell-size:--spacing(8)] la:[[data-slot=card-content]_&]:bg-transparent la:[[data-slot=popover-content]_&]:bg-transparent", e),
659
+ className: V("la:group/calendar la:bg-background la:p-3 la:[--cell-size:--spacing(8)] la:[[data-slot=card-content]_&]:bg-transparent la:[[data-slot=popover-content]_&]:bg-transparent", e),
621
660
  captionLayout: r,
622
661
  formatters: {
623
662
  formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
624
663
  ...a
625
664
  },
626
665
  classNames: {
627
- root: B("la:w-fit", c.root),
628
- months: B("la:relative la:flex la:flex-col la:gap-4 la:md:flex-row", c.months),
629
- month: B("la:flex la:w-full la:flex-col la:gap-4", c.month),
630
- nav: B("la:absolute la:inset-x-0 la:top-0 la:flex la:w-full la:items-center la:justify-between la:gap-1", c.nav),
631
- button_previous: B(Le({ variant: i }), "la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50", c.button_previous),
632
- button_next: B(Le({ variant: i }), "la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50", c.button_next),
633
- month_caption: B("la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:px-(--cell-size)", c.month_caption),
634
- dropdowns: B("la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:gap-1.5 la:text-sm la:font-medium", c.dropdowns),
635
- dropdown_root: B("la:relative la:rounded-md la:border la:border-input la:shadow-xs la:has-focus:border-ring la:has-focus:ring-[3px] la:has-focus:ring-ring/50", c.dropdown_root),
636
- dropdown: B("la:absolute la:inset-0 la:bg-popover la:opacity-0", c.dropdown),
637
- caption_label: B("la:font-medium la:select-none", r === "label" ? "la:text-sm" : "la:flex la:h-8 la:items-center la:gap-1 la:rounded-md la:pr-1 la:pl-2 la:text-sm la:[&>svg]:size-3.5 la:[&>svg]:text-muted-foreground", c.caption_label),
638
- month_grid: B("la:w-full la:border-collapse", c.month_grid),
639
- weekdays: B("la:flex", c.weekdays),
640
- weekday: B("la:flex-1 la:rounded-md la:text-[0.8rem] la:font-normal la:text-muted-foreground la:select-none", c.weekday),
641
- week: B("la:mt-2 la:flex la:w-full", c.week),
642
- week_number_header: B("la:w-(--cell-size) la:select-none", c.week_number_header),
643
- week_number: B("la:text-[0.8rem] la:text-muted-foreground la:select-none", c.week_number),
644
- day: B("la:group/day la:relative la:aspect-square la:h-full la:w-full la:p-0 la:text-center la:select-none la:[&:last-child[data-selected=true]_button]:rounded-r-md", s.showWeekNumber ? "la:[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "la:[&:first-child[data-selected=true]_button]:rounded-l-md", c.day),
645
- range_start: B("la:rounded-l-md la:bg-accent", c.range_start),
646
- range_middle: B("la:rounded-none", c.range_middle),
647
- range_end: B("la:rounded-r-md la:bg-accent", c.range_end),
648
- today: B("la:rounded-md la:bg-accent la:text-accent-foreground la:data-[selected=true]:rounded-none", c.today),
649
- outside: B("la:text-muted-foreground la:aria-selected:text-muted-foreground", c.outside),
650
- disabled: B("la:text-muted-foreground la:opacity-50", c.disabled),
651
- hidden: B("la:invisible", c.hidden),
666
+ root: V("la:w-fit", c.root),
667
+ months: V("la:relative la:flex la:flex-col la:gap-4 la:md:flex-row", c.months),
668
+ month: V("la:flex la:w-full la:flex-col la:gap-4", c.month),
669
+ nav: V("la:absolute la:inset-x-0 la:top-0 la:flex la:w-full la:items-center la:justify-between la:gap-1", c.nav),
670
+ button_previous: V(Le({ variant: i }), "la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50", c.button_previous),
671
+ button_next: V(Le({ variant: i }), "la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50", c.button_next),
672
+ month_caption: V("la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:px-(--cell-size)", c.month_caption),
673
+ dropdowns: V("la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:gap-1.5 la:text-sm la:font-medium", c.dropdowns),
674
+ dropdown_root: V("la:relative la:rounded-md la:border la:border-input la:shadow-xs la:has-focus:border-ring la:has-focus:ring-[3px] la:has-focus:ring-ring/50", c.dropdown_root),
675
+ dropdown: V("la:absolute la:inset-0 la:bg-popover la:opacity-0", c.dropdown),
676
+ caption_label: V("la:font-medium la:select-none", r === "label" ? "la:text-sm" : "la:flex la:h-8 la:items-center la:gap-1 la:rounded-md la:pr-1 la:pl-2 la:text-sm la:[&>svg]:size-3.5 la:[&>svg]:text-muted-foreground", c.caption_label),
677
+ month_grid: V("la:w-full la:border-collapse", c.month_grid),
678
+ weekdays: V("la:flex", c.weekdays),
679
+ weekday: V("la:flex-1 la:rounded-md la:text-[0.8rem] la:font-normal la:text-muted-foreground la:select-none", c.weekday),
680
+ week: V("la:mt-2 la:flex la:w-full", c.week),
681
+ week_number_header: V("la:w-(--cell-size) la:select-none", c.week_number_header),
682
+ week_number: V("la:text-[0.8rem] la:text-muted-foreground la:select-none", c.week_number),
683
+ day: V("la:group/day la:relative la:aspect-square la:h-full la:w-full la:p-0 la:text-center la:select-none la:[&:last-child[data-selected=true]_button]:rounded-r-md", s.showWeekNumber ? "la:[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "la:[&:first-child[data-selected=true]_button]:rounded-l-md", c.day),
684
+ range_start: V("la:rounded-l-md la:bg-accent", c.range_start),
685
+ range_middle: V("la:rounded-none", c.range_middle),
686
+ range_end: V("la:rounded-r-md la:bg-accent", c.range_end),
687
+ today: V("la:rounded-md la:bg-accent la:text-accent-foreground la:data-[selected=true]:rounded-none", c.today),
688
+ outside: V("la:text-muted-foreground la:aria-selected:text-muted-foreground", c.outside),
689
+ disabled: V("la:text-muted-foreground la:opacity-50", c.disabled),
690
+ hidden: V("la:invisible", c.hidden),
652
691
  ...t
653
692
  },
654
693
  components: {
655
694
  Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */ A("div", {
656
695
  "data-slot": "calendar",
657
696
  ref: t,
658
- className: B(e),
697
+ className: V(e),
659
698
  ...n
660
699
  }),
661
700
  Chevron: ({ className: e, orientation: t, ...n }) => A(t === "left" ? h : t === "right" ? g : m, {
662
- className: B("la:size-4", e),
701
+ className: V("la:size-4", e),
663
702
  ...n
664
703
  }),
665
704
  DayButton: ze,
@@ -679,7 +718,7 @@ function ze({ className: t, day: n, modifiers: r, ...i }) {
679
718
  let a = L(), o = e.useRef(null);
680
719
  return e.useEffect(() => {
681
720
  r.focused && o.current?.focus();
682
- }, [r.focused]), /* @__PURE__ */ A(H, {
721
+ }, [r.focused]), /* @__PURE__ */ A(U, {
683
722
  ref: o,
684
723
  variant: "ghost",
685
724
  size: "icon",
@@ -688,7 +727,7 @@ function ze({ className: t, day: n, modifiers: r, ...i }) {
688
727
  "data-range-start": r.range_start,
689
728
  "data-range-end": r.range_end,
690
729
  "data-range-middle": r.range_middle,
691
- className: B("la:flex la:aspect-square la:size-auto la:w-full la:min-w-(--cell-size) la:flex-col la:gap-1 la:leading-none la:font-normal la:group-data-[focused=true]/day:relative la:group-data-[focused=true]/day:z-10 la:group-data-[focused=true]/day:border-ring la:group-data-[focused=true]/day:ring-[3px] la:group-data-[focused=true]/day:ring-ring/50 la:data-[range-end=true]:rounded-md la:data-[range-end=true]:rounded-r-md la:data-[range-end=true]:bg-primary la:data-[range-end=true]:text-primary-foreground la:data-[range-middle=true]:rounded-none la:data-[range-middle=true]:bg-accent la:data-[range-middle=true]:text-accent-foreground la:data-[range-start=true]:rounded-md la:data-[range-start=true]:rounded-l-md la:data-[range-start=true]:bg-primary la:data-[range-start=true]:text-primary-foreground la:data-[selected-single=true]:bg-primary la:data-[selected-single=true]:text-primary-foreground la:dark:hover:text-accent-foreground la:[&>span]:text-xs la:[&>span]:opacity-70", a.day, t),
730
+ className: V("la:flex la:aspect-square la:size-auto la:w-full la:min-w-(--cell-size) la:flex-col la:gap-1 la:leading-none la:font-normal la:group-data-[focused=true]/day:relative la:group-data-[focused=true]/day:z-10 la:group-data-[focused=true]/day:border-ring la:group-data-[focused=true]/day:ring-[3px] la:group-data-[focused=true]/day:ring-ring/50 la:data-[range-end=true]:rounded-md la:data-[range-end=true]:rounded-r-md la:data-[range-end=true]:bg-primary la:data-[range-end=true]:text-primary-foreground la:data-[range-middle=true]:rounded-none la:data-[range-middle=true]:bg-accent la:data-[range-middle=true]:text-accent-foreground la:data-[range-start=true]:rounded-md la:data-[range-start=true]:rounded-l-md la:data-[range-start=true]:bg-primary la:data-[range-start=true]:text-primary-foreground la:data-[selected-single=true]:bg-primary la:data-[selected-single=true]:text-primary-foreground la:dark:hover:text-accent-foreground la:[&>span]:text-xs la:[&>span]:opacity-70", a.day, t),
692
731
  ...i
693
732
  });
694
733
  }
@@ -698,7 +737,7 @@ function Be({ className: e, type: t, ...n }) {
698
737
  return /* @__PURE__ */ A("input", {
699
738
  type: t,
700
739
  "data-slot": "input",
701
- className: B("la:flex la:h-9 la:w-full la:min-w-0 la:rounded-md la:border la:border-input la:bg-card la:px-3 la:py-1 la:text-sm la:text-foreground la:outline-none la:transition-colors la:placeholder:text-muted-foreground la:focus-visible:border-ring la:focus-visible:ring-2 la:focus-visible:ring-ring/20 la:disabled:cursor-not-allowed la:disabled:opacity-50 la:max-md:min-h-11", e),
740
+ className: V("la:flex la:h-9 la:w-full la:min-w-0 la:rounded-md la:border la:border-input la:bg-card la:px-3 la:py-1 la:text-sm la:text-foreground la:outline-none la:transition-colors la:placeholder:text-muted-foreground la:focus-visible:border-ring la:focus-visible:ring-2 la:focus-visible:ring-ring/20 la:disabled:cursor-not-allowed la:disabled:opacity-50 la:max-md:min-h-11", e),
702
741
  ...n
703
742
  });
704
743
  }
@@ -721,7 +760,7 @@ function Ue({ className: e, align: t = "center", sideOffset: n = 4, ...r }) {
721
760
  "data-slot": "popover-content",
722
761
  align: t,
723
762
  sideOffset: n,
724
- className: B("la:z-50 la:w-72 la:origin-(--radix-popover-content-transform-origin) la:rounded-md la:border la:bg-popover la:p-4 la:text-popover-foreground la:shadow-md la:outline-hidden", e),
763
+ className: V("la:z-50 la:w-72 la:origin-(--radix-popover-content-transform-origin) la:rounded-md la:border la:bg-popover la:p-4 la:text-popover-foreground la:shadow-md la:outline-hidden", e),
725
764
  ...r
726
765
  }) });
727
766
  }
@@ -734,21 +773,21 @@ function We({ ...e }) {
734
773
  function Ge({ className: e, ...t }) {
735
774
  return /* @__PURE__ */ A("div", {
736
775
  "data-slot": "popover-header",
737
- className: B("la:flex la:flex-col la:gap-1 la:text-sm", e),
776
+ className: V("la:flex la:flex-col la:gap-1 la:text-sm", e),
738
777
  ...t
739
778
  });
740
779
  }
741
780
  function Ke({ className: e, ...t }) {
742
781
  return /* @__PURE__ */ A("div", {
743
782
  "data-slot": "popover-title",
744
- className: B("la:font-medium", e),
783
+ className: V("la:font-medium", e),
745
784
  ...t
746
785
  });
747
786
  }
748
787
  function qe({ className: e, ...t }) {
749
788
  return /* @__PURE__ */ A("p", {
750
789
  "data-slot": "popover-description",
751
- className: B("la:text-muted-foreground", e),
790
+ className: V("la:text-muted-foreground", e),
752
791
  ...t
753
792
  });
754
793
  }
@@ -783,7 +822,7 @@ var Je = [
783
822
  kind: "relative",
784
823
  minutes: 60
785
824
  };
786
- function Xe(e, t) {
825
+ function W(e, t) {
787
826
  switch (e.kind) {
788
827
  case "relative": return { fromMs: Math.floor((t - e.minutes * 6e4) / 6e4) * 6e4 };
789
828
  case "absolute": return {
@@ -793,17 +832,17 @@ function Xe(e, t) {
793
832
  case "all": return {};
794
833
  }
795
834
  }
796
- function Ze(e) {
835
+ function Xe(e) {
797
836
  switch (e.kind) {
798
837
  case "relative": return Je.find((t) => t.minutes === e.minutes)?.label ?? `Last ${e.minutes} minutes`;
799
838
  case "absolute": return `${$e(e.fromMs, e.toMs)} – ${$e(e.toMs, e.fromMs)}`;
800
839
  case "all": return "All retained";
801
840
  }
802
841
  }
803
- function U(e) {
842
+ function Ze(e) {
804
843
  switch (e.kind) {
805
- case "relative": return `in the ${Ze(e).toLocaleLowerCase()}`;
806
- case "absolute": return `between ${Ze(e)}`;
844
+ case "relative": return `in the ${Xe(e).toLocaleLowerCase()}`;
845
+ case "absolute": return `between ${Xe(e)}`;
807
846
  case "all": return "in retained history";
808
847
  }
809
848
  }
@@ -834,16 +873,16 @@ function et({ value: e, onChange: t, allowAll: n = !0, className: r, align: i =
834
873
  },
835
874
  children: [/* @__PURE__ */ A(He, {
836
875
  asChild: !0,
837
- children: /* @__PURE__ */ j(H, {
876
+ children: /* @__PURE__ */ j(U, {
838
877
  type: "button",
839
878
  variant: "outline",
840
879
  className: r,
841
- "aria-label": `Time range: ${Ze(e)}`,
880
+ "aria-label": `Time range: ${Xe(e)}`,
842
881
  children: [
843
882
  /* @__PURE__ */ A(d, { "aria-hidden": "true" }),
844
883
  /* @__PURE__ */ A("span", {
845
884
  className: "la:truncate la:tabular-nums",
846
- children: Ze(e)
885
+ children: Xe(e)
847
886
  }),
848
887
  /* @__PURE__ */ A(p, {
849
888
  "aria-hidden": "true",
@@ -931,7 +970,7 @@ function et({ value: e, onChange: t, allowAll: n = !0, className: r, align: i =
931
970
  "aria-invalid": u || void 0
932
971
  })]
933
972
  }),
934
- /* @__PURE__ */ A(H, {
973
+ /* @__PURE__ */ A(U, {
935
974
  type: "submit",
936
975
  variant: "outline",
937
976
  size: "sm",
@@ -952,7 +991,7 @@ function et({ value: e, onChange: t, allowAll: n = !0, className: r, align: i =
952
991
  });
953
992
  }
954
993
  function tt({ label: e, selected: t, onSelect: n }) {
955
- return /* @__PURE__ */ A(H, {
994
+ return /* @__PURE__ */ A(U, {
956
995
  type: "button",
957
996
  variant: t ? "secondary" : "ghost",
958
997
  size: "sm",
@@ -963,7 +1002,7 @@ function tt({ label: e, selected: t, onSelect: n }) {
963
1002
  });
964
1003
  }
965
1004
  function nt(e) {
966
- let t = Date.now(), n = Xe(e, t), r = new Date(n.fromMs ?? t - 36e5), i = new Date(n.toMs ?? t);
1005
+ let t = Date.now(), n = W(e, t), r = new Date(n.fromMs ?? t - 36e5), i = new Date(n.toMs ?? t);
967
1006
  return {
968
1007
  dates: {
969
1008
  from: it(r),
@@ -1002,10 +1041,10 @@ var st = I("la:inline-flex la:items-center la:justify-center la:gap-1.5 la:round
1002
1041
  } },
1003
1042
  defaultVariants: { variant: "default" }
1004
1043
  });
1005
- function W({ className: e, variant: t, ...n }) {
1044
+ function G({ className: e, variant: t, ...n }) {
1006
1045
  return /* @__PURE__ */ A("span", {
1007
1046
  "data-slot": "badge",
1008
- className: B(st({ variant: t }), e),
1047
+ className: V(st({ variant: t }), e),
1009
1048
  ...n
1010
1049
  });
1011
1050
  }
@@ -1038,7 +1077,7 @@ function dt({ ...e }) {
1038
1077
  function ft({ className: e, ...t }) {
1039
1078
  return /* @__PURE__ */ A(z.Overlay, {
1040
1079
  "data-slot": "drawer-overlay",
1041
- className: B("la:fixed la:inset-0 la:z-50 la:bg-black/50 la:data-[state=closed]:animate-out la:data-[state=closed]:fade-out-0 la:data-[state=open]:animate-in la:data-[state=open]:fade-in-0", e),
1080
+ className: V("la:fixed la:inset-0 la:z-50 la:bg-black/50 la:data-[state=closed]:animate-out la:data-[state=closed]:fade-out-0 la:data-[state=open]:animate-in la:data-[state=open]:fade-in-0", e),
1042
1081
  ...t
1043
1082
  });
1044
1083
  }
@@ -1047,7 +1086,7 @@ function pt({ className: e, children: t, container: n, ...r }) {
1047
1086
  container: n,
1048
1087
  children: [/* @__PURE__ */ A(ft, {}), /* @__PURE__ */ j(z.Content, {
1049
1088
  "data-slot": "drawer-content",
1050
- className: B("la-observer la:group/drawer-content la:fixed la:z-50 la:flex la:h-auto la:flex-col la:bg-background", "la:data-[vaul-drawer-direction=top]:inset-x-0 la:data-[vaul-drawer-direction=top]:top-0 la:data-[vaul-drawer-direction=top]:mb-24 la:data-[vaul-drawer-direction=top]:max-h-[80vh] la:data-[vaul-drawer-direction=top]:rounded-b-lg la:data-[vaul-drawer-direction=top]:border-b", "la:data-[vaul-drawer-direction=bottom]:inset-x-0 la:data-[vaul-drawer-direction=bottom]:bottom-0 la:data-[vaul-drawer-direction=bottom]:mt-24 la:data-[vaul-drawer-direction=bottom]:max-h-[80vh] la:data-[vaul-drawer-direction=bottom]:rounded-t-lg la:data-[vaul-drawer-direction=bottom]:border-t", "la:data-[vaul-drawer-direction=right]:inset-y-0 la:data-[vaul-drawer-direction=right]:right-0 la:data-[vaul-drawer-direction=right]:w-3/4 la:data-[vaul-drawer-direction=right]:border-l la:data-[vaul-drawer-direction=right]:sm:max-w-sm", "la:data-[vaul-drawer-direction=left]:inset-y-0 la:data-[vaul-drawer-direction=left]:left-0 la:data-[vaul-drawer-direction=left]:w-3/4 la:data-[vaul-drawer-direction=left]:border-r la:data-[vaul-drawer-direction=left]:sm:max-w-sm", e),
1089
+ className: V("la-observer la:group/drawer-content la:fixed la:z-50 la:flex la:h-auto la:flex-col la:bg-background", "la:data-[vaul-drawer-direction=top]:inset-x-0 la:data-[vaul-drawer-direction=top]:top-0 la:data-[vaul-drawer-direction=top]:mb-24 la:data-[vaul-drawer-direction=top]:max-h-[80vh] la:data-[vaul-drawer-direction=top]:rounded-b-lg la:data-[vaul-drawer-direction=top]:border-b", "la:data-[vaul-drawer-direction=bottom]:inset-x-0 la:data-[vaul-drawer-direction=bottom]:bottom-0 la:data-[vaul-drawer-direction=bottom]:mt-24 la:data-[vaul-drawer-direction=bottom]:max-h-[80vh] la:data-[vaul-drawer-direction=bottom]:rounded-t-lg la:data-[vaul-drawer-direction=bottom]:border-t", "la:data-[vaul-drawer-direction=right]:inset-y-0 la:data-[vaul-drawer-direction=right]:right-0 la:data-[vaul-drawer-direction=right]:w-3/4 la:data-[vaul-drawer-direction=right]:border-l la:data-[vaul-drawer-direction=right]:sm:max-w-sm", "la:data-[vaul-drawer-direction=left]:inset-y-0 la:data-[vaul-drawer-direction=left]:left-0 la:data-[vaul-drawer-direction=left]:w-3/4 la:data-[vaul-drawer-direction=left]:border-r la:data-[vaul-drawer-direction=left]:sm:max-w-sm", e),
1051
1090
  ...r,
1052
1091
  children: [/* @__PURE__ */ A("div", { className: "la:mx-auto la:mt-4 la:hidden la:h-2 la:w-[100px] la:shrink-0 la:rounded-full la:bg-muted la:group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }), t]
1053
1092
  })]
@@ -1056,28 +1095,28 @@ function pt({ className: e, children: t, container: n, ...r }) {
1056
1095
  function mt({ className: e, ...t }) {
1057
1096
  return /* @__PURE__ */ A("div", {
1058
1097
  "data-slot": "drawer-header",
1059
- className: B("la:flex la:flex-col la:gap-0.5 la:p-4 la:group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center la:group-data-[vaul-drawer-direction=top]/drawer-content:text-center la:md:gap-1.5 la:md:text-left", e),
1098
+ className: V("la:flex la:flex-col la:gap-0.5 la:p-4 la:group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center la:group-data-[vaul-drawer-direction=top]/drawer-content:text-center la:md:gap-1.5 la:md:text-left", e),
1060
1099
  ...t
1061
1100
  });
1062
1101
  }
1063
1102
  function ht({ className: e, ...t }) {
1064
1103
  return /* @__PURE__ */ A("div", {
1065
1104
  "data-slot": "drawer-footer",
1066
- className: B("la:mt-auto la:flex la:flex-col la:gap-2 la:p-4", e),
1105
+ className: V("la:mt-auto la:flex la:flex-col la:gap-2 la:p-4", e),
1067
1106
  ...t
1068
1107
  });
1069
1108
  }
1070
1109
  function gt({ className: e, ...t }) {
1071
1110
  return /* @__PURE__ */ A(z.Title, {
1072
1111
  "data-slot": "drawer-title",
1073
- className: B("la:font-semibold la:text-foreground", e),
1112
+ className: V("la:font-semibold la:text-foreground", e),
1074
1113
  ...t
1075
1114
  });
1076
1115
  }
1077
1116
  function _t({ className: e, ...t }) {
1078
1117
  return /* @__PURE__ */ A(z.Description, {
1079
1118
  "data-slot": "drawer-description",
1080
- className: B("la:text-sm la:text-muted-foreground", e),
1119
+ className: V("la:text-sm la:text-muted-foreground", e),
1081
1120
  ...t
1082
1121
  });
1083
1122
  }
@@ -1090,7 +1129,7 @@ function vt({ className: e, size: t = "default", ...n }) {
1090
1129
  children: [/* @__PURE__ */ A("select", {
1091
1130
  "data-slot": "native-select",
1092
1131
  "data-size": t,
1093
- className: B("la:h-9 la:w-full la:min-w-0 la:appearance-none la:rounded-md la:border la:border-input la:bg-transparent la:px-3 la:py-2 la:pr-9 la:text-sm la:shadow-xs la:outline-none la:transition-[color,box-shadow] la:selection:bg-primary la:selection:text-primary-foreground la:disabled:pointer-events-none la:disabled:cursor-not-allowed la:data-[size=sm]:h-8 la:data-[size=sm]:py-1 la:focus-visible:border-ring la:focus-visible:ring-[3px] la:focus-visible:ring-ring/50 la:aria-invalid:border-destructive la:aria-invalid:ring-destructive/20 la:dark:bg-input/30 la:dark:hover:bg-input/50 la:dark:aria-invalid:ring-destructive/40", e),
1132
+ className: V("la:h-9 la:w-full la:min-w-0 la:appearance-none la:rounded-md la:border la:border-input la:bg-transparent la:px-3 la:py-2 la:pr-9 la:text-sm la:shadow-xs la:outline-none la:transition-[color,box-shadow] la:selection:bg-primary la:selection:text-primary-foreground la:disabled:pointer-events-none la:disabled:cursor-not-allowed la:data-[size=sm]:h-8 la:data-[size=sm]:py-1 la:focus-visible:border-ring la:focus-visible:ring-[3px] la:focus-visible:ring-ring/50 la:aria-invalid:border-destructive la:aria-invalid:ring-destructive/20 la:dark:bg-input/30 la:dark:hover:bg-input/50 la:dark:aria-invalid:ring-destructive/40", e),
1094
1133
  ...n
1095
1134
  }), /* @__PURE__ */ A(m, {
1096
1135
  className: "la:pointer-events-none la:absolute la:top-1/2 la:right-3.5 la:size-4 la:-translate-y-1/2 la:text-muted-foreground la:opacity-50 la:select-none",
@@ -1099,109 +1138,117 @@ function vt({ className: e, size: t = "default", ...n }) {
1099
1138
  })]
1100
1139
  });
1101
1140
  }
1102
- function G({ className: e, ...t }) {
1141
+ function K({ className: e, ...t }) {
1103
1142
  return /* @__PURE__ */ A("option", {
1104
1143
  "data-slot": "native-select-option",
1105
- className: B("la:bg-[Canvas] la:text-[CanvasText]", e),
1144
+ className: V("la:bg-[Canvas] la:text-[CanvasText]", e),
1106
1145
  ...t
1107
1146
  });
1108
1147
  }
1109
1148
  //#endregion
1110
1149
  //#region src/components/ui/table.tsx
1111
- function K({ className: e, containerProps: t, ...n }) {
1150
+ function q({ className: e, containerProps: t, ...n }) {
1112
1151
  return /* @__PURE__ */ A("div", {
1113
1152
  ...t,
1114
1153
  "data-slot": "table-container",
1115
- className: B("la:relative la:w-full la:overflow-x-auto", t?.className),
1154
+ className: V("la:relative la:w-full la:overflow-x-auto", t?.className),
1116
1155
  children: /* @__PURE__ */ A("table", {
1117
1156
  "data-slot": "table",
1118
- className: B("la:w-full la:caption-bottom la:text-sm la:tabular-nums", e),
1157
+ className: V("la:w-full la:caption-bottom la:text-sm la:tabular-nums", e),
1119
1158
  ...n
1120
1159
  })
1121
1160
  });
1122
1161
  }
1123
- function q({ className: e, ...t }) {
1162
+ function J({ className: e, ...t }) {
1124
1163
  return /* @__PURE__ */ A("thead", {
1125
1164
  "data-slot": "table-header",
1126
- className: B("la:[&_tr]:border-b", e),
1165
+ className: V("la:[&_tr]:border-b", e),
1127
1166
  ...t
1128
1167
  });
1129
1168
  }
1130
- function J({ className: e, ...t }) {
1169
+ function Y({ className: e, ...t }) {
1131
1170
  return /* @__PURE__ */ A("tbody", {
1132
1171
  "data-slot": "table-body",
1133
- className: B("la:[&_tr:last-child]:border-0", e),
1172
+ className: V("la:[&_tr:last-child]:border-0", e),
1134
1173
  ...t
1135
1174
  });
1136
1175
  }
1137
1176
  function yt({ className: e, ...t }) {
1138
1177
  return /* @__PURE__ */ A("tfoot", {
1139
1178
  "data-slot": "table-footer",
1140
- className: B("la:bg-muted/50 la:border-t la:font-medium la:[&>tr]:last:border-b-0", e),
1179
+ className: V("la:bg-muted/50 la:border-t la:font-medium la:[&>tr]:last:border-b-0", e),
1141
1180
  ...t
1142
1181
  });
1143
1182
  }
1144
- function Y({ className: e, ...t }) {
1183
+ function X({ className: e, ...t }) {
1145
1184
  return /* @__PURE__ */ A("tr", {
1146
1185
  "data-slot": "table-row",
1147
- className: B("la:border-b la:transition-colors la:duration-150 la:hover:bg-muted/60 la:data-[state=selected]:bg-muted", e),
1186
+ className: V("la:border-b la:transition-colors la:duration-150 la:hover:bg-muted/60 la:data-[state=selected]:bg-muted", e),
1148
1187
  ...t
1149
1188
  });
1150
1189
  }
1151
- function X({ className: e, ...t }) {
1190
+ function Z({ className: e, ...t }) {
1152
1191
  return /* @__PURE__ */ A("th", {
1153
1192
  "data-slot": "table-head",
1154
- className: B("la:h-10 la:whitespace-nowrap la:px-3 la:text-left la:align-middle la:text-xs la:font-medium la:text-muted-foreground la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]", e),
1193
+ className: V("la:h-10 la:whitespace-nowrap la:px-3 la:text-left la:align-middle la:text-xs la:font-medium la:text-muted-foreground la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]", e),
1155
1194
  ...t
1156
1195
  });
1157
1196
  }
1158
- function Z({ className: e, ...t }) {
1197
+ function Q({ className: e, ...t }) {
1159
1198
  return /* @__PURE__ */ A("td", {
1160
1199
  "data-slot": "table-cell",
1161
- className: B("la:whitespace-nowrap la:px-3 la:py-2.5 la:align-middle la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]", e),
1200
+ className: V("la:whitespace-nowrap la:px-3 la:py-2.5 la:align-middle la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]", e),
1162
1201
  ...t
1163
1202
  });
1164
1203
  }
1165
1204
  function bt({ className: e, ...t }) {
1166
1205
  return /* @__PURE__ */ A("caption", {
1167
1206
  "data-slot": "table-caption",
1168
- className: B("la:text-muted-foreground la:mt-4 la:text-sm", e),
1207
+ className: V("la:text-muted-foreground la:mt-4 la:text-sm", e),
1169
1208
  ...t
1170
1209
  });
1171
1210
  }
1172
1211
  //#endregion
1173
1212
  //#region src/observer-hooks.ts
1174
- function xt(e) {
1175
- let [n, r] = o(0), [i, a] = o(), [s, c] = o(!0), [l, u] = o(!1);
1213
+ function xt(e, n = !0) {
1214
+ let [r, i] = o(0), [a, s] = o(), [c, l] = o(!0), [u, d] = o(!1);
1176
1215
  return t(() => {
1177
- let t = new AbortController(), n, r = 1e3;
1178
- return u(!1), c(!0), o(), () => {
1179
- t.abort(), clearTimeout(n);
1216
+ if (!n || !e.listActors && !e.watchActors) {
1217
+ l(!1);
1218
+ return;
1219
+ }
1220
+ let t = new AbortController(), r, i = 1e3;
1221
+ return d(!1), l(!0), o(), () => {
1222
+ t.abort(), clearTimeout(r);
1180
1223
  };
1181
- function i(n) {
1182
- t.signal.aborted || (a({
1224
+ function a(n) {
1225
+ t.signal.aborted || (s({
1183
1226
  client: e,
1184
1227
  inventory: n,
1185
1228
  updatedAt: Date.now()
1186
- }), u(!1), c(!1), r = 1e3);
1229
+ }), d(!1), l(!1), i = 1e3);
1187
1230
  }
1188
1231
  async function o() {
1189
1232
  try {
1190
1233
  if (e.watchActors) {
1191
- if (await e.watchActors(i, t.signal), !t.signal.aborted) throw Error("Stream ended");
1192
- } else c(!0), i(await e.listActors(t.signal));
1234
+ if (await e.watchActors(a, t.signal), !t.signal.aborted) throw Error("Stream ended");
1235
+ } else l(!0), a(await e.listActors(t.signal));
1193
1236
  } catch {
1194
- t.signal.aborted || u(!0);
1237
+ t.signal.aborted || d(!0);
1195
1238
  } finally {
1196
- t.signal.aborted || (c(!1), n = setTimeout(o, e.watchActors ? r : 5e3), r = Math.min(r * 2, 1e4));
1239
+ t.signal.aborted || (l(!1), r = setTimeout(o, e.watchActors ? i : 5e3), i = Math.min(i * 2, 1e4));
1197
1240
  }
1198
1241
  }
1199
- }, [e, n]), {
1200
- updatedAt: i?.client === e ? i.updatedAt : void 0,
1201
- inventory: i?.client === e ? i.inventory : void 0,
1202
- loading: s,
1203
- failed: l,
1204
- retry: () => r((e) => e + 1)
1242
+ }, [
1243
+ e,
1244
+ r,
1245
+ n
1246
+ ]), {
1247
+ updatedAt: a?.client === e ? a.updatedAt : void 0,
1248
+ inventory: a?.client === e ? a.inventory : void 0,
1249
+ loading: c,
1250
+ failed: u,
1251
+ retry: () => i((e) => e + 1)
1205
1252
  };
1206
1253
  }
1207
1254
  function St(e, n = !0) {
@@ -1329,43 +1376,43 @@ function Tt(e, n) {
1329
1376
  }
1330
1377
  //#endregion
1331
1378
  //#region src/RequestObserver.tsx
1332
- function Et({ client: e, actor: n, timeRange: r, onTimeRangeChange: s, focus: c }) {
1333
- let [l, u] = o(), [d, p] = o(Ye), m = r ?? d, h = s ?? p, g = Tt(e, i(() => l ? {
1334
- ...l,
1379
+ function Et({ client: e, actor: n, inventory: r, timeRange: s, onTimeRangeChange: c, focus: l }) {
1380
+ let [u, d] = o(), [p, m] = o(Ye), h = s ?? p, g = c ?? m, _ = Tt(e, i(() => u ? {
1381
+ ...u,
1335
1382
  ...n,
1336
- ...l.requestId || l.connectionId ? {} : Xe(m, Date.now())
1383
+ ...u.requestId || u.connectionId ? {} : W(h, Date.now())
1337
1384
  } : void 0, [
1338
- l,
1385
+ u,
1339
1386
  n?.actorName,
1340
1387
  n?.actorId,
1341
- m
1342
- ])), { page: _, failed: v, retry: y } = St(e), [b, w] = o(), [T, E] = o(), [D, M] = o("waterfall"), N = a(null), P = a(null), F = n ? "h3" : "h1", I = l ? g.page : b ?? _, te = _ ?? g.page, L = (I?.records ?? []).filter((e) => !n || e.actorName === n.actorName && e.actorId === n.actorId);
1388
+ h
1389
+ ])), { page: v, failed: y, retry: b } = St(e), { inventory: w } = xt(e, !r), [T, E] = o(), [D, M] = o(), [N, P] = o("waterfall"), F = a(null), I = a(null), te = n ? "h3" : "h1", L = u ? _.page : T ?? v, R = v ?? _.page, z = (L?.records ?? []).filter((e) => !n || e.actorName === n.actorName && e.actorId === n.actorId), ne = Ce(r ?? w, [...(T ?? v)?.records ?? [], ...u ? z : []], n);
1343
1390
  return t(() => {
1344
- w(void 0), u(void 0);
1391
+ E(void 0), d(void 0);
1345
1392
  }, [
1346
1393
  e,
1347
1394
  n?.actorName,
1348
1395
  n?.actorId
1349
1396
  ]), t(() => {
1350
- c && u(c);
1351
- }, [c]), t(() => E(void 0), [
1397
+ l && d(l);
1398
+ }, [l]), t(() => M(void 0), [
1352
1399
  e,
1353
- _?.epoch,
1354
- l,
1400
+ v?.epoch,
1401
+ u,
1355
1402
  n?.actorName,
1356
1403
  n?.actorId
1357
1404
  ]), /* @__PURE__ */ j("section", {
1358
- ref: N,
1405
+ ref: F,
1359
1406
  className: "la-observer la-requests",
1360
1407
  "aria-label": "Request observer",
1361
1408
  children: [
1362
- (l?.requestId || l?.connectionId) && /* @__PURE__ */ j("p", { children: [
1409
+ (u?.requestId || u?.connectionId) && /* @__PURE__ */ j("p", { children: [
1363
1410
  "Showing ",
1364
- l.requestId ? `request ${l.requestId}` : `connection ${l?.connectionId}`,
1411
+ u.requestId ? `request ${u.requestId}` : `connection ${u?.connectionId}`,
1365
1412
  " ",
1366
- /* @__PURE__ */ A(H, {
1413
+ /* @__PURE__ */ A(U, {
1367
1414
  variant: "link",
1368
- onClick: () => u(void 0),
1415
+ onClick: () => d(void 0),
1369
1416
  children: "Clear filter"
1370
1417
  })
1371
1418
  ] }),
@@ -1373,7 +1420,7 @@ function Et({ client: e, actor: n, timeRange: r, onTimeRangeChange: s, focus: c
1373
1420
  className: "la-observer-toolbar",
1374
1421
  children: [/* @__PURE__ */ j("div", {
1375
1422
  className: n ? "la:sr-only" : void 0,
1376
- children: [/* @__PURE__ */ A(F, { children: "Requests" }), /* @__PURE__ */ A("p", { children: n ? "Method calls and WebSocket events for this instance." : "Method calls and WebSocket events, with time spent waiting and processing." })]
1423
+ children: [/* @__PURE__ */ A(te, { children: "Requests" }), /* @__PURE__ */ A("p", { children: n ? "Method calls and WebSocket events for this instance." : "Method calls and WebSocket events, with time spent waiting and processing." })]
1377
1424
  }), /* @__PURE__ */ j("div", {
1378
1425
  className: "la-request-actions",
1379
1426
  children: [
@@ -1381,153 +1428,154 @@ function Et({ client: e, actor: n, timeRange: r, onTimeRangeChange: s, focus: c
1381
1428
  className: "request-view-toggle",
1382
1429
  role: "group",
1383
1430
  "aria-label": "Request view",
1384
- children: [/* @__PURE__ */ j(H, {
1385
- variant: D === "waterfall" ? "secondary" : "ghost",
1386
- "aria-pressed": D === "waterfall",
1387
- onClick: () => M("waterfall"),
1431
+ children: [/* @__PURE__ */ j(U, {
1432
+ variant: N === "waterfall" ? "secondary" : "ghost",
1433
+ "aria-pressed": N === "waterfall",
1434
+ onClick: () => P("waterfall"),
1388
1435
  children: [/* @__PURE__ */ A(f, { "aria-hidden": "true" }), "Waterfall"]
1389
- }), /* @__PURE__ */ j(H, {
1390
- variant: D === "table" ? "secondary" : "ghost",
1391
- "aria-pressed": D === "table",
1392
- onClick: () => M("table"),
1436
+ }), /* @__PURE__ */ j(U, {
1437
+ variant: N === "table" ? "secondary" : "ghost",
1438
+ "aria-pressed": N === "table",
1439
+ onClick: () => P("table"),
1393
1440
  children: [/* @__PURE__ */ A(x, { "aria-hidden": "true" }), "Table"]
1394
1441
  })]
1395
1442
  }),
1396
- e.listRequests && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(H, {
1397
- variant: l ? "outline" : "secondary",
1398
- "aria-pressed": !l,
1443
+ e.listRequests && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(U, {
1444
+ variant: u ? "outline" : "secondary",
1445
+ "aria-pressed": !u,
1399
1446
  onClick: () => {
1400
- u(void 0), w(void 0);
1447
+ d(void 0), E(void 0);
1401
1448
  },
1402
1449
  children: "Live"
1403
- }), /* @__PURE__ */ A(H, {
1404
- variant: l ? "secondary" : "outline",
1405
- "aria-pressed": !!l,
1450
+ }), /* @__PURE__ */ A(U, {
1451
+ variant: u ? "secondary" : "outline",
1452
+ "aria-pressed": !!u,
1406
1453
  onClick: () => {
1407
- l || u({});
1454
+ u || d({});
1408
1455
  },
1409
1456
  children: "History"
1410
1457
  })] }),
1411
- !l && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ j(H, {
1458
+ !u && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ j(U, {
1412
1459
  variant: "outline",
1413
- disabled: !I,
1414
- onClick: () => w(b ? void 0 : _),
1415
- children: [A(b ? C : S, { "aria-hidden": "true" }), b ? "Resume" : "Pause"]
1416
- }), v && /* @__PURE__ */ j(H, {
1460
+ disabled: !L,
1461
+ onClick: () => E(T ? void 0 : v),
1462
+ children: [A(T ? C : S, { "aria-hidden": "true" }), T ? "Resume" : "Pause"]
1463
+ }), y && /* @__PURE__ */ j(U, {
1417
1464
  variant: "outline",
1418
- onClick: y,
1465
+ onClick: b,
1419
1466
  children: [/* @__PURE__ */ A(ee, { "aria-hidden": "true" }), "Retry"]
1420
1467
  })] })
1421
1468
  ]
1422
1469
  })]
1423
1470
  }),
1424
- l && /* @__PURE__ */ A(Dt, {
1425
- query: l,
1426
- range: m,
1427
- onRangeChange: h,
1428
- loading: g.loading,
1429
- onSearch: u,
1471
+ u && /* @__PURE__ */ A(Dt, {
1472
+ query: u,
1473
+ range: h,
1474
+ onRangeChange: g,
1475
+ loading: _.loading,
1476
+ onSearch: d,
1430
1477
  scoped: !!n
1431
1478
  }),
1432
- l && g.failed && /* @__PURE__ */ j("div", {
1479
+ u && _.failed && /* @__PURE__ */ j("div", {
1433
1480
  className: "la-observer-error",
1434
1481
  role: "alert",
1435
1482
  children: [
1436
1483
  "Request history unavailable.",
1437
1484
  " ",
1438
- /* @__PURE__ */ A(H, {
1485
+ /* @__PURE__ */ A(U, {
1439
1486
  variant: "outline",
1440
- onClick: g.retry,
1487
+ onClick: _.retry,
1441
1488
  children: "Retry history"
1442
1489
  })
1443
1490
  ]
1444
1491
  }),
1445
- !l && v && /* @__PURE__ */ j("div", {
1492
+ !u && y && /* @__PURE__ */ j("div", {
1446
1493
  className: "la-observer-error",
1447
1494
  role: "alert",
1448
- children: ["Request stream disconnected. Reconnecting… ", _ ? "Showing the last received requests." : "Check your connection and runtime version."]
1495
+ children: ["Request stream disconnected. Reconnecting… ", v ? "Showing the last received requests." : "Check your connection and runtime version."]
1449
1496
  }),
1450
- !!te?.dropped && /* @__PURE__ */ j("div", {
1497
+ !!R?.dropped && /* @__PURE__ */ j("div", {
1451
1498
  className: "la-observer-error",
1452
1499
  role: "alert",
1453
- children: [te.dropped.toLocaleString(), " request traces were not delivered. This history is incomplete."]
1500
+ children: [R.dropped.toLocaleString(), " request traces were not delivered. This history is incomplete."]
1454
1501
  }),
1455
- te?.persistenceFailed && /* @__PURE__ */ A("div", {
1502
+ R?.persistenceFailed && /* @__PURE__ */ A("div", {
1456
1503
  className: "la-observer-error",
1457
1504
  role: "alert",
1458
1505
  children: "Some request events could not be saved. This history may be incomplete."
1459
1506
  }),
1460
- I?.reset && /* @__PURE__ */ A("div", {
1507
+ L?.reset && /* @__PURE__ */ A("div", {
1461
1508
  className: "la-observer-error",
1462
1509
  role: "alert",
1463
1510
  children: "Some older events are no longer retained. Showing available history."
1464
1511
  }),
1465
- D === "waterfall" && L.length > 0 && /* @__PURE__ */ A(Me, {
1466
- records: L,
1467
- selected: T,
1512
+ N === "waterfall" && (z.length > 0 || ne.length > 0) && /* @__PURE__ */ A(Me, {
1513
+ records: z,
1514
+ lanes: ne,
1515
+ selected: D,
1468
1516
  onSelect: (e, t) => {
1469
- P.current = t, E(e);
1517
+ I.current = t, M(e);
1470
1518
  }
1471
1519
  }),
1472
1520
  /* @__PURE__ */ j("div", {
1473
- className: D === "table" || !L.length ? "la-observer-table-frame" : void 0,
1474
- children: [D === "table" && /* @__PURE__ */ j(K, {
1475
- "aria-label": l ? "Saved requests" : "Recent requests",
1521
+ className: N === "table" || !z.length ? "la-observer-table-frame" : void 0,
1522
+ children: [N === "table" && /* @__PURE__ */ j(q, {
1523
+ "aria-label": u ? "Saved requests" : "Recent requests",
1476
1524
  className: "la-request-table",
1477
- children: [/* @__PURE__ */ A(q, { children: /* @__PURE__ */ j(Y, { children: [
1478
- /* @__PURE__ */ A(X, {
1525
+ children: [/* @__PURE__ */ A(J, { children: /* @__PURE__ */ j(X, { children: [
1526
+ /* @__PURE__ */ A(Z, {
1479
1527
  scope: "col",
1480
1528
  children: "Time"
1481
1529
  }),
1482
- /* @__PURE__ */ A(X, {
1530
+ /* @__PURE__ */ A(Z, {
1483
1531
  scope: "col",
1484
1532
  children: "Request"
1485
1533
  }),
1486
- /* @__PURE__ */ A(X, {
1534
+ /* @__PURE__ */ A(Z, {
1487
1535
  scope: "col",
1488
1536
  children: "Instance"
1489
1537
  }),
1490
- /* @__PURE__ */ A(X, {
1538
+ /* @__PURE__ */ A(Z, {
1491
1539
  scope: "col",
1492
1540
  children: "Transport"
1493
1541
  }),
1494
- /* @__PURE__ */ A(X, {
1542
+ /* @__PURE__ */ A(Z, {
1495
1543
  scope: "col",
1496
1544
  children: "Outcome"
1497
1545
  }),
1498
- /* @__PURE__ */ A(X, {
1546
+ /* @__PURE__ */ A(Z, {
1499
1547
  scope: "col",
1500
1548
  children: "Total"
1501
1549
  }),
1502
- /* @__PURE__ */ A(X, {
1550
+ /* @__PURE__ */ A(Z, {
1503
1551
  scope: "col",
1504
1552
  children: "Queue wait"
1505
1553
  }),
1506
- /* @__PURE__ */ A(X, {
1554
+ /* @__PURE__ */ A(Z, {
1507
1555
  scope: "col",
1508
1556
  children: /* @__PURE__ */ A("span", {
1509
1557
  className: "la:sr-only",
1510
1558
  children: "Details"
1511
1559
  })
1512
1560
  })
1513
- ] }) }), /* @__PURE__ */ A(J, { children: L.map((e) => /* @__PURE__ */ j(Y, {
1561
+ ] }) }), /* @__PURE__ */ A(Y, { children: z.map((e) => /* @__PURE__ */ j(X, {
1514
1562
  className: "la-clickable-row",
1515
- "data-state": T === e ? "selected" : void 0,
1563
+ "data-state": D === e ? "selected" : void 0,
1516
1564
  onClick: (t) => {
1517
- P.current = t.currentTarget.querySelector("button"), E(e);
1565
+ I.current = t.currentTarget.querySelector("button"), M(e);
1518
1566
  },
1519
1567
  children: [
1520
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A("time", {
1568
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A("time", {
1521
1569
  dateTime: new Date(e.startedAtMs).toISOString(),
1522
1570
  title: new Date(e.startedAtMs).toLocaleString(),
1523
- children: l ? new Date(e.startedAtMs).toLocaleString([], { hour12: !1 }) : new Date(e.startedAtMs).toLocaleTimeString([], { hour12: !1 })
1571
+ children: u ? new Date(e.startedAtMs).toLocaleString([], { hour12: !1 }) : new Date(e.startedAtMs).toLocaleTimeString([], { hour12: !1 })
1524
1572
  }) }),
1525
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A("span", {
1573
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A("span", {
1526
1574
  className: "la-request-operation",
1527
1575
  title: e.operation,
1528
1576
  children: e.operation
1529
1577
  }) }),
1530
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ j("span", {
1578
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ j("span", {
1531
1579
  className: "la-request-actor",
1532
1580
  title: `${e.actorName} / ${e.actorId}`,
1533
1581
  children: [
@@ -1536,18 +1584,18 @@ function Et({ client: e, actor: n, timeRange: r, onTimeRangeChange: s, focus: c
1536
1584
  e.actorId
1537
1585
  ]
1538
1586
  }) }),
1539
- /* @__PURE__ */ A(Z, { children: e.kind === "method" ? "Method" : "WebSocket" }),
1540
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A(W, {
1587
+ /* @__PURE__ */ A(Q, { children: e.kind === "method" ? "Method" : "WebSocket" }),
1588
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A(G, {
1541
1589
  variant: "outline",
1542
1590
  className: `la-request-outcome-${e.outcome}`,
1543
1591
  children: e.outcome[0].toUpperCase() + e.outcome.slice(1)
1544
1592
  }) }),
1545
- /* @__PURE__ */ A(Z, { children: V(e.durationMs) }),
1546
- /* @__PURE__ */ A(Z, { children: e.queueWaitMs === null ? /* @__PURE__ */ A("span", {
1593
+ /* @__PURE__ */ A(Q, { children: H(e.durationMs) }),
1594
+ /* @__PURE__ */ A(Q, { children: e.queueWaitMs === null ? /* @__PURE__ */ A("span", {
1547
1595
  title: "Request did not begin processing",
1548
1596
  children: "—"
1549
- }) : V(e.queueWaitMs) }),
1550
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A(H, {
1597
+ }) : H(e.queueWaitMs) }),
1598
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A(U, {
1551
1599
  variant: "ghost",
1552
1600
  size: "sm",
1553
1601
  "aria-label": `Inspect ${e.operation} request`,
@@ -1555,47 +1603,36 @@ function Et({ client: e, actor: n, timeRange: r, onTimeRangeChange: s, focus: c
1555
1603
  children: "Details"
1556
1604
  }) })
1557
1605
  ]
1558
- }, e.eventId ?? `${I.epoch}-${e.sequence}`)) })]
1559
- }), !L.length && /* @__PURE__ */ j("div", {
1606
+ }, e.eventId ?? `${L.epoch}-${e.sequence}`)) })]
1607
+ }), !z.length && (N === "table" || !ne.length) && /* @__PURE__ */ j("div", {
1560
1608
  className: "la-request-empty",
1561
1609
  role: "status",
1562
- children: [/* @__PURE__ */ A("strong", { children: l ? g.loading ? "Loading history…" : g.failed ? "History unavailable" : "No saved requests in this range" : I ? "No requests yet" : v ? "Requests unavailable" : "Connecting to requests…" }), /* @__PURE__ */ A("p", { children: l ? "Try a wider time range or fewer filters. Local history retains the latest 10,000 events." : "Call an actor method or send a WebSocket message to see its timings." })]
1610
+ children: [/* @__PURE__ */ A("strong", { children: u ? _.loading ? "Loading history…" : _.failed ? "History unavailable" : "No saved requests in this range" : L ? "No requests yet" : y ? "Requests unavailable" : "Connecting to requests…" }), /* @__PURE__ */ A("p", { children: u ? "Try a wider time range or fewer filters. Local history retains the latest 10,000 events." : "Call an actor method or send a WebSocket message to see its timings." })]
1563
1611
  })]
1564
1612
  }),
1565
- l && I?.nextCursor && /* @__PURE__ */ A(H, {
1613
+ u && L?.nextCursor && /* @__PURE__ */ A(U, {
1566
1614
  className: "la-request-load-older",
1567
1615
  variant: "outline",
1568
- disabled: g.loading,
1569
- onClick: g.loadOlder,
1570
- children: g.loading ? "Loading…" : "Load older"
1571
- }),
1572
- /* @__PURE__ */ j("div", {
1573
- className: "la-observer-footnote",
1574
- children: [/* @__PURE__ */ j("span", {
1575
- className: "la-observer-refresh-status",
1576
- children: [!l && /* @__PURE__ */ A("span", { className: `la-observer-dot ${v ? "la-observer-dot-unknown" : "la-observer-dot-live"}` }), l ? "Saved history" : b ? "Display paused · collection continues" : v ? "Reconnecting…" : _ ? "Live updates" : "Connecting…"]
1577
- }), /* @__PURE__ */ A("span", { children: l ? `${L.length.toLocaleString()} saved requests shown` : n ? `${L.length} matching requests from the latest ${I?.capacity ?? 500} on this control plane.` : `Latest ${I?.capacity ?? 500} requests on this control plane.` })]
1578
- }),
1579
- !l && !!I?.evicted && /* @__PURE__ */ j("p", {
1580
- className: "la-request-note",
1581
- children: [I.evicted.toLocaleString(), " older records have left this history window."]
1616
+ disabled: _.loading,
1617
+ onClick: _.loadOlder,
1618
+ children: _.loading ? "Loading…" : "Load older"
1582
1619
  }),
1583
- /* @__PURE__ */ A("p", {
1620
+ !u && !!L?.evicted && /* @__PURE__ */ j("p", {
1584
1621
  className: "la-request-note",
1585
- children: "Total includes queue wait, actor processing, and persistence. Queue wait includes the WebSocket message queue. Timings exclude the caller’s network round trip."
1622
+ children: [L.evicted.toLocaleString(), " older records have left this history window."]
1586
1623
  }),
1587
1624
  /* @__PURE__ */ A(ct, {
1588
1625
  direction: "right",
1589
1626
  autoFocus: !0,
1590
- open: !!T,
1627
+ open: !!D,
1591
1628
  onOpenChange: (e) => {
1592
- e || E(void 0);
1629
+ e || M(void 0);
1593
1630
  },
1594
1631
  children: /* @__PURE__ */ j(pt, {
1595
- container: N.current,
1632
+ container: F.current,
1596
1633
  className: "la:data-[vaul-drawer-direction=right]:w-full la:data-[vaul-drawer-direction=right]:sm:max-w-[480px]",
1597
1634
  onCloseAutoFocus: (e) => {
1598
- e.preventDefault(), P.current?.focus();
1635
+ e.preventDefault(), I.current?.focus();
1599
1636
  },
1600
1637
  children: [/* @__PURE__ */ j(mt, {
1601
1638
  className: "la:relative la:shrink-0 la:gap-2 la:p-6 la:pr-16",
@@ -1604,7 +1641,7 @@ function Et({ client: e, actor: n, timeRange: r, onTimeRangeChange: s, focus: c
1604
1641
  /* @__PURE__ */ A(_t, { children: "Full identifiers and timings for this request." }),
1605
1642
  /* @__PURE__ */ A(dt, {
1606
1643
  asChild: !0,
1607
- children: /* @__PURE__ */ A(H, {
1644
+ children: /* @__PURE__ */ A(U, {
1608
1645
  className: "la:absolute la:top-4 la:right-4",
1609
1646
  variant: "ghost",
1610
1647
  size: "icon",
@@ -1615,9 +1652,9 @@ function Et({ client: e, actor: n, timeRange: r, onTimeRangeChange: s, focus: c
1615
1652
  ]
1616
1653
  }), /* @__PURE__ */ A("div", {
1617
1654
  className: "la:min-h-0 la:flex-1 la:overflow-y-auto la:px-6 la:pb-6",
1618
- children: T && /* @__PURE__ */ A(Ot, {
1619
- record: T,
1620
- timing: Se(L).calls.find((e) => e.record === T)
1655
+ children: D && /* @__PURE__ */ A(Ot, {
1656
+ record: D,
1657
+ timing: xe(z).calls.find((e) => e.record === D)
1621
1658
  })
1622
1659
  })]
1623
1660
  })
@@ -1669,7 +1706,7 @@ function Dt({ query: e, range: t, onRangeChange: r, loading: i, onSearch: a, sco
1669
1706
  className: "la-observer-select",
1670
1707
  name: "outcome",
1671
1708
  defaultValue: e.outcome ?? "",
1672
- children: [/* @__PURE__ */ A(G, {
1709
+ children: [/* @__PURE__ */ A(K, {
1673
1710
  value: "",
1674
1711
  children: "All outcomes"
1675
1712
  }), [
@@ -1678,13 +1715,13 @@ function Dt({ query: e, range: t, onRangeChange: r, loading: i, onSearch: a, sco
1678
1715
  "rejected",
1679
1716
  "rerouted",
1680
1717
  "interrupted"
1681
- ].map((e) => /* @__PURE__ */ A(G, {
1718
+ ].map((e) => /* @__PURE__ */ A(K, {
1682
1719
  value: e,
1683
1720
  children: e[0].toUpperCase() + e.slice(1)
1684
1721
  }, e))]
1685
1722
  })]
1686
1723
  }),
1687
- /* @__PURE__ */ A(H, {
1724
+ /* @__PURE__ */ A(U, {
1688
1725
  type: "submit",
1689
1726
  variant: "outline",
1690
1727
  disabled: i,
@@ -1706,10 +1743,10 @@ function Ot({ record: e, timing: t }) {
1706
1743
  cold: "Cold",
1707
1744
  warm: "Warm"
1708
1745
  }[e.hostState],
1709
- Total: V(e.durationMs),
1710
- "Queue wait": e.queueWaitMs === null ? "Did not begin processing" : V(e.queueWaitMs),
1746
+ Total: H(e.durationMs),
1747
+ "Queue wait": e.queueWaitMs === null ? "Did not begin processing" : H(e.queueWaitMs),
1711
1748
  ...t ? {
1712
- "Start offset in view": V(t.offsetMs),
1749
+ "Start offset in view": H(t.offsetMs),
1713
1750
  "Gap from preceding calls": we(t.gapMs)
1714
1751
  } : {},
1715
1752
  Host: e.hostId,
@@ -1721,15 +1758,319 @@ function Ot({ record: e, timing: t }) {
1721
1758
  });
1722
1759
  }
1723
1760
  //#endregion
1761
+ //#region src/InstanceTimeline.tsx
1762
+ var kt = 18, At = 8;
1763
+ function jt({ start: e, end: t, endLabel: n = "now", label: r, children: i, footer: a, overlay: o, onMouseLeave: s }) {
1764
+ let c = Ft(e, t), l = zt(e, t), u = Bt(c.span);
1765
+ return /* @__PURE__ */ j("div", {
1766
+ className: "socket-timeline",
1767
+ role: "group",
1768
+ "aria-label": r,
1769
+ onMouseLeave: s,
1770
+ children: [
1771
+ /* @__PURE__ */ j("div", {
1772
+ className: "socket-timeline-axis",
1773
+ "aria-hidden": "true",
1774
+ children: [/* @__PURE__ */ A("span", { children: "Instance" }), /* @__PURE__ */ j("div", { children: [l.map((e) => /* @__PURE__ */ A("span", {
1775
+ style: { left: c.position(e) },
1776
+ children: Vt(e, u)
1777
+ }, e)), /* @__PURE__ */ A("span", {
1778
+ className: "socket-timeline-now",
1779
+ children: n
1780
+ })] })]
1781
+ }),
1782
+ /* @__PURE__ */ j("div", {
1783
+ className: "socket-timeline-body",
1784
+ children: [
1785
+ /* @__PURE__ */ A("div", {
1786
+ className: "socket-timeline-grid",
1787
+ "aria-hidden": "true",
1788
+ children: l.map((e) => /* @__PURE__ */ A("i", { style: { left: c.position(e) } }, e))
1789
+ }),
1790
+ i(c),
1791
+ a
1792
+ ]
1793
+ }),
1794
+ o
1795
+ ]
1796
+ });
1797
+ }
1798
+ function Mt({ actorName: e, actorId: t, tracks: n = 1, children: r }) {
1799
+ return /* @__PURE__ */ j("div", {
1800
+ className: "socket-timeline-row",
1801
+ children: [/* @__PURE__ */ j("div", {
1802
+ className: "socket-timeline-label",
1803
+ title: e ? `${e} / ${t}` : t,
1804
+ children: [e && /* @__PURE__ */ A("span", { children: e }), /* @__PURE__ */ A("strong", { children: t })]
1805
+ }), /* @__PURE__ */ A("div", {
1806
+ className: "socket-timeline-lanes",
1807
+ style: { height: n * kt + 16 },
1808
+ children: r
1809
+ })]
1810
+ });
1811
+ }
1812
+ function Nt({ scale: e, from: t, to: n, track: r = 0, className: i = "", style: a, ...o }) {
1813
+ return /* @__PURE__ */ A("button", {
1814
+ ...o,
1815
+ type: "button",
1816
+ className: `socket-bar ${i}`,
1817
+ style: {
1818
+ ...e.interval(t, n),
1819
+ top: At + r * kt + 3,
1820
+ ...a
1821
+ }
1822
+ });
1823
+ }
1824
+ function Pt() {
1825
+ let [e, t] = o();
1826
+ return {
1827
+ hover: e,
1828
+ show: (e, n) => {
1829
+ let r = n.getBoundingClientRect(), i = n.closest(".socket-timeline").getBoundingClientRect(), a = r.top - i.top < 150;
1830
+ t({
1831
+ item: e,
1832
+ left: Math.min(Math.max(r.left - i.left + r.width / 2, 120), i.width - 120),
1833
+ top: a ? r.bottom - i.top : r.top - i.top,
1834
+ below: a
1835
+ });
1836
+ },
1837
+ hide: () => t(void 0)
1838
+ };
1839
+ }
1840
+ function Ft(e, t) {
1841
+ let n = Math.max(1, t - e), r = (r) => `${(Math.min(Math.max(r, e), t) - e) / n * 100}%`;
1842
+ return {
1843
+ span: n,
1844
+ position: r,
1845
+ interval: (i, a) => ({
1846
+ left: r(i),
1847
+ width: `${Math.max(0, Math.min(a, t) - Math.max(i, e)) / n * 100}%`
1848
+ })
1849
+ };
1850
+ }
1851
+ var $ = 6e4, It = 60 * $, Lt = 24 * It, Rt = [
1852
+ 1e3,
1853
+ 2e3,
1854
+ 5e3,
1855
+ 1e4,
1856
+ 15e3,
1857
+ 3e4,
1858
+ $,
1859
+ 2 * $,
1860
+ 5 * $,
1861
+ 10 * $,
1862
+ 15 * $,
1863
+ 30 * $,
1864
+ It,
1865
+ 2 * It,
1866
+ 3 * It,
1867
+ 6 * It,
1868
+ 12 * It,
1869
+ Lt,
1870
+ 2 * Lt,
1871
+ 7 * Lt
1872
+ ];
1873
+ function zt(e, t) {
1874
+ let n = Bt(Math.max(1, t - e)), r = [];
1875
+ for (let i = Math.floor(e / n) * n + n; i < t - n * .35; i += n) r.push(i);
1876
+ return r;
1877
+ }
1878
+ function Bt(e) {
1879
+ return Rt.find((t) => e / t <= 9) ?? Rt.at(-1);
1880
+ }
1881
+ function Vt(e, t) {
1882
+ let n = new Date(e);
1883
+ return t >= Lt ? n.toLocaleDateString([], {
1884
+ month: "short",
1885
+ day: "numeric"
1886
+ }) : t >= $ ? n.toLocaleTimeString([], {
1887
+ hour: "2-digit",
1888
+ minute: "2-digit",
1889
+ hour12: !1
1890
+ }) : n.toLocaleTimeString([], { hour12: !1 });
1891
+ }
1892
+ //#endregion
1893
+ //#region src/socket-sessions.ts
1894
+ function Ht(e) {
1895
+ if (!Array.isArray(e) || !e.every((e) => !!e && typeof e == "object" && Xt(e))) throw Error("Invalid WebSocket session response");
1896
+ return e;
1897
+ }
1898
+ function Ut(e, t, n) {
1899
+ return JSON.stringify([
1900
+ e,
1901
+ t,
1902
+ n
1903
+ ]);
1904
+ }
1905
+ function Wt(e, t, n = /* @__PURE__ */ new Map()) {
1906
+ let r = /* @__PURE__ */ new Map();
1907
+ for (let e of t?.actors ?? []) for (let t of e.instances) for (let n of t.connections) r.set(JSON.stringify([
1908
+ e.actorName,
1909
+ t.actorId,
1910
+ n.id
1911
+ ]), n.metadata);
1912
+ let i = e.map((e) => {
1913
+ let n = JSON.stringify([
1914
+ e.actorName,
1915
+ e.actorId,
1916
+ e.connectionId
1917
+ ]), i = e.closedAtMs === null ? r.has(n) ? "open" : t?.connectionsComplete === !1 ? "unknown" : "lost" : "closed";
1918
+ return i === "open" ? {
1919
+ ...e,
1920
+ status: i,
1921
+ metadata: r.get(n)
1922
+ } : {
1923
+ ...e,
1924
+ status: i
1925
+ };
1926
+ }), a = new Set(i.map((e) => JSON.stringify([
1927
+ e.actorName,
1928
+ e.actorId,
1929
+ e.connectionId
1930
+ ])));
1931
+ for (let e of t?.actors ?? []) for (let t of e.instances) for (let r of t.connections) {
1932
+ let o = Ut(e.actorName, t.actorId, r.id);
1933
+ if (a.has(o)) continue;
1934
+ let s = n.get(o);
1935
+ i.unshift({
1936
+ connectionId: r.id,
1937
+ actorName: e.actorName,
1938
+ actorId: t.actorId,
1939
+ hostId: null,
1940
+ openedAtMs: s ?? null,
1941
+ estimatedStart: s !== void 0,
1942
+ closedAtMs: null,
1943
+ lastSeenMs: null,
1944
+ messages: 0,
1945
+ failures: 0,
1946
+ status: "open",
1947
+ metadata: r.metadata
1948
+ });
1949
+ }
1950
+ return i;
1951
+ }
1952
+ function Gt(e, t) {
1953
+ if (e.openedAtMs === null) return null;
1954
+ let n = e.status === "closed" ? e.closedAtMs : e.status === "open" ? Math.max(t, e.openedAtMs) : e.lastSeenMs;
1955
+ return {
1956
+ ms: Math.max(0, n - e.openedAtMs),
1957
+ lowerBound: e.status === "lost" || e.status === "unknown"
1958
+ };
1959
+ }
1960
+ function Kt(e, t) {
1961
+ let n = e.map((e) => Gt(e, t)).filter((e) => e !== null && !e.lowerBound), r = e.reduce((e, t) => e + t.messages, 0);
1962
+ return {
1963
+ total: e.length,
1964
+ open: e.filter((e) => e.status === "open").length,
1965
+ lost: e.filter((e) => e.status === "lost").length,
1966
+ closed: e.filter((e) => e.status === "closed").length,
1967
+ median: Yt(n.map((e) => e.ms), .5),
1968
+ p95: Yt(n.map((e) => e.ms), .95),
1969
+ messages: r,
1970
+ messagesPerSession: e.length ? r / e.length : null
1971
+ };
1972
+ }
1973
+ function qt(e) {
1974
+ if (e < 1e3) return `${e.toLocaleString(void 0, { maximumFractionDigits: 0 })} ms`;
1975
+ if (e < 6e4) return `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 1 })} s`;
1976
+ let t = Math.floor(e / 6e4);
1977
+ if (t < 60) return `${t}m ${Math.floor(e % 6e4 / 1e3)}s`;
1978
+ let n = Math.floor(t / 60);
1979
+ return n < 24 ? `${n}h ${t % 60}m` : `${Math.floor(n / 24)}d ${n % 24}h`;
1980
+ }
1981
+ function Jt(e, t = 3) {
1982
+ if (e == null) return null;
1983
+ if (typeof e != "object") return String(e);
1984
+ let n = Array.isArray(e) ? e.map((e, t) => [String(t), e]) : Object.entries(e);
1985
+ if (!n.length) return null;
1986
+ let r = n.slice(0, t).map(([e, t]) => `${e}: ${typeof t == "string" ? t : JSON.stringify(t)}`);
1987
+ return n.length > t ? `${r.join(" · ")} · +${n.length - t}` : r.join(" · ");
1988
+ }
1989
+ function Yt(e, t) {
1990
+ return e.length ? e.sort((e, t) => e - t)[Math.max(0, Math.ceil(e.length * t) - 1)] : null;
1991
+ }
1992
+ function Xt(e) {
1993
+ return typeof e.connectionId == "string" && typeof e.actorName == "string" && typeof e.actorId == "string" && (e.hostId === null || typeof e.hostId == "string") && [
1994
+ e.openedAtMs,
1995
+ e.closedAtMs,
1996
+ e.lastSeenMs
1997
+ ].every((e) => e === null || Number.isSafeInteger(e) && Number(e) >= 0) && [e.messages, e.failures].every((e) => Number.isSafeInteger(e) && Number(e) >= 0) && (e.openedAtMs !== null || e.lastSeenMs !== null);
1998
+ }
1999
+ //#endregion
2000
+ //#region src/ResidencyTimeline.tsx
2001
+ function Zt({ instances: e, periods: t, start: n, end: r, endLabel: i = "now", onSelect: a }) {
2002
+ let { hover: o, show: s, hide: c } = Pt(), l = /* @__PURE__ */ new Map();
2003
+ for (let e of t) {
2004
+ if (e.toMs <= n || e.fromMs >= r) continue;
2005
+ let t = l.get(e.actorId) ?? [];
2006
+ t.push(e), l.set(e.actorId, t);
2007
+ }
2008
+ return /* @__PURE__ */ j("div", {
2009
+ className: "overview-panel socket-timeline-panel residency-history",
2010
+ children: [/* @__PURE__ */ j("div", {
2011
+ className: "socket-panel-heading",
2012
+ children: [/* @__PURE__ */ A("h3", { children: "Residency over time" }), /* @__PURE__ */ j("ul", {
2013
+ className: "socket-legend",
2014
+ "aria-label": "Residency legend",
2015
+ children: [
2016
+ /* @__PURE__ */ j("li", { children: [/* @__PURE__ */ A("span", { className: "socket-swatch residency-swatch-live" }), "In memory"] }),
2017
+ /* @__PURE__ */ j("li", { children: [/* @__PURE__ */ A("span", { className: "socket-swatch residency-swatch-dormant" }), "Dormant"] }),
2018
+ /* @__PURE__ */ j("li", { children: [/* @__PURE__ */ A("span", { className: "socket-swatch residency-swatch-unknown" }), "Unknown"] })
2019
+ ]
2020
+ })]
2021
+ }), /* @__PURE__ */ A(jt, {
2022
+ start: n,
2023
+ end: r,
2024
+ endLabel: i,
2025
+ label: "Instance residency timeline",
2026
+ onMouseLeave: c,
2027
+ overlay: o && /* @__PURE__ */ j("div", {
2028
+ role: "tooltip",
2029
+ className: `socket-tooltip${o.below ? " socket-tooltip-below" : ""}`,
2030
+ style: {
2031
+ left: o.left,
2032
+ top: o.top
2033
+ },
2034
+ children: [
2035
+ o.item.actorId,
2036
+ " · ",
2037
+ Qt(o.item)
2038
+ ]
2039
+ }),
2040
+ children: (t) => e.map((e) => /* @__PURE__ */ A(Mt, {
2041
+ actorId: e.actorId,
2042
+ children: l.get(e.actorId)?.length ? l.get(e.actorId).map((n) => /* @__PURE__ */ A(Nt, {
2043
+ scale: t,
2044
+ from: n.fromMs,
2045
+ to: n.toMs,
2046
+ className: `residency-swatch-${n.status}`,
2047
+ "aria-label": `${e.actorId}: ${Qt(n)}`,
2048
+ onClick: () => a(e.actorId),
2049
+ onMouseEnter: (e) => s(n, e.currentTarget),
2050
+ onMouseLeave: c,
2051
+ onFocus: (e) => s(n, e.currentTarget),
2052
+ onBlur: c
2053
+ }, `${n.fromMs}-${n.status}`)) : /* @__PURE__ */ A("span", {
2054
+ className: "residency-no-history",
2055
+ children: "No retained residency"
2056
+ })
2057
+ }, e.actorId))
2058
+ })]
2059
+ });
2060
+ }
2061
+ function Qt(e) {
2062
+ return `${e.status === "live" ? "In memory" : e.status === "dormant" ? "Dormant" : "Unknown"} · ${new Date(e.fromMs).toLocaleString()} – ${new Date(e.toMs).toLocaleString()} · ${qt(e.toMs - e.fromMs)}`;
2063
+ }
2064
+ //#endregion
1724
2065
  //#region src/state-diff.ts
1725
- var kt = re({ arrays: { detectMove: !1 } });
1726
- function At(e, t) {
1727
- let n = kt.diff(e, t);
2066
+ var $t = re({ arrays: { detectMove: !1 } });
2067
+ function en(e, t) {
2068
+ let n = $t.diff(e, t);
1728
2069
  return n ? ie(n, e) ?? "" : "";
1729
2070
  }
1730
2071
  //#endregion
1731
2072
  //#region src/state-inspection.ts
1732
- function jt(e, n, r) {
2073
+ function tn(e, n, r) {
1733
2074
  let [i, s] = o(), [c, l] = o(), [u, d] = o(!1), [f, p] = o(!0), [m, h] = o(0), g = a(() => {});
1734
2075
  return t(() => {
1735
2076
  let t = new AbortController(), i = !1, a = !1, o, c;
@@ -1792,8 +2133,8 @@ function jt(e, n, r) {
1792
2133
  }
1793
2134
  //#endregion
1794
2135
  //#region src/StateInspector.tsx
1795
- function Mt(e) {
1796
- let { client: t, actorName: n, actorId: r } = e, i = jt(t, n, r), [a, s] = o("state"), [c, l] = o(), [u, d] = o(), [f, p] = o(""), [m, h] = o(0), g = i.current?.snapshot, _ = g?.stateVersion ?? 0, y = c ?? _, b = i.knownVersion > _ || _ > (i.history?.records[0]?.stateVersion ?? 0);
2136
+ function nn(e) {
2137
+ let { client: t, actorName: n, actorId: r } = e, i = tn(t, n, r), [a, s] = o("state"), [c, l] = o(), [u, d] = o(), [f, p] = o(""), [m, h] = o(0), g = i.current?.snapshot, _ = g?.stateVersion ?? 0, y = c ?? _, b = i.knownVersion > _ || _ > (i.history?.records[0]?.stateVersion ?? 0);
1797
2138
  return /* @__PURE__ */ j("section", {
1798
2139
  className: "la-state",
1799
2140
  "aria-label": "Persisted state",
@@ -1802,12 +2143,12 @@ function Mt(e) {
1802
2143
  className: "la-state-heading",
1803
2144
  children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("h3", { children: "Persisted state" }), /* @__PURE__ */ A("p", { children: "Committed fields and their progression in storage." })] }), /* @__PURE__ */ j("div", {
1804
2145
  className: "la-state-actions",
1805
- children: [g && /* @__PURE__ */ j(H, {
2146
+ children: [g && /* @__PURE__ */ j(U, {
1806
2147
  variant: "outline",
1807
2148
  size: "sm",
1808
- onClick: () => Lt(g.state, `${n}-${r}-v${_}.json`),
2149
+ onClick: () => cn(g.state, `${n}-${r}-v${_}.json`),
1809
2150
  children: [/* @__PURE__ */ A(v, { "aria-hidden": "true" }), "Download JSON"]
1810
- }), /* @__PURE__ */ j(H, {
2151
+ }), /* @__PURE__ */ j(U, {
1811
2152
  variant: "outline",
1812
2153
  size: "sm",
1813
2154
  disabled: i.loading,
@@ -1823,13 +2164,13 @@ function Mt(e) {
1823
2164
  className: "la-state-tabs",
1824
2165
  "aria-label": "State views",
1825
2166
  children: [
1826
- /* @__PURE__ */ A(H, {
2167
+ /* @__PURE__ */ A(U, {
1827
2168
  variant: a === "state" ? "secondary" : "ghost",
1828
2169
  "aria-pressed": a === "state",
1829
2170
  onClick: () => s("state"),
1830
2171
  children: "State"
1831
2172
  }),
1832
- /* @__PURE__ */ A(H, {
2173
+ /* @__PURE__ */ A(U, {
1833
2174
  variant: a === "changes" ? "secondary" : "ghost",
1834
2175
  "aria-pressed": a === "changes",
1835
2176
  onClick: () => s("changes"),
@@ -1859,7 +2200,7 @@ function Mt(e) {
1859
2200
  children: "No persisted state yet. Fields appear after the actor commits its first change."
1860
2201
  }),
1861
2202
  a === "state" && g && /* @__PURE__ */ j(k, { children: [
1862
- /* @__PURE__ */ A(Ft, {
2203
+ /* @__PURE__ */ A(on, {
1863
2204
  record: g,
1864
2205
  onInspect: e.onInspectRequest
1865
2206
  }),
@@ -1869,7 +2210,7 @@ function Mt(e) {
1869
2210
  value: f,
1870
2211
  onChange: (e) => p(e.target.value)
1871
2212
  }),
1872
- /* @__PURE__ */ A(Nt, {
2213
+ /* @__PURE__ */ A(rn, {
1873
2214
  state: g.state,
1874
2215
  query: f,
1875
2216
  schema: i.current?.schema ?? null
@@ -1895,7 +2236,7 @@ function Mt(e) {
1895
2236
  /* @__PURE__ */ A("span", { children: e.attribution?.operation ?? "Unknown operation" })
1896
2237
  ] }), /* @__PURE__ */ A("small", { children: e.attribution ? new Date(e.attribution.committedAtMs).toLocaleTimeString() : "Time unavailable" })]
1897
2238
  }) }, e.stateVersion)) }),
1898
- i.history?.nextBefore && /* @__PURE__ */ A(H, {
2239
+ i.history?.nextBefore && /* @__PURE__ */ A(U, {
1899
2240
  variant: "outline",
1900
2241
  size: "sm",
1901
2242
  disabled: i.loading,
@@ -1905,7 +2246,7 @@ function Mt(e) {
1905
2246
  ]
1906
2247
  }), /* @__PURE__ */ j("div", {
1907
2248
  className: "la-state-comparison",
1908
- children: [c !== void 0 && _ > c && /* @__PURE__ */ j(H, {
2249
+ children: [c !== void 0 && _ > c && /* @__PURE__ */ j(U, {
1909
2250
  variant: "outline",
1910
2251
  size: "sm",
1911
2252
  onClick: () => {
@@ -1918,15 +2259,15 @@ function Mt(e) {
1918
2259
  "aria-label": "Compare with version",
1919
2260
  value: u ?? Math.max(0, y - 1),
1920
2261
  onChange: (e) => d(Number(e.target.value)),
1921
- children: [/* @__PURE__ */ A(G, {
2262
+ children: [/* @__PURE__ */ A(K, {
1922
2263
  value: Math.max(0, y - 1),
1923
2264
  children: y === 1 ? "Before first commit" : `Previous · version ${y - 1}`
1924
- }), i.history?.records.filter((e) => e.stateVersion < y - 1).map((e) => /* @__PURE__ */ j(G, {
2265
+ }), i.history?.records.filter((e) => e.stateVersion < y - 1).map((e) => /* @__PURE__ */ j(K, {
1925
2266
  value: e.stateVersion,
1926
2267
  children: ["Version ", e.stateVersion]
1927
2268
  }, e.stateVersion))]
1928
2269
  })]
1929
- }), /* @__PURE__ */ A(It, {
2270
+ }), /* @__PURE__ */ A(sn, {
1930
2271
  ...e,
1931
2272
  version: y,
1932
2273
  baseline: u ?? Math.max(0, y - 1)
@@ -1940,26 +2281,26 @@ function Mt(e) {
1940
2281
  ]
1941
2282
  });
1942
2283
  }
1943
- function Nt({ state: e, query: t, schema: n }) {
2284
+ function rn({ state: e, query: t, schema: n }) {
1944
2285
  let r = Object.entries(e).filter(([e]) => e.toLowerCase().includes(t.toLowerCase()));
1945
2286
  return /* @__PURE__ */ j("div", {
1946
2287
  className: "la-observer-table-frame",
1947
- children: [/* @__PURE__ */ j(K, {
2288
+ children: [/* @__PURE__ */ j(q, {
1948
2289
  "aria-label": "Persisted fields",
1949
- children: [/* @__PURE__ */ A(q, { children: /* @__PURE__ */ j(Y, { children: [
1950
- /* @__PURE__ */ A(X, { children: "Field" }),
1951
- /* @__PURE__ */ A(X, { children: "Type" }),
1952
- /* @__PURE__ */ A(X, { children: "Value" })
1953
- ] }) }), /* @__PURE__ */ A(J, { children: r.map(([e, t]) => /* @__PURE__ */ j(Y, { children: [
1954
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A("code", { children: e }) }),
1955
- /* @__PURE__ */ j(Z, { children: [/* @__PURE__ */ A("span", {
2290
+ children: [/* @__PURE__ */ A(J, { children: /* @__PURE__ */ j(X, { children: [
2291
+ /* @__PURE__ */ A(Z, { children: "Field" }),
2292
+ /* @__PURE__ */ A(Z, { children: "Type" }),
2293
+ /* @__PURE__ */ A(Z, { children: "Value" })
2294
+ ] }) }), /* @__PURE__ */ A(Y, { children: r.map(([e, t]) => /* @__PURE__ */ j(X, { children: [
2295
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A("code", { children: e }) }),
2296
+ /* @__PURE__ */ j(Q, { children: [/* @__PURE__ */ A("span", {
1956
2297
  className: "la-state-type",
1957
- children: Rt(t)
1958
- }), zt(n, e) && /* @__PURE__ */ A("small", {
2298
+ children: ln(t)
2299
+ }), un(n, e) && /* @__PURE__ */ A("small", {
1959
2300
  className: "la-state-schema",
1960
- children: zt(n, e)
2301
+ children: un(n, e)
1961
2302
  })] }),
1962
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A(Pt, { value: t }) })
2303
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A(an, { value: t }) })
1963
2304
  ] }, e)) })]
1964
2305
  }), !r.length && /* @__PURE__ */ A("p", {
1965
2306
  className: "la-state-empty",
@@ -1967,7 +2308,7 @@ function Nt({ state: e, query: t, schema: n }) {
1967
2308
  })]
1968
2309
  });
1969
2310
  }
1970
- function Pt({ value: e }) {
2311
+ function an({ value: e }) {
1971
2312
  let t = JSON.stringify(e);
1972
2313
  return t.length > 1e5 ? /* @__PURE__ */ j("span", { children: [
1973
2314
  "Large value (",
@@ -1976,13 +2317,13 @@ function Pt({ value: e }) {
1976
2317
  ] }) : typeof e == "object" && e ? /* @__PURE__ */ A(ne, {
1977
2318
  data: e,
1978
2319
  shouldExpandNode: (e) => e < 1,
1979
- style: Bt
2320
+ style: dn
1980
2321
  }) : /* @__PURE__ */ A("code", {
1981
- className: `la-state-json-${Rt(e)}`,
2322
+ className: `la-state-json-${ln(e)}`,
1982
2323
  children: t
1983
2324
  });
1984
2325
  }
1985
- function Ft({ record: e, onInspect: t }) {
2326
+ function on({ record: e, onInspect: t }) {
1986
2327
  let n = e.attribution;
1987
2328
  return /* @__PURE__ */ j("div", {
1988
2329
  className: "la-state-attribution",
@@ -2014,7 +2355,7 @@ function Ft({ record: e, onInspect: t }) {
2014
2355
  ]
2015
2356
  });
2016
2357
  }
2017
- function It({ client: e, actorName: n, actorId: r, version: i, baseline: a, onInspectRequest: s }) {
2358
+ function sn({ client: e, actorName: n, actorId: r, version: i, baseline: a, onInspectRequest: s }) {
2018
2359
  let [c, l] = o(), [u, d] = o(), [f, p] = o();
2019
2360
  return t(() => {
2020
2361
  let t = new AbortController(), o;
@@ -2047,7 +2388,7 @@ function It({ client: e, actorName: n, actorId: r, version: i, baseline: a, onIn
2047
2388
  after: u.state
2048
2389
  })) : l({
2049
2390
  after: u,
2050
- html: At(c.snapshot.state, u.state)
2391
+ html: en(c.snapshot.state, u.state)
2051
2392
  });
2052
2393
  } catch (e) {
2053
2394
  t.signal.aborted || d(e instanceof Error ? e.message : "Could not load versions.");
@@ -2072,13 +2413,13 @@ function It({ client: e, actorName: n, actorId: r, version: i, baseline: a, onIn
2072
2413
  role: "status",
2073
2414
  children: "Loading comparison…"
2074
2415
  }),
2075
- f && /* @__PURE__ */ j(H, {
2416
+ f && /* @__PURE__ */ j(U, {
2076
2417
  variant: "ghost",
2077
2418
  size: "sm",
2078
- onClick: () => Lt(f.state, `${n}-${r}-v${i}.json`),
2419
+ onClick: () => cn(f.state, `${n}-${r}-v${i}.json`),
2079
2420
  children: ["Download version ", i]
2080
2421
  }),
2081
- c && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(Ft, {
2422
+ c && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(on, {
2082
2423
  record: c.after,
2083
2424
  onInspect: s
2084
2425
  }), c.html ? /* @__PURE__ */ A("div", {
@@ -2088,18 +2429,18 @@ function It({ client: e, actorName: n, actorId: r, version: i, baseline: a, onIn
2088
2429
  }) : /* @__PURE__ */ A("p", { children: "No persisted fields changed between these versions." })] })
2089
2430
  ] });
2090
2431
  }
2091
- function Lt(e, t) {
2432
+ function cn(e, t) {
2092
2433
  let n = URL.createObjectURL(new Blob([JSON.stringify(e, null, 2)], { type: "application/json" })), r = document.createElement("a");
2093
2434
  r.href = n, r.download = t, r.click(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
2094
2435
  }
2095
- function Rt(e) {
2436
+ function ln(e) {
2096
2437
  return e === null ? "null" : Array.isArray(e) ? "array" : typeof e;
2097
2438
  }
2098
- function zt(e, t) {
2439
+ function un(e, t) {
2099
2440
  let n = e?.definitions, r = n?.State?.properties?.[t]?.$ref, i = r && n?.[r.split("/").pop().replace(/~1/g, "/").replace(/~0/g, "~")]?.type;
2100
2441
  return i ? `Schema: ${Array.isArray(i) ? i.join(" | ") : i}` : void 0;
2101
2442
  }
2102
- var Bt = {
2443
+ var dn = {
2103
2444
  container: "la-state-json",
2104
2445
  basicChildStyle: "la-state-json-child",
2105
2446
  label: "la-state-json-label",
@@ -2118,7 +2459,7 @@ var Bt = {
2118
2459
  };
2119
2460
  //#endregion
2120
2461
  //#region src/queue-wait-history.ts
2121
- function Vt(e, t, n) {
2462
+ function fn(e, t, n) {
2122
2463
  let r = wt(e, {
2123
2464
  ...t,
2124
2465
  actorName: n
@@ -2131,26 +2472,26 @@ function Vt(e, t, n) {
2131
2472
  }
2132
2473
  //#endregion
2133
2474
  //#region src/queue-wait.ts
2134
- function Ht(e) {
2135
- if (!Array.isArray(e) || !e.every(Ut)) throw Error("Invalid queue wait response");
2475
+ function pn(e) {
2476
+ if (!Array.isArray(e) || !e.every(mn)) throw Error("Invalid queue wait response");
2136
2477
  return e;
2137
2478
  }
2138
- function Ut(e) {
2479
+ function mn(e) {
2139
2480
  return !!e && typeof e.actorName == "string" && typeof e.actorId == "string" && Number.isSafeInteger(e.admitted) && e.admitted > 0 && [e.averageMs, e.maxMs].every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0) && e.averageMs <= e.maxMs;
2140
2481
  }
2141
- function Wt(e) {
2142
- return Jt(e, () => "all").get("all") ?? null;
2482
+ function hn(e) {
2483
+ return yn(e, () => "all").get("all") ?? null;
2143
2484
  }
2144
- function Gt(e) {
2145
- return Jt(e, (e) => e.actorName);
2485
+ function gn(e) {
2486
+ return yn(e, (e) => e.actorName);
2146
2487
  }
2147
- function Kt(e, t) {
2148
- return Jt(e.filter((e) => e.actorName === t), (e) => e.actorId);
2488
+ function _n(e, t) {
2489
+ return yn(e.filter((e) => e.actorName === t), (e) => e.actorId);
2149
2490
  }
2150
- function qt(e) {
2491
+ function vn(e) {
2151
2492
  return e === void 0 ? "—" : e >= 1e3 ? `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 2 })} s` : `${e.toLocaleString(void 0, { maximumFractionDigits: 1 })} ms`;
2152
2493
  }
2153
- function Jt(e, t) {
2494
+ function yn(e, t) {
2154
2495
  let n = /* @__PURE__ */ new Map();
2155
2496
  for (let r of e) {
2156
2497
  let e = n.get(t(r)) ?? {
@@ -2167,9 +2508,33 @@ function Jt(e, t) {
2167
2508
  return n;
2168
2509
  }
2169
2510
  //#endregion
2511
+ //#region src/residency.ts
2512
+ function bn(e) {
2513
+ return [...e].sort((e, t) => (t.lastActiveAtMs ?? -1) - (e.lastActiveAtMs ?? -1) || e.actorId.localeCompare(t.actorId));
2514
+ }
2515
+ function xn(e) {
2516
+ if (!e || typeof e != "object" || !("truncated" in e) || typeof e.truncated != "boolean" || !("periods" in e) || !Array.isArray(e.periods)) throw Error("Invalid residency history response.");
2517
+ for (let t of e.periods) if (!t || typeof t.actorId != "string" || ![
2518
+ "live",
2519
+ "dormant",
2520
+ "unknown"
2521
+ ].includes(t.status) || !Number.isSafeInteger(t.fromMs) || !Number.isSafeInteger(t.toMs) || t.fromMs < 0 || t.fromMs >= t.toMs) throw Error("Invalid residency period.");
2522
+ return e;
2523
+ }
2524
+ function Sn(e, t) {
2525
+ if (e == null) return "Unknown";
2526
+ let n = Math.max(0, Math.floor((t - e) / 1e3));
2527
+ if (n < 5) return "Just now";
2528
+ if (n < 60) return `${n}s ago`;
2529
+ let r = Math.floor(n / 60);
2530
+ if (r < 60) return `${r}m ago`;
2531
+ let i = Math.floor(r / 60);
2532
+ return i < 24 ? `${i}h ago` : `${Math.floor(i / 24)}d ago`;
2533
+ }
2534
+ //#endregion
2170
2535
  //#region src/ActorObserver.tsx
2171
- function Yt({ client: e, className: r = "", initialActorName: i, navigation: s, timeRange: c, onTimeRangeChange: l }) {
2172
- let { inventory: u, loading: d, failed: f, retry: p } = xt(e), [m, h] = o(Ye), g = c ?? m, v = l ?? h, [y, b] = o(i), x = s ? s.actorName : y, S = s ? s.onSelectActor : b, [C, w] = o(), [T, E] = o(""), D = a(null), O = JSON.stringify([x, C]), M = a(JSON.stringify([i, void 0])), N = n(), P = u?.actors.find((e) => e.actorName === x), F = P?.instances.find((e) => e.actorId === C), I = Vt(e, Xe(g, Date.now()), x), te = I.rows && Gt(I.rows), L = I.rows && x !== void 0 ? Kt(I.rows, x) : void 0, R = I.supported && I.rows ? Wt(I.rows) : void 0;
2536
+ function Cn({ client: e, className: r = "", initialActorName: i, navigation: s, timeRange: c, onTimeRangeChange: l }) {
2537
+ let { inventory: u, loading: d, failed: f, retry: p } = xt(e), [m, h] = o(Ye), g = c ?? m, v = l ?? h, [y, b] = o(i), x = s ? s.actorName : y, S = s ? s.onSelectActor : b, [C, w] = o(), [T, E] = o(""), D = a(null), O = JSON.stringify([x, C]), M = a(JSON.stringify([i, void 0])), N = n(), P = u?.actors.find((e) => e.actorName === x), F = P?.instances.find((e) => e.actorId === C), I = fn(e, W(g, Date.now()), x), te = I.rows && gn(I.rows), L = I.rows && x !== void 0 ? _n(I.rows, x) : void 0, R = I.supported && I.rows ? hn(I.rows) : void 0;
2173
2538
  t(() => {
2174
2539
  b(i), w(void 0), E("");
2175
2540
  }, [e, i]), t(() => {
@@ -2186,7 +2551,7 @@ function Yt({ client: e, className: r = "", initialActorName: i, navigation: s,
2186
2551
  className: "la-observer-breadcrumb",
2187
2552
  "aria-label": "Breadcrumb",
2188
2553
  children: [
2189
- /* @__PURE__ */ A(H, {
2554
+ /* @__PURE__ */ A(U, {
2190
2555
  variant: "link",
2191
2556
  type: "button",
2192
2557
  "aria-label": "Back to actors",
@@ -2200,7 +2565,7 @@ function Yt({ client: e, className: r = "", initialActorName: i, navigation: s,
2200
2565
  C === void 0 ? /* @__PURE__ */ A("span", {
2201
2566
  "aria-current": "page",
2202
2567
  children: x
2203
- }) : /* @__PURE__ */ A(H, {
2568
+ }) : /* @__PURE__ */ A(U, {
2204
2569
  variant: "link",
2205
2570
  "aria-label": "Back to instances",
2206
2571
  onClick: () => w(void 0),
@@ -2217,23 +2582,23 @@ function Yt({ client: e, className: r = "", initialActorName: i, navigation: s,
2217
2582
  }),
2218
2583
  /* @__PURE__ */ j("div", {
2219
2584
  className: "la-observer-toolbar",
2220
- children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("div", {
2585
+ children: [/* @__PURE__ */ A("div", { children: /* @__PURE__ */ j("div", {
2221
2586
  className: "la-observer-title",
2222
2587
  children: [/* @__PURE__ */ A("h1", {
2223
2588
  ref: D,
2224
2589
  tabIndex: -1,
2225
2590
  children: C ?? x ?? "Actors"
2226
- }), F && /* @__PURE__ */ j(W, {
2591
+ }), F && /* @__PURE__ */ j(G, {
2227
2592
  variant: "outline",
2228
2593
  className: `la-observer-status-${F.status}`,
2229
- children: [/* @__PURE__ */ A("span", { className: `la-observer-dot la-observer-dot-${F.status}` }), fn(F.status)]
2594
+ children: [/* @__PURE__ */ A("span", { className: `la-observer-dot la-observer-dot-${F.status}` }), zn(F.status)]
2230
2595
  })]
2231
- }), C === void 0 && /* @__PURE__ */ A("p", { children: x === void 0 ? "Inspect instances, residency, and connections." : "Inspect this actor class’s instances, residency, and connections." })] }), /* @__PURE__ */ j("div", {
2596
+ }) }), /* @__PURE__ */ j("div", {
2232
2597
  className: "la-observer-actions",
2233
2598
  children: [I.supported && /* @__PURE__ */ A(et, {
2234
2599
  value: g,
2235
2600
  onChange: v
2236
- }), /* @__PURE__ */ j(H, {
2601
+ }), /* @__PURE__ */ j(U, {
2237
2602
  variant: "outline",
2238
2603
  type: "button",
2239
2604
  disabled: d,
@@ -2250,13 +2615,12 @@ function Yt({ client: e, className: r = "", initialActorName: i, navigation: s,
2250
2615
  role: "alert",
2251
2616
  children: [/* @__PURE__ */ A(_, { "aria-hidden": "true" }), /* @__PURE__ */ A("p", { children: u ? "Could not refresh. These counts may be out of date." : "Could not load actors. Check your connection and access, then try again." })]
2252
2617
  }),
2253
- !u && !f && /* @__PURE__ */ A(Xt, {}),
2254
- /* @__PURE__ */ A(se, { inventory: u }),
2255
- u && /* @__PURE__ */ j(k, { children: [x === void 0 ? /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(Zt, {
2618
+ !u && !f && /* @__PURE__ */ A(wn, {}),
2619
+ /* @__PURE__ */ A(oe, { inventory: u }),
2620
+ u && /* @__PURE__ */ A(k, { children: x === void 0 ? /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(Tn, {
2256
2621
  inventory: u,
2257
- queueWait: I.supported ? R ?? null : void 0,
2258
- range: g
2259
- }), u.actors.length ? /* @__PURE__ */ A(Qt, {
2622
+ queueWait: I.supported ? R ?? null : void 0
2623
+ }), u.actors.length ? /* @__PURE__ */ A(En, {
2260
2624
  inventory: u,
2261
2625
  query: T,
2262
2626
  onQueryChange: E,
@@ -2265,19 +2629,18 @@ function Yt({ client: e, className: r = "", initialActorName: i, navigation: s,
2265
2629
  w(t), S(e);
2266
2630
  },
2267
2631
  waits: I.supported ? te : void 0
2268
- }) : /* @__PURE__ */ A(un, {
2632
+ }) : /* @__PURE__ */ A(Ln, {
2269
2633
  title: "No actors yet",
2270
2634
  description: "Deploy your actor classes to see them here. Instance counts appear as actors are used."
2271
- })] }) : P ? /* @__PURE__ */ j(k, { children: [C === void 0 && /* @__PURE__ */ A(Zt, {
2635
+ })] }) : P ? /* @__PURE__ */ j(k, { children: [C === void 0 && /* @__PURE__ */ A(Tn, {
2272
2636
  inventory: {
2273
2637
  ...u,
2274
2638
  actors: [P]
2275
2639
  },
2276
- actorName: x,
2277
- queueWait: I.supported ? R ?? null : void 0,
2278
- range: g
2279
- }), /* @__PURE__ */ A(tn, {
2640
+ queueWait: I.supported ? R ?? null : void 0
2641
+ }), /* @__PURE__ */ A(kn, {
2280
2642
  client: e,
2643
+ inventory: u,
2281
2644
  id: N,
2282
2645
  actorName: x,
2283
2646
  instances: P.instances,
@@ -2285,20 +2648,14 @@ function Yt({ client: e, className: r = "", initialActorName: i, navigation: s,
2285
2648
  range: g,
2286
2649
  selectedInstanceId: C,
2287
2650
  onSelectInstance: w
2288
- }, x)] }) : /* @__PURE__ */ A(un, {
2651
+ }, x)] }) : /* @__PURE__ */ A(Ln, {
2289
2652
  title: "Actor class unavailable",
2290
2653
  description: "This actor class is no longer in the latest inventory. Return to Actors to see available classes."
2291
- }), /* @__PURE__ */ j("div", {
2292
- className: "la-observer-footnote",
2293
- children: [/* @__PURE__ */ j("span", {
2294
- className: "la-observer-refresh-status",
2295
- children: [/* @__PURE__ */ A("span", { className: `la-observer-dot ${f ? "la-observer-dot-unknown" : e.watchActors ? "la-observer-dot-live" : ""}` }), f ? "Reconnecting…" : e.watchActors ? "Live updates" : "Auto-refresh every 5s"]
2296
- }), /* @__PURE__ */ A("span", { children: e.watchActors ? "Changes stream from the control plane." : "Counts follow the latest host heartbeat." })]
2297
- })] })
2654
+ }) })
2298
2655
  ]
2299
2656
  });
2300
2657
  }
2301
- function Xt() {
2658
+ function wn() {
2302
2659
  return /* @__PURE__ */ j("div", {
2303
2660
  className: "la-observer-skeleton",
2304
2661
  role: "status",
@@ -2314,8 +2671,8 @@ function Xt() {
2314
2671
  ]
2315
2672
  });
2316
2673
  }
2317
- function Zt({ inventory: e, actorName: t, queueWait: n, range: r }) {
2318
- let i = e.actors.reduce((e, t) => ({
2674
+ function Tn({ inventory: e, queueWait: t }) {
2675
+ let n = e.actors.reduce((e, t) => ({
2319
2676
  live: e.live + t.live,
2320
2677
  dormant: e.dormant + t.dormant,
2321
2678
  unknown: e.unknown + t.unknown
@@ -2327,58 +2684,38 @@ function Zt({ inventory: e, actorName: t, queueWait: n, range: r }) {
2327
2684
  return /* @__PURE__ */ j("dl", {
2328
2685
  className: "la-observer-summary",
2329
2686
  children: [
2330
- /* @__PURE__ */ j("div", { children: [
2331
- /* @__PURE__ */ A("dt", { children: "Total instances" }),
2332
- /* @__PURE__ */ A("dd", {
2333
- "aria-label": "Total instances",
2334
- children: (i.live + i.dormant + i.unknown).toLocaleString()
2335
- }),
2336
- /* @__PURE__ */ A("p", { children: t === void 0 ? `${e.actors.length} actor ${e.actors.length === 1 ? "type" : "types"}` : "In this actor class" })
2337
- ] }),
2338
- /* @__PURE__ */ j("div", { children: [
2339
- /* @__PURE__ */ j("dt", { children: [/* @__PURE__ */ A("span", { className: "la-observer-dot la-observer-dot-live" }), "Live"] }),
2340
- /* @__PURE__ */ A("dd", {
2341
- "aria-label": "Live instances",
2342
- children: i.live.toLocaleString()
2343
- }),
2344
- /* @__PURE__ */ A("p", { children: "Loaded in memory" })
2345
- ] }),
2346
- /* @__PURE__ */ j("div", { children: [
2347
- /* @__PURE__ */ j("dt", { children: [/* @__PURE__ */ A("span", { className: "la-observer-dot" }), "Dormant"] }),
2348
- /* @__PURE__ */ A("dd", {
2349
- "aria-label": "Dormant instances",
2350
- children: i.dormant.toLocaleString()
2351
- }),
2352
- /* @__PURE__ */ A("p", { children: "Currently unloaded" })
2353
- ] }),
2354
- i.unknown > 0 && /* @__PURE__ */ j("div", { children: [
2355
- /* @__PURE__ */ j("dt", { children: [/* @__PURE__ */ A("span", { className: "la-observer-dot la-observer-dot-unknown" }), "Unknown"] }),
2356
- /* @__PURE__ */ A("dd", {
2357
- "aria-label": "Unknown instances",
2358
- children: i.unknown.toLocaleString()
2359
- }),
2360
- /* @__PURE__ */ A("p", { children: "Awaiting host report" })
2361
- ] }),
2362
- n !== void 0 && /* @__PURE__ */ j("div", {
2687
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: "Total instances" }), /* @__PURE__ */ A("dd", {
2688
+ "aria-label": "Total instances",
2689
+ children: (n.live + n.dormant + n.unknown).toLocaleString()
2690
+ })] }),
2691
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("dt", { children: [/* @__PURE__ */ A("span", { className: "la-observer-dot la-observer-dot-live" }), "Live"] }), /* @__PURE__ */ A("dd", {
2692
+ "aria-label": "Live instances",
2693
+ children: n.live.toLocaleString()
2694
+ })] }),
2695
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("dt", { children: [/* @__PURE__ */ A("span", { className: "la-observer-dot" }), "Dormant"] }), /* @__PURE__ */ A("dd", {
2696
+ "aria-label": "Dormant instances",
2697
+ children: n.dormant.toLocaleString()
2698
+ })] }),
2699
+ n.unknown > 0 && /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("dt", { children: [/* @__PURE__ */ A("span", { className: "la-observer-dot la-observer-dot-unknown" }), "Unknown"] }), /* @__PURE__ */ A("dd", {
2700
+ "aria-label": "Unknown instances",
2701
+ children: n.unknown.toLocaleString()
2702
+ })] }),
2703
+ t !== void 0 && /* @__PURE__ */ j("div", {
2363
2704
  className: "la-observer-queue-wait",
2364
- children: [
2365
- /* @__PURE__ */ A("dt", { children: "Avg queue wait" }),
2366
- /* @__PURE__ */ A("dd", {
2367
- "aria-label": "Average queue wait",
2368
- children: qt(n?.averageMs)
2369
- }),
2370
- /* @__PURE__ */ A("p", { children: n ? `Max ${qt(n.maxMs)} · ${n.admitted.toLocaleString()} admitted ${U(r)}` : `No admitted requests ${U(r)}` })
2371
- ]
2705
+ children: [/* @__PURE__ */ A("dt", { children: "Avg queue wait" }), /* @__PURE__ */ A("dd", {
2706
+ "aria-label": "Average queue wait",
2707
+ children: vn(t?.averageMs)
2708
+ })]
2372
2709
  })
2373
2710
  ]
2374
2711
  });
2375
2712
  }
2376
- function Qt({ inventory: e, query: t, onQueryChange: n, onSelectActor: r, onSelectInstance: i, waits: a }) {
2377
- let o = e.actors.some((e) => e.unknown > 0), s = e.actors.filter((e) => en(e, t)).sort((e, t) => Number(t.live > 0) - Number(e.live > 0)), c = $t(e);
2713
+ function En({ inventory: e, query: t, onQueryChange: n, onSelectActor: r, onSelectInstance: i, waits: a }) {
2714
+ let o = e.actors.some((e) => e.unknown > 0), s = e.actors.filter((e) => On(e, t)).sort((e, t) => Number(t.live > 0) - Number(e.live > 0)), c = Dn(e);
2378
2715
  return /* @__PURE__ */ j(k, { children: [
2379
2716
  /* @__PURE__ */ j("div", {
2380
2717
  className: "la-observer-list-toolbar",
2381
- children: [/* @__PURE__ */ j("h2", { children: ["Actor names ", /* @__PURE__ */ A(W, { children: e.actors.length })] }), /* @__PURE__ */ A(_e, {
2718
+ children: [/* @__PURE__ */ j("h2", { children: ["Actor names ", /* @__PURE__ */ A(G, { children: e.actors.length })] }), /* @__PURE__ */ A(ge, {
2382
2719
  label: "Search actors and instances",
2383
2720
  placeholder: "Search actor name or instance ID…",
2384
2721
  value: t,
@@ -2394,42 +2731,42 @@ function Qt({ inventory: e, query: t, onQueryChange: n, onSelectActor: r, onSele
2394
2731
  }),
2395
2732
  /* @__PURE__ */ A("div", {
2396
2733
  className: "la-observer-table-frame",
2397
- children: s.length ? /* @__PURE__ */ j(K, {
2734
+ children: s.length ? /* @__PURE__ */ j(q, {
2398
2735
  "aria-label": "Actor instance counts",
2399
2736
  className: "la-observer-table",
2400
- children: [/* @__PURE__ */ A(q, { children: /* @__PURE__ */ j(Y, { children: [
2401
- /* @__PURE__ */ A(X, {
2737
+ children: [/* @__PURE__ */ A(J, { children: /* @__PURE__ */ j(X, { children: [
2738
+ /* @__PURE__ */ A(Z, {
2402
2739
  scope: "col",
2403
2740
  children: "Actor"
2404
2741
  }),
2405
- /* @__PURE__ */ A(X, {
2742
+ /* @__PURE__ */ A(Z, {
2406
2743
  scope: "col",
2407
2744
  children: "Live"
2408
2745
  }),
2409
- /* @__PURE__ */ A(X, {
2746
+ /* @__PURE__ */ A(Z, {
2410
2747
  scope: "col",
2411
2748
  children: "Dormant"
2412
2749
  }),
2413
- o && /* @__PURE__ */ A(X, {
2750
+ o && /* @__PURE__ */ A(Z, {
2414
2751
  scope: "col",
2415
2752
  children: "Unknown"
2416
2753
  }),
2417
- /* @__PURE__ */ A(X, {
2754
+ /* @__PURE__ */ A(Z, {
2418
2755
  scope: "col",
2419
2756
  children: "Total"
2420
2757
  }),
2421
- a && /* @__PURE__ */ A(X, {
2758
+ a && /* @__PURE__ */ A(Z, {
2422
2759
  scope: "col",
2423
2760
  className: "la-observer-wait-cell",
2424
2761
  children: "Avg queue wait"
2425
2762
  })
2426
- ] }) }), /* @__PURE__ */ A(J, { children: s.map((e) => /* @__PURE__ */ j(Y, {
2763
+ ] }) }), /* @__PURE__ */ A(Y, { children: s.map((e) => /* @__PURE__ */ j(X, {
2427
2764
  className: "la-clickable-row",
2428
2765
  onClick: () => r(e.actorName),
2429
2766
  children: [
2430
- /* @__PURE__ */ A(Z, {
2767
+ /* @__PURE__ */ A(Q, {
2431
2768
  className: "la-observer-name",
2432
- children: /* @__PURE__ */ j(H, {
2769
+ children: /* @__PURE__ */ j(U, {
2433
2770
  variant: "ghost",
2434
2771
  type: "button",
2435
2772
  className: "la-observer-actor-button la-observer-class-button",
@@ -2439,20 +2776,20 @@ function Qt({ inventory: e, query: t, onQueryChange: n, onSelectActor: r, onSele
2439
2776
  }), /* @__PURE__ */ A("span", { children: e.actorName })]
2440
2777
  })
2441
2778
  }),
2442
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A("span", {
2779
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A("span", {
2443
2780
  className: e.live > 0 ? "la-observer-live" : void 0,
2444
2781
  children: e.live.toLocaleString()
2445
2782
  }) }),
2446
- /* @__PURE__ */ A(Z, { children: e.dormant.toLocaleString() }),
2447
- o && /* @__PURE__ */ A(Z, { children: e.unknown.toLocaleString() }),
2448
- /* @__PURE__ */ A(Z, { children: (e.live + e.dormant + e.unknown).toLocaleString() }),
2449
- a && /* @__PURE__ */ A(Z, {
2783
+ /* @__PURE__ */ A(Q, { children: e.dormant.toLocaleString() }),
2784
+ o && /* @__PURE__ */ A(Q, { children: e.unknown.toLocaleString() }),
2785
+ /* @__PURE__ */ A(Q, { children: (e.live + e.dormant + e.unknown).toLocaleString() }),
2786
+ a && /* @__PURE__ */ A(Q, {
2450
2787
  className: "la-observer-wait-cell",
2451
- children: /* @__PURE__ */ A(rn, { stats: a.get(e.actorName) })
2788
+ children: /* @__PURE__ */ A(jn, { stats: a.get(e.actorName) })
2452
2789
  })
2453
2790
  ]
2454
2791
  }, e.actorName)) })]
2455
- }) : /* @__PURE__ */ A(un, {
2792
+ }) : /* @__PURE__ */ A(Ln, {
2456
2793
  title: "No matching actors",
2457
2794
  description: "Try a different actor name.",
2458
2795
  action: "Clear search",
@@ -2465,7 +2802,7 @@ function Qt({ inventory: e, query: t, onQueryChange: n, onSelectActor: r, onSele
2465
2802
  })
2466
2803
  ] });
2467
2804
  }
2468
- function $t(e) {
2805
+ function Dn(e) {
2469
2806
  return e.actors.flatMap((e) => [{
2470
2807
  id: JSON.stringify({ actorName: e.actorName }),
2471
2808
  group: "Actor classes",
@@ -2479,133 +2816,173 @@ function $t(e) {
2479
2816
  group: "Instances",
2480
2817
  value: t.actorId,
2481
2818
  keywords: [e.actorName],
2482
- hint: `${e.actorName} · ${fn(t.status)} · ${t.connections.length.toLocaleString()} ${t.connections.length === 1 ? "connection" : "connections"}`
2819
+ hint: `${e.actorName} · ${zn(t.status)} · ${t.connections.length.toLocaleString()} ${t.connections.length === 1 ? "connection" : "connections"}`
2483
2820
  }))]);
2484
2821
  }
2485
- function en(e, t) {
2822
+ function On(e, t) {
2486
2823
  let n = t.trim().toLocaleLowerCase().split(/\s+/u).filter(Boolean), r = [e.actorName, ...e.instances.map((e) => e.actorId)].join(" ").toLocaleLowerCase();
2487
2824
  return n.every((e) => r.includes(e));
2488
2825
  }
2489
- function tn({ client: e, id: t, actorName: n, instances: r, waits: i, range: a, selectedInstanceId: s, onSelectInstance: c }) {
2490
- let [l, u] = o(""), [d, f] = o("all"), p = r.filter((e) => dn(e.actorId, l) && (d === "all" || e.status === d));
2491
- p.sort((e, t) => Number(t.status === "live") - Number(e.status === "live"));
2492
- let m = r.find((e) => e.actorId === s);
2493
- return s === void 0 ? /* @__PURE__ */ j("section", {
2494
- id: t,
2826
+ function kn({ client: e, inventory: t, id: n, actorName: r, instances: i, waits: a, range: s, selectedInstanceId: c, onSelectInstance: l }) {
2827
+ let [u, d] = o(""), [f, p] = o("all"), m = Date.now(), h = W(s, m), g = wt(e, {
2828
+ actorName: r,
2829
+ ...h
2830
+ }, e.listResidency, 5e3), _ = bn(i.filter((e) => Rn(e.actorId, u) && (f === "all" || e.status === f))), v = h.toMs ?? m, y = h.fromMs ?? g.value?.periods.reduce((e, t) => Math.min(e, t.fromMs), v) ?? v, b = i.find((e) => e.actorId === c);
2831
+ return c === void 0 ? /* @__PURE__ */ j("section", {
2832
+ id: n,
2495
2833
  className: "la-observer-instances",
2496
- "aria-labelledby": `${t}-heading`,
2834
+ "aria-labelledby": `${n}-heading`,
2497
2835
  children: [/* @__PURE__ */ A("div", {
2498
2836
  className: "la-observer-instances-heading",
2499
2837
  children: /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("h2", {
2500
- id: `${t}-heading`,
2838
+ id: `${n}-heading`,
2501
2839
  children: [
2502
- n,
2840
+ r,
2503
2841
  " instances ",
2504
- /* @__PURE__ */ A(W, {
2842
+ /* @__PURE__ */ A(G, {
2505
2843
  "aria-hidden": "true",
2506
- children: r.length.toLocaleString()
2844
+ children: i.length.toLocaleString()
2507
2845
  })
2508
2846
  ]
2509
- }), /* @__PURE__ */ A("p", { children: "Select an instance to inspect its persisted state, requests, and WebSocket connections." })] })
2510
- }), r.length ? /* @__PURE__ */ j(k, { children: [
2847
+ }), /* @__PURE__ */ A("p", { children: "All instances, most recently active first. Select one to inspect state, requests, and connections." })] })
2848
+ }), i.length ? /* @__PURE__ */ j(k, { children: [
2511
2849
  /* @__PURE__ */ j("div", {
2512
2850
  className: "la-observer-filters",
2513
- children: [/* @__PURE__ */ A(ln, {
2851
+ children: [/* @__PURE__ */ A(In, {
2514
2852
  label: "Search instances",
2515
2853
  placeholder: "Search instance IDs…",
2516
- value: l,
2517
- onChange: u
2854
+ value: u,
2855
+ onChange: d
2518
2856
  }), /* @__PURE__ */ j(vt, {
2519
2857
  className: "la-observer-select",
2520
2858
  "aria-label": "Instance state",
2521
- value: d,
2522
- onChange: (e) => f(e.target.value),
2859
+ value: f,
2860
+ onChange: (e) => p(e.target.value),
2523
2861
  children: [
2524
- /* @__PURE__ */ A(G, {
2862
+ /* @__PURE__ */ A(K, {
2525
2863
  value: "all",
2526
2864
  children: "All states"
2527
2865
  }),
2528
- /* @__PURE__ */ A(G, {
2866
+ /* @__PURE__ */ A(K, {
2529
2867
  value: "live",
2530
2868
  children: "Live"
2531
2869
  }),
2532
- /* @__PURE__ */ A(G, {
2870
+ /* @__PURE__ */ A(K, {
2533
2871
  value: "dormant",
2534
2872
  children: "Dormant"
2535
2873
  }),
2536
- /* @__PURE__ */ A(G, {
2874
+ /* @__PURE__ */ A(K, {
2537
2875
  value: "unknown",
2538
2876
  children: "Unknown"
2539
2877
  })
2540
2878
  ]
2541
2879
  })]
2542
2880
  }),
2881
+ g.supported && g.loading && !g.value && /* @__PURE__ */ A("p", {
2882
+ role: "status",
2883
+ children: "Loading residency history…"
2884
+ }),
2885
+ g.supported && g.failed && /* @__PURE__ */ j("div", {
2886
+ role: "alert",
2887
+ className: "la-observer-notice",
2888
+ children: [/* @__PURE__ */ j("span", { children: ["Could not refresh residency history. ", g.value ? "The timeline may be out of date." : "Try again to load the timeline."] }), /* @__PURE__ */ A(U, {
2889
+ variant: "outline",
2890
+ size: "sm",
2891
+ onClick: g.retry,
2892
+ children: "Retry residency history"
2893
+ })]
2894
+ }),
2895
+ g.value && _.length > 0 && /* @__PURE__ */ A(Zt, {
2896
+ instances: _,
2897
+ periods: g.value.periods,
2898
+ start: y < v ? y : v - 36e5,
2899
+ end: v,
2900
+ endLabel: s.kind === "absolute" ? "end" : "now",
2901
+ onSelect: l
2902
+ }),
2903
+ g.value?.truncated && /* @__PURE__ */ A("p", {
2904
+ role: "status",
2905
+ children: "Residency history is limited to the latest 10,000 reports. Choose a shorter time range to see more detail."
2906
+ }),
2543
2907
  /* @__PURE__ */ A("div", {
2544
2908
  className: "la-observer-table-frame",
2545
- children: p.length ? /* @__PURE__ */ j(K, {
2546
- "aria-label": `${n} instances`,
2909
+ children: _.length ? /* @__PURE__ */ j(q, {
2910
+ "aria-label": `${r} instances`,
2547
2911
  className: "la-observer-instance-table",
2548
- children: [/* @__PURE__ */ A(q, { children: /* @__PURE__ */ j(Y, { children: [
2549
- /* @__PURE__ */ A(X, {
2912
+ children: [/* @__PURE__ */ A(J, { children: /* @__PURE__ */ j(X, { children: [
2913
+ /* @__PURE__ */ A(Z, {
2550
2914
  scope: "col",
2551
2915
  children: "Instance"
2552
2916
  }),
2553
- /* @__PURE__ */ A(X, {
2917
+ /* @__PURE__ */ A(Z, {
2554
2918
  scope: "col",
2555
2919
  children: "State"
2556
2920
  }),
2557
- /* @__PURE__ */ A(X, {
2921
+ /* @__PURE__ */ A(Z, {
2558
2922
  scope: "col",
2559
2923
  children: "Connections"
2560
2924
  }),
2561
- i && /* @__PURE__ */ A(X, {
2925
+ /* @__PURE__ */ A(Z, {
2926
+ scope: "col",
2927
+ "aria-sort": "descending",
2928
+ children: "Last active ↓"
2929
+ }),
2930
+ a && /* @__PURE__ */ A(Z, {
2562
2931
  scope: "col",
2563
2932
  className: "la-observer-wait-cell",
2564
2933
  children: "Avg queue wait"
2565
2934
  }),
2566
- /* @__PURE__ */ A(X, {
2935
+ /* @__PURE__ */ A(Z, {
2567
2936
  scope: "col",
2568
2937
  className: "la-observer-waiting-cell",
2569
2938
  children: "Waiting"
2570
2939
  })
2571
- ] }) }), /* @__PURE__ */ A(J, { children: p.map((e) => /* @__PURE__ */ j(Y, {
2940
+ ] }) }), /* @__PURE__ */ A(Y, { children: _.map((e) => /* @__PURE__ */ j(X, {
2572
2941
  className: "la-clickable-row",
2573
- onClick: () => c(e.actorId),
2942
+ onClick: () => l(e.actorId),
2574
2943
  children: [
2575
- /* @__PURE__ */ A(Z, {
2944
+ /* @__PURE__ */ A(Q, {
2576
2945
  className: "la-observer-instance-id",
2577
- children: /* @__PURE__ */ A(H, {
2946
+ children: /* @__PURE__ */ A(U, {
2578
2947
  variant: "ghost",
2579
2948
  type: "button",
2580
2949
  className: "la-observer-actor-button",
2581
2950
  children: /* @__PURE__ */ A("span", { children: e.actorId })
2582
2951
  })
2583
2952
  }),
2584
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ j(W, {
2953
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ j(G, {
2585
2954
  variant: "outline",
2586
2955
  className: `la-observer-status-${e.status}`,
2587
- children: [/* @__PURE__ */ A("span", { className: `la-observer-dot la-observer-dot-${e.status}` }), fn(e.status)]
2956
+ children: [/* @__PURE__ */ A("span", { className: `la-observer-dot la-observer-dot-${e.status}` }), zn(e.status)]
2588
2957
  }) }),
2589
- /* @__PURE__ */ A(Z, { children: e.connections.length.toLocaleString() }),
2590
- i && /* @__PURE__ */ A(Z, {
2958
+ /* @__PURE__ */ A(Q, { children: e.connections.length.toLocaleString() }),
2959
+ /* @__PURE__ */ A(Q, {
2960
+ className: "la-observer-last-active",
2961
+ children: e.lastActiveAtMs == null ? "Unknown" : /* @__PURE__ */ A("time", {
2962
+ dateTime: new Date(e.lastActiveAtMs).toISOString(),
2963
+ title: new Date(e.lastActiveAtMs).toLocaleString(),
2964
+ children: Sn(e.lastActiveAtMs, m)
2965
+ })
2966
+ }),
2967
+ a && /* @__PURE__ */ A(Q, {
2591
2968
  className: "la-observer-wait-cell",
2592
- children: /* @__PURE__ */ A(rn, { stats: i.get(e.actorId) })
2969
+ children: /* @__PURE__ */ A(jn, { stats: a.get(e.actorId) })
2593
2970
  }),
2594
- /* @__PURE__ */ A(Z, {
2971
+ /* @__PURE__ */ A(Q, {
2595
2972
  className: "la-observer-waiting-cell",
2596
- children: /* @__PURE__ */ A(sn, {
2973
+ children: /* @__PURE__ */ A(Pn, {
2597
2974
  waiting: e.waiting,
2598
2975
  compact: !0
2599
2976
  })
2600
2977
  })
2601
2978
  ]
2602
2979
  }, e.actorId)) })]
2603
- }) : /* @__PURE__ */ A(un, {
2980
+ }) : /* @__PURE__ */ A(Ln, {
2604
2981
  title: "No matching instances",
2605
2982
  description: "Try another instance ID or state.",
2606
2983
  action: "Clear filters",
2607
2984
  onReset: () => {
2608
- u(""), f("all");
2985
+ d(""), p("all");
2609
2986
  }
2610
2987
  })
2611
2988
  }),
@@ -2618,120 +2995,122 @@ function tn({ client: e, id: t, actorName: n, instances: r, waits: i, range: a,
2618
2995
  role: "status",
2619
2996
  children: [
2620
2997
  "No ",
2621
- n,
2998
+ r,
2622
2999
  " instances have been created yet."
2623
3000
  ]
2624
3001
  })]
2625
- }) : /* @__PURE__ */ A(nn, {
3002
+ }) : /* @__PURE__ */ A(An, {
2626
3003
  client: e,
2627
- id: t,
2628
- actorName: n,
2629
- actorId: s,
2630
- instance: m,
2631
- waits: i,
2632
- range: a
2633
- }, s);
2634
- }
2635
- function nn({ client: e, id: t, actorName: n, actorId: r, instance: i, waits: s, range: c }) {
2636
- let [l, u] = o("requests"), [d, f] = o(), p = a(null), m = !!e.getState && !!e.listStateHistory;
3004
+ inventory: t,
3005
+ id: n,
3006
+ actorName: r,
3007
+ actorId: c,
3008
+ instance: b,
3009
+ waits: a,
3010
+ range: s
3011
+ }, c);
3012
+ }
3013
+ function An({ client: e, inventory: t, id: n, actorName: r, actorId: i, instance: s, waits: c, range: l }) {
3014
+ let [u, d] = o("requests"), [f, p] = o(), m = a(null), h = !!e.getState && !!e.listStateHistory;
2637
3015
  return /* @__PURE__ */ j("section", {
2638
3016
  className: "la-observer-instance-detail",
2639
- "aria-label": `${n} / ${r}`,
3017
+ "aria-label": `${r} / ${i}`,
2640
3018
  children: [
2641
- !i && /* @__PURE__ */ A("p", {
3019
+ !s && /* @__PURE__ */ A("p", {
2642
3020
  role: "status",
2643
3021
  children: "This instance is no longer in the current inventory. Its retained requests are still available below."
2644
3022
  }),
2645
3023
  /* @__PURE__ */ j("div", {
2646
3024
  className: "la-observer-instance-metrics",
2647
- children: [s && /* @__PURE__ */ A(an, {
2648
- stats: s.get(r),
2649
- range: c
2650
- }), i && /* @__PURE__ */ A(on, { waiting: i.waiting })]
3025
+ children: [c && /* @__PURE__ */ A(Mn, {
3026
+ stats: c.get(i),
3027
+ range: l
3028
+ }), s && /* @__PURE__ */ A(Nn, { waiting: s.waiting })]
2651
3029
  }),
2652
3030
  /* @__PURE__ */ j("div", {
2653
3031
  className: "la-observer-instance-views",
2654
3032
  role: "group",
2655
3033
  "aria-label": "Instance view",
2656
3034
  children: [
2657
- /* @__PURE__ */ A(H, {
2658
- ref: p,
3035
+ /* @__PURE__ */ A(U, {
3036
+ ref: m,
2659
3037
  variant: "ghost",
2660
- "aria-pressed": l === "requests",
2661
- onClick: () => u("requests"),
3038
+ "aria-pressed": u === "requests",
3039
+ onClick: () => d("requests"),
2662
3040
  children: "Requests"
2663
3041
  }),
2664
- m && /* @__PURE__ */ A(H, {
3042
+ h && /* @__PURE__ */ A(U, {
2665
3043
  variant: "ghost",
2666
- "aria-pressed": l === "state",
2667
- onClick: () => u("state"),
3044
+ "aria-pressed": u === "state",
3045
+ onClick: () => d("state"),
2668
3046
  children: "State"
2669
3047
  }),
2670
- i && /* @__PURE__ */ j(H, {
3048
+ s && /* @__PURE__ */ j(U, {
2671
3049
  variant: "ghost",
2672
- "aria-pressed": l === "websockets",
2673
- onClick: () => u("websockets"),
2674
- children: ["WebSockets ", /* @__PURE__ */ A(W, { children: i.connections.length })]
3050
+ "aria-pressed": u === "websockets",
3051
+ onClick: () => d("websockets"),
3052
+ children: ["WebSockets ", /* @__PURE__ */ A(G, { children: s.connections.length })]
2675
3053
  })
2676
3054
  ]
2677
3055
  }),
2678
3056
  /* @__PURE__ */ A("div", {
2679
- hidden: l !== "requests",
3057
+ hidden: u !== "requests",
2680
3058
  children: e.watchRequests || e.listRequests ? /* @__PURE__ */ A(Et, {
2681
3059
  client: e,
3060
+ inventory: t,
2682
3061
  actor: {
2683
- actorName: n,
2684
- actorId: r
3062
+ actorName: r,
3063
+ actorId: i
2685
3064
  },
2686
- timeRange: c,
2687
- focus: d
3065
+ timeRange: l,
3066
+ focus: f
2688
3067
  }) : /* @__PURE__ */ j("section", { children: [/* @__PURE__ */ A("h3", { children: "Requests" }), /* @__PURE__ */ A("p", { children: "Request timings are unavailable for this connection." })] })
2689
3068
  }),
2690
3069
  /* @__PURE__ */ A("div", {
2691
- hidden: l !== "state",
2692
- children: m && /* @__PURE__ */ A(Mt, {
3070
+ hidden: u !== "state",
3071
+ children: h && /* @__PURE__ */ A(nn, {
2693
3072
  client: e,
2694
- actorName: n,
2695
- actorId: r,
3073
+ actorName: r,
3074
+ actorId: i,
2696
3075
  onInspectRequest: (e) => {
2697
- f(e), u("requests"), p.current?.focus();
3076
+ p(e), d("requests"), m.current?.focus();
2698
3077
  }
2699
3078
  })
2700
3079
  }),
2701
3080
  /* @__PURE__ */ A("div", {
2702
- hidden: l !== "websockets",
2703
- children: i && /* @__PURE__ */ A(cn, {
2704
- id: `${t}-connections`,
2705
- actorId: r,
2706
- connections: i.connections
3081
+ hidden: u !== "websockets",
3082
+ children: s && /* @__PURE__ */ A(Fn, {
3083
+ id: `${n}-connections`,
3084
+ actorId: i,
3085
+ connections: s.connections
2707
3086
  })
2708
3087
  })
2709
3088
  ]
2710
3089
  });
2711
3090
  }
2712
- function rn({ stats: e }) {
3091
+ function jn({ stats: e }) {
2713
3092
  return e ? /* @__PURE__ */ j("span", {
2714
3093
  className: "la-observer-wait",
2715
- title: `Average of ${e.admitted.toLocaleString()} admitted requests in the selected time range; longest wait ${qt(e.maxMs)}`,
2716
- children: [qt(e.averageMs), /* @__PURE__ */ j("small", { children: ["max ", qt(e.maxMs)] })]
3094
+ title: `Average of ${e.admitted.toLocaleString()} admitted requests in the selected time range; longest wait ${vn(e.maxMs)}`,
3095
+ children: [vn(e.averageMs), /* @__PURE__ */ j("small", { children: ["max ", vn(e.maxMs)] })]
2717
3096
  }) : /* @__PURE__ */ A("span", {
2718
3097
  title: "No admitted requests in the selected time range",
2719
3098
  children: "—"
2720
3099
  });
2721
3100
  }
2722
- function an({ stats: e, range: t }) {
3101
+ function Mn({ stats: e, range: t }) {
2723
3102
  return /* @__PURE__ */ A("section", {
2724
3103
  className: "la-observer-queue-wait-detail",
2725
3104
  "aria-label": "Queue wait",
2726
- title: `Time waiting to enter this actor ${U(t)}`,
3105
+ title: `Time waiting to enter this actor ${Ze(t)}`,
2727
3106
  children: e ? /* @__PURE__ */ j("dl", { children: [
2728
3107
  /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: "Avg queue wait" }), /* @__PURE__ */ A("dd", {
2729
3108
  "aria-label": "Average queue wait",
2730
- children: qt(e.averageMs)
3109
+ children: vn(e.averageMs)
2731
3110
  })] }),
2732
3111
  /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: "Max" }), /* @__PURE__ */ A("dd", {
2733
3112
  "aria-label": "Longest queue wait",
2734
- children: qt(e.maxMs)
3113
+ children: vn(e.maxMs)
2735
3114
  })] }),
2736
3115
  /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: "Admitted" }), /* @__PURE__ */ A("dd", {
2737
3116
  "aria-label": "Admitted requests",
@@ -2739,22 +3118,22 @@ function an({ stats: e, range: t }) {
2739
3118
  })] })
2740
3119
  ] }) : /* @__PURE__ */ j("p", { children: [
2741
3120
  "No requests admitted ",
2742
- U(t),
3121
+ Ze(t),
2743
3122
  "."
2744
3123
  ] })
2745
3124
  });
2746
3125
  }
2747
- function on({ waiting: e }) {
3126
+ function Nn({ waiting: e }) {
2748
3127
  return /* @__PURE__ */ A("section", {
2749
3128
  className: "la-observer-waiting",
2750
3129
  "aria-label": "Waiting requests",
2751
3130
  children: e?.length ? /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ j("span", {
2752
3131
  className: "la-observer-waiting-label",
2753
3132
  children: ["Waiting ", /* @__PURE__ */ A("strong", { children: e.length })]
2754
- }), /* @__PURE__ */ A(sn, { waiting: e })] }) : /* @__PURE__ */ A("p", { children: e == null ? "Queue reporting unavailable" : "No requests waiting." })
3133
+ }), /* @__PURE__ */ A(Pn, { waiting: e })] }) : /* @__PURE__ */ A("p", { children: e == null ? "Queue reporting unavailable" : "No requests waiting." })
2755
3134
  });
2756
3135
  }
2757
- function sn({ waiting: e, compact: t = !1 }) {
3136
+ function Pn({ waiting: e, compact: t = !1 }) {
2758
3137
  if (e == null) return /* @__PURE__ */ A("span", {
2759
3138
  title: "Queue reporting is unavailable",
2760
3139
  children: "Unavailable"
@@ -2767,7 +3146,7 @@ function sn({ waiting: e, compact: t = !1 }) {
2767
3146
  return /* @__PURE__ */ j("ol", {
2768
3147
  className: `la-observer-queue${t ? " la-observer-queue-compact" : ""}`,
2769
3148
  "aria-label": `${e.length} waiting requests, next to run first`,
2770
- children: [n.map((e, n) => /* @__PURE__ */ A("li", { children: /* @__PURE__ */ j(W, {
3149
+ children: [n.map((e, n) => /* @__PURE__ */ A("li", { children: /* @__PURE__ */ j(G, {
2771
3150
  variant: "outline",
2772
3151
  className: "la-observer-queue-bubble",
2773
3152
  title: e.operation,
@@ -2778,13 +3157,13 @@ function sn({ waiting: e, compact: t = !1 }) {
2778
3157
  className: "la-observer-queue-operation",
2779
3158
  children: e.operation
2780
3159
  })]
2781
- }) }, e.id)), t && e.length > n.length && /* @__PURE__ */ A("li", { children: /* @__PURE__ */ j(W, {
3160
+ }) }, e.id)), t && e.length > n.length && /* @__PURE__ */ A("li", { children: /* @__PURE__ */ j(G, {
2782
3161
  "aria-label": `${e.length - n.length} more waiting requests`,
2783
3162
  children: ["+", e.length - n.length]
2784
3163
  }) })]
2785
3164
  });
2786
3165
  }
2787
- function cn({ id: e, actorId: t, connections: n }) {
3166
+ function Fn({ id: e, actorId: t, connections: n }) {
2788
3167
  return /* @__PURE__ */ j("section", {
2789
3168
  id: e,
2790
3169
  className: "la-observer-connections",
@@ -2796,7 +3175,7 @@ function cn({ id: e, actorId: t, connections: n }) {
2796
3175
  children: [
2797
3176
  t,
2798
3177
  " WebSockets ",
2799
- /* @__PURE__ */ A(W, {
3178
+ /* @__PURE__ */ A(G, {
2800
3179
  "aria-hidden": "true",
2801
3180
  children: n.length.toLocaleString()
2802
3181
  })
@@ -2804,19 +3183,19 @@ function cn({ id: e, actorId: t, connections: n }) {
2804
3183
  }), /* @__PURE__ */ A("p", { children: `${n.length.toLocaleString()} active ${n.length === 1 ? "connection" : "connections"}` })] })
2805
3184
  }), n.length ? /* @__PURE__ */ A("div", {
2806
3185
  className: "la-observer-table-frame",
2807
- children: /* @__PURE__ */ j(K, {
3186
+ children: /* @__PURE__ */ j(q, {
2808
3187
  "aria-label": `${t} WebSocket connections`,
2809
3188
  className: "la-observer-connection-table",
2810
- children: [/* @__PURE__ */ A(q, { children: /* @__PURE__ */ j(Y, { children: [/* @__PURE__ */ A(X, {
3189
+ children: [/* @__PURE__ */ A(J, { children: /* @__PURE__ */ j(X, { children: [/* @__PURE__ */ A(Z, {
2811
3190
  scope: "col",
2812
3191
  children: "Socket"
2813
- }), /* @__PURE__ */ A(X, {
3192
+ }), /* @__PURE__ */ A(Z, {
2814
3193
  scope: "col",
2815
3194
  children: "Metadata"
2816
- })] }) }), /* @__PURE__ */ A(J, { children: n.map((e) => /* @__PURE__ */ j(Y, { children: [/* @__PURE__ */ A(Z, {
3195
+ })] }) }), /* @__PURE__ */ A(Y, { children: n.map((e) => /* @__PURE__ */ j(X, { children: [/* @__PURE__ */ A(Q, {
2817
3196
  className: "la-observer-socket-id",
2818
3197
  children: e.id
2819
- }), /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A("pre", { children: JSON.stringify(e.metadata, null, 2) }) })] }, e.id)) })]
3198
+ }), /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A("pre", { children: JSON.stringify(e.metadata, null, 2) }) })] }, e.id)) })]
2820
3199
  })
2821
3200
  }) : /* @__PURE__ */ j("div", {
2822
3201
  className: "la-observer-no-connections",
@@ -2825,7 +3204,7 @@ function cn({ id: e, actorId: t, connections: n }) {
2825
3204
  })]
2826
3205
  });
2827
3206
  }
2828
- function ln({ label: e, placeholder: t, value: n, onChange: r }) {
3207
+ function In({ label: e, placeholder: t, value: n, onChange: r }) {
2829
3208
  return /* @__PURE__ */ j("div", {
2830
3209
  className: "la-observer-search",
2831
3210
  children: [/* @__PURE__ */ A(w, { "aria-hidden": "true" }), /* @__PURE__ */ A(Be, {
@@ -2837,14 +3216,14 @@ function ln({ label: e, placeholder: t, value: n, onChange: r }) {
2837
3216
  })]
2838
3217
  });
2839
3218
  }
2840
- function un({ title: e, description: t, action: n, onReset: r }) {
3219
+ function Ln({ title: e, description: t, action: n, onReset: r }) {
2841
3220
  return /* @__PURE__ */ j("div", {
2842
3221
  className: "la-observer-empty",
2843
3222
  children: [
2844
3223
  /* @__PURE__ */ A(w, { "aria-hidden": "true" }),
2845
3224
  /* @__PURE__ */ A("h3", { children: e }),
2846
3225
  /* @__PURE__ */ A("p", { children: t }),
2847
- n && /* @__PURE__ */ A(H, {
3226
+ n && /* @__PURE__ */ A(U, {
2848
3227
  type: "button",
2849
3228
  variant: "outline",
2850
3229
  onClick: r,
@@ -2853,26 +3232,26 @@ function un({ title: e, description: t, action: n, onReset: r }) {
2853
3232
  ]
2854
3233
  });
2855
3234
  }
2856
- function dn(e, t) {
3235
+ function Rn(e, t) {
2857
3236
  return e.toLocaleLowerCase().includes(t.trim().toLocaleLowerCase());
2858
3237
  }
2859
- function fn(e) {
3238
+ function zn(e) {
2860
3239
  return e[0].toUpperCase() + e.slice(1);
2861
3240
  }
2862
3241
  //#endregion
2863
3242
  //#region src/overview-data.ts
2864
- function pn(e) {
3243
+ function Bn(e) {
2865
3244
  let t = e.filter((e) => e.outcome !== "rerouted");
2866
3245
  return {
2867
3246
  count: e.length,
2868
3247
  success: t.length ? 100 * t.filter((e) => e.outcome === "completed").length / t.length : null,
2869
- p95: _n(t.map((e) => e.durationMs))
3248
+ p95: Wn(t.map((e) => e.durationMs))
2870
3249
  };
2871
3250
  }
2872
- function mn(e, t, n) {
3251
+ function Vn(e, t, n) {
2873
3252
  return e.filter((e) => e.startedAtMs >= (t.fromMs ?? 0) && e.startedAtMs <= (t.toMs ?? n));
2874
3253
  }
2875
- function hn(e) {
3254
+ function Hn(e) {
2876
3255
  return e.actors.reduce((e, t) => ({
2877
3256
  live: e.live + t.live,
2878
3257
  dormant: e.dormant + t.dormant,
@@ -2885,33 +3264,33 @@ function hn(e) {
2885
3264
  connections: 0
2886
3265
  });
2887
3266
  }
2888
- function gn(e) {
2889
- return _n(e.filter((e) => e.outcome !== "rerouted" && e.queueWaitMs !== null).map((e) => e.queueWaitMs));
3267
+ function Un(e) {
3268
+ return Wn(e.filter((e) => e.outcome !== "rerouted" && e.queueWaitMs !== null).map((e) => e.queueWaitMs));
2890
3269
  }
2891
- function _n(e) {
3270
+ function Wn(e) {
2892
3271
  return e.length ? e.sort((e, t) => e - t)[Math.ceil(e.length * .95) - 1] : null;
2893
3272
  }
2894
3273
  //#endregion
2895
3274
  //#region src/overview-metrics.ts
2896
- function vn(e) {
3275
+ function Gn(e) {
2897
3276
  let t = e;
2898
- if (!t || !yn(t.total) || !Array.isArray(t.classes) || !t.classes.every(yn)) throw Error("Invalid overview metrics response");
3277
+ if (!t || !Kn(t.total) || !Array.isArray(t.classes) || !t.classes.every(Kn)) throw Error("Invalid overview metrics response");
2899
3278
  return t;
2900
3279
  }
2901
- function yn(e) {
3280
+ function Kn(e) {
2902
3281
  return !!e && typeof e.actorName == "string" && Number.isSafeInteger(e.count) && e.count >= 0 && [
2903
3282
  e.success,
2904
3283
  e.p95,
2905
3284
  e.queueP95
2906
3285
  ].every((e) => e === null || typeof e == "number" && Number.isFinite(e) && e >= 0) && (e.success === null || e.success <= 100);
2907
3286
  }
2908
- function bn(e) {
3287
+ function qn(e) {
2909
3288
  let t = /* @__PURE__ */ new Map();
2910
3289
  for (let n of e) t.set(n.actorName, [...t.get(n.actorName) ?? [], n]);
2911
3290
  let n = (e, t) => ({
2912
3291
  actorName: e,
2913
- ...pn(t),
2914
- queueP95: gn(t)
3292
+ ...Bn(t),
3293
+ queueP95: Un(t)
2915
3294
  });
2916
3295
  return {
2917
3296
  total: n("", e),
@@ -2920,13 +3299,13 @@ function bn(e) {
2920
3299
  }
2921
3300
  //#endregion
2922
3301
  //#region src/Overview.tsx
2923
- function xn({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: i }) {
3302
+ function Jn({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: i }) {
2924
3303
  let a = xt(e), [s, c] = o(Ye), l = r ?? s, u = i ?? c, [d, f] = o(Date.now);
2925
3304
  t(() => {
2926
3305
  let e = setInterval(() => f(Date.now()), 1e4);
2927
3306
  return () => clearInterval(e);
2928
3307
  }, []);
2929
- let p = Xe(l, d), m = wt(e, p, e.getMetrics), h = St(e, !m.supported), g = h.page ? bn(mn(h.page.records, p, Math.max(d, Date.now()))) : void 0, _ = m.supported ? m.value : g, v = m.supported ? m.failed : h.failed;
3308
+ let p = W(l, d), m = wt(e, p, e.getMetrics), h = St(e, !m.supported), g = h.page ? qn(Vn(h.page.records, p, Math.max(d, Date.now()))) : void 0, _ = m.supported ? m.value : g, v = m.supported ? m.failed : h.failed;
2930
3309
  return /* @__PURE__ */ j("section", {
2931
3310
  className: "la-observer overview",
2932
3311
  "aria-label": "Runtime overview",
@@ -2948,7 +3327,7 @@ function xn({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: i })
2948
3327
  onChange: u,
2949
3328
  className: "overview-range"
2950
3329
  }),
2951
- /* @__PURE__ */ A(H, {
3330
+ /* @__PURE__ */ A(U, {
2952
3331
  variant: "outline",
2953
3332
  size: "icon",
2954
3333
  "aria-label": "Refresh overview",
@@ -2980,28 +3359,23 @@ function xn({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: i })
2980
3359
  "Retrying automatically."
2981
3360
  ]
2982
3361
  }),
2983
- /* @__PURE__ */ A(Sn, {
3362
+ /* @__PURE__ */ A(Yn, {
2984
3363
  inventory: a.inventory,
2985
3364
  metrics: _,
2986
3365
  range: l
2987
3366
  }),
2988
- /* @__PURE__ */ A(se, { inventory: a.inventory }),
2989
- /* @__PURE__ */ A(Cn, {
3367
+ /* @__PURE__ */ A(oe, { inventory: a.inventory }),
3368
+ /* @__PURE__ */ A(Xn, {
2990
3369
  inventory: a.inventory,
2991
- metrics: _,
2992
3370
  failed: a.failed,
2993
3371
  onSelectActor: n
2994
3372
  }),
2995
- /* @__PURE__ */ A(Dn, {
2996
- page: m.supported ? void 0 : h.page,
2997
- range: l,
2998
- saved: m.supported
2999
- })
3373
+ /* @__PURE__ */ A(Qn, { page: m.supported ? void 0 : h.page })
3000
3374
  ]
3001
3375
  });
3002
3376
  }
3003
- function Sn({ inventory: e, metrics: t, range: n }) {
3004
- let r = e ? hn(e) : void 0, i = r ? r.live + r.dormant + r.unknown : void 0, a = t?.total;
3377
+ function Yn({ inventory: e, metrics: t, range: n }) {
3378
+ let r = e ? Hn(e) : void 0, i = r ? r.live + r.dormant + r.unknown : void 0, a = t?.total;
3005
3379
  return /* @__PURE__ */ j("div", {
3006
3380
  className: "overview-metrics",
3007
3381
  children: [
@@ -3013,7 +3387,7 @@ function Sn({ inventory: e, metrics: t, range: n }) {
3013
3387
  className: "overview-value",
3014
3388
  children: [/* @__PURE__ */ A("strong", {
3015
3389
  "aria-label": "Actor instances",
3016
- children: Q(i)
3390
+ children: $n(i)
3017
3391
  }), /* @__PURE__ */ A("span", { children: e ? `${e.actors.length} actor ${e.actors.length === 1 ? "class" : "classes"}` : "Waiting for inventory" })]
3018
3392
  }),
3019
3393
  /* @__PURE__ */ A("div", {
@@ -3027,9 +3401,9 @@ function Sn({ inventory: e, metrics: t, range: n }) {
3027
3401
  /* @__PURE__ */ j("div", {
3028
3402
  className: "overview-metric-foot",
3029
3403
  children: [
3030
- /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: Q(r?.live) }), " live"] }),
3031
- /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: Q(r?.dormant) }), " dormant"] }),
3032
- !!r?.unknown && /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: Q(r.unknown) }), " unknown"] })
3404
+ /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: $n(r?.live) }), " live"] }),
3405
+ /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: $n(r?.dormant) }), " dormant"] }),
3406
+ !!r?.unknown && /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: $n(r.unknown) }), " unknown"] })
3033
3407
  ]
3034
3408
  })
3035
3409
  ]
@@ -3042,21 +3416,21 @@ function Sn({ inventory: e, metrics: t, range: n }) {
3042
3416
  className: "overview-value",
3043
3417
  children: [/* @__PURE__ */ A("strong", {
3044
3418
  "aria-label": "Retained requests",
3045
- children: Q(a?.count)
3046
- }), /* @__PURE__ */ A("span", { children: U(n) })]
3419
+ children: $n(a?.count)
3420
+ }), /* @__PURE__ */ A("span", { children: Ze(n) })]
3047
3421
  }),
3048
3422
  /* @__PURE__ */ j("div", {
3049
3423
  className: "overview-health",
3050
3424
  children: [
3051
- /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A(Tn, {
3425
+ /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A(Zn, {
3052
3426
  value: a?.success,
3053
3427
  kind: "success"
3054
3428
  }), " success"] }),
3055
- /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A(Tn, {
3429
+ /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A(Zn, {
3056
3430
  value: a?.p95,
3057
3431
  kind: "latency"
3058
3432
  }), " p95 latency"] }),
3059
- /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: kn(a?.queueP95) }), " p95 queue wait"] })
3433
+ /* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: er(a?.queueP95) }), " p95 queue wait"] })
3060
3434
  ]
3061
3435
  })
3062
3436
  ]
@@ -3069,7 +3443,7 @@ function Sn({ inventory: e, metrics: t, range: n }) {
3069
3443
  className: "overview-value",
3070
3444
  children: [/* @__PURE__ */ A("strong", {
3071
3445
  "aria-label": "Open WebSocket connections",
3072
- children: Q(r?.connections)
3446
+ children: $n(r?.connections)
3073
3447
  }), /* @__PURE__ */ A("span", { children: "open" })]
3074
3448
  }),
3075
3449
  /* @__PURE__ */ j("div", {
@@ -3081,167 +3455,29 @@ function Sn({ inventory: e, metrics: t, range: n }) {
3081
3455
  ]
3082
3456
  });
3083
3457
  }
3084
- function Cn({ inventory: e, metrics: t, failed: n, onSelectActor: r }) {
3085
- let [i, a] = o(""), [s, c] = o("all"), l = e?.actors.filter((e) => e.actorName.toLocaleLowerCase().includes(i.trim().toLocaleLowerCase()) && (s === "all" || e[s] > 0)).sort((e, t) => Number(t.live > 0) - Number(e.live > 0)) ?? [];
3458
+ function Xn({ inventory: e, failed: t, onSelectActor: n }) {
3086
3459
  return /* @__PURE__ */ j("section", {
3087
- "aria-label": "Actor classes",
3088
- children: [/* @__PURE__ */ j("div", {
3460
+ "aria-label": "Actor types",
3461
+ children: [/* @__PURE__ */ A("div", {
3089
3462
  className: "overview-section-heading",
3090
- children: [/* @__PURE__ */ j("h2", { children: ["Actor classes ", /* @__PURE__ */ A("span", { children: Q(e?.actors.length) })] }), /* @__PURE__ */ A(En, {})]
3091
- }), /* @__PURE__ */ j("div", {
3092
- className: "overview-panel",
3093
- children: [
3094
- /* @__PURE__ */ j("div", {
3095
- className: "overview-filterbar",
3096
- children: [/* @__PURE__ */ j("div", {
3097
- className: "overview-search",
3098
- children: [/* @__PURE__ */ A(w, { "aria-hidden": "true" }), /* @__PURE__ */ A(Be, {
3099
- "aria-label": "Filter actor classes",
3100
- placeholder: "Filter actor classes…",
3101
- value: i,
3102
- onInput: (e) => a(e.currentTarget.value)
3103
- })]
3104
- }), /* @__PURE__ */ j(vt, {
3105
- "aria-label": "Filter by residency",
3106
- size: "sm",
3107
- value: s,
3108
- onChange: (e) => c(e.target.value),
3109
- children: [
3110
- /* @__PURE__ */ A(G, {
3111
- value: "all",
3112
- children: "All states"
3113
- }),
3114
- /* @__PURE__ */ A(G, {
3115
- value: "live",
3116
- children: "Live instances"
3117
- }),
3118
- /* @__PURE__ */ A(G, {
3119
- value: "dormant",
3120
- children: "Dormant instances"
3121
- }),
3122
- /* @__PURE__ */ A(G, {
3123
- value: "unknown",
3124
- children: "Unknown residency"
3125
- })
3126
- ]
3127
- })]
3128
- }),
3129
- /* @__PURE__ */ j(K, {
3130
- className: "overview-table",
3131
- "aria-label": "Actor class metrics",
3132
- containerProps: {
3133
- className: "overview-table-scroll",
3134
- role: "region",
3135
- "aria-label": "Actor class metrics",
3136
- tabIndex: 0
3137
- },
3138
- children: [
3139
- /* @__PURE__ */ j("colgroup", { children: [/* @__PURE__ */ A("col", { className: "overview-class-column" }), /* @__PURE__ */ A("col", { span: 6 })] }),
3140
- /* @__PURE__ */ j(q, { children: [/* @__PURE__ */ j(Y, {
3141
- className: "overview-groups",
3142
- children: [
3143
- /* @__PURE__ */ A(X, {
3144
- scope: "colgroup",
3145
- colSpan: 2,
3146
- children: "Actors"
3147
- }),
3148
- /* @__PURE__ */ A(X, {
3149
- scope: "colgroup",
3150
- colSpan: 4,
3151
- children: "Requests"
3152
- }),
3153
- /* @__PURE__ */ A(X, {
3154
- scope: "colgroup",
3155
- children: "WebSockets"
3156
- })
3157
- ]
3158
- }), /* @__PURE__ */ j(Y, { children: [
3159
- /* @__PURE__ */ A(X, {
3160
- scope: "col",
3161
- children: "Class"
3162
- }),
3163
- /* @__PURE__ */ A(X, {
3164
- scope: "col",
3165
- children: "Instances"
3166
- }),
3167
- /* @__PURE__ */ A(X, {
3168
- scope: "col",
3169
- children: "Total"
3170
- }),
3171
- /* @__PURE__ */ A(X, {
3172
- scope: "col",
3173
- children: "Success"
3174
- }),
3175
- /* @__PURE__ */ A(X, {
3176
- scope: "col",
3177
- children: "p95 latency"
3178
- }),
3179
- /* @__PURE__ */ A(X, {
3180
- scope: "col",
3181
- children: "p95 queue wait"
3182
- }),
3183
- /* @__PURE__ */ A(X, {
3184
- scope: "col",
3185
- children: "Connected"
3186
- })
3187
- ] })] }),
3188
- /* @__PURE__ */ A(J, { children: l.map((e) => /* @__PURE__ */ A(wn, {
3189
- actor: e,
3190
- metrics: t && (t.classes.find((t) => t.actorName === e.actorName) ?? On(e.actorName)),
3191
- onSelectActor: r
3192
- }, e.actorName)) })
3193
- ]
3194
- }),
3195
- !l.length && /* @__PURE__ */ j("div", {
3196
- className: "overview-empty",
3197
- role: "status",
3198
- children: [
3199
- /* @__PURE__ */ A("strong", { children: e ? e.actors.length ? "No matching actor classes" : "No actors yet" : n ? "Inventory unavailable" : "Loading actor classes…" }),
3200
- /* @__PURE__ */ A("p", { children: e?.actors.length ? "Try another class name or residency state." : "Actor classes appear after deployment." }),
3201
- !!e?.actors.length && /* @__PURE__ */ A(H, {
3202
- variant: "outline",
3203
- onClick: () => {
3204
- a(""), c("all");
3205
- },
3206
- children: "Clear filters"
3207
- })
3208
- ]
3209
- })
3210
- ]
3211
- })]
3212
- });
3213
- }
3214
- function wn({ actor: e, metrics: t, onSelectActor: n }) {
3215
- return /* @__PURE__ */ j(Y, {
3216
- className: "la-clickable-row",
3217
- onClick: () => n(e.actorName),
3218
- children: [
3219
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A(H, {
3463
+ children: /* @__PURE__ */ A("h2", { children: "Actor types" })
3464
+ }), e?.actors.length ? /* @__PURE__ */ A("ul", {
3465
+ className: "overview-actor-list",
3466
+ "aria-label": "Actor types",
3467
+ children: e.actors.map((e) => /* @__PURE__ */ A("li", { children: /* @__PURE__ */ A(U, {
3220
3468
  variant: "ghost",
3221
3469
  type: "button",
3222
- className: "overview-class-link",
3223
3470
  "aria-label": `Inspect ${e.actorName}`,
3224
- children: /* @__PURE__ */ A("span", {
3225
- title: e.actorName,
3226
- children: e.actorName
3227
- })
3228
- }) }),
3229
- /* @__PURE__ */ A(Z, { children: Q(e.live + e.dormant + e.unknown) }),
3230
- /* @__PURE__ */ A(Z, { children: Q(t?.count) }),
3231
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A(Tn, {
3232
- value: t?.success,
3233
- kind: "success"
3234
- }) }),
3235
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A(Tn, {
3236
- value: t?.p95,
3237
- kind: "latency"
3238
- }) }),
3239
- /* @__PURE__ */ A(Z, { children: kn(t?.queueP95) }),
3240
- /* @__PURE__ */ A(Z, { children: Q(e.instances.reduce((e, t) => e + t.connections.length, 0)) })
3241
- ]
3471
+ onClick: () => n(e.actorName),
3472
+ children: e.actorName
3473
+ }) }, e.actorName))
3474
+ }) : /* @__PURE__ */ A("p", {
3475
+ role: "status",
3476
+ children: e ? "No actor types deployed yet." : t ? "Inventory unavailable" : "Loading actor types…"
3477
+ })]
3242
3478
  });
3243
3479
  }
3244
- function Tn({ value: e, kind: t }) {
3480
+ function Zn({ value: e, kind: t }) {
3245
3481
  if (e == null) return /* @__PURE__ */ A("span", {
3246
3482
  title: "No retained execution attempts",
3247
3483
  children: "—"
@@ -3253,36 +3489,16 @@ function Tn({ value: e, kind: t }) {
3253
3489
  children: [n !== "good" && /* @__PURE__ */ A("span", {
3254
3490
  "aria-hidden": "true",
3255
3491
  children: n === "warn" ? "!" : "×"
3256
- }), t === "success" ? `${e.toLocaleString(void 0, { maximumFractionDigits: 2 })}%` : kn(e)]
3492
+ }), t === "success" ? `${e.toLocaleString(void 0, { maximumFractionDigits: 2 })}%` : er(e)]
3257
3493
  });
3258
3494
  }
3259
- function En() {
3260
- return /* @__PURE__ */ j("details", {
3261
- className: "overview-thresholds",
3262
- children: [/* @__PURE__ */ j("summary", { children: [/* @__PURE__ */ j("span", {
3263
- className: "threshold-dots",
3264
- "aria-hidden": "true",
3265
- children: [
3266
- /* @__PURE__ */ A("i", {}),
3267
- /* @__PURE__ */ A("i", {}),
3268
- /* @__PURE__ */ A("i", {})
3269
- ]
3270
- }), "Thresholds"] }), /* @__PURE__ */ j("div", { children: [
3271
- /* @__PURE__ */ A("strong", { children: "Display thresholds" }),
3272
- /* @__PURE__ */ A("p", { children: "Success: warning below 99%; critical below 95%." }),
3273
- /* @__PURE__ */ A("p", { children: "Latency: critical when p95 exceeds 100 ms." }),
3274
- /* @__PURE__ */ A("p", { children: "Reroutes are excluded from success and latency. Queue wait has no health threshold." })
3275
- ] })]
3276
- });
3277
- }
3278
- function Dn({ page: e, range: t, saved: n }) {
3279
- return /* @__PURE__ */ j("div", {
3495
+ function Qn({ page: e }) {
3496
+ return !e?.dropped && !e?.persistenceFailed && !e?.evicted ? null : /* @__PURE__ */ j("div", {
3280
3497
  className: "overview-data-scope",
3281
3498
  children: [
3282
- /* @__PURE__ */ A("p", { children: n ? `Request metrics cover every retained request ${U(t)}${t.kind === "relative" ? " (refreshed every 10 seconds)" : ""}. Inventory counts are current snapshots.` : `Request metrics cover the latest ${e?.capacity ?? 500} retained traces within the selected window. Inventory counts are current snapshots.` }),
3283
3499
  !!e?.dropped && /* @__PURE__ */ j("p", {
3284
3500
  role: "alert",
3285
- children: [Q(e.dropped), " traces were not delivered. Request metrics are incomplete."]
3501
+ children: [$n(e.dropped), " traces were not delivered. Request metrics are incomplete."]
3286
3502
  }),
3287
3503
  e?.persistenceFailed && /* @__PURE__ */ A("p", {
3288
3504
  role: "alert",
@@ -3292,344 +3508,150 @@ function Dn({ page: e, range: t, saved: n }) {
3292
3508
  ]
3293
3509
  });
3294
3510
  }
3295
- function On(e) {
3296
- return {
3297
- actorName: e,
3298
- count: 0,
3299
- success: null,
3300
- p95: null,
3301
- queueP95: null
3302
- };
3303
- }
3304
- function Q(e) {
3511
+ function $n(e) {
3305
3512
  return e === void 0 ? "—" : e.toLocaleString();
3306
3513
  }
3307
- function kn(e) {
3514
+ function er(e) {
3308
3515
  return e == null ? "—" : `${e.toLocaleString(void 0, { maximumFractionDigits: 1 })} ms`;
3309
3516
  }
3310
3517
  //#endregion
3311
- //#region src/socket-sessions.ts
3312
- function An(e) {
3313
- if (!Array.isArray(e) || !e.every((e) => !!e && typeof e == "object" && Rn(e))) throw Error("Invalid WebSocket session response");
3314
- return e;
3315
- }
3316
- function jn(e, t, n) {
3317
- return JSON.stringify([
3318
- e,
3319
- t,
3320
- n
3321
- ]);
3322
- }
3323
- function Mn(e, t, n = /* @__PURE__ */ new Map()) {
3324
- let r = /* @__PURE__ */ new Map();
3325
- for (let e of t?.actors ?? []) for (let t of e.instances) for (let n of t.connections) r.set(JSON.stringify([
3326
- e.actorName,
3327
- t.actorId,
3328
- n.id
3329
- ]), n.metadata);
3330
- let i = e.map((e) => {
3331
- let n = JSON.stringify([
3332
- e.actorName,
3333
- e.actorId,
3334
- e.connectionId
3335
- ]), i = e.closedAtMs === null ? r.has(n) ? "open" : t?.connectionsComplete === !1 ? "unknown" : "lost" : "closed";
3336
- return i === "open" ? {
3337
- ...e,
3338
- status: i,
3339
- metadata: r.get(n)
3340
- } : {
3341
- ...e,
3342
- status: i
3343
- };
3344
- }), a = new Set(i.map((e) => JSON.stringify([
3345
- e.actorName,
3346
- e.actorId,
3347
- e.connectionId
3348
- ])));
3349
- for (let e of t?.actors ?? []) for (let t of e.instances) for (let r of t.connections) {
3350
- let o = jn(e.actorName, t.actorId, r.id);
3351
- if (a.has(o)) continue;
3352
- let s = n.get(o);
3353
- i.unshift({
3354
- connectionId: r.id,
3355
- actorName: e.actorName,
3356
- actorId: t.actorId,
3357
- hostId: null,
3358
- openedAtMs: s ?? null,
3359
- estimatedStart: s !== void 0,
3360
- closedAtMs: null,
3361
- lastSeenMs: null,
3362
- messages: 0,
3363
- failures: 0,
3364
- status: "open",
3365
- metadata: r.metadata
3366
- });
3367
- }
3368
- return i;
3369
- }
3370
- function Nn(e, t) {
3371
- if (e.openedAtMs === null) return null;
3372
- let n = e.status === "closed" ? e.closedAtMs : e.status === "open" ? Math.max(t, e.openedAtMs) : e.lastSeenMs;
3373
- return {
3374
- ms: Math.max(0, n - e.openedAtMs),
3375
- lowerBound: e.status === "lost" || e.status === "unknown"
3376
- };
3377
- }
3378
- function Pn(e, t) {
3379
- let n = e.map((e) => Nn(e, t)).filter((e) => e !== null && !e.lowerBound), r = e.reduce((e, t) => e + t.messages, 0);
3380
- return {
3381
- total: e.length,
3382
- open: e.filter((e) => e.status === "open").length,
3383
- lost: e.filter((e) => e.status === "lost").length,
3384
- closed: e.filter((e) => e.status === "closed").length,
3385
- median: Ln(n.map((e) => e.ms), .5),
3386
- p95: Ln(n.map((e) => e.ms), .95),
3387
- messages: r,
3388
- messagesPerSession: e.length ? r / e.length : null
3389
- };
3390
- }
3391
- function Fn(e) {
3392
- if (e < 1e3) return `${e.toLocaleString(void 0, { maximumFractionDigits: 0 })} ms`;
3393
- if (e < 6e4) return `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 1 })} s`;
3394
- let t = Math.floor(e / 6e4);
3395
- if (t < 60) return `${t}m ${Math.floor(e % 6e4 / 1e3)}s`;
3396
- let n = Math.floor(t / 60);
3397
- return n < 24 ? `${n}h ${t % 60}m` : `${Math.floor(n / 24)}d ${n % 24}h`;
3398
- }
3399
- function In(e, t = 3) {
3400
- if (e == null) return null;
3401
- if (typeof e != "object") return String(e);
3402
- let n = Array.isArray(e) ? e.map((e, t) => [String(t), e]) : Object.entries(e);
3403
- if (!n.length) return null;
3404
- let r = n.slice(0, t).map(([e, t]) => `${e}: ${typeof t == "string" ? t : JSON.stringify(t)}`);
3405
- return n.length > t ? `${r.join(" · ")} · +${n.length - t}` : r.join(" · ");
3406
- }
3407
- function Ln(e, t) {
3408
- return e.length ? e.sort((e, t) => e - t)[Math.max(0, Math.ceil(e.length * t) - 1)] : null;
3409
- }
3410
- function Rn(e) {
3411
- return typeof e.connectionId == "string" && typeof e.actorName == "string" && typeof e.actorId == "string" && (e.hostId === null || typeof e.hostId == "string") && [
3412
- e.openedAtMs,
3413
- e.closedAtMs,
3414
- e.lastSeenMs
3415
- ].every((e) => e === null || Number.isSafeInteger(e) && Number(e) >= 0) && [e.messages, e.failures].every((e) => Number.isSafeInteger(e) && Number(e) >= 0) && (e.openedAtMs !== null || e.lastSeenMs !== null);
3416
- }
3417
- //#endregion
3418
3518
  //#region src/SocketTimeline.tsx
3419
- var zn = 18, Bn = 8, Vn = 40, $ = 6e4, Hn = 60 * $, Un = 24 * Hn, Wn = [
3420
- 1e3,
3421
- 2e3,
3422
- 5e3,
3423
- 1e4,
3424
- 15e3,
3425
- 3e4,
3426
- $,
3427
- 2 * $,
3428
- 5 * $,
3429
- 10 * $,
3430
- 15 * $,
3431
- 30 * $,
3432
- Hn,
3433
- 2 * Hn,
3434
- 3 * Hn,
3435
- 6 * Hn,
3436
- 12 * Hn,
3437
- Un,
3438
- 2 * Un,
3439
- 7 * Un
3440
- ];
3441
- function Gn({ sessions: e, start: t, end: n, endLabel: r = "now", selected: i, onSelect: a }) {
3442
- let [s, c] = o(), l = Jn(e, t, n), u = l.slice(0, Vn), d = Math.max(1, n - t), f = Qn(t, n), p = $n(d), m = (e) => `${(Math.min(Math.max(e, t), n) - t) / d * 100}%`, h = (e, t) => {
3443
- let n = t.getBoundingClientRect(), r = t.closest(".socket-timeline").getBoundingClientRect(), i = n.top - r.top < 150;
3444
- c({
3445
- session: e,
3446
- left: Math.min(Math.max(n.left - r.left + n.width / 2, 120), r.width - 120),
3447
- top: i ? n.bottom - r.top : n.top - r.top,
3448
- below: i
3449
- });
3450
- };
3451
- return /* @__PURE__ */ j("div", {
3452
- className: "socket-timeline",
3453
- role: "group",
3454
- "aria-label": "Connection timeline",
3455
- onMouseLeave: () => c(void 0),
3456
- children: [
3457
- /* @__PURE__ */ j("div", {
3458
- className: "socket-timeline-axis",
3459
- "aria-hidden": "true",
3460
- children: [/* @__PURE__ */ A("span", {}), /* @__PURE__ */ j("div", { children: [f.map((e) => /* @__PURE__ */ A("span", {
3461
- style: { left: m(e) },
3462
- children: er(e, p)
3463
- }, e)), /* @__PURE__ */ A("span", {
3464
- className: "socket-timeline-now",
3465
- children: r
3466
- })] })]
3467
- }),
3468
- /* @__PURE__ */ j("div", {
3469
- className: "socket-timeline-body",
3470
- children: [
3471
- /* @__PURE__ */ A("div", {
3472
- className: "socket-timeline-grid",
3473
- "aria-hidden": "true",
3474
- children: f.map((e) => /* @__PURE__ */ A("i", { style: { left: m(e) } }, e))
3475
- }),
3476
- u.map((e) => /* @__PURE__ */ j("div", {
3477
- className: "socket-timeline-row",
3478
- children: [/* @__PURE__ */ j("div", {
3479
- className: "socket-timeline-label",
3480
- title: `${e.actorName} / ${e.actorId}`,
3481
- children: [/* @__PURE__ */ A("span", { children: e.actorName }), /* @__PURE__ */ A("strong", { children: e.actorId })]
3482
- }), /* @__PURE__ */ A("div", {
3483
- className: "socket-timeline-lanes",
3484
- style: { height: e.rows.length * zn + 16 },
3485
- children: e.rows.flatMap((e, t) => e.map((e) => /* @__PURE__ */ A("button", {
3486
- type: "button",
3487
- className: `socket-bar socket-bar-${e.session.status}${e.openEnded ? " socket-bar-open-ended" : ""}${e.unknownStart ? " socket-bar-unknown-start" : ""}`,
3488
- "data-state": i === e.session ? "selected" : void 0,
3489
- style: {
3490
- left: m(e.from),
3491
- width: `${(e.to - e.from) / d * 100}%`,
3492
- top: Bn + t * zn
3493
- },
3494
- "aria-label": ir(e.session, n),
3495
- onClick: (t) => a(e.session, t.currentTarget),
3496
- onMouseEnter: (t) => h(e.session, t.currentTarget),
3497
- onFocus: (t) => h(e.session, t.currentTarget),
3498
- onBlur: () => c(void 0)
3499
- }, e.session.connectionId)))
3500
- })]
3501
- }, e.key)),
3502
- l.length > Vn && /* @__PURE__ */ j("p", {
3503
- className: "socket-timeline-more",
3504
- children: [
3505
- (l.length - Vn).toLocaleString(),
3506
- " more ",
3507
- l.length - Vn === 1 ? "instance is" : "instances are",
3508
- " listed in the table below."
3509
- ]
3510
- })
3511
- ]
3512
- }),
3513
- s && /* @__PURE__ */ j("div", {
3514
- role: "tooltip",
3515
- className: `socket-tooltip${s.below ? " socket-tooltip-below" : ""}`,
3516
- style: {
3517
- left: s.left,
3518
- top: s.top
3519
- },
3520
- children: [/* @__PURE__ */ A(qn, { metadata: s.session.metadata }), /* @__PURE__ */ j("dl", { children: [
3521
- /* @__PURE__ */ A("dt", { children: "Connection" }),
3522
- /* @__PURE__ */ A("dd", { children: rr(s.session.connectionId) }),
3523
- /* @__PURE__ */ A("dt", { children: "Instance" }),
3524
- /* @__PURE__ */ j("dd", { children: [
3525
- s.session.actorName,
3526
- " / ",
3527
- s.session.actorId
3528
- ] }),
3529
- /* @__PURE__ */ A("dt", { children: "Status" }),
3530
- /* @__PURE__ */ A("dd", { children: tr(s.session.status) }),
3531
- /* @__PURE__ */ A("dt", { children: "Opened" }),
3532
- /* @__PURE__ */ A("dd", { children: s.session.openedAtMs === null ? "Before retained history" : `${s.session.estimatedStart ? "≈ " : ""}${new Date(s.session.openedAtMs).toLocaleTimeString([], { hour12: !1 })}` }),
3533
- /* @__PURE__ */ A("dt", { children: "Duration" }),
3534
- /* @__PURE__ */ A("dd", { children: nr(s.session, n) }),
3535
- /* @__PURE__ */ A("dt", { children: "Messages" }),
3536
- /* @__PURE__ */ A("dd", { children: s.session.messages.toLocaleString() })
3537
- ] })]
3538
- })
3539
- ]
3519
+ var tr = 40;
3520
+ function nr({ sessions: e, start: t, end: n, endLabel: r = "now", selected: i, onSelect: a }) {
3521
+ let { hover: o, show: s, hide: c } = Pt(), l = ar(e, t, n), u = l.slice(0, tr);
3522
+ return /* @__PURE__ */ A(jt, {
3523
+ start: t,
3524
+ end: n,
3525
+ endLabel: r,
3526
+ label: "Connection timeline",
3527
+ onMouseLeave: c,
3528
+ footer: l.length > tr && /* @__PURE__ */ j("p", {
3529
+ className: "socket-timeline-more",
3530
+ children: [
3531
+ (l.length - tr).toLocaleString(),
3532
+ " more ",
3533
+ l.length - tr === 1 ? "instance is" : "instances are",
3534
+ " listed in the table below."
3535
+ ]
3536
+ }),
3537
+ overlay: o && /* @__PURE__ */ j("div", {
3538
+ role: "tooltip",
3539
+ className: `socket-tooltip${o.below ? " socket-tooltip-below" : ""}`,
3540
+ style: {
3541
+ left: o.left,
3542
+ top: o.top
3543
+ },
3544
+ children: [/* @__PURE__ */ A(ir, { metadata: o.item.metadata }), /* @__PURE__ */ j("dl", { children: [
3545
+ /* @__PURE__ */ A("dt", { children: "Connection" }),
3546
+ /* @__PURE__ */ A("dd", { children: dr(o.item.connectionId) }),
3547
+ /* @__PURE__ */ A("dt", { children: "Instance" }),
3548
+ /* @__PURE__ */ j("dd", { children: [
3549
+ o.item.actorName,
3550
+ " / ",
3551
+ o.item.actorId
3552
+ ] }),
3553
+ /* @__PURE__ */ A("dt", { children: "Status" }),
3554
+ /* @__PURE__ */ A("dd", { children: lr(o.item.status) }),
3555
+ /* @__PURE__ */ A("dt", { children: "Opened" }),
3556
+ /* @__PURE__ */ A("dd", { children: o.item.openedAtMs === null ? "Before retained history" : `${o.item.estimatedStart ? "≈ " : ""}${new Date(o.item.openedAtMs).toLocaleTimeString([], { hour12: !1 })}` }),
3557
+ /* @__PURE__ */ A("dt", { children: "Duration" }),
3558
+ /* @__PURE__ */ A("dd", { children: ur(o.item, n) }),
3559
+ /* @__PURE__ */ A("dt", { children: "Messages" }),
3560
+ /* @__PURE__ */ A("dd", { children: o.item.messages.toLocaleString() })
3561
+ ] })]
3562
+ }),
3563
+ children: (e) => u.map((t) => /* @__PURE__ */ A(Mt, {
3564
+ actorName: t.actorName,
3565
+ actorId: t.actorId,
3566
+ tracks: t.rows.length,
3567
+ children: t.rows.flatMap((t, r) => t.map((t) => /* @__PURE__ */ A(Nt, {
3568
+ scale: e,
3569
+ from: t.from,
3570
+ to: t.to,
3571
+ track: r,
3572
+ className: `socket-bar-${t.session.status}${t.openEnded ? " socket-bar-open-ended" : ""}${t.unknownStart ? " socket-bar-unknown-start" : ""}`,
3573
+ "data-state": i === t.session ? "selected" : void 0,
3574
+ "aria-label": fr(t.session, n),
3575
+ onClick: (e) => a(t.session, e.currentTarget),
3576
+ onMouseEnter: (e) => s(t.session, e.currentTarget),
3577
+ onFocus: (e) => s(t.session, e.currentTarget),
3578
+ onBlur: c
3579
+ }, t.session.connectionId)))
3580
+ }, t.key))
3540
3581
  });
3541
3582
  }
3542
- var Kn = 4;
3543
- function qn({ metadata: e }) {
3583
+ var rr = 4;
3584
+ function ir({ metadata: e }) {
3544
3585
  if (e == null) return null;
3545
3586
  let t = typeof e == "object" ? Array.isArray(e) ? e.map((e, t) => [String(t), e]) : Object.entries(e) : [["value", e]];
3546
3587
  return t.length ? /* @__PURE__ */ j("dl", {
3547
3588
  className: "socket-tooltip-metadata",
3548
3589
  "aria-label": "Connection metadata",
3549
- children: [t.slice(0, Kn).map(([e, t]) => /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: e }), /* @__PURE__ */ A("dd", { children: typeof t == "string" ? t : JSON.stringify(t) })] }, e)), t.length > Kn && /* @__PURE__ */ j("p", { children: [
3590
+ children: [t.slice(0, rr).map(([e, t]) => /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: e }), /* @__PURE__ */ A("dd", { children: typeof t == "string" ? t : JSON.stringify(t) })] }, e)), t.length > rr && /* @__PURE__ */ j("p", { children: [
3550
3591
  "+",
3551
- t.length - Kn,
3592
+ t.length - rr,
3552
3593
  " more in details"
3553
3594
  ] })]
3554
3595
  }) : null;
3555
3596
  }
3556
- function Jn(e, t, n) {
3557
- let r = /* @__PURE__ */ new Map(), i = e.map((e) => Yn(e, t, n)).filter((e) => e.to > t).sort((e, t) => e.from - t.from || e.to - t.to);
3597
+ function ar(e, t, n) {
3598
+ let r = /* @__PURE__ */ new Map(), i = e.map((e) => or(e, t, n)).filter((e) => e.to > t).sort((e, t) => e.from - t.from || e.to - t.to);
3558
3599
  for (let e of i) {
3559
- let i = `${e.session.actorName}${e.session.actorId}`, a = r.get(i) ?? {
3600
+ let i = `${e.session.actorName}\u0000${e.session.actorId}`, a = r.get(i) ?? {
3560
3601
  key: i,
3561
3602
  actorName: e.session.actorName,
3562
3603
  actorId: e.session.actorId,
3563
3604
  rows: []
3564
3605
  };
3565
3606
  r.set(i, a);
3566
- let o = a.rows.find((r) => r.at(-1).to + Xn(t, n) <= e.from);
3607
+ let o = a.rows.find((r) => r.at(-1).to + sr(t, n) <= e.from);
3567
3608
  o ? o.push(e) : a.rows.push([e]);
3568
3609
  }
3569
- return [...r.values()].sort((e, t) => Zn(t) - Zn(e));
3610
+ return [...r.values()].sort((e, t) => cr(t) - cr(e));
3570
3611
  }
3571
- function Yn(e, t, n) {
3612
+ function or(e, t, n) {
3572
3613
  let r = e.openedAtMs ?? (e.status === "open" ? t : e.lastSeenMs ?? t), i = e.status === "closed" ? e.closedAtMs : e.status === "open" ? n : e.lastSeenMs ?? r;
3573
3614
  return {
3574
3615
  session: e,
3575
3616
  from: Math.max(t, r),
3576
- to: Math.max(Math.max(t, r) + Xn(t, n), Math.min(n, i)),
3617
+ to: Math.max(Math.max(t, r) + sr(t, n), Math.min(n, i)),
3577
3618
  openEnded: e.status !== "closed",
3578
3619
  unknownStart: e.openedAtMs === null
3579
3620
  };
3580
3621
  }
3581
- function Xn(e, t) {
3622
+ function sr(e, t) {
3582
3623
  return Math.max(1, (t - e) / 160);
3583
3624
  }
3584
- function Zn(e) {
3625
+ function cr(e) {
3585
3626
  return Math.max(...e.rows.flat().map((e) => e.to));
3586
3627
  }
3587
- function Qn(e, t) {
3588
- let n = $n(Math.max(1, t - e)), r = [];
3589
- for (let i = Math.floor(e / n) * n + n; i < t - n * .35; i += n) r.push(i);
3590
- return r;
3591
- }
3592
- function $n(e) {
3593
- return Wn.find((t) => e / t <= 9) ?? Wn.at(-1);
3594
- }
3595
- function er(e, t) {
3596
- let n = new Date(e);
3597
- return t >= Un ? n.toLocaleDateString([], {
3598
- month: "short",
3599
- day: "numeric"
3600
- }) : t >= $ ? n.toLocaleTimeString([], {
3601
- hour: "2-digit",
3602
- minute: "2-digit",
3603
- hour12: !1
3604
- }) : n.toLocaleTimeString([], { hour12: !1 });
3605
- }
3606
- function tr(e) {
3628
+ function lr(e) {
3607
3629
  return e === "open" ? "Open" : e === "closed" ? "Closed" : e === "unknown" ? "Unknown" : "Lost";
3608
3630
  }
3609
- function nr(e, t) {
3610
- let n = Nn(e, t);
3611
- return n ? `${n.lowerBound ? "≥ " : ""}${Fn(n.ms)}` : "Unknown";
3631
+ function ur(e, t) {
3632
+ let n = Gt(e, t);
3633
+ return n ? `${n.lowerBound ? "≥ " : ""}${qt(n.ms)}` : "Unknown";
3612
3634
  }
3613
- function rr(e) {
3635
+ function dr(e) {
3614
3636
  return e.length > 14 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e;
3615
3637
  }
3616
- function ir(e, t) {
3617
- let n = In(e.metadata);
3618
- return `${tr(e.status)} connection ${rr(e.connectionId)}${n === null ? "" : ` (${n})`} on ${e.actorName} ${e.actorId}, ${nr(e, t)}`;
3638
+ function fr(e, t) {
3639
+ let n = Jt(e.metadata);
3640
+ return `${lr(e.status)} connection ${dr(e.connectionId)}${n === null ? "" : ` (${n})`} on ${e.actorName} ${e.actorId}, ${ur(e, t)}`;
3619
3641
  }
3620
3642
  //#endregion
3621
3643
  //#region src/components/ui/sheet.tsx
3622
- var ar = ae.Root, or = ae.Title, sr = ae.Description;
3623
- function cr({ className: e, children: t, container: n, ...r }) {
3624
- return /* @__PURE__ */ j(ae.Portal, {
3644
+ var pr = B.Root, mr = B.Title, hr = B.Description;
3645
+ function gr({ className: e, children: t, container: n, ...r }) {
3646
+ return /* @__PURE__ */ j(B.Portal, {
3625
3647
  container: n,
3626
- children: [/* @__PURE__ */ A(ae.Overlay, { className: "la-sheet-overlay" }), /* @__PURE__ */ j(ae.Content, {
3648
+ children: [/* @__PURE__ */ A(B.Overlay, { className: "la-sheet-overlay" }), /* @__PURE__ */ j(B.Content, {
3627
3649
  "data-slot": "sheet-content",
3628
- className: B("la-observer la-sheet", e),
3650
+ className: V("la-observer la-sheet", e),
3629
3651
  ...r,
3630
- children: [t, /* @__PURE__ */ A(ae.Close, {
3652
+ children: [t, /* @__PURE__ */ A(B.Close, {
3631
3653
  asChild: !0,
3632
- children: /* @__PURE__ */ A(H, {
3654
+ children: /* @__PURE__ */ A(U, {
3633
3655
  className: "la-sheet-close",
3634
3656
  variant: "ghost",
3635
3657
  size: "icon",
@@ -3642,7 +3664,7 @@ function cr({ className: e, children: t, container: n, ...r }) {
3642
3664
  }
3643
3665
  //#endregion
3644
3666
  //#region src/socket-history.ts
3645
- function lr(e, t) {
3667
+ function _r(e, t) {
3646
3668
  let n = wt(e, t, e.listWebSockets, 5e3);
3647
3669
  return {
3648
3670
  ...n,
@@ -3652,17 +3674,17 @@ function lr(e, t) {
3652
3674
  }
3653
3675
  //#endregion
3654
3676
  //#region src/WebSocketObserver.tsx
3655
- function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s }) {
3677
+ function vr({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s }) {
3656
3678
  let { inventory: c, failed: l, retry: u } = xt(e), [d, f] = o(Ye), p = r ?? d, m = s ?? f, [h, g] = o(Date.now), [_, v] = o(""), [y, b] = o("all"), [x, S] = o(), C = a(null), w = a(null);
3657
3679
  t(() => {
3658
3680
  let e = setInterval(() => g(Date.now()), 5e3);
3659
3681
  return () => clearInterval(e);
3660
3682
  }, []);
3661
- let T = Xe(p, h), E = T.toMs ?? h, D = lr(e, T), O = hr(c, D.retry), M = i(() => Mn(D.rows ?? [], c, O), [
3683
+ let T = W(p, h), E = T.toMs ?? h, D = _r(e, T), O = Cr(c, D.retry), M = i(() => Wt(D.rows ?? [], c, O), [
3662
3684
  D.rows,
3663
3685
  c,
3664
3686
  O
3665
- ]), N = !!c || l, P = _.trim().toLocaleLowerCase(), F = M.filter((e) => (y === "all" || e.status === y) && (!P || `${e.connectionId} ${e.actorName} ${e.actorId} ${e.hostId ?? ""}`.toLocaleLowerCase().includes(P))).sort((e, t) => Number(t.status === "open") - Number(e.status === "open") || (t.openedAtMs ?? t.lastSeenMs ?? Infinity) - (e.openedAtMs ?? e.lastSeenMs ?? Infinity)), I = Pn(M, h), te = Math.max(0, ...M.filter((e) => e.status !== "open").map((e) => Nn(e, h)?.ms ?? 0)) || I.p95, L = mr(F, T.fromMs, E), R = i(() => gr(M, c), [M, c]);
3687
+ ]), N = !!c || l, P = _.trim().toLocaleLowerCase(), F = M.filter((e) => (y === "all" || e.status === y) && (!P || `${e.connectionId} ${e.actorName} ${e.actorId} ${e.hostId ?? ""}`.toLocaleLowerCase().includes(P))).sort((e, t) => Number(t.status === "open") - Number(e.status === "open") || (t.openedAtMs ?? t.lastSeenMs ?? Infinity) - (e.openedAtMs ?? e.lastSeenMs ?? Infinity)), I = Kt(M, h), te = Math.max(0, ...M.filter((e) => e.status !== "open").map((e) => Gt(e, h)?.ms ?? 0)) || I.p95, L = Sr(F, T.fromMs, E), R = i(() => wr(M, c), [M, c]);
3666
3688
  return t(() => S(void 0), [e, p]), /* @__PURE__ */ j("section", {
3667
3689
  ref: C,
3668
3690
  className: "la-observer overview websockets",
@@ -3670,7 +3692,7 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3670
3692
  children: [
3671
3693
  /* @__PURE__ */ j("div", {
3672
3694
  className: "overview-heading",
3673
- children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("h1", { children: "WebSockets" }), /* @__PURE__ */ A("p", { children: N ? `${I.open.toLocaleString()} open now${D.supported ? ` · ${I.total.toLocaleString()} ${I.total === 1 ? "session" : "sessions"} ${U(p)}` : ""}` : "Connecting to inventory…" })] }), /* @__PURE__ */ j("div", {
3695
+ children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("h1", { children: "WebSockets" }), /* @__PURE__ */ A("p", { children: N ? `${I.open.toLocaleString()} open now${D.supported ? ` · ${I.total.toLocaleString()} ${I.total === 1 ? "session" : "sessions"} ${Ze(p)}` : ""}` : "Connecting to inventory…" })] }), /* @__PURE__ */ j("div", {
3674
3696
  className: "overview-controls",
3675
3697
  children: [
3676
3698
  /* @__PURE__ */ A("span", {
@@ -3685,7 +3707,7 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3685
3707
  onChange: m,
3686
3708
  className: "overview-range"
3687
3709
  }),
3688
- /* @__PURE__ */ A(H, {
3710
+ /* @__PURE__ */ A(U, {
3689
3711
  variant: "outline",
3690
3712
  size: "icon",
3691
3713
  "aria-label": "Refresh connections",
@@ -3716,16 +3738,16 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3716
3738
  " Retrying automatically."
3717
3739
  ]
3718
3740
  }),
3719
- /* @__PURE__ */ A(dr, {
3741
+ /* @__PURE__ */ A(yr, {
3720
3742
  summary: I,
3721
3743
  ready: N,
3722
3744
  history: D.supported && !!D.rows,
3723
3745
  range: p
3724
3746
  }),
3725
- /* @__PURE__ */ A(se, { inventory: c }),
3747
+ /* @__PURE__ */ A(oe, { inventory: c }),
3726
3748
  /* @__PURE__ */ j("div", {
3727
3749
  className: "socket-filterbar",
3728
- children: [/* @__PURE__ */ A(_e, {
3750
+ children: [/* @__PURE__ */ A(ge, {
3729
3751
  label: "Filter connections",
3730
3752
  placeholder: "Filter by connection, actor, instance, or host…",
3731
3753
  value: _,
@@ -3737,23 +3759,23 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3737
3759
  value: y,
3738
3760
  onChange: (e) => b(e.target.value),
3739
3761
  children: [
3740
- /* @__PURE__ */ A(G, {
3762
+ /* @__PURE__ */ A(K, {
3741
3763
  value: "all",
3742
3764
  children: "All statuses"
3743
3765
  }),
3744
- /* @__PURE__ */ A(G, {
3766
+ /* @__PURE__ */ A(K, {
3745
3767
  value: "open",
3746
3768
  children: "Open"
3747
3769
  }),
3748
- /* @__PURE__ */ A(G, {
3770
+ /* @__PURE__ */ A(K, {
3749
3771
  value: "closed",
3750
3772
  children: "Closed"
3751
3773
  }),
3752
- /* @__PURE__ */ A(G, {
3774
+ /* @__PURE__ */ A(K, {
3753
3775
  value: "lost",
3754
3776
  children: "Lost"
3755
3777
  }),
3756
- /* @__PURE__ */ A(G, {
3778
+ /* @__PURE__ */ A(K, {
3757
3779
  value: "unknown",
3758
3780
  children: "Unknown"
3759
3781
  })
@@ -3774,7 +3796,7 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3774
3796
  /* @__PURE__ */ j("li", { children: [/* @__PURE__ */ A("i", { className: "socket-swatch socket-swatch-lost" }), " Lost · no disconnect recorded"] })
3775
3797
  ]
3776
3798
  })]
3777
- }), F.length ? /* @__PURE__ */ A(Gn, {
3799
+ }), F.length ? /* @__PURE__ */ A(nr, {
3778
3800
  sessions: F,
3779
3801
  start: L,
3780
3802
  end: E,
@@ -3790,12 +3812,12 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3790
3812
  }) : /* @__PURE__ */ j("div", {
3791
3813
  className: "overview-empty socket-timeline-empty",
3792
3814
  role: "status",
3793
- children: [/* @__PURE__ */ A("strong", { children: _r(N, D, M.length) }), /* @__PURE__ */ A("p", { children: M.length ? "Try another filter or a wider time window." : "Sessions appear here as clients connect to actors." })]
3815
+ children: [/* @__PURE__ */ A("strong", { children: Tr(N, D, M.length) }), /* @__PURE__ */ A("p", { children: M.length ? "Try another filter or a wider time window." : "Sessions appear here as clients connect to actors." })]
3794
3816
  })]
3795
3817
  }),
3796
3818
  /* @__PURE__ */ j("div", {
3797
3819
  className: "overview-panel",
3798
- children: [/* @__PURE__ */ j(K, {
3820
+ children: [/* @__PURE__ */ j(q, {
3799
3821
  className: "overview-table socket-table",
3800
3822
  "aria-label": "WebSocket connections",
3801
3823
  containerProps: {
@@ -3804,40 +3826,40 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3804
3826
  "aria-label": "WebSocket connections",
3805
3827
  tabIndex: 0
3806
3828
  },
3807
- children: [/* @__PURE__ */ A(q, { children: /* @__PURE__ */ j(Y, { children: [
3808
- /* @__PURE__ */ A(X, {
3829
+ children: [/* @__PURE__ */ A(J, { children: /* @__PURE__ */ j(X, { children: [
3830
+ /* @__PURE__ */ A(Z, {
3809
3831
  scope: "col",
3810
3832
  children: "Status"
3811
3833
  }),
3812
- /* @__PURE__ */ A(X, {
3834
+ /* @__PURE__ */ A(Z, {
3813
3835
  scope: "col",
3814
3836
  children: "Connection"
3815
3837
  }),
3816
- /* @__PURE__ */ A(X, {
3838
+ /* @__PURE__ */ A(Z, {
3817
3839
  scope: "col",
3818
3840
  children: "Actor class"
3819
3841
  }),
3820
- /* @__PURE__ */ A(X, {
3842
+ /* @__PURE__ */ A(Z, {
3821
3843
  scope: "col",
3822
3844
  children: "Instance"
3823
3845
  }),
3824
- /* @__PURE__ */ A(X, {
3846
+ /* @__PURE__ */ A(Z, {
3825
3847
  scope: "col",
3826
3848
  children: "Opened"
3827
3849
  }),
3828
- /* @__PURE__ */ A(X, {
3850
+ /* @__PURE__ */ A(Z, {
3829
3851
  scope: "col",
3830
3852
  children: "Duration"
3831
3853
  }),
3832
- /* @__PURE__ */ A(X, {
3854
+ /* @__PURE__ */ A(Z, {
3833
3855
  scope: "col",
3834
3856
  children: "Messages"
3835
3857
  }),
3836
- /* @__PURE__ */ A(X, {
3858
+ /* @__PURE__ */ A(Z, {
3837
3859
  scope: "col",
3838
3860
  children: "Metadata"
3839
3861
  })
3840
- ] }) }), /* @__PURE__ */ A(J, { children: F.map((e) => /* @__PURE__ */ A(fr, {
3862
+ ] }) }), /* @__PURE__ */ A(Y, { children: F.map((e) => /* @__PURE__ */ A(br, {
3841
3863
  session: e,
3842
3864
  now: h,
3843
3865
  longest: te,
@@ -3854,9 +3876,9 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3854
3876
  className: "overview-empty",
3855
3877
  role: "status",
3856
3878
  children: [
3857
- /* @__PURE__ */ A("strong", { children: _r(N, D, M.length) }),
3879
+ /* @__PURE__ */ A("strong", { children: Tr(N, D, M.length) }),
3858
3880
  /* @__PURE__ */ A("p", { children: M.length ? "Try another connection, actor, or status." : "Open an actor WebSocket to see its connection and metadata here." }),
3859
- !!M.length && /* @__PURE__ */ A(H, {
3881
+ !!M.length && /* @__PURE__ */ A(U, {
3860
3882
  variant: "outline",
3861
3883
  onClick: () => {
3862
3884
  v(""), b("all");
@@ -3870,20 +3892,20 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3870
3892
  className: "overview-data-scope",
3871
3893
  children: /* @__PURE__ */ A("p", { children: D.supported ? `Sessions pair each connection’s onConnect and onDisconnect events from retained request history${D.capped ? "; only the 500 most recent sessions are shown" : ""}. Open connections follow the latest host report. Lost connections have no recorded disconnect and are no longer reported by a host, so their duration is a lower bound.` : "Connections are active WebSockets, not unique people. Counts follow the latest host report." })
3872
3894
  }),
3873
- /* @__PURE__ */ A(ar, {
3895
+ /* @__PURE__ */ A(pr, {
3874
3896
  open: !!x,
3875
3897
  onOpenChange: (e) => {
3876
3898
  e || S(void 0);
3877
3899
  },
3878
- children: /* @__PURE__ */ j(cr, {
3900
+ children: /* @__PURE__ */ j(gr, {
3879
3901
  container: C.current,
3880
3902
  onCloseAutoFocus: (e) => {
3881
3903
  e.preventDefault(), w.current?.focus();
3882
3904
  },
3883
3905
  children: [
3884
- /* @__PURE__ */ A(or, { children: "Connection details" }),
3885
- /* @__PURE__ */ A(sr, { children: "Identifiers, timings, and metadata for this WebSocket." }),
3886
- x && /* @__PURE__ */ A(pr, {
3906
+ /* @__PURE__ */ A(mr, { children: "Connection details" }),
3907
+ /* @__PURE__ */ A(hr, { children: "Identifiers, timings, and metadata for this WebSocket." }),
3908
+ x && /* @__PURE__ */ A(xr, {
3887
3909
  session: x,
3888
3910
  now: h,
3889
3911
  onSelectActor: n
@@ -3894,7 +3916,7 @@ function ur({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: s })
3894
3916
  ]
3895
3917
  });
3896
3918
  }
3897
- function dr({ summary: e, ready: t, history: n, range: r }) {
3919
+ function yr({ summary: e, ready: t, history: n, range: r }) {
3898
3920
  return /* @__PURE__ */ j("div", {
3899
3921
  className: "overview-metrics socket-metrics",
3900
3922
  children: [
@@ -3924,7 +3946,7 @@ function dr({ summary: e, ready: t, history: n, range: r }) {
3924
3946
  children: [/* @__PURE__ */ A("strong", {
3925
3947
  "aria-label": "WebSocket sessions",
3926
3948
  children: n ? e.total.toLocaleString() : "—"
3927
- }), /* @__PURE__ */ A("span", { children: r.kind === "absolute" ? Ze(r) : U(r) })]
3949
+ }), /* @__PURE__ */ A("span", { children: r.kind === "absolute" ? Xe(r) : Ze(r) })]
3928
3950
  }),
3929
3951
  /* @__PURE__ */ j("div", {
3930
3952
  className: "overview-metric-foot",
@@ -3940,12 +3962,12 @@ function dr({ summary: e, ready: t, history: n, range: r }) {
3940
3962
  className: "overview-value",
3941
3963
  children: [/* @__PURE__ */ A("strong", {
3942
3964
  "aria-label": "Median session duration",
3943
- children: n && e.median !== null ? Fn(e.median) : "—"
3965
+ children: n && e.median !== null ? qt(e.median) : "—"
3944
3966
  }), /* @__PURE__ */ A("span", { children: "median" })]
3945
3967
  }),
3946
3968
  /* @__PURE__ */ j("div", {
3947
3969
  className: "overview-metric-foot",
3948
- children: [/* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: n && e.p95 !== null ? Fn(e.p95) : "—" }), " p95"] }), /* @__PURE__ */ A("span", { children: "Open sessions count up to now" })]
3970
+ children: [/* @__PURE__ */ j("span", { children: [/* @__PURE__ */ A("b", { children: n && e.p95 !== null ? qt(e.p95) : "—" }), " p95"] }), /* @__PURE__ */ A("span", { children: "Open sessions count up to now" })]
3949
3971
  })
3950
3972
  ]
3951
3973
  }),
@@ -3969,36 +3991,36 @@ function dr({ summary: e, ready: t, history: n, range: r }) {
3969
3991
  ]
3970
3992
  });
3971
3993
  }
3972
- function fr({ session: e, now: t, longest: n, selected: r, onSelect: i }) {
3973
- let a = Nn(e, t), o = a && n ? Math.min(1, a.ms / n) : 0;
3974
- return /* @__PURE__ */ j(Y, {
3994
+ function br({ session: e, now: t, longest: n, selected: r, onSelect: i }) {
3995
+ let a = Gt(e, t), o = a && n ? Math.min(1, a.ms / n) : 0;
3996
+ return /* @__PURE__ */ j(X, {
3975
3997
  className: "la-clickable-row",
3976
3998
  "data-state": r ? "selected" : void 0,
3977
3999
  onClick: (e) => i(e.currentTarget.querySelector("button") ?? e.currentTarget),
3978
4000
  children: [
3979
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ j("span", {
4001
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ j("span", {
3980
4002
  className: `socket-status socket-status-${e.status}`,
3981
4003
  children: [/* @__PURE__ */ A("i", {
3982
4004
  className: `socket-swatch socket-swatch-${e.status}`,
3983
4005
  "aria-hidden": "true"
3984
- }), tr(e.status)]
4006
+ }), lr(e.status)]
3985
4007
  }) }),
3986
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ A("button", {
4008
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ A("button", {
3987
4009
  type: "button",
3988
4010
  className: "socket-connection",
3989
4011
  title: e.connectionId,
3990
4012
  "aria-label": `Inspect connection ${e.connectionId}`,
3991
- children: rr(e.connectionId)
4013
+ children: dr(e.connectionId)
3992
4014
  }) }),
3993
- /* @__PURE__ */ A(Z, {
4015
+ /* @__PURE__ */ A(Q, {
3994
4016
  title: e.actorName,
3995
4017
  children: e.actorName
3996
4018
  }),
3997
- /* @__PURE__ */ A(Z, {
4019
+ /* @__PURE__ */ A(Q, {
3998
4020
  title: e.actorId,
3999
4021
  children: e.actorId
4000
4022
  }),
4001
- /* @__PURE__ */ A(Z, { children: e.openedAtMs === null ? /* @__PURE__ */ A("span", {
4023
+ /* @__PURE__ */ A(Q, { children: e.openedAtMs === null ? /* @__PURE__ */ A("span", {
4002
4024
  title: "The connect event is not in retained history",
4003
4025
  children: "—"
4004
4026
  }) : /* @__PURE__ */ j("time", {
@@ -4006,16 +4028,16 @@ function fr({ session: e, now: t, longest: n, selected: r, onSelect: i }) {
4006
4028
  title: e.estimatedStart ? "Approximate: first reported by the host; the connect event has not been saved yet" : new Date(e.openedAtMs).toLocaleString(),
4007
4029
  children: [e.estimatedStart ? "≈ " : "", new Date(e.openedAtMs).toLocaleTimeString([], { hour12: !1 })]
4008
4030
  }) }),
4009
- /* @__PURE__ */ A(Z, { children: /* @__PURE__ */ j("span", {
4031
+ /* @__PURE__ */ A(Q, { children: /* @__PURE__ */ j("span", {
4010
4032
  className: "socket-duration",
4011
- children: [/* @__PURE__ */ A("span", { children: nr(e, t) }), /* @__PURE__ */ A("i", {
4033
+ children: [/* @__PURE__ */ A("span", { children: ur(e, t) }), /* @__PURE__ */ A("i", {
4012
4034
  className: `socket-duration-bar socket-duration-${e.status}`,
4013
4035
  "aria-hidden": "true",
4014
4036
  children: /* @__PURE__ */ A("b", { style: { width: `${o * 100}%` } })
4015
4037
  })]
4016
4038
  }) }),
4017
- /* @__PURE__ */ A(Z, { children: e.messages.toLocaleString() }),
4018
- /* @__PURE__ */ A(Z, { children: e.metadata === void 0 ? /* @__PURE__ */ A("span", {
4039
+ /* @__PURE__ */ A(Q, { children: e.messages.toLocaleString() }),
4040
+ /* @__PURE__ */ A(Q, { children: e.metadata === void 0 ? /* @__PURE__ */ A("span", {
4019
4041
  title: "No metadata was recorded for this connection",
4020
4042
  children: "—"
4021
4043
  }) : /* @__PURE__ */ A("code", {
@@ -4026,9 +4048,9 @@ function fr({ session: e, now: t, longest: n, selected: r, onSelect: i }) {
4026
4048
  ]
4027
4049
  });
4028
4050
  }
4029
- function pr({ session: e, now: t, onSelectActor: n }) {
4051
+ function xr({ session: e, now: t, onSelectActor: n }) {
4030
4052
  let r = {
4031
- Status: e.status === "lost" ? "Lost — no disconnect recorded" : tr(e.status),
4053
+ Status: e.status === "lost" ? "Lost — no disconnect recorded" : lr(e.status),
4032
4054
  ...e.status === "unknown" ? { Inventory: "Gateway unavailable; connection status unconfirmed" } : {},
4033
4055
  Connection: e.connectionId,
4034
4056
  "Actor class": e.actorName,
@@ -4036,7 +4058,7 @@ function pr({ session: e, now: t, onSelectActor: n }) {
4036
4058
  Opened: e.openedAtMs === null ? "Before retained history" : `${e.estimatedStart ? "≈ " : ""}${new Date(e.openedAtMs).toLocaleString()}`,
4037
4059
  ...e.closedAtMs === null ? {} : { Closed: new Date(e.closedAtMs).toLocaleString() },
4038
4060
  ...e.status === "lost" && e.lastSeenMs !== null ? { "Last activity": new Date(e.lastSeenMs).toLocaleString() } : {},
4039
- Duration: nr(e, t),
4061
+ Duration: ur(e, t),
4040
4062
  Messages: e.messages.toLocaleString(),
4041
4063
  Failures: e.failures.toLocaleString(),
4042
4064
  Host: e.hostId ?? "Unknown"
@@ -4051,22 +4073,22 @@ function pr({ session: e, now: t, onSelectActor: n }) {
4051
4073
  open: !0,
4052
4074
  children: [/* @__PURE__ */ A("summary", { children: "Metadata" }), /* @__PURE__ */ A("pre", { children: JSON.stringify(e.metadata, null, 2) })]
4053
4075
  }),
4054
- n && /* @__PURE__ */ j(H, {
4076
+ n && /* @__PURE__ */ j(U, {
4055
4077
  variant: "outline",
4056
4078
  onClick: () => n(e.actorName),
4057
4079
  children: ["Open ", e.actorName]
4058
4080
  })
4059
4081
  ] });
4060
4082
  }
4061
- function mr(e, t, n) {
4083
+ function Sr(e, t, n) {
4062
4084
  let r = Math.min(...e.map((e) => e.openedAtMs ?? e.lastSeenMs ?? n)), i = Number.isFinite(r) ? r - Math.max(5e3, (n - r) * .06) : n - 6e4;
4063
4085
  return Math.max(t ?? -Infinity, Math.min(i, n - 1e4));
4064
4086
  }
4065
- function hr(e, n) {
4087
+ function Cr(e, n) {
4066
4088
  let [r, i] = o(/* @__PURE__ */ new Map()), s = a(void 0);
4067
4089
  return t(() => {
4068
4090
  if (!e) return;
4069
- let t = new Set(e.actors.flatMap((e) => e.instances.flatMap((t) => t.connections.map((n) => jn(e.actorName, t.actorId, n.id))))), r = s.current;
4091
+ let t = new Set(e.actors.flatMap((e) => e.instances.flatMap((t) => t.connections.map((n) => Ut(e.actorName, t.actorId, n.id))))), r = s.current;
4070
4092
  if (s.current = t, !r) return;
4071
4093
  let a = [...t].filter((e) => !r.has(e)), o = [...r].filter((e) => !t.has(e));
4072
4094
  if (a.length || o.length) {
@@ -4078,7 +4100,7 @@ function hr(e, n) {
4078
4100
  }
4079
4101
  }, [e]), r;
4080
4102
  }
4081
- function gr(e, t) {
4103
+ function wr(e, t) {
4082
4104
  let n = /* @__PURE__ */ new Map();
4083
4105
  for (let e of t?.actors ?? []) n.set(e.actorName, new Set(e.instances.map((e) => e.actorId)));
4084
4106
  for (let t of e) {
@@ -4095,12 +4117,12 @@ function gr(e, t) {
4095
4117
  hint: e
4096
4118
  })))];
4097
4119
  }
4098
- function _r(e, t, n) {
4120
+ function Tr(e, t, n) {
4099
4121
  return !e && !t.rows ? t.failed ? "Connections unavailable" : "Loading connections…" : n ? "No matching connections" : t.supported ? "No WebSocket sessions" : "No active WebSockets";
4100
4122
  }
4101
4123
  //#endregion
4102
4124
  //#region src/ConsoleApp.tsx
4103
- var vr = [
4125
+ var Er = [
4104
4126
  {
4105
4127
  id: "overview",
4106
4128
  label: "Durable Actors",
@@ -4122,7 +4144,7 @@ var vr = [
4122
4144
  icon: u
4123
4145
  }
4124
4146
  ];
4125
- function yr({ client: e, toggleTheme: t }) {
4147
+ function Dr({ client: e, toggleTheme: t }) {
4126
4148
  let [n, r] = o("overview"), [i, a] = o(), [s, u] = o(Ye), d = {
4127
4149
  timeRange: s,
4128
4150
  onTimeRangeChange: u
@@ -4147,7 +4169,7 @@ function yr({ client: e, toggleTheme: t }) {
4147
4169
  }),
4148
4170
  /* @__PURE__ */ A("nav", {
4149
4171
  "aria-label": "Observability",
4150
- children: vr.map((e) => /* @__PURE__ */ j("button", {
4172
+ children: Er.map((e) => /* @__PURE__ */ j("button", {
4151
4173
  type: "button",
4152
4174
  "aria-current": n === e.id ? "page" : void 0,
4153
4175
  onClick: () => {
@@ -4182,12 +4204,12 @@ function yr({ client: e, toggleTheme: t }) {
4182
4204
  id: "main",
4183
4205
  tabIndex: -1,
4184
4206
  children: [
4185
- n === "overview" && /* @__PURE__ */ A(xn, {
4207
+ n === "overview" && /* @__PURE__ */ A(Jn, {
4186
4208
  client: e,
4187
4209
  onSelectActor: f,
4188
4210
  ...d
4189
4211
  }),
4190
- n === "actors" && /* @__PURE__ */ A(Yt, {
4212
+ n === "actors" && /* @__PURE__ */ A(Cn, {
4191
4213
  client: e,
4192
4214
  navigation: {
4193
4215
  actorName: i,
@@ -4199,7 +4221,7 @@ function yr({ client: e, toggleTheme: t }) {
4199
4221
  client: e,
4200
4222
  ...d
4201
4223
  }),
4202
- n === "websockets" && /* @__PURE__ */ A(ur, {
4224
+ n === "websockets" && /* @__PURE__ */ A(vr, {
4203
4225
  client: e,
4204
4226
  onSelectActor: f,
4205
4227
  ...d
@@ -4212,63 +4234,66 @@ function yr({ client: e, toggleTheme: t }) {
4212
4234
  }
4213
4235
  //#endregion
4214
4236
  //#region src/state-data.ts
4215
- function br(e) {
4216
- if (!wr(e) || !(e.snapshot === null || Sr(e.snapshot) && wr(e.snapshot) && wr(e.snapshot.state)) || !(e.schema === null || wr(e.schema))) throw Error("Invalid state response");
4237
+ function Or(e) {
4238
+ if (!Mr(e) || !(e.snapshot === null || Ar(e.snapshot) && Mr(e.snapshot) && Mr(e.snapshot.state)) || !(e.schema === null || Mr(e.schema))) throw Error("Invalid state response");
4217
4239
  return e;
4218
4240
  }
4219
- function xr(e) {
4220
- if (!wr(e) || !Array.isArray(e.records) || !e.records.every(Sr) || !(e.nextBefore === null || Cr(e.nextBefore))) throw Error("Invalid state history");
4241
+ function kr(e) {
4242
+ if (!Mr(e) || !Array.isArray(e.records) || !e.records.every(Ar) || !(e.nextBefore === null || jr(e.nextBefore))) throw Error("Invalid state history");
4221
4243
  return e;
4222
4244
  }
4223
- function Sr(e) {
4224
- if (!wr(e) || !Cr(e.stateVersion) || !Cr(e.ownerEpoch) || typeof e.requestId != "string") return !1;
4245
+ function Ar(e) {
4246
+ if (!Mr(e) || !jr(e.stateVersion) || !jr(e.ownerEpoch) || typeof e.requestId != "string") return !1;
4225
4247
  let t = e.attribution;
4226
- return t === null || wr(t) && typeof t.operation == "string" && (t.connectionId === null || typeof t.connectionId == "string") && typeof t.committedAtMs == "number" && Number.isSafeInteger(t.committedAtMs) && t.committedAtMs >= 0 && typeof t.interleaved == "boolean";
4248
+ return t === null || Mr(t) && typeof t.operation == "string" && (t.connectionId === null || typeof t.connectionId == "string") && typeof t.committedAtMs == "number" && Number.isSafeInteger(t.committedAtMs) && t.committedAtMs >= 0 && typeof t.interleaved == "boolean";
4227
4249
  }
4228
- function Cr(e) {
4250
+ function jr(e) {
4229
4251
  return typeof e == "number" && Number.isSafeInteger(e) && e > 0;
4230
4252
  }
4231
- function wr(e) {
4253
+ function Mr(e) {
4232
4254
  return !!e && typeof e == "object" && !Array.isArray(e);
4233
4255
  }
4234
4256
  //#endregion
4235
4257
  //#region src/client.ts
4236
- var Tr = class {
4258
+ var Nr = class {
4237
4259
  baseUrl;
4238
4260
  request;
4239
4261
  constructor(e = "/api/observe", t = globalThis.fetch.bind(globalThis)) {
4240
4262
  this.baseUrl = e, this.request = t;
4241
4263
  }
4264
+ async listResidency(e, t) {
4265
+ return xn(await this.get(`residency${Pr(e)}`, t));
4266
+ }
4242
4267
  async getState(e, t) {
4243
- return br(await this.get(`state${Er(e)}`, t));
4268
+ return Or(await this.get(`state${Pr(e)}`, t));
4244
4269
  }
4245
4270
  async listStateHistory(e, t) {
4246
- return xr(await this.get(`state/history${Er(e)}`, t));
4271
+ return kr(await this.get(`state/history${Pr(e)}`, t));
4247
4272
  }
4248
4273
  async getMetrics(e, t) {
4249
- return vn(await this.get(`metrics${Er(e)}`, t));
4274
+ return Gn(await this.get(`metrics${Pr(e)}`, t));
4250
4275
  }
4251
4276
  async listQueueWaits(e, t) {
4252
- return Ht(await this.get(`queue-waits${Er(e)}`, t));
4277
+ return pn(await this.get(`queue-waits${Pr(e)}`, t));
4253
4278
  }
4254
4279
  async listWebSockets(e, t) {
4255
- return An(await this.get(`websockets${Er(e)}`, t));
4280
+ return Ht(await this.get(`websockets${Pr(e)}`, t));
4256
4281
  }
4257
4282
  async listActors(e) {
4258
4283
  let t = await this.get("actors", e);
4259
- if (!Dr(t)) throw Error("Invalid actor inventory response.");
4284
+ if (!Fr(t)) throw Error("Invalid actor inventory response.");
4260
4285
  return t;
4261
4286
  }
4262
4287
  async watchActors(e, t) {
4263
- return this.watch("events", "inventory", Dr, e, t);
4288
+ return this.watch("events", "inventory", Fr, e, t);
4264
4289
  }
4265
4290
  async watchRequests(e, t, n) {
4266
4291
  let r = n ? `?${new URLSearchParams({ after: n })}` : "";
4267
- return this.watch(`requests/events${r}`, "requests", Ar, e, t);
4292
+ return this.watch(`requests/events${r}`, "requests", Rr, e, t);
4268
4293
  }
4269
4294
  async listRequests(e, t) {
4270
- let n = await this.get(`requests${Er(e)}`, t);
4271
- if (!Ar(n)) throw Error("Invalid request history response");
4295
+ let n = await this.get(`requests${Pr(e)}`, t);
4296
+ if (!Rr(n)) throw Error("Invalid request history response");
4272
4297
  return n;
4273
4298
  }
4274
4299
  async watch(e, t, n, r, i) {
@@ -4279,7 +4304,7 @@ var Tr = class {
4279
4304
  headers: { accept: "text/event-stream" }
4280
4305
  });
4281
4306
  if (!a.ok || !a.headers.get("content-type")?.startsWith("text/event-stream") || !a.body) throw await a.body?.cancel(), Error("Live inventory is unavailable");
4282
- let o = a.body.getReader(), s = new TextDecoder(), c = oe({ onEvent(e) {
4307
+ let o = a.body.getReader(), s = new TextDecoder(), c = ae({ onEvent(e) {
4283
4308
  if (i.aborted) return;
4284
4309
  if (e.event === "error") throw Error("Live inventory is unavailable");
4285
4310
  if (e.event !== t) return;
@@ -4317,29 +4342,29 @@ var Tr = class {
4317
4342
  return n.json();
4318
4343
  }
4319
4344
  };
4320
- function Er(e) {
4345
+ function Pr(e) {
4321
4346
  let t = new URLSearchParams();
4322
4347
  for (let [n, r] of Object.entries(e)) r !== void 0 && t.set(n, String(r));
4323
4348
  return t.size ? `?${t}` : "";
4324
4349
  }
4325
- function Dr(e) {
4326
- return !e || typeof e != "object" || !("actors" in e) || !Array.isArray(e.actors) || !("connectionsComplete" in e) || typeof e.connectionsComplete != "boolean" ? !1 : e.actors.every((e) => e && typeof e.actorName == "string" && [
4350
+ function Fr(e) {
4351
+ return !e || typeof e != "object" || !("actors" in e) || !Array.isArray(e.actors) || !("connectionsComplete" in e) || typeof e.connectionsComplete != "boolean" ? !1 : e.actors.every((e) => e && typeof e.actorName == "string" && (e.methods === void 0 || Array.isArray(e.methods) && e.methods.every((e) => typeof e == "string")) && [
4327
4352
  e.live,
4328
4353
  e.dormant,
4329
4354
  e.unknown
4330
- ].every((e) => Number.isSafeInteger(e) && e >= 0) && Array.isArray(e.instances) && e.instances.every(Or));
4355
+ ].every((e) => Number.isSafeInteger(e) && e >= 0) && Array.isArray(e.instances) && e.instances.every(Ir));
4331
4356
  }
4332
- function Or(e) {
4357
+ function Ir(e) {
4333
4358
  return !!e && typeof e == "object" && "actorId" in e && typeof e.actorId == "string" && "status" in e && [
4334
4359
  "live",
4335
4360
  "dormant",
4336
4361
  "unknown"
4337
- ].includes(String(e.status)) && "connections" in e && Array.isArray(e.connections) && e.connections.every(kr) && (!("waiting" in e) || e.waiting == null || Array.isArray(e.waiting) && e.waiting.every((e) => !!e && typeof e == "object" && typeof e.id == "string" && typeof e.operation == "string"));
4362
+ ].includes(String(e.status)) && (!("lastActiveAtMs" in e) || e.lastActiveAtMs == null || typeof e.lastActiveAtMs == "number" && Number.isSafeInteger(e.lastActiveAtMs) && e.lastActiveAtMs >= 0) && "connections" in e && Array.isArray(e.connections) && e.connections.every(Lr) && (!("waiting" in e) || e.waiting == null || Array.isArray(e.waiting) && e.waiting.every((e) => !!e && typeof e == "object" && typeof e.id == "string" && typeof e.operation == "string"));
4338
4363
  }
4339
- function kr(e) {
4364
+ function Lr(e) {
4340
4365
  return !!e && typeof e == "object" && "id" in e && typeof e.id == "string" && "metadata" in e;
4341
4366
  }
4342
- function Ar(e) {
4367
+ function Rr(e) {
4343
4368
  if (!e || typeof e != "object") return !1;
4344
4369
  let t = e;
4345
4370
  return typeof t.epoch == "string" && [
@@ -4347,12 +4372,12 @@ function Ar(e) {
4347
4372
  t.capacity,
4348
4373
  t.evicted,
4349
4374
  t.dropped
4350
- ].every(jr) && (t.persistenceFailed === void 0 || typeof t.persistenceFailed == "boolean") && (t.nextCursor == null || typeof t.nextCursor == "string") && (t.resumeCursor === void 0 || typeof t.resumeCursor == "string") && (t.reset === void 0 || typeof t.reset == "boolean") && (t.snapshot === void 0 || typeof t.snapshot == "boolean") && t.capacity > 0 && t.capacity <= 500 && Array.isArray(t.records) && t.records.length <= t.capacity && t.records.every((e) => Mr(e) && e.sequence <= t.cursor);
4375
+ ].every(zr) && (t.persistenceFailed === void 0 || typeof t.persistenceFailed == "boolean") && (t.nextCursor == null || typeof t.nextCursor == "string") && (t.resumeCursor === void 0 || typeof t.resumeCursor == "string") && (t.reset === void 0 || typeof t.reset == "boolean") && (t.snapshot === void 0 || typeof t.snapshot == "boolean") && t.capacity > 0 && t.capacity <= 500 && Array.isArray(t.records) && t.records.length <= t.capacity && t.records.every((e) => Br(e) && e.sequence <= t.cursor);
4351
4376
  }
4352
- function jr(e) {
4377
+ function zr(e) {
4353
4378
  return Number.isSafeInteger(e) && Number(e) >= 0;
4354
4379
  }
4355
- function Mr(e) {
4380
+ function Br(e) {
4356
4381
  if (!e || typeof e != "object") return !1;
4357
4382
  let t = e;
4358
4383
  return typeof t.projectId == "string" && /^[A-Za-z0-9._-]{1,64}$/u.test(t.projectId) && [
@@ -4362,7 +4387,7 @@ function Mr(e) {
4362
4387
  t.actorName,
4363
4388
  t.actorId,
4364
4389
  t.operation
4365
- ].every((e) => typeof e == "string") && (t.eventId === void 0 || typeof t.eventId == "string" && t.eventId.length > 0) && jr(t.sequence) && jr(t.startedAtMs) && t.startedAtMs <= 864e13 && ["method", "websocket"].includes(t.kind) && [
4390
+ ].every((e) => typeof e == "string") && (t.eventId === void 0 || typeof t.eventId == "string" && t.eventId.length > 0) && zr(t.sequence) && zr(t.startedAtMs) && t.startedAtMs <= 864e13 && ["method", "websocket"].includes(t.kind) && [
4366
4391
  "completed",
4367
4392
  "failed",
4368
4393
  "rejected",
@@ -4371,4 +4396,4 @@ function Mr(e) {
4371
4396
  ].includes(t.outcome) && (t.connectionId === null || typeof t.connectionId == "string") && ["cold", "warm"].includes(t.hostState) && Number.isFinite(t.durationMs) && t.durationMs >= 0 && (t.queueWaitMs === null || Number.isFinite(t.queueWaitMs) && t.queueWaitMs >= 0 && t.queueWaitMs <= t.durationMs);
4372
4397
  }
4373
4398
  //#endregion
4374
- export { Yt as ActorObserver, W as Badge, H as Button, Re as Calendar, ze as CalendarDayButton, le as Command, fe as CommandEmpty, pe as CommandGroup, ue as CommandInput, he as CommandItem, de as CommandList, me as CommandSeparator, ge as CommandShortcut, yr as ConsoleApp, ct as Drawer, dt as DrawerClose, pt as DrawerContent, _t as DrawerDescription, ht as DrawerFooter, mt as DrawerHeader, ft as DrawerOverlay, ut as DrawerPortal, gt as DrawerTitle, lt as DrawerTrigger, _e as FilterCombobox, Tr as HttpObserverClient, Be as Input, xn as Overview, Ve as Popover, We as PopoverAnchor, Ue as PopoverContent, qe as PopoverDescription, Ge as PopoverHeader, Ke as PopoverTitle, He as PopoverTrigger, Et as RequestObserver, Me as RequestTimeline, ar as Sheet, cr as SheetContent, sr as SheetDescription, or as SheetTitle, Gn as SocketTimeline, K as Table, J as TableBody, bt as TableCaption, Z as TableCell, yt as TableFooter, X as TableHead, q as TableHeader, Y as TableRow, et as TimeRangePicker, ur as WebSocketObserver, st as badgeVariants, Le as buttonVariants, Ye as defaultTimeRange, Ze as rangeLabel, Xe as resolveRange };
4399
+ export { Cn as ActorObserver, G as Badge, U as Button, Re as Calendar, ze as CalendarDayButton, ce as Command, de as CommandEmpty, fe as CommandGroup, le as CommandInput, me as CommandItem, ue as CommandList, pe as CommandSeparator, he as CommandShortcut, Dr as ConsoleApp, ct as Drawer, dt as DrawerClose, pt as DrawerContent, _t as DrawerDescription, ht as DrawerFooter, mt as DrawerHeader, ft as DrawerOverlay, ut as DrawerPortal, gt as DrawerTitle, lt as DrawerTrigger, ge as FilterCombobox, Nr as HttpObserverClient, Be as Input, Jn as Overview, Ve as Popover, We as PopoverAnchor, Ue as PopoverContent, qe as PopoverDescription, Ge as PopoverHeader, Ke as PopoverTitle, He as PopoverTrigger, Et as RequestObserver, Me as RequestTimeline, Zt as ResidencyTimeline, pr as Sheet, gr as SheetContent, hr as SheetDescription, mr as SheetTitle, nr as SocketTimeline, q as Table, Y as TableBody, bt as TableCaption, Q as TableCell, yt as TableFooter, Z as TableHead, J as TableHeader, X as TableRow, et as TimeRangePicker, vr as WebSocketObserver, st as badgeVariants, Le as buttonVariants, Ye as defaultTimeRange, Xe as rangeLabel, W as resolveRange };