@seedprotocol/react 0.4.29 → 0.4.31
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/index.js +2300 -2216
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2266 +1,2350 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { flushSync as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { useSelector as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { toSnakeCase as
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function je() {
|
|
17
|
-
return nt(Ke);
|
|
1
|
+
import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
2
|
+
import { flushSync as l } from "react-dom";
|
|
3
|
+
import { BaseDb as u, BaseFileManager as d, ClientManagerState as f, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as p, Item as m, ItemProperty as h, Model as g, ModelProperty as _, SEED_PROTOCOL_SCHEMA_NAME as v, Schema as y, appState as b, client as x, createNewItem as S, easSyncProcesses as C, eventEmitter as w, getAddressesForItemsFilter as T, getClient as E, getPropertySchema as D, getSchemaNameFromId as ee, getVersionData as te, loadAllSchemasFromDb as ne, metadata as O, modelSchemas as k, models as A, normalizeFeedItemFields as re, properties as j, resolveMediaRef as ie, schemas as M, seeds as N } from "@seedprotocol/sdk";
|
|
4
|
+
import { debounce as ae, orderBy as oe, startCase as se } from "lodash-es";
|
|
5
|
+
import P from "debug";
|
|
6
|
+
import { useSelector as ce } from "@xstate/react";
|
|
7
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
8
|
+
import { and as le, desc as ue, eq as R, gt as de, inArray as fe, isNotNull as pe, isNull as z, like as me, or as B, sql as he } from "drizzle-orm";
|
|
9
|
+
import { toSnakeCase as ge } from "drizzle-orm/casing";
|
|
10
|
+
import { QueryClient as _e, QueryClientProvider as ve, useQuery as V, useQueryClient as H } from "@tanstack/react-query";
|
|
11
|
+
import ye from "pluralize";
|
|
12
|
+
//#region src/client.ts
|
|
13
|
+
var U = () => ce(E().getService(), (e) => e.value === f.IDLE), W = "addresses.persisted", be = t(0);
|
|
14
|
+
function G() {
|
|
15
|
+
return r(be);
|
|
18
16
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
function xe({ queryClient: e, children: t }) {
|
|
18
|
+
let [r, a] = c(0), o = n(() => {
|
|
19
|
+
e.invalidateQueries({
|
|
20
|
+
queryKey: ["seed", "items"],
|
|
21
|
+
exact: !1
|
|
22
|
+
}), a((e) => e + 1);
|
|
23
|
+
}, [e]);
|
|
24
|
+
return i(() => (w.on(W, o), () => {
|
|
25
|
+
w.off(W, o);
|
|
26
|
+
}), [o]), /* @__PURE__ */ I(be.Provider, {
|
|
27
|
+
value: r,
|
|
28
|
+
children: t
|
|
29
|
+
});
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
}, [a]), t;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/liveQuery.ts
|
|
33
|
+
function K(e) {
|
|
34
|
+
let [t, n] = c(void 0), r = s(null), a = U(), l = o(() => {
|
|
35
|
+
if (!a || !e) return null;
|
|
36
|
+
try {
|
|
37
|
+
return u.liveQuery(e);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return console.error("[useLiveQuery] Failed to create live query:", e), null;
|
|
40
|
+
}
|
|
41
|
+
}, [e, a]);
|
|
42
|
+
return i(() => {
|
|
43
|
+
if (r.current && (r.current.unsubscribe(), r.current = null), l) return r.current = l.subscribe({
|
|
44
|
+
next: (e) => {
|
|
45
|
+
n(e === void 0 ? void 0 : [...e]);
|
|
46
|
+
},
|
|
47
|
+
error: (e) => {
|
|
48
|
+
console.error("[useLiveQuery] Error:", e);
|
|
49
|
+
}
|
|
50
|
+
}), () => {
|
|
51
|
+
r.current && (r.current.unsubscribe(), r.current = null);
|
|
52
|
+
};
|
|
53
|
+
}, [l]), t;
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/item.ts
|
|
57
|
+
var q = P("seedSdk:react:item"), Se = ({ modelName: e, seedLocalId: t, seedUid: r }) => {
|
|
58
|
+
let [a, l] = c(), [, u] = c(0), [d, f] = c(!!(t || r)), [h, g] = c(null), _ = s(void 0), v = s(!1), y = U(), b = G(), x = s(e), S = s(t), C = s(r), T = o(() => y ? !!(S.current || C.current) : !1, [
|
|
59
|
+
y,
|
|
60
|
+
t,
|
|
61
|
+
r
|
|
62
|
+
]), E = n(async () => {
|
|
63
|
+
if (!(y && (S.current || C.current))) {
|
|
64
|
+
l(void 0), f(!1), g(null);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
g(null);
|
|
69
|
+
let e = await m.find({
|
|
70
|
+
modelName: x.current,
|
|
71
|
+
seedLocalId: S.current,
|
|
72
|
+
seedUid: C.current
|
|
73
|
+
});
|
|
74
|
+
if (!e) {
|
|
75
|
+
q("[useItem] [loadItem] no item found", x.current, S.current), l((e) => {
|
|
76
|
+
if (e) return e.seedLocalId && e.seedLocalId === S.current || e.seedUid && e.seedUid === C.current ? e : void 0;
|
|
77
|
+
}), f(!1), g(null);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
l(e), f(!1), g(null);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
q("[useItem] Error loading item:", e), l(void 0), f(!1), g(e);
|
|
83
|
+
}
|
|
84
|
+
}, [y]), D = s(E);
|
|
85
|
+
return i(() => {
|
|
86
|
+
D.current = E;
|
|
87
|
+
}, [E]), i(() => {
|
|
88
|
+
x.current = e, S.current = t, C.current = r;
|
|
89
|
+
}, [
|
|
90
|
+
e,
|
|
91
|
+
t,
|
|
92
|
+
r
|
|
93
|
+
]), i(() => {
|
|
94
|
+
let e = () => {
|
|
95
|
+
u((e) => e + 1), D.current();
|
|
96
|
+
};
|
|
97
|
+
return w.on(p, e), () => {
|
|
98
|
+
w.off(p, e);
|
|
99
|
+
};
|
|
100
|
+
}, []), i(() => {
|
|
101
|
+
if (!T) {
|
|
102
|
+
!t && !r && (l(void 0), f(!1), g(null));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
E();
|
|
106
|
+
}, [
|
|
107
|
+
T,
|
|
108
|
+
E,
|
|
109
|
+
t,
|
|
110
|
+
r,
|
|
111
|
+
b
|
|
112
|
+
]), i(() => {
|
|
113
|
+
if (!a) {
|
|
114
|
+
_.current?.unsubscribe(), _.current = void 0, v.current = !1;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
return _.current?.unsubscribe(), v.current = !1, _.current = a.getService().subscribe((e) => {
|
|
118
|
+
e && typeof e == "object" && "value" in e && (e.value === "idle" ? (v.current = !0, f(!1), g(null)) : e.value === "error" ? (g(/* @__PURE__ */ Error("Item service error")), f(!1)) : v.current && f(!0));
|
|
119
|
+
}), () => {
|
|
120
|
+
_.current?.unsubscribe(), _.current = void 0;
|
|
121
|
+
};
|
|
122
|
+
}, [a]), {
|
|
123
|
+
item: a,
|
|
124
|
+
isLoading: d,
|
|
125
|
+
error: h
|
|
126
|
+
};
|
|
127
|
+
}, Ce = (e, t, n, r, i) => [
|
|
128
|
+
"seed",
|
|
129
|
+
"items",
|
|
130
|
+
e ?? null,
|
|
131
|
+
t ?? !1,
|
|
132
|
+
n ?? !1,
|
|
133
|
+
r ?? null,
|
|
134
|
+
i ?? 0
|
|
135
|
+
], we = ({ modelName: e, deleted: t = !1, includeEas: n = !1, addressFilter: r }) => {
|
|
136
|
+
let a = U(), l = G(), d = H();
|
|
137
|
+
i(() => {
|
|
138
|
+
let e = () => {
|
|
139
|
+
d.invalidateQueries({ queryKey: ["seed", "items"] });
|
|
140
|
+
};
|
|
141
|
+
return w.on(p, e), () => {
|
|
142
|
+
w.off(p, e);
|
|
143
|
+
};
|
|
144
|
+
}, [d]);
|
|
145
|
+
let f = s([]), h = s(/* @__PURE__ */ new Set()), g = s(!1), [_, v] = c(null);
|
|
146
|
+
i(() => {
|
|
147
|
+
if (r !== "owned" && r !== "watched") {
|
|
148
|
+
v(null);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
let e = !1;
|
|
152
|
+
return T(r).then((t) => {
|
|
153
|
+
e || v(t);
|
|
154
|
+
}), () => {
|
|
155
|
+
e = !0;
|
|
156
|
+
};
|
|
157
|
+
}, [r, l]);
|
|
158
|
+
let y = o(() => Ce(e, t, n, r, l), [
|
|
159
|
+
e,
|
|
160
|
+
t,
|
|
161
|
+
n,
|
|
162
|
+
r,
|
|
163
|
+
l
|
|
164
|
+
]);
|
|
165
|
+
i(() => {
|
|
166
|
+
g.current = !1;
|
|
167
|
+
}, [y]);
|
|
168
|
+
let { data: b = [], isLoading: x, error: S } = V({
|
|
169
|
+
queryKey: y,
|
|
170
|
+
queryFn: async () => await m.all(e, t, {
|
|
171
|
+
waitForReady: !0,
|
|
172
|
+
includeEas: n,
|
|
173
|
+
addressFilter: r
|
|
174
|
+
}),
|
|
175
|
+
enabled: a,
|
|
176
|
+
staleTime: 0
|
|
177
|
+
});
|
|
178
|
+
f.current = b;
|
|
179
|
+
let C = a ? u.getAppDb() : null, E = K(o(() => {
|
|
180
|
+
if (!C || (r === "owned" || r === "watched") && _ === null) return null;
|
|
181
|
+
let i = [];
|
|
182
|
+
n || i.push(B(z(N.uid), R(N.uid, ""))), e && i.push(R(N.type, ge(e))), r === "owned" ? _ && _.length > 0 && i.push(B(fe(N.publisher, _), z(N.publisher))) : r === "watched" && (_ && _.length > 0 ? i.push(fe(N.publisher, _)) : i.push(he`1=0`)), t ? i.push(B(pe(N._markedForDeletion), R(N._markedForDeletion, 1))) : (i.push(B(z(N._markedForDeletion), R(N._markedForDeletion, 0))), i.push(B(z(N.revokedAt), R(N.revokedAt, 0))));
|
|
183
|
+
let a = te();
|
|
184
|
+
return C.with(a).select({
|
|
185
|
+
localId: N.localId,
|
|
186
|
+
uid: N.uid,
|
|
187
|
+
type: N.type,
|
|
188
|
+
schemaUid: N.schemaUid,
|
|
189
|
+
createdAt: N.createdAt,
|
|
190
|
+
attestationCreatedAt: N.attestationCreatedAt,
|
|
191
|
+
_markedForDeletion: N._markedForDeletion
|
|
192
|
+
}).from(N).leftJoin(a, R(N.localId, a.seedLocalId)).where(le(de(a.versionsCount, 0), ...i)).groupBy(N.localId);
|
|
193
|
+
}, [
|
|
194
|
+
C,
|
|
195
|
+
a,
|
|
196
|
+
e,
|
|
197
|
+
t,
|
|
198
|
+
n,
|
|
199
|
+
r,
|
|
200
|
+
_
|
|
201
|
+
]));
|
|
202
|
+
return i(() => {
|
|
203
|
+
if (!a || !E) return;
|
|
204
|
+
let e = /* @__PURE__ */ new Set();
|
|
205
|
+
for (let t of E) {
|
|
206
|
+
let n = t.localId || t.uid;
|
|
207
|
+
n && e.add(n);
|
|
208
|
+
}
|
|
209
|
+
let t = /* @__PURE__ */ new Set();
|
|
210
|
+
for (let e of f.current) {
|
|
211
|
+
let n = e.seedLocalId || e.seedUid;
|
|
212
|
+
n && t.add(n);
|
|
213
|
+
}
|
|
214
|
+
if (e.size === 0 && t.size > 0) return;
|
|
215
|
+
if (!g.current && (g.current = !0, e.size > 0 && t.size === 0)) {
|
|
216
|
+
h.current = new Set(e), d.invalidateQueries({ queryKey: y });
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
let n = h.current;
|
|
220
|
+
if (!(n.size === e.size && [...n].every((t) => e.has(t)))) {
|
|
221
|
+
if (t.size === e.size && [...t].every((t) => e.has(t))) {
|
|
222
|
+
h.current = new Set(e);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
h.current = new Set(e), d.invalidateQueries({ queryKey: y });
|
|
226
|
+
}
|
|
227
|
+
}, [
|
|
228
|
+
a,
|
|
229
|
+
E,
|
|
230
|
+
d,
|
|
231
|
+
y
|
|
232
|
+
]), {
|
|
233
|
+
items: oe(b, [(e) => e.lastVersionPublishedAt || e.attestationCreatedAt || e.createdAt], ["desc"]),
|
|
234
|
+
isLoading: x,
|
|
235
|
+
error: S
|
|
236
|
+
};
|
|
237
|
+
}, Te = () => {
|
|
238
|
+
let [e, t] = c(!1), [r, i] = c(null), a = n(() => i(null), []);
|
|
239
|
+
return {
|
|
240
|
+
createItem: n(async (n, r) => {
|
|
241
|
+
if (e) {
|
|
242
|
+
q("[useCreateItem] [createItem] already creating item, skipping");
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
i(null), l(() => t(!0));
|
|
246
|
+
try {
|
|
247
|
+
let { seedLocalId: e } = await S({
|
|
248
|
+
modelName: n,
|
|
249
|
+
...r ?? {}
|
|
250
|
+
});
|
|
251
|
+
return await m.find({
|
|
252
|
+
modelName: n,
|
|
253
|
+
seedLocalId: e
|
|
254
|
+
}) ?? void 0;
|
|
255
|
+
} catch (e) {
|
|
256
|
+
q("[useCreateItem] Error creating item:", e), i(e instanceof Error ? e : Error(String(e)));
|
|
257
|
+
return;
|
|
258
|
+
} finally {
|
|
259
|
+
queueMicrotask(() => t(!1));
|
|
260
|
+
}
|
|
261
|
+
}, [e]),
|
|
262
|
+
isLoading: e,
|
|
263
|
+
error: r,
|
|
264
|
+
resetError: a
|
|
265
|
+
};
|
|
266
|
+
}, Ee = () => {
|
|
267
|
+
let [e, t] = c(null), [r, a] = c(!1), [o, l] = c(null), u = s(void 0), d = n(() => l(null), []), f = n((e) => {
|
|
268
|
+
e && (t(e), l(null), e.publish().catch(() => {}));
|
|
269
|
+
}, []);
|
|
270
|
+
return i(() => {
|
|
271
|
+
if (!e) {
|
|
272
|
+
u.current?.unsubscribe(), u.current = void 0, a(!1);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
u.current?.unsubscribe();
|
|
276
|
+
let t = e.getService();
|
|
277
|
+
u.current = t.subscribe((e) => {
|
|
278
|
+
let t = e?.value, n = e?.context;
|
|
279
|
+
a(t === "publishing");
|
|
280
|
+
let r = n?._publishError;
|
|
281
|
+
l(r ? Error(r.message) : null);
|
|
282
|
+
});
|
|
283
|
+
let n = t.getSnapshot();
|
|
284
|
+
a(n?.value === "publishing");
|
|
285
|
+
let r = n?.context?._publishError;
|
|
286
|
+
return l(r ? Error(r.message) : null), () => {
|
|
287
|
+
u.current?.unsubscribe(), u.current = void 0;
|
|
288
|
+
};
|
|
289
|
+
}, [e]), {
|
|
290
|
+
publishItem: f,
|
|
291
|
+
isLoading: r,
|
|
292
|
+
error: o,
|
|
293
|
+
resetError: d
|
|
294
|
+
};
|
|
295
|
+
}, J = P("seedSdk:react:property"), Y = P("seedSdk:react:itemProperties");
|
|
296
|
+
function De(e, t) {
|
|
297
|
+
let r = U(), [l, u] = c(void 0), [d, f] = c(!1), [p, m] = c(null), g = s(void 0), [, _] = c(0), v = typeof e == "object" && e ? e : null, y = v?.itemId, b = v?.seedLocalId, x = v?.seedUid, S = v?.propertyName, C = typeof e == "string" ? e : y !== void 0 && y !== "" ? y : void 0, w = S ?? (typeof e == "string" ? t : void 0), T = o(() => {
|
|
298
|
+
let e = C !== void 0 && C !== "" ? C : b, t = C !== void 0 && C !== "" ? void 0 : x;
|
|
299
|
+
return (e != null || t != null) && w != null && w !== "" ? {
|
|
300
|
+
type: "identifiers",
|
|
301
|
+
seedLocalId: e ?? void 0,
|
|
302
|
+
seedUid: t,
|
|
303
|
+
propertyName: w
|
|
304
|
+
} : null;
|
|
305
|
+
}, [
|
|
306
|
+
C,
|
|
307
|
+
w,
|
|
308
|
+
b,
|
|
309
|
+
x
|
|
310
|
+
]);
|
|
311
|
+
o(() => T ? !!((T.seedLocalId || T.seedUid) && T.propertyName) : !1, [T]);
|
|
312
|
+
let E = o(() => !r || !T ? !1 : !!((T.seedLocalId || T.seedUid) && T.propertyName), [r, T]);
|
|
313
|
+
a(() => {
|
|
314
|
+
E && f(!0);
|
|
315
|
+
}, [E]);
|
|
316
|
+
let D = n(async () => {
|
|
317
|
+
if (!r || !T) {
|
|
318
|
+
u(void 0), f(!1), m(null);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
try {
|
|
322
|
+
f(!0), m(null);
|
|
323
|
+
let e = T.seedLocalId, t = T.seedUid;
|
|
324
|
+
if (!e && !t) {
|
|
325
|
+
u(void 0), f(!1), m(null);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
let n = await h.find({
|
|
329
|
+
propertyName: T.propertyName,
|
|
330
|
+
seedLocalId: e,
|
|
331
|
+
seedUid: t
|
|
332
|
+
});
|
|
333
|
+
if (!n) {
|
|
334
|
+
J(`[useItemProperty] [updateItemProperty] no property found for Item.${e || t}.${T.propertyName}`), u(void 0), f(!1), m(null);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
u(n), f(!1), m(null);
|
|
338
|
+
} catch (e) {
|
|
339
|
+
J("[useItemProperty] Error updating item property:", e), u(void 0), f(!1), m(e);
|
|
340
|
+
}
|
|
341
|
+
}, [r, T]);
|
|
342
|
+
return i(() => {
|
|
343
|
+
if (!E) {
|
|
344
|
+
u(void 0), f(!1), m(null);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
l && T && l.propertyName === T.propertyName && (T.seedLocalId != null && l.seedLocalId === T.seedLocalId || T.seedUid != null && l.seedUid === T.seedUid) || D();
|
|
348
|
+
}, [
|
|
349
|
+
E,
|
|
350
|
+
D,
|
|
351
|
+
l,
|
|
352
|
+
T
|
|
353
|
+
]), i(() => {
|
|
354
|
+
if (!l) {
|
|
355
|
+
g.current?.unsubscribe(), g.current = void 0;
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
g.current?.unsubscribe();
|
|
359
|
+
let e = 0, t = !1, n;
|
|
360
|
+
return g.current = l.getService().subscribe((r) => {
|
|
361
|
+
if (r && typeof r == "object" && "value" in r && r.value === "idle") {
|
|
362
|
+
f(!1), m(null);
|
|
363
|
+
let e = r.context, i = JSON.stringify([e.renderValue, e.propertyValue]);
|
|
364
|
+
(!t || i !== n) && (t = !0, n = i, _((e) => e + 1));
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
t = !1, n = void 0;
|
|
368
|
+
let i = Date.now();
|
|
369
|
+
i - e >= 50 && (e = i, _((e) => e + 1));
|
|
370
|
+
}), () => {
|
|
371
|
+
g.current?.unsubscribe(), g.current = void 0;
|
|
372
|
+
};
|
|
373
|
+
}, [l]), {
|
|
374
|
+
property: l,
|
|
375
|
+
isLoading: d,
|
|
376
|
+
error: p
|
|
377
|
+
};
|
|
374
378
|
}
|
|
375
|
-
function
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
379
|
+
function Oe(e, t = 300) {
|
|
380
|
+
let r = "itemId" in e ? e.itemId : void 0, a = "seedLocalId" in e ? e.seedLocalId : void 0, c = "seedUid" in e ? e.seedUid : void 0, l = e.propertyName, { property: u, isLoading: d, error: f } = De(o(() => r ? {
|
|
381
|
+
seedLocalId: r,
|
|
382
|
+
propertyName: l
|
|
383
|
+
} : {
|
|
384
|
+
seedLocalId: a,
|
|
385
|
+
seedUid: c,
|
|
386
|
+
propertyName: l
|
|
387
|
+
}, [
|
|
388
|
+
r,
|
|
389
|
+
a,
|
|
390
|
+
c,
|
|
391
|
+
l
|
|
392
|
+
])), p = s(""), m = o(() => ae((e) => {
|
|
393
|
+
e.getService().send({
|
|
394
|
+
type: "save",
|
|
395
|
+
newValue: p.current
|
|
396
|
+
});
|
|
397
|
+
}, t), [t]);
|
|
398
|
+
return i(() => () => m.cancel(), [m]), {
|
|
399
|
+
property: u,
|
|
400
|
+
setValue: n((e) => {
|
|
401
|
+
u && (p.current = e, u.getService().send({
|
|
402
|
+
type: "updateContext",
|
|
403
|
+
propertyValue: e,
|
|
404
|
+
renderValue: e
|
|
405
|
+
}), m(u));
|
|
406
|
+
}, [u, m]),
|
|
407
|
+
isLoading: d,
|
|
408
|
+
error: f
|
|
409
|
+
};
|
|
402
410
|
}
|
|
403
|
-
async function
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
seedLocalId: u || void 0,
|
|
463
|
-
seedUid: f || void 0,
|
|
464
|
-
propertyValue: l[0].createdAt.toString()
|
|
465
|
-
},
|
|
466
|
-
{ waitForReady: !1 }
|
|
467
|
-
);
|
|
468
|
-
b && o.push(b);
|
|
469
|
-
} catch (u) {
|
|
470
|
-
he("[useItemProperties] Error creating createdAt ItemProperty:", u);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
return o;
|
|
411
|
+
async function ke(e, t) {
|
|
412
|
+
if (!e && !t) return [];
|
|
413
|
+
let n = u.getAppDb();
|
|
414
|
+
if (!n) return [];
|
|
415
|
+
let r = await h.all({
|
|
416
|
+
seedLocalId: e ?? void 0,
|
|
417
|
+
seedUid: t ?? void 0
|
|
418
|
+
}, { waitForReady: !0 }), i = [...r], a = /* @__PURE__ */ new Set();
|
|
419
|
+
for (let e of r) e.propertyName && a.add(e.propertyName);
|
|
420
|
+
let o;
|
|
421
|
+
if (r.length > 0) {
|
|
422
|
+
let e = r[0];
|
|
423
|
+
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o = se(o));
|
|
424
|
+
}
|
|
425
|
+
if (!o) {
|
|
426
|
+
let r = await n.select({ type: N.type }).from(N).where(t ? R(N.uid, t) : R(N.localId, e)).limit(1);
|
|
427
|
+
r.length > 0 && r[0].type && (o = se(r[0].type));
|
|
428
|
+
}
|
|
429
|
+
let s = [];
|
|
430
|
+
if (o) try {
|
|
431
|
+
let { Model: e } = await import("@seedprotocol/sdk"), t = await e.getByNameAsync(o);
|
|
432
|
+
if (t?.properties) for (let e of t.properties) e.name && s.push(e.name);
|
|
433
|
+
} catch (e) {
|
|
434
|
+
Y(`[useItemProperties] Error getting ModelProperties for ${o}:`, e);
|
|
435
|
+
}
|
|
436
|
+
if (o && s.length > 0) {
|
|
437
|
+
let n = r.length > 0 ? r[0].seedLocalId ?? e : e, c = r.length > 0 ? r[0].seedUid ?? t : t;
|
|
438
|
+
for (let e of s) if (!a.has(e)) try {
|
|
439
|
+
let t = h.create({
|
|
440
|
+
propertyName: e,
|
|
441
|
+
modelName: o,
|
|
442
|
+
seedLocalId: n || void 0,
|
|
443
|
+
seedUid: c || void 0,
|
|
444
|
+
propertyValue: null
|
|
445
|
+
}, { waitForReady: !1 });
|
|
446
|
+
t && i.push(t);
|
|
447
|
+
} catch (t) {
|
|
448
|
+
J(`[useItemProperties] Error creating ItemProperty for missing property ${e}:`, t);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (e || t) {
|
|
452
|
+
let a = await n.select({ createdAt: N.createdAt }).from(N).where(t ? R(N.uid, t) : R(N.localId, e)).limit(1);
|
|
453
|
+
if (a.length > 0 && a[0].createdAt) {
|
|
454
|
+
let n = "createdAt";
|
|
455
|
+
if (!i.some((e) => e.propertyName === n) && o) try {
|
|
456
|
+
let s = r.length > 0 ? r[0].seedLocalId ?? e : e, c = r.length > 0 ? r[0].seedUid ?? t : t, l = h.create({
|
|
457
|
+
propertyName: n,
|
|
458
|
+
modelName: o,
|
|
459
|
+
seedLocalId: s || void 0,
|
|
460
|
+
seedUid: c || void 0,
|
|
461
|
+
propertyValue: a[0].createdAt.toString()
|
|
462
|
+
}, { waitForReady: !1 });
|
|
463
|
+
l && i.push(l);
|
|
464
|
+
} catch (e) {
|
|
465
|
+
J("[useItemProperties] Error creating createdAt ItemProperty:", e);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return i;
|
|
475
470
|
}
|
|
476
|
-
function
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
n.current = void 0;
|
|
564
|
-
}, [a, s]), {
|
|
565
|
-
properties: i,
|
|
566
|
-
isLoading: d,
|
|
567
|
-
error: u
|
|
568
|
-
};
|
|
471
|
+
function Ae(e) {
|
|
472
|
+
let t = U(), n = H(), r = s(void 0), a = o(() => typeof e == "string" ? {
|
|
473
|
+
type: "itemId",
|
|
474
|
+
itemId: e
|
|
475
|
+
} : typeof e == "object" ? {
|
|
476
|
+
type: "identifiers",
|
|
477
|
+
seedLocalId: e.seedLocalId,
|
|
478
|
+
seedUid: e.seedUid
|
|
479
|
+
} : null, [e]), c = o(() => {
|
|
480
|
+
if (a) return a.type === "itemId" ? a.itemId : a.seedLocalId;
|
|
481
|
+
}, [a]), l = o(() => {
|
|
482
|
+
if (!(!a || a.type === "itemId")) return a.seedUid;
|
|
483
|
+
}, [a]), d = c ?? l ?? "", f = o(() => [
|
|
484
|
+
"seed",
|
|
485
|
+
"itemProperties",
|
|
486
|
+
d
|
|
487
|
+
], [d]), { data: p = [], isLoading: m, error: h } = V({
|
|
488
|
+
queryKey: f,
|
|
489
|
+
queryFn: () => ke(c, l),
|
|
490
|
+
enabled: t && !!d
|
|
491
|
+
}), g = K(o(() => {
|
|
492
|
+
if (!t || !c && !l) return Y("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
493
|
+
let e = u.getAppDb();
|
|
494
|
+
if (!e) return Y("[useItemProperties] Query: returning null (no db)"), null;
|
|
495
|
+
Y(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${l}`);
|
|
496
|
+
let n = l ? e.select({
|
|
497
|
+
propertyName: O.propertyName,
|
|
498
|
+
propertyValue: O.propertyValue,
|
|
499
|
+
seedLocalId: O.seedLocalId,
|
|
500
|
+
seedUid: O.seedUid,
|
|
501
|
+
modelType: O.modelType,
|
|
502
|
+
schemaUid: O.schemaUid,
|
|
503
|
+
createdAt: O.createdAt,
|
|
504
|
+
attestationCreatedAt: O.attestationCreatedAt
|
|
505
|
+
}).from(O).where(le(R(O.seedUid, l), pe(O.propertyName))) : c ? e.select({
|
|
506
|
+
propertyName: O.propertyName,
|
|
507
|
+
propertyValue: O.propertyValue,
|
|
508
|
+
seedLocalId: O.seedLocalId,
|
|
509
|
+
seedUid: O.seedUid,
|
|
510
|
+
modelType: O.modelType,
|
|
511
|
+
schemaUid: O.schemaUid,
|
|
512
|
+
createdAt: O.createdAt,
|
|
513
|
+
attestationCreatedAt: O.attestationCreatedAt
|
|
514
|
+
}).from(O).where(le(R(O.seedLocalId, c), pe(O.propertyName))) : null;
|
|
515
|
+
return Y("[useItemProperties] Query: created query object", { queryType: l ? "seedUid" : "seedLocalId" }), n;
|
|
516
|
+
}, [
|
|
517
|
+
t,
|
|
518
|
+
c,
|
|
519
|
+
l
|
|
520
|
+
])), _ = o(() => {
|
|
521
|
+
if (!g || g.length === 0) return [];
|
|
522
|
+
let e = /* @__PURE__ */ new Map();
|
|
523
|
+
for (let t of g) {
|
|
524
|
+
if (!t.propertyName) continue;
|
|
525
|
+
let n = e.get(t.propertyName);
|
|
526
|
+
if (!n) e.set(t.propertyName, t);
|
|
527
|
+
else {
|
|
528
|
+
let r = n.attestationCreatedAt || n.createdAt || 0;
|
|
529
|
+
(t.attestationCreatedAt || t.createdAt || 0) > r && e.set(t.propertyName, t);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return Array.from(e.values());
|
|
533
|
+
}, [g]);
|
|
534
|
+
return i(() => {
|
|
535
|
+
if (!t || !c && !l || _ === void 0) return;
|
|
536
|
+
let e = JSON.stringify(_.map((e) => ({
|
|
537
|
+
propertyName: e.propertyName,
|
|
538
|
+
propertyValue: e.propertyValue,
|
|
539
|
+
seedLocalId: e.seedLocalId,
|
|
540
|
+
seedUid: e.seedUid
|
|
541
|
+
})).sort((e, t) => (e.propertyName || "").localeCompare(t.propertyName || "")));
|
|
542
|
+
r.current !== e && (r.current = e, _.length > 0 && n.invalidateQueries({ queryKey: f }));
|
|
543
|
+
}, [
|
|
544
|
+
t,
|
|
545
|
+
_,
|
|
546
|
+
p,
|
|
547
|
+
c,
|
|
548
|
+
l,
|
|
549
|
+
n,
|
|
550
|
+
f
|
|
551
|
+
]), i(() => {
|
|
552
|
+
r.current = void 0;
|
|
553
|
+
}, [c, l]), {
|
|
554
|
+
properties: p,
|
|
555
|
+
isLoading: m,
|
|
556
|
+
error: h
|
|
557
|
+
};
|
|
569
558
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
};
|
|
751
|
-
}, _t = () => {
|
|
752
|
-
const t = ge().getService(), r = Le(t, (o) => o.value), n = Le(t, (o) => {
|
|
753
|
-
const a = o.value;
|
|
754
|
-
return a === P.DB_INIT || a === P.SAVE_CONFIG || a === P.PROCESS_SCHEMA_FILES || a === P.ADD_MODELS_TO_STORE || a === P.ADD_MODELS_TO_DB || a === P.IDLE ? "ready" : a;
|
|
755
|
-
});
|
|
756
|
-
return {
|
|
757
|
-
status: r,
|
|
758
|
-
internalStatus: n
|
|
759
|
-
};
|
|
559
|
+
var je = () => {
|
|
560
|
+
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
561
|
+
if (!t.propertyName || !t.seedLocalId && !t.seedUid || !t.modelName) {
|
|
562
|
+
o(/* @__PURE__ */ Error("seedLocalId or seedUid, propertyName, and modelName are required"));
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
o(null), r(!0), e.current?.unsubscribe(), e.current = void 0;
|
|
566
|
+
let n = h.create(t, { waitForReady: !1 });
|
|
567
|
+
if (!n) {
|
|
568
|
+
o(/* @__PURE__ */ Error("Failed to create item property")), r(!1);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
return e.current = n.getService().subscribe((e) => {
|
|
572
|
+
if (e?.value === "error") {
|
|
573
|
+
let t = e.context?._loadingError?.error ?? /* @__PURE__ */ Error("Failed to create item property");
|
|
574
|
+
o(t instanceof Error ? t : Error(String(t))), r(!1);
|
|
575
|
+
}
|
|
576
|
+
e?.value === "idle" && (o(null), r(!1));
|
|
577
|
+
}), n;
|
|
578
|
+
}, []);
|
|
579
|
+
return i(() => () => {
|
|
580
|
+
e.current?.unsubscribe(), e.current = void 0;
|
|
581
|
+
}, []), {
|
|
582
|
+
create: u,
|
|
583
|
+
isLoading: t,
|
|
584
|
+
error: a,
|
|
585
|
+
resetError: l
|
|
586
|
+
};
|
|
587
|
+
}, Me = () => {
|
|
588
|
+
let [e, t] = c(null), [r, a] = c({
|
|
589
|
+
isLoading: !1,
|
|
590
|
+
error: null
|
|
591
|
+
});
|
|
592
|
+
i(() => {
|
|
593
|
+
if (!e) {
|
|
594
|
+
a({
|
|
595
|
+
isLoading: !1,
|
|
596
|
+
error: null
|
|
597
|
+
});
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
let t = e.getService(), n = () => {
|
|
601
|
+
let e = t.getSnapshot().context;
|
|
602
|
+
a({
|
|
603
|
+
isLoading: !!e._destroyInProgress,
|
|
604
|
+
error: e._destroyError ? Error(e._destroyError.message) : null
|
|
605
|
+
});
|
|
606
|
+
};
|
|
607
|
+
n();
|
|
608
|
+
let r = t.subscribe(n);
|
|
609
|
+
return () => r.unsubscribe();
|
|
610
|
+
}, [e]);
|
|
611
|
+
let o = n(async (e) => {
|
|
612
|
+
e && (t(e), await e.destroy());
|
|
613
|
+
}, []), s = n(() => {
|
|
614
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
615
|
+
}, [e]);
|
|
616
|
+
return {
|
|
617
|
+
destroy: o,
|
|
618
|
+
isLoading: r.isLoading,
|
|
619
|
+
error: r.error,
|
|
620
|
+
resetError: s
|
|
621
|
+
};
|
|
622
|
+
}, Ne = P("seedSdk:react:services"), Pe = [
|
|
623
|
+
"idle",
|
|
624
|
+
"ready",
|
|
625
|
+
"done",
|
|
626
|
+
"success",
|
|
627
|
+
"initialized"
|
|
628
|
+
], Fe = (e) => {
|
|
629
|
+
let t = "actor", n = e;
|
|
630
|
+
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t = X(e)), t;
|
|
631
|
+
}, Ie = (e) => {
|
|
632
|
+
let t;
|
|
633
|
+
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), Fe(e) === "global" && t && typeof t == "object" && Object.keys(t).length > 0 && Object.keys(t)[0] === "initialized" && (t = "ready"), t && typeof t == "object" && (t = JSON.stringify(t)), t;
|
|
634
|
+
}, X = (e) => {
|
|
635
|
+
let t = e;
|
|
636
|
+
if (!e || !t.logic || !t.logic.config || !t._snapshot) return;
|
|
637
|
+
let n = t.logic.config;
|
|
638
|
+
if (!n.id) return;
|
|
639
|
+
let r = n.id;
|
|
640
|
+
n.id.includes("@seedSdk/") && (r = n.id.match(/^.*@seedSdk\/(\w+)[\.\w]*/)[1]);
|
|
641
|
+
let i;
|
|
642
|
+
try {
|
|
643
|
+
i = e.getSnapshot();
|
|
644
|
+
} catch (e) {
|
|
645
|
+
return Ne("Error:", e), r;
|
|
646
|
+
}
|
|
647
|
+
if (i) {
|
|
648
|
+
let e = i.context;
|
|
649
|
+
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r = ye(e.modelName.toLowerCase()));
|
|
650
|
+
}
|
|
651
|
+
return r;
|
|
652
|
+
}, Le = (e) => {
|
|
653
|
+
let [t, r] = c(0), a = (e) => {
|
|
654
|
+
let t = 0, n = e;
|
|
655
|
+
if (n.logic?.states) {
|
|
656
|
+
let r = [], i = [];
|
|
657
|
+
for (let [e, t] of Object.entries(n.logic.states)) t.tags?.includes("loading") && (r.push(e), i.push(t));
|
|
658
|
+
let a = i.length, o = Ie(e);
|
|
659
|
+
if (o && Pe.includes(o)) return 0;
|
|
660
|
+
o && (t = r.indexOf(o) / a * 100);
|
|
661
|
+
}
|
|
662
|
+
return t;
|
|
663
|
+
}, o = n((t) => {
|
|
664
|
+
e.getSnapshot().context;
|
|
665
|
+
let n = e.getSnapshot().value;
|
|
666
|
+
if (n === "done" || n === "success" || n === "idle" || n === "ready") {
|
|
667
|
+
clearInterval(t);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
r((e) => e + 1);
|
|
671
|
+
}, [e]), s = n(() => {
|
|
672
|
+
let e = setInterval(() => {
|
|
673
|
+
o(e);
|
|
674
|
+
}, 1e3);
|
|
675
|
+
return e;
|
|
676
|
+
}, [o, e]);
|
|
677
|
+
return i(() => {
|
|
678
|
+
let e = s();
|
|
679
|
+
return () => clearInterval(e);
|
|
680
|
+
}, []), {
|
|
681
|
+
name: Fe(e),
|
|
682
|
+
timeElapsed: t,
|
|
683
|
+
value: Ie(e),
|
|
684
|
+
percentComplete: a(e),
|
|
685
|
+
uniqueKey: X(e)
|
|
686
|
+
};
|
|
687
|
+
}, Re = () => {
|
|
688
|
+
let [e, t] = c(!1), { internalStatus: n } = He();
|
|
689
|
+
return i(() => {
|
|
690
|
+
n === "ready" && t(!0);
|
|
691
|
+
}, [n]), i(() => {
|
|
692
|
+
n === "ready" && t(!0);
|
|
693
|
+
}, []), e;
|
|
694
|
+
}, ze = () => {
|
|
695
|
+
let [e, t] = c(!1), r = Be(), { services: a, percentComplete: o } = Ve(), s = n(async () => {
|
|
696
|
+
for (let e of a) Ne(`would save to db with snapshot__${X(e)}:`, JSON.stringify(e.getPersistedSnapshot()));
|
|
697
|
+
}, [a]), l = n(async () => {
|
|
698
|
+
let e = u.getAppDb();
|
|
699
|
+
return e ? await e.select().from(b).where(me(b.key, "snapshot__%")) : [];
|
|
700
|
+
}, []);
|
|
701
|
+
i(() => !r || e ? void 0 : ((async () => {
|
|
702
|
+
Ne("persistedSnapshots:", await l()), t(!0);
|
|
703
|
+
})(), () => {
|
|
704
|
+
s();
|
|
705
|
+
}), [r, e]);
|
|
706
|
+
}, Be = () => {
|
|
707
|
+
let [e, t] = c(!1), n = Re();
|
|
708
|
+
return i(() => {
|
|
709
|
+
n && (async () => {
|
|
710
|
+
let e = await u.getAppDb().select().from(b).where(me(b.key, "snapshot__%"));
|
|
711
|
+
e && e.length > 0 && t(!0);
|
|
712
|
+
})();
|
|
713
|
+
}, [n]), e;
|
|
714
|
+
}, Ve = () => {
|
|
715
|
+
let [e, t] = c([]), [n, r] = c(5);
|
|
716
|
+
return i(() => {
|
|
717
|
+
let e = E().getService(), n = e;
|
|
718
|
+
n.uniqueKey = "clientManager", t([n]);
|
|
719
|
+
let i = e.subscribe((e) => {
|
|
720
|
+
let t = e.value, n = 0;
|
|
721
|
+
t === f.IDLE ? n = 100 : t === f.ADD_MODELS_TO_DB ? n = 90 : t === f.ADD_MODELS_TO_STORE ? n = 80 : t === f.PROCESS_SCHEMA_FILES ? n = 70 : t === f.SAVE_CONFIG ? n = 60 : t === f.DB_INIT ? n = 50 : t === f.FILE_SYSTEM_INIT ? n = 30 : t === f.PLATFORM_CLASSES_INIT && (n = 10), r(n);
|
|
722
|
+
});
|
|
723
|
+
return () => {
|
|
724
|
+
i.unsubscribe();
|
|
725
|
+
};
|
|
726
|
+
}, []), {
|
|
727
|
+
services: e,
|
|
728
|
+
percentComplete: n
|
|
729
|
+
};
|
|
730
|
+
}, He = () => {
|
|
731
|
+
let e = E().getService();
|
|
732
|
+
return {
|
|
733
|
+
status: ce(e, (e) => e.value),
|
|
734
|
+
internalStatus: ce(e, (e) => {
|
|
735
|
+
let t = e.value;
|
|
736
|
+
return t === f.DB_INIT || t === f.SAVE_CONFIG || t === f.PROCESS_SCHEMA_FILES || t === f.ADD_MODELS_TO_STORE || t === f.ADD_MODELS_TO_DB || t === f.IDLE ? "ready" : t;
|
|
737
|
+
})
|
|
738
|
+
};
|
|
760
739
|
};
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
},
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
error: r.error,
|
|
1131
|
-
resetError: a
|
|
1132
|
-
};
|
|
740
|
+
//#endregion
|
|
741
|
+
//#region src/db.ts
|
|
742
|
+
P("seedSdk:react:db");
|
|
743
|
+
var Ue = () => {
|
|
744
|
+
let [e, t] = c(!1), r = n(() => {
|
|
745
|
+
e || t(!0);
|
|
746
|
+
}, []);
|
|
747
|
+
return i(() => {
|
|
748
|
+
let e;
|
|
749
|
+
return (async () => {
|
|
750
|
+
let t = E().getService(), n = t.getSnapshot().value;
|
|
751
|
+
if (n === f.DB_INIT || n === f.SAVE_CONFIG || n === f.PROCESS_SCHEMA_FILES || n === f.ADD_MODELS_TO_STORE || n === f.ADD_MODELS_TO_DB || n === f.IDLE) {
|
|
752
|
+
r();
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
e = t.subscribe((t) => {
|
|
756
|
+
let n = t.value;
|
|
757
|
+
(n === f.DB_INIT || n === f.SAVE_CONFIG || n === f.PROCESS_SCHEMA_FILES || n === f.ADD_MODELS_TO_STORE || n === f.ADD_MODELS_TO_DB || n === f.IDLE) && (r(), e?.unsubscribe());
|
|
758
|
+
});
|
|
759
|
+
})(), () => {
|
|
760
|
+
e && e.unsubscribe();
|
|
761
|
+
};
|
|
762
|
+
}, []), { dbsAreReady: e };
|
|
763
|
+
}, We = P("seedSdk:react:schema"), Ge = (e) => {
|
|
764
|
+
let [t, r] = c(null), [a, o] = c(!!e), [u, d] = c(null), f = s(null), p = U(), m = n((e) => {
|
|
765
|
+
o(!0), d(null);
|
|
766
|
+
try {
|
|
767
|
+
let t = y.create(e, { waitForReady: !1 });
|
|
768
|
+
r(t);
|
|
769
|
+
let n = t.getService();
|
|
770
|
+
n.getSnapshot().value === "idle" ? (l(() => o(!1)), d(null)) : o(!0), f.current = n.subscribe((e) => {
|
|
771
|
+
e.value === "idle" ? (l(() => o(!1)), d(null)) : o(!0);
|
|
772
|
+
});
|
|
773
|
+
} catch (e) {
|
|
774
|
+
return We("[useSchema] Error creating schema:", e), d(e), r(null), o(!1), null;
|
|
775
|
+
}
|
|
776
|
+
}, []);
|
|
777
|
+
return i(() => {
|
|
778
|
+
if (f.current && (f.current.unsubscribe(), f.current = null), !p) {
|
|
779
|
+
r(null), d(null), o(!1);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
if (!e) {
|
|
783
|
+
r(null), d(null), o(!1);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
return m(e), () => {
|
|
787
|
+
f.current && (f.current.unsubscribe(), f.current = null);
|
|
788
|
+
};
|
|
789
|
+
}, [
|
|
790
|
+
e,
|
|
791
|
+
p,
|
|
792
|
+
m
|
|
793
|
+
]), {
|
|
794
|
+
schema: t,
|
|
795
|
+
isLoading: a,
|
|
796
|
+
error: u
|
|
797
|
+
};
|
|
798
|
+
}, Ke = ["seed", "schemas"], qe = () => {
|
|
799
|
+
let e = U(), t = H(), n = s(void 0), r = s([]), { data: a = [], isLoading: c, error: l } = V({
|
|
800
|
+
queryKey: Ke,
|
|
801
|
+
queryFn: () => y.all({ waitForReady: !0 }),
|
|
802
|
+
enabled: e
|
|
803
|
+
});
|
|
804
|
+
r.current = a;
|
|
805
|
+
let d = e ? u.getAppDb() : null, f = K(o(() => d ? d.select().from(M).orderBy(M.name, ue(M.version)) : null, [d, e]));
|
|
806
|
+
return i(() => {
|
|
807
|
+
if (typeof BroadcastChannel > "u") return;
|
|
808
|
+
let e = new BroadcastChannel("seed-schemas-invalidate"), n = () => {
|
|
809
|
+
t.invalidateQueries({ queryKey: Ke });
|
|
810
|
+
};
|
|
811
|
+
return e.addEventListener("message", n), () => {
|
|
812
|
+
e.removeEventListener("message", n), e.close();
|
|
813
|
+
};
|
|
814
|
+
}, [t]), i(() => {
|
|
815
|
+
if (!e || !f) return;
|
|
816
|
+
let i = n.current;
|
|
817
|
+
if ((i ? JSON.stringify(i) : "undefined") === (f ? JSON.stringify(f) : "undefined") && i !== void 0) return;
|
|
818
|
+
n.current = f;
|
|
819
|
+
let a = /* @__PURE__ */ new Set();
|
|
820
|
+
for (let e of r.current) {
|
|
821
|
+
let t = e.id || e.schemaFileId;
|
|
822
|
+
if (t) a.add(t);
|
|
823
|
+
else {
|
|
824
|
+
let t = e.metadata?.name, n = e.version;
|
|
825
|
+
t && n !== void 0 && a.add(`${t}:${n}`);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
let o = /* @__PURE__ */ new Set();
|
|
829
|
+
for (let e of f) e.name !== "Seed Protocol" && (e.schemaFileId ? o.add(e.schemaFileId) : e.name != null && e.version !== void 0 && o.add(`${e.name}:${e.version}`));
|
|
830
|
+
let s = a.size === o.size && [...a].every((e) => o.has(e)), c = a.size > 0 && o.size > 0 && [...o].some((e) => !a.has(e));
|
|
831
|
+
!s && c && t.invalidateQueries({ queryKey: Ke });
|
|
832
|
+
}, [
|
|
833
|
+
e,
|
|
834
|
+
f,
|
|
835
|
+
t
|
|
836
|
+
]), {
|
|
837
|
+
schemas: a,
|
|
838
|
+
isLoading: c,
|
|
839
|
+
error: l
|
|
840
|
+
};
|
|
841
|
+
}, Je = () => {
|
|
842
|
+
let e = s(null), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
843
|
+
o(null), r(!0), e.current?.unsubscribe(), e.current = null;
|
|
844
|
+
let n = y.create(t, { waitForReady: !1 });
|
|
845
|
+
return e.current = n.getService().subscribe((e) => {
|
|
846
|
+
if (e.value === "error") {
|
|
847
|
+
let t = e.context._loadingError?.error;
|
|
848
|
+
o(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to create schema")), r(!1);
|
|
849
|
+
}
|
|
850
|
+
e.value === "idle" && (o(null), r(!1));
|
|
851
|
+
}), n;
|
|
852
|
+
}, []);
|
|
853
|
+
return i(() => () => {
|
|
854
|
+
e.current?.unsubscribe(), e.current = null;
|
|
855
|
+
}, []), {
|
|
856
|
+
createSchema: u,
|
|
857
|
+
isLoading: t,
|
|
858
|
+
error: a,
|
|
859
|
+
resetError: l
|
|
860
|
+
};
|
|
861
|
+
}, Ye = () => {
|
|
862
|
+
let [e, t] = c(null), [r, a] = c({
|
|
863
|
+
isLoading: !1,
|
|
864
|
+
error: null
|
|
865
|
+
});
|
|
866
|
+
i(() => {
|
|
867
|
+
if (!e) {
|
|
868
|
+
a({
|
|
869
|
+
isLoading: !1,
|
|
870
|
+
error: null
|
|
871
|
+
});
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
let t = e.getService(), n = () => {
|
|
875
|
+
let e = t.getSnapshot().context;
|
|
876
|
+
a({
|
|
877
|
+
isLoading: !!e._destroyInProgress,
|
|
878
|
+
error: e._destroyError ? Error(e._destroyError.message) : null
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
n();
|
|
882
|
+
let r = t.subscribe(n);
|
|
883
|
+
return () => r.unsubscribe();
|
|
884
|
+
}, [e]);
|
|
885
|
+
let o = n(async (e) => {
|
|
886
|
+
e && (t(e), await e.destroy());
|
|
887
|
+
}, []), s = n(() => {
|
|
888
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
889
|
+
}, [e]);
|
|
890
|
+
return {
|
|
891
|
+
destroy: o,
|
|
892
|
+
isLoading: r.isLoading,
|
|
893
|
+
error: r.error,
|
|
894
|
+
resetError: s
|
|
895
|
+
};
|
|
896
|
+
}, Xe = () => {
|
|
897
|
+
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a = U(), o = n(async () => {
|
|
898
|
+
if (a) try {
|
|
899
|
+
let e = await ne(), n = /* @__PURE__ */ new Set();
|
|
900
|
+
for (let t of e) {
|
|
901
|
+
let e = t.schema.metadata?.name;
|
|
902
|
+
e && n.add(e);
|
|
903
|
+
}
|
|
904
|
+
let i = /* @__PURE__ */ new Map();
|
|
905
|
+
for (let e of n) if (r.current.has(e)) {
|
|
906
|
+
let t = r.current.get(e);
|
|
907
|
+
i.set(e, t);
|
|
908
|
+
} else {
|
|
909
|
+
let t = y.create(e, { waitForReady: !1 });
|
|
910
|
+
i.set(e, t);
|
|
911
|
+
}
|
|
912
|
+
for (let [e, t] of r.current.entries()) n.has(e) || t.unload();
|
|
913
|
+
r.current = i, t(Array.from(i.values()));
|
|
914
|
+
} catch (e) {
|
|
915
|
+
We("Error fetching all schema versions from database:", e), t(null);
|
|
916
|
+
}
|
|
917
|
+
}, [a]);
|
|
918
|
+
return i(() => {
|
|
919
|
+
a && o();
|
|
920
|
+
}, [a, o]), i(() => () => {
|
|
921
|
+
r.current.forEach((e) => {
|
|
922
|
+
e.unload();
|
|
923
|
+
}), r.current.clear();
|
|
924
|
+
}, []), e;
|
|
925
|
+
}, Ze = () => Ge(v), Qe = (e) => [
|
|
926
|
+
"seed",
|
|
927
|
+
"models",
|
|
928
|
+
e
|
|
929
|
+
], $e = /* @__PURE__ */ new Map(), et = (e) => {
|
|
930
|
+
let t = U(), n = H(), r = s([]), a = o(() => Qe(e), [e]), { data: c = [], isLoading: l, error: d } = V({
|
|
931
|
+
queryKey: a,
|
|
932
|
+
queryFn: async () => {
|
|
933
|
+
let t = n.getQueryData(a), r = await g.all(e, { waitForReady: !1 });
|
|
934
|
+
if (Array.isArray(t) && t.length > 0 && Array.isArray(r) && r.length === 0) return [...t];
|
|
935
|
+
if (Array.isArray(r) && r.length === 0) {
|
|
936
|
+
let e = n.getQueryData(a);
|
|
937
|
+
if (Array.isArray(e) && e.length > 0) return [...e];
|
|
938
|
+
}
|
|
939
|
+
return r;
|
|
940
|
+
},
|
|
941
|
+
enabled: t && !!e
|
|
942
|
+
}), f = e && typeof e == "string" ? e : "";
|
|
943
|
+
c.length > 0 && $e.set(f, c);
|
|
944
|
+
let p = r.current.length > 0 ? r.current : $e.get(f), m = e ? c.length > 0 ? c : p?.length ? p : c : c;
|
|
945
|
+
r.current = m, i(() => {
|
|
946
|
+
if (!e || typeof BroadcastChannel > "u") return;
|
|
947
|
+
let t = new BroadcastChannel("seed-models-invalidate"), r = (t) => {
|
|
948
|
+
let { schemaName: r, schemaFileId: i } = t.data || {};
|
|
949
|
+
(e === r || e === i) && (n.invalidateQueries({ queryKey: a }), n.refetchQueries({ queryKey: a }));
|
|
950
|
+
};
|
|
951
|
+
return t.addEventListener("message", r), () => {
|
|
952
|
+
t.removeEventListener("message", r), t.close();
|
|
953
|
+
};
|
|
954
|
+
}, [
|
|
955
|
+
e,
|
|
956
|
+
n,
|
|
957
|
+
a
|
|
958
|
+
]);
|
|
959
|
+
let h = s(null), _ = s(null);
|
|
960
|
+
function v() {
|
|
961
|
+
let t = u.getAppDb();
|
|
962
|
+
return !t || !e ? null : t.select({
|
|
963
|
+
modelFileId: A.schemaFileId,
|
|
964
|
+
modelName: A.name
|
|
965
|
+
}).from(M).innerJoin(k, R(M.id, k.schemaId)).innerJoin(A, R(k.modelId, A.id)).where(B(R(M.schemaFileId, e), R(M.name, e)));
|
|
966
|
+
}
|
|
967
|
+
let y = K(o(() => {
|
|
968
|
+
if (!e || !t) return null;
|
|
969
|
+
let n = {
|
|
970
|
+
schemaId: e,
|
|
971
|
+
ready: t
|
|
972
|
+
}, r = h.current;
|
|
973
|
+
if (r && r.schemaId === n.schemaId && r.ready === n.ready && _.current !== null) return _.current;
|
|
974
|
+
let i = v();
|
|
975
|
+
return i ? (h.current = n, _.current = i, i) : null;
|
|
976
|
+
}, [e, t]));
|
|
977
|
+
return i(() => {
|
|
978
|
+
if (!t || !y || !e) return;
|
|
979
|
+
let i = /* @__PURE__ */ new Set();
|
|
980
|
+
for (let e of r.current) {
|
|
981
|
+
let t = e.id || e.modelFileId;
|
|
982
|
+
t ? i.add(t) : e.modelName && i.add(e.modelName);
|
|
983
|
+
}
|
|
984
|
+
let o = /* @__PURE__ */ new Set();
|
|
985
|
+
for (let e of y) e.modelFileId ? o.add(e.modelFileId) : e.modelName && o.add(e.modelName);
|
|
986
|
+
let s = i.size === o.size && [...i].every((e) => o.has(e)), c = o.size > 0 && [...o].some((e) => !i.has(e));
|
|
987
|
+
!s && c && n.invalidateQueries({ queryKey: a });
|
|
988
|
+
}, [
|
|
989
|
+
t,
|
|
990
|
+
y,
|
|
991
|
+
e,
|
|
992
|
+
n,
|
|
993
|
+
a
|
|
994
|
+
]), {
|
|
995
|
+
models: m,
|
|
996
|
+
isLoading: l,
|
|
997
|
+
error: d
|
|
998
|
+
};
|
|
999
|
+
}, tt = (e, t) => {
|
|
1000
|
+
let n = U(), [r, a] = c(void 0), [l, u] = c(!1), [d, f] = c(null), p = s(void 0), [, m] = c(0), h = t == null;
|
|
1001
|
+
if (o(() => n ? h ? !!e : !!(e && t) : !1, [
|
|
1002
|
+
n,
|
|
1003
|
+
h,
|
|
1004
|
+
e,
|
|
1005
|
+
t
|
|
1006
|
+
]), i(() => {
|
|
1007
|
+
if (!n || !h || !e) {
|
|
1008
|
+
a(void 0), u(!1), f(null);
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
(async () => {
|
|
1012
|
+
try {
|
|
1013
|
+
u(!0), f(null), a(await g.createById(e) || void 0), u(!1), f(null);
|
|
1014
|
+
} catch (e) {
|
|
1015
|
+
console.error("[useModel] Error looking up model by ID:", e), a(void 0), u(!1), f(e);
|
|
1016
|
+
}
|
|
1017
|
+
})();
|
|
1018
|
+
}, [
|
|
1019
|
+
n,
|
|
1020
|
+
h,
|
|
1021
|
+
e
|
|
1022
|
+
]), i(() => {
|
|
1023
|
+
if (!h || !r) {
|
|
1024
|
+
p.current?.unsubscribe(), p.current = void 0;
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
return p.current?.unsubscribe(), p.current = r.getService().subscribe((e) => {
|
|
1028
|
+
m((e) => e + 1);
|
|
1029
|
+
}), () => {
|
|
1030
|
+
p.current?.unsubscribe(), p.current = void 0;
|
|
1031
|
+
};
|
|
1032
|
+
}, [h, r]), h) return {
|
|
1033
|
+
model: r,
|
|
1034
|
+
isLoading: l,
|
|
1035
|
+
error: d
|
|
1036
|
+
};
|
|
1037
|
+
let { models: _, isLoading: v, error: y } = et(e), b = o(() => {
|
|
1038
|
+
if (t) return _.find((e) => (e.modelName ?? e.name) === t);
|
|
1039
|
+
}, [_, t]);
|
|
1040
|
+
return i(() => {
|
|
1041
|
+
if (h || !b) {
|
|
1042
|
+
p.current?.unsubscribe(), p.current = void 0;
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
return p.current?.unsubscribe(), p.current = b.getService().subscribe((e) => {
|
|
1046
|
+
m((e) => e + 1);
|
|
1047
|
+
}), () => {
|
|
1048
|
+
p.current?.unsubscribe(), p.current = void 0;
|
|
1049
|
+
};
|
|
1050
|
+
}, [h, b]), {
|
|
1051
|
+
model: b,
|
|
1052
|
+
isLoading: v,
|
|
1053
|
+
error: y
|
|
1054
|
+
};
|
|
1055
|
+
}, nt = () => {
|
|
1056
|
+
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t, n, i) => {
|
|
1057
|
+
o(null), r(!0), e.current?.unsubscribe(), e.current = void 0;
|
|
1058
|
+
let a = g.create(n, t, {
|
|
1059
|
+
...i,
|
|
1060
|
+
waitForReady: !1
|
|
1061
|
+
});
|
|
1062
|
+
return e.current = a.getService().subscribe((e) => {
|
|
1063
|
+
e.value === "error" && (o(e.context._loadingError?.error ?? /* @__PURE__ */ Error("Failed to create model")), r(!1)), e.value === "idle" && (o(null), r(!1));
|
|
1064
|
+
}), a;
|
|
1065
|
+
}, []);
|
|
1066
|
+
return i(() => () => {
|
|
1067
|
+
e.current?.unsubscribe(), e.current = void 0;
|
|
1068
|
+
}, []), {
|
|
1069
|
+
create: u,
|
|
1070
|
+
isLoading: t,
|
|
1071
|
+
error: a,
|
|
1072
|
+
resetError: l
|
|
1073
|
+
};
|
|
1074
|
+
}, rt = () => {
|
|
1075
|
+
let [e, t] = c(null), [r, a] = c({
|
|
1076
|
+
isLoading: !1,
|
|
1077
|
+
error: null
|
|
1078
|
+
});
|
|
1079
|
+
i(() => {
|
|
1080
|
+
if (!e) {
|
|
1081
|
+
a({
|
|
1082
|
+
isLoading: !1,
|
|
1083
|
+
error: null
|
|
1084
|
+
});
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
let t = e.getService(), n = () => {
|
|
1088
|
+
let e = t.getSnapshot().context;
|
|
1089
|
+
a({
|
|
1090
|
+
isLoading: !!e._destroyInProgress,
|
|
1091
|
+
error: e._destroyError ? Error(e._destroyError.message) : null
|
|
1092
|
+
});
|
|
1093
|
+
};
|
|
1094
|
+
n();
|
|
1095
|
+
let r = t.subscribe(n);
|
|
1096
|
+
return () => r.unsubscribe();
|
|
1097
|
+
}, [e]);
|
|
1098
|
+
let o = n(async (e) => {
|
|
1099
|
+
e && (t(e), await e.destroy());
|
|
1100
|
+
}, []), s = n(() => {
|
|
1101
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
1102
|
+
}, [e]);
|
|
1103
|
+
return {
|
|
1104
|
+
destroy: o,
|
|
1105
|
+
isLoading: r.isLoading,
|
|
1106
|
+
error: r.error,
|
|
1107
|
+
resetError: s
|
|
1108
|
+
};
|
|
1133
1109
|
};
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region src/modelProperty.ts
|
|
1112
|
+
P("seedSdk:browser:react:modelProperty");
|
|
1113
|
+
var it = (e, t) => {
|
|
1114
|
+
let { model: n } = tt(e, t);
|
|
1115
|
+
o(() => {
|
|
1116
|
+
if (n) try {
|
|
1117
|
+
return n.modelName ?? n.name;
|
|
1118
|
+
} catch {
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
}, [n]);
|
|
1122
|
+
let r = U(), a = H(), c = o(() => {
|
|
1123
|
+
if (!n) return null;
|
|
1124
|
+
try {
|
|
1125
|
+
return n._getSnapshotContext()._dbId;
|
|
1126
|
+
} catch {
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
}, [n]), l = n?.id, d = o(() => [
|
|
1130
|
+
"seed",
|
|
1131
|
+
"modelProperties",
|
|
1132
|
+
l ?? ""
|
|
1133
|
+
], [l]), { data: f = [], isLoading: p, error: m } = V({
|
|
1134
|
+
queryKey: d,
|
|
1135
|
+
queryFn: () => _.all(l, { waitForReady: !0 }),
|
|
1136
|
+
enabled: r && !!l
|
|
1137
|
+
}), h = r ? u.getAppDb() : null, g = K(o(() => !h || !c ? null : h.select({
|
|
1138
|
+
id: j.id,
|
|
1139
|
+
name: j.name,
|
|
1140
|
+
dataType: j.dataType,
|
|
1141
|
+
schemaFileId: j.schemaFileId
|
|
1142
|
+
}).from(j).where(R(j.modelId, c)), [
|
|
1143
|
+
h,
|
|
1144
|
+
r,
|
|
1145
|
+
c
|
|
1146
|
+
])), v = s([]);
|
|
1147
|
+
return v.current = f, i(() => {
|
|
1148
|
+
if (!l || f.length > 0 || !a || !d) return;
|
|
1149
|
+
let e = [
|
|
1150
|
+
400,
|
|
1151
|
+
1200,
|
|
1152
|
+
2500
|
|
1153
|
+
].map((e) => setTimeout(() => {
|
|
1154
|
+
a.invalidateQueries({ queryKey: d });
|
|
1155
|
+
}, e));
|
|
1156
|
+
return () => e.forEach((e) => clearTimeout(e));
|
|
1157
|
+
}, [
|
|
1158
|
+
l,
|
|
1159
|
+
f.length,
|
|
1160
|
+
a,
|
|
1161
|
+
d
|
|
1162
|
+
]), i(() => {
|
|
1163
|
+
if (!r || !n?.id || !g || !d) return;
|
|
1164
|
+
let e = /* @__PURE__ */ new Set();
|
|
1165
|
+
for (let t of v.current) {
|
|
1166
|
+
let n = t._getSnapshotContext()?.id;
|
|
1167
|
+
n ? e.add(n) : t.name && e.add(t.name);
|
|
1168
|
+
}
|
|
1169
|
+
let t = /* @__PURE__ */ new Set();
|
|
1170
|
+
for (let e of g) e.schemaFileId ? t.add(e.schemaFileId) : e.name && t.add(e.name);
|
|
1171
|
+
!(e.size === t.size && (e.size === 0 || [...e].every((e) => t.has(e)))) && (e.size > 0 || t.size > 0) && a.invalidateQueries({ queryKey: d });
|
|
1172
|
+
}, [
|
|
1173
|
+
r,
|
|
1174
|
+
g,
|
|
1175
|
+
n?.id,
|
|
1176
|
+
a,
|
|
1177
|
+
d
|
|
1178
|
+
]), {
|
|
1179
|
+
modelProperties: f,
|
|
1180
|
+
isLoading: p && f.length === 0,
|
|
1181
|
+
error: m
|
|
1182
|
+
};
|
|
1183
|
+
}, at = async (e, t) => {
|
|
1184
|
+
let n = await g.createById(e);
|
|
1185
|
+
if (!n) return;
|
|
1186
|
+
let r = n.modelName ?? n.name;
|
|
1187
|
+
if (r) return D(r, t);
|
|
1202
1188
|
};
|
|
1203
|
-
function
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1189
|
+
function ot(e, t, r) {
|
|
1190
|
+
let a = o(() => r == null ? t == null ? !!e : !!(e && t) : !!(e && t && r), [
|
|
1191
|
+
e,
|
|
1192
|
+
t,
|
|
1193
|
+
r
|
|
1194
|
+
]), [u, d] = c(void 0), [f, p] = c(a), [m, h] = c(null), v = s(void 0), y = U(), b = o(() => r == null ? t == null ? {
|
|
1195
|
+
type: "propertyFileId",
|
|
1196
|
+
propertyFileId: e
|
|
1197
|
+
} : {
|
|
1198
|
+
type: "modelFileId",
|
|
1199
|
+
modelFileId: e,
|
|
1200
|
+
propertyName: t
|
|
1201
|
+
} : {
|
|
1202
|
+
type: "schemaId",
|
|
1203
|
+
schemaId: e,
|
|
1204
|
+
modelName: t,
|
|
1205
|
+
propertyName: r
|
|
1206
|
+
}, [
|
|
1207
|
+
e,
|
|
1208
|
+
t,
|
|
1209
|
+
r
|
|
1210
|
+
]), x = o(() => y ? b.type === "propertyFileId" ? !!b.propertyFileId : b.type === "modelFileId" ? !!(b.modelFileId && b.propertyName) : !!(b.schemaId && b.modelName && b.propertyName) : !1, [y, b]), S = n(async () => {
|
|
1211
|
+
if (!y) {
|
|
1212
|
+
d(void 0), p(!1), h(null);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
let e, t;
|
|
1216
|
+
try {
|
|
1217
|
+
if (p(!0), h(null), b.type === "propertyFileId") {
|
|
1218
|
+
if (!b.propertyFileId) {
|
|
1219
|
+
d(void 0), p(!1), h(null);
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
let e = await _.createById(b.propertyFileId);
|
|
1223
|
+
e ? (d(e), p(!1), h(null)) : (d(void 0), p(!1), h(null));
|
|
1224
|
+
return;
|
|
1225
|
+
} else if (b.type === "modelFileId") {
|
|
1226
|
+
if (!b.modelFileId || !b.propertyName) {
|
|
1227
|
+
d(void 0), p(!1), h(null);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
e = await at(b.modelFileId, b.propertyName);
|
|
1231
|
+
let n = await g.createById(b.modelFileId);
|
|
1232
|
+
t = n?.modelName ?? n?.name;
|
|
1233
|
+
} else {
|
|
1234
|
+
if (!b.schemaId || !b.modelName || !b.propertyName) {
|
|
1235
|
+
d(void 0), p(!1), h(null);
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
e = await D(b.modelName, b.propertyName), t = b.modelName;
|
|
1239
|
+
}
|
|
1240
|
+
if (e && t) {
|
|
1241
|
+
let n = _.create({
|
|
1242
|
+
...e,
|
|
1243
|
+
modelName: t
|
|
1244
|
+
}, { waitForReady: !1 }), r = n instanceof Promise ? await n : n;
|
|
1245
|
+
l(() => {
|
|
1246
|
+
d(r), p(!1), h(null);
|
|
1247
|
+
});
|
|
1248
|
+
} else d(void 0), p(!1), h(null);
|
|
1249
|
+
} catch (e) {
|
|
1250
|
+
console.error("[useModelProperty] Error updating model property:", e), d(void 0), p(!1), h(e);
|
|
1251
|
+
}
|
|
1252
|
+
}, [
|
|
1253
|
+
y,
|
|
1254
|
+
b.type,
|
|
1255
|
+
b.propertyFileId,
|
|
1256
|
+
b.modelFileId,
|
|
1257
|
+
b.propertyName,
|
|
1258
|
+
b.schemaId,
|
|
1259
|
+
b.modelName
|
|
1260
|
+
]);
|
|
1261
|
+
i(() => {
|
|
1262
|
+
if (!x) {
|
|
1263
|
+
d(void 0), p(!1), h(null);
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
S();
|
|
1267
|
+
}, [x, S]);
|
|
1268
|
+
let C = b.type === "propertyFileId";
|
|
1269
|
+
return i(() => {
|
|
1270
|
+
if (!u || !C) return;
|
|
1271
|
+
v.current?.unsubscribe();
|
|
1272
|
+
let e = ae(S, 100);
|
|
1273
|
+
return v.current = u.getService().subscribe(() => {
|
|
1274
|
+
e();
|
|
1275
|
+
}), () => {
|
|
1276
|
+
e.cancel(), v.current?.unsubscribe(), v.current = void 0;
|
|
1277
|
+
};
|
|
1278
|
+
}, [
|
|
1279
|
+
u,
|
|
1280
|
+
S,
|
|
1281
|
+
C
|
|
1282
|
+
]), {
|
|
1283
|
+
modelProperty: u,
|
|
1284
|
+
isLoading: f,
|
|
1285
|
+
error: m
|
|
1286
|
+
};
|
|
1271
1287
|
}
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
},
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1288
|
+
var st = () => {
|
|
1289
|
+
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t, n, i) => {
|
|
1290
|
+
if (o(null), r(!0), e.current?.unsubscribe(), e.current = void 0, !n || !i.name || !i.dataType) {
|
|
1291
|
+
let e = /* @__PURE__ */ Error("modelName, property name and dataType are required");
|
|
1292
|
+
throw o(e), r(!1), e;
|
|
1293
|
+
}
|
|
1294
|
+
let a = ee(t) ?? t, s = _.create({
|
|
1295
|
+
...i,
|
|
1296
|
+
modelName: n
|
|
1297
|
+
}, {
|
|
1298
|
+
waitForReady: !1,
|
|
1299
|
+
schemaName: a
|
|
1300
|
+
});
|
|
1301
|
+
return e.current = s.getService().subscribe((e) => {
|
|
1302
|
+
if (e.value === "error") {
|
|
1303
|
+
let t = e.context._loadingError?.error ?? /* @__PURE__ */ Error("Failed to create model property");
|
|
1304
|
+
o(t instanceof Error ? t : Error(String(t))), r(!1);
|
|
1305
|
+
}
|
|
1306
|
+
e.value === "idle" && (o(null), r(!1));
|
|
1307
|
+
}), s;
|
|
1308
|
+
}, []);
|
|
1309
|
+
return i(() => () => {
|
|
1310
|
+
e.current?.unsubscribe(), e.current = void 0;
|
|
1311
|
+
}, []), {
|
|
1312
|
+
create: u,
|
|
1313
|
+
isLoading: t,
|
|
1314
|
+
error: a,
|
|
1315
|
+
resetError: l
|
|
1316
|
+
};
|
|
1317
|
+
}, ct = () => {
|
|
1318
|
+
let [e, t] = c(null), [r, a] = c({
|
|
1319
|
+
isLoading: !1,
|
|
1320
|
+
error: null
|
|
1321
|
+
});
|
|
1322
|
+
i(() => {
|
|
1323
|
+
if (!e) {
|
|
1324
|
+
a({
|
|
1325
|
+
isLoading: !1,
|
|
1326
|
+
error: null
|
|
1327
|
+
});
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
let t = e.getService(), n = () => {
|
|
1331
|
+
let e = t.getSnapshot().context;
|
|
1332
|
+
a({
|
|
1333
|
+
isLoading: !!e._destroyInProgress,
|
|
1334
|
+
error: e._destroyError ? Error(e._destroyError.message) : null
|
|
1335
|
+
});
|
|
1336
|
+
};
|
|
1337
|
+
n();
|
|
1338
|
+
let r = t.subscribe(n);
|
|
1339
|
+
return () => r.unsubscribe();
|
|
1340
|
+
}, [e]);
|
|
1341
|
+
let o = n(async (e) => {
|
|
1342
|
+
e && (t(e), await e.destroy());
|
|
1343
|
+
}, []), s = n(() => {
|
|
1344
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
1345
|
+
}, [e]);
|
|
1346
|
+
return {
|
|
1347
|
+
destroy: o,
|
|
1348
|
+
isLoading: r.isLoading,
|
|
1349
|
+
error: r.error,
|
|
1350
|
+
resetError: s
|
|
1351
|
+
};
|
|
1352
|
+
}, lt = () => {
|
|
1353
|
+
let [e, t] = c(null), [r, a] = c({
|
|
1354
|
+
isLoading: !1,
|
|
1355
|
+
error: null
|
|
1356
|
+
});
|
|
1357
|
+
i(() => {
|
|
1358
|
+
if (!e) {
|
|
1359
|
+
a({
|
|
1360
|
+
isLoading: !1,
|
|
1361
|
+
error: null
|
|
1362
|
+
});
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
let t = e.getService(), n = () => {
|
|
1366
|
+
let e = t.getSnapshot().context;
|
|
1367
|
+
a({
|
|
1368
|
+
isLoading: !!e._destroyInProgress,
|
|
1369
|
+
error: e._destroyError ? Error(e._destroyError.message) : null
|
|
1370
|
+
});
|
|
1371
|
+
};
|
|
1372
|
+
n();
|
|
1373
|
+
let r = t.subscribe(n);
|
|
1374
|
+
return () => r.unsubscribe();
|
|
1375
|
+
}, [e]);
|
|
1376
|
+
let o = n(async (e) => {
|
|
1377
|
+
e && (t(e), await e.destroy());
|
|
1378
|
+
}, []), s = n(() => {
|
|
1379
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
1380
|
+
}, [e]);
|
|
1381
|
+
return {
|
|
1382
|
+
deleteItem: o,
|
|
1383
|
+
isLoading: r.isLoading,
|
|
1384
|
+
error: r.error,
|
|
1385
|
+
resetError: s
|
|
1386
|
+
};
|
|
1387
|
+
}, ut = ["seed", "imageFiles"];
|
|
1388
|
+
function dt() {
|
|
1389
|
+
let e = U(), t = H(), { data: n = [], isLoading: r, error: a, refetch: o } = V({
|
|
1390
|
+
queryKey: ut,
|
|
1391
|
+
queryFn: () => d.listImageFiles(),
|
|
1392
|
+
enabled: e
|
|
1393
|
+
});
|
|
1394
|
+
return i(() => {
|
|
1395
|
+
let e = (e) => {
|
|
1396
|
+
e.includes("/images/") && t.invalidateQueries({ queryKey: ut });
|
|
1397
|
+
}, n = () => {
|
|
1398
|
+
t.invalidateQueries({ queryKey: ut });
|
|
1399
|
+
};
|
|
1400
|
+
return w.on("file-saved", e), w.on("fs.downloadAll.success", n), () => {
|
|
1401
|
+
w.off("file-saved", e), w.off("fs.downloadAll.success", n);
|
|
1402
|
+
};
|
|
1403
|
+
}, [t]), {
|
|
1404
|
+
imageFiles: n,
|
|
1405
|
+
isLoading: r,
|
|
1406
|
+
error: a instanceof Error ? a : null,
|
|
1407
|
+
refetch: o
|
|
1408
|
+
};
|
|
1392
1409
|
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1410
|
+
//#endregion
|
|
1411
|
+
//#region src/useFiles.ts
|
|
1412
|
+
var ft = ["seed", "files"];
|
|
1413
|
+
function pt(e = "files") {
|
|
1414
|
+
let t = U(), n = H(), r = o(() => [...ft, e], [e]), { data: a = [], isLoading: s, error: c, refetch: l } = V({
|
|
1415
|
+
queryKey: r,
|
|
1416
|
+
queryFn: () => d.listFiles(e),
|
|
1417
|
+
enabled: t
|
|
1418
|
+
});
|
|
1419
|
+
return i(() => {
|
|
1420
|
+
let t = (t) => {
|
|
1421
|
+
t.includes(`/${e}/`) && n.invalidateQueries({ queryKey: r });
|
|
1422
|
+
}, i = () => {
|
|
1423
|
+
n.invalidateQueries({ queryKey: r });
|
|
1424
|
+
};
|
|
1425
|
+
return w.on("file-saved", t), w.on("fs.downloadAll.success", i), () => {
|
|
1426
|
+
w.off("file-saved", t), w.off("fs.downloadAll.success", i);
|
|
1427
|
+
};
|
|
1428
|
+
}, [
|
|
1429
|
+
n,
|
|
1430
|
+
e,
|
|
1431
|
+
r
|
|
1432
|
+
]), {
|
|
1433
|
+
files: a,
|
|
1434
|
+
isLoading: s,
|
|
1435
|
+
error: c instanceof Error ? c : null,
|
|
1436
|
+
refetch: l
|
|
1437
|
+
};
|
|
1420
1438
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
);
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/useEasSyncProcesses.ts
|
|
1441
|
+
function mt() {
|
|
1442
|
+
let e = u.getAppDb();
|
|
1443
|
+
return o(() => e ? e.select().from(C).orderBy(ue(C.startedAt)) : null, [e]);
|
|
1427
1444
|
}
|
|
1428
|
-
function
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1445
|
+
function ht() {
|
|
1446
|
+
let e = K(mt());
|
|
1447
|
+
return {
|
|
1448
|
+
records: e,
|
|
1449
|
+
nonActiveCount: o(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
|
|
1450
|
+
};
|
|
1434
1451
|
}
|
|
1435
|
-
function
|
|
1436
|
-
|
|
1437
|
-
return Y(e);
|
|
1452
|
+
function gt() {
|
|
1453
|
+
return K(mt());
|
|
1438
1454
|
}
|
|
1439
|
-
function
|
|
1440
|
-
|
|
1455
|
+
function _t() {
|
|
1456
|
+
return ht().nonActiveCount;
|
|
1441
1457
|
}
|
|
1442
|
-
function
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1458
|
+
function vt(e) {
|
|
1459
|
+
let t = u.getAppDb(), n = K(o(() => e != null && t ? t.select().from(C).where(R(C.id, e)).limit(1) : null, [t, e])), r = n === void 0;
|
|
1460
|
+
return {
|
|
1461
|
+
record: n && n.length > 0 ? n[0] : null,
|
|
1462
|
+
isLoading: r
|
|
1463
|
+
};
|
|
1448
1464
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
};
|
|
1458
|
-
function Xe() {
|
|
1459
|
-
return { ...kt };
|
|
1465
|
+
//#endregion
|
|
1466
|
+
//#region src/queryClient.ts
|
|
1467
|
+
var yt = { queries: {
|
|
1468
|
+
networkMode: "offlineFirst",
|
|
1469
|
+
gcTime: 1e3 * 60 * 60 * 24,
|
|
1470
|
+
staleTime: 1e3 * 60
|
|
1471
|
+
} };
|
|
1472
|
+
function bt() {
|
|
1473
|
+
return { ...yt };
|
|
1460
1474
|
}
|
|
1461
|
-
function
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1475
|
+
function xt(e) {
|
|
1476
|
+
let t = bt();
|
|
1477
|
+
return e ? {
|
|
1478
|
+
queries: {
|
|
1479
|
+
...t.queries,
|
|
1480
|
+
...e.queries ?? {}
|
|
1481
|
+
},
|
|
1482
|
+
mutations: {
|
|
1483
|
+
...t.mutations ?? {},
|
|
1484
|
+
...e.mutations ?? {}
|
|
1485
|
+
}
|
|
1486
|
+
} : t;
|
|
1473
1487
|
}
|
|
1474
|
-
function
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1488
|
+
function St(e) {
|
|
1489
|
+
let t = bt(), { defaultOptions: n, ...r } = e ?? {};
|
|
1490
|
+
return new _e({
|
|
1491
|
+
...r,
|
|
1492
|
+
defaultOptions: n ? xt(n) : t
|
|
1493
|
+
});
|
|
1480
1494
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1495
|
+
//#endregion
|
|
1496
|
+
//#region src/SeedProvider.tsx
|
|
1497
|
+
var Ct = null;
|
|
1498
|
+
function wt(e) {
|
|
1499
|
+
let t = Ct?.(e);
|
|
1500
|
+
return typeof window < "u" && window.__SEED_INVALIDATE_ITEM_PROPERTIES__ && window.__SEED_INVALIDATE_ITEM_PROPERTIES__(e), Promise.resolve(t).then(() => {});
|
|
1486
1501
|
}
|
|
1487
|
-
function
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1502
|
+
function Tt({ queryClient: e }) {
|
|
1503
|
+
return i(() => {
|
|
1504
|
+
let t = (t) => {
|
|
1505
|
+
let n = [
|
|
1506
|
+
"seed",
|
|
1507
|
+
"itemProperties",
|
|
1508
|
+
t
|
|
1509
|
+
];
|
|
1510
|
+
return e.invalidateQueries({ queryKey: n }), e.refetchQueries({ queryKey: n });
|
|
1511
|
+
};
|
|
1512
|
+
Ct = t, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = t);
|
|
1513
|
+
let n = (e) => {
|
|
1514
|
+
let n = e?.seedLocalId ?? e?.seedUid;
|
|
1515
|
+
n && t(n);
|
|
1516
|
+
}, r = () => {
|
|
1517
|
+
e.invalidateQueries({
|
|
1518
|
+
queryKey: ["seed", "items"],
|
|
1519
|
+
exact: !1
|
|
1520
|
+
});
|
|
1521
|
+
};
|
|
1522
|
+
return w.on("itemProperty.saved", n), w.on(p, r), () => {
|
|
1523
|
+
w.off("itemProperty.saved", n), w.off(p, r), Ct = null, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = null);
|
|
1524
|
+
};
|
|
1525
|
+
}, [e]), null;
|
|
1504
1526
|
}
|
|
1505
|
-
function
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
] }) });
|
|
1527
|
+
function Et({ children: e, queryClient: t, queryClientRef: n }) {
|
|
1528
|
+
let r = o(() => t ?? St(), [t]);
|
|
1529
|
+
if (n && (n.current = r, typeof window < "u")) {
|
|
1530
|
+
let e = window;
|
|
1531
|
+
e.__TEST_SEED_QUERY_CLIENT__ = r;
|
|
1532
|
+
try {
|
|
1533
|
+
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = r);
|
|
1534
|
+
} catch {}
|
|
1535
|
+
}
|
|
1536
|
+
return /* @__PURE__ */ I(ve, {
|
|
1537
|
+
client: r,
|
|
1538
|
+
children: /* @__PURE__ */ L(xe, {
|
|
1539
|
+
queryClient: r,
|
|
1540
|
+
children: [/* @__PURE__ */ I(Tt, { queryClient: r }), e]
|
|
1541
|
+
})
|
|
1542
|
+
});
|
|
1522
1543
|
}
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
);
|
|
1544
|
+
//#endregion
|
|
1545
|
+
//#region src/SeedClientGate.tsx
|
|
1546
|
+
function Dt() {
|
|
1547
|
+
return /* @__PURE__ */ I("div", {
|
|
1548
|
+
style: {
|
|
1549
|
+
display: "flex",
|
|
1550
|
+
alignItems: "center",
|
|
1551
|
+
justifyContent: "center",
|
|
1552
|
+
height: "100%",
|
|
1553
|
+
width: "100%"
|
|
1554
|
+
},
|
|
1555
|
+
children: "Loading..."
|
|
1556
|
+
});
|
|
1537
1557
|
}
|
|
1538
|
-
function
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
] });
|
|
1558
|
+
function Ot({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, children: o }) {
|
|
1559
|
+
let s = U();
|
|
1560
|
+
i(() => {
|
|
1561
|
+
let n = t ? {
|
|
1562
|
+
...e,
|
|
1563
|
+
config: {
|
|
1564
|
+
...e.config,
|
|
1565
|
+
schema: t
|
|
1566
|
+
}
|
|
1567
|
+
} : e;
|
|
1568
|
+
x.init(n);
|
|
1569
|
+
}, [e, t]);
|
|
1570
|
+
let c = n ?? /* @__PURE__ */ I(Dt, {});
|
|
1571
|
+
return /* @__PURE__ */ L("div", {
|
|
1572
|
+
className: r,
|
|
1573
|
+
style: r ? void 0 : {
|
|
1574
|
+
position: "relative",
|
|
1575
|
+
display: "flex",
|
|
1576
|
+
height: "100vh",
|
|
1577
|
+
width: "100vw"
|
|
1578
|
+
},
|
|
1579
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1580
|
+
className: a,
|
|
1581
|
+
style: {
|
|
1582
|
+
display: s ? "none" : "flex",
|
|
1583
|
+
...!a && {
|
|
1584
|
+
position: "absolute",
|
|
1585
|
+
inset: 0,
|
|
1586
|
+
zIndex: 50,
|
|
1587
|
+
alignItems: "center",
|
|
1588
|
+
justifyContent: "center"
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
"aria-hidden": s,
|
|
1592
|
+
children: c
|
|
1593
|
+
}), /* @__PURE__ */ I("div", {
|
|
1594
|
+
style: {
|
|
1595
|
+
flex: 1,
|
|
1596
|
+
display: s ? "flex" : "none",
|
|
1597
|
+
flexDirection: "column"
|
|
1598
|
+
},
|
|
1599
|
+
children: o
|
|
1600
|
+
})]
|
|
1601
|
+
});
|
|
1583
1602
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1603
|
+
//#endregion
|
|
1604
|
+
//#region src/useOPFSFiles.ts
|
|
1605
|
+
async function kt(e, t = "") {
|
|
1606
|
+
let n = [];
|
|
1607
|
+
try {
|
|
1608
|
+
for await (let [r, i] of e.entries()) {
|
|
1609
|
+
let e = t ? `${t}/${r}` : r;
|
|
1610
|
+
if (i.kind === "file") try {
|
|
1611
|
+
let t = await i.getFile();
|
|
1612
|
+
n.push({
|
|
1613
|
+
name: r,
|
|
1614
|
+
path: e,
|
|
1615
|
+
size: t.size,
|
|
1616
|
+
type: t.type || "application/octet-stream",
|
|
1617
|
+
lastModified: t.lastModified
|
|
1618
|
+
});
|
|
1619
|
+
} catch (t) {
|
|
1620
|
+
console.warn(`Failed to read file ${e}:`, t);
|
|
1621
|
+
}
|
|
1622
|
+
else if (i.kind === "directory") {
|
|
1623
|
+
let t = await kt(i, e);
|
|
1624
|
+
n.push(...t);
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
} catch (e) {
|
|
1628
|
+
console.warn(`Failed to scan directory ${t}:`, e);
|
|
1629
|
+
}
|
|
1630
|
+
return n;
|
|
1611
1631
|
}
|
|
1612
|
-
function
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1632
|
+
function At(e = {}) {
|
|
1633
|
+
let { rootPath: t } = e, [r, a] = c([]), [o, s] = c(!0), [l, u] = c(null), d = n(async () => {
|
|
1634
|
+
s(!0), u(null);
|
|
1635
|
+
try {
|
|
1636
|
+
let e = await navigator.storage.getDirectory();
|
|
1637
|
+
if (t) {
|
|
1638
|
+
let n = t.split("/").filter(Boolean);
|
|
1639
|
+
for (let t of n) e = await e.getDirectoryHandle(t);
|
|
1640
|
+
}
|
|
1641
|
+
a((await kt(e, t || "")).sort((e, t) => e.path.localeCompare(t.path)));
|
|
1642
|
+
} catch (e) {
|
|
1643
|
+
u("Failed to access OPFS: " + (e instanceof Error ? e.message : String(e))), console.error("OPFS access error:", e);
|
|
1644
|
+
} finally {
|
|
1645
|
+
s(!1);
|
|
1646
|
+
}
|
|
1647
|
+
}, [t]);
|
|
1648
|
+
return i(() => {
|
|
1649
|
+
d();
|
|
1650
|
+
}, [d]), {
|
|
1651
|
+
files: r,
|
|
1652
|
+
isLoading: o,
|
|
1653
|
+
error: l,
|
|
1654
|
+
refetch: d
|
|
1655
|
+
};
|
|
1635
1656
|
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1657
|
+
//#endregion
|
|
1658
|
+
//#region src/OPFSFilesManager.tsx
|
|
1659
|
+
var jt = () => /* @__PURE__ */ I("svg", {
|
|
1660
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1661
|
+
fill: "none",
|
|
1662
|
+
viewBox: "0 0 24 24",
|
|
1663
|
+
strokeWidth: 1.5,
|
|
1664
|
+
stroke: "currentColor",
|
|
1665
|
+
style: {
|
|
1666
|
+
width: 20,
|
|
1667
|
+
height: 20
|
|
1668
|
+
},
|
|
1669
|
+
children: /* @__PURE__ */ I("path", {
|
|
1670
|
+
strokeLinecap: "round",
|
|
1671
|
+
strokeLinejoin: "round",
|
|
1672
|
+
d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
|
|
1673
|
+
})
|
|
1674
|
+
}), Mt = () => /* @__PURE__ */ I("svg", {
|
|
1675
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1676
|
+
fill: "none",
|
|
1677
|
+
viewBox: "0 0 24 24",
|
|
1678
|
+
strokeWidth: 1.5,
|
|
1679
|
+
stroke: "currentColor",
|
|
1680
|
+
style: {
|
|
1681
|
+
width: 48,
|
|
1682
|
+
height: 48
|
|
1683
|
+
},
|
|
1684
|
+
children: /* @__PURE__ */ I("path", {
|
|
1685
|
+
strokeLinecap: "round",
|
|
1686
|
+
strokeLinejoin: "round",
|
|
1687
|
+
d: "M2.25 12.75V12a2.25 2.25 0 012.25-2.25h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
|
1688
|
+
})
|
|
1689
|
+
}), Nt = () => /* @__PURE__ */ I("svg", {
|
|
1690
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1691
|
+
fill: "none",
|
|
1692
|
+
viewBox: "0 0 24 24",
|
|
1693
|
+
strokeWidth: 1.5,
|
|
1694
|
+
stroke: "currentColor",
|
|
1695
|
+
style: {
|
|
1696
|
+
width: 20,
|
|
1697
|
+
height: 20
|
|
1698
|
+
},
|
|
1699
|
+
children: /* @__PURE__ */ I("path", {
|
|
1700
|
+
strokeLinecap: "round",
|
|
1701
|
+
strokeLinejoin: "round",
|
|
1702
|
+
d: "M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
|
|
1703
|
+
})
|
|
1704
|
+
}), Pt = () => /* @__PURE__ */ I("svg", {
|
|
1705
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1706
|
+
fill: "none",
|
|
1707
|
+
viewBox: "0 0 24 24",
|
|
1708
|
+
strokeWidth: 1.5,
|
|
1709
|
+
stroke: "currentColor",
|
|
1710
|
+
style: {
|
|
1711
|
+
width: 20,
|
|
1712
|
+
height: 20
|
|
1713
|
+
},
|
|
1714
|
+
children: /* @__PURE__ */ I("path", {
|
|
1715
|
+
strokeLinecap: "round",
|
|
1716
|
+
strokeLinejoin: "round",
|
|
1717
|
+
d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
|
|
1718
|
+
})
|
|
1719
|
+
}), Ft = () => /* @__PURE__ */ L("svg", {
|
|
1720
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1721
|
+
fill: "none",
|
|
1722
|
+
viewBox: "0 0 24 24",
|
|
1723
|
+
style: {
|
|
1724
|
+
width: 32,
|
|
1725
|
+
height: 32
|
|
1726
|
+
},
|
|
1727
|
+
"aria-hidden": !0,
|
|
1728
|
+
children: [/* @__PURE__ */ I("circle", {
|
|
1729
|
+
style: { opacity: .25 },
|
|
1730
|
+
cx: "12",
|
|
1731
|
+
cy: "12",
|
|
1732
|
+
r: "10",
|
|
1733
|
+
stroke: "currentColor",
|
|
1734
|
+
strokeWidth: "4"
|
|
1735
|
+
}), /* @__PURE__ */ I("path", {
|
|
1736
|
+
style: { opacity: .75 },
|
|
1737
|
+
fill: "currentColor",
|
|
1738
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
1739
|
+
})]
|
|
1740
|
+
});
|
|
1741
|
+
function It(e) {
|
|
1742
|
+
if (e === 0) return "0 Bytes";
|
|
1743
|
+
let t = 1024, n = [
|
|
1744
|
+
"Bytes",
|
|
1745
|
+
"KB",
|
|
1746
|
+
"MB",
|
|
1747
|
+
"GB"
|
|
1748
|
+
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
1749
|
+
return Math.round(e / t ** r * 100) / 100 + " " + n[r];
|
|
1671
1750
|
}
|
|
1672
|
-
function
|
|
1673
|
-
|
|
1751
|
+
function Lt(e) {
|
|
1752
|
+
return new Date(e).toLocaleString();
|
|
1674
1753
|
}
|
|
1675
|
-
async function
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
return await (await n.getFileHandle(o)).getFile();
|
|
1754
|
+
async function Rt(e, t) {
|
|
1755
|
+
let n = e.path.split("/").filter(Boolean);
|
|
1756
|
+
if (n.length === 0) throw Error("Invalid file path");
|
|
1757
|
+
let r = t;
|
|
1758
|
+
for (let e = 0; e < n.length - 1; e++) r = await r.getDirectoryHandle(n[e]);
|
|
1759
|
+
let i = n[n.length - 1];
|
|
1760
|
+
return await (await r.getFileHandle(i)).getFile();
|
|
1683
1761
|
}
|
|
1684
|
-
async function
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
await n.removeEntry(o);
|
|
1762
|
+
async function zt(e, t) {
|
|
1763
|
+
let n = e.split("/").filter(Boolean);
|
|
1764
|
+
if (n.length === 0) throw Error("Invalid file path");
|
|
1765
|
+
let r = t;
|
|
1766
|
+
for (let e = 0; e < n.length - 1; e++) r = await r.getDirectoryHandle(n[e]);
|
|
1767
|
+
let i = n[n.length - 1];
|
|
1768
|
+
await r.removeEntry(i);
|
|
1692
1769
|
}
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
},
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1770
|
+
var Bt = {
|
|
1771
|
+
light: {
|
|
1772
|
+
title: "text-gray-900",
|
|
1773
|
+
description: "text-gray-500",
|
|
1774
|
+
batchBar: "bg-gray-100 border-gray-200",
|
|
1775
|
+
batchText: "text-gray-900",
|
|
1776
|
+
clearButton: "text-gray-500 hover:text-gray-900",
|
|
1777
|
+
loadingText: "text-gray-500",
|
|
1778
|
+
errorBox: "bg-red-50 border-red-200",
|
|
1779
|
+
errorTitle: "text-red-800",
|
|
1780
|
+
errorText: "text-red-700",
|
|
1781
|
+
emptyIcon: "text-gray-400",
|
|
1782
|
+
emptyTitle: "text-gray-900",
|
|
1783
|
+
emptyText: "text-gray-500",
|
|
1784
|
+
tableHeader: "bg-gray-100 text-gray-900",
|
|
1785
|
+
tableRow: "bg-white",
|
|
1786
|
+
tableBorder: "border-gray-200 divide-gray-200",
|
|
1787
|
+
tableCell: "text-gray-900",
|
|
1788
|
+
tableCellMuted: "text-gray-500",
|
|
1789
|
+
codeBlock: "bg-gray-100 border-gray-200 text-gray-800",
|
|
1790
|
+
actionButton: "text-gray-500 hover:text-gray-700",
|
|
1791
|
+
deleteButton: "text-gray-500 hover:text-red-600"
|
|
1792
|
+
},
|
|
1793
|
+
dark: {
|
|
1794
|
+
title: "text-white",
|
|
1795
|
+
description: "text-gray-400",
|
|
1796
|
+
batchBar: "bg-gray-800 border-gray-700",
|
|
1797
|
+
batchText: "text-white",
|
|
1798
|
+
clearButton: "text-gray-400 hover:text-white",
|
|
1799
|
+
loadingText: "text-gray-400",
|
|
1800
|
+
errorBox: "bg-red-900/50 border-red-800",
|
|
1801
|
+
errorTitle: "text-red-200",
|
|
1802
|
+
errorText: "text-red-300",
|
|
1803
|
+
emptyIcon: "text-gray-500",
|
|
1804
|
+
emptyTitle: "text-white",
|
|
1805
|
+
emptyText: "text-gray-400",
|
|
1806
|
+
tableHeader: "bg-gray-900 text-white",
|
|
1807
|
+
tableRow: "bg-gray-900",
|
|
1808
|
+
tableBorder: "border-gray-800 divide-gray-800",
|
|
1809
|
+
tableCell: "text-white",
|
|
1810
|
+
tableCellMuted: "text-gray-400",
|
|
1811
|
+
codeBlock: "bg-gray-800 border-gray-700 text-gray-300",
|
|
1812
|
+
actionButton: "text-gray-400 hover:text-indigo-400",
|
|
1813
|
+
deleteButton: "text-gray-400 hover:text-red-500"
|
|
1814
|
+
}
|
|
1815
|
+
}, Z = {
|
|
1816
|
+
container: { padding: "2rem 0" },
|
|
1817
|
+
header: {
|
|
1818
|
+
display: "flex",
|
|
1819
|
+
flexWrap: "wrap",
|
|
1820
|
+
alignItems: "center",
|
|
1821
|
+
gap: "1rem",
|
|
1822
|
+
marginBottom: "1rem"
|
|
1823
|
+
},
|
|
1824
|
+
title: {
|
|
1825
|
+
fontSize: "1.5rem",
|
|
1826
|
+
fontWeight: 600,
|
|
1827
|
+
margin: 0
|
|
1828
|
+
},
|
|
1829
|
+
description: {
|
|
1830
|
+
fontSize: "0.875rem",
|
|
1831
|
+
margin: "0.5rem 0 0 0"
|
|
1832
|
+
},
|
|
1833
|
+
button: "rounded-md px-3 py-2 text-sm font-semibold border-0 cursor-pointer bg-indigo-600 text-white hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",
|
|
1834
|
+
buttonDanger: "rounded-md px-3 py-2 text-sm font-semibold border-0 cursor-pointer bg-red-600 text-white hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600",
|
|
1835
|
+
table: "min-w-full divide-y",
|
|
1836
|
+
tableHeader: "py-3.5 pl-4 pr-3 text-left text-sm font-semibold sm:pl-6",
|
|
1837
|
+
tableCell: "whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6",
|
|
1838
|
+
errorBox: "rounded-md border p-4 mt-4",
|
|
1839
|
+
emptyState: "text-center py-12"
|
|
1756
1840
|
};
|
|
1757
|
-
function
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1841
|
+
function Vt({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDownload: a, title: o = "Files", description: l = "Browse and download all files stored in the Origin Private File System (OPFS).", theme: u = "dark", className: d }) {
|
|
1842
|
+
let f = Bt[u], { files: p, isLoading: m, error: h, refetch: g } = At({ rootPath: e }), _ = t ? p.filter(t) : p, [v, y] = c(/* @__PURE__ */ new Set()), b = s(null), x = _.length > 0 && v.size === _.length, S = v.size > 0 && v.size < _.length, C = (e) => {
|
|
1843
|
+
y((t) => {
|
|
1844
|
+
let n = new Set(t);
|
|
1845
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1846
|
+
});
|
|
1847
|
+
}, w = () => {
|
|
1848
|
+
y(v.size === _.length ? /* @__PURE__ */ new Set() : new Set(_.map((e) => e.path)));
|
|
1849
|
+
};
|
|
1850
|
+
i(() => {
|
|
1851
|
+
y(/* @__PURE__ */ new Set());
|
|
1852
|
+
}, [_.length]), i(() => {
|
|
1853
|
+
b.current && (b.current.indeterminate = S);
|
|
1854
|
+
}, [S]);
|
|
1855
|
+
let T = async (e, t = !1) => {
|
|
1856
|
+
try {
|
|
1857
|
+
let t = await Rt(e, await navigator.storage.getDirectory());
|
|
1858
|
+
if (a) await a(e, t);
|
|
1859
|
+
else {
|
|
1860
|
+
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
1861
|
+
r.href = n, r.download = e.name, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
1862
|
+
}
|
|
1863
|
+
} catch (e) {
|
|
1864
|
+
let n = "Failed to download file: " + (e instanceof Error ? e.message : String(e));
|
|
1865
|
+
throw t || alert(n), e;
|
|
1866
|
+
}
|
|
1867
|
+
}, E = async (e) => {
|
|
1868
|
+
if (!(n && !await n(e)) && confirm(`Are you sure you want to delete "${e.name}"? This action cannot be undone.`)) try {
|
|
1869
|
+
let t = await navigator.storage.getDirectory();
|
|
1870
|
+
await zt(e.path, t), await g(), await r?.([e.path]);
|
|
1871
|
+
} catch (e) {
|
|
1872
|
+
alert("Failed to delete file: " + (e instanceof Error ? e.message : String(e)));
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
return /* @__PURE__ */ L("div", {
|
|
1876
|
+
className: d,
|
|
1877
|
+
style: Z.container,
|
|
1878
|
+
children: [
|
|
1879
|
+
/* @__PURE__ */ I("style", { children: "@keyframes opfs-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}" }),
|
|
1880
|
+
/* @__PURE__ */ L("div", {
|
|
1881
|
+
style: Z.header,
|
|
1882
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1883
|
+
style: {
|
|
1884
|
+
flex: 1,
|
|
1885
|
+
minWidth: 0
|
|
1886
|
+
},
|
|
1887
|
+
children: [/* @__PURE__ */ I("h1", {
|
|
1888
|
+
style: Z.title,
|
|
1889
|
+
className: f.title,
|
|
1890
|
+
children: o
|
|
1891
|
+
}), /* @__PURE__ */ I("p", {
|
|
1892
|
+
style: Z.description,
|
|
1893
|
+
className: f.description,
|
|
1894
|
+
children: l
|
|
1895
|
+
})]
|
|
1896
|
+
}), /* @__PURE__ */ I("button", {
|
|
1897
|
+
type: "button",
|
|
1898
|
+
onClick: g,
|
|
1899
|
+
className: Z.button,
|
|
1900
|
+
children: "Refresh"
|
|
1901
|
+
})]
|
|
1902
|
+
}),
|
|
1903
|
+
v.size > 0 && /* @__PURE__ */ L("div", {
|
|
1904
|
+
className: `mt-4 flex items-center justify-between rounded-lg border px-4 py-3 ${f.batchBar}`,
|
|
1905
|
+
children: [/* @__PURE__ */ L("span", {
|
|
1906
|
+
className: `text-sm font-medium ${f.batchText}`,
|
|
1907
|
+
children: [
|
|
1908
|
+
v.size,
|
|
1909
|
+
" file",
|
|
1910
|
+
v.size === 1 ? "" : "s",
|
|
1911
|
+
" selected"
|
|
1912
|
+
]
|
|
1913
|
+
}), /* @__PURE__ */ L("div", {
|
|
1914
|
+
className: "flex items-center gap-3",
|
|
1915
|
+
children: [
|
|
1916
|
+
/* @__PURE__ */ I("button", {
|
|
1917
|
+
onClick: async () => {
|
|
1918
|
+
if (v.size === 0) return;
|
|
1919
|
+
let e = _.filter((e) => v.has(e.path)), t = [];
|
|
1920
|
+
for (let n of e) try {
|
|
1921
|
+
await T(n, !0), await new Promise((e) => setTimeout(e, 100));
|
|
1922
|
+
} catch (e) {
|
|
1923
|
+
t.push(`${n.name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
1924
|
+
}
|
|
1925
|
+
t.length > 0 && alert(`Some downloads failed:\n${t.join("\n")}`);
|
|
1926
|
+
},
|
|
1927
|
+
className: Z.button,
|
|
1928
|
+
children: /* @__PURE__ */ L("span", {
|
|
1929
|
+
className: "inline-flex items-center gap-2",
|
|
1930
|
+
children: [/* @__PURE__ */ I(jt, {}), " Download All"]
|
|
1931
|
+
})
|
|
1932
|
+
}),
|
|
1933
|
+
/* @__PURE__ */ I("button", {
|
|
1934
|
+
onClick: async () => {
|
|
1935
|
+
if (v.size === 0) return;
|
|
1936
|
+
let e = _.filter((e) => v.has(e.path)), t = e.map((e) => e.name).join(", ");
|
|
1937
|
+
if (!confirm(`Are you sure you want to delete ${v.size} file(s)?\n\nFiles: ${t}\n\nThis action cannot be undone.`)) return;
|
|
1938
|
+
let i = await navigator.storage.getDirectory(), a = [], o = [];
|
|
1939
|
+
for (let t of e) if (!(n && !await n(t))) try {
|
|
1940
|
+
await zt(t.path, i), a.push(t.path);
|
|
1941
|
+
} catch (e) {
|
|
1942
|
+
o.push(`${t.name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
1943
|
+
}
|
|
1944
|
+
y(/* @__PURE__ */ new Set()), await g(), a.length > 0 && await r?.(a), o.length > 0 && alert(`Some deletions failed:\n${o.join("\n")}`);
|
|
1945
|
+
},
|
|
1946
|
+
className: Z.buttonDanger,
|
|
1947
|
+
children: /* @__PURE__ */ L("span", {
|
|
1948
|
+
className: "inline-flex items-center gap-2",
|
|
1949
|
+
children: [/* @__PURE__ */ I(Pt, {}), " Delete All"]
|
|
1950
|
+
})
|
|
1951
|
+
}),
|
|
1952
|
+
/* @__PURE__ */ I("button", {
|
|
1953
|
+
onClick: () => y(/* @__PURE__ */ new Set()),
|
|
1954
|
+
className: `text-sm cursor-pointer bg-transparent border-0 ${f.clearButton}`,
|
|
1955
|
+
children: "Clear selection"
|
|
1956
|
+
})
|
|
1957
|
+
]
|
|
1958
|
+
})]
|
|
1959
|
+
}),
|
|
1960
|
+
/* @__PURE__ */ I("div", {
|
|
1961
|
+
className: "mt-8",
|
|
1962
|
+
children: m ? /* @__PURE__ */ L("div", {
|
|
1963
|
+
className: "flex justify-center items-center py-12 gap-3",
|
|
1964
|
+
children: [/* @__PURE__ */ I("span", {
|
|
1965
|
+
style: { animation: "opfs-spin 1s linear infinite" },
|
|
1966
|
+
children: /* @__PURE__ */ I(Ft, {})
|
|
1967
|
+
}), /* @__PURE__ */ I("span", {
|
|
1968
|
+
className: f.loadingText,
|
|
1969
|
+
children: "Loading files..."
|
|
1970
|
+
})]
|
|
1971
|
+
}) : h ? /* @__PURE__ */ L("div", {
|
|
1972
|
+
className: `${Z.errorBox} ${f.errorBox}`,
|
|
1973
|
+
children: [/* @__PURE__ */ I("h3", {
|
|
1974
|
+
className: `m-0 text-sm font-medium ${f.errorTitle}`,
|
|
1975
|
+
children: "Error"
|
|
1976
|
+
}), /* @__PURE__ */ I("div", {
|
|
1977
|
+
className: `mt-2 text-sm ${f.errorText}`,
|
|
1978
|
+
children: h
|
|
1979
|
+
})]
|
|
1980
|
+
}) : _.length === 0 ? /* @__PURE__ */ L("div", {
|
|
1981
|
+
className: Z.emptyState,
|
|
1982
|
+
children: [
|
|
1983
|
+
/* @__PURE__ */ I("span", {
|
|
1984
|
+
className: f.emptyIcon,
|
|
1985
|
+
children: /* @__PURE__ */ I(Mt, {})
|
|
1986
|
+
}),
|
|
1987
|
+
/* @__PURE__ */ I("h3", {
|
|
1988
|
+
className: `mt-2 text-sm font-semibold ${f.emptyTitle}`,
|
|
1989
|
+
children: "No files"
|
|
1990
|
+
}),
|
|
1991
|
+
/* @__PURE__ */ I("p", {
|
|
1992
|
+
className: `mt-1 text-sm ${f.emptyText}`,
|
|
1993
|
+
children: "No files found in OPFS."
|
|
1994
|
+
})
|
|
1995
|
+
]
|
|
1996
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1997
|
+
className: "overflow-x-auto",
|
|
1998
|
+
children: /* @__PURE__ */ L("table", {
|
|
1999
|
+
className: Z.table,
|
|
2000
|
+
children: [/* @__PURE__ */ I("thead", { children: /* @__PURE__ */ L("tr", {
|
|
2001
|
+
className: f.tableBorder,
|
|
2002
|
+
children: [
|
|
2003
|
+
/* @__PURE__ */ I("th", {
|
|
2004
|
+
className: `${Z.tableHeader} w-10 ${f.tableHeader}`,
|
|
2005
|
+
children: /* @__PURE__ */ I("input", {
|
|
2006
|
+
ref: b,
|
|
2007
|
+
type: "checkbox",
|
|
2008
|
+
checked: x,
|
|
2009
|
+
onChange: w,
|
|
2010
|
+
"aria-label": "Select all"
|
|
2011
|
+
})
|
|
2012
|
+
}),
|
|
2013
|
+
/* @__PURE__ */ I("th", {
|
|
2014
|
+
className: `${Z.tableHeader} ${f.tableHeader}`,
|
|
2015
|
+
children: "Name"
|
|
2016
|
+
}),
|
|
2017
|
+
/* @__PURE__ */ I("th", {
|
|
2018
|
+
className: `${Z.tableHeader} ${f.tableHeader}`,
|
|
2019
|
+
children: "Path"
|
|
2020
|
+
}),
|
|
2021
|
+
/* @__PURE__ */ I("th", {
|
|
2022
|
+
className: `${Z.tableHeader} ${f.tableHeader}`,
|
|
2023
|
+
children: "Size"
|
|
2024
|
+
}),
|
|
2025
|
+
/* @__PURE__ */ I("th", {
|
|
2026
|
+
className: `${Z.tableHeader} ${f.tableHeader}`,
|
|
2027
|
+
children: "Type"
|
|
2028
|
+
}),
|
|
2029
|
+
/* @__PURE__ */ I("th", {
|
|
2030
|
+
className: `${Z.tableHeader} ${f.tableHeader}`,
|
|
2031
|
+
children: "Modified"
|
|
2032
|
+
}),
|
|
2033
|
+
/* @__PURE__ */ I("th", {
|
|
2034
|
+
className: `${Z.tableHeader} w-24 ${f.tableHeader}`,
|
|
2035
|
+
"aria-label": "Actions"
|
|
2036
|
+
})
|
|
2037
|
+
]
|
|
2038
|
+
}) }), /* @__PURE__ */ I("tbody", {
|
|
2039
|
+
className: `divide-y ${f.tableBorder}`,
|
|
2040
|
+
children: _.map((e) => /* @__PURE__ */ L("tr", {
|
|
2041
|
+
className: f.tableRow,
|
|
2042
|
+
children: [
|
|
2043
|
+
/* @__PURE__ */ I("td", {
|
|
2044
|
+
className: `${Z.tableCell} ${f.tableCell}`,
|
|
2045
|
+
children: /* @__PURE__ */ I("input", {
|
|
2046
|
+
type: "checkbox",
|
|
2047
|
+
checked: v.has(e.path),
|
|
2048
|
+
onChange: () => C(e.path),
|
|
2049
|
+
"aria-label": `Select ${e.name}`
|
|
2050
|
+
})
|
|
2051
|
+
}),
|
|
2052
|
+
/* @__PURE__ */ I("td", {
|
|
2053
|
+
className: `${Z.tableCell} ${f.tableCell}`,
|
|
2054
|
+
children: /* @__PURE__ */ L("span", {
|
|
2055
|
+
className: "flex items-center gap-2",
|
|
2056
|
+
children: [/* @__PURE__ */ I(Nt, {}), e.name]
|
|
2057
|
+
})
|
|
2058
|
+
}),
|
|
2059
|
+
/* @__PURE__ */ I("td", {
|
|
2060
|
+
className: `${Z.tableCell} ${f.tableCellMuted}`,
|
|
2061
|
+
children: /* @__PURE__ */ I("code", {
|
|
2062
|
+
className: `text-xs px-2 py-1 rounded border ${f.codeBlock}`,
|
|
2063
|
+
children: e.path
|
|
2064
|
+
})
|
|
2065
|
+
}),
|
|
2066
|
+
/* @__PURE__ */ I("td", {
|
|
2067
|
+
className: `${Z.tableCell} ${f.tableCellMuted}`,
|
|
2068
|
+
children: It(e.size)
|
|
2069
|
+
}),
|
|
2070
|
+
/* @__PURE__ */ I("td", {
|
|
2071
|
+
className: `${Z.tableCell} ${f.tableCellMuted}`,
|
|
2072
|
+
children: e.type
|
|
2073
|
+
}),
|
|
2074
|
+
/* @__PURE__ */ I("td", {
|
|
2075
|
+
className: `${Z.tableCell} ${f.tableCellMuted}`,
|
|
2076
|
+
children: Lt(e.lastModified)
|
|
2077
|
+
}),
|
|
2078
|
+
/* @__PURE__ */ I("td", {
|
|
2079
|
+
className: Z.tableCell,
|
|
2080
|
+
children: /* @__PURE__ */ L("div", {
|
|
2081
|
+
className: "flex gap-2 justify-end",
|
|
2082
|
+
children: [/* @__PURE__ */ I("button", {
|
|
2083
|
+
type: "button",
|
|
2084
|
+
onClick: () => T(e),
|
|
2085
|
+
title: "Download",
|
|
2086
|
+
className: `p-1.5 rounded cursor-pointer bg-transparent border-0 transition-colors ${f.actionButton}`,
|
|
2087
|
+
children: /* @__PURE__ */ I(jt, {})
|
|
2088
|
+
}), /* @__PURE__ */ I("button", {
|
|
2089
|
+
type: "button",
|
|
2090
|
+
onClick: () => E(e),
|
|
2091
|
+
title: "Delete",
|
|
2092
|
+
className: `p-1.5 rounded cursor-pointer bg-transparent border-0 transition-colors ${f.deleteButton}`,
|
|
2093
|
+
children: /* @__PURE__ */ I(Pt, {})
|
|
2094
|
+
})]
|
|
2095
|
+
})
|
|
2096
|
+
})
|
|
2097
|
+
]
|
|
2098
|
+
}, e.path))
|
|
2099
|
+
})]
|
|
2100
|
+
})
|
|
2101
|
+
})
|
|
2102
|
+
})
|
|
2103
|
+
]
|
|
2104
|
+
});
|
|
1958
2105
|
}
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
2106
|
+
//#endregion
|
|
2107
|
+
//#region src/SeedImage.tsx
|
|
2108
|
+
var Q = P("seedSdk:react:SeedImage"), $ = /* @__PURE__ */ new Map(), Ht = (e) => {
|
|
2109
|
+
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
2110
|
+
return t && t[2] ? t[2] : e;
|
|
1962
2111
|
};
|
|
1963
|
-
function
|
|
1964
|
-
|
|
2112
|
+
function Ut(e) {
|
|
2113
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1965
2114
|
}
|
|
1966
|
-
function
|
|
1967
|
-
|
|
1968
|
-
|
|
2115
|
+
function Wt(e, t) {
|
|
2116
|
+
let n = RegExp(`^${Ut(t)}$`), r = Ht(e);
|
|
2117
|
+
return n.test(r);
|
|
1969
2118
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2119
|
+
var Gt = e.memo(({ imageProperty: t, width: n, filename: r, ...a }) => {
|
|
2120
|
+
let [o, s] = c(), [l, u] = c(), { property: f } = De({
|
|
2121
|
+
propertyName: t.propertyName,
|
|
2122
|
+
seedLocalId: t.seedLocalId,
|
|
2123
|
+
seedUid: t.seedUid
|
|
2124
|
+
}), p = t ?? f, m = r ?? p?.refResolvedValue ?? p?.value, h = p?.value, g = typeof h == "string" ? h : m, _ = h != null && (h instanceof File || h instanceof Blob), [v, y] = c(null), b = e.useRef(null);
|
|
2125
|
+
i(() => {
|
|
2126
|
+
if (_ && (h instanceof File || h instanceof Blob)) return b.current || (b.current = URL.createObjectURL(h), y(b.current)), () => {
|
|
2127
|
+
b.current && (URL.revokeObjectURL(b.current), b.current = null), y(null);
|
|
2128
|
+
};
|
|
2129
|
+
b.current = null, y(null);
|
|
2130
|
+
}, [_, h]), i(() => {
|
|
2131
|
+
if (!m || h && ((e) => typeof e == "string" && e.startsWith("blob:"))(h) || v) return;
|
|
2132
|
+
let e = !1;
|
|
2133
|
+
return (async () => {
|
|
2134
|
+
try {
|
|
2135
|
+
let t = p?.localStoragePath ? p.localStoragePath : `${d.getFilesPath("images")}/${m}`;
|
|
2136
|
+
if (await d.pathExists(t)) {
|
|
2137
|
+
let n = await d.getContentUrlFromPath(t);
|
|
2138
|
+
!e && n && u(n);
|
|
2139
|
+
}
|
|
2140
|
+
} catch (e) {
|
|
2141
|
+
Q("_getOriginalContentUrl error", e);
|
|
2142
|
+
}
|
|
2143
|
+
})(), () => {
|
|
2144
|
+
e = !0;
|
|
2145
|
+
};
|
|
2146
|
+
}, [
|
|
2147
|
+
m,
|
|
2148
|
+
h,
|
|
2149
|
+
v,
|
|
2150
|
+
p?.localStoragePath
|
|
2151
|
+
]), i(() => {
|
|
2152
|
+
!n || !m || (async () => {
|
|
2153
|
+
try {
|
|
2154
|
+
let e = await d.getFs(), t = p?.localStoragePath ? p.localStoragePath.split("/").slice(0, -1).join("/") : d.getFilesPath("images"), r = e.readdirSync(t, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => parseInt(e.name)), i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a = Ht(m), o = `${a}-${i}`;
|
|
2155
|
+
if ($.has(o)) try {
|
|
2156
|
+
let e = $.get(o);
|
|
2157
|
+
if (e && (await fetch(e)).ok) {
|
|
2158
|
+
s(e);
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
} catch (e) {
|
|
2162
|
+
Q("error", e), $.delete(o);
|
|
2163
|
+
}
|
|
2164
|
+
let c = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ? Wt(e.name, a) : !1);
|
|
2165
|
+
if (!c) return;
|
|
2166
|
+
let l = `${t}/${i}/${c?.name}`;
|
|
2167
|
+
if (await d.pathExists(l)) {
|
|
2168
|
+
let e = await d.getContentUrlFromPath(l);
|
|
2169
|
+
e && ($.set(o, e), s(e));
|
|
2170
|
+
}
|
|
2171
|
+
} catch (e) {
|
|
2172
|
+
Q("_getSizedContentUrl error", e);
|
|
2173
|
+
}
|
|
2174
|
+
})();
|
|
2175
|
+
}, [
|
|
2176
|
+
p,
|
|
2177
|
+
n,
|
|
2178
|
+
g,
|
|
2179
|
+
m
|
|
2180
|
+
]);
|
|
2181
|
+
let x = (e) => typeof e == "string" && e.startsWith("blob:");
|
|
2182
|
+
return !(o || l || v || g && x(g)) && !m ? null : /* @__PURE__ */ I("img", {
|
|
2183
|
+
src: o || l || v || (x(g) ? g : void 0) || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
2184
|
+
alt: a.alt || t.propertyName || "Image",
|
|
2185
|
+
...a
|
|
2186
|
+
});
|
|
2187
|
+
}, (e, t) => e.imageProperty === t.imageProperty && e.width === t.width && e.filename === t.filename);
|
|
2188
|
+
//#endregion
|
|
2189
|
+
//#region src/useResolvedMediaRef.ts
|
|
2190
|
+
function Kt(e) {
|
|
2191
|
+
let { value: t, enabled: r = !0, treatAs: a } = e, [o, s] = c(0), [l, u] = c(null), [d, f] = c(null), [p, m] = c("idle");
|
|
2192
|
+
i(() => {
|
|
2193
|
+
let e = !1;
|
|
2194
|
+
return (async () => {
|
|
2195
|
+
if (!r || t == null || String(t).trim() === "") {
|
|
2196
|
+
e || (u(null), f(null), m("idle"));
|
|
2197
|
+
return;
|
|
2198
|
+
}
|
|
2199
|
+
e || (m("loading"), f(null));
|
|
2200
|
+
try {
|
|
2201
|
+
let n = await ie(String(t), { treatAs: a });
|
|
2202
|
+
if (e) return;
|
|
2203
|
+
u(n), n.status === "empty" ? m("empty") : n.status === "ready" ? m("ready") : m("unresolved");
|
|
2204
|
+
} catch (t) {
|
|
2205
|
+
if (e) return;
|
|
2206
|
+
f(t instanceof Error ? t : Error(String(t))), u(null), m("error");
|
|
2207
|
+
}
|
|
2208
|
+
})(), () => {
|
|
2209
|
+
e = !0;
|
|
2210
|
+
};
|
|
2211
|
+
}, [
|
|
2212
|
+
r,
|
|
2213
|
+
t,
|
|
2214
|
+
a,
|
|
2215
|
+
o
|
|
2216
|
+
]);
|
|
2217
|
+
let h = n(() => {
|
|
2218
|
+
s((e) => e + 1);
|
|
2219
|
+
}, []);
|
|
2220
|
+
return {
|
|
2221
|
+
href: l && l.status === "ready" ? l.href : void 0,
|
|
2222
|
+
status: p,
|
|
2223
|
+
source: l && l.status === "ready" ? l.source : void 0,
|
|
2224
|
+
error: d,
|
|
2225
|
+
result: l,
|
|
2226
|
+
refetch: h
|
|
2227
|
+
};
|
|
2069
2228
|
}
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
})
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2229
|
+
//#endregion
|
|
2230
|
+
//#region src/SeedMediaImage.tsx
|
|
2231
|
+
function qt({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
2232
|
+
let { href: o } = Kt({
|
|
2233
|
+
value: e,
|
|
2234
|
+
enabled: t,
|
|
2235
|
+
treatAs: n
|
|
2236
|
+
});
|
|
2237
|
+
if (!o) return null;
|
|
2238
|
+
let s = {
|
|
2239
|
+
...a,
|
|
2240
|
+
src: o,
|
|
2241
|
+
alt: i ?? ""
|
|
2242
|
+
};
|
|
2243
|
+
return r ? /* @__PURE__ */ I(F, { children: r(s) }) : /* @__PURE__ */ I("img", { ...s });
|
|
2083
2244
|
}
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2245
|
+
//#endregion
|
|
2246
|
+
//#region src/SeedMediaFile.tsx
|
|
2247
|
+
function Jt(e) {
|
|
2248
|
+
try {
|
|
2249
|
+
return new URL(e).pathname.split("/").filter(Boolean).pop() || "Open";
|
|
2250
|
+
} catch {
|
|
2251
|
+
return "Open";
|
|
2252
|
+
}
|
|
2090
2253
|
}
|
|
2091
|
-
function
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2254
|
+
function Yt(e) {
|
|
2255
|
+
try {
|
|
2256
|
+
let t = new URL(e).protocol;
|
|
2257
|
+
return t === "http:" || t === "https:";
|
|
2258
|
+
} catch {
|
|
2259
|
+
return !1;
|
|
2260
|
+
}
|
|
2098
2261
|
}
|
|
2099
|
-
function
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
href: i,
|
|
2116
|
-
download: n,
|
|
2117
|
-
target: u,
|
|
2118
|
-
rel: c ?? (d && u === "_blank" ? "noopener noreferrer" : void 0),
|
|
2119
|
-
children: a ?? Xt(i)
|
|
2120
|
-
};
|
|
2121
|
-
return o ? /* @__PURE__ */ g(Se, { children: o(f) }) : /* @__PURE__ */ g("a", { ...f });
|
|
2262
|
+
function Xt({ value: e, enabled: t, treatAs: n, download: r, render: i, children: a, target: o, rel: s, ...c }) {
|
|
2263
|
+
let { href: l } = Kt({
|
|
2264
|
+
value: e,
|
|
2265
|
+
enabled: t,
|
|
2266
|
+
treatAs: n
|
|
2267
|
+
});
|
|
2268
|
+
if (!l) return null;
|
|
2269
|
+
let u = Yt(l), d = o === void 0 ? u ? "_blank" : void 0 : o, f = {
|
|
2270
|
+
...c,
|
|
2271
|
+
href: l,
|
|
2272
|
+
download: r,
|
|
2273
|
+
target: d,
|
|
2274
|
+
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
2275
|
+
children: a ?? Jt(l)
|
|
2276
|
+
};
|
|
2277
|
+
return i ? /* @__PURE__ */ I(F, { children: i(f) }) : /* @__PURE__ */ I("a", { ...f });
|
|
2122
2278
|
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2279
|
+
//#endregion
|
|
2280
|
+
//#region src/SeedHtml.tsx
|
|
2281
|
+
function Zt(e) {
|
|
2282
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
2125
2283
|
}
|
|
2126
|
-
function
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
return null;
|
|
2134
|
-
const o = t(e);
|
|
2135
|
-
return r ? /* @__PURE__ */ g(Se, { children: r({ html: o }) }) : /* @__PURE__ */ g("div", { ...n, dangerouslySetInnerHTML: { __html: o } });
|
|
2284
|
+
function Qt({ html: e, sanitize: t, render: n, ...r }) {
|
|
2285
|
+
if (!Zt(e)) return null;
|
|
2286
|
+
let i = t(e);
|
|
2287
|
+
return n ? /* @__PURE__ */ I(F, { children: n({ html: i }) }) : /* @__PURE__ */ I("div", {
|
|
2288
|
+
...r,
|
|
2289
|
+
dangerouslySetInnerHTML: { __html: i }
|
|
2290
|
+
});
|
|
2136
2291
|
}
|
|
2137
|
-
|
|
2138
|
-
|
|
2292
|
+
//#endregion
|
|
2293
|
+
//#region src/formatSeedJson.ts
|
|
2294
|
+
function $t(e, t) {
|
|
2295
|
+
return e.length <= t ? e : `${e.slice(0, t)}…`;
|
|
2139
2296
|
}
|
|
2140
|
-
function
|
|
2141
|
-
|
|
2142
|
-
|
|
2297
|
+
function en(e) {
|
|
2298
|
+
let t = e.trim();
|
|
2299
|
+
return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
|
|
2143
2300
|
}
|
|
2144
|
-
function
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
if (o.has(e))
|
|
2158
|
-
return "[Circular]";
|
|
2159
|
-
if (n >= t)
|
|
2160
|
-
return "[Max depth]";
|
|
2161
|
-
if (o.add(e), Array.isArray(e))
|
|
2162
|
-
return e.map((s) => Fe(s, t, r, n + 1, o));
|
|
2163
|
-
const a = {};
|
|
2164
|
-
for (const [s, c] of Object.entries(e))
|
|
2165
|
-
a[s] = Fe(c, t, r, n + 1, o);
|
|
2166
|
-
return a;
|
|
2301
|
+
function tn(e, t, n, r, i) {
|
|
2302
|
+
if (typeof e == "bigint") return String(e);
|
|
2303
|
+
if (typeof e == "symbol") return e.toString();
|
|
2304
|
+
if (typeof e == "function") return "[Function]";
|
|
2305
|
+
if (e instanceof Date) return e.toISOString();
|
|
2306
|
+
if (typeof e == "string") return $t(e, n);
|
|
2307
|
+
if (typeof e != "object" || !e) return e;
|
|
2308
|
+
if (i.has(e)) return "[Circular]";
|
|
2309
|
+
if (r >= t) return "[Max depth]";
|
|
2310
|
+
if (i.add(e), Array.isArray(e)) return e.map((e) => tn(e, t, n, r + 1, i));
|
|
2311
|
+
let a = {};
|
|
2312
|
+
for (let [o, s] of Object.entries(e)) a[o] = tn(s, t, n, r + 1, i);
|
|
2313
|
+
return a;
|
|
2167
2314
|
}
|
|
2168
|
-
function
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
try {
|
|
2186
|
-
return JSON.stringify(s, null, o);
|
|
2187
|
-
} catch {
|
|
2188
|
-
return "[Unserializable JSON]";
|
|
2189
|
-
}
|
|
2315
|
+
function nn(e, t) {
|
|
2316
|
+
let n = t?.maxDepth ?? 6, r = t?.maxStringLength ?? 5e4, i = t?.space ?? 2;
|
|
2317
|
+
if (e === void 0) return "undefined";
|
|
2318
|
+
if (e === null) return "null";
|
|
2319
|
+
let a = e;
|
|
2320
|
+
if (typeof e == "string") if (en(e)) try {
|
|
2321
|
+
a = JSON.parse(e);
|
|
2322
|
+
} catch {
|
|
2323
|
+
return $t(e, r);
|
|
2324
|
+
}
|
|
2325
|
+
else return $t(e, r);
|
|
2326
|
+
let o = tn(a, n, r, 0, /* @__PURE__ */ new WeakSet());
|
|
2327
|
+
try {
|
|
2328
|
+
return JSON.stringify(o, null, i);
|
|
2329
|
+
} catch {
|
|
2330
|
+
return "[Unserializable JSON]";
|
|
2331
|
+
}
|
|
2190
2332
|
}
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
return n ? /* @__PURE__ */ g(Se, { children: n({ text: a }) }) : /* @__PURE__ */ g("pre", { ...o, children: a });
|
|
2333
|
+
//#endregion
|
|
2334
|
+
//#region src/SeedJson.tsx
|
|
2335
|
+
function rn({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
2336
|
+
let a = t ? t(e) : nn(e, n);
|
|
2337
|
+
return r ? /* @__PURE__ */ I(F, { children: r({ text: a }) }) : /* @__PURE__ */ I("pre", {
|
|
2338
|
+
...i,
|
|
2339
|
+
children: a
|
|
2340
|
+
});
|
|
2200
2341
|
}
|
|
2201
|
-
|
|
2202
|
-
|
|
2342
|
+
//#endregion
|
|
2343
|
+
//#region src/useNormalizedFeedItemFields.ts
|
|
2344
|
+
function an(e, t) {
|
|
2345
|
+
return o(() => e ? re(e, t) : {}, [e, t]);
|
|
2203
2346
|
}
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
Qr as SeedClientGate,
|
|
2209
|
-
Jr as SeedHtml,
|
|
2210
|
-
Kr as SeedImage,
|
|
2211
|
-
Gr as SeedJson,
|
|
2212
|
-
Wr as SeedMediaFile,
|
|
2213
|
-
jr as SeedMediaImage,
|
|
2214
|
-
Hr as SeedProvider,
|
|
2215
|
-
Bt as createSeedQueryClient,
|
|
2216
|
-
rr as formatSeedJson,
|
|
2217
|
-
Xe as getSeedQueryDefaultOptions,
|
|
2218
|
-
Je as getServiceName,
|
|
2219
|
-
Re as getServiceUniqueKey,
|
|
2220
|
-
ke as getServiceValue,
|
|
2221
|
-
zr as invalidateItemPropertiesForItem,
|
|
2222
|
-
$t as mergeSeedQueryDefaults,
|
|
2223
|
-
_r as useAllSchemaVersions,
|
|
2224
|
-
hr as useCreateItem,
|
|
2225
|
-
vr as useCreateItemProperty,
|
|
2226
|
-
Fr as useCreateModel,
|
|
2227
|
-
Tr as useCreateModelProperty,
|
|
2228
|
-
xr as useCreateSchema,
|
|
2229
|
-
Lr as useDbsAreReady,
|
|
2230
|
-
br as useDebouncedItemProperty,
|
|
2231
|
-
kr as useDeleteItem,
|
|
2232
|
-
wr as useDestroyItemProperty,
|
|
2233
|
-
Cr as useDestroyModel,
|
|
2234
|
-
Mr as useDestroyModelProperty,
|
|
2235
|
-
Nr as useDestroySchema,
|
|
2236
|
-
qr as useEasSyncProcessById,
|
|
2237
|
-
Or as useEasSyncProcesses,
|
|
2238
|
-
Ur as useEasSyncProcessesNonActiveCount,
|
|
2239
|
-
Mt as useEasSyncProcessesState,
|
|
2240
|
-
Br as useFiles,
|
|
2241
|
-
_t as useGlobalServiceStatus,
|
|
2242
|
-
xt as useHasSavedSnapshots,
|
|
2243
|
-
$r as useImageFiles,
|
|
2244
|
-
At as useIsDbReady,
|
|
2245
|
-
pr as useItem,
|
|
2246
|
-
Sr as useItemProperties,
|
|
2247
|
-
We as useItemProperty,
|
|
2248
|
-
mr as useItems,
|
|
2249
|
-
Y as useLiveQuery,
|
|
2250
|
-
Rt as useModel,
|
|
2251
|
-
Rr as useModelProperties,
|
|
2252
|
-
Pr as useModelProperty,
|
|
2253
|
-
Ct as useModels,
|
|
2254
|
-
Yr as useNormalizedFeedItemFields,
|
|
2255
|
-
qt as useOPFSFiles,
|
|
2256
|
-
Er as usePersistedSnapshots,
|
|
2257
|
-
gr as usePublishItem,
|
|
2258
|
-
tt as useResolvedMediaRef,
|
|
2259
|
-
Dt as useSchema,
|
|
2260
|
-
Ar as useSchemas,
|
|
2261
|
-
je as useSeedAddressRevision,
|
|
2262
|
-
Dr as useSeedProtocolSchema,
|
|
2263
|
-
Ir as useService,
|
|
2264
|
-
Nt as useServices
|
|
2265
|
-
};
|
|
2266
|
-
//# sourceMappingURL=index.js.map
|
|
2347
|
+
//#endregion
|
|
2348
|
+
export { W as ADDRESSES_PERSISTED_EVENT, ft as FILES_QUERY_KEY_PREFIX, Vt as OPFSFilesManager, Ot as SeedClientGate, Qt as SeedHtml, Gt as SeedImage, rn as SeedJson, Xt as SeedMediaFile, qt as SeedMediaImage, Et as SeedProvider, St as createSeedQueryClient, nn as formatSeedJson, bt as getSeedQueryDefaultOptions, Fe as getServiceName, X as getServiceUniqueKey, Ie as getServiceValue, wt as invalidateItemPropertiesForItem, xt as mergeSeedQueryDefaults, Xe as useAllSchemaVersions, Te as useCreateItem, je as useCreateItemProperty, nt as useCreateModel, st as useCreateModelProperty, Je as useCreateSchema, Ue as useDbsAreReady, Oe as useDebouncedItemProperty, lt as useDeleteItem, Me as useDestroyItemProperty, rt as useDestroyModel, ct as useDestroyModelProperty, Ye as useDestroySchema, vt as useEasSyncProcessById, gt as useEasSyncProcesses, _t as useEasSyncProcessesNonActiveCount, ht as useEasSyncProcessesState, pt as useFiles, He as useGlobalServiceStatus, Be as useHasSavedSnapshots, dt as useImageFiles, Re as useIsDbReady, Se as useItem, Ae as useItemProperties, De as useItemProperty, we as useItems, K as useLiveQuery, tt as useModel, it as useModelProperties, ot as useModelProperty, et as useModels, an as useNormalizedFeedItemFields, At as useOPFSFiles, ze as usePersistedSnapshots, Ee as usePublishItem, Kt as useResolvedMediaRef, Ge as useSchema, qe as useSchemas, G as useSeedAddressRevision, Ze as useSeedProtocolSchema, Le as useService, Ve as useServices };
|
|
2349
|
+
|
|
2350
|
+
//# sourceMappingURL=index.js.map
|