cogsbox-state 0.5.229 → 0.5.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CogsState.jsx +534 -500
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +50 -13
package/dist/CogsState.jsx
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { transformStateFunc as Ae, isDeepEqual as W, isFunction as
|
|
5
|
-
import { pushFunc as
|
|
6
|
-
import
|
|
7
|
-
import { v4 as
|
|
2
|
+
import { jsx as ee, Fragment as ke } from "react/jsx-runtime";
|
|
3
|
+
import { useState as ne, useRef as te, useEffect as de, useLayoutEffect as pe, useMemo as Te, createElement as oe, useSyncExternalStore as Ve, startTransition as Ne } from "react";
|
|
4
|
+
import { transformStateFunc as Ae, isDeepEqual as W, isFunction as B, getNestedValue as G, getDifferences as ue, debounce as be } from "./utility.js";
|
|
5
|
+
import { pushFunc as le, updateFn as X, cutFunc as K, ValidationWrapper as Ce, FormControlComponent as Pe } from "./Functions.jsx";
|
|
6
|
+
import _e from "superjson";
|
|
7
|
+
import { v4 as ge } from "uuid";
|
|
8
8
|
import "zod";
|
|
9
|
-
import { getGlobalStore as n, formRefStore as
|
|
9
|
+
import { getGlobalStore as n, formRefStore as me } from "./store.js";
|
|
10
10
|
import { useCogsConfig as we } from "./CogsStateClient.jsx";
|
|
11
|
-
import { applyPatch as
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
...
|
|
11
|
+
import { applyPatch as xe } from "fast-json-patch";
|
|
12
|
+
function ye(e, i) {
|
|
13
|
+
const S = n.getState().getInitialOptions, g = n.getState().setInitialStateOptions, m = S(e) || {};
|
|
14
|
+
g(e, {
|
|
15
|
+
...m,
|
|
16
16
|
...i
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function ve({
|
|
20
20
|
stateKey: e,
|
|
21
21
|
options: i,
|
|
22
|
-
initialOptionsPart:
|
|
22
|
+
initialOptionsPart: S
|
|
23
23
|
}) {
|
|
24
|
-
const
|
|
25
|
-
let
|
|
24
|
+
const g = H(e) || {}, m = S[e] || {}, E = n.getState().setInitialStateOptions, p = { ...m, ...g };
|
|
25
|
+
let I = !1;
|
|
26
26
|
if (i)
|
|
27
27
|
for (const s in i)
|
|
28
|
-
p.hasOwnProperty(s) ? (s == "localStorage" && i[s] && p[s].key !== i[s]?.key && (
|
|
29
|
-
!W(p[s], i[s]) && (
|
|
30
|
-
|
|
28
|
+
p.hasOwnProperty(s) ? (s == "localStorage" && i[s] && p[s].key !== i[s]?.key && (I = !0, p[s] = i[s]), s == "initialState" && i[s] && p[s] !== i[s] && // Different references
|
|
29
|
+
!W(p[s], i[s]) && (I = !0, p[s] = i[s])) : (I = !0, p[s] = i[s]);
|
|
30
|
+
I && E(e, p);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return { initialState: e, formElements: i, validation:
|
|
32
|
+
function et(e, { formElements: i, validation: S }) {
|
|
33
|
+
return { initialState: e, formElements: i, validation: S };
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
let
|
|
37
|
-
const [
|
|
38
|
-
(Object.keys(
|
|
39
|
-
|
|
35
|
+
const tt = (e, i) => {
|
|
36
|
+
let S = e;
|
|
37
|
+
const [g, m] = Ae(S);
|
|
38
|
+
(Object.keys(m).length > 0 || i && Object.keys(i).length > 0) && Object.keys(m).forEach((I) => {
|
|
39
|
+
m[I] = m[I] || {}, m[I].formElements = {
|
|
40
40
|
...i?.formElements,
|
|
41
41
|
// Global defaults first
|
|
42
42
|
...i?.validation,
|
|
43
|
-
...
|
|
43
|
+
...m[I].formElements || {}
|
|
44
44
|
// State-specific overrides
|
|
45
|
-
},
|
|
46
|
-
}), n.getState().setInitialStates(
|
|
47
|
-
const E = (
|
|
48
|
-
const [
|
|
49
|
-
|
|
50
|
-
stateKey:
|
|
45
|
+
}, H(I) || n.getState().setInitialStateOptions(I, m[I]);
|
|
46
|
+
}), n.getState().setInitialStates(g), n.getState().setCreatedState(g);
|
|
47
|
+
const E = (I, s) => {
|
|
48
|
+
const [v] = ne(s?.componentId ?? ge());
|
|
49
|
+
ve({
|
|
50
|
+
stateKey: I,
|
|
51
51
|
options: s,
|
|
52
|
-
initialOptionsPart:
|
|
52
|
+
initialOptionsPart: m
|
|
53
53
|
});
|
|
54
|
-
const r = n.getState().cogsStateStore[
|
|
55
|
-
|
|
54
|
+
const r = n.getState().cogsStateStore[I] || g[I], f = s?.modifyState ? s.modifyState(r) : r, [R, b] = De(
|
|
55
|
+
f,
|
|
56
56
|
{
|
|
57
|
-
stateKey:
|
|
57
|
+
stateKey: I,
|
|
58
58
|
syncUpdate: s?.syncUpdate,
|
|
59
|
-
componentId:
|
|
59
|
+
componentId: v,
|
|
60
60
|
localStorage: s?.localStorage,
|
|
61
61
|
middleware: s?.middleware,
|
|
62
62
|
enabledSync: s?.enabledSync,
|
|
@@ -67,49 +67,49 @@ const et = (e, i) => {
|
|
|
67
67
|
serverState: s?.serverState
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
|
-
return
|
|
70
|
+
return b;
|
|
71
71
|
};
|
|
72
|
-
function p(
|
|
73
|
-
|
|
72
|
+
function p(I, s) {
|
|
73
|
+
ve({ stateKey: I, options: s, initialOptionsPart: m }), s.localStorage && Ue(I, s), se(I);
|
|
74
74
|
}
|
|
75
75
|
return { useCogsState: E, setCogsOptions: p };
|
|
76
76
|
}, {
|
|
77
|
-
setUpdaterState:
|
|
78
|
-
setState:
|
|
79
|
-
getInitialOptions:
|
|
77
|
+
setUpdaterState: re,
|
|
78
|
+
setState: Z,
|
|
79
|
+
getInitialOptions: H,
|
|
80
80
|
getKeyState: Ee,
|
|
81
81
|
getValidationErrors: Oe,
|
|
82
|
-
setStateLog:
|
|
83
|
-
updateInitialStateGlobal:
|
|
84
|
-
addValidationError:
|
|
85
|
-
removeValidationError:
|
|
86
|
-
setServerSyncActions:
|
|
87
|
-
} = n.getState(), Ie = (e, i,
|
|
88
|
-
|
|
82
|
+
setStateLog: je,
|
|
83
|
+
updateInitialStateGlobal: fe,
|
|
84
|
+
addValidationError: Fe,
|
|
85
|
+
removeValidationError: J,
|
|
86
|
+
setServerSyncActions: Re
|
|
87
|
+
} = n.getState(), Ie = (e, i, S, g, m) => {
|
|
88
|
+
S?.log && console.log(
|
|
89
89
|
"saving to localstorage",
|
|
90
90
|
i,
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
S.localStorage?.key,
|
|
92
|
+
g
|
|
93
93
|
);
|
|
94
|
-
const E =
|
|
95
|
-
if (E &&
|
|
96
|
-
const p = `${
|
|
97
|
-
let
|
|
94
|
+
const E = B(S?.localStorage?.key) ? S.localStorage?.key(e) : S?.localStorage?.key;
|
|
95
|
+
if (E && g) {
|
|
96
|
+
const p = `${g}-${i}-${E}`;
|
|
97
|
+
let I;
|
|
98
98
|
try {
|
|
99
|
-
|
|
99
|
+
I = ie(p)?.lastSyncedWithServer;
|
|
100
100
|
} catch {
|
|
101
101
|
}
|
|
102
102
|
const s = {
|
|
103
103
|
state: e,
|
|
104
104
|
lastUpdated: Date.now(),
|
|
105
|
-
lastSyncedWithServer:
|
|
106
|
-
},
|
|
105
|
+
lastSyncedWithServer: m ?? I
|
|
106
|
+
}, v = _e.serialize(s);
|
|
107
107
|
window.localStorage.setItem(
|
|
108
108
|
p,
|
|
109
|
-
JSON.stringify(
|
|
109
|
+
JSON.stringify(v.json)
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
|
-
},
|
|
112
|
+
}, ie = (e) => {
|
|
113
113
|
if (!e) return null;
|
|
114
114
|
try {
|
|
115
115
|
const i = window.localStorage.getItem(e);
|
|
@@ -118,60 +118,60 @@ const et = (e, i) => {
|
|
|
118
118
|
return console.error("Error loading from localStorage:", i), null;
|
|
119
119
|
}
|
|
120
120
|
}, Ue = (e, i) => {
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
123
|
-
const E =
|
|
124
|
-
`${
|
|
121
|
+
const S = n.getState().cogsStateStore[e], { sessionId: g } = we(), m = B(i?.localStorage?.key) ? i.localStorage.key(S) : i?.localStorage?.key;
|
|
122
|
+
if (m && g) {
|
|
123
|
+
const E = ie(
|
|
124
|
+
`${g}-${e}-${m}`
|
|
125
125
|
);
|
|
126
126
|
if (E && E.lastUpdated > (E.lastSyncedWithServer || 0))
|
|
127
|
-
return
|
|
127
|
+
return Z(e, E.state), se(e), !0;
|
|
128
128
|
}
|
|
129
129
|
return !1;
|
|
130
|
-
},
|
|
130
|
+
}, $e = (e, i, S, g, m, E) => {
|
|
131
131
|
const p = {
|
|
132
132
|
initialState: i,
|
|
133
|
-
updaterState:
|
|
133
|
+
updaterState: ae(
|
|
134
134
|
e,
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
g,
|
|
136
|
+
m,
|
|
137
137
|
E
|
|
138
138
|
),
|
|
139
|
-
state:
|
|
139
|
+
state: S
|
|
140
140
|
};
|
|
141
|
-
|
|
142
|
-
},
|
|
141
|
+
fe(e, p.initialState), re(e, p.updaterState), Z(e, p.state);
|
|
142
|
+
}, se = (e) => {
|
|
143
143
|
const i = n.getState().stateComponents.get(e);
|
|
144
144
|
if (!i) return;
|
|
145
|
-
const
|
|
146
|
-
i.components.forEach((
|
|
147
|
-
(
|
|
145
|
+
const S = /* @__PURE__ */ new Set();
|
|
146
|
+
i.components.forEach((g) => {
|
|
147
|
+
(g ? Array.isArray(g.reactiveType) ? g.reactiveType : [g.reactiveType || "component"] : null)?.includes("none") || S.add(() => g.forceUpdate());
|
|
148
148
|
}), queueMicrotask(() => {
|
|
149
|
-
|
|
149
|
+
S.forEach((g) => g());
|
|
150
150
|
});
|
|
151
|
-
},
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
const
|
|
155
|
-
if ((
|
|
151
|
+
}, nt = (e, i) => {
|
|
152
|
+
const S = n.getState().stateComponents.get(e);
|
|
153
|
+
if (S) {
|
|
154
|
+
const g = `${e}////${i}`, m = S.components.get(g);
|
|
155
|
+
if ((m ? Array.isArray(m.reactiveType) ? m.reactiveType : [m.reactiveType || "component"] : null)?.includes("none"))
|
|
156
156
|
return;
|
|
157
|
-
|
|
157
|
+
m && m.forceUpdate();
|
|
158
158
|
}
|
|
159
|
-
}, Me = (e, i,
|
|
159
|
+
}, Me = (e, i, S, g) => {
|
|
160
160
|
switch (e) {
|
|
161
161
|
case "update":
|
|
162
162
|
return {
|
|
163
|
-
oldValue: G(i,
|
|
164
|
-
newValue: G(
|
|
163
|
+
oldValue: G(i, g),
|
|
164
|
+
newValue: G(S, g)
|
|
165
165
|
};
|
|
166
166
|
case "insert":
|
|
167
167
|
return {
|
|
168
168
|
oldValue: null,
|
|
169
169
|
// or undefined
|
|
170
|
-
newValue: G(
|
|
170
|
+
newValue: G(S, g)
|
|
171
171
|
};
|
|
172
172
|
case "cut":
|
|
173
173
|
return {
|
|
174
|
-
oldValue: G(i,
|
|
174
|
+
oldValue: G(i, g),
|
|
175
175
|
newValue: null
|
|
176
176
|
// or undefined
|
|
177
177
|
};
|
|
@@ -181,284 +181,281 @@ const et = (e, i) => {
|
|
|
181
181
|
};
|
|
182
182
|
function De(e, {
|
|
183
183
|
stateKey: i,
|
|
184
|
-
serverSync:
|
|
185
|
-
localStorage:
|
|
186
|
-
formElements:
|
|
184
|
+
serverSync: S,
|
|
185
|
+
localStorage: g,
|
|
186
|
+
formElements: m,
|
|
187
187
|
reactiveDeps: E,
|
|
188
188
|
reactiveType: p,
|
|
189
|
-
componentId:
|
|
189
|
+
componentId: I,
|
|
190
190
|
initialState: s,
|
|
191
|
-
syncUpdate:
|
|
191
|
+
syncUpdate: v,
|
|
192
192
|
dependencies: r,
|
|
193
|
-
serverState:
|
|
193
|
+
serverState: f
|
|
194
194
|
} = {}) {
|
|
195
|
-
const [
|
|
195
|
+
const [R, b] = ne({}), { sessionId: C } = we();
|
|
196
196
|
let U = !i;
|
|
197
|
-
const [
|
|
197
|
+
const [y] = ne(i ?? ge()), c = n.getState().stateLog[y], Q = te(/* @__PURE__ */ new Set()), z = te(I ?? ge()), N = te(
|
|
198
198
|
null
|
|
199
199
|
);
|
|
200
|
-
|
|
201
|
-
if (
|
|
202
|
-
|
|
200
|
+
N.current = H(y) ?? null, de(() => {
|
|
201
|
+
if (v && v.stateKey === y && v.path?.[0]) {
|
|
202
|
+
Z(y, (a) => ({
|
|
203
203
|
...a,
|
|
204
|
-
[
|
|
204
|
+
[v.path[0]]: v.newValue
|
|
205
205
|
}));
|
|
206
|
-
const t = `${
|
|
206
|
+
const t = `${v.stateKey}:${v.path.join(".")}`;
|
|
207
207
|
n.getState().setSyncInfo(t, {
|
|
208
|
-
timeStamp:
|
|
209
|
-
userId:
|
|
208
|
+
timeStamp: v.timeStamp,
|
|
209
|
+
userId: v.userId
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
}, [
|
|
212
|
+
}, [v]), de(() => {
|
|
213
213
|
if (s) {
|
|
214
|
-
|
|
214
|
+
ye(y, {
|
|
215
215
|
initialState: s
|
|
216
216
|
});
|
|
217
|
-
const t =
|
|
218
|
-
if (!(
|
|
217
|
+
const t = N.current, o = t?.serverState?.id !== void 0 && t?.serverState?.status === "success" && t?.serverState?.data, l = n.getState().initialStateGlobal[y];
|
|
218
|
+
if (!(l && !W(l, s) || !l) && !o)
|
|
219
219
|
return;
|
|
220
|
-
let
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
let w = s,
|
|
224
|
-
const
|
|
225
|
-
o &&
|
|
226
|
-
|
|
220
|
+
let u = null;
|
|
221
|
+
const V = B(t?.localStorage?.key) ? t?.localStorage?.key(s) : t?.localStorage?.key;
|
|
222
|
+
V && C && (u = ie(`${C}-${y}-${V}`));
|
|
223
|
+
let w = s, k = !1;
|
|
224
|
+
const x = o ? Date.now() : 0, A = u?.lastUpdated || 0, M = u?.lastSyncedWithServer || 0;
|
|
225
|
+
o && x > A ? (w = t.serverState.data, k = !0) : u && A > M && (w = u.state, t?.localStorage?.onChange && t?.localStorage?.onChange(w)), $e(
|
|
226
|
+
y,
|
|
227
227
|
s,
|
|
228
228
|
w,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
),
|
|
229
|
+
Y,
|
|
230
|
+
z.current,
|
|
231
|
+
C
|
|
232
|
+
), k && V && C && Ie(w, y, t, C, Date.now()), se(y), (Array.isArray(p) ? p : [p || "component"]).includes("none") || b({});
|
|
233
233
|
}
|
|
234
234
|
}, [
|
|
235
235
|
s,
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
f?.status,
|
|
237
|
+
f?.data,
|
|
238
238
|
...r || []
|
|
239
|
-
]),
|
|
240
|
-
U &&
|
|
241
|
-
serverSync:
|
|
242
|
-
formElements:
|
|
239
|
+
]), pe(() => {
|
|
240
|
+
U && ye(y, {
|
|
241
|
+
serverSync: S,
|
|
242
|
+
formElements: m,
|
|
243
243
|
initialState: s,
|
|
244
|
-
localStorage:
|
|
245
|
-
middleware:
|
|
244
|
+
localStorage: g,
|
|
245
|
+
middleware: N.current?.middleware
|
|
246
246
|
});
|
|
247
|
-
const t = `${
|
|
247
|
+
const t = `${y}////${z.current}`, a = n.getState().stateComponents.get(y) || {
|
|
248
248
|
components: /* @__PURE__ */ new Map()
|
|
249
249
|
};
|
|
250
250
|
return a.components.set(t, {
|
|
251
|
-
forceUpdate: () =>
|
|
251
|
+
forceUpdate: () => b({}),
|
|
252
252
|
paths: /* @__PURE__ */ new Set(),
|
|
253
253
|
deps: [],
|
|
254
254
|
depsFunction: E || void 0,
|
|
255
255
|
reactiveType: p ?? ["component", "deps"]
|
|
256
|
-
}), n.getState().stateComponents.set(
|
|
257
|
-
const o = `${
|
|
258
|
-
a && (a.components.delete(o), a.components.size === 0 && n.getState().stateComponents.delete(
|
|
256
|
+
}), n.getState().stateComponents.set(y, a), b({}), () => {
|
|
257
|
+
const o = `${y}////${z.current}`;
|
|
258
|
+
a && (a.components.delete(o), a.components.size === 0 && n.getState().stateComponents.delete(y));
|
|
259
259
|
};
|
|
260
260
|
}, []);
|
|
261
|
-
const
|
|
261
|
+
const Y = (t, a, o, l) => {
|
|
262
262
|
if (Array.isArray(a)) {
|
|
263
|
-
const
|
|
264
|
-
|
|
263
|
+
const h = `${y}-${a.join(".")}`;
|
|
264
|
+
Q.current.add(h);
|
|
265
265
|
}
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
let
|
|
270
|
-
if ((!
|
|
271
|
-
const
|
|
272
|
-
if (Array.isArray(
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
|
|
266
|
+
Z(y, (h) => {
|
|
267
|
+
const u = B(t) ? t(h) : t, V = `${y}-${a.join(".")}`;
|
|
268
|
+
if (V) {
|
|
269
|
+
let j = !1, T = n.getState().signalDomElements.get(V);
|
|
270
|
+
if ((!T || T.size === 0) && (o.updateType === "insert" || o.updateType === "cut")) {
|
|
271
|
+
const P = a.slice(0, -1), D = G(u, P);
|
|
272
|
+
if (Array.isArray(D)) {
|
|
273
|
+
j = !0;
|
|
274
|
+
const $ = `${y}-${P.join(".")}`;
|
|
275
|
+
T = n.getState().signalDomElements.get($);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
`[data-parent-id="${
|
|
278
|
+
if (T) {
|
|
279
|
+
const P = j ? G(u, a.slice(0, -1)) : G(u, a);
|
|
280
|
+
T.forEach(({ parentId: D, position: $, effect: O }) => {
|
|
281
|
+
const _ = document.querySelector(
|
|
282
|
+
`[data-parent-id="${D}"]`
|
|
283
283
|
);
|
|
284
|
-
if (
|
|
285
|
-
const
|
|
286
|
-
if (
|
|
287
|
-
const
|
|
288
|
-
|
|
284
|
+
if (_) {
|
|
285
|
+
const L = Array.from(_.childNodes);
|
|
286
|
+
if (L[$]) {
|
|
287
|
+
const F = O ? new Function("state", `return (${O})(state)`)(P) : P;
|
|
288
|
+
L[$].textContent = String(F);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
o.updateType === "update" && (
|
|
295
|
-
(
|
|
294
|
+
o.updateType === "update" && (l || N.current?.validation?.key) && a && J(
|
|
295
|
+
(l || N.current?.validation?.key) + "." + a.join(".")
|
|
296
296
|
);
|
|
297
297
|
const w = a.slice(0, a.length - 1);
|
|
298
|
-
o.updateType === "cut" &&
|
|
299
|
-
|
|
300
|
-
), o.updateType === "insert" &&
|
|
301
|
-
|
|
302
|
-
).filter(([
|
|
303
|
-
let
|
|
304
|
-
if (
|
|
305
|
-
let
|
|
306
|
-
|
|
298
|
+
o.updateType === "cut" && N.current?.validation?.key && J(
|
|
299
|
+
N.current?.validation?.key + "." + w.join(".")
|
|
300
|
+
), o.updateType === "insert" && N.current?.validation?.key && Oe(
|
|
301
|
+
N.current?.validation?.key + "." + w.join(".")
|
|
302
|
+
).filter(([T, P]) => {
|
|
303
|
+
let D = T?.split(".").length;
|
|
304
|
+
if (T == w.join(".") && D == w.length - 1) {
|
|
305
|
+
let $ = T + "." + w;
|
|
306
|
+
J(T), Fe($, P);
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
const
|
|
309
|
+
const k = n.getState().stateComponents.get(y);
|
|
310
|
+
if (k) {
|
|
311
|
+
const j = ue(h, u), T = new Set(j), P = o.updateType === "update" ? a.join(".") : a.slice(0, -1).join(".") || "";
|
|
312
312
|
for (const [
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
] of
|
|
316
|
-
let
|
|
317
|
-
const
|
|
318
|
-
if (!
|
|
319
|
-
if (
|
|
320
|
-
|
|
313
|
+
D,
|
|
314
|
+
$
|
|
315
|
+
] of k.components.entries()) {
|
|
316
|
+
let O = !1;
|
|
317
|
+
const _ = Array.isArray($.reactiveType) ? $.reactiveType : [$.reactiveType || "component"];
|
|
318
|
+
if (!_.includes("none")) {
|
|
319
|
+
if (_.includes("all")) {
|
|
320
|
+
$.forceUpdate();
|
|
321
321
|
continue;
|
|
322
322
|
}
|
|
323
|
-
if (
|
|
324
|
-
for (const
|
|
325
|
-
let
|
|
323
|
+
if (_.includes("component") && (($.paths.has(P) || $.paths.has("")) && (O = !0), !O))
|
|
324
|
+
for (const L of T) {
|
|
325
|
+
let F = L;
|
|
326
326
|
for (; ; ) {
|
|
327
|
-
if (
|
|
328
|
-
|
|
327
|
+
if ($.paths.has(F)) {
|
|
328
|
+
O = !0;
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
333
|
-
const Se =
|
|
331
|
+
const ce = F.lastIndexOf(".");
|
|
332
|
+
if (ce !== -1) {
|
|
333
|
+
const Se = F.substring(
|
|
334
334
|
0,
|
|
335
|
-
|
|
335
|
+
ce
|
|
336
336
|
);
|
|
337
337
|
if (!isNaN(
|
|
338
|
-
Number(
|
|
339
|
-
) &&
|
|
340
|
-
|
|
338
|
+
Number(F.substring(ce + 1))
|
|
339
|
+
) && $.paths.has(Se)) {
|
|
340
|
+
O = !0;
|
|
341
341
|
break;
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
F = Se;
|
|
344
344
|
} else
|
|
345
|
-
|
|
346
|
-
if (
|
|
345
|
+
F = "";
|
|
346
|
+
if (F === "")
|
|
347
347
|
break;
|
|
348
348
|
}
|
|
349
|
-
if (
|
|
349
|
+
if (O) break;
|
|
350
350
|
}
|
|
351
|
-
if (!
|
|
352
|
-
const
|
|
353
|
-
let
|
|
354
|
-
typeof
|
|
351
|
+
if (!O && _.includes("deps") && $.depsFunction) {
|
|
352
|
+
const L = $.depsFunction(u);
|
|
353
|
+
let F = !1;
|
|
354
|
+
typeof L == "boolean" ? L && (F = !0) : W($.deps, L) || ($.deps = L, F = !0), F && (O = !0);
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
O && $.forceUpdate();
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
C.length > 0 && queueMicrotask(() => {
|
|
360
|
-
C.forEach((P) => P());
|
|
361
|
-
});
|
|
362
359
|
}
|
|
363
|
-
const
|
|
364
|
-
a = a.map((
|
|
365
|
-
const
|
|
366
|
-
return
|
|
360
|
+
const x = Date.now();
|
|
361
|
+
a = a.map((j, T) => {
|
|
362
|
+
const P = a.slice(0, -1), D = G(u, P);
|
|
363
|
+
return T === a.length - 1 && ["insert", "cut"].includes(o.updateType) ? (D.length - 1).toString() : j;
|
|
367
364
|
});
|
|
368
|
-
const { oldValue:
|
|
365
|
+
const { oldValue: A, newValue: M } = Me(
|
|
369
366
|
o.updateType,
|
|
370
|
-
|
|
371
|
-
|
|
367
|
+
h,
|
|
368
|
+
u,
|
|
372
369
|
a
|
|
373
370
|
), q = {
|
|
374
|
-
timeStamp:
|
|
375
|
-
stateKey:
|
|
371
|
+
timeStamp: x,
|
|
372
|
+
stateKey: y,
|
|
376
373
|
path: a,
|
|
377
374
|
updateType: o.updateType,
|
|
378
375
|
status: "new",
|
|
379
|
-
oldValue:
|
|
376
|
+
oldValue: A,
|
|
380
377
|
newValue: M
|
|
381
378
|
};
|
|
382
|
-
if (
|
|
383
|
-
const
|
|
384
|
-
const
|
|
385
|
-
return
|
|
379
|
+
if (je(y, (j) => {
|
|
380
|
+
const P = [...j ?? [], q].reduce((D, $) => {
|
|
381
|
+
const O = `${$.stateKey}:${JSON.stringify($.path)}`, _ = D.get(O);
|
|
382
|
+
return _ ? (_.timeStamp = Math.max(_.timeStamp, $.timeStamp), _.newValue = $.newValue, _.oldValue = _.oldValue ?? $.oldValue, _.updateType = $.updateType) : D.set(O, { ...$ }), D;
|
|
386
383
|
}, /* @__PURE__ */ new Map());
|
|
387
|
-
return Array.from(
|
|
384
|
+
return Array.from(P.values());
|
|
388
385
|
}), Ie(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
),
|
|
386
|
+
u,
|
|
387
|
+
y,
|
|
388
|
+
N.current,
|
|
389
|
+
C
|
|
390
|
+
), N.current?.middleware && N.current.middleware({
|
|
394
391
|
updateLog: c,
|
|
395
392
|
update: q
|
|
396
|
-
}),
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
syncKey: typeof
|
|
400
|
-
rollBackState:
|
|
401
|
-
actionTimeStamp: Date.now() + (
|
|
393
|
+
}), N.current?.serverSync) {
|
|
394
|
+
const j = n.getState().serverState[y], T = N.current?.serverSync;
|
|
395
|
+
Re(y, {
|
|
396
|
+
syncKey: typeof T.syncKey == "string" ? T.syncKey : T.syncKey({ state: u }),
|
|
397
|
+
rollBackState: j,
|
|
398
|
+
actionTimeStamp: Date.now() + (T.debounce ?? 3e3),
|
|
402
399
|
status: "waiting"
|
|
403
400
|
});
|
|
404
401
|
}
|
|
405
|
-
return
|
|
402
|
+
return u;
|
|
406
403
|
});
|
|
407
404
|
};
|
|
408
|
-
n.getState().updaterState[
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
405
|
+
n.getState().updaterState[y] || (re(
|
|
406
|
+
y,
|
|
407
|
+
ae(
|
|
408
|
+
y,
|
|
409
|
+
Y,
|
|
410
|
+
z.current,
|
|
411
|
+
C
|
|
415
412
|
)
|
|
416
|
-
), n.getState().cogsStateStore[
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
), [
|
|
423
|
-
return [Ee(
|
|
413
|
+
), n.getState().cogsStateStore[y] || Z(y, e), n.getState().initialStateGlobal[y] || fe(y, e));
|
|
414
|
+
const d = Te(() => ae(
|
|
415
|
+
y,
|
|
416
|
+
Y,
|
|
417
|
+
z.current,
|
|
418
|
+
C
|
|
419
|
+
), [y, C]);
|
|
420
|
+
return [Ee(y), d];
|
|
424
421
|
}
|
|
425
|
-
function
|
|
426
|
-
const
|
|
422
|
+
function ae(e, i, S, g) {
|
|
423
|
+
const m = /* @__PURE__ */ new Map();
|
|
427
424
|
let E = 0;
|
|
428
|
-
const p = (
|
|
429
|
-
const r =
|
|
430
|
-
for (const [
|
|
431
|
-
(
|
|
425
|
+
const p = (v) => {
|
|
426
|
+
const r = v.join(".");
|
|
427
|
+
for (const [f] of m)
|
|
428
|
+
(f === r || f.startsWith(r + ".")) && m.delete(f);
|
|
432
429
|
E++;
|
|
433
|
-
},
|
|
434
|
-
removeValidation: (
|
|
435
|
-
|
|
430
|
+
}, I = {
|
|
431
|
+
removeValidation: (v) => {
|
|
432
|
+
v?.validationKey && J(v.validationKey);
|
|
436
433
|
},
|
|
437
|
-
revertToInitialState: (
|
|
434
|
+
revertToInitialState: (v) => {
|
|
438
435
|
const r = n.getState().getInitialOptions(e)?.validation;
|
|
439
|
-
r?.key &&
|
|
440
|
-
const
|
|
441
|
-
n.getState().clearSelectedIndexesForState(e),
|
|
442
|
-
const
|
|
443
|
-
U && localStorage.removeItem(U),
|
|
444
|
-
const
|
|
445
|
-
return
|
|
436
|
+
r?.key && J(r?.key), v?.validationKey && J(v.validationKey);
|
|
437
|
+
const f = n.getState().initialStateGlobal[e];
|
|
438
|
+
n.getState().clearSelectedIndexesForState(e), m.clear(), E++;
|
|
439
|
+
const R = s(f, []), b = H(e), C = B(b?.localStorage?.key) ? b?.localStorage?.key(f) : b?.localStorage?.key, U = `${g}-${e}-${C}`;
|
|
440
|
+
U && localStorage.removeItem(U), re(e, R), Z(e, f);
|
|
441
|
+
const y = n.getState().stateComponents.get(e);
|
|
442
|
+
return y && y.components.forEach((c) => {
|
|
446
443
|
c.forceUpdate();
|
|
447
|
-
}),
|
|
444
|
+
}), f;
|
|
448
445
|
},
|
|
449
|
-
updateInitialState: (
|
|
450
|
-
|
|
451
|
-
const r =
|
|
446
|
+
updateInitialState: (v) => {
|
|
447
|
+
m.clear(), E++;
|
|
448
|
+
const r = ae(
|
|
452
449
|
e,
|
|
453
450
|
i,
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
),
|
|
457
|
-
return localStorage.getItem(
|
|
458
|
-
|
|
451
|
+
S,
|
|
452
|
+
g
|
|
453
|
+
), f = n.getState().initialStateGlobal[e], R = H(e), b = B(R?.localStorage?.key) ? R?.localStorage?.key(f) : R?.localStorage?.key, C = `${g}-${e}-${b}`;
|
|
454
|
+
return localStorage.getItem(C) && localStorage.removeItem(C), Ne(() => {
|
|
455
|
+
fe(e, v), re(e, r), Z(e, v);
|
|
459
456
|
const U = n.getState().stateComponents.get(e);
|
|
460
|
-
U && U.components.forEach((
|
|
461
|
-
|
|
457
|
+
U && U.components.forEach((y) => {
|
|
458
|
+
y.forceUpdate();
|
|
462
459
|
});
|
|
463
460
|
}), {
|
|
464
461
|
fetchId: (U) => r.get()[U]
|
|
@@ -468,28 +465,28 @@ function re(e, i, v, u) {
|
|
|
468
465
|
_serverState: n.getState().serverState[e],
|
|
469
466
|
_isLoading: n.getState().isLoadingGlobal[e],
|
|
470
467
|
_isServerSynced: () => {
|
|
471
|
-
const
|
|
472
|
-
return !!(
|
|
468
|
+
const v = n.getState().serverState[e];
|
|
469
|
+
return !!(v && W(v, Ee(e)));
|
|
473
470
|
}
|
|
474
471
|
};
|
|
475
|
-
function s(
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
const
|
|
472
|
+
function s(v, r = [], f) {
|
|
473
|
+
const R = r.map(String).join(".");
|
|
474
|
+
m.get(R);
|
|
475
|
+
const b = function() {
|
|
479
476
|
return n().getNestedState(e, r);
|
|
480
477
|
};
|
|
481
|
-
Object.keys(
|
|
482
|
-
|
|
478
|
+
Object.keys(I).forEach((y) => {
|
|
479
|
+
b[y] = I[y];
|
|
483
480
|
});
|
|
484
|
-
const
|
|
485
|
-
apply(
|
|
481
|
+
const C = {
|
|
482
|
+
apply(y, c, Q) {
|
|
486
483
|
return console.log(
|
|
487
484
|
`PROXY APPLY TRAP HIT: stateKey=${e}, path=${r.join(".")}`
|
|
488
485
|
), console.trace("Apply trap stack trace"), n().getNestedState(e, r);
|
|
489
486
|
},
|
|
490
|
-
get(
|
|
491
|
-
|
|
492
|
-
const
|
|
487
|
+
get(y, c) {
|
|
488
|
+
f?.validIndices && !Array.isArray(v) && (f = { ...f, validIndices: void 0 });
|
|
489
|
+
const Q = /* @__PURE__ */ new Set([
|
|
493
490
|
"insert",
|
|
494
491
|
"cut",
|
|
495
492
|
"cutByValue",
|
|
@@ -512,19 +509,19 @@ function re(e, i, v, u) {
|
|
|
512
509
|
"_stateKey",
|
|
513
510
|
"getComponents"
|
|
514
511
|
]);
|
|
515
|
-
if (c !== "then" && !c.startsWith("$") && c !== "stateMapNoRender" && !
|
|
516
|
-
const
|
|
512
|
+
if (c !== "then" && !c.startsWith("$") && c !== "stateMapNoRender" && !Q.has(c)) {
|
|
513
|
+
const d = `${e}////${S}`, t = n.getState().stateComponents.get(e);
|
|
517
514
|
if (t) {
|
|
518
|
-
const a = t.components.get(
|
|
515
|
+
const a = t.components.get(d);
|
|
519
516
|
if (a && !a.pathsInitialized && (a.pathsInitialized = !0, !a.paths.has(""))) {
|
|
520
517
|
const o = r.join(".");
|
|
521
|
-
let
|
|
522
|
-
for (const
|
|
523
|
-
if (o.startsWith(
|
|
524
|
-
|
|
518
|
+
let l = !0;
|
|
519
|
+
for (const h of a.paths)
|
|
520
|
+
if (o.startsWith(h) && (o === h || o[h.length] === ".")) {
|
|
521
|
+
l = !1;
|
|
525
522
|
break;
|
|
526
523
|
}
|
|
527
|
-
|
|
524
|
+
l && a.paths.add(o);
|
|
528
525
|
}
|
|
529
526
|
}
|
|
530
527
|
}
|
|
@@ -535,55 +532,55 @@ function re(e, i, v, u) {
|
|
|
535
532
|
);
|
|
536
533
|
if (c === "sync" && r.length === 0)
|
|
537
534
|
return async function() {
|
|
538
|
-
const
|
|
535
|
+
const d = n.getState().getInitialOptions(e), t = d?.sync;
|
|
539
536
|
if (!t)
|
|
540
537
|
return console.error(`No mutation defined for state key "${e}"`), { success: !1, error: "No mutation defined" };
|
|
541
|
-
const a = n.getState().getNestedState(e, []), o =
|
|
538
|
+
const a = n.getState().getNestedState(e, []), o = d?.validation?.key;
|
|
542
539
|
try {
|
|
543
|
-
const
|
|
544
|
-
if (
|
|
545
|
-
n.getState().removeValidationError(o),
|
|
546
|
-
const
|
|
547
|
-
n.getState().addValidationError(
|
|
540
|
+
const l = await t.action(a);
|
|
541
|
+
if (l && !l.success && l.errors && o) {
|
|
542
|
+
n.getState().removeValidationError(o), l.errors.forEach((u) => {
|
|
543
|
+
const V = [o, ...u.path].join(".");
|
|
544
|
+
n.getState().addValidationError(V, u.message);
|
|
548
545
|
});
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
546
|
+
const h = n.getState().stateComponents.get(e);
|
|
547
|
+
h && h.components.forEach((u) => {
|
|
548
|
+
u.forceUpdate();
|
|
552
549
|
});
|
|
553
550
|
}
|
|
554
|
-
return
|
|
555
|
-
} catch (
|
|
556
|
-
return t.onError && t.onError(
|
|
551
|
+
return l?.success && t.onSuccess ? t.onSuccess(l.data) : !l?.success && t.onError && t.onError(l.error), l;
|
|
552
|
+
} catch (l) {
|
|
553
|
+
return t.onError && t.onError(l), { success: !1, error: l };
|
|
557
554
|
}
|
|
558
555
|
};
|
|
559
556
|
if (c === "_status") {
|
|
560
|
-
const
|
|
561
|
-
return W(
|
|
557
|
+
const d = n.getState().getNestedState(e, r), t = n.getState().initialStateGlobal[e], a = G(t, r);
|
|
558
|
+
return W(d, a) ? "fresh" : "stale";
|
|
562
559
|
}
|
|
563
560
|
if (c === "getStatus")
|
|
564
561
|
return function() {
|
|
565
|
-
const
|
|
562
|
+
const d = n().getNestedState(
|
|
566
563
|
e,
|
|
567
564
|
r
|
|
568
565
|
), t = n.getState().initialStateGlobal[e], a = G(t, r);
|
|
569
|
-
return W(
|
|
566
|
+
return W(d, a) ? "fresh" : "stale";
|
|
570
567
|
};
|
|
571
568
|
if (c === "removeStorage")
|
|
572
569
|
return () => {
|
|
573
|
-
const
|
|
570
|
+
const d = n.getState().initialStateGlobal[e], t = H(e), a = B(t?.localStorage?.key) ? t?.localStorage?.key(d) : t?.localStorage?.key, o = `${g}-${e}-${a}`;
|
|
574
571
|
o && localStorage.removeItem(o);
|
|
575
572
|
};
|
|
576
573
|
if (c === "showValidationErrors")
|
|
577
574
|
return () => {
|
|
578
|
-
const
|
|
579
|
-
if (!
|
|
575
|
+
const d = n.getState().getInitialOptions(e)?.validation;
|
|
576
|
+
if (!d?.key)
|
|
580
577
|
throw new Error("Validation key not found");
|
|
581
|
-
return n.getState().getValidationErrors(
|
|
578
|
+
return n.getState().getValidationErrors(d.key + "." + r.join("."));
|
|
582
579
|
};
|
|
583
|
-
if (Array.isArray(
|
|
584
|
-
const
|
|
580
|
+
if (Array.isArray(v)) {
|
|
581
|
+
const d = () => f?.validIndices ? v.map((a, o) => ({
|
|
585
582
|
item: a,
|
|
586
|
-
originalIndex:
|
|
583
|
+
originalIndex: f.validIndices[o]
|
|
587
584
|
})) : n.getState().getNestedState(e, r).map((a, o) => ({
|
|
588
585
|
item: a,
|
|
589
586
|
originalIndex: o
|
|
@@ -593,9 +590,9 @@ function re(e, i, v, u) {
|
|
|
593
590
|
const t = n.getState().getSelectedIndex(e, r.join("."));
|
|
594
591
|
if (t !== void 0)
|
|
595
592
|
return s(
|
|
596
|
-
|
|
593
|
+
v[t],
|
|
597
594
|
[...r, t.toString()],
|
|
598
|
-
|
|
595
|
+
f
|
|
599
596
|
);
|
|
600
597
|
};
|
|
601
598
|
if (c === "clearSelected")
|
|
@@ -606,43 +603,59 @@ function re(e, i, v, u) {
|
|
|
606
603
|
return () => n.getState().getSelectedIndex(e, r.join(".")) ?? -1;
|
|
607
604
|
if (c === "stateSort")
|
|
608
605
|
return (t) => {
|
|
609
|
-
const o = [...
|
|
610
|
-
(
|
|
611
|
-
),
|
|
612
|
-
...
|
|
606
|
+
const o = [...d()].sort(
|
|
607
|
+
(u, V) => t(u.item, V.item)
|
|
608
|
+
), l = o.map(({ item: u }) => u), h = {
|
|
609
|
+
...f,
|
|
613
610
|
validIndices: o.map(
|
|
614
|
-
({ originalIndex:
|
|
611
|
+
({ originalIndex: u }) => u
|
|
615
612
|
)
|
|
616
613
|
};
|
|
617
|
-
return s(
|
|
614
|
+
return s(l, r, h);
|
|
618
615
|
};
|
|
619
616
|
if (c === "stateFilter")
|
|
620
617
|
return (t) => {
|
|
621
|
-
const o =
|
|
622
|
-
({ item:
|
|
623
|
-
),
|
|
624
|
-
...
|
|
618
|
+
const o = d().filter(
|
|
619
|
+
({ item: u }, V) => t(u, V)
|
|
620
|
+
), l = o.map(({ item: u }) => u), h = {
|
|
621
|
+
...f,
|
|
625
622
|
validIndices: o.map(
|
|
626
|
-
({ originalIndex:
|
|
623
|
+
({ originalIndex: u }) => u
|
|
627
624
|
)
|
|
628
625
|
};
|
|
629
|
-
return s(
|
|
626
|
+
return s(l, r, h);
|
|
630
627
|
};
|
|
631
|
-
if (c === "stateMap"
|
|
632
|
-
return (t) =>
|
|
633
|
-
let
|
|
634
|
-
|
|
635
|
-
const
|
|
628
|
+
if (c === "stateMap")
|
|
629
|
+
return (t) => v.map((o, l) => {
|
|
630
|
+
let h;
|
|
631
|
+
f?.validIndices && f.validIndices[l] !== void 0 ? h = f.validIndices[l] : h = l;
|
|
632
|
+
const u = [...r, h.toString()], V = s(o, u, f), w = `${S}-${r.join(".")}-${h}`, k = t(o, V, l);
|
|
633
|
+
return /* @__PURE__ */ ee(
|
|
634
|
+
Le,
|
|
635
|
+
{
|
|
636
|
+
stateKey: e,
|
|
637
|
+
itemComponentId: w,
|
|
638
|
+
itemPath: u,
|
|
639
|
+
children: k
|
|
640
|
+
},
|
|
641
|
+
h
|
|
642
|
+
);
|
|
643
|
+
});
|
|
644
|
+
if (c === "stateMapNoRender")
|
|
645
|
+
return (t) => v.map((o, l) => {
|
|
646
|
+
let h;
|
|
647
|
+
f?.validIndices && f.validIndices[l] !== void 0 ? h = f.validIndices[l] : h = l;
|
|
648
|
+
const u = [...r, h.toString()], V = s(o, u, f);
|
|
636
649
|
return t(
|
|
637
650
|
o,
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
s(
|
|
651
|
+
V,
|
|
652
|
+
l,
|
|
653
|
+
v,
|
|
654
|
+
s(v, r, f)
|
|
642
655
|
);
|
|
643
656
|
});
|
|
644
657
|
if (c === "$stateMap")
|
|
645
|
-
return (t) =>
|
|
658
|
+
return (t) => oe(We, {
|
|
646
659
|
proxy: {
|
|
647
660
|
_stateKey: e,
|
|
648
661
|
_path: r,
|
|
@@ -653,242 +666,242 @@ function re(e, i, v, u) {
|
|
|
653
666
|
});
|
|
654
667
|
if (c === "stateFlattenOn")
|
|
655
668
|
return (t) => {
|
|
656
|
-
const a =
|
|
657
|
-
|
|
669
|
+
const a = v;
|
|
670
|
+
m.clear(), E++;
|
|
658
671
|
const o = a.flatMap(
|
|
659
|
-
(
|
|
672
|
+
(l) => l[t] ?? []
|
|
660
673
|
);
|
|
661
674
|
return s(
|
|
662
675
|
o,
|
|
663
676
|
[...r, "[*]", t],
|
|
664
|
-
|
|
677
|
+
f
|
|
665
678
|
);
|
|
666
679
|
};
|
|
667
680
|
if (c === "index")
|
|
668
681
|
return (t) => {
|
|
669
|
-
const a =
|
|
682
|
+
const a = v[t];
|
|
670
683
|
return s(a, [...r, t.toString()]);
|
|
671
684
|
};
|
|
672
685
|
if (c === "last")
|
|
673
686
|
return () => {
|
|
674
687
|
const t = n.getState().getNestedState(e, r);
|
|
675
688
|
if (t.length === 0) return;
|
|
676
|
-
const a = t.length - 1, o = t[a],
|
|
677
|
-
return s(o,
|
|
689
|
+
const a = t.length - 1, o = t[a], l = [...r, a.toString()];
|
|
690
|
+
return s(o, l);
|
|
678
691
|
};
|
|
679
692
|
if (c === "insert")
|
|
680
|
-
return (t) => (p(r),
|
|
693
|
+
return (t) => (p(r), le(i, t, r, e), s(
|
|
681
694
|
n.getState().getNestedState(e, r),
|
|
682
695
|
r
|
|
683
696
|
));
|
|
684
697
|
if (c === "uniqueInsert")
|
|
685
698
|
return (t, a, o) => {
|
|
686
|
-
const
|
|
687
|
-
let
|
|
688
|
-
if (!
|
|
699
|
+
const l = n.getState().getNestedState(e, r), h = B(t) ? t(l) : t;
|
|
700
|
+
let u = null;
|
|
701
|
+
if (!l.some((w) => {
|
|
689
702
|
if (a) {
|
|
690
|
-
const
|
|
691
|
-
(
|
|
703
|
+
const x = a.every(
|
|
704
|
+
(A) => W(w[A], h[A])
|
|
692
705
|
);
|
|
693
|
-
return
|
|
706
|
+
return x && (u = w), x;
|
|
694
707
|
}
|
|
695
|
-
const
|
|
696
|
-
return
|
|
708
|
+
const k = W(w, h);
|
|
709
|
+
return k && (u = w), k;
|
|
697
710
|
}))
|
|
698
|
-
p(r),
|
|
699
|
-
else if (o &&
|
|
700
|
-
const w = o(
|
|
701
|
-
(
|
|
711
|
+
p(r), le(i, h, r, e);
|
|
712
|
+
else if (o && u) {
|
|
713
|
+
const w = o(u), k = l.map(
|
|
714
|
+
(x) => W(x, u) ? w : x
|
|
702
715
|
);
|
|
703
|
-
p(r),
|
|
716
|
+
p(r), X(i, k, r);
|
|
704
717
|
}
|
|
705
718
|
};
|
|
706
719
|
if (c === "cut")
|
|
707
720
|
return (t, a) => {
|
|
708
721
|
if (!a?.waitForSync)
|
|
709
|
-
return p(r),
|
|
722
|
+
return p(r), K(i, r, e, t), s(
|
|
710
723
|
n.getState().getNestedState(e, r),
|
|
711
724
|
r
|
|
712
725
|
);
|
|
713
726
|
};
|
|
714
727
|
if (c === "cutByValue")
|
|
715
728
|
return (t) => {
|
|
716
|
-
for (let a = 0; a <
|
|
717
|
-
|
|
729
|
+
for (let a = 0; a < v.length; a++)
|
|
730
|
+
v[a] === t && K(i, r, e, a);
|
|
718
731
|
};
|
|
719
732
|
if (c === "toggleByValue")
|
|
720
733
|
return (t) => {
|
|
721
|
-
const a =
|
|
722
|
-
a > -1 ?
|
|
734
|
+
const a = v.findIndex((o) => o === t);
|
|
735
|
+
a > -1 ? K(i, r, e, a) : le(i, t, r, e);
|
|
723
736
|
};
|
|
724
737
|
if (c === "stateFind")
|
|
725
738
|
return (t) => {
|
|
726
|
-
const o =
|
|
727
|
-
({ item:
|
|
739
|
+
const o = d().find(
|
|
740
|
+
({ item: h }, u) => t(h, u)
|
|
728
741
|
);
|
|
729
742
|
if (!o) return;
|
|
730
|
-
const
|
|
731
|
-
return s(o.item,
|
|
743
|
+
const l = [...r, o.originalIndex.toString()];
|
|
744
|
+
return s(o.item, l, f);
|
|
732
745
|
};
|
|
733
746
|
if (c === "findWith")
|
|
734
747
|
return (t, a) => {
|
|
735
|
-
const
|
|
736
|
-
({ item:
|
|
748
|
+
const l = d().find(
|
|
749
|
+
({ item: u }) => u[t] === a
|
|
737
750
|
);
|
|
738
|
-
if (!
|
|
739
|
-
const
|
|
740
|
-
return s(
|
|
751
|
+
if (!l) return;
|
|
752
|
+
const h = [...r, l.originalIndex.toString()];
|
|
753
|
+
return s(l.item, h, f);
|
|
741
754
|
};
|
|
742
755
|
}
|
|
743
|
-
const
|
|
744
|
-
if (!isNaN(Number(
|
|
745
|
-
const
|
|
756
|
+
const z = r[r.length - 1];
|
|
757
|
+
if (!isNaN(Number(z))) {
|
|
758
|
+
const d = r.slice(0, -1), t = n.getState().getNestedState(e, d);
|
|
746
759
|
if (Array.isArray(t) && c === "cut")
|
|
747
|
-
return () =>
|
|
760
|
+
return () => K(
|
|
748
761
|
i,
|
|
749
|
-
|
|
762
|
+
d,
|
|
750
763
|
e,
|
|
751
|
-
Number(
|
|
764
|
+
Number(z)
|
|
752
765
|
);
|
|
753
766
|
}
|
|
754
767
|
if (c === "get")
|
|
755
768
|
return () => n.getState().getNestedState(e, r);
|
|
756
769
|
if (c === "$derive")
|
|
757
|
-
return (
|
|
770
|
+
return (d) => he({
|
|
758
771
|
_stateKey: e,
|
|
759
772
|
_path: r,
|
|
760
|
-
_effect:
|
|
773
|
+
_effect: d.toString()
|
|
761
774
|
});
|
|
762
775
|
if (c === "$get")
|
|
763
|
-
return () =>
|
|
776
|
+
return () => he({
|
|
764
777
|
_stateKey: e,
|
|
765
778
|
_path: r
|
|
766
779
|
});
|
|
767
780
|
if (c === "lastSynced") {
|
|
768
|
-
const
|
|
769
|
-
return n.getState().getSyncInfo(
|
|
781
|
+
const d = `${e}:${r.join(".")}`;
|
|
782
|
+
return n.getState().getSyncInfo(d);
|
|
770
783
|
}
|
|
771
784
|
if (c == "getLocalStorage")
|
|
772
|
-
return (
|
|
785
|
+
return (d) => ie(g + "-" + e + "-" + d);
|
|
773
786
|
if (c === "_selected") {
|
|
774
|
-
const
|
|
787
|
+
const d = r.slice(0, -1), t = d.join("."), a = n.getState().getNestedState(e, d);
|
|
775
788
|
return Array.isArray(a) ? Number(r[r.length - 1]) === n.getState().getSelectedIndex(e, t) : void 0;
|
|
776
789
|
}
|
|
777
790
|
if (c === "setSelected")
|
|
778
|
-
return (
|
|
791
|
+
return (d) => {
|
|
779
792
|
const t = r.slice(0, -1), a = Number(r[r.length - 1]), o = t.join(".");
|
|
780
|
-
|
|
781
|
-
const
|
|
782
|
-
|
|
793
|
+
d ? n.getState().setSelectedIndex(e, o, a) : n.getState().setSelectedIndex(e, o, void 0);
|
|
794
|
+
const l = n.getState().getNestedState(e, [...t]);
|
|
795
|
+
X(i, l, t), p(t);
|
|
783
796
|
};
|
|
784
797
|
if (c === "toggleSelected")
|
|
785
798
|
return () => {
|
|
786
|
-
const
|
|
799
|
+
const d = r.slice(0, -1), t = Number(r[r.length - 1]), a = d.join("."), o = n.getState().getSelectedIndex(e, a);
|
|
787
800
|
n.getState().setSelectedIndex(
|
|
788
801
|
e,
|
|
789
802
|
a,
|
|
790
803
|
o === t ? void 0 : t
|
|
791
804
|
);
|
|
792
|
-
const
|
|
793
|
-
|
|
805
|
+
const l = n.getState().getNestedState(e, [...d]);
|
|
806
|
+
X(i, l, d), p(d);
|
|
794
807
|
};
|
|
795
808
|
if (r.length == 0) {
|
|
796
809
|
if (c === "applyJsonPatch")
|
|
797
|
-
return (
|
|
798
|
-
const t = n.getState().cogsStateStore[e], o =
|
|
799
|
-
|
|
810
|
+
return (d) => {
|
|
811
|
+
const t = n.getState().cogsStateStore[e], o = xe(t, d).newDocument;
|
|
812
|
+
$e(
|
|
800
813
|
e,
|
|
801
814
|
n.getState().initialStateGlobal[e],
|
|
802
815
|
o,
|
|
803
816
|
i,
|
|
804
|
-
|
|
805
|
-
|
|
817
|
+
S,
|
|
818
|
+
g
|
|
806
819
|
);
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
const
|
|
820
|
+
const l = n.getState().stateComponents.get(e);
|
|
821
|
+
if (l) {
|
|
822
|
+
const h = ue(t, o), u = new Set(h);
|
|
810
823
|
for (const [
|
|
811
|
-
|
|
824
|
+
V,
|
|
812
825
|
w
|
|
813
|
-
] of
|
|
814
|
-
let
|
|
815
|
-
const
|
|
816
|
-
if (!
|
|
817
|
-
if (
|
|
826
|
+
] of l.components.entries()) {
|
|
827
|
+
let k = !1;
|
|
828
|
+
const x = Array.isArray(w.reactiveType) ? w.reactiveType : [w.reactiveType || "component"];
|
|
829
|
+
if (!x.includes("none")) {
|
|
830
|
+
if (x.includes("all")) {
|
|
818
831
|
w.forceUpdate();
|
|
819
832
|
continue;
|
|
820
833
|
}
|
|
821
|
-
if (
|
|
822
|
-
for (const
|
|
823
|
-
if (w.paths.has(
|
|
824
|
-
|
|
834
|
+
if (x.includes("component") && (w.paths.has("") && (k = !0), !k))
|
|
835
|
+
for (const A of u) {
|
|
836
|
+
if (w.paths.has(A)) {
|
|
837
|
+
k = !0;
|
|
825
838
|
break;
|
|
826
839
|
}
|
|
827
|
-
let M =
|
|
840
|
+
let M = A.lastIndexOf(".");
|
|
828
841
|
for (; M !== -1; ) {
|
|
829
|
-
const q =
|
|
842
|
+
const q = A.substring(0, M);
|
|
830
843
|
if (w.paths.has(q)) {
|
|
831
|
-
|
|
844
|
+
k = !0;
|
|
832
845
|
break;
|
|
833
846
|
}
|
|
834
|
-
const
|
|
847
|
+
const j = A.substring(
|
|
835
848
|
M + 1
|
|
836
849
|
);
|
|
837
|
-
if (!isNaN(Number(
|
|
838
|
-
const
|
|
839
|
-
if (
|
|
840
|
-
const
|
|
850
|
+
if (!isNaN(Number(j))) {
|
|
851
|
+
const T = q.lastIndexOf(".");
|
|
852
|
+
if (T !== -1) {
|
|
853
|
+
const P = q.substring(
|
|
841
854
|
0,
|
|
842
|
-
|
|
855
|
+
T
|
|
843
856
|
);
|
|
844
|
-
if (w.paths.has(
|
|
845
|
-
|
|
857
|
+
if (w.paths.has(P)) {
|
|
858
|
+
k = !0;
|
|
846
859
|
break;
|
|
847
860
|
}
|
|
848
861
|
}
|
|
849
862
|
}
|
|
850
863
|
M = q.lastIndexOf(".");
|
|
851
864
|
}
|
|
852
|
-
if (
|
|
865
|
+
if (k) break;
|
|
853
866
|
}
|
|
854
|
-
if (
|
|
855
|
-
const
|
|
867
|
+
if (!k && x.includes("deps") && w.depsFunction) {
|
|
868
|
+
const A = w.depsFunction(o);
|
|
856
869
|
let M = !1;
|
|
857
|
-
typeof
|
|
870
|
+
typeof A == "boolean" ? A && (M = !0) : W(w.deps, A) || (w.deps = A, M = !0), M && (k = !0);
|
|
858
871
|
}
|
|
859
|
-
|
|
872
|
+
k && w.forceUpdate();
|
|
860
873
|
}
|
|
861
874
|
}
|
|
862
875
|
}
|
|
863
876
|
};
|
|
864
877
|
if (c === "validateZodSchema")
|
|
865
878
|
return () => {
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
879
|
+
const d = n.getState().getInitialOptions(e)?.validation, t = n.getState().addValidationError;
|
|
880
|
+
if (!d?.zodSchema)
|
|
868
881
|
throw new Error("Zod schema not found");
|
|
869
|
-
if (!
|
|
882
|
+
if (!d?.key)
|
|
870
883
|
throw new Error("Validation key not found");
|
|
871
|
-
|
|
884
|
+
J(d.key);
|
|
872
885
|
const a = n.getState().cogsStateStore[e];
|
|
873
886
|
try {
|
|
874
|
-
const o = n.getState().getValidationErrors(
|
|
875
|
-
o && o.length > 0 && o.forEach(([
|
|
876
|
-
|
|
887
|
+
const o = n.getState().getValidationErrors(d.key);
|
|
888
|
+
o && o.length > 0 && o.forEach(([h]) => {
|
|
889
|
+
h && h.startsWith(d.key) && J(h);
|
|
877
890
|
});
|
|
878
|
-
const
|
|
879
|
-
return
|
|
880
|
-
const
|
|
881
|
-
t(
|
|
882
|
-
}),
|
|
891
|
+
const l = d.zodSchema.safeParse(a);
|
|
892
|
+
return l.success ? !0 : (l.error.errors.forEach((u) => {
|
|
893
|
+
const V = u.path, w = u.message, k = [d.key, ...V].join(".");
|
|
894
|
+
t(k, w);
|
|
895
|
+
}), se(e), !1);
|
|
883
896
|
} catch (o) {
|
|
884
897
|
return console.error("Zod schema validation failed", o), !1;
|
|
885
898
|
}
|
|
886
899
|
};
|
|
887
|
-
if (c === "_componentId") return
|
|
900
|
+
if (c === "_componentId") return S;
|
|
888
901
|
if (c === "getComponents")
|
|
889
902
|
return () => n().stateComponents.get(e);
|
|
890
903
|
if (c === "getAllFormRefs")
|
|
891
|
-
return () =>
|
|
904
|
+
return () => me.getState().getFormRefsByStateKey(e);
|
|
892
905
|
if (c === "_initialState")
|
|
893
906
|
return n.getState().initialStateGlobal[e];
|
|
894
907
|
if (c === "_serverState")
|
|
@@ -896,61 +909,61 @@ function re(e, i, v, u) {
|
|
|
896
909
|
if (c === "_isLoading")
|
|
897
910
|
return n.getState().isLoadingGlobal[e];
|
|
898
911
|
if (c === "revertToInitialState")
|
|
899
|
-
return
|
|
900
|
-
if (c === "updateInitialState") return
|
|
901
|
-
if (c === "removeValidation") return
|
|
912
|
+
return I.revertToInitialState;
|
|
913
|
+
if (c === "updateInitialState") return I.updateInitialState;
|
|
914
|
+
if (c === "removeValidation") return I.removeValidation;
|
|
902
915
|
}
|
|
903
916
|
if (c === "getFormRef")
|
|
904
|
-
return () =>
|
|
917
|
+
return () => me.getState().getFormRef(e + "." + r.join("."));
|
|
905
918
|
if (c === "validationWrapper")
|
|
906
919
|
return ({
|
|
907
|
-
children:
|
|
920
|
+
children: d,
|
|
908
921
|
hideMessage: t
|
|
909
|
-
}) => /* @__PURE__ */
|
|
910
|
-
|
|
922
|
+
}) => /* @__PURE__ */ ee(
|
|
923
|
+
Ce,
|
|
911
924
|
{
|
|
912
925
|
formOpts: t ? { validation: { message: "" } } : void 0,
|
|
913
926
|
path: r,
|
|
914
927
|
validationKey: n.getState().getInitialOptions(e)?.validation?.key || "",
|
|
915
928
|
stateKey: e,
|
|
916
|
-
validIndices:
|
|
917
|
-
children:
|
|
929
|
+
validIndices: f?.validIndices,
|
|
930
|
+
children: d
|
|
918
931
|
}
|
|
919
932
|
);
|
|
920
933
|
if (c === "_stateKey") return e;
|
|
921
934
|
if (c === "_path") return r;
|
|
922
|
-
if (c === "_isServerSynced") return
|
|
935
|
+
if (c === "_isServerSynced") return I._isServerSynced;
|
|
923
936
|
if (c === "update")
|
|
924
|
-
return (
|
|
937
|
+
return (d, t) => {
|
|
925
938
|
if (t?.debounce)
|
|
926
939
|
be(() => {
|
|
927
|
-
|
|
940
|
+
X(i, d, r, "");
|
|
928
941
|
const a = n.getState().getNestedState(e, r);
|
|
929
942
|
t?.afterUpdate && t.afterUpdate(a);
|
|
930
943
|
}, t.debounce);
|
|
931
944
|
else {
|
|
932
|
-
|
|
945
|
+
X(i, d, r, "");
|
|
933
946
|
const a = n.getState().getNestedState(e, r);
|
|
934
947
|
t?.afterUpdate && t.afterUpdate(a);
|
|
935
948
|
}
|
|
936
949
|
p(r);
|
|
937
950
|
};
|
|
938
951
|
if (c === "formElement")
|
|
939
|
-
return (
|
|
940
|
-
|
|
952
|
+
return (d, t) => /* @__PURE__ */ ee(
|
|
953
|
+
Pe,
|
|
941
954
|
{
|
|
942
955
|
setState: i,
|
|
943
956
|
stateKey: e,
|
|
944
957
|
path: r,
|
|
945
|
-
child:
|
|
958
|
+
child: d,
|
|
946
959
|
formOpts: t
|
|
947
960
|
}
|
|
948
961
|
);
|
|
949
|
-
const
|
|
950
|
-
return s(
|
|
962
|
+
const N = [...r, c], Y = n.getState().getNestedState(e, N);
|
|
963
|
+
return s(Y, N, f);
|
|
951
964
|
}
|
|
952
|
-
}, U = new Proxy(
|
|
953
|
-
return
|
|
965
|
+
}, U = new Proxy(b, C);
|
|
966
|
+
return m.set(R, {
|
|
954
967
|
proxy: U,
|
|
955
968
|
stateVersion: E
|
|
956
969
|
}), U;
|
|
@@ -959,81 +972,102 @@ function re(e, i, v, u) {
|
|
|
959
972
|
n.getState().getNestedState(e, [])
|
|
960
973
|
);
|
|
961
974
|
}
|
|
962
|
-
function
|
|
963
|
-
return
|
|
975
|
+
function he(e) {
|
|
976
|
+
return oe(Ge, { proxy: e });
|
|
964
977
|
}
|
|
965
978
|
function We({
|
|
966
979
|
proxy: e,
|
|
967
980
|
rebuildStateShape: i
|
|
968
981
|
}) {
|
|
969
|
-
const
|
|
970
|
-
return Array.isArray(
|
|
971
|
-
|
|
982
|
+
const S = n().getNestedState(e._stateKey, e._path);
|
|
983
|
+
return Array.isArray(S) ? i(
|
|
984
|
+
S,
|
|
972
985
|
e._path
|
|
973
986
|
).stateMapNoRender(
|
|
974
|
-
(
|
|
987
|
+
(m, E, p, I, s) => e._mapFn(m, E, p, I, s)
|
|
975
988
|
) : null;
|
|
976
989
|
}
|
|
977
990
|
function Ge({
|
|
978
991
|
proxy: e
|
|
979
992
|
}) {
|
|
980
|
-
const i = te(null),
|
|
993
|
+
const i = te(null), S = `${e._stateKey}-${e._path.join(".")}`;
|
|
981
994
|
return de(() => {
|
|
982
|
-
const
|
|
983
|
-
if (!
|
|
984
|
-
const
|
|
985
|
-
let
|
|
986
|
-
|
|
987
|
-
const
|
|
995
|
+
const g = i.current;
|
|
996
|
+
if (!g || !g.parentElement) return;
|
|
997
|
+
const m = g.parentElement, p = Array.from(m.childNodes).indexOf(g);
|
|
998
|
+
let I = m.getAttribute("data-parent-id");
|
|
999
|
+
I || (I = `parent-${crypto.randomUUID()}`, m.setAttribute("data-parent-id", I));
|
|
1000
|
+
const v = {
|
|
988
1001
|
instanceId: `instance-${crypto.randomUUID()}`,
|
|
989
|
-
parentId:
|
|
1002
|
+
parentId: I,
|
|
990
1003
|
position: p,
|
|
991
1004
|
effect: e._effect
|
|
992
1005
|
};
|
|
993
|
-
n.getState().addSignalElement(
|
|
1006
|
+
n.getState().addSignalElement(S, v);
|
|
994
1007
|
const r = n.getState().getNestedState(e._stateKey, e._path);
|
|
995
|
-
let
|
|
1008
|
+
let f;
|
|
996
1009
|
if (e._effect)
|
|
997
1010
|
try {
|
|
998
|
-
|
|
1011
|
+
f = new Function(
|
|
999
1012
|
"state",
|
|
1000
1013
|
`return (${e._effect})(state)`
|
|
1001
1014
|
)(r);
|
|
1002
|
-
} catch (
|
|
1003
|
-
console.error("Error evaluating effect function during mount:",
|
|
1015
|
+
} catch (b) {
|
|
1016
|
+
console.error("Error evaluating effect function during mount:", b), f = r;
|
|
1004
1017
|
}
|
|
1005
1018
|
else
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
}, [e._stateKey, e._path.join("."), e._effect]),
|
|
1019
|
+
f = r;
|
|
1020
|
+
f !== null && typeof f == "object" && (f = JSON.stringify(f));
|
|
1021
|
+
const R = document.createTextNode(String(f));
|
|
1022
|
+
g.replaceWith(R);
|
|
1023
|
+
}, [e._stateKey, e._path.join("."), e._effect]), oe("span", {
|
|
1011
1024
|
ref: i,
|
|
1012
1025
|
style: { display: "none" },
|
|
1013
|
-
"data-signal-id":
|
|
1026
|
+
"data-signal-id": S
|
|
1014
1027
|
});
|
|
1015
1028
|
}
|
|
1016
|
-
function
|
|
1029
|
+
function rt(e) {
|
|
1017
1030
|
const i = Ve(
|
|
1018
|
-
(
|
|
1019
|
-
const
|
|
1031
|
+
(S) => {
|
|
1032
|
+
const g = n.getState().stateComponents.get(e._stateKey) || {
|
|
1020
1033
|
components: /* @__PURE__ */ new Map()
|
|
1021
1034
|
};
|
|
1022
|
-
return
|
|
1023
|
-
forceUpdate:
|
|
1035
|
+
return g.components.set(e._stateKey, {
|
|
1036
|
+
forceUpdate: S,
|
|
1024
1037
|
paths: /* @__PURE__ */ new Set([e._path.join(".")])
|
|
1025
|
-
}), () =>
|
|
1038
|
+
}), () => g.components.delete(e._stateKey);
|
|
1026
1039
|
},
|
|
1027
1040
|
() => n.getState().getNestedState(e._stateKey, e._path)
|
|
1028
1041
|
);
|
|
1029
|
-
return
|
|
1042
|
+
return oe("text", {}, String(i));
|
|
1043
|
+
}
|
|
1044
|
+
function Le({
|
|
1045
|
+
stateKey: e,
|
|
1046
|
+
itemComponentId: i,
|
|
1047
|
+
itemPath: S,
|
|
1048
|
+
children: g
|
|
1049
|
+
}) {
|
|
1050
|
+
const [, m] = ne({});
|
|
1051
|
+
return pe(() => {
|
|
1052
|
+
const E = `${e}////${i}`, p = n.getState().stateComponents.get(e) || {
|
|
1053
|
+
components: /* @__PURE__ */ new Map()
|
|
1054
|
+
};
|
|
1055
|
+
return p.components.set(E, {
|
|
1056
|
+
forceUpdate: () => m({}),
|
|
1057
|
+
paths: /* @__PURE__ */ new Set([S.join(".")])
|
|
1058
|
+
// ATOMIC: Subscribes only to this item's path.
|
|
1059
|
+
}), n.getState().stateComponents.set(e, p), () => {
|
|
1060
|
+
const I = n.getState().stateComponents.get(e);
|
|
1061
|
+
I && I.components.delete(E);
|
|
1062
|
+
};
|
|
1063
|
+
}, [e, i, S.join(".")]), /* @__PURE__ */ ee(ke, { children: g });
|
|
1030
1064
|
}
|
|
1031
1065
|
export {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1066
|
+
he as $cogsSignal,
|
|
1067
|
+
rt as $cogsSignalStore,
|
|
1068
|
+
et as addStateOptions,
|
|
1069
|
+
tt as createCogsState,
|
|
1070
|
+
nt as notifyComponent,
|
|
1037
1071
|
De as useCogsStateFn
|
|
1038
1072
|
};
|
|
1039
1073
|
//# sourceMappingURL=CogsState.jsx.map
|