cogsbox-state 0.5.431 → 0.5.434

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/store.js CHANGED
@@ -1,376 +1,311 @@
1
- import { create as h } from "zustand";
2
- import { ulid as u } from "ulid";
3
- const b = h((a, l) => ({
1
+ import { create as u } from "zustand";
2
+ import { ulid as w } from "ulid";
3
+ const g = u((a, f) => ({
4
4
  formRefs: /* @__PURE__ */ new Map(),
5
- registerFormRef: (e, r) => a((t) => {
6
- const n = new Map(t.formRefs);
7
- return n.set(e, r), { formRefs: n };
5
+ registerFormRef: (r, s) => a((t) => {
6
+ const e = new Map(t.formRefs);
7
+ return e.set(r, s), { formRefs: e };
8
8
  }),
9
- getFormRef: (e) => l().formRefs.get(e),
10
- removeFormRef: (e) => a((r) => {
11
- const t = new Map(r.formRefs);
12
- return t.delete(e), { formRefs: t };
9
+ getFormRef: (r) => f().formRefs.get(r),
10
+ removeFormRef: (r) => a((s) => {
11
+ const t = new Map(s.formRefs);
12
+ return t.delete(r), { formRefs: t };
13
13
  }),
14
14
  // Get all refs that start with the stateKey prefix
15
- getFormRefsByStateKey: (e) => {
16
- const r = l().formRefs, t = e + ".", n = /* @__PURE__ */ new Map();
17
- return r.forEach((s, o) => {
18
- (o.startsWith(t) || o === e) && n.set(o, s);
19
- }), n;
15
+ getFormRefsByStateKey: (r) => {
16
+ const s = f().formRefs, t = r + ".", e = /* @__PURE__ */ new Map();
17
+ return s.forEach((n, o) => {
18
+ (o.startsWith(t) || o === r) && e.set(o, n);
19
+ }), e;
20
20
  }
21
- })), I = h((a, l) => ({
22
- shadowStateStore: /* @__PURE__ */ new Map(),
23
- shadowStateSubscribers: /* @__PURE__ */ new Map(),
24
- subscribeToShadowState: (e, r) => (a((t) => {
25
- const n = new Map(t.shadowStateSubscribers), s = n.get(e) || /* @__PURE__ */ new Set();
26
- return s.add(r), n.set(e, s), { shadowStateSubscribers: n };
27
- }), () => {
21
+ })), b = (a) => a === null || typeof a != "object" || a instanceof Uint8Array || a instanceof Int8Array || a instanceof Uint16Array || a instanceof Int16Array || a instanceof Uint32Array || a instanceof Int32Array || a instanceof Float32Array || a instanceof Float64Array || a instanceof ArrayBuffer || a instanceof Date || a instanceof RegExp || a instanceof Map || a instanceof Set ? !1 : Array.isArray(a) || a.constructor === Object, M = u((a, f) => ({
22
+ markAsDirty: (r, s, t = { bubble: !0 }) => {
23
+ const e = new Map(f().shadowStateStore);
24
+ let n = !1;
25
+ const o = (i) => {
26
+ const d = [r, ...i].join("."), c = e.get(d);
27
+ c && c.stateSource === "server" && c.isDirty !== !0 && (e.set(d, { ...c, isDirty: !0 }), n = !0);
28
+ };
29
+ if (o(s), t.bubble) {
30
+ let i = [...s];
31
+ for (; i.length > 0; )
32
+ i.pop(), o(i);
33
+ }
34
+ n && a({ shadowStateStore: e });
35
+ },
36
+ serverStateUpdates: /* @__PURE__ */ new Map(),
37
+ setServerStateUpdate: (r, s) => {
28
38
  a((t) => {
29
- const n = new Map(t.shadowStateSubscribers), s = n.get(e);
30
- return s && (s.delete(r), s.size === 0 && n.delete(e)), { shadowStateSubscribers: n };
39
+ const e = new Map(t.serverStateUpdates);
40
+ return e.set(r, s), { serverStateUpdates: e };
41
+ }), f().notifyPathSubscribers(r, {
42
+ type: "SERVER_STATE_UPDATE",
43
+ serverState: s
31
44
  });
32
- }),
33
- initializeShadowState: (e, r) => {
34
- const t = /* @__PURE__ */ new Map(), n = (s, o) => {
35
- const d = [e, ...o].join(".");
36
- if (Array.isArray(s)) {
37
- const i = [];
38
- s.forEach((c) => {
39
- typeof c == "object" && c !== null && !c.id && (c.id = u());
40
- const f = `id:${c.id}`;
41
- i.push(f);
42
- const p = [...o, f];
43
- n(c, p);
45
+ },
46
+ shadowStateStore: /* @__PURE__ */ new Map(),
47
+ pathSubscribers: /* @__PURE__ */ new Map(),
48
+ subscribeToPath: (r, s) => {
49
+ const t = f().pathSubscribers, e = t.get(r) || /* @__PURE__ */ new Set();
50
+ return e.add(s), t.set(r, e), () => {
51
+ const n = f().pathSubscribers.get(r);
52
+ n && (n.delete(s), n.size === 0 && f().pathSubscribers.delete(r));
53
+ };
54
+ },
55
+ notifyPathSubscribers: (r, s) => {
56
+ const e = f().pathSubscribers.get(r);
57
+ e && e.forEach((n) => n(s));
58
+ },
59
+ initializeShadowState: (r, s) => {
60
+ const t = new Map(f().shadowStateStore), e = (n, o) => {
61
+ const i = [r, ...o].join(".");
62
+ if (Array.isArray(n)) {
63
+ const d = [];
64
+ n.forEach((c) => {
65
+ const l = `id:${w()}`;
66
+ d.push(i + "." + l);
67
+ }), t.set(i, { arrayKeys: d }), n.forEach((c, l) => {
68
+ const S = d[l].split(".").pop();
69
+ e(c, [...o, S]);
44
70
  });
45
- const S = {
46
- id: u(),
47
- arrayKeys: i
48
- };
49
- t.set(d, S);
50
- } else typeof s == "object" && s !== null ? (t.set(d, { id: u() }), Object.keys(s).forEach((i) => {
51
- n(s[i], [...o, i]);
52
- })) : t.set(d, { id: u() });
71
+ } else if (b(n)) {
72
+ const d = Object.fromEntries(
73
+ Object.keys(n).map((c) => [c, i + "." + c])
74
+ );
75
+ t.set(i, { fields: d }), Object.keys(n).forEach((c) => {
76
+ e(n[c], [...o, c]);
77
+ });
78
+ } else
79
+ t.set(i, { value: n });
53
80
  };
54
- n(r, []), a({ shadowStateStore: t });
81
+ e(s, []), a({ shadowStateStore: t });
82
+ },
83
+ getShadowValue: (r, s) => {
84
+ const t = f().shadowStateStore.get(r);
85
+ if (t) {
86
+ if (t.value !== void 0)
87
+ return t.value;
88
+ if (t.arrayKeys)
89
+ return (s ?? t.arrayKeys).map((o) => f().getShadowValue(o));
90
+ if (t.fields) {
91
+ const e = {};
92
+ return Object.entries(t.fields).forEach(([n, o]) => {
93
+ e[n] = f().getShadowValue(o);
94
+ }), e;
95
+ }
96
+ }
55
97
  },
56
- getShadowMetadata: (e, r) => {
57
- const t = [e, ...r].join(".");
58
- return l().shadowStateStore.get(t);
98
+ getShadowMetadata: (r, s, t) => {
99
+ const e = [r, ...s].join(".");
100
+ return f().shadowStateStore.get(e), f().shadowStateStore.get(e);
59
101
  },
60
- setShadowMetadata: (e, r, t) => {
61
- const n = [e, ...r].join("."), s = new Map(l().shadowStateStore), o = s.get(n) || { id: u() };
62
- s.set(n, { ...o, ...t }), a({ shadowStateStore: s }), t.virtualizer?.itemHeight && l().shadowStateSubscribers.get(e)?.forEach((i) => i());
102
+ setShadowMetadata: (r, s, t) => {
103
+ const e = [r, ...s].join("."), n = new Map(f().shadowStateStore), o = n.get(e) || { id: w() };
104
+ n.set(e, { ...o, ...t }), a({ shadowStateStore: n });
63
105
  },
64
- insertShadowArrayElement: (e, r, t) => {
65
- const n = new Map(l().shadowStateStore), s = [e, ...r].join("."), o = n.get(s), d = l().getNestedState(e, r);
106
+ setTransformCache: (r, s, t, e) => {
107
+ const n = [r, ...s].join("."), o = new Map(f().shadowStateStore), i = o.get(n) || {};
108
+ i.transformCaches || (i.transformCaches = /* @__PURE__ */ new Map()), i.transformCaches.set(t, e), o.set(n, i), a({ shadowStateStore: o });
109
+ },
110
+ insertShadowArrayElement: (r, s, t) => {
111
+ const e = new Map(f().shadowStateStore), n = [r, ...s].join("."), o = e.get(n);
66
112
  if (!o || !o.arrayKeys) return;
67
- const i = `id:${t.id}`, S = d.findIndex((p) => p.id === t.id);
68
- if (S === -1) return;
69
- const c = [...o.arrayKeys];
70
- c.splice(S, 0, i), n.set(s, { ...o, arrayKeys: c });
71
- const f = (p, w) => {
72
- const g = [e, ...w].join(".");
73
- typeof p == "object" && p !== null ? (n.set(g, { id: u() }), Object.keys(p).forEach((y) => {
74
- f(p[y], [...w, y]);
75
- })) : n.set(g, { id: u() });
113
+ const i = `id:${w()}`, d = n + "." + i, c = [...o.arrayKeys];
114
+ c.push(d), e.set(n, { ...o, arrayKeys: c });
115
+ const l = (S, y) => {
116
+ const h = [r, ...y].join(".");
117
+ if (!Array.isArray(S)) if (typeof S == "object" && S !== null) {
118
+ const m = Object.fromEntries(
119
+ Object.keys(S).map((p) => [p, h + "." + p])
120
+ );
121
+ e.set(h, { fields: m }), Object.entries(S).forEach(([p, E]) => {
122
+ l(E, [...y, p]);
123
+ });
124
+ } else
125
+ e.set(h, { value: S });
76
126
  };
77
- f(t, [...r, i]), a({ shadowStateStore: n });
127
+ l(t, [...s, i]), a({ shadowStateStore: e }), f().notifyPathSubscribers(n, {
128
+ type: "INSERT",
129
+ path: n,
130
+ itemKey: d
131
+ });
78
132
  },
79
- removeShadowArrayElement: (e, r) => {
80
- const t = new Map(l().shadowStateStore), n = [e, ...r].join("."), s = r[r.length - 1], o = r.slice(0, -1), d = [e, ...o].join("."), i = t.get(d);
81
- if (i && i.arrayKeys) {
133
+ removeShadowArrayElement: (r, s) => {
134
+ const t = new Map(f().shadowStateStore), e = [r, ...s].join("."), n = s.slice(0, -1), o = [r, ...n].join("."), i = t.get(o);
135
+ if (i && i.arrayKeys && i.arrayKeys.findIndex(
136
+ (c) => c === e
137
+ ) !== -1) {
82
138
  const c = i.arrayKeys.filter(
83
- (f) => f !== s
139
+ (S) => S !== e
84
140
  );
85
- t.set(d, { ...i, arrayKeys: c });
141
+ t.set(o, {
142
+ ...i,
143
+ arrayKeys: c
144
+ });
145
+ const l = e + ".";
146
+ for (const S of Array.from(t.keys()))
147
+ (S === e || S.startsWith(l)) && t.delete(S);
86
148
  }
87
- const S = n + ".";
88
- for (const c of Array.from(t.keys()))
89
- (c === n || c.startsWith(S)) && t.delete(c);
90
- a({ shadowStateStore: t });
149
+ a({ shadowStateStore: t }), f().notifyPathSubscribers(o, {
150
+ type: "REMOVE",
151
+ path: o,
152
+ itemKey: e
153
+ // The exact ID of the removed item
154
+ });
91
155
  },
92
- updateShadowAtPath: (e, r, t) => {
93
- const n = [e, ...r].join("."), s = new Map(l().shadowStateStore), o = s.get(n) || { id: u() };
94
- s.set(n, { ...o, lastUpdated: Date.now() }), a({ shadowStateStore: s });
156
+ updateShadowAtPath: (r, s, t) => {
157
+ const e = new Map(f().shadowStateStore), n = [r, ...s].join("."), o = (i, d) => {
158
+ const c = e.get(i);
159
+ if (b(d) && c && c.fields) {
160
+ for (const l in d)
161
+ if (Object.prototype.hasOwnProperty.call(d, l)) {
162
+ const S = c.fields[l], y = d[l];
163
+ S && o(S, y);
164
+ }
165
+ } else {
166
+ const l = e.get(i) || {};
167
+ e.set(i, { ...l, value: d });
168
+ }
169
+ };
170
+ o(n, t), f().notifyPathSubscribers(n, { type: "UPDATE", newValue: t }), a({ shadowStateStore: e });
95
171
  },
96
172
  selectedIndicesMap: /* @__PURE__ */ new Map(),
97
- // Add the new methods
98
- getSelectedIndex: (e, r) => {
99
- const t = l().selectedIndicesMap.get(e);
100
- if (t)
101
- return t.get(r);
173
+ getSelectedIndex: (r, s) => {
174
+ const t = f().selectedIndicesMap.get(r);
175
+ if (!t) return -1;
176
+ const e = s || M.getState().getShadowMetadata(r, [])?.arrayKeys;
177
+ return e ? e.indexOf(t) : -1;
102
178
  },
103
- setSelectedIndex: (e, r, t) => {
104
- a((n) => {
105
- const s = new Map(n.selectedIndicesMap);
106
- let o = s.get(e);
107
- return o || (o = /* @__PURE__ */ new Map(), s.set(e, o)), t === void 0 ? o.delete(r) : o.set(r, t), {
108
- ...n,
109
- selectedIndicesMap: s
110
- };
111
- });
112
- },
113
- clearSelectedIndex: ({
114
- stateKey: e,
115
- path: r
116
- }) => {
179
+ setSelectedIndex: (r, s) => {
117
180
  a((t) => {
118
- const n = new Map(t.selectedIndicesMap), s = n.get(e);
119
- if (!s) return t;
120
- const o = r.join(".");
121
- return s.delete(o), {
181
+ const e = t.selectedIndicesMap;
182
+ return s === void 0 ? e.delete(r) : (e.has(r) && f().notifyPathSubscribers(e.get(r), {
183
+ type: "THIS_UNSELECTED"
184
+ }), e.set(r, s), f().notifyPathSubscribers(s, {
185
+ type: "THIS_SELECTED"
186
+ })), f().notifyPathSubscribers(r, {
187
+ type: "GET_SELECTED"
188
+ }), {
122
189
  ...t,
123
- selectedIndicesMap: n
190
+ selectedIndicesMap: e
124
191
  };
125
192
  });
126
193
  },
127
- clearSelectedIndexesForState: (e) => {
128
- a((r) => {
129
- const t = new Map(r.selectedIndicesMap);
130
- return t.delete(e) ? (console.log(
131
- `Cleared selected indices map entry for stateKey: ${e}`
132
- ), { selectedIndicesMap: t }) : {};
194
+ clearSelectedIndex: ({ arrayKey: r }) => {
195
+ a((s) => {
196
+ const t = s.selectedIndicesMap;
197
+ return t.delete(r), f().notifyPathSubscribers(r, {
198
+ type: "CLEAR_SELECTION"
199
+ }), {
200
+ ...s,
201
+ selectedIndicesMap: t
202
+ };
133
203
  });
134
204
  },
135
- stateComponents: /* @__PURE__ */ new Map(),
136
- subscribe: (e) => l().subscribe(e),
137
- reactiveDeps: {},
138
- setReactiveDeps: (e, r) => a((t) => ({
139
- ...t,
140
- reactiveDeps: {
141
- ...t.reactiveDeps,
142
- [e]: r
143
- }
144
- })),
145
- deleteReactiveDeps: (e) => a((r) => {
146
- const { [e]: t, ...n } = r.reactiveDeps;
147
- return {
148
- ...r,
149
- reactiveDeps: n
150
- };
151
- }),
152
- reRenderTriggerPrevValue: {},
153
- signalDomElements: /* @__PURE__ */ new Map(),
154
- addSignalElement: (e, r) => {
155
- const t = l().signalDomElements;
156
- t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(r), a({ signalDomElements: new Map(t) });
157
- },
158
- removeSignalElement: (e, r) => {
159
- const t = l().signalDomElements, n = t.get(e);
160
- n && n.forEach((s) => {
161
- s.instanceId === r && n.delete(s);
162
- }), a({ signalDomElements: new Map(t) });
205
+ clearSelectedIndexesForState: (r) => {
206
+ a((s) => {
207
+ const t = new Map(s.selectedIndicesMap);
208
+ return t.delete(r) ? { selectedIndicesMap: t } : {};
209
+ });
163
210
  },
164
211
  initialStateOptions: {},
165
- updaterState: {},
166
212
  stateTimeline: {},
167
213
  cogsStateStore: {},
168
214
  stateLog: {},
169
- isLoadingGlobal: {},
170
215
  initialStateGlobal: {},
171
- iniitialCreatedState: {},
172
- updateInitialCreatedState: (e, r) => {
173
- a((t) => ({
174
- iniitialCreatedState: {
175
- ...t.iniitialCreatedState,
176
- [e]: r
177
- }
178
- }));
179
- },
180
216
  validationErrors: /* @__PURE__ */ new Map(),
181
- serverState: {},
182
- serverSyncActions: {},
183
- serverSyncLog: {},
184
- serverSideOrNot: {},
185
- setServerSyncLog: (e, r) => {
186
- a((t) => ({
187
- serverSyncLog: {
188
- ...t.serverSyncLog,
189
- [e]: [...t.serverSyncLog[e] ?? [], r]
190
- }
191
- }));
192
- },
193
- setServerSideOrNot: (e, r) => {
194
- a((t) => ({
195
- serverSideOrNot: {
196
- ...t.serverSideOrNot,
197
- [e]: r
198
- }
199
- }));
200
- },
201
- getServerSideOrNot: (e) => l().serverSideOrNot[e],
202
- getThisLocalUpdate: (e) => l().stateLog[e],
203
- setServerState: (e, r) => {
204
- a((t) => ({
205
- serverState: {
206
- ...t.serverState,
207
- [e]: r
208
- }
209
- }));
210
- },
211
- setStateLog: (e, r) => {
217
+ setStateLog: (r, s) => {
212
218
  a((t) => {
213
- const n = t.stateLog[e] ?? [], s = r(n);
219
+ const e = t.stateLog[r] ?? [], n = s(e);
214
220
  return {
215
221
  stateLog: {
216
222
  ...t.stateLog,
217
- [e]: s
223
+ [r]: n
218
224
  }
219
225
  };
220
226
  });
221
227
  },
222
- setIsLoadingGlobal: (e, r) => {
223
- a((t) => ({
224
- isLoadingGlobal: {
225
- ...t.isLoadingGlobal,
226
- [e]: r
227
- }
228
- }));
229
- },
230
- setServerSyncActions: (e, r) => {
231
- a((t) => ({
232
- serverSyncActions: {
233
- ...t.serverSyncActions,
234
- [e]: r
235
- }
236
- }));
237
- },
238
- addValidationError: (e, r) => {
239
- console.log("addValidationError---"), a((t) => {
240
- const n = new Map(t.validationErrors), s = n.get(e) || [];
241
- return console.log("addValidationError", e, r, s), n.set(e, [...s, r]), { validationErrors: n };
228
+ addValidationError: (r, s) => {
229
+ a((t) => {
230
+ const e = new Map(t.validationErrors), n = e.get(r) || [];
231
+ return console.log("addValidationError", r, s, n), e.set(r, [...n, s]), { validationErrors: e };
242
232
  });
243
233
  },
244
- removeValidationError: (e) => {
245
- a((r) => {
246
- const t = new Map(r.validationErrors);
247
- let n = !1;
248
- const s = e.split(".");
234
+ removeValidationError: (r) => {
235
+ a((s) => {
236
+ const t = new Map(s.validationErrors);
237
+ let e = !1;
238
+ const n = r.split(".");
249
239
  return Array.from(t.keys()).forEach((o) => {
250
- const d = o.split(".");
251
- if (d.length >= s.length) {
252
- let i = !0;
253
- for (let S = 0; S < s.length; S++)
254
- if (d[S] !== s[S]) {
255
- i = !1;
240
+ const i = o.split(".");
241
+ if (i.length >= n.length) {
242
+ let d = !0;
243
+ for (let c = 0; c < n.length; c++)
244
+ if (i[c] !== n[c]) {
245
+ d = !1;
256
246
  break;
257
247
  }
258
- i && (n = !0, t.delete(o));
248
+ d && (e = !0, t.delete(o));
259
249
  }
260
- }), n ? { validationErrors: t } : r;
250
+ }), e ? { validationErrors: t } : s;
261
251
  });
262
252
  },
263
- getValidationErrors: (e) => {
264
- const r = [], t = l().validationErrors, n = e.split("."), s = (o, d) => o === "[*]" ? !0 : Array.isArray(o) ? o.includes(parseInt(d)) : o === d;
253
+ getValidationErrors: (r) => {
254
+ const s = [], t = f().validationErrors, e = r.split("."), n = (o, i) => o === "[*]" ? !0 : Array.isArray(o) ? o.includes(parseInt(i)) : o === i;
265
255
  return Array.from(t.keys()).forEach((o) => {
266
- const d = o.split(".");
267
- if (d.length >= n.length) {
268
- let i = !0;
269
- for (let S = 0; S < n.length; S++) {
270
- const c = n[S], f = d[S];
271
- if (c === "[*]" || Array.isArray(c)) {
272
- const p = parseInt(f);
273
- if (isNaN(p)) {
274
- i = !1;
256
+ const i = o.split(".");
257
+ if (i.length >= e.length) {
258
+ let d = !0;
259
+ for (let c = 0; c < e.length; c++) {
260
+ const l = e[c], S = i[c];
261
+ if (l === "[*]" || Array.isArray(l)) {
262
+ const y = parseInt(S);
263
+ if (isNaN(y)) {
264
+ d = !1;
275
265
  break;
276
266
  }
277
- if (!s(c, f)) {
278
- i = !1;
267
+ if (!n(l, S)) {
268
+ d = !1;
279
269
  break;
280
270
  }
281
- } else if (c !== f) {
282
- i = !1;
271
+ } else if (l !== S) {
272
+ d = !1;
283
273
  break;
284
274
  }
285
275
  }
286
- if (i) {
287
- const S = t.get(o);
288
- S && r.push(...S);
276
+ if (d) {
277
+ const c = t.get(o);
278
+ c && s.push(...c);
289
279
  }
290
280
  }
291
- }), r;
281
+ }), s;
292
282
  },
293
- getInitialOptions: (e) => l().initialStateOptions[e],
294
- getNestedState: (e, r) => {
295
- const t = l().cogsStateStore[e], n = (s, o) => {
296
- if (o.length === 0 || s === void 0)
297
- return s;
298
- const d = o[0], i = o.slice(1);
299
- if (Array.isArray(s) && typeof d == "string" && d.startsWith("id:")) {
300
- const c = d.split(":")[1], f = s.find(
301
- (p) => p && String(p.id) === c
302
- );
303
- return n(f, i);
304
- }
305
- if (d === "[*]") {
306
- if (!Array.isArray(s)) {
307
- console.warn("Asterisk notation used on non-array value");
308
- return;
309
- }
310
- if (i.length === 0) return s;
311
- const c = s.map((f) => n(f, i));
312
- return Array.isArray(c[0]) ? c.flat() : c;
313
- }
314
- const S = s[d];
315
- return n(S, i);
316
- };
317
- return n(t, r);
318
- },
319
- setInitialStateOptions: (e, r) => {
283
+ getInitialOptions: (r) => f().initialStateOptions[r],
284
+ setInitialStateOptions: (r, s) => {
320
285
  a((t) => ({
321
286
  initialStateOptions: {
322
287
  ...t.initialStateOptions,
323
- [e]: r
288
+ [r]: s
324
289
  }
325
290
  }));
326
291
  },
327
- updateInitialStateGlobal: (e, r) => {
292
+ updateInitialStateGlobal: (r, s) => {
328
293
  a((t) => ({
329
294
  initialStateGlobal: {
330
295
  ...t.initialStateGlobal,
331
- [e]: r
332
- }
333
- }));
334
- },
335
- getUpdaterState: (e) => l().updaterState[e],
336
- setUpdaterState: (e, r) => {
337
- const t = l().updaterState;
338
- !e || !r || a({ updaterState: { ...t ?? {}, [e]: r } });
339
- },
340
- getKeyState: (e) => l().cogsStateStore[e],
341
- setState: (e, r) => {
342
- a((t) => ({
343
- cogsStateStore: {
344
- ...t.cogsStateStore,
345
- [e]: typeof r == "function" ? r(t.cogsStateStore[e]) : r
346
- }
347
- }));
348
- },
349
- setInitialStates: (e) => {
350
- a((r) => ({
351
- cogsStateStore: {
352
- ...r.cogsStateStore,
353
- ...e
354
- }
355
- }));
356
- },
357
- setCreatedState: (e) => {
358
- a((r) => ({
359
- iniitialCreatedState: {
360
- ...r.cogsStateStore,
361
- ...e
296
+ [r]: s
362
297
  }
363
298
  }));
364
299
  },
365
300
  syncInfoStore: /* @__PURE__ */ new Map(),
366
- setSyncInfo: (e, r) => a((t) => {
367
- const n = new Map(t.syncInfoStore);
368
- return n.set(e, r), { ...t, syncInfoStore: n };
301
+ setSyncInfo: (r, s) => a((t) => {
302
+ const e = new Map(t.syncInfoStore);
303
+ return e.set(r, s), { ...t, syncInfoStore: e };
369
304
  }),
370
- getSyncInfo: (e) => l().syncInfoStore.get(e) || null
305
+ getSyncInfo: (r) => f().syncInfoStore.get(r) || null
371
306
  }));
372
307
  export {
373
- b as formRefStore,
374
- I as getGlobalStore
308
+ g as formRefStore,
309
+ M as getGlobalStore
375
310
  };
376
311
  //# sourceMappingURL=store.js.map