@voltro/client 0.55.0 → 0.57.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,31 +1,31 @@
1
- import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, x as ee, y as te } from "./formData-DtlF8t8h.js";
2
- import { createContext as S, createElement as C, useCallback as w, useContext as T, useDebugValue as ne, useEffect as E, useMemo as D, useRef as O, useState as k, useSyncExternalStore as re } from "react";
3
- import { Cause as A, Context as ie, Duration as j, Effect as M, Exit as N, Fiber as P, Layer as F, ManagedRuntime as ae, Schedule as I, Schema as oe, Stream as L } from "effect";
4
- import * as se from "@effect/platform/Headers";
5
- import { RpcClient as R, RpcSerialization as ce } from "@effect/rpc";
6
- import { applyRowPatch as z, fieldIssuesOf as le, pluginTag as ue } from "@voltro/protocol";
7
- import * as de from "@effect/platform/Socket";
8
- import { jsx as fe } from "react/jsx-runtime";
9
- import { FormApi as pe } from "@tanstack/form-core";
10
- import { useStore as me } from "@tanstack/react-store";
11
- import { ArrayFormatter as he } from "effect/ParseResult";
1
+ import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, x as S, y as ee } from "./formData-He_L4ozH.js";
2
+ import { createContext as C, createElement as w, useCallback as T, useContext as te, useDebugValue as ne, useEffect as E, useMemo as D, useRef as O, useState as k, useSyncExternalStore as A } from "react";
3
+ import { Cause as j, Context as re, Duration as ie, Effect as M, Exit as N, Fiber as P, Layer as F, ManagedRuntime as I, Schedule as L, Schema as ae, Stream as R } from "effect";
4
+ import * as oe from "@effect/platform/Headers";
5
+ import { RpcClient as z, RpcSerialization as se } from "@effect/rpc";
6
+ import { applyRowPatch as ce, fieldIssuesOf as le, pluginTag as ue } from "@voltro/protocol";
7
+ import * as B from "@effect/platform/Socket";
8
+ import { jsx as de } from "react/jsx-runtime";
9
+ import { FormApi as fe } from "@tanstack/form-core";
10
+ import { useStore as pe } from "@tanstack/react-store";
11
+ import { ArrayFormatter as me } from "effect/ParseResult";
12
12
  //#region src/traceBus.ts
13
- var ge = /* @__PURE__ */ new Set(), _e = (e) => {
14
- for (let t of ge) try {
13
+ var V = /* @__PURE__ */ new Set(), he = (e) => {
14
+ for (let t of V) try {
15
15
  t(e);
16
16
  } catch {}
17
- }, ve = (e) => (ge.add(e), () => {
18
- ge.delete(e);
19
- }), B = (e) => {
17
+ }, ge = (e) => (V.add(e), () => {
18
+ V.delete(e);
19
+ }), H = (e) => {
20
20
  let t = (e) => e == null ? "null" : typeof e == "string" ? JSON.stringify(e) : typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? `[${e.map(t).join(",")}]` : typeof e == "object" ? `{${Object.keys(e).sort().map((n) => `${JSON.stringify(n)}:${t(e[n])}`).join(",")}}` : String(e);
21
21
  return t(e);
22
- }, ye = Object.freeze({
22
+ }, _e = Object.freeze({
23
23
  data: void 0,
24
24
  revision: -1,
25
25
  emittedAt: void 0,
26
26
  error: void 0,
27
27
  pendingPatches: 0
28
- }), be = 5e3, xe = (e, t, n) => {
28
+ }), ve = 5e3, ye = (e, t, n) => {
29
29
  if (e._tag === "error") return !1;
30
30
  if (e._tag === "delta") return !0;
31
31
  try {
@@ -33,21 +33,21 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
33
33
  } catch {
34
34
  return !1;
35
35
  }
36
- }, V = 0, Se = () => `patch_${++V}`, H = (e, t) => {
36
+ }, be = 0, xe = () => `patch_${++be}`, U = (e, t) => {
37
37
  let n = e;
38
38
  for (let e of t.split(".")) {
39
39
  if (typeof n != "object" || !n) return;
40
40
  n = n[e];
41
41
  }
42
42
  return n;
43
- }, U = (e, t, n) => {
43
+ }, Se = (e, t, n) => {
44
44
  let r = t.split("."), i = (e) => typeof e == "object" && e && !Array.isArray(e) ? { ...e } : {}, a = i(e), o = a;
45
45
  for (let e = 0; e < r.length - 1; e += 1) o[r[e]] = i(o[r[e]]), o = o[r[e]];
46
46
  return o[r[r.length - 1]] = n, a;
47
- }, W = (e, t) => {
47
+ }, Ce = (e, t) => {
48
48
  let n = e.by ?? "id", r = e.identify ? e.identify(t) : typeof t[n] == "string" ? t[n] : typeof t.id == "string" ? t.id : void 0, i = r === void 0 ? [] : Array.isArray(r) ? r : [r];
49
49
  return i.length === 0 ? null : new Set(i);
50
- }, Ce = (e, t, n) => {
50
+ }, we = (e, t, n) => {
51
51
  let r = e.path, i = e.by ?? "id";
52
52
  if (e.op === "insert") {
53
53
  let a = e.shapeItem ?? e.shape, o = a ? {
@@ -60,11 +60,11 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
60
60
  optimistic: !0
61
61
  }, s = e.order ?? "append";
62
62
  return (e) => {
63
- let t = Array.isArray(H(e, r)) ? H(e, r) : [];
64
- return U(e ?? {}, r, s === "append" ? [...t, o] : [o, ...t]);
63
+ let t = Array.isArray(U(e, r)) ? U(e, r) : [];
64
+ return Se(e ?? {}, r, s === "append" ? [...t, o] : [o, ...t]);
65
65
  };
66
66
  }
67
- let a = W(e, t);
67
+ let a = Ce(e, t);
68
68
  if (a === null) return null;
69
69
  if (e.op === "update") {
70
70
  let n = e.shapeItem ?? e.shape, o = n ? (e) => ({
@@ -78,24 +78,24 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
78
78
  optimistic: !0
79
79
  });
80
80
  return (e) => {
81
- let t = H(e, r);
81
+ let t = U(e, r);
82
82
  if (!Array.isArray(t)) {
83
83
  if (typeof t != "object" || !t) return e;
84
84
  let n = t;
85
- return a.has(n[i]) ? U(e, r, o(n)) : e;
85
+ return a.has(n[i]) ? Se(e, r, o(n)) : e;
86
86
  }
87
- return U(e, r, t.map((e) => a.has(e[i]) ? o(e) : e));
87
+ return Se(e, r, t.map((e) => a.has(e[i]) ? o(e) : e));
88
88
  };
89
89
  }
90
90
  return (e) => {
91
- let t = Array.isArray(H(e, r)) ? H(e, r) : [];
92
- return U(e, r, t.filter((e) => !a.has(e[i])));
91
+ let t = Array.isArray(U(e, r)) ? U(e, r) : [];
92
+ return Se(e, r, t.filter((e) => !a.has(e[i])));
93
93
  };
94
- }, we = (e, t, n) => {
94
+ }, Te = (e, t, n) => {
95
95
  if (e.op === "insert") return n;
96
96
  let r = t.id;
97
97
  return typeof r == "string" && r.length > 0 ? r : null;
98
- }, Te = (e, t, n, r) => {
98
+ }, Ee = (e, t, n, r) => {
99
99
  let { anchorColumn: i, targetColumn: a } = e, o = new Set(n.map((e) => String(e)));
100
100
  return (e) => {
101
101
  if (!Array.isArray(e)) return e;
@@ -126,8 +126,8 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
126
126
  }));
127
127
  return c ? n : e;
128
128
  };
129
- }, Ee = (e, t, n) => {
130
- if (e.path !== void 0) return Ce(e, t, n);
129
+ }, De = (e, t, n) => {
130
+ if (e.path !== void 0) return we(e, t, n);
131
131
  switch (e.op) {
132
132
  case "insert": {
133
133
  let r = e.shape ? {
@@ -145,7 +145,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
145
145
  };
146
146
  }
147
147
  case "update": {
148
- let n = W(e, t);
148
+ let n = Ce(e, t);
149
149
  if (n === null) return null;
150
150
  let r = e.shape, i = r ? (e) => ({
151
151
  ...r(t, e),
@@ -168,7 +168,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
168
168
  };
169
169
  }
170
170
  case "delete": {
171
- let n = W(e, t);
171
+ let n = Ce(e, t);
172
172
  return n === null ? null : (e) => {
173
173
  if (!Array.isArray(e)) {
174
174
  let t = e;
@@ -178,7 +178,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
178
178
  };
179
179
  }
180
180
  }
181
- }, De = 5e3, Oe = class {
181
+ }, Oe = 5e3, ke = class {
182
182
  entries = /* @__PURE__ */ new Map();
183
183
  inactiveTtlMs;
184
184
  onChangeHook;
@@ -186,20 +186,20 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
186
186
  mirror;
187
187
  mergeCell;
188
188
  constructor(e = {}) {
189
- this.inactiveTtlMs = e.inactiveTtlMs ?? De, this.onChangeHook = e.onChange, this.errorBus = e.errorBus, this.mirror = e.mirror, this.mergeCell = e.mergeCell;
189
+ this.inactiveTtlMs = e.inactiveTtlMs ?? Oe, this.onChangeHook = e.onChange, this.errorBus = e.errorBus, this.mirror = e.mirror, this.mergeCell = e.mergeCell;
190
190
  }
191
191
  subscribe(e, t, n, r, i = {}) {
192
- let a = B(e), o = typeof e[0] == "string" ? e[0] : void 0, s = this.entries.get(a);
192
+ let a = H(e), o = typeof e[0] == "string" ? e[0] : void 0, s = this.entries.get(a);
193
193
  return s && s.evictionTimer !== null && (clearTimeout(s.evictionTimer), s.evictionTimer = null), s ? (s.fiber === null && (s.fetch = t, s.runtime = n, this.startFiber(s, t, n)), s.source === void 0 && i.source !== void 0 && (s.source = i.source)) : s = this.create(a, o, t, n, i.source), s.subscribers.add(r), {
194
194
  getSnapshot: () => this.getSnapshot(a),
195
195
  unsubscribe: () => this.unsubscribe(a, r)
196
196
  };
197
197
  }
198
198
  update(e, t, n) {
199
- let r = B(e), i = typeof e[0] == "string" ? e[0] : void 0, a = this.entries.get(r);
199
+ let r = H(e), i = typeof e[0] == "string" ? e[0] : void 0, a = this.entries.get(r);
200
200
  a ||= this.createStub(r, i);
201
201
  let o = {
202
- id: Se(),
202
+ id: xe(),
203
203
  mutationId: n,
204
204
  reducer: t
205
205
  };
@@ -213,7 +213,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
213
213
  for (let i of this.entries.values()) {
214
214
  if (i.tag !== e) continue;
215
215
  let a = {
216
- id: `forTag-${++V}`,
216
+ id: `forTag-${++be}`,
217
217
  mutationId: n,
218
218
  reducer: t
219
219
  };
@@ -230,12 +230,12 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
230
230
  confirmByMutation(e) {
231
231
  let t = !1;
232
232
  for (let n of this.entries.values()) for (let r of n.state.patches) r.mutationId === e && r.confirmed !== !0 && (r.confirmed = !0, t = !0);
233
- t && setTimeout(() => this.resyncUnechoedMutation(e), be);
233
+ t && setTimeout(() => this.resyncUnechoedMutation(e), ve);
234
234
  }
235
235
  resyncUnechoedMutation(e) {
236
236
  for (let t of this.entries.values()) {
237
237
  if (!t.state.patches.some((t) => t.mutationId === e && t.confirmed === !0)) continue;
238
- let n = t.tag ?? t.key, r = `optimistic patch for ${n} got no superseding server event within ${be}ms — the write is confirmed, so the preview is KEPT. Check reactivity for this query's source table.`;
238
+ let n = t.tag ?? t.key, r = `optimistic patch for ${n} got no superseding server event within ${ve}ms — the write is confirmed, so the preview is KEPT. Check reactivity for this query's source table.`;
239
239
  this.errorBus?.emit({
240
240
  source: "subscription",
241
241
  tag: n,
@@ -248,7 +248,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
248
248
  }
249
249
  }
250
250
  autoApply(e, t, n) {
251
- let r = `optimistic-${n}-${++V}`;
251
+ let r = `optimistic-${n}-${++be}`;
252
252
  for (let i of e) {
253
253
  for (let e of this.entries.values()) {
254
254
  if (!(Array.isArray(e.source) ? e.source.includes(i.table) : e.source === i.table)) continue;
@@ -262,7 +262,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
262
262
  if (!n) continue;
263
263
  }
264
264
  if (e.computed && i.op === "insert" && i.path === void 0) continue;
265
- let a = Ee(i, t, r);
265
+ let a = De(i, t, r);
266
266
  if (a === null) continue;
267
267
  let o = {
268
268
  id: `${r}-${e.key}`,
@@ -275,10 +275,10 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
275
275
  if (e !== void 0) for (let [a, o] of Object.entries(e)) {
276
276
  let e = t[a];
277
277
  if (!Array.isArray(e)) continue;
278
- let s = we(i, t, r);
278
+ let s = Te(i, t, r);
279
279
  if (s !== null) for (let t of this.entries.values()) {
280
280
  if (!(Array.isArray(t.source) ? t.source.includes(o.junction) : t.source === o.junction) || t.computed) continue;
281
- let i = Te(o, s, e.map((e) => String(e)), `${r}-${a}`);
281
+ let i = Ee(o, s, e.map((e) => String(e)), `${r}-${a}`);
282
282
  t.state.patches.push({
283
283
  id: `${r}-${a}-${t.key}`,
284
284
  mutationId: n,
@@ -295,10 +295,10 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
295
295
  n.state.patches = n.state.patches.filter((e) => e.id !== t), n.state.patches.length !== r && this.invalidate(n);
296
296
  }
297
297
  peek(e) {
298
- return this.getSnapshot(B(e));
298
+ return this.getSnapshot(H(e));
299
299
  }
300
300
  getEntry(e) {
301
- return this.entries.get(B(e));
301
+ return this.entries.get(H(e));
302
302
  }
303
303
  size() {
304
304
  return this.entries.size;
@@ -399,28 +399,31 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
399
399
  };
400
400
  }
401
401
  startFiber(e, t, n) {
402
- let r = e.tag ?? e.key, i = t(), a = L.unwrapScoped(M.currentSpan.pipe(M.catchAll(() => M.succeed(void 0)), M.map((t) => (t && (e.traceId = t.traceId, _e({
402
+ let r = e.tag ?? e.key, i = t(), a = R.unwrapScoped(M.currentSpan.pipe(M.catchAll(() => M.succeed(void 0)), M.map((t) => (t && (e.traceId = t.traceId, he({
403
403
  traceId: t.traceId,
404
404
  spanId: t.spanId,
405
405
  source: "subscription",
406
406
  tag: r
407
- })), i)))).pipe(L.withSpan(`client.subscription.${r}`, { attributes: { "rpc.tag": r } })), o = e.state.baseRevision >= 0 ? e.state.baseRevision : void 0, s = a.pipe(L.runForEach((t) => M.sync(() => {
407
+ })), i)))).pipe(R.withSpan(`client.subscription.${r}`, { attributes: { "rpc.tag": r } })), o = e.state.baseRevision >= 0 ? e.state.baseRevision : void 0, s = a.pipe(R.runForEach((t) => M.sync(() => {
408
408
  let n = e.state.base;
409
- if (t._tag === "snapshot") e.state.base = t.data, e.state.baseRevision = t.revision, e.state.baseEmittedAt = void 0, e.state.baseError = void 0, t.computed === !0 && (e.computed = !0);
410
- else if (t._tag === "error") e.state.baseError = A.fail(t.error), typeof t.revision == "number" && (e.state.baseRevision = t.revision);
409
+ if (t._tag === "snapshot") e.state.base = t.data, e.state.baseRevision = t.revision, e.state.baseEmittedAt = void 0, e.state.baseError = void 0, this.errorBus?.emitSuccess({
410
+ source: "subscription",
411
+ tag: e.tag ?? e.key
412
+ }), t.computed === !0 && (e.computed = !0);
413
+ else if (t._tag === "error") e.state.baseError = j.fail(t.error), typeof t.revision == "number" && (e.state.baseRevision = t.revision);
411
414
  else {
412
415
  let n = e.state.base;
413
- Array.isArray(n) && (e.state.base = z(n, t.patch, this.mergeCell === void 0 ? {} : { mergeCell: this.mergeCell })), e.state.baseRevision = t.revision, e.state.baseEmittedAt = t.emittedAt, e.state.baseError = void 0;
416
+ Array.isArray(n) && (e.state.base = ce(n, t.patch, this.mergeCell === void 0 ? {} : { mergeCell: this.mergeCell })), e.state.baseRevision = t.revision, e.state.baseEmittedAt = t.emittedAt, e.state.baseError = void 0;
414
417
  }
415
- e.state.patches.some((e) => e.confirmed === !0) && xe(t, n, e.state.base) && (e.state.patches = e.state.patches.filter((e) => e.confirmed !== !0)), this.mirror !== void 0 && t._tag !== "error" && this.mirror.save(e.key, {
418
+ e.state.patches.some((e) => e.confirmed === !0) && ye(t, n, e.state.base) && (e.state.patches = e.state.patches.filter((e) => e.confirmed !== !0)), this.mirror !== void 0 && t._tag !== "error" && this.mirror.save(e.key, {
416
419
  tag: e.tag,
417
420
  data: e.state.base,
418
421
  revision: e.state.baseRevision
419
422
  }).catch(() => {}), this.invalidate(e);
420
423
  })));
421
- e.fiber = n.runFork(o === void 0 ? s : s.pipe(M.locallyWith(R.currentHeaders, (e) => se.set(e, "voltro-resume-from", String(o))))), e.fiber.addObserver((t) => {
424
+ e.fiber = n.runFork(o === void 0 ? s : s.pipe(M.locallyWith(z.currentHeaders, (e) => oe.set(e, "voltro-resume-from", String(o))))), e.fiber.addObserver((t) => {
422
425
  if (N.isFailure(t) && !N.isInterrupted(t) && (e.state.baseRevision === -1 && (e.state.baseError = t.cause, this.invalidate(e)), this.errorBus)) {
423
- let n = A.squash(t.cause);
426
+ let n = j.squash(t.cause);
424
427
  this.errorBus.emit({
425
428
  source: "subscription",
426
429
  tag: e.tag ?? e.key,
@@ -437,7 +440,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
437
440
  }
438
441
  getSnapshot(e) {
439
442
  let t = this.entries.get(e);
440
- if (!t) return ye;
443
+ if (!t) return _e;
441
444
  if (t.state.cachedSnapshot !== null) return t.state.cachedSnapshot;
442
445
  let n = t.state.base;
443
446
  if (n !== void 0 && t.state.patches.length > 0) for (let e of t.state.patches) n = e.reducer(n);
@@ -460,15 +463,16 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
460
463
  t && t.subscribers.size === 0 && (t.fiber && M.runFork(P.interrupt(t.fiber)), this.entries.delete(e.key));
461
464
  }, this.inactiveTtlMs);
462
465
  }
463
- }, ke = class extends Oe {
466
+ }, Ae = class extends ke {
464
467
  subscribe(e, t, n, r, i = {}) {
465
468
  return {
466
469
  getSnapshot: () => this.peek(e),
467
470
  unsubscribe: () => {}
468
471
  };
469
472
  }
470
- }, Ae = class {
473
+ }, je = class {
471
474
  #e = /* @__PURE__ */ new Set();
475
+ #t = /* @__PURE__ */ new Set();
472
476
  on(e) {
473
477
  return this.#e.add(e), () => {
474
478
  this.#e.delete(e);
@@ -479,55 +483,70 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
479
483
  t(e);
480
484
  } catch {}
481
485
  }
482
- }, je = S(null), Me = () => {
486
+ onSuccess(e) {
487
+ return this.#t.add(e), () => {
488
+ this.#t.delete(e);
489
+ };
490
+ }
491
+ emitSuccess(e) {
492
+ for (let t of this.#t) try {
493
+ t(e);
494
+ } catch {}
495
+ }
496
+ }, Me = C(null), Ne = () => {
483
497
  throw Error("Voltro: rpc / cache calls are not invokable on a not-yet-resolved api — either during SSR, or in the client boot window before the api client resolves");
484
- }, Ne = new Proxy(() => Me(), {
485
- get: (e, t) => Ne,
498
+ }, Pe = new Proxy(() => Ne(), {
499
+ get: (e, t) => Pe,
486
500
  has: () => !0,
487
- apply: () => Me()
488
- }), Pe = Symbol.for("@voltro/client/ssrDescriptors"), Fe = globalThis, Ie = Fe[Pe] ?? (Fe[Pe] = { byApi: /* @__PURE__ */ new Map() }), Le = (e, t) => {
489
- Ie.byApi.set(e, t);
490
- }, Re = (e) => Ie.byApi.get(e), ze = () => {
491
- Ie.byApi.clear();
492
- }, Be = {
501
+ apply: () => Ne()
502
+ }), Fe = Symbol.for("@voltro/client/ssrDescriptors"), Ie = globalThis, Le = Ie[Fe] ?? (Ie[Fe] = { byApi: /* @__PURE__ */ new Map() }), Re = (e, t) => {
503
+ Le.byApi.set(e, t);
504
+ }, ze = (e) => Le.byApi.get(e), Be = () => {
505
+ Le.byApi.clear();
506
+ }, Ve = {
493
507
  runtime: { runPromiseExit: () => Promise.resolve(N.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
494
- cache: new ke(),
495
- client: Ne,
508
+ cache: new Ae(),
509
+ client: Pe,
496
510
  descriptors: {},
497
511
  inspectBaseUrl: "",
498
- errorBus: new Ae()
499
- }, Ve = {
512
+ errorBus: new je()
513
+ }, He = {
500
514
  get: (e) => {
501
- let t = Re(e);
502
- return t === void 0 ? Be : {
503
- ...Be,
515
+ let t = ze(e);
516
+ return t === void 0 ? Ve : {
517
+ ...Ve,
504
518
  descriptors: t
505
519
  };
506
520
  },
507
521
  names: []
508
- }, He = !1, Ue = !1, G = null, We = () => {
509
- He = !1, Ue = !1, G !== null && (clearTimeout(G), G = null);
510
- }, Ge = () => {
511
- let e = T(je);
512
- return e ? (Ue || (Ue = !0, G !== null && (clearTimeout(G), G = null)), e) : (typeof window < "u" && !He && !Ue && G === null && process.env.NODE_ENV !== "production" && (G = setTimeout(() => {
513
- G = null, !(He || Ue) && (He = !0, console.warn("useFrameworkRuntimes: no <FrameworkRuntimesProvider> in the tree — returning a loading baseline (subscriptions read `undefined`, mutations are no-ops). If this is not an intentional lazy/conditional mount, mount your app via @voltro/web mount() or wrap the subtree in <VoltroRuntimeProvider>."));
514
- }, 0)), Ve);
515
- }, K = (e) => Ge().get(e), Ke = (e) => typeof e.runtime?.runFork != "function", qe = async (e) => {
522
+ }, Ue = !1, We = !1, W = null, Ge = () => {
523
+ Ue = !1, We = !1, W !== null && (clearTimeout(W), W = null);
524
+ }, Ke = () => {
525
+ let e = te(Me);
526
+ return e ? (We || (We = !0, W !== null && (clearTimeout(W), W = null)), e) : (typeof window < "u" && !Ue && !We && W === null && process.env.NODE_ENV !== "production" && (W = setTimeout(() => {
527
+ W = null, !(Ue || We) && (Ue = !0, console.warn("useFrameworkRuntimes: no <FrameworkRuntimesProvider> in the tree — returning a loading baseline (subscriptions read `undefined`, mutations are no-ops). If this is not an intentional lazy/conditional mount, mount your app via @voltro/web mount() or wrap the subtree in <VoltroRuntimeProvider>."));
528
+ }, 0)), He);
529
+ }, G = (e) => {
530
+ let t = Ke(), n = t.demand;
531
+ return E(() => {
532
+ n?.(e);
533
+ }, [n, e]), t.get(e);
534
+ }, qe = (e) => typeof e.runtime?.runFork != "function", Je = async (e) => {
516
535
  let { name: t, wsUrl: n, group: r, headers: i, webSocketConstructor: a } = e;
517
- class o extends ie.Tag(`@voltro/client/AppClient/${t}`)() {}
518
- let s = F.succeed(de.WebSocketConstructor, (e, t) => a(e, t)), c = R.layerProtocolSocket().pipe(F.provide(ce.layerJson), F.provide(de.layerWebSocket(n)), F.provide(s)), l = typeof i == "function" ? await i() : i, u = F.scoped(o, R.make(r)).pipe(F.provide(c)), d = l ? F.locallyScoped(R.currentHeaders, se.fromInput(l)) : F.empty, f = ae.make(F.merge(u, d));
536
+ class o extends re.Tag(`@voltro/client/AppClient/${t}`)() {}
537
+ let s = F.succeed(B.WebSocketConstructor, (e, t) => a(e, t)), c = z.layerProtocolSocket().pipe(F.provide(se.layerJson), F.provide(B.layerWebSocket(n)), F.provide(s)), l = typeof i == "function" ? await i() : i, u = F.scoped(o, z.make(r)).pipe(F.provide(c)), d = l ? F.locallyScoped(z.currentHeaders, oe.fromInput(l)) : F.empty, f = I.make(F.merge(u, d));
519
538
  try {
520
- let e = await f.runPromise(o), t = new Ae();
539
+ let e = await f.runPromise(o), t = new je();
521
540
  return {
522
541
  runtime: f,
523
542
  client: e,
524
- cache: new Oe({ errorBus: t }),
543
+ cache: new ke({ errorBus: t }),
525
544
  errorBus: t
526
545
  };
527
546
  } catch (e) {
528
547
  throw f.dispose(), e;
529
548
  }
530
- }, Je = (e) => Math.min(500 * 2 ** Math.min(e - 1, 4), 5e3), Ye = () => ({
549
+ }, Ye = (e) => Math.min(500 * 2 ** Math.min(e - 1, 4), 5e3), Xe = () => ({
531
550
  resolved: null,
532
551
  retryToken: 0,
533
552
  failureCount: 0,
@@ -536,15 +555,15 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
536
555
  everOpened: !1,
537
556
  wedgeStop: null,
538
557
  subjectMayHaveChanged: !1
539
- }), Xe = (e) => {
558
+ }), Ze = (e) => {
540
559
  e.wedgeStop !== null && (e.wedgeStop(), e.wedgeStop = null);
541
- }, Ze = (e) => {
542
- e.cache.destroy(e.runtime), e.runtime.dispose();
543
560
  }, Qe = (e) => {
544
- let t = e.apis, n = e.buildClient, r = e.onChange, i = e.retryDelayMs ?? Je, a = e.stableWindowMs ?? 5e3, o = e.scheduler?.setTimeout ?? ((e, t) => setTimeout(e, t)), s = e.scheduler?.clearTimeout ?? ((e) => {
561
+ e.cache.destroy(e.runtime), e.runtime.dispose();
562
+ }, $e = (e) => {
563
+ let t = e.apis, n = e.buildClient, r = e.onChange, i = e.retryDelayMs ?? Ye, a = e.stableWindowMs ?? 5e3, o = e.scheduler?.setTimeout ?? ((e, t) => setTimeout(e, t)), s = e.scheduler?.clearTimeout ?? ((e) => {
545
564
  clearTimeout(e);
546
565
  }), c = e.scheduler?.queueMicrotask ?? queueMicrotask, l = e.onReconnecting, u = e.wedgeBackstop, d = /* @__PURE__ */ new Map();
547
- for (let e of t) d.set(e.name, Ye());
566
+ for (let e of t) d.set(e.name, Xe());
548
567
  let f = !1, p = /* @__PURE__ */ new Set(), m = (e, t) => {
549
568
  let n = o(() => {
550
569
  p.delete(n), e();
@@ -570,7 +589,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
570
589
  if (!t) return;
571
590
  let r = t.generation, i = () => {
572
591
  if (f || t.generation !== r) return;
573
- t.everOpened = !0, Xe(t), t.retryToken++;
592
+ t.everOpened = !0, Ze(t), t.retryToken++;
574
593
  let e = t.failureCount;
575
594
  m(() => {
576
595
  f || t.failureCount === e && (t.failureCount = 0);
@@ -581,11 +600,11 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
581
600
  try {
582
601
  let a = await n(e, r, i, o);
583
602
  if (f || t.generation !== r) {
584
- Ze(a);
603
+ Qe(a);
585
604
  return;
586
605
  }
587
606
  let s = t.resolved;
588
- s && !t.subjectMayHaveChanged && a.cache.seedStaleFrom(s.cache), t.subjectMayHaveChanged = !1, t.resolved = a, t.reconnectStatusDispose &&= (t.reconnectStatusDispose(), null), h(), s && Ze(s);
607
+ s && !t.subjectMayHaveChanged && a.cache.seedStaleFrom(s.cache), t.subjectMayHaveChanged = !1, t.resolved = a, t.reconnectStatusDispose &&= (t.reconnectStatusDispose(), null), h(), s && Qe(s);
589
608
  } catch {
590
609
  if (f || t.generation !== r) return;
591
610
  g(e);
@@ -593,7 +612,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
593
612
  }, v = (e) => {
594
613
  if (!f) for (let n of t) {
595
614
  let t = d.get(n.name);
596
- t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, t.failureCount = 0, Xe(t), _(n));
615
+ t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, t.failureCount = 0, Ze(t), _(n));
597
616
  }
598
617
  };
599
618
  return t.length === 0 ? (r(/* @__PURE__ */ new Map(), !0), {
@@ -610,7 +629,7 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
610
629
  f = !0;
611
630
  for (let e of p) s(e);
612
631
  p.clear();
613
- for (let [, e] of d) e.resolved && Ze(e.resolved), e.reconnectStatusDispose && e.reconnectStatusDispose(), Xe(e);
632
+ for (let [, e] of d) e.resolved && Qe(e.resolved), e.reconnectStatusDispose && e.reconnectStatusDispose(), Ze(e);
614
633
  d.clear();
615
634
  }
616
635
  },
@@ -621,8 +640,8 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
621
640
  v(!1);
622
641
  }
623
642
  });
624
- }, $e = ({ apis: e, children: t }) => {
625
- let n = D(() => ({
643
+ }, et = ({ apis: e, children: t, demand: n }) => {
644
+ let r = D(() => ({
626
645
  get: (t) => {
627
646
  let n = e.get(t);
628
647
  if (!n) {
@@ -631,47 +650,48 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
631
650
  }
632
651
  return n;
633
652
  },
634
- names: Array.from(e.keys())
653
+ names: Array.from(e.keys()),
654
+ ...n === void 0 ? {} : { demand: n }
635
655
  }), [e]);
636
- return /* @__PURE__ */ fe(je.Provider, {
637
- value: n,
656
+ return /* @__PURE__ */ de(Me.Provider, {
657
+ value: r,
638
658
  children: t
639
659
  });
640
- }, et = Symbol.for("@voltro/client/storeStorageProvider"), tt = () => {
641
- let e = globalThis, t = e[et];
660
+ }, tt = Symbol.for("@voltro/client/storeStorageProvider"), nt = () => {
661
+ let e = globalThis, t = e[tt];
642
662
  if (t !== void 0) return t;
643
663
  let n = {
644
664
  provider: void 0,
645
665
  used: !1
646
666
  };
647
- return e[et] = n, n;
648
- }, nt = (e) => {
667
+ return e[tt] = n, n;
668
+ }, rt = (e) => {
649
669
  if (typeof window > "u") return null;
650
670
  try {
651
671
  return (e === "session" ? window.sessionStorage : window.localStorage) ?? null;
652
672
  } catch {
653
673
  return null;
654
674
  }
655
- }, rt = (e) => {
656
- let t = tt();
657
- t.used && e !== null && console.warn("[voltro] setStoreStorage() was called after a persisted store had already read. That store booted against the previous backing store and will not be re-read. Install storage before the first render — on React Native, after awaiting hydrate()."), t.provider = e ?? void 0;
658
675
  }, it = (e) => {
659
- let t = tt();
660
- return t.used = !0, (t.provider ?? nt)(e);
661
- }, at = () => {
662
- let e = tt();
676
+ let t = nt();
677
+ t.used && e !== null && console.warn("[voltro] setStoreStorage() was called after a persisted store had already read. That store booted against the previous backing store and will not be re-read. Install storage before the first render — on React Native, after awaiting hydrate()."), t.provider = e ?? void 0;
678
+ }, at = (e) => {
679
+ let t = nt();
680
+ return t.used = !0, (t.provider ?? rt)(e);
681
+ }, ot = () => {
682
+ let e = nt();
663
683
  e.provider = void 0, e.used = !1;
664
- }, ot = (e, t) => {
684
+ }, st = (e, t) => {
665
685
  if (Object.is(e, t)) return !0;
666
686
  if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
667
687
  let n = Object.keys(e), r = Object.keys(t);
668
688
  if (n.length !== r.length) return !1;
669
689
  for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
670
690
  return !0;
671
- }, st = 50, ct = /* @__PURE__ */ new Set(), lt = (e, t) => {
672
- ct.has(e) || (ct.add(e), console.warn(t));
673
- }, ut = "\0global", dt = null, ft = (e, t, n) => {
674
- let r = dt?.() ?? null;
691
+ }, ct = 50, lt = /* @__PURE__ */ new Set(), ut = (e, t) => {
692
+ lt.has(e) || (lt.add(e), console.warn(t));
693
+ }, dt = "\0global", ft = null, pt = (e, t, n) => {
694
+ let r = ft?.() ?? null;
675
695
  if (r === null) return n;
676
696
  let i = n;
677
697
  for (let n of r.seeds) n.store === e && n.key === t && (i = {
@@ -679,9 +699,9 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
679
699
  ...n.value
680
700
  });
681
701
  return i;
682
- }, pt = (e, t) => {
702
+ }, mt = (e, t) => {
683
703
  let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
684
- if (i >= st) throw i = 0, Error(`defineStore: notification depth exceeded ${st} — a subscriber writes a NEW value every time it is notified, so the store can never settle. Look for a listener calling set() with something derived from the current state without converging.`);
704
+ if (i >= ct) throw i = 0, Error(`defineStore: notification depth exceeded ${ct} — a subscriber writes a NEW value every time it is notified, so the store can never settle. Look for a listener calling set() with something derived from the current state without converging.`);
685
705
  i += 1;
686
706
  try {
687
707
  for (let e of [...r]) e();
@@ -702,20 +722,20 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
702
722
  if (typeof i?.then == "function") throw a === 1 && o !== void 0 && (n = o), --a, a === 0 && (o = void 0, s = void 0), Error(`defineStore: batch('${e}') was given an async function. A batch is synchronous — everything after the first await would land outside it. Await the work first, then batch the writes: \`const r = await load(); store.batch('${e}', () => { … })\`.`);
703
723
  if (--a, a > 0) return;
704
724
  let l = o, u = s;
705
- o = void 0, s = void 0, !ot(l, n) && (t(l, n, u), c());
725
+ o = void 0, s = void 0, !st(l, n) && (t(l, n, u), c());
706
726
  },
707
727
  set: (e, r) => {
708
728
  let i = typeof e == "function" ? e(n) : {
709
729
  ...n,
710
730
  ...e
711
731
  };
712
- if (ot(i, n)) return;
732
+ if (st(i, n)) return;
713
733
  let o = n;
714
734
  n = i, !(a > 0) && (t(o, i, r), c());
715
735
  },
716
736
  reset: () => {
717
737
  let r = e();
718
- if (ot(r, n)) return;
738
+ if (st(r, n)) return;
719
739
  let i = n;
720
740
  n = r, !(a > 0) && (t(i, r, "reset"), c());
721
741
  },
@@ -723,51 +743,51 @@ var ge = /* @__PURE__ */ new Set(), _e = (e) => {
723
743
  r.delete(e);
724
744
  })
725
745
  };
726
- }, mt = 200, ht = [], gt = /* @__PURE__ */ new Set(), _t = [], vt = () => _t, yt = (e) => (gt.add(e), () => {
727
- gt.delete(e);
728
- }), bt = () => {
729
- ht.length = 0, _t = [];
730
- }, xt = (e, t) => {
731
- let n = ht[e];
746
+ }, ht = 200, gt = [], _t = /* @__PURE__ */ new Set(), vt = [], yt = () => vt, bt = (e) => (_t.add(e), () => {
747
+ _t.delete(e);
748
+ }), xt = () => {
749
+ gt.length = 0, vt = [];
750
+ }, St = (e, t) => {
751
+ let n = gt[e];
732
752
  if (n === void 0) return !1;
733
- let r = Tt.get(n.store);
753
+ let r = Et.get(n.store);
734
754
  if (r === void 0) return !1;
735
755
  let i = t === "before" ? n.prev : n.next;
736
- Ct = !0;
756
+ wt = !0;
737
757
  try {
738
758
  r.set(() => i, n.key, `travel:${t}`);
739
759
  } finally {
740
- Ct = !1;
760
+ wt = !1;
741
761
  }
742
762
  return !0;
743
- }, St = !1, Ct = !1, wt = (e) => {
744
- ht.push(e), ht.length > mt && ht.shift(), _t = [...ht];
745
- for (let e of [...gt]) e();
746
- }, Tt = /* @__PURE__ */ new Map(), Et = /* @__PURE__ */ new Map(), Dt = 0, Ot = !1, kt = /* @__PURE__ */ new Map(), At = () => (Ot || (Ot = !0, queueMicrotask(() => {
747
- Dt += 1, Ot = !1;
748
- })), Dt), jt = Mt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
749
- function Mt(e) {
763
+ }, Ct = !1, wt = !1, Tt = (e) => {
764
+ gt.push(e), gt.length > ht && gt.shift(), vt = [...gt];
765
+ for (let e of [..._t]) e();
766
+ }, Et = /* @__PURE__ */ new Map(), Dt = /* @__PURE__ */ new Map(), Ot = 0, kt = !1, At = /* @__PURE__ */ new Map(), jt = () => (kt || (kt = !0, queueMicrotask(() => {
767
+ Ot += 1, kt = !1;
768
+ })), Ot), Mt = Nt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
769
+ function Nt(e) {
750
770
  let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
751
771
  return n.length > 0 ? n : void 0;
752
772
  }
753
- var Nt = () => {
773
+ var Pt = () => {
754
774
  let e = (/* @__PURE__ */ Error()).stack;
755
775
  if (typeof e != "string") return "<unknown>";
756
776
  for (let t of e.split("\n").slice(1)) {
757
- let e = Mt(t);
777
+ let e = Nt(t);
758
778
  if (e === void 0) continue;
759
779
  let n = e.replace(/:\d+:\d+$/, "");
760
- if (jt === "" || n !== jt.replace(/:\d+:\d+$/, "")) return n;
780
+ if (Mt === "" || n !== Mt.replace(/:\d+:\d+$/, "")) return n;
761
781
  }
762
782
  return "<unknown>";
763
- }, Pt = () => [...Tt.values()], Ft = (e, t, n) => {
764
- let r = Nt(), i = At(), a = Tt.get(e);
783
+ }, Ft = () => [...Et.values()], It = (e, t, n) => {
784
+ let r = Pt(), i = jt(), a = Et.get(e);
765
785
  if (a !== void 0) {
766
- let t = Et.get(e) ?? "<unknown>", n = kt.get(e) === i;
786
+ let t = Dt.get(e) ?? "<unknown>", n = At.get(e) === i;
767
787
  if (r !== "<unknown>" && r === t && !n) return a;
768
788
  throw Error(`defineStore: '${e}' is already defined. Store names are the devtools + seed key, so two stores sharing one name would silently share state. Rename one.\n first: ${t}\n second: ${r}`);
769
789
  }
770
- let o = n?.persist, s = () => it(o?.storage === "session" ? "session" : "local"), c = () => {
790
+ let o = n?.persist, s = () => at(o?.storage === "session" ? "session" : "local"), c = () => {
771
791
  let e = s();
772
792
  if (e === null || o === void 0) return;
773
793
  let t;
@@ -792,28 +812,28 @@ var Nt = () => {
792
812
  t.setItem(o.key, JSON.stringify(n));
793
813
  } catch {}
794
814
  }, u = /* @__PURE__ */ new Map(), d = (n) => {
795
- let r = n ?? ut, i = u.get(r);
815
+ let r = n ?? dt, i = u.get(r);
796
816
  if (i === void 0) {
797
817
  let a = n;
798
- i = pt(o !== void 0 && n === void 0 ? () => {
818
+ i = mt(o !== void 0 && n === void 0 ? () => {
799
819
  let e = t();
800
820
  return f = e, {
801
821
  ...e,
802
822
  ...c() ?? {}
803
823
  };
804
824
  } : t, (t, n, r) => {
805
- if (o !== void 0 && a === void 0 && l(n), !St && !Ct) {
825
+ if (o !== void 0 && a === void 0 && l(n), !Ct && !wt) {
806
826
  let e = m(a);
807
827
  e.steps.length = e.cursor, e.steps.push({
808
828
  prev: t,
809
829
  next: n
810
830
  }), e.steps.length > h && e.steps.shift(), e.cursor = e.steps.length;
811
831
  }
812
- wt({
832
+ Tt({
813
833
  store: e,
814
834
  ...a === void 0 ? {} : { key: a },
815
835
  ...r === void 0 ? {} : { label: r },
816
- ...St || Ct ? { isUndo: !0 } : {},
836
+ ...Ct || wt ? { isUndo: !0 } : {},
817
837
  prev: t,
818
838
  next: n,
819
839
  at: Date.now()
@@ -822,7 +842,7 @@ var Nt = () => {
822
842
  }
823
843
  return i;
824
844
  }, f, p = /* @__PURE__ */ new Map(), m = (e) => {
825
- let t = e ?? ut, n = p.get(t);
845
+ let t = e ?? dt, n = p.get(t);
826
846
  return n === void 0 && (n = {
827
847
  steps: [],
828
848
  cursor: 0
@@ -850,18 +870,24 @@ var Nt = () => {
850
870
  state: void 0,
851
871
  value: void 0,
852
872
  has: !1
853
- }), s = w((t) => {
873
+ }), s = T((t) => {
854
874
  let n = o.current;
855
875
  if (n.has && Object.is(n.state, t)) return n.value;
856
876
  let r = i.current(t), s = a.current, c = n.has && (s ? s(n.value, r) : Object.is(n.value, r));
857
- process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && ot(n.value, r) && lt(e, `[@voltro/client] ${e}.use(): the selector returns a NEW object each call, so the default identity check never sees it as unchanged and this component re-renders on EVERY store change.\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or select a primitive.`);
877
+ if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && st(n.value, r)) {
878
+ let t = !0;
879
+ try {
880
+ t = !Object.is(i.current(n.state), n.value);
881
+ } catch {}
882
+ ut(e, t ? `[@voltro/client] ${e}.use(): the selector returns a NEW object each call, so the default identity check never sees it as unchanged and this component re-renders on EVERY store change.\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or select a primitive.` : `[@voltro/client] ${e}.use(): this component re-renders on store changes that do not change what it selects. The selector is stable — it returns the same reference for the same state — and the STORE is writing a new value that is equal one level deep (a fresh \`[]\` or \`{}\`, say).\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or stop writing an equal value.`);
883
+ }
858
884
  let l = c ? n.value : r;
859
885
  return o.current = {
860
886
  state: t,
861
887
  value: l,
862
888
  has: !0
863
889
  }, l;
864
- }, []), c = n?.key, l = n?.retain === !0, u = w((e) => {
890
+ }, []), c = n?.key, l = n?.retain === !0, u = T((e) => {
865
891
  let t = r.subscribe(e);
866
892
  return c !== void 0 && !l && v(c), () => {
867
893
  t(), c !== void 0 && !l && y(c);
@@ -870,11 +896,11 @@ var Nt = () => {
870
896
  r,
871
897
  c,
872
898
  l
873
- ]), p = w(() => s(r.get()), [r, s]), m = w(() => s(ft(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
899
+ ]), p = T(() => s(r.get()), [r, s]), m = T(() => s(pt(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
874
900
  r,
875
901
  n?.key,
876
902
  s
877
- ]), h = re(u, p, m);
903
+ ]), h = A(u, p, m);
878
904
  return ne(h), h;
879
905
  },
880
906
  instance: d,
@@ -888,11 +914,11 @@ var Nt = () => {
888
914
  undo: (e) => {
889
915
  let t = m(e);
890
916
  if (t.cursor === 0) return !1;
891
- --t.cursor, St = !0;
917
+ --t.cursor, Ct = !0;
892
918
  try {
893
919
  d(e).set(() => t.steps[t.cursor].prev, "undo");
894
920
  } finally {
895
- St = !1;
921
+ Ct = !1;
896
922
  }
897
923
  return !0;
898
924
  },
@@ -900,11 +926,11 @@ var Nt = () => {
900
926
  let t = m(e);
901
927
  if (t.cursor >= t.steps.length) return !1;
902
928
  let n = t.steps[t.cursor];
903
- t.cursor += 1, St = !0;
929
+ t.cursor += 1, Ct = !0;
904
930
  try {
905
931
  d(e).set(() => n.next, "redo");
906
932
  } finally {
907
- St = !1;
933
+ Ct = !1;
908
934
  }
909
935
  return !0;
910
936
  },
@@ -916,27 +942,27 @@ var Nt = () => {
916
942
  release: (e) => {
917
943
  u.delete(e), p.delete(e);
918
944
  },
919
- keys: () => [...u.keys()].filter((e) => e !== ut)
945
+ keys: () => [...u.keys()].filter((e) => e !== dt)
920
946
  };
921
- return Tt.set(e, b), Et.set(e, r), kt.set(e, i), b;
922
- }, It = () => {
923
- Tt.clear(), Et.clear(), kt.clear(), ct.clear();
924
- }, Lt = () => ({ seeds: [] }), Rt = (e) => {
925
- dt = e;
926
- }, zt = (e, t, n) => {
927
- let r = dt?.() ?? null;
947
+ return Et.set(e, b), Dt.set(e, r), At.set(e, i), b;
948
+ }, Lt = () => {
949
+ Et.clear(), Dt.clear(), At.clear(), lt.clear();
950
+ }, Rt = () => ({ seeds: [] }), zt = (e) => {
951
+ ft = e;
952
+ }, Bt = (e, t, n) => {
953
+ let r = ft?.() ?? null;
928
954
  if (r === null) throw Error(`seedStore('${e.name}') was called outside a server render. Seeding exists to put a value into the SSR hydration payload; on the client, set the store directly instead. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
929
955
  r.seeds.push({
930
956
  store: e.name,
931
957
  ...n?.key === void 0 ? {} : { key: n.key },
932
958
  value: t
933
959
  });
934
- }, Bt = (e) => {
960
+ }, Vt = (e) => {
935
961
  if (e !== void 0) for (let t of e) {
936
- let e = Tt.get(t.store);
962
+ let e = Et.get(t.store);
937
963
  e !== void 0 && e.set(t.value, t.key);
938
964
  }
939
- }, q = (e, t) => {
965
+ }, K = (e, t) => {
940
966
  let n = t.split("."), r = e;
941
967
  for (let e = 0; e < n.length; e++) {
942
968
  let i = n[e];
@@ -955,15 +981,15 @@ var Nt = () => {
955
981
  }
956
982
  if (typeof r != "function") throw Error(`@voltro/client: rpc tag ${JSON.stringify(t)} did not resolve to a callable method.`);
957
983
  return r;
958
- }, Vt = Object.freeze({
984
+ }, Ht = Object.freeze({
959
985
  data: void 0,
960
986
  revision: -1,
961
987
  emittedAt: void 0,
962
988
  error: void 0,
963
989
  pendingPatches: 0
964
- }), Ht = () => Vt;
965
- function J(e, t, n = {}, r = {}) {
966
- let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = K(e), l = c[t]?.source, u = O(n);
990
+ }), Ut = () => Ht;
991
+ function q(e, t, n = {}, r = {}) {
992
+ let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = G(e), l = c[t]?.source, u = O(n);
967
993
  u.current = n;
968
994
  let d = O(s);
969
995
  d.current = s;
@@ -971,19 +997,19 @@ function J(e, t, n = {}, r = {}) {
971
997
  let e = u.current;
972
998
  return {
973
999
  queryKey: [t, e],
974
- fetch: () => q(d.current, t)(e)
1000
+ fetch: () => K(d.current, t)(e)
975
1001
  };
976
- }, [t, f]), m = p.queryKey, h = w((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
1002
+ }, [t, f]), m = p.queryKey, h = T((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
977
1003
  o,
978
1004
  a,
979
1005
  l,
980
1006
  i,
981
1007
  p
982
- ]), g = w(() => i ? Vt : o.peek(m), [
1008
+ ]), g = T(() => i ? Ht : o.peek(m), [
983
1009
  o,
984
1010
  i,
985
1011
  m
986
- ]), _ = re(h, g, Ht), v = _.data !== void 0, y = v && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), b = {
1012
+ ]), _ = A(h, g, Ut), v = _.data !== void 0, y = v && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), b = {
987
1013
  revision: _.revision,
988
1014
  emittedAt: _.emittedAt,
989
1015
  error: _.error,
@@ -1039,26 +1065,31 @@ function J(e, t, n = {}, r = {}) {
1039
1065
  };
1040
1066
  }
1041
1067
  //#endregion
1042
- //#region src/runRpc.ts
1043
- var Y = async (e, t) => {
1068
+ //#region src/awaitResolvedApi.ts
1069
+ var Wt = 15e3, J = async (e, t, n) => {
1070
+ if (!qe(e.current)) return e.current;
1071
+ let r = Date.now() + Wt;
1072
+ for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !qe(e.current)) return e.current;
1073
+ throw Error(`Voltro: the api "${t}" did not resolve within ${Wt}ms, so ${n} was never sent. This is not the boot window — that is waited out. Check that "${t}" is a configured api name and that its client could connect.`);
1074
+ }, Y = async (e, t) => {
1044
1075
  let n = await e.runPromiseExit(t);
1045
1076
  if (N.isSuccess(n)) return n.value;
1046
- throw A.squash(n.cause);
1047
- }, Ut = 100, X = [], Wt = /* @__PURE__ */ new Set(), Gt = [], Kt = () => {
1048
- Gt = X.slice();
1049
- }, qt = () => {
1050
- Kt();
1051
- for (let e of Wt) try {
1077
+ throw j.squash(n.cause);
1078
+ }, Gt = 100, X = [], Kt = /* @__PURE__ */ new Set(), qt = [], Jt = () => {
1079
+ qt = X.slice();
1080
+ }, Yt = () => {
1081
+ Jt();
1082
+ for (let e of Kt) try {
1052
1083
  e();
1053
1084
  } catch {}
1054
- }, Jt = (e) => {
1085
+ }, Xt = (e) => {
1055
1086
  let t = {
1056
1087
  ...e,
1057
1088
  status: "pending",
1058
1089
  startedAt: Date.now()
1059
1090
  };
1060
- X.unshift(t), X.length > Ut && (X.length = Ut), qt();
1061
- }, Yt = (e, t) => {
1091
+ X.unshift(t), X.length > Gt && (X.length = Gt), Yt();
1092
+ }, Zt = (e, t) => {
1062
1093
  let n = X.findIndex((t) => t.id === e);
1063
1094
  if (n === -1) return;
1064
1095
  let r = X[n], i = Date.now();
@@ -1074,12 +1105,12 @@ var Y = async (e, t) => {
1074
1105
  error: t.error,
1075
1106
  settledAt: i,
1076
1107
  durationMs: i - r.startedAt
1077
- }, qt();
1078
- }, Xt = () => Gt, Zt = (e) => (Wt.add(e), () => {
1079
- Wt.delete(e);
1080
- }), Qt = () => {
1081
- X.length !== 0 && (X.length = 0, qt());
1082
- }, $t = (e, t) => {
1108
+ }, Yt();
1109
+ }, Qt = () => qt, $t = (e) => (Kt.add(e), () => {
1110
+ Kt.delete(e);
1111
+ }), en = () => {
1112
+ X.length !== 0 && (X.length = 0, Yt());
1113
+ }, tn = (e, t) => {
1083
1114
  if (t === void 0 || typeof e != "object" || !e) return e;
1084
1115
  try {
1085
1116
  Object.defineProperty(e, "__voltroTraceId", {
@@ -1089,107 +1120,117 @@ var Y = async (e, t) => {
1089
1120
  });
1090
1121
  } catch {}
1091
1122
  return e;
1092
- }, en, tn = (e) => {
1093
- en = e;
1094
- }, nn = () => en, rn = (e, t, n) => typeof e == "function" ? e(t, n) : e, an = 0, on = () => `mut_${++an}`, sn = 0, cn = () => {
1123
+ }, nn, rn = (e) => {
1124
+ nn = e;
1125
+ }, an = () => nn, on = (e, t, n) => typeof e == "function" ? e(t, n) : e, sn = 0, cn = () => `mut_${++sn}`, ln = 0, un = () => {
1095
1126
  let e = typeof crypto < "u" ? crypto : void 0;
1096
- return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${sn += 1}`;
1097
- }, ln = (e, t) => e.pipe(M.locallyWith(R.currentHeaders, (e) => se.set(e, "idempotency-key", t))), un = (e, t) => ({
1127
+ return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${ln += 1}`;
1128
+ }, dn = (e, t) => e.pipe(M.locallyWith(z.currentHeaders, (e) => oe.set(e, "idempotency-key", t))), fn = (e, t) => ({
1098
1129
  update: (n, r) => {
1099
1130
  e.update(n, r, t);
1100
1131
  },
1101
1132
  forTag: (n, r) => e.forTag(n, r, t)
1102
1133
  }), Z = (e, t) => {
1103
- let { runtime: n, cache: r, client: i, descriptors: a, errorBus: o } = K(e), s = a[t], c = s?.targets;
1134
+ let n = G(e), { descriptors: r, errorBus: i } = n, a = O(n);
1135
+ a.current = n;
1136
+ let o = r[t], s = o?.targets;
1104
1137
  if (process.env.NODE_ENV !== "production") {
1105
- let n = s?.kind;
1138
+ let n = o?.kind;
1106
1139
  n !== void 0 && n !== "mutation" && console.error(`[@voltro/client] useMutation('${e}', '${t}') targets a ${n}, not a mutation. Use ${n === "action" ? "useAction" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
1107
1140
  }
1108
- let [l, u] = k(!1), [d, f] = k(void 0), [p, m] = k(void 0), h = O(null), g = O(!1), _ = w(async (a, s) => {
1109
- let l = s?.onError !== void 0 || s?.notify?.error !== void 0, d = (e) => {
1110
- s?.onError?.(e, a);
1111
- let t = rn(s?.notify?.error, e, a);
1112
- t !== void 0 && en?.error(t);
1141
+ let [c, l] = k(!1), [u, d] = k(void 0), [f, p] = k(void 0), m = O(null), h = O(!1), g = T(async (n, r) => {
1142
+ let o = r?.onError !== void 0 || r?.notify?.error !== void 0, c = (e) => {
1143
+ r?.onError?.(e, n);
1144
+ let t = on(r?.notify?.error, e, n);
1145
+ t !== void 0 && nn?.error(t);
1113
1146
  };
1114
- u(!0), f(void 0);
1115
- let p = on(), _ = s?.idempotencyKey ?? cn();
1116
- Jt({
1117
- id: p,
1147
+ l(!0), d(void 0);
1148
+ let u, f, g;
1149
+ try {
1150
+ ({runtime: u, cache: f, client: g} = await J(a, e, t));
1151
+ } catch (e) {
1152
+ if (l(!1), d(e), o) return c(e);
1153
+ throw e;
1154
+ }
1155
+ let _ = cn(), v = r?.idempotencyKey ?? un();
1156
+ Xt({
1157
+ id: _,
1118
1158
  apiName: e,
1119
1159
  tag: t,
1120
- input: a
1160
+ input: n
1121
1161
  });
1122
- let v = h.current, y = g.current;
1123
- if (v) try {
1124
- v(un(r, p), a);
1162
+ let y = m.current, b = h.current;
1163
+ if (y) try {
1164
+ y(fn(f, _), n);
1125
1165
  } catch (e) {
1126
- if (f(e), u(!1), r.revertByMutation(p), Yt(p, {
1166
+ if (d(e), l(!1), f.revertByMutation(_), Zt(_, {
1127
1167
  status: "error",
1128
1168
  error: e
1129
- }), l) return d(e);
1169
+ }), o) return c(e);
1130
1170
  throw e;
1131
1171
  }
1132
- else !y && c && c.length > 0 && r.autoApply(c, a, p);
1133
- let b;
1172
+ else !b && s && s.length > 0 && f.autoApply(s, n, _);
1173
+ let x;
1134
1174
  try {
1135
- let o = q(i, t), c = M.currentSpan.pipe(M.tap((e) => M.sync(() => {
1136
- b = e.traceId, _e({
1175
+ let a = K(g, t), o = M.currentSpan.pipe(M.tap((e) => M.sync(() => {
1176
+ x = e.traceId, he({
1137
1177
  traceId: e.traceId,
1138
1178
  spanId: e.spanId,
1139
1179
  source: "mutation",
1140
1180
  tag: t
1141
1181
  });
1142
- })), M.catchAll(() => M.void), M.zipRight(ln(o(a), _))).pipe(M.withSpan(`client.mutation.${t}`, { attributes: {
1182
+ })), M.catchAll(() => M.void), M.zipRight(dn(a(n), v))).pipe(M.withSpan(`client.mutation.${t}`, { attributes: {
1143
1183
  "voltro.api": e,
1144
- "voltro.mutationId": p,
1184
+ "voltro.mutationId": _,
1145
1185
  "rpc.tag": t
1146
- } })), l = await Y(n, c);
1147
- m(l), Yt(p, {
1186
+ } })), s = await Y(u, o);
1187
+ p(s), Zt(_, {
1148
1188
  status: "success",
1149
- output: l
1150
- }), r.confirmByMutation(p), s?.onSuccess?.(l, a);
1151
- let u = rn(s?.notify?.success, l, a);
1152
- return u !== void 0 && en?.success(u), l;
1189
+ output: s
1190
+ }), i.emitSuccess({
1191
+ source: "mutation",
1192
+ tag: t
1193
+ }), f.confirmByMutation(_), r?.onSuccess?.(s, n);
1194
+ let c = on(r?.notify?.success, s, n);
1195
+ return c !== void 0 && nn?.success(c), s;
1153
1196
  } catch (e) {
1154
- let n = $t(e, b);
1155
- if (f(n), Yt(p, {
1197
+ let n = tn(e, x);
1198
+ if (d(n), Zt(_, {
1156
1199
  status: "error",
1157
1200
  error: n
1158
- }), r.revertByMutation(p), o.emit({
1201
+ }), f.revertByMutation(_), i.emit({
1159
1202
  source: "mutation",
1160
1203
  tag: t,
1161
1204
  error: n,
1162
- ...b === void 0 ? {} : { traceId: b }
1163
- }), l) return d(n);
1205
+ ...x === void 0 ? {} : { traceId: x }
1206
+ }), o) return c(n);
1164
1207
  throw n;
1165
1208
  } finally {
1166
- u(!1);
1209
+ l(!1);
1167
1210
  }
1168
1211
  }, [
1169
- n,
1170
- r,
1171
- i,
1172
1212
  e,
1173
1213
  t,
1174
- c
1214
+ s,
1215
+ i
1175
1216
  ]);
1176
1217
  return D(() => {
1177
1218
  let e = {
1178
- mutate: _,
1179
- pending: l,
1180
- error: d,
1181
- data: p,
1182
- withOptimistic: (t) => (h.current = t, e),
1183
- withoutOptimistic: () => (g.current = !0, e)
1219
+ mutate: g,
1220
+ pending: c,
1221
+ error: u,
1222
+ data: f,
1223
+ withOptimistic: (t) => (m.current = t, e),
1224
+ withoutOptimistic: () => (h.current = !0, e)
1184
1225
  };
1185
1226
  return e;
1186
1227
  }, [
1187
- _,
1188
- l,
1189
- d,
1190
- p
1228
+ g,
1229
+ c,
1230
+ u,
1231
+ f
1191
1232
  ]);
1192
- }, dn = (e, t) => {
1233
+ }, pn = (e, t) => {
1193
1234
  if (t === void 0 || typeof e != "object" || !e) return e;
1194
1235
  try {
1195
1236
  Object.defineProperty(e, "__voltroTraceId", {
@@ -1199,22 +1240,17 @@ var Y = async (e, t) => {
1199
1240
  });
1200
1241
  } catch {}
1201
1242
  return e;
1202
- }, fn = (e, t, n) => typeof e == "function" ? e(t, n) : e, pn = 0, mn = () => `act_${++pn}`, hn = 15e3, gn = async (e, t, n) => {
1203
- if (!Ke(e.current)) return e.current;
1204
- let r = Date.now() + hn;
1205
- for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !Ke(e.current)) return e.current;
1206
- throw Error(`Voltro: the api "${t}" did not resolve within ${hn}ms, so ${n} was never sent. This is not the boot window — that is waited out. Check that "${t}" is a configured api name and that its client could connect.`);
1207
- }, _n = (e, t) => {
1208
- let n = K(e), { descriptors: r, errorBus: i } = n, a = O(n);
1243
+ }, mn = (e, t, n) => typeof e == "function" ? e(t, n) : e, hn = 0, gn = () => `act_${++hn}`, _n = (e, t) => {
1244
+ let n = G(e), { descriptors: r, errorBus: i } = n, a = O(n);
1209
1245
  if (a.current = n, process.env.NODE_ENV !== "production") {
1210
1246
  let n = r[t]?.kind;
1211
1247
  n !== void 0 && n !== "action" && console.error(`[@voltro/client] useAction('${e}', '${t}') targets a ${n}, not an action. Use ${n === "mutation" ? "useMutation" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
1212
1248
  }
1213
- let [o, s] = k(!1), [c, l] = k(void 0), [u, d] = k(void 0), f = w(async (n, r) => {
1249
+ let [o, s] = k(!1), [c, l] = k(void 0), [u, d] = k(void 0), f = T(async (n, r) => {
1214
1250
  let o = r?.onError !== void 0 || r?.notify?.error !== void 0;
1215
1251
  s(!0), l(void 0);
1216
- let c = mn(), u = r?.idempotencyKey ?? cn();
1217
- Jt({
1252
+ let c = gn(), u = r?.idempotencyKey ?? un();
1253
+ Xt({
1218
1254
  id: c,
1219
1255
  apiName: e,
1220
1256
  tag: t,
@@ -1222,27 +1258,30 @@ var Y = async (e, t) => {
1222
1258
  });
1223
1259
  let f;
1224
1260
  try {
1225
- let { runtime: i, client: o } = await gn(a, e, t), s = q(o, t), l = await Y(i, M.currentSpan.pipe(M.tap((e) => M.sync(() => {
1226
- f = e.traceId, _e({
1261
+ let { runtime: o, client: s } = await J(a, e, t), l = K(s, t), p = await Y(o, M.currentSpan.pipe(M.tap((e) => M.sync(() => {
1262
+ f = e.traceId, he({
1227
1263
  traceId: e.traceId,
1228
1264
  spanId: e.spanId,
1229
1265
  source: "action",
1230
1266
  tag: t
1231
1267
  });
1232
- })), M.catchAll(() => M.void), M.zipRight(ln(s(n), u))).pipe(M.withSpan(`client.action.${t}`, { attributes: {
1268
+ })), M.catchAll(() => M.void), M.zipRight(dn(l(n), u))).pipe(M.withSpan(`client.action.${t}`, { attributes: {
1233
1269
  "voltro.api": e,
1234
1270
  "voltro.actionId": c,
1235
1271
  "rpc.tag": t
1236
1272
  } })));
1237
- d(l), Yt(c, {
1273
+ d(p), Zt(c, {
1238
1274
  status: "success",
1239
- output: l
1240
- }), r?.onSuccess?.(l, n);
1241
- let p = fn(r?.notify?.success, l, n);
1242
- return p !== void 0 && nn()?.success(p), l;
1275
+ output: p
1276
+ }), i.emitSuccess({
1277
+ source: "action",
1278
+ tag: t
1279
+ }), r?.onSuccess?.(p, n);
1280
+ let m = mn(r?.notify?.success, p, n);
1281
+ return m !== void 0 && an()?.success(m), p;
1243
1282
  } catch (e) {
1244
- let a = dn(e, f);
1245
- if (l(a), Yt(c, {
1283
+ let a = pn(e, f);
1284
+ if (l(a), Zt(c, {
1246
1285
  status: "error",
1247
1286
  error: a
1248
1287
  }), i.emit({
@@ -1252,8 +1291,8 @@ var Y = async (e, t) => {
1252
1291
  ...f === void 0 ? {} : { traceId: f }
1253
1292
  }), o) {
1254
1293
  r?.onError?.(a, n);
1255
- let e = fn(r?.notify?.error, a, n);
1256
- e !== void 0 && nn()?.error(e);
1294
+ let e = mn(r?.notify?.error, a, n);
1295
+ e !== void 0 && an()?.error(e);
1257
1296
  return;
1258
1297
  }
1259
1298
  throw a;
@@ -1276,7 +1315,7 @@ var Y = async (e, t) => {
1276
1315
  c,
1277
1316
  u
1278
1317
  ]);
1279
- }, vn = S(void 0), yn = (e) => C(vn.Provider, { value: e.messages }, e.children), bn = () => T(vn), xn = Symbol.for("voltro.client.formEngine"), Sn = S(void 0), Cn = (e, t) => {
1318
+ }, vn = C(void 0), yn = (e) => w(vn.Provider, { value: e.messages }, e.children), bn = () => te(vn), xn = Symbol.for("voltro.client.formEngine"), Sn = C(void 0), Cn = (e, t) => {
1280
1319
  let n = e;
1281
1320
  for (let e of t.split(".")) {
1282
1321
  if (typeof n != "object" || !n) return;
@@ -1298,31 +1337,31 @@ var Y = async (e, t) => {
1298
1337
  let r = /^(.+?)\.\d+\.(.+)$/.exec(t);
1299
1338
  if (r !== null) return e.find((e) => e.name === r[1] && e.widget === "array")?.item?.find((e) => e.name === r[2]);
1300
1339
  }, Dn = (e, t, n) => {
1301
- let r = K(e), a = Z(e, t), o = n.schema ?? r.descriptors[t]?.input;
1302
- process.env.NODE_ENV !== "production" && o === void 0 && console.error(`[@voltro/client] useFormBinding('${e}', '${t}'): no input schema. Pass options.schema, or mount the descriptor so its input reaches the client. Rendering no fields; submit skips client-side validation.`);
1303
- let s = D(() => o ? x(o) : [], [o]), c = bn(), l = n.messages ?? c, u = D(() => ({
1340
+ let r = G(e), a = O(void 0), o = typeof t == "function" ? t(a.current?.state?.values ?? n.defaults ?? {}) : t, s = O(o).current, c = Z(e, o), l = n.schema ?? r.descriptors[o]?.input;
1341
+ process.env.NODE_ENV !== "production" && l === void 0 && console.error(`[@voltro/client] useFormBinding('${e}', '${t}'): no input schema. Pass options.schema, or mount the descriptor so its input reaches the client. Rendering no fields; submit skips client-side validation.`);
1342
+ let u = D(() => l ? x(l) : [], [l]), d = bn(), f = n.messages ?? d, p = D(() => ({
1304
1343
  ...n.locale === void 0 ? {} : { locale: n.locale },
1305
- ...l === void 0 ? {} : { messages: l }
1306
- }), [n.locale, l]), d = O(n.asyncFields);
1307
- d.current = n.asyncFields;
1308
- let f = O(n);
1309
- f.current = n;
1310
- let p = O(a);
1311
- p.current = a;
1312
- let m = O(u);
1313
- m.current = u;
1314
- let h = O(o);
1315
- h.current = o;
1316
- let [g, _] = k(() => n.flash?.errors ?? {}), [v, y] = k(n.flash?.formError), [ee, S] = k(void 0), C = O(void 0), T = w((e) => {
1317
- let t = h.current;
1344
+ ...f === void 0 ? {} : { messages: f }
1345
+ }), [n.locale, f]), m = O(n.asyncFields);
1346
+ m.current = n.asyncFields;
1347
+ let h = O(n);
1348
+ h.current = n;
1349
+ let g = O(c);
1350
+ g.current = c;
1351
+ let _ = O(p);
1352
+ _.current = p;
1353
+ let v = O(l);
1354
+ v.current = l;
1355
+ let [y, S] = k(() => n.flash?.errors ?? {}), [C, w] = k(n.flash?.formError), [te, ne] = k(void 0), A = O(void 0), j = T((e) => {
1356
+ let t = v.current;
1318
1357
  if (t === void 0) return [];
1319
- let n = f.current, r = e;
1358
+ let n = h.current, r = e;
1320
1359
  if (n.toInput !== void 0) try {
1321
1360
  r = n.toInput(e);
1322
1361
  } catch {
1323
1362
  r = e;
1324
1363
  }
1325
- let a = i(t, r, m.current).issues;
1364
+ let a = i(t, r, _.current).issues;
1326
1365
  if (n.toInput === void 0) return a;
1327
1366
  let o = n.errorPath ?? {};
1328
1367
  return a.map((t) => {
@@ -1332,146 +1371,146 @@ var Y = async (e, t) => {
1332
1371
  path: n
1333
1372
  };
1334
1373
  });
1335
- }, []), ne = w((e) => {
1336
- let t = { ...e ?? {} }, n = h.current;
1374
+ }, []), re = T((e) => {
1375
+ let t = { ...e ?? {} }, n = v.current;
1337
1376
  if (n !== void 0) for (let e of x(n)) (e.widget === "checkbox" || e.widget === "switch") && !(e.name in t) && (t[e.name] = !1);
1338
1377
  return t;
1339
- }, []), re = O(() => Promise.resolve()), A = O(void 0);
1340
- if (A.current === void 0) {
1341
- let e = n.flash, t = e === void 0 ? ne(n.defaults) : {
1342
- ...ne(n.defaults),
1378
+ }, []), ie = O(() => Promise.resolve());
1379
+ if (a.current === void 0) {
1380
+ let e = n.flash, t = e === void 0 ? re(n.defaults) : {
1381
+ ...re(n.defaults),
1343
1382
  ...e.values
1344
1383
  };
1345
- A.current = new pe({
1346
- onSubmit: ({ value: e }) => re.current(e),
1384
+ a.current = new fe({
1385
+ onSubmit: ({ value: e }) => ie.current(e),
1347
1386
  defaultValues: t,
1348
1387
  validators: { onChange: ({ value: e }) => {
1349
- let t = T(e);
1388
+ let t = j(e);
1350
1389
  if (t.length === 0) return;
1351
1390
  let n = {};
1352
- for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = b(e, m.current));
1391
+ for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = b(e, _.current));
1353
1392
  return { fields: n };
1354
1393
  } }
1355
1394
  });
1356
1395
  }
1357
- let ie = A.current, j = ie;
1358
- E(() => j.mount(), [j]);
1359
- let M = n.subscribe ?? "all";
1360
- me(ie.store, (e) => M === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
1361
- let N = ie.store.state.values, P = ie.store.state, F = D(() => T(N), [T, N]), ae = n.isLoading === !0, I = n.validate, oe = I?.onChange ?? "afterTouched", L = I?.onBlur ?? !0, se = P.submissionAttempts, R = P.fieldMetaBase ?? {}, ce = w((e) => {
1396
+ let M = a.current, N = M;
1397
+ E(() => N.mount(), [N]);
1398
+ let P = n.subscribe ?? "all";
1399
+ pe(M.store, (e) => P === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
1400
+ let F = M.store.state.values, I = M.store.state, L = D(() => j(F), [j, F]), ae = n.isLoading === !0, R = n.validate, oe = R?.onChange ?? "afterTouched", z = R?.onBlur ?? !0, se = I.submissionAttempts, ce = I.fieldMetaBase ?? {}, ue = T((e) => {
1362
1401
  if (ae) return !1;
1363
1402
  if (se > 0 || oe === "always") return !0;
1364
1403
  if (oe === "never") return !1;
1365
- let t = R[e];
1366
- return t === void 0 ? !1 : L ? t.isBlurred === !0 : t.isTouched === !0;
1404
+ let t = ce[e];
1405
+ return t === void 0 ? !1 : z ? t.isBlurred === !0 : t.isTouched === !0;
1367
1406
  }, [
1368
1407
  se,
1369
- R,
1408
+ ce,
1370
1409
  ae,
1371
1410
  oe,
1372
- L
1373
- ]), z = w((e) => {
1374
- let t = g[e];
1411
+ z
1412
+ ]), B = T((e) => {
1413
+ let t = y[e];
1375
1414
  if (t !== void 0) return t;
1376
- let n = d.current?.[e];
1415
+ let n = m.current?.[e];
1377
1416
  if (n !== void 0 && n.status === "invalid") return n.message ?? b({
1378
1417
  id: "validation.invalid",
1379
1418
  fallback: "Invalid value"
1380
- }, m.current);
1381
- if (!ce(e)) return;
1382
- let r = F.find((t) => t.path === e);
1383
- return r === void 0 ? void 0 : b(r, m.current);
1419
+ }, _.current);
1420
+ if (!ue(e)) return;
1421
+ let r = L.find((t) => t.path === e);
1422
+ return r === void 0 ? void 0 : b(r, _.current);
1384
1423
  }, [
1385
- g,
1386
- ce,
1387
- F
1388
- ]), ue = D(() => {
1389
- let e = {}, t = /* @__PURE__ */ new Set([...F.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(g)]);
1390
- for (let [e, n] of Object.entries(d.current ?? {})) n.status === "invalid" && t.add(e);
1424
+ y,
1425
+ ue,
1426
+ L
1427
+ ]), de = D(() => {
1428
+ let e = {}, t = /* @__PURE__ */ new Set([...L.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(y)]);
1429
+ for (let [e, n] of Object.entries(m.current ?? {})) n.status === "invalid" && t.add(e);
1391
1430
  for (let n of t) {
1392
- let t = z(n);
1431
+ let t = B(n);
1393
1432
  t !== void 0 && (e[n] = t);
1394
1433
  }
1395
1434
  return e;
1396
1435
  }, [
1397
- F,
1398
- g,
1399
- z
1400
- ]), de = w((e) => {
1401
- _((t) => {
1436
+ L,
1437
+ y,
1438
+ B
1439
+ ]), me = T((e) => {
1440
+ S((t) => {
1402
1441
  if (!(e in t)) return t;
1403
1442
  let n = { ...t };
1404
1443
  return delete n[e], n;
1405
1444
  });
1406
- }, []), fe = w((n) => {
1407
- let r = En(s, n), i = j.getFieldMeta(n), a = z(n), o = wn(e, t, n), c = d.current?.[n], l = [a === void 0 ? void 0 : `${o}-error`, r?.description === void 0 ? void 0 : `${o}-help`].filter((e) => e !== void 0);
1445
+ }, []), V = T((t) => {
1446
+ let n = En(u, t), r = N.getFieldMeta(t), i = B(t), a = wn(e, s, t), o = m.current?.[t], c = [i === void 0 ? void 0 : `${a}-error`, n?.description === void 0 ? void 0 : `${a}-help`].filter((e) => e !== void 0);
1408
1447
  return {
1409
- value: j.getFieldValue(n),
1448
+ value: N.getFieldValue(t),
1410
1449
  setValue: (e) => {
1411
- de(n), !Object.is(j.getFieldValue(n), e) && j.setFieldValue(n, e);
1450
+ me(t), !Object.is(N.getFieldValue(t), e) && N.setFieldValue(t, e);
1412
1451
  },
1413
1452
  onBlur: () => {
1414
- j.setFieldMeta(n, (e) => ({
1453
+ N.setFieldMeta(t, (e) => ({
1415
1454
  ...Tn,
1416
1455
  ...e ?? {},
1417
1456
  isTouched: !0,
1418
1457
  isBlurred: !0
1419
1458
  }));
1420
1459
  },
1421
- error: a,
1422
- serverError: g[n],
1423
- touched: i?.isTouched === !0,
1424
- blurred: i?.isBlurred === !0,
1425
- dirty: i?.isDirty === !0,
1426
- required: r?.required === !0,
1427
- label: r?.label ?? n,
1428
- widget: r?.widget ?? "text",
1429
- options: r?.options,
1430
- description: r?.description,
1431
- asyncStatus: c?.status ?? "idle",
1460
+ error: i,
1461
+ serverError: y[t],
1462
+ touched: r?.isTouched === !0,
1463
+ blurred: r?.isBlurred === !0,
1464
+ dirty: r?.isDirty === !0,
1465
+ required: n?.required === !0,
1466
+ label: n?.label ?? t,
1467
+ widget: n?.widget ?? "text",
1468
+ options: n?.options,
1469
+ description: n?.description,
1470
+ asyncStatus: o?.status ?? "idle",
1432
1471
  a11y: {
1433
- id: o,
1434
- "aria-invalid": a !== void 0 || void 0,
1435
- "aria-required": r?.required === !0 || void 0,
1436
- "aria-describedby": l.length > 0 ? l.join(" ") : void 0
1472
+ id: a,
1473
+ "aria-invalid": i !== void 0 || void 0,
1474
+ "aria-required": n?.required === !0 || void 0,
1475
+ "aria-describedby": c.length > 0 ? c.join(" ") : void 0
1437
1476
  }
1438
1477
  };
1439
1478
  }, [
1440
1479
  e,
1441
- de,
1442
- j,
1443
1480
  s,
1444
- t,
1445
- g,
1446
- z
1447
- ]), he = w((e) => ({
1448
- items: j.getFieldValue(e) ?? [],
1481
+ me,
1482
+ N,
1483
+ u,
1484
+ y,
1485
+ B
1486
+ ]), he = T((e) => ({
1487
+ items: N.getFieldValue(e) ?? [],
1449
1488
  push: (t) => {
1450
- j.pushFieldValue(e, t);
1489
+ N.pushFieldValue(e, t);
1451
1490
  },
1452
1491
  insert: (t, n) => {
1453
- j.insertFieldValue(e, t, n);
1492
+ N.insertFieldValue(e, t, n);
1454
1493
  },
1455
1494
  remove: (t) => {
1456
- j.removeFieldValue(e, t);
1495
+ N.removeFieldValue(e, t);
1457
1496
  },
1458
1497
  move: (t, n) => {
1459
- j.moveFieldValues(e, t, n);
1498
+ N.moveFieldValues(e, t, n);
1460
1499
  },
1461
1500
  swap: (t, n) => {
1462
- j.swapFieldValues(e, t, n);
1501
+ N.swapFieldValues(e, t, n);
1463
1502
  },
1464
- field: (t, n) => fe(`${e}.${t}.${n}`)
1465
- }), [j, fe]), ge = w((e) => s.filter((t) => t.section === e), [s]), _e = w((e, t) => {
1466
- de(e), !Object.is(j.getFieldValue(e), t) && j.setFieldValue(e, t);
1467
- }, [de, j]), ve = w((e) => {
1468
- for (let [t, n] of Object.entries(e)) j.setFieldValue(t, n);
1469
- }, [j]), B = w((e) => {
1470
- _({}), y(void 0), S(void 0), C.current = void 0, e === void 0 ? j.reset() : j.reset(ne(e));
1471
- }, [j, ne]), ye = n.asyncTimeoutMs ?? 5e3, be = w(async () => {
1503
+ field: (t, n) => V(`${e}.${t}.${n}`)
1504
+ }), [N, V]), ge = T((e) => u.filter((t) => t.section === e), [u]), H = T((e, t) => {
1505
+ me(e), !Object.is(N.getFieldValue(e), t) && N.setFieldValue(e, t);
1506
+ }, [me, N]), _e = T((e) => {
1507
+ for (let [t, n] of Object.entries(e)) N.setFieldValue(t, n);
1508
+ }, [N]), ve = T((e) => {
1509
+ S({}), w(void 0), ne(void 0), A.current = void 0, e === void 0 ? N.reset() : N.reset(re(e));
1510
+ }, [N, re]), ye = n.asyncTimeoutMs ?? 5e3, be = T(async () => {
1472
1511
  let e = Date.now();
1473
1512
  for (;;) {
1474
- let t = d.current;
1513
+ let t = m.current;
1475
1514
  if (t === void 0) return;
1476
1515
  let n = Object.entries(t), r = n.filter(([, e]) => e.status === "checking");
1477
1516
  if (r.length === 0) {
@@ -1479,81 +1518,81 @@ var Y = async (e, t) => {
1479
1518
  return e.length === 0 ? void 0 : Object.fromEntries(e.map(([e, t]) => [e, t.message ?? b({
1480
1519
  id: "validation.invalid",
1481
1520
  fallback: "Invalid value"
1482
- }, m.current)]));
1521
+ }, _.current)]));
1483
1522
  }
1484
1523
  if (Date.now() - e > ye) return Object.fromEntries(r.map(([e]) => [e, b({
1485
1524
  id: "validation.checking",
1486
1525
  fallback: "Still checking…"
1487
- }, m.current)]));
1526
+ }, _.current)]));
1488
1527
  await new Promise((e) => setTimeout(e, 50));
1489
1528
  }
1490
- }, [ye]), xe = w(() => {
1491
- let n = globalThis.document;
1492
- if (n?.getElementById === void 0) return;
1493
- let r = [...s.map((e) => e.name), ...Object.keys(g).filter((e) => !s.some((t) => t.name === e))];
1494
- for (let i of r) if (z(i) !== void 0) {
1495
- n.getElementById(wn(e, t, i))?.focus?.();
1529
+ }, [ye]), xe = T(() => {
1530
+ let t = globalThis.document;
1531
+ if (t?.getElementById === void 0) return;
1532
+ let n = [...u.map((e) => e.name), ...Object.keys(y).filter((e) => !u.some((t) => t.name === e))];
1533
+ for (let r of n) if (B(r) !== void 0) {
1534
+ t.getElementById(wn(e, s, r))?.focus?.();
1496
1535
  return;
1497
1536
  }
1498
1537
  }, [
1499
1538
  e,
1500
1539
  s,
1501
- t,
1502
- g,
1503
- z
1504
- ]), V = O(xe);
1505
- V.current = xe;
1506
- let Se = w(async () => {
1507
- y(void 0), _({}), S(void 0), C.current = void 0;
1540
+ u,
1541
+ y,
1542
+ B
1543
+ ]), U = O(xe);
1544
+ U.current = xe;
1545
+ let Se = T(async () => {
1546
+ w(void 0), S({}), ne(void 0), A.current = void 0;
1508
1547
  let e, t = !1;
1509
- if (await j.handleSubmit().catch((n) => {
1548
+ if (await N.handleSubmit().catch((n) => {
1510
1549
  t = !0, e = n;
1511
1550
  }), t) throw e;
1512
- return C.current === void 0 && queueMicrotask(() => {
1513
- V.current();
1514
- }), C.current;
1515
- }, [j]);
1516
- re.current = (async (e) => {
1517
- let t = f.current, n = e, r = n;
1551
+ return A.current === void 0 && queueMicrotask(() => {
1552
+ U.current();
1553
+ }), A.current;
1554
+ }, [N]);
1555
+ ie.current = (async (e) => {
1556
+ let t = h.current, n = e, r = n;
1518
1557
  if (t.toInput !== void 0) try {
1519
1558
  r = t.toInput(n);
1520
1559
  } catch (e) {
1521
- y(e instanceof Error ? e.message : String(e));
1560
+ w(e instanceof Error ? e.message : String(e));
1522
1561
  return;
1523
1562
  }
1524
- if (T(n).length > 0) {
1563
+ if (j(n).length > 0) {
1525
1564
  queueMicrotask(() => {
1526
- V.current();
1565
+ U.current();
1527
1566
  });
1528
1567
  return;
1529
1568
  }
1530
- let i = h.current;
1569
+ let i = v.current;
1531
1570
  if (i !== void 0) {
1532
- let e = te(i, r);
1571
+ let e = ee(i, r);
1533
1572
  e.dropped.length > 0 && process.env.NODE_ENV !== "production" && console.warn(`[@voltro/client] useFormBinding: dropped ${e.dropped.length} value(s) the mutation's input does not declare (${e.dropped.join(", ")}). The server refuses undeclared fields, so they are not sent. Map them with \`toInput\` if they belong in the write; ignore this if they are form-only state.`), r = e.input;
1534
1573
  }
1535
1574
  let a = await be();
1536
1575
  if (a !== void 0) {
1537
- _((e) => ({
1576
+ S((e) => ({
1538
1577
  ...e,
1539
1578
  ...a
1540
1579
  })), queueMicrotask(() => {
1541
- V.current();
1580
+ U.current();
1542
1581
  });
1543
1582
  return;
1544
1583
  }
1545
- let o = (e) => p.current.mutate(e);
1584
+ let o = (e) => g.current.mutate(e);
1546
1585
  try {
1547
1586
  let e = t.onSubmit === void 0 ? await o(r) : await t.onSubmit({
1548
1587
  input: r,
1549
1588
  values: n,
1550
1589
  mutate: o
1551
1590
  });
1552
- C.current = e, t.onSuccess?.(e);
1591
+ A.current = e, t.onSuccess?.(e);
1553
1592
  } catch (e) {
1554
1593
  let t = le(e);
1555
1594
  if (t.length === 0) {
1556
- S(e), f.current.onError?.(e);
1595
+ ne(e), h.current.onError?.(e);
1557
1596
  return;
1558
1597
  }
1559
1598
  let n = {};
@@ -1561,77 +1600,77 @@ var Y = async (e, t) => {
1561
1600
  id: e.message,
1562
1601
  ...e.params === void 0 ? {} : { params: e.params },
1563
1602
  fallback: e.message
1564
- }, m.current));
1565
- _((e) => ({
1603
+ }, _.current));
1604
+ S((e) => ({
1566
1605
  ...e,
1567
1606
  ...n
1568
1607
  })), queueMicrotask(() => {
1569
- V.current();
1608
+ U.current();
1570
1609
  });
1571
1610
  }
1572
1611
  });
1573
- let H = F.length === 0, U = Object.values(d.current ?? {}).some((e) => e.status === "checking"), W = ee ?? a.error, Ce = W !== void 0 && le(W).length > 0 ? void 0 : W, we = Object.keys(ue).length, Te = (() => {
1574
- for (let e of s) if (ue[e.name] !== void 0) return e.name;
1575
- let e = Object.keys(ue);
1612
+ let Ce = L.length === 0, we = Object.values(m.current ?? {}).some((e) => e.status === "checking"), Te = te ?? c.error, Ee = Te !== void 0 && le(Te).length > 0 ? void 0 : Te, De = Object.keys(de).length, Oe = (() => {
1613
+ for (let e of u) if (de[e.name] !== void 0) return e.name;
1614
+ let e = Object.keys(de);
1576
1615
  return e.length > 0 ? e[0] : void 0;
1577
- })(), Ee = {
1578
- isDirty: !ae && P.isDirty,
1579
- isPristine: P.isPristine,
1580
- isTouched: P.isTouched,
1581
- isValid: H,
1582
- isValidating: U,
1583
- canSubmit: H && !U && !P.isSubmitting && !ae,
1584
- isSubmitting: P.isSubmitting,
1585
- isSubmitted: P.isSubmitted,
1586
- isSubmitSuccessful: P.isSubmitSuccessful && C.current !== void 0,
1587
- submissionAttempts: P.submissionAttempts,
1588
- errorCount: we,
1589
- firstInvalidPath: Te,
1590
- pending: a.pending,
1616
+ })(), ke = {
1617
+ isDirty: !ae && I.isDirty,
1618
+ isPristine: I.isPristine,
1619
+ isTouched: I.isTouched,
1620
+ isValid: Ce,
1621
+ isValidating: we,
1622
+ canSubmit: Ce && !we && !I.isSubmitting && !ae,
1623
+ isSubmitting: I.isSubmitting,
1624
+ isSubmitted: I.isSubmitted,
1625
+ isSubmitSuccessful: I.isSubmitSuccessful && A.current !== void 0,
1626
+ submissionAttempts: I.submissionAttempts,
1627
+ errorCount: De,
1628
+ firstInvalidPath: Oe,
1629
+ pending: c.pending,
1591
1630
  isLoading: ae,
1592
- submitError: Ce,
1593
- data: a.data
1594
- }, De = {
1595
- fields: s,
1596
- values: N,
1597
- errors: ue,
1598
- issues: F,
1599
- isValid: H,
1600
- pending: a.pending,
1601
- submitError: Ce,
1602
- formError: v,
1603
- data: a.data,
1604
- setValue: _e,
1605
- setValues: ve,
1606
- reset: B,
1631
+ submitError: Ee,
1632
+ data: c.data
1633
+ }, Ae = {
1634
+ fields: u,
1635
+ values: F,
1636
+ errors: de,
1637
+ issues: L,
1638
+ isValid: Ce,
1639
+ pending: c.pending,
1640
+ submitError: Ee,
1641
+ formError: C,
1642
+ data: c.data,
1643
+ setValue: H,
1644
+ setValues: _e,
1645
+ reset: ve,
1607
1646
  submit: Se,
1608
- field: fe,
1647
+ field: V,
1609
1648
  array: he,
1610
1649
  section: ge,
1611
- state: Ee,
1650
+ state: ke,
1612
1651
  focusFirstInvalid: xe
1613
1652
  };
1614
- return Object.defineProperty(De, xn, {
1653
+ return Object.defineProperty(Ae, xn, {
1615
1654
  value: {
1616
- store: ie.store,
1617
- field: fe
1655
+ store: M.store,
1656
+ field: V
1618
1657
  },
1619
1658
  enumerable: !1
1620
- }), De;
1621
- }, On = (e) => C(Sn.Provider, { value: e.binding }, e.children), kn = () => T(Sn);
1659
+ }), Ae;
1660
+ }, On = (e) => w(Sn.Provider, { value: e.binding }, e.children), kn = () => te(Sn);
1622
1661
  function An(e, t) {
1623
- let n = T(Sn), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
1662
+ let n = te(Sn), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
1624
1663
  if (a === void 0) throw Error("useFormField(path) found no form binding — mount <FormBindingProvider binding={form}> above this field, or call useFormField(form, path) with the binding in hand.");
1625
1664
  let o = a[xn];
1626
1665
  if (o === void 0) throw Error("useFormField: not a useFormBinding result");
1627
- return me(o.store, (e) => {
1666
+ return pe(o.store, (e) => {
1628
1667
  let t = e.fieldMetaBase[i];
1629
1668
  return `${JSON.stringify(Cn(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
1630
1669
  }), o.field(i);
1631
1670
  }
1632
1671
  //#endregion
1633
1672
  //#region src/createHooks.ts
1634
- var jn = J, Mn = (e) => ({
1673
+ var jn = q, Mn = (e) => ({
1635
1674
  useSubscription: (t, n, r) => jn(e, t, n, r),
1636
1675
  useMutation: (t) => Z(e, t),
1637
1676
  useAction: (t) => _n(e, t),
@@ -1643,14 +1682,14 @@ var jn = J, Mn = (e) => ({
1643
1682
  if (i === null) throw Error(`seedPreloadedSubscription('${e}', '${t}') was called outside a server render. Preload seeds exist to put a subscription's first value into the SSR hydration payload; on the client the live subscription already provides it. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
1644
1683
  i.seeds.push({
1645
1684
  api: e,
1646
- key: B([t, n]),
1685
+ key: H([t, n]),
1647
1686
  value: r
1648
1687
  });
1649
1688
  }, zn = (e, t, n) => {
1650
1689
  let r = Pn?.() ?? null;
1651
1690
  r !== null && r.seeds.push({
1652
1691
  api: e,
1653
- key: B([t, n]),
1692
+ key: H([t, n]),
1654
1693
  value: void 0,
1655
1694
  failed: !0
1656
1695
  });
@@ -1660,7 +1699,7 @@ var jn = J, Mn = (e) => ({
1660
1699
  failed: t.failed === !0
1661
1700
  });
1662
1701
  }, Vn = (e, t, n) => {
1663
- let r = B([t, n]), i = Pn?.() ?? null;
1702
+ let r = H([t, n]), i = Pn?.() ?? null;
1664
1703
  if (i !== null) {
1665
1704
  for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? void 0 : t.value;
1666
1705
  return;
@@ -1668,7 +1707,7 @@ var jn = J, Mn = (e) => ({
1668
1707
  let a = In.get(Ln(e, r));
1669
1708
  return a === void 0 || a.failed ? void 0 : a.value;
1670
1709
  }, Hn = (e, t, n) => {
1671
- let r = B([t, n]), i = Pn?.() ?? null;
1710
+ let r = H([t, n]), i = Pn?.() ?? null;
1672
1711
  if (i !== null) {
1673
1712
  for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? "failed" : "seeded";
1674
1713
  return "absent";
@@ -1681,7 +1720,7 @@ var jn = J, Mn = (e) => ({
1681
1720
  //#endregion
1682
1721
  //#region src/usePreloadedSubscription.ts
1683
1722
  function Wn(e, t, n = {}, r = {}) {
1684
- let i = Vn(e, t, n), a = J(e, t, n, i === void 0 ? r : {
1723
+ let i = Vn(e, t, n), a = q(e, t, n, i === void 0 ? r : {
1685
1724
  ...r,
1686
1725
  initialSnapshot: i
1687
1726
  });
@@ -1700,7 +1739,7 @@ var Gn = {
1700
1739
  _tag = "EventStreamClosed";
1701
1740
  };
1702
1741
  function qn(e, t, n, r = {}) {
1703
- let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s = K(a), { runtime: c, client: l } = s, [u, d] = k(Gn), f = O(n);
1742
+ let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s = G(a), { runtime: c, client: l } = s, [u, d] = k(Gn), f = O(n);
1704
1743
  f.current = n;
1705
1744
  let p = O(o);
1706
1745
  p.current = o;
@@ -1712,7 +1751,7 @@ function qn(e, t, n, r = {}) {
1712
1751
  v.current = t;
1713
1752
  let y = O(null);
1714
1753
  y.current !== _ && (y.current = _, g.current = /* @__PURE__ */ new Map());
1715
- let b = w((e, t) => {
1754
+ let b = T((e, t) => {
1716
1755
  e <= 0 || (d((n) => ({
1717
1756
  ...n,
1718
1757
  missed: n.missed + e,
@@ -1724,7 +1763,7 @@ function qn(e, t, n, r = {}) {
1724
1763
  count: e,
1725
1764
  reason: t
1726
1765
  }));
1727
- }, []), x = !i && _ !== null && !Ke(s);
1766
+ }, []), x = !i && _ !== null && !qe(s);
1728
1767
  return E(() => {
1729
1768
  if (!x) {
1730
1769
  d(Gn);
@@ -1739,18 +1778,18 @@ function qn(e, t, n, r = {}) {
1739
1778
  origin: e,
1740
1779
  n: t
1741
1780
  }));
1742
- return q(m.current, e.name)({
1781
+ return K(m.current, e.name)({
1743
1782
  key: v.current,
1744
1783
  ...t.length > 0 ? { resume: t } : {}
1745
1784
  });
1746
- }), r = L.unwrap(n).pipe(L.tap(() => M.sync(() => {
1785
+ }), r = R.unwrap(n).pipe(R.tap(() => M.sync(() => {
1747
1786
  t = 0;
1748
- })), L.concat(L.fail(new Kn())), L.retry(I.exponential("250 millis", 2).pipe(I.either(I.spaced("30 seconds")), I.jittered, I.tapOutput(() => M.sync(() => {
1787
+ })), R.concat(R.fail(new Kn())), R.retry(L.exponential("250 millis", 2).pipe(L.either(L.spaced("30 seconds")), L.jittered, L.tapOutput(() => M.sync(() => {
1749
1788
  t += 1, d((e) => ({
1750
1789
  ...e,
1751
1790
  status: "connecting"
1752
1791
  }));
1753
- }))))), i = h.current.runFork(L.runForEach(r, (e) => M.sync(() => {
1792
+ }))))), i = h.current.runFork(R.runForEach(r, (e) => M.sync(() => {
1754
1793
  if (e._tag === "attached") {
1755
1794
  d((e) => ({
1756
1795
  ...e,
@@ -1851,7 +1890,7 @@ var Jn = () => {
1851
1890
  }, Xn = (e = {}) => {
1852
1891
  let [t, n] = k(!1), [r, i] = k(void 0), [a, o] = k(void 0), s = O(e);
1853
1892
  return s.current = e, {
1854
- run: w(async (e, t = {}) => {
1893
+ run: T(async (e, t = {}) => {
1855
1894
  n(!0), i(void 0), o(void 0);
1856
1895
  try {
1857
1896
  let n = await Yn(e, {
@@ -1927,141 +1966,142 @@ var Jn = () => {
1927
1966
  }
1928
1967
  i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
1929
1968
  }), nr = (e, t = {}) => {
1930
- let { runtime: n, client: r, inspectBaseUrl: i, errorBus: a } = K(e), [o, s] = k(0), [c, l] = k("idle"), [u, d] = k(void 0), f = O(null), p = w(() => {
1969
+ let n = G(e), { inspectBaseUrl: r, errorBus: i } = n, a = O(n);
1970
+ a.current = n;
1971
+ let [o, s] = k(0), [c, l] = k("idle"), [u, d] = k(void 0), f = O(null), p = T(() => {
1931
1972
  s(0), l("idle"), d(void 0);
1932
- }, []), m = w(() => {
1973
+ }, []), m = T(() => {
1933
1974
  f.current?.abort();
1934
- }, []), h = w((e) => /^https?:\/\//.test(e) ? e : `${i}${e}`, [i]), g = w(async (e, i, a, o) => {
1935
- let s = Math.max(0, i.retries ?? t.retries ?? 1), c = (e instanceof File, e.type || "application/octet-stream"), l = e instanceof File ? e.name : "blob", u = i.visibility ?? t.visibility, d = i.key ?? t.key, f = i.folder ?? t.folder, p = i.tags ?? t.tags, m = {
1936
- ...u ? { visibility: u } : {},
1937
- ...f ? { folder: f } : {},
1938
- ...p ? { tags: p } : {},
1939
- ...i.alt ? { alt: i.alt } : {},
1940
- ...i.caption ? { caption: i.caption } : {}
1941
- }, g = (e) => ({
1975
+ }, []), h = T((e) => /^https?:\/\//.test(e) ? e : `${r}${e}`, [r]), g = T(async (n, r, i, o) => {
1976
+ let { runtime: s, client: c } = await J(a, e, "storage.upload"), l = Math.max(0, r.retries ?? t.retries ?? 1), u = (n instanceof File, n.type || "application/octet-stream"), d = n instanceof File ? n.name : "blob", f = r.visibility ?? t.visibility, p = r.key ?? t.key, m = r.folder ?? t.folder, g = r.tags ?? t.tags, _ = {
1977
+ ...f ? { visibility: f } : {},
1978
+ ...m ? { folder: m } : {},
1979
+ ...g ? { tags: g } : {},
1980
+ ...r.alt ? { alt: r.alt } : {},
1981
+ ...r.caption ? { caption: r.caption } : {}
1982
+ }, v = (e) => ({
1942
1983
  id: e.id,
1943
1984
  url: h(e.url),
1944
- name: l,
1985
+ name: d,
1945
1986
  mime: e.contentType,
1946
1987
  size: e.size,
1947
1988
  ...e.width === void 0 ? {} : { width: e.width },
1948
1989
  ...e.height === void 0 ? {} : { height: e.height }
1949
- }), _ = async () => {
1950
- let s = i.mintTag ?? t.mintTag ?? Q("mintUploadTicket"), l = q(r, s), u = await Y(n, l({
1951
- contentType: c,
1952
- ...m,
1953
- ...d ? { key: d } : {}
1954
- })), f = await tr(h(u.uploadUrl), c, e, o, a);
1955
- return g(f);
1956
- }, v = async () => {
1957
- let s = i.presignMintTag ?? t.presignMintTag ?? Q("mintPresignedUpload"), l = i.finalizeTag ?? t.finalizeTag ?? Q("finalizeUpload"), u;
1990
+ }), y = async () => {
1991
+ let e = r.mintTag ?? t.mintTag ?? Q("mintUploadTicket"), a = K(c, e), l = await Y(s, a({
1992
+ contentType: u,
1993
+ ..._,
1994
+ ...p ? { key: p } : {}
1995
+ })), d = await tr(h(l.uploadUrl), u, n, o, i);
1996
+ return v(d);
1997
+ }, b = async () => {
1998
+ let e = r.presignMintTag ?? t.presignMintTag ?? Q("mintPresignedUpload"), a = r.finalizeTag ?? t.finalizeTag ?? Q("finalizeUpload"), l;
1958
1999
  try {
1959
- let e = q(r, s);
1960
- u = await Y(n, e({
1961
- contentType: c,
1962
- ...m
2000
+ let t = K(c, e);
2001
+ l = await Y(s, t({
2002
+ contentType: u,
2003
+ ..._
1963
2004
  }));
1964
2005
  } catch {
1965
2006
  return null;
1966
2007
  }
1967
- await er(u.uploadUrl, c, e, o, a);
1968
- let d = q(r, l), f = await Y(n, d({ finalizeToken: u.finalizeToken }));
1969
- return g(f);
1970
- }, y = async () => {
1971
- let s = i.beginResumableTag ?? t.beginResumableTag ?? Q("beginResumableUpload"), l = q(r, s), u = e.size, d = i.chunkSize ?? t.chunkSize, f = await Y(n, l({
1972
- contentType: c,
1973
- size: u,
1974
- ...m,
2008
+ await er(l.uploadUrl, u, n, o, i);
2009
+ let d = K(c, a), f = await Y(s, d({ finalizeToken: l.finalizeToken }));
2010
+ return v(f);
2011
+ }, x = async () => {
2012
+ let e = r.beginResumableTag ?? t.beginResumableTag ?? Q("beginResumableUpload"), a = K(c, e), l = n.size, d = r.chunkSize ?? t.chunkSize, f = await Y(s, a({
2013
+ contentType: u,
2014
+ size: l,
2015
+ ..._,
1975
2016
  ...d ? { chunkSize: d } : {}
1976
- })), p = h(f.uploadUrl), _ = Math.max(1, f.chunkSize), v = Math.max(1, Math.ceil(u / _)), y = Math.max(0, i.retries ?? t.retries ?? 1), b = 0, x = null;
1977
- for (let t = 0; t < v; t++) {
1978
- let n = t * _, r = Math.min(u, n + _), i = e.slice(n, r), s = t === v - 1, l = r - n, d = 0;
2017
+ })), p = h(f.uploadUrl), m = Math.max(1, f.chunkSize), g = Math.max(1, Math.ceil(l / m)), y = Math.max(0, r.retries ?? t.retries ?? 1), b = 0, x = null;
2018
+ for (let e = 0; e < g; e++) {
2019
+ let t = e * m, r = Math.min(l, t + m), a = n.slice(t, r), s = e === g - 1, c = r - t, d = 0;
1979
2020
  for (;;) {
1980
- if (a.aborted) throw new DOMException("upload aborted", "AbortError");
2021
+ if (i.aborted) throw new DOMException("upload aborted", "AbortError");
1981
2022
  try {
1982
- let e = await $n(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${t}${s ? "&final=1" : ""}`}`, c, i, (e) => o((b + e * l) / u), a, s);
1983
- s && (x = e);
2023
+ let t = await $n(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${e}${s ? "&final=1" : ""}`}`, u, a, (e) => o((b + e * c) / l), i, s);
2024
+ s && (x = t);
1984
2025
  break;
1985
2026
  } catch (e) {
1986
2027
  if (e instanceof DOMException && e.name === "AbortError" || d++ >= y) throw e;
1987
2028
  }
1988
2029
  }
1989
- b += l, o(b / u);
2030
+ b += c, o(b / l);
1990
2031
  }
1991
2032
  if (!x) throw Error("resumable upload produced no final reply");
1992
- return g(x);
1993
- }, b = async () => {
1994
- let s = i.multipartBeginTag ?? t.multipartBeginTag ?? Q("beginMultipartUpload"), u = i.multipartSignTag ?? t.multipartSignTag ?? Q("signMultipartPart"), d = i.multipartCompleteTag ?? t.multipartCompleteTag ?? Q("completeMultipartUpload"), f = i.multipartAbortTag ?? t.multipartAbortTag ?? Q("abortMultipartUpload"), p = e.size, g = i.chunkSize ?? t.chunkSize, _;
2033
+ return v(x);
2034
+ }, S = async () => {
2035
+ let e = r.multipartBeginTag ?? t.multipartBeginTag ?? Q("beginMultipartUpload"), a = r.multipartSignTag ?? t.multipartSignTag ?? Q("signMultipartPart"), l = r.multipartCompleteTag ?? t.multipartCompleteTag ?? Q("completeMultipartUpload"), f = r.multipartAbortTag ?? t.multipartAbortTag ?? Q("abortMultipartUpload"), p = n.size, m = r.chunkSize ?? t.chunkSize, g;
1995
2036
  try {
1996
- let e = q(r, s);
1997
- _ = await Y(n, e({
1998
- contentType: c,
2037
+ let t = K(c, e);
2038
+ g = await Y(s, t({
2039
+ contentType: u,
1999
2040
  size: p,
2000
- ...m,
2001
- ...g ? { partSize: g } : {}
2041
+ ..._,
2042
+ ...m ? { partSize: m } : {}
2002
2043
  }));
2003
2044
  } catch {
2004
2045
  return null;
2005
2046
  }
2006
- let v = q(r, u), y = q(r, d), b = q(r, f), x = Math.max(1, _.partSize), ee = Math.max(1, Math.ceil(p / x)), te = Math.max(0, i.retries ?? t.retries ?? 1), S = [], C = 0;
2047
+ let v = K(c, a), y = K(c, l), b = K(c, f), x = Math.max(1, g.partSize), S = Math.max(1, Math.ceil(p / x)), ee = Math.max(0, r.retries ?? t.retries ?? 1), C = [], w = 0;
2007
2048
  try {
2008
- for (let t = 0; t < ee; t++) {
2009
- let r = t * x, i = Math.min(p, r + x), s = e.slice(r, i), c = t + 1, l = i - r, u = 0;
2049
+ for (let e = 0; e < S; e++) {
2050
+ let t = e * x, r = Math.min(p, t + x), a = n.slice(t, r), c = e + 1, l = r - t, u = 0;
2010
2051
  for (;;) {
2011
- if (a.aborted) throw new DOMException("upload aborted", "AbortError");
2052
+ if (i.aborted) throw new DOMException("upload aborted", "AbortError");
2012
2053
  try {
2013
- let { url: e } = await Y(n, v({
2014
- multipartToken: _.multipartToken,
2054
+ let { url: e } = await Y(s, v({
2055
+ multipartToken: g.multipartToken,
2015
2056
  partNumber: c
2016
- })), t = await Qn(e, s, (e) => o((C + e * l) / p), a);
2017
- S.push({
2057
+ })), t = await Qn(e, a, (e) => o((w + e * l) / p), i);
2058
+ C.push({
2018
2059
  partNumber: c,
2019
2060
  etag: t
2020
2061
  });
2021
2062
  break;
2022
2063
  } catch (e) {
2023
- if (e instanceof DOMException && e.name === "AbortError" || u++ >= te) throw e;
2064
+ if (e instanceof DOMException && e.name === "AbortError" || u++ >= ee) throw e;
2024
2065
  }
2025
2066
  }
2026
- C += l, o(C / p);
2067
+ w += l, o(w / p);
2027
2068
  }
2028
- let t = await Y(n, y({
2029
- multipartToken: _.multipartToken,
2030
- parts: S
2069
+ let e = await Y(s, y({
2070
+ multipartToken: g.multipartToken,
2071
+ parts: C
2031
2072
  }));
2032
2073
  return {
2033
- id: t.id,
2034
- url: h(t.url),
2035
- name: l,
2036
- mime: c,
2037
- size: t.size
2074
+ id: e.id,
2075
+ url: h(e.url),
2076
+ name: d,
2077
+ mime: u,
2078
+ size: e.size
2038
2079
  };
2039
2080
  } catch (e) {
2040
2081
  try {
2041
- await Y(n, b({ multipartToken: _.multipartToken }));
2082
+ await Y(s, b({ multipartToken: g.multipartToken }));
2042
2083
  } catch {}
2043
2084
  throw e;
2044
2085
  }
2045
2086
  };
2046
- if ((i.prefer ?? t.prefer) === "multipart") return await b() || await y();
2047
- if ((i.prefer ?? t.prefer) === "resumable") return await y();
2048
- let x = (i.prefer ?? t.prefer) === "presign", ee;
2049
- for (let e = 0; e <= s; e++) {
2050
- if (a.aborted) throw new DOMException("upload aborted", "AbortError");
2087
+ if ((r.prefer ?? t.prefer) === "multipart") return await S() || await x();
2088
+ if ((r.prefer ?? t.prefer) === "resumable") return await x();
2089
+ let ee = (r.prefer ?? t.prefer) === "presign", C;
2090
+ for (let e = 0; e <= l; e++) {
2091
+ if (i.aborted) throw new DOMException("upload aborted", "AbortError");
2051
2092
  try {
2052
- if (x) {
2053
- let e = await v();
2093
+ if (ee) {
2094
+ let e = await b();
2054
2095
  if (e) return e;
2055
2096
  }
2056
- return await _();
2097
+ return await y();
2057
2098
  } catch (t) {
2058
- if (t instanceof DOMException && t.name === "AbortError" || (ee = t, e === s)) throw t;
2099
+ if (t instanceof DOMException && t.name === "AbortError" || (C = t, e === l)) throw t;
2059
2100
  }
2060
2101
  }
2061
- throw ee;
2102
+ throw C;
2062
2103
  }, [
2063
- n,
2064
- r,
2104
+ e,
2065
2105
  h,
2066
2106
  t.mintTag,
2067
2107
  t.presignMintTag,
@@ -2078,14 +2118,14 @@ var Jn = () => {
2078
2118
  t.folder,
2079
2119
  t.tags,
2080
2120
  t.retries
2081
- ]), _ = w(async (e, n = {}) => {
2121
+ ]), _ = T(async (e, n = {}) => {
2082
2122
  let r = new AbortController();
2083
2123
  f.current = r, l("uploading"), d(void 0), s(0);
2084
2124
  try {
2085
2125
  let t = await g(e, n, r.signal, s);
2086
2126
  return s(1), l("success"), t;
2087
2127
  } catch (e) {
2088
- throw l("error"), d(e), e instanceof DOMException && e.name === "AbortError" || a.emit({
2128
+ throw l("error"), d(e), e instanceof DOMException && e.name === "AbortError" || i.emit({
2089
2129
  source: "action",
2090
2130
  tag: n.mintTag ?? t.mintTag ?? Q("mintUploadTicket"),
2091
2131
  error: e
@@ -2093,13 +2133,13 @@ var Jn = () => {
2093
2133
  }
2094
2134
  }, [
2095
2135
  g,
2096
- a,
2136
+ i,
2097
2137
  t.mintTag
2098
- ]), v = w(async (e, n = {}) => {
2138
+ ]), v = T(async (e, n = {}) => {
2099
2139
  if (e.length === 0) return [];
2100
2140
  let r = new AbortController();
2101
2141
  f.current = r, l("uploading"), d(void 0), s(0);
2102
- let i = Math.max(1, n.concurrency ?? t.concurrency ?? 3), o = Array(e.length), c = Array(e.length).fill(0), u = () => s(c.reduce((e, t) => e + t, 0) / e.length), p = 0, m = async () => {
2142
+ let a = Math.max(1, n.concurrency ?? t.concurrency ?? 3), o = Array(e.length), c = Array(e.length).fill(0), u = () => s(c.reduce((e, t) => e + t, 0) / e.length), p = 0, m = async () => {
2103
2143
  for (;;) {
2104
2144
  let t = p++;
2105
2145
  if (t >= e.length) return;
@@ -2109,9 +2149,9 @@ var Jn = () => {
2109
2149
  }
2110
2150
  };
2111
2151
  try {
2112
- return await Promise.all(Array.from({ length: Math.min(i, e.length) }, () => m())), s(1), l("success"), o;
2152
+ return await Promise.all(Array.from({ length: Math.min(a, e.length) }, () => m())), s(1), l("success"), o;
2113
2153
  } catch (e) {
2114
- throw r.abort(), l("error"), d(e), e instanceof DOMException && e.name === "AbortError" || a.emit({
2154
+ throw r.abort(), l("error"), d(e), e instanceof DOMException && e.name === "AbortError" || i.emit({
2115
2155
  source: "action",
2116
2156
  tag: n.mintTag ?? t.mintTag ?? Q("mintUploadTicket"),
2117
2157
  error: e
@@ -2119,14 +2159,14 @@ var Jn = () => {
2119
2159
  }
2120
2160
  }, [
2121
2161
  g,
2122
- a,
2162
+ i,
2123
2163
  t.concurrency,
2124
2164
  t.mintTag
2125
- ]), y = w((e, t = {}) => {
2165
+ ]), y = T((e, t = {}) => {
2126
2166
  e.preventDefault();
2127
2167
  let n = e.dataTransfer ? Array.from(e.dataTransfer.files) : [];
2128
2168
  return n.length ? v(n, t) : Promise.resolve([]);
2129
- }, [v]), b = w((e, t = {}) => {
2169
+ }, [v]), b = T((e, t = {}) => {
2130
2170
  let n = e.clipboardData ? Array.from(e.clipboardData.files) : [];
2131
2171
  return n.length ? v(n, t) : Promise.resolve([]);
2132
2172
  }, [v]), x = D(() => ({
@@ -2159,8 +2199,8 @@ var Jn = () => {
2159
2199
  x
2160
2200
  ]);
2161
2201
  }, $ = async (e) => {
2162
- let t = q(e.client, e.tag), n = M.currentSpan.pipe(M.tap((t) => M.sync(() => {
2163
- _e({
2202
+ let t = K(e.client, e.tag), n = M.currentSpan.pipe(M.tap((t) => M.sync(() => {
2203
+ he({
2164
2204
  traceId: t.traceId,
2165
2205
  spanId: t.spanId,
2166
2206
  source: "mutation",
@@ -2172,34 +2212,30 @@ var Jn = () => {
2172
2212
  } }));
2173
2213
  return Y(e.runtime, n);
2174
2214
  }, rr = (e, t) => {
2175
- let { runtime: n, client: r, descriptors: i } = K(e);
2176
- if (process.env.NODE_ENV !== "production") {
2177
- let n = i[t]?.kind;
2215
+ let n = G(e), { descriptors: r } = n, i = O(n);
2216
+ if (i.current = n, process.env.NODE_ENV !== "production") {
2217
+ let n = r[t]?.kind;
2178
2218
  n !== void 0 && n !== "workflow" && console.error(`[@voltro/client] useWorkflow('${e}', '${t}') targets a ${n}, not a workflow. Use ${n === "mutation" ? "useMutation" : n === "action" ? "useAction" : `the ${n} hook`} instead.`);
2179
2219
  }
2180
- let [a, o] = k(!1), [s, c] = k(void 0), [l, u] = k(void 0), d = w(async (i) => {
2220
+ let [a, o] = k(!1), [s, c] = k(void 0), [l, u] = k(void 0), d = T(async (n) => {
2181
2221
  o(!0), c(void 0);
2182
2222
  try {
2183
- let a = await $({
2223
+ let { runtime: r, client: a } = await J(i, e, t), o = await $({
2184
2224
  apiName: e,
2185
- runtime: n,
2186
- client: r,
2225
+ runtime: r,
2226
+ client: a,
2187
2227
  tag: t,
2188
- input: i,
2228
+ input: n,
2189
2229
  spanPrefix: "client.workflow.start"
2190
2230
  });
2191
- return u(a), a;
2231
+ return u(o), o;
2192
2232
  } catch (e) {
2193
2233
  throw c(e), e;
2194
2234
  } finally {
2195
2235
  o(!1);
2196
2236
  }
2197
- }, [
2198
- e,
2199
- n,
2200
- r,
2201
- t
2202
- ]), f = w(async (t) => {
2237
+ }, [e, t]), f = T(async (t) => {
2238
+ let { runtime: n, client: r } = await J(i, e, "__voltro.workflow.cancel");
2203
2239
  await $({
2204
2240
  apiName: e,
2205
2241
  runtime: n,
@@ -2208,11 +2244,8 @@ var Jn = () => {
2208
2244
  input: t,
2209
2245
  spanPrefix: "client.workflow.cancel"
2210
2246
  });
2211
- }, [
2212
- e,
2213
- n,
2214
- r
2215
- ]), p = w(async (t) => {
2247
+ }, [e]), p = T(async (t) => {
2248
+ let { runtime: n, client: r } = await J(i, e, "__voltro.workflow.resume");
2216
2249
  await $({
2217
2250
  apiName: e,
2218
2251
  runtime: n,
@@ -2221,42 +2254,36 @@ var Jn = () => {
2221
2254
  input: t,
2222
2255
  spanPrefix: "client.workflow.resume"
2223
2256
  });
2224
- }, [
2225
- e,
2226
- n,
2227
- r
2228
- ]), m = w(async (t, i, a) => $({
2229
- apiName: e,
2230
- runtime: n,
2231
- client: r,
2232
- tag: "__voltro.workflow.signal",
2233
- input: {
2234
- id: t.id,
2235
- signalName: i,
2236
- ...a === void 0 ? {} : { payload: a }
2237
- },
2238
- spanPrefix: "client.workflow.signal"
2239
- }), [
2240
- e,
2241
- n,
2242
- r
2243
- ]), h = w(async (t, i, a, o) => $({
2244
- apiName: e,
2245
- runtime: n,
2246
- client: r,
2247
- tag: "__voltro.workflow.update",
2248
- input: {
2249
- id: t.id,
2250
- updateName: i,
2251
- ...a === void 0 ? {} : { payload: a },
2252
- ...o?.timeoutMs === void 0 ? {} : { timeoutMs: o.timeoutMs }
2253
- },
2254
- spanPrefix: "client.workflow.update"
2255
- }), [
2256
- e,
2257
- n,
2258
- r
2259
- ]);
2257
+ }, [e]), m = T(async (t, n, r) => {
2258
+ let { runtime: a, client: o } = await J(i, e, "__voltro.workflow.signal");
2259
+ return $({
2260
+ apiName: e,
2261
+ runtime: a,
2262
+ client: o,
2263
+ tag: "__voltro.workflow.signal",
2264
+ input: {
2265
+ id: t.id,
2266
+ signalName: n,
2267
+ ...r === void 0 ? {} : { payload: r }
2268
+ },
2269
+ spanPrefix: "client.workflow.signal"
2270
+ });
2271
+ }, [e]), h = T(async (t, n, r, a) => {
2272
+ let { runtime: o, client: s } = await J(i, e, "__voltro.workflow.update");
2273
+ return $({
2274
+ apiName: e,
2275
+ runtime: o,
2276
+ client: s,
2277
+ tag: "__voltro.workflow.update",
2278
+ input: {
2279
+ id: t.id,
2280
+ updateName: n,
2281
+ ...r === void 0 ? {} : { payload: r },
2282
+ ...a?.timeoutMs === void 0 ? {} : { timeoutMs: a.timeoutMs }
2283
+ },
2284
+ spanPrefix: "client.workflow.update"
2285
+ });
2286
+ }, [e]);
2260
2287
  return D(() => ({
2261
2288
  start: d,
2262
2289
  cancel: f,
@@ -2277,32 +2304,30 @@ var Jn = () => {
2277
2304
  l
2278
2305
  ]);
2279
2306
  }, ir = (e) => {
2280
- let { runtime: t, client: n } = K(e), [r, i] = k(!1), [a, o] = k(void 0), [s, c] = k(void 0), l = w(async (r, a, s) => {
2307
+ let t = G(e), n = O(t);
2308
+ n.current = t;
2309
+ let [r, i] = k(!1), [a, o] = k(void 0), [s, c] = k(void 0), l = T(async (t, r, a) => {
2281
2310
  i(!0), o(void 0);
2282
2311
  try {
2283
- let i = await $({
2312
+ let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.signal"), s = await $({
2284
2313
  apiName: e,
2285
- runtime: t,
2286
- client: n,
2314
+ runtime: i,
2315
+ client: o,
2287
2316
  tag: "__voltro.workflow.signal",
2288
2317
  input: {
2289
- id: r.id,
2290
- signalName: a,
2291
- ...s === void 0 ? {} : { payload: s }
2318
+ id: t.id,
2319
+ signalName: r,
2320
+ ...a === void 0 ? {} : { payload: a }
2292
2321
  },
2293
2322
  spanPrefix: "client.workflow.signal"
2294
2323
  });
2295
- return c(i), i;
2324
+ return c(s), s;
2296
2325
  } catch (e) {
2297
2326
  throw o(e), e;
2298
2327
  } finally {
2299
2328
  i(!1);
2300
2329
  }
2301
- }, [
2302
- e,
2303
- t,
2304
- n
2305
- ]);
2330
+ }, [e]);
2306
2331
  return D(() => ({
2307
2332
  signal: l,
2308
2333
  pending: r,
@@ -2315,33 +2340,31 @@ var Jn = () => {
2315
2340
  s
2316
2341
  ]);
2317
2342
  }, ar = (e) => {
2318
- let { runtime: t, client: n } = K(e), [r, i] = k(!1), [a, o] = k(void 0), [s, c] = k(void 0), l = w(async (r, a, s, l) => {
2343
+ let t = G(e), n = O(t);
2344
+ n.current = t;
2345
+ let [r, i] = k(!1), [a, o] = k(void 0), [s, c] = k(void 0), l = T(async (t, r, a, s) => {
2319
2346
  i(!0), o(void 0);
2320
2347
  try {
2321
- let i = await $({
2348
+ let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.update"), l = await $({
2322
2349
  apiName: e,
2323
- runtime: t,
2324
- client: n,
2350
+ runtime: i,
2351
+ client: o,
2325
2352
  tag: "__voltro.workflow.update",
2326
2353
  input: {
2327
- id: r.id,
2328
- updateName: a,
2329
- ...s === void 0 ? {} : { payload: s },
2330
- ...l?.timeoutMs === void 0 ? {} : { timeoutMs: l.timeoutMs }
2354
+ id: t.id,
2355
+ updateName: r,
2356
+ ...a === void 0 ? {} : { payload: a },
2357
+ ...s?.timeoutMs === void 0 ? {} : { timeoutMs: s.timeoutMs }
2331
2358
  },
2332
2359
  spanPrefix: "client.workflow.update"
2333
2360
  });
2334
- return c(i), i;
2361
+ return c(l), l;
2335
2362
  } catch (e) {
2336
2363
  throw o(e), e;
2337
2364
  } finally {
2338
2365
  i(!1);
2339
2366
  }
2340
- }, [
2341
- e,
2342
- t,
2343
- n
2344
- ]);
2367
+ }, [e]);
2345
2368
  return D(() => ({
2346
2369
  update: l,
2347
2370
  pending: r,
@@ -2354,7 +2377,7 @@ var Jn = () => {
2354
2377
  s
2355
2378
  ]);
2356
2379
  }, or = (e, t) => {
2357
- let n = J(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
2380
+ let n = q(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
2358
2381
  return n.loading || n.idle || n.failed ? {
2359
2382
  ...n,
2360
2383
  run: void 0
@@ -2363,7 +2386,7 @@ var Jn = () => {
2363
2386
  run: n.data[0]
2364
2387
  };
2365
2388
  }, sr = (e, t = {}, n = {}) => {
2366
- let r = J(e, "__voltro.workflow.runs", t, n);
2389
+ let r = q(e, "__voltro.workflow.runs", t, n);
2367
2390
  return r.loading || r.idle || r.failed ? {
2368
2391
  ...r,
2369
2392
  runs: []
@@ -2372,7 +2395,7 @@ var Jn = () => {
2372
2395
  runs: r.data
2373
2396
  };
2374
2397
  }, cr = (e, t) => {
2375
- let n = J(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
2398
+ let n = q(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
2376
2399
  return n.loading || n.idle || n.failed ? {
2377
2400
  ...n,
2378
2401
  steps: []
@@ -2381,7 +2404,7 @@ var Jn = () => {
2381
2404
  steps: n.data
2382
2405
  };
2383
2406
  }, lr = (e, t) => {
2384
- let n = J(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
2407
+ let n = q(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
2385
2408
  return n.loading || n.idle || n.failed ? {
2386
2409
  ...n,
2387
2410
  events: []
@@ -2390,7 +2413,7 @@ var Jn = () => {
2390
2413
  events: n.data
2391
2414
  };
2392
2415
  }, ur = lr, dr = (e, t = {}, n = {}) => {
2393
- let r = J(e, "__voltro.workflow.domainEvents", t, n);
2416
+ let r = q(e, "__voltro.workflow.domainEvents", t, n);
2394
2417
  return r.loading || r.idle || r.failed ? {
2395
2418
  ...r,
2396
2419
  events: []
@@ -2399,7 +2422,7 @@ var Jn = () => {
2399
2422
  events: r.data
2400
2423
  };
2401
2424
  }, fr = (e, t) => {
2402
- let n = J(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
2425
+ let n = q(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
2403
2426
  return n.loading || n.idle || n.failed ? {
2404
2427
  ...n,
2405
2428
  deliveries: []
@@ -2451,22 +2474,22 @@ var Jn = () => {
2451
2474
  step: n?.stepName
2452
2475
  };
2453
2476
  }, vr = (e, t) => {
2454
- let n = or(e, t), r = cr(e, t), i = lr(e, t), a = rr(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = w(async () => {
2477
+ let n = or(e, t), r = cr(e, t), i = lr(e, t), a = rr(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = T(async () => {
2455
2478
  if (!o) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
2456
2479
  await a.cancel({
2457
2480
  workflowName: o.tag,
2458
2481
  executionId: o.executionId
2459
2482
  });
2460
- }, [a, o]), u = w(async () => {
2483
+ }, [a, o]), u = T(async () => {
2461
2484
  if (!o) throw Error("useWorkflowRunState: no run loaded — cannot resume");
2462
2485
  await a.resume({
2463
2486
  workflowName: o.tag,
2464
2487
  executionId: o.executionId
2465
2488
  });
2466
- }, [a, o]), d = w((e, n) => {
2489
+ }, [a, o]), d = T((e, n) => {
2467
2490
  if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot signal");
2468
2491
  return a.signal({ id: t }, e, n);
2469
- }, [a, t]), f = w((e, n, r) => {
2492
+ }, [a, t]), f = T((e, n, r) => {
2470
2493
  if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot update");
2471
2494
  return a.update({ id: t }, e, n, r);
2472
2495
  }, [a, t]);
@@ -2495,7 +2518,7 @@ var Jn = () => {
2495
2518
  f
2496
2519
  ]);
2497
2520
  }, yr = (e, t) => {
2498
- let { runtime: n, client: r } = K(e), [i, a] = k([]), [o, s] = k("idle"), [c, l] = k(void 0), u = O(null), d = w(() => {
2521
+ let { runtime: n, client: r } = G(e), [i, a] = k([]), [o, s] = k("idle"), [c, l] = k(void 0), u = O(null), d = T(() => {
2499
2522
  let e = u.current;
2500
2523
  e && (u.current = null, n.runFork(P.interrupt(e)), s((e) => e === "streaming" ? "idle" : e));
2501
2524
  }, [n]);
@@ -2503,15 +2526,15 @@ var Jn = () => {
2503
2526
  events: i,
2504
2527
  status: o,
2505
2528
  error: c,
2506
- start: w((e = {}) => {
2529
+ start: T((e = {}) => {
2507
2530
  let i = u.current;
2508
2531
  i && n.runFork(P.interrupt(i)), a([]), l(void 0), s("streaming");
2509
- let o = q(r, t)(e), c = L.runForEach(o, (e) => M.sync(() => a((t) => [...t, e]))).pipe(M.matchCause({
2532
+ let o = K(r, t)(e), c = R.runForEach(o, (e) => M.sync(() => a((t) => [...t, e]))).pipe(M.matchCause({
2510
2533
  onSuccess: () => {
2511
2534
  s("done");
2512
2535
  },
2513
2536
  onFailure: (e) => {
2514
- A.isInterruptedOnly(e) || (l(A.squash(e)), s("error"));
2537
+ j.isInterruptedOnly(e) || (l(j.squash(e)), s("error"));
2515
2538
  }
2516
2539
  }));
2517
2540
  u.current = n.runFork(c);
@@ -2525,36 +2548,40 @@ var Jn = () => {
2525
2548
  }, br = (e, t, n, r) => {
2526
2549
  let i = 0, a = !1, o = (e) => M.sync(() => {
2527
2550
  e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
2528
- }), s = (e, t, a) => {
2529
- let o = i > t ? 0 : e + 1;
2530
- if (o > r.maxReconnects) return M.sync(() => {
2551
+ }), s = (e) => {
2552
+ if (typeof e != "object" || !e) return;
2553
+ let t = e.name, n = e.message;
2554
+ if (typeof t == "string" || typeof n == "string") return `${typeof t == "string" ? t : ""}::${typeof n == "string" ? n : ""}`;
2555
+ }, c, l = (e, t, a) => {
2556
+ let o = i > t, l = o ? 0 : e + 1, d = a === void 0 ? void 0 : s(a), f = d !== void 0 && d === c && !o;
2557
+ if (c = o ? void 0 : d, f || l > r.maxReconnects) return M.sync(() => {
2531
2558
  n.onError(a ?? /* @__PURE__ */ Error("stream connection lost")), n.onStatus("error");
2532
2559
  });
2533
- let s = Math.min(r.maxBackoffMs, r.backoffMs * 2 ** Math.max(0, o - 1));
2560
+ let p = Math.min(r.maxBackoffMs, r.backoffMs * 2 ** Math.max(0, l - 1));
2534
2561
  return M.sync(() => {
2535
2562
  n.onStatus("reconnecting"), n.onReconnect();
2536
- }).pipe(M.zipRight(M.sleep(j.millis(s))), M.zipRight(M.sync(() => n.onStatus("streaming"))), M.zipRight(c(o)));
2537
- }, c = (r) => M.suspend(() => {
2538
- let c = i, l = e({
2563
+ }).pipe(M.zipRight(M.sleep(ie.millis(p))), M.zipRight(M.sync(() => n.onStatus("streaming"))), M.zipRight(u(l)));
2564
+ }, u = (r) => M.suspend(() => {
2565
+ let s = i, c = e({
2539
2566
  ...t,
2540
- fromSeq: c
2567
+ fromSeq: s
2541
2568
  });
2542
- return L.runForEach(l, o).pipe(M.matchCauseEffect({
2543
- onSuccess: () => a ? M.sync(() => n.onStatus("done")) : s(r, c, void 0),
2544
- onFailure: (e) => A.isInterruptedOnly(e) ? M.void : a ? M.sync(() => n.onStatus("done")) : s(r, c, A.squash(e))
2569
+ return R.runForEach(c, o).pipe(M.matchCauseEffect({
2570
+ onSuccess: () => a ? M.sync(() => n.onStatus("done")) : l(r, s, void 0),
2571
+ onFailure: (e) => j.isInterruptedOnly(e) ? M.void : a ? M.sync(() => n.onStatus("done")) : l(r, s, j.squash(e))
2545
2572
  }));
2546
2573
  });
2547
- return c(0);
2574
+ return u(0);
2548
2575
  }, xr = (e) => {
2549
2576
  let t = e?._tag;
2550
2577
  return t === "done" || t === "error";
2551
2578
  }, Sr = (e, t, n = {}) => {
2552
- let { runtime: r, client: i } = K(e), [a, o] = k([]), [s, c] = k("idle"), [l, u] = k(0), [d, f] = k(void 0), p = O(null), m = {
2579
+ let { runtime: r, client: i } = G(e), [a, o] = k([]), [s, c] = k("idle"), [l, u] = k(0), [d, f] = k(void 0), p = O(null), m = {
2553
2580
  maxReconnects: n.maxReconnects ?? 6,
2554
2581
  backoffMs: n.backoffMs ?? 400,
2555
2582
  maxBackoffMs: n.maxBackoffMs ?? 8e3,
2556
2583
  isTerminal: n.isTerminal ?? xr
2557
- }, h = w(() => {
2584
+ }, h = T(() => {
2558
2585
  let e = p.current;
2559
2586
  e && (p.current = null, r.runFork(P.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
2560
2587
  }, [r]);
@@ -2563,10 +2590,10 @@ var Jn = () => {
2563
2590
  status: s,
2564
2591
  reconnects: l,
2565
2592
  error: d,
2566
- start: w((e = {}) => {
2593
+ start: T((e = {}) => {
2567
2594
  let n = p.current;
2568
2595
  n && r.runFork(P.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
2569
- let a = q(i, t), s = {
2596
+ let a = K(i, t), s = {
2570
2597
  onEvent: (e) => o((t) => [...t, e]),
2571
2598
  onStatus: c,
2572
2599
  onReconnect: () => u((e) => e + 1),
@@ -2590,7 +2617,7 @@ var Jn = () => {
2590
2617
  if (n.role === "user" && n.content) return n.content;
2591
2618
  }
2592
2619
  }, Tr = (e, t, n) => {
2593
- let { threadId: r } = n, i = J(e, `${t}.messages`, { threadId: r }), a = _n(e, `${t}.send`), o = D(() => [...i.data ?? []].sort(Cr), [i.data]), s = w((e, t = {}) => a.run({
2620
+ let { threadId: r } = n, i = q(e, `${t}.messages`, { threadId: r }), a = _n(e, `${t}.send`), o = D(() => [...i.data ?? []].sort(Cr), [i.data]), s = T((e, t = {}) => a.run({
2594
2621
  threadId: r,
2595
2622
  order: i.data?.length ?? 0,
2596
2623
  prompt: e,
@@ -2599,7 +2626,7 @@ var Jn = () => {
2599
2626
  a,
2600
2627
  r,
2601
2628
  i.data
2602
- ]), c = w(() => {
2629
+ ]), c = T(() => {
2603
2630
  let e = wr(o);
2604
2631
  return e === void 0 ? void 0 : s(e);
2605
2632
  }, [o, s]);
@@ -2641,17 +2668,17 @@ var Jn = () => {
2641
2668
  history: s,
2642
2669
  status: r,
2643
2670
  error: i,
2644
- send: w((e = {}) => {
2671
+ send: T((e = {}) => {
2645
2672
  let t = e.message;
2646
2673
  l.current = typeof t == "string" ? t : "", a(e);
2647
2674
  }, [a]),
2648
2675
  cancel: o
2649
2676
  };
2650
2677
  }, Dr = (e, t) => {
2651
- let n = _n(e, t), [r, i] = k(void 0), a = w(async (e) => {
2678
+ let n = _n(e, t), [r, i] = k(void 0), a = T(async (e) => {
2652
2679
  let t = await n.run({ question: e });
2653
2680
  return i(t), t;
2654
- }, [n]), o = w(() => i(void 0), []);
2681
+ }, [n]), o = T(() => i(void 0), []);
2655
2682
  return D(() => ({
2656
2683
  ask: a,
2657
2684
  answer: r,
@@ -2666,18 +2693,22 @@ var Jn = () => {
2666
2693
  o
2667
2694
  ]);
2668
2695
  }, Or = (e) => {
2669
- let { cache: t, runtime: n } = K(e);
2670
- return w(() => {
2696
+ let { cache: t, runtime: n } = G(e);
2697
+ return T(() => {
2671
2698
  t.refreshAll(n);
2672
2699
  }, [t, n]);
2673
2700
  }, kr = (e) => e?._tag === "Unauthenticated", Ar = (e, t, n = {}) => {
2674
- let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0;
2701
+ let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0, c = e.on((e) => {
2702
+ if (!kr(e.error) || s >= i) return;
2703
+ let n = a();
2704
+ n - o < r || (o = n, s += 1, t());
2705
+ }), l = e.onSuccess(() => {
2706
+ s = 0;
2707
+ });
2675
2708
  return {
2676
- dispose: e.on((e) => {
2677
- if (!kr(e.error) || s >= i) return;
2678
- let n = a();
2679
- n - o < r || (o = n, s += 1, t());
2680
- }),
2709
+ dispose: () => {
2710
+ c(), l();
2711
+ },
2681
2712
  noteSuccess: () => {
2682
2713
  s = 0;
2683
2714
  }
@@ -2695,18 +2726,44 @@ var Jn = () => {
2695
2726
  ...t ? { context: t } : {}
2696
2727
  });
2697
2728
  }, Fr = (e, t) => {
2698
- let { errorBus: n } = K(e);
2729
+ let { errorBus: n } = G(e);
2699
2730
  E(() => n.on(t), [n, t]);
2700
- }, Ir = (e, t) => {
2731
+ }, Ir = {
2732
+ failed: [],
2733
+ healthy: !0
2734
+ }, Lr = (e) => {
2735
+ let { errorBus: t } = G(e), [n, r] = k(Ir);
2736
+ return E(() => {
2737
+ let e = /* @__PURE__ */ new Map(), n = () => {
2738
+ let t = [...e.values()].sort((e, t) => t.at - e.at);
2739
+ r(t.length === 0 ? Ir : {
2740
+ failed: t,
2741
+ healthy: !1
2742
+ });
2743
+ }, i = t.on((t) => {
2744
+ e.set(t.tag, {
2745
+ tag: t.tag,
2746
+ source: t.source,
2747
+ error: t.error,
2748
+ at: Date.now()
2749
+ }), n();
2750
+ }), a = t.onSuccess((t) => {
2751
+ e.delete(t.tag) && n();
2752
+ });
2753
+ return () => {
2754
+ i(), a();
2755
+ };
2756
+ }, [t]), n;
2757
+ }, Rr = (e, t) => {
2701
2758
  let n = globalThis, r = Symbol.for(`@voltro/web/context:${e}`), i = n[r];
2702
2759
  if (i) return i;
2703
- let a = S(t);
2760
+ let a = C(t);
2704
2761
  return n[r] = a, a;
2705
- }, Lr = Ir("serverRequest", null), Rr = () => T(Lr), zr = ({ value: e, children: t }) => /* @__PURE__ */ fe(Lr.Provider, {
2762
+ }, zr = Rr("serverRequest", null), Br = () => te(zr), Vr = ({ value: e, children: t }) => /* @__PURE__ */ de(zr.Provider, {
2706
2763
  value: e,
2707
2764
  children: t
2708
- }), Br = (e) => {
2709
- let t = Rr();
2765
+ }), Hr = (e) => {
2766
+ let t = Br();
2710
2767
  return D(() => {
2711
2768
  if (t !== null) return t.formFlash?.formKey === e ? t.formFlash : void 0;
2712
2769
  if (typeof document > "u") return;
@@ -2718,13 +2775,13 @@ var Jn = () => {
2718
2775
  return;
2719
2776
  }
2720
2777
  }, [t, e]);
2721
- }, Vr = (e, t, n) => e.map((e) => {
2778
+ }, Ur = (e, t, n) => e.map((e) => {
2722
2779
  let r = String(e[n] ?? ""), i = e[t];
2723
2780
  return {
2724
2781
  value: r,
2725
2782
  label: i == null ? r : String(i)
2726
2783
  };
2727
- }), Hr = (e, t, n = {}) => {
2784
+ }), Wr = (e, t, n = {}) => {
2728
2785
  let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] = k(n.initialTerm ?? ""), [l, u] = k(s);
2729
2786
  E(() => {
2730
2787
  if (s === l) return;
@@ -2735,24 +2792,24 @@ var Jn = () => {
2735
2792
  l,
2736
2793
  r
2737
2794
  ]);
2738
- let d = n.skipUntilTerm === !0 && l.trim() === "", f = J(e, t, D(() => o(l), [o, l]), { skip: d }), p = D(() => Vr(f.data ?? [], i, a), [
2795
+ let d = n.skipUntilTerm === !0 && l.trim() === "", f = q(e, t, D(() => o(l), [o, l]), { skip: d }), p = D(() => Ur(f.data ?? [], i, a), [
2739
2796
  f.data,
2740
2797
  i,
2741
2798
  a
2742
- ]), m = w((e) => c(e), []);
2799
+ ]), m = T((e) => c(e), []);
2743
2800
  return {
2744
2801
  options: p,
2745
2802
  loading: !d && f.data === void 0,
2746
2803
  term: s,
2747
2804
  search: m
2748
2805
  };
2749
- }, Ur = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Wr = (t, n, r = {}) => {
2750
- let i = K(t), [a, o] = k(r.pageSize), s = J(t, n, D(() => a === void 0 ? r.input ?? {} : {
2806
+ }, Gr = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Kr = (t, n, r = {}) => {
2807
+ let i = G(t), [a, o] = k(r.pageSize), s = q(t, n, D(() => a === void 0 ? r.input ?? {} : {
2751
2808
  ...r.input,
2752
2809
  limit: a
2753
- }, [r.input, a])), c = i.descriptors[n]?.output, l = w(() => {
2810
+ }, [r.input, a])), c = i.descriptors[n]?.output, l = T(() => {
2754
2811
  r.pageSize !== void 0 && o((e) => (e ?? r.pageSize) + r.pageSize);
2755
- }, [r.pageSize]), u = D(() => r.columns ?? (c === void 0 ? [] : e(c)), [r.columns, c]), [d, f] = k(r.initialSort), p = w((e) => {
2812
+ }, [r.pageSize]), u = D(() => r.columns ?? (c === void 0 ? [] : e(c)), [r.columns, c]), [d, f] = k(r.initialSort), p = T((e) => {
2756
2813
  f((t) => t?.column === e ? {
2757
2814
  column: e,
2758
2815
  direction: t.direction === "asc" ? "desc" : "asc"
@@ -2767,7 +2824,7 @@ var Jn = () => {
2767
2824
  let e = s.data ?? [];
2768
2825
  if (d === void 0) return e;
2769
2826
  let t = d.direction === "asc" ? 1 : -1;
2770
- return [...e].sort((e, n) => Ur(e[d.column], n[d.column]) * t);
2827
+ return [...e].sort((e, n) => Gr(e[d.column], n[d.column]) * t);
2771
2828
  }, [s.data, d]),
2772
2829
  loading: s.data === void 0,
2773
2830
  error: s.error,
@@ -2776,14 +2833,14 @@ var Jn = () => {
2776
2833
  loadMore: l,
2777
2834
  hasMore: a !== void 0 && (s.data?.length ?? 0) >= a
2778
2835
  };
2779
- }, Gr = (e, t, n, r) => {
2836
+ }, qr = (e, t, n, r) => {
2780
2837
  let i = e.replace(/\/$/, ""), a = new URLSearchParams({
2781
2838
  table: t,
2782
2839
  id: n
2783
2840
  });
2784
2841
  return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
2785
- }, Kr = Gr, qr = (e, t, n, r) => {
2786
- let { inspectBaseUrl: i } = K(e), [a, o] = k({
2842
+ }, Jr = qr, Yr = (e, t, n, r) => {
2843
+ let { inspectBaseUrl: i } = G(e), [a, o] = k({
2787
2844
  data: void 0,
2788
2845
  loading: !0,
2789
2846
  error: void 0
@@ -2795,7 +2852,7 @@ var Jn = () => {
2795
2852
  loading: !0,
2796
2853
  error: void 0
2797
2854
  });
2798
- let a = Gr(i ?? "", t, n, r);
2855
+ let a = qr(i ?? "", t, n, r);
2799
2856
  return fetch(a).then(async (e) => {
2800
2857
  if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
2801
2858
  return await e.json();
@@ -2821,12 +2878,12 @@ var Jn = () => {
2821
2878
  n,
2822
2879
  r
2823
2880
  ]), a;
2824
- }, Jr = "admin:full", Yr = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), Xr = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), Zr = S({ scopes: [] });
2825
- function Qr(e) {
2826
- return C(Zr.Provider, { value: { scopes: e.scopes } }, e.children);
2881
+ }, Xr = "admin:full", Zr = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), Qr = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), $r = C({ scopes: [] });
2882
+ function ei(e) {
2883
+ return w($r.Provider, { value: { scopes: e.scopes } }, e.children);
2827
2884
  }
2828
- var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes, e), ni = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, ri = (e) => {
2829
- let { inspectBaseUrl: t } = K(e), [n, r] = k({
2885
+ var ti = () => te($r), ni = (e) => Zr(ti().scopes, e), ri = (e) => Qr(ti().scopes, e), ii = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, ai = (e) => {
2886
+ let { inspectBaseUrl: t } = G(e), [n, r] = k({
2830
2887
  manifest: void 0,
2831
2888
  loading: !0,
2832
2889
  error: void 0
@@ -2837,7 +2894,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2837
2894
  manifest: void 0,
2838
2895
  loading: !0,
2839
2896
  error: void 0
2840
- }), fetch(ni(t ?? "")).then(async (e) => {
2897
+ }), fetch(ii(t ?? "")).then(async (e) => {
2841
2898
  if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
2842
2899
  return await e.json();
2843
2900
  }).then((t) => {
@@ -2856,7 +2913,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2856
2913
  e = !0;
2857
2914
  };
2858
2915
  }, [e, t]), n;
2859
- }, ii = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), ai = (e, t) => {
2916
+ }, oi = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), si = (e, t) => {
2860
2917
  if (e === void 0) return "unknown";
2861
2918
  if (t.includes("admin:full") || e.length === 0) return "allowed";
2862
2919
  let n = !1;
@@ -2865,7 +2922,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2865
2922
  n = !0;
2866
2923
  continue;
2867
2924
  }
2868
- if (!ii(t, r)) {
2925
+ if (!oi(t, r)) {
2869
2926
  if (r.resourceScoped) {
2870
2927
  n = !0;
2871
2928
  continue;
@@ -2874,13 +2931,13 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2874
2931
  }
2875
2932
  }
2876
2933
  return n ? "unknown" : "allowed";
2877
- }, oi = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), si = (e) => {
2934
+ }, ci = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), li = (e) => {
2878
2935
  for (let t of e ?? []) if (t.kind === "open") return t.reason;
2879
- }, ci = (e) => ai(e, $r().scopes), li = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, ui = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, di = (e) => e === void 0 ? {} : {
2936
+ }, ui = (e) => si(e, ti().scopes), di = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, fi = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, pi = (e) => e === void 0 ? {} : {
2880
2937
  tag: e.tag,
2881
2938
  ...e.guards === void 0 ? {} : { guards: e.guards }
2882
- }, fi = (e) => e.tables.filter((e) => !e.framework).map((t) => {
2883
- let n = e.procedures.find((e) => e.kind === "query" && li(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && ui(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && ui(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && ui(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
2939
+ }, mi = (e) => e.tables.filter((e) => !e.framework).map((t) => {
2940
+ let n = e.procedures.find((e) => e.kind === "query" && di(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && fi(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && fi(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && fi(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
2884
2941
  return {
2885
2942
  table: t.name,
2886
2943
  columns: t.columns.filter((e) => e.serverOnly !== !0),
@@ -2889,18 +2946,18 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2889
2946
  reactive: t.reactive,
2890
2947
  ...o === void 0 ? {} : { pkColumn: o },
2891
2948
  editable: (t.editable ?? !0) && o !== void 0,
2892
- list: di(n),
2893
- create: di(r),
2894
- update: di(i),
2895
- delete: di(a)
2949
+ list: pi(n),
2950
+ create: pi(r),
2951
+ update: pi(i),
2952
+ delete: pi(a)
2896
2953
  };
2897
- }), pi = (e) => {
2898
- let [t, n] = k([]), [r, i] = k([]), a = w((e) => {
2954
+ }), hi = (e) => {
2955
+ let [t, n] = k([]), [r, i] = k([]), a = T((e) => {
2899
2956
  n((t) => [...t, e]), i([]);
2900
- }, []), o = w(async () => {
2957
+ }, []), o = T(async () => {
2901
2958
  let r = t[t.length - 1];
2902
2959
  r !== void 0 && r.blockedBy === void 0 && (await e.onUndo(r.invocationId), n((e) => e.slice(0, -1)), i((e) => [...e, r]));
2903
- }, [t, e]), s = w(async () => {
2960
+ }, [t, e]), s = T(async () => {
2904
2961
  let t = r[r.length - 1];
2905
2962
  t !== void 0 && (await e.onRedo(t.invocationId), i((e) => e.slice(0, -1)), n((e) => [...e, t]));
2906
2963
  }, [r, e]);
@@ -2922,14 +2979,14 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2922
2979
  o,
2923
2980
  s
2924
2981
  ]);
2925
- }, mi = "__voltro.undo.log", hi = "__voltro.undo.apply", gi = "__voltro.undo.redo", _i = (e, t) => {
2926
- let n = t?.limit, { data: r } = J(e, mi, n === void 0 ? {} : { limit: n }), i = Z(e, hi), a = Z(e, gi), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = w(async (e) => {
2982
+ }, gi = "__voltro.undo.log", _i = "__voltro.undo.apply", vi = "__voltro.undo.redo", yi = (e, t) => {
2983
+ let n = t?.limit, { data: r } = q(e, gi, n === void 0 ? {} : { limit: n }), i = Z(e, _i), a = Z(e, vi), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = T(async (e) => {
2927
2984
  await i.mutate({ invocationId: e });
2928
- }, [i]), u = w(async (e) => {
2985
+ }, [i]), u = T(async (e) => {
2929
2986
  await a.mutate({ invocationId: e });
2930
- }, [a]), d = w(async () => {
2987
+ }, [a]), d = T(async () => {
2931
2988
  s && await l(s.id);
2932
- }, [s, l]), f = w(async () => {
2989
+ }, [s, l]), f = T(async () => {
2933
2990
  c && await u(c.id);
2934
2991
  }, [c, u]);
2935
2992
  return {
@@ -2942,21 +2999,21 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2942
2999
  undoLast: d,
2943
3000
  redoLast: f
2944
3001
  };
2945
- }, vi = (e, t) => ({
3002
+ }, bi = (e, t) => ({
2946
3003
  name: e,
2947
3004
  map: t
2948
- }), yi = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), bi = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), xi = (e, t, n) => {
3005
+ }), xi = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), Si = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), Ci = (e, t, n) => {
2949
3006
  let r = { ...t };
2950
3007
  for (let [i, a] of Object.entries(e.map)) {
2951
- if (bi.has(i) || a === void 0) continue;
3008
+ if (Si.has(i) || a === void 0) continue;
2952
3009
  let e = t[i];
2953
3010
  r[i] = (...r) => {
2954
- let i = yi(a, t);
3011
+ let i = xi(a, t);
2955
3012
  if (i !== null && n(i), typeof e == "function") return e(...r);
2956
3013
  };
2957
3014
  }
2958
3015
  return r;
2959
- }, Si = (e, t, n) => {
3016
+ }, wi = (e, t, n) => {
2960
3017
  let r = O({
2961
3018
  spec: e,
2962
3019
  props: t,
@@ -2967,46 +3024,46 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
2967
3024
  props: t,
2968
3025
  sink: n
2969
3026
  }, E(() => {
2970
- let e = r.current, t = yi(e.spec.map.onMount, e.props);
3027
+ let e = r.current, t = xi(e.spec.map.onMount, e.props);
2971
3028
  return t !== null && e.sink(t), () => {
2972
- let e = r.current, t = yi(e.spec.map.onUnmount, e.props);
3029
+ let e = r.current, t = xi(e.spec.map.onUnmount, e.props);
2973
3030
  t !== null && e.sink(t);
2974
3031
  };
2975
- }, []), D(() => xi(e, t, n), [
3032
+ }, []), D(() => Ci(e, t, n), [
2976
3033
  e,
2977
3034
  t,
2978
3035
  n
2979
3036
  ]);
2980
- }, Ci = (e, t) => {
2981
- let n = K(e).descriptors[t]?.input;
3037
+ }, Ti = (e, t) => {
3038
+ let n = G(e).descriptors[t]?.input;
2982
3039
  return D(() => n === void 0 ? [] : x(n), [n]);
2983
- }, wi = (t, n) => {
2984
- let r = K(t).descriptors[n]?.output;
3040
+ }, Ei = (t, n) => {
3041
+ let r = G(t).descriptors[n]?.output;
2985
3042
  return D(() => r === void 0 ? [] : e(r), [r]);
2986
- }, Ti = (e, t) => {
3043
+ }, Di = (e, t) => {
2987
3044
  if (e === t) return !0;
2988
3045
  if (e.length !== t.length) return !1;
2989
3046
  for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
2990
3047
  return !0;
2991
- }, Ei = (e) => Object.keys(e).sort().map((t) => e[t]), Di = (e, t) => {
2992
- let n = O(null), r = Ei(e);
2993
- return (n.current === null || !Ti(n.current.key, r)) && (n.current = {
3048
+ }, Oi = (e) => Object.keys(e).sort().map((t) => e[t]), ki = (e, t) => {
3049
+ let n = O(null), r = Oi(e);
3050
+ return (n.current === null || !Di(n.current.key, r)) && (n.current = {
2994
3051
  key: r,
2995
3052
  value: t(e)
2996
3053
  }), n.current.value;
2997
- }, Oi = (e, t, n, r = {}) => {
2998
- let i = J(e, t, { ...n }, r);
3054
+ }, Ai = (e, t, n, r = {}) => {
3055
+ let i = q(e, t, { ...n }, r);
2999
3056
  return D(() => ({
3000
3057
  allowed: i.data?.allowed === !0,
3001
3058
  pending: i.data === void 0
3002
3059
  }), [i.data]);
3003
- }, ki = (e, t, n, r = {}) => {
3004
- let i = J(e, t, { ...n }, r);
3060
+ }, ji = (e, t, n, r = {}) => {
3061
+ let i = q(e, t, { ...n }, r);
3005
3062
  return D(() => ({
3006
3063
  allowedIds: new Set(i.data?.allowedIds ?? []),
3007
3064
  pending: i.data === void 0
3008
3065
  }), [i.data]);
3009
- }, Ai = (e) => {
3066
+ }, Mi = (e) => {
3010
3067
  switch (e) {
3011
3068
  case "select":
3012
3069
  case "radio":
@@ -3022,26 +3079,26 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3022
3079
  case "switch": return "boolean";
3023
3080
  default: return null;
3024
3081
  }
3025
- }, ji = (e) => x(e).map((e) => {
3082
+ }, Ni = (e) => x(e).map((e) => {
3026
3083
  if (e.name.includes(".")) return null;
3027
- let t = Ai(e.widget);
3084
+ let t = Mi(e.widget);
3028
3085
  return t === null ? null : {
3029
3086
  name: e.name,
3030
3087
  label: e.label,
3031
3088
  kind: t,
3032
3089
  ...e.options ? { options: e.options } : {}
3033
3090
  };
3034
- }).filter((e) => e !== null), Mi = (e) => {
3091
+ }).filter((e) => e !== null), Pi = (e) => {
3035
3092
  let t = {};
3036
3093
  for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
3037
3094
  return t;
3038
- }, Ni = (e, t, n = {}) => {
3039
- let r = K(e).descriptors[t]?.input, i = D(() => r === void 0 ? [] : ji(r), [r]), [a, o] = k(n.initial ?? {}), s = w((e, t) => {
3040
- o((n) => Mi({
3095
+ }, Fi = (e, t, n = {}) => {
3096
+ let r = G(e).descriptors[t]?.input, i = D(() => r === void 0 ? [] : Ni(r), [r]), [a, o] = k(n.initial ?? {}), s = T((e, t) => {
3097
+ o((n) => Pi({
3041
3098
  ...n,
3042
3099
  [e]: t
3043
3100
  }));
3044
- }, []), c = w(() => o({}), []), l = J(e, t, D(() => Mi(a), [a]));
3101
+ }, []), c = T(() => o({}), []), l = q(e, t, D(() => Pi(a), [a]));
3045
3102
  return {
3046
3103
  filters: i,
3047
3104
  values: a,
@@ -3052,20 +3109,20 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3052
3109
  loading: l.data === void 0,
3053
3110
  error: l.error
3054
3111
  };
3055
- }, Pi = (e, t, n = {}) => {
3056
- let r = J(e, t, n), i = r.data;
3112
+ }, Ii = (e, t, n = {}) => {
3113
+ let r = q(e, t, n), i = r.data;
3057
3114
  return {
3058
3115
  record: Array.isArray(i) ? i[0] : i,
3059
3116
  loading: i === void 0,
3060
3117
  error: r.error
3061
3118
  };
3062
- }, Fi = (e, t = 300) => {
3119
+ }, Li = (e, t = 300) => {
3063
3120
  let [n, r] = k(e);
3064
3121
  return E(() => {
3065
3122
  let n = setTimeout(() => r(e), t);
3066
3123
  return () => clearTimeout(n);
3067
3124
  }, [e, t]), n;
3068
- }, Ii = (e) => {
3125
+ }, Ri = (e) => {
3069
3126
  let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
3070
3127
  if (a && t.trim() === "") return {
3071
3128
  status: "idle",
@@ -3083,39 +3140,39 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3083
3140
  valid: o.valid,
3084
3141
  message: o.message
3085
3142
  };
3086
- }, Li = (e, t, n, r) => {
3087
- let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Fi(n, o), l = s && c.trim() === "", u = J(e, t, D(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
3088
- return Ii({
3143
+ }, zi = (e, t, n, r) => {
3144
+ let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Li(n, o), l = s && c.trim() === "", u = q(e, t, D(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
3145
+ return Ri({
3089
3146
  value: n,
3090
3147
  debouncedValue: c,
3091
3148
  data: l ? null : u.data,
3092
3149
  interpret: a,
3093
3150
  skipEmpty: s
3094
3151
  });
3095
- }, Ri = (e, t) => ({
3152
+ }, Bi = (e, t) => ({
3096
3153
  name: e,
3097
3154
  payload: t
3098
- }), zi = (e, t) => {
3099
- let n = oe.decodeUnknownEither(e.payload, { errors: "all" })(t);
3155
+ }), Vi = (e, t) => {
3156
+ let n = ae.decodeUnknownEither(e.payload, { errors: "all" })(t);
3100
3157
  if (n._tag === "Right") return {
3101
3158
  valid: !0,
3102
3159
  errors: {}
3103
3160
  };
3104
3161
  let r = {};
3105
- for (let e of he.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
3162
+ for (let e of me.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
3106
3163
  return {
3107
3164
  valid: !1,
3108
3165
  errors: r
3109
3166
  };
3110
- }, Bi = (e) => {
3167
+ }, Hi = (e) => {
3111
3168
  let t = new Map(e.map((e) => [e.name, e]));
3112
3169
  return {
3113
3170
  names: [...t.keys()].sort(),
3114
3171
  get: (e) => t.get(e),
3115
3172
  events: e
3116
3173
  };
3117
- }, Vi = (e, t) => {
3118
- let n = Bi(e);
3174
+ }, Ui = (e, t) => {
3175
+ let n = Hi(e);
3119
3176
  return {
3120
3177
  track: (e, r) => {
3121
3178
  let i = n.get(e);
@@ -3124,7 +3181,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3124
3181
  return;
3125
3182
  }
3126
3183
  if (process.env.NODE_ENV !== "production") {
3127
- let t = zi(i, r);
3184
+ let t = Vi(i, r);
3128
3185
  t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
3129
3186
  }
3130
3187
  t({
@@ -3135,47 +3192,47 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3135
3192
  names: n.names,
3136
3193
  catalog: n
3137
3194
  };
3138
- }, Hi = (e, t) => {
3195
+ }, Wi = (e, t) => {
3139
3196
  let n = _n(e, t);
3140
3197
  return {
3141
- preview: w((e) => n.run(e), [n]),
3198
+ preview: T((e) => n.run(e), [n]),
3142
3199
  diff: n.lastResult,
3143
3200
  pending: n.pending,
3144
3201
  error: n.error
3145
3202
  };
3146
- }, Ui = (e, t, n, r) => [...e, {
3203
+ }, Gi = (e, t, n, r) => [...e, {
3147
3204
  id: t,
3148
3205
  tag: n,
3149
3206
  input: r,
3150
3207
  status: "pending",
3151
3208
  attempts: 0
3152
- }], Wi = (e, t, n) => e.map((e) => e.id === t ? {
3209
+ }], Ki = (e, t, n) => e.map((e) => e.id === t ? {
3153
3210
  ...e,
3154
3211
  ...n
3155
- } : e), Gi = (e, t) => Wi(e, t, { status: "sent" }), Ki = (e, t, n) => e.map((e) => e.id === t ? {
3212
+ } : e), qi = (e, t) => Ki(e, t, { status: "sent" }), Ji = (e, t, n) => e.map((e) => e.id === t ? {
3156
3213
  ...e,
3157
3214
  status: "failed",
3158
3215
  error: n,
3159
3216
  attempts: e.attempts + 1
3160
- } : e), qi = (e, t, n) => Wi(e, t, {
3217
+ } : e), Yi = (e, t, n) => Ki(e, t, {
3161
3218
  status: "conflict",
3162
3219
  error: n
3163
- }), Ji = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
3220
+ }), Xi = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
3164
3221
  ...e,
3165
3222
  input: n,
3166
3223
  status: "pending",
3167
3224
  error: void 0
3168
- } : e), Yi = (e) => e.filter((e) => e.status !== "sent"), Xi = (e) => {
3225
+ } : e), Zi = (e) => e.filter((e) => e.status !== "sent"), Qi = (e) => {
3169
3226
  let t = [];
3170
3227
  for (let n of e) {
3171
3228
  if (n.status === "conflict") break;
3172
3229
  (n.status === "pending" || n.status === "failed") && t.push(n);
3173
3230
  }
3174
3231
  return t;
3175
- }, Zi = (e) => {
3232
+ }, $i = (e) => {
3176
3233
  let t = e;
3177
3234
  return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
3178
- }, Qi = (e) => {
3235
+ }, ea = (e) => {
3179
3236
  let [t, n] = k(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
3180
3237
  return E(() => {
3181
3238
  if (e !== void 0) {
@@ -3188,8 +3245,8 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3188
3245
  window.removeEventListener("online", t), window.removeEventListener("offline", r);
3189
3246
  };
3190
3247
  }, [e]), t;
3191
- }, $i = (e) => {
3192
- let { send: t, persistence: n, isConflict: r = Zi, idFor: i } = e, [a, o] = k([]), s = Qi(e.online), c = O(a);
3248
+ }, ta = (e) => {
3249
+ let { send: t, persistence: n, isConflict: r = $i, idFor: i } = e, [a, o] = k([]), s = ea(e.online), c = O(a);
3193
3250
  c.current = a;
3194
3251
  let l = O(0), u = O(Math.random().toString(36).slice(2, 8)), d = O(n === void 0);
3195
3252
  E(() => {
@@ -3203,27 +3260,27 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3203
3260
  e = !0;
3204
3261
  };
3205
3262
  }, [n]), E(() => {
3206
- n === void 0 || !d.current || n.save(Yi(a)).catch(() => {});
3263
+ n === void 0 || !d.current || n.save(Zi(a)).catch(() => {});
3207
3264
  }, [n, a]);
3208
- let f = w((e, t) => {
3265
+ let f = T((e, t) => {
3209
3266
  let n = i?.() ?? `obx_${u.current}_${l.current++}_${e}`;
3210
- o((r) => Ui(r, n, e, t));
3211
- }, [i]), p = w(async () => {
3212
- for (let e of Xi(c.current)) try {
3213
- await t(e), o((t) => Gi(t, e.id));
3267
+ o((r) => Gi(r, n, e, t));
3268
+ }, [i]), p = T(async () => {
3269
+ for (let e of Qi(c.current)) try {
3270
+ await t(e), o((t) => qi(t, e.id));
3214
3271
  } catch (t) {
3215
3272
  if (r(t)) {
3216
- o((n) => qi(n, e.id, t));
3273
+ o((n) => Yi(n, e.id, t));
3217
3274
  break;
3218
3275
  }
3219
- o((n) => Ki(n, e.id, t));
3276
+ o((n) => Ji(n, e.id, t));
3220
3277
  }
3221
3278
  }, [t, r]);
3222
3279
  E(() => {
3223
3280
  s && p();
3224
3281
  }, [s, p]);
3225
- let m = w((e, t) => {
3226
- let n = Ji(c.current, e, t);
3282
+ let m = T((e, t) => {
3283
+ let n = Xi(c.current, e, t);
3227
3284
  c.current = n, o(n), s && p();
3228
3285
  }, [s, p]);
3229
3286
  return {
@@ -3235,7 +3292,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3235
3292
  conflicts: a.filter((e) => e.status === "conflict"),
3236
3293
  resolveConflict: m
3237
3294
  };
3238
- }, ea = (e) => {
3295
+ }, na = (e) => {
3239
3296
  let { scrollTop: t, viewportHeight: n, rowHeight: r, overscan: i = 5, total: a } = e, o = r > 0 ? r : 1, s = Math.max(0, Math.floor(t / o)), c = Math.ceil(n / o), l = Math.max(0, s - i), u = s + c + i, d = a === void 0 ? u : Math.min(u, a);
3240
3297
  return {
3241
3298
  startIndex: l,
@@ -3245,8 +3302,8 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3245
3302
  topSpacer: l * r,
3246
3303
  bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
3247
3304
  };
3248
- }, ta = (e, t, n) => {
3249
- let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = k(0), u = D(() => ea({
3305
+ }, ra = (e, t, n) => {
3306
+ let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = k(0), u = D(() => na({
3250
3307
  scrollTop: c,
3251
3308
  viewportHeight: i,
3252
3309
  rowHeight: r,
@@ -3258,7 +3315,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3258
3315
  r,
3259
3316
  a,
3260
3317
  o
3261
- ]), d = J(e, t, D(() => ({
3318
+ ]), d = q(e, t, D(() => ({
3262
3319
  ...s,
3263
3320
  offset: u.offset,
3264
3321
  limit: u.limit
@@ -3266,7 +3323,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3266
3323
  s,
3267
3324
  u.offset,
3268
3325
  u.limit
3269
- ])), f = w((e) => {
3326
+ ])), f = T((e) => {
3270
3327
  l(e.currentTarget.scrollTop);
3271
3328
  }, []);
3272
3329
  return {
@@ -3278,8 +3335,8 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3278
3335
  loading: d.data === void 0,
3279
3336
  error: d.error
3280
3337
  };
3281
- }, na = () => typeof navigator > "u" || navigator.onLine, ra = (e) => {
3282
- let { errorBus: t } = K(e), [n, r] = k(na), [i, a] = k(0), [o, s] = k(void 0), c = O(!0);
3338
+ }, ia = () => typeof navigator > "u" || navigator.onLine, aa = (e) => {
3339
+ let { errorBus: t } = G(e), [n, r] = k(ia), [i, a] = k(0), [o, s] = k(void 0), c = O(!0);
3283
3340
  E(() => (c.current = !0, () => {
3284
3341
  c.current = !1;
3285
3342
  }), []), E(() => {
@@ -3295,7 +3352,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3295
3352
  c.current && (a((e) => e + 1), s(Date.now()));
3296
3353
  });
3297
3354
  }, [t]);
3298
- let l = w(() => {
3355
+ let l = T(() => {
3299
3356
  a(0);
3300
3357
  }, []);
3301
3358
  return {
@@ -3305,7 +3362,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3305
3362
  lastFailureAt: o,
3306
3363
  reportSuccess: l
3307
3364
  };
3308
- }, ia = "__voltro.connections.list", aa = "__voltro.connections.start", oa = "__voltro.connections.submitToken", sa = "__voltro.connections.disconnect", ca = {
3365
+ }, oa = "__voltro.connections.list", sa = "__voltro.connections.start", ca = "__voltro.connections.submitToken", la = "__voltro.connections.disconnect", ua = {
3309
3366
  connectionId: "",
3310
3367
  kind: "oauth2",
3311
3368
  label: "",
@@ -3316,14 +3373,14 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3316
3373
  expiresAt: null,
3317
3374
  lastError: null,
3318
3375
  connectedAt: null
3319
- }, la = (e, t) => {
3376
+ }, da = (e, t) => {
3320
3377
  if (t === "redirect") {
3321
3378
  globalThis.location.assign(e);
3322
3379
  return;
3323
3380
  }
3324
3381
  globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
3325
- }, ua = (e) => {
3326
- let { data: t } = J(e, ia, {}), n = _n(e, aa), r = Z(e, oa), i = Z(e, sa), a = t ?? [], o = n.pending || r.pending || i.pending, s = w((e) => ({
3382
+ }, fa = (e) => {
3383
+ let { data: t } = q(e, oa, {}), n = _n(e, sa), r = Z(e, ca), i = Z(e, la), a = t ?? [], o = n.pending || r.pending || i.pending, s = T((e) => ({
3327
3384
  ...e,
3328
3385
  connected: e.status === "connected",
3329
3386
  needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
@@ -3331,7 +3388,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3331
3388
  connect: async (t) => {
3332
3389
  if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
3333
3390
  let r = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
3334
- la((await n.run({
3391
+ da((await n.run({
3335
3392
  connectionId: e.connectionId,
3336
3393
  redirectTo: r
3337
3394
  })).authorizeUrl, t?.mode);
@@ -3351,7 +3408,7 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3351
3408
  n,
3352
3409
  r,
3353
3410
  i
3354
- ]), c = w((e) => {
3411
+ ]), c = T((e) => {
3355
3412
  let t = a.find((t) => t.connectionId === e);
3356
3413
  return t === void 0 ? void 0 : s(t);
3357
3414
  }, [a, s]);
@@ -3361,10 +3418,10 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3361
3418
  get: c,
3362
3419
  pending: o
3363
3420
  };
3364
- }, da = (e, t) => {
3365
- let n = ua(e), r = n.get(t);
3421
+ }, pa = (e, t) => {
3422
+ let n = fa(e), r = n.get(t);
3366
3423
  return D(() => r === void 0 ? {
3367
- ...ca,
3424
+ ...ua,
3368
3425
  connectionId: t,
3369
3426
  label: t,
3370
3427
  connected: !1,
@@ -3389,6 +3446,6 @@ var $r = () => T(Zr), ei = (e) => Yr($r().scopes, e), ti = (e) => Xr($r().scopes
3389
3446
  n.loading,
3390
3447
  n.pending
3391
3448
  ]);
3392
- }, fa = "framework-client";
3449
+ }, ma = "framework-client";
3393
3450
  //#endregion
3394
- export { Jr as ADMIN_SCOPE, fa as CLIENT_NAME, ia as CONNECTIONS_LIST_TAG, sa as CONNECTION_DISCONNECT_TAG, aa as CONNECTION_START_TAG, oa as CONNECTION_SUBMIT_TOKEN_TAG, v as FORM_FLASH_SCRIPT_ID, p as FORM_KEY_FIELD, g as FORM_PATH_PREFIX, u as FORM_REDIRECT_FIELD, On as FormBindingProvider, je as FrameworkRuntimesContext, $e as FrameworkRuntimesProvider, ke as LoadingSubscriptionCache, Qr as PermissionProvider, _ as RICH_TEXT_MARKS, a as RICH_TEXT_MAX_NODES, d as RichTextDocument, Ae as RpcErrorBus, Lr as ServerRequestContext, zr as ServerRequestProvider, Oe as SubscriptionCache, hi as UNDO_APPLY_TAG, mi as UNDO_LOG_TAG, gi as UNDO_REDO_TAG, yn as ValidationMessagesProvider, We as _resetFrameworkRuntimesWarning, ze as _resetSsrDescriptors, Bn as applyPreloadSeeds, Bt as applyStoreSeeds, qe as buildApiRuntime, Yr as canCall, Xr as canCallAny, Qt as clearMutations, Yi as clearSent, bt as clearStoreHistory, ea as computeWindow, Vi as createAnalytics, Mn as createHooks, ai as decideAccess, c as decodeFieldIssues, Ri as defineEvent, Ft as defineStore, vi as defineTracking, Pt as definedStores, fi as deriveEntityAdmins, n as documentLocale, y as emptyRichTextDocument, Ui as enqueueEntry, Bi as eventCatalog, ji as filtersFromSchema, r as formActionPath, m as formDataToInput, ee as formField, t as formSections, cn as freshIdempotencyKey, nn as getMutationNotifier, Xt as getMutations, Ir as globalContext, o as isRichTextDocument, s as isSafeHref, kr as isUnauthenticated, Ke as isUnresolvedApi, Nn as makePreloadSeedBag, Lt as makeStoreSeedBag, ni as manifestUrl, qi as markConflict, Ki as markFailed, Gi as markSent, si as openAccessReason, h as parseRichText, Kr as provenanceUrl, Mr as publishClientError, _e as publishClientTrace, Hn as readPreloadedSeedOutcome, Vn as readPreloadedSnapshot, Le as registerSsrDescriptors, Xi as replayable, Pr as reportClientError, oi as requiredScopes, Un as resetPreloadSeeds, It as resetStoreRegistryForTests, at as resetStoreStorageForTest, q as resolveByTag, Ji as resolveConflictEntry, it as resolveStoreStorage, yi as resolveTrackingEvent, b as resolveValidationMessage, te as restrictToSchema, br as resumableConsumeProgram, f as richTextToPlainText, Vr as rowsToOptions, Yn as runSequence, e as schemaToColumns, x as schemaToFields, Rn as seedPreloadedSubscription, zn as seedPreloadedSubscriptionFailure, zt as seedStore, Jn as sequence, l as serializeRichText, tn as setMutationNotifier, Fn as setPreloadSeedResolver, Rt as setStoreSeedResolver, rt as setStoreStorage, Yt as settleMutation, ot as shallow, Ti as shallowArrayEqual, Ei as sourceValues, Ne as ssrClientProxy, Re as ssrDescriptorsFor, Be as ssrStubHandle, B as stableKey, Qe as startApiSupervisor, Jt as startMutation, vt as storeHistory, Nr as subscribeClientErrors, ve as subscribeClientTraces, Zt as subscribeMutations, yt as subscribeStoreHistory, xe as supersedesConfirmedPatches, xt as travelToStoreState, ci as useAccessDecision, _n as useAction, Er as useAgent, Tr as useAgentChat, yr as useAgentStream, Li as useAsyncValidation, ei as useCan, ti as useCanAny, ri as useCapabilityManifest, da as useConnection, ra as useConnectionStatus, ua as useConnections, Dr as useDataCopilot, Wr as useDataTable, Fi as useDebounced, Di as useDerived, qn as useEvent, Dn as useFormBinding, kn as useFormBindingContext, An as useFormField, Br as useFormFlash, Ci as useFormSkeleton, K as useFrameworkApi, Ge as useFrameworkRuntimes, Z as useMutation, Fr as useOnRpcError, $i as useOutbox, $r as usePermissions, Wn as usePreloadedSubscription, Hi as usePreview, qr as useProvenance, Hr as useQueryField, Ni as useQueryFilters, Pi as useRecord, Or as useRefreshSubscriptions, Oi as useResourceCan, ki as useResourceCans, Sr as useResumableAgentStream, Xn as useSequence, Rr as useServerRequest, J as useSubscription, wi as useTableSkeleton, Si as useTracking, pi as useUndo, _i as useUndoLog, nr as useUpload, bn as useValidationMessages, ta as useWindowedSubscription, rr as useWorkflow, dr as useWorkflowDomainEvents, fr as useWorkflowEventDeliveries, ur as useWorkflowEvents, or as useWorkflowRun, lr as useWorkflowRunEvents, vr as useWorkflowRunState, cr as useWorkflowRunSteps, sr as useWorkflowRuns, ir as useWorkflowSignal, ar as useWorkflowUpdate, zi as validateEventPayload, i as validateFields, Ii as validationStatus, Ar as wireAuthRefresh, ln as withIdempotencyKey, xi as wrapTrackedCallbacks };
3451
+ export { Xr as ADMIN_SCOPE, ma as CLIENT_NAME, oa as CONNECTIONS_LIST_TAG, la as CONNECTION_DISCONNECT_TAG, sa as CONNECTION_START_TAG, ca as CONNECTION_SUBMIT_TOKEN_TAG, v as FORM_FLASH_SCRIPT_ID, p as FORM_KEY_FIELD, g as FORM_PATH_PREFIX, u as FORM_REDIRECT_FIELD, On as FormBindingProvider, Me as FrameworkRuntimesContext, et as FrameworkRuntimesProvider, Ae as LoadingSubscriptionCache, ei as PermissionProvider, _ as RICH_TEXT_MARKS, a as RICH_TEXT_MAX_NODES, d as RichTextDocument, je as RpcErrorBus, zr as ServerRequestContext, Vr as ServerRequestProvider, ke as SubscriptionCache, _i as UNDO_APPLY_TAG, gi as UNDO_LOG_TAG, vi as UNDO_REDO_TAG, yn as ValidationMessagesProvider, Ge as _resetFrameworkRuntimesWarning, Be as _resetSsrDescriptors, Bn as applyPreloadSeeds, Vt as applyStoreSeeds, Je as buildApiRuntime, Zr as canCall, Qr as canCallAny, en as clearMutations, Zi as clearSent, xt as clearStoreHistory, na as computeWindow, Ui as createAnalytics, Mn as createHooks, si as decideAccess, c as decodeFieldIssues, Bi as defineEvent, It as defineStore, bi as defineTracking, Ft as definedStores, mi as deriveEntityAdmins, n as documentLocale, y as emptyRichTextDocument, Gi as enqueueEntry, Hi as eventCatalog, Ni as filtersFromSchema, r as formActionPath, m as formDataToInput, S as formField, t as formSections, un as freshIdempotencyKey, an as getMutationNotifier, Qt as getMutations, Rr as globalContext, o as isRichTextDocument, s as isSafeHref, kr as isUnauthenticated, qe as isUnresolvedApi, Nn as makePreloadSeedBag, Rt as makeStoreSeedBag, ii as manifestUrl, Yi as markConflict, Ji as markFailed, qi as markSent, li as openAccessReason, h as parseRichText, Jr as provenanceUrl, Mr as publishClientError, he as publishClientTrace, Hn as readPreloadedSeedOutcome, Vn as readPreloadedSnapshot, Re as registerSsrDescriptors, Qi as replayable, Pr as reportClientError, ci as requiredScopes, Un as resetPreloadSeeds, Lt as resetStoreRegistryForTests, ot as resetStoreStorageForTest, K as resolveByTag, Xi as resolveConflictEntry, at as resolveStoreStorage, xi as resolveTrackingEvent, b as resolveValidationMessage, ee as restrictToSchema, br as resumableConsumeProgram, f as richTextToPlainText, Ur as rowsToOptions, Yn as runSequence, e as schemaToColumns, x as schemaToFields, Rn as seedPreloadedSubscription, zn as seedPreloadedSubscriptionFailure, Bt as seedStore, Jn as sequence, l as serializeRichText, rn as setMutationNotifier, Fn as setPreloadSeedResolver, zt as setStoreSeedResolver, it as setStoreStorage, Zt as settleMutation, st as shallow, Di as shallowArrayEqual, Oi as sourceValues, Pe as ssrClientProxy, ze as ssrDescriptorsFor, Ve as ssrStubHandle, H as stableKey, $e as startApiSupervisor, Xt as startMutation, yt as storeHistory, Nr as subscribeClientErrors, ge as subscribeClientTraces, $t as subscribeMutations, bt as subscribeStoreHistory, ye as supersedesConfirmedPatches, St as travelToStoreState, ui as useAccessDecision, _n as useAction, Er as useAgent, Tr as useAgentChat, yr as useAgentStream, zi as useAsyncValidation, ni as useCan, ri as useCanAny, ai as useCapabilityManifest, pa as useConnection, aa as useConnectionStatus, fa as useConnections, Dr as useDataCopilot, Kr as useDataTable, Li as useDebounced, ki as useDerived, qn as useEvent, Dn as useFormBinding, kn as useFormBindingContext, An as useFormField, Hr as useFormFlash, Ti as useFormSkeleton, G as useFrameworkApi, Ke as useFrameworkRuntimes, Z as useMutation, Fr as useOnRpcError, ta as useOutbox, ti as usePermissions, Wn as usePreloadedSubscription, Wi as usePreview, Yr as useProvenance, Wr as useQueryField, Fi as useQueryFilters, Ii as useRecord, Or as useRefreshSubscriptions, Ai as useResourceCan, ji as useResourceCans, Sr as useResumableAgentStream, Xn as useSequence, Br as useServerRequest, q as useSubscription, Lr as useSubscriptionHealth, Ei as useTableSkeleton, wi as useTracking, hi as useUndo, yi as useUndoLog, nr as useUpload, bn as useValidationMessages, ra as useWindowedSubscription, rr as useWorkflow, dr as useWorkflowDomainEvents, fr as useWorkflowEventDeliveries, ur as useWorkflowEvents, or as useWorkflowRun, lr as useWorkflowRunEvents, vr as useWorkflowRunState, cr as useWorkflowRunSteps, sr as useWorkflowRuns, ir as useWorkflowSignal, ar as useWorkflowUpdate, Vi as validateEventPayload, i as validateFields, Ri as validationStatus, Ar as wireAuthRefresh, dn as withIdempotencyKey, Ci as wrapTrackedCallbacks };