cogsbox-state 0.5.440 → 0.5.441

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as ot, Fragment as Ut } from "react/jsx-runtime";
3
- import { memo as Ot, useState as K, useRef as q, useCallback as ct, useEffect as Z, useLayoutEffect as dt, useMemo as St, createElement as lt, startTransition as Rt } from "react";
3
+ import { memo as Ot, useState as K, useRef as q, useCallback as ct, useEffect as Z, useLayoutEffect as dt, useMemo as gt, createElement as lt, startTransition as Rt } from "react";
4
4
  import { createRoot as At } from "react-dom/client";
5
5
  import { transformStateFunc as Nt, isFunction as at, isArray as Tt, getDifferences as Ct, isDeepEqual as st } from "./utility.js";
6
6
  import { ValidationWrapper as kt } from "./Functions.jsx";
@@ -9,51 +9,51 @@ import { v4 as rt } from "uuid";
9
9
  import { getGlobalStore as e, formRefStore as vt } from "./store.js";
10
10
  import { useCogsConfig as Pt } from "./CogsStateClient.jsx";
11
11
  import { useInView as jt } from "react-intersection-observer";
12
- function yt(t, r) {
13
- const g = e.getState().getInitialOptions, S = e.getState().setInitialStateOptions, y = g(t) || {};
14
- S(t, {
12
+ function yt(t, n) {
13
+ const S = e.getState().getInitialOptions, g = e.getState().setInitialStateOptions, y = S(t) || {};
14
+ g(t, {
15
15
  ...y,
16
- ...r
16
+ ...n
17
17
  });
18
18
  }
19
19
  function Et({
20
20
  stateKey: t,
21
- options: r,
22
- initialOptionsPart: g
21
+ options: n,
22
+ initialOptionsPart: S
23
23
  }) {
24
- const S = nt(t) || {}, y = g[t] || {}, I = e.getState().setInitialStateOptions, E = { ...y, ...S };
24
+ const g = nt(t) || {}, y = S[t] || {}, I = e.getState().setInitialStateOptions, E = { ...y, ...g };
25
25
  let u = !1;
26
- if (r)
27
- for (const f in r)
28
- E.hasOwnProperty(f) ? (f == "localStorage" && r[f] && E[f].key !== r[f]?.key && (u = !0, E[f] = r[f]), f == "defaultState" && r[f] && E[f] !== r[f] && !st(E[f], r[f]) && (u = !0, E[f] = r[f])) : (u = !0, E[f] = r[f]);
26
+ if (n)
27
+ for (const f in n)
28
+ E.hasOwnProperty(f) ? (f == "localStorage" && n[f] && E[f].key !== n[f]?.key && (u = !0, E[f] = n[f]), f == "defaultState" && n[f] && E[f] !== n[f] && !st(E[f], n[f]) && (u = !0, E[f] = n[f])) : (u = !0, E[f] = n[f]);
29
29
  u && I(t, E);
30
30
  }
31
- function ie(t, { formElements: r, validation: g }) {
32
- return { initialState: t, formElements: r, validation: g };
31
+ function ie(t, { formElements: n, validation: S }) {
32
+ return { initialState: t, formElements: n, validation: S };
33
33
  }
34
- const Lt = (t, r) => {
35
- let g = t;
36
- const [S, y] = Nt(g);
37
- r?.__fromSyncSchema && r?.__syncNotifications && e.getState().setInitialStateOptions("__notifications", r.__syncNotifications), Object.keys(S).forEach((u) => {
34
+ const Lt = (t, n) => {
35
+ let S = t;
36
+ const [g, y] = Nt(S);
37
+ n?.__fromSyncSchema && n?.__syncNotifications && e.getState().setInitialStateOptions("__notifications", n.__syncNotifications), Object.keys(g).forEach((u) => {
38
38
  let f = y[u] || {};
39
39
  const A = {
40
40
  ...f
41
41
  };
42
- if (r?.formElements && (A.formElements = {
43
- ...r.formElements,
42
+ if (n?.formElements && (A.formElements = {
43
+ ...n.formElements,
44
44
  ...f.formElements || {}
45
- }), r?.validation && (A.validation = {
46
- ...r.validation,
45
+ }), n?.validation && (A.validation = {
46
+ ...n.validation,
47
47
  ...f.validation || {}
48
- }, r.validation.key && !f.validation?.key && (A.validation.key = `${r.validation.key}.${u}`)), Object.keys(A).length > 0) {
48
+ }, n.validation.key && !f.validation?.key && (A.validation.key = `${n.validation.key}.${u}`)), Object.keys(A).length > 0) {
49
49
  const w = nt(u);
50
50
  w ? e.getState().setInitialStateOptions(u, {
51
51
  ...w,
52
52
  ...A
53
53
  }) : e.getState().setInitialStateOptions(u, A);
54
54
  }
55
- }), Object.keys(S).forEach((u) => {
56
- e.getState().initializeShadowState(u, S[u]);
55
+ }), Object.keys(g).forEach((u) => {
56
+ e.getState().initializeShadowState(u, g[u]);
57
57
  });
58
58
  const I = (u, f) => {
59
59
  const [A] = K(f?.componentId ?? rt());
@@ -62,7 +62,7 @@ const Lt = (t, r) => {
62
62
  options: f,
63
63
  initialOptionsPart: y
64
64
  });
65
- const w = e.getState().getShadowValue(u) || S[u], i = f?.modifyState ? f.modifyState(w) : w;
65
+ const w = e.getState().getShadowValue(u) || g[u], i = f?.modifyState ? f.modifyState(w) : w;
66
66
  return zt(i, {
67
67
  stateKey: u,
68
68
  syncUpdate: f?.syncUpdate,
@@ -82,15 +82,12 @@ const Lt = (t, r) => {
82
82
  return { useCogsState: I, setCogsOptions: E };
83
83
  };
84
84
  function ce(t) {
85
- const r = {};
86
- for (const g in t.schemas) {
87
- const S = t.schemas[g];
88
- S.rawSchema ? r[g] = S.rawSchema : S.schemas?.defaults ? r[g] = S.schemas.defaults : S._tableName ? r[g] = S : r[g] = {};
85
+ const n = t.schemas, S = {};
86
+ for (const g in n) {
87
+ const y = n[g];
88
+ S[g] = y.schemas?.defaults || {};
89
89
  }
90
- return Lt(r, {
91
- __fromSyncSchema: !0,
92
- __syncNotifications: t.notifications
93
- });
90
+ return e.getState().setInitialStateOptions("__notifications", t.notifications), Lt(S);
94
91
  }
95
92
  const {
96
93
  getInitialOptions: nt,
@@ -99,22 +96,22 @@ const {
99
96
  updateInitialStateGlobal: _t,
100
97
  addValidationError: pt,
101
98
  removeValidationError: ut
102
- } = e.getState(), Ht = (t, r, g, S, y) => {
103
- g?.log && console.log(
99
+ } = e.getState(), Ht = (t, n, S, g, y) => {
100
+ S?.log && console.log(
104
101
  "saving to localstorage",
105
- r,
106
- g.localStorage?.key,
107
- S
102
+ n,
103
+ S.localStorage?.key,
104
+ g
108
105
  );
109
- const I = at(g?.localStorage?.key) ? g.localStorage?.key(t) : g?.localStorage?.key;
110
- if (I && S) {
111
- const E = `${S}-${r}-${I}`;
106
+ const I = at(S?.localStorage?.key) ? S.localStorage?.key(t) : S?.localStorage?.key;
107
+ if (I && g) {
108
+ const E = `${g}-${n}-${I}`;
112
109
  let u;
113
110
  try {
114
- u = gt(E)?.lastSyncedWithServer;
111
+ u = St(E)?.lastSyncedWithServer;
115
112
  } catch {
116
113
  }
117
- const f = e.getState().getShadowMetadata(r, []), A = {
114
+ const f = e.getState().getShadowMetadata(n, []), A = {
118
115
  state: t,
119
116
  lastUpdated: Date.now(),
120
117
  lastSyncedWithServer: u,
@@ -126,69 +123,69 @@ const {
126
123
  JSON.stringify(w.json)
127
124
  );
128
125
  }
129
- }, gt = (t) => {
126
+ }, St = (t) => {
130
127
  if (!t) return null;
131
128
  try {
132
- const r = window.localStorage.getItem(t);
133
- return r ? JSON.parse(r) : null;
134
- } catch (r) {
135
- return console.error("Error loading from localStorage:", r), null;
129
+ const n = window.localStorage.getItem(t);
130
+ return n ? JSON.parse(n) : null;
131
+ } catch (n) {
132
+ return console.error("Error loading from localStorage:", n), null;
136
133
  }
137
- }, xt = (t, r) => {
138
- const g = e.getState().getShadowValue(t), { sessionId: S } = Pt(), y = at(r?.localStorage?.key) ? r.localStorage.key(g) : r?.localStorage?.key;
139
- if (y && S) {
140
- const I = gt(
141
- `${S}-${t}-${y}`
134
+ }, xt = (t, n) => {
135
+ const S = e.getState().getShadowValue(t), { sessionId: g } = Pt(), y = at(n?.localStorage?.key) ? n.localStorage.key(S) : n?.localStorage?.key;
136
+ if (y && g) {
137
+ const I = St(
138
+ `${g}-${t}-${y}`
142
139
  );
143
140
  if (I && I.lastUpdated > (I.lastSyncedWithServer || 0))
144
141
  return it(t), !0;
145
142
  }
146
143
  return !1;
147
144
  }, it = (t) => {
148
- const r = e.getState().getShadowMetadata(t, []);
149
- if (!r) return;
150
- const g = /* @__PURE__ */ new Set();
151
- r?.components?.forEach((S) => {
152
- (S ? Array.isArray(S.reactiveType) ? S.reactiveType : [S.reactiveType || "component"] : null)?.includes("none") || g.add(() => S.forceUpdate());
145
+ const n = e.getState().getShadowMetadata(t, []);
146
+ if (!n) return;
147
+ const S = /* @__PURE__ */ new Set();
148
+ n?.components?.forEach((g) => {
149
+ (g ? Array.isArray(g.reactiveType) ? g.reactiveType : [g.reactiveType || "component"] : null)?.includes("none") || S.add(() => g.forceUpdate());
153
150
  }), queueMicrotask(() => {
154
- g.forEach((S) => S());
151
+ S.forEach((g) => g());
155
152
  });
156
- }, ue = (t, r) => {
157
- const g = e.getState().getShadowMetadata(t, []);
158
- if (g) {
159
- const S = `${t}////${r}`, y = g?.components?.get(S);
153
+ }, ue = (t, n) => {
154
+ const S = e.getState().getShadowMetadata(t, []);
155
+ if (S) {
156
+ const g = `${t}////${n}`, y = S?.components?.get(g);
160
157
  if ((y ? Array.isArray(y.reactiveType) ? y.reactiveType : [y.reactiveType || "component"] : null)?.includes("none"))
161
158
  return;
162
159
  y && y.forceUpdate();
163
160
  }
164
161
  };
165
- function wt(t, r, g, S) {
166
- const y = e.getState(), I = y.getShadowMetadata(t, r);
167
- if (y.setShadowMetadata(t, r, {
162
+ function wt(t, n, S, g) {
163
+ const y = e.getState(), I = y.getShadowMetadata(t, n);
164
+ if (y.setShadowMetadata(t, n, {
168
165
  ...I,
169
166
  isDirty: !1,
170
167
  stateSource: "server",
171
- lastServerSync: S || Date.now()
172
- }), Array.isArray(g)) {
173
- const E = y.getShadowMetadata(t, r);
168
+ lastServerSync: g || Date.now()
169
+ }), Array.isArray(S)) {
170
+ const E = y.getShadowMetadata(t, n);
174
171
  E?.arrayKeys && E.arrayKeys.forEach((u, f) => {
175
- const A = u.split(".").slice(1), w = g[f];
172
+ const A = u.split(".").slice(1), w = S[f];
176
173
  w !== void 0 && wt(
177
174
  t,
178
175
  A,
179
176
  w,
180
- S
177
+ g
181
178
  );
182
179
  });
183
- } else g && typeof g == "object" && g.constructor === Object && Object.keys(g).forEach((E) => {
184
- const u = [...r, E], f = g[E];
185
- wt(t, u, f, S);
180
+ } else S && typeof S == "object" && S.constructor === Object && Object.keys(S).forEach((E) => {
181
+ const u = [...n, E], f = S[E];
182
+ wt(t, u, f, g);
186
183
  });
187
184
  }
188
185
  function zt(t, {
189
- stateKey: r,
190
- localStorage: g,
191
- formElements: S,
186
+ stateKey: n,
187
+ localStorage: S,
188
+ formElements: g,
192
189
  reactiveDeps: y,
193
190
  reactiveType: I,
194
191
  componentId: E,
@@ -198,8 +195,8 @@ function zt(t, {
198
195
  serverState: w
199
196
  } = {}) {
200
197
  const [i, h] = K({}), { sessionId: M } = Pt();
201
- let z = !r;
202
- const [c] = K(r ?? rt()), B = e.getState().stateLog[c], J = q(/* @__PURE__ */ new Set()), H = q(E ?? rt()), W = q(
198
+ let z = !n;
199
+ const [c] = K(n ?? rt()), B = e.getState().stateLog[c], J = q(/* @__PURE__ */ new Set()), H = q(E ?? rt()), W = q(
203
200
  null
204
201
  );
205
202
  W.current = nt(c) ?? null, Z(() => {
@@ -221,7 +218,7 @@ function zt(t, {
221
218
  timestamp: a.serverState.timestamp || Date.now()
222
219
  };
223
220
  if (a?.localStorage?.key && M) {
224
- const p = at(a.localStorage.key) ? a.localStorage.key(d) : a.localStorage.key, V = gt(
221
+ const p = at(a.localStorage.key) ? a.localStorage.key(d) : a.localStorage.key, V = St(
225
222
  `${M}-${c}-${p}`
226
223
  );
227
224
  if (V && V.lastUpdated > (a?.serverState?.timestamp || 0))
@@ -241,9 +238,9 @@ function zt(t, {
241
238
  );
242
239
  Z(() => {
243
240
  e.getState().setServerStateUpdate(c, w);
244
- }, [w, c]), Z(() => e.getState().subscribeToPath(c, (n) => {
245
- if (n?.type === "SERVER_STATE_UPDATE") {
246
- const a = n.serverState;
241
+ }, [w, c]), Z(() => e.getState().subscribeToPath(c, (r) => {
242
+ if (r?.type === "SERVER_STATE_UPDATE") {
243
+ const a = r.serverState;
247
244
  if (a?.status === "success" && a.data !== void 0) {
248
245
  yt(c, { serverState: a });
249
246
  const l = typeof a.merge == "object" ? a.merge : a.merge === !0 ? {} : null, p = e.getState().getShadowValue(c), V = a.data;
@@ -295,10 +292,10 @@ function zt(t, {
295
292
  const o = e.getState().getShadowMetadata(c, []);
296
293
  if (o && o.stateSource)
297
294
  return;
298
- const n = nt(c);
299
- if (n?.defaultState !== void 0 || u !== void 0) {
300
- const a = n?.defaultState || u;
301
- n?.defaultState || yt(c, {
295
+ const r = nt(c);
296
+ if (r?.defaultState !== void 0 || u !== void 0) {
297
+ const a = r?.defaultState || u;
298
+ r?.defaultState || yt(c, {
302
299
  defaultState: a
303
300
  });
304
301
  const { value: d, source: l, timestamp: p } = m();
@@ -311,12 +308,12 @@ function zt(t, {
311
308
  }
312
309
  }, [c, ...A || []]), dt(() => {
313
310
  z && yt(c, {
314
- formElements: S,
311
+ formElements: g,
315
312
  defaultState: u,
316
- localStorage: g,
313
+ localStorage: S,
317
314
  middleware: W.current?.middleware
318
315
  });
319
- const o = `${c}////${H.current}`, n = e.getState().getShadowMetadata(c, []), a = n?.components || /* @__PURE__ */ new Map();
316
+ const o = `${c}////${H.current}`, r = e.getState().getShadowMetadata(c, []), a = r?.components || /* @__PURE__ */ new Map();
320
317
  return a.set(o, {
321
318
  forceUpdate: () => h({}),
322
319
  reactiveType: I ?? ["component", "deps"],
@@ -325,7 +322,7 @@ function zt(t, {
325
322
  deps: y ? y(e.getState().getShadowValue(c)) : [],
326
323
  prevDeps: y ? y(e.getState().getShadowValue(c)) : []
327
324
  }), e.getState().setShadowMetadata(c, [], {
328
- ...n,
325
+ ...r,
329
326
  components: a
330
327
  }), h({}), () => {
331
328
  const d = e.getState().getShadowMetadata(c, []), l = d?.components?.get(o);
@@ -335,16 +332,16 @@ function zt(t, {
335
332
  }), d?.components && e.getState().setShadowMetadata(c, [], d);
336
333
  };
337
334
  }, []);
338
- const Y = q(null), Q = (o, n, a) => {
339
- const d = [c, ...n].join(".");
340
- if (Array.isArray(n)) {
341
- const b = `${c}-${n.join(".")}`;
335
+ const Y = q(null), Q = (o, r, a) => {
336
+ const d = [c, ...r].join(".");
337
+ if (Array.isArray(r)) {
338
+ const b = `${c}-${r.join(".")}`;
342
339
  J.current.add(b);
343
340
  }
344
- const l = e.getState(), p = l.getShadowMetadata(c, n), V = l.getShadowValue(d), _ = a.updateType === "insert" && at(o) ? o({ state: V, uuid: rt() }) : at(o) ? o(V) : o, C = {
341
+ const l = e.getState(), p = l.getShadowMetadata(c, r), V = l.getShadowValue(d), _ = a.updateType === "insert" && at(o) ? o({ state: V, uuid: rt() }) : at(o) ? o(V) : o, C = {
345
342
  timeStamp: Date.now(),
346
343
  stateKey: c,
347
- path: n,
344
+ path: r,
348
345
  updateType: a.updateType,
349
346
  status: "new",
350
347
  oldValue: V,
@@ -352,8 +349,8 @@ function zt(t, {
352
349
  };
353
350
  switch (a.updateType) {
354
351
  case "insert": {
355
- l.insertShadowArrayElement(c, n, C.newValue), l.markAsDirty(c, n, { bubble: !0 });
356
- const b = l.getShadowMetadata(c, n);
352
+ l.insertShadowArrayElement(c, r, C.newValue), l.markAsDirty(c, r, { bubble: !0 });
353
+ const b = l.getShadowMetadata(c, r);
357
354
  if (b?.arrayKeys) {
358
355
  const k = b.arrayKeys[b.arrayKeys.length - 1];
359
356
  if (k) {
@@ -364,12 +361,12 @@ function zt(t, {
364
361
  break;
365
362
  }
366
363
  case "cut": {
367
- const b = n.slice(0, -1);
368
- l.removeShadowArrayElement(c, n), l.markAsDirty(c, b, { bubble: !0 });
364
+ const b = r.slice(0, -1);
365
+ l.removeShadowArrayElement(c, r), l.markAsDirty(c, b, { bubble: !0 });
369
366
  break;
370
367
  }
371
368
  case "update": {
372
- l.updateShadowAtPath(c, n, C.newValue), l.markAsDirty(c, n, { bubble: !0 });
369
+ l.updateShadowAtPath(c, r, C.newValue), l.markAsDirty(c, r, { bubble: !0 });
373
370
  break;
374
371
  }
375
372
  }
@@ -396,8 +393,8 @@ function zt(t, {
396
393
  });
397
394
  }
398
395
  if (a.updateType === "insert" && p?.mapWrappers && p.mapWrappers.length > 0) {
399
- const b = l.getShadowMetadata(c, n)?.arrayKeys || [], k = b[b.length - 1], P = l.getShadowValue(k), O = l.getShadowValue(
400
- [c, ...n].join(".")
396
+ const b = l.getShadowMetadata(c, r)?.arrayKeys || [], k = b[b.length - 1], P = l.getShadowValue(k), O = l.getShadowValue(
397
+ [c, ...r].join(".")
401
398
  );
402
399
  if (!k || P === void 0) return;
403
400
  p.mapWrappers.forEach((v) => {
@@ -411,7 +408,7 @@ function zt(t, {
411
408
  if (T) {
412
409
  const D = It(
413
410
  c,
414
- n,
411
+ r,
415
412
  v.meta.transforms
416
413
  ), R = v.meta.transforms.find(
417
414
  (L) => L.type === "sort"
@@ -458,7 +455,7 @@ function zt(t, {
458
455
  });
459
456
  }
460
457
  if (a.updateType === "cut") {
461
- const b = n.slice(0, -1), k = l.getShadowMetadata(c, b);
458
+ const b = r.slice(0, -1), k = l.getShadowMetadata(c, b);
462
459
  k?.mapWrappers && k.mapWrappers.length > 0 && k.mapWrappers.forEach((P) => {
463
460
  if (P.containerRef && P.containerRef.isConnected) {
464
461
  const O = P.containerRef.querySelector(
@@ -476,7 +473,7 @@ function zt(t, {
476
473
  ), !N?.components)
477
474
  return x;
478
475
  if (a.updateType === "update") {
479
- let b = [...n];
476
+ let b = [...r];
480
477
  for (; ; ) {
481
478
  const k = l.getShadowMetadata(c, b);
482
479
  if (k?.pathComponents && k.pathComponents.forEach((P) => {
@@ -489,7 +486,7 @@ function zt(t, {
489
486
  b.pop();
490
487
  }
491
488
  _ && typeof _ == "object" && !Tt(_) && V && typeof V == "object" && !Tt(V) && Ct(_, V).forEach((P) => {
492
- const O = P.split("."), v = [...n, ...O], T = l.getShadowMetadata(c, v);
489
+ const O = P.split("."), v = [...r, ...O], T = l.getShadowMetadata(c, v);
493
490
  T?.pathComponents && T.pathComponents.forEach(($) => {
494
491
  if (j.has($))
495
492
  return;
@@ -498,7 +495,7 @@ function zt(t, {
498
495
  });
499
496
  });
500
497
  } else if (a.updateType === "insert" || a.updateType === "cut") {
501
- const b = a.updateType === "insert" ? n : n.slice(0, -1), k = l.getShadowMetadata(c, b);
498
+ const b = a.updateType === "insert" ? r : r.slice(0, -1), k = l.getShadowMetadata(c, b);
502
499
  if (k?.signals && k.signals.length > 0) {
503
500
  const P = [c, ...b].join("."), O = l.getShadowValue(P);
504
501
  k.signals.forEach(({ parentId: v, position: T, effect: $ }) => {
@@ -560,7 +557,7 @@ function zt(t, {
560
557
  }), x;
561
558
  };
562
559
  e.getState().initialStateGlobal[c] || _t(c, t);
563
- const X = St(() => Dt(
560
+ const X = gt(() => Dt(
564
561
  c,
565
562
  Q,
566
563
  H.current,
@@ -570,47 +567,47 @@ function zt(t, {
570
567
  }
571
568
  function Bt(t) {
572
569
  return !t || t.length === 0 ? "" : t.map(
573
- (r) => (
570
+ (n) => (
574
571
  // Safely stringify dependencies. An empty array becomes '[]'.
575
- `${r.type}${JSON.stringify(r.dependencies || [])}`
572
+ `${n.type}${JSON.stringify(n.dependencies || [])}`
576
573
  )
577
574
  ).join("");
578
575
  }
579
- const It = (t, r, g) => {
580
- let S = e.getState().getShadowMetadata(t, r)?.arrayKeys || [];
581
- if (!g || g.length === 0)
582
- return S;
583
- let y = S.map((I) => ({
576
+ const It = (t, n, S) => {
577
+ let g = e.getState().getShadowMetadata(t, n)?.arrayKeys || [];
578
+ if (!S || S.length === 0)
579
+ return g;
580
+ let y = g.map((I) => ({
584
581
  key: I,
585
582
  value: e.getState().getShadowValue(I)
586
583
  }));
587
- for (const I of g)
584
+ for (const I of S)
588
585
  I.type === "filter" ? y = y.filter(
589
586
  ({ value: E }, u) => I.fn(E, u)
590
587
  ) : I.type === "sort" && y.sort((E, u) => I.fn(E.value, u.value));
591
588
  return y.map(({ key: I }) => I);
592
- }, Vt = (t, r, g) => {
593
- const S = `${t}////${r}`, { addPathComponent: y, getShadowMetadata: I } = e.getState(), u = I(t, [])?.components?.get(S);
594
- !u || u.reactiveType === "none" || !(Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType]).includes("component") || y(t, g, S);
595
- }, ft = (t, r, g) => {
596
- const S = e.getState(), y = S.getShadowMetadata(t, []), I = /* @__PURE__ */ new Set();
589
+ }, Vt = (t, n, S) => {
590
+ const g = `${t}////${n}`, { addPathComponent: y, getShadowMetadata: I } = e.getState(), u = I(t, [])?.components?.get(g);
591
+ !u || u.reactiveType === "none" || !(Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType]).includes("component") || y(t, S, g);
592
+ }, ft = (t, n, S) => {
593
+ const g = e.getState(), y = g.getShadowMetadata(t, []), I = /* @__PURE__ */ new Set();
597
594
  y?.components && y.components.forEach((u, f) => {
598
595
  (Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType || "component"]).includes("all") && (u.forceUpdate(), I.add(f));
599
- }), S.getShadowMetadata(t, [...r, "getSelected"])?.pathComponents?.forEach((u) => {
596
+ }), g.getShadowMetadata(t, [...n, "getSelected"])?.pathComponents?.forEach((u) => {
600
597
  y?.components?.get(u)?.forceUpdate();
601
598
  });
602
- const E = S.getShadowMetadata(t, r);
599
+ const E = g.getShadowMetadata(t, n);
603
600
  for (let u of E?.arrayKeys || []) {
604
- const f = u + ".selected", A = S.getShadowMetadata(
601
+ const f = u + ".selected", A = g.getShadowMetadata(
605
602
  t,
606
603
  f.split(".").slice(1)
607
604
  );
608
- u == g && A?.pathComponents?.forEach((w) => {
605
+ u == S && A?.pathComponents?.forEach((w) => {
609
606
  y?.components?.get(w)?.forceUpdate();
610
607
  });
611
608
  }
612
609
  };
613
- function Dt(t, r, g, S) {
610
+ function Dt(t, n, S, g) {
614
611
  const y = /* @__PURE__ */ new Map();
615
612
  let I = 0;
616
613
  const E = (w) => {
@@ -640,17 +637,17 @@ function Dt(t, r, g, S) {
640
637
  if (m === "getDifferences")
641
638
  return () => {
642
639
  const s = e.getState().getShadowMetadata(t, []), o = e.getState().getShadowValue(t);
643
- let n;
644
- return s?.stateSource === "server" && s.baseServerState ? n = s.baseServerState : n = e.getState().initialStateGlobal[t], Ct(o, n);
640
+ let r;
641
+ return s?.stateSource === "server" && s.baseServerState ? r = s.baseServerState : r = e.getState().initialStateGlobal[t], Ct(o, r);
645
642
  };
646
643
  if (m === "sync" && i.length === 0)
647
644
  return async function() {
648
645
  const s = e.getState().getInitialOptions(t), o = s?.sync;
649
646
  if (!o)
650
647
  return console.error(`No mutation defined for state key "${t}"`), { success: !1, error: "No mutation defined" };
651
- const n = e.getState().getShadowValue(t, []), a = s?.validation?.key;
648
+ const r = e.getState().getShadowValue(t, []), a = s?.validation?.key;
652
649
  try {
653
- const d = await o.action(n);
650
+ const d = await o.action(r);
654
651
  if (d && !d.success && d.errors && a && (e.getState().removeValidationError(a), d.errors.forEach((l) => {
655
652
  const p = [a, ...l.path].join(".");
656
653
  e.getState().addValidationError(p, l.message);
@@ -661,7 +658,7 @@ function Dt(t, r, g, S) {
661
658
  isDirty: !1,
662
659
  lastServerSync: Date.now(),
663
660
  stateSource: "server",
664
- baseServerState: n
661
+ baseServerState: r
665
662
  // Update base server state
666
663
  }), o.onSuccess && o.onSuccess(d.data);
667
664
  } else !d?.success && o.onError && o.onError(d.error);
@@ -672,14 +669,14 @@ function Dt(t, r, g, S) {
672
669
  };
673
670
  if (m === "_status" || m === "getStatus") {
674
671
  const s = () => {
675
- const o = e.getState().getShadowMetadata(t, i), n = e.getState().getShadowValue(c);
676
- return o?.isDirty === !0 ? "dirty" : o?.isDirty === !1 || o?.stateSource === "server" ? "synced" : o?.stateSource === "localStorage" ? "restored" : o?.stateSource === "default" ? "fresh" : e.getState().getShadowMetadata(t, [])?.stateSource === "server" && !o?.isDirty ? "synced" : n !== void 0 && !o ? "fresh" : "unknown";
672
+ const o = e.getState().getShadowMetadata(t, i), r = e.getState().getShadowValue(c);
673
+ return o?.isDirty === !0 ? "dirty" : o?.isDirty === !1 || o?.stateSource === "server" ? "synced" : o?.stateSource === "localStorage" ? "restored" : o?.stateSource === "default" ? "fresh" : e.getState().getShadowMetadata(t, [])?.stateSource === "server" && !o?.isDirty ? "synced" : r !== void 0 && !o ? "fresh" : "unknown";
677
674
  };
678
675
  return m === "_status" ? s() : s;
679
676
  }
680
677
  if (m === "removeStorage")
681
678
  return () => {
682
- const s = e.getState().initialStateGlobal[t], o = nt(t), n = at(o?.localStorage?.key) ? o.localStorage.key(s) : o?.localStorage?.key, a = `${S}-${t}-${n}`;
679
+ const s = e.getState().initialStateGlobal[t], o = nt(t), r = at(o?.localStorage?.key) ? o.localStorage.key(s) : o?.localStorage?.key, a = `${g}-${t}-${r}`;
683
680
  a && localStorage.removeItem(a);
684
681
  };
685
682
  if (m === "showValidationErrors")
@@ -698,14 +695,14 @@ function Dt(t, r, g, S) {
698
695
  const o = e.getState().selectedIndicesMap;
699
696
  if (!o || !o.has(s))
700
697
  return;
701
- const n = o.get(s);
702
- if (h?.validIds && !h.validIds.includes(n))
698
+ const r = o.get(s);
699
+ if (h?.validIds && !h.validIds.includes(r))
703
700
  return;
704
- const a = e.getState().getShadowValue(n);
701
+ const a = e.getState().getShadowValue(r);
705
702
  if (a)
706
703
  return u({
707
704
  currentState: a,
708
- path: n.split(".").slice(1),
705
+ path: r.split(".").slice(1),
709
706
  componentId: M
710
707
  });
711
708
  };
@@ -724,7 +721,7 @@ function Dt(t, r, g, S) {
724
721
  return (s) => {
725
722
  const {
726
723
  itemHeight: o = 50,
727
- overscan: n = 6,
724
+ overscan: r = 6,
728
725
  stickToBottom: a = !1,
729
726
  scrollStickTolerance: d = 75
730
727
  } = s, l = q(null), [p, V] = K({
@@ -747,7 +744,7 @@ function Dt(t, r, g, S) {
747
744
  behavior: C.current ? "instant" : "smooth"
748
745
  });
749
746
  }, [_, a]);
750
- const N = e.getState().getShadowMetadata(t, i)?.arrayKeys || [], { totalHeight: j, itemOffsets: b } = St(() => {
747
+ const N = e.getState().getShadowMetadata(t, i)?.arrayKeys || [], { totalHeight: j, itemOffsets: b } = gt(() => {
751
748
  let v = 0;
752
749
  const T = /* @__PURE__ */ new Map();
753
750
  return (e.getState().getShadowMetadata(t, i)?.arrayKeys || []).forEach((D) => {
@@ -766,7 +763,7 @@ function Dt(t, r, g, S) {
766
763
  v.clientHeight / o
767
764
  ), D = N.length - 1, R = Math.max(
768
765
  0,
769
- D - $ - n
766
+ D - $ - r
770
767
  );
771
768
  V({ startIndex: R, endIndex: D }), requestAnimationFrame(() => {
772
769
  P("instant"), C.current = !1;
@@ -776,7 +773,7 @@ function Dt(t, r, g, S) {
776
773
  };
777
774
  T();
778
775
  }
779
- }, [N.length, a, o, n]);
776
+ }, [N.length, a, o, r]);
780
777
  const k = ct(() => {
781
778
  const v = l.current;
782
779
  if (!v) return;
@@ -793,10 +790,10 @@ function Dt(t, r, g, S) {
793
790
  if (tt !== p.startIndex) {
794
791
  const et = Math.ceil(D / o);
795
792
  V({
796
- startIndex: Math.max(0, tt - n),
793
+ startIndex: Math.max(0, tt - r),
797
794
  endIndex: Math.min(
798
795
  N.length - 1,
799
- tt + et + n
796
+ tt + et + r
800
797
  )
801
798
  });
802
799
  }
@@ -804,7 +801,7 @@ function Dt(t, r, g, S) {
804
801
  N.length,
805
802
  p.startIndex,
806
803
  o,
807
- n,
804
+ r,
808
805
  d
809
806
  ]);
810
807
  Z(() => {
@@ -870,7 +867,7 @@ function Dt(t, r, g, S) {
870
867
  clearTimeout($), R.disconnect(), v.removeEventListener("load", L, !0);
871
868
  };
872
869
  }, [a, N.length, P]), {
873
- virtualState: St(() => {
870
+ virtualState: gt(() => {
874
871
  const v = e.getState(), T = v.getShadowValue(
875
872
  [t, ...i].join(".")
876
873
  ), $ = v.getShadowMetadata(t, i)?.arrayKeys || [], D = T.slice(
@@ -921,7 +918,7 @@ function Dt(t, r, g, S) {
921
918
  };
922
919
  if (m === "stateMap")
923
920
  return (s) => {
924
- const [o, n] = K(
921
+ const [o, r] = K(
925
922
  h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys
926
923
  ), a = e.getState().getShadowValue(c, h?.validIds);
927
924
  if (!o)
@@ -960,11 +957,11 @@ function Dt(t, r, g, S) {
960
957
  return (s) => {
961
958
  const o = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
962
959
  if (o)
963
- for (let n = 0; n < o.length; n++) {
964
- const a = o[n];
960
+ for (let r = 0; r < o.length; r++) {
961
+ const a = o[r];
965
962
  if (!a) continue;
966
963
  const d = e.getState().getShadowValue(a);
967
- if (s(d, n)) {
964
+ if (s(d, r)) {
968
965
  const l = a.split(".").slice(1);
969
966
  return u({
970
967
  currentState: d,
@@ -981,15 +978,15 @@ function Dt(t, r, g, S) {
981
978
  const o = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
982
979
  if (!o)
983
980
  throw new Error("No array keys found for filtering.");
984
- const n = [], a = w.filter(
985
- (d, l) => s(d, l) ? (n.push(o[l]), !0) : !1
981
+ const r = [], a = w.filter(
982
+ (d, l) => s(d, l) ? (r.push(o[l]), !0) : !1
986
983
  );
987
984
  return u({
988
985
  currentState: a,
989
986
  path: i,
990
987
  componentId: M,
991
988
  meta: {
992
- validIds: n,
989
+ validIds: r,
993
990
  transforms: [
994
991
  ...h?.transforms || [],
995
992
  {
@@ -1005,16 +1002,16 @@ function Dt(t, r, g, S) {
1005
1002
  const o = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
1006
1003
  if (!o)
1007
1004
  throw new Error("No array keys found for sorting");
1008
- const n = w.map((a, d) => ({
1005
+ const r = w.map((a, d) => ({
1009
1006
  item: a,
1010
1007
  key: o[d]
1011
1008
  }));
1012
- return n.sort((a, d) => s(a.item, d.item)).filter(Boolean), u({
1013
- currentState: n.map((a) => a.item),
1009
+ return r.sort((a, d) => s(a.item, d.item)).filter(Boolean), u({
1010
+ currentState: r.map((a) => a.item),
1014
1011
  path: i,
1015
1012
  componentId: M,
1016
1013
  meta: {
1017
- validIds: n.map((a) => a.key),
1014
+ validIds: r.map((a) => a.key),
1018
1015
  transforms: [
1019
1016
  ...h?.transforms || [],
1020
1017
  { type: "sort", fn: s }
@@ -1026,7 +1023,7 @@ function Dt(t, r, g, S) {
1026
1023
  return function(s = {}) {
1027
1024
  const {
1028
1025
  bufferSize: o = 100,
1029
- flushInterval: n = 100,
1026
+ flushInterval: r = 100,
1030
1027
  bufferStrategy: a = "accumulate",
1031
1028
  store: d,
1032
1029
  onFlush: l
@@ -1046,19 +1043,19 @@ function Dt(t, r, g, S) {
1046
1043
  if (p = [], d) {
1047
1044
  const b = d(j);
1048
1045
  b !== void 0 && (Array.isArray(b) ? b : [b]).forEach((P) => {
1049
- r(P, i, {
1046
+ n(P, i, {
1050
1047
  updateType: "insert"
1051
1048
  });
1052
1049
  });
1053
1050
  } else
1054
1051
  j.forEach((b) => {
1055
- r(b, i, {
1052
+ n(b, i, {
1056
1053
  updateType: "insert"
1057
1054
  });
1058
1055
  });
1059
1056
  l?.(j);
1060
1057
  };
1061
- n > 0 && (_ = setInterval(C, n));
1058
+ r > 0 && (_ = setInterval(C, r));
1062
1059
  const F = rt(), x = e.getState().getShadowMetadata(t, i) || {}, N = x.streams || /* @__PURE__ */ new Map();
1063
1060
  return N.set(F, { buffer: p, flushTimer: _ }), e.getState().setShadowMetadata(t, i, {
1064
1061
  ...x,
@@ -1082,7 +1079,7 @@ function Dt(t, r, g, S) {
1082
1079
  };
1083
1080
  if (m === "stateList")
1084
1081
  return (s) => /* @__PURE__ */ ot(() => {
1085
- const n = q(/* @__PURE__ */ new Map()), a = h?.transforms && h.transforms.length > 0 ? `${M}-${Bt(h.transforms)}` : `${M}-base`, [d, l] = K({}), { validIds: p, arrayValues: V } = St(() => {
1082
+ const r = q(/* @__PURE__ */ new Map()), a = h?.transforms && h.transforms.length > 0 ? `${M}-${Bt(h.transforms)}` : `${M}-base`, [d, l] = K({}), { validIds: p, arrayValues: V } = gt(() => {
1086
1083
  const U = e.getState().getShadowMetadata(t, i)?.transformCaches?.get(a);
1087
1084
  let C;
1088
1085
  U && U.validIds ? C = U.validIds : (C = It(
@@ -1128,8 +1125,8 @@ function Dt(t, r, g, S) {
1128
1125
  const F = p[C];
1129
1126
  if (!F)
1130
1127
  return null;
1131
- let x = n.current.get(F);
1132
- x || (x = rt(), n.current.set(F, x));
1128
+ let x = r.current.get(F);
1129
+ x || (x = rt(), r.current.set(F, x));
1133
1130
  const N = F.split(".").slice(1);
1134
1131
  return lt(Mt, {
1135
1132
  key: F,
@@ -1147,11 +1144,11 @@ function Dt(t, r, g, S) {
1147
1144
  return (s) => {
1148
1145
  const o = w;
1149
1146
  y.clear(), I++;
1150
- const n = o.flatMap(
1147
+ const r = o.flatMap(
1151
1148
  (a) => a[s] ?? []
1152
1149
  );
1153
1150
  return u({
1154
- currentState: n,
1151
+ currentState: r,
1155
1152
  path: [...i, "[*]", s],
1156
1153
  componentId: M,
1157
1154
  meta: h
@@ -1159,14 +1156,14 @@ function Dt(t, r, g, S) {
1159
1156
  };
1160
1157
  if (m === "index")
1161
1158
  return (s) => {
1162
- const n = e.getState().getShadowMetadata(t, i)?.arrayKeys?.filter(
1159
+ const r = e.getState().getShadowMetadata(t, i)?.arrayKeys?.filter(
1163
1160
  (l) => !h?.validIds || h?.validIds && h?.validIds?.includes(l)
1164
1161
  )?.[s];
1165
- if (!n) return;
1166
- const a = e.getState().getShadowValue(n, h?.validIds);
1162
+ if (!r) return;
1163
+ const a = e.getState().getShadowValue(r, h?.validIds);
1167
1164
  return u({
1168
1165
  currentState: a,
1169
- path: n.split(".").slice(1),
1166
+ path: r.split(".").slice(1),
1170
1167
  componentId: M,
1171
1168
  meta: h
1172
1169
  });
@@ -1175,23 +1172,23 @@ function Dt(t, r, g, S) {
1175
1172
  return () => {
1176
1173
  const s = e.getState().getShadowValue(t, i);
1177
1174
  if (s.length === 0) return;
1178
- const o = s.length - 1, n = s[o], a = [...i, o.toString()];
1175
+ const o = s.length - 1, r = s[o], a = [...i, o.toString()];
1179
1176
  return u({
1180
- currentState: n,
1177
+ currentState: r,
1181
1178
  path: a,
1182
1179
  componentId: M,
1183
1180
  meta: h
1184
1181
  });
1185
1182
  };
1186
1183
  if (m === "insert")
1187
- return (s, o) => (r(s, i, { updateType: "insert" }), u({
1184
+ return (s, o) => (n(s, i, { updateType: "insert" }), u({
1188
1185
  currentState: e.getState().getShadowValue(t, i),
1189
1186
  path: i,
1190
1187
  componentId: M,
1191
1188
  meta: h
1192
1189
  }));
1193
1190
  if (m === "uniqueInsert")
1194
- return (s, o, n) => {
1191
+ return (s, o, r) => {
1195
1192
  const a = e.getState().getShadowValue(t, i), d = at(s) ? s(a) : s;
1196
1193
  let l = null;
1197
1194
  if (!a.some((V) => {
@@ -1200,24 +1197,24 @@ function Dt(t, r, g, S) {
1200
1197
  ) : st(V, d);
1201
1198
  return _ && (l = V), _;
1202
1199
  }))
1203
- E(i), r(d, i, { updateType: "insert" });
1204
- else if (n && l) {
1205
- const V = n(l), _ = a.map(
1200
+ E(i), n(d, i, { updateType: "insert" });
1201
+ else if (r && l) {
1202
+ const V = r(l), _ = a.map(
1206
1203
  (U) => st(U, l) ? V : U
1207
1204
  );
1208
- E(i), r(_, i, {
1205
+ E(i), n(_, i, {
1209
1206
  updateType: "update"
1210
1207
  });
1211
1208
  }
1212
1209
  };
1213
1210
  if (m === "cut")
1214
1211
  return (s, o) => {
1215
- const n = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
1216
- if (!n || n.length === 0) return;
1217
- const a = s == -1 ? n.length - 1 : s !== void 0 ? s : n.length - 1, d = n[a];
1212
+ const r = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
1213
+ if (!r || r.length === 0) return;
1214
+ const a = s == -1 ? r.length - 1 : s !== void 0 ? s : r.length - 1, d = r[a];
1218
1215
  if (!d) return;
1219
1216
  const l = d.split(".").slice(1);
1220
- r(w, l, {
1217
+ n(w, l, {
1221
1218
  updateType: "cut"
1222
1219
  });
1223
1220
  };
@@ -1230,37 +1227,37 @@ function Dt(t, r, g, S) {
1230
1227
  );
1231
1228
  if (!s || s.length === 0) return;
1232
1229
  const o = e.getState().selectedIndicesMap.get(c);
1233
- let n = s.findIndex(
1230
+ let r = s.findIndex(
1234
1231
  (l) => l === o
1235
1232
  );
1236
- const a = s[n == -1 ? s.length - 1 : n]?.split(".").slice(1);
1233
+ const a = s[r == -1 ? s.length - 1 : r]?.split(".").slice(1);
1237
1234
  e.getState().clearSelectedIndex({ arrayKey: c });
1238
1235
  const d = a?.slice(0, -1);
1239
- ft(t, d), r(w, a, {
1236
+ ft(t, d), n(w, a, {
1240
1237
  updateType: "cut"
1241
1238
  });
1242
1239
  };
1243
1240
  if (m === "cutByValue")
1244
1241
  return (s) => {
1245
- const o = e.getState().getShadowMetadata(t, i), n = h?.validIds ?? o?.arrayKeys;
1246
- if (!n) return;
1242
+ const o = e.getState().getShadowMetadata(t, i), r = h?.validIds ?? o?.arrayKeys;
1243
+ if (!r) return;
1247
1244
  let a = null;
1248
- for (const d of n)
1245
+ for (const d of r)
1249
1246
  if (e.getState().getShadowValue(d) === s) {
1250
1247
  a = d;
1251
1248
  break;
1252
1249
  }
1253
1250
  if (a) {
1254
1251
  const d = a.split(".").slice(1);
1255
- r(null, d, { updateType: "cut" });
1252
+ n(null, d, { updateType: "cut" });
1256
1253
  }
1257
1254
  };
1258
1255
  if (m === "toggleByValue")
1259
1256
  return (s) => {
1260
- const o = e.getState().getShadowMetadata(t, i), n = h?.validIds ?? o?.arrayKeys;
1261
- if (!n) return;
1257
+ const o = e.getState().getShadowMetadata(t, i), r = h?.validIds ?? o?.arrayKeys;
1258
+ if (!r) return;
1262
1259
  let a = null;
1263
- for (const d of n) {
1260
+ for (const d of r) {
1264
1261
  const l = e.getState().getShadowValue(d);
1265
1262
  if (console.log("itemValue sdasdasdasd", l), l === s) {
1266
1263
  a = d;
@@ -1269,19 +1266,19 @@ function Dt(t, r, g, S) {
1269
1266
  }
1270
1267
  if (console.log("itemValue keyToCut", a), a) {
1271
1268
  const d = a.split(".").slice(1);
1272
- console.log("itemValue keyToCut", a), r(s, d, {
1269
+ console.log("itemValue keyToCut", a), n(s, d, {
1273
1270
  updateType: "cut"
1274
1271
  });
1275
1272
  } else
1276
- r(s, i, { updateType: "insert" });
1273
+ n(s, i, { updateType: "insert" });
1277
1274
  };
1278
1275
  if (m === "findWith")
1279
1276
  return (s, o) => {
1280
- const n = e.getState().getShadowMetadata(t, i)?.arrayKeys;
1281
- if (!n)
1277
+ const r = e.getState().getShadowMetadata(t, i)?.arrayKeys;
1278
+ if (!r)
1282
1279
  throw new Error("No array keys found for sorting");
1283
1280
  let a = null, d = [];
1284
- for (const l of n) {
1281
+ for (const l of r) {
1285
1282
  let p = e.getState().getShadowValue(l, h?.validIds);
1286
1283
  if (p && p[s] === o) {
1287
1284
  a = p, d = l.split(".").slice(1);
@@ -1299,7 +1296,7 @@ function Dt(t, r, g, S) {
1299
1296
  if (m === "cut") {
1300
1297
  let s = e.getState().getShadowValue(i.join("."));
1301
1298
  return () => {
1302
- r(s, i, { updateType: "cut" });
1299
+ n(s, i, { updateType: "cut" });
1303
1300
  };
1304
1301
  }
1305
1302
  if (m === "get")
@@ -1320,27 +1317,27 @@ function Dt(t, r, g, S) {
1320
1317
  return e.getState().getSyncInfo(s);
1321
1318
  }
1322
1319
  if (m == "getLocalStorage")
1323
- return (s) => gt(S + "-" + t + "-" + s);
1320
+ return (s) => St(g + "-" + t + "-" + s);
1324
1321
  if (m === "isSelected") {
1325
1322
  const s = [t, ...i].slice(0, -1);
1326
1323
  if (ft(t, i, void 0), Array.isArray(
1327
1324
  e.getState().getShadowValue(s.join("."), h?.validIds)
1328
1325
  )) {
1329
1326
  i[i.length - 1];
1330
- const o = s.join("."), n = e.getState().selectedIndicesMap.get(o), a = t + "." + i.join(".");
1331
- return n === a;
1327
+ const o = s.join("."), r = e.getState().selectedIndicesMap.get(o), a = t + "." + i.join(".");
1328
+ return r === a;
1332
1329
  }
1333
1330
  return;
1334
1331
  }
1335
1332
  if (m === "setSelected")
1336
1333
  return (s) => {
1337
- const o = i.slice(0, -1), n = t + "." + o.join("."), a = t + "." + i.join(".");
1338
- ft(t, o, void 0), e.getState().selectedIndicesMap.get(n), s && e.getState().setSelectedIndex(n, a);
1334
+ const o = i.slice(0, -1), r = t + "." + o.join("."), a = t + "." + i.join(".");
1335
+ ft(t, o, void 0), e.getState().selectedIndicesMap.get(r), s && e.getState().setSelectedIndex(r, a);
1339
1336
  };
1340
1337
  if (m === "toggleSelected")
1341
1338
  return () => {
1342
- const s = i.slice(0, -1), o = t + "." + s.join("."), n = t + "." + i.join(".");
1343
- e.getState().selectedIndicesMap.get(o) === n ? e.getState().clearSelectedIndex({ arrayKey: o }) : e.getState().setSelectedIndex(o, n);
1339
+ const s = i.slice(0, -1), o = t + "." + s.join("."), r = t + "." + i.join(".");
1340
+ e.getState().selectedIndicesMap.get(o) === r ? e.getState().clearSelectedIndex({ arrayKey: o }) : e.getState().setSelectedIndex(o, r);
1344
1341
  };
1345
1342
  if (m === "_componentId")
1346
1343
  return M;
@@ -1349,15 +1346,15 @@ function Dt(t, r, g, S) {
1349
1346
  return (s) => {
1350
1347
  const o = e.getState().getInitialOptions(t)?.validation;
1351
1348
  if (!o?.key) throw new Error("Validation key not found");
1352
- ut(o.key), s.forEach((n) => {
1353
- const a = [o.key, ...n.path].join(".");
1354
- pt(a, n.message);
1349
+ ut(o.key), s.forEach((r) => {
1350
+ const a = [o.key, ...r.path].join(".");
1351
+ pt(a, r.message);
1355
1352
  }), it(t);
1356
1353
  };
1357
1354
  if (m === "applyJsonPatch")
1358
1355
  return (s) => {
1359
- const o = e.getState(), n = o.getShadowMetadata(t, []);
1360
- if (!n?.components) return;
1356
+ const o = e.getState(), r = o.getShadowMetadata(t, []);
1357
+ if (!r?.components) return;
1361
1358
  const a = (l) => !l || l === "/" ? [] : l.split("/").slice(1).map((p) => p.replace(/~1/g, "/").replace(/~0/g, "~")), d = /* @__PURE__ */ new Set();
1362
1359
  for (const l of s) {
1363
1360
  const p = a(l.path);
@@ -1374,7 +1371,7 @@ function Dt(t, r, g, S) {
1374
1371
  );
1375
1372
  if (console.log("pathMeta", U), U?.pathComponents && U.pathComponents.forEach((C) => {
1376
1373
  if (!d.has(C)) {
1377
- const F = n.components?.get(C);
1374
+ const F = r.components?.get(C);
1378
1375
  F && (F.forceUpdate(), d.add(C));
1379
1376
  }
1380
1377
  }), _.length === 0) break;
@@ -1393,7 +1390,7 @@ function Dt(t, r, g, S) {
1393
1390
  );
1394
1391
  if (U?.pathComponents && U.pathComponents.forEach((C) => {
1395
1392
  if (!d.has(C)) {
1396
- const F = n.components?.get(C);
1393
+ const F = r.components?.get(C);
1397
1394
  F && (F.forceUpdate(), d.add(C));
1398
1395
  }
1399
1396
  }), _.length === 0) break;
@@ -1412,7 +1409,7 @@ function Dt(t, r, g, S) {
1412
1409
  "Zod schema (v3 or v4) or validation key not found"
1413
1410
  );
1414
1411
  ut(s.key);
1415
- const n = e.getState().getShadowValue(t), a = o.safeParse(n);
1412
+ const r = e.getState().getShadowValue(t), a = o.safeParse(r);
1416
1413
  return a.success ? !0 : ("issues" in a.error ? a.error.issues.forEach((d) => {
1417
1414
  const l = [s.key, ...d.path].join(".");
1418
1415
  pt(l, d.message);
@@ -1444,7 +1441,7 @@ function Dt(t, r, g, S) {
1444
1441
  if (m === "_stateKey") return t;
1445
1442
  if (m === "_path") return i;
1446
1443
  if (m === "update")
1447
- return (s) => (r(s, i, { updateType: "update" }), {
1444
+ return (s) => (n(s, i, { updateType: "update" }), {
1448
1445
  /**
1449
1446
  * Marks this specific item, which was just updated, as 'synced' (not dirty).
1450
1447
  */
@@ -1459,8 +1456,8 @@ function Dt(t, r, g, S) {
1459
1456
  lastServerSync: Date.now()
1460
1457
  // Add timestamp
1461
1458
  });
1462
- const n = [t, ...i].join(".");
1463
- e.getState().notifyPathSubscribers(n, {
1459
+ const r = [t, ...i].join(".");
1460
+ e.getState().notifyPathSubscribers(r, {
1464
1461
  type: "SYNC_STATUS_CHANGE",
1465
1462
  isDirty: !1
1466
1463
  });
@@ -1471,7 +1468,7 @@ function Dt(t, r, g, S) {
1471
1468
  if (console.log("currentValueAtPath", s), typeof w != "boolean")
1472
1469
  throw new Error("toggle() can only be used on boolean values");
1473
1470
  return () => {
1474
- r(!s, i, {
1471
+ n(!s, i, {
1475
1472
  updateType: "update"
1476
1473
  });
1477
1474
  };
@@ -1483,7 +1480,7 @@ function Dt(t, r, g, S) {
1483
1480
  stateKey: t,
1484
1481
  path: i,
1485
1482
  rebuildStateShape: u,
1486
- setState: r,
1483
+ setState: n,
1487
1484
  formOpts: o,
1488
1485
  renderFn: s
1489
1486
  }
@@ -1515,9 +1512,9 @@ function Dt(t, r, g, S) {
1515
1512
  e.getState().clearSelectedIndexesForState(t), y.clear(), I++, e.getState().initializeShadowState(t, M), u({
1516
1513
  currentState: M,
1517
1514
  path: [],
1518
- componentId: g
1515
+ componentId: S
1519
1516
  });
1520
- const z = nt(t), c = at(z?.localStorage?.key) ? z?.localStorage?.key(M) : z?.localStorage?.key, B = `${S}-${t}-${c}`;
1517
+ const z = nt(t), c = at(z?.localStorage?.key) ? z?.localStorage?.key(M) : z?.localStorage?.key, B = `${g}-${t}-${c}`;
1521
1518
  B && localStorage.removeItem(B);
1522
1519
  const J = e.getState().getShadowMetadata(t, []);
1523
1520
  return J && J?.components?.forEach((H) => {
@@ -1528,10 +1525,10 @@ function Dt(t, r, g, S) {
1528
1525
  y.clear(), I++;
1529
1526
  const i = Dt(
1530
1527
  t,
1531
- r,
1532
- g,
1533
- S
1534
- ), h = e.getState().initialStateGlobal[t], M = nt(t), z = at(M?.localStorage?.key) ? M?.localStorage?.key(h) : M?.localStorage?.key, c = `${S}-${t}-${z}`;
1528
+ n,
1529
+ S,
1530
+ g
1531
+ ), h = e.getState().initialStateGlobal[t], M = nt(t), z = at(M?.localStorage?.key) ? M?.localStorage?.key(h) : M?.localStorage?.key, c = `${g}-${t}-${z}`;
1535
1532
  return localStorage.getItem(c) && localStorage.removeItem(c), Rt(() => {
1536
1533
  _t(t, w), e.getState().initializeShadowState(t, w);
1537
1534
  const B = e.getState().getShadowMetadata(t, []);
@@ -1545,7 +1542,7 @@ function Dt(t, r, g, S) {
1545
1542
  };
1546
1543
  return u({
1547
1544
  currentState: e.getState().getShadowValue(t, []),
1548
- componentId: g,
1545
+ componentId: S,
1549
1546
  path: []
1550
1547
  });
1551
1548
  }
@@ -1554,21 +1551,21 @@ function bt(t) {
1554
1551
  }
1555
1552
  function qt({
1556
1553
  proxy: t,
1557
- rebuildStateShape: r
1554
+ rebuildStateShape: n
1558
1555
  }) {
1559
- const g = q(null), S = q(`map-${crypto.randomUUID()}`), y = q(!1), I = q(/* @__PURE__ */ new Map());
1556
+ const S = q(null), g = q(`map-${crypto.randomUUID()}`), y = q(!1), I = q(/* @__PURE__ */ new Map());
1560
1557
  Z(() => {
1561
- const u = g.current;
1558
+ const u = S.current;
1562
1559
  if (!u || y.current) return;
1563
1560
  const f = setTimeout(() => {
1564
1561
  const A = e.getState().getShadowMetadata(t._stateKey, t._path) || {}, w = A.mapWrappers || [];
1565
1562
  w.push({
1566
- instanceId: S.current,
1563
+ instanceId: g.current,
1567
1564
  mapFn: t._mapFn,
1568
1565
  containerRef: u,
1569
- rebuildStateShape: r,
1566
+ rebuildStateShape: n,
1570
1567
  path: t._path,
1571
- componentId: S.current,
1568
+ componentId: g.current,
1572
1569
  meta: t._meta
1573
1570
  }), e.getState().setShadowMetadata(t._stateKey, t._path, {
1574
1571
  ...A,
@@ -1576,27 +1573,27 @@ function qt({
1576
1573
  }), y.current = !0, E();
1577
1574
  }, 0);
1578
1575
  return () => {
1579
- if (clearTimeout(f), S.current) {
1576
+ if (clearTimeout(f), g.current) {
1580
1577
  const A = e.getState().getShadowMetadata(t._stateKey, t._path) || {};
1581
1578
  A.mapWrappers && (A.mapWrappers = A.mapWrappers.filter(
1582
- (w) => w.instanceId !== S.current
1579
+ (w) => w.instanceId !== g.current
1583
1580
  ), e.getState().setShadowMetadata(t._stateKey, t._path, A));
1584
1581
  }
1585
1582
  I.current.forEach((A) => A.unmount());
1586
1583
  };
1587
1584
  }, []);
1588
1585
  const E = () => {
1589
- const u = g.current;
1586
+ const u = S.current;
1590
1587
  if (!u) return;
1591
1588
  const f = e.getState().getShadowValue(
1592
1589
  [t._stateKey, ...t._path].join("."),
1593
1590
  t._meta?.validIds
1594
1591
  );
1595
1592
  if (!Array.isArray(f)) return;
1596
- const A = t._meta?.validIds ?? e.getState().getShadowMetadata(t._stateKey, t._path)?.arrayKeys ?? [], w = r({
1593
+ const A = t._meta?.validIds ?? e.getState().getShadowMetadata(t._stateKey, t._path)?.arrayKeys ?? [], w = n({
1597
1594
  currentState: f,
1598
1595
  path: t._path,
1599
- componentId: S.current,
1596
+ componentId: g.current,
1600
1597
  meta: t._meta
1601
1598
  });
1602
1599
  f.forEach((i, h) => {
@@ -1614,24 +1611,24 @@ function qt({
1614
1611
  itemPath: J,
1615
1612
  localIndex: h,
1616
1613
  arraySetter: w,
1617
- rebuildStateShape: r,
1614
+ rebuildStateShape: n,
1618
1615
  renderFn: t._mapFn
1619
1616
  })
1620
1617
  );
1621
1618
  });
1622
1619
  };
1623
- return /* @__PURE__ */ ot("div", { ref: g, "data-map-container": S.current });
1620
+ return /* @__PURE__ */ ot("div", { ref: S, "data-map-container": g.current });
1624
1621
  }
1625
1622
  function Gt({
1626
1623
  proxy: t
1627
1624
  }) {
1628
- const r = q(null), g = q(null), S = q(!1), y = `${t._stateKey}-${t._path.join(".")}`, I = e.getState().getShadowValue(
1625
+ const n = q(null), S = q(null), g = q(!1), y = `${t._stateKey}-${t._path.join(".")}`, I = e.getState().getShadowValue(
1629
1626
  [t._stateKey, ...t._path].join("."),
1630
1627
  t._meta?.validIds
1631
1628
  );
1632
1629
  return Z(() => {
1633
- const E = r.current;
1634
- if (!E || S.current) return;
1630
+ const E = n.current;
1631
+ if (!E || g.current) return;
1635
1632
  const u = setTimeout(() => {
1636
1633
  if (!E.parentElement) {
1637
1634
  console.warn("Parent element not found for signal", y);
@@ -1639,10 +1636,10 @@ function Gt({
1639
1636
  }
1640
1637
  const f = E.parentElement, w = Array.from(f.childNodes).indexOf(E);
1641
1638
  let i = f.getAttribute("data-parent-id");
1642
- i || (i = `parent-${crypto.randomUUID()}`, f.setAttribute("data-parent-id", i)), g.current = `instance-${crypto.randomUUID()}`;
1639
+ i || (i = `parent-${crypto.randomUUID()}`, f.setAttribute("data-parent-id", i)), S.current = `instance-${crypto.randomUUID()}`;
1643
1640
  const h = e.getState().getShadowMetadata(t._stateKey, t._path) || {}, M = h.signals || [];
1644
1641
  M.push({
1645
- instanceId: g.current,
1642
+ instanceId: S.current,
1646
1643
  parentId: i,
1647
1644
  position: w,
1648
1645
  effect: t._effect
@@ -1662,61 +1659,61 @@ function Gt({
1662
1659
  }
1663
1660
  z !== null && typeof z == "object" && (z = JSON.stringify(z));
1664
1661
  const c = document.createTextNode(String(z ?? ""));
1665
- E.replaceWith(c), S.current = !0;
1662
+ E.replaceWith(c), g.current = !0;
1666
1663
  }, 0);
1667
1664
  return () => {
1668
- if (clearTimeout(u), g.current) {
1665
+ if (clearTimeout(u), S.current) {
1669
1666
  const f = e.getState().getShadowMetadata(t._stateKey, t._path) || {};
1670
1667
  f.signals && (f.signals = f.signals.filter(
1671
- (A) => A.instanceId !== g.current
1668
+ (A) => A.instanceId !== S.current
1672
1669
  ), e.getState().setShadowMetadata(t._stateKey, t._path, f));
1673
1670
  }
1674
1671
  };
1675
1672
  }, []), lt("span", {
1676
- ref: r,
1673
+ ref: n,
1677
1674
  style: { display: "contents" },
1678
1675
  "data-signal-id": y
1679
1676
  });
1680
1677
  }
1681
1678
  const Mt = Ot(
1682
1679
  Yt,
1683
- (t, r) => t.itemPath.join(".") === r.itemPath.join(".") && t.stateKey === r.stateKey && t.itemComponentId === r.itemComponentId && t.localIndex === r.localIndex
1680
+ (t, n) => t.itemPath.join(".") === n.itemPath.join(".") && t.stateKey === n.stateKey && t.itemComponentId === n.itemComponentId && t.localIndex === n.localIndex
1684
1681
  ), Jt = (t) => {
1685
- const [r, g] = K(!1);
1682
+ const [n, S] = K(!1);
1686
1683
  return dt(() => {
1687
1684
  if (!t.current) {
1688
- g(!0);
1685
+ S(!0);
1689
1686
  return;
1690
1687
  }
1691
- const S = Array.from(t.current.querySelectorAll("img"));
1692
- if (S.length === 0) {
1693
- g(!0);
1688
+ const g = Array.from(t.current.querySelectorAll("img"));
1689
+ if (g.length === 0) {
1690
+ S(!0);
1694
1691
  return;
1695
1692
  }
1696
1693
  let y = 0;
1697
1694
  const I = () => {
1698
- y++, y === S.length && g(!0);
1695
+ y++, y === g.length && S(!0);
1699
1696
  };
1700
- return S.forEach((E) => {
1697
+ return g.forEach((E) => {
1701
1698
  E.complete ? I() : (E.addEventListener("load", I), E.addEventListener("error", I));
1702
1699
  }), () => {
1703
- S.forEach((E) => {
1700
+ g.forEach((E) => {
1704
1701
  E.removeEventListener("load", I), E.removeEventListener("error", I);
1705
1702
  });
1706
1703
  };
1707
- }, [t.current]), r;
1704
+ }, [t.current]), n;
1708
1705
  };
1709
1706
  function Yt({
1710
1707
  stateKey: t,
1711
- itemComponentId: r,
1712
- itemPath: g,
1713
- localIndex: S,
1708
+ itemComponentId: n,
1709
+ itemPath: S,
1710
+ localIndex: g,
1714
1711
  arraySetter: y,
1715
1712
  rebuildStateShape: I,
1716
1713
  renderFn: E
1717
1714
  }) {
1718
- const [, u] = K({}), { ref: f, inView: A } = jt(), w = q(null), i = Jt(w), h = q(!1), M = [t, ...g].join(".");
1719
- $t(t, r, u);
1715
+ const [, u] = K({}), { ref: f, inView: A } = jt(), w = q(null), i = Jt(w), h = q(!1), M = [t, ...S].join(".");
1716
+ $t(t, n, u);
1720
1717
  const z = ct(
1721
1718
  (W) => {
1722
1719
  w.current = W, f(W);
@@ -1734,39 +1731,39 @@ function Yt({
1734
1731
  if (W && W.offsetHeight > 0) {
1735
1732
  h.current = !0;
1736
1733
  const m = W.offsetHeight;
1737
- e.getState().setShadowMetadata(t, g, {
1734
+ e.getState().setShadowMetadata(t, S, {
1738
1735
  virtualizer: {
1739
1736
  itemHeight: m,
1740
1737
  domRef: W
1741
1738
  }
1742
1739
  });
1743
- const Y = g.slice(0, -1), Q = [t, ...Y].join(".");
1740
+ const Y = S.slice(0, -1), Q = [t, ...Y].join(".");
1744
1741
  e.getState().notifyPathSubscribers(Q, {
1745
1742
  type: "ITEMHEIGHT",
1746
- itemKey: g.join("."),
1743
+ itemKey: S.join("."),
1747
1744
  ref: w.current
1748
1745
  });
1749
1746
  }
1750
- }, [A, i, t, g]);
1751
- const c = [t, ...g].join("."), B = e.getState().getShadowValue(c);
1747
+ }, [A, i, t, S]);
1748
+ const c = [t, ...S].join("."), B = e.getState().getShadowValue(c);
1752
1749
  if (B === void 0)
1753
1750
  return null;
1754
1751
  const J = I({
1755
1752
  currentState: B,
1756
- path: g,
1757
- componentId: r
1758
- }), H = E(J, S, y);
1753
+ path: S,
1754
+ componentId: n
1755
+ }), H = E(J, g, y);
1759
1756
  return /* @__PURE__ */ ot("div", { ref: z, children: H });
1760
1757
  }
1761
1758
  function Zt({
1762
1759
  stateKey: t,
1763
- path: r,
1764
- rebuildStateShape: g,
1765
- renderFn: S,
1760
+ path: n,
1761
+ rebuildStateShape: S,
1762
+ renderFn: g,
1766
1763
  formOpts: y,
1767
1764
  setState: I
1768
1765
  }) {
1769
- const [E] = K(() => rt()), [, u] = K({}), f = [t, ...r].join(".");
1766
+ const [E] = K(() => rt()), [, u] = K({}), f = [t, ...n].join(".");
1770
1767
  $t(t, E, u);
1771
1768
  const A = e.getState().getShadowValue(f), [w, i] = K(A), h = q(!1), M = q(null);
1772
1769
  Z(() => {
@@ -1784,12 +1781,12 @@ function Zt({
1784
1781
  typeof A === "number" && typeof H == "string" && (H = H === "" ? 0 : Number(H)), i(H), h.current = !0, M.current && clearTimeout(M.current);
1785
1782
  const m = y?.debounceTime ?? 200;
1786
1783
  M.current = setTimeout(() => {
1787
- h.current = !1, I(H, r, { updateType: "update" });
1784
+ h.current = !1, I(H, n, { updateType: "update" });
1788
1785
  const { getInitialOptions: Y, setShadowMetadata: Q, getShadowMetadata: X } = e.getState(), s = Y(t)?.validation, o = s?.zodSchemaV4 || s?.zodSchemaV3;
1789
1786
  if (o) {
1790
- const n = e.getState().getShadowValue(t), a = o.safeParse(n), d = X(t, r) || {};
1787
+ const r = e.getState().getShadowValue(t), a = o.safeParse(r), d = X(t, n) || {};
1791
1788
  if (a.success)
1792
- Q(t, r, {
1789
+ Q(t, n, {
1793
1790
  ...d,
1794
1791
  validation: {
1795
1792
  status: "VALID_LIVE",
@@ -1798,16 +1795,16 @@ function Zt({
1798
1795
  });
1799
1796
  else {
1800
1797
  const p = ("issues" in a.error ? a.error.issues : a.error.errors).filter(
1801
- (V) => JSON.stringify(V.path) === JSON.stringify(r)
1798
+ (V) => JSON.stringify(V.path) === JSON.stringify(n)
1802
1799
  );
1803
- p.length > 0 ? Q(t, r, {
1800
+ p.length > 0 ? Q(t, n, {
1804
1801
  ...d,
1805
1802
  validation: {
1806
1803
  status: "INVALID_LIVE",
1807
1804
  message: p[0]?.message,
1808
1805
  validatedValue: H
1809
1806
  }
1810
- }) : Q(t, r, {
1807
+ }) : Q(t, n, {
1811
1808
  ...d,
1812
1809
  validation: {
1813
1810
  status: "VALID_LIVE",
@@ -1818,13 +1815,13 @@ function Zt({
1818
1815
  }
1819
1816
  }, m), u({});
1820
1817
  },
1821
- [I, r, y?.debounceTime, t]
1818
+ [I, n, y?.debounceTime, t]
1822
1819
  ), c = ct(async () => {
1823
- console.log("handleBlur triggered"), M.current && (clearTimeout(M.current), M.current = null, h.current = !1, I(w, r, { updateType: "update" }));
1820
+ console.log("handleBlur triggered"), M.current && (clearTimeout(M.current), M.current = null, h.current = !1, I(w, n, { updateType: "update" }));
1824
1821
  const { getInitialOptions: H } = e.getState(), W = H(t)?.validation, m = W?.zodSchemaV4 || W?.zodSchemaV3;
1825
1822
  if (!m) return;
1826
- const Y = e.getState().getShadowMetadata(t, r);
1827
- e.getState().setShadowMetadata(t, r, {
1823
+ const Y = e.getState().getShadowMetadata(t, n);
1824
+ e.getState().setShadowMetadata(t, n, {
1828
1825
  ...Y,
1829
1826
  validation: {
1830
1827
  status: "DIRTY",
@@ -1833,7 +1830,7 @@ function Zt({
1833
1830
  });
1834
1831
  const Q = e.getState().getShadowValue(t), X = m.safeParse(Q);
1835
1832
  if (console.log("result ", X), X.success)
1836
- e.getState().setShadowMetadata(t, r, {
1833
+ e.getState().setShadowMetadata(t, n, {
1837
1834
  ...Y,
1838
1835
  validation: {
1839
1836
  status: "VALID_PENDING_SYNC",
@@ -1842,32 +1839,32 @@ function Zt({
1842
1839
  });
1843
1840
  else {
1844
1841
  const s = "issues" in X.error ? X.error.issues : X.error.errors;
1845
- console.log("All validation errors:", s), console.log("Current blur path:", r);
1846
- const o = s.filter((n) => {
1847
- if (console.log("Processing error:", n), r.some((d) => d.startsWith("id:"))) {
1842
+ console.log("All validation errors:", s), console.log("Current blur path:", n);
1843
+ const o = s.filter((r) => {
1844
+ if (console.log("Processing error:", r), n.some((d) => d.startsWith("id:"))) {
1848
1845
  console.log("Detected array path with ULID");
1849
- const d = r[0].startsWith("id:") ? [] : r.slice(0, -1);
1846
+ const d = n[0].startsWith("id:") ? [] : n.slice(0, -1);
1850
1847
  console.log("Parent path:", d);
1851
1848
  const l = e.getState().getShadowMetadata(t, d);
1852
1849
  if (console.log("Array metadata:", l), l?.arrayKeys) {
1853
- const p = [t, ...r.slice(0, -1)].join("."), V = l.arrayKeys.indexOf(p);
1850
+ const p = [t, ...n.slice(0, -1)].join("."), V = l.arrayKeys.indexOf(p);
1854
1851
  console.log("Item key:", p, "Index:", V);
1855
- const _ = [...d, V, ...r.slice(-1)], U = JSON.stringify(n.path) === JSON.stringify(_);
1852
+ const _ = [...d, V, ...n.slice(-1)], U = JSON.stringify(r.path) === JSON.stringify(_);
1856
1853
  return console.log("Zod path comparison:", {
1857
1854
  zodPath: _,
1858
- errorPath: n.path,
1855
+ errorPath: r.path,
1859
1856
  match: U
1860
1857
  }), U;
1861
1858
  }
1862
1859
  }
1863
- const a = JSON.stringify(n.path) === JSON.stringify(r);
1860
+ const a = JSON.stringify(r.path) === JSON.stringify(n);
1864
1861
  return console.log("Direct path comparison:", {
1865
- errorPath: n.path,
1866
- currentPath: r,
1862
+ errorPath: r.path,
1863
+ currentPath: n,
1867
1864
  match: a
1868
1865
  }), a;
1869
1866
  });
1870
- console.log("Filtered path errors:", o), e.getState().setShadowMetadata(t, r, {
1867
+ console.log("Filtered path errors:", o), e.getState().setShadowMetadata(t, n, {
1871
1868
  ...Y,
1872
1869
  validation: {
1873
1870
  status: "VALIDATION_FAILED",
@@ -1877,9 +1874,9 @@ function Zt({
1877
1874
  });
1878
1875
  }
1879
1876
  u({});
1880
- }, [t, r, w, I]), B = g({
1877
+ }, [t, n, w, I]), B = S({
1881
1878
  currentState: A,
1882
- path: r,
1879
+ path: n,
1883
1880
  componentId: E
1884
1881
  }), J = new Proxy(B, {
1885
1882
  get(H, W) {
@@ -1890,24 +1887,24 @@ function Zt({
1890
1887
  },
1891
1888
  // 5. Wire the new onBlur handler to the input props.
1892
1889
  onBlur: c,
1893
- ref: vt.getState().getFormRef(t + "." + r.join("."))
1890
+ ref: vt.getState().getFormRef(t + "." + n.join("."))
1894
1891
  } : H[W];
1895
1892
  }
1896
1893
  });
1897
- return /* @__PURE__ */ ot(kt, { formOpts: y, path: r, stateKey: t, children: S(J) });
1894
+ return /* @__PURE__ */ ot(kt, { formOpts: y, path: n, stateKey: t, children: g(J) });
1898
1895
  }
1899
- function $t(t, r, g) {
1900
- const S = `${t}////${r}`;
1896
+ function $t(t, n, S) {
1897
+ const g = `${t}////${n}`;
1901
1898
  dt(() => {
1902
1899
  const { registerComponent: y, unregisterComponent: I } = e.getState();
1903
- return y(t, S, {
1904
- forceUpdate: () => g({}),
1900
+ return y(t, g, {
1901
+ forceUpdate: () => S({}),
1905
1902
  paths: /* @__PURE__ */ new Set(),
1906
1903
  reactiveType: ["component"]
1907
1904
  }), () => {
1908
- I(t, S);
1905
+ I(t, g);
1909
1906
  };
1910
- }, [t, S]);
1907
+ }, [t, g]);
1911
1908
  }
1912
1909
  export {
1913
1910
  bt as $cogsSignal,