cogsbox-state 0.5.463 → 0.5.464
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.d.ts.map +1 -1
- package/dist/CogsState.jsx +1222 -1242
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +4 -40
package/dist/CogsState.jsx
CHANGED
|
@@ -1,889 +1,870 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { createRoot as
|
|
5
|
-
import { transformStateFunc as
|
|
6
|
-
import { ValidationWrapper as
|
|
7
|
-
import
|
|
8
|
-
import { v4 as
|
|
9
|
-
import { getGlobalStore as
|
|
10
|
-
import { useCogsConfig as
|
|
11
|
-
import { useInView as
|
|
12
|
-
function
|
|
13
|
-
const y =
|
|
14
|
-
m(
|
|
2
|
+
import { jsx as rt, Fragment as kt } from "react/jsx-runtime";
|
|
3
|
+
import { memo as Dt, useState as X, useRef as q, useCallback as ot, useEffect as Z, useLayoutEffect as lt, useMemo as dt, createElement as st, startTransition as Ot } from "react";
|
|
4
|
+
import { createRoot as bt } from "react-dom/client";
|
|
5
|
+
import { transformStateFunc as Rt, isFunction as K, isArray as wt, getDifferences as Et, isDeepEqual as nt } from "./utility.js";
|
|
6
|
+
import { ValidationWrapper as Vt } from "./Functions.jsx";
|
|
7
|
+
import Ut from "superjson";
|
|
8
|
+
import { v4 as tt } from "uuid";
|
|
9
|
+
import { getGlobalStore as a, formRefStore as ht } from "./store.js";
|
|
10
|
+
import { useCogsConfig as At } from "./CogsStateClient.jsx";
|
|
11
|
+
import { useInView as $t } from "react-intersection-observer";
|
|
12
|
+
function St(t, r) {
|
|
13
|
+
const y = a.getState().getInitialOptions, m = a.getState().setInitialStateOptions, v = y(t) || {};
|
|
14
|
+
m(t, {
|
|
15
15
|
...v,
|
|
16
|
-
...
|
|
16
|
+
...r
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
stateKey:
|
|
21
|
-
options:
|
|
19
|
+
function It({
|
|
20
|
+
stateKey: t,
|
|
21
|
+
options: r,
|
|
22
22
|
initialOptionsPart: y
|
|
23
23
|
}) {
|
|
24
|
-
const m =
|
|
25
|
-
let
|
|
26
|
-
if (
|
|
27
|
-
for (const
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const m = et(t) || {}, v = y[t] || {}, g = a.getState().setInitialStateOptions, T = { ...v, ...m };
|
|
25
|
+
let h = !1;
|
|
26
|
+
if (r)
|
|
27
|
+
for (const e in r)
|
|
28
|
+
T.hasOwnProperty(e) ? (e == "localStorage" && r[e] && T[e].key !== r[e]?.key && (h = !0, T[e] = r[e]), e == "defaultState" && r[e] && T[e] !== r[e] && !nt(T[e], r[e]) && (h = !0, T[e] = r[e])) : (h = !0, T[e] = r[e]);
|
|
29
|
+
T.syncOptions && (!r || !r.hasOwnProperty("syncOptions")) && (h = !0), h && g(t, T);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return { initialState:
|
|
31
|
+
function ne(t, { formElements: r, validation: y }) {
|
|
32
|
+
return { initialState: t, formElements: r, validation: y };
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
let y =
|
|
36
|
-
const [m, v] =
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
...
|
|
34
|
+
const Nt = (t, r) => {
|
|
35
|
+
let y = t;
|
|
36
|
+
const [m, v] = Rt(y);
|
|
37
|
+
r?.__fromSyncSchema && r?.__syncNotifications && a.getState().setInitialStateOptions("__notifications", r.__syncNotifications), r?.__fromSyncSchema && r?.__apiParamsMap && a.getState().setInitialStateOptions("__apiParamsMap", r.__apiParamsMap), Object.keys(m).forEach((h) => {
|
|
38
|
+
let e = v[h] || {};
|
|
39
|
+
const s = {
|
|
40
|
+
...e
|
|
41
41
|
};
|
|
42
|
-
if (
|
|
43
|
-
...
|
|
44
|
-
...
|
|
45
|
-
}),
|
|
46
|
-
...
|
|
47
|
-
...
|
|
48
|
-
},
|
|
49
|
-
zodSchemaV4:
|
|
50
|
-
...
|
|
51
|
-
}), Object.keys(
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
...
|
|
55
|
-
...
|
|
56
|
-
}) :
|
|
42
|
+
if (r?.formElements && (s.formElements = {
|
|
43
|
+
...r.formElements,
|
|
44
|
+
...e.formElements || {}
|
|
45
|
+
}), r?.validation && (s.validation = {
|
|
46
|
+
...r.validation,
|
|
47
|
+
...e.validation || {}
|
|
48
|
+
}, r.validation.key && !e.validation?.key && (s.validation.key = `${r.validation.key}.${h}`)), r?.__syncSchemas?.[h]?.schemas?.validation && (s.validation = {
|
|
49
|
+
zodSchemaV4: r.__syncSchemas[h].schemas.validation,
|
|
50
|
+
...e.validation
|
|
51
|
+
}), Object.keys(s).length > 0) {
|
|
52
|
+
const p = et(h);
|
|
53
|
+
p ? a.getState().setInitialStateOptions(h, {
|
|
54
|
+
...p,
|
|
55
|
+
...s
|
|
56
|
+
}) : a.getState().setInitialStateOptions(h, s);
|
|
57
57
|
}
|
|
58
|
-
}), Object.keys(m).forEach((
|
|
59
|
-
|
|
58
|
+
}), Object.keys(m).forEach((h) => {
|
|
59
|
+
a.getState().initializeShadowState(h, m[h]);
|
|
60
60
|
});
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
options: u,
|
|
61
|
+
const g = (h, e) => {
|
|
62
|
+
const [s] = X(e?.componentId ?? tt());
|
|
63
|
+
It({
|
|
64
|
+
stateKey: h,
|
|
65
|
+
options: e,
|
|
67
66
|
initialOptionsPart: v
|
|
68
67
|
});
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
stateKey:
|
|
72
|
-
syncUpdate:
|
|
73
|
-
componentId:
|
|
74
|
-
localStorage:
|
|
75
|
-
middleware:
|
|
76
|
-
reactiveType:
|
|
77
|
-
reactiveDeps:
|
|
78
|
-
defaultState:
|
|
79
|
-
dependencies:
|
|
80
|
-
serverState:
|
|
81
|
-
syncOptions:
|
|
82
|
-
__useSync:
|
|
68
|
+
const p = a.getState().getShadowValue(h) || m[h], F = e?.modifyState ? e.modifyState(p) : p;
|
|
69
|
+
return Wt(F, {
|
|
70
|
+
stateKey: h,
|
|
71
|
+
syncUpdate: e?.syncUpdate,
|
|
72
|
+
componentId: s,
|
|
73
|
+
localStorage: e?.localStorage,
|
|
74
|
+
middleware: e?.middleware,
|
|
75
|
+
reactiveType: e?.reactiveType,
|
|
76
|
+
reactiveDeps: e?.reactiveDeps,
|
|
77
|
+
defaultState: e?.defaultState,
|
|
78
|
+
dependencies: e?.dependencies,
|
|
79
|
+
serverState: e?.serverState,
|
|
80
|
+
syncOptions: e?.syncOptions,
|
|
81
|
+
__useSync: r?.__useSync
|
|
83
82
|
});
|
|
84
83
|
};
|
|
85
|
-
function h
|
|
86
|
-
|
|
84
|
+
function T(h, e) {
|
|
85
|
+
It({ stateKey: h, options: e, initialOptionsPart: v }), e.localStorage && Lt(h, e), pt(h);
|
|
87
86
|
}
|
|
88
|
-
return { useCogsState:
|
|
87
|
+
return { useCogsState: g, setCogsOptions: T };
|
|
89
88
|
};
|
|
90
|
-
function
|
|
91
|
-
const y =
|
|
92
|
-
for (const
|
|
93
|
-
const
|
|
94
|
-
m[
|
|
89
|
+
function oe(t, r) {
|
|
90
|
+
const y = t.schemas, m = {}, v = {};
|
|
91
|
+
for (const g in y) {
|
|
92
|
+
const T = y[g];
|
|
93
|
+
m[g] = T?.schemas?.defaultValues || {}, T?.api?.queryData?._paramType && (v[g] = T.api.queryData._paramType);
|
|
95
94
|
}
|
|
96
|
-
return
|
|
95
|
+
return Nt(m, {
|
|
97
96
|
__fromSyncSchema: !0,
|
|
98
|
-
__syncNotifications:
|
|
97
|
+
__syncNotifications: t.notifications,
|
|
99
98
|
__apiParamsMap: v,
|
|
100
|
-
__useSync:
|
|
99
|
+
__useSync: r,
|
|
101
100
|
__syncSchemas: y
|
|
102
101
|
});
|
|
103
102
|
}
|
|
104
103
|
const {
|
|
105
|
-
getInitialOptions:
|
|
106
|
-
addStateLog:
|
|
107
|
-
updateInitialStateGlobal:
|
|
108
|
-
} =
|
|
104
|
+
getInitialOptions: et,
|
|
105
|
+
addStateLog: Ft,
|
|
106
|
+
updateInitialStateGlobal: _t
|
|
107
|
+
} = a.getState(), jt = (t, r, y, m, v) => {
|
|
109
108
|
y?.log && console.log(
|
|
110
109
|
"saving to localstorage",
|
|
111
|
-
|
|
110
|
+
r,
|
|
112
111
|
y.localStorage?.key,
|
|
113
112
|
m
|
|
114
113
|
);
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
let
|
|
114
|
+
const g = K(y?.localStorage?.key) ? y.localStorage?.key(t) : y?.localStorage?.key;
|
|
115
|
+
if (g && m) {
|
|
116
|
+
const T = `${m}-${r}-${g}`;
|
|
117
|
+
let h;
|
|
119
118
|
try {
|
|
120
|
-
|
|
119
|
+
h = ft(T)?.lastSyncedWithServer;
|
|
121
120
|
} catch {
|
|
122
121
|
}
|
|
123
|
-
const
|
|
124
|
-
state:
|
|
122
|
+
const e = a.getState().getShadowMetadata(r, []), s = {
|
|
123
|
+
state: t,
|
|
125
124
|
lastUpdated: Date.now(),
|
|
126
|
-
lastSyncedWithServer:
|
|
127
|
-
stateSource:
|
|
128
|
-
baseServerState:
|
|
129
|
-
},
|
|
125
|
+
lastSyncedWithServer: h,
|
|
126
|
+
stateSource: e?.stateSource,
|
|
127
|
+
baseServerState: e?.baseServerState
|
|
128
|
+
}, p = Ut.serialize(s);
|
|
130
129
|
window.localStorage.setItem(
|
|
131
|
-
|
|
132
|
-
JSON.stringify(
|
|
130
|
+
T,
|
|
131
|
+
JSON.stringify(p.json)
|
|
133
132
|
);
|
|
134
133
|
}
|
|
135
|
-
},
|
|
136
|
-
if (!
|
|
134
|
+
}, ft = (t) => {
|
|
135
|
+
if (!t) return null;
|
|
137
136
|
try {
|
|
138
|
-
const
|
|
139
|
-
return
|
|
140
|
-
} catch (
|
|
141
|
-
return console.error("Error loading from localStorage:",
|
|
137
|
+
const r = window.localStorage.getItem(t);
|
|
138
|
+
return r ? JSON.parse(r) : null;
|
|
139
|
+
} catch (r) {
|
|
140
|
+
return console.error("Error loading from localStorage:", r), null;
|
|
142
141
|
}
|
|
143
|
-
},
|
|
144
|
-
const y =
|
|
142
|
+
}, Lt = (t, r) => {
|
|
143
|
+
const y = a.getState().getShadowValue(t), { sessionId: m } = At(), v = K(r?.localStorage?.key) ? r.localStorage.key(y) : r?.localStorage?.key;
|
|
145
144
|
if (v && m) {
|
|
146
|
-
const
|
|
147
|
-
`${m}-${
|
|
145
|
+
const g = ft(
|
|
146
|
+
`${m}-${t}-${v}`
|
|
148
147
|
);
|
|
149
|
-
if (
|
|
150
|
-
return
|
|
148
|
+
if (g && g.lastUpdated > (g.lastSyncedWithServer || 0))
|
|
149
|
+
return pt(t), !0;
|
|
151
150
|
}
|
|
152
151
|
return !1;
|
|
153
|
-
},
|
|
154
|
-
const
|
|
155
|
-
if (!
|
|
152
|
+
}, pt = (t) => {
|
|
153
|
+
const r = a.getState().getShadowMetadata(t, []);
|
|
154
|
+
if (!r) return;
|
|
156
155
|
const y = /* @__PURE__ */ new Set();
|
|
157
|
-
|
|
156
|
+
r?.components?.forEach((m) => {
|
|
158
157
|
(m ? Array.isArray(m.reactiveType) ? m.reactiveType : [m.reactiveType || "component"] : null)?.includes("none") || y.add(() => m.forceUpdate());
|
|
159
158
|
}), queueMicrotask(() => {
|
|
160
159
|
y.forEach((m) => m());
|
|
161
160
|
});
|
|
162
|
-
},
|
|
163
|
-
const y =
|
|
161
|
+
}, se = (t, r) => {
|
|
162
|
+
const y = a.getState().getShadowMetadata(t, []);
|
|
164
163
|
if (y) {
|
|
165
|
-
const m = `${
|
|
164
|
+
const m = `${t}////${r}`, v = y?.components?.get(m);
|
|
166
165
|
if ((v ? Array.isArray(v.reactiveType) ? v.reactiveType : [v.reactiveType || "component"] : null)?.includes("none"))
|
|
167
166
|
return;
|
|
168
167
|
v && v.forceUpdate();
|
|
169
168
|
}
|
|
170
169
|
};
|
|
171
|
-
function
|
|
172
|
-
const v =
|
|
173
|
-
if (v.setShadowMetadata(
|
|
174
|
-
...
|
|
170
|
+
function mt(t, r, y, m) {
|
|
171
|
+
const v = a.getState(), g = v.getShadowMetadata(t, r);
|
|
172
|
+
if (v.setShadowMetadata(t, r, {
|
|
173
|
+
...g,
|
|
175
174
|
isDirty: !1,
|
|
176
175
|
stateSource: "server",
|
|
177
176
|
lastServerSync: m || Date.now()
|
|
178
177
|
}), Array.isArray(y)) {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
const T = v.getShadowMetadata(t, r);
|
|
179
|
+
T?.arrayKeys && T.arrayKeys.forEach((h, e) => {
|
|
180
|
+
const s = h.split(".").slice(1), p = y[e];
|
|
181
|
+
p !== void 0 && mt(
|
|
182
|
+
t,
|
|
183
|
+
s,
|
|
184
|
+
p,
|
|
186
185
|
m
|
|
187
186
|
);
|
|
188
187
|
});
|
|
189
|
-
} else y && typeof y == "object" && y.constructor === Object && Object.keys(y).forEach((
|
|
190
|
-
const
|
|
191
|
-
|
|
188
|
+
} else y && typeof y == "object" && y.constructor === Object && Object.keys(y).forEach((T) => {
|
|
189
|
+
const h = [...r, T], e = y[T];
|
|
190
|
+
mt(t, h, e, m);
|
|
192
191
|
});
|
|
193
192
|
}
|
|
194
|
-
let
|
|
195
|
-
function
|
|
196
|
-
stateKey:
|
|
193
|
+
let ct = /* @__PURE__ */ new Map(), gt = !1;
|
|
194
|
+
function Wt(t, {
|
|
195
|
+
stateKey: r,
|
|
197
196
|
localStorage: y,
|
|
198
197
|
formElements: m,
|
|
199
198
|
reactiveDeps: v,
|
|
200
|
-
reactiveType:
|
|
201
|
-
componentId:
|
|
202
|
-
defaultState:
|
|
203
|
-
syncUpdate:
|
|
204
|
-
dependencies:
|
|
205
|
-
serverState:
|
|
206
|
-
__useSync:
|
|
199
|
+
reactiveType: g,
|
|
200
|
+
componentId: T,
|
|
201
|
+
defaultState: h,
|
|
202
|
+
syncUpdate: e,
|
|
203
|
+
dependencies: s,
|
|
204
|
+
serverState: p,
|
|
205
|
+
__useSync: F
|
|
207
206
|
} = {}) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const [f] = Q(a ?? te()), K = z(h ?? te()), L = z(
|
|
207
|
+
const [j, k] = X({}), { sessionId: N } = At();
|
|
208
|
+
let G = !r;
|
|
209
|
+
const [S] = X(r ?? tt()), Q = q(T ?? tt()), d = q(
|
|
212
210
|
null
|
|
213
211
|
);
|
|
214
|
-
|
|
215
|
-
if (
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
timeStamp:
|
|
219
|
-
userId:
|
|
212
|
+
d.current = et(S) ?? null, Z(() => {
|
|
213
|
+
if (e && e.stateKey === S && e.path?.[0]) {
|
|
214
|
+
const l = `${e.stateKey}:${e.path.join(".")}`;
|
|
215
|
+
a.getState().setSyncInfo(l, {
|
|
216
|
+
timeStamp: e.timeStamp,
|
|
217
|
+
userId: e.userId
|
|
220
218
|
});
|
|
221
219
|
}
|
|
222
|
-
}, [
|
|
223
|
-
const
|
|
224
|
-
(
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
220
|
+
}, [e]);
|
|
221
|
+
const W = ot(
|
|
222
|
+
(l) => {
|
|
223
|
+
const u = l ? { ...et(S), ...l } : et(S), E = u?.defaultState || h || t;
|
|
224
|
+
if (u?.serverState?.status === "success" && u?.serverState?.data !== void 0)
|
|
227
225
|
return {
|
|
228
|
-
value:
|
|
226
|
+
value: u.serverState.data,
|
|
229
227
|
source: "server",
|
|
230
|
-
timestamp:
|
|
228
|
+
timestamp: u.serverState.timestamp || Date.now()
|
|
231
229
|
};
|
|
232
|
-
if (
|
|
233
|
-
const
|
|
234
|
-
`${
|
|
230
|
+
if (u?.localStorage?.key && N) {
|
|
231
|
+
const V = K(u.localStorage.key) ? u.localStorage.key(E) : u.localStorage.key, M = ft(
|
|
232
|
+
`${N}-${S}-${V}`
|
|
235
233
|
);
|
|
236
|
-
if (
|
|
234
|
+
if (M && M.lastUpdated > (u?.serverState?.timestamp || 0))
|
|
237
235
|
return {
|
|
238
|
-
value:
|
|
236
|
+
value: M.state,
|
|
239
237
|
source: "localStorage",
|
|
240
|
-
timestamp:
|
|
238
|
+
timestamp: M.lastUpdated
|
|
241
239
|
};
|
|
242
240
|
}
|
|
243
241
|
return {
|
|
244
|
-
value:
|
|
242
|
+
value: E || t,
|
|
245
243
|
source: "default",
|
|
246
244
|
timestamp: Date.now()
|
|
247
245
|
};
|
|
248
246
|
},
|
|
249
|
-
[
|
|
247
|
+
[S, h, t, N]
|
|
250
248
|
);
|
|
251
249
|
Z(() => {
|
|
252
|
-
|
|
253
|
-
}, [
|
|
250
|
+
a.getState().setServerStateUpdate(S, p);
|
|
251
|
+
}, [p, S]), Z(() => a.getState().subscribeToPath(S, (i) => {
|
|
254
252
|
if (i?.type === "SERVER_STATE_UPDATE") {
|
|
255
|
-
const
|
|
256
|
-
if (console.log("SERVER_STATE_UPDATE", i),
|
|
257
|
-
|
|
258
|
-
const w = typeof
|
|
259
|
-
if (w && Array.isArray(
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
),
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
267
|
-
const C =
|
|
253
|
+
const u = i.serverState;
|
|
254
|
+
if (console.log("SERVER_STATE_UPDATE", i), u?.status === "success" && u.data !== void 0) {
|
|
255
|
+
St(S, { serverState: u });
|
|
256
|
+
const w = typeof u.merge == "object" ? u.merge : u.merge === !0 ? {} : null, V = a.getState().getShadowValue(S), M = u.data;
|
|
257
|
+
if (w && Array.isArray(V) && Array.isArray(M)) {
|
|
258
|
+
const U = w.key, $ = new Set(
|
|
259
|
+
V.map((x) => x[U])
|
|
260
|
+
), z = M.filter((x) => !$.has(x[U]));
|
|
261
|
+
z.length > 0 && z.forEach((x) => {
|
|
262
|
+
a.getState().insertShadowArrayElement(S, [], x);
|
|
263
|
+
const B = a.getState().getShadowMetadata(S, []);
|
|
264
|
+
if (B?.arrayKeys) {
|
|
265
|
+
const C = B.arrayKeys[B.arrayKeys.length - 1];
|
|
268
266
|
if (C) {
|
|
269
|
-
const
|
|
270
|
-
|
|
267
|
+
const O = C.split(".").slice(1);
|
|
268
|
+
a.getState().setShadowMetadata(S, O, {
|
|
271
269
|
isDirty: !1,
|
|
272
270
|
stateSource: "server",
|
|
273
|
-
lastServerSync:
|
|
271
|
+
lastServerSync: u.timestamp || Date.now()
|
|
274
272
|
});
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
|
|
273
|
+
const I = a.getState().getShadowValue(C);
|
|
274
|
+
I && typeof I == "object" && !Array.isArray(I) && Object.keys(I).forEach((b) => {
|
|
275
|
+
const A = [...O, b];
|
|
276
|
+
a.getState().setShadowMetadata(S, A, {
|
|
279
277
|
isDirty: !1,
|
|
280
278
|
stateSource: "server",
|
|
281
|
-
lastServerSync:
|
|
279
|
+
lastServerSync: u.timestamp || Date.now()
|
|
282
280
|
});
|
|
283
281
|
});
|
|
284
282
|
}
|
|
285
283
|
}
|
|
286
284
|
});
|
|
287
285
|
} else
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
a.getState().initializeShadowState(S, M), mt(
|
|
287
|
+
S,
|
|
290
288
|
[],
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
M,
|
|
290
|
+
u.timestamp
|
|
293
291
|
);
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
...
|
|
292
|
+
const _ = a.getState().getShadowMetadata(S, []);
|
|
293
|
+
a.getState().setShadowMetadata(S, [], {
|
|
294
|
+
..._,
|
|
297
295
|
stateSource: "server",
|
|
298
|
-
lastServerSync:
|
|
296
|
+
lastServerSync: u.timestamp || Date.now(),
|
|
299
297
|
isDirty: !1
|
|
300
298
|
});
|
|
301
299
|
}
|
|
302
300
|
}
|
|
303
|
-
}), [
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
301
|
+
}), [S, W]), Z(() => {
|
|
302
|
+
const l = a.getState().getShadowMetadata(S, []);
|
|
303
|
+
if (l && l.stateSource)
|
|
306
304
|
return;
|
|
307
|
-
const i =
|
|
308
|
-
if (i?.defaultState !== void 0 ||
|
|
309
|
-
const
|
|
310
|
-
i?.defaultState ||
|
|
311
|
-
defaultState:
|
|
305
|
+
const i = et(S);
|
|
306
|
+
if (i?.defaultState !== void 0 || h !== void 0) {
|
|
307
|
+
const u = i?.defaultState || h;
|
|
308
|
+
i?.defaultState || St(S, {
|
|
309
|
+
defaultState: u
|
|
312
310
|
});
|
|
313
|
-
const { value:
|
|
314
|
-
|
|
311
|
+
const { value: E, source: w, timestamp: V } = W();
|
|
312
|
+
a.getState().initializeShadowState(S, E), a.getState().setShadowMetadata(S, [], {
|
|
315
313
|
stateSource: w,
|
|
316
|
-
lastServerSync: w === "server" ?
|
|
314
|
+
lastServerSync: w === "server" ? V : void 0,
|
|
317
315
|
isDirty: !1,
|
|
318
|
-
baseServerState: w === "server" ?
|
|
319
|
-
}),
|
|
316
|
+
baseServerState: w === "server" ? E : void 0
|
|
317
|
+
}), pt(S);
|
|
320
318
|
}
|
|
321
|
-
}, [
|
|
322
|
-
|
|
319
|
+
}, [S, ...s || []]), lt(() => {
|
|
320
|
+
G && St(S, {
|
|
323
321
|
formElements: m,
|
|
324
|
-
defaultState:
|
|
322
|
+
defaultState: h,
|
|
325
323
|
localStorage: y,
|
|
326
|
-
middleware:
|
|
324
|
+
middleware: d.current?.middleware
|
|
327
325
|
});
|
|
328
|
-
const
|
|
329
|
-
return
|
|
330
|
-
forceUpdate: () =>
|
|
331
|
-
reactiveType:
|
|
326
|
+
const l = `${S}////${Q.current}`, i = a.getState().getShadowMetadata(S, []), u = i?.components || /* @__PURE__ */ new Map();
|
|
327
|
+
return u.set(l, {
|
|
328
|
+
forceUpdate: () => k({}),
|
|
329
|
+
reactiveType: g ?? ["component", "deps"],
|
|
332
330
|
paths: /* @__PURE__ */ new Set(),
|
|
333
331
|
depsFunction: v || void 0,
|
|
334
|
-
deps: v ? v(
|
|
335
|
-
prevDeps: v ? v(
|
|
336
|
-
}),
|
|
332
|
+
deps: v ? v(a.getState().getShadowValue(S)) : [],
|
|
333
|
+
prevDeps: v ? v(a.getState().getShadowValue(S)) : []
|
|
334
|
+
}), a.getState().setShadowMetadata(S, [], {
|
|
337
335
|
...i,
|
|
338
|
-
components:
|
|
339
|
-
}),
|
|
340
|
-
const
|
|
341
|
-
w?.paths && w.paths.forEach((
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
}),
|
|
336
|
+
components: u
|
|
337
|
+
}), k({}), () => {
|
|
338
|
+
const E = a.getState().getShadowMetadata(S, []), w = E?.components?.get(l);
|
|
339
|
+
w?.paths && w.paths.forEach((V) => {
|
|
340
|
+
const _ = V.split(".").slice(1), U = a.getState().getShadowMetadata(S, _);
|
|
341
|
+
U?.pathComponents && U.pathComponents.size === 0 && (delete U.pathComponents, a.getState().setShadowMetadata(S, _, U));
|
|
342
|
+
}), E?.components && a.getState().setShadowMetadata(S, [], E);
|
|
345
343
|
};
|
|
346
344
|
}, []);
|
|
347
|
-
const J =
|
|
348
|
-
|
|
349
|
-
const X = (c, i, s) => {
|
|
350
|
-
console.time("top of effectiveSetState");
|
|
351
|
-
const p = [f, ...i].join("."), w = t.getState(), b = w.getShadowMetadata(f, i), A = w.getShadowValue(p);
|
|
352
|
-
console.timeEnd("top of effectiveSetState"), console.time("top of payload");
|
|
353
|
-
const E = s.updateType === "insert" && ee(c) ? c({ state: A, uuid: te() }) : ee(c) ? c(A) : c, N = {
|
|
345
|
+
const J = q(null), n = (l, i, u) => {
|
|
346
|
+
const E = [S, ...i].join("."), w = a.getState(), V = w.getShadowMetadata(S, i), M = w.getShadowValue(E), _ = u.updateType === "insert" && K(l) ? l({ state: M, uuid: tt() }) : K(l) ? l(M) : l, $ = {
|
|
354
347
|
timeStamp: Date.now(),
|
|
355
|
-
stateKey:
|
|
348
|
+
stateKey: S,
|
|
356
349
|
path: i,
|
|
357
|
-
updateType:
|
|
350
|
+
updateType: u.updateType,
|
|
358
351
|
status: "new",
|
|
359
|
-
oldValue:
|
|
360
|
-
newValue:
|
|
352
|
+
oldValue: M,
|
|
353
|
+
newValue: _
|
|
361
354
|
};
|
|
362
|
-
switch (
|
|
355
|
+
switch (u.updateType) {
|
|
363
356
|
case "insert": {
|
|
364
|
-
w.insertShadowArrayElement(
|
|
365
|
-
const C =
|
|
357
|
+
w.insertShadowArrayElement(S, i, $.newValue), w.markAsDirty(S, i, { bubble: !0 });
|
|
358
|
+
const C = V;
|
|
366
359
|
if (C?.arrayKeys) {
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
w.markAsDirty(
|
|
360
|
+
const O = C.arrayKeys[C.arrayKeys.length - 1];
|
|
361
|
+
if (O) {
|
|
362
|
+
const I = O.split(".").slice(1);
|
|
363
|
+
w.markAsDirty(S, I, { bubble: !1 });
|
|
371
364
|
}
|
|
372
365
|
}
|
|
373
366
|
break;
|
|
374
367
|
}
|
|
375
368
|
case "cut": {
|
|
376
369
|
const C = i.slice(0, -1);
|
|
377
|
-
w.removeShadowArrayElement(
|
|
370
|
+
w.removeShadowArrayElement(S, i), w.markAsDirty(S, C, { bubble: !0 });
|
|
378
371
|
break;
|
|
379
372
|
}
|
|
380
373
|
case "update": {
|
|
381
|
-
w.updateShadowAtPath(
|
|
374
|
+
w.updateShadowAtPath(S, i, $.newValue), w.markAsDirty(S, i, { bubble: !0 });
|
|
382
375
|
break;
|
|
383
376
|
}
|
|
384
377
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
let D = C;
|
|
395
|
-
if (T && C !== null)
|
|
378
|
+
if (u.sync !== !1 && J.current && J.current.connected && J.current.updateState({ operation: $ }), V?.signals && V.signals.length > 0) {
|
|
379
|
+
const C = u.updateType === "cut" ? null : _;
|
|
380
|
+
V.signals.forEach(({ parentId: O, position: I, effect: b }) => {
|
|
381
|
+
const A = document.querySelector(`[data-parent-id="${O}"]`);
|
|
382
|
+
if (A) {
|
|
383
|
+
const D = Array.from(A.childNodes);
|
|
384
|
+
if (D[I]) {
|
|
385
|
+
let P = C;
|
|
386
|
+
if (b && C !== null)
|
|
396
387
|
try {
|
|
397
|
-
|
|
388
|
+
P = new Function(
|
|
398
389
|
"state",
|
|
399
|
-
`return (${
|
|
390
|
+
`return (${b})(state)`
|
|
400
391
|
)(C);
|
|
401
|
-
} catch (
|
|
402
|
-
console.error("Error evaluating effect function:",
|
|
392
|
+
} catch (R) {
|
|
393
|
+
console.error("Error evaluating effect function:", R);
|
|
403
394
|
}
|
|
404
|
-
|
|
395
|
+
P != null && typeof P == "object" && (P = JSON.stringify(P)), D[I].textContent = String(P ?? "");
|
|
405
396
|
}
|
|
406
397
|
}
|
|
407
398
|
});
|
|
408
399
|
}
|
|
409
|
-
if (
|
|
410
|
-
const C = w.getShadowMetadata(
|
|
411
|
-
[
|
|
400
|
+
if (u.updateType === "insert" && V?.mapWrappers && V.mapWrappers.length > 0) {
|
|
401
|
+
const C = w.getShadowMetadata(S, i)?.arrayKeys || [], O = C[C.length - 1], I = w.getShadowValue(O), b = w.getShadowValue(
|
|
402
|
+
[S, ...i].join(".")
|
|
412
403
|
);
|
|
413
|
-
if (!
|
|
414
|
-
|
|
415
|
-
let
|
|
416
|
-
if (
|
|
417
|
-
for (const
|
|
418
|
-
if (
|
|
419
|
-
|
|
404
|
+
if (!O || I === void 0) return;
|
|
405
|
+
V.mapWrappers.forEach((A) => {
|
|
406
|
+
let D = !0, P = -1;
|
|
407
|
+
if (A.meta?.transforms && A.meta.transforms.length > 0) {
|
|
408
|
+
for (const R of A.meta.transforms)
|
|
409
|
+
if (R.type === "filter" && !R.fn(I, -1)) {
|
|
410
|
+
D = !1;
|
|
420
411
|
break;
|
|
421
412
|
}
|
|
422
|
-
if (
|
|
423
|
-
const
|
|
424
|
-
|
|
413
|
+
if (D) {
|
|
414
|
+
const R = yt(
|
|
415
|
+
S,
|
|
425
416
|
i,
|
|
426
|
-
|
|
427
|
-
),
|
|
428
|
-
(
|
|
417
|
+
A.meta.transforms
|
|
418
|
+
), Y = A.meta.transforms.find(
|
|
419
|
+
(L) => L.type === "sort"
|
|
429
420
|
);
|
|
430
|
-
if (
|
|
431
|
-
const
|
|
432
|
-
key:
|
|
433
|
-
value: w.getShadowValue(
|
|
421
|
+
if (Y) {
|
|
422
|
+
const L = R.map((H) => ({
|
|
423
|
+
key: H,
|
|
424
|
+
value: w.getShadowValue(H)
|
|
434
425
|
}));
|
|
435
|
-
|
|
436
|
-
(
|
|
426
|
+
L.push({ key: O, value: I }), L.sort((H, at) => Y.fn(H.value, at.value)), P = L.findIndex(
|
|
427
|
+
(H) => H.key === O
|
|
437
428
|
);
|
|
438
429
|
} else
|
|
439
|
-
|
|
430
|
+
P = R.length;
|
|
440
431
|
}
|
|
441
432
|
} else
|
|
442
|
-
|
|
443
|
-
if (
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
) :
|
|
451
|
-
const
|
|
452
|
-
path:
|
|
453
|
-
currentState:
|
|
454
|
-
componentId:
|
|
455
|
-
meta:
|
|
433
|
+
D = !0, P = C.length - 1;
|
|
434
|
+
if (D && A.containerRef && A.containerRef.isConnected) {
|
|
435
|
+
const R = document.createElement("div");
|
|
436
|
+
R.setAttribute("data-item-path", O);
|
|
437
|
+
const Y = Array.from(A.containerRef.children);
|
|
438
|
+
P >= 0 && P < Y.length ? A.containerRef.insertBefore(
|
|
439
|
+
R,
|
|
440
|
+
Y[P]
|
|
441
|
+
) : A.containerRef.appendChild(R);
|
|
442
|
+
const L = bt(R), H = tt(), at = O.split(".").slice(1), it = A.rebuildStateShape({
|
|
443
|
+
path: A.path,
|
|
444
|
+
currentState: b,
|
|
445
|
+
componentId: A.componentId,
|
|
446
|
+
meta: A.meta
|
|
456
447
|
});
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
stateKey:
|
|
460
|
-
itemComponentId:
|
|
461
|
-
itemPath:
|
|
462
|
-
localIndex:
|
|
463
|
-
arraySetter:
|
|
464
|
-
rebuildStateShape:
|
|
465
|
-
renderFn:
|
|
448
|
+
L.render(
|
|
449
|
+
st(vt, {
|
|
450
|
+
stateKey: S,
|
|
451
|
+
itemComponentId: H,
|
|
452
|
+
itemPath: at,
|
|
453
|
+
localIndex: P,
|
|
454
|
+
arraySetter: it,
|
|
455
|
+
rebuildStateShape: A.rebuildStateShape,
|
|
456
|
+
renderFn: A.mapFn
|
|
466
457
|
})
|
|
467
458
|
);
|
|
468
459
|
}
|
|
469
460
|
});
|
|
470
461
|
}
|
|
471
|
-
if (
|
|
472
|
-
const C = i.slice(0, -1),
|
|
473
|
-
|
|
474
|
-
if (
|
|
475
|
-
const
|
|
476
|
-
`[data-item-path="${
|
|
462
|
+
if (u.updateType === "cut") {
|
|
463
|
+
const C = i.slice(0, -1), O = w.getShadowMetadata(S, C);
|
|
464
|
+
O?.mapWrappers && O.mapWrappers.length > 0 && O.mapWrappers.forEach((I) => {
|
|
465
|
+
if (I.containerRef && I.containerRef.isConnected) {
|
|
466
|
+
const b = I.containerRef.querySelector(
|
|
467
|
+
`[data-item-path="${E}"]`
|
|
477
468
|
);
|
|
478
|
-
|
|
469
|
+
b && b.remove();
|
|
479
470
|
}
|
|
480
471
|
});
|
|
481
472
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
if (s.updateType === "update") {
|
|
473
|
+
const x = w.getShadowMetadata(S, []), B = /* @__PURE__ */ new Set();
|
|
474
|
+
if (x?.components) {
|
|
475
|
+
if (u.updateType === "update") {
|
|
486
476
|
let C = [...i];
|
|
487
477
|
for (; ; ) {
|
|
488
|
-
const
|
|
489
|
-
if (
|
|
490
|
-
if (
|
|
478
|
+
const O = w.getShadowMetadata(S, C);
|
|
479
|
+
if (O?.pathComponents && O.pathComponents.forEach((I) => {
|
|
480
|
+
if (B.has(I))
|
|
491
481
|
return;
|
|
492
|
-
const
|
|
493
|
-
|
|
482
|
+
const b = x.components?.get(I);
|
|
483
|
+
b && ((Array.isArray(b.reactiveType) ? b.reactiveType : [b.reactiveType || "component"]).includes("none") || (b.forceUpdate(), B.add(I)));
|
|
494
484
|
}), C.length === 0)
|
|
495
485
|
break;
|
|
496
486
|
C.pop();
|
|
497
487
|
}
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
if (
|
|
488
|
+
_ && typeof _ == "object" && !wt(_) && M && typeof M == "object" && !wt(M) && Et(_, M).forEach((I) => {
|
|
489
|
+
const b = I.split("."), A = [...i, ...b], D = w.getShadowMetadata(S, A);
|
|
490
|
+
D?.pathComponents && D.pathComponents.forEach((P) => {
|
|
491
|
+
if (B.has(P))
|
|
502
492
|
return;
|
|
503
|
-
const
|
|
504
|
-
|
|
493
|
+
const R = x.components?.get(P);
|
|
494
|
+
R && ((Array.isArray(R.reactiveType) ? R.reactiveType : [R.reactiveType || "component"]).includes("none") || (R.forceUpdate(), B.add(P)));
|
|
505
495
|
});
|
|
506
496
|
});
|
|
507
|
-
} else if (
|
|
508
|
-
const C =
|
|
509
|
-
if (
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
`[data-parent-id="${
|
|
497
|
+
} else if (u.updateType === "insert" || u.updateType === "cut") {
|
|
498
|
+
const C = u.updateType === "insert" ? i : i.slice(0, -1), O = w.getShadowMetadata(S, C);
|
|
499
|
+
if (O?.signals && O.signals.length > 0) {
|
|
500
|
+
const I = [S, ...C].join("."), b = w.getShadowValue(I);
|
|
501
|
+
O.signals.forEach(({ parentId: A, position: D, effect: P }) => {
|
|
502
|
+
const R = document.querySelector(
|
|
503
|
+
`[data-parent-id="${A}"]`
|
|
514
504
|
);
|
|
515
|
-
if (
|
|
516
|
-
const
|
|
517
|
-
if (
|
|
518
|
-
let
|
|
519
|
-
if (
|
|
505
|
+
if (R) {
|
|
506
|
+
const Y = Array.from(R.childNodes);
|
|
507
|
+
if (Y[D]) {
|
|
508
|
+
let L = b;
|
|
509
|
+
if (P)
|
|
520
510
|
try {
|
|
521
|
-
|
|
511
|
+
L = new Function(
|
|
522
512
|
"state",
|
|
523
|
-
`return (${
|
|
524
|
-
)(
|
|
525
|
-
} catch (
|
|
526
|
-
console.error("Error evaluating effect function:",
|
|
513
|
+
`return (${P})(state)`
|
|
514
|
+
)(b);
|
|
515
|
+
} catch (H) {
|
|
516
|
+
console.error("Error evaluating effect function:", H), L = b;
|
|
527
517
|
}
|
|
528
|
-
|
|
518
|
+
L != null && typeof L == "object" && (L = JSON.stringify(L)), Y[D].textContent = String(L ?? "");
|
|
529
519
|
}
|
|
530
520
|
}
|
|
531
521
|
});
|
|
532
522
|
}
|
|
533
|
-
|
|
534
|
-
if (!
|
|
535
|
-
const
|
|
536
|
-
|
|
523
|
+
O?.pathComponents && O.pathComponents.forEach((I) => {
|
|
524
|
+
if (!B.has(I)) {
|
|
525
|
+
const b = x.components?.get(I);
|
|
526
|
+
b && (b.forceUpdate(), B.add(I));
|
|
537
527
|
}
|
|
538
528
|
});
|
|
539
529
|
}
|
|
540
|
-
|
|
541
|
-
if (
|
|
530
|
+
x.components.forEach((C, O) => {
|
|
531
|
+
if (B.has(O))
|
|
542
532
|
return;
|
|
543
|
-
const
|
|
544
|
-
if (
|
|
545
|
-
C.forceUpdate(),
|
|
533
|
+
const I = Array.isArray(C.reactiveType) ? C.reactiveType : [C.reactiveType || "component"];
|
|
534
|
+
if (I.includes("all")) {
|
|
535
|
+
C.forceUpdate(), B.add(O);
|
|
546
536
|
return;
|
|
547
537
|
}
|
|
548
|
-
if (
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
|
|
538
|
+
if (I.includes("deps") && C.depsFunction) {
|
|
539
|
+
const b = w.getShadowValue(S), A = C.depsFunction(b);
|
|
540
|
+
let D = !1;
|
|
541
|
+
A === !0 ? D = !0 : Array.isArray(A) && (nt(C.prevDeps, A) || (C.prevDeps = A, D = !0)), D && (C.forceUpdate(), B.add(O));
|
|
552
542
|
}
|
|
553
|
-
}),
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
),
|
|
559
|
-
update:
|
|
560
|
-
})
|
|
543
|
+
}), B.clear(), Ft(S, $), jt(
|
|
544
|
+
_,
|
|
545
|
+
S,
|
|
546
|
+
d.current,
|
|
547
|
+
N
|
|
548
|
+
), d.current?.middleware && d.current.middleware({
|
|
549
|
+
update: $
|
|
550
|
+
});
|
|
561
551
|
}
|
|
562
552
|
};
|
|
563
|
-
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
return o && (J.current = o(
|
|
575
|
-
r,
|
|
576
|
-
d ?? {}
|
|
577
|
-
)), r;
|
|
553
|
+
a.getState().initialStateGlobal[S] || _t(S, t);
|
|
554
|
+
const o = dt(() => Ct(
|
|
555
|
+
S,
|
|
556
|
+
n,
|
|
557
|
+
Q.current,
|
|
558
|
+
N
|
|
559
|
+
), [S, N]), c = F, f = d.current?.syncOptions;
|
|
560
|
+
return c && (J.current = c(
|
|
561
|
+
o,
|
|
562
|
+
f ?? {}
|
|
563
|
+
)), o;
|
|
578
564
|
}
|
|
579
|
-
function
|
|
580
|
-
return !
|
|
581
|
-
(
|
|
565
|
+
function Ht(t) {
|
|
566
|
+
return !t || t.length === 0 ? "" : t.map(
|
|
567
|
+
(r) => `${r.type}${JSON.stringify(r.dependencies || [])}`
|
|
582
568
|
).join("");
|
|
583
569
|
}
|
|
584
|
-
const
|
|
585
|
-
let m =
|
|
570
|
+
const yt = (t, r, y) => {
|
|
571
|
+
let m = a.getState().getShadowMetadata(t, r)?.arrayKeys || [];
|
|
586
572
|
if (!y || y.length === 0)
|
|
587
573
|
return m;
|
|
588
|
-
let v = m.map((
|
|
589
|
-
key:
|
|
590
|
-
value:
|
|
574
|
+
let v = m.map((g) => ({
|
|
575
|
+
key: g,
|
|
576
|
+
value: a.getState().getShadowValue(g)
|
|
591
577
|
}));
|
|
592
|
-
for (const
|
|
593
|
-
|
|
594
|
-
({ value:
|
|
595
|
-
) :
|
|
596
|
-
return v.map(({ key:
|
|
597
|
-
},
|
|
598
|
-
const m = `${
|
|
599
|
-
!
|
|
600
|
-
},
|
|
601
|
-
const m =
|
|
602
|
-
v?.components && v.components.forEach((
|
|
603
|
-
(Array.isArray(
|
|
604
|
-
}), m.getShadowMetadata(
|
|
605
|
-
v?.components?.get(
|
|
578
|
+
for (const g of y)
|
|
579
|
+
g.type === "filter" ? v = v.filter(
|
|
580
|
+
({ value: T }, h) => g.fn(T, h)
|
|
581
|
+
) : g.type === "sort" && v.sort((T, h) => g.fn(T.value, h.value));
|
|
582
|
+
return v.map(({ key: g }) => g);
|
|
583
|
+
}, Mt = (t, r, y) => {
|
|
584
|
+
const m = `${t}////${r}`, { addPathComponent: v, getShadowMetadata: g } = a.getState(), h = g(t, [])?.components?.get(m);
|
|
585
|
+
!h || h.reactiveType === "none" || !(Array.isArray(h.reactiveType) ? h.reactiveType : [h.reactiveType]).includes("component") || v(t, y, m);
|
|
586
|
+
}, ut = (t, r, y) => {
|
|
587
|
+
const m = a.getState(), v = m.getShadowMetadata(t, []), g = /* @__PURE__ */ new Set();
|
|
588
|
+
v?.components && v.components.forEach((h, e) => {
|
|
589
|
+
(Array.isArray(h.reactiveType) ? h.reactiveType : [h.reactiveType || "component"]).includes("all") && (h.forceUpdate(), g.add(e));
|
|
590
|
+
}), m.getShadowMetadata(t, [...r, "getSelected"])?.pathComponents?.forEach((h) => {
|
|
591
|
+
v?.components?.get(h)?.forceUpdate();
|
|
606
592
|
});
|
|
607
|
-
const
|
|
608
|
-
for (let
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
|
|
593
|
+
const T = m.getShadowMetadata(t, r);
|
|
594
|
+
for (let h of T?.arrayKeys || []) {
|
|
595
|
+
const e = h + ".selected", s = m.getShadowMetadata(
|
|
596
|
+
t,
|
|
597
|
+
e.split(".").slice(1)
|
|
612
598
|
);
|
|
613
|
-
|
|
614
|
-
v?.components?.get(
|
|
599
|
+
h == y && s?.pathComponents?.forEach((p) => {
|
|
600
|
+
v?.components?.get(p)?.forceUpdate();
|
|
615
601
|
});
|
|
616
602
|
}
|
|
617
603
|
};
|
|
618
|
-
function
|
|
604
|
+
function Ct(t, r, y, m) {
|
|
619
605
|
const v = /* @__PURE__ */ new Map();
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
meta: l,
|
|
625
|
-
componentId: V
|
|
606
|
+
function g({
|
|
607
|
+
path: e = [],
|
|
608
|
+
meta: s,
|
|
609
|
+
componentId: p
|
|
626
610
|
}) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
if (Object.getOwnPropertyNames(S).includes(g) && n.length === 0)
|
|
640
|
-
return S[g];
|
|
641
|
-
if (g === "getDifferences")
|
|
611
|
+
const F = s ? JSON.stringify(s.validIds || s.transforms) : "", j = e.join(".") + ":" + F;
|
|
612
|
+
if (console.log("PROXY CACHE KEY ", j), v.has(j))
|
|
613
|
+
return console.log("PROXY CACHE HIT"), v.get(j);
|
|
614
|
+
const k = [t, ...e].join("."), N = function() {
|
|
615
|
+
return a().getShadowValue(t, e);
|
|
616
|
+
}, G = {
|
|
617
|
+
get(Q, d) {
|
|
618
|
+
if (d === "_rebuildStateShape")
|
|
619
|
+
return g;
|
|
620
|
+
if (Object.getOwnPropertyNames(T).includes(d) && e.length === 0)
|
|
621
|
+
return T[d];
|
|
622
|
+
if (d === "getDifferences")
|
|
642
623
|
return () => {
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
return
|
|
624
|
+
const n = a.getState().getShadowMetadata(t, []), o = a.getState().getShadowValue(t);
|
|
625
|
+
let c;
|
|
626
|
+
return n?.stateSource === "server" && n.baseServerState ? c = n.baseServerState : c = a.getState().initialStateGlobal[t], Et(o, c);
|
|
646
627
|
};
|
|
647
|
-
if (
|
|
628
|
+
if (d === "sync" && e.length === 0)
|
|
648
629
|
return async function() {
|
|
649
|
-
const
|
|
630
|
+
const n = a.getState().getInitialOptions(t), o = n?.sync;
|
|
650
631
|
if (!o)
|
|
651
|
-
return console.error(`No mutation defined for state key "${
|
|
652
|
-
const
|
|
632
|
+
return console.error(`No mutation defined for state key "${t}"`), { success: !1, error: "No mutation defined" };
|
|
633
|
+
const c = a.getState().getShadowValue(t, []), f = n?.validation?.key;
|
|
653
634
|
try {
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
...
|
|
635
|
+
const l = await o.action(c);
|
|
636
|
+
if (l && !l.success && l.errors, l?.success) {
|
|
637
|
+
const i = a.getState().getShadowMetadata(t, []);
|
|
638
|
+
a.getState().setShadowMetadata(t, [], {
|
|
639
|
+
...i,
|
|
659
640
|
isDirty: !1,
|
|
660
641
|
lastServerSync: Date.now(),
|
|
661
642
|
stateSource: "server",
|
|
662
|
-
baseServerState:
|
|
643
|
+
baseServerState: c
|
|
663
644
|
// Update base server state
|
|
664
|
-
}), o.onSuccess && o.onSuccess(
|
|
665
|
-
} else !
|
|
666
|
-
return
|
|
667
|
-
} catch (
|
|
668
|
-
return o.onError && o.onError(
|
|
645
|
+
}), o.onSuccess && o.onSuccess(l.data);
|
|
646
|
+
} else !l?.success && o.onError && o.onError(l.error);
|
|
647
|
+
return l;
|
|
648
|
+
} catch (l) {
|
|
649
|
+
return o.onError && o.onError(l), { success: !1, error: l };
|
|
669
650
|
}
|
|
670
651
|
};
|
|
671
|
-
if (
|
|
672
|
-
const
|
|
673
|
-
const o =
|
|
674
|
-
return o?.isDirty === !0 ? "dirty" : o?.isDirty === !1 || o?.stateSource === "server" ? "synced" : o?.stateSource === "localStorage" ? "restored" : o?.stateSource === "default" ? "fresh" :
|
|
652
|
+
if (d === "_status" || d === "getStatus") {
|
|
653
|
+
const n = () => {
|
|
654
|
+
const o = a.getState().getShadowMetadata(t, e), c = a.getState().getShadowValue(k);
|
|
655
|
+
return o?.isDirty === !0 ? "dirty" : o?.isDirty === !1 || o?.stateSource === "server" ? "synced" : o?.stateSource === "localStorage" ? "restored" : o?.stateSource === "default" ? "fresh" : a.getState().getShadowMetadata(t, [])?.stateSource === "server" && !o?.isDirty ? "synced" : c !== void 0 && !o ? "fresh" : "unknown";
|
|
675
656
|
};
|
|
676
|
-
return
|
|
657
|
+
return d === "_status" ? n() : n;
|
|
677
658
|
}
|
|
678
|
-
if (
|
|
659
|
+
if (d === "removeStorage")
|
|
679
660
|
return () => {
|
|
680
|
-
const
|
|
681
|
-
|
|
661
|
+
const n = a.getState().initialStateGlobal[t], o = et(t), c = K(o?.localStorage?.key) ? o.localStorage.key(n) : o?.localStorage?.key, f = `${m}-${t}-${c}`;
|
|
662
|
+
f && localStorage.removeItem(f);
|
|
682
663
|
};
|
|
683
|
-
if (
|
|
664
|
+
if (d === "showValidationErrors")
|
|
684
665
|
return () => {
|
|
685
|
-
const
|
|
686
|
-
return
|
|
666
|
+
const n = a.getState().getShadowMetadata(t, e);
|
|
667
|
+
return n?.validation?.status === "VALIDATION_FAILED" && n.validation.message ? [n.validation.message] : [];
|
|
687
668
|
};
|
|
688
|
-
if (
|
|
669
|
+
if (d === "getSelected")
|
|
689
670
|
return () => {
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
...
|
|
671
|
+
const n = t + "." + e.join(".");
|
|
672
|
+
Mt(t, p, [
|
|
673
|
+
...e,
|
|
693
674
|
"getSelected"
|
|
694
675
|
]);
|
|
695
|
-
const o =
|
|
696
|
-
if (!o || !o.has(
|
|
676
|
+
const o = a.getState().selectedIndicesMap;
|
|
677
|
+
if (!o || !o.has(n))
|
|
697
678
|
return;
|
|
698
|
-
const
|
|
699
|
-
if (!(
|
|
700
|
-
return
|
|
701
|
-
path:
|
|
702
|
-
componentId:
|
|
679
|
+
const c = o.get(n);
|
|
680
|
+
if (!(s?.validIds && !s.validIds.includes(c) || !a.getState().getShadowValue(c)))
|
|
681
|
+
return g({
|
|
682
|
+
path: c.split(".").slice(1),
|
|
683
|
+
componentId: p
|
|
703
684
|
});
|
|
704
685
|
};
|
|
705
|
-
if (
|
|
706
|
-
return () =>
|
|
707
|
-
|
|
708
|
-
|
|
686
|
+
if (d === "getSelectedIndex")
|
|
687
|
+
return () => a.getState().getSelectedIndex(
|
|
688
|
+
t + "." + e.join("."),
|
|
689
|
+
s?.validIds
|
|
709
690
|
);
|
|
710
|
-
if (
|
|
711
|
-
return
|
|
712
|
-
|
|
713
|
-
arrayKey:
|
|
691
|
+
if (d === "clearSelected")
|
|
692
|
+
return ut(t, e), () => {
|
|
693
|
+
a.getState().clearSelectedIndex({
|
|
694
|
+
arrayKey: t + "." + e.join(".")
|
|
714
695
|
});
|
|
715
696
|
};
|
|
716
|
-
if (
|
|
717
|
-
return (
|
|
697
|
+
if (d === "useVirtualView")
|
|
698
|
+
return (n) => {
|
|
718
699
|
const {
|
|
719
700
|
itemHeight: o = 50,
|
|
720
|
-
overscan:
|
|
721
|
-
stickToBottom:
|
|
722
|
-
scrollStickTolerance:
|
|
723
|
-
} =
|
|
701
|
+
overscan: c = 6,
|
|
702
|
+
stickToBottom: f = !1,
|
|
703
|
+
scrollStickTolerance: l = 75
|
|
704
|
+
} = n, i = q(null), [u, E] = X({
|
|
724
705
|
startIndex: 0,
|
|
725
706
|
endIndex: 10
|
|
726
|
-
}), [
|
|
707
|
+
}), [w, V] = X({}), M = q(!0), _ = q({
|
|
727
708
|
isUserScrolling: !1,
|
|
728
709
|
lastScrollTop: 0,
|
|
729
710
|
scrollUpCount: 0,
|
|
730
711
|
isNearBottom: !0
|
|
731
|
-
}),
|
|
712
|
+
}), U = q(
|
|
732
713
|
/* @__PURE__ */ new Map()
|
|
733
714
|
);
|
|
734
|
-
|
|
735
|
-
if (!
|
|
715
|
+
lt(() => {
|
|
716
|
+
if (!f || !i.current || _.current.isUserScrolling)
|
|
736
717
|
return;
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
top:
|
|
740
|
-
behavior:
|
|
718
|
+
const I = i.current;
|
|
719
|
+
I.scrollTo({
|
|
720
|
+
top: I.scrollHeight,
|
|
721
|
+
behavior: M.current ? "instant" : "smooth"
|
|
741
722
|
});
|
|
742
|
-
}, [
|
|
743
|
-
const
|
|
744
|
-
let
|
|
745
|
-
const
|
|
746
|
-
return (
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
height:
|
|
750
|
-
offset:
|
|
751
|
-
}),
|
|
752
|
-
}),
|
|
753
|
-
}, [
|
|
754
|
-
|
|
755
|
-
if (
|
|
756
|
-
const
|
|
757
|
-
if (
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
), D =
|
|
723
|
+
}, [w, f]);
|
|
724
|
+
const $ = a.getState().getShadowMetadata(t, e)?.arrayKeys || [], { totalHeight: z, itemOffsets: x } = dt(() => {
|
|
725
|
+
let I = 0;
|
|
726
|
+
const b = /* @__PURE__ */ new Map();
|
|
727
|
+
return (a.getState().getShadowMetadata(t, e)?.arrayKeys || []).forEach((D) => {
|
|
728
|
+
const P = D.split(".").slice(1), R = a.getState().getShadowMetadata(t, P)?.virtualizer?.itemHeight || o;
|
|
729
|
+
b.set(D, {
|
|
730
|
+
height: R,
|
|
731
|
+
offset: I
|
|
732
|
+
}), I += R;
|
|
733
|
+
}), U.current = b, { totalHeight: I, itemOffsets: b };
|
|
734
|
+
}, [$.length, o]);
|
|
735
|
+
lt(() => {
|
|
736
|
+
if (f && $.length > 0 && i.current && !_.current.isUserScrolling && M.current) {
|
|
737
|
+
const I = i.current, b = () => {
|
|
738
|
+
if (I.clientHeight > 0) {
|
|
739
|
+
const A = Math.ceil(
|
|
740
|
+
I.clientHeight / o
|
|
741
|
+
), D = $.length - 1, P = Math.max(
|
|
761
742
|
0,
|
|
762
|
-
D -
|
|
743
|
+
D - A - c
|
|
763
744
|
);
|
|
764
|
-
|
|
765
|
-
|
|
745
|
+
E({ startIndex: P, endIndex: D }), requestAnimationFrame(() => {
|
|
746
|
+
C("instant"), M.current = !1;
|
|
766
747
|
});
|
|
767
748
|
} else
|
|
768
|
-
requestAnimationFrame(
|
|
749
|
+
requestAnimationFrame(b);
|
|
769
750
|
};
|
|
770
|
-
|
|
751
|
+
b();
|
|
771
752
|
}
|
|
772
|
-
}, [
|
|
773
|
-
const
|
|
774
|
-
const
|
|
775
|
-
if (!
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
let
|
|
779
|
-
for (let
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
782
|
-
|
|
753
|
+
}, [$.length, f, o, c]);
|
|
754
|
+
const B = ot(() => {
|
|
755
|
+
const I = i.current;
|
|
756
|
+
if (!I) return;
|
|
757
|
+
const b = I.scrollTop, { scrollHeight: A, clientHeight: D } = I, P = _.current, R = A - (b + D), Y = P.isNearBottom;
|
|
758
|
+
P.isNearBottom = R <= l, b < P.lastScrollTop ? (P.scrollUpCount++, P.scrollUpCount > 3 && Y && (P.isUserScrolling = !0, console.log("User scrolled away from bottom"))) : P.isNearBottom && (P.isUserScrolling = !1, P.scrollUpCount = 0), P.lastScrollTop = b;
|
|
759
|
+
let L = 0;
|
|
760
|
+
for (let H = 0; H < $.length; H++) {
|
|
761
|
+
const at = $[H], it = U.current.get(at);
|
|
762
|
+
if (it && it.offset + it.height > b) {
|
|
763
|
+
L = H;
|
|
783
764
|
break;
|
|
784
765
|
}
|
|
785
766
|
}
|
|
786
|
-
if (
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
startIndex: Math.max(0,
|
|
767
|
+
if (L !== u.startIndex) {
|
|
768
|
+
const H = Math.ceil(D / o);
|
|
769
|
+
E({
|
|
770
|
+
startIndex: Math.max(0, L - c),
|
|
790
771
|
endIndex: Math.min(
|
|
791
|
-
|
|
792
|
-
|
|
772
|
+
$.length - 1,
|
|
773
|
+
L + H + c
|
|
793
774
|
)
|
|
794
775
|
});
|
|
795
776
|
}
|
|
796
777
|
}, [
|
|
797
|
-
|
|
798
|
-
|
|
778
|
+
$.length,
|
|
779
|
+
u.startIndex,
|
|
799
780
|
o,
|
|
800
|
-
|
|
801
|
-
|
|
781
|
+
c,
|
|
782
|
+
l
|
|
802
783
|
]);
|
|
803
784
|
Z(() => {
|
|
804
|
-
const
|
|
805
|
-
if (!(!
|
|
806
|
-
return
|
|
785
|
+
const I = i.current;
|
|
786
|
+
if (!(!I || !f))
|
|
787
|
+
return I.addEventListener("scroll", B, {
|
|
807
788
|
passive: !0
|
|
808
789
|
}), () => {
|
|
809
|
-
|
|
790
|
+
I.removeEventListener("scroll", B);
|
|
810
791
|
};
|
|
811
|
-
}, [
|
|
812
|
-
const
|
|
813
|
-
(
|
|
814
|
-
const
|
|
815
|
-
if (!
|
|
816
|
-
|
|
817
|
-
const
|
|
818
|
-
const D = (
|
|
819
|
-
if (
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
top:
|
|
823
|
-
behavior:
|
|
792
|
+
}, [B, f]);
|
|
793
|
+
const C = ot(
|
|
794
|
+
(I = "smooth") => {
|
|
795
|
+
const b = i.current;
|
|
796
|
+
if (!b) return;
|
|
797
|
+
_.current.isUserScrolling = !1, _.current.isNearBottom = !0, _.current.scrollUpCount = 0;
|
|
798
|
+
const A = () => {
|
|
799
|
+
const D = (P = 0) => {
|
|
800
|
+
if (P > 5) return;
|
|
801
|
+
const R = b.scrollHeight, Y = b.scrollTop, L = b.clientHeight;
|
|
802
|
+
Y + L >= R - 1 || (b.scrollTo({
|
|
803
|
+
top: R,
|
|
804
|
+
behavior: I
|
|
824
805
|
}), setTimeout(() => {
|
|
825
|
-
const
|
|
826
|
-
(
|
|
806
|
+
const H = b.scrollHeight, at = b.scrollTop;
|
|
807
|
+
(H !== R || at + L < H - 1) && D(P + 1);
|
|
827
808
|
}, 50));
|
|
828
809
|
};
|
|
829
810
|
D();
|
|
830
811
|
};
|
|
831
|
-
"requestIdleCallback" in window ? requestIdleCallback(
|
|
832
|
-
requestAnimationFrame(
|
|
812
|
+
"requestIdleCallback" in window ? requestIdleCallback(A, { timeout: 100 }) : requestAnimationFrame(() => {
|
|
813
|
+
requestAnimationFrame(A);
|
|
833
814
|
});
|
|
834
815
|
},
|
|
835
816
|
[]
|
|
836
817
|
);
|
|
837
818
|
return Z(() => {
|
|
838
|
-
if (!
|
|
839
|
-
const
|
|
840
|
-
let
|
|
819
|
+
if (!f || !i.current) return;
|
|
820
|
+
const I = i.current, b = _.current;
|
|
821
|
+
let A;
|
|
841
822
|
const D = () => {
|
|
842
|
-
clearTimeout(
|
|
843
|
-
!
|
|
844
|
-
|
|
823
|
+
clearTimeout(A), A = setTimeout(() => {
|
|
824
|
+
!b.isUserScrolling && b.isNearBottom && C(
|
|
825
|
+
M.current ? "instant" : "smooth"
|
|
845
826
|
);
|
|
846
827
|
}, 100);
|
|
847
|
-
},
|
|
848
|
-
|
|
828
|
+
}, P = new MutationObserver(() => {
|
|
829
|
+
b.isUserScrolling || D();
|
|
849
830
|
});
|
|
850
|
-
|
|
831
|
+
P.observe(I, {
|
|
851
832
|
childList: !0,
|
|
852
833
|
subtree: !0,
|
|
853
834
|
attributes: !0,
|
|
854
835
|
attributeFilter: ["style", "class"]
|
|
855
836
|
// More specific than just 'height'
|
|
856
837
|
});
|
|
857
|
-
const
|
|
858
|
-
|
|
838
|
+
const R = (Y) => {
|
|
839
|
+
Y.target instanceof HTMLImageElement && !b.isUserScrolling && D();
|
|
859
840
|
};
|
|
860
|
-
return
|
|
861
|
-
|
|
841
|
+
return I.addEventListener("load", R, !0), M.current ? setTimeout(() => {
|
|
842
|
+
C("instant");
|
|
862
843
|
}, 0) : D(), () => {
|
|
863
|
-
clearTimeout(
|
|
844
|
+
clearTimeout(A), P.disconnect(), I.removeEventListener("load", R, !0);
|
|
864
845
|
};
|
|
865
|
-
}, [
|
|
866
|
-
virtualState:
|
|
867
|
-
const
|
|
868
|
-
[
|
|
869
|
-
),
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
846
|
+
}, [f, $.length, C]), {
|
|
847
|
+
virtualState: dt(() => {
|
|
848
|
+
const I = a.getState(), b = I.getShadowValue(
|
|
849
|
+
[t, ...e].join(".")
|
|
850
|
+
), A = I.getShadowMetadata(t, e)?.arrayKeys || [];
|
|
851
|
+
b.slice(
|
|
852
|
+
u.startIndex,
|
|
853
|
+
u.endIndex + 1
|
|
873
854
|
);
|
|
874
|
-
const D =
|
|
875
|
-
|
|
876
|
-
|
|
855
|
+
const D = A.slice(
|
|
856
|
+
u.startIndex,
|
|
857
|
+
u.endIndex + 1
|
|
877
858
|
);
|
|
878
|
-
return
|
|
879
|
-
path:
|
|
880
|
-
componentId:
|
|
881
|
-
meta: { ...
|
|
859
|
+
return g({
|
|
860
|
+
path: e,
|
|
861
|
+
componentId: p,
|
|
862
|
+
meta: { ...s, validIds: D }
|
|
882
863
|
});
|
|
883
|
-
}, [
|
|
864
|
+
}, [u.startIndex, u.endIndex, $.length]),
|
|
884
865
|
virtualizerProps: {
|
|
885
866
|
outer: {
|
|
886
|
-
ref:
|
|
867
|
+
ref: i,
|
|
887
868
|
style: {
|
|
888
869
|
overflowY: "auto",
|
|
889
870
|
height: "100%",
|
|
@@ -892,1019 +873,1018 @@ function Pe(e, a, y, m) {
|
|
|
892
873
|
},
|
|
893
874
|
inner: {
|
|
894
875
|
style: {
|
|
895
|
-
height: `${
|
|
876
|
+
height: `${z}px`,
|
|
896
877
|
position: "relative"
|
|
897
878
|
}
|
|
898
879
|
},
|
|
899
880
|
list: {
|
|
900
881
|
style: {
|
|
901
|
-
transform: `translateY(${
|
|
882
|
+
transform: `translateY(${U.current.get($[u.startIndex])?.offset || 0}px)`
|
|
902
883
|
}
|
|
903
884
|
}
|
|
904
885
|
},
|
|
905
|
-
scrollToBottom:
|
|
906
|
-
scrollToIndex: (
|
|
907
|
-
if (
|
|
908
|
-
const
|
|
909
|
-
|
|
886
|
+
scrollToBottom: C,
|
|
887
|
+
scrollToIndex: (I, b = "smooth") => {
|
|
888
|
+
if (i.current && $[I]) {
|
|
889
|
+
const A = U.current.get($[I])?.offset || 0;
|
|
890
|
+
i.current.scrollTo({ top: A, behavior: b });
|
|
910
891
|
}
|
|
911
892
|
}
|
|
912
893
|
};
|
|
913
894
|
};
|
|
914
|
-
if (
|
|
915
|
-
return (
|
|
916
|
-
const [o,
|
|
917
|
-
|
|
918
|
-
),
|
|
895
|
+
if (d === "stateMap")
|
|
896
|
+
return (n) => {
|
|
897
|
+
const [o, c] = X(
|
|
898
|
+
s?.validIds ?? a.getState().getShadowMetadata(t, e)?.arrayKeys
|
|
899
|
+
), f = a.getState().getShadowValue(k, s?.validIds);
|
|
919
900
|
if (!o)
|
|
920
901
|
throw new Error("No array keys found for mapping");
|
|
921
|
-
const
|
|
922
|
-
path:
|
|
923
|
-
componentId:
|
|
924
|
-
meta:
|
|
902
|
+
const l = g({
|
|
903
|
+
path: e,
|
|
904
|
+
componentId: p,
|
|
905
|
+
meta: s
|
|
925
906
|
});
|
|
926
|
-
return
|
|
927
|
-
const
|
|
928
|
-
path:
|
|
929
|
-
componentId:
|
|
930
|
-
meta:
|
|
907
|
+
return f.map((i, u) => {
|
|
908
|
+
const E = o[u]?.split(".").slice(1), w = g({
|
|
909
|
+
path: E,
|
|
910
|
+
componentId: p,
|
|
911
|
+
meta: s
|
|
931
912
|
});
|
|
932
|
-
return
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
913
|
+
return n(
|
|
914
|
+
w,
|
|
915
|
+
u,
|
|
916
|
+
l
|
|
936
917
|
);
|
|
937
918
|
});
|
|
938
919
|
};
|
|
939
|
-
if (
|
|
940
|
-
return (
|
|
920
|
+
if (d === "$stateMap")
|
|
921
|
+
return (n) => st(xt, {
|
|
941
922
|
proxy: {
|
|
942
|
-
_stateKey:
|
|
943
|
-
_path:
|
|
944
|
-
_mapFn:
|
|
945
|
-
_meta:
|
|
923
|
+
_stateKey: t,
|
|
924
|
+
_path: e,
|
|
925
|
+
_mapFn: n,
|
|
926
|
+
_meta: s
|
|
946
927
|
},
|
|
947
|
-
rebuildStateShape:
|
|
928
|
+
rebuildStateShape: g
|
|
948
929
|
});
|
|
949
|
-
if (
|
|
950
|
-
return (
|
|
951
|
-
const o =
|
|
930
|
+
if (d === "stateFind")
|
|
931
|
+
return (n) => {
|
|
932
|
+
const o = s?.validIds ?? a.getState().getShadowMetadata(t, e)?.arrayKeys;
|
|
952
933
|
if (o)
|
|
953
|
-
for (let
|
|
954
|
-
const
|
|
955
|
-
if (!
|
|
956
|
-
const
|
|
957
|
-
if (
|
|
958
|
-
const
|
|
959
|
-
return
|
|
960
|
-
path:
|
|
961
|
-
componentId:
|
|
962
|
-
meta:
|
|
934
|
+
for (let c = 0; c < o.length; c++) {
|
|
935
|
+
const f = o[c];
|
|
936
|
+
if (!f) continue;
|
|
937
|
+
const l = a.getState().getShadowValue(f);
|
|
938
|
+
if (n(l, c)) {
|
|
939
|
+
const i = f.split(".").slice(1);
|
|
940
|
+
return g({
|
|
941
|
+
path: i,
|
|
942
|
+
componentId: p,
|
|
943
|
+
meta: s
|
|
963
944
|
// Pass along meta for potential further chaining
|
|
964
945
|
});
|
|
965
946
|
}
|
|
966
947
|
}
|
|
967
948
|
};
|
|
968
|
-
if (
|
|
969
|
-
return (
|
|
970
|
-
const o =
|
|
949
|
+
if (d === "stateFilter")
|
|
950
|
+
return (n) => {
|
|
951
|
+
const o = a.getState().getShadowValue([t, ...e].join("."), s?.validIds);
|
|
971
952
|
if (!Array.isArray(o)) return [];
|
|
972
|
-
const
|
|
973
|
-
if (!
|
|
953
|
+
const c = s?.validIds ?? a.getState().getShadowMetadata(t, e)?.arrayKeys;
|
|
954
|
+
if (!c)
|
|
974
955
|
throw new Error("No array keys found for filtering.");
|
|
975
|
-
const
|
|
956
|
+
const f = [];
|
|
976
957
|
return o.filter(
|
|
977
|
-
(
|
|
978
|
-
),
|
|
979
|
-
path:
|
|
980
|
-
componentId:
|
|
958
|
+
(l, i) => n(l, i) ? (f.push(c[i]), !0) : !1
|
|
959
|
+
), g({
|
|
960
|
+
path: e,
|
|
961
|
+
componentId: p,
|
|
981
962
|
meta: {
|
|
982
|
-
validIds:
|
|
963
|
+
validIds: f,
|
|
983
964
|
transforms: [
|
|
984
|
-
...
|
|
965
|
+
...s?.transforms || [],
|
|
985
966
|
{
|
|
986
967
|
type: "filter",
|
|
987
|
-
fn:
|
|
968
|
+
fn: n
|
|
988
969
|
}
|
|
989
970
|
]
|
|
990
971
|
}
|
|
991
972
|
});
|
|
992
973
|
};
|
|
993
|
-
if (
|
|
994
|
-
return (
|
|
995
|
-
const o =
|
|
974
|
+
if (d === "stateSort")
|
|
975
|
+
return (n) => {
|
|
976
|
+
const o = a.getState().getShadowValue([t, ...e].join("."), s?.validIds);
|
|
996
977
|
if (!Array.isArray(o)) return [];
|
|
997
|
-
const
|
|
998
|
-
if (!
|
|
978
|
+
const c = s?.validIds ?? a.getState().getShadowMetadata(t, e)?.arrayKeys;
|
|
979
|
+
if (!c)
|
|
999
980
|
throw new Error("No array keys found for sorting");
|
|
1000
|
-
const
|
|
1001
|
-
item:
|
|
1002
|
-
key:
|
|
981
|
+
const f = o.map((l, i) => ({
|
|
982
|
+
item: l,
|
|
983
|
+
key: c[i]
|
|
1003
984
|
}));
|
|
1004
|
-
return
|
|
1005
|
-
path:
|
|
1006
|
-
componentId:
|
|
985
|
+
return f.sort((l, i) => n(l.item, i.item)).filter(Boolean), g({
|
|
986
|
+
path: e,
|
|
987
|
+
componentId: p,
|
|
1007
988
|
meta: {
|
|
1008
|
-
validIds:
|
|
989
|
+
validIds: f.map((l) => l.key),
|
|
1009
990
|
transforms: [
|
|
1010
|
-
...
|
|
1011
|
-
{ type: "sort", fn:
|
|
991
|
+
...s?.transforms || [],
|
|
992
|
+
{ type: "sort", fn: n }
|
|
1012
993
|
]
|
|
1013
994
|
}
|
|
1014
995
|
});
|
|
1015
996
|
};
|
|
1016
|
-
if (
|
|
1017
|
-
return function(
|
|
997
|
+
if (d === "stream")
|
|
998
|
+
return function(n = {}) {
|
|
1018
999
|
const {
|
|
1019
1000
|
bufferSize: o = 100,
|
|
1020
|
-
flushInterval:
|
|
1021
|
-
bufferStrategy:
|
|
1022
|
-
store:
|
|
1023
|
-
onFlush:
|
|
1024
|
-
} =
|
|
1025
|
-
let
|
|
1026
|
-
const
|
|
1027
|
-
if (!
|
|
1028
|
-
if (
|
|
1029
|
-
|
|
1030
|
-
else if (
|
|
1001
|
+
flushInterval: c = 100,
|
|
1002
|
+
bufferStrategy: f = "accumulate",
|
|
1003
|
+
store: l,
|
|
1004
|
+
onFlush: i
|
|
1005
|
+
} = n;
|
|
1006
|
+
let u = [], E = !1, w = null;
|
|
1007
|
+
const V = (z) => {
|
|
1008
|
+
if (!E) {
|
|
1009
|
+
if (f === "sliding" && u.length >= o)
|
|
1010
|
+
u.shift();
|
|
1011
|
+
else if (f === "dropping" && u.length >= o)
|
|
1031
1012
|
return;
|
|
1032
|
-
|
|
1013
|
+
u.push(z), u.length >= o && M();
|
|
1033
1014
|
}
|
|
1034
|
-
},
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
if (
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
|
|
1015
|
+
}, M = () => {
|
|
1016
|
+
if (u.length === 0) return;
|
|
1017
|
+
const z = [...u];
|
|
1018
|
+
if (u = [], l) {
|
|
1019
|
+
const x = l(z);
|
|
1020
|
+
x !== void 0 && (Array.isArray(x) ? x : [x]).forEach((C) => {
|
|
1021
|
+
r(C, e, {
|
|
1041
1022
|
updateType: "insert"
|
|
1042
1023
|
});
|
|
1043
1024
|
});
|
|
1044
1025
|
} else
|
|
1045
|
-
|
|
1046
|
-
|
|
1026
|
+
z.forEach((x) => {
|
|
1027
|
+
r(x, e, {
|
|
1047
1028
|
updateType: "insert"
|
|
1048
1029
|
});
|
|
1049
1030
|
});
|
|
1050
|
-
|
|
1031
|
+
i?.(z);
|
|
1051
1032
|
};
|
|
1052
|
-
|
|
1053
|
-
const
|
|
1054
|
-
return
|
|
1055
|
-
...
|
|
1056
|
-
streams:
|
|
1033
|
+
c > 0 && (w = setInterval(M, c));
|
|
1034
|
+
const _ = tt(), U = a.getState().getShadowMetadata(t, e) || {}, $ = U.streams || /* @__PURE__ */ new Map();
|
|
1035
|
+
return $.set(_, { buffer: u, flushTimer: w }), a.getState().setShadowMetadata(t, e, {
|
|
1036
|
+
...U,
|
|
1037
|
+
streams: $
|
|
1057
1038
|
}), {
|
|
1058
|
-
write: (
|
|
1059
|
-
writeMany: (
|
|
1060
|
-
flush: () =>
|
|
1039
|
+
write: (z) => V(z),
|
|
1040
|
+
writeMany: (z) => z.forEach(V),
|
|
1041
|
+
flush: () => M(),
|
|
1061
1042
|
pause: () => {
|
|
1062
|
-
|
|
1043
|
+
E = !0;
|
|
1063
1044
|
},
|
|
1064
1045
|
resume: () => {
|
|
1065
|
-
|
|
1046
|
+
E = !1, u.length > 0 && M();
|
|
1066
1047
|
},
|
|
1067
1048
|
close: () => {
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1049
|
+
M(), w && clearInterval(w);
|
|
1050
|
+
const z = a.getState().getShadowMetadata(t, e);
|
|
1051
|
+
z?.streams && z.streams.delete(_);
|
|
1071
1052
|
}
|
|
1072
1053
|
};
|
|
1073
1054
|
};
|
|
1074
|
-
if (
|
|
1075
|
-
return (
|
|
1076
|
-
const
|
|
1077
|
-
const
|
|
1078
|
-
let
|
|
1079
|
-
|
|
1055
|
+
if (d === "stateList")
|
|
1056
|
+
return (n) => /* @__PURE__ */ rt(() => {
|
|
1057
|
+
const c = q(/* @__PURE__ */ new Map()), f = s?.transforms && s.transforms.length > 0 ? `${p}-${Ht(s.transforms)}` : `${p}-base`, [l, i] = X({}), { validIds: u, arrayValues: E } = dt(() => {
|
|
1058
|
+
const V = a.getState().getShadowMetadata(t, e)?.transformCaches?.get(f);
|
|
1059
|
+
let M;
|
|
1060
|
+
V && V.validIds ? M = V.validIds : (M = yt(
|
|
1061
|
+
t,
|
|
1080
1062
|
e,
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
validIds: E,
|
|
1063
|
+
s?.transforms
|
|
1064
|
+
), a.getState().setTransformCache(t, e, f, {
|
|
1065
|
+
validIds: M,
|
|
1085
1066
|
computedAt: Date.now(),
|
|
1086
|
-
transforms:
|
|
1067
|
+
transforms: s?.transforms || []
|
|
1087
1068
|
}));
|
|
1088
|
-
const
|
|
1069
|
+
const _ = a.getState().getShadowValue(k, M);
|
|
1089
1070
|
return {
|
|
1090
|
-
validIds:
|
|
1091
|
-
arrayValues:
|
|
1071
|
+
validIds: M,
|
|
1072
|
+
arrayValues: _ || []
|
|
1092
1073
|
};
|
|
1093
|
-
}, [
|
|
1074
|
+
}, [f, l]);
|
|
1094
1075
|
if (Z(() => {
|
|
1095
|
-
const
|
|
1096
|
-
if (
|
|
1076
|
+
const V = a.getState().subscribeToPath(k, (M) => {
|
|
1077
|
+
if (M.type === "GET_SELECTED")
|
|
1097
1078
|
return;
|
|
1098
|
-
const
|
|
1099
|
-
if (
|
|
1100
|
-
for (const
|
|
1101
|
-
|
|
1102
|
-
(
|
|
1079
|
+
const U = a.getState().getShadowMetadata(t, e)?.transformCaches;
|
|
1080
|
+
if (U)
|
|
1081
|
+
for (const $ of U.keys())
|
|
1082
|
+
$.startsWith(p) && U.delete($);
|
|
1083
|
+
(M.type === "INSERT" || M.type === "REMOVE" || M.type === "CLEAR_SELECTION") && i({});
|
|
1103
1084
|
});
|
|
1104
1085
|
return () => {
|
|
1105
|
-
|
|
1086
|
+
V();
|
|
1106
1087
|
};
|
|
1107
|
-
}, [
|
|
1088
|
+
}, [p, k]), !Array.isArray(E))
|
|
1108
1089
|
return null;
|
|
1109
|
-
const
|
|
1110
|
-
path:
|
|
1111
|
-
componentId:
|
|
1090
|
+
const w = g({
|
|
1091
|
+
path: e,
|
|
1092
|
+
componentId: p,
|
|
1112
1093
|
meta: {
|
|
1113
|
-
...
|
|
1114
|
-
validIds:
|
|
1094
|
+
...s,
|
|
1095
|
+
validIds: u
|
|
1115
1096
|
}
|
|
1116
1097
|
});
|
|
1117
|
-
return /* @__PURE__ */
|
|
1118
|
-
const
|
|
1119
|
-
if (!
|
|
1098
|
+
return /* @__PURE__ */ rt(kt, { children: E.map((V, M) => {
|
|
1099
|
+
const _ = u[M];
|
|
1100
|
+
if (!_)
|
|
1120
1101
|
return null;
|
|
1121
|
-
let
|
|
1122
|
-
|
|
1123
|
-
const
|
|
1124
|
-
return
|
|
1125
|
-
key:
|
|
1126
|
-
stateKey:
|
|
1127
|
-
itemComponentId:
|
|
1128
|
-
itemPath:
|
|
1129
|
-
localIndex:
|
|
1130
|
-
arraySetter:
|
|
1131
|
-
rebuildStateShape:
|
|
1132
|
-
renderFn:
|
|
1102
|
+
let U = c.current.get(_);
|
|
1103
|
+
U || (U = tt(), c.current.set(_, U));
|
|
1104
|
+
const $ = _.split(".").slice(1);
|
|
1105
|
+
return st(vt, {
|
|
1106
|
+
key: _,
|
|
1107
|
+
stateKey: t,
|
|
1108
|
+
itemComponentId: U,
|
|
1109
|
+
itemPath: $,
|
|
1110
|
+
localIndex: M,
|
|
1111
|
+
arraySetter: w,
|
|
1112
|
+
rebuildStateShape: g,
|
|
1113
|
+
renderFn: n
|
|
1133
1114
|
});
|
|
1134
1115
|
}) });
|
|
1135
1116
|
}, {});
|
|
1136
|
-
if (
|
|
1137
|
-
return (
|
|
1138
|
-
const o =
|
|
1117
|
+
if (d === "stateFlattenOn")
|
|
1118
|
+
return (n) => {
|
|
1119
|
+
const o = a.getState().getShadowValue([t, ...e].join("."), s?.validIds);
|
|
1139
1120
|
return Array.isArray(o) ? (o.flatMap(
|
|
1140
|
-
(
|
|
1141
|
-
),
|
|
1142
|
-
path: [...
|
|
1143
|
-
componentId:
|
|
1144
|
-
meta:
|
|
1121
|
+
(f) => f[n] ?? []
|
|
1122
|
+
), g({
|
|
1123
|
+
path: [...e, "[*]", n],
|
|
1124
|
+
componentId: p,
|
|
1125
|
+
meta: s
|
|
1145
1126
|
})) : [];
|
|
1146
1127
|
};
|
|
1147
|
-
if (
|
|
1148
|
-
return (
|
|
1149
|
-
const
|
|
1150
|
-
(
|
|
1151
|
-
)?.[
|
|
1152
|
-
return
|
|
1153
|
-
path:
|
|
1154
|
-
componentId:
|
|
1155
|
-
meta:
|
|
1128
|
+
if (d === "index")
|
|
1129
|
+
return (n) => {
|
|
1130
|
+
const c = a.getState().getShadowMetadata(t, e)?.arrayKeys?.filter(
|
|
1131
|
+
(l) => !s?.validIds || s?.validIds && s?.validIds?.includes(l)
|
|
1132
|
+
)?.[n];
|
|
1133
|
+
return c ? (a.getState().getShadowValue(c, s?.validIds), g({
|
|
1134
|
+
path: c.split(".").slice(1),
|
|
1135
|
+
componentId: p,
|
|
1136
|
+
meta: s
|
|
1156
1137
|
})) : void 0;
|
|
1157
1138
|
};
|
|
1158
|
-
if (
|
|
1139
|
+
if (d === "last")
|
|
1159
1140
|
return () => {
|
|
1160
|
-
const
|
|
1161
|
-
if (
|
|
1162
|
-
const o =
|
|
1163
|
-
|
|
1164
|
-
const
|
|
1165
|
-
return
|
|
1166
|
-
path:
|
|
1167
|
-
componentId:
|
|
1168
|
-
meta:
|
|
1141
|
+
const n = a.getState().getShadowValue(t, e);
|
|
1142
|
+
if (n.length === 0) return;
|
|
1143
|
+
const o = n.length - 1;
|
|
1144
|
+
n[o];
|
|
1145
|
+
const c = [...e, o.toString()];
|
|
1146
|
+
return g({
|
|
1147
|
+
path: c,
|
|
1148
|
+
componentId: p,
|
|
1149
|
+
meta: s
|
|
1169
1150
|
});
|
|
1170
1151
|
};
|
|
1171
|
-
if (
|
|
1172
|
-
return (
|
|
1173
|
-
path:
|
|
1174
|
-
componentId:
|
|
1175
|
-
meta:
|
|
1152
|
+
if (d === "insert")
|
|
1153
|
+
return (n, o) => (r(n, e, { updateType: "insert" }), g({
|
|
1154
|
+
path: e,
|
|
1155
|
+
componentId: p,
|
|
1156
|
+
meta: s
|
|
1176
1157
|
}));
|
|
1177
|
-
if (
|
|
1178
|
-
return (
|
|
1179
|
-
const
|
|
1180
|
-
let
|
|
1181
|
-
if (!
|
|
1182
|
-
const
|
|
1183
|
-
(
|
|
1184
|
-
) :
|
|
1185
|
-
return
|
|
1158
|
+
if (d === "uniqueInsert")
|
|
1159
|
+
return (n, o, c) => {
|
|
1160
|
+
const f = a.getState().getShadowValue(t, e), l = K(n) ? n(f) : n;
|
|
1161
|
+
let i = null;
|
|
1162
|
+
if (!f.some((E) => {
|
|
1163
|
+
const w = o ? o.every(
|
|
1164
|
+
(V) => nt(E[V], l[V])
|
|
1165
|
+
) : nt(E, l);
|
|
1166
|
+
return w && (i = E), w;
|
|
1186
1167
|
}))
|
|
1187
|
-
|
|
1188
|
-
else if (
|
|
1189
|
-
const
|
|
1190
|
-
(
|
|
1168
|
+
r(l, e, { updateType: "insert" });
|
|
1169
|
+
else if (c && i) {
|
|
1170
|
+
const E = c(i), w = f.map(
|
|
1171
|
+
(V) => nt(V, i) ? E : V
|
|
1191
1172
|
);
|
|
1192
|
-
|
|
1173
|
+
r(w, e, {
|
|
1193
1174
|
updateType: "update"
|
|
1194
1175
|
});
|
|
1195
1176
|
}
|
|
1196
1177
|
};
|
|
1197
|
-
if (
|
|
1198
|
-
return (
|
|
1199
|
-
const
|
|
1200
|
-
if (!
|
|
1201
|
-
const
|
|
1202
|
-
if (!
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1178
|
+
if (d === "cut")
|
|
1179
|
+
return (n, o) => {
|
|
1180
|
+
const c = a.getState().getShadowValue([t, ...e].join("."), s?.validIds), f = s?.validIds ?? a.getState().getShadowMetadata(t, e)?.arrayKeys;
|
|
1181
|
+
if (!f || f.length === 0) return;
|
|
1182
|
+
const l = n == -1 ? f.length - 1 : n !== void 0 ? n : f.length - 1, i = f[l];
|
|
1183
|
+
if (!i) return;
|
|
1184
|
+
const u = i.split(".").slice(1);
|
|
1185
|
+
r(c, u, {
|
|
1205
1186
|
updateType: "cut"
|
|
1206
1187
|
});
|
|
1207
1188
|
};
|
|
1208
|
-
if (
|
|
1189
|
+
if (d === "cutSelected")
|
|
1209
1190
|
return () => {
|
|
1210
|
-
const
|
|
1211
|
-
if (!
|
|
1212
|
-
const
|
|
1213
|
-
let
|
|
1214
|
-
(
|
|
1191
|
+
const n = yt(t, e, s?.transforms), o = a.getState().getShadowValue([t, ...e].join("."), s?.validIds);
|
|
1192
|
+
if (!n || n.length === 0) return;
|
|
1193
|
+
const c = a.getState().selectedIndicesMap.get(k);
|
|
1194
|
+
let f = n.findIndex(
|
|
1195
|
+
(u) => u === c
|
|
1215
1196
|
);
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1197
|
+
const l = n[f == -1 ? n.length - 1 : f]?.split(".").slice(1);
|
|
1198
|
+
a.getState().clearSelectedIndex({ arrayKey: k });
|
|
1199
|
+
const i = l?.slice(0, -1);
|
|
1200
|
+
ut(t, i), r(o, l, {
|
|
1220
1201
|
updateType: "cut"
|
|
1221
1202
|
});
|
|
1222
1203
|
};
|
|
1223
|
-
if (
|
|
1224
|
-
return (
|
|
1225
|
-
const o =
|
|
1226
|
-
if (!
|
|
1227
|
-
let
|
|
1228
|
-
for (const
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1204
|
+
if (d === "cutByValue")
|
|
1205
|
+
return (n) => {
|
|
1206
|
+
const o = a.getState().getShadowMetadata(t, e), c = s?.validIds ?? o?.arrayKeys;
|
|
1207
|
+
if (!c) return;
|
|
1208
|
+
let f = null;
|
|
1209
|
+
for (const l of c)
|
|
1210
|
+
if (a.getState().getShadowValue(l) === n) {
|
|
1211
|
+
f = l;
|
|
1231
1212
|
break;
|
|
1232
1213
|
}
|
|
1233
|
-
if (
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1214
|
+
if (f) {
|
|
1215
|
+
const l = f.split(".").slice(1);
|
|
1216
|
+
r(null, l, { updateType: "cut" });
|
|
1236
1217
|
}
|
|
1237
1218
|
};
|
|
1238
|
-
if (
|
|
1239
|
-
return (
|
|
1240
|
-
const o =
|
|
1241
|
-
if (!
|
|
1242
|
-
let
|
|
1243
|
-
for (const
|
|
1244
|
-
const
|
|
1245
|
-
if (console.log("itemValue sdasdasdasd",
|
|
1246
|
-
|
|
1219
|
+
if (d === "toggleByValue")
|
|
1220
|
+
return (n) => {
|
|
1221
|
+
const o = a.getState().getShadowMetadata(t, e), c = s?.validIds ?? o?.arrayKeys;
|
|
1222
|
+
if (!c) return;
|
|
1223
|
+
let f = null;
|
|
1224
|
+
for (const l of c) {
|
|
1225
|
+
const i = a.getState().getShadowValue(l);
|
|
1226
|
+
if (console.log("itemValue sdasdasdasd", i), i === n) {
|
|
1227
|
+
f = l;
|
|
1247
1228
|
break;
|
|
1248
1229
|
}
|
|
1249
1230
|
}
|
|
1250
|
-
if (console.log("itemValue keyToCut",
|
|
1251
|
-
const
|
|
1252
|
-
console.log("itemValue keyToCut",
|
|
1231
|
+
if (console.log("itemValue keyToCut", f), f) {
|
|
1232
|
+
const l = f.split(".").slice(1);
|
|
1233
|
+
console.log("itemValue keyToCut", f), r(n, l, {
|
|
1253
1234
|
updateType: "cut"
|
|
1254
1235
|
});
|
|
1255
1236
|
} else
|
|
1256
|
-
|
|
1237
|
+
r(n, e, { updateType: "insert" });
|
|
1257
1238
|
};
|
|
1258
|
-
if (
|
|
1259
|
-
return (
|
|
1260
|
-
const
|
|
1261
|
-
if (!
|
|
1239
|
+
if (d === "findWith")
|
|
1240
|
+
return (n, o) => {
|
|
1241
|
+
const c = a.getState().getShadowMetadata(t, e)?.arrayKeys;
|
|
1242
|
+
if (!c)
|
|
1262
1243
|
throw new Error("No array keys found for sorting");
|
|
1263
|
-
let
|
|
1264
|
-
for (const
|
|
1265
|
-
let
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1244
|
+
let f = [];
|
|
1245
|
+
for (const l of c) {
|
|
1246
|
+
let i = a.getState().getShadowValue(l, s?.validIds);
|
|
1247
|
+
if (i && i[n] === o) {
|
|
1248
|
+
f = l.split(".").slice(1);
|
|
1268
1249
|
break;
|
|
1269
1250
|
}
|
|
1270
1251
|
}
|
|
1271
|
-
return
|
|
1272
|
-
path:
|
|
1273
|
-
componentId:
|
|
1274
|
-
meta:
|
|
1252
|
+
return g({
|
|
1253
|
+
path: f,
|
|
1254
|
+
componentId: p,
|
|
1255
|
+
meta: s
|
|
1275
1256
|
});
|
|
1276
1257
|
};
|
|
1277
|
-
if (
|
|
1278
|
-
let
|
|
1258
|
+
if (d === "cutThis") {
|
|
1259
|
+
let n = a.getState().getShadowValue(e.join("."));
|
|
1279
1260
|
return () => {
|
|
1280
|
-
|
|
1261
|
+
r(n, e, { updateType: "cut" });
|
|
1281
1262
|
};
|
|
1282
1263
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
return () => (
|
|
1285
|
-
if (
|
|
1286
|
-
return () =>
|
|
1287
|
-
if (
|
|
1288
|
-
return (
|
|
1289
|
-
_stateKey:
|
|
1290
|
-
_path:
|
|
1291
|
-
_effect:
|
|
1292
|
-
_meta:
|
|
1264
|
+
if (d === "get")
|
|
1265
|
+
return () => (Mt(t, p, e), a.getState().getShadowValue(k, s?.validIds));
|
|
1266
|
+
if (d === "getState")
|
|
1267
|
+
return () => a.getState().getShadowValue(k, s?.validIds);
|
|
1268
|
+
if (d === "$derive")
|
|
1269
|
+
return (n) => Tt({
|
|
1270
|
+
_stateKey: t,
|
|
1271
|
+
_path: e,
|
|
1272
|
+
_effect: n.toString(),
|
|
1273
|
+
_meta: s
|
|
1293
1274
|
});
|
|
1294
|
-
if (
|
|
1295
|
-
return () =>
|
|
1296
|
-
if (
|
|
1297
|
-
const
|
|
1298
|
-
return
|
|
1275
|
+
if (d === "$get")
|
|
1276
|
+
return () => Tt({ _stateKey: t, _path: e, _meta: s });
|
|
1277
|
+
if (d === "lastSynced") {
|
|
1278
|
+
const n = `${t}:${e.join(".")}`;
|
|
1279
|
+
return a.getState().getSyncInfo(n);
|
|
1299
1280
|
}
|
|
1300
|
-
if (
|
|
1301
|
-
return (
|
|
1302
|
-
if (
|
|
1303
|
-
const
|
|
1304
|
-
if (
|
|
1305
|
-
|
|
1281
|
+
if (d == "getLocalStorage")
|
|
1282
|
+
return (n) => ft(m + "-" + t + "-" + n);
|
|
1283
|
+
if (d === "isSelected") {
|
|
1284
|
+
const n = [t, ...e].slice(0, -1);
|
|
1285
|
+
if (ut(t, e, void 0), Array.isArray(
|
|
1286
|
+
a.getState().getShadowValue(n.join("."), s?.validIds)
|
|
1306
1287
|
)) {
|
|
1307
|
-
|
|
1308
|
-
const o =
|
|
1309
|
-
return
|
|
1288
|
+
e[e.length - 1];
|
|
1289
|
+
const o = n.join("."), c = a.getState().selectedIndicesMap.get(o), f = t + "." + e.join(".");
|
|
1290
|
+
return c === f;
|
|
1310
1291
|
}
|
|
1311
1292
|
return;
|
|
1312
1293
|
}
|
|
1313
|
-
if (
|
|
1314
|
-
return (
|
|
1315
|
-
const o =
|
|
1316
|
-
|
|
1294
|
+
if (d === "setSelected")
|
|
1295
|
+
return (n) => {
|
|
1296
|
+
const o = e.slice(0, -1), c = t + "." + o.join("."), f = t + "." + e.join(".");
|
|
1297
|
+
ut(t, o, void 0), a.getState().selectedIndicesMap.get(c), n && a.getState().setSelectedIndex(c, f);
|
|
1317
1298
|
};
|
|
1318
|
-
if (
|
|
1299
|
+
if (d === "toggleSelected")
|
|
1319
1300
|
return () => {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1301
|
+
const n = e.slice(0, -1), o = t + "." + n.join("."), c = t + "." + e.join(".");
|
|
1302
|
+
a.getState().selectedIndicesMap.get(o) === c ? a.getState().clearSelectedIndex({ arrayKey: o }) : a.getState().setSelectedIndex(o, c);
|
|
1322
1303
|
};
|
|
1323
|
-
if (
|
|
1324
|
-
return
|
|
1325
|
-
if (
|
|
1326
|
-
if (
|
|
1327
|
-
return (
|
|
1328
|
-
|
|
1329
|
-
const
|
|
1330
|
-
|
|
1331
|
-
...
|
|
1304
|
+
if (d === "_componentId")
|
|
1305
|
+
return p;
|
|
1306
|
+
if (e.length == 0) {
|
|
1307
|
+
if (d === "addZodValidation")
|
|
1308
|
+
return (n) => {
|
|
1309
|
+
a.getState().getInitialOptions(t)?.validation, n.forEach((o) => {
|
|
1310
|
+
const c = a.getState().getShadowMetadata(t, o.path) || {};
|
|
1311
|
+
a.getState().setShadowMetadata(t, o.path, {
|
|
1312
|
+
...c,
|
|
1332
1313
|
validation: {
|
|
1333
1314
|
status: "VALIDATION_FAILED",
|
|
1334
1315
|
message: o.message,
|
|
1335
1316
|
validatedValue: void 0
|
|
1336
1317
|
}
|
|
1337
|
-
}),
|
|
1318
|
+
}), a.getState().notifyPathSubscribers(o.path, {
|
|
1338
1319
|
type: "VALIDATION_FAILED",
|
|
1339
1320
|
message: o.message,
|
|
1340
1321
|
validatedValue: void 0
|
|
1341
1322
|
});
|
|
1342
1323
|
});
|
|
1343
1324
|
};
|
|
1344
|
-
if (
|
|
1345
|
-
return (
|
|
1346
|
-
if (!
|
|
1325
|
+
if (d === "clearZodValidation")
|
|
1326
|
+
return (n) => {
|
|
1327
|
+
if (!n)
|
|
1347
1328
|
throw new Error("clearZodValidation requires a path");
|
|
1348
|
-
const o =
|
|
1349
|
-
o.validation && (
|
|
1329
|
+
const o = a.getState().getShadowMetadata(t, n) || {};
|
|
1330
|
+
o.validation && (a.getState().setShadowMetadata(t, n, {
|
|
1350
1331
|
...o,
|
|
1351
1332
|
validation: void 0
|
|
1352
|
-
}),
|
|
1333
|
+
}), a.getState().notifyPathSubscribers([t, ...n].join("."), {
|
|
1353
1334
|
type: "VALIDATION_CLEARED"
|
|
1354
1335
|
}));
|
|
1355
1336
|
};
|
|
1356
|
-
if (
|
|
1357
|
-
return (
|
|
1358
|
-
const o =
|
|
1359
|
-
if (!
|
|
1360
|
-
const
|
|
1361
|
-
for (const
|
|
1362
|
-
const
|
|
1363
|
-
switch (
|
|
1337
|
+
if (d === "applyJsonPatch")
|
|
1338
|
+
return (n) => {
|
|
1339
|
+
const o = a.getState(), c = o.getShadowMetadata(t, []);
|
|
1340
|
+
if (!c?.components) return;
|
|
1341
|
+
const f = (i) => !i || i === "/" ? [] : i.split("/").slice(1).map((u) => u.replace(/~1/g, "/").replace(/~0/g, "~")), l = /* @__PURE__ */ new Set();
|
|
1342
|
+
for (const i of n) {
|
|
1343
|
+
const u = f(i.path);
|
|
1344
|
+
switch (i.op) {
|
|
1364
1345
|
case "add":
|
|
1365
1346
|
case "replace": {
|
|
1366
|
-
const { value:
|
|
1367
|
-
o.updateShadowAtPath(
|
|
1368
|
-
let
|
|
1347
|
+
const { value: E } = i;
|
|
1348
|
+
o.updateShadowAtPath(t, u, E), o.markAsDirty(t, u, { bubble: !0 });
|
|
1349
|
+
let w = [...u];
|
|
1369
1350
|
for (; ; ) {
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1372
|
-
|
|
1351
|
+
const V = o.getShadowMetadata(
|
|
1352
|
+
t,
|
|
1353
|
+
w
|
|
1373
1354
|
);
|
|
1374
|
-
if (
|
|
1375
|
-
if (!
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1355
|
+
if (V?.pathComponents && V.pathComponents.forEach((M) => {
|
|
1356
|
+
if (!l.has(M)) {
|
|
1357
|
+
const _ = c.components?.get(M);
|
|
1358
|
+
_ && (_.forceUpdate(), l.add(M));
|
|
1378
1359
|
}
|
|
1379
|
-
}),
|
|
1380
|
-
|
|
1360
|
+
}), w.length === 0) break;
|
|
1361
|
+
w.pop();
|
|
1381
1362
|
}
|
|
1382
1363
|
break;
|
|
1383
1364
|
}
|
|
1384
1365
|
case "remove": {
|
|
1385
|
-
const
|
|
1386
|
-
o.removeShadowArrayElement(
|
|
1387
|
-
let
|
|
1366
|
+
const E = u.slice(0, -1);
|
|
1367
|
+
o.removeShadowArrayElement(t, u), o.markAsDirty(t, E, { bubble: !0 });
|
|
1368
|
+
let w = [...E];
|
|
1388
1369
|
for (; ; ) {
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1391
|
-
|
|
1370
|
+
const V = o.getShadowMetadata(
|
|
1371
|
+
t,
|
|
1372
|
+
w
|
|
1392
1373
|
);
|
|
1393
|
-
if (
|
|
1394
|
-
if (!
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1374
|
+
if (V?.pathComponents && V.pathComponents.forEach((M) => {
|
|
1375
|
+
if (!l.has(M)) {
|
|
1376
|
+
const _ = c.components?.get(M);
|
|
1377
|
+
_ && (_.forceUpdate(), l.add(M));
|
|
1397
1378
|
}
|
|
1398
|
-
}),
|
|
1399
|
-
|
|
1379
|
+
}), w.length === 0) break;
|
|
1380
|
+
w.pop();
|
|
1400
1381
|
}
|
|
1401
1382
|
break;
|
|
1402
1383
|
}
|
|
1403
1384
|
}
|
|
1404
1385
|
}
|
|
1405
1386
|
};
|
|
1406
|
-
if (
|
|
1407
|
-
return () =>
|
|
1408
|
-
if (
|
|
1409
|
-
return () =>
|
|
1387
|
+
if (d === "getComponents")
|
|
1388
|
+
return () => a.getState().getShadowMetadata(t, [])?.components;
|
|
1389
|
+
if (d === "getAllFormRefs")
|
|
1390
|
+
return () => ht.getState().getFormRefsByStateKey(t);
|
|
1410
1391
|
}
|
|
1411
|
-
if (
|
|
1412
|
-
return () =>
|
|
1413
|
-
if (
|
|
1392
|
+
if (d === "getFormRef")
|
|
1393
|
+
return () => ht.getState().getFormRef(t + "." + e.join("."));
|
|
1394
|
+
if (d === "validationWrapper")
|
|
1414
1395
|
return ({
|
|
1415
|
-
children:
|
|
1396
|
+
children: n,
|
|
1416
1397
|
hideMessage: o
|
|
1417
|
-
}) => /* @__PURE__ */
|
|
1418
|
-
|
|
1398
|
+
}) => /* @__PURE__ */ rt(
|
|
1399
|
+
Vt,
|
|
1419
1400
|
{
|
|
1420
1401
|
formOpts: o ? { validation: { message: "" } } : void 0,
|
|
1421
|
-
path:
|
|
1422
|
-
stateKey:
|
|
1423
|
-
children:
|
|
1402
|
+
path: e,
|
|
1403
|
+
stateKey: t,
|
|
1404
|
+
children: n
|
|
1424
1405
|
}
|
|
1425
1406
|
);
|
|
1426
|
-
if (
|
|
1427
|
-
if (
|
|
1428
|
-
if (
|
|
1429
|
-
return
|
|
1430
|
-
const
|
|
1431
|
-
if (
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1434
|
-
for (const [
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1437
|
-
const
|
|
1438
|
-
(
|
|
1407
|
+
if (d === "_stateKey") return t;
|
|
1408
|
+
if (d === "_path") return e;
|
|
1409
|
+
if (d === "update")
|
|
1410
|
+
return (n) => {
|
|
1411
|
+
const c = new Error().stack || "";
|
|
1412
|
+
if (c.includes("onClick") || c.includes("dispatchEvent") || c.includes("batchedUpdates")) {
|
|
1413
|
+
const l = `${t}.${e.join(".")}`;
|
|
1414
|
+
gt || (ct.clear(), gt = !0, queueMicrotask(() => {
|
|
1415
|
+
for (const [u, E] of ct) {
|
|
1416
|
+
const w = u.split(".");
|
|
1417
|
+
w[0];
|
|
1418
|
+
const V = w.slice(1), M = E.reduce(
|
|
1419
|
+
(_, U) => typeof U == "function" && typeof _ == "function" ? ($) => U(_($)) : U
|
|
1439
1420
|
);
|
|
1440
|
-
|
|
1421
|
+
r(M, V, {
|
|
1441
1422
|
updateType: "update"
|
|
1442
1423
|
});
|
|
1443
1424
|
}
|
|
1444
|
-
|
|
1425
|
+
ct.clear(), gt = !1;
|
|
1445
1426
|
}));
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1427
|
+
const i = ct.get(l) || [];
|
|
1428
|
+
i.push(n), ct.set(l, i);
|
|
1448
1429
|
} else
|
|
1449
|
-
|
|
1430
|
+
r(n, e, { updateType: "update" });
|
|
1450
1431
|
return {
|
|
1451
1432
|
synced: () => {
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1454
|
-
...
|
|
1433
|
+
const l = a.getState().getShadowMetadata(t, e);
|
|
1434
|
+
a.getState().setShadowMetadata(t, e, {
|
|
1435
|
+
...l,
|
|
1455
1436
|
isDirty: !1,
|
|
1456
1437
|
stateSource: "server",
|
|
1457
1438
|
lastServerSync: Date.now()
|
|
1458
1439
|
});
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1440
|
+
const i = [t, ...e].join(".");
|
|
1441
|
+
a.getState().notifyPathSubscribers(i, {
|
|
1461
1442
|
type: "SYNC_STATUS_CHANGE",
|
|
1462
1443
|
isDirty: !1
|
|
1463
1444
|
});
|
|
1464
1445
|
}
|
|
1465
1446
|
};
|
|
1466
1447
|
};
|
|
1467
|
-
if (
|
|
1468
|
-
const
|
|
1469
|
-
if (typeof
|
|
1448
|
+
if (d === "toggle") {
|
|
1449
|
+
const n = a.getState().getShadowValue([t, ...e].join("."), s?.validIds);
|
|
1450
|
+
if (typeof n != "boolean")
|
|
1470
1451
|
throw new Error("toggle() can only be used on boolean values");
|
|
1471
1452
|
return () => {
|
|
1472
|
-
|
|
1453
|
+
r(!n, e, {
|
|
1473
1454
|
updateType: "update"
|
|
1474
1455
|
});
|
|
1475
1456
|
};
|
|
1476
1457
|
}
|
|
1477
|
-
if (
|
|
1478
|
-
return (
|
|
1479
|
-
|
|
1458
|
+
if (d === "formElement")
|
|
1459
|
+
return (n, o) => /* @__PURE__ */ rt(
|
|
1460
|
+
Gt,
|
|
1480
1461
|
{
|
|
1481
|
-
stateKey:
|
|
1482
|
-
path:
|
|
1483
|
-
rebuildStateShape:
|
|
1484
|
-
setState:
|
|
1462
|
+
stateKey: t,
|
|
1463
|
+
path: e,
|
|
1464
|
+
rebuildStateShape: g,
|
|
1465
|
+
setState: r,
|
|
1485
1466
|
formOpts: o,
|
|
1486
|
-
renderFn:
|
|
1467
|
+
renderFn: n
|
|
1487
1468
|
}
|
|
1488
1469
|
);
|
|
1489
|
-
const
|
|
1490
|
-
return
|
|
1491
|
-
path:
|
|
1492
|
-
componentId:
|
|
1493
|
-
meta:
|
|
1470
|
+
const J = [...e, d];
|
|
1471
|
+
return a.getState().getShadowValue(t, J), g({
|
|
1472
|
+
path: J,
|
|
1473
|
+
componentId: p,
|
|
1474
|
+
meta: s
|
|
1494
1475
|
});
|
|
1495
1476
|
}
|
|
1496
|
-
},
|
|
1497
|
-
return v.set(
|
|
1477
|
+
}, S = new Proxy(N, G);
|
|
1478
|
+
return v.set(j, S), S;
|
|
1498
1479
|
}
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
t.getState().clearSelectedIndexesForState(e), t.getState().initializeShadowState(e, V), h({
|
|
1480
|
+
const T = {
|
|
1481
|
+
revertToInitialState: (e) => {
|
|
1482
|
+
a.getState().getInitialOptions(t)?.validation;
|
|
1483
|
+
const s = a.getState().getShadowMetadata(t, []);
|
|
1484
|
+
s?.stateSource === "server" && s.baseServerState ? s.baseServerState : a.getState().initialStateGlobal[t];
|
|
1485
|
+
const p = a.getState().initialStateGlobal[t];
|
|
1486
|
+
a.getState().clearSelectedIndexesForState(t), a.getState().initializeShadowState(t, p), g({
|
|
1507
1487
|
path: [],
|
|
1508
1488
|
componentId: y
|
|
1509
1489
|
});
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1512
|
-
const
|
|
1513
|
-
return
|
|
1514
|
-
|
|
1515
|
-
}),
|
|
1490
|
+
const F = et(t), j = K(F?.localStorage?.key) ? F?.localStorage?.key(p) : F?.localStorage?.key, k = `${m}-${t}-${j}`;
|
|
1491
|
+
k && localStorage.removeItem(k);
|
|
1492
|
+
const N = a.getState().getShadowMetadata(t, []);
|
|
1493
|
+
return N && N?.components?.forEach((G) => {
|
|
1494
|
+
G.forceUpdate();
|
|
1495
|
+
}), p;
|
|
1516
1496
|
},
|
|
1517
|
-
updateInitialState: (
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
|
|
1497
|
+
updateInitialState: (e) => {
|
|
1498
|
+
const s = Ct(
|
|
1499
|
+
t,
|
|
1500
|
+
r,
|
|
1521
1501
|
y,
|
|
1522
1502
|
m
|
|
1523
|
-
),
|
|
1524
|
-
return localStorage.getItem(
|
|
1525
|
-
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
|
|
1503
|
+
), p = a.getState().initialStateGlobal[t], F = et(t), j = K(F?.localStorage?.key) ? F?.localStorage?.key(p) : F?.localStorage?.key, k = `${m}-${t}-${j}`;
|
|
1504
|
+
return localStorage.getItem(k) && localStorage.removeItem(k), Ot(() => {
|
|
1505
|
+
_t(t, e), a.getState().initializeShadowState(t, e);
|
|
1506
|
+
const N = a.getState().getShadowMetadata(t, []);
|
|
1507
|
+
N && N?.components?.forEach((G) => {
|
|
1508
|
+
G.forceUpdate();
|
|
1529
1509
|
});
|
|
1530
1510
|
}), {
|
|
1531
|
-
fetchId: (
|
|
1511
|
+
fetchId: (N) => s.get()[N]
|
|
1532
1512
|
};
|
|
1533
1513
|
}
|
|
1534
1514
|
};
|
|
1535
|
-
return
|
|
1515
|
+
return g({
|
|
1536
1516
|
componentId: y,
|
|
1537
1517
|
path: []
|
|
1538
1518
|
});
|
|
1539
1519
|
}
|
|
1540
|
-
function
|
|
1541
|
-
return
|
|
1520
|
+
function Tt(t) {
|
|
1521
|
+
return st(Bt, { proxy: t });
|
|
1542
1522
|
}
|
|
1543
|
-
function
|
|
1544
|
-
proxy:
|
|
1545
|
-
rebuildStateShape:
|
|
1523
|
+
function xt({
|
|
1524
|
+
proxy: t,
|
|
1525
|
+
rebuildStateShape: r
|
|
1546
1526
|
}) {
|
|
1547
|
-
const y =
|
|
1527
|
+
const y = q(null), m = q(`map-${crypto.randomUUID()}`), v = q(!1), g = q(/* @__PURE__ */ new Map());
|
|
1548
1528
|
Z(() => {
|
|
1549
|
-
const
|
|
1550
|
-
if (!
|
|
1551
|
-
const
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1529
|
+
const h = y.current;
|
|
1530
|
+
if (!h || v.current) return;
|
|
1531
|
+
const e = setTimeout(() => {
|
|
1532
|
+
const s = a.getState().getShadowMetadata(t._stateKey, t._path) || {}, p = s.mapWrappers || [];
|
|
1533
|
+
p.push({
|
|
1554
1534
|
instanceId: m.current,
|
|
1555
|
-
mapFn:
|
|
1556
|
-
containerRef:
|
|
1557
|
-
rebuildStateShape:
|
|
1558
|
-
path:
|
|
1535
|
+
mapFn: t._mapFn,
|
|
1536
|
+
containerRef: h,
|
|
1537
|
+
rebuildStateShape: r,
|
|
1538
|
+
path: t._path,
|
|
1559
1539
|
componentId: m.current,
|
|
1560
|
-
meta:
|
|
1561
|
-
}),
|
|
1562
|
-
...
|
|
1563
|
-
mapWrappers:
|
|
1564
|
-
}), v.current = !0,
|
|
1540
|
+
meta: t._meta
|
|
1541
|
+
}), a.getState().setShadowMetadata(t._stateKey, t._path, {
|
|
1542
|
+
...s,
|
|
1543
|
+
mapWrappers: p
|
|
1544
|
+
}), v.current = !0, T();
|
|
1565
1545
|
}, 0);
|
|
1566
1546
|
return () => {
|
|
1567
|
-
if (clearTimeout(
|
|
1568
|
-
const
|
|
1569
|
-
|
|
1570
|
-
(
|
|
1571
|
-
),
|
|
1547
|
+
if (clearTimeout(e), m.current) {
|
|
1548
|
+
const s = a.getState().getShadowMetadata(t._stateKey, t._path) || {};
|
|
1549
|
+
s.mapWrappers && (s.mapWrappers = s.mapWrappers.filter(
|
|
1550
|
+
(p) => p.instanceId !== m.current
|
|
1551
|
+
), a.getState().setShadowMetadata(t._stateKey, t._path, s));
|
|
1572
1552
|
}
|
|
1573
|
-
|
|
1553
|
+
g.current.forEach((s) => s.unmount());
|
|
1574
1554
|
};
|
|
1575
1555
|
}, []);
|
|
1576
|
-
const
|
|
1577
|
-
const
|
|
1578
|
-
if (!
|
|
1579
|
-
const
|
|
1580
|
-
[
|
|
1581
|
-
|
|
1556
|
+
const T = () => {
|
|
1557
|
+
const h = y.current;
|
|
1558
|
+
if (!h) return;
|
|
1559
|
+
const e = a.getState().getShadowValue(
|
|
1560
|
+
[t._stateKey, ...t._path].join("."),
|
|
1561
|
+
t._meta?.validIds
|
|
1582
1562
|
);
|
|
1583
|
-
if (!Array.isArray(
|
|
1584
|
-
const
|
|
1585
|
-
currentState:
|
|
1586
|
-
path:
|
|
1563
|
+
if (!Array.isArray(e)) return;
|
|
1564
|
+
const s = t._meta?.validIds ?? a.getState().getShadowMetadata(t._stateKey, t._path)?.arrayKeys ?? [], p = r({
|
|
1565
|
+
currentState: e,
|
|
1566
|
+
path: t._path,
|
|
1587
1567
|
componentId: m.current,
|
|
1588
|
-
meta:
|
|
1568
|
+
meta: t._meta
|
|
1589
1569
|
});
|
|
1590
|
-
|
|
1591
|
-
const
|
|
1592
|
-
if (!
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
stateKey:
|
|
1601
|
-
itemComponentId:
|
|
1602
|
-
itemPath:
|
|
1570
|
+
e.forEach((F, j) => {
|
|
1571
|
+
const k = s[j];
|
|
1572
|
+
if (!k) return;
|
|
1573
|
+
const N = tt(), G = document.createElement("div");
|
|
1574
|
+
G.setAttribute("data-item-path", k), h.appendChild(G);
|
|
1575
|
+
const S = bt(G);
|
|
1576
|
+
g.current.set(k, S);
|
|
1577
|
+
const Q = k.split(".").slice(1);
|
|
1578
|
+
S.render(
|
|
1579
|
+
st(vt, {
|
|
1580
|
+
stateKey: t._stateKey,
|
|
1581
|
+
itemComponentId: N,
|
|
1582
|
+
itemPath: Q,
|
|
1603
1583
|
localIndex: j,
|
|
1604
|
-
arraySetter:
|
|
1605
|
-
rebuildStateShape:
|
|
1606
|
-
renderFn:
|
|
1584
|
+
arraySetter: p,
|
|
1585
|
+
rebuildStateShape: r,
|
|
1586
|
+
renderFn: t._mapFn
|
|
1607
1587
|
})
|
|
1608
1588
|
);
|
|
1609
1589
|
});
|
|
1610
1590
|
};
|
|
1611
|
-
return /* @__PURE__ */
|
|
1591
|
+
return /* @__PURE__ */ rt("div", { ref: y, "data-map-container": m.current });
|
|
1612
1592
|
}
|
|
1613
|
-
function
|
|
1614
|
-
proxy:
|
|
1593
|
+
function Bt({
|
|
1594
|
+
proxy: t
|
|
1615
1595
|
}) {
|
|
1616
|
-
const
|
|
1617
|
-
[
|
|
1618
|
-
|
|
1596
|
+
const r = q(null), y = q(null), m = q(!1), v = `${t._stateKey}-${t._path.join(".")}`, g = a.getState().getShadowValue(
|
|
1597
|
+
[t._stateKey, ...t._path].join("."),
|
|
1598
|
+
t._meta?.validIds
|
|
1619
1599
|
);
|
|
1620
1600
|
return Z(() => {
|
|
1621
|
-
const
|
|
1622
|
-
if (!
|
|
1623
|
-
const
|
|
1624
|
-
if (!
|
|
1601
|
+
const T = r.current;
|
|
1602
|
+
if (!T || m.current) return;
|
|
1603
|
+
const h = setTimeout(() => {
|
|
1604
|
+
if (!T.parentElement) {
|
|
1625
1605
|
console.warn("Parent element not found for signal", v);
|
|
1626
1606
|
return;
|
|
1627
1607
|
}
|
|
1628
|
-
const
|
|
1629
|
-
let
|
|
1630
|
-
|
|
1631
|
-
const j =
|
|
1632
|
-
|
|
1608
|
+
const e = T.parentElement, p = Array.from(e.childNodes).indexOf(T);
|
|
1609
|
+
let F = e.getAttribute("data-parent-id");
|
|
1610
|
+
F || (F = `parent-${crypto.randomUUID()}`, e.setAttribute("data-parent-id", F)), y.current = `instance-${crypto.randomUUID()}`;
|
|
1611
|
+
const j = a.getState().getShadowMetadata(t._stateKey, t._path) || {}, k = j.signals || [];
|
|
1612
|
+
k.push({
|
|
1633
1613
|
instanceId: y.current,
|
|
1634
|
-
parentId:
|
|
1635
|
-
position:
|
|
1636
|
-
effect:
|
|
1637
|
-
}),
|
|
1614
|
+
parentId: F,
|
|
1615
|
+
position: p,
|
|
1616
|
+
effect: t._effect
|
|
1617
|
+
}), a.getState().setShadowMetadata(t._stateKey, t._path, {
|
|
1638
1618
|
...j,
|
|
1639
|
-
signals:
|
|
1619
|
+
signals: k
|
|
1640
1620
|
});
|
|
1641
|
-
let
|
|
1642
|
-
if (
|
|
1621
|
+
let N = g;
|
|
1622
|
+
if (t._effect)
|
|
1643
1623
|
try {
|
|
1644
|
-
|
|
1624
|
+
N = new Function(
|
|
1645
1625
|
"state",
|
|
1646
|
-
`return (${
|
|
1647
|
-
)(
|
|
1648
|
-
} catch (
|
|
1649
|
-
console.error("Error evaluating effect function:",
|
|
1626
|
+
`return (${t._effect})(state)`
|
|
1627
|
+
)(g);
|
|
1628
|
+
} catch (S) {
|
|
1629
|
+
console.error("Error evaluating effect function:", S);
|
|
1650
1630
|
}
|
|
1651
|
-
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1631
|
+
N !== null && typeof N == "object" && (N = JSON.stringify(N));
|
|
1632
|
+
const G = document.createTextNode(String(N ?? ""));
|
|
1633
|
+
T.replaceWith(G), m.current = !0;
|
|
1654
1634
|
}, 0);
|
|
1655
1635
|
return () => {
|
|
1656
|
-
if (clearTimeout(
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
(
|
|
1660
|
-
),
|
|
1636
|
+
if (clearTimeout(h), y.current) {
|
|
1637
|
+
const e = a.getState().getShadowMetadata(t._stateKey, t._path) || {};
|
|
1638
|
+
e.signals && (e.signals = e.signals.filter(
|
|
1639
|
+
(s) => s.instanceId !== y.current
|
|
1640
|
+
), a.getState().setShadowMetadata(t._stateKey, t._path, e));
|
|
1661
1641
|
}
|
|
1662
1642
|
};
|
|
1663
|
-
}, []),
|
|
1664
|
-
ref:
|
|
1643
|
+
}, []), st("span", {
|
|
1644
|
+
ref: r,
|
|
1665
1645
|
style: { display: "contents" },
|
|
1666
1646
|
"data-signal-id": v
|
|
1667
1647
|
});
|
|
1668
1648
|
}
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
(
|
|
1672
|
-
),
|
|
1673
|
-
const [
|
|
1674
|
-
return
|
|
1675
|
-
if (!
|
|
1649
|
+
const vt = Dt(
|
|
1650
|
+
zt,
|
|
1651
|
+
(t, r) => t.itemPath.join(".") === r.itemPath.join(".") && t.stateKey === r.stateKey && t.itemComponentId === r.itemComponentId && t.localIndex === r.localIndex
|
|
1652
|
+
), qt = (t) => {
|
|
1653
|
+
const [r, y] = X(!1);
|
|
1654
|
+
return lt(() => {
|
|
1655
|
+
if (!t.current) {
|
|
1676
1656
|
y(!0);
|
|
1677
1657
|
return;
|
|
1678
1658
|
}
|
|
1679
|
-
const m = Array.from(
|
|
1659
|
+
const m = Array.from(t.current.querySelectorAll("img"));
|
|
1680
1660
|
if (m.length === 0) {
|
|
1681
1661
|
y(!0);
|
|
1682
1662
|
return;
|
|
1683
1663
|
}
|
|
1684
1664
|
let v = 0;
|
|
1685
|
-
const
|
|
1665
|
+
const g = () => {
|
|
1686
1666
|
v++, v === m.length && y(!0);
|
|
1687
1667
|
};
|
|
1688
|
-
return m.forEach((
|
|
1689
|
-
|
|
1668
|
+
return m.forEach((T) => {
|
|
1669
|
+
T.complete ? g() : (T.addEventListener("load", g), T.addEventListener("error", g));
|
|
1690
1670
|
}), () => {
|
|
1691
|
-
m.forEach((
|
|
1692
|
-
|
|
1671
|
+
m.forEach((T) => {
|
|
1672
|
+
T.removeEventListener("load", g), T.removeEventListener("error", g);
|
|
1693
1673
|
});
|
|
1694
1674
|
};
|
|
1695
|
-
}, [
|
|
1675
|
+
}, [t.current]), r;
|
|
1696
1676
|
};
|
|
1697
|
-
function
|
|
1698
|
-
stateKey:
|
|
1699
|
-
itemComponentId:
|
|
1677
|
+
function zt({
|
|
1678
|
+
stateKey: t,
|
|
1679
|
+
itemComponentId: r,
|
|
1700
1680
|
itemPath: y,
|
|
1701
1681
|
localIndex: m,
|
|
1702
1682
|
arraySetter: v,
|
|
1703
|
-
rebuildStateShape:
|
|
1704
|
-
renderFn:
|
|
1683
|
+
rebuildStateShape: g,
|
|
1684
|
+
renderFn: T
|
|
1705
1685
|
}) {
|
|
1706
|
-
const [,
|
|
1707
|
-
|
|
1708
|
-
const
|
|
1709
|
-
(
|
|
1710
|
-
|
|
1686
|
+
const [, h] = X({}), { ref: e, inView: s } = $t(), p = q(null), F = qt(p), j = q(!1), k = [t, ...y].join(".");
|
|
1687
|
+
Pt(t, r, h);
|
|
1688
|
+
const N = ot(
|
|
1689
|
+
(W) => {
|
|
1690
|
+
p.current = W, e(W);
|
|
1711
1691
|
},
|
|
1712
|
-
[
|
|
1692
|
+
[e]
|
|
1713
1693
|
);
|
|
1714
1694
|
Z(() => {
|
|
1715
|
-
|
|
1716
|
-
|
|
1695
|
+
a.getState().subscribeToPath(k, (W) => {
|
|
1696
|
+
h({});
|
|
1717
1697
|
});
|
|
1718
1698
|
}, []), Z(() => {
|
|
1719
|
-
if (!
|
|
1699
|
+
if (!s || !F || j.current)
|
|
1720
1700
|
return;
|
|
1721
|
-
const
|
|
1722
|
-
if (
|
|
1701
|
+
const W = p.current;
|
|
1702
|
+
if (W && W.offsetHeight > 0) {
|
|
1723
1703
|
j.current = !0;
|
|
1724
|
-
const J =
|
|
1725
|
-
|
|
1704
|
+
const J = W.offsetHeight;
|
|
1705
|
+
a.getState().setShadowMetadata(t, y, {
|
|
1726
1706
|
virtualizer: {
|
|
1727
1707
|
itemHeight: J,
|
|
1728
|
-
domRef:
|
|
1708
|
+
domRef: W
|
|
1729
1709
|
}
|
|
1730
1710
|
});
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1711
|
+
const n = y.slice(0, -1), o = [t, ...n].join(".");
|
|
1712
|
+
a.getState().notifyPathSubscribers(o, {
|
|
1733
1713
|
type: "ITEMHEIGHT",
|
|
1734
1714
|
itemKey: y.join("."),
|
|
1735
|
-
ref:
|
|
1715
|
+
ref: p.current
|
|
1736
1716
|
});
|
|
1737
1717
|
}
|
|
1738
|
-
}, [
|
|
1739
|
-
const
|
|
1740
|
-
if (
|
|
1718
|
+
}, [s, F, t, y]);
|
|
1719
|
+
const G = [t, ...y].join("."), S = a.getState().getShadowValue(G);
|
|
1720
|
+
if (S === void 0)
|
|
1741
1721
|
return null;
|
|
1742
|
-
const
|
|
1743
|
-
currentState:
|
|
1722
|
+
const Q = g({
|
|
1723
|
+
currentState: S,
|
|
1744
1724
|
path: y,
|
|
1745
|
-
componentId:
|
|
1746
|
-
}),
|
|
1747
|
-
return /* @__PURE__ */
|
|
1725
|
+
componentId: r
|
|
1726
|
+
}), d = T(Q, m, v);
|
|
1727
|
+
return /* @__PURE__ */ rt("div", { ref: N, children: d });
|
|
1748
1728
|
}
|
|
1749
|
-
function
|
|
1750
|
-
stateKey:
|
|
1751
|
-
path:
|
|
1729
|
+
function Gt({
|
|
1730
|
+
stateKey: t,
|
|
1731
|
+
path: r,
|
|
1752
1732
|
rebuildStateShape: y,
|
|
1753
1733
|
renderFn: m,
|
|
1754
1734
|
formOpts: v,
|
|
1755
|
-
setState:
|
|
1735
|
+
setState: g
|
|
1756
1736
|
}) {
|
|
1757
|
-
const [
|
|
1758
|
-
|
|
1759
|
-
const
|
|
1737
|
+
const [T] = X(() => tt()), [, h] = X({}), e = [t, ...r].join(".");
|
|
1738
|
+
Pt(t, T, h);
|
|
1739
|
+
const s = a.getState().getShadowValue(e), [p, F] = X(s), j = q(!1), k = q(null);
|
|
1760
1740
|
Z(() => {
|
|
1761
|
-
!j.current && !
|
|
1762
|
-
}, [
|
|
1763
|
-
const
|
|
1764
|
-
!j.current &&
|
|
1741
|
+
!j.current && !nt(s, p) && F(s);
|
|
1742
|
+
}, [s]), Z(() => {
|
|
1743
|
+
const d = a.getState().subscribeToPath(e, (W) => {
|
|
1744
|
+
!j.current && p !== W && h({});
|
|
1765
1745
|
});
|
|
1766
1746
|
return () => {
|
|
1767
|
-
|
|
1747
|
+
d(), k.current && (clearTimeout(k.current), j.current = !1);
|
|
1768
1748
|
};
|
|
1769
1749
|
}, []);
|
|
1770
|
-
const
|
|
1771
|
-
(
|
|
1772
|
-
typeof
|
|
1750
|
+
const N = ot(
|
|
1751
|
+
(d) => {
|
|
1752
|
+
typeof s === "number" && typeof d == "string" && (d = d === "" ? 0 : Number(d)), F(d), j.current = !0, k.current && clearTimeout(k.current);
|
|
1773
1753
|
const J = v?.debounceTime ?? 200;
|
|
1774
|
-
|
|
1775
|
-
j.current = !1,
|
|
1776
|
-
const { getInitialOptions:
|
|
1777
|
-
if (
|
|
1778
|
-
const i =
|
|
1779
|
-
if (
|
|
1780
|
-
|
|
1781
|
-
...
|
|
1754
|
+
k.current = setTimeout(() => {
|
|
1755
|
+
j.current = !1, g(d, r, { updateType: "update" });
|
|
1756
|
+
const { getInitialOptions: n, setShadowMetadata: o, getShadowMetadata: c } = a.getState(), f = n(t)?.validation, l = f?.zodSchemaV4 || f?.zodSchemaV3;
|
|
1757
|
+
if (l) {
|
|
1758
|
+
const i = a.getState().getShadowValue(t), u = l.safeParse(i), E = c(t, r) || {};
|
|
1759
|
+
if (u.success)
|
|
1760
|
+
o(t, r, {
|
|
1761
|
+
...E,
|
|
1782
1762
|
validation: {
|
|
1783
1763
|
status: "VALID_LIVE",
|
|
1784
|
-
validatedValue:
|
|
1764
|
+
validatedValue: d,
|
|
1785
1765
|
message: void 0
|
|
1786
1766
|
}
|
|
1787
1767
|
});
|
|
1788
1768
|
else {
|
|
1789
|
-
const
|
|
1790
|
-
(
|
|
1769
|
+
const V = ("issues" in u.error ? u.error.issues : u.error.errors).filter(
|
|
1770
|
+
(M) => JSON.stringify(M.path) === JSON.stringify(r)
|
|
1791
1771
|
);
|
|
1792
|
-
|
|
1793
|
-
...
|
|
1772
|
+
V.length > 0 ? o(t, r, {
|
|
1773
|
+
...E,
|
|
1794
1774
|
validation: {
|
|
1795
1775
|
status: "INVALID_LIVE",
|
|
1796
|
-
message:
|
|
1797
|
-
validatedValue:
|
|
1776
|
+
message: V[0]?.message,
|
|
1777
|
+
validatedValue: d
|
|
1798
1778
|
}
|
|
1799
|
-
}) :
|
|
1800
|
-
...
|
|
1779
|
+
}) : o(t, r, {
|
|
1780
|
+
...E,
|
|
1801
1781
|
validation: {
|
|
1802
1782
|
status: "VALID_LIVE",
|
|
1803
|
-
validatedValue:
|
|
1783
|
+
validatedValue: d,
|
|
1804
1784
|
message: void 0
|
|
1805
1785
|
}
|
|
1806
1786
|
});
|
|
1807
1787
|
}
|
|
1808
1788
|
}
|
|
1809
|
-
}, J),
|
|
1789
|
+
}, J), h({});
|
|
1810
1790
|
},
|
|
1811
|
-
[
|
|
1812
|
-
),
|
|
1813
|
-
console.log("handleBlur triggered"),
|
|
1814
|
-
const { getInitialOptions:
|
|
1791
|
+
[g, r, v?.debounceTime, t]
|
|
1792
|
+
), G = ot(async () => {
|
|
1793
|
+
console.log("handleBlur triggered"), k.current && (clearTimeout(k.current), k.current = null, j.current = !1, g(p, r, { updateType: "update" }));
|
|
1794
|
+
const { getInitialOptions: d } = a.getState(), W = d(t)?.validation, J = W?.zodSchemaV4 || W?.zodSchemaV3;
|
|
1815
1795
|
if (!J) return;
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1818
|
-
...
|
|
1796
|
+
const n = a.getState().getShadowMetadata(t, r);
|
|
1797
|
+
a.getState().setShadowMetadata(t, r, {
|
|
1798
|
+
...n,
|
|
1819
1799
|
validation: {
|
|
1820
1800
|
status: "DIRTY",
|
|
1821
|
-
validatedValue:
|
|
1801
|
+
validatedValue: p
|
|
1822
1802
|
}
|
|
1823
1803
|
});
|
|
1824
|
-
const
|
|
1825
|
-
if (console.log("result ",
|
|
1826
|
-
|
|
1827
|
-
...
|
|
1804
|
+
const o = a.getState().getShadowValue(t), c = J.safeParse(o);
|
|
1805
|
+
if (console.log("result ", c), c.success)
|
|
1806
|
+
a.getState().setShadowMetadata(t, r, {
|
|
1807
|
+
...n,
|
|
1828
1808
|
validation: {
|
|
1829
1809
|
status: "VALID_PENDING_SYNC",
|
|
1830
|
-
validatedValue:
|
|
1810
|
+
validatedValue: p
|
|
1831
1811
|
}
|
|
1832
1812
|
});
|
|
1833
1813
|
else {
|
|
1834
|
-
const
|
|
1835
|
-
console.log("All validation errors:",
|
|
1836
|
-
const
|
|
1837
|
-
if (console.log("Processing error:", i),
|
|
1814
|
+
const f = "issues" in c.error ? c.error.issues : c.error.errors;
|
|
1815
|
+
console.log("All validation errors:", f), console.log("Current blur path:", r);
|
|
1816
|
+
const l = f.filter((i) => {
|
|
1817
|
+
if (console.log("Processing error:", i), r.some((E) => E.startsWith("id:"))) {
|
|
1838
1818
|
console.log("Detected array path with ULID");
|
|
1839
|
-
const
|
|
1840
|
-
console.log("Parent path:",
|
|
1841
|
-
const w =
|
|
1819
|
+
const E = r[0].startsWith("id:") ? [] : r.slice(0, -1);
|
|
1820
|
+
console.log("Parent path:", E);
|
|
1821
|
+
const w = a.getState().getShadowMetadata(t, E);
|
|
1842
1822
|
if (console.log("Array metadata:", w), w?.arrayKeys) {
|
|
1843
|
-
const
|
|
1844
|
-
console.log("Item key:",
|
|
1845
|
-
const
|
|
1823
|
+
const V = [t, ...r.slice(0, -1)].join("."), M = w.arrayKeys.indexOf(V);
|
|
1824
|
+
console.log("Item key:", V, "Index:", M);
|
|
1825
|
+
const _ = [...E, M, ...r.slice(-1)], U = JSON.stringify(i.path) === JSON.stringify(_);
|
|
1846
1826
|
return console.log("Zod path comparison:", {
|
|
1847
|
-
zodPath:
|
|
1827
|
+
zodPath: _,
|
|
1848
1828
|
errorPath: i.path,
|
|
1849
|
-
match:
|
|
1850
|
-
}),
|
|
1829
|
+
match: U
|
|
1830
|
+
}), U;
|
|
1851
1831
|
}
|
|
1852
1832
|
}
|
|
1853
|
-
const
|
|
1833
|
+
const u = JSON.stringify(i.path) === JSON.stringify(r);
|
|
1854
1834
|
return console.log("Direct path comparison:", {
|
|
1855
1835
|
errorPath: i.path,
|
|
1856
|
-
currentPath:
|
|
1857
|
-
match:
|
|
1858
|
-
}),
|
|
1836
|
+
currentPath: r,
|
|
1837
|
+
match: u
|
|
1838
|
+
}), u;
|
|
1859
1839
|
});
|
|
1860
|
-
console.log("Filtered path errors:",
|
|
1861
|
-
...
|
|
1840
|
+
console.log("Filtered path errors:", l), a.getState().setShadowMetadata(t, r, {
|
|
1841
|
+
...n,
|
|
1862
1842
|
validation: {
|
|
1863
1843
|
status: "VALIDATION_FAILED",
|
|
1864
|
-
message:
|
|
1865
|
-
validatedValue:
|
|
1844
|
+
message: l[0]?.message,
|
|
1845
|
+
validatedValue: p
|
|
1866
1846
|
}
|
|
1867
1847
|
});
|
|
1868
1848
|
}
|
|
1869
|
-
|
|
1870
|
-
}, [
|
|
1871
|
-
currentState:
|
|
1872
|
-
path:
|
|
1873
|
-
componentId:
|
|
1874
|
-
}),
|
|
1875
|
-
get(
|
|
1876
|
-
return
|
|
1877
|
-
value:
|
|
1849
|
+
h({});
|
|
1850
|
+
}, [t, r, p, g]), S = y({
|
|
1851
|
+
currentState: s,
|
|
1852
|
+
path: r,
|
|
1853
|
+
componentId: T
|
|
1854
|
+
}), Q = new Proxy(S, {
|
|
1855
|
+
get(d, W) {
|
|
1856
|
+
return W === "inputProps" ? {
|
|
1857
|
+
value: p ?? "",
|
|
1878
1858
|
onChange: (J) => {
|
|
1879
|
-
|
|
1859
|
+
N(J.target.value);
|
|
1880
1860
|
},
|
|
1881
1861
|
// 5. Wire the new onBlur handler to the input props.
|
|
1882
|
-
onBlur:
|
|
1883
|
-
ref:
|
|
1884
|
-
} :
|
|
1862
|
+
onBlur: G,
|
|
1863
|
+
ref: ht.getState().getFormRef(t + "." + r.join("."))
|
|
1864
|
+
} : d[W];
|
|
1885
1865
|
}
|
|
1886
1866
|
});
|
|
1887
|
-
return /* @__PURE__ */
|
|
1867
|
+
return /* @__PURE__ */ rt(Vt, { formOpts: v, path: r, stateKey: t, children: m(Q) });
|
|
1888
1868
|
}
|
|
1889
|
-
function
|
|
1890
|
-
const m = `${
|
|
1891
|
-
|
|
1892
|
-
const { registerComponent: v, unregisterComponent:
|
|
1893
|
-
return v(
|
|
1869
|
+
function Pt(t, r, y) {
|
|
1870
|
+
const m = `${t}////${r}`;
|
|
1871
|
+
lt(() => {
|
|
1872
|
+
const { registerComponent: v, unregisterComponent: g } = a.getState();
|
|
1873
|
+
return v(t, m, {
|
|
1894
1874
|
forceUpdate: () => y({}),
|
|
1895
1875
|
paths: /* @__PURE__ */ new Set(),
|
|
1896
1876
|
reactiveType: ["component"]
|
|
1897
1877
|
}), () => {
|
|
1898
|
-
|
|
1878
|
+
g(t, m);
|
|
1899
1879
|
};
|
|
1900
|
-
}, [
|
|
1880
|
+
}, [t, m]);
|
|
1901
1881
|
}
|
|
1902
1882
|
export {
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1883
|
+
Tt as $cogsSignal,
|
|
1884
|
+
ne as addStateOptions,
|
|
1885
|
+
Nt as createCogsState,
|
|
1886
|
+
oe as createCogsStateFromSync,
|
|
1887
|
+
se as notifyComponent,
|
|
1888
|
+
Wt as useCogsStateFn
|
|
1909
1889
|
};
|
|
1910
1890
|
//# sourceMappingURL=CogsState.jsx.map
|