@voltro/devtools 0.71.1 → 0.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,372 +1,373 @@
1
- import { createContext as e, useCallback as t, useContext as n, useEffect as r, useId as i, useMemo as a, useRef as o, useState as s, useSyncExternalStore as c } from "react";
2
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
3
- import { clearMutations as f, clearStoreHistory as p, clientDiagnosticsSnapshot as m, definedStores as ee, getMutations as h, storeHistory as g, subscribeClientDiagnostics as te, subscribeMutations as _, subscribeStoreHistory as v, travelToStoreState as y, useFrameworkRuntimes as b } from "@voltro/client";
4
- import { getRouteSnapshot as ne, getStatuses as re, subscribeRouteSnapshot as ie, subscribeStatuses as ae } from "@voltro/web";
5
- import { addSink as oe } from "@voltro/logger";
6
- //#region src/usePosition.ts
7
- var se = [
8
- "topLeft",
9
- "topMid",
10
- "topRight",
11
- "midLeft",
12
- "midRight",
13
- "bottomLeft",
14
- "bottomMid",
15
- "bottomRight"
16
- ], x = "voltro:devtools:anchor", ce = (e) => {
17
- if (typeof window > "u") return e;
1
+ import { Component as e, createContext as t, useCallback as n, useContext as r, useEffect as i, useId as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l, useSyncExternalStore as u } from "react";
2
+ import { addSink as d } from "@voltro/logger";
3
+ import { getRouteSnapshot as f, getStatuses as p, subscribeConsoleCalls as m, subscribeRouteSnapshot as h, subscribeStatuses as g } from "@voltro/web";
4
+ import { clearStoreHistory as _, definedStores as v, getMutations as y, storeHistory as b, subscribeMutations as x, subscribeStoreHistory as S, travelToStoreState as C, useConnectionStatus as w, useFrameworkRuntimes as T, useWorkflow as E } from "@voltro/client";
5
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
6
+ import { createPortal as A } from "react-dom";
7
+ //#region src/consoleBridge.ts
8
+ var j = (e) => e === "warn" || e === "error", M = (e) => {
9
+ if (typeof e == "string") return e;
10
+ if (e instanceof Error) return `${e.name}: ${e.message}`;
11
+ if (e === void 0) return "undefined";
12
+ if (typeof e == "function") return `[function ${e.name || "anonymous"}]`;
13
+ if (typeof e == "symbol" || typeof e == "bigint") return String(e);
18
14
  try {
19
- let e = window.localStorage.getItem(x);
20
- if (e && se.includes(e)) return e;
21
- } catch {}
22
- return e;
23
- }, le = (e) => {
24
- if (!(typeof window > "u")) try {
25
- window.localStorage.setItem(x, e);
26
- } catch {}
27
- }, ue = (e = "bottomLeft") => {
28
- let [n, i] = s(() => ce(e));
29
- return r(() => {
30
- if (typeof window > "u") return;
31
- let e = (e) => {
32
- e.key === x && e.newValue && se.includes(e.newValue) && i(e.newValue);
33
- };
34
- return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
35
- }, []), [n, t((e) => {
36
- i(e), le(e);
37
- }, [])];
38
- }, de = (e) => {
39
- switch (e) {
40
- case "topLeft": return {
41
- top: 24,
42
- left: 24
43
- };
44
- case "topMid": return {
45
- top: 24,
46
- left: "50%",
47
- transform: "translateX(-50%)"
48
- };
49
- case "topRight": return {
50
- top: 24,
51
- right: 24
52
- };
53
- case "midLeft": return {
54
- top: "50%",
55
- left: 24,
56
- transform: "translateY(-50%)"
57
- };
58
- case "midRight": return {
59
- top: "50%",
60
- right: 24,
61
- transform: "translateY(-50%)"
62
- };
63
- case "bottomLeft": return {
64
- bottom: 24,
65
- left: 24
66
- };
67
- case "bottomMid": return {
68
- bottom: 24,
69
- left: "50%",
70
- transform: "translateX(-50%)"
71
- };
72
- case "bottomRight": return {
73
- bottom: 24,
74
- right: 24
75
- };
15
+ let t = JSON.stringify(e);
16
+ return t === void 0 ? String(e) : t.length > 500 ? `${t.slice(0, 499)}…` : t;
17
+ } catch {
18
+ return String(e);
76
19
  }
77
- }, fe = {
78
- default: "vdt:bg-muted vdt:text-foreground hover:vdt:bg-muted/80",
79
- ghost: "vdt:bg-transparent vdt:text-foreground hover:vdt:bg-muted/50",
80
- outline: "vdt:bg-transparent vdt:text-foreground vdt:border vdt:border-border hover:vdt:border-border-strong",
81
- accent: "vdt:bg-accent vdt:text-accent-foreground hover:vdt:bg-accent-dim",
82
- danger: "vdt:bg-danger/15 vdt:text-danger hover:vdt:bg-danger/25"
83
- }, pe = {
84
- sm: "vdt:text-xs vdt:px-2 vdt:py-1 vdt:rounded-sm",
85
- md: "vdt:text-sm vdt:px-3 vdt:py-1.5 vdt:rounded-md"
86
- }, S = ({ variant: e = "default", size: t = "md", onClick: n, disabled: r, children: i, className: a, title: o }) => /* @__PURE__ */ u("button", {
87
- onClick: n,
88
- disabled: r,
89
- title: o,
90
- className: [
91
- "vdt:inline-flex vdt:items-center vdt:gap-1.5 vdt:font-medium vdt:transition-colors",
92
- "disabled:vdt:opacity-40 disabled:vdt:cursor-not-allowed",
93
- fe[e],
94
- pe[t],
95
- a ?? ""
96
- ].join(" "),
97
- children: i
98
- }), me = ({ onClick: e, title: t, active: n, children: r, className: i }) => /* @__PURE__ */ u("button", {
99
- onClick: e,
100
- title: t,
101
- className: [
102
- "vdt:inline-flex vdt:items-center vdt:justify-center",
103
- "vdt:w-7 vdt:h-7 vdt:rounded-md vdt:transition-colors",
104
- n ? "vdt:bg-accent vdt:text-accent-foreground" : "vdt:text-foreground-muted hover:vdt:bg-muted hover:vdt:text-foreground",
105
- i ?? ""
106
- ].join(" "),
107
- children: r
108
- }), he = ({ children: e, className: t }) => {
109
- let n = o(null);
110
- return r(() => {
111
- let e = n.current;
112
- if (e === null) return;
113
- let t = (t) => {
114
- if (e.scrollWidth <= e.clientWidth) return;
115
- let n = t.deltaY + t.deltaX;
116
- n !== 0 && (t.preventDefault(), e.scrollLeft += n);
117
- };
118
- return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
119
- }, []), /* @__PURE__ */ u("div", {
120
- ref: n,
121
- role: "tablist",
122
- className: [
123
- "vdt-tablist",
124
- "vdt:flex vdt:items-center vdt:gap-0.5 vdt:border-b vdt:border-border",
125
- "vdt:px-2 vdt:bg-card",
126
- "vdt:overflow-x-auto vdt:flex-nowrap",
127
- t ?? ""
128
- ].join(" "),
129
- children: e
130
- });
131
- }, C = ({ active: e, onClick: t, badge: n, children: r }) => /* @__PURE__ */ d("button", {
132
- role: "tab",
133
- "aria-selected": e,
134
- onClick: t,
135
- className: [
136
- "vdt:relative vdt:flex vdt:items-center vdt:gap-1.5 vdt:px-3 vdt:py-2",
137
- "vdt:text-xs vdt:font-medium vdt:transition-colors",
138
- "vdt:border-b-2 vdt:shrink-0 vdt:whitespace-nowrap",
139
- e ? "vdt:text-foreground vdt:border-accent" : "vdt:text-foreground-muted vdt:border-transparent hover:vdt:text-foreground"
140
- ].join(" "),
141
- children: [/* @__PURE__ */ u("span", { children: r }), typeof n == "number" && n > 0 ? /* @__PURE__ */ u("span", {
142
- className: [
143
- "vdt:inline-flex vdt:items-center vdt:justify-center",
144
- "vdt:min-w-4 vdt:h-4 vdt:px-1 vdt:rounded-full",
145
- "vdt:text-[10px] vdt:font-semibold",
146
- e ? "vdt:bg-accent vdt:text-accent-foreground" : "vdt:bg-muted vdt:text-foreground-muted"
147
- ].join(" "),
148
- children: n
149
- }) : null]
150
- }), ge = {
151
- neutral: "vdt:bg-muted vdt:text-foreground-muted vdt:border vdt:border-border",
152
- success: "vdt:bg-success/15 vdt:text-success vdt:border vdt:border-success/30",
153
- warning: "vdt:bg-warning/15 vdt:text-warning vdt:border vdt:border-warning/30",
154
- danger: "vdt:bg-danger/15 vdt:text-danger vdt:border vdt:border-danger/30",
155
- info: "vdt:bg-info/15 vdt:text-info vdt:border vdt:border-info/30",
156
- accent: "vdt:bg-accent/15 vdt:text-accent vdt:border vdt:border-accent/30"
157
- }, w = ({ tone: e = "neutral", children: t, className: n }) => /* @__PURE__ */ u("span", {
158
- className: [
159
- "vdt:inline-flex vdt:items-center vdt:gap-1 vdt:px-1.5 vdt:py-0.5",
160
- "vdt:rounded-sm vdt:text-[10px] vdt:font-medium vdt:uppercase vdt:tracking-wider",
161
- ge[e],
162
- n ?? ""
163
- ].join(" "),
164
- children: t
165
- }), T = ({ children: e, className: t }) => /* @__PURE__ */ u("div", {
166
- className: ["vdt:bg-background-elevated vdt:border vdt:border-border vdt:rounded-md", t ?? ""].join(" "),
167
- children: e
168
- }), E = ({ children: e, right: t, Icon: n }) => /* @__PURE__ */ d("div", {
169
- className: "vdt:flex vdt:items-center vdt:justify-between vdt:px-3 vdt:py-2 vdt:border-b vdt:border-border",
170
- children: [/* @__PURE__ */ d("div", {
171
- className: "vdt:flex vdt:items-center vdt:gap-1.5",
172
- children: [n ? /* @__PURE__ */ u(n, { className: "vdt:w-3 vdt:h-3 vdt:text-foreground-muted" }) : null, /* @__PURE__ */ u("span", {
173
- className: "vdt:text-[10px] vdt:font-semibold vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted",
174
- children: e
175
- })]
176
- }), t ?? null]
177
- }), D = ({ entries: e }) => /* @__PURE__ */ u("dl", {
178
- className: "vdt:grid vdt:grid-cols-[auto_1fr] vdt:gap-x-3 vdt:gap-y-1 vdt:px-3 vdt:py-2 vdt:text-xs",
179
- children: e.map((e) => /* @__PURE__ */ d("div", {
180
- className: "vdt:contents",
181
- children: [/* @__PURE__ */ u("dt", {
182
- className: "vdt:text-foreground-muted vdt:font-medium",
183
- children: e.key
184
- }), /* @__PURE__ */ u("dd", {
185
- className: "vdt:font-mono vdt:text-foreground vdt:break-all",
186
- children: e.value
187
- })]
188
- }, e.key))
189
- }), O = ({ children: e }) => /* @__PURE__ */ u("div", {
190
- className: "vdt:flex vdt:items-center vdt:justify-center vdt:py-12 vdt:px-6 vdt:text-center",
191
- children: /* @__PURE__ */ u("div", {
192
- className: "vdt:text-xs vdt:text-foreground-subtle vdt:max-w-xs",
193
- children: e
194
- })
195
- }), k = (e) => ({ className: t }) => /* @__PURE__ */ u("svg", {
20
+ }, N = (e, t, n = /* @__PURE__ */ new Date()) => {
21
+ let r = t.find((e) => e instanceof Error), i = {};
22
+ return t.forEach((e, t) => {
23
+ typeof e != "string" && !(e instanceof Error) && typeof e == "object" && e && (i[`arg${t}`] = e);
24
+ }), {
25
+ ts: n,
26
+ level: e,
27
+ scope: `console.${e}`,
28
+ message: t.map(M).join(" "),
29
+ fields: i,
30
+ ...r === void 0 ? {} : { cause: r }
31
+ };
32
+ }, P = (e, t, n = /* @__PURE__ */ new Date()) => {
33
+ let r = t instanceof Error ? t : void 0;
34
+ return {
35
+ ts: n,
36
+ level: "error",
37
+ scope: e,
38
+ message: t instanceof Error ? `${t.name}: ${t.message}` : `${e === "window.error" ? "Uncaught" : "Unhandled rejection"}: ${M(t)}`,
39
+ fields: {},
40
+ ...r === void 0 ? {} : { cause: r }
41
+ };
42
+ }, F = Symbol.for("voltro.devtools.consoleBridge"), ee = (e, t = m) => {
43
+ let n = globalThis, r = n[F];
44
+ if (r !== void 0) return r;
45
+ let i = [], a = !1, o = () => {
46
+ a = !1;
47
+ let t = i;
48
+ i = [];
49
+ for (let n of t) n.claimed || e(n.record);
50
+ }, s = (e) => {
51
+ i.push({
52
+ record: e,
53
+ claimed: !1
54
+ }), a || (a = !0, queueMicrotask(o));
55
+ }, c = (e) => {
56
+ if (e.message !== "") {
57
+ for (let t of i) if (!t.claimed && t.record.level === e.level && t.record.message.includes(e.message)) {
58
+ t.claimed = !0;
59
+ break;
60
+ }
61
+ }
62
+ }, l = t((e) => {
63
+ if (j(e.level)) try {
64
+ s(N(e.level, e.args, new Date(e.ts)));
65
+ } catch {}
66
+ }), u = (t) => {
67
+ e(P("window.error", t.error ?? t.message));
68
+ }, d = (t) => {
69
+ e(P("unhandledrejection", t.reason));
70
+ }, f = typeof window < "u";
71
+ f && (window.addEventListener("error", u), window.addEventListener("unhandledrejection", d));
72
+ let p = {
73
+ noteLoggerRecord: c,
74
+ dispose: () => {
75
+ l(), f && (window.removeEventListener("error", u), window.removeEventListener("unhandledrejection", d)), delete n[F];
76
+ }
77
+ };
78
+ return n[F] = p, p;
79
+ }, te = 500, ne = [], re = /* @__PURE__ */ new Set(), ie = [], ae = () => {
80
+ ie = ne.slice();
81
+ }, oe = () => {
82
+ ae();
83
+ for (let e of re) try {
84
+ e();
85
+ } catch {}
86
+ }, se = typeof window < "u" ? ee(ce) : null;
87
+ d((e) => {
88
+ se?.noteLoggerRecord(e), ce(e);
89
+ });
90
+ function ce(e) {
91
+ ne.unshift(e), ne.length > te && (ne.length = te), oe();
92
+ }
93
+ var I = () => ie, le = (e) => (re.add(e), () => {
94
+ re.delete(e);
95
+ }), L = (e) => ({ className: t }) => /* @__PURE__ */ O("svg", {
196
96
  viewBox: "0 0 24 24",
197
97
  fill: "none",
198
98
  stroke: "currentColor",
199
99
  strokeWidth: "1.6",
200
100
  strokeLinecap: "round",
201
101
  strokeLinejoin: "round",
202
- className: t,
102
+ className: t ?? "vdt:w-4 vdt:h-4",
203
103
  "aria-hidden": "true",
204
104
  children: e
205
- }), A = ({ className: e }) => {
206
- let t = i(), n = `vdtBoltFront-${t}`, r = `vdtBoltBack-${t}`;
207
- return /* @__PURE__ */ d("svg", {
105
+ }), ue = ({ className: e }) => {
106
+ let t = a(), n = `vdtBoltFront-${t}`, r = `vdtBoltBack-${t}`;
107
+ return /* @__PURE__ */ k("svg", {
208
108
  viewBox: "0 0 48 48",
209
109
  fill: "none",
210
110
  className: e,
211
111
  "aria-hidden": "true",
212
112
  children: [
213
- /* @__PURE__ */ d("defs", { children: [/* @__PURE__ */ d("linearGradient", {
113
+ /* @__PURE__ */ k("defs", { children: [/* @__PURE__ */ k("linearGradient", {
214
114
  id: n,
215
115
  x1: "13",
216
116
  y1: "5",
217
117
  x2: "33",
218
118
  y2: "43",
219
119
  gradientUnits: "userSpaceOnUse",
220
- children: [/* @__PURE__ */ u("stop", { stopColor: "#C4A6FF" }), /* @__PURE__ */ u("stop", {
120
+ children: [/* @__PURE__ */ O("stop", { stopColor: "#C4A6FF" }), /* @__PURE__ */ O("stop", {
221
121
  offset: "1",
222
122
  stopColor: "#9D5BFF"
223
123
  })]
224
- }), /* @__PURE__ */ d("linearGradient", {
124
+ }), /* @__PURE__ */ k("linearGradient", {
225
125
  id: r,
226
126
  x1: "22",
227
127
  y1: "5",
228
128
  x2: "35",
229
129
  y2: "43",
230
130
  gradientUnits: "userSpaceOnUse",
231
- children: [/* @__PURE__ */ u("stop", { stopColor: "#9D5BFF" }), /* @__PURE__ */ u("stop", {
131
+ children: [/* @__PURE__ */ O("stop", { stopColor: "#9D5BFF" }), /* @__PURE__ */ O("stop", {
232
132
  offset: "1",
233
133
  stopColor: "#7C3AED"
234
134
  })]
235
135
  })] }),
236
- /* @__PURE__ */ u("path", {
136
+ /* @__PURE__ */ O("path", {
237
137
  d: "M28 5 13 27 22 26 20 43Z",
238
138
  fill: `url(#${n})`
239
139
  }),
240
- /* @__PURE__ */ u("path", {
140
+ /* @__PURE__ */ O("path", {
241
141
  d: "M28 5 20 43 35 21 26 22Z",
242
142
  fill: `url(#${r})`
243
143
  })
244
144
  ]
245
145
  });
246
- }, _e = k(/* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("line", {
146
+ }, de = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("line", {
247
147
  x1: "18",
248
148
  y1: "6",
249
149
  x2: "6",
250
150
  y2: "18"
251
- }), /* @__PURE__ */ u("line", {
151
+ }), /* @__PURE__ */ O("line", {
252
152
  x1: "6",
253
153
  y1: "6",
254
154
  x2: "18",
255
155
  y2: "18"
256
- })] })), j = k(/* @__PURE__ */ u("polyline", { points: "22 12 18 12 15 21 9 3 6 12 2 12" })), ve = k(/* @__PURE__ */ d(l, { children: [
257
- /* @__PURE__ */ u("ellipse", {
156
+ })] })), fe = L(/* @__PURE__ */ O("polyline", { points: "22 12 18 12 15 21 9 3 6 12 2 12" })), pe = L(/* @__PURE__ */ k(D, { children: [
157
+ /* @__PURE__ */ O("ellipse", {
258
158
  cx: "12",
259
159
  cy: "5",
260
160
  rx: "9",
261
161
  ry: "3"
262
162
  }),
263
- /* @__PURE__ */ u("path", { d: "M3 5 v6 c0 1.66 4 3 9 3 s9 -1.34 9 -3 V5" }),
264
- /* @__PURE__ */ u("path", { d: "M3 11 v6 c0 1.66 4 3 9 3 s9 -1.34 9 -3 v-6" })
265
- ] })), M = k(/* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("circle", {
163
+ /* @__PURE__ */ O("path", { d: "M3 5 v6 c0 1.66 4 3 9 3 s9 -1.34 9 -3 V5" }),
164
+ /* @__PURE__ */ O("path", { d: "M3 11 v6 c0 1.66 4 3 9 3 s9 -1.34 9 -3 v-6" })
165
+ ] })), me = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("circle", {
266
166
  cx: "12",
267
167
  cy: "12",
268
168
  r: "10"
269
- }), /* @__PURE__ */ u("polygon", { points: "16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76" })] })), ye = k(/* @__PURE__ */ d(l, { children: [
270
- /* @__PURE__ */ u("path", { d: "M12 22 v-5" }),
271
- /* @__PURE__ */ u("path", { d: "M9 8 V2" }),
272
- /* @__PURE__ */ u("path", { d: "M15 8 V2" }),
273
- /* @__PURE__ */ u("path", { d: "M18 8 v4 a6 6 0 0 1 -12 0 V8 z" })
274
- ] })), N = k(/* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("polyline", { points: "17 11 12 6 7 11" }), /* @__PURE__ */ u("polyline", { points: "17 17 12 22 7 17" })] })), be = k(/* @__PURE__ */ u("polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" })), P = k(/* @__PURE__ */ d(l, { children: [
275
- /* @__PURE__ */ u("polyline", { points: "3 6 5 6 21 6" }),
276
- /* @__PURE__ */ u("path", { d: "M19 6 l-1 14 c-.05 1.1 -.96 2 -2 2 H8 c-1.04 0 -1.95 -.9 -2 -2 L5 6" }),
277
- /* @__PURE__ */ u("path", { d: "M10 11 v6" }),
278
- /* @__PURE__ */ u("path", { d: "M14 11 v6" })
279
- ] })), xe = k(/* @__PURE__ */ d(l, { children: [
280
- /* @__PURE__ */ u("path", { d: "M18 16.98 h-5.99 c-1.1 0 -1.95 .94 -2.48 1.9 A4 4 0 0 1 2 17 c0 -1.42 .76 -2.66 1.9 -3.34" }),
281
- /* @__PURE__ */ u("path", { d: "M6 17 l3.13 -5.78 c.53 -.97 .43 -2.22 -.26 -3.07 A4 4 0 1 1 17 7" }),
282
- /* @__PURE__ */ u("path", { d: "M16 6.78 a4 4 0 1 1 5 6.31 c-.84 .6 -1.36 1.59 -1.36 2.61" })
283
- ] })), Se = k(/* @__PURE__ */ d(l, { children: [
284
- /* @__PURE__ */ u("line", {
169
+ }), /* @__PURE__ */ O("polygon", { points: "16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76" })] })), he = L(/* @__PURE__ */ k(D, { children: [
170
+ /* @__PURE__ */ O("path", { d: "M12 22 v-5" }),
171
+ /* @__PURE__ */ O("path", { d: "M9 8 V2" }),
172
+ /* @__PURE__ */ O("path", { d: "M15 8 V2" }),
173
+ /* @__PURE__ */ O("path", { d: "M18 8 v4 a6 6 0 0 1 -12 0 V8 z" })
174
+ ] })), ge = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("polyline", { points: "17 11 12 6 7 11" }), /* @__PURE__ */ O("polyline", { points: "17 17 12 22 7 17" })] })), _e = L(/* @__PURE__ */ k(D, { children: [
175
+ /* @__PURE__ */ O("polyline", { points: "3 6 5 6 21 6" }),
176
+ /* @__PURE__ */ O("path", { d: "M19 6 l-1 14 c-.05 1.1 -.96 2 -2 2 H8 c-1.04 0 -1.95 -.9 -2 -2 L5 6" }),
177
+ /* @__PURE__ */ O("path", { d: "M10 11 v6" }),
178
+ /* @__PURE__ */ O("path", { d: "M14 11 v6" })
179
+ ] })), ve = L(/* @__PURE__ */ k(D, { children: [
180
+ /* @__PURE__ */ O("path", { d: "M18 16.98 h-5.99 c-1.1 0 -1.95 .94 -2.48 1.9 A4 4 0 0 1 2 17 c0 -1.42 .76 -2.66 1.9 -3.34" }),
181
+ /* @__PURE__ */ O("path", { d: "M6 17 l3.13 -5.78 c.53 -.97 .43 -2.22 -.26 -3.07 A4 4 0 1 1 17 7" }),
182
+ /* @__PURE__ */ O("path", { d: "M16 6.78 a4 4 0 1 1 5 6.31 c-.84 .6 -1.36 1.59 -1.36 2.61" })
183
+ ] })), ye = L(/* @__PURE__ */ k(D, { children: [
184
+ /* @__PURE__ */ O("rect", {
185
+ x: "3",
186
+ y: "3",
187
+ width: "6",
188
+ height: "6",
189
+ rx: "1"
190
+ }),
191
+ /* @__PURE__ */ O("rect", {
192
+ x: "15",
193
+ y: "15",
194
+ width: "6",
195
+ height: "6",
196
+ rx: "1"
197
+ }),
198
+ /* @__PURE__ */ O("path", { d: "M9 6h3a3 3 0 0 1 3 3v3" }),
199
+ /* @__PURE__ */ O("path", { d: "M15 18h-3a3 3 0 0 1-3-3v-3" })
200
+ ] })), be = L(/* @__PURE__ */ k(D, { children: [
201
+ /* @__PURE__ */ O("line", {
285
202
  x1: "6",
286
203
  y1: "3",
287
204
  x2: "6",
288
205
  y2: "15"
289
206
  }),
290
- /* @__PURE__ */ u("circle", {
207
+ /* @__PURE__ */ O("circle", {
291
208
  cx: "18",
292
209
  cy: "6",
293
210
  r: "3"
294
211
  }),
295
- /* @__PURE__ */ u("circle", {
212
+ /* @__PURE__ */ O("circle", {
296
213
  cx: "6",
297
214
  cy: "18",
298
215
  r: "3"
299
216
  }),
300
- /* @__PURE__ */ u("path", { d: "M18 9 a9 9 0 0 1 -9 9" })
301
- ] })), Ce = ({ className: e }) => /* @__PURE__ */ d("svg", {
217
+ /* @__PURE__ */ O("path", { d: "M18 9 a9 9 0 0 1 -9 9" })
218
+ ] })), xe = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("circle", {
219
+ cx: "11",
220
+ cy: "11",
221
+ r: "7"
222
+ }), /* @__PURE__ */ O("path", { d: "m20 20-3.5-3.5" })] })), Se = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("path", { d: "M4 12h12M12 6l6 6-6 6" }), /* @__PURE__ */ O("path", { d: "M4 4v16" })] })), Ce = L(/* @__PURE__ */ k(D, { children: [
223
+ /* @__PURE__ */ O("path", { d: "M4 6h16M4 12h10M4 18h6" }),
224
+ /* @__PURE__ */ O("circle", {
225
+ cx: "18",
226
+ cy: "17",
227
+ r: "3"
228
+ }),
229
+ /* @__PURE__ */ O("path", { d: "m20.5 19.5 2 2" })
230
+ ] })), we = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("path", { d: "M5 4h14v16H5z" }), /* @__PURE__ */ O("path", { d: "M8 8h8M8 12h8M8 16h5" })] })), Te = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("rect", {
231
+ x: "3",
232
+ y: "4",
233
+ width: "18",
234
+ height: "12",
235
+ rx: "2"
236
+ }), /* @__PURE__ */ O("path", { d: "M8 20h8M12 16v4" })] })), Ee = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("rect", {
237
+ x: "3",
238
+ y: "4",
239
+ width: "18",
240
+ height: "16",
241
+ rx: "2"
242
+ }), /* @__PURE__ */ O("path", { d: "M3 14h18" })] })), De = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("rect", {
243
+ x: "3",
244
+ y: "4",
245
+ width: "18",
246
+ height: "16",
247
+ rx: "2"
248
+ }), /* @__PURE__ */ O("path", { d: "M3 10h18" })] })), Oe = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("rect", {
249
+ x: "3",
250
+ y: "4",
251
+ width: "18",
252
+ height: "16",
253
+ rx: "2"
254
+ }), /* @__PURE__ */ O("path", { d: "M9 4v16" })] })), ke = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("rect", {
255
+ x: "3",
256
+ y: "4",
257
+ width: "18",
258
+ height: "16",
259
+ rx: "2"
260
+ }), /* @__PURE__ */ O("path", { d: "M15 4v16" })] })), Ae = L(/* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("rect", {
261
+ x: "7",
262
+ y: "8",
263
+ width: "14",
264
+ height: "12",
265
+ rx: "2"
266
+ }), /* @__PURE__ */ O("path", { d: "M3 14V6a2 2 0 0 1 2-2h8" })] })), je = L(/* @__PURE__ */ k(D, { children: [
267
+ /* @__PURE__ */ O("circle", {
268
+ cx: "9",
269
+ cy: "6",
270
+ r: "1",
271
+ fill: "currentColor"
272
+ }),
273
+ /* @__PURE__ */ O("circle", {
274
+ cx: "15",
275
+ cy: "6",
276
+ r: "1",
277
+ fill: "currentColor"
278
+ }),
279
+ /* @__PURE__ */ O("circle", {
280
+ cx: "9",
281
+ cy: "12",
282
+ r: "1",
283
+ fill: "currentColor"
284
+ }),
285
+ /* @__PURE__ */ O("circle", {
286
+ cx: "15",
287
+ cy: "12",
288
+ r: "1",
289
+ fill: "currentColor"
290
+ }),
291
+ /* @__PURE__ */ O("circle", {
292
+ cx: "9",
293
+ cy: "18",
294
+ r: "1",
295
+ fill: "currentColor"
296
+ }),
297
+ /* @__PURE__ */ O("circle", {
298
+ cx: "15",
299
+ cy: "18",
300
+ r: "1",
301
+ fill: "currentColor"
302
+ })
303
+ ] })), Me = ({ className: e }) => /* @__PURE__ */ k("svg", {
302
304
  viewBox: "0 0 24 24",
303
305
  fill: "none",
304
306
  className: e,
305
307
  "aria-hidden": "true",
306
- children: [/* @__PURE__ */ u("circle", {
308
+ children: [/* @__PURE__ */ O("circle", {
307
309
  cx: "12",
308
310
  cy: "12",
309
311
  r: "9",
310
312
  stroke: "currentColor",
311
313
  strokeOpacity: "0.2",
312
314
  strokeWidth: "2.5"
313
- }), /* @__PURE__ */ u("path", {
315
+ }), /* @__PURE__ */ O("path", {
314
316
  d: "M21 12 a9 9 0 0 0 -9 -9",
315
317
  stroke: "currentColor",
316
318
  strokeWidth: "2.5",
317
319
  strokeLinecap: "round"
318
320
  })]
319
- }), we = [
320
- "topLeft",
321
- "topMid",
322
- "topRight",
323
- "midLeft",
324
- null,
325
- "midRight",
326
- "bottomLeft",
327
- "bottomMid",
328
- "bottomRight"
329
- ], Te = ({ anchor: e, onChange: t }) => /* @__PURE__ */ u("div", {
330
- role: "radiogroup",
331
- "aria-label": "Devtools position",
332
- className: "vdt:grid vdt:grid-cols-3 vdt:gap-0.5 vdt:p-1 vdt:bg-muted vdt:rounded-md",
333
- children: we.map((n, r) => {
334
- if (n === null) return /* @__PURE__ */ u("div", {
335
- "aria-hidden": "true",
336
- className: "vdt:w-3 vdt:h-3 vdt:rounded-sm vdt:bg-transparent"
337
- }, r);
338
- let i = n === e;
339
- return /* @__PURE__ */ u("button", {
340
- role: "radio",
341
- "aria-checked": i,
342
- "aria-label": n,
343
- title: n,
344
- onClick: () => t(n),
345
- className: ["vdt:w-3 vdt:h-3 vdt:rounded-sm vdt:transition-colors", i ? "vdt:bg-accent" : "vdt:bg-border hover:vdt:bg-border-strong"].join(" ")
346
- }, n);
347
- })
348
- }), Ee = 500, F = (e) => {
349
- let t = "";
350
- for (let n of e) t += `${n.key}|${n.subscriberCount}|${n.snapshot.revision}|${n.snapshot.pendingPatches}|${n.snapshot.error ? "1" : "0"}|${n.hasFiber ? "1" : "0"}|${n.evicting ? "1" : "0"};`;
351
- return t;
352
- }, De = (e) => {
353
- let [t, n] = s(() => e ? e.peekAll() : []), i = o(F(t));
354
- return r(() => {
355
- if (!e) return;
356
- let t = () => {
357
- let t = e.peekAll(), r = F(t);
358
- r !== i.current && (i.current = r, n(t));
359
- }, r = setInterval(t, Ee);
360
- return t(), () => clearInterval(r);
361
- }, [e]), t;
362
- }, I = {
321
+ }), Ne = {
363
322
  shell: {
364
323
  brand: "Voltro Devtools",
365
324
  brandWord: "Voltro",
366
325
  kicker: "Devtools",
367
326
  openLabel: "Open Voltro Devtools",
368
327
  openTitle: "Open Voltro Devtools (Alt+V)",
369
- closeTitle: "Close (Alt+V)"
328
+ closeTitle: "Close (Alt+V)",
329
+ searchPlaceholder: "Search subscriptions, mutations, traces, logs…",
330
+ searchLabel: "Search",
331
+ dockMenuTitle: "Dock position",
332
+ dockBottom: "Dock to bottom",
333
+ dockTop: "Dock to top",
334
+ dockLeft: "Dock to left",
335
+ dockRight: "Dock to right",
336
+ dockWindow: "Separate window",
337
+ pushPage: "Push the page",
338
+ pushPageHint: "Pads the document so the page reflows beside the console. Fixed-position bars and 100vw layouts ignore it.",
339
+ resizeLabel: "Resize",
340
+ moveTitle: "Drag to move",
341
+ scopeAll: "All",
342
+ connected: "connected",
343
+ recovering: "reconnecting",
344
+ degraded: "degraded",
345
+ offline: "offline",
346
+ live: "live",
347
+ pending: "pending",
348
+ failed: "failed",
349
+ errorsWord: (e) => e === 1 ? "error" : "errors",
350
+ warningsWord: (e) => e === 1 ? "warning" : "warnings",
351
+ results: (e) => `${e} result${e === 1 ? "" : "s"}`,
352
+ noResults: "Nothing matches.",
353
+ noResultsHint: "Search matches names, inputs, messages and error text. Quote a phrase to match it whole.",
354
+ emptyAll: "Nothing captured yet.",
355
+ emptyAllHint: "Subscriptions, mutations, traces and logs appear here as the app produces them.",
356
+ emptySubscriptions: "No live subscriptions.",
357
+ emptySubscriptionsHint: "Mount a `useSubscription` hook and its cache entry appears here.",
358
+ emptyMutations: "No mutations yet.",
359
+ emptyMutationsHint: "Every `useMutation` call lands here with its input, result and timing.",
360
+ emptyTraces: "No traces yet.",
361
+ emptyTracesHint: "Spans arrive from the api while the console is open.",
362
+ emptyLogs: "No log records yet.",
363
+ emptyLogsHint: "Records from `@voltro/logger` in this page land here.",
364
+ selectHint: "Select a row to see its detail.",
365
+ hintNavigate: "navigate",
366
+ hintOpen: "open",
367
+ hintToggle: "toggle",
368
+ hintDock: "dock",
369
+ crashTitle: "The devtools overlay hit an error. The page is unaffected.",
370
+ crashReset: "Reset overlay"
370
371
  },
371
372
  tabs: {
372
373
  subscriptions: "Subs",
@@ -377,7 +378,42 @@ var se = [
377
378
  traces: "Traces",
378
379
  routes: "Routes",
379
380
  runtimes: "Runtimes",
380
- logs: "Logs"
381
+ logs: "Logs",
382
+ workflows: "Workflows"
383
+ },
384
+ workflows: {
385
+ noApi: "No api processes connected — workflows discover from `*.workflow.tsx`.",
386
+ noDefinitions: "This api registers no workflows.",
387
+ noRuns: "No runs yet — start one above, or call `useWorkflow()` from the page.",
388
+ runsUnavailable: "The run list is unavailable — the api refused the workflow built-ins (check access or the api log).",
389
+ runs: (e) => `Runs (${e})`,
390
+ runsBadge: (e) => `${e} runs`,
391
+ runningBadge: (e) => `${e} running`,
392
+ child: "child",
393
+ start: "Start",
394
+ starting: "Starting…",
395
+ workflowLabel: "Workflow",
396
+ payloadLabel: "Payload (JSON)",
397
+ payloadHint: "Prefilled from the last run of this workflow; edit and start.",
398
+ invalidJson: (e) => `Payload is not valid JSON: ${e}`,
399
+ started: (e, t) => `Started · ${e} · ${t}`,
400
+ startFailed: (e) => `Start refused: ${e}`,
401
+ steps: (e) => `Steps (${e})`,
402
+ noSteps: "No steps recorded yet.",
403
+ events: (e) => `Events (${e})`,
404
+ attempt: (e) => `attempt ${e}`,
405
+ input: "Input",
406
+ output: "Output",
407
+ error: "Error",
408
+ trace: "trace",
409
+ cancel: "Cancel run",
410
+ cancelResult: (e) => `Cancel · ${e}`,
411
+ awaiting: "awaiting signal",
412
+ signalName: "Signal",
413
+ signalPayload: "Signal payload (JSON)",
414
+ sendSignal: "Send signal",
415
+ signalSent: (e) => `Signal \`${e}\` sent.`,
416
+ actionFailed: (e, t) => `${e} refused: ${t}`
381
417
  },
382
418
  subscriptions: {
383
419
  emptyTitle: "No active subscriptions.",
@@ -432,7 +468,7 @@ var se = [
432
468
  collapse: "collapse",
433
469
  expand: "expand",
434
470
  noLoaderTitle: "No loader data for this route.",
435
- noLoaderHint: (e) => /* @__PURE__ */ d(l, { children: [
471
+ noLoaderHint: (e) => /* @__PURE__ */ k(D, { children: [
436
472
  "Pages with an exported `loader` see their resolved data here. UI-only apps (no ",
437
473
  e,
438
474
  ") don't surface loader state at all."
@@ -447,7 +483,7 @@ var se = [
447
483
  noApi: "No API connected. Traces appear once a `useMutation` / `useSubscription` call runs.",
448
484
  noneCaptured: (e) => `${e} — no traces captured yet. Trigger an action.`,
449
485
  proxiedTitle: "Traces aren't fetchable from this browser — the API is reached over a proxied socket, so there's no direct inspect origin for this panel.",
450
- proxiedHint: (e) => /* @__PURE__ */ d(l, { children: [
486
+ proxiedHint: (e) => /* @__PURE__ */ k(D, { children: [
451
487
  "They're still recorded server-side. Use ",
452
488
  e,
453
489
  " or open the app's",
@@ -460,7 +496,7 @@ var se = [
460
496
  delivery: (e) => e === 1 ? "delivery" : "deliveries",
461
497
  spans: (e) => `${e} spans`
462
498
  }
463
- }, L = e(I), R = (e, t) => ({
499
+ }, Pe = t(Ne), Fe = (e, t) => ({
464
500
  shell: {
465
501
  ...e.shell,
466
502
  ...t.shell
@@ -500,39 +536,112 @@ var se = [
500
536
  traces: {
501
537
  ...e.traces,
502
538
  ...t.traces
539
+ },
540
+ workflows: {
541
+ ...e.workflows,
542
+ ...t.workflows
503
543
  }
504
544
  });
505
- function z(e) {
506
- let t = n(L), r = a(() => R(t, e.strings), [t, e.strings]);
507
- return /* @__PURE__ */ u(L.Provider, {
508
- value: r,
545
+ function Ie(e) {
546
+ let t = r(Pe), n = s(() => Fe(t, e.strings), [t, e.strings]);
547
+ return /* @__PURE__ */ O(Pe.Provider, {
548
+ value: n,
509
549
  children: e.children
510
550
  });
511
551
  }
512
- var B = (e) => {
513
- let t = n(L);
514
- return a(() => e ? R(t, e) : t, [t, e]);
515
- }, Oe = () => {
516
- let e = b();
552
+ var R = (e) => {
553
+ let t = r(Pe);
554
+ return s(() => e ? Fe(t, e) : t, [t, e]);
555
+ }, Le = {
556
+ default: "vdt:bg-muted vdt:text-foreground vdt:hover:bg-muted/80",
557
+ ghost: "vdt:bg-transparent vdt:text-foreground vdt:hover:bg-muted/50",
558
+ outline: "vdt:bg-transparent vdt:text-foreground vdt:border vdt:border-border vdt:hover:border-border-strong",
559
+ accent: "vdt:bg-accent vdt:text-accent-foreground vdt:hover:bg-accent-dim",
560
+ danger: "vdt:bg-danger/15 vdt:text-danger vdt:hover:bg-danger/25"
561
+ }, Re = {
562
+ sm: "vdt:text-xs vdt:px-2 vdt:py-1 vdt:rounded-sm",
563
+ md: "vdt:text-sm vdt:px-3 vdt:py-1.5 vdt:rounded-md"
564
+ }, z = ({ variant: e = "default", size: t = "md", onClick: n, disabled: r, children: i, className: a, title: o }) => /* @__PURE__ */ O("button", {
565
+ onClick: n,
566
+ disabled: r,
567
+ title: o,
568
+ className: [
569
+ "vdt:inline-flex vdt:items-center vdt:gap-1.5 vdt:font-medium vdt:transition-colors",
570
+ "vdt:disabled:opacity-40 vdt:disabled:cursor-not-allowed",
571
+ Le[e],
572
+ Re[t],
573
+ a ?? ""
574
+ ].join(" "),
575
+ children: i
576
+ }), ze = {
577
+ neutral: "vdt:bg-muted vdt:text-foreground-muted vdt:border vdt:border-border",
578
+ success: "vdt:bg-success/15 vdt:text-success vdt:border vdt:border-success/30",
579
+ warning: "vdt:bg-warning/15 vdt:text-warning vdt:border vdt:border-warning/30",
580
+ danger: "vdt:bg-danger/15 vdt:text-danger vdt:border vdt:border-danger/30",
581
+ info: "vdt:bg-info/15 vdt:text-info vdt:border vdt:border-info/30",
582
+ accent: "vdt:bg-accent/15 vdt:text-accent vdt:border vdt:border-accent/30"
583
+ }, B = ({ tone: e = "neutral", children: t, className: n }) => /* @__PURE__ */ O("span", {
584
+ className: [
585
+ "vdt:inline-flex vdt:items-center vdt:gap-1 vdt:px-1.5 vdt:py-0.5",
586
+ "vdt:rounded-sm vdt:text-[10px] vdt:font-medium vdt:uppercase vdt:tracking-wider",
587
+ ze[e],
588
+ n ?? ""
589
+ ].join(" "),
590
+ children: t
591
+ }), V = ({ children: e, className: t }) => /* @__PURE__ */ O("div", {
592
+ className: ["vdt:bg-background-elevated vdt:border vdt:border-border vdt:rounded-md", t ?? ""].join(" "),
593
+ children: e
594
+ }), H = ({ children: e, right: t, Icon: n }) => /* @__PURE__ */ k("div", {
595
+ className: "vdt:flex vdt:items-center vdt:justify-between vdt:px-3 vdt:py-2 vdt:border-b vdt:border-border",
596
+ children: [/* @__PURE__ */ k("div", {
597
+ className: "vdt:flex vdt:items-center vdt:gap-1.5",
598
+ children: [n ? /* @__PURE__ */ O(n, { className: "vdt:w-3 vdt:h-3 vdt:text-foreground-muted" }) : null, /* @__PURE__ */ O("span", {
599
+ className: "vdt:text-[10px] vdt:font-semibold vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted",
600
+ children: e
601
+ })]
602
+ }), t ?? null]
603
+ }), U = ({ entries: e }) => /* @__PURE__ */ O("dl", {
604
+ className: "vdt:grid vdt:grid-cols-[auto_1fr] vdt:gap-x-3 vdt:gap-y-1 vdt:px-3 vdt:py-2 vdt:text-xs",
605
+ children: e.map((e) => /* @__PURE__ */ k("div", {
606
+ className: "vdt:contents",
607
+ children: [/* @__PURE__ */ O("dt", {
608
+ className: "vdt:text-foreground-muted vdt:font-medium",
609
+ children: e.key
610
+ }), /* @__PURE__ */ O("dd", {
611
+ className: "vdt:font-mono vdt:text-foreground vdt:break-all",
612
+ children: e.value
613
+ })]
614
+ }, e.key))
615
+ }), W = ({ children: e }) => /* @__PURE__ */ O("div", {
616
+ className: "vdt:flex vdt:items-center vdt:justify-center vdt:py-12 vdt:px-6 vdt:text-center",
617
+ children: /* @__PURE__ */ O("div", {
618
+ className: "vdt:text-xs vdt:text-foreground-subtle vdt:max-w-xs",
619
+ children: e
620
+ })
621
+ }), Be = 500, Ve = (e) => {
622
+ let t = "";
623
+ for (let n of e) t += `${n.key}|${n.subscriberCount}|${n.snapshot.revision}|${n.snapshot.pendingPatches}|${n.snapshot.error ? "1" : "0"}|${n.hasFiber ? "1" : "0"}|${n.evicting ? "1" : "0"};`;
624
+ return t;
625
+ }, He = (e) => {
626
+ let [t, n] = l(() => e ? e.peekAll() : []), r = c(Ve(t));
627
+ return i(() => {
628
+ if (!e) return;
629
+ let t = () => {
630
+ let t = e.peekAll(), i = Ve(t);
631
+ i !== r.current && (r.current = i, n(t));
632
+ }, i = setInterval(t, Be);
633
+ return t(), () => clearInterval(i);
634
+ }, [e]), t;
635
+ }, Ue = () => {
636
+ let e = T();
517
637
  return e.names.map((t) => ({
518
638
  name: t,
519
639
  entries: e.get(t).cache.peekAll()
520
640
  }));
521
- }, V = () => {
522
- let e = b();
523
- return De((e.names[0] ? e.get(e.names[0]) : null)?.cache ?? null), Oe();
524
- }, ke = () => {
525
- let [e, t] = s(() => m().events);
526
- return r(() => te(() => {
527
- t(m().events);
528
- }), []), e.slice(-80).reverse();
529
- }, Ae = (e) => {
530
- let { snapshot: t, hasFiber: n, evicting: r } = e;
531
- return e.recovery.phase === "stuck" ? "danger" : e.recovery.phase === "steady" ? t.error ? "danger" : t.pendingPatches > 0 ? "warning" : t.revision >= 0 ? "success" : r ? "neutral" : n ? "info" : "neutral" : "warning";
532
- }, je = ({ tone: e }) => /* @__PURE__ */ u("span", {
533
- "aria-hidden": "true",
534
- className: ["vdt:inline-block vdt:w-2 vdt:h-2 vdt:rounded-full", e === "success" ? "vdt:bg-success" : e === "info" ? "vdt:bg-info" : e === "danger" ? "vdt:bg-danger" : e === "warning" ? "vdt:bg-warning" : "vdt:bg-foreground-subtle"].join(" ")
535
- }), Me = (e) => {
641
+ }, We = () => {
642
+ let e = T();
643
+ return He((e.names[0] ? e.get(e.names[0]) : null)?.cache ?? null), Ue();
644
+ }, Ge = (e) => {
536
645
  try {
537
646
  let t = JSON.parse(e);
538
647
  if (Array.isArray(t)) {
@@ -541,754 +650,510 @@ var B = (e) => {
541
650
  }
542
651
  } catch {}
543
652
  return e;
544
- }, Ne = ({ entry: e, expanded: t, onToggle: n }) => {
545
- let r = Ae(e);
546
- return /* @__PURE__ */ d("div", {
547
- className: "vdt:border-b last:vdt:border-b-0 vdt:border-border",
548
- children: [/* @__PURE__ */ d("button", {
549
- onClick: n,
550
- className: "vdt:w-full vdt:flex vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-1.5 hover:vdt:bg-muted/40 vdt:transition-colors",
551
- children: [
552
- /* @__PURE__ */ u(je, { tone: r }),
553
- /* @__PURE__ */ u("span", {
554
- className: "vdt:flex-1 vdt:text-xs vdt:font-mono vdt:truncate vdt:text-left vdt:text-foreground",
555
- children: Me(e.key)
556
- }),
557
- e.snapshot.pendingPatches > 0 ? /* @__PURE__ */ d(w, {
558
- tone: "warning",
559
- children: ["+", e.snapshot.pendingPatches]
560
- }) : null,
561
- e.recovery.phase === "steady" ? null : /* @__PURE__ */ u(w, {
562
- tone: e.recovery.phase === "stuck" ? "danger" : "warning",
563
- children: e.recovery.phase
564
- }),
565
- e.subscriberCount > 0 ? /* @__PURE__ */ u(w, {
566
- tone: "neutral",
567
- children: e.subscriberCount
568
- }) : null,
569
- e.snapshot.revision >= 0 ? /* @__PURE__ */ d("span", {
570
- className: "vdt:text-[10px] vdt:text-foreground-subtle vdt:font-mono",
571
- children: ["r", e.snapshot.revision]
572
- }) : null
573
- ]
574
- }), t ? /* @__PURE__ */ d("div", {
575
- className: "vdt:bg-background/60 vdt:border-t vdt:border-border",
576
- children: [/* @__PURE__ */ u(D, { entries: [
577
- {
578
- key: "tag",
579
- value: e.tag ?? "—"
580
- },
581
- {
582
- key: "source",
583
- value: e.source ?? "—"
584
- },
585
- {
586
- key: "subscribers",
587
- value: String(e.subscriberCount)
588
- },
589
- {
590
- key: "fiber",
591
- value: e.hasFiber ? "running" : e.evicting ? "evicting" : "idle"
592
- },
593
- {
594
- key: "recovery",
595
- value: e.recovery.phase
596
- },
597
- {
598
- key: "recoveryAttempt",
599
- value: String(e.recovery.attempt)
600
- },
601
- {
602
- key: "basePreserved",
603
- value: String(e.recovery.basePreserved)
604
- },
605
- {
606
- key: "lastTransportFailureAt",
607
- value: e.recovery.lastTransportFailureAt ? new Date(e.recovery.lastTransportFailureAt).toISOString() : "—"
608
- },
609
- {
610
- key: "lastReissueAt",
611
- value: e.recovery.lastReissueAt ? new Date(e.recovery.lastReissueAt).toISOString() : "—"
612
- },
613
- {
614
- key: "lastDeliveryAt",
615
- value: e.recovery.lastDeliveryAt ? new Date(e.recovery.lastDeliveryAt).toISOString() : "—"
616
- },
617
- {
618
- key: "revision",
619
- value: e.snapshot.revision >= 0 ? String(e.snapshot.revision) : "—"
620
- },
621
- {
622
- key: "emittedAt",
623
- value: e.snapshot.emittedAt ? new Date(e.snapshot.emittedAt).toISOString() : "—"
624
- },
625
- {
626
- key: "pendingPatches",
627
- value: String(e.snapshot.pendingPatches)
628
- },
629
- {
630
- key: "error",
631
- value: e.snapshot.error ? String(e.snapshot.error) : "—"
653
+ }, Ke = ({ entry: e }) => /* @__PURE__ */ k("div", {
654
+ className: "vdt:bg-background/60",
655
+ children: [/* @__PURE__ */ O(U, { entries: [
656
+ {
657
+ key: "tag",
658
+ value: e.tag ?? "—"
659
+ },
660
+ {
661
+ key: "source",
662
+ value: e.source ?? "—"
663
+ },
664
+ {
665
+ key: "subscribers",
666
+ value: String(e.subscriberCount)
667
+ },
668
+ {
669
+ key: "fiber",
670
+ value: e.hasFiber ? "running" : e.evicting ? "evicting" : "idle"
671
+ },
672
+ {
673
+ key: "recovery",
674
+ value: e.recovery.phase
675
+ },
676
+ {
677
+ key: "recoveryAttempt",
678
+ value: String(e.recovery.attempt)
679
+ },
680
+ {
681
+ key: "basePreserved",
682
+ value: String(e.recovery.basePreserved)
683
+ },
684
+ {
685
+ key: "lastTransportFailureAt",
686
+ value: e.recovery.lastTransportFailureAt ? new Date(e.recovery.lastTransportFailureAt).toISOString() : "—"
687
+ },
688
+ {
689
+ key: "lastReissueAt",
690
+ value: e.recovery.lastReissueAt ? new Date(e.recovery.lastReissueAt).toISOString() : "—"
691
+ },
692
+ {
693
+ key: "lastDeliveryAt",
694
+ value: e.recovery.lastDeliveryAt ? new Date(e.recovery.lastDeliveryAt).toISOString() : "—"
695
+ },
696
+ {
697
+ key: "revision",
698
+ value: e.snapshot.revision >= 0 ? String(e.snapshot.revision) : "—"
699
+ },
700
+ {
701
+ key: "emittedAt",
702
+ value: e.snapshot.emittedAt ? new Date(e.snapshot.emittedAt).toISOString() : "—"
703
+ },
704
+ {
705
+ key: "pendingPatches",
706
+ value: String(e.snapshot.pendingPatches)
707
+ },
708
+ {
709
+ key: "error",
710
+ value: e.snapshot.error ? String(e.snapshot.error) : "—"
711
+ }
712
+ ] }), /* @__PURE__ */ k("details", {
713
+ className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
714
+ children: [/* @__PURE__ */ O("summary", {
715
+ className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:cursor-pointer",
716
+ children: "Data"
717
+ }), /* @__PURE__ */ O("pre", {
718
+ className: "vdt:mt-2 vdt:text-[11px] vdt:text-foreground vdt:max-h-64 vdt:overflow-auto vdt:font-mono",
719
+ children: (() => {
720
+ try {
721
+ return JSON.stringify(e.snapshot.data, null, 2);
722
+ } catch {
723
+ return String(e.snapshot.data);
632
724
  }
633
- ] }), /* @__PURE__ */ d("details", {
634
- className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
635
- children: [/* @__PURE__ */ u("summary", {
636
- className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:cursor-pointer",
637
- children: "Data"
638
- }), /* @__PURE__ */ u("pre", {
639
- className: "vdt:mt-2 vdt:text-[11px] vdt:text-foreground vdt:max-h-64 vdt:overflow-auto vdt:font-mono",
640
- children: (() => {
641
- try {
642
- return JSON.stringify(e.snapshot.data, null, 2);
643
- } catch {
644
- return String(e.snapshot.data);
645
- }
646
- })()
647
- })]
648
- })]
649
- }) : null]
725
+ })()
726
+ })]
727
+ })]
728
+ }), qe = () => We().reduce((e, t) => e + t.entries.length, 0), Je = (e) => e === "compiling" || e === "loading" || e === "reconnecting", Ye = () => u(le, I, I), Xe = ({ name: e }) => {
729
+ let t = w(e).status;
730
+ return /* @__PURE__ */ k("span", {
731
+ className: "vdt-chip",
732
+ "data-status": t,
733
+ children: [/* @__PURE__ */ O("span", {
734
+ className: `vdt-dot vdt-dot-${t === "connected" ? "ok" : t === "recovering" ? "warn" : "err"}`,
735
+ "aria-hidden": "true"
736
+ }), /* @__PURE__ */ O("b", { children: e })]
650
737
  });
651
- }, Pe = () => {
652
- let e = V(), t = ke(), n = B().subscriptions, [r, i] = s(null);
653
- return e.reduce((e, t) => e + t.entries.length, 0) === 0 && t.length === 0 ? /* @__PURE__ */ d(O, { children: [n.emptyTitle, /* @__PURE__ */ u("div", {
654
- className: "vdt:mt-1 vdt:text-foreground-subtle",
655
- children: n.emptyHint
656
- })] }) : /* @__PURE__ */ d("div", {
657
- className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
658
- children: [e.map((e) => e.entries.length === 0 ? null : /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ u(E, {
659
- Icon: j,
660
- right: /* @__PURE__ */ u(w, {
661
- tone: "accent",
662
- children: e.entries.length
663
- }),
664
- children: e.name
665
- }), e.entries.map((t) => /* @__PURE__ */ u(Ne, {
666
- entry: t,
667
- expanded: r === `${e.name}:${t.key}`,
668
- onToggle: () => i((n) => n === `${e.name}:${t.key}` ? null : `${e.name}:${t.key}`)
669
- }, t.key))] }, e.name)), t.length > 0 ? /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ u(E, {
670
- Icon: j,
671
- right: /* @__PURE__ */ u(w, {
672
- tone: "neutral",
673
- children: t.length
674
- }),
675
- children: n.timelineTitle
676
- }), /* @__PURE__ */ u("div", {
677
- className: "vdt:max-h-72 vdt:overflow-auto",
678
- children: t.map((e) => /* @__PURE__ */ d("div", {
679
- className: "vdt:border-b last:vdt:border-b-0 vdt:border-border vdt:px-3 vdt:py-1.5",
680
- children: [/* @__PURE__ */ d("div", {
681
- className: "vdt:flex vdt:gap-2 vdt:text-[11px] vdt:font-mono",
738
+ }, Ze = ({ status: e, onOpen: t, buttonRef: n }) => {
739
+ let r = R().shell, i = T(), a = qe(), o = u(x, y, y), s = Ye(), c = o.filter((e) => e.status === "pending").length, l = o.filter((e) => e.status === "error").length, d = s.filter((e) => e.level === "error" || e.level === "fatal").length, f = s.filter((e) => e.level === "warn").length, p = e !== null, m = e?.kind ?? "idle", h = e === null ? "" : Je(m) ? e.label.replace(/[…\.\s]+$/, "") : e.label;
740
+ return /* @__PURE__ */ k("button", {
741
+ ref: n,
742
+ type: "button",
743
+ className: "vdt-capsule",
744
+ "data-busy": p ? "true" : "false",
745
+ "data-kind": m,
746
+ onClick: t,
747
+ title: r.openTitle,
748
+ "aria-label": r.openLabel,
749
+ children: [p ? /* @__PURE__ */ O(Me, { className: "vdt-capsule-mark vdt-spinner" }) : /* @__PURE__ */ O(ue, { className: "vdt-capsule-mark" }), p ? /* @__PURE__ */ k("span", {
750
+ className: "vdt-capsule-status",
751
+ children: [h, Je(m) ? /* @__PURE__ */ k("span", {
752
+ className: "vdt-dots",
753
+ "aria-hidden": "true",
754
+ children: [
755
+ /* @__PURE__ */ O("span", {}),
756
+ /* @__PURE__ */ O("span", {}),
757
+ /* @__PURE__ */ O("span", {})
758
+ ]
759
+ }) : null]
760
+ }) : /* @__PURE__ */ k("span", {
761
+ className: "vdt-capsule-chips",
762
+ children: [
763
+ i.names.map((e) => /* @__PURE__ */ O(Xe, { name: e }, e)),
764
+ /* @__PURE__ */ k("span", {
765
+ className: "vdt-chip",
766
+ "data-chip": "live",
682
767
  children: [
683
- /* @__PURE__ */ d("span", {
684
- className: "vdt:text-foreground-subtle",
685
- children: [
686
- "+",
687
- e.elapsedMs,
688
- "ms"
689
- ]
768
+ /* @__PURE__ */ O("b", { children: a }),
769
+ " ",
770
+ r.live
771
+ ]
772
+ }),
773
+ c > 0 ? /* @__PURE__ */ k("span", {
774
+ className: "vdt-chip vdt-chip-info",
775
+ "data-chip": "pending",
776
+ children: [
777
+ /* @__PURE__ */ O("span", {
778
+ className: "vdt-dot vdt-dot-info",
779
+ "aria-hidden": "true"
690
780
  }),
691
- /* @__PURE__ */ u("span", {
692
- className: "vdt:text-foreground-muted",
693
- children: e.api
781
+ /* @__PURE__ */ O("b", { children: c }),
782
+ " ",
783
+ r.pending
784
+ ]
785
+ }) : null,
786
+ l > 0 ? /* @__PURE__ */ k("span", {
787
+ className: "vdt-chip vdt-chip-err",
788
+ "data-chip": "failed",
789
+ children: [
790
+ /* @__PURE__ */ O("span", {
791
+ className: "vdt-dot vdt-dot-err",
792
+ "aria-hidden": "true"
694
793
  }),
695
- /* @__PURE__ */ u("span", {
696
- className: "vdt:text-foreground",
697
- children: e.kind
698
- })
794
+ /* @__PURE__ */ O("b", { children: l }),
795
+ " ",
796
+ r.failed
797
+ ]
798
+ }) : null,
799
+ d > 0 ? /* @__PURE__ */ k("span", {
800
+ className: "vdt-chip vdt-chip-err",
801
+ "data-chip": "errors",
802
+ children: [
803
+ /* @__PURE__ */ O("b", { children: d }),
804
+ " ",
805
+ r.errorsWord(d)
806
+ ]
807
+ }) : null,
808
+ d === 0 && f > 0 ? /* @__PURE__ */ k("span", {
809
+ className: "vdt-chip vdt-chip-warn",
810
+ "data-chip": "warnings",
811
+ children: [
812
+ /* @__PURE__ */ O("b", { children: f }),
813
+ " ",
814
+ r.warningsWord(f)
699
815
  ]
700
- }), Object.keys(e.fields).length > 0 ? /* @__PURE__ */ u("div", {
701
- className: "vdt:mt-0.5 vdt:text-[10px] vdt:text-foreground-subtle vdt:font-mono vdt:break-all",
702
- children: JSON.stringify(e.fields)
703
- }) : null]
704
- }, e.sequence))
705
- })] }) : null]
816
+ }) : null
817
+ ]
818
+ })]
706
819
  });
707
- }, Fe = () => V().reduce((e, t) => e + t.entries.length, 0), Ie = (e) => {
820
+ }, Qe = [
821
+ "bottom",
822
+ "top",
823
+ "left",
824
+ "right",
825
+ "window"
826
+ ], $e = [
827
+ "bottom",
828
+ "top",
829
+ "left",
830
+ "right"
831
+ ], et = (e) => typeof e == "string" && Qe.includes(e), tt = (e) => e !== "window", nt = {
832
+ bottom: 240,
833
+ top: 240,
834
+ left: 320,
835
+ right: 320
836
+ }, G = {
837
+ w: 480,
838
+ h: 320
839
+ }, rt = 64, K = {
840
+ dock: "bottom",
841
+ sizes: {
842
+ bottom: 400,
843
+ top: 400,
844
+ left: 460,
845
+ right: 460
846
+ },
847
+ window: {
848
+ x: 80,
849
+ y: 80,
850
+ w: 860,
851
+ h: 560
852
+ },
853
+ push: !1
854
+ }, it = "voltro:devtools:dock", q = (e) => typeof e == "number" && Number.isFinite(e), at = (e, t) => {
855
+ let n = {
856
+ ...K,
857
+ dock: t
858
+ };
859
+ if (typeof e != "object" || !e) return n;
860
+ let r = e, i = typeof r.sizes == "object" && r.sizes !== null ? r.sizes : {}, a = { ...K.sizes };
861
+ for (let e of $e) {
862
+ let t = i[e];
863
+ q(t) && t >= nt[e] && (a[e] = Math.round(t));
864
+ }
865
+ let o = typeof r.window == "object" && r.window !== null ? r.window : {}, s = {
866
+ x: q(o.x) ? Math.round(o.x) : n.window.x,
867
+ y: q(o.y) ? Math.round(o.y) : n.window.y,
868
+ w: q(o.w) && o.w >= G.w ? Math.round(o.w) : n.window.w,
869
+ h: q(o.h) && o.h >= G.h ? Math.round(o.h) : n.window.h
870
+ };
871
+ return {
872
+ dock: et(r.dock) ? r.dock : t,
873
+ sizes: a,
874
+ window: s,
875
+ push: r.push === !0
876
+ };
877
+ }, ot = (e) => {
878
+ if (typeof window > "u") return {
879
+ ...K,
880
+ dock: e
881
+ };
708
882
  try {
709
- return JSON.stringify(e, null, 2);
883
+ let t = window.localStorage.getItem(it);
884
+ return t === null ? {
885
+ ...K,
886
+ dock: e
887
+ } : at(JSON.parse(t), e);
710
888
  } catch {
711
- return String(e);
889
+ return {
890
+ ...K,
891
+ dock: e
892
+ };
893
+ }
894
+ }, st = (e) => {
895
+ if (!(typeof window > "u")) try {
896
+ window.localStorage.setItem(it, JSON.stringify(e));
897
+ } catch {}
898
+ }, ct = () => typeof window > "u" ? {
899
+ width: 1440,
900
+ height: 900
901
+ } : {
902
+ width: window.innerWidth,
903
+ height: window.innerHeight
904
+ }, lt = (e, t, n = ct()) => {
905
+ let r = e === "left" || e === "right" ? n.width : n.height, i = Math.max(nt[e], r - rt);
906
+ return Math.round(Math.min(i, Math.max(nt[e], t)));
907
+ }, J = (e, t = ct()) => {
908
+ let n = Math.max(120, t.width - 16), r = Math.max(120, t.height - 16), i = Math.round(Math.min(Math.max(Math.min(G.w, n), e.w), n)), a = Math.round(Math.min(Math.max(Math.min(G.h, r), e.h), r));
909
+ return {
910
+ x: Math.round(Math.min(Math.max(8, e.x), Math.max(8, t.width - i - 8))),
911
+ y: Math.round(Math.min(Math.max(8, e.y), Math.max(8, t.height - a - 8))),
912
+ w: i,
913
+ h: a
914
+ };
915
+ }, ut = (e, t) => {
916
+ let n = { ...e.sizes }, r = !1;
917
+ for (let e of $e) {
918
+ let i = lt(e, n[e], t);
919
+ i !== n[e] && (n[e] = i, r = !0);
712
920
  }
713
- }, Le = () => c(ie, ne, ne), Re = () => {
714
- let [e, t] = s(() => typeof window > "u" ? "/" : window.location.pathname);
715
- return r(() => {
921
+ let i = J(e.window, t), a = i.x !== e.window.x || i.y !== e.window.y || i.w !== e.window.w || i.h !== e.window.h;
922
+ return !r && !a ? e : {
923
+ ...e,
924
+ sizes: n,
925
+ window: i
926
+ };
927
+ }, dt = (e) => (window.addEventListener("resize", e), () => window.removeEventListener("resize", e)), Y = {
928
+ width: 0,
929
+ height: 0
930
+ }, ft = () => {
931
+ let e = window.innerWidth, t = window.innerHeight;
932
+ return (Y.width !== e || Y.height !== t) && (Y = {
933
+ width: e,
934
+ height: t
935
+ }), Y;
936
+ }, pt = {
937
+ width: 1440,
938
+ height: 900
939
+ }, mt = () => pt, ht = () => u(dt, ft, mt), gt = (e = "bottom") => {
940
+ let [t, r] = l(() => ot(e));
941
+ i(() => {
716
942
  if (typeof window > "u") return;
717
- let e = () => t(window.location.pathname);
718
- window.addEventListener("popstate", e);
719
- let n = setInterval(e, 1e3);
720
- return () => {
721
- window.removeEventListener("popstate", e), clearInterval(n);
943
+ let t = (t) => {
944
+ if (t.key === it && t.newValue !== null) try {
945
+ r(at(JSON.parse(t.newValue), e));
946
+ } catch {}
722
947
  };
723
- }, []), e;
724
- }, ze = () => {
725
- let e = Le(), t = Re(), n = B().routes, [r, i] = s(!0), a = e.pathname === "/" && Object.keys(e.params).length === 0 && e.loaderData === void 0 && t !== "/" ? t : e.pathname, o = Object.entries(e.params).map(([e, t]) => ({
726
- key: e,
727
- value: String(t)
728
- }));
729
- return /* @__PURE__ */ d("div", {
730
- className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
731
- children: [/* @__PURE__ */ d(T, { children: [
732
- /* @__PURE__ */ u(E, {
733
- Icon: M,
734
- children: n.currentRoute
735
- }),
736
- /* @__PURE__ */ u(D, { entries: [{
737
- key: "pathname",
738
- value: a
739
- }, {
740
- key: "params",
741
- value: o.length === 0 ? "—" : ""
742
- }] }),
743
- o.length > 0 ? /* @__PURE__ */ u("div", {
744
- className: "vdt:px-3 vdt:pb-3",
745
- children: /* @__PURE__ */ u(D, { entries: o })
746
- }) : null
747
- ] }), /* @__PURE__ */ d(T, { children: [
748
- /* @__PURE__ */ u(E, {
749
- Icon: M,
750
- children: n.loaderData
751
- }),
752
- /* @__PURE__ */ u("button", {
753
- onClick: () => i((e) => !e),
754
- className: "vdt:px-3 vdt:py-1.5 vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted hover:vdt:text-foreground",
755
- children: r ? n.collapse : n.expand
756
- }),
757
- r ? e.loaderData === void 0 ? /* @__PURE__ */ d(O, { children: [n.noLoaderTitle, /* @__PURE__ */ u("div", {
758
- className: "vdt:mt-1 vdt:text-foreground-subtle",
759
- children: n.noLoaderHint(/* @__PURE__ */ u("code", { children: "<Router>" }))
760
- })] }) : /* @__PURE__ */ u("pre", {
761
- className: "vdt:px-3 vdt:pb-3 vdt:text-[11px] vdt:max-h-80 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
762
- children: Ie(e.loaderData)
763
- }) : null
764
- ] })]
765
- });
766
- }, Be = (e) => {
767
- let t = 0, n = 0, r = 0, i = 0, a = 0;
768
- for (let o of Object.values(e)) o.kind === "query" && (t += 1), o.kind === "mutation" && (n += 1), o.kind === "action" && (r += 1), o.kind === "stream" && (i += 1), o.kind === "workflow" && (a += 1);
769
- return {
770
- queries: t,
771
- mutations: n,
772
- actions: r,
773
- streams: i,
774
- workflows: a
775
- };
776
- }, Ve = () => {
777
- let e = b(), t = B().runtimes, n = e.names;
778
- return n.length === 0 ? /* @__PURE__ */ d(O, { children: [t.emptyTitle, /* @__PURE__ */ u("div", {
779
- className: "vdt:mt-1 vdt:text-foreground-subtle",
780
- children: t.emptyHint
781
- })] }) : /* @__PURE__ */ u("div", {
782
- className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
783
- children: n.map((n) => {
784
- let r = e.get(n), i = Be(r.descriptors);
785
- return /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ u(E, {
786
- Icon: ye,
787
- right: /* @__PURE__ */ u(w, {
788
- tone: "success",
789
- children: t.live
790
- }),
791
- children: n
792
- }), /* @__PURE__ */ u(D, { entries: [
793
- {
794
- key: "queries",
795
- value: String(i.queries)
796
- },
797
- {
798
- key: "mutations",
799
- value: String(i.mutations)
800
- },
801
- {
802
- key: "actions",
803
- value: String(i.actions)
804
- },
805
- {
806
- key: "streams",
807
- value: String(i.streams)
808
- },
809
- {
810
- key: "workflows",
811
- value: String(i.workflows)
812
- },
813
- {
814
- key: "cacheSize",
815
- value: String(r.cache.size())
816
- },
817
- {
818
- key: "descriptors",
819
- value: String(Object.keys(r.descriptors).length)
820
- }
821
- ] })] }, n);
822
- })
823
- });
824
- }, H = () => c(_, h, h), He = (e) => typeof e == "number" ? e < 1 ? "<1ms" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s` : "—", U = (e) => {
825
- try {
826
- return JSON.stringify(e, null, 2);
827
- } catch {
828
- return String(e);
829
- }
830
- }, Ue = (e) => e === "pending" ? "info" : e === "success" ? "success" : "danger", We = ({ tone: e }) => /* @__PURE__ */ u("span", {
831
- "aria-hidden": "true",
832
- className: ["vdt:inline-block vdt:w-2 vdt:h-2 vdt:rounded-full", e === "success" ? "vdt:bg-success" : e === "danger" ? "vdt:bg-danger" : "vdt:bg-info"].join(" ")
833
- }), Ge = ({ mutation: e, expanded: t, onToggle: n }) => {
834
- let r = Ue(e.status), i = new Date(e.startedAt).toISOString().slice(11, 23);
835
- return /* @__PURE__ */ d("div", {
836
- className: "vdt:border-b last:vdt:border-b-0 vdt:border-border",
837
- children: [/* @__PURE__ */ d("button", {
838
- onClick: n,
839
- className: "vdt:w-full vdt:flex vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-1.5 hover:vdt:bg-muted/40 vdt:transition-colors",
840
- children: [
841
- /* @__PURE__ */ u(We, { tone: r }),
842
- /* @__PURE__ */ u("span", {
843
- className: "vdt:text-[10px] vdt:text-foreground-subtle vdt:font-mono vdt:tabular-nums",
844
- children: i
845
- }),
846
- /* @__PURE__ */ d("span", {
847
- className: "vdt:flex-1 vdt:flex vdt:items-center vdt:gap-1.5 vdt:min-w-0 vdt:text-left",
848
- children: [/* @__PURE__ */ u(w, {
849
- tone: "accent",
850
- children: e.apiName
851
- }), /* @__PURE__ */ u("span", {
852
- className: "vdt:text-xs vdt:font-mono vdt:text-foreground vdt:truncate",
853
- children: e.tag
854
- })]
855
- }),
856
- /* @__PURE__ */ u("span", {
857
- className: "vdt:text-[10px] vdt:font-mono vdt:text-foreground-muted vdt:tabular-nums",
858
- children: He(e.durationMs)
859
- })
860
- ]
861
- }), t ? /* @__PURE__ */ d("div", {
862
- className: "vdt:bg-background/60 vdt:border-t vdt:border-border",
863
- children: [
864
- /* @__PURE__ */ u(D, { entries: [
865
- {
866
- key: "id",
867
- value: e.id
868
- },
869
- {
870
- key: "api",
871
- value: e.apiName
872
- },
873
- {
874
- key: "tag",
875
- value: e.tag
876
- },
877
- {
878
- key: "status",
879
- value: e.status
880
- },
881
- {
882
- key: "startedAt",
883
- value: new Date(e.startedAt).toISOString()
884
- },
885
- {
886
- key: "settledAt",
887
- value: e.settledAt ? new Date(e.settledAt).toISOString() : "—"
888
- },
889
- {
890
- key: "duration",
891
- value: He(e.durationMs)
892
- }
893
- ] }),
894
- /* @__PURE__ */ d("details", {
895
- className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
896
- children: [/* @__PURE__ */ u("summary", {
897
- className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:cursor-pointer",
898
- children: "Input"
899
- }), /* @__PURE__ */ u("pre", {
900
- className: "vdt:mt-2 vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
901
- children: U(e.input)
902
- })]
903
- }),
904
- e.status === "success" ? /* @__PURE__ */ d("details", {
905
- className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
906
- children: [/* @__PURE__ */ u("summary", {
907
- className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:cursor-pointer",
908
- children: "Output"
909
- }), /* @__PURE__ */ u("pre", {
910
- className: "vdt:mt-2 vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
911
- children: U(e.output)
912
- })]
913
- }) : null,
914
- e.status === "error" ? /* @__PURE__ */ d("details", {
915
- className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
916
- open: !0,
917
- children: [/* @__PURE__ */ u("summary", {
918
- className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-danger vdt:cursor-pointer",
919
- children: "Error"
920
- }), /* @__PURE__ */ u("pre", {
921
- className: "vdt:mt-2 vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-danger",
922
- children: e.error instanceof Error ? `${e.error.name}: ${e.error.message}\n\n${e.error.stack ?? ""}` : U(e.error)
923
- })]
924
- }) : null
925
- ]
926
- }) : null]
927
- });
928
- }, Ke = () => {
929
- let e = H(), t = B().mutations, [n, r] = s(null);
930
- return e.length === 0 ? /* @__PURE__ */ d(O, { children: [t.emptyTitle, /* @__PURE__ */ u("div", {
931
- className: "vdt:mt-1 vdt:text-foreground-subtle",
932
- children: t.emptyHint
933
- })] }) : /* @__PURE__ */ u("div", {
934
- className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
935
- children: /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ u(E, {
936
- Icon: N,
937
- right: /* @__PURE__ */ d("button", {
938
- onClick: () => {
939
- f(), r(null);
940
- },
941
- title: t.clearTitle,
942
- className: "vdt:inline-flex vdt:items-center vdt:gap-1 vdt:px-1.5 vdt:py-0.5 vdt:rounded-sm vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted hover:vdt:text-foreground hover:vdt:bg-muted/40 vdt:transition-colors",
943
- children: [/* @__PURE__ */ u(P, { className: "vdt:w-3 vdt:h-3" }), t.clear]
944
- }),
945
- children: t.recent(e.length)
946
- }), e.map((e) => /* @__PURE__ */ u(Ge, {
947
- mutation: e,
948
- expanded: n === e.id,
949
- onToggle: () => r(n === e.id ? null : e.id)
950
- }, e.id))] })
951
- });
952
- }, qe = () => H().length, Je = 500, W = [], G = /* @__PURE__ */ new Set(), Ye = [], Xe = () => {
953
- Ye = W.slice();
954
- }, Ze = () => {
955
- Xe();
956
- for (let e of G) try {
957
- e();
958
- } catch {}
959
- };
960
- oe(Qe);
961
- function Qe(e) {
962
- W.unshift(e), W.length > Je && (W.length = Je), Ze();
963
- }
964
- var $e = () => Ye, et = (e) => (G.add(e), () => {
965
- G.delete(e);
966
- }), tt = () => {
967
- W.length !== 0 && (W.length = 0, Ze());
968
- }, nt = () => c(et, $e, $e), rt = [
969
- "trace",
970
- "debug",
971
- "info",
972
- "warn",
973
- "error",
974
- "fatal"
975
- ], it = {
976
- trace: "vdt:text-foreground-subtle",
977
- debug: "vdt:text-info",
978
- info: "vdt:text-foreground",
979
- warn: "vdt:text-warning",
980
- error: "vdt:text-danger",
981
- fatal: "vdt:text-danger vdt:font-bold"
982
- }, at = {
983
- trace: "vdt:bg-foreground-subtle",
984
- debug: "vdt:bg-info",
985
- info: "vdt:bg-accent",
986
- warn: "vdt:bg-warning",
987
- error: "vdt:bg-danger",
988
- fatal: "vdt:bg-danger"
989
- }, ot = (e) => {
990
- if (Object.keys(e).length === 0) return "";
991
- try {
992
- return JSON.stringify(e, null, 2);
993
- } catch {
994
- return String(e);
995
- }
996
- }, st = (e) => {
997
- let t = (e) => e < 10 ? `0${e}` : String(e);
998
- return `${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${((e) => e < 100 ? e < 10 ? `00${e}` : `0${e}` : String(e))(e.getMilliseconds())}`;
999
- }, ct = ({ record: e, expanded: t, onToggle: n }) => {
1000
- let r = Object.keys(e.fields).length > 0 || e.cause !== void 0 || e.fiberId !== void 0, i = t ? ot(e.fields) : "";
1001
- return /* @__PURE__ */ d("div", {
1002
- className: "vdt:border-b last:vdt:border-b-0 vdt:border-border",
1003
- children: [/* @__PURE__ */ d("button", {
1004
- onClick: n,
1005
- disabled: !r,
1006
- className: [
1007
- "vdt:w-full vdt:flex vdt:items-start vdt:gap-2 vdt:px-3 vdt:py-1 vdt:text-left",
1008
- "vdt:transition-colors",
1009
- r ? "hover:vdt:bg-muted/40 vdt:cursor-pointer" : "vdt:cursor-default"
1010
- ].join(" "),
1011
- children: [
1012
- /* @__PURE__ */ u("span", {
1013
- "aria-hidden": "true",
1014
- className: ["vdt:inline-block vdt:w-1 vdt:h-3.5 vdt:rounded-sm vdt:mt-1 vdt:flex-shrink-0", at[e.level]].join(" ")
1015
- }),
1016
- /* @__PURE__ */ u("span", {
1017
- className: "vdt:text-[10px] vdt:font-mono vdt:tabular-nums vdt:text-foreground-subtle vdt:flex-shrink-0 vdt:mt-0.5",
1018
- children: st(e.ts)
1019
- }),
1020
- e.scope ? /* @__PURE__ */ u("span", {
1021
- className: "vdt:text-[10px] vdt:font-mono vdt:text-foreground-muted vdt:flex-shrink-0 vdt:mt-0.5 vdt:truncate vdt:max-w-32",
1022
- children: e.scope
1023
- }) : null,
1024
- /* @__PURE__ */ u("span", {
1025
- className: ["vdt:flex-1 vdt:text-xs vdt:break-words", it[e.level]].join(" "),
1026
- children: e.message
1027
- })
1028
- ]
1029
- }), t && r ? /* @__PURE__ */ d("div", {
1030
- className: "vdt:bg-background/60 vdt:border-t vdt:border-border vdt:px-3 vdt:py-2 vdt:flex vdt:flex-col vdt:gap-2",
1031
- children: [
1032
- e.fiberId ? /* @__PURE__ */ d("div", {
1033
- className: "vdt:text-[10px] vdt:font-mono vdt:text-foreground-muted",
1034
- children: ["fiber: ", e.fiberId]
1035
- }) : null,
1036
- i ? /* @__PURE__ */ u("pre", {
1037
- className: "vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
1038
- children: i
1039
- }) : null,
1040
- e.cause === void 0 ? null : /* @__PURE__ */ u("pre", {
1041
- className: "vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-danger",
1042
- children: e.cause instanceof Error ? `${e.cause.name}: ${e.cause.message}\n\n${e.cause.stack ?? ""}` : String(e.cause)
1043
- })
1044
- ]
1045
- }) : null]
1046
- });
1047
- }, lt = () => {
1048
- let e = nt(), t = B().logs, [n, r] = s(() => new Set(rt)), [i, o] = s(""), [c, l] = s(null), f = (e) => {
948
+ return window.addEventListener("storage", t), () => window.removeEventListener("storage", t);
949
+ }, [e]);
950
+ let a = n((e) => {
1049
951
  r((t) => {
1050
- let n = new Set(t);
1051
- return n.has(e) ? n.delete(e) : n.add(e), n;
952
+ let n = e(t);
953
+ return st(n), n;
1052
954
  });
1053
- }, p = a(() => {
1054
- let t = i.trim().toLowerCase();
1055
- return e.filter((e) => n.has(e.level) ? t === "" || [
1056
- e.message,
1057
- e.scope ?? "",
1058
- ot(e.fields)
1059
- ].join(" ").toLowerCase().includes(t) : !1);
1060
- }, [
1061
- e,
1062
- n,
1063
- i
1064
- ]);
1065
- return /* @__PURE__ */ d("div", {
1066
- className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
1067
- children: [/* @__PURE__ */ d(T, { children: [
1068
- /* @__PURE__ */ u(E, {
1069
- Icon: be,
1070
- right: /* @__PURE__ */ d("button", {
1071
- onClick: () => {
1072
- tt(), l(null);
1073
- },
1074
- title: t.clearTitle,
1075
- className: "vdt:inline-flex vdt:items-center vdt:gap-1 vdt:px-1.5 vdt:py-0.5 vdt:rounded-sm vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted hover:vdt:text-foreground hover:vdt:bg-muted/40 vdt:transition-colors",
1076
- children: [/* @__PURE__ */ u(P, { className: "vdt:w-3 vdt:h-3" }), t.clear]
1077
- }),
1078
- children: t.filters
1079
- }),
1080
- /* @__PURE__ */ u("div", {
1081
- className: "vdt:flex vdt:flex-wrap vdt:gap-1.5 vdt:px-3 vdt:py-2 vdt:border-b vdt:border-border",
1082
- children: rt.map((e) => {
1083
- let t = n.has(e);
1084
- return /* @__PURE__ */ d("button", {
1085
- onClick: () => f(e),
1086
- "aria-pressed": t,
1087
- className: [
1088
- "vdt:inline-flex vdt:items-center vdt:gap-1 vdt:px-1.5 vdt:py-0.5",
1089
- "vdt:rounded-sm vdt:text-[10px] vdt:font-medium vdt:uppercase vdt:tracking-wider",
1090
- "vdt:border vdt:transition-colors",
1091
- t ? "vdt:bg-muted vdt:text-foreground vdt:border-border-strong" : "vdt:bg-transparent vdt:text-foreground-subtle vdt:border-border hover:vdt:text-foreground-muted"
1092
- ].join(" "),
1093
- children: [/* @__PURE__ */ u("span", {
1094
- "aria-hidden": "true",
1095
- className: [
1096
- "vdt:inline-block vdt:w-1.5 vdt:h-1.5 vdt:rounded-full",
1097
- at[e],
1098
- t ? "" : "vdt:opacity-40"
1099
- ].join(" ")
1100
- }), e]
1101
- }, e);
1102
- })
1103
- }),
1104
- /* @__PURE__ */ u("div", {
1105
- className: "vdt:px-3 vdt:py-2",
1106
- children: /* @__PURE__ */ u("input", {
1107
- type: "text",
1108
- value: i,
1109
- onChange: (e) => o(e.target.value),
1110
- placeholder: t.searchPlaceholder,
1111
- className: "vdt:w-full vdt:px-2 vdt:py-1 vdt:text-xs vdt:bg-background vdt:border vdt:border-border vdt:rounded-sm vdt:text-foreground vdt:placeholder:text-foreground-subtle focus:vdt:outline-none focus:vdt:border-accent"
1112
- })
1113
- })
1114
- ] }), p.length === 0 ? /* @__PURE__ */ d(O, { children: [e.length === 0 ? t.emptyNone : t.emptyNoMatch, /* @__PURE__ */ u("div", {
1115
- className: "vdt:mt-1 vdt:text-foreground-subtle",
1116
- children: t.emptyHint
1117
- })] }) : /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ u(E, {
1118
- right: /* @__PURE__ */ d("span", {
1119
- className: "vdt:text-[10px] vdt:text-foreground-muted",
1120
- children: [
1121
- p.length,
1122
- " / ",
1123
- e.length
1124
- ]
1125
- }),
1126
- children: t.tail
1127
- }), p.map((e, t) => {
1128
- let n = `${e.ts.getTime()}:${t}`;
1129
- return /* @__PURE__ */ u(ct, {
1130
- record: e,
1131
- expanded: c === n,
1132
- onToggle: () => l(c === n ? null : n)
1133
- }, n);
1134
- })] })]
1135
- });
1136
- }, ut = () => nt().length, dt = () => c(v, g, g), K = (e, t = 90) => {
1137
- let n;
1138
- try {
1139
- n = JSON.stringify(e) ?? String(e);
1140
- } catch {
1141
- n = String(e);
955
+ }, []);
956
+ return [t, {
957
+ setDock: n((e) => a((t) => t.dock === e ? t : {
958
+ ...t,
959
+ dock: e
960
+ }), [a]),
961
+ setEdgeSize: n((e, t) => a((n) => {
962
+ let r = lt(e, t);
963
+ return n.sizes[e] === r ? n : {
964
+ ...n,
965
+ sizes: {
966
+ ...n.sizes,
967
+ [e]: r
968
+ }
969
+ };
970
+ }), [a]),
971
+ setWindowRect: n((e) => a((t) => ({
972
+ ...t,
973
+ window: J(e)
974
+ })), [a]),
975
+ setPush: n((e) => a((t) => t.push === e ? t : {
976
+ ...t,
977
+ push: e
978
+ }), [a])
979
+ }];
980
+ }, _t = (e) => {
981
+ switch (e) {
982
+ case "ArrowDown": return "bottom";
983
+ case "ArrowUp": return "top";
984
+ case "ArrowLeft": return "left";
985
+ case "ArrowRight": return "right";
986
+ default: return null;
1142
987
  }
1143
- return n.length > t ? `${n.slice(0, t)}…` : n;
1144
- }, ft = (e, t) => typeof e != "object" || typeof t != "object" || e === null || t === null ? [] : [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].filter((n) => !Object.is(e[n], t[n])), pt = ({ label: e, state: t }) => {
1145
- let [n, r] = s(!1);
1146
- return /* @__PURE__ */ d("div", {
1147
- className: "voltro-dt-row",
1148
- children: [/* @__PURE__ */ d("button", {
988
+ }, vt = {
989
+ bottom: Ee,
990
+ top: De,
991
+ left: Oe,
992
+ right: ke,
993
+ window: Ae
994
+ }, yt = ({ dock: e, push: t, onDock: n, onPush: r }) => {
995
+ let a = R().shell, [o, s] = l(!1), u = c(null), d = {
996
+ bottom: a.dockBottom,
997
+ top: a.dockTop,
998
+ left: a.dockLeft,
999
+ right: a.dockRight,
1000
+ window: a.dockWindow
1001
+ };
1002
+ i(() => {
1003
+ if (!o) return;
1004
+ let e = (e) => {
1005
+ u.current !== null && !e.composedPath().includes(u.current) && s(!1);
1006
+ }, t = (e) => {
1007
+ e.key === "Escape" && s(!1);
1008
+ };
1009
+ return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
1010
+ document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
1011
+ };
1012
+ }, [o]);
1013
+ let f = c([]);
1014
+ i(() => {
1015
+ if (!o) return;
1016
+ let t = Qe.indexOf(e);
1017
+ f.current[t === -1 ? 0 : t]?.focus();
1018
+ }, [o, e]);
1019
+ let p = (e) => {
1020
+ let t = f.current.filter((e) => e !== null);
1021
+ if (t.length === 0) return;
1022
+ let n = t.findIndex((t) => t === e.target), r = null;
1023
+ switch (e.key) {
1024
+ case "ArrowRight":
1025
+ case "ArrowDown":
1026
+ r = (n + 1) % t.length;
1027
+ break;
1028
+ case "ArrowLeft":
1029
+ case "ArrowUp":
1030
+ r = (n - 1 + t.length) % t.length;
1031
+ break;
1032
+ case "Home":
1033
+ r = 0;
1034
+ break;
1035
+ case "End":
1036
+ r = t.length - 1;
1037
+ break;
1038
+ default: return;
1039
+ }
1040
+ e.preventDefault(), t[r]?.focus();
1041
+ }, m = vt[e];
1042
+ return /* @__PURE__ */ k("div", {
1043
+ ref: u,
1044
+ className: "vdt-dockmenu",
1045
+ children: [/* @__PURE__ */ O("button", {
1149
1046
  type: "button",
1150
- className: "voltro-dt-rowhead",
1151
- onClick: () => r((e) => !e),
1152
- children: [/* @__PURE__ */ u(w, {
1153
- tone: "neutral",
1154
- children: e
1155
- }), /* @__PURE__ */ u("span", {
1156
- className: "voltro-dt-mono",
1157
- children: K(t)
1047
+ className: `vdt-iconbtn${o ? " vdt-iconbtn-on" : ""}`,
1048
+ title: a.dockMenuTitle,
1049
+ "aria-label": a.dockMenuTitle,
1050
+ "aria-haspopup": "menu",
1051
+ "aria-expanded": o,
1052
+ onClick: () => s((e) => !e),
1053
+ children: /* @__PURE__ */ O(m, { className: "vdt:w-4 vdt:h-4" })
1054
+ }), o ? /* @__PURE__ */ k("div", {
1055
+ role: "menu",
1056
+ "aria-label": a.dockMenuTitle,
1057
+ className: "vdt-dockmenu-pop",
1058
+ children: [/* @__PURE__ */ O("div", {
1059
+ className: "vdt-dockmenu-row",
1060
+ onKeyDown: p,
1061
+ children: Qe.map((t, r) => {
1062
+ let i = vt[t], a = t === e;
1063
+ return /* @__PURE__ */ O("button", {
1064
+ ref: (e) => {
1065
+ f.current[r] = e;
1066
+ },
1067
+ type: "button",
1068
+ role: "menuitemradio",
1069
+ "aria-checked": a,
1070
+ "aria-label": d[t],
1071
+ title: d[t],
1072
+ className: `vdt-dockmenu-item${a ? " vdt-dockmenu-item-on" : ""}`,
1073
+ onClick: () => {
1074
+ n(t), s(!1);
1075
+ },
1076
+ children: /* @__PURE__ */ O(i, { className: "vdt:w-4 vdt:h-4" })
1077
+ }, t);
1078
+ })
1079
+ }), /* @__PURE__ */ k("label", {
1080
+ className: `vdt-dockmenu-push${e === "window" ? " vdt-dockmenu-push-off" : ""}`,
1081
+ children: [/* @__PURE__ */ O("input", {
1082
+ type: "checkbox",
1083
+ role: "menuitemcheckbox",
1084
+ "aria-checked": t,
1085
+ checked: t,
1086
+ disabled: e === "window",
1087
+ onChange: (e) => r(e.target.checked)
1088
+ }), /* @__PURE__ */ k("span", { children: [/* @__PURE__ */ O("span", {
1089
+ className: "vdt-dockmenu-push-label",
1090
+ children: a.pushPage
1091
+ }), /* @__PURE__ */ O("span", {
1092
+ className: "vdt-dockmenu-push-hint",
1093
+ children: a.pushPageHint
1094
+ })] })]
1158
1095
  })]
1159
- }), n ? /* @__PURE__ */ u(D, { entries: Object.entries(t).map(([e, t]) => ({
1160
- key: e,
1161
- value: K(t, 200)
1162
- })) }) : null]
1096
+ }) : null]
1163
1097
  });
1164
- }, mt = () => {
1165
- let e = dt(), [t, n] = s(null), r = ee(), i = t ?? e.length;
1166
- return /* @__PURE__ */ d(l, { children: [
1167
- /* @__PURE__ */ d(E, {
1168
- Icon: ve,
1169
- right: /* @__PURE__ */ d(S, {
1170
- onClick: () => {
1171
- p(), n(null);
1172
- },
1173
- children: [/* @__PURE__ */ u(P, {}), "Clear"]
1174
- }),
1175
- children: [
1176
- "Stores (",
1177
- r.length,
1178
- ")"
1179
- ]
1180
- }),
1181
- r.length === 0 ? /* @__PURE__ */ u(O, { children: "No stores defined. `defineStore(name, () => state)` in a *.store.ts file." }) : r.map((e) => /* @__PURE__ */ d(T, { children: [
1182
- /* @__PURE__ */ u(E, { children: e.name }),
1183
- /* @__PURE__ */ u(pt, {
1184
- label: "global",
1185
- state: e.get()
1186
- }),
1187
- e.keys().map((t) => /* @__PURE__ */ u(pt, {
1188
- label: t,
1189
- state: e.get(t)
1190
- }, t))
1191
- ] }, e.name)),
1192
- /* @__PURE__ */ d(E, {
1193
- Icon: N,
1194
- right: /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(S, {
1195
- onClick: () => {
1196
- i <= 0 || y(i - 1, "before") && n(i - 1);
1197
- },
1198
- disabled: i <= 0,
1199
- children: "◀ Back"
1200
- }), /* @__PURE__ */ u(S, {
1201
- onClick: () => {
1202
- t === null || i >= e.length || y(i, "after") && n(i + 1);
1203
- },
1204
- disabled: t === null || i >= e.length,
1205
- children: "Forward ▶"
1206
- })] }),
1207
- children: [
1208
- "Writes (",
1209
- e.length,
1210
- ")",
1211
- t === null ? "" : ` — travelled to ${i}/${e.length}`
1212
- ]
1213
- }),
1214
- e.length === 0 ? /* @__PURE__ */ u(O, { children: "No writes yet. Every `set()` lands here, labelled if you pass one." }) : [...e].reverse().map((n, r) => {
1215
- let a = e.length - 1 - r, o = ft(n.prev, n.next);
1216
- return /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ d("div", {
1217
- className: "voltro-dt-rowhead",
1218
- children: [
1219
- /* @__PURE__ */ u(w, {
1220
- tone: n.isUndo === !0 ? "warning" : "neutral",
1221
- children: n.store
1222
- }),
1223
- n.key === void 0 ? null : /* @__PURE__ */ u(w, {
1224
- tone: "neutral",
1225
- children: n.key
1226
- }),
1227
- n.label === void 0 ? null : /* @__PURE__ */ u("span", {
1228
- className: "voltro-dt-mono",
1229
- children: n.label
1230
- }),
1231
- t !== null && a === i ? /* @__PURE__ */ u(w, {
1232
- tone: "info",
1233
- children: "here"
1234
- }) : null
1235
- ]
1236
- }), /* @__PURE__ */ u(D, { entries: [
1237
- {
1238
- key: "changed",
1239
- value: o.length > 0 ? o.join(", ") : "(no field diff)"
1240
- },
1241
- {
1242
- key: "before",
1243
- value: K(n.prev)
1244
- },
1245
- {
1246
- key: "after",
1247
- value: K(n.next)
1248
- }
1249
- ] })] }, `${n.at}-${a}`);
1250
- })
1251
- ] });
1252
- }, ht = e(null);
1253
- function gt(e) {
1254
- return /* @__PURE__ */ u(ht.Provider, {
1098
+ }, bt = t(null);
1099
+ function xt(e) {
1100
+ return /* @__PURE__ */ O(bt.Provider, {
1255
1101
  value: e.token,
1256
1102
  children: e.children
1257
1103
  });
1258
1104
  }
1259
- var q = () => n(ht), J = (e, t) => {
1105
+ var X = () => r(bt), St = (e, t) => {
1260
1106
  let n = { ...t ?? {} };
1261
1107
  return e !== null && e !== "" && (n.authorization = `Bearer ${e}`), n;
1262
- }, _t = (e) => e !== void 0 && e !== "" ? e : null, vt = (e) => typeof document > "u" ? () => {} : (document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e)), yt = () => typeof document > "u" || !document.hidden, bt = () => !0, Y = () => c(vt, yt, bt), xt = 5e3, St = async (e, t) => {
1263
- if (e === "") return null;
1108
+ }, Ct = (e) => e !== void 0 && e !== "" ? e : null, wt = (e) => typeof e == "object" && !!e && "data" in e, Tt = (e) => wt(e) ? e.data : null, Et = async (e, t, n) => {
1109
+ let r = await fetch(e, {
1110
+ method: "POST",
1111
+ headers: St(t, {
1112
+ accept: "application/json",
1113
+ "content-type": "application/json"
1114
+ }),
1115
+ body: JSON.stringify(n ?? {})
1116
+ }), i = await r.json().catch(() => null);
1117
+ if (!r.ok) {
1118
+ let e = typeof i == "object" && i ? i : void 0, t = typeof e?.message == "string" ? e.message : typeof e?.error == "string" ? e.error : `HTTP ${r.status}`;
1119
+ throw Error(t);
1120
+ }
1121
+ let a = Tt(i);
1122
+ if (a === null) throw Error("the api answered without an observation");
1123
+ return a;
1124
+ }, Z = async (e, t) => {
1264
1125
  try {
1265
- let n = await fetch(`${e}/_voltro/inspect/subscriptions`, { headers: J(t, { accept: "application/json" }) });
1266
- return n.ok ? await n.json() : null;
1126
+ let n = await fetch(e, { headers: St(t, { accept: "application/json" }) });
1127
+ return n.ok ? Tt(await n.json()) : null;
1267
1128
  } catch {
1268
1129
  return null;
1269
1130
  }
1270
- }, Ct = (e) => {
1271
- let t = b(), n = Y(), i = q(), a = t.names, o = e && n, [c, l] = s(() => a.map((e) => ({
1131
+ }, Dt = (e) => typeof document > "u" ? () => {} : (document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e)), Ot = () => typeof document > "u" || !document.hidden, kt = () => !0, Q = () => u(Dt, Ot, kt), At = 5e3, jt = async (e, t) => {
1132
+ if (e === "") return null;
1133
+ let n = await Z(`${e}/_voltro/inspect/subscriptions`, t);
1134
+ return n !== null && Array.isArray(n.subscriptions) ? n : null;
1135
+ }, Mt = (e) => {
1136
+ let t = T(), n = Q(), r = X(), a = t.names, o = e && n, [s, c] = l(() => a.map((e) => ({
1272
1137
  name: e,
1273
1138
  response: null,
1274
1139
  live: !1
1275
1140
  })));
1276
- return r(() => {
1141
+ return i(() => {
1277
1142
  if (!o) return;
1278
1143
  let e = !1, n = (t, n) => {
1279
- e || l((e) => e.map((e) => e.name === t ? {
1144
+ e || c((e) => e.map((e) => e.name === t ? {
1280
1145
  ...e,
1281
1146
  ...n
1282
1147
  } : e));
1283
- }, r = a.map((e) => {
1284
- let r = t.get(e).inspectBaseUrl;
1285
- if (r === "") return { teardown: () => {} };
1148
+ }, i = a.map((e) => {
1149
+ let i = t.get(e).inspectBaseUrl;
1150
+ if (i === "") return { teardown: () => {} };
1286
1151
  let a = null, o = null, s = () => {
1287
1152
  o !== null && clearInterval(o), o = null;
1288
1153
  }, c = () => {
1289
1154
  if (o !== null) return;
1290
1155
  let t = async () => {
1291
- let t = await St(r, i);
1156
+ let t = await jt(i, r);
1292
1157
  t !== null && n(e, {
1293
1158
  response: t,
1294
1159
  live: !1
@@ -1296,13 +1161,13 @@ var q = () => n(ht), J = (e, t) => {
1296
1161
  };
1297
1162
  t(), o = setInterval(() => {
1298
1163
  t();
1299
- }, xt);
1164
+ }, At);
1300
1165
  };
1301
- St(r, i).then((t) => {
1166
+ jt(i, r).then((t) => {
1302
1167
  t !== null && n(e, { response: t });
1303
1168
  });
1304
1169
  try {
1305
- a = new EventSource(`${r}/_voltro/inspect/stream`), a.addEventListener("subscriptions", (t) => {
1170
+ a = new EventSource(`${i}/_voltro/inspect/stream`), a.addEventListener("subscriptions", (t) => {
1306
1171
  try {
1307
1172
  let r = JSON.parse(t.data).payload;
1308
1173
  r && typeof r == "object" && n(e, {
@@ -1324,147 +1189,147 @@ var q = () => n(ht), J = (e, t) => {
1324
1189
  });
1325
1190
  return () => {
1326
1191
  e = !0;
1327
- for (let e of r) e.teardown();
1192
+ for (let e of i) e.teardown();
1328
1193
  };
1329
1194
  }, [
1330
1195
  o,
1331
1196
  t,
1332
1197
  a,
1333
- i
1334
- ]), c;
1335
- }, X = (e) => {
1198
+ r
1199
+ ]), s;
1200
+ }, Nt = (e) => {
1336
1201
  if (typeof e != "object" || !e) return !1;
1337
1202
  let t = e;
1338
- if (Array.isArray(t.and)) return t.and.some(X);
1339
- if (Array.isArray(t.or)) return t.or.some(X);
1203
+ if (Array.isArray(t.and)) return t.and.some(Nt);
1204
+ if (Array.isArray(t.or)) return t.or.some(Nt);
1340
1205
  let n = t.op;
1341
1206
  return n === "gt" || n === "gte" || n === "lt" || n === "lte";
1342
- }, Z = (e) => {
1207
+ }, Pt = (e) => {
1343
1208
  if (typeof e != "object" || !e) return !1;
1344
1209
  let t = e;
1345
- if (Array.isArray(t.and)) return t.and.some(Z);
1346
- if (Array.isArray(t.or)) return t.or.some(Z);
1210
+ if (Array.isArray(t.and)) return t.and.some(Pt);
1211
+ if (Array.isArray(t.or)) return t.or.some(Pt);
1347
1212
  let n = t.op;
1348
1213
  return n === "eq" || n === "in";
1349
- }, wt = (e) => e.usingIndex !== void 0 && e.usingIndex.fields.every((t) => e.conjunctiveColumns.includes(t)) ? "tuple" : Z(e.predicate) ? "column" : X(e.predicate) ? "range" : "unindexed", Tt = (e) => e === "tuple" ? "success" : e === "column" ? "info" : e === "range" ? "neutral" : "warning", Et = (e) => e === "tuple" ? "tuple" : e === "column" ? "column" : e === "range" ? "range" : "UNINDEXED", Dt = (e) => e == null ? "null" : typeof e == "string" ? `'${e}'` : Array.isArray(e) ? `[${e.map(Dt).join(", ")}]` : String(e), Ot = (e) => e.op === "isNull" ? `${e.column} IS NULL` : e.op === "isNotNull" ? `${e.column} IS NOT NULL` : `${e.column} ${e.op} ${Dt(e.value)}`, Q = (e, t = 0) => {
1214
+ }, Ft = (e) => e.usingIndex !== void 0 && e.usingIndex.fields.every((t) => e.conjunctiveColumns.includes(t)) ? "tuple" : Pt(e.predicate) ? "column" : Nt(e.predicate) ? "range" : "unindexed", It = (e) => e === "tuple" ? "success" : e === "column" ? "info" : e === "range" ? "neutral" : "warning", Lt = (e) => e === "tuple" ? "tuple" : e === "column" ? "column" : e === "range" ? "range" : "UNINDEXED", Rt = (e) => e == null ? "null" : typeof e == "string" ? `'${e}'` : Array.isArray(e) ? `[${e.map(Rt).join(", ")}]` : String(e), zt = (e) => e.op === "isNull" ? `${e.column} IS NULL` : e.op === "isNotNull" ? `${e.column} IS NOT NULL` : `${e.column} ${e.op} ${Rt(e.value)}`, Bt = (e, t = 0) => {
1350
1215
  if (typeof e != "object" || !e) return String(e);
1351
1216
  let n = e;
1352
- if (Array.isArray(n.and)) return n.and.map((e) => Q(e, t + 1)).join(" AND ");
1217
+ if (Array.isArray(n.and)) return n.and.map((e) => Bt(e, t + 1)).join(" AND ");
1353
1218
  if (Array.isArray(n.or)) {
1354
- let e = n.or.map((e) => Q(e, t + 1)).join(" OR ");
1219
+ let e = n.or.map((e) => Bt(e, t + 1)).join(" OR ");
1355
1220
  return t > 0 ? `(${e})` : e;
1356
1221
  }
1357
- return typeof n.column == "string" && typeof n.op == "string" ? Ot(n) : JSON.stringify(e);
1358
- }, kt = () => {
1359
- let e = Ct(!0), t = B().indexes, n = e.filter((e) => e.response !== null).length;
1360
- return e.length === 0 ? /* @__PURE__ */ u(O, { children: t.noApis }) : n === 0 ? /* @__PURE__ */ d(O, { children: [t.unreachableTitle, /* @__PURE__ */ u("div", {
1222
+ return typeof n.column == "string" && typeof n.op == "string" ? zt(n) : JSON.stringify(e);
1223
+ }, Vt = () => {
1224
+ let e = Mt(!0), t = R().indexes, n = e.filter((e) => e.response !== null).length;
1225
+ return e.length === 0 ? /* @__PURE__ */ O(W, { children: t.noApis }) : n === 0 ? /* @__PURE__ */ k(W, { children: [t.unreachableTitle, /* @__PURE__ */ O("div", {
1361
1226
  className: "vdt:mt-1 vdt:text-foreground-subtle",
1362
1227
  children: t.unreachableHint
1363
- })] }) : /* @__PURE__ */ u("div", {
1228
+ })] }) : /* @__PURE__ */ O("div", {
1364
1229
  className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
1365
- children: e.map(({ name: e, response: n, live: r }) => n === null ? /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ u(E, {
1366
- Icon: j,
1230
+ children: e.map(({ name: e, response: n, live: r }) => n === null ? /* @__PURE__ */ k(V, { children: [/* @__PURE__ */ O(H, {
1231
+ Icon: fe,
1367
1232
  children: e
1368
- }), /* @__PURE__ */ u("div", {
1233
+ }), /* @__PURE__ */ O("div", {
1369
1234
  className: "vdt:text-xs vdt:text-foreground-subtle",
1370
1235
  children: t.offline
1371
- })] }, e) : /* @__PURE__ */ u(At, {
1236
+ })] }, e) : /* @__PURE__ */ O(Ht, {
1372
1237
  apiName: e,
1373
1238
  response: n,
1374
1239
  live: r
1375
1240
  }, e))
1376
1241
  });
1377
- }, At = ({ apiName: e, response: t, live: n }) => {
1378
- let r = B().indexes, i = [...t.subscriptions].sort((e, t) => t.subscriberCount - e.subscriberCount);
1379
- return /* @__PURE__ */ d(T, { children: [
1380
- /* @__PURE__ */ u(E, {
1381
- Icon: j,
1382
- right: /* @__PURE__ */ d("div", {
1242
+ }, Ht = ({ apiName: e, response: t, live: n }) => {
1243
+ let r = R().indexes, i = [...t.subscriptions].sort((e, t) => t.subscriberCount - e.subscriberCount);
1244
+ return /* @__PURE__ */ k(V, { children: [
1245
+ /* @__PURE__ */ O(H, {
1246
+ Icon: fe,
1247
+ right: /* @__PURE__ */ k("div", {
1383
1248
  className: "vdt:flex vdt:items-center vdt:gap-1",
1384
- children: [/* @__PURE__ */ u(w, {
1249
+ children: [/* @__PURE__ */ O(B, {
1385
1250
  tone: "info",
1386
1251
  children: r.subsBadge(t.subscriptions.length)
1387
- }), /* @__PURE__ */ u(w, {
1252
+ }), /* @__PURE__ */ O(B, {
1388
1253
  tone: n ? "success" : "neutral",
1389
1254
  children: n ? r.live : r.poll
1390
1255
  })]
1391
1256
  }),
1392
1257
  children: e
1393
1258
  }),
1394
- t.matcherStats.length > 0 && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
1259
+ t.matcherStats.length > 0 && /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("div", {
1395
1260
  className: "vdt:text-[11px] vdt:uppercase vdt:tracking-wide vdt:text-foreground-subtle vdt:mt-3 vdt:mb-1",
1396
1261
  children: r.tables
1397
- }), /* @__PURE__ */ u("div", {
1262
+ }), /* @__PURE__ */ O("div", {
1398
1263
  className: "vdt:flex vdt:flex-col vdt:gap-1",
1399
- children: t.matcherStats.map((e) => /* @__PURE__ */ d("div", {
1264
+ children: t.matcherStats.map((e) => /* @__PURE__ */ k("div", {
1400
1265
  className: "vdt:flex vdt:items-baseline vdt:gap-3 vdt:text-xs",
1401
1266
  children: [
1402
- /* @__PURE__ */ u("span", {
1267
+ /* @__PURE__ */ O("span", {
1403
1268
  className: "vdt:font-mono vdt:text-foreground",
1404
1269
  children: e.tableName
1405
1270
  }),
1406
- /* @__PURE__ */ d("span", {
1271
+ /* @__PURE__ */ k("span", {
1407
1272
  className: "vdt:text-foreground-subtle",
1408
1273
  children: [e.tupleRouted + e.columnBucketed + e.rangeBucketed + e.unindexedFallback, " subs"]
1409
1274
  }),
1410
- e.tupleRouted > 0 && /* @__PURE__ */ u(w, {
1275
+ e.tupleRouted > 0 && /* @__PURE__ */ O(B, {
1411
1276
  tone: "success",
1412
1277
  children: `${e.tupleRouted} tuple`
1413
1278
  }),
1414
- e.columnBucketed > 0 && /* @__PURE__ */ u(w, {
1279
+ e.columnBucketed > 0 && /* @__PURE__ */ O(B, {
1415
1280
  tone: "info",
1416
1281
  children: `${e.columnBucketed} column`
1417
1282
  }),
1418
- e.rangeBucketed > 0 && /* @__PURE__ */ u(w, {
1283
+ e.rangeBucketed > 0 && /* @__PURE__ */ O(B, {
1419
1284
  tone: "neutral",
1420
1285
  children: `${e.rangeBucketed} range`
1421
1286
  }),
1422
- e.unindexedFallback > 0 && /* @__PURE__ */ u(w, {
1287
+ e.unindexedFallback > 0 && /* @__PURE__ */ O(B, {
1423
1288
  tone: "warning",
1424
1289
  children: `${e.unindexedFallback} unindexed`
1425
1290
  }),
1426
- e.distinctTupleKeys > 0 && /* @__PURE__ */ d("span", {
1291
+ e.distinctTupleKeys > 0 && /* @__PURE__ */ k("span", {
1427
1292
  className: "vdt:text-foreground-subtle",
1428
1293
  children: [e.distinctTupleKeys, " tuple keys"]
1429
1294
  })
1430
1295
  ]
1431
1296
  }, e.tableName))
1432
1297
  })] }),
1433
- i.length > 0 && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
1298
+ i.length > 0 && /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("div", {
1434
1299
  className: "vdt:text-[11px] vdt:uppercase vdt:tracking-wide vdt:text-foreground-subtle vdt:mt-3 vdt:mb-1",
1435
1300
  children: r.subscriptionsSection
1436
- }), /* @__PURE__ */ u("div", {
1301
+ }), /* @__PURE__ */ O("div", {
1437
1302
  className: "vdt:flex vdt:flex-col vdt:gap-2",
1438
- children: i.map((e) => /* @__PURE__ */ u(jt, { sub: e }, e.fingerprint))
1303
+ children: i.map((e) => /* @__PURE__ */ O(Ut, { sub: e }, e.fingerprint))
1439
1304
  })] })
1440
1305
  ] });
1441
- }, jt = ({ sub: e }) => {
1442
- let t = B().indexes, n = wt(e);
1443
- return /* @__PURE__ */ d("div", {
1306
+ }, Ut = ({ sub: e }) => {
1307
+ let t = R().indexes, n = Ft(e);
1308
+ return /* @__PURE__ */ k("div", {
1444
1309
  className: "vdt:flex vdt:flex-col vdt:gap-0.5 vdt:px-2 vdt:py-1 vdt:rounded-sm vdt:bg-muted/40",
1445
- children: [/* @__PURE__ */ d("div", {
1310
+ children: [/* @__PURE__ */ k("div", {
1446
1311
  className: "vdt:flex vdt:items-baseline vdt:gap-2 vdt:text-xs",
1447
1312
  children: [
1448
- /* @__PURE__ */ u("span", {
1313
+ /* @__PURE__ */ O("span", {
1449
1314
  className: "vdt:font-mono vdt:text-foreground",
1450
1315
  children: e.table
1451
1316
  }),
1452
- /* @__PURE__ */ u(w, {
1453
- tone: Tt(n),
1454
- children: Et(n)
1317
+ /* @__PURE__ */ O(B, {
1318
+ tone: It(n),
1319
+ children: Lt(n)
1455
1320
  }),
1456
- e.usingIndex && /* @__PURE__ */ d("span", {
1321
+ e.usingIndex && /* @__PURE__ */ k("span", {
1457
1322
  className: "vdt:text-foreground-subtle",
1458
1323
  children: [
1459
1324
  t.via,
1460
1325
  " ",
1461
- /* @__PURE__ */ u("span", {
1326
+ /* @__PURE__ */ O("span", {
1462
1327
  className: "vdt:font-mono",
1463
1328
  children: e.usingIndex.name
1464
1329
  })
1465
1330
  ]
1466
1331
  }),
1467
- /* @__PURE__ */ d("span", {
1332
+ /* @__PURE__ */ k("span", {
1468
1333
  className: "vdt:text-foreground-subtle vdt:ml-auto",
1469
1334
  children: [
1470
1335
  e.subscriberCount,
@@ -1473,110 +1338,106 @@ var q = () => n(ht), J = (e, t) => {
1473
1338
  ]
1474
1339
  })
1475
1340
  ]
1476
- }), /* @__PURE__ */ u("div", {
1341
+ }), /* @__PURE__ */ O("div", {
1477
1342
  className: "vdt:text-[11px] vdt:font-mono vdt:text-foreground-subtle vdt:break-all",
1478
- children: Q(e.predicate)
1343
+ children: Bt(e.predicate)
1479
1344
  })]
1480
1345
  });
1481
- }, Mt = (e) => {
1482
- let t = Ct(e), n = 0;
1346
+ }, Wt = (e) => {
1347
+ let t = Mt(e), n = 0;
1483
1348
  for (let e of t) n += e.response?.subscriptions.length ?? 0;
1484
1349
  return n;
1485
- }, Nt = {
1350
+ }, Gt = {
1486
1351
  outgoing: [],
1487
1352
  incoming: [],
1488
1353
  targets: [],
1489
1354
  deliveries: []
1490
- }, Pt = 4e3, Ft = async (e, t) => {
1355
+ }, Kt = 4e3, qt = async (e, t) => {
1491
1356
  if (e === "") return null;
1492
- try {
1493
- let n = await fetch(`${e}/_voltro/inspect/webhooks`, { headers: J(t, { accept: "application/json" }) });
1494
- return n.ok ? await n.json() : null;
1495
- } catch {
1496
- return null;
1497
- }
1498
- }, It = (e, t = !0) => {
1499
- let n = Y(), i = q(), a = t && n && e !== "", [o, c] = s(Nt);
1500
- return r(() => {
1357
+ let n = await Z(`${e}/_voltro/inspect/webhooks`, t);
1358
+ return n !== null && Array.isArray(n.outgoing) && Array.isArray(n.incoming) ? n : null;
1359
+ }, Jt = (e, t = !0) => {
1360
+ let n = Q(), r = X(), a = t && n && e !== "", [o, s] = l(Gt);
1361
+ return i(() => {
1501
1362
  if (!a) return;
1502
1363
  let t = !1, n = async () => {
1503
- let n = await Ft(e, i);
1504
- t || n === null || c(n);
1364
+ let n = await qt(e, r);
1365
+ t || n === null || s(n);
1505
1366
  };
1506
1367
  n();
1507
- let r = setInterval(n, Pt);
1368
+ let i = setInterval(n, Kt);
1508
1369
  return () => {
1509
- t = !0, clearInterval(r);
1370
+ t = !0, clearInterval(i);
1510
1371
  };
1511
1372
  }, [
1512
1373
  e,
1513
1374
  a,
1514
- i
1375
+ r
1515
1376
  ]), o;
1516
- }, Lt = {
1377
+ }, Yt = {
1517
1378
  pending: "neutral",
1518
1379
  inFlight: "info",
1519
1380
  succeeded: "success",
1520
1381
  failed: "danger",
1521
1382
  retryScheduled: "warning"
1522
- }, Rt = (e) => {
1383
+ }, Xt = (e) => {
1523
1384
  let t = new Date(e), n = (e) => e < 10 ? `0${e}` : String(e);
1524
1385
  return `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
1525
- }, zt = (e) => {
1526
- let t = b(), n = Y(), i = q(), a = t.names.join(","), [o, c] = s(0), l = e && n;
1527
- return r(() => {
1528
- if (!l) {
1529
- c(0);
1386
+ }, Zt = (e) => {
1387
+ let t = T(), n = Q(), r = X(), a = t.names.join(","), [o, s] = l(0), c = e && n;
1388
+ return i(() => {
1389
+ if (!c) {
1390
+ s(0);
1530
1391
  return;
1531
1392
  }
1532
1393
  let e = a === "" ? [] : a.split(",").map((e) => t.get(e).inspectBaseUrl).filter((e) => e !== "");
1533
1394
  if (e.length === 0) {
1534
- c(0);
1395
+ s(0);
1535
1396
  return;
1536
1397
  }
1537
- let n = !1, r = async () => {
1538
- let t = await Promise.all(e.map((e) => Ft(e, i)));
1539
- n || c(t.reduce((e, t) => e + (t === null ? 0 : t.outgoing.length + t.incoming.length + t.targets.length), 0));
1398
+ let n = !1, i = async () => {
1399
+ let t = await Promise.all(e.map((e) => qt(e, r)));
1400
+ n || s(t.reduce((e, t) => e + (t === null ? 0 : t.outgoing.length + t.incoming.length + t.targets.length), 0));
1540
1401
  };
1541
- r();
1542
- let o = setInterval(r, Pt);
1402
+ i();
1403
+ let o = setInterval(i, Kt);
1543
1404
  return () => {
1544
1405
  n = !0, clearInterval(o);
1545
1406
  };
1546
1407
  }, [
1547
1408
  t,
1548
1409
  a,
1549
- l,
1550
- i
1410
+ c,
1411
+ r
1551
1412
  ]), o;
1552
- }, Bt = ({ apiName: e, baseUrl: t }) => {
1553
- let n = It(t), r = B().webhooks;
1554
- return n.outgoing.length + n.incoming.length + n.targets.length + n.deliveries.length > 0 ? /* @__PURE__ */ u("div", {
1413
+ }, Qt = ({ apiName: e, baseUrl: t }) => {
1414
+ let n = Jt(t), r = R().webhooks;
1415
+ return n.outgoing.length + n.incoming.length + n.targets.length + n.deliveries.length > 0 ? /* @__PURE__ */ O("div", {
1555
1416
  className: "vdt:space-y-4",
1556
- children: /* @__PURE__ */ d(T, { children: [
1557
- /* @__PURE__ */ d("div", {
1417
+ children: /* @__PURE__ */ k(V, { children: [
1418
+ /* @__PURE__ */ k("div", {
1558
1419
  className: "vdt:flex vdt:items-center vdt:gap-2 vdt:mb-3",
1559
- children: [/* @__PURE__ */ u(xe, { className: "vdt:w-4 vdt:h-4 vdt:text-accent" }), /* @__PURE__ */ u(E, { children: e })]
1420
+ children: [/* @__PURE__ */ O(ve, { className: "vdt:w-4 vdt:h-4 vdt:text-accent" }), /* @__PURE__ */ O(H, { children: e })]
1560
1421
  }),
1561
- n.outgoing.length > 0 ? /* @__PURE__ */ d("div", {
1422
+ n.outgoing.length > 0 ? /* @__PURE__ */ k("div", {
1562
1423
  className: "vdt:mb-4",
1563
- children: [/* @__PURE__ */ u("div", {
1424
+ children: [/* @__PURE__ */ O("div", {
1564
1425
  className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
1565
1426
  children: r.outgoing(n.outgoing.length)
1566
- }), /* @__PURE__ */ u("div", {
1427
+ }), /* @__PURE__ */ O("div", {
1567
1428
  className: "vdt:space-y-1",
1568
- children: n.outgoing.map((e) => /* @__PURE__ */ d("div", {
1429
+ children: n.outgoing.map((e) => /* @__PURE__ */ k("div", {
1569
1430
  className: "vdt:flex vdt:items-center vdt:gap-2 vdt:text-sm",
1570
1431
  children: [
1571
- /* @__PURE__ */ u("code", {
1432
+ /* @__PURE__ */ O("code", {
1572
1433
  className: "vdt:text-foreground vdt:font-mono",
1573
1434
  children: e.id
1574
1435
  }),
1575
- /* @__PURE__ */ d(w, {
1436
+ /* @__PURE__ */ k(B, {
1576
1437
  tone: "neutral",
1577
1438
  children: ["v", e.version]
1578
1439
  }),
1579
- e.description ? /* @__PURE__ */ u("span", {
1440
+ e.description ? /* @__PURE__ */ O("span", {
1580
1441
  className: "vdt:text-foreground-muted vdt:text-xs vdt:truncate",
1581
1442
  children: e.description
1582
1443
  }) : null
@@ -1584,28 +1445,28 @@ var q = () => n(ht), J = (e, t) => {
1584
1445
  }, e.id))
1585
1446
  })]
1586
1447
  }) : null,
1587
- n.incoming.length > 0 ? /* @__PURE__ */ d("div", {
1448
+ n.incoming.length > 0 ? /* @__PURE__ */ k("div", {
1588
1449
  className: "vdt:mb-4",
1589
- children: [/* @__PURE__ */ u("div", {
1450
+ children: [/* @__PURE__ */ O("div", {
1590
1451
  className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
1591
1452
  children: r.incoming(n.incoming.length)
1592
- }), /* @__PURE__ */ u("div", {
1453
+ }), /* @__PURE__ */ O("div", {
1593
1454
  className: "vdt:space-y-1",
1594
- children: n.incoming.map((e) => /* @__PURE__ */ d("div", {
1455
+ children: n.incoming.map((e) => /* @__PURE__ */ k("div", {
1595
1456
  className: "vdt:flex vdt:items-center vdt:gap-2 vdt:text-sm",
1596
1457
  children: [
1597
- /* @__PURE__ */ u("code", {
1458
+ /* @__PURE__ */ O("code", {
1598
1459
  className: "vdt:text-foreground vdt:font-mono",
1599
1460
  children: e.path
1600
1461
  }),
1601
- e.provider ? /* @__PURE__ */ u(w, {
1462
+ e.provider ? /* @__PURE__ */ O(B, {
1602
1463
  tone: "info",
1603
1464
  children: e.provider
1604
1465
  }) : null,
1605
- e.signatureConfigured ? /* @__PURE__ */ u(w, {
1466
+ e.signatureConfigured ? /* @__PURE__ */ O(B, {
1606
1467
  tone: "success",
1607
1468
  children: r.signed
1608
- }) : /* @__PURE__ */ u(w, {
1469
+ }) : /* @__PURE__ */ O(B, {
1609
1470
  tone: "warning",
1610
1471
  children: r.unsigned
1611
1472
  })
@@ -1613,41 +1474,41 @@ var q = () => n(ht), J = (e, t) => {
1613
1474
  }, e.id))
1614
1475
  })]
1615
1476
  }) : null,
1616
- n.targets.length > 0 ? /* @__PURE__ */ d("div", {
1477
+ n.targets.length > 0 ? /* @__PURE__ */ k("div", {
1617
1478
  className: "vdt:mb-4",
1618
- children: [/* @__PURE__ */ u("div", {
1479
+ children: [/* @__PURE__ */ O("div", {
1619
1480
  className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
1620
1481
  children: r.targets(n.targets.length)
1621
- }), /* @__PURE__ */ u("div", {
1482
+ }), /* @__PURE__ */ O("div", {
1622
1483
  className: "vdt:space-y-1",
1623
1484
  children: n.targets.map((e) => {
1624
1485
  let t = n.outgoing.find((t) => t.id === e.event)?.version ?? e.payloadVersion, i = e.payloadVersion === t ? "current" : e.payloadVersion < t ? "behind" : "ahead";
1625
- return /* @__PURE__ */ d("div", {
1486
+ return /* @__PURE__ */ k("div", {
1626
1487
  className: "vdt:flex vdt:items-center vdt:gap-2 vdt:text-sm",
1627
1488
  children: [
1628
- /* @__PURE__ */ u("code", {
1489
+ /* @__PURE__ */ O("code", {
1629
1490
  className: "vdt:text-foreground vdt:font-mono",
1630
1491
  children: e.event
1631
1492
  }),
1632
- /* @__PURE__ */ u("span", {
1493
+ /* @__PURE__ */ O("span", {
1633
1494
  className: "vdt:text-foreground-muted",
1634
1495
  children: "→"
1635
1496
  }),
1636
- /* @__PURE__ */ u("span", {
1497
+ /* @__PURE__ */ O("span", {
1637
1498
  className: "vdt:text-foreground vdt:text-xs vdt:truncate vdt:max-w-72",
1638
1499
  children: e.url
1639
1500
  }),
1640
- e.active ? /* @__PURE__ */ u(w, {
1501
+ e.active ? /* @__PURE__ */ O(B, {
1641
1502
  tone: "success",
1642
1503
  children: r.active
1643
- }) : /* @__PURE__ */ u(w, {
1504
+ }) : /* @__PURE__ */ O(B, {
1644
1505
  tone: "warning",
1645
1506
  children: r.paused
1646
1507
  }),
1647
- i === "current" ? /* @__PURE__ */ d(w, {
1508
+ i === "current" ? /* @__PURE__ */ k(B, {
1648
1509
  tone: "neutral",
1649
1510
  children: ["v", e.payloadVersion]
1650
- }) : i === "behind" ? /* @__PURE__ */ d(w, {
1511
+ }) : i === "behind" ? /* @__PURE__ */ k(B, {
1651
1512
  tone: "warning",
1652
1513
  children: [
1653
1514
  "v",
@@ -1655,7 +1516,7 @@ var q = () => n(ht), J = (e, t) => {
1655
1516
  " ← current v",
1656
1517
  t
1657
1518
  ]
1658
- }) : /* @__PURE__ */ d(w, {
1519
+ }) : /* @__PURE__ */ k(B, {
1659
1520
  tone: "danger",
1660
1521
  children: [
1661
1522
  "v",
@@ -1669,39 +1530,39 @@ var q = () => n(ht), J = (e, t) => {
1669
1530
  })
1670
1531
  })]
1671
1532
  }) : null,
1672
- n.deliveries.length > 0 ? /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("div", {
1533
+ n.deliveries.length > 0 ? /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
1673
1534
  className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
1674
1535
  children: r.deliveries(n.deliveries.length)
1675
- }), /* @__PURE__ */ u("div", {
1536
+ }), /* @__PURE__ */ O("div", {
1676
1537
  className: "vdt:space-y-0.5 vdt:font-mono vdt:text-xs",
1677
- children: n.deliveries.map((e) => /* @__PURE__ */ d("div", {
1538
+ children: n.deliveries.map((e) => /* @__PURE__ */ k("div", {
1678
1539
  className: "vdt:flex vdt:items-center vdt:gap-2",
1679
1540
  children: [
1680
- /* @__PURE__ */ u("span", {
1541
+ /* @__PURE__ */ O("span", {
1681
1542
  className: "vdt:text-foreground-subtle",
1682
- children: Rt(e.scheduledAt)
1543
+ children: Xt(e.scheduledAt)
1683
1544
  }),
1684
- /* @__PURE__ */ u("span", {
1545
+ /* @__PURE__ */ O("span", {
1685
1546
  className: "vdt:text-foreground vdt:min-w-32 vdt:truncate",
1686
1547
  children: e.event
1687
1548
  }),
1688
- /* @__PURE__ */ u(w, {
1689
- tone: Lt[e.status],
1549
+ /* @__PURE__ */ O(B, {
1550
+ tone: Yt[e.status],
1690
1551
  children: e.status
1691
1552
  }),
1692
- e.responseStatus === null ? null : /* @__PURE__ */ u("span", {
1553
+ e.responseStatus === null ? null : /* @__PURE__ */ O("span", {
1693
1554
  className: "vdt:text-foreground-muted",
1694
1555
  children: e.responseStatus
1695
1556
  }),
1696
- e.latencyMs === null ? null : /* @__PURE__ */ d("span", {
1557
+ e.latencyMs === null ? null : /* @__PURE__ */ k("span", {
1697
1558
  className: "vdt:text-foreground-subtle",
1698
1559
  children: [e.latencyMs, "ms"]
1699
1560
  }),
1700
- /* @__PURE__ */ u("span", {
1561
+ /* @__PURE__ */ O("span", {
1701
1562
  className: "vdt:text-foreground-subtle",
1702
1563
  children: r.attempt(e.attempt)
1703
1564
  }),
1704
- e.errorMessage ? /* @__PURE__ */ u("span", {
1565
+ e.errorMessage ? /* @__PURE__ */ O("span", {
1705
1566
  className: "vdt:text-danger vdt:truncate vdt:max-w-64",
1706
1567
  children: e.errorMessage
1707
1568
  }) : null
@@ -1710,75 +1571,959 @@ var q = () => n(ht), J = (e, t) => {
1710
1571
  })] }) : null
1711
1572
  ] })
1712
1573
  }) : null;
1713
- }, Vt = () => {
1714
- let e = b(), t = B().webhooks;
1715
- return e.names.length === 0 ? /* @__PURE__ */ u(O, { children: t.empty }) : /* @__PURE__ */ u("div", {
1574
+ }, $t = () => {
1575
+ let e = T(), t = R().webhooks;
1576
+ return e.names.length === 0 ? /* @__PURE__ */ O(W, { children: t.empty }) : /* @__PURE__ */ O("div", {
1716
1577
  className: "vdt:space-y-4 vdt:p-3",
1717
1578
  children: e.names.map((t) => {
1718
1579
  let n = e.get(t);
1719
- return /* @__PURE__ */ u(Bt, {
1580
+ return /* @__PURE__ */ O(Qt, {
1720
1581
  apiName: t,
1721
1582
  baseUrl: n.inspectBaseUrl
1722
1583
  }, t);
1723
1584
  })
1724
- });
1725
- }, Ht = { traces: [] }, Ut = 4e3, Wt = async (e, t) => {
1726
- if (e === "") return null;
1585
+ });
1586
+ }, en = (e, t) => {
1587
+ let n = `${e}/_voltro/inspect/stream?channels=${encodeURIComponent(t.channels.join(","))}`, r = !1, i = 0, a, o, s = async () => {
1588
+ if (r) return;
1589
+ a = new AbortController();
1590
+ let e;
1591
+ try {
1592
+ let o = await fetch(n, {
1593
+ headers: St(t.token, { accept: "text/event-stream" }),
1594
+ signal: a.signal
1595
+ });
1596
+ if (!o.ok || o.body === null) throw Error(`inspect stream HTTP ${o.status}`);
1597
+ if (r) {
1598
+ await o.body.cancel();
1599
+ return;
1600
+ }
1601
+ i = 0, e = o.body.getReader();
1602
+ let s = new TextDecoder(), c = "";
1603
+ for (; !r;) {
1604
+ let { done: n, value: r } = await e.read();
1605
+ if (n) break;
1606
+ if (c = (c + s.decode(r, { stream: !0 })).replace(/\r\n/g, "\n"), c.length > 1048576) throw Error("inspect stream event exceeds the size limit");
1607
+ let i;
1608
+ for (; (i = c.indexOf("\n\n")) !== -1;) {
1609
+ let e = c.slice(0, i);
1610
+ c = c.slice(i + 2);
1611
+ let n = e.split("\n").filter((e) => e.startsWith("data:")).map((e) => e.slice(5).replace(/^ /, "")).join("\n");
1612
+ if (n === "") continue;
1613
+ let r;
1614
+ try {
1615
+ r = JSON.parse(n);
1616
+ } catch {
1617
+ continue;
1618
+ }
1619
+ typeof r == "object" && r && typeof r.channel == "string" && t.onEvent(r);
1620
+ }
1621
+ }
1622
+ if (!r) throw Error("inspect stream disconnected");
1623
+ } catch (e) {
1624
+ r || t.onError?.(e instanceof Error ? e : Error(String(e)));
1625
+ } finally {
1626
+ await e?.cancel().catch(() => void 0), e?.releaseLock(), a.abort();
1627
+ }
1628
+ if (!r) {
1629
+ let e = Math.min(3e4, 1e3 * 2 ** i);
1630
+ i = Math.min(i + 1, 5), o = setTimeout(() => {
1631
+ s();
1632
+ }, e);
1633
+ }
1634
+ };
1635
+ return s(), { close: () => {
1636
+ r = !0, clearTimeout(o), a?.abort();
1637
+ } };
1638
+ }, tn = (e, t, n, r = 250) => {
1639
+ let [a, o] = l(0), s = t.join(",");
1640
+ return i(() => {
1641
+ if (!n || e === "") return;
1642
+ let t = new Set(s.split(",")), i, a = !1, c = en(e, {
1643
+ channels: s.split(","),
1644
+ token: null,
1645
+ onEvent: (e) => {
1646
+ !a && t.has(e.channel) && i === void 0 && (i = setTimeout(() => {
1647
+ i = void 0, a || o((e) => e + 1);
1648
+ }, r));
1649
+ }
1650
+ });
1651
+ return () => {
1652
+ a = !0, clearTimeout(i), c.close();
1653
+ };
1654
+ }, [
1655
+ e,
1656
+ s,
1657
+ n,
1658
+ r
1659
+ ]), a;
1660
+ }, nn = {
1661
+ queued: "neutral",
1662
+ running: "info",
1663
+ succeeded: "success",
1664
+ failed: "danger",
1665
+ cancelled: "warning",
1666
+ paused: "accent",
1667
+ suspended: "accent"
1668
+ }, rn = {
1669
+ running: "info",
1670
+ succeeded: "success",
1671
+ failed: "danger"
1672
+ }, an = 50, on = 1e4, sn = (e) => e == null ? "—" : e < 1e3 ? `${Math.round(e)}ms` : e < 6e4 ? `${(e / 1e3).toFixed(e < 1e4 ? 2 : 1)}s` : `${Math.floor(e / 6e4)}m ${Math.floor(e % 6e4 / 1e3)}s`, cn = (e) => {
1673
+ let t = new Date(e), n = (e) => e < 10 ? `0${e}` : String(e);
1674
+ return `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
1675
+ }, ln = (e) => {
1676
+ try {
1677
+ return JSON.stringify(e, null, 2);
1678
+ } catch {
1679
+ return String(e);
1680
+ }
1681
+ }, un = (e) => e === "running" || e === "queued", dn = (e, t) => e.durationMs ?? (un(e.status) ? t - new Date(e.startedAt).getTime() : null), fn = (e) => {
1682
+ let t = /* @__PURE__ */ new Set();
1683
+ for (let n of e) {
1684
+ let e = n.payload?.signalName;
1685
+ typeof e == "string" && (n.eventType === "signal-awaited" && t.add(e), n.eventType === "signal-received" && t.delete(e));
1686
+ }
1687
+ return [...t];
1688
+ }, pn = async (e, t) => {
1689
+ if (e === "") return null;
1690
+ let n = await Z(`${e}/_voltro/inspect/workflows/runs?limit=${an}`, t);
1691
+ return n !== null && Array.isArray(n.runs) ? n.runs : null;
1692
+ }, mn = (e) => {
1693
+ let t = Q(), n = X(), r = t && e !== "", a = tn(e, ["workflowRuns"], r), [o, s] = l([]), [c, u] = l(!1);
1694
+ return i(() => {
1695
+ if (!r) return;
1696
+ let t = !1, i = async () => {
1697
+ let r = await pn(e, n);
1698
+ if (!t) {
1699
+ if (r === null) {
1700
+ u(!0);
1701
+ return;
1702
+ }
1703
+ u(!1), s(r);
1704
+ }
1705
+ };
1706
+ i();
1707
+ let a = setInterval(i, on);
1708
+ return () => {
1709
+ t = !0, clearInterval(a);
1710
+ };
1711
+ }, [
1712
+ e,
1713
+ r,
1714
+ n,
1715
+ a
1716
+ ]), {
1717
+ runs: o,
1718
+ failed: c
1719
+ };
1720
+ }, hn = (e, t) => {
1721
+ let n = Q(), r = X(), a = tn(e, ["workflowSteps", "workflowEvents"], n && e !== ""), [o, s] = l([]), [c, u] = l([]);
1722
+ return i(() => {
1723
+ if (!n || e === "") return;
1724
+ let i = !1, a = `${e}/_voltro/inspect/workflows/runs/${encodeURIComponent(t)}`, o = async () => {
1725
+ let [e, t] = await Promise.all([Z(`${a}/steps`, r), Z(`${a}/events`, r)]);
1726
+ i || (e !== null && Array.isArray(e.steps) && s(e.steps), t !== null && Array.isArray(t.events) && u(t.events));
1727
+ };
1728
+ o();
1729
+ let c = setInterval(o, on);
1730
+ return () => {
1731
+ i = !0, clearInterval(c);
1732
+ };
1733
+ }, [
1734
+ e,
1735
+ t,
1736
+ n,
1737
+ r,
1738
+ a
1739
+ ]), {
1740
+ steps: o,
1741
+ events: c
1742
+ };
1743
+ }, gn = (e) => {
1744
+ let t = T(), n = Q(), r = X(), a = t.names.join(","), [o, s] = l(0), c = e && n, u = tn(a === "" ? "" : t.get(a.split(",")[0]).inspectBaseUrl ?? "", ["workflowRuns"], c);
1745
+ return i(() => {
1746
+ if (!c) {
1747
+ s(0);
1748
+ return;
1749
+ }
1750
+ let e = a === "" ? [] : a.split(",").map((e) => t.get(e).inspectBaseUrl).filter((e) => e !== "");
1751
+ if (e.length === 0) {
1752
+ s(0);
1753
+ return;
1754
+ }
1755
+ let n = !1, i = async () => {
1756
+ let t = await Promise.all(e.map((e) => pn(e, r)));
1757
+ n || s(t.reduce((e, t) => e + (t === null ? 0 : t.filter((e) => un(e.status)).length), 0));
1758
+ };
1759
+ i();
1760
+ let o = setInterval(i, on);
1761
+ return () => {
1762
+ n = !0, clearInterval(o);
1763
+ };
1764
+ }, [
1765
+ t,
1766
+ a,
1767
+ c,
1768
+ r,
1769
+ u
1770
+ ]), o;
1771
+ }, _n = () => {
1772
+ let e = T(), t = R().workflows;
1773
+ return e.names.length === 0 ? /* @__PURE__ */ O(W, { children: t.noApi }) : /* @__PURE__ */ O("div", {
1774
+ className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
1775
+ children: e.names.map((e) => /* @__PURE__ */ O(vn, { apiName: e }, e))
1776
+ });
1777
+ }, vn = ({ apiName: e }) => {
1778
+ let t = T(), n = R().workflows, r = t.get(e), a = r.inspectBaseUrl, o = s(() => Object.entries(r.descriptors).filter(([, e]) => e.kind === "workflow").map(([e]) => e).sort(), [r.descriptors]), { runs: c, failed: u } = mn(a), d = c.filter((e) => un(e.status)).length, [f, p] = l(null), [m, h] = l(() => Date.now());
1779
+ return i(() => {
1780
+ if (d === 0) return;
1781
+ let e = setInterval(() => h(Date.now()), 1e3);
1782
+ return () => clearInterval(e);
1783
+ }, [d]), /* @__PURE__ */ k(V, { children: [
1784
+ /* @__PURE__ */ O(H, {
1785
+ Icon: ye,
1786
+ right: d > 0 ? /* @__PURE__ */ O(B, {
1787
+ tone: "info",
1788
+ children: n.runningBadge(d)
1789
+ }) : /* @__PURE__ */ O(B, {
1790
+ tone: "neutral",
1791
+ children: n.runsBadge(c.length)
1792
+ }),
1793
+ children: e
1794
+ }),
1795
+ /* @__PURE__ */ O(yn, {
1796
+ apiName: e,
1797
+ definitions: o,
1798
+ runs: c
1799
+ }),
1800
+ /* @__PURE__ */ k("div", {
1801
+ className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
1802
+ children: [/* @__PURE__ */ O("div", {
1803
+ className: "vdt:text-foreground-muted vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:mb-1.5",
1804
+ children: n.runs(c.length)
1805
+ }), u ? /* @__PURE__ */ O("div", {
1806
+ className: "vdt:text-xs vdt:text-danger",
1807
+ children: n.runsUnavailable
1808
+ }) : c.length === 0 ? /* @__PURE__ */ O("div", {
1809
+ className: "vdt:text-xs vdt:text-foreground-subtle",
1810
+ children: o.length === 0 ? n.noDefinitions : n.noRuns
1811
+ }) : /* @__PURE__ */ O("div", {
1812
+ className: "vdt:flex vdt:flex-col vdt:gap-0.5",
1813
+ children: c.map((e) => /* @__PURE__ */ k("div", {
1814
+ "data-run-id": e.id,
1815
+ "data-run-status": e.status,
1816
+ children: [/* @__PURE__ */ k("button", {
1817
+ type: "button",
1818
+ "aria-expanded": f === e.id,
1819
+ onClick: () => p(f === e.id ? null : e.id),
1820
+ className: "vdt:w-full vdt:flex vdt:items-center vdt:gap-2 vdt:text-left vdt:text-xs vdt:px-1.5 vdt:py-1 vdt:rounded-sm vdt:hover:bg-muted",
1821
+ children: [
1822
+ /* @__PURE__ */ O("span", {
1823
+ className: "vdt:text-foreground-subtle vdt:w-2",
1824
+ children: f === e.id ? "▾" : "▸"
1825
+ }),
1826
+ /* @__PURE__ */ O(B, {
1827
+ tone: nn[e.status] ?? "neutral",
1828
+ children: e.status
1829
+ }),
1830
+ /* @__PURE__ */ O("code", {
1831
+ className: "vdt:font-mono vdt:text-foreground vdt:truncate",
1832
+ children: e.tag
1833
+ }),
1834
+ e.parentExecutionId === null ? null : /* @__PURE__ */ O(B, {
1835
+ tone: "neutral",
1836
+ children: n.child
1837
+ }),
1838
+ e.errorMessage === null ? null : /* @__PURE__ */ k("span", {
1839
+ className: "vdt:text-danger vdt:truncate vdt:font-mono vdt:text-[11px]",
1840
+ children: [e.errorTag === null ? "" : `${e.errorTag} · `, e.errorMessage]
1841
+ }),
1842
+ /* @__PURE__ */ O("span", {
1843
+ className: "vdt:ml-auto vdt:tabular-nums vdt:text-foreground-muted vdt:whitespace-nowrap",
1844
+ children: sn(dn(e, m))
1845
+ }),
1846
+ /* @__PURE__ */ O("span", {
1847
+ className: "vdt:tabular-nums vdt:text-foreground-subtle vdt:whitespace-nowrap",
1848
+ children: cn(e.startedAt)
1849
+ })
1850
+ ]
1851
+ }), f === e.id ? /* @__PURE__ */ O(bn, {
1852
+ baseUrl: a,
1853
+ run: e
1854
+ }) : null]
1855
+ }, e.id))
1856
+ })]
1857
+ })
1858
+ ] });
1859
+ }, yn = ({ apiName: e, definitions: t, runs: n }) => {
1860
+ let r = R().workflows, [a, o] = l(t[0] ?? "");
1861
+ i(() => {
1862
+ a === "" && t.length > 0 && o(t[0]);
1863
+ }, [t, a]);
1864
+ let c = s(() => {
1865
+ let e = n.find((e) => e.tag === a);
1866
+ return e === void 0 ? "{}" : ln(e.payload);
1867
+ }, [n, a]), [u, d] = l(c), [f, p] = l(!1);
1868
+ i(() => {
1869
+ f || d(c);
1870
+ }, [c, f]);
1871
+ let [m, h] = l(null), g = E(e, a === "" ? "__voltro.devtools.none" : a);
1872
+ if (t.length === 0) return null;
1873
+ let _ = async () => {
1874
+ let e;
1875
+ try {
1876
+ e = u.trim() === "" ? {} : JSON.parse(u);
1877
+ } catch (e) {
1878
+ h({
1879
+ tone: "danger",
1880
+ text: r.invalidJson(e instanceof Error ? e.message : String(e))
1881
+ });
1882
+ return;
1883
+ }
1884
+ h(null);
1885
+ try {
1886
+ let t = await g.start(e);
1887
+ h({
1888
+ tone: "success",
1889
+ text: r.started(t.executionId ?? t.id, t.status)
1890
+ }), p(!1);
1891
+ } catch (e) {
1892
+ h({
1893
+ tone: "danger",
1894
+ text: r.startFailed(e instanceof Error ? e.message : String(e))
1895
+ });
1896
+ }
1897
+ };
1898
+ return /* @__PURE__ */ k("div", {
1899
+ className: "vdt:px-3 vdt:py-2 vdt:flex vdt:flex-col vdt:gap-1.5",
1900
+ children: [
1901
+ /* @__PURE__ */ k("div", {
1902
+ className: "vdt:flex vdt:items-center vdt:gap-2",
1903
+ children: [
1904
+ /* @__PURE__ */ O("span", {
1905
+ className: "vdt:text-foreground-muted vdt:text-[10px] vdt:uppercase vdt:tracking-wider",
1906
+ children: r.start
1907
+ }),
1908
+ /* @__PURE__ */ O("select", {
1909
+ "aria-label": r.workflowLabel,
1910
+ value: a,
1911
+ onChange: (e) => {
1912
+ o(e.target.value), p(!1), h(null);
1913
+ },
1914
+ className: "vdt:text-xs vdt:font-mono vdt:bg-background vdt:border vdt:border-border vdt:rounded-sm vdt:px-1.5 vdt:py-0.5 vdt:text-foreground",
1915
+ children: t.map((e) => /* @__PURE__ */ O("option", {
1916
+ value: e,
1917
+ children: e
1918
+ }, e))
1919
+ }),
1920
+ /* @__PURE__ */ O("span", { className: "vdt:sp" }),
1921
+ /* @__PURE__ */ O(z, {
1922
+ onClick: () => {
1923
+ _();
1924
+ },
1925
+ disabled: g.pending || a === "",
1926
+ children: g.pending ? r.starting : r.start
1927
+ })
1928
+ ]
1929
+ }),
1930
+ /* @__PURE__ */ O("textarea", {
1931
+ "aria-label": r.payloadLabel,
1932
+ value: u,
1933
+ onChange: (e) => {
1934
+ d(e.target.value), p(!0);
1935
+ },
1936
+ spellCheck: !1,
1937
+ rows: Math.min(8, Math.max(2, u.split("\n").length)),
1938
+ className: "vdt:w-full vdt:text-[11px] vdt:font-mono vdt:bg-background vdt:border vdt:border-border vdt:rounded-sm vdt:px-2 vdt:py-1 vdt:text-foreground vdt:resize-y"
1939
+ }),
1940
+ /* @__PURE__ */ O("div", {
1941
+ className: "vdt:text-[10px] vdt:text-foreground-subtle",
1942
+ children: r.payloadHint
1943
+ }),
1944
+ m === null ? null : /* @__PURE__ */ O("div", {
1945
+ role: m.tone === "danger" ? "alert" : "status",
1946
+ className: `vdt:text-xs ${m.tone === "danger" ? "vdt:text-danger" : "vdt:text-success"}`,
1947
+ children: m.text
1948
+ })
1949
+ ]
1950
+ });
1951
+ }, bn = ({ baseUrl: e, run: t }) => {
1952
+ let n = R().workflows, r = X(), { steps: a, events: o } = hn(e, t.id), c = s(() => fn(o), [o]), [u, d] = l(""), [f, p] = l("{}"), [m, h] = l(!1), [g, _] = l(null);
1953
+ i(() => {
1954
+ u === "" && c.length > 0 && d(c[0]);
1955
+ }, [c, u]);
1956
+ let [v, y] = l(null), b = t.status === "running" || t.status === "queued" || t.status === "suspended", x = `${e}/_voltro/inspect/workflows/runs/${encodeURIComponent(t.id)}`, S = async (e, t) => {
1957
+ _(null), h(!0);
1958
+ try {
1959
+ _({
1960
+ tone: "success",
1961
+ text: await t()
1962
+ });
1963
+ } catch (t) {
1964
+ _({
1965
+ tone: "danger",
1966
+ text: n.actionFailed(e, t instanceof Error ? t.message : String(t))
1967
+ });
1968
+ } finally {
1969
+ h(!1);
1970
+ }
1971
+ }, C = () => S(n.cancel, async () => {
1972
+ let e = await Et(`${x}/cancel`, r, {});
1973
+ return n.cancelResult(typeof e.kind == "string" ? e.kind : e.cancelled === !0 ? "confirmed" : "submitted");
1974
+ }), w = () => S(n.sendSignal, async () => {
1975
+ let e;
1976
+ try {
1977
+ e = f.trim() === "" ? void 0 : JSON.parse(f);
1978
+ } catch (e) {
1979
+ throw Error(n.invalidJson(e instanceof Error ? e.message : String(e)));
1980
+ }
1981
+ return await Et(`${x}/signal`, r, e === void 0 ? { signalName: u } : {
1982
+ signalName: u,
1983
+ payload: e
1984
+ }), n.signalSent(u);
1985
+ });
1986
+ return /* @__PURE__ */ k("div", {
1987
+ className: "vdt:ml-4 vdt:pl-2 vdt:border-l vdt:border-border vdt:py-1 vdt:flex vdt:flex-col vdt:gap-2 vdt:text-xs",
1988
+ children: [
1989
+ /* @__PURE__ */ k("div", {
1990
+ className: "vdt:grid vdt:grid-cols-1 vdt:sm:grid-cols-2 vdt:gap-2",
1991
+ children: [/* @__PURE__ */ O($, {
1992
+ label: n.payloadLabel,
1993
+ value: t.payload
1994
+ }), /* @__PURE__ */ O($, {
1995
+ label: t.status === "failed" ? n.error : n.output,
1996
+ value: t.status === "failed" ? {
1997
+ tag: t.errorTag,
1998
+ message: t.errorMessage
1999
+ } : t.output
2000
+ })]
2001
+ }),
2002
+ /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
2003
+ className: "vdt:text-foreground-muted vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:mb-1",
2004
+ children: n.steps(a.length)
2005
+ }), a.length === 0 ? /* @__PURE__ */ O("div", {
2006
+ className: "vdt:text-foreground-subtle",
2007
+ children: n.noSteps
2008
+ }) : /* @__PURE__ */ O("div", {
2009
+ className: "vdt:flex vdt:flex-col vdt:gap-0.5",
2010
+ children: a.map((e) => /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ k("button", {
2011
+ type: "button",
2012
+ onClick: () => y(v === e.id ? null : e.id),
2013
+ className: "vdt:w-full vdt:flex vdt:items-center vdt:gap-2 vdt:text-left vdt:px-1 vdt:py-0.5 vdt:rounded-sm vdt:hover:bg-muted",
2014
+ children: [
2015
+ /* @__PURE__ */ O(B, {
2016
+ tone: rn[e.status] ?? "info",
2017
+ children: e.status
2018
+ }),
2019
+ /* @__PURE__ */ O("code", {
2020
+ className: "vdt:font-mono vdt:text-foreground",
2021
+ children: e.stepName
2022
+ }),
2023
+ e.attempt > 1 ? /* @__PURE__ */ O("span", {
2024
+ className: "vdt:text-warning",
2025
+ children: n.attempt(e.attempt)
2026
+ }) : null,
2027
+ e.errorMessage === null ? null : /* @__PURE__ */ O("span", {
2028
+ className: "vdt:text-danger vdt:truncate vdt:font-mono vdt:text-[11px]",
2029
+ children: e.errorMessage
2030
+ }),
2031
+ /* @__PURE__ */ O("span", {
2032
+ className: "vdt:ml-auto vdt:tabular-nums vdt:text-foreground-muted",
2033
+ children: sn(e.durationMs)
2034
+ })
2035
+ ]
2036
+ }), v === e.id ? /* @__PURE__ */ k("div", {
2037
+ className: "vdt:ml-3 vdt:grid vdt:grid-cols-1 vdt:sm:grid-cols-2 vdt:gap-2 vdt:py-1",
2038
+ children: [/* @__PURE__ */ O($, {
2039
+ label: n.input,
2040
+ value: e.input
2041
+ }), /* @__PURE__ */ O($, {
2042
+ label: e.status === "failed" ? n.error : n.output,
2043
+ value: e.status === "failed" ? e.errorCause ?? {
2044
+ tag: e.errorTag,
2045
+ message: e.errorMessage
2046
+ } : e.output
2047
+ })]
2048
+ }) : null] }, e.id))
2049
+ })] }),
2050
+ o.length > 0 ? /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
2051
+ className: "vdt:text-foreground-muted vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:mb-1",
2052
+ children: n.events(o.length)
2053
+ }), /* @__PURE__ */ O("div", {
2054
+ className: "vdt:flex vdt:flex-wrap vdt:gap-1",
2055
+ children: o.map((e) => /* @__PURE__ */ k("span", {
2056
+ title: cn(e.occurredAt),
2057
+ className: "vdt:inline-flex vdt:items-center vdt:gap-1 vdt:text-[10px] vdt:font-mono vdt:text-foreground-muted vdt:border vdt:border-border vdt:rounded-sm vdt:px-1",
2058
+ children: [e.eventType, e.stepName === null ? "" : ` · ${e.stepName}`]
2059
+ }, e.id))
2060
+ })] }) : null,
2061
+ /* @__PURE__ */ k("div", {
2062
+ className: "vdt:flex vdt:flex-wrap vdt:items-center vdt:gap-2",
2063
+ children: [
2064
+ b ? /* @__PURE__ */ O(z, {
2065
+ onClick: () => {
2066
+ C();
2067
+ },
2068
+ disabled: m,
2069
+ children: n.cancel
2070
+ }) : null,
2071
+ c.length > 0 && t.status === "running" ? /* @__PURE__ */ k(D, { children: [
2072
+ /* @__PURE__ */ O("span", {
2073
+ className: "vdt:text-foreground-muted",
2074
+ children: n.awaiting
2075
+ }),
2076
+ /* @__PURE__ */ O("select", {
2077
+ "aria-label": n.signalName,
2078
+ value: u,
2079
+ onChange: (e) => d(e.target.value),
2080
+ className: "vdt:text-xs vdt:font-mono vdt:bg-background vdt:border vdt:border-border vdt:rounded-sm vdt:px-1.5 vdt:py-0.5 vdt:text-foreground",
2081
+ children: c.map((e) => /* @__PURE__ */ O("option", {
2082
+ value: e,
2083
+ children: e
2084
+ }, e))
2085
+ }),
2086
+ /* @__PURE__ */ O("input", {
2087
+ "aria-label": n.signalPayload,
2088
+ value: f,
2089
+ onChange: (e) => p(e.target.value),
2090
+ spellCheck: !1,
2091
+ className: "vdt:text-[11px] vdt:font-mono vdt:bg-background vdt:border vdt:border-border vdt:rounded-sm vdt:px-1.5 vdt:py-0.5 vdt:text-foreground vdt:min-w-32"
2092
+ }),
2093
+ /* @__PURE__ */ O(z, {
2094
+ onClick: () => {
2095
+ w();
2096
+ },
2097
+ disabled: m || u === "",
2098
+ children: n.sendSignal
2099
+ })
2100
+ ] }) : null,
2101
+ t.traceId === null ? null : /* @__PURE__ */ k("span", {
2102
+ className: "vdt:text-[10px] vdt:font-mono vdt:text-foreground-subtle",
2103
+ children: [
2104
+ n.trace,
2105
+ " · ",
2106
+ t.traceId
2107
+ ]
2108
+ })
2109
+ ]
2110
+ }),
2111
+ g === null ? null : /* @__PURE__ */ O("div", {
2112
+ role: g.tone === "danger" ? "alert" : "status",
2113
+ className: g.tone === "danger" ? "vdt:text-danger" : "vdt:text-success",
2114
+ children: g.text
2115
+ })
2116
+ ]
2117
+ });
2118
+ }, $ = ({ label: e, value: t }) => /* @__PURE__ */ k("div", {
2119
+ className: "vdt:min-w-0",
2120
+ children: [/* @__PURE__ */ O("div", {
2121
+ className: "vdt:text-foreground-muted vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:mb-0.5",
2122
+ children: e
2123
+ }), t == null ? /* @__PURE__ */ O("div", {
2124
+ className: "vdt:text-foreground-subtle",
2125
+ children: "—"
2126
+ }) : /* @__PURE__ */ O("pre", {
2127
+ className: "vdt:overflow-x-auto vdt:text-[11px] vdt:font-mono vdt:p-1.5 vdt:rounded-sm vdt:bg-background vdt:border vdt:border-border vdt:text-foreground vdt:whitespace-pre-wrap vdt:break-all",
2128
+ children: ln(t)
2129
+ })]
2130
+ }), xn = (e) => {
2131
+ try {
2132
+ return JSON.stringify(e, null, 2);
2133
+ } catch {
2134
+ return String(e);
2135
+ }
2136
+ }, Sn = () => u(h, f, f), Cn = () => {
2137
+ let [e, t] = l(() => typeof window > "u" ? "/" : window.location.pathname);
2138
+ return i(() => {
2139
+ if (typeof window > "u") return;
2140
+ let e = () => t(window.location.pathname);
2141
+ window.addEventListener("popstate", e);
2142
+ let n = setInterval(e, 1e3);
2143
+ return () => {
2144
+ window.removeEventListener("popstate", e), clearInterval(n);
2145
+ };
2146
+ }, []), e;
2147
+ }, wn = () => {
2148
+ let e = Sn(), t = Cn(), n = R().routes, [r, i] = l(!0), a = e.pathname === "/" && Object.keys(e.params).length === 0 && e.loaderData === void 0 && t !== "/" ? t : e.pathname, o = Object.entries(e.params).map(([e, t]) => ({
2149
+ key: e,
2150
+ value: String(t)
2151
+ }));
2152
+ return /* @__PURE__ */ k("div", {
2153
+ className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
2154
+ children: [/* @__PURE__ */ k(V, { children: [
2155
+ /* @__PURE__ */ O(H, {
2156
+ Icon: me,
2157
+ children: n.currentRoute
2158
+ }),
2159
+ /* @__PURE__ */ O(U, { entries: [{
2160
+ key: "pathname",
2161
+ value: a
2162
+ }, {
2163
+ key: "params",
2164
+ value: o.length === 0 ? "—" : ""
2165
+ }] }),
2166
+ o.length > 0 ? /* @__PURE__ */ O("div", {
2167
+ className: "vdt:px-3 vdt:pb-3",
2168
+ children: /* @__PURE__ */ O(U, { entries: o })
2169
+ }) : null
2170
+ ] }), /* @__PURE__ */ k(V, { children: [
2171
+ /* @__PURE__ */ O(H, {
2172
+ Icon: me,
2173
+ children: n.loaderData
2174
+ }),
2175
+ /* @__PURE__ */ O("button", {
2176
+ onClick: () => i((e) => !e),
2177
+ className: "vdt:px-3 vdt:py-1.5 vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:hover:text-foreground",
2178
+ children: r ? n.collapse : n.expand
2179
+ }),
2180
+ r ? e.loaderData === void 0 ? /* @__PURE__ */ k(W, { children: [n.noLoaderTitle, /* @__PURE__ */ O("div", {
2181
+ className: "vdt:mt-1 vdt:text-foreground-subtle",
2182
+ children: n.noLoaderHint(/* @__PURE__ */ O("code", { children: "<Router>" }))
2183
+ })] }) : /* @__PURE__ */ O("pre", {
2184
+ className: "vdt:px-3 vdt:pb-3 vdt:text-[11px] vdt:max-h-80 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
2185
+ children: xn(e.loaderData)
2186
+ }) : null
2187
+ ] })]
2188
+ });
2189
+ }, Tn = (e) => {
2190
+ let t = 0, n = 0, r = 0, i = 0, a = 0;
2191
+ for (let o of Object.values(e)) o.kind === "query" && (t += 1), o.kind === "mutation" && (n += 1), o.kind === "action" && (r += 1), o.kind === "stream" && (i += 1), o.kind === "workflow" && (a += 1);
2192
+ return {
2193
+ queries: t,
2194
+ mutations: n,
2195
+ actions: r,
2196
+ streams: i,
2197
+ workflows: a
2198
+ };
2199
+ }, En = () => {
2200
+ let e = T(), t = R().runtimes, n = e.names;
2201
+ return n.length === 0 ? /* @__PURE__ */ k(W, { children: [t.emptyTitle, /* @__PURE__ */ O("div", {
2202
+ className: "vdt:mt-1 vdt:text-foreground-subtle",
2203
+ children: t.emptyHint
2204
+ })] }) : /* @__PURE__ */ O("div", {
2205
+ className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
2206
+ children: n.map((n) => {
2207
+ let r = e.get(n), i = Tn(r.descriptors);
2208
+ return /* @__PURE__ */ k(V, { children: [/* @__PURE__ */ O(H, {
2209
+ Icon: he,
2210
+ right: /* @__PURE__ */ O(B, {
2211
+ tone: "success",
2212
+ children: t.live
2213
+ }),
2214
+ children: n
2215
+ }), /* @__PURE__ */ O(U, { entries: [
2216
+ {
2217
+ key: "queries",
2218
+ value: String(i.queries)
2219
+ },
2220
+ {
2221
+ key: "mutations",
2222
+ value: String(i.mutations)
2223
+ },
2224
+ {
2225
+ key: "actions",
2226
+ value: String(i.actions)
2227
+ },
2228
+ {
2229
+ key: "streams",
2230
+ value: String(i.streams)
2231
+ },
2232
+ {
2233
+ key: "workflows",
2234
+ value: String(i.workflows)
2235
+ },
2236
+ {
2237
+ key: "cacheSize",
2238
+ value: String(r.cache.size())
2239
+ },
2240
+ {
2241
+ key: "descriptors",
2242
+ value: String(Object.keys(r.descriptors).length)
2243
+ }
2244
+ ] })] }, n);
2245
+ })
2246
+ });
2247
+ }, Dn = () => u(S, b, b), On = (e, t = 90) => {
2248
+ let n;
2249
+ try {
2250
+ n = JSON.stringify(e) ?? String(e);
2251
+ } catch {
2252
+ n = String(e);
2253
+ }
2254
+ return n.length > t ? `${n.slice(0, t)}…` : n;
2255
+ }, kn = (e, t) => typeof e != "object" || typeof t != "object" || e === null || t === null ? [] : [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].filter((n) => !Object.is(e[n], t[n])), An = ({ label: e, state: t }) => {
2256
+ let [n, r] = l(!1);
2257
+ return /* @__PURE__ */ k("div", {
2258
+ className: "vdt:border-t vdt:border-border",
2259
+ children: [/* @__PURE__ */ k("button", {
2260
+ type: "button",
2261
+ className: "vdt:flex vdt:w-full vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-2 vdt:text-left vdt:hover:bg-muted",
2262
+ onClick: () => r((e) => !e),
2263
+ children: [/* @__PURE__ */ O(B, {
2264
+ tone: "neutral",
2265
+ children: e
2266
+ }), /* @__PURE__ */ O("span", {
2267
+ className: "vdt:truncate vdt:font-mono vdt:text-[11px] vdt:text-foreground-muted",
2268
+ children: On(t)
2269
+ })]
2270
+ }), n ? /* @__PURE__ */ O(U, { entries: Object.entries(t).map(([e, t]) => ({
2271
+ key: e,
2272
+ value: On(t, 200)
2273
+ })) }) : null]
2274
+ });
2275
+ }, jn = () => {
2276
+ let e = Dn(), [t, n] = l(null), r = v(), i = t ?? e.length;
2277
+ return /* @__PURE__ */ k(D, { children: [
2278
+ /* @__PURE__ */ k(H, {
2279
+ Icon: pe,
2280
+ right: /* @__PURE__ */ k(z, {
2281
+ onClick: () => {
2282
+ _(), n(null);
2283
+ },
2284
+ children: [/* @__PURE__ */ O(_e, {}), "Clear"]
2285
+ }),
2286
+ children: [
2287
+ "Stores (",
2288
+ r.length,
2289
+ ")"
2290
+ ]
2291
+ }),
2292
+ r.length === 0 ? /* @__PURE__ */ O(W, { children: "No stores defined. `defineStore(name, () => state)` in a *.store.ts file." }) : r.map((e) => /* @__PURE__ */ k(V, { children: [
2293
+ /* @__PURE__ */ O(H, { children: e.name }),
2294
+ /* @__PURE__ */ O(An, {
2295
+ label: "global",
2296
+ state: e.get()
2297
+ }),
2298
+ e.keys().map((t) => /* @__PURE__ */ O(An, {
2299
+ label: t,
2300
+ state: e.get(t)
2301
+ }, t))
2302
+ ] }, e.name)),
2303
+ /* @__PURE__ */ k(H, {
2304
+ Icon: ge,
2305
+ right: /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(z, {
2306
+ onClick: () => {
2307
+ i <= 0 || C(i - 1, "before") && n(i - 1);
2308
+ },
2309
+ disabled: i <= 0,
2310
+ children: "◀ Back"
2311
+ }), /* @__PURE__ */ O(z, {
2312
+ onClick: () => {
2313
+ t === null || i >= e.length || C(i, "after") && n(i + 1);
2314
+ },
2315
+ disabled: t === null || i >= e.length,
2316
+ children: "Forward ▶"
2317
+ })] }),
2318
+ children: [
2319
+ "Writes (",
2320
+ e.length,
2321
+ ")",
2322
+ t === null ? "" : ` — travelled to ${i}/${e.length}`
2323
+ ]
2324
+ }),
2325
+ e.length === 0 ? /* @__PURE__ */ O(W, { children: "No writes yet. Every `set()` lands here, labelled if you pass one." }) : [...e].reverse().map((n, r) => {
2326
+ let a = e.length - 1 - r, o = kn(n.prev, n.next);
2327
+ return /* @__PURE__ */ k(V, { children: [/* @__PURE__ */ k("div", {
2328
+ className: "vdt:flex vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-2",
2329
+ children: [
2330
+ /* @__PURE__ */ O(B, {
2331
+ tone: n.isUndo === !0 ? "warning" : "neutral",
2332
+ children: n.store
2333
+ }),
2334
+ n.key === void 0 ? null : /* @__PURE__ */ O(B, {
2335
+ tone: "neutral",
2336
+ children: n.key
2337
+ }),
2338
+ n.label === void 0 ? null : /* @__PURE__ */ O("span", {
2339
+ className: "vdt:truncate vdt:font-mono vdt:text-[11px] vdt:text-foreground-muted",
2340
+ children: n.label
2341
+ }),
2342
+ t !== null && a === i ? /* @__PURE__ */ O(B, {
2343
+ tone: "info",
2344
+ children: "here"
2345
+ }) : null
2346
+ ]
2347
+ }), /* @__PURE__ */ O(U, { entries: [
2348
+ {
2349
+ key: "changed",
2350
+ value: o.length > 0 ? o.join(", ") : "(no field diff)"
2351
+ },
2352
+ {
2353
+ key: "before",
2354
+ value: On(n.prev)
2355
+ },
2356
+ {
2357
+ key: "after",
2358
+ value: On(n.next)
2359
+ }
2360
+ ] })] }, `${n.at}-${a}`);
2361
+ })
2362
+ ] });
2363
+ }, Mn = (e) => typeof e == "number" ? e < 1 ? "<1ms" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s` : "—", Nn = (e) => {
1727
2364
  try {
1728
- let n = await fetch(`${e}/_voltro/inspect/traces`, { headers: J(t, { accept: "application/json" }) });
1729
- return n.ok ? await n.json() : null;
2365
+ return JSON.stringify(e, null, 2);
1730
2366
  } catch {
1731
- return null;
2367
+ return String(e);
1732
2368
  }
1733
- }, Gt = (e, t = !0) => {
1734
- let n = Y(), i = q(), a = t && n && e !== "", [o, c] = s(Ht);
1735
- return r(() => {
1736
- if (!a) return;
1737
- let t = !1, n = async () => {
1738
- let n = await Wt(e, i);
1739
- t || n === null || c(n);
1740
- };
1741
- n();
1742
- let r = setInterval(n, Ut);
1743
- return () => {
1744
- t = !0, clearInterval(r);
1745
- };
1746
- }, [
1747
- e,
1748
- a,
1749
- i
1750
- ]), o;
1751
- }, Kt = (e) => {
1752
- let t = b(), n = Y(), i = q(), a = t.names.join(","), [o, c] = s(0), l = e && n;
1753
- return r(() => {
1754
- if (!l) {
1755
- c(0);
2369
+ }, Pn = ({ mutation: e }) => /* @__PURE__ */ k("div", {
2370
+ className: "vdt:bg-background/60",
2371
+ children: [
2372
+ /* @__PURE__ */ O(U, { entries: [
2373
+ {
2374
+ key: "id",
2375
+ value: e.id
2376
+ },
2377
+ {
2378
+ key: "api",
2379
+ value: e.apiName
2380
+ },
2381
+ {
2382
+ key: "tag",
2383
+ value: e.tag
2384
+ },
2385
+ {
2386
+ key: "status",
2387
+ value: e.status
2388
+ },
2389
+ {
2390
+ key: "startedAt",
2391
+ value: new Date(e.startedAt).toISOString()
2392
+ },
2393
+ {
2394
+ key: "settledAt",
2395
+ value: e.settledAt ? new Date(e.settledAt).toISOString() : "—"
2396
+ },
2397
+ {
2398
+ key: "duration",
2399
+ value: Mn(e.durationMs)
2400
+ }
2401
+ ] }),
2402
+ /* @__PURE__ */ k("details", {
2403
+ className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
2404
+ open: !0,
2405
+ children: [/* @__PURE__ */ O("summary", {
2406
+ className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:cursor-pointer",
2407
+ children: "Input"
2408
+ }), /* @__PURE__ */ O("pre", {
2409
+ className: "vdt:mt-2 vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
2410
+ children: Nn(e.input)
2411
+ })]
2412
+ }),
2413
+ e.status === "success" ? /* @__PURE__ */ k("details", {
2414
+ className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
2415
+ open: !0,
2416
+ children: [/* @__PURE__ */ O("summary", {
2417
+ className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:cursor-pointer",
2418
+ children: "Output"
2419
+ }), /* @__PURE__ */ O("pre", {
2420
+ className: "vdt:mt-2 vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
2421
+ children: Nn(e.output)
2422
+ })]
2423
+ }) : null,
2424
+ e.status === "error" ? /* @__PURE__ */ k("details", {
2425
+ className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
2426
+ open: !0,
2427
+ children: [/* @__PURE__ */ O("summary", {
2428
+ className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-danger vdt:cursor-pointer",
2429
+ children: "Error"
2430
+ }), /* @__PURE__ */ O("pre", {
2431
+ className: "vdt:mt-2 vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-danger",
2432
+ children: e.error instanceof Error ? `${e.error.name}: ${e.error.message}\n\n${e.error.stack ?? ""}` : Nn(e.error)
2433
+ })]
2434
+ }) : null
2435
+ ]
2436
+ }), Fn = {
2437
+ trace: "vdt:text-foreground-subtle",
2438
+ debug: "vdt:text-info",
2439
+ info: "vdt:text-foreground",
2440
+ warn: "vdt:text-warning",
2441
+ error: "vdt:text-danger",
2442
+ fatal: "vdt:text-danger vdt:font-bold"
2443
+ }, In = (e) => {
2444
+ if (Object.keys(e).length === 0) return "";
2445
+ try {
2446
+ return JSON.stringify(e, null, 2);
2447
+ } catch {
2448
+ return String(e);
2449
+ }
2450
+ }, Ln = (e) => {
2451
+ let t = (e) => e < 10 ? `0${e}` : String(e);
2452
+ return `${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${((e) => e < 100 ? e < 10 ? `00${e}` : `0${e}` : String(e))(e.getMilliseconds())}`;
2453
+ }, Rn = ({ record: e }) => {
2454
+ let t = In(e.fields);
2455
+ return /* @__PURE__ */ k("div", {
2456
+ className: "vdt:bg-background/60 vdt:px-3 vdt:py-2 vdt:flex vdt:flex-col vdt:gap-2",
2457
+ children: [
2458
+ /* @__PURE__ */ k("div", {
2459
+ className: "vdt:text-[10px] vdt:font-mono vdt:text-foreground-muted",
2460
+ children: [
2461
+ Ln(e.ts),
2462
+ e.scope ? ` · ${e.scope}` : "",
2463
+ " · ",
2464
+ e.level
2465
+ ]
2466
+ }),
2467
+ /* @__PURE__ */ O("div", {
2468
+ className: ["vdt:text-xs vdt:break-words", Fn[e.level]].join(" "),
2469
+ children: e.message
2470
+ }),
2471
+ e.fiberId ? /* @__PURE__ */ k("div", {
2472
+ className: "vdt:text-[10px] vdt:font-mono vdt:text-foreground-muted",
2473
+ children: ["fiber: ", e.fiberId]
2474
+ }) : null,
2475
+ t ? /* @__PURE__ */ O("pre", {
2476
+ className: "vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
2477
+ children: t
2478
+ }) : null,
2479
+ e.cause === void 0 ? null : /* @__PURE__ */ O("pre", {
2480
+ className: "vdt:text-[11px] vdt:max-h-48 vdt:overflow-auto vdt:font-mono vdt:text-danger",
2481
+ children: e.cause instanceof Error ? e.cause.stack ?? `${e.cause.name}: ${e.cause.message}` : String(e.cause)
2482
+ })
2483
+ ]
2484
+ });
2485
+ }, zn = 4e3, Bn = async (e, t) => {
2486
+ if (e === "") return null;
2487
+ let n = await Z(`${e}/_voltro/inspect/traces`, t);
2488
+ return n !== null && Array.isArray(n.traces) ? n : null;
2489
+ }, Vn = [], Hn = (e) => {
2490
+ let t = T(), n = Q(), r = X(), a = t.names.join(","), [o, s] = l(Vn), c = e && n;
2491
+ return i(() => {
2492
+ if (!c) {
2493
+ s(Vn);
1756
2494
  return;
1757
2495
  }
1758
- let e = a === "" ? [] : a.split(",").map((e) => t.get(e).inspectBaseUrl).filter((e) => e !== "");
2496
+ let e = a === "" ? [] : a.split(",").map((e) => ({
2497
+ name: e,
2498
+ baseUrl: t.get(e).inspectBaseUrl
2499
+ })).filter((e) => e.baseUrl !== "");
1759
2500
  if (e.length === 0) {
1760
- c(0);
2501
+ s(Vn);
1761
2502
  return;
1762
2503
  }
1763
- let n = !1, r = async () => {
1764
- let t = await Promise.all(e.map((e) => Wt(e, i)));
1765
- n || c(t.reduce((e, t) => e + (t === null ? 0 : t.traces.filter((e) => e.hasError).length), 0));
2504
+ let n = !1, i = async () => {
2505
+ let t = await Promise.all(e.map((e) => Bn(e.baseUrl, r)));
2506
+ if (n) return;
2507
+ let i = [];
2508
+ t.forEach((t, n) => {
2509
+ if (t !== null) for (let r of t.traces) i.push({
2510
+ apiName: e[n].name,
2511
+ trace: r
2512
+ });
2513
+ }), s(i);
1766
2514
  };
1767
- r();
1768
- let o = setInterval(r, Ut);
2515
+ i();
2516
+ let o = setInterval(i, zn);
1769
2517
  return () => {
1770
2518
  n = !0, clearInterval(o);
1771
2519
  };
1772
2520
  }, [
1773
2521
  t,
1774
2522
  a,
1775
- l,
1776
- i
2523
+ c,
2524
+ r
1777
2525
  ]), o;
1778
- }, $ = (e) => e < 1 ? "<1ms" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(2)}s`, qt = (e) => {
1779
- let t = new Date(e), n = (e) => e < 10 ? `0${e}` : String(e);
1780
- return `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
1781
- }, Jt = (e) => {
2526
+ }, Un = (e) => e < 1 ? "<1ms" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(2)}s`, Wn = (e) => {
1782
2527
  let t = new Map(e.map((e) => [e.spanId, e])), n = /* @__PURE__ */ new Map(), r = (e, i) => {
1783
2528
  if (n.has(e.spanId)) return n.get(e.spanId);
1784
2529
  if (i > 64 || e.parentSpanId === null) return n.set(e.spanId, 0), 0;
@@ -1787,346 +2532,909 @@ var q = () => n(ht), J = (e, t) => {
1787
2532
  };
1788
2533
  for (let t of e) r(t, 0);
1789
2534
  return n;
1790
- }, Yt = ({ trace: e }) => {
1791
- let [t, n] = s(e.hasError), r = B().traces, i = Jt(e.spans), a = e.startMs, o = e.durationMs > 0 ? e.durationMs : 1;
1792
- return /* @__PURE__ */ d("div", {
1793
- className: "vdt:border vdt:border-border vdt:rounded-md vdt:overflow-hidden",
1794
- children: [/* @__PURE__ */ d("button", {
1795
- onClick: () => n((e) => !e),
1796
- className: "vdt:w-full vdt:flex vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-2 vdt:text-left vdt:text-sm hover:vdt:bg-background-elevated",
2535
+ }, Gn = ({ trace: e }) => {
2536
+ let t = Wn(e.spans), n = e.startMs, r = e.durationMs > 0 ? e.durationMs : 1;
2537
+ return /* @__PURE__ */ k("div", {
2538
+ className: "vdt:px-3 vdt:py-2 vdt:space-y-1 vdt:bg-background",
2539
+ children: [
2540
+ /* @__PURE__ */ k("div", {
2541
+ className: "vdt:text-foreground-subtle vdt:text-[10px] vdt:font-mono vdt:mb-1",
2542
+ children: ["trace ", e.traceId]
2543
+ }),
2544
+ e.spans.map((e) => {
2545
+ let i = t.get(e.spanId) ?? 0, a = Math.max(0, Math.min(100, (e.startMs - n) / r * 100)), o = Math.max(1.5, Math.min(100 - a, e.durationMs / r * 100)), s = e.status === "error";
2546
+ return /* @__PURE__ */ k("div", {
2547
+ className: "vdt:flex vdt:items-center vdt:gap-2 vdt:text-xs",
2548
+ children: [
2549
+ /* @__PURE__ */ k("div", {
2550
+ className: "vdt:flex vdt:items-center vdt:gap-1 vdt:w-56 vdt:shrink-0",
2551
+ style: { paddingLeft: i * 12 },
2552
+ children: [/* @__PURE__ */ O("span", {
2553
+ className: s ? "vdt:text-danger" : "vdt:text-foreground-muted",
2554
+ children: s ? "✗" : "·"
2555
+ }), /* @__PURE__ */ O("code", {
2556
+ className: `vdt:font-mono vdt:truncate ${s ? "vdt:text-danger" : "vdt:text-foreground"}`,
2557
+ children: e.name
2558
+ })]
2559
+ }),
2560
+ /* @__PURE__ */ O("div", {
2561
+ className: "vdt:relative vdt:flex-1 vdt:h-3 vdt:bg-background-elevated vdt:rounded-sm vdt:overflow-hidden",
2562
+ children: /* @__PURE__ */ O("div", {
2563
+ className: `vdt:absolute vdt:top-0 vdt:h-full vdt:rounded-sm ${s ? "vdt:bg-danger" : "vdt:bg-accent"}`,
2564
+ style: {
2565
+ left: `${a}%`,
2566
+ width: `${o}%`
2567
+ }
2568
+ })
2569
+ }),
2570
+ /* @__PURE__ */ O("span", {
2571
+ className: "vdt:text-foreground vdt:tabular-nums vdt:w-14 vdt:text-right vdt:shrink-0",
2572
+ children: Un(e.durationMs)
2573
+ })
2574
+ ]
2575
+ }, e.spanId);
2576
+ }),
2577
+ e.spans.filter((e) => e.status === "error" && e.statusMessage).map((e) => /* @__PURE__ */ k("div", {
2578
+ className: "vdt:text-danger vdt:text-xs vdt:font-mono vdt:pl-2 vdt:pt-1",
2579
+ children: [
2580
+ e.name,
2581
+ ": ",
2582
+ e.statusMessage
2583
+ ]
2584
+ }, `${e.spanId}-msg`))
2585
+ ]
2586
+ });
2587
+ }, Kn = [
2588
+ "all",
2589
+ "subscription",
2590
+ "mutation",
2591
+ "trace",
2592
+ "log"
2593
+ ], qn = [
2594
+ "workflows",
2595
+ "stores",
2596
+ "indexes",
2597
+ "webhooks",
2598
+ "routes",
2599
+ "runtimes"
2600
+ ], Jn = [...Kn, ...qn], Yn = (e) => Kn.includes(e), Xn = (e) => {
2601
+ let t = [], n = /"([^"]*)"|(\S+)/g, r;
2602
+ for (; (r = n.exec(e)) !== null;) {
2603
+ let e = (r[1] ?? r[2] ?? "").toLowerCase();
2604
+ e !== "" && t.push(e);
2605
+ }
2606
+ return t;
2607
+ }, Zn = (e, t) => t.every((t) => e.includes(t)), Qn = {
2608
+ subscription: 0,
2609
+ mutation: 1,
2610
+ trace: 1,
2611
+ log: 1
2612
+ }, $n = (e, t, n) => {
2613
+ let r = Xn(t), i = n === "all" ? e : e.filter((e) => e.source === n);
2614
+ return [...r.length === 0 ? i : i.filter((e) => Zn(e.haystack, r))].sort((e, t) => {
2615
+ let n = Qn[e.source] - Qn[t.source];
2616
+ return n === 0 ? t.at - e.at : n;
2617
+ });
2618
+ }, er = (e) => {
2619
+ let t = {
2620
+ subscription: 0,
2621
+ mutation: 0,
2622
+ trace: 0,
2623
+ log: 0
2624
+ };
2625
+ for (let n of e) t[n.source]++;
2626
+ return t;
2627
+ }, tr = (e, t = 400) => {
2628
+ let n;
2629
+ try {
2630
+ n = JSON.stringify(e) ?? String(e);
2631
+ } catch {
2632
+ n = String(e);
2633
+ }
2634
+ return n.length > t ? n.slice(0, t) : n;
2635
+ }, nr = (e, t, n) => {
2636
+ if (e.length === 0) return null;
2637
+ let r = t === null ? -1 : e.indexOf(t);
2638
+ return r === -1 ? n === 1 ? e[0] : e[e.length - 1] : e[(r + n + e.length) % e.length];
2639
+ }, rr = (e) => e.recovery.phase === "stuck" || e.snapshot.error ? "err" : e.recovery.phase !== "steady" || e.snapshot.pendingPatches > 0 ? "warn" : e.snapshot.revision >= 0 ? "ok" : e.hasFiber ? "info" : "idle", ir = (e, t) => {
2640
+ let n = Ge(t.key), r = [];
2641
+ t.subscriberCount > 0 && r.push(`${t.subscriberCount} sub${t.subscriberCount === 1 ? "" : "s"}`), t.snapshot.revision >= 0 && r.push(`r${t.snapshot.revision}`), t.snapshot.pendingPatches > 0 && r.push(`+${t.snapshot.pendingPatches} pending`), t.evicting && r.push("evicting");
2642
+ let i = t.snapshot.error ? "error" : t.recovery.phase === "steady" ? void 0 : t.recovery.phase;
2643
+ return {
2644
+ id: `sub:${e}:${t.key}`,
2645
+ source: "subscription",
2646
+ apiName: e,
2647
+ name: n,
2648
+ summary: r.join(" · "),
2649
+ ...i === void 0 ? {} : { status: i },
2650
+ tone: rr(t),
2651
+ at: 0,
2652
+ haystack: `${e} ${t.key} ${t.tag ?? ""} ${t.source ?? ""} ${i ?? ""}`.toLowerCase(),
2653
+ detail: {
2654
+ source: "subscription",
2655
+ apiName: e,
2656
+ entry: t
2657
+ }
2658
+ };
2659
+ }, ar = (e) => e.status === "pending" ? "info" : e.status === "success" ? "ok" : "err", or = (e) => e.status === "error" ? e.error instanceof Error && e.error.name !== "Error" ? e.error.name : "error" : e.status, sr = (e) => {
2660
+ let t = tr(e.input, 160), n = e.status === "error" ? e.error instanceof Error ? `${e.error.name} ${e.error.message}` : tr(e.error, 200) : "";
2661
+ return {
2662
+ id: `mut:${e.id}`,
2663
+ source: "mutation",
2664
+ apiName: e.apiName,
2665
+ name: e.tag,
2666
+ summary: t,
2667
+ status: or(e),
2668
+ tone: ar(e),
2669
+ at: e.startedAt,
2670
+ haystack: `${e.apiName} ${e.tag} ${e.status} ${t} ${n}`.toLowerCase(),
2671
+ detail: {
2672
+ source: "mutation",
2673
+ mutation: e
2674
+ }
2675
+ };
2676
+ }, cr = (e) => {
2677
+ switch (e.level) {
2678
+ case "error":
2679
+ case "fatal": return "err";
2680
+ case "warn": return "warn";
2681
+ case "info": return "info";
2682
+ default: return "idle";
2683
+ }
2684
+ }, lr = (e, t) => ({
2685
+ id: `log:${e.ts.getTime()}:${t}`,
2686
+ source: "log",
2687
+ name: e.scope ?? "log",
2688
+ summary: e.message,
2689
+ status: e.level,
2690
+ tone: cr(e),
2691
+ at: e.ts.getTime(),
2692
+ haystack: `${e.scope ?? ""} ${e.level} ${e.message} ${tr(e.fields, 300)}`.toLowerCase(),
2693
+ detail: {
2694
+ source: "log",
2695
+ record: e
2696
+ }
2697
+ }), ur = (e, t) => {
2698
+ let n = t.spans.slice(0, 4).map((e) => e.name).join(" → "), r = t.kind === "subscription" ? `${t.deliveryCount ?? 0} deliveries` : `${t.spanCount} spans · ${n}`, i = t.spans.filter((e) => e.status === "error").map((e) => `${e.name} ${e.statusMessage ?? ""}`).join(" ");
2699
+ return {
2700
+ id: `trace:${e}:${t.traceId}`,
2701
+ source: "trace",
2702
+ apiName: e,
2703
+ name: t.rootName,
2704
+ summary: r,
2705
+ status: t.hasError ? "error" : "ok",
2706
+ tone: t.hasError ? "err" : "ok",
2707
+ at: t.startMs,
2708
+ haystack: `${e} ${t.rootName} ${t.traceId} ${t.spans.map((e) => e.name).join(" ")} ${i}`.toLowerCase(),
2709
+ detail: {
2710
+ source: "trace",
2711
+ apiName: e,
2712
+ trace: t
2713
+ }
2714
+ };
2715
+ }, dr = () => u(x, y, y), fr = () => u(le, I, I), pr = (e) => {
2716
+ let t = We(), n = dr(), r = fr(), i = Hn(e);
2717
+ return s(() => {
2718
+ let e = [];
2719
+ for (let n of t) for (let t of n.entries) e.push(ir(n.name, t));
2720
+ for (let t of n) e.push(sr(t));
2721
+ for (let t of i) e.push(ur(t.apiName, t.trace));
2722
+ return r.forEach((t, n) => e.push(lr(t, n))), e;
2723
+ }, [
2724
+ t,
2725
+ n,
2726
+ r,
2727
+ i
2728
+ ]);
2729
+ }, mr = {
2730
+ all: null,
2731
+ subscription: fe,
2732
+ mutation: Se,
2733
+ trace: be,
2734
+ log: we,
2735
+ workflows: ye,
2736
+ stores: pe,
2737
+ indexes: Ce,
2738
+ webhooks: ve,
2739
+ routes: me,
2740
+ runtimes: Te
2741
+ }, hr = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent) ? {
2742
+ search: "⌘K",
2743
+ alt: "⌥",
2744
+ shift: "⇧"
2745
+ } : {
2746
+ search: "Ctrl K",
2747
+ alt: "Alt",
2748
+ shift: "Shift"
2749
+ }, gr = (e, t, n) => {
2750
+ if (n.trim() !== "") return {
2751
+ title: e.noResults,
2752
+ hint: e.noResultsHint
2753
+ };
2754
+ switch (t) {
2755
+ case "subscription": return {
2756
+ title: e.emptySubscriptions,
2757
+ hint: e.emptySubscriptionsHint
2758
+ };
2759
+ case "mutation": return {
2760
+ title: e.emptyMutations,
2761
+ hint: e.emptyMutationsHint
2762
+ };
2763
+ case "trace": return {
2764
+ title: e.emptyTraces,
2765
+ hint: e.emptyTracesHint
2766
+ };
2767
+ case "log": return {
2768
+ title: e.emptyLogs,
2769
+ hint: e.emptyLogsHint
2770
+ };
2771
+ default: return {
2772
+ title: e.emptyAll,
2773
+ hint: e.emptyAllHint
2774
+ };
2775
+ }
2776
+ }, _r = (e) => {
2777
+ let t = new Date(e), n = (e) => e < 10 ? `0${e}` : String(e);
2778
+ return `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
2779
+ }, vr = ({ item: e, selected: t, onSelect: n }) => {
2780
+ let r = c(null);
2781
+ return i(() => {
2782
+ t && r.current !== null && typeof r.current.scrollIntoView == "function" && r.current.scrollIntoView({ block: "nearest" });
2783
+ }, [t]), /* @__PURE__ */ k("button", {
2784
+ ref: r,
2785
+ type: "button",
2786
+ role: "option",
2787
+ "aria-selected": t,
2788
+ "data-source": e.source,
2789
+ className: `vdt-row${t ? " vdt-row-sel" : ""}`,
2790
+ onClick: n,
2791
+ children: [
2792
+ /* @__PURE__ */ O("span", {
2793
+ className: `vdt-dot vdt-dot-${e.tone}`,
2794
+ "aria-hidden": "true"
2795
+ }),
2796
+ /* @__PURE__ */ O("span", {
2797
+ className: "vdt-row-src",
2798
+ children: e.source
2799
+ }),
2800
+ /* @__PURE__ */ k("span", {
2801
+ className: "vdt-row-main",
2802
+ children: [/* @__PURE__ */ O("code", {
2803
+ className: "vdt-row-name",
2804
+ children: e.name
2805
+ }), /* @__PURE__ */ O("span", {
2806
+ className: "vdt-row-summary",
2807
+ children: e.summary
2808
+ })]
2809
+ }),
2810
+ /* @__PURE__ */ k("span", {
2811
+ className: "vdt-row-meta",
2812
+ children: [
2813
+ e.apiName !== void 0 && e.source !== "mutation" ? /* @__PURE__ */ O("span", {
2814
+ className: "vdt-row-api",
2815
+ children: e.apiName
2816
+ }) : null,
2817
+ e.status === void 0 ? null : /* @__PURE__ */ O("span", {
2818
+ className: `vdt-tag vdt-tag-${e.tone}`,
2819
+ children: e.status
2820
+ }),
2821
+ e.at > 0 ? /* @__PURE__ */ O("span", {
2822
+ className: "vdt-row-time",
2823
+ children: _r(e.at)
2824
+ }) : null
2825
+ ]
2826
+ })
2827
+ ]
2828
+ });
2829
+ }, yr = ({ item: e }) => {
2830
+ let t = e.detail;
2831
+ return /* @__PURE__ */ k("div", {
2832
+ className: "vdt-detail",
2833
+ children: [/* @__PURE__ */ k("div", {
2834
+ className: "vdt-detail-head",
1797
2835
  children: [
1798
- /* @__PURE__ */ u("span", {
1799
- className: "vdt:text-foreground-muted vdt:text-xs",
1800
- children: t ? "▾" : "▸"
2836
+ /* @__PURE__ */ O("span", {
2837
+ className: `vdt-dot vdt-dot-${e.tone}`,
2838
+ "aria-hidden": "true"
1801
2839
  }),
1802
- /* @__PURE__ */ u("code", {
1803
- className: "vdt:font-mono vdt:text-foreground vdt:truncate vdt:max-w-64",
1804
- children: e.rootName
2840
+ /* @__PURE__ */ O("span", {
2841
+ className: "vdt-row-src",
2842
+ children: e.source
1805
2843
  }),
1806
- e.hasError ? /* @__PURE__ */ u(w, {
1807
- tone: "danger",
1808
- children: r.error
1809
- }) : /* @__PURE__ */ u(w, {
1810
- tone: "success",
1811
- children: r.ok
2844
+ /* @__PURE__ */ O("code", {
2845
+ className: "vdt-detail-name",
2846
+ children: e.name
1812
2847
  }),
1813
- e.kind === "subscription" ? /* @__PURE__ */ u(w, {
1814
- tone: "info",
1815
- children: r.sub
2848
+ e.status === void 0 ? null : /* @__PURE__ */ O("span", {
2849
+ className: `vdt-tag vdt-tag-${e.tone}`,
2850
+ children: e.status
2851
+ }),
2852
+ /* @__PURE__ */ O("span", { className: "vdt-sp" }),
2853
+ e.apiName === void 0 ? null : /* @__PURE__ */ O("span", {
2854
+ className: "vdt-row-api",
2855
+ children: e.apiName
2856
+ }),
2857
+ e.at > 0 ? /* @__PURE__ */ O("span", {
2858
+ className: "vdt-row-time",
2859
+ children: _r(e.at)
2860
+ }) : null
2861
+ ]
2862
+ }), /* @__PURE__ */ k("div", {
2863
+ className: "vdt-detail-body",
2864
+ children: [
2865
+ t.source === "subscription" ? /* @__PURE__ */ O(Ke, { entry: t.entry }) : null,
2866
+ t.source === "mutation" ? /* @__PURE__ */ O(Pn, { mutation: t.mutation }) : null,
2867
+ t.source === "trace" ? /* @__PURE__ */ O(Gn, { trace: t.trace }) : null,
2868
+ t.source === "log" ? /* @__PURE__ */ O(Rn, { record: t.record }) : null
2869
+ ]
2870
+ })]
2871
+ });
2872
+ }, br = ({ name: e }) => {
2873
+ let t = R().shell, n = w(e).status, r = n === "connected" ? "ok" : n === "recovering" ? "warn" : "err", i = n === "connected" ? t.connected : n === "recovering" ? t.recovering : n === "degraded" ? t.degraded : t.offline;
2874
+ return /* @__PURE__ */ k("span", {
2875
+ className: "vdt-chip",
2876
+ "data-status": n,
2877
+ children: [
2878
+ /* @__PURE__ */ O("span", {
2879
+ className: `vdt-dot vdt-dot-${r}`,
2880
+ "aria-hidden": "true"
2881
+ }),
2882
+ /* @__PURE__ */ O("b", { children: e }),
2883
+ /* @__PURE__ */ O("span", { children: i })
2884
+ ]
2885
+ });
2886
+ }, xr = () => u(h, () => f().pathname ?? "", () => ""), Sr = ({ dock: e, push: t, onDock: n, onPush: r, onClose: i, scope: a, onScope: o, searchRef: c, onHeaderPointerDown: u }) => {
2887
+ let d = R(), f = d.shell, p = d.tabs, m = T(), h = pr(!0), g = Wt(!0), _ = Zt(!0), v = gn(!0), y = xr(), [b, x] = l(""), [S, C] = l(null), w = Yn(a), E = s(() => er(h), [h]), A = s(() => h.filter((e) => e.source === "trace" && e.tone === "err").length, [h]), j = s(() => $n(h, b, a), [
2888
+ h,
2889
+ b,
2890
+ a
2891
+ ]), M = s(() => gr(f, a, b), [
2892
+ f,
2893
+ a,
2894
+ b
2895
+ ]), N = s(() => S === null ? null : j.find((e) => e.id === S) ?? null, [j, S]), P = (e) => {
2896
+ switch (e) {
2897
+ case "all": return h.length;
2898
+ case "subscription": return E.subscription;
2899
+ case "mutation": return E.mutation;
2900
+ case "trace": return E.trace;
2901
+ case "log": return E.log;
2902
+ case "indexes": return g;
2903
+ case "webhooks": return _;
2904
+ case "workflows": return v;
2905
+ default: return null;
2906
+ }
2907
+ }, F = (e) => {
2908
+ switch (e) {
2909
+ case "all": return f.scopeAll;
2910
+ case "subscription": return p.subscriptions;
2911
+ case "mutation": return p.mutations;
2912
+ case "trace": return p.traces;
2913
+ case "log": return p.logs;
2914
+ case "workflows": return p.workflows;
2915
+ case "stores": return p.stores;
2916
+ case "indexes": return p.indexes;
2917
+ case "webhooks": return p.webhooks;
2918
+ case "routes": return p.routes;
2919
+ case "runtimes": return p.runtimes;
2920
+ }
2921
+ };
2922
+ return /* @__PURE__ */ k(D, { children: [
2923
+ /* @__PURE__ */ k("header", {
2924
+ className: "vdt-bar",
2925
+ onPointerDown: u,
2926
+ children: [
2927
+ e === "window" ? /* @__PURE__ */ O("span", {
2928
+ className: "vdt-win-handle",
2929
+ title: f.moveTitle,
2930
+ "aria-hidden": "true",
2931
+ children: /* @__PURE__ */ O(je, { className: "vdt:w-4 vdt:h-4" })
1816
2932
  }) : null,
1817
- e.kind === "subscription" ? /* @__PURE__ */ d("span", {
1818
- className: "vdt:text-foreground-muted vdt:text-xs vdt:ml-auto",
2933
+ /* @__PURE__ */ O(ue, { className: "vdt-bar-mark" }),
2934
+ w ? /* @__PURE__ */ k("label", {
2935
+ className: "vdt-search",
1819
2936
  children: [
1820
- e.deliveryCount ?? 0,
1821
- " ",
1822
- r.delivery(e.deliveryCount ?? 0),
1823
- e.lastDeliveryMs === void 0 ? null : /* @__PURE__ */ d(l, { children: [" · last ", /* @__PURE__ */ u("span", {
1824
- className: "vdt:text-foreground vdt:tabular-nums",
1825
- children: $(e.lastDeliveryMs)
1826
- })] })
2937
+ /* @__PURE__ */ O(xe, { className: "vdt:w-3.5 vdt:h-3.5" }),
2938
+ /* @__PURE__ */ O("input", {
2939
+ ref: c,
2940
+ type: "search",
2941
+ value: b,
2942
+ onChange: (e) => x(e.target.value),
2943
+ onKeyDown: (e) => {
2944
+ e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), C(nr(j.map((e) => e.id), S, e.key === "ArrowDown" ? 1 : -1))) : e.key === "Escape" ? b === "" ? i() : (e.preventDefault(), x("")) : e.key === "Enter" && N === null && j.length > 0 && C(j[0].id);
2945
+ },
2946
+ placeholder: f.searchPlaceholder,
2947
+ "aria-label": f.searchLabel,
2948
+ autoComplete: "off",
2949
+ spellCheck: !1
2950
+ }),
2951
+ /* @__PURE__ */ O("kbd", {
2952
+ className: "vdt-kbd",
2953
+ children: hr.search
2954
+ })
1827
2955
  ]
1828
- }) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("span", {
1829
- className: "vdt:text-foreground-muted vdt:text-xs vdt:ml-auto",
1830
- children: r.spans(e.spanCount)
1831
- }), /* @__PURE__ */ u("span", {
1832
- className: "vdt:text-foreground vdt:text-xs vdt:tabular-nums",
1833
- children: $(e.durationMs)
1834
- })] }),
1835
- /* @__PURE__ */ u("span", {
1836
- className: "vdt:text-foreground-subtle vdt:text-xs",
1837
- children: qt(e.startMs)
2956
+ }) : /* @__PURE__ */ k("span", {
2957
+ className: "vdt-bar-title",
2958
+ children: [/* @__PURE__ */ O("span", {
2959
+ className: "vdt-bar-brand",
2960
+ children: f.brandWord
2961
+ }), /* @__PURE__ */ O("span", {
2962
+ className: "vdt-bar-kicker",
2963
+ children: f.kicker
2964
+ })]
2965
+ }),
2966
+ /* @__PURE__ */ O("div", {
2967
+ role: "tablist",
2968
+ "aria-label": f.brand,
2969
+ className: "vdt-scopes",
2970
+ children: Jn.map((e, t) => {
2971
+ let n = mr[e], r = P(e), i = e === a;
2972
+ return /* @__PURE__ */ k("button", {
2973
+ type: "button",
2974
+ role: "tab",
2975
+ "aria-selected": i,
2976
+ "data-scope": e,
2977
+ className: `vdt-scope${i ? " vdt-scope-on" : ""}${t === 5 ? " vdt-scope-sep" : ""}`,
2978
+ onClick: () => {
2979
+ o(e), C(null), Yn(e) && requestAnimationFrame(() => {
2980
+ let e = c.current;
2981
+ e !== null && e.getRootNode().activeElement !== e && e.focus();
2982
+ });
2983
+ },
2984
+ children: [
2985
+ n ? /* @__PURE__ */ O(n, { className: "vdt:w-3.5 vdt:h-3.5" }) : null,
2986
+ /* @__PURE__ */ O("span", {
2987
+ className: "vdt-scope-label",
2988
+ children: F(e)
2989
+ }),
2990
+ r !== null && r > 0 ? /* @__PURE__ */ O("span", {
2991
+ className: `vdt-badge${i ? " vdt-badge-acc" : ""}${e === "trace" && A > 0 ? " vdt-badge-err" : ""}`,
2992
+ children: r
2993
+ }) : null
2994
+ ]
2995
+ }, e);
2996
+ })
2997
+ }),
2998
+ /* @__PURE__ */ O("span", { className: "vdt-sp" }),
2999
+ /* @__PURE__ */ O(yt, {
3000
+ dock: e,
3001
+ push: t,
3002
+ onDock: n,
3003
+ onPush: r
3004
+ }),
3005
+ /* @__PURE__ */ O("button", {
3006
+ type: "button",
3007
+ className: "vdt-iconbtn",
3008
+ title: f.closeTitle,
3009
+ "aria-label": f.closeTitle,
3010
+ onClick: i,
3011
+ children: /* @__PURE__ */ O(de, { className: "vdt:w-4 vdt:h-4" })
1838
3012
  })
1839
3013
  ]
1840
- }), t ? /* @__PURE__ */ d("div", {
1841
- className: "vdt:px-3 vdt:py-2 vdt:space-y-1 vdt:border-t vdt:border-border vdt:bg-background",
3014
+ }),
3015
+ w ? /* @__PURE__ */ k("div", {
3016
+ className: "vdt-body",
3017
+ "data-empty": j.length === 0 ? "true" : "false",
3018
+ children: [/* @__PURE__ */ O("div", {
3019
+ role: "listbox",
3020
+ "aria-label": f.results(j.length),
3021
+ tabIndex: 0,
3022
+ className: "vdt-results",
3023
+ onKeyDown: (e) => {
3024
+ e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), C(nr(j.map((e) => e.id), S, e.key === "ArrowDown" ? 1 : -1))) : e.key === "Escape" && i();
3025
+ },
3026
+ children: j.length === 0 ? /* @__PURE__ */ k("div", {
3027
+ className: "vdt-empty",
3028
+ children: [/* @__PURE__ */ O("div", {
3029
+ className: "vdt-empty-title",
3030
+ children: M.title
3031
+ }), /* @__PURE__ */ O("div", {
3032
+ className: "vdt-empty-hint",
3033
+ children: M.hint
3034
+ })]
3035
+ }) : j.map((e) => /* @__PURE__ */ O(vr, {
3036
+ item: e,
3037
+ selected: e.id === S,
3038
+ onSelect: () => C(e.id === S ? null : e.id)
3039
+ }, e.id))
3040
+ }), /* @__PURE__ */ O("aside", {
3041
+ className: "vdt-side",
3042
+ "aria-live": "polite",
3043
+ children: N === null ? /* @__PURE__ */ O("div", {
3044
+ className: "vdt-empty vdt-empty-side",
3045
+ children: /* @__PURE__ */ O("div", {
3046
+ className: "vdt-empty-hint",
3047
+ children: f.selectHint
3048
+ })
3049
+ }) : /* @__PURE__ */ O(yr, { item: N })
3050
+ })]
3051
+ }) : /* @__PURE__ */ k("div", {
3052
+ className: "vdt-body vdt-body-panel",
3053
+ children: [
3054
+ a === "workflows" ? /* @__PURE__ */ O(_n, {}) : null,
3055
+ a === "stores" ? /* @__PURE__ */ O(jn, {}) : null,
3056
+ a === "indexes" ? /* @__PURE__ */ O(Vt, {}) : null,
3057
+ a === "webhooks" ? /* @__PURE__ */ O($t, {}) : null,
3058
+ a === "routes" ? /* @__PURE__ */ O(wn, {}) : null,
3059
+ a === "runtimes" ? /* @__PURE__ */ O(En, {}) : null
3060
+ ]
3061
+ }),
3062
+ /* @__PURE__ */ k("footer", {
3063
+ className: "vdt-foot",
1842
3064
  children: [
1843
- /* @__PURE__ */ d("div", {
1844
- className: "vdt:text-foreground-subtle vdt:text-[10px] vdt:font-mono vdt:mb-1",
1845
- children: ["trace ", e.traceId]
3065
+ m.names.map((e) => /* @__PURE__ */ O(br, { name: e }, e)),
3066
+ y === "" ? null : /* @__PURE__ */ O("span", {
3067
+ className: "vdt-foot-route",
3068
+ children: /* @__PURE__ */ O("code", { children: y })
1846
3069
  }),
1847
- e.spans.map((e) => {
1848
- let t = i.get(e.spanId) ?? 0, n = Math.max(0, Math.min(100, (e.startMs - a) / o * 100)), r = Math.max(1.5, Math.min(100 - n, e.durationMs / o * 100)), s = e.status === "error";
1849
- return /* @__PURE__ */ d("div", {
1850
- className: "vdt:flex vdt:items-center vdt:gap-2 vdt:text-xs",
1851
- children: [
1852
- /* @__PURE__ */ d("div", {
1853
- className: "vdt:flex vdt:items-center vdt:gap-1 vdt:w-56 vdt:shrink-0",
1854
- style: { paddingLeft: t * 12 },
1855
- children: [/* @__PURE__ */ u("span", {
1856
- className: s ? "vdt:text-danger" : "vdt:text-foreground-muted",
1857
- children: s ? "✗" : "·"
1858
- }), /* @__PURE__ */ u("code", {
1859
- className: `vdt:font-mono vdt:truncate ${s ? "vdt:text-danger" : "vdt:text-foreground"}`,
1860
- children: e.name
1861
- })]
3070
+ /* @__PURE__ */ O("span", { className: "vdt-sp" }),
3071
+ /* @__PURE__ */ k("span", {
3072
+ className: "vdt-hints",
3073
+ children: [
3074
+ /* @__PURE__ */ k("span", { children: [
3075
+ /* @__PURE__ */ O("kbd", {
3076
+ className: "vdt-kbd",
3077
+ children: "↑↓"
1862
3078
  }),
1863
- /* @__PURE__ */ u("div", {
1864
- className: "vdt:relative vdt:flex-1 vdt:h-3 vdt:bg-background-elevated vdt:rounded-sm vdt:overflow-hidden",
1865
- children: /* @__PURE__ */ u("div", {
1866
- className: `vdt:absolute vdt:top-0 vdt:h-full vdt:rounded-sm ${s ? "vdt:bg-danger" : "vdt:bg-accent"}`,
1867
- style: {
1868
- left: `${n}%`,
1869
- width: `${r}%`
1870
- }
1871
- })
3079
+ " ",
3080
+ f.hintNavigate
3081
+ ] }),
3082
+ /* @__PURE__ */ k("span", { children: [
3083
+ /* @__PURE__ */ O("kbd", {
3084
+ className: "vdt-kbd",
3085
+ children: "↵"
1872
3086
  }),
1873
- /* @__PURE__ */ u("span", {
1874
- className: "vdt:text-foreground vdt:tabular-nums vdt:w-14 vdt:text-right vdt:shrink-0",
1875
- children: $(e.durationMs)
1876
- })
1877
- ]
1878
- }, e.spanId);
1879
- }),
1880
- e.spans.filter((e) => e.status === "error" && e.statusMessage).map((e) => /* @__PURE__ */ d("div", {
1881
- className: "vdt:text-danger vdt:text-xs vdt:font-mono vdt:pl-2 vdt:pt-1",
1882
- children: [
1883
- e.name,
1884
- ": ",
1885
- e.statusMessage
3087
+ " ",
3088
+ f.hintOpen
3089
+ ] }),
3090
+ /* @__PURE__ */ k("span", { children: [
3091
+ /* @__PURE__ */ O("kbd", {
3092
+ className: "vdt-kbd",
3093
+ children: hr.alt
3094
+ }),
3095
+ "+",
3096
+ /* @__PURE__ */ O("kbd", {
3097
+ className: "vdt-kbd",
3098
+ children: "V"
3099
+ }),
3100
+ " ",
3101
+ f.hintToggle
3102
+ ] }),
3103
+ /* @__PURE__ */ k("span", { children: [
3104
+ /* @__PURE__ */ O("kbd", {
3105
+ className: "vdt-kbd",
3106
+ children: hr.alt
3107
+ }),
3108
+ "+",
3109
+ /* @__PURE__ */ O("kbd", {
3110
+ className: "vdt-kbd",
3111
+ children: hr.shift
3112
+ }),
3113
+ "+",
3114
+ /* @__PURE__ */ O("kbd", {
3115
+ className: "vdt-kbd",
3116
+ children: "←↑↓→"
3117
+ }),
3118
+ " ",
3119
+ f.hintDock
3120
+ ] })
1886
3121
  ]
1887
- }, `${e.spanId}-msg`))
3122
+ })
1888
3123
  ]
1889
- }) : null]
1890
- });
1891
- }, Xt = ({ apiName: e, baseUrl: t }) => {
1892
- let n = Gt(t), r = B().traces;
1893
- return n.traces.length === 0 ? /* @__PURE__ */ u("div", {
1894
- className: "vdt:text-foreground-muted vdt:text-sm vdt:px-1",
1895
- children: r.noneCaptured(e)
1896
- }) : /* @__PURE__ */ d(T, { children: [/* @__PURE__ */ d("div", {
1897
- className: "vdt:flex vdt:items-center vdt:gap-2 vdt:mb-3",
3124
+ })
3125
+ ] });
3126
+ }, Cr = ({ error: e, onReset: t }) => {
3127
+ let n = R().shell;
3128
+ return /* @__PURE__ */ k("div", {
3129
+ role: "alert",
3130
+ className: "vdt-crash",
1898
3131
  children: [
1899
- /* @__PURE__ */ u(Se, { className: "vdt:w-4 vdt:h-4 vdt:text-accent" }),
1900
- /* @__PURE__ */ u(E, { children: e }),
1901
- /* @__PURE__ */ u(w, {
1902
- tone: "neutral",
1903
- children: n.traces.length
3132
+ /* @__PURE__ */ O("div", {
3133
+ className: "vdt-crash-title",
3134
+ children: n.crashTitle
3135
+ }),
3136
+ /* @__PURE__ */ k("pre", {
3137
+ className: "vdt-crash-message",
3138
+ children: [
3139
+ e.name,
3140
+ ": ",
3141
+ e.message
3142
+ ]
3143
+ }),
3144
+ /* @__PURE__ */ O("button", {
3145
+ type: "button",
3146
+ className: "vdt-crash-reset",
3147
+ onClick: t,
3148
+ children: n.crashReset
1904
3149
  })
1905
3150
  ]
1906
- }), /* @__PURE__ */ u("div", {
1907
- className: "vdt:space-y-2",
1908
- children: n.traces.map((e) => /* @__PURE__ */ u(Yt, { trace: e }, e.traceId))
1909
- })] });
1910
- }, Zt = () => {
1911
- let e = b(), t = B().traces, n = e.names, r = n.map((t) => ({
1912
- name: t,
1913
- handle: e.get(t)
1914
- })).filter((e) => e.handle !== null && e.handle.inspectBaseUrl !== "");
1915
- return n.length === 0 ? /* @__PURE__ */ u("div", {
1916
- className: "vdt:text-foreground-muted vdt:text-sm vdt:p-4",
1917
- children: t.noApi
1918
- }) : r.length === 0 ? /* @__PURE__ */ d("div", {
1919
- className: "vdt:text-foreground-muted vdt:text-sm vdt:p-4 vdt:space-y-2",
1920
- children: [/* @__PURE__ */ u("p", { children: t.proxiedTitle }), /* @__PURE__ */ u("p", { children: t.proxiedHint(/* @__PURE__ */ u("code", {
1921
- className: "vdt:text-foreground",
1922
- children: "voltro logs --trace <id>"
1923
- })) })]
1924
- }) : /* @__PURE__ */ u("div", {
1925
- className: "vdt:space-y-4",
1926
- children: r.map(({ name: e, handle: t }) => /* @__PURE__ */ u(Xt, {
1927
- apiName: e,
1928
- baseUrl: t.inspectBaseUrl
1929
- }, e))
1930
3151
  });
1931
- }, Qt = () => c(ae, re, re), $t = "voltro:devtools:open", en = (e) => {
3152
+ }, wr = class extends e {
3153
+ state = { error: null };
3154
+ static getDerivedStateFromError(e) {
3155
+ return { error: e };
3156
+ }
3157
+ componentDidCatch(e, t) {
3158
+ this.props.onError?.(e, t);
3159
+ }
3160
+ render() {
3161
+ return this.state.error === null ? this.props.children : /* @__PURE__ */ O(Cr, {
3162
+ error: this.state.error,
3163
+ onReset: () => this.setState({ error: null })
3164
+ });
3165
+ }
3166
+ }, Tr = /vdt/, Er = (e, t) => {
3167
+ for (let n of Array.from(e)) {
3168
+ if (n instanceof CSSStyleRule) {
3169
+ Tr.test(n.selectorText) && t.push(n.cssText);
3170
+ continue;
3171
+ }
3172
+ if (n instanceof CSSKeyframesRule) {
3173
+ n.name.startsWith("vdt-") && t.push(n.cssText);
3174
+ continue;
3175
+ }
3176
+ if (n instanceof CSSGroupingRule || n instanceof CSSLayerBlockRule) {
3177
+ let e = [];
3178
+ if (Er(n.cssRules, e), e.length === 0) continue;
3179
+ let r = n.cssText, i = r.slice(0, r.indexOf("{")).trim();
3180
+ t.push(`${i} {\n${e.join("\n")}\n}`);
3181
+ continue;
3182
+ }
3183
+ n.constructor.name === "CSSPropertyRule" && Tr.test(n.cssText) && t.push(n.cssText), n.constructor.name === "CSSLayerStatementRule" && t.push(n.cssText);
3184
+ }
3185
+ }, Dr = (e) => {
3186
+ let t = [];
3187
+ for (let n of Array.from(e.styleSheets)) {
3188
+ let e;
3189
+ try {
3190
+ e = n.cssRules;
3191
+ } catch {
3192
+ continue;
3193
+ }
3194
+ Er(e, t);
3195
+ }
3196
+ return t.join("\n");
3197
+ }, Or = (e, t) => {
3198
+ if (typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype && "adoptedStyleSheets" in e) {
3199
+ let n = new CSSStyleSheet();
3200
+ n.replaceSync(t), e.adoptedStyleSheets = [n];
3201
+ return;
3202
+ }
3203
+ let n = e.querySelector("style[data-vdt]");
3204
+ n === null && (n = e.ownerDocument.createElement("style"), n.setAttribute("data-vdt", ""), e.prepend(n)), n.textContent = t;
3205
+ }, kr = ({ children: e }) => {
3206
+ let t = c(null), [n, r] = l(null);
3207
+ return o(() => {
3208
+ let e = t.current;
3209
+ if (e === null) return;
3210
+ let n = e.shadowRoot ?? e.attachShadow({ mode: "open" }), i = n.querySelector("[data-vdt-mount]");
3211
+ i === null && (i = e.ownerDocument.createElement("div"), i.setAttribute("data-vdt-mount", ""), n.append(i));
3212
+ let a = e.ownerDocument, o = "", s = () => {
3213
+ let e = Dr(a);
3214
+ e !== o && (o = e, Or(n, e));
3215
+ };
3216
+ s();
3217
+ let c = typeof MutationObserver > "u" ? null : new MutationObserver(() => s());
3218
+ return c?.observe(a.head, {
3219
+ childList: !0,
3220
+ subtree: !0,
3221
+ characterData: !0
3222
+ }), r(i), () => c?.disconnect();
3223
+ }, []), /* @__PURE__ */ O("div", {
3224
+ ref: t,
3225
+ className: "vdt-root",
3226
+ "data-voltro-devtools": "",
3227
+ children: n === null ? null : A(e, n)
3228
+ });
3229
+ }, Ar = () => u(g, p, p), jr = "voltro:devtools:open", Mr = (e) => {
1932
3230
  if (typeof window > "u") return e;
1933
3231
  try {
1934
- let t = window.localStorage.getItem($t);
3232
+ let t = window.localStorage.getItem(jr);
1935
3233
  return t === null ? e : t === "1";
1936
3234
  } catch {
1937
3235
  return e;
1938
3236
  }
1939
- }, tn = (e) => {
3237
+ }, Nr = (e) => {
1940
3238
  if (!(typeof window > "u")) try {
1941
- window.localStorage.setItem($t, e ? "1" : "0");
3239
+ window.localStorage.setItem(jr, e ? "1" : "0");
1942
3240
  } catch {}
1943
- }, nn = ({ initialIsOpen: e = !1, initialAnchor: t = "bottomLeft", strings: n, inspectToken: r } = {}) => {
1944
- let i = _t(r);
1945
- return /* @__PURE__ */ u(gt, {
3241
+ }, Pr = ({ initialIsOpen: e = !1, initialDock: t = "bottom", strings: n, inspectToken: r } = {}) => {
3242
+ let i = Ct(r);
3243
+ return /* @__PURE__ */ O(xt, {
1946
3244
  token: i,
1947
- children: /* @__PURE__ */ u(z, {
3245
+ children: /* @__PURE__ */ O(Ie, {
1948
3246
  strings: n ?? {},
1949
- children: /* @__PURE__ */ u(rn, {
3247
+ children: /* @__PURE__ */ O(Hr, {
1950
3248
  initialIsOpen: e,
1951
- initialAnchor: t
3249
+ initialDock: t
1952
3250
  })
1953
3251
  })
1954
3252
  });
1955
- }, rn = ({ initialIsOpen: e, initialAnchor: t }) => {
1956
- let n = B().shell, [i, a] = ue(t), [o, c] = s(() => en(e)), [l, f] = s("subscriptions"), p = Fe(), m = qe(), ee = ut(), h = Mt(o), g = zt(o), te = Kt(o), _ = Qt(), v = _.length > 0 ? _[_.length - 1] : null, y = v !== null;
1957
- return r(() => {
1958
- tn(o);
1959
- }, [o]), r(() => {
3253
+ }, Fr = (e) => e === "bottom" ? "padding-bottom" : e === "top" ? "padding-top" : e === "left" ? "padding-left" : "padding-right", Ir = (e) => {
3254
+ switch (e.dock) {
3255
+ case "bottom":
3256
+ case "top": return { height: e.sizes[e.dock] };
3257
+ case "left":
3258
+ case "right": return { width: e.sizes[e.dock] };
3259
+ case "window": return {
3260
+ left: e.window.x,
3261
+ top: e.window.y,
3262
+ width: e.window.w,
3263
+ height: e.window.h
3264
+ };
3265
+ }
3266
+ }, Lr = (e, t, n, r) => {
3267
+ switch (e) {
3268
+ case "bottom": return t - r;
3269
+ case "top": return t + r;
3270
+ case "left": return t + n;
3271
+ case "right": return t - n;
3272
+ }
3273
+ }, Rr = (e) => {
3274
+ console.error("[voltro devtools] the overlay hit an error and was contained:", e);
3275
+ }, zr = (e) => {
3276
+ let t = document.body.style;
3277
+ e !== null && t.setProperty("cursor", e), t.setProperty("user-select", "none"), t.setProperty("-webkit-user-select", "none");
3278
+ }, Br = () => {
3279
+ let e = document.body.style;
3280
+ e.removeProperty("cursor"), e.removeProperty("user-select"), e.removeProperty("-webkit-user-select");
3281
+ }, Vr = (e) => e instanceof Element && e.closest("button, input, a, [role=\"menu\"], [role=\"tablist\"], label") !== null, Hr = ({ initialIsOpen: e, initialDock: t }) => {
3282
+ let r = R().shell, [a, o] = l(() => Mr(e)), [u, d] = gt(t), [f, p] = l("all"), m = c(null), [h, g] = l(0), _ = Ar(), v = _.length > 0 ? _[_.length - 1] : null;
3283
+ i(() => {
3284
+ Nr(a);
3285
+ }, [a]);
3286
+ let { dock: y, push: b } = u, { setDock: x, setEdgeSize: S, setWindowRect: C, setPush: w } = d, T = ht(), E = s(() => ut(u, T), [u, T]), D = c(null), A = c(!1);
3287
+ i(() => {
3288
+ if (a) {
3289
+ A.current = !0;
3290
+ return;
3291
+ }
3292
+ A.current && D.current?.focus();
3293
+ }, [a]), i(() => {
1960
3294
  if (typeof window > "u") return;
1961
- let e = (e) => {
1962
- e.altKey && (e.key === "v" || e.key === "V") && (e.preventDefault(), c((e) => !e));
3295
+ let e = (e, t, n) => e.code === t || e.key.toLowerCase() === n, t = (t) => {
3296
+ if (t.altKey && !t.shiftKey && !t.metaKey && !t.ctrlKey && e(t, "KeyV", "v")) {
3297
+ t.preventDefault(), o((e) => !e);
3298
+ return;
3299
+ }
3300
+ if ((t.metaKey || t.ctrlKey) && !t.altKey && e(t, "KeyK", "k")) {
3301
+ t.preventDefault(), o(!0), p((e) => e === "stores" || e === "indexes" || e === "webhooks" || e === "routes" || e === "runtimes" ? "all" : e), g((e) => e + 1);
3302
+ return;
3303
+ }
3304
+ if (t.altKey && t.shiftKey) {
3305
+ let e = _t(t.key);
3306
+ e !== null && (t.preventDefault(), o(!0), x(e));
3307
+ }
3308
+ };
3309
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
3310
+ }, [x]), i(() => {
3311
+ if (!a) return;
3312
+ let e = requestAnimationFrame(() => m.current?.focus());
3313
+ return () => cancelAnimationFrame(e);
3314
+ }, [a, h]), i(() => {
3315
+ if (typeof document > "u" || !a || !b || !tt(y)) return;
3316
+ let e = document.documentElement, t = Fr(y);
3317
+ return e.style.setProperty(t, `${E.sizes[y]}px`), () => {
3318
+ e.style.removeProperty(t);
3319
+ };
3320
+ }, [
3321
+ a,
3322
+ b,
3323
+ y,
3324
+ E.sizes
3325
+ ]);
3326
+ let j = n((e) => {
3327
+ if (!tt(y)) return;
3328
+ e.preventDefault();
3329
+ let t = y, n = {
3330
+ x: e.clientX,
3331
+ y: e.clientY,
3332
+ size: E.sizes[t]
3333
+ }, r = (e) => {
3334
+ S(t, lt(t, Lr(t, n.size, e.clientX - n.x, e.clientY - n.y)));
3335
+ }, i = () => {
3336
+ window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), window.removeEventListener("pointercancel", i), Br();
1963
3337
  };
1964
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1965
- }, []), /* @__PURE__ */ u("div", {
3338
+ window.addEventListener("pointermove", r), window.addEventListener("pointerup", i), window.addEventListener("pointercancel", i), zr(t === "left" || t === "right" ? "col-resize" : "row-resize");
3339
+ }, [
3340
+ y,
3341
+ E.sizes,
3342
+ S
3343
+ ]), M = n((e) => {
3344
+ if (y !== "window" || Vr(e.target)) return;
3345
+ e.preventDefault();
3346
+ let t = {
3347
+ x: e.clientX,
3348
+ y: e.clientY,
3349
+ rect: E.window
3350
+ }, n = (e) => {
3351
+ C(J({
3352
+ ...t.rect,
3353
+ x: t.rect.x + (e.clientX - t.x),
3354
+ y: t.rect.y + (e.clientY - t.y)
3355
+ }));
3356
+ }, r = () => {
3357
+ window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), Br();
3358
+ };
3359
+ window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), zr(null);
3360
+ }, [
3361
+ y,
3362
+ E.window,
3363
+ C
3364
+ ]), N = n((e) => {
3365
+ if (y !== "window") return;
3366
+ e.preventDefault();
3367
+ let t = {
3368
+ x: e.clientX,
3369
+ y: e.clientY,
3370
+ rect: E.window
3371
+ }, n = (e) => {
3372
+ C(J({
3373
+ ...t.rect,
3374
+ w: t.rect.w + (e.clientX - t.x),
3375
+ h: t.rect.h + (e.clientY - t.y)
3376
+ }));
3377
+ }, r = () => {
3378
+ window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), Br();
3379
+ };
3380
+ window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), zr("nwse-resize");
3381
+ }, [
3382
+ y,
3383
+ E.window,
3384
+ C
3385
+ ]), P = n(() => o(!1), []), F = n(() => o(!0), []);
3386
+ return /* @__PURE__ */ O(kr, { children: /* @__PURE__ */ O("div", {
1966
3387
  className: "vdt-host",
1967
- style: de(i),
1968
- children: /* @__PURE__ */ u("div", {
3388
+ "data-open": a ? "true" : "false",
3389
+ "data-dock": y,
3390
+ "data-push": b && a && y !== "window" ? "true" : "false",
3391
+ children: /* @__PURE__ */ O("div", {
1969
3392
  className: "vdt-scope",
1970
- children: /* @__PURE__ */ d("div", {
1971
- className: "vdt-surface vdt-pulse vdt-anim-pop",
1972
- "data-open": o ? "true" : "false",
1973
- "data-busy": y ? "true" : "false",
1974
- "data-kind": v?.kind ?? "idle",
1975
- role: o ? "dialog" : void 0,
1976
- "aria-label": o ? n.brand : void 0,
1977
- children: [/* @__PURE__ */ u(on, {
1978
- open: o,
1979
- busy: y,
1980
- label: v?.label ?? "",
1981
- kind: v?.kind ?? "idle",
1982
- onOpen: () => c(!0)
1983
- }), /* @__PURE__ */ u(sn, {
1984
- open: o,
1985
- anchor: i,
1986
- onAnchor: a,
1987
- onClose: () => c(!1),
1988
- tab: l,
1989
- onTab: f,
1990
- subsCount: p,
1991
- mutationsCount: m,
1992
- logsCount: ee,
1993
- indexesCount: h,
1994
- webhooksCount: g,
1995
- tracesCount: te
1996
- })]
1997
- })
1998
- })
1999
- });
2000
- }, an = (e) => e === "compiling" || e === "loading" || e === "reconnecting", on = ({ open: e, busy: t, label: n, kind: r, onOpen: i }) => {
2001
- let a = B().shell, o = an(r), s = o ? n.replace(/[…\.\s]+$/, "") : n;
2002
- return /* @__PURE__ */ d("button", {
2003
- type: "button",
2004
- className: "vdt-fab-layer",
2005
- onClick: i,
2006
- tabIndex: e ? -1 : 0,
2007
- "aria-hidden": e ? "true" : "false",
2008
- title: e ? void 0 : a.openTitle,
2009
- "aria-label": e ? void 0 : a.openLabel,
2010
- children: [t ? /* @__PURE__ */ u(Ce, { className: "vdt:w-5 vdt:h-5 vdt-spinner" }) : /* @__PURE__ */ u(A, { className: "vdt:w-6 vdt:h-6" }), /* @__PURE__ */ d("span", {
2011
- className: "vdt-fab-label",
2012
- children: [s, o ? /* @__PURE__ */ d("span", {
2013
- className: "vdt-dots",
2014
- "aria-hidden": "true",
3393
+ children: a ? /* @__PURE__ */ k("section", {
3394
+ className: "vdt-console",
3395
+ role: "dialog",
3396
+ "aria-label": r.brand,
3397
+ "data-dock": y,
3398
+ style: Ir(E),
2015
3399
  children: [
2016
- /* @__PURE__ */ u("span", {}),
2017
- /* @__PURE__ */ u("span", {}),
2018
- /* @__PURE__ */ u("span", {})
3400
+ tt(y) ? /* @__PURE__ */ O("div", {
3401
+ className: "vdt-grip",
3402
+ role: "separator",
3403
+ "aria-label": r.resizeLabel,
3404
+ "aria-orientation": y === "left" || y === "right" ? "vertical" : "horizontal",
3405
+ onPointerDown: j
3406
+ }) : null,
3407
+ /* @__PURE__ */ O(wr, {
3408
+ onError: Rr,
3409
+ children: /* @__PURE__ */ O(Sr, {
3410
+ dock: y,
3411
+ push: b,
3412
+ onDock: x,
3413
+ onPush: w,
3414
+ onClose: P,
3415
+ scope: f,
3416
+ onScope: p,
3417
+ searchRef: m,
3418
+ onHeaderPointerDown: y === "window" ? M : void 0
3419
+ })
3420
+ }),
3421
+ y === "window" ? /* @__PURE__ */ O("div", {
3422
+ className: "vdt-win-resize",
3423
+ role: "separator",
3424
+ "aria-label": r.resizeLabel,
3425
+ onPointerDown: N
3426
+ }) : null
2019
3427
  ]
2020
- }) : null]
2021
- })]
2022
- });
2023
- }, sn = ({ open: e, anchor: t, onAnchor: n, onClose: r, tab: i, onTab: a, subsCount: o, mutationsCount: s, logsCount: c, indexesCount: l, webhooksCount: f, tracesCount: p }) => {
2024
- let m = B().tabs;
2025
- return /* @__PURE__ */ d("div", {
2026
- className: "vdt-panel-layer",
2027
- "aria-hidden": e ? "false" : "true",
2028
- children: [
2029
- /* @__PURE__ */ u(cn, {
2030
- anchor: t,
2031
- onAnchor: n,
2032
- onClose: r
2033
- }),
2034
- /* @__PURE__ */ d(he, { children: [
2035
- /* @__PURE__ */ u(C, {
2036
- active: i === "subscriptions",
2037
- onClick: () => a("subscriptions"),
2038
- badge: o,
2039
- children: m.subscriptions
2040
- }),
2041
- /* @__PURE__ */ u(C, {
2042
- active: i === "mutations",
2043
- onClick: () => a("mutations"),
2044
- badge: s,
2045
- children: m.mutations
2046
- }),
2047
- /* @__PURE__ */ u(C, {
2048
- active: i === "stores",
2049
- onClick: () => a("stores"),
2050
- children: m.stores
2051
- }),
2052
- /* @__PURE__ */ u(C, {
2053
- active: i === "indexes",
2054
- onClick: () => a("indexes"),
2055
- badge: l,
2056
- children: m.indexes
2057
- }),
2058
- /* @__PURE__ */ u(C, {
2059
- active: i === "webhooks",
2060
- onClick: () => a("webhooks"),
2061
- badge: f,
2062
- children: m.webhooks
2063
- }),
2064
- /* @__PURE__ */ u(C, {
2065
- active: i === "traces",
2066
- onClick: () => a("traces"),
2067
- badge: p,
2068
- children: m.traces
2069
- }),
2070
- /* @__PURE__ */ u(C, {
2071
- active: i === "routes",
2072
- onClick: () => a("routes"),
2073
- children: m.routes
2074
- }),
2075
- /* @__PURE__ */ u(C, {
2076
- active: i === "runtimes",
2077
- onClick: () => a("runtimes"),
2078
- children: m.runtimes
2079
- }),
2080
- /* @__PURE__ */ u(C, {
2081
- active: i === "logs",
2082
- onClick: () => a("logs"),
2083
- badge: c,
2084
- children: m.logs
3428
+ }) : /* @__PURE__ */ O(wr, {
3429
+ onError: Rr,
3430
+ children: /* @__PURE__ */ O(Ze, {
3431
+ status: v,
3432
+ onOpen: F,
3433
+ buttonRef: D
2085
3434
  })
2086
- ] }),
2087
- /* @__PURE__ */ d("div", {
2088
- className: "vdt:flex-1 vdt:overflow-auto vdt:bg-background",
2089
- children: [
2090
- e && i === "subscriptions" ? /* @__PURE__ */ u(Pe, {}) : null,
2091
- e && i === "mutations" ? /* @__PURE__ */ u(Ke, {}) : null,
2092
- e && i === "indexes" ? /* @__PURE__ */ u(kt, {}) : null,
2093
- e && i === "webhooks" ? /* @__PURE__ */ u(Vt, {}) : null,
2094
- e && i === "traces" ? /* @__PURE__ */ u(Zt, {}) : null,
2095
- e && i === "routes" ? /* @__PURE__ */ u(ze, {}) : null,
2096
- e && i === "runtimes" ? /* @__PURE__ */ u(Ve, {}) : null,
2097
- e && i === "stores" ? /* @__PURE__ */ u(mt, {}) : null,
2098
- e && i === "logs" ? /* @__PURE__ */ u(lt, {}) : null
2099
- ]
2100
- })
2101
- ]
2102
- });
2103
- }, cn = ({ anchor: e, onAnchor: t, onClose: n }) => {
2104
- let r = B().shell;
2105
- return /* @__PURE__ */ d("div", {
2106
- className: "vdt:flex vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-2 vdt:border-b vdt:border-border vdt:bg-background-elevated",
2107
- children: [
2108
- /* @__PURE__ */ u(A, { className: "vdt:w-4 vdt:h-4 vdt:text-accent" }),
2109
- /* @__PURE__ */ d("div", {
2110
- className: "vdt:flex-1 vdt:flex vdt:items-center vdt:gap-1.5",
2111
- children: [/* @__PURE__ */ u("span", {
2112
- className: "vdt:text-xs vdt:font-semibold vdt:text-foreground",
2113
- children: r.brandWord
2114
- }), /* @__PURE__ */ u("span", {
2115
- className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted",
2116
- children: r.kicker
2117
- })]
2118
- }),
2119
- /* @__PURE__ */ u(Te, {
2120
- anchor: e,
2121
- onChange: t
2122
- }),
2123
- /* @__PURE__ */ u(me, {
2124
- onClick: n,
2125
- title: r.closeTitle,
2126
- children: /* @__PURE__ */ u(_e, { className: "vdt:w-4 vdt:h-4" })
2127
3435
  })
2128
- ]
2129
- });
3436
+ })
3437
+ }) });
2130
3438
  };
2131
3439
  //#endregion
2132
- export { z as DevtoolsStringsProvider, nn as VoltroDevtools, I as defaultDevtoolsStrings, B as useDevtoolsStrings };
3440
+ export { Ie as DevtoolsStringsProvider, Pr as VoltroDevtools, Ne as defaultDevtoolsStrings, R as useDevtoolsStrings };