cogsbox-state 0.5.434 → 0.5.436

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