cogsbox-state 0.5.163 → 0.5.164

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,26 +1,26 @@
1
1
  "use client";
2
- import { jsx as Se } from "react/jsx-runtime";
3
- import { useState as ie, useRef as Y, useEffect as se, useLayoutEffect as Ne, useMemo as $e, createElement as K, useSyncExternalStore as ke, startTransition as we } from "react";
4
- import { transformStateFunc as Ae, isFunction as G, getNestedValue as W, getDifferences as Ee, isDeepEqual as U, debounce as Te } from "./utility.js";
5
- import { pushFunc as ae, updateFn as B, cutFunc as H, ValidationWrapper as xe, FormControlComponent as Ve } from "./Functions.jsx";
6
- import Ce from "./node_modules/superjson/dist/index.js";
2
+ import { jsx as me } from "react/jsx-runtime";
3
+ import { useState as le, useRef as Q, useEffect as de, useLayoutEffect as Ne, useMemo as ke, createElement as te, useSyncExternalStore as we, startTransition as Ae } from "react";
4
+ import { transformStateFunc as Te, isDeepEqual as U, isFunction as G, getNestedValue as W, getDifferences as he, debounce as xe } from "./utility.js";
5
+ import { pushFunc as se, updateFn as Z, cutFunc as X, ValidationWrapper as Ve, FormControlComponent as Ce } from "./Functions.jsx";
6
+ import be from "./node_modules/superjson/dist/index.js";
7
7
  import "zod";
8
- import { getGlobalStore as a, formRefStore as me } from "./store.js";
8
+ import { getGlobalStore as a, formRefStore as ye } from "./store.js";
9
9
  import { useCogsConfig as _e } from "./CogsStateClient.jsx";
10
- import ce from "./node_modules/uuid/dist/esm-browser/v4.js";
11
- function ye(e, c) {
12
- const m = a.getState().getInitialOptions, u = a.getState().setInitialStateOptions, d = m(e) || {};
13
- u(e, {
10
+ import ge from "./node_modules/uuid/dist/esm-browser/v4.js";
11
+ function ve(e, c) {
12
+ const m = a.getState().getInitialOptions, g = a.getState().setInitialStateOptions, d = m(e) || {};
13
+ g(e, {
14
14
  ...d,
15
15
  ...c
16
16
  });
17
17
  }
18
- function ve({
18
+ function Ie({
19
19
  stateKey: e,
20
20
  options: c,
21
21
  initialOptionsPart: m
22
22
  }) {
23
- const u = z(e) || {}, d = m[e] || {}, I = a.getState().setInitialStateOptions, E = { ...d, ...u };
23
+ const g = z(e) || {}, d = m[e] || {}, I = a.getState().setInitialStateOptions, E = { ...d, ...g };
24
24
  let f = !1;
25
25
  if (c)
26
26
  for (const l in c)
@@ -33,7 +33,7 @@ function Ye(e, { formElements: c, validation: m }) {
33
33
  }
34
34
  const Xe = (e, c) => {
35
35
  let m = e;
36
- const [u, d] = Ae(m);
36
+ const [g, d] = Te(m);
37
37
  (Object.keys(d).length > 0 || c && Object.keys(c).length > 0) && Object.keys(d).forEach((f) => {
38
38
  d[f] = d[f] || {}, d[f].formElements = {
39
39
  ...c?.formElements,
@@ -42,15 +42,15 @@ const Xe = (e, c) => {
42
42
  ...d[f].formElements || {}
43
43
  // State-specific overrides
44
44
  }, z(f) || a.getState().setInitialStateOptions(f, d[f]);
45
- }), a.getState().setInitialStates(u), a.getState().setCreatedState(u);
45
+ }), a.getState().setInitialStates(g), a.getState().setCreatedState(g);
46
46
  const I = (f, l) => {
47
- const [S] = ie(l?.componentId ?? ce());
48
- ve({
47
+ const [S] = le(l?.componentId ?? ge());
48
+ Ie({
49
49
  stateKey: f,
50
50
  options: l,
51
51
  initialOptionsPart: d
52
52
  });
53
- const t = a.getState().cogsStateStore[f] || u[f], v = l?.modifyState ? l.modifyState(t) : t, [x, V] = Re(
53
+ const t = a.getState().cogsStateStore[f] || g[f], v = l?.modifyState ? l.modifyState(t) : t, [T, b] = De(
54
54
  v,
55
55
  {
56
56
  stateKey: f,
@@ -66,49 +66,49 @@ const Xe = (e, c) => {
66
66
  serverState: l?.serverState
67
67
  }
68
68
  );
69
- return V;
69
+ return b;
70
70
  };
71
71
  function E(f, l) {
72
- ve({ stateKey: f, options: l, initialOptionsPart: d }), l.localStorage && pe(f, l), te(f);
72
+ Ie({ stateKey: f, options: l, initialOptionsPart: d }), l.localStorage && Fe(f, l), re(f);
73
73
  }
74
74
  return { useCogsState: I, setCogsOptions: E };
75
75
  }, {
76
- setUpdaterState: X,
76
+ setUpdaterState: K,
77
77
  setState: q,
78
78
  getInitialOptions: z,
79
- getKeyState: he,
80
- getValidationErrors: be,
81
- setStateLog: Pe,
82
- updateInitialStateGlobal: le,
83
- addValidationError: je,
79
+ getKeyState: $e,
80
+ getValidationErrors: Pe,
81
+ setStateLog: je,
82
+ updateInitialStateGlobal: ue,
83
+ addValidationError: Oe,
84
84
  removeValidationError: M,
85
- setServerSyncActions: Oe
86
- } = a.getState(), Ie = (e, c, m, u, d) => {
85
+ setServerSyncActions: pe
86
+ } = a.getState(), Ee = (e, c, m, g, d) => {
87
87
  m?.log && console.log(
88
88
  "saving to localstorage",
89
89
  c,
90
90
  m.localStorage?.key,
91
- u
91
+ g
92
92
  );
93
93
  const I = G(m?.localStorage?.key) ? m.localStorage?.key(e) : m?.localStorage?.key;
94
- if (I && u) {
95
- const E = `${u}-${c}-${I}`;
94
+ if (I && g) {
95
+ const E = `${g}-${c}-${I}`;
96
96
  let f;
97
97
  try {
98
- f = ee(E)?.lastSyncedWithServer;
98
+ f = ne(E)?.lastSyncedWithServer;
99
99
  } catch {
100
100
  }
101
101
  const l = {
102
102
  state: e,
103
103
  lastUpdated: Date.now(),
104
104
  lastSyncedWithServer: d ?? f
105
- }, S = Ce.serialize(l);
105
+ }, S = be.serialize(l);
106
106
  window.localStorage.setItem(
107
107
  E,
108
108
  JSON.stringify(S.json)
109
109
  );
110
110
  }
111
- }, ee = (e) => {
111
+ }, ne = (e) => {
112
112
  if (!e) return null;
113
113
  try {
114
114
  const c = window.localStorage.getItem(e);
@@ -116,50 +116,50 @@ const Xe = (e, c) => {
116
116
  } catch (c) {
117
117
  return console.error("Error loading from localStorage:", c), null;
118
118
  }
119
- }, pe = (e, c) => {
120
- const m = a.getState().cogsStateStore[e], { sessionId: u } = _e(), d = G(c?.localStorage?.key) ? c.localStorage.key(m) : c?.localStorage?.key;
121
- if (d && u) {
122
- const I = ee(
123
- `${u}-${e}-${d}`
119
+ }, Fe = (e, c) => {
120
+ const m = a.getState().cogsStateStore[e], { sessionId: g } = _e(), d = G(c?.localStorage?.key) ? c.localStorage.key(m) : c?.localStorage?.key;
121
+ if (d && g) {
122
+ const I = ne(
123
+ `${g}-${e}-${d}`
124
124
  );
125
125
  if (I && I.lastUpdated > (I.lastSyncedWithServer || 0))
126
- return q(e, I.state), te(e), !0;
126
+ return q(e, I.state), re(e), !0;
127
127
  }
128
128
  return !1;
129
- }, Fe = (e, c, m, u, d, I) => {
129
+ }, Re = (e, c, m, g, d, I) => {
130
130
  const E = {
131
131
  initialState: c,
132
- updaterState: Q(
132
+ updaterState: ee(
133
133
  e,
134
- u,
134
+ g,
135
135
  d,
136
136
  I
137
137
  ),
138
138
  state: m
139
139
  };
140
- le(e, E.initialState), X(e, E.updaterState), q(e, E.state);
141
- }, te = (e) => {
140
+ ue(e, E.initialState), K(e, E.updaterState), q(e, E.state);
141
+ }, re = (e) => {
142
142
  const c = a.getState().stateComponents.get(e);
143
143
  if (!c) return;
144
144
  const m = /* @__PURE__ */ new Set();
145
- c.components.forEach((u) => {
146
- (u ? Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType || "component"] : null)?.includes("none") || m.add(() => u.forceUpdate());
145
+ c.components.forEach((g) => {
146
+ (g ? Array.isArray(g.reactiveType) ? g.reactiveType : [g.reactiveType || "component"] : null)?.includes("none") || m.add(() => g.forceUpdate());
147
147
  }), queueMicrotask(() => {
148
- m.forEach((u) => u());
148
+ m.forEach((g) => g());
149
149
  });
150
150
  }, Qe = (e, c) => {
151
151
  const m = a.getState().stateComponents.get(e);
152
152
  if (m) {
153
- const u = `${e}////${c}`, d = m.components.get(u);
153
+ const g = `${e}////${c}`, d = m.components.get(g);
154
154
  if ((d ? Array.isArray(d.reactiveType) ? d.reactiveType : [d.reactiveType || "component"] : null)?.includes("none"))
155
155
  return;
156
156
  d && d.forceUpdate();
157
157
  }
158
158
  };
159
- function Re(e, {
159
+ function De(e, {
160
160
  stateKey: c,
161
161
  serverSync: m,
162
- localStorage: u,
162
+ localStorage: g,
163
163
  formElements: d,
164
164
  middleware: I,
165
165
  reactiveDeps: E,
@@ -168,14 +168,14 @@ function Re(e, {
168
168
  initialState: S,
169
169
  syncUpdate: t,
170
170
  dependencies: v,
171
- serverState: x
171
+ serverState: T
172
172
  } = {}) {
173
- const [V, P] = ie({}), { sessionId: h } = _e();
174
- let j = !c;
175
- const [r] = ie(c ?? ce()), J = a.getState().stateLog[r], Z = Y(/* @__PURE__ */ new Set()), L = Y(l ?? ce()), n = Y(
173
+ const [b, j] = le({}), { sessionId: $ } = _e();
174
+ let O = !c;
175
+ const [r] = le(c ?? ge()), J = a.getState().stateLog[r], H = Q(/* @__PURE__ */ new Set()), L = Q(l ?? ge()), n = Q(
176
176
  null
177
177
  );
178
- n.current = z(r) ?? null, se(() => {
178
+ n.current = z(r) ?? null, de(() => {
179
179
  if (t && t.stateKey === r && t.path?.[0]) {
180
180
  q(r, (i) => ({
181
181
  ...i,
@@ -187,204 +187,209 @@ function Re(e, {
187
187
  userId: t.userId
188
188
  });
189
189
  }
190
- }, [t]), se(() => {
190
+ }, [t]), de(() => {
191
191
  if (S) {
192
- ye(r, {
192
+ ve(r, {
193
193
  initialState: S
194
194
  });
195
- const s = n.current;
196
- let i = null;
197
- const y = G(s?.localStorage?.key) ? s?.localStorage?.key(S) : s?.localStorage?.key;
198
- y && h && (i = ee(
199
- h + "-" + r + "-" + y
200
- ));
201
- let N = S, $ = !1;
202
- const k = Date.now(), C = i?.lastUpdated || 0, p = i?.lastSyncedWithServer || 0;
203
- s?.serverState?.id !== void 0 && s?.serverState?.status === "success" && s?.serverState?.data && k > C ? (N = s.serverState.data, $ = !0) : i && C > p && (N = i.state, s?.localStorage?.onChange && s?.localStorage?.onChange(N)), Fe(
195
+ const s = n.current, y = s?.serverState?.id !== void 0 && s?.serverState?.status === "success" && s?.serverState?.data, k = a.getState().initialStateGlobal[r];
196
+ if (!(k && !U(k, S) || !k) && !y)
197
+ return;
198
+ let _ = null;
199
+ const x = G(s?.localStorage?.key) ? s?.localStorage?.key(S) : s?.localStorage?.key;
200
+ x && $ && (_ = ne(`${$}-${r}-${x}`));
201
+ let V = S, Y = !1;
202
+ const ae = y ? Date.now() : 0, B = _?.lastUpdated || 0, fe = _?.lastSyncedWithServer || 0;
203
+ y && ae > B ? (V = s.serverState.data, Y = !0) : _ && B > fe && (V = _.state, s?.localStorage?.onChange && s?.localStorage?.onChange(V)), Re(
204
204
  r,
205
205
  S,
206
- N,
206
+ V,
207
207
  o,
208
208
  L.current,
209
- h
210
- ), $ && y && h && Ie(N, r, s, h, Date.now()), te(r), (Array.isArray(f) ? f : [f || "component"]).includes("none") || P({});
209
+ $
210
+ ), Y && x && $ && Ee(V, r, s, $, Date.now()), re(r), (Array.isArray(f) ? f : [f || "component"]).includes("none") || j({});
211
211
  }
212
- }, [S, x?.status, ...v || []]), Ne(() => {
213
- j && ye(r, {
212
+ }, [
213
+ S,
214
+ T?.status,
215
+ T?.data,
216
+ ...v || []
217
+ ]), Ne(() => {
218
+ O && ve(r, {
214
219
  serverSync: m,
215
220
  formElements: d,
216
221
  initialState: S,
217
- localStorage: u,
222
+ localStorage: g,
218
223
  middleware: I
219
224
  });
220
225
  const s = `${r}////${L.current}`, i = a.getState().stateComponents.get(r) || {
221
226
  components: /* @__PURE__ */ new Map()
222
227
  };
223
228
  return i.components.set(s, {
224
- forceUpdate: () => P({}),
229
+ forceUpdate: () => j({}),
225
230
  paths: /* @__PURE__ */ new Set(),
226
231
  deps: [],
227
232
  depsFunction: E || void 0,
228
233
  reactiveType: f ?? ["component", "deps"]
229
- }), a.getState().stateComponents.set(r, i), P({}), () => {
234
+ }), a.getState().stateComponents.set(r, i), j({}), () => {
230
235
  const y = `${r}////${L.current}`;
231
236
  i && (i.components.delete(y), i.components.size === 0 && a.getState().stateComponents.delete(r));
232
237
  };
233
238
  }, []);
234
- const o = (s, i, y, N) => {
239
+ const o = (s, i, y, k) => {
235
240
  if (Array.isArray(i)) {
236
- const $ = `${r}-${i.join(".")}`;
237
- Z.current.add($);
241
+ const w = `${r}-${i.join(".")}`;
242
+ H.current.add(w);
238
243
  }
239
- q(r, ($) => {
240
- const k = G(s) ? s($) : s, C = `${r}-${i.join(".")}`;
241
- if (C) {
242
- let R = !1, w = a.getState().signalDomElements.get(C);
243
- if ((!w || w.size === 0) && (y.updateType === "insert" || y.updateType === "cut")) {
244
- const O = i.slice(0, -1), F = W(k, O);
244
+ q(r, (w) => {
245
+ const _ = G(s) ? s(w) : s, x = `${r}-${i.join(".")}`;
246
+ if (x) {
247
+ let R = !1, N = a.getState().signalDomElements.get(x);
248
+ if ((!N || N.size === 0) && (y.updateType === "insert" || y.updateType === "cut")) {
249
+ const p = i.slice(0, -1), F = W(_, p);
245
250
  if (Array.isArray(F)) {
246
251
  R = !0;
247
- const _ = `${r}-${O.join(".")}`;
248
- w = a.getState().signalDomElements.get(_);
252
+ const h = `${r}-${p.join(".")}`;
253
+ N = a.getState().signalDomElements.get(h);
249
254
  }
250
255
  }
251
- if (w) {
252
- const O = R ? W(k, i.slice(0, -1)) : W(k, i);
253
- w.forEach(({ parentId: F, position: _, effect: T }) => {
256
+ if (N) {
257
+ const p = R ? W(_, i.slice(0, -1)) : W(_, i);
258
+ N.forEach(({ parentId: F, position: h, effect: C }) => {
254
259
  const A = document.querySelector(
255
260
  `[data-parent-id="${F}"]`
256
261
  );
257
262
  if (A) {
258
263
  const D = Array.from(A.childNodes);
259
- if (D[_]) {
260
- const b = T ? new Function("state", `return (${T})(state)`)(O) : O;
261
- D[_].textContent = String(b);
264
+ if (D[h]) {
265
+ const P = C ? new Function("state", `return (${C})(state)`)(p) : p;
266
+ D[h].textContent = String(P);
262
267
  }
263
268
  }
264
269
  });
265
270
  }
266
271
  }
267
- y.updateType === "update" && (N || n.current?.validation?.key) && i && M(
268
- (N || n.current?.validation?.key) + "." + i.join(".")
272
+ y.updateType === "update" && (k || n.current?.validation?.key) && i && M(
273
+ (k || n.current?.validation?.key) + "." + i.join(".")
269
274
  );
270
- const p = i.slice(0, i.length - 1);
275
+ const V = i.slice(0, i.length - 1);
271
276
  y.updateType === "cut" && n.current?.validation?.key && M(
272
- n.current?.validation?.key + "." + p.join(".")
273
- ), y.updateType === "insert" && n.current?.validation?.key && be(
274
- n.current?.validation?.key + "." + p.join(".")
275
- ).filter(([w, O]) => {
276
- let F = w?.split(".").length;
277
- if (w == p.join(".") && F == p.length - 1) {
278
- let _ = w + "." + p;
279
- M(w), je(_, O);
277
+ n.current?.validation?.key + "." + V.join(".")
278
+ ), y.updateType === "insert" && n.current?.validation?.key && Pe(
279
+ n.current?.validation?.key + "." + V.join(".")
280
+ ).filter(([N, p]) => {
281
+ let F = N?.split(".").length;
282
+ if (N == V.join(".") && F == V.length - 1) {
283
+ let h = N + "." + V;
284
+ M(N), Oe(h, p);
280
285
  }
281
286
  });
282
- const de = W($, i), ue = W(k, i);
287
+ const Y = W(w, i), ae = W(_, i);
283
288
  y.updateType === "update" ? i.join(".") : [...i].slice(0, -1).join(".");
284
- const ne = a.getState().stateComponents.get(r);
285
- if (ne) {
286
- const R = Ee($, k), w = new Set(R), O = y.updateType === "update" ? i.join(".") : i.slice(0, -1).join(".") || "";
289
+ const B = a.getState().stateComponents.get(r);
290
+ if (B) {
291
+ const R = he(w, _), N = new Set(R), p = y.updateType === "update" ? i.join(".") : i.slice(0, -1).join(".") || "";
287
292
  for (const [
288
293
  F,
289
- _
290
- ] of ne.components.entries()) {
291
- let T = !1;
292
- const A = Array.isArray(_.reactiveType) ? _.reactiveType : [_.reactiveType || "component"];
294
+ h
295
+ ] of B.components.entries()) {
296
+ let C = !1;
297
+ const A = Array.isArray(h.reactiveType) ? h.reactiveType : [h.reactiveType || "component"];
293
298
  if (!A.includes("none")) {
294
299
  if (A.includes("all")) {
295
- _.forceUpdate();
300
+ h.forceUpdate();
296
301
  continue;
297
302
  }
298
- if (A.includes("component") && ((_.paths.has(O) || _.paths.has("")) && (T = !0), !T))
299
- for (const D of w) {
300
- let b = D;
303
+ if (A.includes("component") && ((h.paths.has(p) || h.paths.has("")) && (C = !0), !C))
304
+ for (const D of N) {
305
+ let P = D;
301
306
  for (; ; ) {
302
- if (_.paths.has(b)) {
303
- T = !0;
307
+ if (h.paths.has(P)) {
308
+ C = !0;
304
309
  break;
305
310
  }
306
- const re = b.lastIndexOf(".");
307
- if (re !== -1) {
308
- const fe = b.substring(
311
+ const ie = P.lastIndexOf(".");
312
+ if (ie !== -1) {
313
+ const Se = P.substring(
309
314
  0,
310
- re
315
+ ie
311
316
  );
312
317
  if (!isNaN(
313
- Number(b.substring(re + 1))
314
- ) && _.paths.has(fe)) {
315
- T = !0;
318
+ Number(P.substring(ie + 1))
319
+ ) && h.paths.has(Se)) {
320
+ C = !0;
316
321
  break;
317
322
  }
318
- b = fe;
323
+ P = Se;
319
324
  } else
320
- b = "";
321
- if (b === "")
325
+ P = "";
326
+ if (P === "")
322
327
  break;
323
328
  }
324
- if (T) break;
329
+ if (C) break;
325
330
  }
326
- if (!T && A.includes("deps") && _.depsFunction) {
327
- const D = _.depsFunction(k);
328
- let b = !1;
329
- typeof D == "boolean" ? D && (b = !0) : U(_.deps, D) || (_.deps = D, b = !0), b && (T = !0);
331
+ if (!C && A.includes("deps") && h.depsFunction) {
332
+ const D = h.depsFunction(_);
333
+ let P = !1;
334
+ typeof D == "boolean" ? D && (P = !0) : U(h.deps, D) || (h.deps = D, P = !0), P && (C = !0);
330
335
  }
331
- T && _.forceUpdate();
336
+ C && h.forceUpdate();
332
337
  }
333
338
  }
334
339
  }
335
- const ge = {
340
+ const oe = {
336
341
  timeStamp: Date.now(),
337
342
  stateKey: r,
338
343
  path: i,
339
344
  updateType: y.updateType,
340
345
  status: "new",
341
- oldValue: de,
342
- newValue: ue
346
+ oldValue: Y,
347
+ newValue: ae
343
348
  };
344
- if (Pe(r, (R) => {
345
- const O = [...R ?? [], ge].reduce((F, _) => {
346
- const T = `${_.stateKey}:${JSON.stringify(_.path)}`, A = F.get(T);
347
- return A ? (A.timeStamp = Math.max(A.timeStamp, _.timeStamp), A.newValue = _.newValue, A.oldValue = A.oldValue ?? _.oldValue, A.updateType = _.updateType) : F.set(T, { ..._ }), F;
349
+ if (je(r, (R) => {
350
+ const p = [...R ?? [], oe].reduce((F, h) => {
351
+ const C = `${h.stateKey}:${JSON.stringify(h.path)}`, A = F.get(C);
352
+ return A ? (A.timeStamp = Math.max(A.timeStamp, h.timeStamp), A.newValue = h.newValue, A.oldValue = A.oldValue ?? h.oldValue, A.updateType = h.updateType) : F.set(C, { ...h }), F;
348
353
  }, /* @__PURE__ */ new Map());
349
- return Array.from(O.values());
350
- }), Ie(
351
- k,
354
+ return Array.from(p.values());
355
+ }), Ee(
356
+ _,
352
357
  r,
353
358
  n.current,
354
- h
359
+ $
355
360
  ), I && I({
356
361
  updateLog: J,
357
- update: ge
362
+ update: oe
358
363
  }), n.current?.serverSync) {
359
- const R = a.getState().serverState[r], w = n.current?.serverSync;
360
- Oe(r, {
361
- syncKey: typeof w.syncKey == "string" ? w.syncKey : w.syncKey({ state: k }),
364
+ const R = a.getState().serverState[r], N = n.current?.serverSync;
365
+ pe(r, {
366
+ syncKey: typeof N.syncKey == "string" ? N.syncKey : N.syncKey({ state: _ }),
362
367
  rollBackState: R,
363
- actionTimeStamp: Date.now() + (w.debounce ?? 3e3),
368
+ actionTimeStamp: Date.now() + (N.debounce ?? 3e3),
364
369
  status: "waiting"
365
370
  });
366
371
  }
367
- return k;
372
+ return _;
368
373
  });
369
374
  };
370
- a.getState().updaterState[r] || (X(
375
+ a.getState().updaterState[r] || (K(
371
376
  r,
372
- Q(
377
+ ee(
373
378
  r,
374
379
  o,
375
380
  L.current,
376
- h
381
+ $
377
382
  )
378
- ), a.getState().cogsStateStore[r] || q(r, e), a.getState().initialStateGlobal[r] || le(r, e));
379
- const g = $e(() => Q(
383
+ ), a.getState().cogsStateStore[r] || q(r, e), a.getState().initialStateGlobal[r] || ue(r, e));
384
+ const u = ke(() => ee(
380
385
  r,
381
386
  o,
382
387
  L.current,
383
- h
388
+ $
384
389
  ), [r]);
385
- return [he(r), g];
390
+ return [$e(r), u];
386
391
  }
387
- function Q(e, c, m, u) {
392
+ function ee(e, c, m, g) {
388
393
  const d = /* @__PURE__ */ new Map();
389
394
  let I = 0;
390
395
  const E = (S) => {
@@ -401,29 +406,29 @@ function Q(e, c, m, u) {
401
406
  t?.key && M(t?.key), S?.validationKey && M(S.validationKey);
402
407
  const v = a.getState().initialStateGlobal[e];
403
408
  a.getState().clearSelectedIndexesForState(e), d.clear(), I++;
404
- const x = l(v, []), V = z(e), P = G(V?.localStorage?.key) ? V?.localStorage?.key(v) : V?.localStorage?.key, h = `${u}-${e}-${P}`;
405
- h && localStorage.removeItem(h), X(e, x), q(e, v);
406
- const j = a.getState().stateComponents.get(e);
407
- return j && j.components.forEach((r) => {
409
+ const T = l(v, []), b = z(e), j = G(b?.localStorage?.key) ? b?.localStorage?.key(v) : b?.localStorage?.key, $ = `${g}-${e}-${j}`;
410
+ $ && localStorage.removeItem($), K(e, T), q(e, v);
411
+ const O = a.getState().stateComponents.get(e);
412
+ return O && O.components.forEach((r) => {
408
413
  r.forceUpdate();
409
414
  }), v;
410
415
  },
411
416
  updateInitialState: (S) => {
412
417
  d.clear(), I++;
413
- const t = Q(
418
+ const t = ee(
414
419
  e,
415
420
  c,
416
421
  m,
417
- u
418
- ), v = a.getState().initialStateGlobal[e], x = z(e), V = G(x?.localStorage?.key) ? x?.localStorage?.key(v) : x?.localStorage?.key, P = `${u}-${e}-${V}`;
419
- return console.log("removing storage", P), localStorage.getItem(P) && localStorage.removeItem(P), we(() => {
420
- le(e, S), X(e, t), q(e, S);
421
- const h = a.getState().stateComponents.get(e);
422
- h && h.components.forEach((j) => {
423
- j.forceUpdate();
422
+ g
423
+ ), v = a.getState().initialStateGlobal[e], T = z(e), b = G(T?.localStorage?.key) ? T?.localStorage?.key(v) : T?.localStorage?.key, j = `${g}-${e}-${b}`;
424
+ return console.log("removing storage", j), localStorage.getItem(j) && localStorage.removeItem(j), Ae(() => {
425
+ ue(e, S), K(e, t), q(e, S);
426
+ const $ = a.getState().stateComponents.get(e);
427
+ $ && $.components.forEach((O) => {
428
+ O.forceUpdate();
424
429
  });
425
430
  }), {
426
- fetchId: (h) => t.get()[h]
431
+ fetchId: ($) => t.get()[$]
427
432
  };
428
433
  },
429
434
  _initialState: a.getState().initialStateGlobal[e],
@@ -431,34 +436,34 @@ function Q(e, c, m, u) {
431
436
  _isLoading: a.getState().isLoadingGlobal[e],
432
437
  _isServerSynced: () => {
433
438
  const S = a.getState().serverState[e];
434
- return !!(S && U(S, he(e)));
439
+ return !!(S && U(S, $e(e)));
435
440
  }
436
441
  };
437
442
  function l(S, t = [], v) {
438
- const x = t.map(String).join(".");
439
- d.get(x);
440
- const V = function() {
443
+ const T = t.map(String).join(".");
444
+ d.get(T);
445
+ const b = function() {
441
446
  return a().getNestedState(e, t);
442
447
  };
443
- Object.keys(f).forEach((j) => {
444
- V[j] = f[j];
448
+ Object.keys(f).forEach((O) => {
449
+ b[O] = f[O];
445
450
  });
446
- const P = {
447
- apply(j, r, J) {
451
+ const j = {
452
+ apply(O, r, J) {
448
453
  return console.log(
449
454
  `PROXY APPLY TRAP HIT: stateKey=${e}, path=${t.join(".")}`
450
455
  ), console.trace("Apply trap stack trace"), a().getNestedState(e, t);
451
456
  },
452
- get(j, r) {
457
+ get(O, r) {
453
458
  if (r !== "then" && !r.startsWith("$") && r !== "stateMapNoRender") {
454
- const n = t.join("."), o = `${e}////${m}`, g = a.getState().stateComponents.get(e);
455
- if (g) {
456
- const s = g.components.get(o);
459
+ const n = t.join("."), o = `${e}////${m}`, u = a.getState().stateComponents.get(e);
460
+ if (u) {
461
+ const s = u.components.get(o);
457
462
  s && (t.length > 0 || r === "get") && s.paths.add(n);
458
463
  }
459
464
  }
460
465
  if (r === "getDifferences")
461
- return () => Ee(
466
+ return () => he(
462
467
  a.getState().cogsStateStore[e],
463
468
  a.getState().initialStateGlobal[e]
464
469
  );
@@ -467,17 +472,17 @@ function Q(e, c, m, u) {
467
472
  const n = a.getState().getInitialOptions(e), o = n?.sync;
468
473
  if (!o)
469
474
  return console.error(`No mutation defined for state key "${e}"`), { success: !1, error: "No mutation defined" };
470
- const g = a.getState().getNestedState(e, []), s = n?.validation?.key;
475
+ const u = a.getState().getNestedState(e, []), s = n?.validation?.key;
471
476
  try {
472
- const i = await o.action(g);
477
+ const i = await o.action(u);
473
478
  if (i && !i.success && i.errors && s) {
474
- a.getState().removeValidationError(s), i.errors.forEach((N) => {
475
- const $ = [s, ...N.path].join(".");
476
- a.getState().addValidationError($, N.message);
479
+ a.getState().removeValidationError(s), i.errors.forEach((k) => {
480
+ const w = [s, ...k.path].join(".");
481
+ a.getState().addValidationError(w, k.message);
477
482
  });
478
483
  const y = a.getState().stateComponents.get(e);
479
- y && y.components.forEach((N) => {
480
- N.forceUpdate();
484
+ y && y.components.forEach((k) => {
485
+ k.forceUpdate();
481
486
  });
482
487
  }
483
488
  return i?.success && o.onSuccess ? o.onSuccess(i.data) : !i?.success && o.onError && o.onError(i.error), i;
@@ -486,20 +491,20 @@ function Q(e, c, m, u) {
486
491
  }
487
492
  };
488
493
  if (r === "_status") {
489
- const n = a.getState().getNestedState(e, t), o = a.getState().initialStateGlobal[e], g = W(o, t);
490
- return U(n, g) ? "fresh" : "stale";
494
+ const n = a.getState().getNestedState(e, t), o = a.getState().initialStateGlobal[e], u = W(o, t);
495
+ return U(n, u) ? "fresh" : "stale";
491
496
  }
492
497
  if (r === "getStatus")
493
498
  return function() {
494
499
  const n = a().getNestedState(
495
500
  e,
496
501
  t
497
- ), o = a.getState().initialStateGlobal[e], g = W(o, t);
498
- return U(n, g) ? "fresh" : "stale";
502
+ ), o = a.getState().initialStateGlobal[e], u = W(o, t);
503
+ return U(n, u) ? "fresh" : "stale";
499
504
  };
500
505
  if (r === "removeStorage")
501
506
  return () => {
502
- const n = a.getState().initialStateGlobal[e], o = z(e), g = G(o?.localStorage?.key) ? o?.localStorage?.key(n) : o?.localStorage?.key, s = `${u}-${e}-${g}`;
507
+ const n = a.getState().initialStateGlobal[e], o = z(e), u = G(o?.localStorage?.key) ? o?.localStorage?.key(n) : o?.localStorage?.key, s = `${g}-${e}-${u}`;
503
508
  console.log("removing storage", s), s && localStorage.removeItem(s);
504
509
  };
505
510
  if (r === "showValidationErrors")
@@ -543,16 +548,16 @@ function Q(e, c, m, u) {
543
548
  return (n) => {
544
549
  const o = v?.filtered?.some(
545
550
  (s) => s.join(".") === t.join(".")
546
- ), g = o ? S : a.getState().getNestedState(e, t);
547
- return r !== "stateMapNoRender" && (d.clear(), I++), g.map((s, i) => {
548
- const y = o && s.__origIndex ? s.__origIndex : i, N = l(
551
+ ), u = o ? S : a.getState().getNestedState(e, t);
552
+ return r !== "stateMapNoRender" && (d.clear(), I++), u.map((s, i) => {
553
+ const y = o && s.__origIndex ? s.__origIndex : i, k = l(
549
554
  s,
550
555
  [...t, y.toString()],
551
556
  v
552
557
  );
553
558
  return n(
554
559
  s,
555
- N,
560
+ k,
556
561
  i,
557
562
  S,
558
563
  l(S, t, v)
@@ -560,7 +565,7 @@ function Q(e, c, m, u) {
560
565
  });
561
566
  };
562
567
  if (r === "$stateMap")
563
- return (n) => K(De, {
568
+ return (n) => te(Ue, {
564
569
  proxy: {
565
570
  _stateKey: e,
566
571
  _path: t,
@@ -571,11 +576,11 @@ function Q(e, c, m, u) {
571
576
  });
572
577
  if (r === "stateFlattenOn")
573
578
  return (n) => {
574
- const g = v?.filtered?.some(
579
+ const u = v?.filtered?.some(
575
580
  (i) => i.join(".") === t.join(".")
576
581
  ) ? S : a.getState().getNestedState(e, t);
577
582
  d.clear(), I++;
578
- const s = g.flatMap(
583
+ const s = u.flatMap(
579
584
  (i, y) => i[n] ?? []
580
585
  );
581
586
  return l(
@@ -586,9 +591,9 @@ function Q(e, c, m, u) {
586
591
  };
587
592
  if (r === "findWith")
588
593
  return (n, o) => {
589
- const g = S.findIndex((y) => y[n] === o);
590
- if (g === -1) return;
591
- const s = S[g], i = [...t, g.toString()];
594
+ const u = S.findIndex((y) => y[n] === o);
595
+ if (u === -1) return;
596
+ const s = S[u], i = [...t, u.toString()];
592
597
  return d.clear(), I++, l(s, i);
593
598
  };
594
599
  if (r === "index")
@@ -600,40 +605,40 @@ function Q(e, c, m, u) {
600
605
  return () => {
601
606
  const n = a.getState().getNestedState(e, t);
602
607
  if (n.length === 0) return;
603
- const o = n.length - 1, g = n[o], s = [...t, o.toString()];
604
- return l(g, s);
608
+ const o = n.length - 1, u = n[o], s = [...t, o.toString()];
609
+ return l(u, s);
605
610
  };
606
611
  if (r === "insert")
607
- return (n) => (E(t), ae(c, n, t, e), l(
612
+ return (n) => (E(t), se(c, n, t, e), l(
608
613
  a.getState().getNestedState(e, t),
609
614
  t
610
615
  ));
611
616
  if (r === "uniqueInsert")
612
- return (n, o, g) => {
617
+ return (n, o, u) => {
613
618
  const s = a.getState().getNestedState(e, t), i = G(n) ? n(s) : n;
614
619
  let y = null;
615
- if (!s.some(($) => {
620
+ if (!s.some((w) => {
616
621
  if (o) {
617
- const C = o.every(
618
- (p) => U($[p], i[p])
622
+ const x = o.every(
623
+ (V) => U(w[V], i[V])
619
624
  );
620
- return C && (y = $), C;
625
+ return x && (y = w), x;
621
626
  }
622
- const k = U($, i);
623
- return k && (y = $), k;
627
+ const _ = U(w, i);
628
+ return _ && (y = w), _;
624
629
  }))
625
- E(t), ae(c, i, t, e);
626
- else if (g && y) {
627
- const $ = g(y), k = s.map(
628
- (C) => U(C, y) ? $ : C
630
+ E(t), se(c, i, t, e);
631
+ else if (u && y) {
632
+ const w = u(y), _ = s.map(
633
+ (x) => U(x, y) ? w : x
629
634
  );
630
- E(t), B(c, k, t);
635
+ E(t), Z(c, _, t);
631
636
  }
632
637
  };
633
638
  if (r === "cut")
634
639
  return (n, o) => {
635
640
  if (!o?.waitForSync)
636
- return E(t), H(c, t, e, n), l(
641
+ return E(t), X(c, t, e, n), l(
637
642
  a.getState().getNestedState(e, t),
638
643
  t
639
644
  );
@@ -641,24 +646,24 @@ function Q(e, c, m, u) {
641
646
  if (r === "cutByValue")
642
647
  return (n) => {
643
648
  for (let o = 0; o < S.length; o++)
644
- S[o] === n && H(c, t, e, o);
649
+ S[o] === n && X(c, t, e, o);
645
650
  };
646
651
  if (r === "toggleByValue")
647
652
  return (n) => {
648
- const o = S.findIndex((g) => g === n);
649
- o > -1 ? H(c, t, e, o) : ae(c, n, t, e);
653
+ const o = S.findIndex((u) => u === n);
654
+ o > -1 ? X(c, t, e, o) : se(c, n, t, e);
650
655
  };
651
656
  if (r === "stateFilter")
652
657
  return (n) => {
653
658
  const o = S.map((i, y) => ({
654
659
  ...i,
655
660
  __origIndex: y.toString()
656
- })), g = [], s = [];
661
+ })), u = [], s = [];
657
662
  for (let i = 0; i < o.length; i++)
658
- n(o[i], i) && (g.push(i), s.push(o[i]));
663
+ n(o[i], i) && (u.push(i), s.push(o[i]));
659
664
  return d.clear(), I++, l(s, t, {
660
665
  filtered: [...v?.filtered || [], t],
661
- validIndices: g
666
+ validIndices: u
662
667
  // Always pass validIndices, even if empty
663
668
  });
664
669
  };
@@ -667,7 +672,7 @@ function Q(e, c, m, u) {
667
672
  if (!isNaN(Number(J))) {
668
673
  const n = t.slice(0, -1), o = a.getState().getNestedState(e, n);
669
674
  if (Array.isArray(o) && r === "cut")
670
- return () => H(
675
+ return () => X(
671
676
  c,
672
677
  n,
673
678
  e,
@@ -677,19 +682,19 @@ function Q(e, c, m, u) {
677
682
  if (r === "get")
678
683
  return () => a.getState().getNestedState(e, t);
679
684
  if (r === "$derive")
680
- return (n) => oe({
685
+ return (n) => ce({
681
686
  _stateKey: e,
682
687
  _path: t,
683
688
  _effect: n.toString()
684
689
  });
685
690
  if (r === "$derive")
686
- return (n) => oe({
691
+ return (n) => ce({
687
692
  _stateKey: e,
688
693
  _path: t,
689
694
  _effect: n.toString()
690
695
  });
691
696
  if (r === "$get")
692
- return () => oe({
697
+ return () => ce({
693
698
  _stateKey: e,
694
699
  _path: t
695
700
  });
@@ -698,28 +703,28 @@ function Q(e, c, m, u) {
698
703
  return a.getState().getSyncInfo(n);
699
704
  }
700
705
  if (r == "getLocalStorage")
701
- return (n) => ee(u + "-" + e + "-" + n);
706
+ return (n) => ne(g + "-" + e + "-" + n);
702
707
  if (r === "_selected") {
703
- const n = t.slice(0, -1), o = n.join("."), g = a.getState().getNestedState(e, n);
704
- return Array.isArray(g) ? Number(t[t.length - 1]) === a.getState().getSelectedIndex(e, o) : void 0;
708
+ const n = t.slice(0, -1), o = n.join("."), u = a.getState().getNestedState(e, n);
709
+ return Array.isArray(u) ? Number(t[t.length - 1]) === a.getState().getSelectedIndex(e, o) : void 0;
705
710
  }
706
711
  if (r === "setSelected")
707
712
  return (n) => {
708
- const o = t.slice(0, -1), g = Number(t[t.length - 1]), s = o.join(".");
709
- n ? a.getState().setSelectedIndex(e, s, g) : a.getState().setSelectedIndex(e, s, void 0);
713
+ const o = t.slice(0, -1), u = Number(t[t.length - 1]), s = o.join(".");
714
+ n ? a.getState().setSelectedIndex(e, s, u) : a.getState().setSelectedIndex(e, s, void 0);
710
715
  const i = a.getState().getNestedState(e, [...o]);
711
- B(c, i, o), E(o);
716
+ Z(c, i, o), E(o);
712
717
  };
713
718
  if (r === "toggleSelected")
714
719
  return () => {
715
- const n = t.slice(0, -1), o = Number(t[t.length - 1]), g = n.join("."), s = a.getState().getSelectedIndex(e, g);
720
+ const n = t.slice(0, -1), o = Number(t[t.length - 1]), u = n.join("."), s = a.getState().getSelectedIndex(e, u);
716
721
  a.getState().setSelectedIndex(
717
722
  e,
718
- g,
723
+ u,
719
724
  s === o ? void 0 : o
720
725
  );
721
726
  const i = a.getState().getNestedState(e, [...n]);
722
- B(c, i, n), E(n);
727
+ Z(c, i, n), E(n);
723
728
  };
724
729
  if (t.length == 0) {
725
730
  if (r === "validateZodSchema")
@@ -730,17 +735,17 @@ function Q(e, c, m, u) {
730
735
  if (!n?.key)
731
736
  throw new Error("Validation key not found");
732
737
  M(n.key);
733
- const g = a.getState().cogsStateStore[e];
738
+ const u = a.getState().cogsStateStore[e];
734
739
  try {
735
740
  const s = a.getState().getValidationErrors(n.key);
736
741
  s && s.length > 0 && s.forEach(([y]) => {
737
742
  y && y.startsWith(n.key) && M(y);
738
743
  });
739
- const i = n.zodSchema.safeParse(g);
740
- return i.success ? !0 : (i.error.errors.forEach((N) => {
741
- const $ = N.path, k = N.message, C = [n.key, ...$].join(".");
742
- o(C, k);
743
- }), te(e), !1);
744
+ const i = n.zodSchema.safeParse(u);
745
+ return i.success ? !0 : (i.error.errors.forEach((k) => {
746
+ const w = k.path, _ = k.message, x = [n.key, ...w].join(".");
747
+ o(x, _);
748
+ }), re(e), !1);
744
749
  } catch (s) {
745
750
  return console.error("Zod schema validation failed", s), !1;
746
751
  }
@@ -749,7 +754,7 @@ function Q(e, c, m, u) {
749
754
  if (r === "getComponents")
750
755
  return () => a().stateComponents.get(e);
751
756
  if (r === "getAllFormRefs")
752
- return () => me.getState().getFormRefsByStateKey(e);
757
+ return () => ye.getState().getFormRefsByStateKey(e);
753
758
  if (r === "_initialState")
754
759
  return a.getState().initialStateGlobal[e];
755
760
  if (r === "_serverState")
@@ -762,13 +767,13 @@ function Q(e, c, m, u) {
762
767
  if (r === "removeValidation") return f.removeValidation;
763
768
  }
764
769
  if (r === "getFormRef")
765
- return () => me.getState().getFormRef(e + "." + t.join("."));
770
+ return () => ye.getState().getFormRef(e + "." + t.join("."));
766
771
  if (r === "validationWrapper")
767
772
  return ({
768
773
  children: n,
769
774
  hideMessage: o
770
- }) => /* @__PURE__ */ Se(
771
- xe,
775
+ }) => /* @__PURE__ */ me(
776
+ Ve,
772
777
  {
773
778
  formOpts: o ? { validation: { message: "" } } : void 0,
774
779
  path: t,
@@ -784,21 +789,21 @@ function Q(e, c, m, u) {
784
789
  if (r === "update")
785
790
  return (n, o) => {
786
791
  if (o?.debounce)
787
- Te(() => {
788
- B(c, n, t, "");
789
- const g = a.getState().getNestedState(e, t);
790
- o?.afterUpdate && o.afterUpdate(g);
792
+ xe(() => {
793
+ Z(c, n, t, "");
794
+ const u = a.getState().getNestedState(e, t);
795
+ o?.afterUpdate && o.afterUpdate(u);
791
796
  }, o.debounce);
792
797
  else {
793
- B(c, n, t, "");
794
- const g = a.getState().getNestedState(e, t);
795
- o?.afterUpdate && o.afterUpdate(g);
798
+ Z(c, n, t, "");
799
+ const u = a.getState().getNestedState(e, t);
800
+ o?.afterUpdate && o.afterUpdate(u);
796
801
  }
797
802
  E(t);
798
803
  };
799
804
  if (r === "formElement")
800
- return (n, o) => /* @__PURE__ */ Se(
801
- Ve,
805
+ return (n, o) => /* @__PURE__ */ me(
806
+ Ce,
802
807
  {
803
808
  setState: c,
804
809
  stateKey: e,
@@ -807,23 +812,23 @@ function Q(e, c, m, u) {
807
812
  formOpts: o
808
813
  }
809
814
  );
810
- const Z = [...t, r], L = a.getState().getNestedState(e, Z);
811
- return l(L, Z, v);
815
+ const H = [...t, r], L = a.getState().getNestedState(e, H);
816
+ return l(L, H, v);
812
817
  }
813
- }, h = new Proxy(V, P);
814
- return d.set(x, {
815
- proxy: h,
818
+ }, $ = new Proxy(b, j);
819
+ return d.set(T, {
820
+ proxy: $,
816
821
  stateVersion: I
817
- }), h;
822
+ }), $;
818
823
  }
819
824
  return l(
820
825
  a.getState().getNestedState(e, [])
821
826
  );
822
827
  }
823
- function oe(e) {
824
- return K(Ue, { proxy: e });
828
+ function ce(e) {
829
+ return te(Me, { proxy: e });
825
830
  }
826
- function De({
831
+ function Ue({
827
832
  proxy: e,
828
833
  rebuildStateShape: c
829
834
  }) {
@@ -835,14 +840,14 @@ function De({
835
840
  (d, I, E, f, l) => e._mapFn(d, I, E, f, l)
836
841
  ) : null;
837
842
  }
838
- function Ue({
843
+ function Me({
839
844
  proxy: e
840
845
  }) {
841
- const c = Y(null), m = `${e._stateKey}-${e._path.join(".")}`;
842
- return se(() => {
843
- const u = c.current;
844
- if (!u || !u.parentElement) return;
845
- const d = u.parentElement, E = Array.from(d.childNodes).indexOf(u);
846
+ const c = Q(null), m = `${e._stateKey}-${e._path.join(".")}`;
847
+ return de(() => {
848
+ const g = c.current;
849
+ if (!g || !g.parentElement) return;
850
+ const d = g.parentElement, E = Array.from(d.childNodes).indexOf(g);
846
851
  let f = d.getAttribute("data-parent-id");
847
852
  f || (f = `parent-${crypto.randomUUID()}`, d.setAttribute("data-parent-id", f));
848
853
  const S = {
@@ -860,41 +865,41 @@ function Ue({
860
865
  "state",
861
866
  `return (${e._effect})(state)`
862
867
  )(t);
863
- } catch (V) {
864
- console.error("Error evaluating effect function during mount:", V), v = t;
868
+ } catch (b) {
869
+ console.error("Error evaluating effect function during mount:", b), v = t;
865
870
  }
866
871
  else
867
872
  v = t;
868
873
  v !== null && typeof v == "object" && (v = JSON.stringify(v));
869
- const x = document.createTextNode(String(v));
870
- u.replaceWith(x);
871
- }, [e._stateKey, e._path.join("."), e._effect]), K("span", {
874
+ const T = document.createTextNode(String(v));
875
+ g.replaceWith(T);
876
+ }, [e._stateKey, e._path.join("."), e._effect]), te("span", {
872
877
  ref: c,
873
878
  style: { display: "none" },
874
879
  "data-signal-id": m
875
880
  });
876
881
  }
877
882
  function Ke(e) {
878
- const c = ke(
883
+ const c = we(
879
884
  (m) => {
880
- const u = a.getState().stateComponents.get(e._stateKey) || {
885
+ const g = a.getState().stateComponents.get(e._stateKey) || {
881
886
  components: /* @__PURE__ */ new Map()
882
887
  };
883
- return u.components.set(e._stateKey, {
888
+ return g.components.set(e._stateKey, {
884
889
  forceUpdate: m,
885
890
  paths: /* @__PURE__ */ new Set([e._path.join(".")])
886
- }), () => u.components.delete(e._stateKey);
891
+ }), () => g.components.delete(e._stateKey);
887
892
  },
888
893
  () => a.getState().getNestedState(e._stateKey, e._path)
889
894
  );
890
- return K("text", {}, String(c));
895
+ return te("text", {}, String(c));
891
896
  }
892
897
  export {
893
- oe as $cogsSignal,
898
+ ce as $cogsSignal,
894
899
  Ke as $cogsSignalStore,
895
900
  Ye as addStateOptions,
896
901
  Xe as createCogsState,
897
902
  Qe as notifyComponent,
898
- Re as useCogsStateFn
903
+ De as useCogsStateFn
899
904
  };
900
905
  //# sourceMappingURL=CogsState.jsx.map