@seedprotocol/react 0.7.9-next.1189.g5e63267 → 0.7.9-next.1306.g4ff6582
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/SeedProvider.d.ts +3 -8
- package/dist/SeedProvider.d.ts.map +1 -1
- package/dist/client.d.ts +2 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/db.d.ts.map +1 -1
- package/dist/index.js +729 -743
- package/dist/index.js.map +1 -1
- package/dist/itemProperty.d.ts.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/services.d.ts.map +1 -1
- package/dist/useCreateState.d.ts +4 -3
- package/dist/useCreateState.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useInsertionEffect as a, useMemo as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
|
|
3
3
|
import { flushSync as u } from "react-dom";
|
|
4
|
-
import { BaseArweaveClient as d, BaseDb as f, BaseFileManager as p, ClientManagerState as m, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as h, FILES_CHANGED_EVENT as g, Item as _, ItemProperty as v, ItemPropertySaveValidationError as y, MachineIds as b, Model as x, ModelProperty as S, SEED_PROTOCOL_SCHEMA_NAME as C, Schema as w, client as T, easName as ee, easSyncProcesses as E, ensureImageLocal as te, eventEmitter as D, getAddressesForItemsFilter as ne, getArweaveReadBaseUrls as O, getClient as k, getPropertySchema as A, getSchemaNameFromId as re, getVersionData as ie, isChangeFeedRunning as j,
|
|
5
|
-
import { debounce as
|
|
6
|
-
import
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { QueryClient as
|
|
9
|
-
import { and as
|
|
10
|
-
import
|
|
4
|
+
import { BaseArweaveClient as d, BaseDb as f, BaseFileManager as p, ClientManagerState as m, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as h, FILES_CHANGED_EVENT as g, Item as _, ItemProperty as v, ItemPropertySaveValidationError as y, MachineIds as b, Model as x, ModelProperty as S, SEED_PROTOCOL_SCHEMA_NAME as C, Schema as w, client as T, easName as ee, easSyncProcesses as E, ensureImageLocal as te, eventEmitter as D, getAddressesForItemsFilter as ne, getArweaveReadBaseUrls as O, getClient as k, getPropertySchema as A, getSchemaNameFromId as re, getVersionData as ie, isChangeFeedRunning as j, isClientReadySnapshot as ae, isValidEasAttestationUid as oe, loadAllSchemasFromDb as se, metadata as M, modelSchemas as ce, models as le, normalizeArweaveTxIdForEnsure as ue, normalizeFeedItemFields as N, ownedSeedsSql as P, pickLatestMetadataRowPerProperty as de, placeholderUidSql as fe, properties as F, publisherInAddressListSql as pe, resolveMediaRef as I, schemas as L, seeds as R, watchEntityRows as me } from "@seedprotocol/sdk";
|
|
5
|
+
import { debounce as he, orderBy as ge, startCase as _e } from "lodash-es";
|
|
6
|
+
import ve from "debug";
|
|
7
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
8
|
+
import { QueryClient as ye, QueryClientContext as be, QueryClientProvider as H, useQuery as U, useQueryClient as xe } from "@tanstack/react-query";
|
|
9
|
+
import { and as W, desc as Se, eq as G, gt as Ce, isNotNull as we, isNull as Te, or as Ee } from "drizzle-orm";
|
|
10
|
+
import De from "pluralize";
|
|
11
11
|
//#region src/client.ts
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
let t =
|
|
12
|
+
var Oe = (e) => k().subscribeService(e), ke = () => k().getService(), Ae = () => l(Oe, ke, ke);
|
|
13
|
+
function K(e) {
|
|
14
|
+
let t = Ae(), r = s(e);
|
|
15
15
|
r.current = e;
|
|
16
16
|
let i = n((e) => {
|
|
17
17
|
let n = t.subscribe({
|
|
@@ -25,11 +25,11 @@ function Oe(e) {
|
|
|
25
25
|
}, [t]), a = () => r.current(t.getSnapshot());
|
|
26
26
|
return l(i, a, a);
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
return r(
|
|
28
|
+
var q = () => K(ae), je = "addresses.persisted", J = "localCopies.removed", Me = t(0);
|
|
29
|
+
function Ne() {
|
|
30
|
+
return r(Me);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Pe({ queryClient: e, children: t }) {
|
|
33
33
|
let [r, a] = c(0), o = n(() => {
|
|
34
34
|
e.invalidateQueries({
|
|
35
35
|
queryKey: ["seed", "items"],
|
|
@@ -42,19 +42,19 @@ function Ne({ queryClient: e, children: t }) {
|
|
|
42
42
|
exact: !1
|
|
43
43
|
}), a((e) => e + 1);
|
|
44
44
|
}, [e]);
|
|
45
|
-
return i(() => (D.on(
|
|
46
|
-
D.off(
|
|
47
|
-
}), [o]), /* @__PURE__ */
|
|
45
|
+
return i(() => (D.on(je, o), D.on(J, o), () => {
|
|
46
|
+
D.off(je, o), D.off(J, o);
|
|
47
|
+
}), [o]), /* @__PURE__ */ B(Me.Provider, {
|
|
48
48
|
value: r,
|
|
49
49
|
children: t
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region src/liveQuery.ts
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function Y(e) {
|
|
55
|
+
return Re(e).data;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Fe(e) {
|
|
58
58
|
if (e && typeof e == "object" && typeof e.toSQL == "function") try {
|
|
59
59
|
let { sql: t, params: n } = e.toSQL();
|
|
60
60
|
return `sql:${t}|${JSON.stringify(n)}`;
|
|
@@ -63,19 +63,19 @@ function Pe(e) {
|
|
|
63
63
|
}
|
|
64
64
|
return e;
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var Ie = [
|
|
67
67
|
500,
|
|
68
68
|
1e3,
|
|
69
69
|
2e3,
|
|
70
70
|
5e3,
|
|
71
71
|
1e4,
|
|
72
72
|
3e4
|
|
73
|
-
],
|
|
74
|
-
function
|
|
73
|
+
], Le = (e) => e instanceof Error ? e : Error(String(e));
|
|
74
|
+
function Re(e) {
|
|
75
75
|
let [t, n] = c({
|
|
76
76
|
data: void 0,
|
|
77
77
|
error: null
|
|
78
|
-
}), [r, a] = c(0), o =
|
|
78
|
+
}), [r, a] = c(0), o = q(), l = Fe(e), u = s(e);
|
|
79
79
|
u.current = e;
|
|
80
80
|
let d = s(0), p = s(null);
|
|
81
81
|
return i(() => {
|
|
@@ -92,9 +92,9 @@ function Le(e) {
|
|
|
92
92
|
let r, i = (e) => {
|
|
93
93
|
n((t) => ({
|
|
94
94
|
data: t.data,
|
|
95
|
-
error:
|
|
95
|
+
error: Le(e)
|
|
96
96
|
}));
|
|
97
|
-
let t =
|
|
97
|
+
let t = Ie[Math.min(d.current, Ie.length - 1)];
|
|
98
98
|
d.current += 1, r = setTimeout(() => a((e) => e + 1), t);
|
|
99
99
|
}, s;
|
|
100
100
|
try {
|
|
@@ -121,16 +121,16 @@ function Le(e) {
|
|
|
121
121
|
}
|
|
122
122
|
//#endregion
|
|
123
123
|
//#region src/queryClient.ts
|
|
124
|
-
var
|
|
124
|
+
var ze = { queries: {
|
|
125
125
|
networkMode: "offlineFirst",
|
|
126
126
|
gcTime: 864e5,
|
|
127
127
|
staleTime: 6e4
|
|
128
128
|
} };
|
|
129
|
-
function
|
|
130
|
-
return { ...
|
|
129
|
+
function Be() {
|
|
130
|
+
return { ...ze };
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
let t =
|
|
132
|
+
function Ve(e) {
|
|
133
|
+
let t = Be();
|
|
134
134
|
return e ? {
|
|
135
135
|
queries: {
|
|
136
136
|
...t.queries,
|
|
@@ -142,31 +142,31 @@ function Be(e) {
|
|
|
142
142
|
}
|
|
143
143
|
} : t;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
let t =
|
|
147
|
-
return new
|
|
145
|
+
function He(e) {
|
|
146
|
+
let t = Be(), { defaultOptions: n, ...r } = e ?? {};
|
|
147
|
+
return new ye({
|
|
148
148
|
...r,
|
|
149
|
-
defaultOptions: n ?
|
|
149
|
+
defaultOptions: n ? Ve(n) : t
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var Ue, We = !1, Ge = () => {
|
|
153
153
|
try {
|
|
154
154
|
return process.env.NODE_ENV !== "production";
|
|
155
155
|
} catch {
|
|
156
156
|
return !1;
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
function
|
|
160
|
-
return r(
|
|
159
|
+
function X() {
|
|
160
|
+
return r(be) || (!We && Ge() && (We = !0, console.warn("[@seedprotocol/react] A Seed hook ran outside SeedProvider (no QueryClientProvider found), so it uses a shared fallback QueryClient. Wrap the app in <SeedProvider>: from 0.8 these hooks will throw without it.")), Ue ?? (Ue = He()), Ue);
|
|
161
161
|
}
|
|
162
162
|
//#endregion
|
|
163
163
|
//#region src/item.ts
|
|
164
|
-
var
|
|
164
|
+
var Ke = ve("seedSdk:react:item"), qe = (e) => [
|
|
165
165
|
"seed",
|
|
166
166
|
"item",
|
|
167
167
|
e ?? null
|
|
168
|
-
],
|
|
169
|
-
let r = t || n, [, a] = c(0), [, l] = c(0), [u, d] = c(!1), [f, p] = c(null), m = s(!1), g =
|
|
168
|
+
], Je = ({ modelName: e, seedLocalId: t, seedUid: n }) => {
|
|
169
|
+
let r = t || n, [, a] = c(0), [, l] = c(0), [u, d] = c(!1), [f, p] = c(null), m = s(!1), g = q(), v = X(), y = o(() => qe(r), [r]), b = s(y);
|
|
170
170
|
b.current = y;
|
|
171
171
|
let x = U({
|
|
172
172
|
queryKey: y,
|
|
@@ -177,7 +177,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
177
177
|
seedUid: n
|
|
178
178
|
});
|
|
179
179
|
if (i) return i;
|
|
180
|
-
|
|
180
|
+
Ke("[useItem] no item found", e, r);
|
|
181
181
|
let a = v.getQueryData(y);
|
|
182
182
|
return a && a.getService().getSnapshot().status === "active" ? a : null;
|
|
183
183
|
},
|
|
@@ -198,7 +198,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
198
198
|
}, [v]), i(() => {
|
|
199
199
|
if (m.current = !1, d(!1), p(null), !S) return;
|
|
200
200
|
let e = S.getService().subscribe((e) => {
|
|
201
|
-
e && typeof e == "object" && "value" in e && (
|
|
201
|
+
e && typeof e == "object" && "value" in e && (S.status === "error" ? (p(/* @__PURE__ */ Error("Item service error")), d(!1)) : S.status === "ready" && e.value === "idle" ? (m.current = !0, d(!1), p(null)) : m.current && d(!0));
|
|
202
202
|
});
|
|
203
203
|
return () => e.unsubscribe();
|
|
204
204
|
}, [S]), i(() => {
|
|
@@ -228,18 +228,18 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
228
228
|
isLoading: !!r && x.isPending || u,
|
|
229
229
|
error: f ?? x.error
|
|
230
230
|
};
|
|
231
|
-
},
|
|
231
|
+
}, Ye = (e) => {
|
|
232
232
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
233
233
|
for (let r of e ?? []) {
|
|
234
234
|
if (!r.localId) continue;
|
|
235
|
-
let e =
|
|
235
|
+
let e = oe(r.uid) ? r.uid.toLowerCase() : "", i = r.lastVersionPublishedAt || r.attestationCreatedAt || r.createdAt;
|
|
236
236
|
i && t.set(r.localId, i), n.push(`${r.localId}:${e}:${i ?? ""}`);
|
|
237
237
|
}
|
|
238
238
|
return {
|
|
239
239
|
signature: n.sort().join(","),
|
|
240
240
|
sortTimes: t
|
|
241
241
|
};
|
|
242
|
-
},
|
|
242
|
+
}, Xe = (e, t, n, r, i, a, o) => [
|
|
243
243
|
"seed",
|
|
244
244
|
"items",
|
|
245
245
|
e ?? null,
|
|
@@ -251,8 +251,8 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
251
251
|
modelFileId: a ?? null,
|
|
252
252
|
schemaName: o ?? null
|
|
253
253
|
}] : []
|
|
254
|
-
],
|
|
255
|
-
let u =
|
|
254
|
+
], Ze = ({ modelName: e, modelFileId: t, schemaName: n, deleted: r = !1, includeEas: a = !1, addressFilter: l }) => {
|
|
255
|
+
let u = q(), d = Ne(), p = xe();
|
|
256
256
|
i(() => {
|
|
257
257
|
let e = () => {
|
|
258
258
|
p.invalidateQueries({ queryKey: ["seed", "items"] });
|
|
@@ -274,7 +274,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
274
274
|
e = !0;
|
|
275
275
|
};
|
|
276
276
|
}, [l, d]);
|
|
277
|
-
let S = o(() =>
|
|
277
|
+
let S = o(() => Xe(e, r, a, l, d, t, n), [
|
|
278
278
|
e,
|
|
279
279
|
r,
|
|
280
280
|
a,
|
|
@@ -300,10 +300,10 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
300
300
|
staleTime: 0
|
|
301
301
|
});
|
|
302
302
|
m.current = C;
|
|
303
|
-
let O = u ? f.getAppDb() : null, k =
|
|
303
|
+
let O = u ? f.getAppDb() : null, k = Y(o(() => {
|
|
304
304
|
if (!O || (l === "owned" || l === "watched") && b === null) return null;
|
|
305
305
|
let t = [];
|
|
306
|
-
a || t.push(
|
|
306
|
+
a || t.push(fe(R.uid)), e && t.push(G(R.type, ee(e))), l === "owned" ? t.push(P(b ?? [])) : l === "watched" && t.push(pe(R.publisher, b ?? [])), r ? t.push(G(R._markedForDeletion, 1)) : (t.push(Ee(Te(R._markedForDeletion), G(R._markedForDeletion, 0))), t.push(Ee(Te(R.revokedAt), G(R.revokedAt, 0))));
|
|
307
307
|
let n = ie();
|
|
308
308
|
return O.with(n).select({
|
|
309
309
|
localId: R.localId,
|
|
@@ -314,7 +314,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
314
314
|
attestationCreatedAt: R.attestationCreatedAt,
|
|
315
315
|
lastVersionPublishedAt: n.lastVersionPublishedAt,
|
|
316
316
|
_markedForDeletion: R._markedForDeletion
|
|
317
|
-
}).from(R).leftJoin(n,
|
|
317
|
+
}).from(R).leftJoin(n, G(R.localId, n.seedLocalId)).where(W(Ce(n.versionsCount, 0), ...t)).groupBy(R.localId);
|
|
318
318
|
}, [
|
|
319
319
|
O,
|
|
320
320
|
u,
|
|
@@ -323,7 +323,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
323
323
|
a,
|
|
324
324
|
l,
|
|
325
325
|
b
|
|
326
|
-
])), A = s(
|
|
326
|
+
])), A = s(Ye(void 0)), re = Ye(k);
|
|
327
327
|
re.signature !== A.current.signature && (A.current = re);
|
|
328
328
|
let j = A.current;
|
|
329
329
|
return i(() => {
|
|
@@ -338,7 +338,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
338
338
|
let n = e.seedLocalId || e.seedUid;
|
|
339
339
|
n && t.add(n);
|
|
340
340
|
}
|
|
341
|
-
e.size === 0 && t.size > 0 || (
|
|
341
|
+
e.size === 0 && t.size > 0 || (et(t, e) ? g.current = e : et(g.current, e) && (v.current > y.current || T) || (g.current = e, y.current = v.current, p.invalidateQueries({ queryKey: S })));
|
|
342
342
|
}, [
|
|
343
343
|
u,
|
|
344
344
|
k,
|
|
@@ -347,15 +347,15 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
347
347
|
E,
|
|
348
348
|
T
|
|
349
349
|
]), {
|
|
350
|
-
items: o(() =>
|
|
350
|
+
items: o(() => ge(C, [(e) => e.seedLocalId && j.sortTimes.get(e.seedLocalId) || e.lastVersionPublishedAt || e.attestationCreatedAt || e.createdAt], ["desc"]), [C, j]),
|
|
351
351
|
isLoading: w || !u,
|
|
352
352
|
error: te
|
|
353
353
|
};
|
|
354
|
-
},
|
|
354
|
+
}, Qe = () => {
|
|
355
355
|
let [e, t] = c(!1), [r, i] = c(null), a = s(null), o = n(() => i(null), []);
|
|
356
356
|
return {
|
|
357
357
|
createItem: n((e, n, r) => {
|
|
358
|
-
if (a.current) return
|
|
358
|
+
if (a.current) return Ke("[useCreateItem] [createItem] already creating item, returning the in-flight create"), a.current;
|
|
359
359
|
i(null), u(() => t(!0));
|
|
360
360
|
let o = (async () => {
|
|
361
361
|
try {
|
|
@@ -365,7 +365,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
365
365
|
...t
|
|
366
366
|
}, r) ?? void 0;
|
|
367
367
|
} catch (e) {
|
|
368
|
-
|
|
368
|
+
Ke("[useCreateItem] Error creating item:", e), i(e instanceof Error ? e : Error(String(e)));
|
|
369
369
|
return;
|
|
370
370
|
} finally {
|
|
371
371
|
a.current = null, queueMicrotask(() => t(!1));
|
|
@@ -377,7 +377,7 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
377
377
|
error: r,
|
|
378
378
|
resetError: o
|
|
379
379
|
};
|
|
380
|
-
},
|
|
380
|
+
}, $e = () => {
|
|
381
381
|
let [e, t] = c(null), [r, a] = c(!1), [o, l] = c(null), u = s(void 0), d = n(() => l(null), []), f = n((e, n) => {
|
|
382
382
|
e && (t(e), l(null), e.publish(n).catch((e) => {
|
|
383
383
|
l(e instanceof Error ? e : Error(String(e)));
|
|
@@ -402,16 +402,16 @@ var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
|
402
402
|
resetError: d
|
|
403
403
|
};
|
|
404
404
|
};
|
|
405
|
-
function
|
|
405
|
+
function et(e, t) {
|
|
406
406
|
return e.size === t.size && [...e].every((e) => t.has(e));
|
|
407
407
|
}
|
|
408
408
|
//#endregion
|
|
409
409
|
//#region src/entityRows.ts
|
|
410
|
-
function
|
|
411
|
-
let n =
|
|
410
|
+
function tt(e, t) {
|
|
411
|
+
let n = q() && j(), r = Re(n ? null : t), [a, o] = c({
|
|
412
412
|
data: void 0,
|
|
413
413
|
error: null
|
|
414
|
-
}), l = e && t ? `${JSON.stringify(e)}|${String(
|
|
414
|
+
}), l = e && t ? `${JSON.stringify(e)}|${String(Fe(t))}` : null, u = s({
|
|
415
415
|
watch: e,
|
|
416
416
|
query: t
|
|
417
417
|
});
|
|
@@ -425,14 +425,14 @@ function et(e, t) {
|
|
|
425
425
|
});
|
|
426
426
|
let { watch: e, query: t } = u.current;
|
|
427
427
|
if (!n || !l || !e || !t) return;
|
|
428
|
-
let r =
|
|
428
|
+
let r = me(e, () => t.all(), (e) => o({
|
|
429
429
|
data: [...e],
|
|
430
430
|
error: null
|
|
431
431
|
}), {
|
|
432
432
|
immediate: !0,
|
|
433
433
|
onError: (e) => o((t) => ({
|
|
434
434
|
data: t.data,
|
|
435
|
-
error:
|
|
435
|
+
error: Le(e)
|
|
436
436
|
}))
|
|
437
437
|
});
|
|
438
438
|
return () => r.unsubscribe();
|
|
@@ -440,15 +440,15 @@ function et(e, t) {
|
|
|
440
440
|
}
|
|
441
441
|
//#endregion
|
|
442
442
|
//#region src/itemProperty.ts
|
|
443
|
-
var
|
|
443
|
+
var nt = ve("seedSdk:react:property"), rt = ve("seedSdk:react:itemProperties"), it = (e, t, n) => [
|
|
444
444
|
"seed",
|
|
445
445
|
"itemProperty",
|
|
446
446
|
e ?? null,
|
|
447
447
|
t ?? null,
|
|
448
448
|
n
|
|
449
449
|
];
|
|
450
|
-
function
|
|
451
|
-
let n =
|
|
450
|
+
function at(e, t) {
|
|
451
|
+
let n = q(), r = X(), [, a] = c(0), s = typeof e == "object" && e ? e : null, l = s?.itemId, u = s?.seedLocalId, d = s?.seedUid, f = s?.propertyName, p = typeof e == "string" ? e : l !== void 0 && l !== "" ? l : void 0, m = f ?? (typeof e == "string" ? t : void 0), h = o(() => {
|
|
452
452
|
let e = p !== void 0 && p !== "" ? p : u, t = p !== void 0 && p !== "" ? void 0 : d;
|
|
453
453
|
return (e || t) && m ? {
|
|
454
454
|
type: "identifiers",
|
|
@@ -462,7 +462,7 @@ function it(e, t) {
|
|
|
462
462
|
m,
|
|
463
463
|
u,
|
|
464
464
|
d
|
|
465
|
-
]), g = o(() =>
|
|
465
|
+
]), g = o(() => it(h?.seedLocalId, h?.seedUid, h?.propertyName ?? ""), [h]), _ = U({
|
|
466
466
|
queryKey: g,
|
|
467
467
|
queryFn: async () => {
|
|
468
468
|
if (!h) return null;
|
|
@@ -476,7 +476,7 @@ function it(e, t) {
|
|
|
476
476
|
seedUid: h.itemId,
|
|
477
477
|
hold: !1
|
|
478
478
|
}) : void 0, n = e ?? t;
|
|
479
|
-
return n ||
|
|
479
|
+
return n || nt(`[useItemProperty] no property found for Item.${h.seedLocalId || h.seedUid}.${h.propertyName}`), n ?? null;
|
|
480
480
|
},
|
|
481
481
|
initialData: () => h ? v.peekReady(h) : void 0,
|
|
482
482
|
staleTime: 0,
|
|
@@ -485,15 +485,15 @@ function it(e, t) {
|
|
|
485
485
|
retry: !1,
|
|
486
486
|
enabled: n && !!h
|
|
487
487
|
}, r), y = _.data ?? void 0;
|
|
488
|
-
return
|
|
488
|
+
return ct(o(() => y ? [y] : [], [y])), i(() => {
|
|
489
489
|
if (!y) return;
|
|
490
490
|
let e = () => a((e) => e + 1), t = y.getService().getSnapshot()?.context, n = t?.renderValue, r = t?.propertyValue, i = !1, o = 0, s, c = y.getService().subscribe((t) => {
|
|
491
491
|
let a = t?.context ?? {};
|
|
492
492
|
if (!Object.is(a.renderValue, n) || !Object.is(a.propertyValue, r)) {
|
|
493
|
-
n = a.renderValue, r = a.propertyValue, i = t.value === "idle", o = Date.now(), clearTimeout(s), s = void 0, e();
|
|
493
|
+
n = a.renderValue, r = a.propertyValue, i = t.value === "idle" && a._status === "ready", o = Date.now(), clearTimeout(s), s = void 0, e();
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
|
-
if (t.value === "idle") {
|
|
496
|
+
if (t.value === "idle" && a._status === "ready") {
|
|
497
497
|
i || (i = !0, clearTimeout(s), s = void 0, e());
|
|
498
498
|
return;
|
|
499
499
|
}
|
|
@@ -512,8 +512,8 @@ function it(e, t) {
|
|
|
512
512
|
error: _.error
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
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 } =
|
|
515
|
+
function ot(e, t = 300) {
|
|
516
|
+
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 } = at(o(() => r ? {
|
|
517
517
|
itemId: r,
|
|
518
518
|
propertyName: l
|
|
519
519
|
} : {
|
|
@@ -525,7 +525,7 @@ function at(e, t = 300) {
|
|
|
525
525
|
a,
|
|
526
526
|
c,
|
|
527
527
|
l
|
|
528
|
-
])), p = s(""), m =
|
|
528
|
+
])), p = s(""), m = st(u), h = o(() => he((e) => {
|
|
529
529
|
e.setValue(p.current);
|
|
530
530
|
}, t), [t]);
|
|
531
531
|
i(() => () => h.flush(), [h]);
|
|
@@ -540,7 +540,7 @@ function at(e, t = 300) {
|
|
|
540
540
|
error: f ?? m
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function st(e) {
|
|
544
544
|
let [t, n] = c(null);
|
|
545
545
|
return i(() => {
|
|
546
546
|
if (!e) {
|
|
@@ -560,7 +560,7 @@ function ot(e) {
|
|
|
560
560
|
return () => a.unsubscribe();
|
|
561
561
|
}, [e]), t;
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function ct(e) {
|
|
564
564
|
i(() => {
|
|
565
565
|
let t = e.filter((e) => v.retain(e));
|
|
566
566
|
return () => {
|
|
@@ -570,7 +570,7 @@ function st(e) {
|
|
|
570
570
|
};
|
|
571
571
|
}, [e]);
|
|
572
572
|
}
|
|
573
|
-
async function
|
|
573
|
+
async function lt(e, t) {
|
|
574
574
|
if (!e && !t) return [];
|
|
575
575
|
let n = f.getAppDb();
|
|
576
576
|
if (!n) return [];
|
|
@@ -585,19 +585,19 @@ async function ct(e, t) {
|
|
|
585
585
|
let o;
|
|
586
586
|
if (r.length > 0) {
|
|
587
587
|
let e = r[0];
|
|
588
|
-
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o =
|
|
588
|
+
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o = _e(o));
|
|
589
589
|
}
|
|
590
590
|
let s = await n.select({
|
|
591
591
|
type: R.type,
|
|
592
592
|
modelFileId: R.modelFileId
|
|
593
|
-
}).from(R).where(t ?
|
|
594
|
-
!o && s.length > 0 && s[0].type && (o =
|
|
593
|
+
}).from(R).where(t ? G(R.uid, t) : G(R.localId, e)).limit(1), c = s[0]?.modelFileId ?? void 0;
|
|
594
|
+
!o && s.length > 0 && s[0].type && (o = _e(s[0].type));
|
|
595
595
|
let l = [];
|
|
596
596
|
if (o) try {
|
|
597
597
|
let { Model: e } = await import("@seedprotocol/sdk"), t = await e.resolveAsync(o, { modelFileId: c });
|
|
598
598
|
if (t?.properties) for (let e of t.properties) e.name && l.push(e.name);
|
|
599
599
|
} catch (e) {
|
|
600
|
-
|
|
600
|
+
rt(`[useItemProperties] Error getting ModelProperties for ${o}:`, e);
|
|
601
601
|
}
|
|
602
602
|
if (o && l.length > 0) {
|
|
603
603
|
let n = r.length > 0 ? r[0].seedLocalId ?? e : e, s = r.length > 0 ? r[0].seedUid ?? t : t;
|
|
@@ -614,11 +614,11 @@ async function ct(e, t) {
|
|
|
614
614
|
});
|
|
615
615
|
t && i.push(t);
|
|
616
616
|
} catch (t) {
|
|
617
|
-
|
|
617
|
+
nt(`[useItemProperties] Error creating ItemProperty for missing property ${e}:`, t);
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
if (e || t) {
|
|
621
|
-
let a = await n.select({ createdAt: R.createdAt }).from(R).where(t ?
|
|
621
|
+
let a = await n.select({ createdAt: R.createdAt }).from(R).where(t ? G(R.uid, t) : G(R.localId, e)).limit(1);
|
|
622
622
|
if (a.length > 0 && a[0].createdAt) {
|
|
623
623
|
let n = "createdAt";
|
|
624
624
|
if (!i.some((e) => e.propertyName === n) && o) try {
|
|
@@ -634,14 +634,14 @@ async function ct(e, t) {
|
|
|
634
634
|
});
|
|
635
635
|
l && i.push(l);
|
|
636
636
|
} catch (e) {
|
|
637
|
-
|
|
637
|
+
nt("[useItemProperties] Error creating createdAt ItemProperty:", e);
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
return i;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
644
|
-
let t =
|
|
643
|
+
function ut(e) {
|
|
644
|
+
let t = q(), n = xe(), r = s(void 0), a = o(() => typeof e == "string" ? {
|
|
645
645
|
type: "itemId",
|
|
646
646
|
itemId: e
|
|
647
647
|
} : typeof e == "object" ? {
|
|
@@ -658,16 +658,16 @@ function lt(e) {
|
|
|
658
658
|
u
|
|
659
659
|
], [u]), { data: p = [], isLoading: m, error: h } = U({
|
|
660
660
|
queryKey: d,
|
|
661
|
-
queryFn: () =>
|
|
661
|
+
queryFn: () => lt(c, l),
|
|
662
662
|
enabled: t && !!u,
|
|
663
663
|
gcTime: 0
|
|
664
664
|
});
|
|
665
|
-
|
|
665
|
+
ct(p);
|
|
666
666
|
let g = o(() => {
|
|
667
|
-
if (!t || !c && !l) return
|
|
667
|
+
if (!t || !c && !l) return rt("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
668
668
|
let e = f.getAppDb();
|
|
669
|
-
if (!e) return
|
|
670
|
-
|
|
669
|
+
if (!e) return rt("[useItemProperties] Query: returning null (no db)"), null;
|
|
670
|
+
rt(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${l}`);
|
|
671
671
|
let n = l ? e.select({
|
|
672
672
|
propertyName: M.propertyName,
|
|
673
673
|
propertyValue: M.propertyValue,
|
|
@@ -679,7 +679,7 @@ function lt(e) {
|
|
|
679
679
|
attestationCreatedAt: M.attestationCreatedAt,
|
|
680
680
|
localId: M.localId,
|
|
681
681
|
revokedAt: M.revokedAt
|
|
682
|
-
}).from(M).where(
|
|
682
|
+
}).from(M).where(W(G(M.seedUid, l), we(M.propertyName))) : c ? e.select({
|
|
683
683
|
propertyName: M.propertyName,
|
|
684
684
|
propertyValue: M.propertyValue,
|
|
685
685
|
seedLocalId: M.seedLocalId,
|
|
@@ -690,19 +690,19 @@ function lt(e) {
|
|
|
690
690
|
attestationCreatedAt: M.attestationCreatedAt,
|
|
691
691
|
localId: M.localId,
|
|
692
692
|
revokedAt: M.revokedAt
|
|
693
|
-
}).from(M).where(
|
|
694
|
-
return
|
|
693
|
+
}).from(M).where(W(G(M.seedLocalId, c), we(M.propertyName))) : null;
|
|
694
|
+
return rt("[useItemProperties] Query: created query object", { queryType: l ? "seedUid" : "seedLocalId" }), n;
|
|
695
695
|
}, [
|
|
696
696
|
t,
|
|
697
697
|
c,
|
|
698
698
|
l
|
|
699
|
-
]), _ =
|
|
699
|
+
]), _ = tt(o(() => l ? {
|
|
700
700
|
seedUid: l,
|
|
701
701
|
tables: ["metadata"]
|
|
702
702
|
} : c ? {
|
|
703
703
|
seedLocalId: c,
|
|
704
704
|
tables: ["metadata"]
|
|
705
|
-
} : null, [c, l]), g).data, v = o(() => !_ || _.length === 0 ? [] :
|
|
705
|
+
} : null, [c, l]), g).data, v = o(() => !_ || _.length === 0 ? [] : de(_), [_]);
|
|
706
706
|
return i(() => {
|
|
707
707
|
if (!t || !c && !l || v === void 0) return;
|
|
708
708
|
let e = JSON.stringify(v.map((e) => ({
|
|
@@ -728,7 +728,7 @@ function lt(e) {
|
|
|
728
728
|
error: h
|
|
729
729
|
};
|
|
730
730
|
}
|
|
731
|
-
var
|
|
731
|
+
var dt = () => {
|
|
732
732
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
733
733
|
if (!t.propertyName || !t.seedLocalId && !t.seedUid || !t.modelName) {
|
|
734
734
|
o(/* @__PURE__ */ Error("seedLocalId or seedUid, propertyName, and modelName are required"));
|
|
@@ -740,12 +740,8 @@ var ut = () => {
|
|
|
740
740
|
o(/* @__PURE__ */ Error("Failed to create item property")), r(!1);
|
|
741
741
|
return;
|
|
742
742
|
}
|
|
743
|
-
let i = n.getService().subscribe((
|
|
744
|
-
|
|
745
|
-
let t = e.context?._loadingError?.error ?? /* @__PURE__ */ Error("Failed to create item property");
|
|
746
|
-
o(t instanceof Error ? t : Error(String(t))), r(!1);
|
|
747
|
-
}
|
|
748
|
-
e?.value === "idle" && (o(null), r(!1));
|
|
743
|
+
let i = n.getService().subscribe(() => {
|
|
744
|
+
n.status === "error" && (o(/* @__PURE__ */ Error("Failed to create item property")), r(!1)), n.status === "ready" && (o(null), r(!1));
|
|
749
745
|
});
|
|
750
746
|
return e.current = i, n;
|
|
751
747
|
}, []);
|
|
@@ -757,7 +753,7 @@ var ut = () => {
|
|
|
757
753
|
error: a,
|
|
758
754
|
resetError: l
|
|
759
755
|
};
|
|
760
|
-
},
|
|
756
|
+
}, ft = () => {
|
|
761
757
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
762
758
|
return {
|
|
763
759
|
destroy: n(async (e) => {
|
|
@@ -776,25 +772,24 @@ var ut = () => {
|
|
|
776
772
|
error: r,
|
|
777
773
|
resetError: n(() => i(null), [])
|
|
778
774
|
};
|
|
779
|
-
},
|
|
775
|
+
}, pt = /* @__PURE__ */ new Set([
|
|
780
776
|
m.SAVE_CONFIG,
|
|
781
777
|
m.PROCESS_SCHEMA_FILES,
|
|
782
|
-
m.ADD_MODELS_TO_STORE,
|
|
783
778
|
m.ADD_MODELS_TO_DB,
|
|
784
779
|
m.IDLE
|
|
785
|
-
]),
|
|
780
|
+
]), mt = (e) => typeof e == "string" && pt.has(e), ht = () => ({ dbsAreReady: K((e) => e.status === "active" && mt(e.value)) }), gt = ve("seedSdk:react:services"), _t = [
|
|
786
781
|
"idle",
|
|
787
782
|
"ready",
|
|
788
783
|
"done",
|
|
789
784
|
"success",
|
|
790
785
|
"initialized"
|
|
791
|
-
],
|
|
786
|
+
], vt = (e) => {
|
|
792
787
|
let t = "actor", n = e;
|
|
793
|
-
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t =
|
|
794
|
-
}, vt = (e) => {
|
|
795
|
-
let t;
|
|
796
|
-
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), _t(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;
|
|
788
|
+
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t = bt(e)), t;
|
|
797
789
|
}, yt = (e) => {
|
|
790
|
+
let t;
|
|
791
|
+
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), vt(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;
|
|
792
|
+
}, bt = (e) => {
|
|
798
793
|
let t = e;
|
|
799
794
|
if (!e || !t.logic || !t.logic.config || !t._snapshot) return;
|
|
800
795
|
let n = t.logic.config;
|
|
@@ -805,23 +800,23 @@ var ut = () => {
|
|
|
805
800
|
try {
|
|
806
801
|
i = e.getSnapshot();
|
|
807
802
|
} catch (e) {
|
|
808
|
-
return
|
|
803
|
+
return gt("Error:", e), r;
|
|
809
804
|
}
|
|
810
805
|
if (i) {
|
|
811
806
|
let e = i.context;
|
|
812
|
-
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r =
|
|
807
|
+
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r = De(e.modelName.toLowerCase()));
|
|
813
808
|
}
|
|
814
809
|
return r;
|
|
815
|
-
},
|
|
810
|
+
}, xt = (e) => e?.logic?.config?.id === b.CLIENT_MANAGER, St = (e) => {
|
|
816
811
|
let t = e?.getSnapshot();
|
|
817
|
-
if (
|
|
818
|
-
let n =
|
|
819
|
-
if (n &&
|
|
812
|
+
if (xt(e)) return t?.status === "active" ? Dt(t.value) : 0;
|
|
813
|
+
let n = yt(e);
|
|
814
|
+
if (n && _t.includes(n)) return 100;
|
|
820
815
|
let r = e?.logic?.states;
|
|
821
816
|
if (!n || !r) return 0;
|
|
822
817
|
let i = Object.entries(r).filter(([, e]) => e.tags?.includes("loading")).map(([e]) => e), a = i.indexOf(n);
|
|
823
818
|
return a < 0 ? 0 : a / i.length * 100;
|
|
824
|
-
},
|
|
819
|
+
}, Ct = (e) => {
|
|
825
820
|
let [t, r] = c(0), a = n((t) => {
|
|
826
821
|
let n = e.subscribe({
|
|
827
822
|
next: t,
|
|
@@ -829,7 +824,7 @@ var ut = () => {
|
|
|
829
824
|
complete: t
|
|
830
825
|
});
|
|
831
826
|
return () => n.unsubscribe();
|
|
832
|
-
}, [e]), o = () =>
|
|
827
|
+
}, [e]), o = () => yt(e), s = l(a, o, o), u = n((t) => {
|
|
833
828
|
let n = e.getSnapshot().value;
|
|
834
829
|
n === "done" || n === "success" || n === "idle" || n === "ready" ? clearInterval(t) : r((e) => e + 1);
|
|
835
830
|
}, [e]), d = n(() => {
|
|
@@ -842,20 +837,19 @@ var ut = () => {
|
|
|
842
837
|
let e = d();
|
|
843
838
|
return () => clearInterval(e);
|
|
844
839
|
}, []), {
|
|
845
|
-
name:
|
|
840
|
+
name: vt(e),
|
|
846
841
|
timeElapsed: t,
|
|
847
842
|
value: s,
|
|
848
|
-
percentComplete:
|
|
849
|
-
uniqueKey:
|
|
843
|
+
percentComplete: St(e),
|
|
844
|
+
uniqueKey: bt(e)
|
|
850
845
|
};
|
|
851
|
-
},
|
|
852
|
-
let { internalStatus: e } =
|
|
846
|
+
}, wt = () => {
|
|
847
|
+
let { internalStatus: e } = kt();
|
|
853
848
|
return e === "ready";
|
|
854
|
-
},
|
|
849
|
+
}, Tt = () => {}, Et = () => !1, Dt = (e) => {
|
|
855
850
|
switch (e) {
|
|
856
851
|
case m.IDLE: return 100;
|
|
857
852
|
case m.ADD_MODELS_TO_DB: return 90;
|
|
858
|
-
case m.ADD_MODELS_TO_STORE: return 80;
|
|
859
853
|
case m.PROCESS_SCHEMA_FILES: return 70;
|
|
860
854
|
case m.SAVE_CONFIG: return 60;
|
|
861
855
|
case m.DB_INIT: return 50;
|
|
@@ -863,27 +857,27 @@ var ut = () => {
|
|
|
863
857
|
case m.PLATFORM_CLASSES_INIT: return 10;
|
|
864
858
|
default: return 0;
|
|
865
859
|
}
|
|
866
|
-
},
|
|
867
|
-
let e =
|
|
860
|
+
}, Ot = () => {
|
|
861
|
+
let e = Ae(), t = K((e) => e.status === "active" ? Dt(e.value) : 0);
|
|
868
862
|
return {
|
|
869
863
|
services: o(() => (e.uniqueKey = "clientManager", [e]), [e]),
|
|
870
864
|
percentComplete: t
|
|
871
865
|
};
|
|
872
|
-
},
|
|
873
|
-
status:
|
|
874
|
-
internalStatus:
|
|
875
|
-
}),
|
|
876
|
-
function
|
|
866
|
+
}, kt = () => ({
|
|
867
|
+
status: K((e) => e.value),
|
|
868
|
+
internalStatus: K((e) => e.status === "active" && mt(e.value) ? "ready" : e.value)
|
|
869
|
+
}), At = (e) => e instanceof Error ? e : Error(String(e));
|
|
870
|
+
function jt(e) {
|
|
877
871
|
let t = s(null), r = s(0), [a, o] = c(!1), [l, u] = c(null), d = n(() => u(null), []), f = n((n) => {
|
|
878
872
|
let r = (t) => {
|
|
879
|
-
if (
|
|
873
|
+
if (n.status === "error") {
|
|
880
874
|
let n = t.context?._loadingError?.error;
|
|
881
875
|
u(n instanceof Error ? n : Error(e)), o(!1);
|
|
882
|
-
} else
|
|
876
|
+
} else n.status === "ready" && (u(null), o(!1));
|
|
883
877
|
}, i = n.getService();
|
|
884
878
|
t.current = i.subscribe(r), r(i.getSnapshot());
|
|
885
879
|
}, [e]), p = n((e) => {
|
|
886
|
-
throw u(
|
|
880
|
+
throw u(At(e)), o(!1), e;
|
|
887
881
|
}, []), m = n(() => (t.current?.unsubscribe(), t.current = null, u(null), o(!0), ++r.current), []), h = n((e) => {
|
|
888
882
|
m();
|
|
889
883
|
let t;
|
|
@@ -923,11 +917,11 @@ function At(e) {
|
|
|
923
917
|
}
|
|
924
918
|
//#endregion
|
|
925
919
|
//#region src/schema.ts
|
|
926
|
-
var
|
|
927
|
-
let [t, r] = c(null), [a, o] = c(!!e), [s, l] = c(null), d =
|
|
920
|
+
var Mt = ve("seedSdk:react:schema"), Nt = (e) => {
|
|
921
|
+
let [t, r] = c(null), [a, o] = c(!!e), [s, l] = c(null), d = q(), f = n(async (e, t) => {
|
|
928
922
|
o(!0), l(null);
|
|
929
923
|
try {
|
|
930
|
-
if (!await
|
|
924
|
+
if (!await Pt(e)) {
|
|
931
925
|
if (!t.current) return;
|
|
932
926
|
r(null), o(!1);
|
|
933
927
|
return;
|
|
@@ -936,15 +930,15 @@ var jt = ge("seedSdk:react:schema"), Mt = (e) => {
|
|
|
936
930
|
let n = w.create(e, { waitForReady: !1 });
|
|
937
931
|
t.instance = n, r(n);
|
|
938
932
|
let i = n.getService(), a = (t) => {
|
|
939
|
-
if (
|
|
940
|
-
else if (
|
|
933
|
+
if (n.status === "ready") u(() => o(!1)), l(null);
|
|
934
|
+
else if (n.status === "error") {
|
|
941
935
|
let n = t.context._loadingError?.error;
|
|
942
936
|
o(!1), l(n instanceof Error ? n : /* @__PURE__ */ Error(`Failed to load schema "${e}"`));
|
|
943
937
|
} else o(!0);
|
|
944
938
|
};
|
|
945
939
|
a(i.getSnapshot()), t.subscription = i.subscribe(a);
|
|
946
940
|
} catch (e) {
|
|
947
|
-
if (
|
|
941
|
+
if (Mt("[useSchema] Error creating schema:", e), !t.current) return;
|
|
948
942
|
l(e), r(null), o(!1);
|
|
949
943
|
}
|
|
950
944
|
}, []);
|
|
@@ -971,23 +965,23 @@ var jt = ge("seedSdk:react:schema"), Mt = (e) => {
|
|
|
971
965
|
error: s
|
|
972
966
|
};
|
|
973
967
|
};
|
|
974
|
-
async function
|
|
968
|
+
async function Pt(e) {
|
|
975
969
|
if (e === C) return !0;
|
|
976
970
|
let t = f.getAppDb();
|
|
977
|
-
return !t || (await t.select({ id: L.id }).from(L).where(
|
|
971
|
+
return !t || (await t.select({ id: L.id }).from(L).where(Ee(G(L.name, e), G(L.schemaFileId, e))).limit(1)).length > 0;
|
|
978
972
|
}
|
|
979
|
-
var
|
|
980
|
-
let e =
|
|
981
|
-
queryKey:
|
|
973
|
+
var Ft = ["seed", "schemas"], It = () => {
|
|
974
|
+
let e = q(), t = X(), n = s(void 0), r = s([]), { data: a = [], isLoading: c, error: l } = U({
|
|
975
|
+
queryKey: Ft,
|
|
982
976
|
queryFn: () => w.all({ waitForReady: !0 }),
|
|
983
977
|
enabled: e
|
|
984
978
|
}, t);
|
|
985
979
|
r.current = a;
|
|
986
|
-
let u = e ? f.getAppDb() : null, d =
|
|
980
|
+
let u = e ? f.getAppDb() : null, d = Y(o(() => u ? u.select().from(L).orderBy(L.name, Se(L.version)) : null, [u, e]));
|
|
987
981
|
return i(() => {
|
|
988
982
|
if (typeof BroadcastChannel > "u") return;
|
|
989
983
|
let e = new BroadcastChannel("seed-schemas-invalidate"), n = () => {
|
|
990
|
-
t.invalidateQueries({ queryKey:
|
|
984
|
+
t.invalidateQueries({ queryKey: Ft });
|
|
991
985
|
};
|
|
992
986
|
return e.addEventListener("message", n), () => {
|
|
993
987
|
e.removeEventListener("message", n), e.close();
|
|
@@ -1010,7 +1004,7 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1010
1004
|
let o = /* @__PURE__ */ new Set();
|
|
1011
1005
|
for (let e of d) e.name !== "Seed Protocol" && (e.schemaFileId ? o.add(e.schemaFileId) : e.name != null && e.version !== void 0 && o.add(`${e.name}:${e.version}`));
|
|
1012
1006
|
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)), l = [...a].some((e) => !o.has(e));
|
|
1013
|
-
!s && (c || l) && t.invalidateQueries({ queryKey:
|
|
1007
|
+
!s && (c || l) && t.invalidateQueries({ queryKey: Ft });
|
|
1014
1008
|
}, [
|
|
1015
1009
|
e,
|
|
1016
1010
|
d,
|
|
@@ -1020,15 +1014,15 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1020
1014
|
isLoading: c,
|
|
1021
1015
|
error: l
|
|
1022
1016
|
};
|
|
1023
|
-
},
|
|
1024
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
1017
|
+
}, Lt = () => {
|
|
1018
|
+
let { run: e, isLoading: t, error: r, resetError: i } = jt("Failed to create schema");
|
|
1025
1019
|
return {
|
|
1026
1020
|
createSchema: n((t) => e(() => w.create(t, { waitForReady: !1 })), [e]),
|
|
1027
1021
|
isLoading: t,
|
|
1028
1022
|
error: r,
|
|
1029
1023
|
resetError: i
|
|
1030
1024
|
};
|
|
1031
|
-
},
|
|
1025
|
+
}, Rt = () => {
|
|
1032
1026
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1033
1027
|
return {
|
|
1034
1028
|
destroy: n(async (e) => {
|
|
@@ -1047,10 +1041,10 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1047
1041
|
error: r,
|
|
1048
1042
|
resetError: n(() => i(null), [])
|
|
1049
1043
|
};
|
|
1050
|
-
},
|
|
1051
|
-
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a =
|
|
1044
|
+
}, zt = () => {
|
|
1045
|
+
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a = q(), o = n(async () => {
|
|
1052
1046
|
if (a) try {
|
|
1053
|
-
let e = await
|
|
1047
|
+
let e = await se(), n = /* @__PURE__ */ new Set();
|
|
1054
1048
|
for (let t of e) {
|
|
1055
1049
|
let e = t.schema.metadata?.name;
|
|
1056
1050
|
e && n.add(e);
|
|
@@ -1066,7 +1060,7 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1066
1060
|
for (let [e, t] of r.current.entries()) n.has(e) || t.unload();
|
|
1067
1061
|
r.current = i, t(Array.from(i.values()));
|
|
1068
1062
|
} catch (e) {
|
|
1069
|
-
|
|
1063
|
+
Mt("Error fetching all schema versions from database:", e), t(null);
|
|
1070
1064
|
}
|
|
1071
1065
|
}, [a]);
|
|
1072
1066
|
return i(() => {
|
|
@@ -1076,12 +1070,12 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1076
1070
|
e.unload();
|
|
1077
1071
|
}), r.current.clear();
|
|
1078
1072
|
}, []), e;
|
|
1079
|
-
},
|
|
1073
|
+
}, Bt = () => Nt(C), Vt = (e) => [
|
|
1080
1074
|
"seed",
|
|
1081
1075
|
"models",
|
|
1082
1076
|
e
|
|
1083
|
-
],
|
|
1084
|
-
let t =
|
|
1077
|
+
], Ht = (e) => {
|
|
1078
|
+
let t = q(), n = X(), r = s(null), a = o(() => Vt(e), [e]), { data: c = [], isLoading: l, error: u } = U({
|
|
1085
1079
|
queryKey: a,
|
|
1086
1080
|
queryFn: async () => {
|
|
1087
1081
|
let t = await x.all(e, { waitForReady: !1 }), i = n.getQueryData(a), o = r.current;
|
|
@@ -1107,11 +1101,11 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1107
1101
|
function g() {
|
|
1108
1102
|
let t = f.getAppDb();
|
|
1109
1103
|
return !t || !e ? null : t.select({
|
|
1110
|
-
modelFileId:
|
|
1111
|
-
modelName:
|
|
1112
|
-
}).from(L).innerJoin(
|
|
1104
|
+
modelFileId: le.schemaFileId,
|
|
1105
|
+
modelName: le.name
|
|
1106
|
+
}).from(L).innerJoin(ce, G(L.id, ce.schemaId)).innerJoin(le, G(ce.modelId, le.id)).where(Ee(G(L.schemaFileId, e), G(L.name, e)));
|
|
1113
1107
|
}
|
|
1114
|
-
let _ =
|
|
1108
|
+
let _ = Y(o(() => {
|
|
1115
1109
|
if (!e || !t) return null;
|
|
1116
1110
|
let n = {
|
|
1117
1111
|
schemaId: e,
|
|
@@ -1142,8 +1136,8 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1142
1136
|
isLoading: l,
|
|
1143
1137
|
error: u
|
|
1144
1138
|
};
|
|
1145
|
-
},
|
|
1146
|
-
let n =
|
|
1139
|
+
}, Ut = (e, t) => {
|
|
1140
|
+
let n = q(), [r, a] = c(void 0), [l, u] = c(!1), [d, f] = c(null), p = s(void 0), [, m] = c(0), h = t == null;
|
|
1147
1141
|
i(() => {
|
|
1148
1142
|
!n || !h || !e ? (a(void 0), u(!1), f(null)) : (async () => {
|
|
1149
1143
|
try {
|
|
@@ -1159,7 +1153,7 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1159
1153
|
h,
|
|
1160
1154
|
e
|
|
1161
1155
|
]);
|
|
1162
|
-
let { models: g, isLoading: _, error: v } =
|
|
1156
|
+
let { models: g, isLoading: _, error: v } = Ht(h ? null : e), y = o(() => {
|
|
1163
1157
|
if (!h && t) return g.find((e) => (e.modelName ?? e.name) === t);
|
|
1164
1158
|
}, [
|
|
1165
1159
|
h,
|
|
@@ -1181,8 +1175,8 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1181
1175
|
isLoading: _,
|
|
1182
1176
|
error: v
|
|
1183
1177
|
};
|
|
1184
|
-
},
|
|
1185
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
1178
|
+
}, Wt = () => {
|
|
1179
|
+
let { run: e, isLoading: t, error: r, resetError: i } = jt("Failed to create model");
|
|
1186
1180
|
return {
|
|
1187
1181
|
create: n((t, n, r) => e(() => x.create(n, t, {
|
|
1188
1182
|
...r,
|
|
@@ -1192,7 +1186,7 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1192
1186
|
error: r,
|
|
1193
1187
|
resetError: i
|
|
1194
1188
|
};
|
|
1195
|
-
},
|
|
1189
|
+
}, Gt = () => {
|
|
1196
1190
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1197
1191
|
return {
|
|
1198
1192
|
destroy: n(async (e) => {
|
|
@@ -1214,16 +1208,16 @@ var Pt = ["seed", "schemas"], Ft = () => {
|
|
|
1214
1208
|
};
|
|
1215
1209
|
//#endregion
|
|
1216
1210
|
//#region src/modelProperty.ts
|
|
1217
|
-
async function
|
|
1211
|
+
async function Kt(e) {
|
|
1218
1212
|
let t = f.getAppDb();
|
|
1219
1213
|
if (t) {
|
|
1220
|
-
let n = await t.select({ name: L.name }).from(L).where(
|
|
1214
|
+
let n = await t.select({ name: L.name }).from(L).where(Ee(G(L.name, e), G(L.schemaFileId, e))).limit(1);
|
|
1221
1215
|
if (n[0]?.name) return n[0].name;
|
|
1222
1216
|
}
|
|
1223
1217
|
return re(e) ?? e;
|
|
1224
1218
|
}
|
|
1225
|
-
var
|
|
1226
|
-
let { model: n } =
|
|
1219
|
+
var qt = (e, t) => {
|
|
1220
|
+
let { model: n } = Ut(e, t), r = q(), a = X(), c = Xt(n), l = n?.id, u = o(() => [
|
|
1227
1221
|
"seed",
|
|
1228
1222
|
"modelProperties",
|
|
1229
1223
|
l ?? ""
|
|
@@ -1231,12 +1225,12 @@ var Kt = (e, t) => {
|
|
|
1231
1225
|
queryKey: u,
|
|
1232
1226
|
queryFn: () => S.all(l, { waitForReady: !0 }),
|
|
1233
1227
|
enabled: r && !!l
|
|
1234
|
-
}, a), h = r ? f.getAppDb() : null, g =
|
|
1228
|
+
}, a), h = r ? f.getAppDb() : null, g = Y(o(() => !h || !c ? null : h.select({
|
|
1235
1229
|
id: F.id,
|
|
1236
1230
|
name: F.name,
|
|
1237
1231
|
dataType: F.dataType,
|
|
1238
1232
|
schemaFileId: F.schemaFileId
|
|
1239
|
-
}).from(F).where(
|
|
1233
|
+
}).from(F).where(G(F.modelId, c)), [
|
|
1240
1234
|
h,
|
|
1241
1235
|
r,
|
|
1242
1236
|
c
|
|
@@ -1277,24 +1271,24 @@ var Kt = (e, t) => {
|
|
|
1277
1271
|
isLoading: p && d.length === 0,
|
|
1278
1272
|
error: m
|
|
1279
1273
|
};
|
|
1280
|
-
},
|
|
1274
|
+
}, Jt = [
|
|
1281
1275
|
400,
|
|
1282
1276
|
1200,
|
|
1283
1277
|
2500
|
|
1284
|
-
],
|
|
1278
|
+
], Yt = (e) => {
|
|
1285
1279
|
if (e) try {
|
|
1286
1280
|
return e._getSnapshotContext()._dbId;
|
|
1287
1281
|
} catch {
|
|
1288
1282
|
return;
|
|
1289
1283
|
}
|
|
1290
|
-
},
|
|
1291
|
-
let [t, n] = c(() =>
|
|
1284
|
+
}, Xt = (e) => {
|
|
1285
|
+
let [t, n] = c(() => Yt(e));
|
|
1292
1286
|
return i(() => {
|
|
1293
|
-
if (n(
|
|
1294
|
-
let t = e.getService().subscribe(() => n(
|
|
1287
|
+
if (n(Yt(e)), !e) return;
|
|
1288
|
+
let t = e.getService().subscribe(() => n(Yt(e)));
|
|
1295
1289
|
return () => t.unsubscribe();
|
|
1296
1290
|
}, [e]), t;
|
|
1297
|
-
},
|
|
1291
|
+
}, Zt = async (e, t) => {
|
|
1298
1292
|
let n = await x.createById(e, { hold: !1 });
|
|
1299
1293
|
if (!n) return;
|
|
1300
1294
|
let r = n.modelName ?? n.name;
|
|
@@ -1303,13 +1297,13 @@ var Kt = (e, t) => {
|
|
|
1303
1297
|
schemaName: n.schemaName
|
|
1304
1298
|
});
|
|
1305
1299
|
};
|
|
1306
|
-
function
|
|
1300
|
+
function Qt(...e) {
|
|
1307
1301
|
let [t, r, a] = e, l = Math.min(e.length, 3), d = o(() => l === 3 ? !!(t && r && a) : l === 2 ? !!(t && r) : !!t, [
|
|
1308
1302
|
l,
|
|
1309
1303
|
t,
|
|
1310
1304
|
r,
|
|
1311
1305
|
a
|
|
1312
|
-
]), [f, p] = c(void 0), [m, h] = c(d), [g, _] = c(null), v = s(void 0), y =
|
|
1306
|
+
]), [f, p] = c(void 0), [m, h] = c(d), [g, _] = c(null), v = s(void 0), y = q(), b = o(() => l === 3 ? {
|
|
1313
1307
|
type: "schemaId",
|
|
1314
1308
|
schemaId: t,
|
|
1315
1309
|
modelName: r,
|
|
@@ -1347,7 +1341,7 @@ function Zt(...e) {
|
|
|
1347
1341
|
p(void 0), h(!1), _(null);
|
|
1348
1342
|
return;
|
|
1349
1343
|
}
|
|
1350
|
-
t = await
|
|
1344
|
+
t = await Zt(b.modelFileId, b.propertyName);
|
|
1351
1345
|
let e = await x.createById(b.modelFileId, { hold: !1 });
|
|
1352
1346
|
n = e?.modelName ?? e?.name;
|
|
1353
1347
|
} else {
|
|
@@ -1355,7 +1349,7 @@ function Zt(...e) {
|
|
|
1355
1349
|
p(void 0), h(!1), _(null);
|
|
1356
1350
|
return;
|
|
1357
1351
|
}
|
|
1358
|
-
let e = await
|
|
1352
|
+
let e = await Kt(b.schemaId);
|
|
1359
1353
|
t = await A(b.modelName, b.propertyName, { schemaName: e }), n = b.modelName;
|
|
1360
1354
|
}
|
|
1361
1355
|
if (t && n) {
|
|
@@ -1385,7 +1379,7 @@ function Zt(...e) {
|
|
|
1385
1379
|
let T = s(!1);
|
|
1386
1380
|
T.current = m || !!f || !!g, i(() => {
|
|
1387
1381
|
if (!C || b.type === "propertyFileId") return;
|
|
1388
|
-
let e =
|
|
1382
|
+
let e = Jt.map((e) => setTimeout(() => {
|
|
1389
1383
|
T.current || w({ quiet: !0 });
|
|
1390
1384
|
}, e));
|
|
1391
1385
|
return () => e.forEach((e) => clearTimeout(e));
|
|
@@ -1398,7 +1392,7 @@ function Zt(...e) {
|
|
|
1398
1392
|
return i(() => {
|
|
1399
1393
|
if (!f || !ee) return;
|
|
1400
1394
|
v.current?.unsubscribe();
|
|
1401
|
-
let e =
|
|
1395
|
+
let e = he(w, 100), t = f.getService().subscribe(() => {
|
|
1402
1396
|
e();
|
|
1403
1397
|
});
|
|
1404
1398
|
return v.current = t, () => {
|
|
@@ -1414,12 +1408,12 @@ function Zt(...e) {
|
|
|
1414
1408
|
error: g
|
|
1415
1409
|
};
|
|
1416
1410
|
}
|
|
1417
|
-
var
|
|
1418
|
-
let { runAsync: e, isLoading: t, error: r, resetError: i } =
|
|
1411
|
+
var $t = () => {
|
|
1412
|
+
let { runAsync: e, isLoading: t, error: r, resetError: i } = jt("Failed to create model property");
|
|
1419
1413
|
return {
|
|
1420
1414
|
create: n((t, n, r) => e(async () => {
|
|
1421
1415
|
if (!n || !r.name || !r.dataType) throw Error("modelName, property name and dataType are required");
|
|
1422
|
-
let e = await
|
|
1416
|
+
let e = await Kt(t);
|
|
1423
1417
|
return S.create({
|
|
1424
1418
|
...r,
|
|
1425
1419
|
modelName: n
|
|
@@ -1432,7 +1426,7 @@ var Qt = () => {
|
|
|
1432
1426
|
error: r,
|
|
1433
1427
|
resetError: i
|
|
1434
1428
|
};
|
|
1435
|
-
},
|
|
1429
|
+
}, en = () => {
|
|
1436
1430
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1437
1431
|
return {
|
|
1438
1432
|
destroy: n(async (e) => {
|
|
@@ -1451,7 +1445,7 @@ var Qt = () => {
|
|
|
1451
1445
|
error: r,
|
|
1452
1446
|
resetError: n(() => i(null), [])
|
|
1453
1447
|
};
|
|
1454
|
-
},
|
|
1448
|
+
}, tn = () => {
|
|
1455
1449
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1456
1450
|
return {
|
|
1457
1451
|
deleteItem: n(async (e) => {
|
|
@@ -1470,18 +1464,18 @@ var Qt = () => {
|
|
|
1470
1464
|
error: r,
|
|
1471
1465
|
resetError: n(() => i(null), [])
|
|
1472
1466
|
};
|
|
1473
|
-
},
|
|
1474
|
-
function
|
|
1475
|
-
let e =
|
|
1476
|
-
queryKey:
|
|
1467
|
+
}, nn = ["seed", "imageFiles"];
|
|
1468
|
+
function rn() {
|
|
1469
|
+
let e = q(), t = X(), { data: n = [], isLoading: r, error: a, refetch: o } = U({
|
|
1470
|
+
queryKey: nn,
|
|
1477
1471
|
queryFn: () => p.listImageFiles(),
|
|
1478
1472
|
enabled: e
|
|
1479
1473
|
}, t);
|
|
1480
1474
|
return i(() => {
|
|
1481
1475
|
let e = (e) => {
|
|
1482
|
-
e.includes("/images/") && t.invalidateQueries({ queryKey:
|
|
1476
|
+
e.includes("/images/") && t.invalidateQueries({ queryKey: nn });
|
|
1483
1477
|
}, n = (e) => {
|
|
1484
|
-
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey:
|
|
1478
|
+
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey: nn });
|
|
1485
1479
|
};
|
|
1486
1480
|
return D.on("file-saved", e), D.on(g, n), () => {
|
|
1487
1481
|
D.off("file-saved", e), D.off(g, n);
|
|
@@ -1495,9 +1489,9 @@ function nn() {
|
|
|
1495
1489
|
}
|
|
1496
1490
|
//#endregion
|
|
1497
1491
|
//#region src/useFiles.ts
|
|
1498
|
-
var
|
|
1499
|
-
function
|
|
1500
|
-
let t =
|
|
1492
|
+
var an = ["seed", "files"];
|
|
1493
|
+
function on(e = "files") {
|
|
1494
|
+
let t = q(), n = X(), r = o(() => [...an, e], [e]), { data: a = [], isLoading: s, error: c, refetch: l } = U({
|
|
1501
1495
|
queryKey: r,
|
|
1502
1496
|
queryFn: () => p.listFiles(e),
|
|
1503
1497
|
enabled: t
|
|
@@ -1524,28 +1518,28 @@ function an(e = "files") {
|
|
|
1524
1518
|
}
|
|
1525
1519
|
//#endregion
|
|
1526
1520
|
//#region src/useEasSyncProcesses.ts
|
|
1527
|
-
function on() {
|
|
1528
|
-
return J() ? f.getAppDb() : null;
|
|
1529
|
-
}
|
|
1530
1521
|
function sn() {
|
|
1531
|
-
|
|
1532
|
-
return o(() => e ? e.select().from(E).orderBy(Se(E.startedAt)) : null, [e]);
|
|
1522
|
+
return q() ? f.getAppDb() : null;
|
|
1533
1523
|
}
|
|
1534
1524
|
function cn() {
|
|
1535
|
-
let e =
|
|
1525
|
+
let e = sn();
|
|
1526
|
+
return o(() => e ? e.select().from(E).orderBy(Se(E.startedAt)) : null, [e]);
|
|
1527
|
+
}
|
|
1528
|
+
function ln() {
|
|
1529
|
+
let e = Y(cn());
|
|
1536
1530
|
return {
|
|
1537
1531
|
records: e,
|
|
1538
1532
|
nonActiveCount: o(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
|
|
1539
1533
|
};
|
|
1540
1534
|
}
|
|
1541
|
-
function ln() {
|
|
1542
|
-
return X(sn());
|
|
1543
|
-
}
|
|
1544
1535
|
function un() {
|
|
1545
|
-
return cn()
|
|
1536
|
+
return Y(cn());
|
|
1546
1537
|
}
|
|
1547
|
-
function dn(
|
|
1548
|
-
|
|
1538
|
+
function dn() {
|
|
1539
|
+
return ln().nonActiveCount;
|
|
1540
|
+
}
|
|
1541
|
+
function fn(e) {
|
|
1542
|
+
let t = sn(), n = Y(o(() => e != null && t ? t.select().from(E).where(G(E.id, e)).limit(1) : null, [t, e])), r = e != null && (t == null || n === void 0);
|
|
1549
1543
|
return {
|
|
1550
1544
|
record: n && n.length > 0 ? n[0] : null,
|
|
1551
1545
|
isLoading: r
|
|
@@ -1553,37 +1547,29 @@ function dn(e) {
|
|
|
1553
1547
|
}
|
|
1554
1548
|
//#endregion
|
|
1555
1549
|
//#region src/SeedProvider.tsx
|
|
1556
|
-
var
|
|
1557
|
-
function
|
|
1558
|
-
|
|
1559
|
-
return typeof window < "u" && window.__SEED_INVALIDATE_ITEM_PROPERTIES__ && window.__SEED_INVALIDATE_ITEM_PROPERTIES__(e), Promise.resolve(t).then(() => {});
|
|
1550
|
+
var pn = null;
|
|
1551
|
+
function mn(e) {
|
|
1552
|
+
return Promise.resolve(pn?.(e));
|
|
1560
1553
|
}
|
|
1561
|
-
function
|
|
1554
|
+
function hn({ queryClient: e }) {
|
|
1562
1555
|
return i(() => {
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
return e.invalidateQueries({ queryKey: n }), e.refetchQueries({ queryKey: n });
|
|
1570
|
-
};
|
|
1571
|
-
fn = t, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = t);
|
|
1572
|
-
let n = (e) => {
|
|
1573
|
-
let n = e?.seedLocalId ?? e?.seedUid;
|
|
1574
|
-
n && t(n);
|
|
1575
|
-
}, r = () => {
|
|
1556
|
+
pn = (t) => e.invalidateQueries({ queryKey: [
|
|
1557
|
+
"seed",
|
|
1558
|
+
"itemProperties",
|
|
1559
|
+
t
|
|
1560
|
+
] });
|
|
1561
|
+
let t = () => {
|
|
1576
1562
|
e.invalidateQueries({
|
|
1577
1563
|
queryKey: ["seed", "items"],
|
|
1578
1564
|
exact: !1
|
|
1579
1565
|
});
|
|
1580
1566
|
};
|
|
1581
|
-
return D.on(
|
|
1582
|
-
D.off(
|
|
1567
|
+
return D.on(h, t), () => {
|
|
1568
|
+
D.off(h, t), pn = null;
|
|
1583
1569
|
};
|
|
1584
1570
|
}, [e]), null;
|
|
1585
1571
|
}
|
|
1586
|
-
function
|
|
1572
|
+
function gn({ config: e, addresses: t, onInitError: n }) {
|
|
1587
1573
|
let r = s(n);
|
|
1588
1574
|
r.current = n;
|
|
1589
1575
|
let a = s(t);
|
|
@@ -1599,8 +1585,8 @@ function hn({ config: e, addresses: t, onInitError: n }) {
|
|
|
1599
1585
|
});
|
|
1600
1586
|
}, [e, o]), null;
|
|
1601
1587
|
}
|
|
1602
|
-
function
|
|
1603
|
-
let s = o(() => i ??
|
|
1588
|
+
function _n({ children: e, config: t, addresses: n, onInitError: r, queryClient: i, queryClientRef: a }) {
|
|
1589
|
+
let s = o(() => i ?? He(), [i]);
|
|
1604
1590
|
if (a && (a.current = s, typeof window < "u")) {
|
|
1605
1591
|
let e = window;
|
|
1606
1592
|
e.__TEST_SEED_QUERY_CLIENT__ = s;
|
|
@@ -1608,13 +1594,13 @@ function gn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1608
1594
|
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = s);
|
|
1609
1595
|
} catch {}
|
|
1610
1596
|
}
|
|
1611
|
-
return /* @__PURE__ */
|
|
1597
|
+
return /* @__PURE__ */ B(H, {
|
|
1612
1598
|
client: s,
|
|
1613
|
-
children: /* @__PURE__ */
|
|
1599
|
+
children: /* @__PURE__ */ V(Pe, {
|
|
1614
1600
|
queryClient: s,
|
|
1615
1601
|
children: [
|
|
1616
|
-
/* @__PURE__ */
|
|
1617
|
-
t && /* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ B(hn, { queryClient: s }),
|
|
1603
|
+
t && /* @__PURE__ */ B(gn, {
|
|
1618
1604
|
config: t,
|
|
1619
1605
|
addresses: n,
|
|
1620
1606
|
onInitError: r
|
|
@@ -1626,8 +1612,8 @@ function gn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1626
1612
|
}
|
|
1627
1613
|
//#endregion
|
|
1628
1614
|
//#region src/SeedClientGate.tsx
|
|
1629
|
-
function
|
|
1630
|
-
return /* @__PURE__ */
|
|
1615
|
+
function vn() {
|
|
1616
|
+
return /* @__PURE__ */ B("div", {
|
|
1631
1617
|
style: {
|
|
1632
1618
|
display: "flex",
|
|
1633
1619
|
alignItems: "center",
|
|
@@ -1638,21 +1624,21 @@ function _n() {
|
|
|
1638
1624
|
children: "Loading..."
|
|
1639
1625
|
});
|
|
1640
1626
|
}
|
|
1641
|
-
function
|
|
1627
|
+
function yn(e) {
|
|
1642
1628
|
try {
|
|
1643
1629
|
return JSON.stringify(e ?? null);
|
|
1644
1630
|
} catch {
|
|
1645
1631
|
return e;
|
|
1646
1632
|
}
|
|
1647
1633
|
}
|
|
1648
|
-
function
|
|
1649
|
-
let l =
|
|
1634
|
+
function bn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1635
|
+
let l = q(), u = s(o);
|
|
1650
1636
|
u.current = o;
|
|
1651
1637
|
let d = s(e);
|
|
1652
1638
|
d.current = e;
|
|
1653
1639
|
let f = s(t);
|
|
1654
1640
|
f.current = t;
|
|
1655
|
-
let p =
|
|
1641
|
+
let p = yn(e), m = yn(t);
|
|
1656
1642
|
i(() => {
|
|
1657
1643
|
let e = d.current, t = f.current, n = t ? {
|
|
1658
1644
|
...e,
|
|
@@ -1665,7 +1651,7 @@ function yn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1665
1651
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1666
1652
|
});
|
|
1667
1653
|
}, [p, m]);
|
|
1668
|
-
let h = n ?? /* @__PURE__ */
|
|
1654
|
+
let h = n ?? /* @__PURE__ */ B(vn, {}), g = r ? void 0 : {
|
|
1669
1655
|
position: "relative",
|
|
1670
1656
|
display: "flex",
|
|
1671
1657
|
height: "100vh",
|
|
@@ -1680,15 +1666,15 @@ function yn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1680
1666
|
justifyContent: "center"
|
|
1681
1667
|
}
|
|
1682
1668
|
};
|
|
1683
|
-
return /* @__PURE__ */
|
|
1669
|
+
return /* @__PURE__ */ V("div", {
|
|
1684
1670
|
className: r,
|
|
1685
1671
|
style: g,
|
|
1686
|
-
children: [/* @__PURE__ */
|
|
1672
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1687
1673
|
className: a,
|
|
1688
1674
|
style: _,
|
|
1689
1675
|
"aria-hidden": l,
|
|
1690
1676
|
children: h
|
|
1691
|
-
}), /* @__PURE__ */
|
|
1677
|
+
}), /* @__PURE__ */ B("div", {
|
|
1692
1678
|
style: {
|
|
1693
1679
|
flex: 1,
|
|
1694
1680
|
display: l ? "flex" : "none",
|
|
@@ -1700,54 +1686,54 @@ function yn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1700
1686
|
}
|
|
1701
1687
|
//#endregion
|
|
1702
1688
|
//#region src/opfsPaths.ts
|
|
1703
|
-
function
|
|
1689
|
+
function xn(e) {
|
|
1704
1690
|
let t = e.split("/").filter(Boolean);
|
|
1705
1691
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1706
1692
|
return t;
|
|
1707
1693
|
}
|
|
1708
|
-
async function
|
|
1694
|
+
async function Sn(e, t) {
|
|
1709
1695
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1710
1696
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1711
1697
|
return n;
|
|
1712
1698
|
}
|
|
1713
|
-
async function
|
|
1714
|
-
let n =
|
|
1699
|
+
async function Cn(e, t) {
|
|
1700
|
+
let n = xn(e), r = n.pop();
|
|
1715
1701
|
return {
|
|
1716
|
-
dir: await
|
|
1702
|
+
dir: await Sn(n.join("/"), t),
|
|
1717
1703
|
name: r
|
|
1718
1704
|
};
|
|
1719
1705
|
}
|
|
1720
|
-
async function Cn(e, t) {
|
|
1721
|
-
let { dir: n, name: r } = await Sn(e, t);
|
|
1722
|
-
return n.getFileHandle(r);
|
|
1723
|
-
}
|
|
1724
1706
|
async function wn(e, t) {
|
|
1725
|
-
|
|
1707
|
+
let { dir: n, name: r } = await Cn(e, t);
|
|
1708
|
+
return n.getFileHandle(r);
|
|
1726
1709
|
}
|
|
1727
1710
|
async function Tn(e, t) {
|
|
1728
|
-
|
|
1729
|
-
await n.removeEntry(r);
|
|
1711
|
+
return (await wn(e, t)).getFile();
|
|
1730
1712
|
}
|
|
1731
1713
|
async function En(e, t) {
|
|
1714
|
+
let { dir: n, name: r } = await Cn(e, t);
|
|
1715
|
+
await n.removeEntry(r);
|
|
1716
|
+
}
|
|
1717
|
+
async function Dn(e, t) {
|
|
1732
1718
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1733
1719
|
for await (let e of n.entries()) r.push(e);
|
|
1734
1720
|
let i = !0;
|
|
1735
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1721
|
+
for (let [e, t] of r) (t.kind === "file" || !await Dn(n, e)) && (i = !1);
|
|
1736
1722
|
return i && await e.removeEntry(t), i;
|
|
1737
1723
|
}
|
|
1738
|
-
async function
|
|
1724
|
+
async function On(e, t) {
|
|
1739
1725
|
try {
|
|
1740
|
-
let { dir: n, name: r } = await
|
|
1741
|
-
return await
|
|
1726
|
+
let { dir: n, name: r } = await Cn(e, t);
|
|
1727
|
+
return await Dn(n, r);
|
|
1742
1728
|
} catch (e) {
|
|
1743
1729
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1744
1730
|
throw e;
|
|
1745
1731
|
}
|
|
1746
1732
|
}
|
|
1747
|
-
function
|
|
1733
|
+
function kn() {
|
|
1748
1734
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1749
1735
|
}
|
|
1750
|
-
var
|
|
1736
|
+
var An = [
|
|
1751
1737
|
{
|
|
1752
1738
|
type: "image/jpeg",
|
|
1753
1739
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1758,43 +1744,43 @@ var kn = [
|
|
|
1758
1744
|
},
|
|
1759
1745
|
{
|
|
1760
1746
|
type: "image/gif",
|
|
1761
|
-
test: (e) =>
|
|
1747
|
+
test: (e) => jn(e, 0, 4) === "GIF8"
|
|
1762
1748
|
},
|
|
1763
1749
|
{
|
|
1764
1750
|
type: "image/webp",
|
|
1765
|
-
test: (e) =>
|
|
1751
|
+
test: (e) => jn(e, 0, 4) === "RIFF" && jn(e, 8, 12) === "WEBP"
|
|
1766
1752
|
},
|
|
1767
1753
|
{
|
|
1768
1754
|
type: "image/avif",
|
|
1769
|
-
test: (e) =>
|
|
1755
|
+
test: (e) => jn(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(jn(e, 8, 12))
|
|
1770
1756
|
},
|
|
1771
1757
|
{
|
|
1772
1758
|
type: "application/vnd.sqlite3",
|
|
1773
|
-
test: (e) =>
|
|
1759
|
+
test: (e) => jn(e, 0, 15) === "SQLite format 3"
|
|
1774
1760
|
},
|
|
1775
1761
|
{
|
|
1776
1762
|
type: "application/pdf",
|
|
1777
|
-
test: (e) =>
|
|
1763
|
+
test: (e) => jn(e, 0, 5) === "%PDF-"
|
|
1778
1764
|
}
|
|
1779
1765
|
];
|
|
1780
|
-
function
|
|
1766
|
+
function jn(e, t, n) {
|
|
1781
1767
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1782
1768
|
}
|
|
1783
|
-
function
|
|
1784
|
-
return
|
|
1769
|
+
function Mn(e) {
|
|
1770
|
+
return An.find((t) => t.test(e))?.type;
|
|
1785
1771
|
}
|
|
1786
|
-
async function
|
|
1787
|
-
if (e.size !== 0) return
|
|
1772
|
+
async function Nn(e) {
|
|
1773
|
+
if (e.size !== 0) return Mn(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1788
1774
|
}
|
|
1789
1775
|
//#endregion
|
|
1790
1776
|
//#region src/useOPFSFiles.ts
|
|
1791
|
-
async function
|
|
1777
|
+
async function Pn(e, t = "") {
|
|
1792
1778
|
let n = [];
|
|
1793
1779
|
try {
|
|
1794
1780
|
for await (let [r, i] of e.entries()) {
|
|
1795
1781
|
let e = t ? `${t}/${r}` : r;
|
|
1796
1782
|
if (i.kind === "file") try {
|
|
1797
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1783
|
+
let t = await i.getFile(), a = t.type ? void 0 : await Nn(t).catch(() => void 0);
|
|
1798
1784
|
n.push({
|
|
1799
1785
|
name: r,
|
|
1800
1786
|
path: e,
|
|
@@ -1807,7 +1793,7 @@ async function Nn(e, t = "") {
|
|
|
1807
1793
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1808
1794
|
}
|
|
1809
1795
|
else if (i.kind === "directory") {
|
|
1810
|
-
let t = await
|
|
1796
|
+
let t = await Pn(i, e);
|
|
1811
1797
|
n.push(...t);
|
|
1812
1798
|
}
|
|
1813
1799
|
}
|
|
@@ -1816,11 +1802,11 @@ async function Nn(e, t = "") {
|
|
|
1816
1802
|
}
|
|
1817
1803
|
return n;
|
|
1818
1804
|
}
|
|
1819
|
-
function
|
|
1805
|
+
function Fn(e = {}) {
|
|
1820
1806
|
let { rootPath: t } = e, [r, a] = c([]), [o, s] = c(!0), [l, u] = c(!1), [d, f] = c(null), [p, m] = c(null), h = n(async () => {
|
|
1821
1807
|
s(!0), f(null), m(null);
|
|
1822
1808
|
try {
|
|
1823
|
-
let e = await
|
|
1809
|
+
let e = await Pn(await Sn(t ?? ""), t || "");
|
|
1824
1810
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1825
1811
|
} catch (e) {
|
|
1826
1812
|
f("Failed to access OPFS: " + (e instanceof Error ? e.message : String(e))), m(e instanceof Error ? e.name : null), console.error("OPFS access error:", e);
|
|
@@ -1841,96 +1827,96 @@ function Pn(e = {}) {
|
|
|
1841
1827
|
}
|
|
1842
1828
|
//#endregion
|
|
1843
1829
|
//#region src/OPFSFilesManager/format.ts
|
|
1844
|
-
var
|
|
1830
|
+
var In = [
|
|
1845
1831
|
"B",
|
|
1846
1832
|
"KB",
|
|
1847
1833
|
"MB",
|
|
1848
1834
|
"GB",
|
|
1849
1835
|
"TB"
|
|
1850
1836
|
];
|
|
1851
|
-
function
|
|
1837
|
+
function Z(e) {
|
|
1852
1838
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1853
|
-
let t = Math.min(
|
|
1854
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1839
|
+
let t = Math.min(In.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1840
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${In[t]}`;
|
|
1855
1841
|
}
|
|
1856
|
-
var
|
|
1857
|
-
function
|
|
1842
|
+
var Ln = 6e4, Rn = 60 * Ln, zn = 24 * Rn;
|
|
1843
|
+
function Bn(e, t = Date.now()) {
|
|
1858
1844
|
let n = t - e;
|
|
1859
|
-
if (n <
|
|
1860
|
-
if (n <
|
|
1861
|
-
if (n <
|
|
1862
|
-
let r = Math.round(n /
|
|
1845
|
+
if (n < Ln) return "just now";
|
|
1846
|
+
if (n < Rn) return `${Math.round(n / Ln)} min ago`;
|
|
1847
|
+
if (n < zn) return `${Math.round(n / Rn)} h ago`;
|
|
1848
|
+
let r = Math.round(n / zn);
|
|
1863
1849
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1864
1850
|
}
|
|
1865
|
-
function
|
|
1851
|
+
function Vn(e) {
|
|
1866
1852
|
return new Date(e).toLocaleString(void 0, {
|
|
1867
1853
|
dateStyle: "medium",
|
|
1868
1854
|
timeStyle: "short"
|
|
1869
1855
|
});
|
|
1870
1856
|
}
|
|
1871
|
-
function
|
|
1857
|
+
function Hn(e, t) {
|
|
1872
1858
|
if (e.length <= t) return e;
|
|
1873
1859
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1874
1860
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1875
1861
|
}
|
|
1876
1862
|
//#endregion
|
|
1877
1863
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1878
|
-
var
|
|
1879
|
-
check: /* @__PURE__ */
|
|
1880
|
-
chevronLeft: /* @__PURE__ */
|
|
1881
|
-
chevronRight: /* @__PURE__ */
|
|
1882
|
-
copy: /* @__PURE__ */
|
|
1864
|
+
var Un = {
|
|
1865
|
+
check: /* @__PURE__ */ B("path", { d: "M20 6 9 17l-5-5" }),
|
|
1866
|
+
chevronLeft: /* @__PURE__ */ B("path", { d: "m15 18-6-6 6-6" }),
|
|
1867
|
+
chevronRight: /* @__PURE__ */ B("path", { d: "m9 18 6-6-6-6" }),
|
|
1868
|
+
copy: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("rect", {
|
|
1883
1869
|
width: "14",
|
|
1884
1870
|
height: "14",
|
|
1885
1871
|
x: "8",
|
|
1886
1872
|
y: "8",
|
|
1887
1873
|
rx: "2",
|
|
1888
1874
|
ry: "2"
|
|
1889
|
-
}), /* @__PURE__ */
|
|
1890
|
-
database: /* @__PURE__ */
|
|
1891
|
-
/* @__PURE__ */
|
|
1875
|
+
}), /* @__PURE__ */ B("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
|
|
1876
|
+
database: /* @__PURE__ */ V(z, { children: [
|
|
1877
|
+
/* @__PURE__ */ B("ellipse", {
|
|
1892
1878
|
cx: "12",
|
|
1893
1879
|
cy: "5",
|
|
1894
1880
|
rx: "9",
|
|
1895
1881
|
ry: "3"
|
|
1896
1882
|
}),
|
|
1897
|
-
/* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */
|
|
1883
|
+
/* @__PURE__ */ B("path", { d: "M3 5V19A9 3 0 0 0 21 19V5" }),
|
|
1884
|
+
/* @__PURE__ */ B("path", { d: "M3 12A9 3 0 0 0 21 12" })
|
|
1899
1885
|
] }),
|
|
1900
|
-
download: /* @__PURE__ */
|
|
1901
|
-
/* @__PURE__ */
|
|
1902
|
-
/* @__PURE__ */
|
|
1903
|
-
/* @__PURE__ */
|
|
1886
|
+
download: /* @__PURE__ */ V(z, { children: [
|
|
1887
|
+
/* @__PURE__ */ B("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1888
|
+
/* @__PURE__ */ B("polyline", { points: "7 10 12 15 17 10" }),
|
|
1889
|
+
/* @__PURE__ */ B("line", {
|
|
1904
1890
|
x1: "12",
|
|
1905
1891
|
x2: "12",
|
|
1906
1892
|
y1: "15",
|
|
1907
1893
|
y2: "3"
|
|
1908
1894
|
})
|
|
1909
1895
|
] }),
|
|
1910
|
-
file: /* @__PURE__ */
|
|
1911
|
-
fileCode: /* @__PURE__ */
|
|
1912
|
-
/* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
1896
|
+
file: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })] }),
|
|
1897
|
+
fileCode: /* @__PURE__ */ V(z, { children: [
|
|
1898
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1899
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1900
|
+
/* @__PURE__ */ B("path", { d: "m10 13-2 2 2 2" }),
|
|
1901
|
+
/* @__PURE__ */ B("path", { d: "m14 17 2-2-2-2" })
|
|
1916
1902
|
] }),
|
|
1917
|
-
fileJson: /* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
/* @__PURE__ */
|
|
1920
|
-
/* @__PURE__ */
|
|
1921
|
-
/* @__PURE__ */
|
|
1903
|
+
fileJson: /* @__PURE__ */ V(z, { children: [
|
|
1904
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1905
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1906
|
+
/* @__PURE__ */ B("path", { d: "M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1" }),
|
|
1907
|
+
/* @__PURE__ */ B("path", { d: "M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1" })
|
|
1922
1908
|
] }),
|
|
1923
|
-
fileText: /* @__PURE__ */
|
|
1924
|
-
/* @__PURE__ */
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
1928
|
-
/* @__PURE__ */
|
|
1909
|
+
fileText: /* @__PURE__ */ V(z, { children: [
|
|
1910
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1911
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1912
|
+
/* @__PURE__ */ B("path", { d: "M10 9H8" }),
|
|
1913
|
+
/* @__PURE__ */ B("path", { d: "M16 13H8" }),
|
|
1914
|
+
/* @__PURE__ */ B("path", { d: "M16 17H8" })
|
|
1929
1915
|
] }),
|
|
1930
|
-
folder: /* @__PURE__ */
|
|
1931
|
-
folderOpen: /* @__PURE__ */
|
|
1932
|
-
image: /* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
1916
|
+
folder: /* @__PURE__ */ B("path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }),
|
|
1917
|
+
folderOpen: /* @__PURE__ */ B("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" }),
|
|
1918
|
+
image: /* @__PURE__ */ V(z, { children: [
|
|
1919
|
+
/* @__PURE__ */ B("rect", {
|
|
1934
1920
|
width: "18",
|
|
1935
1921
|
height: "18",
|
|
1936
1922
|
x: "3",
|
|
@@ -1938,64 +1924,64 @@ var Hn = {
|
|
|
1938
1924
|
rx: "2",
|
|
1939
1925
|
ry: "2"
|
|
1940
1926
|
}),
|
|
1941
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ B("circle", {
|
|
1942
1928
|
cx: "9",
|
|
1943
1929
|
cy: "9",
|
|
1944
1930
|
r: "2"
|
|
1945
1931
|
}),
|
|
1946
|
-
/* @__PURE__ */
|
|
1932
|
+
/* @__PURE__ */ B("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
1947
1933
|
] }),
|
|
1948
|
-
imageOff: /* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
1934
|
+
imageOff: /* @__PURE__ */ V(z, { children: [
|
|
1935
|
+
/* @__PURE__ */ B("line", {
|
|
1950
1936
|
x1: "2",
|
|
1951
1937
|
x2: "22",
|
|
1952
1938
|
y1: "2",
|
|
1953
1939
|
y2: "22"
|
|
1954
1940
|
}),
|
|
1955
|
-
/* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1941
|
+
/* @__PURE__ */ B("path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83" }),
|
|
1942
|
+
/* @__PURE__ */ B("line", {
|
|
1957
1943
|
x1: "13.5",
|
|
1958
1944
|
x2: "6",
|
|
1959
1945
|
y1: "13.5",
|
|
1960
1946
|
y2: "21"
|
|
1961
1947
|
}),
|
|
1962
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ B("line", {
|
|
1963
1949
|
x1: "18",
|
|
1964
1950
|
x2: "21",
|
|
1965
1951
|
y1: "12",
|
|
1966
1952
|
y2: "15"
|
|
1967
1953
|
}),
|
|
1968
|
-
/* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ B("path", { d: "M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59" }),
|
|
1955
|
+
/* @__PURE__ */ B("path", { d: "M21 15V5a2 2 0 0 0-2-2H9" })
|
|
1970
1956
|
] }),
|
|
1971
|
-
layers: /* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1957
|
+
layers: /* @__PURE__ */ V(z, { children: [
|
|
1958
|
+
/* @__PURE__ */ B("path", { d: "m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z" }),
|
|
1959
|
+
/* @__PURE__ */ B("path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65" }),
|
|
1960
|
+
/* @__PURE__ */ B("path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65" })
|
|
1975
1961
|
] }),
|
|
1976
|
-
layoutGrid: /* @__PURE__ */
|
|
1977
|
-
/* @__PURE__ */
|
|
1962
|
+
layoutGrid: /* @__PURE__ */ V(z, { children: [
|
|
1963
|
+
/* @__PURE__ */ B("rect", {
|
|
1978
1964
|
width: "7",
|
|
1979
1965
|
height: "7",
|
|
1980
1966
|
x: "3",
|
|
1981
1967
|
y: "3",
|
|
1982
1968
|
rx: "1"
|
|
1983
1969
|
}),
|
|
1984
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ B("rect", {
|
|
1985
1971
|
width: "7",
|
|
1986
1972
|
height: "7",
|
|
1987
1973
|
x: "14",
|
|
1988
1974
|
y: "3",
|
|
1989
1975
|
rx: "1"
|
|
1990
1976
|
}),
|
|
1991
|
-
/* @__PURE__ */
|
|
1977
|
+
/* @__PURE__ */ B("rect", {
|
|
1992
1978
|
width: "7",
|
|
1993
1979
|
height: "7",
|
|
1994
1980
|
x: "14",
|
|
1995
1981
|
y: "14",
|
|
1996
1982
|
rx: "1"
|
|
1997
1983
|
}),
|
|
1998
|
-
/* @__PURE__ */
|
|
1984
|
+
/* @__PURE__ */ B("rect", {
|
|
1999
1985
|
width: "7",
|
|
2000
1986
|
height: "7",
|
|
2001
1987
|
x: "3",
|
|
@@ -2003,51 +1989,51 @@ var Hn = {
|
|
|
2003
1989
|
rx: "1"
|
|
2004
1990
|
})
|
|
2005
1991
|
] }),
|
|
2006
|
-
list: /* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
/* @__PURE__ */
|
|
2010
|
-
/* @__PURE__ */
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
1992
|
+
list: /* @__PURE__ */ V(z, { children: [
|
|
1993
|
+
/* @__PURE__ */ B("path", { d: "M3 12h.01" }),
|
|
1994
|
+
/* @__PURE__ */ B("path", { d: "M3 18h.01" }),
|
|
1995
|
+
/* @__PURE__ */ B("path", { d: "M3 6h.01" }),
|
|
1996
|
+
/* @__PURE__ */ B("path", { d: "M8 12h13" }),
|
|
1997
|
+
/* @__PURE__ */ B("path", { d: "M8 18h13" }),
|
|
1998
|
+
/* @__PURE__ */ B("path", { d: "M8 6h13" })
|
|
2013
1999
|
] }),
|
|
2014
|
-
refresh: /* @__PURE__ */
|
|
2015
|
-
/* @__PURE__ */
|
|
2016
|
-
/* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2000
|
+
refresh: /* @__PURE__ */ V(z, { children: [
|
|
2001
|
+
/* @__PURE__ */ B("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
2002
|
+
/* @__PURE__ */ B("path", { d: "M21 3v5h-5" }),
|
|
2003
|
+
/* @__PURE__ */ B("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
2004
|
+
/* @__PURE__ */ B("path", { d: "M8 16H3v5" })
|
|
2019
2005
|
] }),
|
|
2020
|
-
search: /* @__PURE__ */
|
|
2006
|
+
search: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("circle", {
|
|
2021
2007
|
cx: "11",
|
|
2022
2008
|
cy: "11",
|
|
2023
2009
|
r: "8"
|
|
2024
|
-
}), /* @__PURE__ */
|
|
2025
|
-
trash: /* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2010
|
+
}), /* @__PURE__ */ B("path", { d: "m21 21-4.3-4.3" })] }),
|
|
2011
|
+
trash: /* @__PURE__ */ V(z, { children: [
|
|
2012
|
+
/* @__PURE__ */ B("path", { d: "M3 6h18" }),
|
|
2013
|
+
/* @__PURE__ */ B("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
2014
|
+
/* @__PURE__ */ B("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
|
|
2015
|
+
/* @__PURE__ */ B("line", {
|
|
2030
2016
|
x1: "10",
|
|
2031
2017
|
x2: "10",
|
|
2032
2018
|
y1: "11",
|
|
2033
2019
|
y2: "17"
|
|
2034
2020
|
}),
|
|
2035
|
-
/* @__PURE__ */
|
|
2021
|
+
/* @__PURE__ */ B("line", {
|
|
2036
2022
|
x1: "14",
|
|
2037
2023
|
x2: "14",
|
|
2038
2024
|
y1: "11",
|
|
2039
2025
|
y2: "17"
|
|
2040
2026
|
})
|
|
2041
2027
|
] }),
|
|
2042
|
-
triangleAlert: /* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
/* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2028
|
+
triangleAlert: /* @__PURE__ */ V(z, { children: [
|
|
2029
|
+
/* @__PURE__ */ B("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
2030
|
+
/* @__PURE__ */ B("path", { d: "M12 9v4" }),
|
|
2031
|
+
/* @__PURE__ */ B("path", { d: "M12 17h.01" })
|
|
2046
2032
|
] }),
|
|
2047
|
-
x: /* @__PURE__ */
|
|
2033
|
+
x: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("path", { d: "M18 6 6 18" }), /* @__PURE__ */ B("path", { d: "m6 6 12 12" })] })
|
|
2048
2034
|
};
|
|
2049
|
-
function
|
|
2050
|
-
return /* @__PURE__ */
|
|
2035
|
+
function Q({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
2036
|
+
return /* @__PURE__ */ B("svg", {
|
|
2051
2037
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2052
2038
|
width: t,
|
|
2053
2039
|
height: t,
|
|
@@ -2060,20 +2046,20 @@ function $({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
2060
2046
|
"aria-hidden": "true",
|
|
2061
2047
|
focusable: "false",
|
|
2062
2048
|
className: r,
|
|
2063
|
-
children:
|
|
2049
|
+
children: Un[e]
|
|
2064
2050
|
});
|
|
2065
2051
|
}
|
|
2066
2052
|
//#endregion
|
|
2067
2053
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
2068
|
-
var
|
|
2069
|
-
function
|
|
2054
|
+
var Wn = 6;
|
|
2055
|
+
function Gn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
2070
2056
|
let a = s(null);
|
|
2071
2057
|
return i(() => {
|
|
2072
2058
|
let e = a.current;
|
|
2073
2059
|
return e && !e.open && (e.showModal(), e.querySelector("[data-initial-focus]")?.focus()), () => {
|
|
2074
2060
|
e?.open && e.close();
|
|
2075
2061
|
};
|
|
2076
|
-
}, []), /* @__PURE__ */
|
|
2062
|
+
}, []), /* @__PURE__ */ B("dialog", {
|
|
2077
2063
|
ref: a,
|
|
2078
2064
|
className: ["seed-fm-dialog", e].filter(Boolean).join(" "),
|
|
2079
2065
|
"aria-labelledby": "seed-fm-delete-title",
|
|
@@ -2083,7 +2069,7 @@ function Wn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2083
2069
|
onClick: (e) => {
|
|
2084
2070
|
e.target === e.currentTarget && t();
|
|
2085
2071
|
},
|
|
2086
|
-
children: /* @__PURE__ */
|
|
2072
|
+
children: /* @__PURE__ */ B("form", {
|
|
2087
2073
|
method: "dialog",
|
|
2088
2074
|
onSubmit: (e) => {
|
|
2089
2075
|
e.preventDefault(), n();
|
|
@@ -2092,32 +2078,32 @@ function Wn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2092
2078
|
})
|
|
2093
2079
|
});
|
|
2094
2080
|
}
|
|
2095
|
-
function
|
|
2096
|
-
let [s, l] = c(!0), u = e.flatMap((e) => e.variants), d = u.reduce((e, t) => e + t.file.size, 0), f = e.length + (s ? u.length : 0), p = t ? `${t}/` : "", m = r(s), h = m.label ? `${m.label}?` : e.length === 1 ? `Delete ${
|
|
2097
|
-
return /* @__PURE__ */
|
|
2081
|
+
function Kn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
2082
|
+
let [s, l] = c(!0), u = e.flatMap((e) => e.variants), d = u.reduce((e, t) => e + t.file.size, 0), f = e.length + (s ? u.length : 0), p = t ? `${t}/` : "", m = r(s), h = m.label ? `${m.label}?` : e.length === 1 ? `Delete ${Hn(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
2083
|
+
return /* @__PURE__ */ V(Gn, {
|
|
2098
2084
|
className: o,
|
|
2099
2085
|
onCancel: i,
|
|
2100
2086
|
onSubmit: () => a(s),
|
|
2101
2087
|
children: [
|
|
2102
|
-
/* @__PURE__ */
|
|
2088
|
+
/* @__PURE__ */ B("h3", {
|
|
2103
2089
|
id: "seed-fm-delete-title",
|
|
2104
2090
|
children: h
|
|
2105
2091
|
}),
|
|
2106
|
-
/* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ V("p", { children: [
|
|
2107
2093
|
"This removes ",
|
|
2108
2094
|
e.length === 1 ? "it" : "them",
|
|
2109
2095
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
2110
2096
|
] }),
|
|
2111
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ V("ul", { children: [e.slice(0, Wn).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
2112
2098
|
title: e.file.path,
|
|
2113
2099
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
2114
|
-
}), /* @__PURE__ */
|
|
2100
|
+
}), /* @__PURE__ */ B("span", { children: Z(e.file.size) })] }, e.file.path)), e.length > Wn && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
2115
2101
|
"and ",
|
|
2116
|
-
e.length -
|
|
2102
|
+
e.length - Wn,
|
|
2117
2103
|
" more"
|
|
2118
2104
|
] }) })] }),
|
|
2119
|
-
u.length > 0 && /* @__PURE__ */
|
|
2120
|
-
/* @__PURE__ */
|
|
2105
|
+
u.length > 0 && /* @__PURE__ */ V("label", { children: [
|
|
2106
|
+
/* @__PURE__ */ B("input", {
|
|
2121
2107
|
type: "checkbox",
|
|
2122
2108
|
className: "seed-fm-checkbox",
|
|
2123
2109
|
checked: s,
|
|
@@ -2128,26 +2114,26 @@ function Gn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2128
2114
|
" resized ",
|
|
2129
2115
|
u.length === 1 ? "copy" : "copies",
|
|
2130
2116
|
" (",
|
|
2131
|
-
|
|
2117
|
+
Z(d),
|
|
2132
2118
|
")"
|
|
2133
2119
|
] }),
|
|
2134
|
-
n && /* @__PURE__ */
|
|
2120
|
+
n && /* @__PURE__ */ V("div", {
|
|
2135
2121
|
className: "seed-fm-warning",
|
|
2136
2122
|
role: "alert",
|
|
2137
|
-
children: [/* @__PURE__ */
|
|
2123
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2138
2124
|
name: "triangleAlert",
|
|
2139
2125
|
size: 16
|
|
2140
|
-
}), /* @__PURE__ */
|
|
2126
|
+
}), /* @__PURE__ */ B("span", { children: n })]
|
|
2141
2127
|
}),
|
|
2142
|
-
/* @__PURE__ */
|
|
2128
|
+
/* @__PURE__ */ V("div", {
|
|
2143
2129
|
className: "seed-fm-dialog-actions",
|
|
2144
|
-
children: [/* @__PURE__ */
|
|
2130
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2145
2131
|
type: "button",
|
|
2146
2132
|
className: "seed-fm-btn",
|
|
2147
2133
|
onClick: i,
|
|
2148
2134
|
"data-initial-focus": !0,
|
|
2149
2135
|
children: "Cancel"
|
|
2150
|
-
}), /* @__PURE__ */
|
|
2136
|
+
}), /* @__PURE__ */ B("button", {
|
|
2151
2137
|
type: "submit",
|
|
2152
2138
|
className: `seed-fm-btn ${m.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
2153
2139
|
children: m.label ?? `Delete ${f} ${f === 1 ? "file" : "files"}`
|
|
@@ -2156,43 +2142,43 @@ function Gn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2156
2142
|
]
|
|
2157
2143
|
});
|
|
2158
2144
|
}
|
|
2159
|
-
function
|
|
2145
|
+
function qn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
2160
2146
|
let [d, f] = c(!1), p = t.reduce((e, t) => e + t.size, 0), m = `${e.path}/`, h = `${t.length} ${t.length === 1 ? "file" : "files"}`, g = t.length - e.fileCount;
|
|
2161
|
-
return /* @__PURE__ */
|
|
2147
|
+
return /* @__PURE__ */ V(Gn, {
|
|
2162
2148
|
className: u,
|
|
2163
2149
|
onCancel: s,
|
|
2164
2150
|
onSubmit: l,
|
|
2165
2151
|
children: [
|
|
2166
|
-
/* @__PURE__ */
|
|
2152
|
+
/* @__PURE__ */ B("h3", {
|
|
2167
2153
|
id: "seed-fm-delete-title",
|
|
2168
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
2154
|
+
children: i.label ? `${i.label}?` : `Delete the “${Hn(e.name, 32)}” folder?`
|
|
2169
2155
|
}),
|
|
2170
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ V("p", { children: [
|
|
2171
2157
|
"This removes the folder and the ",
|
|
2172
2158
|
h,
|
|
2173
2159
|
" in it (",
|
|
2174
|
-
|
|
2160
|
+
Z(p),
|
|
2175
2161
|
g > 0 && `, including ${g} resized ${g === 1 ? "copy" : "copies"}`,
|
|
2176
2162
|
") from this browser’s private storage. Copies on Arweave or other devices aren’t affected."
|
|
2177
2163
|
] }),
|
|
2178
|
-
/* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ V("div", {
|
|
2179
2165
|
className: "seed-fm-irreversible",
|
|
2180
|
-
children: [/* @__PURE__ */
|
|
2166
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2181
2167
|
name: "triangleAlert",
|
|
2182
2168
|
size: 16
|
|
2183
|
-
}), /* @__PURE__ */
|
|
2169
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2184
2170
|
}),
|
|
2185
|
-
/* @__PURE__ */
|
|
2171
|
+
/* @__PURE__ */ V("ul", { children: [t.slice(0, Wn).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
2186
2172
|
title: e.path,
|
|
2187
2173
|
children: e.path.slice(m.length)
|
|
2188
|
-
}), /* @__PURE__ */
|
|
2174
|
+
}), /* @__PURE__ */ B("span", { children: Z(e.size) })] }, e.path)), t.length > Wn && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
2189
2175
|
"and ",
|
|
2190
|
-
t.length -
|
|
2176
|
+
t.length - Wn,
|
|
2191
2177
|
" more"
|
|
2192
2178
|
] }) })] }),
|
|
2193
|
-
/* @__PURE__ */
|
|
2179
|
+
/* @__PURE__ */ V("div", {
|
|
2194
2180
|
className: "seed-fm-keepcopy",
|
|
2195
|
-
children: [/* @__PURE__ */
|
|
2181
|
+
children: [/* @__PURE__ */ B("span", { children: d ? "Saved a copy to your computer." : "Want a copy first? Save the folder to your computer." }), /* @__PURE__ */ V("button", {
|
|
2196
2182
|
type: "button",
|
|
2197
2183
|
className: "seed-fm-btn",
|
|
2198
2184
|
disabled: a,
|
|
@@ -2200,7 +2186,7 @@ function Kn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2200
2186
|
await o() && f(!0);
|
|
2201
2187
|
},
|
|
2202
2188
|
children: [
|
|
2203
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ B(Q, {
|
|
2204
2190
|
name: d ? "check" : "download",
|
|
2205
2191
|
size: 15
|
|
2206
2192
|
}),
|
|
@@ -2209,7 +2195,7 @@ function Kn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2209
2195
|
]
|
|
2210
2196
|
})]
|
|
2211
2197
|
}),
|
|
2212
|
-
n > 0 && /* @__PURE__ */
|
|
2198
|
+
n > 0 && /* @__PURE__ */ V("p", { children: [
|
|
2213
2199
|
n,
|
|
2214
2200
|
" other ",
|
|
2215
2201
|
n === 1 ? "file" : "files",
|
|
@@ -2218,23 +2204,23 @@ function Kn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2218
2204
|
" ",
|
|
2219
2205
|
"hidden here and won’t be deleted, so the folder itself will stay."
|
|
2220
2206
|
] }),
|
|
2221
|
-
r && /* @__PURE__ */
|
|
2207
|
+
r && /* @__PURE__ */ V("div", {
|
|
2222
2208
|
className: "seed-fm-warning",
|
|
2223
2209
|
role: "alert",
|
|
2224
|
-
children: [/* @__PURE__ */
|
|
2210
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2225
2211
|
name: "triangleAlert",
|
|
2226
2212
|
size: 16
|
|
2227
|
-
}), /* @__PURE__ */
|
|
2213
|
+
}), /* @__PURE__ */ B("span", { children: r })]
|
|
2228
2214
|
}),
|
|
2229
|
-
/* @__PURE__ */
|
|
2215
|
+
/* @__PURE__ */ V("div", {
|
|
2230
2216
|
className: "seed-fm-dialog-actions",
|
|
2231
|
-
children: [/* @__PURE__ */
|
|
2217
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2232
2218
|
type: "button",
|
|
2233
2219
|
className: "seed-fm-btn",
|
|
2234
2220
|
onClick: s,
|
|
2235
2221
|
"data-initial-focus": !0,
|
|
2236
2222
|
children: "Cancel"
|
|
2237
|
-
}), /* @__PURE__ */
|
|
2223
|
+
}), /* @__PURE__ */ B("button", {
|
|
2238
2224
|
type: "submit",
|
|
2239
2225
|
disabled: a,
|
|
2240
2226
|
className: `seed-fm-btn ${i.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
@@ -2246,18 +2232,18 @@ function Kn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2246
2232
|
}
|
|
2247
2233
|
//#endregion
|
|
2248
2234
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2249
|
-
function
|
|
2235
|
+
function Jn(e) {
|
|
2250
2236
|
return e.detectedType ?? e.type;
|
|
2251
2237
|
}
|
|
2252
|
-
var
|
|
2253
|
-
function
|
|
2254
|
-
let t =
|
|
2255
|
-
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" ||
|
|
2238
|
+
var Yn = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2239
|
+
function $(e) {
|
|
2240
|
+
let t = Jn(e);
|
|
2241
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || Yn.test(e.name) ? "database" : t === "application/json" || /\.json$/i.test(e.name) ? "json" : t === "text/html" || /\.html?$/i.test(e.name) ? "html" : t.startsWith("text/") ? "text" : "other";
|
|
2256
2242
|
}
|
|
2257
2243
|
function Xn(e) {
|
|
2258
2244
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2259
2245
|
if (t) return t.toLowerCase();
|
|
2260
|
-
let n =
|
|
2246
|
+
let n = Jn(e);
|
|
2261
2247
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2262
2248
|
}
|
|
2263
2249
|
var Zn = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, Qn = /^(.*\/)?images\/([^/]+)$/, $n = (e) => e.replace(/\.[^/.]+$/, "");
|
|
@@ -2292,7 +2278,7 @@ function rr(e, t) {
|
|
|
2292
2278
|
let a = nr(t);
|
|
2293
2279
|
r.push(a);
|
|
2294
2280
|
let o = tr(t.path);
|
|
2295
|
-
o &&
|
|
2281
|
+
o && $(t) === "image" && n.set(o, a);
|
|
2296
2282
|
}
|
|
2297
2283
|
for (let e of i) {
|
|
2298
2284
|
let t = n.get(e.key);
|
|
@@ -2348,7 +2334,7 @@ function sr(e) {
|
|
|
2348
2334
|
text: 0,
|
|
2349
2335
|
other: 0
|
|
2350
2336
|
};
|
|
2351
|
-
for (let n of e) t[
|
|
2337
|
+
for (let n of e) t[$(n)] += n.size;
|
|
2352
2338
|
return t;
|
|
2353
2339
|
}
|
|
2354
2340
|
function cr(e) {
|
|
@@ -2410,7 +2396,7 @@ async function vr(e) {
|
|
|
2410
2396
|
}
|
|
2411
2397
|
async function yr(e) {
|
|
2412
2398
|
let t = e.variants[0];
|
|
2413
|
-
return t ?
|
|
2399
|
+
return t ? Tn(t.file.path) : vr(await Tn(e.file.path));
|
|
2414
2400
|
}
|
|
2415
2401
|
var br = /* @__PURE__ */ new WeakMap(), xr = null;
|
|
2416
2402
|
function Sr(e, t) {
|
|
@@ -2421,7 +2407,7 @@ function Sr(e, t) {
|
|
|
2421
2407
|
});
|
|
2422
2408
|
}
|
|
2423
2409
|
function Cr(e) {
|
|
2424
|
-
let t =
|
|
2410
|
+
let t = $(e.file) === "image", [r, a] = c(null), [o, s] = c(!1), [l, u] = c(null), [d, f] = c("idle"), p = n((e) => a(e), []);
|
|
2425
2411
|
i(() => {
|
|
2426
2412
|
if (t && r && !o) return Sr(r, () => s(!0));
|
|
2427
2413
|
}, [
|
|
@@ -2488,36 +2474,36 @@ var wr = {
|
|
|
2488
2474
|
label: "Other",
|
|
2489
2475
|
color: "var(--seed-kind-other)"
|
|
2490
2476
|
}
|
|
2491
|
-
}, Tr = (e) => ({ "--seed-kind": wr[e].color }), Er = (e) => /png|webp|gif|avif|svg/.test(
|
|
2477
|
+
}, Tr = (e) => ({ "--seed-kind": wr[e].color }), Er = (e) => /png|webp|gif|avif|svg/.test(Jn(e.file));
|
|
2492
2478
|
function Dr({ entry: e, size: t, children: n }) {
|
|
2493
|
-
let r =
|
|
2479
|
+
let r = $(e.file), { ref: i, url: a, status: o, markError: s } = Cr(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2494
2480
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2495
2481
|
l && Er(e) ? "seed-fm-thumb--checker" : "",
|
|
2496
2482
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2497
2483
|
].filter(Boolean).join(" "), d;
|
|
2498
|
-
return d = l ? /* @__PURE__ */
|
|
2484
|
+
return d = l ? /* @__PURE__ */ B("img", {
|
|
2499
2485
|
src: a,
|
|
2500
2486
|
alt: "",
|
|
2501
2487
|
decoding: "async",
|
|
2502
2488
|
draggable: !1,
|
|
2503
2489
|
onError: s
|
|
2504
|
-
}) : t === "mini" ? /* @__PURE__ */
|
|
2490
|
+
}) : t === "mini" ? /* @__PURE__ */ B(Q, {
|
|
2505
2491
|
name: c ? "imageOff" : wr[r].icon,
|
|
2506
2492
|
size: 16
|
|
2507
|
-
}) : r === "image" && !c ? null : /* @__PURE__ */
|
|
2493
|
+
}) : r === "image" && !c ? null : /* @__PURE__ */ V("span", {
|
|
2508
2494
|
className: "seed-fm-kind",
|
|
2509
|
-
children: [/* @__PURE__ */
|
|
2495
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2510
2496
|
name: c ? "imageOff" : wr[r].icon,
|
|
2511
2497
|
size: 28,
|
|
2512
2498
|
strokeWidth: 1.6
|
|
2513
|
-
}), c ? /* @__PURE__ */
|
|
2499
|
+
}), c ? /* @__PURE__ */ B("span", {
|
|
2514
2500
|
className: "seed-fm-kind-error",
|
|
2515
2501
|
children: "Can’t decode image"
|
|
2516
|
-
}) : /* @__PURE__ */
|
|
2502
|
+
}) : /* @__PURE__ */ B("span", {
|
|
2517
2503
|
className: "seed-fm-ext",
|
|
2518
2504
|
children: Xn(e.file)
|
|
2519
2505
|
})]
|
|
2520
|
-
}), /* @__PURE__ */
|
|
2506
|
+
}), /* @__PURE__ */ V("span", {
|
|
2521
2507
|
ref: i,
|
|
2522
2508
|
className: u,
|
|
2523
2509
|
style: Tr(r),
|
|
@@ -2527,14 +2513,14 @@ function Dr({ entry: e, size: t, children: n }) {
|
|
|
2527
2513
|
//#endregion
|
|
2528
2514
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2529
2515
|
function Or({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2530
|
-
return /* @__PURE__ */
|
|
2516
|
+
return /* @__PURE__ */ B("ul", {
|
|
2531
2517
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2532
2518
|
role: "listbox",
|
|
2533
2519
|
"aria-label": "Files",
|
|
2534
2520
|
"aria-multiselectable": "true",
|
|
2535
2521
|
children: e.map((e, i) => {
|
|
2536
2522
|
let { file: o, variants: s } = e, c = t.has(o.path);
|
|
2537
|
-
return /* @__PURE__ */
|
|
2523
|
+
return /* @__PURE__ */ V("li", {
|
|
2538
2524
|
role: "option",
|
|
2539
2525
|
tabIndex: 0,
|
|
2540
2526
|
"aria-selected": c,
|
|
@@ -2546,10 +2532,10 @@ function Or({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2546
2532
|
onKeyDown: (t) => {
|
|
2547
2533
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2548
2534
|
},
|
|
2549
|
-
children: [/* @__PURE__ */
|
|
2535
|
+
children: [/* @__PURE__ */ V(Dr, {
|
|
2550
2536
|
entry: e,
|
|
2551
2537
|
size: "tile",
|
|
2552
|
-
children: [/* @__PURE__ */
|
|
2538
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2553
2539
|
type: "button",
|
|
2554
2540
|
className: "seed-fm-check",
|
|
2555
2541
|
tabIndex: -1,
|
|
@@ -2557,16 +2543,16 @@ function Or({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2557
2543
|
onClick: (t) => {
|
|
2558
2544
|
t.stopPropagation(), r(e, i, t.shiftKey);
|
|
2559
2545
|
},
|
|
2560
|
-
children: c && /* @__PURE__ */
|
|
2546
|
+
children: c && /* @__PURE__ */ B(Q, {
|
|
2561
2547
|
name: "check",
|
|
2562
2548
|
size: 14,
|
|
2563
2549
|
strokeWidth: 3
|
|
2564
2550
|
})
|
|
2565
|
-
}), s.length > 0 && /* @__PURE__ */
|
|
2551
|
+
}), s.length > 0 && /* @__PURE__ */ V("span", {
|
|
2566
2552
|
className: "seed-fm-badge",
|
|
2567
2553
|
title: "Resized copies are grouped with this image",
|
|
2568
2554
|
children: [
|
|
2569
|
-
/* @__PURE__ */
|
|
2555
|
+
/* @__PURE__ */ B(Q, {
|
|
2570
2556
|
name: "layers",
|
|
2571
2557
|
size: 11,
|
|
2572
2558
|
strokeWidth: 2.2
|
|
@@ -2576,21 +2562,21 @@ function Or({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2576
2562
|
s.length === 1 ? "size" : "sizes"
|
|
2577
2563
|
]
|
|
2578
2564
|
})]
|
|
2579
|
-
}), /* @__PURE__ */
|
|
2565
|
+
}), /* @__PURE__ */ V("span", {
|
|
2580
2566
|
className: "seed-fm-tile-meta",
|
|
2581
|
-
children: [/* @__PURE__ */
|
|
2567
|
+
children: [/* @__PURE__ */ B("span", {
|
|
2582
2568
|
className: "seed-fm-tile-name",
|
|
2583
|
-
children:
|
|
2584
|
-
}), /* @__PURE__ */
|
|
2569
|
+
children: Hn(o.name, 24)
|
|
2570
|
+
}), /* @__PURE__ */ V("span", {
|
|
2585
2571
|
className: "seed-fm-tile-sub",
|
|
2586
2572
|
children: [
|
|
2587
|
-
|
|
2573
|
+
Z(o.size),
|
|
2588
2574
|
" ·",
|
|
2589
2575
|
" ",
|
|
2590
|
-
/* @__PURE__ */
|
|
2576
|
+
/* @__PURE__ */ B("time", {
|
|
2591
2577
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2592
|
-
title:
|
|
2593
|
-
children:
|
|
2578
|
+
title: Vn(o.lastModified),
|
|
2579
|
+
children: Bn(o.lastModified)
|
|
2594
2580
|
})
|
|
2595
2581
|
]
|
|
2596
2582
|
})]
|
|
@@ -2607,14 +2593,14 @@ function kr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2607
2593
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
2608
2594
|
}, [m, h]);
|
|
2609
2595
|
let g = n ? `${n}/` : "";
|
|
2610
|
-
return /* @__PURE__ */
|
|
2596
|
+
return /* @__PURE__ */ B("div", {
|
|
2611
2597
|
className: "seed-fm-list-wrap",
|
|
2612
|
-
children: /* @__PURE__ */
|
|
2598
|
+
children: /* @__PURE__ */ V("table", {
|
|
2613
2599
|
className: ["seed-fm-list", d].filter(Boolean).join(" "),
|
|
2614
|
-
children: [/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
2600
|
+
children: [/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ V("tr", { children: [
|
|
2601
|
+
/* @__PURE__ */ B("th", {
|
|
2616
2602
|
style: { width: 28 },
|
|
2617
|
-
children: /* @__PURE__ */
|
|
2603
|
+
children: /* @__PURE__ */ B("input", {
|
|
2618
2604
|
ref: p,
|
|
2619
2605
|
type: "checkbox",
|
|
2620
2606
|
className: "seed-fm-checkbox",
|
|
@@ -2623,34 +2609,34 @@ function kr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2623
2609
|
"aria-label": "Select all"
|
|
2624
2610
|
})
|
|
2625
2611
|
}),
|
|
2626
|
-
/* @__PURE__ */
|
|
2627
|
-
/* @__PURE__ */
|
|
2612
|
+
/* @__PURE__ */ B("th", { children: "Name" }),
|
|
2613
|
+
/* @__PURE__ */ B("th", {
|
|
2628
2614
|
className: "seed-fm-col-type",
|
|
2629
2615
|
children: "Type"
|
|
2630
2616
|
}),
|
|
2631
|
-
/* @__PURE__ */
|
|
2617
|
+
/* @__PURE__ */ B("th", {
|
|
2632
2618
|
className: "seed-fm-num seed-fm-col-size",
|
|
2633
2619
|
children: "Size"
|
|
2634
2620
|
}),
|
|
2635
|
-
/* @__PURE__ */
|
|
2621
|
+
/* @__PURE__ */ B("th", {
|
|
2636
2622
|
className: "seed-fm-col-modified",
|
|
2637
2623
|
children: "Modified"
|
|
2638
2624
|
}),
|
|
2639
|
-
/* @__PURE__ */
|
|
2625
|
+
/* @__PURE__ */ B("th", { children: /* @__PURE__ */ B("span", {
|
|
2640
2626
|
className: "seed-fm-visually-hidden",
|
|
2641
2627
|
children: "Actions"
|
|
2642
2628
|
}) })
|
|
2643
|
-
] }) }), /* @__PURE__ */
|
|
2629
|
+
] }) }), /* @__PURE__ */ B("tbody", { children: e.map((e, n) => {
|
|
2644
2630
|
let { file: i } = e, o = t.has(i.path), s = u(e);
|
|
2645
|
-
return /* @__PURE__ */
|
|
2631
|
+
return /* @__PURE__ */ V("tr", {
|
|
2646
2632
|
"data-path": i.path,
|
|
2647
2633
|
"aria-selected": o,
|
|
2648
2634
|
className: ["seed-fm-row", f].filter(Boolean).join(" "),
|
|
2649
2635
|
onClick: (t) => r(e, n, t),
|
|
2650
2636
|
children: [
|
|
2651
|
-
/* @__PURE__ */
|
|
2637
|
+
/* @__PURE__ */ B("td", {
|
|
2652
2638
|
onClick: (e) => e.stopPropagation(),
|
|
2653
|
-
children: /* @__PURE__ */
|
|
2639
|
+
children: /* @__PURE__ */ B("input", {
|
|
2654
2640
|
type: "checkbox",
|
|
2655
2641
|
className: "seed-fm-checkbox",
|
|
2656
2642
|
checked: o,
|
|
@@ -2659,61 +2645,61 @@ function kr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2659
2645
|
"aria-label": `Select ${i.name}`
|
|
2660
2646
|
})
|
|
2661
2647
|
}),
|
|
2662
|
-
/* @__PURE__ */
|
|
2648
|
+
/* @__PURE__ */ B("td", { children: /* @__PURE__ */ V("span", {
|
|
2663
2649
|
className: "seed-fm-namecell",
|
|
2664
|
-
children: [/* @__PURE__ */
|
|
2650
|
+
children: [/* @__PURE__ */ B(Dr, {
|
|
2665
2651
|
entry: e,
|
|
2666
2652
|
size: "mini"
|
|
2667
|
-
}), /* @__PURE__ */
|
|
2653
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("button", {
|
|
2668
2654
|
type: "button",
|
|
2669
2655
|
className: "seed-fm-row-name seed-fm-row-open",
|
|
2670
2656
|
onClick: (t) => {
|
|
2671
2657
|
t.stopPropagation(), r(e, n, t);
|
|
2672
2658
|
},
|
|
2673
2659
|
children: i.name
|
|
2674
|
-
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */
|
|
2660
|
+
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */ B("span", {
|
|
2675
2661
|
className: "seed-fm-row-path",
|
|
2676
2662
|
children: i.path.slice(g.length)
|
|
2677
2663
|
})] })]
|
|
2678
2664
|
}) }),
|
|
2679
|
-
/* @__PURE__ */
|
|
2665
|
+
/* @__PURE__ */ B("td", {
|
|
2680
2666
|
className: "seed-fm-col-type",
|
|
2681
|
-
children: /* @__PURE__ */
|
|
2667
|
+
children: /* @__PURE__ */ V("span", {
|
|
2682
2668
|
className: "seed-fm-type",
|
|
2683
|
-
style: Tr(
|
|
2684
|
-
children: [
|
|
2669
|
+
style: Tr($(i)),
|
|
2670
|
+
children: [Jn(i), i.detectedType && /* @__PURE__ */ B("small", { children: "detected" })]
|
|
2685
2671
|
})
|
|
2686
2672
|
}),
|
|
2687
|
-
/* @__PURE__ */
|
|
2673
|
+
/* @__PURE__ */ B("td", {
|
|
2688
2674
|
className: "seed-fm-num seed-fm-col-size",
|
|
2689
2675
|
title: `${i.size.toLocaleString()} bytes`,
|
|
2690
|
-
children:
|
|
2676
|
+
children: Z(e.totalSize)
|
|
2691
2677
|
}),
|
|
2692
|
-
/* @__PURE__ */
|
|
2678
|
+
/* @__PURE__ */ B("td", {
|
|
2693
2679
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2694
|
-
title:
|
|
2695
|
-
children:
|
|
2680
|
+
title: Vn(i.lastModified),
|
|
2681
|
+
children: Bn(i.lastModified)
|
|
2696
2682
|
}),
|
|
2697
|
-
/* @__PURE__ */
|
|
2683
|
+
/* @__PURE__ */ V("td", {
|
|
2698
2684
|
className: "seed-fm-actions",
|
|
2699
2685
|
onClick: (e) => e.stopPropagation(),
|
|
2700
|
-
children: [/* @__PURE__ */
|
|
2686
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2701
2687
|
type: "button",
|
|
2702
2688
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2703
2689
|
"aria-label": `Download ${i.name}`,
|
|
2704
2690
|
title: "Download",
|
|
2705
2691
|
onClick: () => c(e),
|
|
2706
|
-
children: /* @__PURE__ */
|
|
2692
|
+
children: /* @__PURE__ */ B(Q, {
|
|
2707
2693
|
name: "download",
|
|
2708
2694
|
size: 15
|
|
2709
2695
|
})
|
|
2710
|
-
}), /* @__PURE__ */
|
|
2696
|
+
}), /* @__PURE__ */ B("button", {
|
|
2711
2697
|
type: "button",
|
|
2712
2698
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2713
2699
|
"aria-label": s.label ? `${s.label}: ${i.name}` : `Delete ${i.name}`,
|
|
2714
2700
|
title: s.label ?? "Delete",
|
|
2715
2701
|
onClick: () => l(e),
|
|
2716
|
-
children: /* @__PURE__ */
|
|
2702
|
+
children: /* @__PURE__ */ B(Q, {
|
|
2717
2703
|
name: "trash",
|
|
2718
2704
|
size: 15
|
|
2719
2705
|
})
|
|
@@ -2729,11 +2715,11 @@ function kr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2729
2715
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2730
2716
|
var Ar = 1048576, jr = 32768;
|
|
2731
2717
|
function Mr(e) {
|
|
2732
|
-
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o =
|
|
2718
|
+
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = $(e.file), s = e.file.size;
|
|
2733
2719
|
return i(() => {
|
|
2734
2720
|
let e = !1, t = null;
|
|
2735
2721
|
return n({ kind: "loading" }), (async () => {
|
|
2736
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2722
|
+
if (o === "image") return t = URL.createObjectURL(await Tn(r)), {
|
|
2737
2723
|
kind: "image",
|
|
2738
2724
|
url: t
|
|
2739
2725
|
};
|
|
@@ -2742,7 +2728,7 @@ function Mr(e) {
|
|
|
2742
2728
|
kind: "none",
|
|
2743
2729
|
message: "This file is too large to preview."
|
|
2744
2730
|
};
|
|
2745
|
-
let e = await
|
|
2731
|
+
let e = await Tn(r), t = e.size > jr, n = await e.slice(0, jr).text();
|
|
2746
2732
|
if (o === "json" && !t) try {
|
|
2747
2733
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2748
2734
|
} catch {}
|
|
@@ -2777,14 +2763,14 @@ function Mr(e) {
|
|
|
2777
2763
|
]), t;
|
|
2778
2764
|
}
|
|
2779
2765
|
function Nr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onDelete: o, deleteAction: l, onCopyPath: u, className: d }) {
|
|
2780
|
-
let { file: f, variants: p } = e, m =
|
|
2766
|
+
let { file: f, variants: p } = e, m = $(f), h = Mr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2781
2767
|
i(() => {
|
|
2782
2768
|
_(null), y(!1);
|
|
2783
2769
|
}, [f.path]), i(() => {
|
|
2784
2770
|
b.current?.focus();
|
|
2785
2771
|
}, []);
|
|
2786
2772
|
let x = `seed-fm-panel-${encodeURIComponent(f.path)}`, S = p.reduce((e, t) => e + t.file.size, 0), C;
|
|
2787
|
-
if (h.kind === "image" && !v) C = /* @__PURE__ */
|
|
2773
|
+
if (h.kind === "image" && !v) C = /* @__PURE__ */ B("img", {
|
|
2788
2774
|
src: h.url,
|
|
2789
2775
|
alt: `Preview of ${f.name}`,
|
|
2790
2776
|
onLoad: (e) => _({
|
|
@@ -2793,64 +2779,64 @@ function Nr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2793
2779
|
}),
|
|
2794
2780
|
onError: () => y(!0)
|
|
2795
2781
|
});
|
|
2796
|
-
else if (h.kind === "text") C = /* @__PURE__ */
|
|
2782
|
+
else if (h.kind === "text") C = /* @__PURE__ */ V("pre", { children: [h.text, h.truncated && "\n…"] });
|
|
2797
2783
|
else if (h.kind === "loading") C = null;
|
|
2798
2784
|
else {
|
|
2799
2785
|
let e = h.kind === "none" ? h.message : "The browser can’t decode this image. The file may be corrupt or not an image.";
|
|
2800
|
-
C = /* @__PURE__ */
|
|
2786
|
+
C = /* @__PURE__ */ V("span", {
|
|
2801
2787
|
className: "seed-fm-preview-note",
|
|
2802
|
-
children: [/* @__PURE__ */
|
|
2788
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2803
2789
|
name: v ? "imageOff" : wr[m].icon,
|
|
2804
2790
|
size: 32,
|
|
2805
2791
|
strokeWidth: 1.5
|
|
2806
2792
|
}), e]
|
|
2807
2793
|
});
|
|
2808
2794
|
}
|
|
2809
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2810
|
-
return /* @__PURE__ */
|
|
2795
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(Jn(f));
|
|
2796
|
+
return /* @__PURE__ */ V("aside", {
|
|
2811
2797
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2812
2798
|
role: "dialog",
|
|
2813
2799
|
"aria-modal": "false",
|
|
2814
2800
|
"aria-labelledby": x,
|
|
2815
2801
|
children: [
|
|
2816
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ V("div", {
|
|
2817
2803
|
className: "seed-fm-panel-head",
|
|
2818
2804
|
children: [
|
|
2819
|
-
/* @__PURE__ */
|
|
2805
|
+
/* @__PURE__ */ B("h3", {
|
|
2820
2806
|
id: x,
|
|
2821
2807
|
title: f.name,
|
|
2822
2808
|
children: f.name
|
|
2823
2809
|
}),
|
|
2824
|
-
/* @__PURE__ */
|
|
2810
|
+
/* @__PURE__ */ B("button", {
|
|
2825
2811
|
type: "button",
|
|
2826
2812
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2827
2813
|
"aria-label": "Previous file",
|
|
2828
2814
|
disabled: !n,
|
|
2829
2815
|
onClick: n ?? void 0,
|
|
2830
|
-
children: /* @__PURE__ */
|
|
2816
|
+
children: /* @__PURE__ */ B(Q, { name: "chevronLeft" })
|
|
2831
2817
|
}),
|
|
2832
|
-
/* @__PURE__ */
|
|
2818
|
+
/* @__PURE__ */ B("button", {
|
|
2833
2819
|
type: "button",
|
|
2834
2820
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2835
2821
|
"aria-label": "Next file",
|
|
2836
2822
|
disabled: !r,
|
|
2837
2823
|
onClick: r ?? void 0,
|
|
2838
|
-
children: /* @__PURE__ */
|
|
2824
|
+
children: /* @__PURE__ */ B(Q, { name: "chevronRight" })
|
|
2839
2825
|
}),
|
|
2840
|
-
/* @__PURE__ */
|
|
2826
|
+
/* @__PURE__ */ B("button", {
|
|
2841
2827
|
ref: b,
|
|
2842
2828
|
type: "button",
|
|
2843
2829
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2844
2830
|
"aria-label": "Close details",
|
|
2845
2831
|
onClick: t,
|
|
2846
|
-
children: /* @__PURE__ */
|
|
2832
|
+
children: /* @__PURE__ */ B(Q, { name: "x" })
|
|
2847
2833
|
})
|
|
2848
2834
|
]
|
|
2849
2835
|
}),
|
|
2850
|
-
/* @__PURE__ */
|
|
2836
|
+
/* @__PURE__ */ V("div", {
|
|
2851
2837
|
className: "seed-fm-panel-body",
|
|
2852
2838
|
children: [
|
|
2853
|
-
/* @__PURE__ */
|
|
2839
|
+
/* @__PURE__ */ B("div", {
|
|
2854
2840
|
className: [
|
|
2855
2841
|
"seed-fm-preview",
|
|
2856
2842
|
w ? "seed-fm-thumb--checker" : "",
|
|
@@ -2859,78 +2845,78 @@ function Nr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2859
2845
|
style: Tr(m),
|
|
2860
2846
|
children: C
|
|
2861
2847
|
}),
|
|
2862
|
-
/* @__PURE__ */
|
|
2848
|
+
/* @__PURE__ */ V("dl", {
|
|
2863
2849
|
className: "seed-fm-details",
|
|
2864
2850
|
children: [
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
/* @__PURE__ */
|
|
2851
|
+
/* @__PURE__ */ B("dt", { children: "Path" }),
|
|
2852
|
+
/* @__PURE__ */ B("dd", { children: /* @__PURE__ */ V("span", {
|
|
2867
2853
|
className: "seed-fm-path",
|
|
2868
|
-
children: [/* @__PURE__ */
|
|
2854
|
+
children: [/* @__PURE__ */ B("code", { children: f.path }), /* @__PURE__ */ B("button", {
|
|
2869
2855
|
type: "button",
|
|
2870
2856
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2871
2857
|
"aria-label": "Copy path",
|
|
2872
2858
|
title: "Copy path",
|
|
2873
2859
|
onClick: u,
|
|
2874
|
-
children: /* @__PURE__ */
|
|
2860
|
+
children: /* @__PURE__ */ B(Q, {
|
|
2875
2861
|
name: "copy",
|
|
2876
2862
|
size: 13
|
|
2877
2863
|
})
|
|
2878
2864
|
})]
|
|
2879
2865
|
}) }),
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
/* @__PURE__ */
|
|
2882
|
-
|
|
2866
|
+
/* @__PURE__ */ B("dt", { children: "Size" }),
|
|
2867
|
+
/* @__PURE__ */ V("dd", { children: [
|
|
2868
|
+
Z(f.size),
|
|
2883
2869
|
" ",
|
|
2884
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ V("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2885
2871
|
] }),
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ B("dt", { children: "Type" }),
|
|
2873
|
+
/* @__PURE__ */ V("dd", { children: [Jn(f), f.detectedType && /* @__PURE__ */ V("small", { children: [
|
|
2888
2874
|
" from file contents. File.type is “",
|
|
2889
2875
|
f.type,
|
|
2890
2876
|
"”"
|
|
2891
2877
|
] })] }),
|
|
2892
|
-
g && /* @__PURE__ */
|
|
2878
|
+
g && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("dt", { children: "Dimensions" }), /* @__PURE__ */ V("dd", { children: [
|
|
2893
2879
|
g.width.toLocaleString(),
|
|
2894
2880
|
" × ",
|
|
2895
2881
|
g.height.toLocaleString(),
|
|
2896
2882
|
" px"
|
|
2897
2883
|
] })] }),
|
|
2898
|
-
/* @__PURE__ */
|
|
2899
|
-
/* @__PURE__ */
|
|
2900
|
-
|
|
2884
|
+
/* @__PURE__ */ B("dt", { children: "Modified" }),
|
|
2885
|
+
/* @__PURE__ */ V("dd", { children: [
|
|
2886
|
+
Vn(f.lastModified),
|
|
2901
2887
|
" ",
|
|
2902
|
-
/* @__PURE__ */
|
|
2888
|
+
/* @__PURE__ */ B("small", { children: Bn(f.lastModified) })
|
|
2903
2889
|
] })
|
|
2904
2890
|
]
|
|
2905
2891
|
}),
|
|
2906
|
-
p.length > 0 && /* @__PURE__ */
|
|
2892
|
+
p.length > 0 && /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ V("div", {
|
|
2907
2893
|
className: "seed-fm-section-label",
|
|
2908
|
-
children: ["Resized copies · ",
|
|
2909
|
-
}), /* @__PURE__ */
|
|
2894
|
+
children: ["Resized copies · ", Z(S)]
|
|
2895
|
+
}), /* @__PURE__ */ B("ul", {
|
|
2910
2896
|
className: "seed-fm-variants",
|
|
2911
|
-
children: p.map((e) => /* @__PURE__ */
|
|
2897
|
+
children: p.map((e) => /* @__PURE__ */ V("li", {
|
|
2912
2898
|
title: e.file.path,
|
|
2913
|
-
children: [/* @__PURE__ */
|
|
2899
|
+
children: [/* @__PURE__ */ V("span", { children: [e.width, "w · webp"] }), /* @__PURE__ */ B("span", { children: Z(e.file.size) })]
|
|
2914
2900
|
}, e.file.path))
|
|
2915
2901
|
})] })
|
|
2916
2902
|
]
|
|
2917
2903
|
}),
|
|
2918
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ V("div", {
|
|
2919
2905
|
className: "seed-fm-panel-foot",
|
|
2920
|
-
children: [/* @__PURE__ */
|
|
2906
|
+
children: [/* @__PURE__ */ V("button", {
|
|
2921
2907
|
type: "button",
|
|
2922
2908
|
className: "seed-fm-btn seed-fm-btn--primary",
|
|
2923
2909
|
onClick: a,
|
|
2924
|
-
children: [/* @__PURE__ */
|
|
2910
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2925
2911
|
name: "download",
|
|
2926
2912
|
size: 15
|
|
2927
2913
|
}), " Download"]
|
|
2928
|
-
}), /* @__PURE__ */
|
|
2914
|
+
}), /* @__PURE__ */ V("button", {
|
|
2929
2915
|
type: "button",
|
|
2930
2916
|
className: `seed-fm-btn${l.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
2931
2917
|
onClick: o,
|
|
2932
2918
|
children: [
|
|
2933
|
-
/* @__PURE__ */
|
|
2919
|
+
/* @__PURE__ */ B(Q, {
|
|
2934
2920
|
name: "trash",
|
|
2935
2921
|
size: 15
|
|
2936
2922
|
}),
|
|
@@ -3277,51 +3263,51 @@ function ni({ files: e, estimate: t }) {
|
|
|
3277
3263
|
size: i,
|
|
3278
3264
|
color: "var(--seed-border-strong)"
|
|
3279
3265
|
}] : []];
|
|
3280
|
-
return /* @__PURE__ */
|
|
3266
|
+
return /* @__PURE__ */ V("div", {
|
|
3281
3267
|
className: "seed-fm-usage",
|
|
3282
3268
|
title: "From navigator.storage.estimate(). Browsers round these numbers.",
|
|
3283
|
-
children: [/* @__PURE__ */
|
|
3269
|
+
children: [/* @__PURE__ */ V("div", {
|
|
3284
3270
|
className: "seed-fm-usage-row",
|
|
3285
|
-
children: [/* @__PURE__ */
|
|
3286
|
-
/* @__PURE__ */
|
|
3271
|
+
children: [/* @__PURE__ */ V("span", { children: [
|
|
3272
|
+
/* @__PURE__ */ B("strong", { children: Z(t ? t.usage : r) }),
|
|
3287
3273
|
" ",
|
|
3288
3274
|
t ? "used by this site" : `in ${Zr(e.length, "file")}`
|
|
3289
|
-
] }), t && /* @__PURE__ */
|
|
3290
|
-
}), a > 0 && /* @__PURE__ */
|
|
3275
|
+
] }), t && /* @__PURE__ */ V("span", { children: [Z(t.quota), " available"] })]
|
|
3276
|
+
}), a > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3291
3277
|
className: "seed-fm-meter",
|
|
3292
3278
|
role: "img",
|
|
3293
3279
|
"aria-label": "Storage used, by file type",
|
|
3294
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3280
|
+
children: o.map((e) => /* @__PURE__ */ B("span", { style: {
|
|
3295
3281
|
width: `${e.size / a * 100}%`,
|
|
3296
3282
|
background: e.color
|
|
3297
3283
|
} }, e.label))
|
|
3298
|
-
}), /* @__PURE__ */
|
|
3284
|
+
}), /* @__PURE__ */ B("ul", {
|
|
3299
3285
|
className: "seed-fm-legend",
|
|
3300
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3286
|
+
children: o.map((e) => /* @__PURE__ */ V("li", {
|
|
3301
3287
|
style: { "--seed-swatch": e.color },
|
|
3302
3288
|
children: [
|
|
3303
3289
|
e.label,
|
|
3304
3290
|
" ",
|
|
3305
|
-
|
|
3291
|
+
Z(e.size)
|
|
3306
3292
|
]
|
|
3307
3293
|
}, e.label))
|
|
3308
3294
|
})] })]
|
|
3309
3295
|
});
|
|
3310
3296
|
}
|
|
3311
3297
|
function ri({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3312
|
-
return /* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ V("div", {
|
|
3313
3299
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3314
3300
|
role: r === "error" ? "alert" : void 0,
|
|
3315
3301
|
children: [
|
|
3316
|
-
/* @__PURE__ */
|
|
3302
|
+
/* @__PURE__ */ B("span", {
|
|
3317
3303
|
className: "seed-fm-state-icon",
|
|
3318
|
-
children: /* @__PURE__ */
|
|
3304
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3319
3305
|
name: e,
|
|
3320
3306
|
size: 22
|
|
3321
3307
|
})
|
|
3322
3308
|
}),
|
|
3323
|
-
/* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3309
|
+
/* @__PURE__ */ B("h3", { children: t }),
|
|
3310
|
+
/* @__PURE__ */ B("p", { children: n }),
|
|
3325
3311
|
i
|
|
3326
3312
|
]
|
|
3327
3313
|
});
|
|
@@ -3330,102 +3316,102 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3330
3316
|
a(() => {
|
|
3331
3317
|
p !== "none" && zr();
|
|
3332
3318
|
}, [p]);
|
|
3333
|
-
let S = Qr(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: ee, hasLoaded: E, error: te, errorName: D, refetch: ne } =
|
|
3319
|
+
let S = Qr(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: ee, hasLoaded: E, error: te, errorName: D, refetch: ne } = Fn({ rootPath: e }), O = o(() => t ? T.filter(t) : T, [T, t]), k = Br(T), [A, re] = c(_);
|
|
3334
3320
|
i(() => re(_), [_]);
|
|
3335
3321
|
let ie = o(() => rr(O, A), [O, A]), [j, ae] = c(S);
|
|
3336
3322
|
i(() => ae(S), [S]);
|
|
3337
|
-
let [oe,
|
|
3338
|
-
x ? x(e, t, n) :
|
|
3339
|
-
},
|
|
3323
|
+
let [oe, se] = c(""), [M, ce] = c("name"), [le, ue] = c(g), [N, P] = c(() => /* @__PURE__ */ new Set()), de = s(null), [fe, F] = c(null), pe = s(null), [I, L] = c(null), [R, me] = c(null), [he, ge] = c(!1), { toasts: _e, showToast: ve } = ei(), ye = (e, t, n) => {
|
|
3324
|
+
x ? x(e, t, n) : ve(e, t);
|
|
3325
|
+
}, be = o(() => ar(ie, j, {
|
|
3340
3326
|
query: oe,
|
|
3341
|
-
sort:
|
|
3327
|
+
sort: M
|
|
3342
3328
|
}), [
|
|
3343
3329
|
ie,
|
|
3344
3330
|
j,
|
|
3345
3331
|
oe,
|
|
3346
|
-
|
|
3347
|
-
]),
|
|
3332
|
+
M
|
|
3333
|
+
]), H = be.entries, U = H.length ? H.filter((e) => $(e.file) === "image").length / H.length : 0, xe = le ?? (U >= .5 ? "grid" : "list"), W = o(() => new Map(ie.map((e) => [e.file.path, e])), [ie]), Se = o(() => [...N].map((e) => W.get(e)).filter((e) => !!e), [N, W]), G = fe ? W.get(fe) ?? null : null, Ce = G ? H.indexOf(G) : -1;
|
|
3348
3334
|
i(() => {
|
|
3349
3335
|
P((e) => {
|
|
3350
|
-
let t = new Set([...e].filter((e) =>
|
|
3336
|
+
let t = new Set([...e].filter((e) => W.has(e)));
|
|
3351
3337
|
return t.size === e.size ? e : t;
|
|
3352
3338
|
});
|
|
3353
|
-
}, [
|
|
3354
|
-
let
|
|
3355
|
-
ae(e),
|
|
3356
|
-
},
|
|
3339
|
+
}, [W]);
|
|
3340
|
+
let we = (e) => {
|
|
3341
|
+
ae(e), se(""), P(/* @__PURE__ */ new Set()), de.current = null, F(null);
|
|
3342
|
+
}, Te = (e, t, n) => {
|
|
3357
3343
|
let r = de.current;
|
|
3358
3344
|
P((i) => {
|
|
3359
3345
|
let a = new Set(i);
|
|
3360
3346
|
if (n && r != null) {
|
|
3361
3347
|
let [e, n] = r < t ? [r, t] : [t, r];
|
|
3362
|
-
for (let t of
|
|
3348
|
+
for (let t of H.slice(e, n + 1)) a.add(t.file.path);
|
|
3363
3349
|
} else a.has(e.file.path) ? a.delete(e.file.path) : a.add(e.file.path);
|
|
3364
3350
|
return a;
|
|
3365
3351
|
}), (!n || r == null) && (de.current = t);
|
|
3366
|
-
},
|
|
3367
|
-
|
|
3368
|
-
}, Te = () => {
|
|
3369
|
-
I(null), fe.current?.focus?.(), fe.current = null;
|
|
3370
|
-
}, Ee = (e, t, n) => {
|
|
3371
|
-
let r = n.shiftKey || n.metaKey || n.ctrlKey;
|
|
3372
|
-
N.size > 0 || r ? q(e, t, n.shiftKey) : we(e.file.path);
|
|
3352
|
+
}, Ee = (e) => {
|
|
3353
|
+
fe || (pe.current = document.activeElement), F(e);
|
|
3373
3354
|
}, De = () => {
|
|
3374
|
-
|
|
3355
|
+
F(null), pe.current?.focus?.(), pe.current = null;
|
|
3356
|
+
}, Oe = (e, t, n) => {
|
|
3357
|
+
let r = n.shiftKey || n.metaKey || n.ctrlKey;
|
|
3358
|
+
N.size > 0 || r ? Te(e, t, n.shiftKey) : Ee(e.file.path);
|
|
3359
|
+
}, ke = () => {
|
|
3360
|
+
let e = H.every((e) => N.has(e.file.path));
|
|
3375
3361
|
P((t) => {
|
|
3376
3362
|
let n = new Set(t);
|
|
3377
|
-
for (let t of
|
|
3363
|
+
for (let t of H) e ? n.delete(t.file.path) : n.add(t.file.path);
|
|
3378
3364
|
return n;
|
|
3379
3365
|
});
|
|
3380
|
-
},
|
|
3366
|
+
}, Ae = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, K = async (e, t) => {
|
|
3381
3367
|
l ? await l(e, t) : $r(e.name, t);
|
|
3382
|
-
},
|
|
3368
|
+
}, q = async (e, t) => {
|
|
3383
3369
|
if (e.length === 0) return !1;
|
|
3384
|
-
|
|
3370
|
+
ge(!0);
|
|
3385
3371
|
try {
|
|
3386
3372
|
if (e.length === 1 && !t) {
|
|
3387
3373
|
let [t] = e;
|
|
3388
|
-
return await
|
|
3374
|
+
return await K(t, await Tn(t.path)), !0;
|
|
3389
3375
|
}
|
|
3390
3376
|
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await qr(await Promise.all(e.map(async (e) => ({
|
|
3391
|
-
name: t ? e.path.slice(n.length) :
|
|
3392
|
-
data: await
|
|
3377
|
+
name: t ? e.path.slice(n.length) : Ae(e.path),
|
|
3378
|
+
data: await Tn(e.path),
|
|
3393
3379
|
lastModified: e.lastModified
|
|
3394
3380
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3395
|
-
return await
|
|
3381
|
+
return await K({
|
|
3396
3382
|
name: i,
|
|
3397
3383
|
path: i,
|
|
3398
3384
|
size: r.size,
|
|
3399
3385
|
type: "application/zip",
|
|
3400
3386
|
lastModified: Date.now()
|
|
3401
|
-
}, r),
|
|
3387
|
+
}, r), ye(`Saved ${i} with ${Zr(e.length, "file")}`, "success", {
|
|
3402
3388
|
kind: "download",
|
|
3403
3389
|
paths: e.map((e) => e.path),
|
|
3404
3390
|
fileName: i
|
|
3405
3391
|
}), !0;
|
|
3406
3392
|
} catch (t) {
|
|
3407
|
-
return
|
|
3393
|
+
return ye(`Couldn’t download: ${Xr(t)}`, "error", {
|
|
3408
3394
|
kind: "download",
|
|
3409
3395
|
paths: e.map((e) => e.path),
|
|
3410
3396
|
error: Xr(t)
|
|
3411
3397
|
}), !1;
|
|
3412
3398
|
} finally {
|
|
3413
|
-
|
|
3399
|
+
ge(!1);
|
|
3414
3400
|
}
|
|
3415
|
-
},
|
|
3401
|
+
}, je = (e) => q(e.map((e) => e.file)), J = (e, t) => e.flatMap((e) => [e.file, ...t ? e.variants.map((e) => e.file) : []]), Me = (e) => {
|
|
3416
3402
|
let t = b?.(e);
|
|
3417
3403
|
return {
|
|
3418
3404
|
label: t?.label,
|
|
3419
3405
|
destructive: t?.destructive !== !1
|
|
3420
3406
|
};
|
|
3421
|
-
},
|
|
3422
|
-
|
|
3407
|
+
}, Ne = (e) => Me(J(e, !0)), Pe = async (e, t) => {
|
|
3408
|
+
ge(!0);
|
|
3423
3409
|
let i = [], a = [], o = [], s = !1;
|
|
3424
3410
|
try {
|
|
3425
3411
|
let r = await navigator.storage.getDirectory();
|
|
3426
3412
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3427
3413
|
else try {
|
|
3428
|
-
await
|
|
3414
|
+
await En(t.path, r), i.push(t.path);
|
|
3429
3415
|
} catch (e) {
|
|
3430
3416
|
a.push({
|
|
3431
3417
|
path: t.path,
|
|
@@ -3433,7 +3419,7 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3433
3419
|
});
|
|
3434
3420
|
}
|
|
3435
3421
|
if (t) try {
|
|
3436
|
-
s = await
|
|
3422
|
+
s = await On(t.path, r);
|
|
3437
3423
|
} catch (e) {
|
|
3438
3424
|
a.push({
|
|
3439
3425
|
path: t.path,
|
|
@@ -3449,13 +3435,13 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3449
3435
|
P((e) => {
|
|
3450
3436
|
let t = new Set(e);
|
|
3451
3437
|
return i.forEach((e) => t.delete(e)), t;
|
|
3452
|
-
}),
|
|
3438
|
+
}), fe && i.includes(fe) && F(null), await ne(), ge(!1);
|
|
3453
3439
|
let c = [s ? `Deleted the ${t.name} folder (${Zr(i.length, "file")})` : i.length > 0 ? `Deleted ${Zr(i.length, "file")}` : "Nothing deleted"];
|
|
3454
3440
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3455
3441
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3456
3442
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
3457
3443
|
}
|
|
3458
|
-
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`),
|
|
3444
|
+
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`), ye(c.join(". "), a.length ? "error" : "success", {
|
|
3459
3445
|
kind: "delete",
|
|
3460
3446
|
deleted: i,
|
|
3461
3447
|
skipped: o,
|
|
@@ -3465,26 +3451,26 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3465
3451
|
folderRemoved: s
|
|
3466
3452
|
}
|
|
3467
3453
|
}), i.length > 0 && await r?.(i);
|
|
3468
|
-
},
|
|
3454
|
+
}, Y = async (e) => {
|
|
3469
3455
|
if (e.length === 0) return;
|
|
3470
3456
|
if (!y) {
|
|
3471
|
-
|
|
3457
|
+
L(e);
|
|
3472
3458
|
return;
|
|
3473
3459
|
}
|
|
3474
|
-
let t =
|
|
3475
|
-
await y(t) && await
|
|
3476
|
-
},
|
|
3460
|
+
let t = J(e, !0);
|
|
3461
|
+
await y(t) && await Pe(t);
|
|
3462
|
+
}, Fe = (e) => O.filter((t) => t.path.startsWith(`${e.path}/`)), Ie = async (e) => {
|
|
3477
3463
|
if (!y) {
|
|
3478
|
-
|
|
3464
|
+
me(e);
|
|
3479
3465
|
return;
|
|
3480
3466
|
}
|
|
3481
|
-
let t =
|
|
3482
|
-
await y(t) && await
|
|
3483
|
-
},
|
|
3484
|
-
let t = () =>
|
|
3467
|
+
let t = Fe(e);
|
|
3468
|
+
await y(t) && await Pe(t, e);
|
|
3469
|
+
}, Le = (e) => {
|
|
3470
|
+
let t = () => ye("Path copied", "success", {
|
|
3485
3471
|
kind: "copy-path",
|
|
3486
3472
|
path: e
|
|
3487
|
-
}), n = (t) =>
|
|
3473
|
+
}), n = (t) => ye("Couldn’t copy. Select the path text instead.", "error", {
|
|
3488
3474
|
kind: "copy-path",
|
|
3489
3475
|
path: e,
|
|
3490
3476
|
error: t === void 0 ? "Clipboard unavailable" : Xr(t)
|
|
@@ -3494,275 +3480,275 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3494
3480
|
} catch (e) {
|
|
3495
3481
|
n(e);
|
|
3496
3482
|
}
|
|
3497
|
-
},
|
|
3498
|
-
if (
|
|
3483
|
+
}, Re = (e) => {
|
|
3484
|
+
if (I || R) return;
|
|
3499
3485
|
let t = e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement;
|
|
3500
3486
|
if (e.key === "Escape") {
|
|
3501
|
-
if (
|
|
3487
|
+
if (fe) De();
|
|
3502
3488
|
else if (N.size > 0) P(/* @__PURE__ */ new Set());
|
|
3503
3489
|
else return;
|
|
3504
3490
|
e.preventDefault();
|
|
3505
3491
|
} else if (G && !t && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
3506
|
-
let t =
|
|
3507
|
-
t &&
|
|
3492
|
+
let t = H[Ce + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3493
|
+
t && F(t.file.path), e.preventDefault();
|
|
3508
3494
|
}
|
|
3509
|
-
},
|
|
3495
|
+
}, ze = o(() => O.some((e) => er(e.path)), [O]), Be = /(^|\/)images(\/\d+)?$/.test(j), Ve = [{
|
|
3510
3496
|
label: C,
|
|
3511
3497
|
path: S
|
|
3512
3498
|
}, ...(j.length > S.length ? j.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3513
3499
|
label: e,
|
|
3514
3500
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3515
|
-
}))],
|
|
3516
|
-
if (!
|
|
3501
|
+
}))], He = `h${f}`, Ue = Se.reduce((e, t) => e + t.file.size, 0), We;
|
|
3502
|
+
if (!kn()) We = /* @__PURE__ */ B(ri, {
|
|
3517
3503
|
icon: "triangleAlert",
|
|
3518
3504
|
tone: "error",
|
|
3519
3505
|
title: "This browser doesn’t support private file storage",
|
|
3520
3506
|
children: "OPFS isn’t available here. Some private browsing windows and older browsers turn it off. Try a current version of Chrome, Edge, Firefox, or Safari in a normal window."
|
|
3521
3507
|
});
|
|
3522
3508
|
else if (te) {
|
|
3523
|
-
let e = /* @__PURE__ */
|
|
3509
|
+
let e = /* @__PURE__ */ V("button", {
|
|
3524
3510
|
type: "button",
|
|
3525
3511
|
className: "seed-fm-btn",
|
|
3526
3512
|
onClick: () => ne(),
|
|
3527
|
-
children: [/* @__PURE__ */
|
|
3513
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3528
3514
|
name: "refresh",
|
|
3529
3515
|
size: 15
|
|
3530
3516
|
}), " Try again"]
|
|
3531
3517
|
});
|
|
3532
|
-
|
|
3518
|
+
We = D === "NotFoundError" && S ? /* @__PURE__ */ V(ri, {
|
|
3533
3519
|
icon: "triangleAlert",
|
|
3534
3520
|
tone: "error",
|
|
3535
3521
|
title: `Can’t open ${S}`,
|
|
3536
3522
|
action: e,
|
|
3537
3523
|
children: [
|
|
3538
3524
|
"The folder ",
|
|
3539
|
-
/* @__PURE__ */
|
|
3525
|
+
/* @__PURE__ */ B("code", { children: S }),
|
|
3540
3526
|
" doesn’t exist in this browser’s private storage yet. Check the",
|
|
3541
3527
|
" ",
|
|
3542
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ B("code", { children: "rootPath" }),
|
|
3543
3529
|
" prop, or open the app once so the SDK creates it."
|
|
3544
3530
|
]
|
|
3545
|
-
}) : /* @__PURE__ */
|
|
3531
|
+
}) : /* @__PURE__ */ B(ri, {
|
|
3546
3532
|
icon: "triangleAlert",
|
|
3547
3533
|
tone: "error",
|
|
3548
3534
|
title: "Can’t read private storage",
|
|
3549
3535
|
action: e,
|
|
3550
3536
|
children: te
|
|
3551
3537
|
});
|
|
3552
|
-
} else
|
|
3538
|
+
} else We = E ? ie.length === 0 ? /* @__PURE__ */ B(ri, {
|
|
3553
3539
|
icon: "folderOpen",
|
|
3554
3540
|
title: `No files in ${C} yet`,
|
|
3555
3541
|
children: "Files show up here when the app saves images, JSON, or HTML to this browser’s private storage, for example after you add an image to a post or sync content from Arweave."
|
|
3556
|
-
}) :
|
|
3542
|
+
}) : be.folders.length === 0 && H.length === 0 ? oe ? /* @__PURE__ */ V(ri, {
|
|
3557
3543
|
icon: "search",
|
|
3558
3544
|
title: `No matches for “${oe}”`,
|
|
3559
|
-
action: /* @__PURE__ */
|
|
3545
|
+
action: /* @__PURE__ */ B("button", {
|
|
3560
3546
|
type: "button",
|
|
3561
3547
|
className: "seed-fm-btn",
|
|
3562
|
-
onClick: () =>
|
|
3548
|
+
onClick: () => se(""),
|
|
3563
3549
|
children: "Clear search"
|
|
3564
3550
|
}),
|
|
3565
3551
|
children: [
|
|
3566
3552
|
"Search covers file names and paths in ",
|
|
3567
|
-
|
|
3553
|
+
Ve[Ve.length - 1].label,
|
|
3568
3554
|
" and every folder inside it."
|
|
3569
3555
|
]
|
|
3570
|
-
}) : /* @__PURE__ */
|
|
3556
|
+
}) : /* @__PURE__ */ B(ri, {
|
|
3571
3557
|
icon: "folderOpen",
|
|
3572
3558
|
title: "This folder is empty",
|
|
3573
3559
|
children: "Everything in it has been deleted or filtered out."
|
|
3574
|
-
}) : /* @__PURE__ */
|
|
3560
|
+
}) : /* @__PURE__ */ V(z, { children: [be.folders.length > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3575
3561
|
className: "seed-fm-section-label",
|
|
3576
3562
|
children: "Folders"
|
|
3577
|
-
}), /* @__PURE__ */
|
|
3563
|
+
}), /* @__PURE__ */ B("ul", {
|
|
3578
3564
|
className: "seed-fm-folders",
|
|
3579
|
-
children:
|
|
3565
|
+
children: be.folders.map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ V("button", {
|
|
3580
3566
|
type: "button",
|
|
3581
3567
|
className: w("folder", "seed-fm-folder"),
|
|
3582
|
-
onClick: () =>
|
|
3583
|
-
children: [/* @__PURE__ */
|
|
3568
|
+
onClick: () => we(e.path),
|
|
3569
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3584
3570
|
name: "folder",
|
|
3585
3571
|
size: 20,
|
|
3586
3572
|
strokeWidth: 1.75
|
|
3587
|
-
}), /* @__PURE__ */
|
|
3573
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("span", {
|
|
3588
3574
|
className: "seed-fm-folder-name",
|
|
3589
3575
|
children: e.name
|
|
3590
|
-
}), /* @__PURE__ */
|
|
3576
|
+
}), /* @__PURE__ */ V("span", {
|
|
3591
3577
|
className: "seed-fm-folder-meta",
|
|
3592
3578
|
children: [
|
|
3593
3579
|
Zr(e.fileCount, "file"),
|
|
3594
3580
|
" · ",
|
|
3595
|
-
|
|
3581
|
+
Z(e.size)
|
|
3596
3582
|
]
|
|
3597
3583
|
})] })]
|
|
3598
|
-
}), /* @__PURE__ */
|
|
3584
|
+
}), /* @__PURE__ */ B("button", {
|
|
3599
3585
|
type: "button",
|
|
3600
3586
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon seed-fm-folder-delete",
|
|
3601
3587
|
"aria-label": `Delete folder ${e.name}`,
|
|
3602
3588
|
title: "Delete folder",
|
|
3603
|
-
disabled:
|
|
3604
|
-
onClick: () =>
|
|
3605
|
-
children: /* @__PURE__ */
|
|
3589
|
+
disabled: he,
|
|
3590
|
+
onClick: () => Ie(e),
|
|
3591
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3606
3592
|
name: "trash",
|
|
3607
3593
|
size: 15
|
|
3608
3594
|
})
|
|
3609
3595
|
})] }, e.path))
|
|
3610
|
-
})] }),
|
|
3596
|
+
})] }), H.length > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3611
3597
|
className: "seed-fm-section-label",
|
|
3612
|
-
children: oe ? Zr(
|
|
3613
|
-
}), xe === "grid" ? /* @__PURE__ */
|
|
3614
|
-
entries:
|
|
3598
|
+
children: oe ? Zr(H.length, "result") : "Files"
|
|
3599
|
+
}), xe === "grid" ? /* @__PURE__ */ B(Or, {
|
|
3600
|
+
entries: H,
|
|
3615
3601
|
selected: N,
|
|
3616
|
-
onActivate:
|
|
3617
|
-
onToggle:
|
|
3602
|
+
onActivate: Oe,
|
|
3603
|
+
onToggle: Te,
|
|
3618
3604
|
className: h.grid,
|
|
3619
3605
|
tileClassName: h.tile
|
|
3620
|
-
}) : /* @__PURE__ */
|
|
3621
|
-
entries:
|
|
3606
|
+
}) : /* @__PURE__ */ B(kr, {
|
|
3607
|
+
entries: H,
|
|
3622
3608
|
selected: N,
|
|
3623
3609
|
cwd: j,
|
|
3624
|
-
onActivate:
|
|
3625
|
-
onToggle:
|
|
3626
|
-
onToggleAll:
|
|
3627
|
-
onDownload: (e) =>
|
|
3628
|
-
onDelete: (e) =>
|
|
3629
|
-
deleteActionFor: (e) =>
|
|
3610
|
+
onActivate: Oe,
|
|
3611
|
+
onToggle: Te,
|
|
3612
|
+
onToggleAll: ke,
|
|
3613
|
+
onDownload: (e) => je([e]),
|
|
3614
|
+
onDelete: (e) => Y([e]),
|
|
3615
|
+
deleteActionFor: (e) => Ne([e]),
|
|
3630
3616
|
className: h.list,
|
|
3631
3617
|
rowClassName: h.row
|
|
3632
|
-
})] })] }) : /* @__PURE__ */
|
|
3618
|
+
})] })] }) : /* @__PURE__ */ B("ul", {
|
|
3633
3619
|
className: w("grid", "seed-fm-grid"),
|
|
3634
3620
|
"aria-busy": "true",
|
|
3635
3621
|
"aria-label": "Loading files",
|
|
3636
|
-
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */
|
|
3622
|
+
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ B("li", {
|
|
3637
3623
|
className: "seed-fm-tile",
|
|
3638
|
-
children: /* @__PURE__ */
|
|
3624
|
+
children: /* @__PURE__ */ B("span", { className: "seed-fm-thumb seed-fm-skeleton" })
|
|
3639
3625
|
}, t))
|
|
3640
3626
|
});
|
|
3641
|
-
let
|
|
3642
|
-
return /* @__PURE__ */
|
|
3627
|
+
let Ge = I ? J(I, !0) : [], X = R ? Fe(R) : [], Ke = N.size > 0 ? Ne(Se) : null;
|
|
3628
|
+
return /* @__PURE__ */ V("div", {
|
|
3643
3629
|
className: [w("root", "seed-fm"), m].filter(Boolean).join(" "),
|
|
3644
3630
|
"data-seed-theme": p === "none" ? void 0 : p,
|
|
3645
3631
|
"data-selecting": N.size > 0 || void 0,
|
|
3646
|
-
onKeyDown:
|
|
3632
|
+
onKeyDown: Re,
|
|
3647
3633
|
children: [
|
|
3648
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ V("div", {
|
|
3649
3635
|
className: "seed-fm-frame",
|
|
3650
3636
|
children: [
|
|
3651
|
-
/* @__PURE__ */
|
|
3637
|
+
/* @__PURE__ */ V("header", {
|
|
3652
3638
|
className: w("header", "seed-fm-header"),
|
|
3653
3639
|
children: [
|
|
3654
|
-
/* @__PURE__ */
|
|
3640
|
+
/* @__PURE__ */ V("div", {
|
|
3655
3641
|
className: "seed-fm-titles",
|
|
3656
|
-
children: [/* @__PURE__ */
|
|
3642
|
+
children: [/* @__PURE__ */ B(He, {
|
|
3657
3643
|
className: "seed-fm-title",
|
|
3658
3644
|
children: u
|
|
3659
|
-
}), d && /* @__PURE__ */
|
|
3645
|
+
}), d && /* @__PURE__ */ B("p", {
|
|
3660
3646
|
className: "seed-fm-description",
|
|
3661
3647
|
children: d
|
|
3662
3648
|
})]
|
|
3663
3649
|
}),
|
|
3664
|
-
E && !te && /* @__PURE__ */
|
|
3650
|
+
E && !te && /* @__PURE__ */ B(ni, {
|
|
3665
3651
|
files: O,
|
|
3666
3652
|
estimate: k
|
|
3667
3653
|
}),
|
|
3668
|
-
/* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ B("button", {
|
|
3669
3655
|
type: "button",
|
|
3670
3656
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3671
3657
|
onClick: () => ne(),
|
|
3672
3658
|
"aria-label": "Refresh",
|
|
3673
3659
|
title: "Refresh",
|
|
3674
3660
|
"data-busy": ee && E,
|
|
3675
|
-
children: /* @__PURE__ */
|
|
3661
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3676
3662
|
name: "refresh",
|
|
3677
3663
|
size: 15
|
|
3678
3664
|
})
|
|
3679
3665
|
})
|
|
3680
3666
|
]
|
|
3681
3667
|
}),
|
|
3682
|
-
E && !te && ie.length > 0 && /* @__PURE__ */
|
|
3668
|
+
E && !te && ie.length > 0 && /* @__PURE__ */ V("div", {
|
|
3683
3669
|
className: w("toolbar", "seed-fm-toolbar"),
|
|
3684
3670
|
children: [
|
|
3685
|
-
/* @__PURE__ */
|
|
3671
|
+
/* @__PURE__ */ B("nav", {
|
|
3686
3672
|
"aria-label": "Folder",
|
|
3687
|
-
children: /* @__PURE__ */
|
|
3673
|
+
children: /* @__PURE__ */ B("ol", {
|
|
3688
3674
|
className: "seed-fm-crumbs",
|
|
3689
|
-
children:
|
|
3675
|
+
children: Ve.map((e, t) => /* @__PURE__ */ V("li", { children: [t > 0 && /* @__PURE__ */ B(Q, {
|
|
3690
3676
|
name: "chevronRight",
|
|
3691
3677
|
size: 14
|
|
3692
|
-
}), /* @__PURE__ */
|
|
3678
|
+
}), /* @__PURE__ */ B("button", {
|
|
3693
3679
|
type: "button",
|
|
3694
|
-
onClick: () =>
|
|
3695
|
-
"aria-current": t ===
|
|
3680
|
+
onClick: () => we(e.path),
|
|
3681
|
+
"aria-current": t === Ve.length - 1 ? "page" : void 0,
|
|
3696
3682
|
children: e.label
|
|
3697
3683
|
})] }, e.path || "/"))
|
|
3698
3684
|
})
|
|
3699
3685
|
}),
|
|
3700
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ V("label", {
|
|
3701
3687
|
className: "seed-fm-search",
|
|
3702
|
-
children: [/* @__PURE__ */
|
|
3688
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3703
3689
|
name: "search",
|
|
3704
3690
|
size: 14
|
|
3705
|
-
}), /* @__PURE__ */
|
|
3691
|
+
}), /* @__PURE__ */ B("input", {
|
|
3706
3692
|
type: "search",
|
|
3707
3693
|
value: oe,
|
|
3708
|
-
onChange: (e) =>
|
|
3694
|
+
onChange: (e) => se(e.target.value),
|
|
3709
3695
|
placeholder: "Search names and paths",
|
|
3710
3696
|
"aria-label": "Search files"
|
|
3711
3697
|
})]
|
|
3712
3698
|
}),
|
|
3713
|
-
/* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ V("select", {
|
|
3714
3700
|
className: "seed-fm-select",
|
|
3715
|
-
value:
|
|
3701
|
+
value: M,
|
|
3716
3702
|
onChange: (e) => ce(e.target.value),
|
|
3717
3703
|
"aria-label": "Sort by",
|
|
3718
3704
|
children: [
|
|
3719
|
-
/* @__PURE__ */
|
|
3705
|
+
/* @__PURE__ */ B("option", {
|
|
3720
3706
|
value: "name",
|
|
3721
3707
|
children: "Name"
|
|
3722
3708
|
}),
|
|
3723
|
-
/* @__PURE__ */
|
|
3709
|
+
/* @__PURE__ */ B("option", {
|
|
3724
3710
|
value: "modified",
|
|
3725
3711
|
children: "Recently modified"
|
|
3726
3712
|
}),
|
|
3727
|
-
/* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ B("option", {
|
|
3728
3714
|
value: "size",
|
|
3729
3715
|
children: "Largest"
|
|
3730
3716
|
})
|
|
3731
3717
|
]
|
|
3732
3718
|
}),
|
|
3733
|
-
/* @__PURE__ */
|
|
3719
|
+
/* @__PURE__ */ V("div", {
|
|
3734
3720
|
className: "seed-fm-viewtoggle",
|
|
3735
3721
|
role: "group",
|
|
3736
3722
|
"aria-label": "View",
|
|
3737
|
-
children: [/* @__PURE__ */
|
|
3723
|
+
children: [/* @__PURE__ */ B("button", {
|
|
3738
3724
|
type: "button",
|
|
3739
3725
|
"aria-pressed": xe === "grid",
|
|
3740
3726
|
"aria-label": "Grid view",
|
|
3741
3727
|
onClick: () => ue("grid"),
|
|
3742
|
-
children: /* @__PURE__ */
|
|
3728
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3743
3729
|
name: "layoutGrid",
|
|
3744
3730
|
size: 15
|
|
3745
3731
|
})
|
|
3746
|
-
}), /* @__PURE__ */
|
|
3732
|
+
}), /* @__PURE__ */ B("button", {
|
|
3747
3733
|
type: "button",
|
|
3748
3734
|
"aria-pressed": xe === "list",
|
|
3749
3735
|
"aria-label": "List view",
|
|
3750
3736
|
onClick: () => ue("list"),
|
|
3751
|
-
children: /* @__PURE__ */
|
|
3737
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3752
3738
|
name: "list",
|
|
3753
3739
|
size: 15
|
|
3754
3740
|
})
|
|
3755
3741
|
})]
|
|
3756
3742
|
}),
|
|
3757
|
-
|
|
3743
|
+
ze && Be && /* @__PURE__ */ V("p", {
|
|
3758
3744
|
className: "seed-fm-hint",
|
|
3759
3745
|
children: [
|
|
3760
|
-
/* @__PURE__ */
|
|
3746
|
+
/* @__PURE__ */ B(Q, {
|
|
3761
3747
|
name: "layers",
|
|
3762
3748
|
size: 13
|
|
3763
3749
|
}),
|
|
3764
3750
|
A ? "Resized copies are grouped with their original image." : "Resized copies are shown in their size folders.",
|
|
3765
|
-
/* @__PURE__ */
|
|
3751
|
+
/* @__PURE__ */ B("button", {
|
|
3766
3752
|
type: "button",
|
|
3767
3753
|
className: "seed-fm-linkbtn",
|
|
3768
3754
|
onClick: () => {
|
|
@@ -3774,31 +3760,31 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3774
3760
|
})
|
|
3775
3761
|
]
|
|
3776
3762
|
}),
|
|
3777
|
-
/* @__PURE__ */
|
|
3763
|
+
/* @__PURE__ */ B("div", {
|
|
3778
3764
|
className: w("body", "seed-fm-body"),
|
|
3779
|
-
children:
|
|
3765
|
+
children: We
|
|
3780
3766
|
}),
|
|
3781
|
-
|
|
3767
|
+
Ke && /* @__PURE__ */ V("div", {
|
|
3782
3768
|
className: w("batchBar", "seed-fm-batch"),
|
|
3783
3769
|
role: "toolbar",
|
|
3784
3770
|
"aria-label": "Selected files",
|
|
3785
3771
|
children: [
|
|
3786
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ V("span", {
|
|
3787
3773
|
className: "seed-fm-batch-count",
|
|
3788
3774
|
"aria-live": "polite",
|
|
3789
3775
|
children: [
|
|
3790
3776
|
N.size,
|
|
3791
3777
|
" selected ",
|
|
3792
|
-
/* @__PURE__ */
|
|
3778
|
+
/* @__PURE__ */ V("span", { children: ["· ", Z(Ue)] })
|
|
3793
3779
|
]
|
|
3794
3780
|
}),
|
|
3795
|
-
/* @__PURE__ */
|
|
3781
|
+
/* @__PURE__ */ V("button", {
|
|
3796
3782
|
type: "button",
|
|
3797
3783
|
className: "seed-fm-btn",
|
|
3798
|
-
disabled:
|
|
3799
|
-
onClick: () =>
|
|
3784
|
+
disabled: he,
|
|
3785
|
+
onClick: () => je(Se),
|
|
3800
3786
|
children: [
|
|
3801
|
-
/* @__PURE__ */
|
|
3787
|
+
/* @__PURE__ */ B(Q, {
|
|
3802
3788
|
name: "download",
|
|
3803
3789
|
size: 15
|
|
3804
3790
|
}),
|
|
@@ -3806,26 +3792,26 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3806
3792
|
N.size > 1 ? "Download .zip" : "Download"
|
|
3807
3793
|
]
|
|
3808
3794
|
}),
|
|
3809
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ V("button", {
|
|
3810
3796
|
type: "button",
|
|
3811
|
-
className: `seed-fm-btn${
|
|
3812
|
-
disabled:
|
|
3813
|
-
onClick: () =>
|
|
3797
|
+
className: `seed-fm-btn${Ke.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
3798
|
+
disabled: he,
|
|
3799
|
+
onClick: () => Y(Se),
|
|
3814
3800
|
children: [
|
|
3815
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ B(Q, {
|
|
3816
3802
|
name: "trash",
|
|
3817
3803
|
size: 15
|
|
3818
3804
|
}),
|
|
3819
3805
|
" ",
|
|
3820
|
-
|
|
3806
|
+
Ke.label ?? "Delete"
|
|
3821
3807
|
]
|
|
3822
3808
|
}),
|
|
3823
|
-
/* @__PURE__ */
|
|
3809
|
+
/* @__PURE__ */ B("button", {
|
|
3824
3810
|
type: "button",
|
|
3825
3811
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3826
3812
|
"aria-label": "Clear selection",
|
|
3827
3813
|
onClick: () => P(/* @__PURE__ */ new Set()),
|
|
3828
|
-
children: /* @__PURE__ */
|
|
3814
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3829
3815
|
name: "x",
|
|
3830
3816
|
size: 15
|
|
3831
3817
|
})
|
|
@@ -3834,49 +3820,49 @@ function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3834
3820
|
})
|
|
3835
3821
|
]
|
|
3836
3822
|
}),
|
|
3837
|
-
G && /* @__PURE__ */
|
|
3823
|
+
G && /* @__PURE__ */ B(Nr, {
|
|
3838
3824
|
entry: G,
|
|
3839
3825
|
className: h.panel,
|
|
3840
|
-
onClose:
|
|
3841
|
-
onPrevious:
|
|
3842
|
-
onNext:
|
|
3843
|
-
onDownload: () =>
|
|
3844
|
-
onDelete: () =>
|
|
3845
|
-
deleteAction:
|
|
3846
|
-
onCopyPath: () =>
|
|
3826
|
+
onClose: De,
|
|
3827
|
+
onPrevious: Ce > 0 ? () => F(H[Ce - 1].file.path) : null,
|
|
3828
|
+
onNext: Ce >= 0 && Ce < H.length - 1 ? () => F(H[Ce + 1].file.path) : null,
|
|
3829
|
+
onDownload: () => je([G]),
|
|
3830
|
+
onDelete: () => Y([G]),
|
|
3831
|
+
deleteAction: Ne([G]),
|
|
3832
|
+
onCopyPath: () => Le(G.file.path)
|
|
3847
3833
|
}, "panel"),
|
|
3848
|
-
|
|
3849
|
-
entries:
|
|
3834
|
+
I && /* @__PURE__ */ B(Kn, {
|
|
3835
|
+
entries: I,
|
|
3850
3836
|
rootPath: S,
|
|
3851
|
-
warning: v(
|
|
3852
|
-
deleteActionFor: (e) =>
|
|
3837
|
+
warning: v(Ge),
|
|
3838
|
+
deleteActionFor: (e) => Me(J(I, e)),
|
|
3853
3839
|
className: h.dialog,
|
|
3854
|
-
onCancel: () =>
|
|
3840
|
+
onCancel: () => L(null),
|
|
3855
3841
|
onConfirm: (e) => {
|
|
3856
|
-
let t =
|
|
3857
|
-
|
|
3842
|
+
let t = J(I, e);
|
|
3843
|
+
L(null), Pe(t);
|
|
3858
3844
|
}
|
|
3859
3845
|
}),
|
|
3860
|
-
|
|
3861
|
-
folder:
|
|
3862
|
-
files:
|
|
3863
|
-
hiddenCount: T.filter((e) => e.path.startsWith(`${
|
|
3864
|
-
warning: v(
|
|
3865
|
-
action:
|
|
3866
|
-
busy:
|
|
3846
|
+
R && /* @__PURE__ */ B(qn, {
|
|
3847
|
+
folder: R,
|
|
3848
|
+
files: X,
|
|
3849
|
+
hiddenCount: T.filter((e) => e.path.startsWith(`${R.path}/`)).length - X.length,
|
|
3850
|
+
warning: v(X),
|
|
3851
|
+
action: Me(X),
|
|
3852
|
+
busy: he,
|
|
3867
3853
|
className: h.dialog,
|
|
3868
|
-
onDownload: () =>
|
|
3869
|
-
onCancel: () =>
|
|
3854
|
+
onDownload: () => q(X, R),
|
|
3855
|
+
onCancel: () => me(null),
|
|
3870
3856
|
onConfirm: () => {
|
|
3871
|
-
|
|
3857
|
+
me(null), Pe(X, R);
|
|
3872
3858
|
}
|
|
3873
3859
|
}),
|
|
3874
|
-
!x && /* @__PURE__ */
|
|
3860
|
+
!x && /* @__PURE__ */ B("ul", {
|
|
3875
3861
|
className: "seed-fm-toasts",
|
|
3876
3862
|
"aria-live": "polite",
|
|
3877
|
-
children:
|
|
3863
|
+
children: _e.map((e) => /* @__PURE__ */ V("li", {
|
|
3878
3864
|
className: w("toast", `seed-fm-toast${e.tone === "error" ? " seed-fm-toast--error" : ""}`),
|
|
3879
|
-
children: [/* @__PURE__ */
|
|
3865
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3880
3866
|
name: e.tone === "error" ? "triangleAlert" : "check",
|
|
3881
3867
|
size: 15,
|
|
3882
3868
|
strokeWidth: 2.5
|
|
@@ -3896,7 +3882,7 @@ var ai = (e) => {
|
|
|
3896
3882
|
}
|
|
3897
3883
|
};
|
|
3898
3884
|
function oi(e) {
|
|
3899
|
-
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, u] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ = ai(t), v = o(() =>
|
|
3885
|
+
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, u] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ = ai(t), v = o(() => ue(_) ?? ue(r) ?? ue(m) ?? ue(g), [
|
|
3900
3886
|
_,
|
|
3901
3887
|
r,
|
|
3902
3888
|
m,
|
|
@@ -3964,7 +3950,7 @@ function oi(e) {
|
|
|
3964
3950
|
}
|
|
3965
3951
|
//#endregion
|
|
3966
3952
|
//#region src/SeedImage.tsx
|
|
3967
|
-
var si =
|
|
3953
|
+
var si = ve("seedSdk:react:SeedImage"), ci = /* @__PURE__ */ new Map(), li = (e) => {
|
|
3968
3954
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
3969
3955
|
return t && t[2] ? t[2] : e;
|
|
3970
3956
|
};
|
|
@@ -3976,7 +3962,7 @@ function di(e, t) {
|
|
|
3976
3962
|
return n.test(r);
|
|
3977
3963
|
}
|
|
3978
3964
|
var fi = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o }, s) => {
|
|
3979
|
-
let [l, u] = c(), [d, f] = c(), { property: m } =
|
|
3965
|
+
let [l, u] = c(), [d, f] = c(), { property: m } = at({
|
|
3980
3966
|
propertyName: t.propertyName,
|
|
3981
3967
|
seedLocalId: t.seedLocalId,
|
|
3982
3968
|
seedUid: t.seedUid
|
|
@@ -4053,7 +4039,7 @@ var fi = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4053
4039
|
let te = l || d || C || (ee(x) ? x : void 0) || (a && !E ? v : void 0) || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", { onError: D, ...ne } = o, O = (e) => {
|
|
4054
4040
|
v && te === v && y(), D?.(e);
|
|
4055
4041
|
};
|
|
4056
|
-
return /* @__PURE__ */
|
|
4042
|
+
return /* @__PURE__ */ B("img", {
|
|
4057
4043
|
src: te,
|
|
4058
4044
|
alt: o.alt || t.propertyName || "Image",
|
|
4059
4045
|
width: n,
|
|
@@ -4088,7 +4074,7 @@ function pi(e) {
|
|
|
4088
4074
|
error: null
|
|
4089
4075
|
});
|
|
4090
4076
|
try {
|
|
4091
|
-
let r = await
|
|
4077
|
+
let r = await I(String(t), { treatAs: a }), i = r.status === "ready" && r.source === "localBlob" ? r.href : void 0;
|
|
4092
4078
|
if (e) {
|
|
4093
4079
|
i && URL.revokeObjectURL(i);
|
|
4094
4080
|
return;
|
|
@@ -4146,7 +4132,7 @@ function mi({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
4146
4132
|
src: o,
|
|
4147
4133
|
alt: i ?? ""
|
|
4148
4134
|
};
|
|
4149
|
-
return r ? /* @__PURE__ */
|
|
4135
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("img", { ...s });
|
|
4150
4136
|
}
|
|
4151
4137
|
//#endregion
|
|
4152
4138
|
//#region src/SeedMediaFile.tsx
|
|
@@ -4180,7 +4166,7 @@ function _i({ value: e, enabled: t, treatAs: n, download: r, render: i, children
|
|
|
4180
4166
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
4181
4167
|
children: a ?? hi(l)
|
|
4182
4168
|
};
|
|
4183
|
-
return i ? /* @__PURE__ */
|
|
4169
|
+
return i ? /* @__PURE__ */ B(z, { children: i(f) }) : /* @__PURE__ */ B("a", { ...f });
|
|
4184
4170
|
}
|
|
4185
4171
|
//#endregion
|
|
4186
4172
|
//#region src/SeedMediaAudio.tsx
|
|
@@ -4196,7 +4182,7 @@ function vi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4196
4182
|
src: o,
|
|
4197
4183
|
controls: i
|
|
4198
4184
|
};
|
|
4199
|
-
return r ? /* @__PURE__ */
|
|
4185
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("audio", { ...s });
|
|
4200
4186
|
}
|
|
4201
4187
|
//#endregion
|
|
4202
4188
|
//#region src/SeedMediaVideo.tsx
|
|
@@ -4212,7 +4198,7 @@ function yi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4212
4198
|
src: o,
|
|
4213
4199
|
controls: i
|
|
4214
4200
|
};
|
|
4215
|
-
return r ? /* @__PURE__ */
|
|
4201
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("video", { ...s });
|
|
4216
4202
|
}
|
|
4217
4203
|
//#endregion
|
|
4218
4204
|
//#region src/SeedHtml.tsx
|
|
@@ -4222,7 +4208,7 @@ function bi(e) {
|
|
|
4222
4208
|
function xi({ html: e, sanitize: t, render: n, ...r }) {
|
|
4223
4209
|
if (!bi(e)) return null;
|
|
4224
4210
|
let i = t(e);
|
|
4225
|
-
return n ? /* @__PURE__ */
|
|
4211
|
+
return n ? /* @__PURE__ */ B(z, { children: n({ html: i }) }) : /* @__PURE__ */ B("div", {
|
|
4226
4212
|
...r,
|
|
4227
4213
|
dangerouslySetInnerHTML: { __html: i }
|
|
4228
4214
|
});
|
|
@@ -4279,7 +4265,7 @@ function Ti(e, t) {
|
|
|
4279
4265
|
//#region src/SeedJson.tsx
|
|
4280
4266
|
function Ei({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4281
4267
|
let a = t ? t(e) : Ti(e, n);
|
|
4282
|
-
return r ? /* @__PURE__ */
|
|
4268
|
+
return r ? /* @__PURE__ */ B(z, { children: r({ text: a }) }) : /* @__PURE__ */ B("pre", {
|
|
4283
4269
|
...i,
|
|
4284
4270
|
children: a
|
|
4285
4271
|
});
|
|
@@ -4287,9 +4273,9 @@ function Ei({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
|
4287
4273
|
//#endregion
|
|
4288
4274
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4289
4275
|
function Di(e, t) {
|
|
4290
|
-
return o(() => e ?
|
|
4276
|
+
return o(() => e ? N(e, t) : {}, [e, t]);
|
|
4291
4277
|
}
|
|
4292
4278
|
//#endregion
|
|
4293
|
-
export {
|
|
4279
|
+
export { je as ADDRESSES_PERSISTED_EVENT, an as FILES_QUERY_KEY_PREFIX, J as LOCAL_COPIES_REMOVED_EVENT, ii as OPFSFilesManager, Rr as OPFS_FILES_MANAGER_CSS, bn as SeedClientGate, xi as SeedHtml, fi as SeedImage, Ei as SeedJson, vi as SeedMediaAudio, _i as SeedMediaFile, mi as SeedMediaImage, yi as SeedMediaVideo, _n as SeedProvider, He as createSeedQueryClient, Ti as formatSeedJson, it as getItemPropertyQueryKey, qe as getItemQueryKey, St as getPercentComplete, Be as getSeedQueryDefaultOptions, vt as getServiceName, bt as getServiceUniqueKey, yt as getServiceValue, mn as invalidateItemPropertiesForItem, mt as isDbReadyState, Ve as mergeSeedQueryDefaults, zt as useAllSchemaVersions, K as useClientSelector, Ae as useClientService, Qe as useCreateItem, dt as useCreateItemProperty, Wt as useCreateModel, $t as useCreateModelProperty, Lt as useCreateSchema, ht as useDbsAreReady, ot as useDebouncedItemProperty, tn as useDeleteItem, ft as useDestroyItemProperty, Gt as useDestroyModel, en as useDestroyModelProperty, Rt as useDestroySchema, fn as useEasSyncProcessById, un as useEasSyncProcesses, dn as useEasSyncProcessesNonActiveCount, ln as useEasSyncProcessesState, oi as useEnsureLocalImage, on as useFiles, kt as useGlobalServiceStatus, Et as useHasSavedSnapshots, rn as useImageFiles, q as useIsClientReady, wt as useIsDbReady, Je as useItem, ut as useItemProperties, at as useItemProperty, Ze as useItems, Y as useLiveQuery, Re as useLiveQueryState, Ut as useModel, qt as useModelProperties, Qt as useModelProperty, Ht as useModels, Di as useNormalizedFeedItemFields, Fn as useOPFSFiles, Tt as usePersistedSnapshots, $e as usePublishItem, pi as useResolvedMediaRef, Nt as useSchema, It as useSchemas, Ne as useSeedAddressRevision, Bt as useSeedProtocolSchema, Ct as useService, Ot as useServices, Br as useStorageEstimate, Cr as useThumbnail };
|
|
4294
4280
|
|
|
4295
4281
|
//# sourceMappingURL=index.js.map
|