cogsbox-state 0.5.485 → 0.5.487

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/CogsState.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as Q, Fragment as Te } from "react/jsx-runtime";
2
+ import { jsx as Q, Fragment as Pe } from "react/jsx-runtime";
3
3
  import { pluginStore as R } from "./pluginStore.js";
4
4
  import { useState as ne, useRef as q, useCallback as Ie, useEffect as Z, useLayoutEffect as re, useMemo as Ae, createElement as Se, startTransition as ke } from "react";
5
5
  import { transformStateFunc as De, isFunction as L, isDeepEqual as X, isArray as Ce, getDifferences as _e } from "./utility.js";
@@ -11,15 +11,15 @@ import { useCogsConfig as Me } from "./CogsStateClient.js";
11
11
  import { runValidation as ze } from "./validation.js";
12
12
  const {
13
13
  getInitialOptions: j,
14
- updateInitialStateGlobal: be,
15
- getShadowMetadata: V,
14
+ updateInitialStateGlobal: Ve,
15
+ getShadowMetadata: E,
16
16
  setShadowMetadata: W,
17
17
  getShadowValue: C,
18
18
  initializeShadowState: K,
19
19
  initializeAndMergeShadowState: Re,
20
20
  updateShadowAtPath: Le,
21
21
  insertShadowArrayElement: We,
22
- insertManyShadowArrayElements: Ve,
22
+ insertManyShadowArrayElements: be,
23
23
  removeShadowArrayElement: Be,
24
24
  setInitialStateOptions: ye,
25
25
  setServerStateUpdate: me,
@@ -35,7 +35,7 @@ const {
35
35
  removePluginMetaData: we
36
36
  } = p.getState(), { notifyUpdate: Ye } = R.getState();
37
37
  function F(e, n, l) {
38
- const i = V(e, n);
38
+ const i = E(e, n);
39
39
  if (!!!i?.arrayKeys)
40
40
  return { isArray: !1, value: p.getState().getShadowValue(e, n), keys: [] };
41
41
  const u = n.length > 0 ? n.join(".") : "root", h = l?.arrayViews?.[u] ?? i.arrayKeys;
@@ -65,21 +65,21 @@ function fe({
65
65
  const i = j(e) || {}, f = l[e] || {};
66
66
  let u = { ...f, ...i }, h = !1;
67
67
  if (n) {
68
- const y = (t, o) => {
68
+ const m = (t, o) => {
69
69
  for (const d in o)
70
- o.hasOwnProperty(d) && (o[d] instanceof Object && !Array.isArray(o[d]) && t[d] instanceof Object ? X(t[d], o[d]) || (y(t[d], o[d]), h = !0) : t[d] !== o[d] && (t[d] = o[d], h = !0));
70
+ o.hasOwnProperty(d) && (o[d] instanceof Object && !Array.isArray(o[d]) && t[d] instanceof Object ? X(t[d], o[d]) || (m(t[d], o[d]), h = !0) : t[d] !== o[d] && (t[d] = o[d], h = !0));
71
71
  return t;
72
72
  };
73
- u = y(u, n);
73
+ u = m(u, n);
74
74
  }
75
75
  if (u.validation && (n?.validation?.hasOwnProperty("onBlur") || i?.validation?.hasOwnProperty("onBlur") || f?.validation?.hasOwnProperty("onBlur") || (u.validation.onBlur = "error", h = !0)), h) {
76
76
  ye(e, u);
77
- const y = u.validation?.zodSchemaV4, t = u.validation?.zodSchemaV3;
78
- (y !== i?.validation?.zodSchemaV4 || t !== i?.validation?.zodSchemaV3) && (y || t) && (y ? H(e, y, "zod4") : t && H(e, t, "zod3"), U(e));
77
+ const m = u.validation?.zodSchemaV4, t = u.validation?.zodSchemaV3;
78
+ (m !== i?.validation?.zodSchemaV4 || t !== i?.validation?.zodSchemaV3) && (m || t) && (m ? H(e, m, "zod4") : t && H(e, t, "zod3"), U(e));
79
79
  }
80
80
  return u;
81
81
  }
82
- const Vt = (e, n) => {
82
+ const bt = (e, n) => {
83
83
  n?.plugins && R.getState().setRegisteredPlugins(n.plugins);
84
84
  const l = {};
85
85
  if (n?.plugins)
@@ -92,29 +92,29 @@ const Vt = (e, n) => {
92
92
  onBlur: "error",
93
93
  ...n?.validation
94
94
  };
95
- const E = j(o), b = E ? {
96
- ...E,
95
+ const $ = j(o), V = $ ? {
96
+ ...$,
97
97
  formElements: n?.formElements,
98
98
  validation: {
99
- ...E.validation,
99
+ ...$.validation,
100
100
  ...d.validation
101
101
  }
102
102
  } : d;
103
- Object.keys(b).length > 0 && ye(o, b);
103
+ Object.keys(V).length > 0 && ye(o, V);
104
104
  }), Object.keys(f).forEach((o) => {
105
105
  K(o, f[o]);
106
106
  });
107
107
  const h = (o, d) => {
108
- const [E] = ne(d?.componentId ?? ae()), b = fe({
108
+ const [$] = ne(d?.componentId ?? ae()), V = fe({
109
109
  stateKey: o,
110
110
  options: d,
111
111
  initialOptionsPart: u
112
- }), $ = q(b);
113
- $.current = b;
112
+ }), T = q(V);
113
+ T.current = V;
114
114
  const v = C(o, []) || f[o], _ = ct(v, {
115
115
  stateKey: o,
116
116
  syncUpdate: d?.syncUpdate,
117
- componentId: E,
117
+ componentId: $,
118
118
  localStorage: d?.localStorage,
119
119
  middleware: d?.middleware,
120
120
  reactiveType: d?.reactiveType,
@@ -128,28 +128,28 @@ const Vt = (e, n) => {
128
128
  }, [o, d]), re(() => (R.getState().registerStateHandler(o, _), () => {
129
129
  R.getState().unregisterStateHandler(o);
130
130
  }), [o, _]), re(() => {
131
- const T = j(o)?.validation;
132
- T?.zodSchemaV4 ? H(o, T.zodSchemaV4, "zod4") : T?.zodSchemaV3 && H(o, T.zodSchemaV3, "zod3");
131
+ const P = j(o)?.validation;
132
+ P?.zodSchemaV4 ? H(o, P.zodSchemaV4, "zod4") : P?.zodSchemaV3 && H(o, P.zodSchemaV3, "zod3");
133
133
  }), _;
134
134
  };
135
- function y(o, d) {
135
+ function m(o, d) {
136
136
  if (fe({ stateKey: o, options: d, initialOptionsPart: u }), d.localStorage && Xe(o, d), d.formElements) {
137
- const b = R.getState().registeredPlugins.map(($) => d.formElements.hasOwnProperty($.name) ? {
138
- ...$,
139
- formWrapper: d.formElements[$.name]
140
- } : $);
141
- R.getState().setRegisteredPlugins(b);
137
+ const V = R.getState().registeredPlugins.map((T) => d.formElements.hasOwnProperty(T.name) ? {
138
+ ...T,
139
+ formWrapper: d.formElements[T.name]
140
+ } : T);
141
+ R.getState().setRegisteredPlugins(V);
142
142
  }
143
143
  U(o);
144
144
  }
145
145
  function t(o) {
146
- Object.keys(f).forEach((E) => {
147
- y(E, o);
146
+ Object.keys(f).forEach(($) => {
147
+ m($, o);
148
148
  });
149
149
  }
150
150
  return {
151
151
  useCogsState: h,
152
- setCogsOptionsByKey: y,
152
+ setCogsOptionsByKey: m,
153
153
  setCogsOptions: t
154
154
  };
155
155
  }, Ze = (e, n, l, i, f) => {
@@ -162,15 +162,15 @@ const Vt = (e, n) => {
162
162
  const u = L(l?.localStorage?.key) ? l.localStorage?.key(e) : l?.localStorage?.key;
163
163
  if (u && i) {
164
164
  const h = `${i}-${n}-${u}`;
165
- let y;
165
+ let m;
166
166
  try {
167
- y = ce(h)?.lastSyncedWithServer;
167
+ m = ce(h)?.lastSyncedWithServer;
168
168
  } catch {
169
169
  }
170
- const t = V(n, []), o = {
170
+ const t = E(n, []), o = {
171
171
  state: e,
172
172
  lastUpdated: Date.now(),
173
- lastSyncedWithServer: y,
173
+ lastSyncedWithServer: m,
174
174
  stateSource: t?.stateSource,
175
175
  baseServerState: t?.baseServerState
176
176
  }, d = Fe.serialize(o);
@@ -205,7 +205,7 @@ const Vt = (e, n) => {
205
205
  }
206
206
  return !1;
207
207
  }, U = (e) => {
208
- const n = V(e, []);
208
+ const n = E(e, []);
209
209
  if (!n) return;
210
210
  const l = /* @__PURE__ */ new Set();
211
211
  n?.components?.forEach((i) => {
@@ -215,16 +215,16 @@ const Vt = (e, n) => {
215
215
  });
216
216
  };
217
217
  function oe(e, n, l, i) {
218
- const f = V(e, n);
218
+ const f = E(e, n);
219
219
  if (W(e, n, {
220
220
  ...f,
221
221
  isDirty: !1,
222
222
  stateSource: "server",
223
223
  lastServerSync: i || Date.now()
224
224
  }), Array.isArray(l)) {
225
- const u = V(e, n);
226
- u?.arrayKeys && u.arrayKeys.forEach((h, y) => {
227
- const t = [...n, h], o = l[y];
225
+ const u = E(e, n);
226
+ u?.arrayKeys && u.arrayKeys.forEach((h, m) => {
227
+ const t = [...n, h], o = l[m];
228
228
  o !== void 0 && oe(
229
229
  e,
230
230
  t,
@@ -233,8 +233,8 @@ function oe(e, n, l, i) {
233
233
  );
234
234
  });
235
235
  } else l && typeof l == "object" && l.constructor === Object && Object.keys(l).forEach((u) => {
236
- const h = [...n, u], y = l[u];
237
- oe(e, h, y, i);
236
+ const h = [...n, u], m = l[u];
237
+ oe(e, h, m, i);
238
238
  });
239
239
  }
240
240
  let ie = [], ge = !1;
@@ -249,45 +249,45 @@ function et(e, n) {
249
249
  if (!u) return;
250
250
  const h = Array.from(u.childNodes);
251
251
  if (!h[i]) return;
252
- let y = n;
252
+ let m = n;
253
253
  if (f && n !== null)
254
254
  try {
255
- y = new Function("state", `return (${f})(state)`)(
255
+ m = new Function("state", `return (${f})(state)`)(
256
256
  n
257
257
  );
258
258
  } catch (t) {
259
259
  console.error("Error evaluating effect function:", t);
260
260
  }
261
- y !== null && typeof y == "object" && (y = JSON.stringify(y)), h[i].textContent = String(y ?? "");
261
+ m !== null && typeof m == "object" && (m = JSON.stringify(m)), h[i].textContent = String(m ?? "");
262
262
  });
263
263
  }
264
264
  function tt(e, n, l) {
265
- const i = V(e, []);
265
+ const i = E(e, []);
266
266
  if (!i?.components)
267
267
  return /* @__PURE__ */ new Set();
268
268
  const f = /* @__PURE__ */ new Set();
269
269
  if (l.type === "update") {
270
270
  let u = [...n];
271
271
  for (; ; ) {
272
- const h = V(e, u);
273
- if (h?.pathComponents && h.pathComponents.forEach((y) => {
274
- const t = i.components?.get(y);
272
+ const h = E(e, u);
273
+ if (h?.pathComponents && h.pathComponents.forEach((m) => {
274
+ const t = i.components?.get(m);
275
275
  t && ((Array.isArray(t.reactiveType) ? t.reactiveType : [t.reactiveType || "component"]).includes("none") || f.add(t));
276
276
  }), u.length === 0) break;
277
277
  u.pop();
278
278
  }
279
- l.newValue && typeof l.newValue == "object" && !Ce(l.newValue) && _e(l.newValue, l.oldValue).forEach((y) => {
280
- const t = y.split("."), o = [...n, ...t], d = V(e, o);
281
- d?.pathComponents && d.pathComponents.forEach((E) => {
282
- const b = i.components?.get(E);
283
- b && ((Array.isArray(b.reactiveType) ? b.reactiveType : [b.reactiveType || "component"]).includes("none") || f.add(b));
279
+ l.newValue && typeof l.newValue == "object" && !Ce(l.newValue) && _e(l.newValue, l.oldValue).forEach((m) => {
280
+ const t = m.split("."), o = [...n, ...t], d = E(e, o);
281
+ d?.pathComponents && d.pathComponents.forEach(($) => {
282
+ const V = i.components?.get($);
283
+ V && ((Array.isArray(V.reactiveType) ? V.reactiveType : [V.reactiveType || "component"]).includes("none") || f.add(V));
284
284
  });
285
285
  });
286
286
  } else if (l.type === "insert" || l.type === "cut" || l.type === "insert_many") {
287
287
  let h = [...l.type === "insert" ? n : n.slice(0, -1)];
288
288
  for (; ; ) {
289
- const y = V(e, h);
290
- if (y?.pathComponents && y.pathComponents.forEach((t) => {
289
+ const m = E(e, h);
290
+ if (m?.pathComponents && m.pathComponents.forEach((t) => {
291
291
  const o = i.components?.get(t);
292
292
  o && f.add(o);
293
293
  }), h.length === 0) break;
@@ -301,7 +301,7 @@ function rt(e, n, l) {
301
301
  if (X(i, f))
302
302
  return null;
303
303
  Le(e, n, f), se(e, n, { bubble: !0 });
304
- const u = V(e, n);
304
+ const u = E(e, n);
305
305
  return {
306
306
  type: "update",
307
307
  oldValue: i,
@@ -310,8 +310,8 @@ function rt(e, n, l) {
310
310
  };
311
311
  }
312
312
  function nt(e, n, l) {
313
- Ve(e, n, l), se(e, n, { bubble: !0 });
314
- const i = V(e, n);
313
+ be(e, n, l), se(e, n, { bubble: !0 });
314
+ const i = E(e, n);
315
315
  return {
316
316
  type: "insert_many",
317
317
  count: l.length,
@@ -334,12 +334,12 @@ function at(e, n, l, i, f) {
334
334
  f
335
335
  );
336
336
  se(e, n, { bubble: !0 });
337
- const y = V(e, n);
337
+ const m = E(e, n);
338
338
  let t;
339
- return y?.arrayKeys && i !== void 0 && i > 0 && (t = y.arrayKeys[i - 1]), {
339
+ return m?.arrayKeys && i !== void 0 && i > 0 && (t = m.arrayKeys[i - 1]), {
340
340
  type: "insert",
341
341
  newValue: u,
342
- shadowMeta: y,
342
+ shadowMeta: m,
343
343
  path: n,
344
344
  itemId: h,
345
345
  insertAfterId: t
@@ -361,8 +361,8 @@ function it() {
361
361
  f.stateKey,
362
362
  f.path,
363
363
  f
364
- ).forEach((y) => {
365
- e.add(y);
364
+ ).forEach((m) => {
365
+ e.add(m);
366
366
  });
367
367
  }
368
368
  l.length > 0 && xe(l), n.forEach(({ shadowMeta: i, displayValue: f }) => {
@@ -375,9 +375,9 @@ function st(e, n, l) {
375
375
  return (f, u, h) => {
376
376
  i(e, u, f, h);
377
377
  };
378
- function i(f, u, h, y) {
378
+ function i(f, u, h, m) {
379
379
  let t;
380
- switch (y.updateType) {
380
+ switch (m.updateType) {
381
381
  case "update":
382
382
  t = rt(f, u, h);
383
383
  break;
@@ -386,8 +386,8 @@ function st(e, n, l) {
386
386
  f,
387
387
  u,
388
388
  h,
389
- y.index,
390
- y.itemId
389
+ m.index,
390
+ m.itemId
391
391
  );
392
392
  break;
393
393
  case "insert_many":
@@ -404,20 +404,20 @@ function st(e, n, l) {
404
404
  timeStamp: Date.now(),
405
405
  stateKey: f,
406
406
  path: u,
407
- updateType: y.updateType,
407
+ updateType: m.updateType,
408
408
  status: "new",
409
409
  oldValue: t.oldValue,
410
410
  newValue: t.newValue ?? null,
411
411
  itemId: t.itemId,
412
412
  insertAfterId: t.insertAfterId,
413
- metaData: y.metaData
413
+ metaData: m.metaData
414
414
  };
415
415
  ie.push(o), t.newValue !== void 0 && Ze(
416
416
  t.newValue,
417
417
  f,
418
418
  l.current,
419
419
  n
420
- ), l.current?.middleware && l.current.middleware({ update: o }), ze(o, y.validationTrigger || "programmatic"), Ye(o);
420
+ ), l.current?.middleware && l.current.middleware({ update: o }), ze(o, m.validationTrigger || "programmatic"), Ye(o);
421
421
  }
422
422
  }
423
423
  function ct(e, {
@@ -427,34 +427,34 @@ function ct(e, {
427
427
  reactiveDeps: f,
428
428
  reactiveType: u,
429
429
  componentId: h,
430
- defaultState: y,
430
+ defaultState: m,
431
431
  dependencies: t,
432
432
  serverState: o
433
433
  } = {}) {
434
- const [d, E] = ne({}), { sessionId: b } = Me();
435
- let $ = !n;
436
- const [v] = ne(n ?? ae()), _ = q(h ?? ae()), T = q(
434
+ const [d, $] = ne({}), { sessionId: V } = Me();
435
+ let T = !n;
436
+ const [v] = ne(n ?? ae()), _ = q(h ?? ae()), P = q(
437
437
  null
438
438
  );
439
- T.current = j(v) ?? null;
439
+ P.current = j(v) ?? null;
440
440
  const x = Ie(
441
- (I) => {
442
- const r = I ? { ...j(v), ...I } : j(v), a = r?.defaultState || y || e;
441
+ (k) => {
442
+ const r = k ? { ...j(v), ...k } : j(v), a = r?.defaultState || m || e;
443
443
  if (r?.serverState?.status === "success" && r?.serverState?.data !== void 0)
444
444
  return {
445
445
  value: r.serverState.data,
446
446
  source: "server",
447
447
  timestamp: r.serverState.timestamp || Date.now()
448
448
  };
449
- if (r?.localStorage?.key && b) {
450
- const S = L(r.localStorage.key) ? r.localStorage.key(a) : r.localStorage.key, c = ce(
451
- `${b}-${v}-${S}`
449
+ if (r?.localStorage?.key && V) {
450
+ const S = L(r.localStorage.key) ? r.localStorage.key(a) : r.localStorage.key, s = ce(
451
+ `${V}-${v}-${S}`
452
452
  );
453
- if (c && c.lastUpdated > (r?.serverState?.timestamp || 0))
453
+ if (s && s.lastUpdated > (r?.serverState?.timestamp || 0))
454
454
  return {
455
- value: c.state,
455
+ value: s.state,
456
456
  source: "localStorage",
457
- timestamp: c.lastUpdated
457
+ timestamp: s.lastUpdated
458
458
  };
459
459
  }
460
460
  return {
@@ -463,31 +463,31 @@ function ct(e, {
463
463
  timestamp: Date.now()
464
464
  };
465
465
  },
466
- [v, y, e, b]
466
+ [v, m, e, V]
467
467
  );
468
468
  Z(() => {
469
469
  o && o.status === "success" && o.data !== void 0 && me(v, o);
470
- }, [o, v]), Z(() => p.getState().subscribeToPath(v, (k) => {
471
- if (k?.type === "SERVER_STATE_UPDATE") {
472
- const r = k.serverState;
470
+ }, [o, v]), Z(() => p.getState().subscribeToPath(v, (D) => {
471
+ if (D?.type === "SERVER_STATE_UPDATE") {
472
+ const r = D.serverState;
473
473
  if (r?.status !== "success" || r.data === void 0)
474
474
  return;
475
475
  ue(v, { serverState: r });
476
- const a = typeof r.merge == "object" ? r.merge : r.merge === !0 ? { strategy: "append", key: "id" } : null, s = C(v, []), S = r.data;
477
- if (a && a.strategy === "append" && "key" in a && Array.isArray(s) && Array.isArray(S)) {
478
- const c = a.key;
479
- if (!c) {
476
+ const a = typeof r.merge == "object" ? r.merge : r.merge === !0 ? { strategy: "append", key: "id" } : null, c = C(v, []), S = r.data;
477
+ if (a && a.strategy === "append" && "key" in a && Array.isArray(c) && Array.isArray(S)) {
478
+ const s = a.key;
479
+ if (!s) {
480
480
  console.error(
481
481
  "CogsState: Merge strategy 'append' requires a 'key' field."
482
482
  );
483
483
  return;
484
484
  }
485
- const m = new Set(
486
- s.map((M) => M[c])
485
+ const y = new Set(
486
+ c.map((M) => M[s])
487
487
  ), w = S.filter(
488
- (M) => !m.has(M[c])
488
+ (M) => !y.has(M[s])
489
489
  );
490
- w.length > 0 && Ve(v, [], w);
490
+ w.length > 0 && be(v, [], w);
491
491
  const A = C(v, []);
492
492
  oe(
493
493
  v,
@@ -505,108 +505,108 @@ function ct(e, {
505
505
  U(v);
506
506
  }
507
507
  }), [v]), Z(() => {
508
- const I = p.getState().getShadowMetadata(v, []);
509
- if (I && I.stateSource)
508
+ const k = p.getState().getShadowMetadata(v, []);
509
+ if (k && k.stateSource)
510
510
  return;
511
- const k = j(v), r = {
512
- localStorageEnabled: !!k?.localStorage?.key
511
+ const D = j(v), r = {
512
+ localStorageEnabled: !!D?.localStorage?.key
513
513
  };
514
514
  if (W(v, [], {
515
- ...I,
515
+ ...k,
516
516
  features: r
517
- }), k?.defaultState !== void 0 || y !== void 0) {
518
- const m = k?.defaultState || y;
519
- k?.defaultState || ue(v, {
520
- defaultState: m
517
+ }), D?.defaultState !== void 0 || m !== void 0) {
518
+ const y = D?.defaultState || m;
519
+ D?.defaultState || ue(v, {
520
+ defaultState: y
521
521
  });
522
522
  }
523
- const { value: a, source: s, timestamp: S } = x();
523
+ const { value: a, source: c, timestamp: S } = x();
524
524
  K(v, a);
525
- const c = j(v)?.validation;
526
- c?.zodSchemaV4 ? H(v, c.zodSchemaV4, "zod4") : c?.zodSchemaV3 && H(v, c.zodSchemaV3, "zod3"), W(v, [], {
527
- stateSource: s,
528
- lastServerSync: s === "server" ? S : void 0,
529
- isDirty: s === "server" ? !1 : void 0,
530
- baseServerState: s === "server" ? a : void 0
531
- }), s === "server" && o && me(v, o), U(v);
525
+ const s = j(v)?.validation;
526
+ s?.zodSchemaV4 ? H(v, s.zodSchemaV4, "zod4") : s?.zodSchemaV3 && H(v, s.zodSchemaV3, "zod3"), W(v, [], {
527
+ stateSource: c,
528
+ lastServerSync: c === "server" ? S : void 0,
529
+ isDirty: c === "server" ? !1 : void 0,
530
+ baseServerState: c === "server" ? a : void 0
531
+ }), c === "server" && o && me(v, o), U(v);
532
532
  }, [v, ...t || []]), re(() => {
533
- $ && ue(v, {
533
+ T && ue(v, {
534
534
  formElements: i,
535
- defaultState: y,
535
+ defaultState: m,
536
536
  localStorage: l,
537
- middleware: T.current?.middleware
537
+ middleware: P.current?.middleware
538
538
  });
539
- const I = `${v}////${_.current}`, k = V(v, []), r = k?.components || /* @__PURE__ */ new Map();
540
- return r.set(I, {
541
- forceUpdate: () => E({}),
539
+ const k = `${v}////${_.current}`, D = E(v, []), r = D?.components || /* @__PURE__ */ new Map();
540
+ return r.set(k, {
541
+ forceUpdate: () => $({}),
542
542
  reactiveType: u ?? ["component"],
543
543
  paths: /* @__PURE__ */ new Set(),
544
544
  depsFunction: f || void 0,
545
545
  deps: f ? f(C(v, [])) : [],
546
546
  prevDeps: f ? f(C(v, [])) : []
547
547
  }), W(v, [], {
548
- ...k,
548
+ ...D,
549
549
  components: r
550
- }), E({}), () => {
551
- const a = V(v, []), s = a?.components?.get(I);
552
- s?.paths && s.paths.forEach((S) => {
553
- const m = S.split(".").slice(1), w = p.getState().getShadowMetadata(v, m);
554
- w?.pathComponents && w.pathComponents.size === 0 && (delete w.pathComponents, p.getState().setShadowMetadata(v, m, w));
550
+ }), $({}), () => {
551
+ const a = E(v, []), c = a?.components?.get(k);
552
+ c?.paths && c.paths.forEach((S) => {
553
+ const y = S.split(".").slice(1), w = p.getState().getShadowMetadata(v, y);
554
+ w?.pathComponents && w.pathComponents.size === 0 && (delete w.pathComponents, p.getState().setShadowMetadata(v, y, w));
555
555
  }), a?.components && W(v, [], a);
556
556
  };
557
557
  }, []);
558
558
  const G = st(
559
559
  v,
560
- b,
561
- T
560
+ V,
561
+ P
562
562
  );
563
- return p.getState().initialStateGlobal[v] || be(v, e), Ae(() => Pe(
563
+ return p.getState().initialStateGlobal[v] || Ve(v, e), Ae(() => Te(
564
564
  v,
565
565
  G,
566
566
  _.current,
567
- b
568
- ), [v, b]);
567
+ V
568
+ ), [v, V]);
569
569
  }
570
570
  const lt = (e, n, l) => {
571
- let i = V(e, n)?.arrayKeys || [];
571
+ let i = E(e, n)?.arrayKeys || [];
572
572
  const f = l?.transforms;
573
573
  if (!f || f.length === 0)
574
574
  return i;
575
575
  for (const u of f)
576
576
  if (u.type === "filter") {
577
577
  const h = [];
578
- i.forEach((y, t) => {
579
- const o = C(e, [...n, y]);
580
- u.fn(o, t) && h.push(y);
578
+ i.forEach((m, t) => {
579
+ const o = C(e, [...n, m]);
580
+ u.fn(o, t) && h.push(m);
581
581
  }), i = h;
582
- } else u.type === "sort" && i.sort((h, y) => {
583
- const t = C(e, [...n, h]), o = C(e, [...n, y]);
582
+ } else u.type === "sort" && i.sort((h, m) => {
583
+ const t = C(e, [...n, h]), o = C(e, [...n, m]);
584
584
  return u.fn(t, o);
585
585
  });
586
586
  return i;
587
587
  }, te = (e, n, l) => {
588
- const i = `${e}////${n}`, u = V(e, [])?.components?.get(i);
588
+ const i = `${e}////${n}`, u = E(e, [])?.components?.get(i);
589
589
  !u || u.reactiveType === "none" || !(Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType]).includes("component") || Ge(e, l, i);
590
590
  }, Y = (e, n, l) => {
591
- const i = V(e, []), f = /* @__PURE__ */ new Set();
592
- i?.components && i.components.forEach((h, y) => {
593
- (Array.isArray(h.reactiveType) ? h.reactiveType : [h.reactiveType || "component"]).includes("all") && (h.forceUpdate(), f.add(y));
594
- }), V(e, [
591
+ const i = E(e, []), f = /* @__PURE__ */ new Set();
592
+ i?.components && i.components.forEach((h, m) => {
593
+ (Array.isArray(h.reactiveType) ? h.reactiveType : [h.reactiveType || "component"]).includes("all") && (h.forceUpdate(), f.add(m));
594
+ }), E(e, [
595
595
  ...n,
596
596
  "getSelected"
597
597
  ])?.pathComponents?.forEach((h) => {
598
598
  i?.components?.get(h)?.forceUpdate();
599
599
  });
600
- const u = V(e, n);
600
+ const u = E(e, n);
601
601
  for (let h of u?.arrayKeys || []) {
602
- const y = h + ".selected", t = V(e, y.split(".").slice(1));
602
+ const m = h + ".selected", t = E(e, m.split(".").slice(1));
603
603
  h == l && t?.pathComponents?.forEach((o) => {
604
604
  i?.components?.get(o)?.forceUpdate();
605
605
  });
606
606
  }
607
607
  };
608
608
  function N(e, n, l) {
609
- const i = V(e, n), f = n.length > 0 ? n.join(".") : "root", u = l?.arrayViews?.[f];
609
+ const i = E(e, n), f = n.length > 0 ? n.join(".") : "root", u = l?.arrayViews?.[f];
610
610
  if (Array.isArray(u) && u.length === 0)
611
611
  return {
612
612
  shadowMeta: i,
@@ -646,29 +646,29 @@ function ft(e, n, l) {
646
646
  i.style.pointerEvents = l ? "none" : "", i.setAttribute("aria-disabled", String(l));
647
647
  });
648
648
  }
649
- function Pe(e, n, l, i) {
649
+ function Te(e, n, l, i) {
650
650
  const f = /* @__PURE__ */ new Map();
651
651
  function u({
652
652
  path: t = [],
653
653
  meta: o,
654
654
  componentId: d
655
655
  }) {
656
- if (V(e, t)?.isRaw)
656
+ if (E(e, t)?.isRaw)
657
657
  return C(e, t);
658
- const b = o ? JSON.stringify(o.arrayViews || o.transforms) : "", $ = t.join(".") + ":" + d + ":" + b;
659
- if (f.has($))
660
- return f.get($);
658
+ const V = o ? JSON.stringify(o.arrayViews || o.transforms) : "", T = t.join(".") + ":" + d + ":" + V;
659
+ if (f.has(T))
660
+ return f.get(T);
661
661
  const v = [e, ...t].join("."), _ = () => {
662
- }, T = {
663
- apply(G, g, I) {
664
- if (I.length === 0) {
662
+ }, P = {
663
+ apply(G, g, k) {
664
+ if (k.length === 0) {
665
665
  const r = t.length > 0 ? t.join(".") : "root", a = o?.arrayViews?.[r];
666
666
  return te(e, d, t), C(e, t, a);
667
667
  }
668
- const k = I[0];
669
- return n(k, t, { updateType: "update" }), !0;
668
+ const D = k[0];
669
+ return n(D, t, { updateType: "update" }), !0;
670
670
  },
671
- get(G, g, I) {
671
+ get(G, g, k) {
672
672
  if (g === Symbol.toPrimitive)
673
673
  return (r) => r === "number" ? NaN : r === "string" ? `[CogsState: ${t.join(".") || "root"}]` : null;
674
674
  if (g === Symbol.toStringTag)
@@ -681,7 +681,7 @@ function Pe(e, n, l, i) {
681
681
  } : void 0;
682
682
  }
683
683
  if (g === "call" || g === "apply" || g === "bind")
684
- return Reflect.get(G, g, I);
684
+ return Reflect.get(G, g, k);
685
685
  if (typeof g != "string")
686
686
  return Reflect.get(G, g);
687
687
  if (t.length === 0 && g in h)
@@ -689,28 +689,28 @@ function Pe(e, n, l, i) {
689
689
  if (typeof g == "string" && !g.startsWith("$")) {
690
690
  const { value: r } = N(e, t, o);
691
691
  if (r !== null && typeof r == "object" && !Array.isArray(r) && Object.prototype.hasOwnProperty.call(r, g)) {
692
- const c = [...t, g];
692
+ const s = [...t, g];
693
693
  return u({
694
- path: c,
694
+ path: s,
695
695
  componentId: d,
696
696
  meta: o
697
697
  });
698
698
  }
699
- const s = R.getState().registeredPlugins;
700
- for (const c of s) {
701
- const m = c.chainMethods?.[g];
702
- if (m && ut(t, m.pathPattern) && dt(r, m.target))
699
+ const c = R.getState().registeredPlugins;
700
+ for (const s of c) {
701
+ const y = s.chainMethods?.[g];
702
+ if (y && ut(t, y.pathPattern) && dt(r, y.target))
703
703
  return (...w) => {
704
- const A = R.getState(), M = A.pluginOptions.get(e)?.get(c.name), D = A.getHookResult(e, c.name);
705
- return m.handler(
704
+ const A = R.getState(), M = A.pluginOptions.get(e)?.get(s.name), I = A.getHookResult(e, s.name);
705
+ return y.handler(
706
706
  {
707
707
  stateKey: e,
708
708
  path: t,
709
- pluginName: c.name,
709
+ pluginName: s.name,
710
710
  options: M,
711
- hookData: D,
711
+ hookData: I,
712
712
  $get: () => N(e, t, o).value,
713
- $update: (P) => (n(P, t, {
713
+ $update: (b) => (n(b, t, {
714
714
  updateType: "update"
715
715
  }), {
716
716
  synced: () => {
@@ -723,19 +723,19 @@ function Pe(e, n, l, i) {
723
723
  });
724
724
  }
725
725
  }),
726
- $applyOperation: (P, O) => {
727
- n(P.newValue, P.path, {
728
- updateType: P.updateType,
729
- itemId: P.itemId,
726
+ $applyOperation: (b, O) => {
727
+ n(b.newValue, b.path, {
728
+ updateType: b.updateType,
729
+ itemId: b.itemId,
730
730
  metaData: O
731
731
  });
732
732
  },
733
- getFieldMetaData: () => he(e, t)?.get(c.name),
734
- setFieldMetaData: (P) => ve(e, t, c.name, P),
735
- removeFieldMetaData: () => we(e, t, c.name),
733
+ getFieldMetaData: () => he(e, t)?.get(s.name),
734
+ setFieldMetaData: (b) => ve(e, t, s.name, b),
735
+ removeFieldMetaData: () => we(e, t, s.name),
736
736
  getFieldRefs: () => Ee(e, t),
737
737
  getFieldElements: () => $e(e, t),
738
- setFieldDisabled: (P) => ft(e, t, P)
738
+ setFieldDisabled: (b) => ft(e, t, b)
739
739
  },
740
740
  ...w
741
741
  );
@@ -755,52 +755,52 @@ function Pe(e, n, l, i) {
755
755
  const r = p.getState().getInitialOptions(e), a = r?.sync;
756
756
  if (!a)
757
757
  return console.error(`No mutation defined for state key "${e}"`), { success: !1, error: "No mutation defined" };
758
- const s = p.getState().getShadowValue(e, []), S = r?.validation?.key;
758
+ const c = p.getState().getShadowValue(e, []), S = r?.validation?.key;
759
759
  try {
760
- const c = await a.action(s);
761
- if (c && !c.success && c.errors, c?.success) {
762
- const m = p.getState().getShadowMetadata(e, []);
760
+ const s = await a.action(c);
761
+ if (s && !s.success && s.errors, s?.success) {
762
+ const y = p.getState().getShadowMetadata(e, []);
763
763
  W(e, [], {
764
- ...m,
764
+ ...y,
765
765
  isDirty: !1,
766
766
  lastServerSync: Date.now(),
767
767
  stateSource: "server",
768
- baseServerState: s
768
+ baseServerState: c
769
769
  // Update base server state
770
- }), a.onSuccess && a.onSuccess(c.data);
771
- } else !c?.success && a.onError && a.onError(c.error);
772
- return c;
773
- } catch (c) {
774
- return a.onError && a.onError(c), { success: !1, error: c };
770
+ }), a.onSuccess && a.onSuccess(s.data);
771
+ } else !s?.success && a.onError && a.onError(s.error);
772
+ return s;
773
+ } catch (s) {
774
+ return a.onError && a.onError(s), { success: !1, error: s };
775
775
  }
776
776
  };
777
777
  if (g === "$_status" || g === "$getStatus") {
778
778
  const r = () => {
779
- const { shadowMeta: a, value: s } = N(e, t, o);
780
- return a?.isDirty === !0 ? "dirty" : a?.stateSource === "server" || a?.isDirty === !1 ? "synced" : a?.stateSource === "localStorage" ? "restored" : a?.stateSource === "default" || s !== void 0 ? "fresh" : "unknown";
779
+ const { shadowMeta: a, value: c } = N(e, t, o);
780
+ return a?.isDirty === !0 ? "dirty" : a?.stateSource === "server" || a?.isDirty === !1 ? "synced" : a?.stateSource === "localStorage" ? "restored" : a?.stateSource === "default" || c !== void 0 ? "fresh" : "unknown";
781
781
  };
782
782
  return g === "$_status" ? r() : r;
783
783
  }
784
784
  if (g === "$removeStorage")
785
785
  return () => {
786
- const r = p.getState().initialStateGlobal[e], a = j(e), s = L(a?.localStorage?.key) ? a.localStorage.key(r) : a?.localStorage?.key, S = i && s ? `${i}-${e}-${s}` : void 0;
786
+ const r = p.getState().initialStateGlobal[e], a = j(e), c = L(a?.localStorage?.key) ? a.localStorage.key(r) : a?.localStorage?.key, S = i && c ? `${i}-${e}-${c}` : void 0;
787
787
  de(S);
788
788
  };
789
789
  if (g === "$setRaw")
790
790
  return (r) => {
791
- const a = V(e, t) || {};
791
+ const a = E(e, t) || {};
792
792
  W(e, t, { ...a, isRaw: !0 }), n(r, t, { updateType: "update" });
793
793
  };
794
794
  if (g === "$validate")
795
795
  return () => {
796
- const r = p.getState(), { value: a } = N(e, t, o), s = r.getInitialOptions(e), S = s?.validation?.zodSchemaV4 || s?.validation?.zodSchemaV3;
796
+ const r = p.getState(), { value: a } = N(e, t, o), c = r.getInitialOptions(e), S = c?.validation?.zodSchemaV4 || c?.validation?.zodSchemaV3;
797
797
  if (!S)
798
798
  return { success: !0, data: a };
799
- const c = S.safeParse(a);
800
- if (c.success) {
801
- const m = r.getShadowMetadata(e, t) || {};
799
+ const s = S.safeParse(a);
800
+ if (s.success) {
801
+ const y = r.getShadowMetadata(e, t) || {};
802
802
  r.setShadowMetadata(e, t, {
803
- ...m,
803
+ ...y,
804
804
  validation: {
805
805
  status: "VALID",
806
806
  errors: [],
@@ -808,7 +808,7 @@ function Pe(e, n, l, i) {
808
808
  }
809
809
  });
810
810
  } else
811
- (c.error?.issues || c.error?.errors || []).forEach((w) => {
811
+ (s.error?.issues || s.error?.errors || []).forEach((w) => {
812
812
  const A = [...t, ...w.path.map(String)], M = r.getShadowMetadata(e, A) || {};
813
813
  r.setShadowMetadata(e, A, {
814
814
  ...M,
@@ -827,13 +827,39 @@ function Pe(e, n, l, i) {
827
827
  }
828
828
  });
829
829
  });
830
- return U(e), c;
830
+ return U(e), s;
831
831
  };
832
832
  if (g === "$showValidationErrors")
833
833
  return () => {
834
834
  const { shadowMeta: r } = N(e, t, o);
835
835
  return r?.validation?.status === "INVALID" && r.validation.errors.length > 0 ? r.validation.errors.filter((a) => a.severity === "error").map((a) => a.message) : [];
836
836
  };
837
+ if (g === "$validationErrors")
838
+ return (r) => {
839
+ const a = p.getState(), c = (s) => {
840
+ const y = a.getShadowMetadata(e, s)?.validation, w = (y?.errors || []).map((b) => ({
841
+ ...b,
842
+ path: s
843
+ })), A = w.filter((b) => b.severity === "error"), M = w.filter(
844
+ (b) => b.severity === "warning"
845
+ ), I = A.length > 0 ? "error" : M.length > 0 ? "warning" : void 0;
846
+ return {
847
+ status: y?.status || "NOT_VALIDATED",
848
+ severity: I,
849
+ hasErrors: A.length > 0,
850
+ hasWarnings: M.length > 0,
851
+ message: A[0]?.message || M[0]?.message || "",
852
+ errors: A.map((b) => b.message),
853
+ warnings: M.map((b) => b.message),
854
+ allErrors: w,
855
+ path: s,
856
+ getData: () => a.getShadowValue(e, s)
857
+ };
858
+ };
859
+ return (r ?? Object.keys(a.getShadowNode(e, t) ?? {}).filter(
860
+ (s) => s !== "_meta"
861
+ )).map((s) => c([...t, s]));
862
+ };
837
863
  if (g === "$getSelected")
838
864
  return () => {
839
865
  const r = [e, ...t].join(".");
@@ -844,8 +870,8 @@ function Pe(e, n, l, i) {
844
870
  const a = p.getState().selectedIndicesMap.get(r);
845
871
  if (!a)
846
872
  return;
847
- const s = t.join("."), S = o?.arrayViews?.[s], c = a.split(".").pop();
848
- if (!(S && !S.includes(c) || C(
873
+ const c = t.join("."), S = o?.arrayViews?.[c], s = a.split(".").pop();
874
+ if (!(S && !S.includes(s) || C(
849
875
  e,
850
876
  a.split(".").slice(1)
851
877
  ) === void 0))
@@ -862,11 +888,11 @@ function Pe(e, n, l, i) {
862
888
  const a = p.getState().selectedIndicesMap.get(r);
863
889
  if (!a)
864
890
  return -1;
865
- const { keys: s } = F(e, t, o);
866
- if (!s)
891
+ const { keys: c } = F(e, t, o);
892
+ if (!c)
867
893
  return -1;
868
894
  const S = a.split(".").pop();
869
- return s.indexOf(S);
895
+ return c.indexOf(S);
870
896
  };
871
897
  if (g === "$clearSelected")
872
898
  return Y(e, t), () => {
@@ -876,20 +902,20 @@ function Pe(e, n, l, i) {
876
902
  };
877
903
  if (g === "$map")
878
904
  return (r) => {
879
- const { value: a, keys: s } = F(
905
+ const { value: a, keys: c } = F(
880
906
  e,
881
907
  t,
882
908
  o
883
909
  );
884
- if (te(e, d, t), !s || !Array.isArray(a))
910
+ if (te(e, d, t), !c || !Array.isArray(a))
885
911
  return [];
886
912
  const S = u({
887
913
  path: t,
888
914
  componentId: d,
889
915
  meta: o
890
916
  });
891
- return a.map((c, m) => {
892
- const w = s[m];
917
+ return a.map((s, y) => {
918
+ const w = c[y];
893
919
  if (!w) return;
894
920
  const A = [...t, w], M = u({
895
921
  path: A,
@@ -897,23 +923,23 @@ function Pe(e, n, l, i) {
897
923
  componentId: d,
898
924
  meta: o
899
925
  });
900
- return r(M, m, S);
926
+ return r(M, y, S);
901
927
  });
902
928
  };
903
929
  if (g === "$filter")
904
930
  return (r) => {
905
- const a = t.length > 0 ? t.join(".") : "root", { keys: s, value: S } = F(
931
+ const a = t.length > 0 ? t.join(".") : "root", { keys: c, value: S } = F(
906
932
  e,
907
933
  t,
908
934
  o
909
935
  );
910
936
  if (!Array.isArray(S))
911
937
  throw new Error("filter can only be used on arrays");
912
- const c = [];
913
- return S.forEach((m, w) => {
914
- if (r(m, w)) {
915
- const A = s[w];
916
- A && c.push(A);
938
+ const s = [];
939
+ return S.forEach((y, w) => {
940
+ if (r(y, w)) {
941
+ const A = c[w];
942
+ A && s.push(A);
917
943
  }
918
944
  }), u({
919
945
  path: t,
@@ -922,7 +948,7 @@ function Pe(e, n, l, i) {
922
948
  ...o,
923
949
  arrayViews: {
924
950
  ...o?.arrayViews || {},
925
- [a]: c
951
+ [a]: s
926
952
  },
927
953
  transforms: [
928
954
  ...o?.transforms || [],
@@ -933,19 +959,19 @@ function Pe(e, n, l, i) {
933
959
  };
934
960
  if (g === "$sort")
935
961
  return (r) => {
936
- const a = t.length > 0 ? t.join(".") : "root", { value: s, keys: S } = F(
962
+ const a = t.length > 0 ? t.join(".") : "root", { value: c, keys: S } = F(
937
963
  e,
938
964
  t,
939
965
  o
940
966
  );
941
- if (!Array.isArray(s) || !S)
967
+ if (!Array.isArray(c) || !S)
942
968
  throw new Error("No array keys found for sorting");
943
- const c = s.map((w, A) => ({
969
+ const s = c.map((w, A) => ({
944
970
  item: w,
945
971
  key: S[A]
946
972
  }));
947
- c.sort((w, A) => r(w.item, A.item));
948
- const m = c.map((w) => w.key);
973
+ s.sort((w, A) => r(w.item, A.item));
974
+ const y = s.map((w) => w.key);
949
975
  return u({
950
976
  path: t,
951
977
  componentId: d,
@@ -953,7 +979,7 @@ function Pe(e, n, l, i) {
953
979
  ...o,
954
980
  arrayViews: {
955
981
  ...o?.arrayViews || {},
956
- [a]: m
982
+ [a]: y
957
983
  },
958
984
  transforms: [
959
985
  ...o?.transforms || [],
@@ -964,13 +990,13 @@ function Pe(e, n, l, i) {
964
990
  };
965
991
  if (g === "$list")
966
992
  return (r) => /* @__PURE__ */ Q(() => {
967
- const s = q(/* @__PURE__ */ new Map()), [S, c] = ne({}), m = t.length > 0 ? t.join(".") : "root", w = lt(e, t, o), A = Ae(() => ({
993
+ const c = q(/* @__PURE__ */ new Map()), [S, s] = ne({}), y = t.length > 0 ? t.join(".") : "root", w = lt(e, t, o), A = Ae(() => ({
968
994
  ...o,
969
995
  arrayViews: {
970
996
  ...o?.arrayViews || {},
971
- [m]: w
997
+ [y]: w
972
998
  }
973
- }), [o, m, w]), { value: M } = F(
999
+ }), [o, y, w]), { value: M } = F(
974
1000
  e,
975
1001
  t,
976
1002
  A
@@ -983,24 +1009,24 @@ function Pe(e, n, l, i) {
983
1009
  if (B)
984
1010
  for (const ee of B.keys())
985
1011
  ee.startsWith(d) && B.delete(ee);
986
- (z.type === "INSERT" || z.type === "INSERT_MANY" || z.type === "REMOVE" || z.type === "CLEAR_SELECTION" || z.type === "SERVER_STATE_UPDATE" && !o?.serverStateIsUpStream) && c({});
1012
+ (z.type === "INSERT" || z.type === "INSERT_MANY" || z.type === "REMOVE" || z.type === "CLEAR_SELECTION" || z.type === "SERVER_STATE_UPDATE" && !o?.serverStateIsUpStream) && s({});
987
1013
  });
988
1014
  return () => {
989
1015
  O();
990
1016
  };
991
1017
  }, [d, v]), !Array.isArray(M))
992
1018
  return null;
993
- const D = u({
1019
+ const I = u({
994
1020
  path: t,
995
1021
  componentId: d,
996
1022
  meta: A
997
1023
  // Use updated meta here
998
- }), P = M.map((O, z) => {
1024
+ }), b = M.map((O, z) => {
999
1025
  const J = w[z];
1000
1026
  if (!J)
1001
1027
  return null;
1002
- let B = s.current.get(J);
1003
- B || (B = ae(), s.current.set(J, B));
1028
+ let B = c.current.get(J);
1029
+ B || (B = ae(), c.current.set(J, B));
1004
1030
  const ee = [...t, J];
1005
1031
  return Se(Ue, {
1006
1032
  key: J,
@@ -1008,16 +1034,16 @@ function Pe(e, n, l, i) {
1008
1034
  itemComponentId: B,
1009
1035
  itemPath: ee,
1010
1036
  localIndex: z,
1011
- arraySetter: D,
1037
+ arraySetter: I,
1012
1038
  rebuildStateShape: u,
1013
1039
  renderFn: r
1014
1040
  });
1015
1041
  });
1016
- return /* @__PURE__ */ Q(Te, { children: P });
1042
+ return /* @__PURE__ */ Q(Pe, { children: b });
1017
1043
  }, {});
1018
1044
  if (g === "$stateFlattenOn")
1019
1045
  return (r) => {
1020
- const a = t.length > 0 ? t.join(".") : "root", s = o?.arrayViews?.[a], S = p.getState().getShadowValue(e, t, s);
1046
+ const a = t.length > 0 ? t.join(".") : "root", c = o?.arrayViews?.[a], S = p.getState().getShadowValue(e, t, c);
1021
1047
  return Array.isArray(S) ? u({
1022
1048
  path: [...t, "[*]", r],
1023
1049
  componentId: d,
@@ -1026,21 +1052,21 @@ function Pe(e, n, l, i) {
1026
1052
  };
1027
1053
  if (g === "$index")
1028
1054
  return (r) => {
1029
- const a = t.length > 0 ? t.join(".") : "root", s = o?.arrayViews?.[a];
1030
- if (s) {
1031
- const m = s[r];
1032
- return m ? u({
1033
- path: [...t, m],
1055
+ const a = t.length > 0 ? t.join(".") : "root", c = o?.arrayViews?.[a];
1056
+ if (c) {
1057
+ const y = c[r];
1058
+ return y ? u({
1059
+ path: [...t, y],
1034
1060
  componentId: d,
1035
1061
  meta: o
1036
1062
  }) : void 0;
1037
1063
  }
1038
- const S = V(e, t);
1064
+ const S = E(e, t);
1039
1065
  if (!S?.arrayKeys) return;
1040
- const c = S.arrayKeys[r];
1041
- if (c)
1066
+ const s = S.arrayKeys[r];
1067
+ if (s)
1042
1068
  return u({
1043
- path: [...t, c],
1069
+ path: [...t, s],
1044
1070
  componentId: d,
1045
1071
  meta: o
1046
1072
  });
@@ -1053,9 +1079,9 @@ function Pe(e, n, l, i) {
1053
1079
  const a = r[r.length - 1];
1054
1080
  if (!a)
1055
1081
  return;
1056
- const s = [...t, a];
1082
+ const c = [...t, a];
1057
1083
  return u({
1058
- path: s,
1084
+ path: c,
1059
1085
  componentId: d,
1060
1086
  meta: o
1061
1087
  });
@@ -1074,23 +1100,23 @@ function Pe(e, n, l, i) {
1074
1100
  });
1075
1101
  };
1076
1102
  if (g === "$uniqueInsert")
1077
- return (r, a, s) => {
1103
+ return (r, a, c) => {
1078
1104
  const { value: S } = N(
1079
1105
  e,
1080
1106
  t,
1081
1107
  o
1082
- ), c = L(r) ? r(S) : r;
1083
- let m = null;
1108
+ ), s = L(r) ? r(S) : r;
1109
+ let y = null;
1084
1110
  if (!S.some((A) => {
1085
1111
  const M = a ? a.every(
1086
- (D) => X(A[D], c[D])
1087
- ) : X(A, c);
1088
- return M && (m = A), M;
1112
+ (I) => X(A[I], s[I])
1113
+ ) : X(A, s);
1114
+ return M && (y = A), M;
1089
1115
  }))
1090
- n(c, t, { updateType: "insert" });
1091
- else if (s && m) {
1092
- const A = s(m), M = S.map(
1093
- (D) => X(D, m) ? A : D
1116
+ n(s, t, { updateType: "insert" });
1117
+ else if (c && y) {
1118
+ const A = c(y), M = S.map(
1119
+ (I) => X(I, y) ? A : I
1094
1120
  );
1095
1121
  n(M, t, {
1096
1122
  updateType: "update"
@@ -1099,11 +1125,11 @@ function Pe(e, n, l, i) {
1099
1125
  };
1100
1126
  if (g === "$cut")
1101
1127
  return (r, a) => {
1102
- const s = V(e, t);
1103
- if (!s?.arrayKeys || s.arrayKeys.length === 0)
1128
+ const c = E(e, t);
1129
+ if (!c?.arrayKeys || c.arrayKeys.length === 0)
1104
1130
  return;
1105
- const S = r === -1 ? s.arrayKeys.length - 1 : r !== void 0 ? r : s.arrayKeys.length - 1, c = s.arrayKeys[S];
1106
- c && n(null, [...t, c], {
1131
+ const S = r === -1 ? c.arrayKeys.length - 1 : r !== void 0 ? r : c.arrayKeys.length - 1, s = c.arrayKeys[S];
1132
+ s && n(null, [...t, s], {
1107
1133
  updateType: "cut"
1108
1134
  });
1109
1135
  };
@@ -1112,16 +1138,16 @@ function Pe(e, n, l, i) {
1112
1138
  const r = [e, ...t].join("."), { keys: a } = F(e, t, o);
1113
1139
  if (!a || a.length === 0)
1114
1140
  return;
1115
- const s = p.getState().selectedIndicesMap.get(r);
1116
- if (!s)
1141
+ const c = p.getState().selectedIndicesMap.get(r);
1142
+ if (!c)
1117
1143
  return;
1118
- const S = s.split(".").pop();
1144
+ const S = c.split(".").pop();
1119
1145
  if (!a.includes(S))
1120
1146
  return;
1121
- const c = s.split(".").slice(1);
1147
+ const s = c.split(".").slice(1);
1122
1148
  p.getState().clearSelectedIndex({ arrayKey: r });
1123
- const m = c.slice(0, -1);
1124
- Y(e, m), n(null, c, {
1149
+ const y = s.slice(0, -1);
1150
+ Y(e, y), n(null, s, {
1125
1151
  updateType: "cut"
1126
1152
  });
1127
1153
  };
@@ -1129,12 +1155,12 @@ function Pe(e, n, l, i) {
1129
1155
  return (r) => {
1130
1156
  const {
1131
1157
  isArray: a,
1132
- value: s,
1158
+ value: c,
1133
1159
  keys: S
1134
1160
  } = F(e, t, o);
1135
1161
  if (!a) return;
1136
- const c = le(s, S, (m) => m === r);
1137
- c && n(null, [...t, c.key], {
1162
+ const s = le(c, S, (y) => y === r);
1163
+ s && n(null, [...t, s.key], {
1138
1164
  updateType: "cut"
1139
1165
  });
1140
1166
  };
@@ -1142,14 +1168,14 @@ function Pe(e, n, l, i) {
1142
1168
  return (r) => {
1143
1169
  const {
1144
1170
  isArray: a,
1145
- value: s,
1171
+ value: c,
1146
1172
  keys: S
1147
1173
  } = F(e, t, o);
1148
1174
  if (!a) return;
1149
- const c = le(s, S, (m) => m === r);
1150
- if (c) {
1151
- const m = [...t, c.key];
1152
- n(null, m, {
1175
+ const s = le(c, S, (y) => y === r);
1176
+ if (s) {
1177
+ const y = [...t, s.key];
1178
+ n(null, y, {
1153
1179
  updateType: "cut"
1154
1180
  });
1155
1181
  } else
@@ -1157,16 +1183,16 @@ function Pe(e, n, l, i) {
1157
1183
  };
1158
1184
  if (g === "$findWith")
1159
1185
  return (r, a) => {
1160
- const { isArray: s, value: S, keys: c } = F(e, t, o);
1161
- if (!s)
1186
+ const { isArray: c, value: S, keys: s } = F(e, t, o);
1187
+ if (!c)
1162
1188
  throw new Error("findWith can only be used on arrays");
1163
- const m = le(
1189
+ const y = le(
1164
1190
  S,
1165
- c,
1191
+ s,
1166
1192
  (w) => w?.[r] === a
1167
1193
  );
1168
- return m ? u({
1169
- path: [...t, m.key],
1194
+ return y ? u({
1195
+ path: [...t, y.key],
1170
1196
  componentId: d,
1171
1197
  meta: o
1172
1198
  }) : null;
@@ -1200,45 +1226,45 @@ function Pe(e, n, l, i) {
1200
1226
  return (r) => ce(i + "-" + e + "-" + r);
1201
1227
  if (g === "$isSelected") {
1202
1228
  const r = t.slice(0, -1);
1203
- if (V(e, r)?.arrayKeys) {
1204
- const s = e + "." + r.join("."), S = p.getState().selectedIndicesMap.get(s), c = e + "." + t.join(".");
1205
- return S === c;
1229
+ if (E(e, r)?.arrayKeys) {
1230
+ const c = e + "." + r.join("."), S = p.getState().selectedIndicesMap.get(c), s = e + "." + t.join(".");
1231
+ return S === s;
1206
1232
  }
1207
1233
  return;
1208
1234
  }
1209
1235
  if (g === "$setSelected")
1210
1236
  return (r) => {
1211
- const a = t.slice(0, -1), s = e + "." + a.join("."), S = e + "." + t.join(".");
1212
- Y(e, a, void 0), p.getState().selectedIndicesMap.get(s), r && p.getState().setSelectedIndex(s, S);
1237
+ const a = t.slice(0, -1), c = e + "." + a.join("."), S = e + "." + t.join(".");
1238
+ Y(e, a, void 0), p.getState().selectedIndicesMap.get(c), r && p.getState().setSelectedIndex(c, S);
1213
1239
  };
1214
1240
  if (g === "$toggleSelected")
1215
1241
  return () => {
1216
- const r = t.slice(0, -1), a = e + "." + r.join("."), s = e + "." + t.join(".");
1217
- p.getState().selectedIndicesMap.get(a) === s ? p.getState().clearSelectedIndex({ arrayKey: a }) : p.getState().setSelectedIndex(a, s), Y(e, r);
1242
+ const r = t.slice(0, -1), a = e + "." + r.join("."), c = e + "." + t.join(".");
1243
+ p.getState().selectedIndicesMap.get(a) === c ? p.getState().clearSelectedIndex({ arrayKey: a }) : p.getState().setSelectedIndex(a, c), Y(e, r);
1218
1244
  };
1219
1245
  if (g === "$clearValidation")
1220
1246
  return (r) => {
1221
- const a = r ? [...t, ...r] : t, s = p.getState(), S = s.getShadowNode(e, a);
1247
+ const a = r ? [...t, ...r] : t, c = p.getState(), S = c.getShadowNode(e, a);
1222
1248
  if (console.log("startNode ", S), !S) return;
1223
- const c = [[S, a]];
1224
- for (console.log("stack ", c); c.length > 0; ) {
1225
- const [m, w] = c.pop();
1226
- if (console.log("while (stack.length ", m, w), !m || typeof m != "object") continue;
1227
- if (m._meta?.validation) {
1228
- m._meta.validation = {
1249
+ const s = [[S, a]];
1250
+ for (console.log("stack ", s); s.length > 0; ) {
1251
+ const [y, w] = s.pop();
1252
+ if (console.log("while (stack.length ", y, w), !y || typeof y != "object") continue;
1253
+ if (y._meta?.validation) {
1254
+ y._meta.validation = {
1229
1255
  status: "NOT_VALIDATED",
1230
1256
  errors: [],
1231
1257
  lastValidated: Date.now(),
1232
1258
  validatedValue: void 0
1233
1259
  };
1234
1260
  const M = [e, ...w].join(".");
1235
- s.notifyPathSubscribers(M, {
1261
+ c.notifyPathSubscribers(M, {
1236
1262
  type: "VALIDATION_CLEAR"
1237
1263
  });
1238
1264
  }
1239
- const A = Object.keys(m);
1265
+ const A = Object.keys(y);
1240
1266
  for (const M of A)
1241
- M !== "_meta" && c.push([m[M], [...w, M]]);
1267
+ M !== "_meta" && s.push([y[M], [...w, M]]);
1242
1268
  }
1243
1269
  U(e);
1244
1270
  };
@@ -1250,8 +1276,8 @@ function Pe(e, n, l, i) {
1250
1276
  fe({ stateKey: e, options: r, initialOptionsPart: {} });
1251
1277
  };
1252
1278
  if (g === "$_applyUpdate")
1253
- return (r, a, s = "update") => {
1254
- n(r, a, { updateType: s });
1279
+ return (r, a, c = "update") => {
1280
+ n(r, a, { updateType: c });
1255
1281
  };
1256
1282
  if (g === "$_getEffectiveSetState")
1257
1283
  return n;
@@ -1263,11 +1289,11 @@ function Pe(e, n, l, i) {
1263
1289
  return (r) => we(e, t, r);
1264
1290
  if (g === "$addZodValidation")
1265
1291
  return (r, a) => {
1266
- const s = p.getState();
1292
+ const c = p.getState();
1267
1293
  r.forEach((S) => {
1268
- const c = S.path.map(String), m = s.getShadowMetadata(e, c) || {};
1269
- s.setShadowMetadata(e, c, {
1270
- ...m,
1294
+ const s = S.path.map(String), y = c.getShadowMetadata(e, s) || {};
1295
+ c.setShadowMetadata(e, s, {
1296
+ ...y,
1271
1297
  validation: {
1272
1298
  status: "INVALID",
1273
1299
  errors: [
@@ -1281,8 +1307,8 @@ function Pe(e, n, l, i) {
1281
1307
  lastValidated: Date.now(),
1282
1308
  validatedValue: void 0
1283
1309
  }
1284
- }), s.notifyPathSubscribers(
1285
- [e, ...c].join("."),
1310
+ }), c.notifyPathSubscribers(
1311
+ [e, ...s].join("."),
1286
1312
  { type: "VALIDATION_UPDATE" }
1287
1313
  );
1288
1314
  }), U(e);
@@ -1290,9 +1316,9 @@ function Pe(e, n, l, i) {
1290
1316
  if (g === "$clearZodValidationPaths")
1291
1317
  return (r) => {
1292
1318
  const a = p.getState();
1293
- r.forEach((s) => {
1294
- const S = a.getShadowMetadata(e, s) || {};
1295
- S.validation && (a.setShadowMetadata(e, s, {
1319
+ r.forEach((c) => {
1320
+ const S = a.getShadowMetadata(e, c) || {};
1321
+ S.validation && (a.setShadowMetadata(e, c, {
1296
1322
  ...S,
1297
1323
  validation: {
1298
1324
  status: "NOT_VALIDATED",
@@ -1301,53 +1327,53 @@ function Pe(e, n, l, i) {
1301
1327
  validatedValue: void 0
1302
1328
  }
1303
1329
  }), a.notifyPathSubscribers(
1304
- [e, ...s].join("."),
1330
+ [e, ...c].join("."),
1305
1331
  { type: "VALIDATION_CLEAR" }
1306
1332
  ));
1307
1333
  }), U(e);
1308
1334
  };
1309
1335
  if (g === "$applyOperation")
1310
1336
  return (r, a) => {
1311
- let s;
1337
+ let c;
1312
1338
  if (r.insertAfterId && r.updateType === "insert") {
1313
- const S = V(e, r.path);
1339
+ const S = E(e, r.path);
1314
1340
  if (S?.arrayKeys) {
1315
- const c = S.arrayKeys.indexOf(
1341
+ const s = S.arrayKeys.indexOf(
1316
1342
  r.insertAfterId
1317
1343
  );
1318
- c !== -1 && (s = c + 1);
1344
+ s !== -1 && (c = s + 1);
1319
1345
  }
1320
1346
  }
1321
1347
  n(r.newValue, r.path, {
1322
1348
  updateType: r.updateType,
1323
1349
  itemId: r.itemId,
1324
- index: s,
1350
+ index: c,
1325
1351
  // Pass the calculated index
1326
1352
  metaData: a
1327
1353
  });
1328
1354
  };
1329
1355
  if (g === "$applyJsonPatch")
1330
1356
  return (r) => {
1331
- const a = p.getState(), s = a.getShadowMetadata(e, []);
1332
- if (!s?.components) return;
1333
- const S = (m) => !m || m === "/" ? [] : m.split("/").slice(1).map((w) => w.replace(/~1/g, "/").replace(/~0/g, "~")), c = /* @__PURE__ */ new Set();
1334
- for (const m of r) {
1335
- const w = S(m.path);
1336
- switch (m.op) {
1357
+ const a = p.getState(), c = a.getShadowMetadata(e, []);
1358
+ if (!c?.components) return;
1359
+ const S = (y) => !y || y === "/" ? [] : y.split("/").slice(1).map((w) => w.replace(/~1/g, "/").replace(/~0/g, "~")), s = /* @__PURE__ */ new Set();
1360
+ for (const y of r) {
1361
+ const w = S(y.path);
1362
+ switch (y.op) {
1337
1363
  case "add":
1338
1364
  case "replace": {
1339
- const { value: A } = m;
1365
+ const { value: A } = y;
1340
1366
  a.updateShadowAtPath(e, w, A), a.markAsDirty(e, w, { bubble: !0 });
1341
1367
  let M = [...w];
1342
1368
  for (; ; ) {
1343
- const D = a.getShadowMetadata(
1369
+ const I = a.getShadowMetadata(
1344
1370
  e,
1345
1371
  M
1346
1372
  );
1347
- if (D?.pathComponents && D.pathComponents.forEach((P) => {
1348
- if (!c.has(P)) {
1349
- const O = s.components?.get(P);
1350
- O && (O.forceUpdate(), c.add(P));
1373
+ if (I?.pathComponents && I.pathComponents.forEach((b) => {
1374
+ if (!s.has(b)) {
1375
+ const O = c.components?.get(b);
1376
+ O && (O.forceUpdate(), s.add(b));
1351
1377
  }
1352
1378
  }), M.length === 0) break;
1353
1379
  M.pop();
@@ -1359,14 +1385,14 @@ function Pe(e, n, l, i) {
1359
1385
  a.removeShadowArrayElement(e, w), a.markAsDirty(e, A, { bubble: !0 });
1360
1386
  let M = [...A];
1361
1387
  for (; ; ) {
1362
- const D = a.getShadowMetadata(
1388
+ const I = a.getShadowMetadata(
1363
1389
  e,
1364
1390
  M
1365
1391
  );
1366
- if (D?.pathComponents && D.pathComponents.forEach((P) => {
1367
- if (!c.has(P)) {
1368
- const O = s.components?.get(P);
1369
- O && (O.forceUpdate(), c.add(P));
1392
+ if (I?.pathComponents && I.pathComponents.forEach((b) => {
1393
+ if (!s.has(b)) {
1394
+ const O = c.components?.get(b);
1395
+ O && (O.forceUpdate(), s.add(b));
1370
1396
  }
1371
1397
  }), M.length === 0) break;
1372
1398
  M.pop();
@@ -1377,7 +1403,7 @@ function Pe(e, n, l, i) {
1377
1403
  }
1378
1404
  };
1379
1405
  if (g === "$getComponents")
1380
- return () => V(e, [])?.components;
1406
+ return () => E(e, [])?.components;
1381
1407
  }
1382
1408
  if (g === "$validationWrapper")
1383
1409
  return ({
@@ -1404,8 +1430,8 @@ function Pe(e, n, l, i) {
1404
1430
  stateSource: "server",
1405
1431
  lastServerSync: Date.now()
1406
1432
  });
1407
- const s = [e, ...t].join(".");
1408
- Qe(s, {
1433
+ const c = [e, ...t].join(".");
1434
+ Qe(c, {
1409
1435
  type: "SYNC_STATUS_CHANGE",
1410
1436
  isDirty: !1
1411
1437
  });
@@ -1427,8 +1453,8 @@ function Pe(e, n, l, i) {
1427
1453
  }
1428
1454
  if (g === "$isolate")
1429
1455
  return (r, a) => {
1430
- const s = Array.isArray(r), S = s ? r : void 0, c = s ? a : r;
1431
- if (!c || typeof c != "function")
1456
+ const c = Array.isArray(r), S = c ? r : void 0, s = c ? a : r;
1457
+ if (!s || typeof s != "function")
1432
1458
  throw new Error(
1433
1459
  "CogsState: $isolate requires a render function."
1434
1460
  );
@@ -1439,7 +1465,7 @@ function Pe(e, n, l, i) {
1439
1465
  path: t,
1440
1466
  dependencies: S,
1441
1467
  rebuildStateShape: u,
1442
- renderFn: c
1468
+ renderFn: s
1443
1469
  }
1444
1470
  );
1445
1471
  };
@@ -1455,15 +1481,15 @@ function Pe(e, n, l, i) {
1455
1481
  renderFn: r
1456
1482
  }
1457
1483
  );
1458
- const k = [...t, g];
1484
+ const D = [...t, g];
1459
1485
  return u({
1460
- path: k,
1486
+ path: D,
1461
1487
  componentId: d,
1462
1488
  meta: o
1463
1489
  });
1464
1490
  }
1465
- }, x = new Proxy(_, T);
1466
- return f.set($, x), x;
1491
+ }, x = new Proxy(_, P);
1492
+ return f.set(T, x), x;
1467
1493
  }
1468
1494
  const h = {
1469
1495
  $revertToInitialState: (t) => {
@@ -1473,21 +1499,21 @@ function Pe(e, n, l, i) {
1473
1499
  path: [],
1474
1500
  componentId: l
1475
1501
  });
1476
- const E = j(e), b = L(E?.localStorage?.key) ? E?.localStorage?.key(d) : E?.localStorage?.key, $ = i && b ? `${i}-${e}-${b}` : void 0;
1477
- return de($), U(e), d;
1502
+ const $ = j(e), V = L($?.localStorage?.key) ? $?.localStorage?.key(d) : $?.localStorage?.key, T = i && V ? `${i}-${e}-${V}` : void 0;
1503
+ return de(T), U(e), d;
1478
1504
  },
1479
1505
  $initializeAndMergeShadowState: (t) => {
1480
1506
  Re(e, t), U(e);
1481
1507
  },
1482
1508
  $updateInitialState: (t) => {
1483
- const o = Pe(
1509
+ const o = Te(
1484
1510
  e,
1485
1511
  n,
1486
1512
  l,
1487
1513
  i
1488
- ), d = p.getState().initialStateGlobal[e], E = j(e), b = L(E?.localStorage?.key) ? E?.localStorage?.key(d) : E?.localStorage?.key, $ = i && b ? `${i}-${e}-${b}` : void 0;
1489
- return de($), ke(() => {
1490
- be(e, t), K(e, t);
1514
+ ), d = p.getState().initialStateGlobal[e], $ = j(e), V = L($?.localStorage?.key) ? $?.localStorage?.key(d) : $?.localStorage?.key, T = i && V ? `${i}-${e}-${V}` : void 0;
1515
+ return de(T), ke(() => {
1516
+ Ve(e, t), K(e, t);
1491
1517
  const v = p.getState().getShadowMetadata(e, []);
1492
1518
  v && v?.components?.forEach((_) => {
1493
1519
  _.forceUpdate();
@@ -1508,7 +1534,7 @@ function pe(e) {
1508
1534
  function gt({
1509
1535
  proxy: e
1510
1536
  }) {
1511
- const n = q(null), l = q(null), i = q(!1), f = `${e._stateKey}-${e._path.join(".")}`, u = e._path.length > 0 ? e._path.join(".") : "root", h = e._meta?.arrayViews?.[u], y = C(e._stateKey, e._path, h);
1537
+ const n = q(null), l = q(null), i = q(!1), f = `${e._stateKey}-${e._path.join(".")}`, u = e._path.length > 0 ? e._path.join(".") : "root", h = e._meta?.arrayViews?.[u], m = C(e._stateKey, e._path, h);
1512
1538
  return Z(() => {
1513
1539
  const t = n.current;
1514
1540
  if (!t || i.current) return;
@@ -1517,38 +1543,38 @@ function gt({
1517
1543
  console.warn("Parent element not found for signal", f);
1518
1544
  return;
1519
1545
  }
1520
- const d = t.parentElement, b = Array.from(d.childNodes).indexOf(t);
1521
- let $ = d.getAttribute("data-parent-id");
1522
- $ || ($ = `parent-${crypto.randomUUID()}`, d.setAttribute("data-parent-id", $)), l.current = `instance-${crypto.randomUUID()}`;
1546
+ const d = t.parentElement, V = Array.from(d.childNodes).indexOf(t);
1547
+ let T = d.getAttribute("data-parent-id");
1548
+ T || (T = `parent-${crypto.randomUUID()}`, d.setAttribute("data-parent-id", T)), l.current = `instance-${crypto.randomUUID()}`;
1523
1549
  const v = p.getState().getShadowMetadata(e._stateKey, e._path) || {}, _ = v.signals || [];
1524
1550
  _.push({
1525
1551
  instanceId: l.current,
1526
- parentId: $,
1527
- position: b,
1552
+ parentId: T,
1553
+ position: V,
1528
1554
  effect: e._effect
1529
1555
  }), p.getState().setShadowMetadata(e._stateKey, e._path, {
1530
1556
  ...v,
1531
1557
  signals: _
1532
1558
  });
1533
- let T = y;
1559
+ let P = m;
1534
1560
  if (e._effect)
1535
1561
  try {
1536
- T = new Function(
1562
+ P = new Function(
1537
1563
  "state",
1538
1564
  `return (${e._effect})(state)`
1539
- )(y);
1565
+ )(m);
1540
1566
  } catch (G) {
1541
1567
  console.error("Error evaluating effect function:", G);
1542
1568
  }
1543
- T !== null && typeof T == "object" && (T = JSON.stringify(T));
1544
- const x = document.createTextNode(String(T ?? ""));
1569
+ P !== null && typeof P == "object" && (P = JSON.stringify(P));
1570
+ const x = document.createTextNode(String(P ?? ""));
1545
1571
  t.replaceWith(x), i.current = !0;
1546
1572
  }, 0);
1547
1573
  return () => {
1548
1574
  if (clearTimeout(o), l.current) {
1549
1575
  const d = p.getState().getShadowMetadata(e._stateKey, e._path) || {};
1550
1576
  d.signals && (d.signals = d.signals.filter(
1551
- (E) => E.instanceId !== l.current
1577
+ ($) => $.instanceId !== l.current
1552
1578
  ), p.getState().setShadowMetadata(e._stateKey, e._path, d));
1553
1579
  }
1554
1580
  };
@@ -1560,7 +1586,7 @@ function gt({
1560
1586
  }
1561
1587
  export {
1562
1588
  pe as $cogsSignal,
1563
- Vt as createCogsState,
1589
+ bt as createCogsState,
1564
1590
  ct as useCogsStateFn
1565
1591
  };
1566
1592
  //# sourceMappingURL=CogsState.js.map