@seedprotocol/react 0.7.9-next.1110.g7eb9e57 → 0.7.9-next.1189.g5e63267
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/SeedImage.d.ts.map +1 -1
- package/dist/index.js +966 -954
- package/dist/index.js.map +1 -1
- package/dist/item.d.ts.map +1 -1
- package/dist/useFiles.d.ts +1 -1
- package/dist/useFiles.d.ts.map +1 -1
- package/dist/useImageFiles.d.ts +1 -1
- package/dist/useImageFiles.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
|
5
|
-
import { debounce as
|
|
6
|
-
import
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { QueryClient as _e, QueryClientContext as ve, QueryClientProvider as ye, useQuery as
|
|
9
|
-
import { and as
|
|
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, isValidEasAttestationUid as ae, loadAllSchemasFromDb as oe, metadata as M, modelSchemas as se, models as ce, normalizeArweaveTxIdForEnsure as le, normalizeFeedItemFields as ue, ownedSeedsSql as N, pickLatestMetadataRowPerProperty as P, placeholderUidSql as de, properties as F, publisherInAddressListSql as I, resolveMediaRef as fe, schemas as L, seeds as R, watchEntityRows as z } from "@seedprotocol/sdk";
|
|
5
|
+
import { debounce as pe, orderBy as me, startCase as he } from "lodash-es";
|
|
6
|
+
import ge from "debug";
|
|
7
|
+
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
8
|
+
import { QueryClient as _e, QueryClientContext as ve, QueryClientProvider as ye, useQuery as U, useQueryClient as be } from "@tanstack/react-query";
|
|
9
|
+
import { and as xe, desc as Se, eq as W, gt as G, isNotNull as K, isNull as Ce, or as q } from "drizzle-orm";
|
|
10
10
|
import we from "pluralize";
|
|
11
11
|
//#region src/client.ts
|
|
12
|
-
var Te = (e) =>
|
|
12
|
+
var Te = (e) => k().subscribeService(e), Ee = () => k().getService(), De = () => l(Te, Ee, Ee);
|
|
13
13
|
function Oe(e) {
|
|
14
14
|
let t = De(), r = s(e);
|
|
15
15
|
r.current = e;
|
|
@@ -18,18 +18,18 @@ function Oe(e) {
|
|
|
18
18
|
next: e,
|
|
19
19
|
error: e,
|
|
20
20
|
complete: e
|
|
21
|
-
}), r =
|
|
21
|
+
}), r = k().subscribeService(e);
|
|
22
22
|
return () => {
|
|
23
23
|
n.unsubscribe(), r();
|
|
24
24
|
};
|
|
25
25
|
}, [t]), a = () => r.current(t.getSnapshot());
|
|
26
26
|
return l(i, a, a);
|
|
27
27
|
}
|
|
28
|
-
var ke = (e) => e.status === "active" && e.value === m.IDLE,
|
|
29
|
-
function
|
|
30
|
-
return r(
|
|
28
|
+
var ke = (e) => e.status === "active" && e.value === m.IDLE, J = () => Oe(ke), Ae = "addresses.persisted", Y = "localCopies.removed", je = t(0);
|
|
29
|
+
function Me() {
|
|
30
|
+
return r(je);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Ne({ 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 Pe({ queryClient: e, children: t }) {
|
|
|
42
42
|
exact: !1
|
|
43
43
|
}), a((e) => e + 1);
|
|
44
44
|
}, [e]);
|
|
45
|
-
return i(() => (
|
|
46
|
-
|
|
47
|
-
}), [o]), /* @__PURE__ */
|
|
45
|
+
return i(() => (D.on(Ae, o), D.on(Y, o), () => {
|
|
46
|
+
D.off(Ae, o), D.off(Y, o);
|
|
47
|
+
}), [o]), /* @__PURE__ */ V(je.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 X(e) {
|
|
55
|
+
return Le(e).data;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Pe(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 Fe(e) {
|
|
|
63
63
|
}
|
|
64
64
|
return e;
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var Fe = [
|
|
67
67
|
500,
|
|
68
68
|
1e3,
|
|
69
69
|
2e3,
|
|
70
70
|
5e3,
|
|
71
71
|
1e4,
|
|
72
72
|
3e4
|
|
73
|
-
],
|
|
74
|
-
function
|
|
73
|
+
], Ie = (e) => e instanceof Error ? e : Error(String(e));
|
|
74
|
+
function Le(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 = J(), l = Pe(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 Re(e) {
|
|
|
92
92
|
let r, i = (e) => {
|
|
93
93
|
n((t) => ({
|
|
94
94
|
data: t.data,
|
|
95
|
-
error:
|
|
95
|
+
error: Ie(e)
|
|
96
96
|
}));
|
|
97
|
-
let t =
|
|
97
|
+
let t = Fe[Math.min(d.current, Fe.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 Re(e) {
|
|
|
121
121
|
}
|
|
122
122
|
//#endregion
|
|
123
123
|
//#region src/queryClient.ts
|
|
124
|
-
var
|
|
124
|
+
var Re = { queries: {
|
|
125
125
|
networkMode: "offlineFirst",
|
|
126
126
|
gcTime: 864e5,
|
|
127
127
|
staleTime: 6e4
|
|
128
128
|
} };
|
|
129
|
-
function
|
|
130
|
-
return { ...
|
|
129
|
+
function ze() {
|
|
130
|
+
return { ...Re };
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
let t =
|
|
132
|
+
function Be(e) {
|
|
133
|
+
let t = ze();
|
|
134
134
|
return e ? {
|
|
135
135
|
queries: {
|
|
136
136
|
...t.queries,
|
|
@@ -142,33 +142,33 @@ function Ve(e) {
|
|
|
142
142
|
}
|
|
143
143
|
} : t;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
let t =
|
|
145
|
+
function Ve(e) {
|
|
146
|
+
let t = ze(), { defaultOptions: n, ...r } = e ?? {};
|
|
147
147
|
return new _e({
|
|
148
148
|
...r,
|
|
149
|
-
defaultOptions: n ?
|
|
149
|
+
defaultOptions: n ? Be(n) : t
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var He, Ue = !1, We = () => {
|
|
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(ve) || (!
|
|
159
|
+
function Z() {
|
|
160
|
+
return r(ve) || (!Ue && We() && (Ue = !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.")), He ?? (He = Ve()), He);
|
|
161
161
|
}
|
|
162
162
|
//#endregion
|
|
163
163
|
//#region src/item.ts
|
|
164
|
-
var
|
|
164
|
+
var Ge = ge("seedSdk:react:item"), Ke = (e) => [
|
|
165
165
|
"seed",
|
|
166
166
|
"item",
|
|
167
167
|
e ?? null
|
|
168
168
|
], qe = ({ 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 =
|
|
169
|
+
let r = t || n, [, a] = c(0), [, l] = c(0), [u, d] = c(!1), [f, p] = c(null), m = s(!1), g = J(), v = Z(), y = o(() => Ke(r), [r]), b = s(y);
|
|
170
170
|
b.current = y;
|
|
171
|
-
let x =
|
|
171
|
+
let x = U({
|
|
172
172
|
queryKey: y,
|
|
173
173
|
queryFn: async () => {
|
|
174
174
|
let i = _.peekReady(r) ?? await _.find({
|
|
@@ -177,7 +177,7 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
177
177
|
seedUid: n
|
|
178
178
|
});
|
|
179
179
|
if (i) return i;
|
|
180
|
-
|
|
180
|
+
Ge("[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
|
},
|
|
@@ -192,8 +192,8 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
192
192
|
let e = () => {
|
|
193
193
|
a((e) => e + 1), v.invalidateQueries({ queryKey: b.current });
|
|
194
194
|
};
|
|
195
|
-
return
|
|
196
|
-
|
|
195
|
+
return D.on(h, e), () => {
|
|
196
|
+
D.off(h, e);
|
|
197
197
|
};
|
|
198
198
|
}, [v]), i(() => {
|
|
199
199
|
if (m.current = !1, d(!1), p(null), !S) return;
|
|
@@ -228,7 +228,18 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
228
228
|
isLoading: !!r && x.isPending || u,
|
|
229
229
|
error: f ?? x.error
|
|
230
230
|
};
|
|
231
|
-
}, Je = (e
|
|
231
|
+
}, Je = (e) => {
|
|
232
|
+
let t = /* @__PURE__ */ new Map(), n = [];
|
|
233
|
+
for (let r of e ?? []) {
|
|
234
|
+
if (!r.localId) continue;
|
|
235
|
+
let e = ae(r.uid) ? r.uid.toLowerCase() : "", i = r.lastVersionPublishedAt || r.attestationCreatedAt || r.createdAt;
|
|
236
|
+
i && t.set(r.localId, i), n.push(`${r.localId}:${e}:${i ?? ""}`);
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
signature: n.sort().join(","),
|
|
240
|
+
sortTimes: t
|
|
241
|
+
};
|
|
242
|
+
}, Ye = (e, t, n, r, i, a, o) => [
|
|
232
243
|
"seed",
|
|
233
244
|
"items",
|
|
234
245
|
e ?? null,
|
|
@@ -240,14 +251,14 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
240
251
|
modelFileId: a ?? null,
|
|
241
252
|
schemaName: o ?? null
|
|
242
253
|
}] : []
|
|
243
|
-
],
|
|
244
|
-
let u =
|
|
254
|
+
], Xe = ({ modelName: e, modelFileId: t, schemaName: n, deleted: r = !1, includeEas: a = !1, addressFilter: l }) => {
|
|
255
|
+
let u = J(), d = Me(), p = be();
|
|
245
256
|
i(() => {
|
|
246
257
|
let e = () => {
|
|
247
258
|
p.invalidateQueries({ queryKey: ["seed", "items"] });
|
|
248
259
|
};
|
|
249
|
-
return
|
|
250
|
-
|
|
260
|
+
return D.on(h, e), () => {
|
|
261
|
+
D.off(h, e);
|
|
251
262
|
};
|
|
252
263
|
}, [p]);
|
|
253
264
|
let m = s([]), g = s(/* @__PURE__ */ new Set()), v = s(0), y = s(0), [b, x] = c(null);
|
|
@@ -257,13 +268,13 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
257
268
|
return;
|
|
258
269
|
}
|
|
259
270
|
let e = !1;
|
|
260
|
-
return
|
|
271
|
+
return ne(l).then((t) => {
|
|
261
272
|
e || x(t);
|
|
262
273
|
}), () => {
|
|
263
274
|
e = !0;
|
|
264
275
|
};
|
|
265
276
|
}, [l, d]);
|
|
266
|
-
let S = o(() =>
|
|
277
|
+
let S = o(() => Ye(e, r, a, l, d, t, n), [
|
|
267
278
|
e,
|
|
268
279
|
r,
|
|
269
280
|
a,
|
|
@@ -275,7 +286,7 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
275
286
|
i(() => {
|
|
276
287
|
g.current = /* @__PURE__ */ new Set();
|
|
277
288
|
}, [S]);
|
|
278
|
-
let { data: C = [], isLoading: w, isFetching: T, dataUpdatedAt: E, error:
|
|
289
|
+
let { data: C = [], isLoading: w, isFetching: T, dataUpdatedAt: E, error: te } = U({
|
|
279
290
|
queryKey: S,
|
|
280
291
|
queryFn: async ({ signal: i }) => (v.current++, await _.all(e, r, {
|
|
281
292
|
waitForReady: !0,
|
|
@@ -289,33 +300,36 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
289
300
|
staleTime: 0
|
|
290
301
|
});
|
|
291
302
|
m.current = C;
|
|
292
|
-
let
|
|
293
|
-
if (!
|
|
303
|
+
let O = u ? f.getAppDb() : null, k = X(o(() => {
|
|
304
|
+
if (!O || (l === "owned" || l === "watched") && b === null) return null;
|
|
294
305
|
let t = [];
|
|
295
|
-
a || t.push(
|
|
296
|
-
let n =
|
|
297
|
-
return
|
|
298
|
-
localId:
|
|
299
|
-
uid:
|
|
300
|
-
type:
|
|
301
|
-
schemaUid:
|
|
302
|
-
createdAt:
|
|
303
|
-
attestationCreatedAt:
|
|
304
|
-
|
|
305
|
-
|
|
306
|
+
a || t.push(de(R.uid)), e && t.push(W(R.type, ee(e))), l === "owned" ? t.push(N(b ?? [])) : l === "watched" && t.push(I(R.publisher, b ?? [])), r ? t.push(W(R._markedForDeletion, 1)) : (t.push(q(Ce(R._markedForDeletion), W(R._markedForDeletion, 0))), t.push(q(Ce(R.revokedAt), W(R.revokedAt, 0))));
|
|
307
|
+
let n = ie();
|
|
308
|
+
return O.with(n).select({
|
|
309
|
+
localId: R.localId,
|
|
310
|
+
uid: R.uid,
|
|
311
|
+
type: R.type,
|
|
312
|
+
schemaUid: R.schemaUid,
|
|
313
|
+
createdAt: R.createdAt,
|
|
314
|
+
attestationCreatedAt: R.attestationCreatedAt,
|
|
315
|
+
lastVersionPublishedAt: n.lastVersionPublishedAt,
|
|
316
|
+
_markedForDeletion: R._markedForDeletion
|
|
317
|
+
}).from(R).leftJoin(n, W(R.localId, n.seedLocalId)).where(xe(G(n.versionsCount, 0), ...t)).groupBy(R.localId);
|
|
306
318
|
}, [
|
|
307
|
-
|
|
319
|
+
O,
|
|
308
320
|
u,
|
|
309
321
|
e,
|
|
310
322
|
r,
|
|
311
323
|
a,
|
|
312
324
|
l,
|
|
313
325
|
b
|
|
314
|
-
]));
|
|
326
|
+
])), A = s(Je(void 0)), re = Je(k);
|
|
327
|
+
re.signature !== A.current.signature && (A.current = re);
|
|
328
|
+
let j = A.current;
|
|
315
329
|
return i(() => {
|
|
316
|
-
if (!u || !
|
|
330
|
+
if (!u || !k) return;
|
|
317
331
|
let e = /* @__PURE__ */ new Set();
|
|
318
|
-
for (let t of
|
|
332
|
+
for (let t of k) {
|
|
319
333
|
let n = t.localId || t.uid;
|
|
320
334
|
n && e.add(n);
|
|
321
335
|
}
|
|
@@ -324,24 +338,24 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
324
338
|
let n = e.seedLocalId || e.seedUid;
|
|
325
339
|
n && t.add(n);
|
|
326
340
|
}
|
|
327
|
-
e.size === 0 && t.size > 0 || (
|
|
341
|
+
e.size === 0 && t.size > 0 || ($e(t, e) ? g.current = e : $e(g.current, e) && (v.current > y.current || T) || (g.current = e, y.current = v.current, p.invalidateQueries({ queryKey: S })));
|
|
328
342
|
}, [
|
|
329
343
|
u,
|
|
330
|
-
|
|
344
|
+
k,
|
|
331
345
|
p,
|
|
332
346
|
S,
|
|
333
347
|
E,
|
|
334
348
|
T
|
|
335
349
|
]), {
|
|
336
|
-
items: o(() =>
|
|
350
|
+
items: o(() => me(C, [(e) => e.seedLocalId && j.sortTimes.get(e.seedLocalId) || e.lastVersionPublishedAt || e.attestationCreatedAt || e.createdAt], ["desc"]), [C, j]),
|
|
337
351
|
isLoading: w || !u,
|
|
338
|
-
error:
|
|
352
|
+
error: te
|
|
339
353
|
};
|
|
340
|
-
},
|
|
354
|
+
}, Ze = () => {
|
|
341
355
|
let [e, t] = c(!1), [r, i] = c(null), a = s(null), o = n(() => i(null), []);
|
|
342
356
|
return {
|
|
343
357
|
createItem: n((e, n, r) => {
|
|
344
|
-
if (a.current) return
|
|
358
|
+
if (a.current) return Ge("[useCreateItem] [createItem] already creating item, returning the in-flight create"), a.current;
|
|
345
359
|
i(null), u(() => t(!0));
|
|
346
360
|
let o = (async () => {
|
|
347
361
|
try {
|
|
@@ -351,7 +365,7 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
351
365
|
...t
|
|
352
366
|
}, r) ?? void 0;
|
|
353
367
|
} catch (e) {
|
|
354
|
-
|
|
368
|
+
Ge("[useCreateItem] Error creating item:", e), i(e instanceof Error ? e : Error(String(e)));
|
|
355
369
|
return;
|
|
356
370
|
} finally {
|
|
357
371
|
a.current = null, queueMicrotask(() => t(!1));
|
|
@@ -363,7 +377,7 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
363
377
|
error: r,
|
|
364
378
|
resetError: o
|
|
365
379
|
};
|
|
366
|
-
},
|
|
380
|
+
}, Qe = () => {
|
|
367
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) => {
|
|
368
382
|
e && (t(e), l(null), e.publish(n).catch((e) => {
|
|
369
383
|
l(e instanceof Error ? e : Error(String(e)));
|
|
@@ -388,16 +402,16 @@ var X = R("seedSdk:react:item"), Ke = (e) => [
|
|
|
388
402
|
resetError: d
|
|
389
403
|
};
|
|
390
404
|
};
|
|
391
|
-
function
|
|
405
|
+
function $e(e, t) {
|
|
392
406
|
return e.size === t.size && [...e].every((e) => t.has(e));
|
|
393
407
|
}
|
|
394
408
|
//#endregion
|
|
395
409
|
//#region src/entityRows.ts
|
|
396
|
-
function
|
|
397
|
-
let n =
|
|
410
|
+
function et(e, t) {
|
|
411
|
+
let n = J() && j(), r = Le(n ? null : t), [a, o] = c({
|
|
398
412
|
data: void 0,
|
|
399
413
|
error: null
|
|
400
|
-
}), l = e && t ? `${JSON.stringify(e)}|${String(
|
|
414
|
+
}), l = e && t ? `${JSON.stringify(e)}|${String(Pe(t))}` : null, u = s({
|
|
401
415
|
watch: e,
|
|
402
416
|
query: t
|
|
403
417
|
});
|
|
@@ -411,14 +425,14 @@ function $e(e, t) {
|
|
|
411
425
|
});
|
|
412
426
|
let { watch: e, query: t } = u.current;
|
|
413
427
|
if (!n || !l || !e || !t) return;
|
|
414
|
-
let r =
|
|
428
|
+
let r = z(e, () => t.all(), (e) => o({
|
|
415
429
|
data: [...e],
|
|
416
430
|
error: null
|
|
417
431
|
}), {
|
|
418
432
|
immediate: !0,
|
|
419
433
|
onError: (e) => o((t) => ({
|
|
420
434
|
data: t.data,
|
|
421
|
-
error:
|
|
435
|
+
error: Ie(e)
|
|
422
436
|
}))
|
|
423
437
|
});
|
|
424
438
|
return () => r.unsubscribe();
|
|
@@ -426,15 +440,15 @@ function $e(e, t) {
|
|
|
426
440
|
}
|
|
427
441
|
//#endregion
|
|
428
442
|
//#region src/itemProperty.ts
|
|
429
|
-
var
|
|
443
|
+
var tt = ge("seedSdk:react:property"), nt = ge("seedSdk:react:itemProperties"), rt = (e, t, n) => [
|
|
430
444
|
"seed",
|
|
431
445
|
"itemProperty",
|
|
432
446
|
e ?? null,
|
|
433
447
|
t ?? null,
|
|
434
448
|
n
|
|
435
449
|
];
|
|
436
|
-
function
|
|
437
|
-
let n =
|
|
450
|
+
function it(e, t) {
|
|
451
|
+
let n = J(), r = Z(), [, 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(() => {
|
|
438
452
|
let e = p !== void 0 && p !== "" ? p : u, t = p !== void 0 && p !== "" ? void 0 : d;
|
|
439
453
|
return (e || t) && m ? {
|
|
440
454
|
type: "identifiers",
|
|
@@ -448,7 +462,7 @@ function rt(e, t) {
|
|
|
448
462
|
m,
|
|
449
463
|
u,
|
|
450
464
|
d
|
|
451
|
-
]), g = o(() =>
|
|
465
|
+
]), g = o(() => rt(h?.seedLocalId, h?.seedUid, h?.propertyName ?? ""), [h]), _ = U({
|
|
452
466
|
queryKey: g,
|
|
453
467
|
queryFn: async () => {
|
|
454
468
|
if (!h) return null;
|
|
@@ -462,7 +476,7 @@ function rt(e, t) {
|
|
|
462
476
|
seedUid: h.itemId,
|
|
463
477
|
hold: !1
|
|
464
478
|
}) : void 0, n = e ?? t;
|
|
465
|
-
return n ||
|
|
479
|
+
return n || tt(`[useItemProperty] no property found for Item.${h.seedLocalId || h.seedUid}.${h.propertyName}`), n ?? null;
|
|
466
480
|
},
|
|
467
481
|
initialData: () => h ? v.peekReady(h) : void 0,
|
|
468
482
|
staleTime: 0,
|
|
@@ -471,7 +485,7 @@ function rt(e, t) {
|
|
|
471
485
|
retry: !1,
|
|
472
486
|
enabled: n && !!h
|
|
473
487
|
}, r), y = _.data ?? void 0;
|
|
474
|
-
return
|
|
488
|
+
return st(o(() => y ? [y] : [], [y])), i(() => {
|
|
475
489
|
if (!y) return;
|
|
476
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) => {
|
|
477
491
|
let a = t?.context ?? {};
|
|
@@ -498,8 +512,8 @@ function rt(e, t) {
|
|
|
498
512
|
error: _.error
|
|
499
513
|
};
|
|
500
514
|
}
|
|
501
|
-
function
|
|
502
|
-
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 at(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 } = it(o(() => r ? {
|
|
503
517
|
itemId: r,
|
|
504
518
|
propertyName: l
|
|
505
519
|
} : {
|
|
@@ -511,7 +525,7 @@ function it(e, t = 300) {
|
|
|
511
525
|
a,
|
|
512
526
|
c,
|
|
513
527
|
l
|
|
514
|
-
])), p = s(""), m =
|
|
528
|
+
])), p = s(""), m = ot(u), h = o(() => pe((e) => {
|
|
515
529
|
e.setValue(p.current);
|
|
516
530
|
}, t), [t]);
|
|
517
531
|
i(() => () => h.flush(), [h]);
|
|
@@ -526,7 +540,7 @@ function it(e, t = 300) {
|
|
|
526
540
|
error: f ?? m
|
|
527
541
|
};
|
|
528
542
|
}
|
|
529
|
-
function
|
|
543
|
+
function ot(e) {
|
|
530
544
|
let [t, n] = c(null);
|
|
531
545
|
return i(() => {
|
|
532
546
|
if (!e) {
|
|
@@ -546,7 +560,7 @@ function at(e) {
|
|
|
546
560
|
return () => a.unsubscribe();
|
|
547
561
|
}, [e]), t;
|
|
548
562
|
}
|
|
549
|
-
function
|
|
563
|
+
function st(e) {
|
|
550
564
|
i(() => {
|
|
551
565
|
let t = e.filter((e) => v.retain(e));
|
|
552
566
|
return () => {
|
|
@@ -556,7 +570,7 @@ function ot(e) {
|
|
|
556
570
|
};
|
|
557
571
|
}, [e]);
|
|
558
572
|
}
|
|
559
|
-
async function
|
|
573
|
+
async function ct(e, t) {
|
|
560
574
|
if (!e && !t) return [];
|
|
561
575
|
let n = f.getAppDb();
|
|
562
576
|
if (!n) return [];
|
|
@@ -571,19 +585,19 @@ async function st(e, t) {
|
|
|
571
585
|
let o;
|
|
572
586
|
if (r.length > 0) {
|
|
573
587
|
let e = r[0];
|
|
574
|
-
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o =
|
|
588
|
+
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o = he(o));
|
|
575
589
|
}
|
|
576
590
|
let s = await n.select({
|
|
577
|
-
type:
|
|
578
|
-
modelFileId:
|
|
579
|
-
}).from(
|
|
580
|
-
!o && s.length > 0 && s[0].type && (o =
|
|
591
|
+
type: R.type,
|
|
592
|
+
modelFileId: R.modelFileId
|
|
593
|
+
}).from(R).where(t ? W(R.uid, t) : W(R.localId, e)).limit(1), c = s[0]?.modelFileId ?? void 0;
|
|
594
|
+
!o && s.length > 0 && s[0].type && (o = he(s[0].type));
|
|
581
595
|
let l = [];
|
|
582
596
|
if (o) try {
|
|
583
597
|
let { Model: e } = await import("@seedprotocol/sdk"), t = await e.resolveAsync(o, { modelFileId: c });
|
|
584
598
|
if (t?.properties) for (let e of t.properties) e.name && l.push(e.name);
|
|
585
599
|
} catch (e) {
|
|
586
|
-
|
|
600
|
+
nt(`[useItemProperties] Error getting ModelProperties for ${o}:`, e);
|
|
587
601
|
}
|
|
588
602
|
if (o && l.length > 0) {
|
|
589
603
|
let n = r.length > 0 ? r[0].seedLocalId ?? e : e, s = r.length > 0 ? r[0].seedUid ?? t : t;
|
|
@@ -600,11 +614,11 @@ async function st(e, t) {
|
|
|
600
614
|
});
|
|
601
615
|
t && i.push(t);
|
|
602
616
|
} catch (t) {
|
|
603
|
-
|
|
617
|
+
tt(`[useItemProperties] Error creating ItemProperty for missing property ${e}:`, t);
|
|
604
618
|
}
|
|
605
619
|
}
|
|
606
620
|
if (e || t) {
|
|
607
|
-
let a = await n.select({ createdAt:
|
|
621
|
+
let a = await n.select({ createdAt: R.createdAt }).from(R).where(t ? W(R.uid, t) : W(R.localId, e)).limit(1);
|
|
608
622
|
if (a.length > 0 && a[0].createdAt) {
|
|
609
623
|
let n = "createdAt";
|
|
610
624
|
if (!i.some((e) => e.propertyName === n) && o) try {
|
|
@@ -620,14 +634,14 @@ async function st(e, t) {
|
|
|
620
634
|
});
|
|
621
635
|
l && i.push(l);
|
|
622
636
|
} catch (e) {
|
|
623
|
-
|
|
637
|
+
tt("[useItemProperties] Error creating createdAt ItemProperty:", e);
|
|
624
638
|
}
|
|
625
639
|
}
|
|
626
640
|
}
|
|
627
641
|
return i;
|
|
628
642
|
}
|
|
629
|
-
function
|
|
630
|
-
let t =
|
|
643
|
+
function lt(e) {
|
|
644
|
+
let t = J(), n = be(), r = s(void 0), a = o(() => typeof e == "string" ? {
|
|
631
645
|
type: "itemId",
|
|
632
646
|
itemId: e
|
|
633
647
|
} : typeof e == "object" ? {
|
|
@@ -642,53 +656,53 @@ function ct(e) {
|
|
|
642
656
|
"seed",
|
|
643
657
|
"itemProperties",
|
|
644
658
|
u
|
|
645
|
-
], [u]), { data: p = [], isLoading: m, error: h } =
|
|
659
|
+
], [u]), { data: p = [], isLoading: m, error: h } = U({
|
|
646
660
|
queryKey: d,
|
|
647
|
-
queryFn: () =>
|
|
661
|
+
queryFn: () => ct(c, l),
|
|
648
662
|
enabled: t && !!u,
|
|
649
663
|
gcTime: 0
|
|
650
664
|
});
|
|
651
|
-
|
|
665
|
+
st(p);
|
|
652
666
|
let g = o(() => {
|
|
653
|
-
if (!t || !c && !l) return
|
|
667
|
+
if (!t || !c && !l) return nt("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
654
668
|
let e = f.getAppDb();
|
|
655
|
-
if (!e) return
|
|
656
|
-
|
|
669
|
+
if (!e) return nt("[useItemProperties] Query: returning null (no db)"), null;
|
|
670
|
+
nt(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${l}`);
|
|
657
671
|
let n = l ? e.select({
|
|
658
|
-
propertyName:
|
|
659
|
-
propertyValue:
|
|
660
|
-
seedLocalId:
|
|
661
|
-
seedUid:
|
|
662
|
-
modelType:
|
|
663
|
-
schemaUid:
|
|
664
|
-
createdAt:
|
|
665
|
-
attestationCreatedAt:
|
|
666
|
-
localId:
|
|
667
|
-
revokedAt:
|
|
668
|
-
}).from(
|
|
669
|
-
propertyName:
|
|
670
|
-
propertyValue:
|
|
671
|
-
seedLocalId:
|
|
672
|
-
seedUid:
|
|
673
|
-
modelType:
|
|
674
|
-
schemaUid:
|
|
675
|
-
createdAt:
|
|
676
|
-
attestationCreatedAt:
|
|
677
|
-
localId:
|
|
678
|
-
revokedAt:
|
|
679
|
-
}).from(
|
|
680
|
-
return
|
|
672
|
+
propertyName: M.propertyName,
|
|
673
|
+
propertyValue: M.propertyValue,
|
|
674
|
+
seedLocalId: M.seedLocalId,
|
|
675
|
+
seedUid: M.seedUid,
|
|
676
|
+
modelType: M.modelType,
|
|
677
|
+
schemaUid: M.schemaUid,
|
|
678
|
+
createdAt: M.createdAt,
|
|
679
|
+
attestationCreatedAt: M.attestationCreatedAt,
|
|
680
|
+
localId: M.localId,
|
|
681
|
+
revokedAt: M.revokedAt
|
|
682
|
+
}).from(M).where(xe(W(M.seedUid, l), K(M.propertyName))) : c ? e.select({
|
|
683
|
+
propertyName: M.propertyName,
|
|
684
|
+
propertyValue: M.propertyValue,
|
|
685
|
+
seedLocalId: M.seedLocalId,
|
|
686
|
+
seedUid: M.seedUid,
|
|
687
|
+
modelType: M.modelType,
|
|
688
|
+
schemaUid: M.schemaUid,
|
|
689
|
+
createdAt: M.createdAt,
|
|
690
|
+
attestationCreatedAt: M.attestationCreatedAt,
|
|
691
|
+
localId: M.localId,
|
|
692
|
+
revokedAt: M.revokedAt
|
|
693
|
+
}).from(M).where(xe(W(M.seedLocalId, c), K(M.propertyName))) : null;
|
|
694
|
+
return nt("[useItemProperties] Query: created query object", { queryType: l ? "seedUid" : "seedLocalId" }), n;
|
|
681
695
|
}, [
|
|
682
696
|
t,
|
|
683
697
|
c,
|
|
684
698
|
l
|
|
685
|
-
]), _ =
|
|
699
|
+
]), _ = et(o(() => l ? {
|
|
686
700
|
seedUid: l,
|
|
687
701
|
tables: ["metadata"]
|
|
688
702
|
} : c ? {
|
|
689
703
|
seedLocalId: c,
|
|
690
704
|
tables: ["metadata"]
|
|
691
|
-
} : null, [c, l]), g).data, v = o(() => !_ || _.length === 0 ? [] :
|
|
705
|
+
} : null, [c, l]), g).data, v = o(() => !_ || _.length === 0 ? [] : P(_), [_]);
|
|
692
706
|
return i(() => {
|
|
693
707
|
if (!t || !c && !l || v === void 0) return;
|
|
694
708
|
let e = JSON.stringify(v.map((e) => ({
|
|
@@ -714,7 +728,7 @@ function ct(e) {
|
|
|
714
728
|
error: h
|
|
715
729
|
};
|
|
716
730
|
}
|
|
717
|
-
var
|
|
731
|
+
var ut = () => {
|
|
718
732
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
719
733
|
if (!t.propertyName || !t.seedLocalId && !t.seedUid || !t.modelName) {
|
|
720
734
|
o(/* @__PURE__ */ Error("seedLocalId or seedUid, propertyName, and modelName are required"));
|
|
@@ -743,7 +757,7 @@ var lt = () => {
|
|
|
743
757
|
error: a,
|
|
744
758
|
resetError: l
|
|
745
759
|
};
|
|
746
|
-
},
|
|
760
|
+
}, dt = () => {
|
|
747
761
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
748
762
|
return {
|
|
749
763
|
destroy: n(async (e) => {
|
|
@@ -762,25 +776,25 @@ var lt = () => {
|
|
|
762
776
|
error: r,
|
|
763
777
|
resetError: n(() => i(null), [])
|
|
764
778
|
};
|
|
765
|
-
},
|
|
779
|
+
}, ft = /* @__PURE__ */ new Set([
|
|
766
780
|
m.SAVE_CONFIG,
|
|
767
781
|
m.PROCESS_SCHEMA_FILES,
|
|
768
782
|
m.ADD_MODELS_TO_STORE,
|
|
769
783
|
m.ADD_MODELS_TO_DB,
|
|
770
784
|
m.IDLE
|
|
771
|
-
]),
|
|
785
|
+
]), pt = (e) => typeof e == "string" && ft.has(e), mt = () => ({ dbsAreReady: Oe((e) => e.status === "active" && pt(e.value)) }), ht = ge("seedSdk:react:services"), gt = [
|
|
772
786
|
"idle",
|
|
773
787
|
"ready",
|
|
774
788
|
"done",
|
|
775
789
|
"success",
|
|
776
790
|
"initialized"
|
|
777
|
-
],
|
|
791
|
+
], _t = (e) => {
|
|
778
792
|
let t = "actor", n = e;
|
|
779
|
-
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t =
|
|
780
|
-
}, _t = (e) => {
|
|
781
|
-
let t;
|
|
782
|
-
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), gt(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;
|
|
793
|
+
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t = yt(e)), t;
|
|
783
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;
|
|
797
|
+
}, yt = (e) => {
|
|
784
798
|
let t = e;
|
|
785
799
|
if (!e || !t.logic || !t.logic.config || !t._snapshot) return;
|
|
786
800
|
let n = t.logic.config;
|
|
@@ -791,23 +805,23 @@ var lt = () => {
|
|
|
791
805
|
try {
|
|
792
806
|
i = e.getSnapshot();
|
|
793
807
|
} catch (e) {
|
|
794
|
-
return
|
|
808
|
+
return ht("Error:", e), r;
|
|
795
809
|
}
|
|
796
810
|
if (i) {
|
|
797
811
|
let e = i.context;
|
|
798
812
|
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r = we(e.modelName.toLowerCase()));
|
|
799
813
|
}
|
|
800
814
|
return r;
|
|
801
|
-
},
|
|
815
|
+
}, bt = (e) => e?.logic?.config?.id === b.CLIENT_MANAGER, xt = (e) => {
|
|
802
816
|
let t = e?.getSnapshot();
|
|
803
|
-
if (
|
|
804
|
-
let n =
|
|
805
|
-
if (n &&
|
|
817
|
+
if (bt(e)) return t?.status === "active" ? Et(t.value) : 0;
|
|
818
|
+
let n = vt(e);
|
|
819
|
+
if (n && gt.includes(n)) return 100;
|
|
806
820
|
let r = e?.logic?.states;
|
|
807
821
|
if (!n || !r) return 0;
|
|
808
822
|
let i = Object.entries(r).filter(([, e]) => e.tags?.includes("loading")).map(([e]) => e), a = i.indexOf(n);
|
|
809
823
|
return a < 0 ? 0 : a / i.length * 100;
|
|
810
|
-
},
|
|
824
|
+
}, St = (e) => {
|
|
811
825
|
let [t, r] = c(0), a = n((t) => {
|
|
812
826
|
let n = e.subscribe({
|
|
813
827
|
next: t,
|
|
@@ -815,7 +829,7 @@ var lt = () => {
|
|
|
815
829
|
complete: t
|
|
816
830
|
});
|
|
817
831
|
return () => n.unsubscribe();
|
|
818
|
-
}, [e]), o = () =>
|
|
832
|
+
}, [e]), o = () => vt(e), s = l(a, o, o), u = n((t) => {
|
|
819
833
|
let n = e.getSnapshot().value;
|
|
820
834
|
n === "done" || n === "success" || n === "idle" || n === "ready" ? clearInterval(t) : r((e) => e + 1);
|
|
821
835
|
}, [e]), d = n(() => {
|
|
@@ -828,16 +842,16 @@ var lt = () => {
|
|
|
828
842
|
let e = d();
|
|
829
843
|
return () => clearInterval(e);
|
|
830
844
|
}, []), {
|
|
831
|
-
name:
|
|
845
|
+
name: _t(e),
|
|
832
846
|
timeElapsed: t,
|
|
833
847
|
value: s,
|
|
834
|
-
percentComplete:
|
|
835
|
-
uniqueKey:
|
|
848
|
+
percentComplete: xt(e),
|
|
849
|
+
uniqueKey: yt(e)
|
|
836
850
|
};
|
|
837
|
-
},
|
|
838
|
-
let { internalStatus: e } =
|
|
851
|
+
}, Ct = () => {
|
|
852
|
+
let { internalStatus: e } = Ot();
|
|
839
853
|
return e === "ready";
|
|
840
|
-
},
|
|
854
|
+
}, wt = () => {}, Tt = () => !1, Et = (e) => {
|
|
841
855
|
switch (e) {
|
|
842
856
|
case m.IDLE: return 100;
|
|
843
857
|
case m.ADD_MODELS_TO_DB: return 90;
|
|
@@ -849,17 +863,17 @@ var lt = () => {
|
|
|
849
863
|
case m.PLATFORM_CLASSES_INIT: return 10;
|
|
850
864
|
default: return 0;
|
|
851
865
|
}
|
|
852
|
-
},
|
|
853
|
-
let e = De(), t = Oe((e) => e.status === "active" ?
|
|
866
|
+
}, Dt = () => {
|
|
867
|
+
let e = De(), t = Oe((e) => e.status === "active" ? Et(e.value) : 0);
|
|
854
868
|
return {
|
|
855
869
|
services: o(() => (e.uniqueKey = "clientManager", [e]), [e]),
|
|
856
870
|
percentComplete: t
|
|
857
871
|
};
|
|
858
|
-
},
|
|
872
|
+
}, Ot = () => ({
|
|
859
873
|
status: Oe((e) => e.value),
|
|
860
|
-
internalStatus: Oe((e) => e.status === "active" &&
|
|
861
|
-
}),
|
|
862
|
-
function
|
|
874
|
+
internalStatus: Oe((e) => e.status === "active" && pt(e.value) ? "ready" : e.value)
|
|
875
|
+
}), kt = (e) => e instanceof Error ? e : Error(String(e));
|
|
876
|
+
function At(e) {
|
|
863
877
|
let t = s(null), r = s(0), [a, o] = c(!1), [l, u] = c(null), d = n(() => u(null), []), f = n((n) => {
|
|
864
878
|
let r = (t) => {
|
|
865
879
|
if (t.value === "error") {
|
|
@@ -869,7 +883,7 @@ function kt(e) {
|
|
|
869
883
|
}, i = n.getService();
|
|
870
884
|
t.current = i.subscribe(r), r(i.getSnapshot());
|
|
871
885
|
}, [e]), p = n((e) => {
|
|
872
|
-
throw u(
|
|
886
|
+
throw u(kt(e)), o(!1), e;
|
|
873
887
|
}, []), m = n(() => (t.current?.unsubscribe(), t.current = null, u(null), o(!0), ++r.current), []), h = n((e) => {
|
|
874
888
|
m();
|
|
875
889
|
let t;
|
|
@@ -909,11 +923,11 @@ function kt(e) {
|
|
|
909
923
|
}
|
|
910
924
|
//#endregion
|
|
911
925
|
//#region src/schema.ts
|
|
912
|
-
var
|
|
913
|
-
let [t, r] = c(null), [a, o] = c(!!e), [s, l] = c(null), d =
|
|
926
|
+
var jt = ge("seedSdk:react:schema"), Mt = (e) => {
|
|
927
|
+
let [t, r] = c(null), [a, o] = c(!!e), [s, l] = c(null), d = J(), f = n(async (e, t) => {
|
|
914
928
|
o(!0), l(null);
|
|
915
929
|
try {
|
|
916
|
-
if (!await
|
|
930
|
+
if (!await Nt(e)) {
|
|
917
931
|
if (!t.current) return;
|
|
918
932
|
r(null), o(!1);
|
|
919
933
|
return;
|
|
@@ -930,7 +944,7 @@ var At = R("seedSdk:react:schema"), jt = (e) => {
|
|
|
930
944
|
};
|
|
931
945
|
a(i.getSnapshot()), t.subscription = i.subscribe(a);
|
|
932
946
|
} catch (e) {
|
|
933
|
-
if (
|
|
947
|
+
if (jt("[useSchema] Error creating schema:", e), !t.current) return;
|
|
934
948
|
l(e), r(null), o(!1);
|
|
935
949
|
}
|
|
936
950
|
}, []);
|
|
@@ -957,23 +971,23 @@ var At = R("seedSdk:react:schema"), jt = (e) => {
|
|
|
957
971
|
error: s
|
|
958
972
|
};
|
|
959
973
|
};
|
|
960
|
-
async function
|
|
974
|
+
async function Nt(e) {
|
|
961
975
|
if (e === C) return !0;
|
|
962
976
|
let t = f.getAppDb();
|
|
963
|
-
return !t || (await t.select({ id:
|
|
977
|
+
return !t || (await t.select({ id: L.id }).from(L).where(q(W(L.name, e), W(L.schemaFileId, e))).limit(1)).length > 0;
|
|
964
978
|
}
|
|
965
|
-
var
|
|
966
|
-
let e =
|
|
967
|
-
queryKey:
|
|
979
|
+
var Pt = ["seed", "schemas"], Ft = () => {
|
|
980
|
+
let e = J(), t = Z(), n = s(void 0), r = s([]), { data: a = [], isLoading: c, error: l } = U({
|
|
981
|
+
queryKey: Pt,
|
|
968
982
|
queryFn: () => w.all({ waitForReady: !0 }),
|
|
969
983
|
enabled: e
|
|
970
984
|
}, t);
|
|
971
985
|
r.current = a;
|
|
972
|
-
let u = e ? f.getAppDb() : null, d =
|
|
986
|
+
let u = e ? f.getAppDb() : null, d = X(o(() => u ? u.select().from(L).orderBy(L.name, Se(L.version)) : null, [u, e]));
|
|
973
987
|
return i(() => {
|
|
974
988
|
if (typeof BroadcastChannel > "u") return;
|
|
975
989
|
let e = new BroadcastChannel("seed-schemas-invalidate"), n = () => {
|
|
976
|
-
t.invalidateQueries({ queryKey:
|
|
990
|
+
t.invalidateQueries({ queryKey: Pt });
|
|
977
991
|
};
|
|
978
992
|
return e.addEventListener("message", n), () => {
|
|
979
993
|
e.removeEventListener("message", n), e.close();
|
|
@@ -996,7 +1010,7 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
996
1010
|
let o = /* @__PURE__ */ new Set();
|
|
997
1011
|
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}`));
|
|
998
1012
|
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));
|
|
999
|
-
!s && (c || l) && t.invalidateQueries({ queryKey:
|
|
1013
|
+
!s && (c || l) && t.invalidateQueries({ queryKey: Pt });
|
|
1000
1014
|
}, [
|
|
1001
1015
|
e,
|
|
1002
1016
|
d,
|
|
@@ -1006,15 +1020,15 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1006
1020
|
isLoading: c,
|
|
1007
1021
|
error: l
|
|
1008
1022
|
};
|
|
1009
|
-
},
|
|
1010
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
1023
|
+
}, It = () => {
|
|
1024
|
+
let { run: e, isLoading: t, error: r, resetError: i } = At("Failed to create schema");
|
|
1011
1025
|
return {
|
|
1012
1026
|
createSchema: n((t) => e(() => w.create(t, { waitForReady: !1 })), [e]),
|
|
1013
1027
|
isLoading: t,
|
|
1014
1028
|
error: r,
|
|
1015
1029
|
resetError: i
|
|
1016
1030
|
};
|
|
1017
|
-
},
|
|
1031
|
+
}, Lt = () => {
|
|
1018
1032
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1019
1033
|
return {
|
|
1020
1034
|
destroy: n(async (e) => {
|
|
@@ -1033,10 +1047,10 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1033
1047
|
error: r,
|
|
1034
1048
|
resetError: n(() => i(null), [])
|
|
1035
1049
|
};
|
|
1036
|
-
},
|
|
1037
|
-
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a =
|
|
1050
|
+
}, Rt = () => {
|
|
1051
|
+
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a = J(), o = n(async () => {
|
|
1038
1052
|
if (a) try {
|
|
1039
|
-
let e = await
|
|
1053
|
+
let e = await oe(), n = /* @__PURE__ */ new Set();
|
|
1040
1054
|
for (let t of e) {
|
|
1041
1055
|
let e = t.schema.metadata?.name;
|
|
1042
1056
|
e && n.add(e);
|
|
@@ -1052,7 +1066,7 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1052
1066
|
for (let [e, t] of r.current.entries()) n.has(e) || t.unload();
|
|
1053
1067
|
r.current = i, t(Array.from(i.values()));
|
|
1054
1068
|
} catch (e) {
|
|
1055
|
-
|
|
1069
|
+
jt("Error fetching all schema versions from database:", e), t(null);
|
|
1056
1070
|
}
|
|
1057
1071
|
}, [a]);
|
|
1058
1072
|
return i(() => {
|
|
@@ -1062,12 +1076,12 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1062
1076
|
e.unload();
|
|
1063
1077
|
}), r.current.clear();
|
|
1064
1078
|
}, []), e;
|
|
1065
|
-
},
|
|
1079
|
+
}, zt = () => Mt(C), Bt = (e) => [
|
|
1066
1080
|
"seed",
|
|
1067
1081
|
"models",
|
|
1068
1082
|
e
|
|
1069
|
-
],
|
|
1070
|
-
let t =
|
|
1083
|
+
], Vt = (e) => {
|
|
1084
|
+
let t = J(), n = Z(), r = s(null), a = o(() => Bt(e), [e]), { data: c = [], isLoading: l, error: u } = U({
|
|
1071
1085
|
queryKey: a,
|
|
1072
1086
|
queryFn: async () => {
|
|
1073
1087
|
let t = await x.all(e, { waitForReady: !1 }), i = n.getQueryData(a), o = r.current;
|
|
@@ -1093,11 +1107,11 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1093
1107
|
function g() {
|
|
1094
1108
|
let t = f.getAppDb();
|
|
1095
1109
|
return !t || !e ? null : t.select({
|
|
1096
|
-
modelFileId:
|
|
1097
|
-
modelName:
|
|
1098
|
-
}).from(
|
|
1110
|
+
modelFileId: ce.schemaFileId,
|
|
1111
|
+
modelName: ce.name
|
|
1112
|
+
}).from(L).innerJoin(se, W(L.id, se.schemaId)).innerJoin(ce, W(se.modelId, ce.id)).where(q(W(L.schemaFileId, e), W(L.name, e)));
|
|
1099
1113
|
}
|
|
1100
|
-
let _ =
|
|
1114
|
+
let _ = X(o(() => {
|
|
1101
1115
|
if (!e || !t) return null;
|
|
1102
1116
|
let n = {
|
|
1103
1117
|
schemaId: e,
|
|
@@ -1128,8 +1142,8 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1128
1142
|
isLoading: l,
|
|
1129
1143
|
error: u
|
|
1130
1144
|
};
|
|
1131
|
-
},
|
|
1132
|
-
let n =
|
|
1145
|
+
}, Ht = (e, t) => {
|
|
1146
|
+
let n = J(), [r, a] = c(void 0), [l, u] = c(!1), [d, f] = c(null), p = s(void 0), [, m] = c(0), h = t == null;
|
|
1133
1147
|
i(() => {
|
|
1134
1148
|
!n || !h || !e ? (a(void 0), u(!1), f(null)) : (async () => {
|
|
1135
1149
|
try {
|
|
@@ -1145,7 +1159,7 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1145
1159
|
h,
|
|
1146
1160
|
e
|
|
1147
1161
|
]);
|
|
1148
|
-
let { models: g, isLoading: _, error: v } =
|
|
1162
|
+
let { models: g, isLoading: _, error: v } = Vt(h ? null : e), y = o(() => {
|
|
1149
1163
|
if (!h && t) return g.find((e) => (e.modelName ?? e.name) === t);
|
|
1150
1164
|
}, [
|
|
1151
1165
|
h,
|
|
@@ -1167,8 +1181,8 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1167
1181
|
isLoading: _,
|
|
1168
1182
|
error: v
|
|
1169
1183
|
};
|
|
1170
|
-
},
|
|
1171
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
1184
|
+
}, Ut = () => {
|
|
1185
|
+
let { run: e, isLoading: t, error: r, resetError: i } = At("Failed to create model");
|
|
1172
1186
|
return {
|
|
1173
1187
|
create: n((t, n, r) => e(() => x.create(n, t, {
|
|
1174
1188
|
...r,
|
|
@@ -1178,7 +1192,7 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1178
1192
|
error: r,
|
|
1179
1193
|
resetError: i
|
|
1180
1194
|
};
|
|
1181
|
-
},
|
|
1195
|
+
}, Wt = () => {
|
|
1182
1196
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1183
1197
|
return {
|
|
1184
1198
|
destroy: n(async (e) => {
|
|
@@ -1200,29 +1214,29 @@ var Nt = ["seed", "schemas"], Pt = () => {
|
|
|
1200
1214
|
};
|
|
1201
1215
|
//#endregion
|
|
1202
1216
|
//#region src/modelProperty.ts
|
|
1203
|
-
async function
|
|
1217
|
+
async function Gt(e) {
|
|
1204
1218
|
let t = f.getAppDb();
|
|
1205
1219
|
if (t) {
|
|
1206
|
-
let n = await t.select({ name:
|
|
1220
|
+
let n = await t.select({ name: L.name }).from(L).where(q(W(L.name, e), W(L.schemaFileId, e))).limit(1);
|
|
1207
1221
|
if (n[0]?.name) return n[0].name;
|
|
1208
1222
|
}
|
|
1209
|
-
return
|
|
1223
|
+
return re(e) ?? e;
|
|
1210
1224
|
}
|
|
1211
|
-
var
|
|
1212
|
-
let { model: n } =
|
|
1225
|
+
var Kt = (e, t) => {
|
|
1226
|
+
let { model: n } = Ht(e, t), r = J(), a = Z(), c = Yt(n), l = n?.id, u = o(() => [
|
|
1213
1227
|
"seed",
|
|
1214
1228
|
"modelProperties",
|
|
1215
1229
|
l ?? ""
|
|
1216
|
-
], [l]), { data: d = [], isLoading: p, error: m } =
|
|
1230
|
+
], [l]), { data: d = [], isLoading: p, error: m } = U({
|
|
1217
1231
|
queryKey: u,
|
|
1218
1232
|
queryFn: () => S.all(l, { waitForReady: !0 }),
|
|
1219
1233
|
enabled: r && !!l
|
|
1220
|
-
}, a), h = r ? f.getAppDb() : null, g =
|
|
1221
|
-
id:
|
|
1222
|
-
name:
|
|
1223
|
-
dataType:
|
|
1224
|
-
schemaFileId:
|
|
1225
|
-
}).from(
|
|
1234
|
+
}, a), h = r ? f.getAppDb() : null, g = X(o(() => !h || !c ? null : h.select({
|
|
1235
|
+
id: F.id,
|
|
1236
|
+
name: F.name,
|
|
1237
|
+
dataType: F.dataType,
|
|
1238
|
+
schemaFileId: F.schemaFileId
|
|
1239
|
+
}).from(F).where(W(F.modelId, c)), [
|
|
1226
1240
|
h,
|
|
1227
1241
|
r,
|
|
1228
1242
|
c
|
|
@@ -1263,39 +1277,39 @@ var Gt = (e, t) => {
|
|
|
1263
1277
|
isLoading: p && d.length === 0,
|
|
1264
1278
|
error: m
|
|
1265
1279
|
};
|
|
1266
|
-
},
|
|
1280
|
+
}, qt = [
|
|
1267
1281
|
400,
|
|
1268
1282
|
1200,
|
|
1269
1283
|
2500
|
|
1270
|
-
],
|
|
1284
|
+
], Jt = (e) => {
|
|
1271
1285
|
if (e) try {
|
|
1272
1286
|
return e._getSnapshotContext()._dbId;
|
|
1273
1287
|
} catch {
|
|
1274
1288
|
return;
|
|
1275
1289
|
}
|
|
1276
|
-
},
|
|
1277
|
-
let [t, n] = c(() =>
|
|
1290
|
+
}, Yt = (e) => {
|
|
1291
|
+
let [t, n] = c(() => Jt(e));
|
|
1278
1292
|
return i(() => {
|
|
1279
|
-
if (n(
|
|
1280
|
-
let t = e.getService().subscribe(() => n(
|
|
1293
|
+
if (n(Jt(e)), !e) return;
|
|
1294
|
+
let t = e.getService().subscribe(() => n(Jt(e)));
|
|
1281
1295
|
return () => t.unsubscribe();
|
|
1282
1296
|
}, [e]), t;
|
|
1283
|
-
},
|
|
1297
|
+
}, Xt = async (e, t) => {
|
|
1284
1298
|
let n = await x.createById(e, { hold: !1 });
|
|
1285
1299
|
if (!n) return;
|
|
1286
1300
|
let r = n.modelName ?? n.name;
|
|
1287
|
-
if (r) return
|
|
1301
|
+
if (r) return A(r, t, {
|
|
1288
1302
|
modelFileId: e,
|
|
1289
1303
|
schemaName: n.schemaName
|
|
1290
1304
|
});
|
|
1291
1305
|
};
|
|
1292
|
-
function
|
|
1306
|
+
function Zt(...e) {
|
|
1293
1307
|
let [t, r, a] = e, l = Math.min(e.length, 3), d = o(() => l === 3 ? !!(t && r && a) : l === 2 ? !!(t && r) : !!t, [
|
|
1294
1308
|
l,
|
|
1295
1309
|
t,
|
|
1296
1310
|
r,
|
|
1297
1311
|
a
|
|
1298
|
-
]), [f, p] = c(void 0), [m, h] = c(d), [g, _] = c(null), v = s(void 0), y =
|
|
1312
|
+
]), [f, p] = c(void 0), [m, h] = c(d), [g, _] = c(null), v = s(void 0), y = J(), b = o(() => l === 3 ? {
|
|
1299
1313
|
type: "schemaId",
|
|
1300
1314
|
schemaId: t,
|
|
1301
1315
|
modelName: r,
|
|
@@ -1333,7 +1347,7 @@ function Xt(...e) {
|
|
|
1333
1347
|
p(void 0), h(!1), _(null);
|
|
1334
1348
|
return;
|
|
1335
1349
|
}
|
|
1336
|
-
t = await
|
|
1350
|
+
t = await Xt(b.modelFileId, b.propertyName);
|
|
1337
1351
|
let e = await x.createById(b.modelFileId, { hold: !1 });
|
|
1338
1352
|
n = e?.modelName ?? e?.name;
|
|
1339
1353
|
} else {
|
|
@@ -1341,8 +1355,8 @@ function Xt(...e) {
|
|
|
1341
1355
|
p(void 0), h(!1), _(null);
|
|
1342
1356
|
return;
|
|
1343
1357
|
}
|
|
1344
|
-
let e = await
|
|
1345
|
-
t = await
|
|
1358
|
+
let e = await Gt(b.schemaId);
|
|
1359
|
+
t = await A(b.modelName, b.propertyName, { schemaName: e }), n = b.modelName;
|
|
1346
1360
|
}
|
|
1347
1361
|
if (t && n) {
|
|
1348
1362
|
let e = S.create({
|
|
@@ -1371,7 +1385,7 @@ function Xt(...e) {
|
|
|
1371
1385
|
let T = s(!1);
|
|
1372
1386
|
T.current = m || !!f || !!g, i(() => {
|
|
1373
1387
|
if (!C || b.type === "propertyFileId") return;
|
|
1374
|
-
let e =
|
|
1388
|
+
let e = qt.map((e) => setTimeout(() => {
|
|
1375
1389
|
T.current || w({ quiet: !0 });
|
|
1376
1390
|
}, e));
|
|
1377
1391
|
return () => e.forEach((e) => clearTimeout(e));
|
|
@@ -1384,7 +1398,7 @@ function Xt(...e) {
|
|
|
1384
1398
|
return i(() => {
|
|
1385
1399
|
if (!f || !ee) return;
|
|
1386
1400
|
v.current?.unsubscribe();
|
|
1387
|
-
let e =
|
|
1401
|
+
let e = pe(w, 100), t = f.getService().subscribe(() => {
|
|
1388
1402
|
e();
|
|
1389
1403
|
});
|
|
1390
1404
|
return v.current = t, () => {
|
|
@@ -1400,12 +1414,12 @@ function Xt(...e) {
|
|
|
1400
1414
|
error: g
|
|
1401
1415
|
};
|
|
1402
1416
|
}
|
|
1403
|
-
var
|
|
1404
|
-
let { runAsync: e, isLoading: t, error: r, resetError: i } =
|
|
1417
|
+
var Qt = () => {
|
|
1418
|
+
let { runAsync: e, isLoading: t, error: r, resetError: i } = At("Failed to create model property");
|
|
1405
1419
|
return {
|
|
1406
1420
|
create: n((t, n, r) => e(async () => {
|
|
1407
1421
|
if (!n || !r.name || !r.dataType) throw Error("modelName, property name and dataType are required");
|
|
1408
|
-
let e = await
|
|
1422
|
+
let e = await Gt(t);
|
|
1409
1423
|
return S.create({
|
|
1410
1424
|
...r,
|
|
1411
1425
|
modelName: n
|
|
@@ -1418,7 +1432,7 @@ var Zt = () => {
|
|
|
1418
1432
|
error: r,
|
|
1419
1433
|
resetError: i
|
|
1420
1434
|
};
|
|
1421
|
-
},
|
|
1435
|
+
}, $t = () => {
|
|
1422
1436
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1423
1437
|
return {
|
|
1424
1438
|
destroy: n(async (e) => {
|
|
@@ -1437,7 +1451,7 @@ var Zt = () => {
|
|
|
1437
1451
|
error: r,
|
|
1438
1452
|
resetError: n(() => i(null), [])
|
|
1439
1453
|
};
|
|
1440
|
-
},
|
|
1454
|
+
}, en = () => {
|
|
1441
1455
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1442
1456
|
return {
|
|
1443
1457
|
deleteItem: n(async (e) => {
|
|
@@ -1456,23 +1470,21 @@ var Zt = () => {
|
|
|
1456
1470
|
error: r,
|
|
1457
1471
|
resetError: n(() => i(null), [])
|
|
1458
1472
|
};
|
|
1459
|
-
},
|
|
1460
|
-
function
|
|
1461
|
-
let e =
|
|
1462
|
-
queryKey:
|
|
1473
|
+
}, tn = ["seed", "imageFiles"];
|
|
1474
|
+
function nn() {
|
|
1475
|
+
let e = J(), t = Z(), { data: n = [], isLoading: r, error: a, refetch: o } = U({
|
|
1476
|
+
queryKey: tn,
|
|
1463
1477
|
queryFn: () => p.listImageFiles(),
|
|
1464
1478
|
enabled: e
|
|
1465
1479
|
}, t);
|
|
1466
1480
|
return i(() => {
|
|
1467
1481
|
let e = (e) => {
|
|
1468
|
-
e.includes("/images/") && t.invalidateQueries({ queryKey:
|
|
1469
|
-
}, n = () => {
|
|
1470
|
-
t.invalidateQueries({ queryKey:
|
|
1471
|
-
}, r = (e) => {
|
|
1472
|
-
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey: en });
|
|
1482
|
+
e.includes("/images/") && t.invalidateQueries({ queryKey: tn });
|
|
1483
|
+
}, n = (e) => {
|
|
1484
|
+
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey: tn });
|
|
1473
1485
|
};
|
|
1474
|
-
return
|
|
1475
|
-
|
|
1486
|
+
return D.on("file-saved", e), D.on(g, n), () => {
|
|
1487
|
+
D.off("file-saved", e), D.off(g, n);
|
|
1476
1488
|
};
|
|
1477
1489
|
}, [t]), {
|
|
1478
1490
|
imageFiles: n,
|
|
@@ -1483,9 +1495,9 @@ function tn() {
|
|
|
1483
1495
|
}
|
|
1484
1496
|
//#endregion
|
|
1485
1497
|
//#region src/useFiles.ts
|
|
1486
|
-
var
|
|
1487
|
-
function
|
|
1488
|
-
let t =
|
|
1498
|
+
var rn = ["seed", "files"];
|
|
1499
|
+
function an(e = "files") {
|
|
1500
|
+
let t = J(), n = Z(), r = o(() => [...rn, e], [e]), { data: a = [], isLoading: s, error: c, refetch: l } = U({
|
|
1489
1501
|
queryKey: r,
|
|
1490
1502
|
queryFn: () => p.listFiles(e),
|
|
1491
1503
|
enabled: t
|
|
@@ -1493,13 +1505,11 @@ function rn(e = "files") {
|
|
|
1493
1505
|
return i(() => {
|
|
1494
1506
|
let t = (t) => {
|
|
1495
1507
|
t.includes(`/${e}/`) && n.invalidateQueries({ queryKey: r });
|
|
1496
|
-
}, i = () => {
|
|
1497
|
-
n.invalidateQueries({ queryKey: r });
|
|
1498
|
-
}, a = (t) => {
|
|
1508
|
+
}, i = (t) => {
|
|
1499
1509
|
t.some((t) => t.includes(`/${e}/`)) && n.invalidateQueries({ queryKey: r });
|
|
1500
1510
|
};
|
|
1501
|
-
return
|
|
1502
|
-
|
|
1511
|
+
return D.on("file-saved", t), D.on(g, i), () => {
|
|
1512
|
+
D.off("file-saved", t), D.off(g, i);
|
|
1503
1513
|
};
|
|
1504
1514
|
}, [
|
|
1505
1515
|
n,
|
|
@@ -1514,28 +1524,28 @@ function rn(e = "files") {
|
|
|
1514
1524
|
}
|
|
1515
1525
|
//#endregion
|
|
1516
1526
|
//#region src/useEasSyncProcesses.ts
|
|
1517
|
-
function an() {
|
|
1518
|
-
return q() ? f.getAppDb() : null;
|
|
1519
|
-
}
|
|
1520
1527
|
function on() {
|
|
1521
|
-
|
|
1522
|
-
return o(() => e ? e.select().from(E).orderBy(xe(E.startedAt)) : null, [e]);
|
|
1528
|
+
return J() ? f.getAppDb() : null;
|
|
1523
1529
|
}
|
|
1524
1530
|
function sn() {
|
|
1525
|
-
let e =
|
|
1531
|
+
let e = on();
|
|
1532
|
+
return o(() => e ? e.select().from(E).orderBy(Se(E.startedAt)) : null, [e]);
|
|
1533
|
+
}
|
|
1534
|
+
function cn() {
|
|
1535
|
+
let e = X(sn());
|
|
1526
1536
|
return {
|
|
1527
1537
|
records: e,
|
|
1528
1538
|
nonActiveCount: o(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
|
|
1529
1539
|
};
|
|
1530
1540
|
}
|
|
1531
|
-
function cn() {
|
|
1532
|
-
return J(on());
|
|
1533
|
-
}
|
|
1534
1541
|
function ln() {
|
|
1535
|
-
return sn()
|
|
1542
|
+
return X(sn());
|
|
1536
1543
|
}
|
|
1537
|
-
function un(
|
|
1538
|
-
|
|
1544
|
+
function un() {
|
|
1545
|
+
return cn().nonActiveCount;
|
|
1546
|
+
}
|
|
1547
|
+
function dn(e) {
|
|
1548
|
+
let t = on(), n = X(o(() => e != null && t ? t.select().from(E).where(W(E.id, e)).limit(1) : null, [t, e])), r = e != null && (t == null || n === void 0);
|
|
1539
1549
|
return {
|
|
1540
1550
|
record: n && n.length > 0 ? n[0] : null,
|
|
1541
1551
|
isLoading: r
|
|
@@ -1543,12 +1553,12 @@ function un(e) {
|
|
|
1543
1553
|
}
|
|
1544
1554
|
//#endregion
|
|
1545
1555
|
//#region src/SeedProvider.tsx
|
|
1546
|
-
var
|
|
1547
|
-
function
|
|
1548
|
-
let t =
|
|
1556
|
+
var fn = null;
|
|
1557
|
+
function pn(e) {
|
|
1558
|
+
let t = fn?.(e);
|
|
1549
1559
|
return typeof window < "u" && window.__SEED_INVALIDATE_ITEM_PROPERTIES__ && window.__SEED_INVALIDATE_ITEM_PROPERTIES__(e), Promise.resolve(t).then(() => {});
|
|
1550
1560
|
}
|
|
1551
|
-
function
|
|
1561
|
+
function mn({ queryClient: e }) {
|
|
1552
1562
|
return i(() => {
|
|
1553
1563
|
let t = (t) => {
|
|
1554
1564
|
let n = [
|
|
@@ -1558,7 +1568,7 @@ function pn({ queryClient: e }) {
|
|
|
1558
1568
|
];
|
|
1559
1569
|
return e.invalidateQueries({ queryKey: n }), e.refetchQueries({ queryKey: n });
|
|
1560
1570
|
};
|
|
1561
|
-
|
|
1571
|
+
fn = t, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = t);
|
|
1562
1572
|
let n = (e) => {
|
|
1563
1573
|
let n = e?.seedLocalId ?? e?.seedUid;
|
|
1564
1574
|
n && t(n);
|
|
@@ -1568,12 +1578,12 @@ function pn({ queryClient: e }) {
|
|
|
1568
1578
|
exact: !1
|
|
1569
1579
|
});
|
|
1570
1580
|
};
|
|
1571
|
-
return
|
|
1572
|
-
|
|
1581
|
+
return D.on("itemProperty.saved", n), D.on(h, r), () => {
|
|
1582
|
+
D.off("itemProperty.saved", n), D.off(h, r), fn = null, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = null);
|
|
1573
1583
|
};
|
|
1574
1584
|
}, [e]), null;
|
|
1575
1585
|
}
|
|
1576
|
-
function
|
|
1586
|
+
function hn({ config: e, addresses: t, onInitError: n }) {
|
|
1577
1587
|
let r = s(n);
|
|
1578
1588
|
r.current = n;
|
|
1579
1589
|
let a = s(t);
|
|
@@ -1589,8 +1599,8 @@ function mn({ config: e, addresses: t, onInitError: n }) {
|
|
|
1589
1599
|
});
|
|
1590
1600
|
}, [e, o]), null;
|
|
1591
1601
|
}
|
|
1592
|
-
function
|
|
1593
|
-
let s = o(() => i ??
|
|
1602
|
+
function gn({ children: e, config: t, addresses: n, onInitError: r, queryClient: i, queryClientRef: a }) {
|
|
1603
|
+
let s = o(() => i ?? Ve(), [i]);
|
|
1594
1604
|
if (a && (a.current = s, typeof window < "u")) {
|
|
1595
1605
|
let e = window;
|
|
1596
1606
|
e.__TEST_SEED_QUERY_CLIENT__ = s;
|
|
@@ -1598,13 +1608,13 @@ function hn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1598
1608
|
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = s);
|
|
1599
1609
|
} catch {}
|
|
1600
1610
|
}
|
|
1601
|
-
return /* @__PURE__ */
|
|
1611
|
+
return /* @__PURE__ */ V(ye, {
|
|
1602
1612
|
client: s,
|
|
1603
|
-
children: /* @__PURE__ */
|
|
1613
|
+
children: /* @__PURE__ */ H(Ne, {
|
|
1604
1614
|
queryClient: s,
|
|
1605
1615
|
children: [
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
t && /* @__PURE__ */
|
|
1616
|
+
/* @__PURE__ */ V(mn, { queryClient: s }),
|
|
1617
|
+
t && /* @__PURE__ */ V(hn, {
|
|
1608
1618
|
config: t,
|
|
1609
1619
|
addresses: n,
|
|
1610
1620
|
onInitError: r
|
|
@@ -1616,8 +1626,8 @@ function hn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1616
1626
|
}
|
|
1617
1627
|
//#endregion
|
|
1618
1628
|
//#region src/SeedClientGate.tsx
|
|
1619
|
-
function
|
|
1620
|
-
return /* @__PURE__ */
|
|
1629
|
+
function _n() {
|
|
1630
|
+
return /* @__PURE__ */ V("div", {
|
|
1621
1631
|
style: {
|
|
1622
1632
|
display: "flex",
|
|
1623
1633
|
alignItems: "center",
|
|
@@ -1628,21 +1638,21 @@ function gn() {
|
|
|
1628
1638
|
children: "Loading..."
|
|
1629
1639
|
});
|
|
1630
1640
|
}
|
|
1631
|
-
function
|
|
1641
|
+
function vn(e) {
|
|
1632
1642
|
try {
|
|
1633
1643
|
return JSON.stringify(e ?? null);
|
|
1634
1644
|
} catch {
|
|
1635
1645
|
return e;
|
|
1636
1646
|
}
|
|
1637
1647
|
}
|
|
1638
|
-
function
|
|
1639
|
-
let l =
|
|
1648
|
+
function yn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1649
|
+
let l = J(), u = s(o);
|
|
1640
1650
|
u.current = o;
|
|
1641
1651
|
let d = s(e);
|
|
1642
1652
|
d.current = e;
|
|
1643
1653
|
let f = s(t);
|
|
1644
1654
|
f.current = t;
|
|
1645
|
-
let p =
|
|
1655
|
+
let p = vn(e), m = vn(t);
|
|
1646
1656
|
i(() => {
|
|
1647
1657
|
let e = d.current, t = f.current, n = t ? {
|
|
1648
1658
|
...e,
|
|
@@ -1655,7 +1665,7 @@ function vn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1655
1665
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1656
1666
|
});
|
|
1657
1667
|
}, [p, m]);
|
|
1658
|
-
let h = n ?? /* @__PURE__ */
|
|
1668
|
+
let h = n ?? /* @__PURE__ */ V(_n, {}), g = r ? void 0 : {
|
|
1659
1669
|
position: "relative",
|
|
1660
1670
|
display: "flex",
|
|
1661
1671
|
height: "100vh",
|
|
@@ -1670,15 +1680,15 @@ function vn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1670
1680
|
justifyContent: "center"
|
|
1671
1681
|
}
|
|
1672
1682
|
};
|
|
1673
|
-
return /* @__PURE__ */
|
|
1683
|
+
return /* @__PURE__ */ H("div", {
|
|
1674
1684
|
className: r,
|
|
1675
1685
|
style: g,
|
|
1676
|
-
children: [/* @__PURE__ */
|
|
1686
|
+
children: [/* @__PURE__ */ V("div", {
|
|
1677
1687
|
className: a,
|
|
1678
1688
|
style: _,
|
|
1679
1689
|
"aria-hidden": l,
|
|
1680
1690
|
children: h
|
|
1681
|
-
}), /* @__PURE__ */
|
|
1691
|
+
}), /* @__PURE__ */ V("div", {
|
|
1682
1692
|
style: {
|
|
1683
1693
|
flex: 1,
|
|
1684
1694
|
display: l ? "flex" : "none",
|
|
@@ -1690,54 +1700,54 @@ function vn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1690
1700
|
}
|
|
1691
1701
|
//#endregion
|
|
1692
1702
|
//#region src/opfsPaths.ts
|
|
1693
|
-
function
|
|
1703
|
+
function bn(e) {
|
|
1694
1704
|
let t = e.split("/").filter(Boolean);
|
|
1695
1705
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1696
1706
|
return t;
|
|
1697
1707
|
}
|
|
1698
|
-
async function
|
|
1708
|
+
async function xn(e, t) {
|
|
1699
1709
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1700
1710
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1701
1711
|
return n;
|
|
1702
1712
|
}
|
|
1703
|
-
async function
|
|
1704
|
-
let n =
|
|
1713
|
+
async function Sn(e, t) {
|
|
1714
|
+
let n = bn(e), r = n.pop();
|
|
1705
1715
|
return {
|
|
1706
|
-
dir: await
|
|
1716
|
+
dir: await xn(n.join("/"), t),
|
|
1707
1717
|
name: r
|
|
1708
1718
|
};
|
|
1709
1719
|
}
|
|
1710
|
-
async function Sn(e, t) {
|
|
1711
|
-
let { dir: n, name: r } = await xn(e, t);
|
|
1712
|
-
return n.getFileHandle(r);
|
|
1713
|
-
}
|
|
1714
1720
|
async function Cn(e, t) {
|
|
1715
|
-
|
|
1721
|
+
let { dir: n, name: r } = await Sn(e, t);
|
|
1722
|
+
return n.getFileHandle(r);
|
|
1716
1723
|
}
|
|
1717
1724
|
async function wn(e, t) {
|
|
1718
|
-
|
|
1719
|
-
await n.removeEntry(r);
|
|
1725
|
+
return (await Cn(e, t)).getFile();
|
|
1720
1726
|
}
|
|
1721
1727
|
async function Tn(e, t) {
|
|
1728
|
+
let { dir: n, name: r } = await Sn(e, t);
|
|
1729
|
+
await n.removeEntry(r);
|
|
1730
|
+
}
|
|
1731
|
+
async function En(e, t) {
|
|
1722
1732
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1723
1733
|
for await (let e of n.entries()) r.push(e);
|
|
1724
1734
|
let i = !0;
|
|
1725
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1735
|
+
for (let [e, t] of r) (t.kind === "file" || !await En(n, e)) && (i = !1);
|
|
1726
1736
|
return i && await e.removeEntry(t), i;
|
|
1727
1737
|
}
|
|
1728
|
-
async function
|
|
1738
|
+
async function Dn(e, t) {
|
|
1729
1739
|
try {
|
|
1730
|
-
let { dir: n, name: r } = await
|
|
1731
|
-
return await
|
|
1740
|
+
let { dir: n, name: r } = await Sn(e, t);
|
|
1741
|
+
return await En(n, r);
|
|
1732
1742
|
} catch (e) {
|
|
1733
1743
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1734
1744
|
throw e;
|
|
1735
1745
|
}
|
|
1736
1746
|
}
|
|
1737
|
-
function
|
|
1747
|
+
function On() {
|
|
1738
1748
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1739
1749
|
}
|
|
1740
|
-
var
|
|
1750
|
+
var kn = [
|
|
1741
1751
|
{
|
|
1742
1752
|
type: "image/jpeg",
|
|
1743
1753
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1748,43 +1758,43 @@ var On = [
|
|
|
1748
1758
|
},
|
|
1749
1759
|
{
|
|
1750
1760
|
type: "image/gif",
|
|
1751
|
-
test: (e) =>
|
|
1761
|
+
test: (e) => An(e, 0, 4) === "GIF8"
|
|
1752
1762
|
},
|
|
1753
1763
|
{
|
|
1754
1764
|
type: "image/webp",
|
|
1755
|
-
test: (e) =>
|
|
1765
|
+
test: (e) => An(e, 0, 4) === "RIFF" && An(e, 8, 12) === "WEBP"
|
|
1756
1766
|
},
|
|
1757
1767
|
{
|
|
1758
1768
|
type: "image/avif",
|
|
1759
|
-
test: (e) =>
|
|
1769
|
+
test: (e) => An(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(An(e, 8, 12))
|
|
1760
1770
|
},
|
|
1761
1771
|
{
|
|
1762
1772
|
type: "application/vnd.sqlite3",
|
|
1763
|
-
test: (e) =>
|
|
1773
|
+
test: (e) => An(e, 0, 15) === "SQLite format 3"
|
|
1764
1774
|
},
|
|
1765
1775
|
{
|
|
1766
1776
|
type: "application/pdf",
|
|
1767
|
-
test: (e) =>
|
|
1777
|
+
test: (e) => An(e, 0, 5) === "%PDF-"
|
|
1768
1778
|
}
|
|
1769
1779
|
];
|
|
1770
|
-
function
|
|
1780
|
+
function An(e, t, n) {
|
|
1771
1781
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1772
1782
|
}
|
|
1773
|
-
function
|
|
1774
|
-
return
|
|
1783
|
+
function jn(e) {
|
|
1784
|
+
return kn.find((t) => t.test(e))?.type;
|
|
1775
1785
|
}
|
|
1776
|
-
async function
|
|
1777
|
-
if (e.size !== 0) return
|
|
1786
|
+
async function Mn(e) {
|
|
1787
|
+
if (e.size !== 0) return jn(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1778
1788
|
}
|
|
1779
1789
|
//#endregion
|
|
1780
1790
|
//#region src/useOPFSFiles.ts
|
|
1781
|
-
async function
|
|
1791
|
+
async function Nn(e, t = "") {
|
|
1782
1792
|
let n = [];
|
|
1783
1793
|
try {
|
|
1784
1794
|
for await (let [r, i] of e.entries()) {
|
|
1785
1795
|
let e = t ? `${t}/${r}` : r;
|
|
1786
1796
|
if (i.kind === "file") try {
|
|
1787
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1797
|
+
let t = await i.getFile(), a = t.type ? void 0 : await Mn(t).catch(() => void 0);
|
|
1788
1798
|
n.push({
|
|
1789
1799
|
name: r,
|
|
1790
1800
|
path: e,
|
|
@@ -1797,7 +1807,7 @@ async function Mn(e, t = "") {
|
|
|
1797
1807
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1798
1808
|
}
|
|
1799
1809
|
else if (i.kind === "directory") {
|
|
1800
|
-
let t = await
|
|
1810
|
+
let t = await Nn(i, e);
|
|
1801
1811
|
n.push(...t);
|
|
1802
1812
|
}
|
|
1803
1813
|
}
|
|
@@ -1806,11 +1816,11 @@ async function Mn(e, t = "") {
|
|
|
1806
1816
|
}
|
|
1807
1817
|
return n;
|
|
1808
1818
|
}
|
|
1809
|
-
function
|
|
1819
|
+
function Pn(e = {}) {
|
|
1810
1820
|
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 () => {
|
|
1811
1821
|
s(!0), f(null), m(null);
|
|
1812
1822
|
try {
|
|
1813
|
-
let e = await
|
|
1823
|
+
let e = await Nn(await xn(t ?? ""), t || "");
|
|
1814
1824
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1815
1825
|
} catch (e) {
|
|
1816
1826
|
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);
|
|
@@ -1831,96 +1841,96 @@ function Nn(e = {}) {
|
|
|
1831
1841
|
}
|
|
1832
1842
|
//#endregion
|
|
1833
1843
|
//#region src/OPFSFilesManager/format.ts
|
|
1834
|
-
var
|
|
1844
|
+
var Fn = [
|
|
1835
1845
|
"B",
|
|
1836
1846
|
"KB",
|
|
1837
1847
|
"MB",
|
|
1838
1848
|
"GB",
|
|
1839
1849
|
"TB"
|
|
1840
1850
|
];
|
|
1841
|
-
function
|
|
1851
|
+
function Q(e) {
|
|
1842
1852
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1843
|
-
let t = Math.min(
|
|
1844
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1853
|
+
let t = Math.min(Fn.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1854
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${Fn[t]}`;
|
|
1845
1855
|
}
|
|
1846
|
-
var
|
|
1847
|
-
function
|
|
1856
|
+
var In = 6e4, Ln = 60 * In, Rn = 24 * Ln;
|
|
1857
|
+
function zn(e, t = Date.now()) {
|
|
1848
1858
|
let n = t - e;
|
|
1849
|
-
if (n <
|
|
1850
|
-
if (n <
|
|
1851
|
-
if (n <
|
|
1852
|
-
let r = Math.round(n /
|
|
1859
|
+
if (n < In) return "just now";
|
|
1860
|
+
if (n < Ln) return `${Math.round(n / In)} min ago`;
|
|
1861
|
+
if (n < Rn) return `${Math.round(n / Ln)} h ago`;
|
|
1862
|
+
let r = Math.round(n / Rn);
|
|
1853
1863
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1854
1864
|
}
|
|
1855
|
-
function
|
|
1865
|
+
function Bn(e) {
|
|
1856
1866
|
return new Date(e).toLocaleString(void 0, {
|
|
1857
1867
|
dateStyle: "medium",
|
|
1858
1868
|
timeStyle: "short"
|
|
1859
1869
|
});
|
|
1860
1870
|
}
|
|
1861
|
-
function
|
|
1871
|
+
function Vn(e, t) {
|
|
1862
1872
|
if (e.length <= t) return e;
|
|
1863
1873
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1864
1874
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1865
1875
|
}
|
|
1866
1876
|
//#endregion
|
|
1867
1877
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1868
|
-
var
|
|
1869
|
-
check: /* @__PURE__ */
|
|
1870
|
-
chevronLeft: /* @__PURE__ */
|
|
1871
|
-
chevronRight: /* @__PURE__ */
|
|
1872
|
-
copy: /* @__PURE__ */
|
|
1878
|
+
var Hn = {
|
|
1879
|
+
check: /* @__PURE__ */ V("path", { d: "M20 6 9 17l-5-5" }),
|
|
1880
|
+
chevronLeft: /* @__PURE__ */ V("path", { d: "m15 18-6-6 6-6" }),
|
|
1881
|
+
chevronRight: /* @__PURE__ */ V("path", { d: "m9 18 6-6-6-6" }),
|
|
1882
|
+
copy: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("rect", {
|
|
1873
1883
|
width: "14",
|
|
1874
1884
|
height: "14",
|
|
1875
1885
|
x: "8",
|
|
1876
1886
|
y: "8",
|
|
1877
1887
|
rx: "2",
|
|
1878
1888
|
ry: "2"
|
|
1879
|
-
}), /* @__PURE__ */
|
|
1880
|
-
database: /* @__PURE__ */
|
|
1881
|
-
/* @__PURE__ */
|
|
1889
|
+
}), /* @__PURE__ */ V("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
|
|
1890
|
+
database: /* @__PURE__ */ H(B, { children: [
|
|
1891
|
+
/* @__PURE__ */ V("ellipse", {
|
|
1882
1892
|
cx: "12",
|
|
1883
1893
|
cy: "5",
|
|
1884
1894
|
rx: "9",
|
|
1885
1895
|
ry: "3"
|
|
1886
1896
|
}),
|
|
1887
|
-
/* @__PURE__ */
|
|
1888
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ V("path", { d: "M3 5V19A9 3 0 0 0 21 19V5" }),
|
|
1898
|
+
/* @__PURE__ */ V("path", { d: "M3 12A9 3 0 0 0 21 12" })
|
|
1889
1899
|
] }),
|
|
1890
|
-
download: /* @__PURE__ */
|
|
1891
|
-
/* @__PURE__ */
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1900
|
+
download: /* @__PURE__ */ H(B, { children: [
|
|
1901
|
+
/* @__PURE__ */ V("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1902
|
+
/* @__PURE__ */ V("polyline", { points: "7 10 12 15 17 10" }),
|
|
1903
|
+
/* @__PURE__ */ V("line", {
|
|
1894
1904
|
x1: "12",
|
|
1895
1905
|
x2: "12",
|
|
1896
1906
|
y1: "15",
|
|
1897
1907
|
y2: "3"
|
|
1898
1908
|
})
|
|
1899
1909
|
] }),
|
|
1900
|
-
file: /* @__PURE__ */
|
|
1901
|
-
fileCode: /* @__PURE__ */
|
|
1902
|
-
/* @__PURE__ */
|
|
1903
|
-
/* @__PURE__ */
|
|
1904
|
-
/* @__PURE__ */
|
|
1905
|
-
/* @__PURE__ */
|
|
1910
|
+
file: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ V("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })] }),
|
|
1911
|
+
fileCode: /* @__PURE__ */ H(B, { children: [
|
|
1912
|
+
/* @__PURE__ */ V("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1913
|
+
/* @__PURE__ */ V("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1914
|
+
/* @__PURE__ */ V("path", { d: "m10 13-2 2 2 2" }),
|
|
1915
|
+
/* @__PURE__ */ V("path", { d: "m14 17 2-2-2-2" })
|
|
1906
1916
|
] }),
|
|
1907
|
-
fileJson: /* @__PURE__ */
|
|
1908
|
-
/* @__PURE__ */
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
1917
|
+
fileJson: /* @__PURE__ */ H(B, { children: [
|
|
1918
|
+
/* @__PURE__ */ V("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1919
|
+
/* @__PURE__ */ V("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1920
|
+
/* @__PURE__ */ V("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" }),
|
|
1921
|
+
/* @__PURE__ */ V("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" })
|
|
1912
1922
|
] }),
|
|
1913
|
-
fileText: /* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
/* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1923
|
+
fileText: /* @__PURE__ */ H(B, { children: [
|
|
1924
|
+
/* @__PURE__ */ V("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1925
|
+
/* @__PURE__ */ V("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1926
|
+
/* @__PURE__ */ V("path", { d: "M10 9H8" }),
|
|
1927
|
+
/* @__PURE__ */ V("path", { d: "M16 13H8" }),
|
|
1928
|
+
/* @__PURE__ */ V("path", { d: "M16 17H8" })
|
|
1919
1929
|
] }),
|
|
1920
|
-
folder: /* @__PURE__ */
|
|
1921
|
-
folderOpen: /* @__PURE__ */
|
|
1922
|
-
image: /* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
1930
|
+
folder: /* @__PURE__ */ V("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" }),
|
|
1931
|
+
folderOpen: /* @__PURE__ */ V("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" }),
|
|
1932
|
+
image: /* @__PURE__ */ H(B, { children: [
|
|
1933
|
+
/* @__PURE__ */ V("rect", {
|
|
1924
1934
|
width: "18",
|
|
1925
1935
|
height: "18",
|
|
1926
1936
|
x: "3",
|
|
@@ -1928,64 +1938,64 @@ var Vn = {
|
|
|
1928
1938
|
rx: "2",
|
|
1929
1939
|
ry: "2"
|
|
1930
1940
|
}),
|
|
1931
|
-
/* @__PURE__ */
|
|
1941
|
+
/* @__PURE__ */ V("circle", {
|
|
1932
1942
|
cx: "9",
|
|
1933
1943
|
cy: "9",
|
|
1934
1944
|
r: "2"
|
|
1935
1945
|
}),
|
|
1936
|
-
/* @__PURE__ */
|
|
1946
|
+
/* @__PURE__ */ V("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
1937
1947
|
] }),
|
|
1938
|
-
imageOff: /* @__PURE__ */
|
|
1939
|
-
/* @__PURE__ */
|
|
1948
|
+
imageOff: /* @__PURE__ */ H(B, { children: [
|
|
1949
|
+
/* @__PURE__ */ V("line", {
|
|
1940
1950
|
x1: "2",
|
|
1941
1951
|
x2: "22",
|
|
1942
1952
|
y1: "2",
|
|
1943
1953
|
y2: "22"
|
|
1944
1954
|
}),
|
|
1945
|
-
/* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ V("path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83" }),
|
|
1956
|
+
/* @__PURE__ */ V("line", {
|
|
1947
1957
|
x1: "13.5",
|
|
1948
1958
|
x2: "6",
|
|
1949
1959
|
y1: "13.5",
|
|
1950
1960
|
y2: "21"
|
|
1951
1961
|
}),
|
|
1952
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ V("line", {
|
|
1953
1963
|
x1: "18",
|
|
1954
1964
|
x2: "21",
|
|
1955
1965
|
y1: "12",
|
|
1956
1966
|
y2: "15"
|
|
1957
1967
|
}),
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ V("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" }),
|
|
1969
|
+
/* @__PURE__ */ V("path", { d: "M21 15V5a2 2 0 0 0-2-2H9" })
|
|
1960
1970
|
] }),
|
|
1961
|
-
layers: /* @__PURE__ */
|
|
1962
|
-
/* @__PURE__ */
|
|
1963
|
-
/* @__PURE__ */
|
|
1964
|
-
/* @__PURE__ */
|
|
1971
|
+
layers: /* @__PURE__ */ H(B, { children: [
|
|
1972
|
+
/* @__PURE__ */ V("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" }),
|
|
1973
|
+
/* @__PURE__ */ V("path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65" }),
|
|
1974
|
+
/* @__PURE__ */ V("path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65" })
|
|
1965
1975
|
] }),
|
|
1966
|
-
layoutGrid: /* @__PURE__ */
|
|
1967
|
-
/* @__PURE__ */
|
|
1976
|
+
layoutGrid: /* @__PURE__ */ H(B, { children: [
|
|
1977
|
+
/* @__PURE__ */ V("rect", {
|
|
1968
1978
|
width: "7",
|
|
1969
1979
|
height: "7",
|
|
1970
1980
|
x: "3",
|
|
1971
1981
|
y: "3",
|
|
1972
1982
|
rx: "1"
|
|
1973
1983
|
}),
|
|
1974
|
-
/* @__PURE__ */
|
|
1984
|
+
/* @__PURE__ */ V("rect", {
|
|
1975
1985
|
width: "7",
|
|
1976
1986
|
height: "7",
|
|
1977
1987
|
x: "14",
|
|
1978
1988
|
y: "3",
|
|
1979
1989
|
rx: "1"
|
|
1980
1990
|
}),
|
|
1981
|
-
/* @__PURE__ */
|
|
1991
|
+
/* @__PURE__ */ V("rect", {
|
|
1982
1992
|
width: "7",
|
|
1983
1993
|
height: "7",
|
|
1984
1994
|
x: "14",
|
|
1985
1995
|
y: "14",
|
|
1986
1996
|
rx: "1"
|
|
1987
1997
|
}),
|
|
1988
|
-
/* @__PURE__ */
|
|
1998
|
+
/* @__PURE__ */ V("rect", {
|
|
1989
1999
|
width: "7",
|
|
1990
2000
|
height: "7",
|
|
1991
2001
|
x: "3",
|
|
@@ -1993,51 +2003,51 @@ var Vn = {
|
|
|
1993
2003
|
rx: "1"
|
|
1994
2004
|
})
|
|
1995
2005
|
] }),
|
|
1996
|
-
list: /* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
/* @__PURE__ */
|
|
1999
|
-
/* @__PURE__ */
|
|
2000
|
-
/* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2002
|
-
/* @__PURE__ */
|
|
2006
|
+
list: /* @__PURE__ */ H(B, { children: [
|
|
2007
|
+
/* @__PURE__ */ V("path", { d: "M3 12h.01" }),
|
|
2008
|
+
/* @__PURE__ */ V("path", { d: "M3 18h.01" }),
|
|
2009
|
+
/* @__PURE__ */ V("path", { d: "M3 6h.01" }),
|
|
2010
|
+
/* @__PURE__ */ V("path", { d: "M8 12h13" }),
|
|
2011
|
+
/* @__PURE__ */ V("path", { d: "M8 18h13" }),
|
|
2012
|
+
/* @__PURE__ */ V("path", { d: "M8 6h13" })
|
|
2003
2013
|
] }),
|
|
2004
|
-
refresh: /* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2014
|
+
refresh: /* @__PURE__ */ H(B, { children: [
|
|
2015
|
+
/* @__PURE__ */ V("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
2016
|
+
/* @__PURE__ */ V("path", { d: "M21 3v5h-5" }),
|
|
2017
|
+
/* @__PURE__ */ V("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
2018
|
+
/* @__PURE__ */ V("path", { d: "M8 16H3v5" })
|
|
2009
2019
|
] }),
|
|
2010
|
-
search: /* @__PURE__ */
|
|
2020
|
+
search: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("circle", {
|
|
2011
2021
|
cx: "11",
|
|
2012
2022
|
cy: "11",
|
|
2013
2023
|
r: "8"
|
|
2014
|
-
}), /* @__PURE__ */
|
|
2015
|
-
trash: /* @__PURE__ */
|
|
2016
|
-
/* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2024
|
+
}), /* @__PURE__ */ V("path", { d: "m21 21-4.3-4.3" })] }),
|
|
2025
|
+
trash: /* @__PURE__ */ H(B, { children: [
|
|
2026
|
+
/* @__PURE__ */ V("path", { d: "M3 6h18" }),
|
|
2027
|
+
/* @__PURE__ */ V("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
2028
|
+
/* @__PURE__ */ V("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
|
|
2029
|
+
/* @__PURE__ */ V("line", {
|
|
2020
2030
|
x1: "10",
|
|
2021
2031
|
x2: "10",
|
|
2022
2032
|
y1: "11",
|
|
2023
2033
|
y2: "17"
|
|
2024
2034
|
}),
|
|
2025
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ V("line", {
|
|
2026
2036
|
x1: "14",
|
|
2027
2037
|
x2: "14",
|
|
2028
2038
|
y1: "11",
|
|
2029
2039
|
y2: "17"
|
|
2030
2040
|
})
|
|
2031
2041
|
] }),
|
|
2032
|
-
triangleAlert: /* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2042
|
+
triangleAlert: /* @__PURE__ */ H(B, { children: [
|
|
2043
|
+
/* @__PURE__ */ V("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" }),
|
|
2044
|
+
/* @__PURE__ */ V("path", { d: "M12 9v4" }),
|
|
2045
|
+
/* @__PURE__ */ V("path", { d: "M12 17h.01" })
|
|
2036
2046
|
] }),
|
|
2037
|
-
x: /* @__PURE__ */
|
|
2047
|
+
x: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("path", { d: "M18 6 6 18" }), /* @__PURE__ */ V("path", { d: "m6 6 12 12" })] })
|
|
2038
2048
|
};
|
|
2039
|
-
function
|
|
2040
|
-
return /* @__PURE__ */
|
|
2049
|
+
function $({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
2050
|
+
return /* @__PURE__ */ V("svg", {
|
|
2041
2051
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2042
2052
|
width: t,
|
|
2043
2053
|
height: t,
|
|
@@ -2050,20 +2060,20 @@ function Q({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
2050
2060
|
"aria-hidden": "true",
|
|
2051
2061
|
focusable: "false",
|
|
2052
2062
|
className: r,
|
|
2053
|
-
children:
|
|
2063
|
+
children: Hn[e]
|
|
2054
2064
|
});
|
|
2055
2065
|
}
|
|
2056
2066
|
//#endregion
|
|
2057
2067
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
2058
|
-
var
|
|
2059
|
-
function
|
|
2068
|
+
var Un = 6;
|
|
2069
|
+
function Wn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
2060
2070
|
let a = s(null);
|
|
2061
2071
|
return i(() => {
|
|
2062
2072
|
let e = a.current;
|
|
2063
2073
|
return e && !e.open && (e.showModal(), e.querySelector("[data-initial-focus]")?.focus()), () => {
|
|
2064
2074
|
e?.open && e.close();
|
|
2065
2075
|
};
|
|
2066
|
-
}, []), /* @__PURE__ */
|
|
2076
|
+
}, []), /* @__PURE__ */ V("dialog", {
|
|
2067
2077
|
ref: a,
|
|
2068
2078
|
className: ["seed-fm-dialog", e].filter(Boolean).join(" "),
|
|
2069
2079
|
"aria-labelledby": "seed-fm-delete-title",
|
|
@@ -2073,7 +2083,7 @@ function Un({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2073
2083
|
onClick: (e) => {
|
|
2074
2084
|
e.target === e.currentTarget && t();
|
|
2075
2085
|
},
|
|
2076
|
-
children: /* @__PURE__ */
|
|
2086
|
+
children: /* @__PURE__ */ V("form", {
|
|
2077
2087
|
method: "dialog",
|
|
2078
2088
|
onSubmit: (e) => {
|
|
2079
2089
|
e.preventDefault(), n();
|
|
@@ -2082,32 +2092,32 @@ function Un({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2082
2092
|
})
|
|
2083
2093
|
});
|
|
2084
2094
|
}
|
|
2085
|
-
function
|
|
2086
|
-
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 ${
|
|
2087
|
-
return /* @__PURE__ */
|
|
2095
|
+
function Gn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
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 ${Vn(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
2097
|
+
return /* @__PURE__ */ H(Wn, {
|
|
2088
2098
|
className: o,
|
|
2089
2099
|
onCancel: i,
|
|
2090
2100
|
onSubmit: () => a(s),
|
|
2091
2101
|
children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2102
|
+
/* @__PURE__ */ V("h3", {
|
|
2093
2103
|
id: "seed-fm-delete-title",
|
|
2094
2104
|
children: h
|
|
2095
2105
|
}),
|
|
2096
|
-
/* @__PURE__ */
|
|
2106
|
+
/* @__PURE__ */ H("p", { children: [
|
|
2097
2107
|
"This removes ",
|
|
2098
2108
|
e.length === 1 ? "it" : "them",
|
|
2099
2109
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
2100
2110
|
] }),
|
|
2101
|
-
/* @__PURE__ */
|
|
2111
|
+
/* @__PURE__ */ H("ul", { children: [e.slice(0, Un).map((e) => /* @__PURE__ */ H("li", { children: [/* @__PURE__ */ V("code", {
|
|
2102
2112
|
title: e.file.path,
|
|
2103
2113
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
2104
|
-
}), /* @__PURE__ */
|
|
2114
|
+
}), /* @__PURE__ */ V("span", { children: Q(e.file.size) })] }, e.file.path)), e.length > Un && /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H("span", { children: [
|
|
2105
2115
|
"and ",
|
|
2106
|
-
e.length -
|
|
2116
|
+
e.length - Un,
|
|
2107
2117
|
" more"
|
|
2108
2118
|
] }) })] }),
|
|
2109
|
-
u.length > 0 && /* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2119
|
+
u.length > 0 && /* @__PURE__ */ H("label", { children: [
|
|
2120
|
+
/* @__PURE__ */ V("input", {
|
|
2111
2121
|
type: "checkbox",
|
|
2112
2122
|
className: "seed-fm-checkbox",
|
|
2113
2123
|
checked: s,
|
|
@@ -2118,26 +2128,26 @@ function Wn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2118
2128
|
" resized ",
|
|
2119
2129
|
u.length === 1 ? "copy" : "copies",
|
|
2120
2130
|
" (",
|
|
2121
|
-
|
|
2131
|
+
Q(d),
|
|
2122
2132
|
")"
|
|
2123
2133
|
] }),
|
|
2124
|
-
n && /* @__PURE__ */
|
|
2134
|
+
n && /* @__PURE__ */ H("div", {
|
|
2125
2135
|
className: "seed-fm-warning",
|
|
2126
2136
|
role: "alert",
|
|
2127
|
-
children: [/* @__PURE__ */
|
|
2137
|
+
children: [/* @__PURE__ */ V($, {
|
|
2128
2138
|
name: "triangleAlert",
|
|
2129
2139
|
size: 16
|
|
2130
|
-
}), /* @__PURE__ */
|
|
2140
|
+
}), /* @__PURE__ */ V("span", { children: n })]
|
|
2131
2141
|
}),
|
|
2132
|
-
/* @__PURE__ */
|
|
2142
|
+
/* @__PURE__ */ H("div", {
|
|
2133
2143
|
className: "seed-fm-dialog-actions",
|
|
2134
|
-
children: [/* @__PURE__ */
|
|
2144
|
+
children: [/* @__PURE__ */ V("button", {
|
|
2135
2145
|
type: "button",
|
|
2136
2146
|
className: "seed-fm-btn",
|
|
2137
2147
|
onClick: i,
|
|
2138
2148
|
"data-initial-focus": !0,
|
|
2139
2149
|
children: "Cancel"
|
|
2140
|
-
}), /* @__PURE__ */
|
|
2150
|
+
}), /* @__PURE__ */ V("button", {
|
|
2141
2151
|
type: "submit",
|
|
2142
2152
|
className: `seed-fm-btn ${m.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
2143
2153
|
children: m.label ?? `Delete ${f} ${f === 1 ? "file" : "files"}`
|
|
@@ -2146,43 +2156,43 @@ function Wn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2146
2156
|
]
|
|
2147
2157
|
});
|
|
2148
2158
|
}
|
|
2149
|
-
function
|
|
2159
|
+
function Kn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
2150
2160
|
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;
|
|
2151
|
-
return /* @__PURE__ */
|
|
2161
|
+
return /* @__PURE__ */ H(Wn, {
|
|
2152
2162
|
className: u,
|
|
2153
2163
|
onCancel: s,
|
|
2154
2164
|
onSubmit: l,
|
|
2155
2165
|
children: [
|
|
2156
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ V("h3", {
|
|
2157
2167
|
id: "seed-fm-delete-title",
|
|
2158
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
2168
|
+
children: i.label ? `${i.label}?` : `Delete the “${Vn(e.name, 32)}” folder?`
|
|
2159
2169
|
}),
|
|
2160
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ H("p", { children: [
|
|
2161
2171
|
"This removes the folder and the ",
|
|
2162
2172
|
h,
|
|
2163
2173
|
" in it (",
|
|
2164
|
-
|
|
2174
|
+
Q(p),
|
|
2165
2175
|
g > 0 && `, including ${g} resized ${g === 1 ? "copy" : "copies"}`,
|
|
2166
2176
|
") from this browser’s private storage. Copies on Arweave or other devices aren’t affected."
|
|
2167
2177
|
] }),
|
|
2168
|
-
/* @__PURE__ */
|
|
2178
|
+
/* @__PURE__ */ H("div", {
|
|
2169
2179
|
className: "seed-fm-irreversible",
|
|
2170
|
-
children: [/* @__PURE__ */
|
|
2180
|
+
children: [/* @__PURE__ */ V($, {
|
|
2171
2181
|
name: "triangleAlert",
|
|
2172
2182
|
size: 16
|
|
2173
|
-
}), /* @__PURE__ */
|
|
2183
|
+
}), /* @__PURE__ */ H("span", { children: [/* @__PURE__ */ V("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2174
2184
|
}),
|
|
2175
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ H("ul", { children: [t.slice(0, Un).map((e) => /* @__PURE__ */ H("li", { children: [/* @__PURE__ */ V("code", {
|
|
2176
2186
|
title: e.path,
|
|
2177
2187
|
children: e.path.slice(m.length)
|
|
2178
|
-
}), /* @__PURE__ */
|
|
2188
|
+
}), /* @__PURE__ */ V("span", { children: Q(e.size) })] }, e.path)), t.length > Un && /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H("span", { children: [
|
|
2179
2189
|
"and ",
|
|
2180
|
-
t.length -
|
|
2190
|
+
t.length - Un,
|
|
2181
2191
|
" more"
|
|
2182
2192
|
] }) })] }),
|
|
2183
|
-
/* @__PURE__ */
|
|
2193
|
+
/* @__PURE__ */ H("div", {
|
|
2184
2194
|
className: "seed-fm-keepcopy",
|
|
2185
|
-
children: [/* @__PURE__ */
|
|
2195
|
+
children: [/* @__PURE__ */ V("span", { children: d ? "Saved a copy to your computer." : "Want a copy first? Save the folder to your computer." }), /* @__PURE__ */ H("button", {
|
|
2186
2196
|
type: "button",
|
|
2187
2197
|
className: "seed-fm-btn",
|
|
2188
2198
|
disabled: a,
|
|
@@ -2190,7 +2200,7 @@ function Gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2190
2200
|
await o() && f(!0);
|
|
2191
2201
|
},
|
|
2192
2202
|
children: [
|
|
2193
|
-
/* @__PURE__ */
|
|
2203
|
+
/* @__PURE__ */ V($, {
|
|
2194
2204
|
name: d ? "check" : "download",
|
|
2195
2205
|
size: 15
|
|
2196
2206
|
}),
|
|
@@ -2199,7 +2209,7 @@ function Gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2199
2209
|
]
|
|
2200
2210
|
})]
|
|
2201
2211
|
}),
|
|
2202
|
-
n > 0 && /* @__PURE__ */
|
|
2212
|
+
n > 0 && /* @__PURE__ */ H("p", { children: [
|
|
2203
2213
|
n,
|
|
2204
2214
|
" other ",
|
|
2205
2215
|
n === 1 ? "file" : "files",
|
|
@@ -2208,23 +2218,23 @@ function Gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2208
2218
|
" ",
|
|
2209
2219
|
"hidden here and won’t be deleted, so the folder itself will stay."
|
|
2210
2220
|
] }),
|
|
2211
|
-
r && /* @__PURE__ */
|
|
2221
|
+
r && /* @__PURE__ */ H("div", {
|
|
2212
2222
|
className: "seed-fm-warning",
|
|
2213
2223
|
role: "alert",
|
|
2214
|
-
children: [/* @__PURE__ */
|
|
2224
|
+
children: [/* @__PURE__ */ V($, {
|
|
2215
2225
|
name: "triangleAlert",
|
|
2216
2226
|
size: 16
|
|
2217
|
-
}), /* @__PURE__ */
|
|
2227
|
+
}), /* @__PURE__ */ V("span", { children: r })]
|
|
2218
2228
|
}),
|
|
2219
|
-
/* @__PURE__ */
|
|
2229
|
+
/* @__PURE__ */ H("div", {
|
|
2220
2230
|
className: "seed-fm-dialog-actions",
|
|
2221
|
-
children: [/* @__PURE__ */
|
|
2231
|
+
children: [/* @__PURE__ */ V("button", {
|
|
2222
2232
|
type: "button",
|
|
2223
2233
|
className: "seed-fm-btn",
|
|
2224
2234
|
onClick: s,
|
|
2225
2235
|
"data-initial-focus": !0,
|
|
2226
2236
|
children: "Cancel"
|
|
2227
|
-
}), /* @__PURE__ */
|
|
2237
|
+
}), /* @__PURE__ */ V("button", {
|
|
2228
2238
|
type: "submit",
|
|
2229
2239
|
disabled: a,
|
|
2230
2240
|
className: `seed-fm-btn ${i.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
@@ -2236,42 +2246,42 @@ function Gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2236
2246
|
}
|
|
2237
2247
|
//#endregion
|
|
2238
2248
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2239
|
-
function
|
|
2249
|
+
function qn(e) {
|
|
2240
2250
|
return e.detectedType ?? e.type;
|
|
2241
2251
|
}
|
|
2242
|
-
var
|
|
2243
|
-
function
|
|
2244
|
-
let t =
|
|
2245
|
-
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" ||
|
|
2252
|
+
var Jn = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2253
|
+
function Yn(e) {
|
|
2254
|
+
let t = qn(e);
|
|
2255
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || Jn.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";
|
|
2246
2256
|
}
|
|
2247
|
-
function
|
|
2257
|
+
function Xn(e) {
|
|
2248
2258
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2249
2259
|
if (t) return t.toLowerCase();
|
|
2250
|
-
let n =
|
|
2260
|
+
let n = qn(e);
|
|
2251
2261
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2252
2262
|
}
|
|
2253
|
-
var
|
|
2254
|
-
function
|
|
2255
|
-
let t =
|
|
2263
|
+
var Zn = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, Qn = /^(.*\/)?images\/([^/]+)$/, $n = (e) => e.replace(/\.[^/.]+$/, "");
|
|
2264
|
+
function er(e) {
|
|
2265
|
+
let t = Zn.exec(e);
|
|
2256
2266
|
return t ? {
|
|
2257
2267
|
key: `${t[1] ?? ""}images/${t[3]}`,
|
|
2258
2268
|
width: Number(t[2])
|
|
2259
2269
|
} : null;
|
|
2260
2270
|
}
|
|
2261
|
-
function
|
|
2262
|
-
let t =
|
|
2263
|
-
return t ? `${t[1] ?? ""}images/${
|
|
2271
|
+
function tr(e) {
|
|
2272
|
+
let t = Qn.exec(e);
|
|
2273
|
+
return t ? `${t[1] ?? ""}images/${$n(t[2])}` : null;
|
|
2264
2274
|
}
|
|
2265
|
-
var
|
|
2275
|
+
var nr = (e) => ({
|
|
2266
2276
|
file: e,
|
|
2267
2277
|
variants: [],
|
|
2268
2278
|
totalSize: e.size
|
|
2269
2279
|
});
|
|
2270
|
-
function
|
|
2271
|
-
if (!t) return e.map(
|
|
2280
|
+
function rr(e, t) {
|
|
2281
|
+
if (!t) return e.map(nr);
|
|
2272
2282
|
let n = /* @__PURE__ */ new Map(), r = [], i = [];
|
|
2273
2283
|
for (let t of e) {
|
|
2274
|
-
let e =
|
|
2284
|
+
let e = er(t.path);
|
|
2275
2285
|
if (e) {
|
|
2276
2286
|
i.push({
|
|
2277
2287
|
file: t,
|
|
@@ -2279,27 +2289,27 @@ function tr(e, t) {
|
|
|
2279
2289
|
});
|
|
2280
2290
|
continue;
|
|
2281
2291
|
}
|
|
2282
|
-
let a =
|
|
2292
|
+
let a = nr(t);
|
|
2283
2293
|
r.push(a);
|
|
2284
|
-
let o =
|
|
2285
|
-
o &&
|
|
2294
|
+
let o = tr(t.path);
|
|
2295
|
+
o && Yn(t) === "image" && n.set(o, a);
|
|
2286
2296
|
}
|
|
2287
2297
|
for (let e of i) {
|
|
2288
2298
|
let t = n.get(e.key);
|
|
2289
2299
|
t ? (t.variants.push({
|
|
2290
2300
|
file: e.file,
|
|
2291
2301
|
width: e.width
|
|
2292
|
-
}), t.totalSize += e.file.size) : r.push(
|
|
2302
|
+
}), t.totalSize += e.file.size) : r.push(nr(e.file));
|
|
2293
2303
|
}
|
|
2294
2304
|
for (let e of n.values()) e.variants.sort((e, t) => e.width - t.width);
|
|
2295
2305
|
return r;
|
|
2296
2306
|
}
|
|
2297
|
-
var
|
|
2298
|
-
function
|
|
2307
|
+
var ir = (e, t) => e ? `${e}/${t}` : t;
|
|
2308
|
+
function ar(e, t, n = {}) {
|
|
2299
2309
|
let r = t ? `${t}/` : "", i = e.filter((e) => e.file.path.startsWith(r)), a = n.query?.trim().toLowerCase();
|
|
2300
2310
|
if (a) return {
|
|
2301
2311
|
folders: [],
|
|
2302
|
-
entries:
|
|
2312
|
+
entries: or(i.filter((e) => e.file.path.slice(r.length).toLowerCase().includes(a)), n.sort)
|
|
2303
2313
|
};
|
|
2304
2314
|
let o = /* @__PURE__ */ new Map(), s = [];
|
|
2305
2315
|
for (let e of i) {
|
|
@@ -2310,7 +2320,7 @@ function rr(e, t, n = {}) {
|
|
|
2310
2320
|
}
|
|
2311
2321
|
let a = n.slice(0, i), c = o.get(a) ?? {
|
|
2312
2322
|
name: a,
|
|
2313
|
-
path:
|
|
2323
|
+
path: ir(t, a),
|
|
2314
2324
|
fileCount: 0,
|
|
2315
2325
|
size: 0
|
|
2316
2326
|
};
|
|
@@ -2318,10 +2328,10 @@ function rr(e, t, n = {}) {
|
|
|
2318
2328
|
}
|
|
2319
2329
|
return {
|
|
2320
2330
|
folders: [...o.values()].sort((e, t) => e.name.localeCompare(t.name)),
|
|
2321
|
-
entries:
|
|
2331
|
+
entries: or(s, n.sort)
|
|
2322
2332
|
};
|
|
2323
2333
|
}
|
|
2324
|
-
function
|
|
2334
|
+
function or(e, t = "name") {
|
|
2325
2335
|
let n = {
|
|
2326
2336
|
name: (e, t) => e.file.name.localeCompare(t.file.name),
|
|
2327
2337
|
modified: (e, t) => t.file.lastModified - e.file.lastModified,
|
|
@@ -2329,7 +2339,7 @@ function ir(e, t = "name") {
|
|
|
2329
2339
|
};
|
|
2330
2340
|
return [...e].sort(n[t]);
|
|
2331
2341
|
}
|
|
2332
|
-
function
|
|
2342
|
+
function sr(e) {
|
|
2333
2343
|
let t = {
|
|
2334
2344
|
image: 0,
|
|
2335
2345
|
database: 0,
|
|
@@ -2338,34 +2348,34 @@ function ar(e) {
|
|
|
2338
2348
|
text: 0,
|
|
2339
2349
|
other: 0
|
|
2340
2350
|
};
|
|
2341
|
-
for (let n of e) t[
|
|
2351
|
+
for (let n of e) t[Yn(n)] += n.size;
|
|
2342
2352
|
return t;
|
|
2343
2353
|
}
|
|
2344
|
-
function
|
|
2354
|
+
function cr(e) {
|
|
2345
2355
|
return e.find((e) => /(^|\/)db\/seed\.db$/.test(e.path)) ? "This includes the Seed database. The app loses its local items and drafts, and anything not yet published is gone. Reload the app afterwards." : null;
|
|
2346
2356
|
}
|
|
2347
2357
|
//#endregion
|
|
2348
2358
|
//#region src/OPFSFilesManager/useThumbnail.ts
|
|
2349
|
-
var
|
|
2350
|
-
function
|
|
2359
|
+
var lr = 400, ur = 262144, dr = 4, fr = 3e4, pr = 0, mr = [];
|
|
2360
|
+
function hr(e) {
|
|
2351
2361
|
return new Promise((t, n) => {
|
|
2352
2362
|
let r = () => {
|
|
2353
|
-
|
|
2354
|
-
|
|
2363
|
+
pr++, e().then(t, n).finally(() => {
|
|
2364
|
+
pr--, mr.shift()?.();
|
|
2355
2365
|
});
|
|
2356
2366
|
};
|
|
2357
|
-
|
|
2367
|
+
pr < dr ? r() : mr.push(r);
|
|
2358
2368
|
});
|
|
2359
2369
|
}
|
|
2360
|
-
var
|
|
2361
|
-
function
|
|
2362
|
-
let n =
|
|
2370
|
+
var gr = /* @__PURE__ */ new Map();
|
|
2371
|
+
function _r(e, t) {
|
|
2372
|
+
let n = gr.get(e);
|
|
2363
2373
|
if (!n) {
|
|
2364
2374
|
let r = {
|
|
2365
2375
|
refs: 0,
|
|
2366
2376
|
promise: Promise.resolve("")
|
|
2367
2377
|
};
|
|
2368
|
-
r.promise =
|
|
2378
|
+
r.promise = hr(t).then((e) => (r.url = URL.createObjectURL(e), r.url)), gr.set(e, r), n = r;
|
|
2369
2379
|
}
|
|
2370
2380
|
n.timer && (clearTimeout(n.timer), n.timer = void 0), n.refs++;
|
|
2371
2381
|
let r = n, i = !1;
|
|
@@ -2373,15 +2383,15 @@ function hr(e, t) {
|
|
|
2373
2383
|
promise: r.promise,
|
|
2374
2384
|
release: () => {
|
|
2375
2385
|
i || (i = !0, r.refs--, !(r.refs > 0) && (r.timer = setTimeout(() => {
|
|
2376
|
-
r.url && URL.revokeObjectURL(r.url),
|
|
2377
|
-
},
|
|
2386
|
+
r.url && URL.revokeObjectURL(r.url), gr.get(e) === r && gr.delete(e);
|
|
2387
|
+
}, fr)));
|
|
2378
2388
|
}
|
|
2379
2389
|
};
|
|
2380
2390
|
}
|
|
2381
|
-
async function
|
|
2382
|
-
if (e.size <
|
|
2391
|
+
async function vr(e) {
|
|
2392
|
+
if (e.size < ur || typeof createImageBitmap != "function") return e;
|
|
2383
2393
|
let t = await createImageBitmap(e, {
|
|
2384
|
-
resizeWidth:
|
|
2394
|
+
resizeWidth: lr,
|
|
2385
2395
|
resizeQuality: "medium"
|
|
2386
2396
|
});
|
|
2387
2397
|
try {
|
|
@@ -2398,22 +2408,22 @@ async function gr(e) {
|
|
|
2398
2408
|
t.close();
|
|
2399
2409
|
}
|
|
2400
2410
|
}
|
|
2401
|
-
async function
|
|
2411
|
+
async function yr(e) {
|
|
2402
2412
|
let t = e.variants[0];
|
|
2403
|
-
return t ?
|
|
2413
|
+
return t ? wn(t.file.path) : vr(await wn(e.file.path));
|
|
2404
2414
|
}
|
|
2405
|
-
var
|
|
2406
|
-
function
|
|
2407
|
-
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (
|
|
2408
|
-
for (let t of e) t.isIntersecting && (
|
|
2409
|
-
}, { rootMargin: "300px" })),
|
|
2410
|
-
|
|
2415
|
+
var br = /* @__PURE__ */ new WeakMap(), xr = null;
|
|
2416
|
+
function Sr(e, t) {
|
|
2417
|
+
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (xr ?? (xr = new IntersectionObserver((e) => {
|
|
2418
|
+
for (let t of e) t.isIntersecting && (xr.unobserve(t.target), br.get(t.target)?.(), br.delete(t.target));
|
|
2419
|
+
}, { rootMargin: "300px" })), br.set(e, t), xr.observe(e), () => {
|
|
2420
|
+
br.delete(e), xr?.unobserve(e);
|
|
2411
2421
|
});
|
|
2412
2422
|
}
|
|
2413
|
-
function
|
|
2414
|
-
let t =
|
|
2423
|
+
function Cr(e) {
|
|
2424
|
+
let t = Yn(e.file) === "image", [r, a] = c(null), [o, s] = c(!1), [l, u] = c(null), [d, f] = c("idle"), p = n((e) => a(e), []);
|
|
2415
2425
|
i(() => {
|
|
2416
|
-
if (t && r && !o) return
|
|
2426
|
+
if (t && r && !o) return Sr(r, () => s(!0));
|
|
2417
2427
|
}, [
|
|
2418
2428
|
t,
|
|
2419
2429
|
r,
|
|
@@ -2424,7 +2434,7 @@ function xr(e) {
|
|
|
2424
2434
|
if (!t || !o) return;
|
|
2425
2435
|
let n = !1;
|
|
2426
2436
|
f("loading");
|
|
2427
|
-
let r =
|
|
2437
|
+
let r = _r(_, () => yr(e));
|
|
2428
2438
|
return r.promise.then((e) => {
|
|
2429
2439
|
n || (u(e), f("ready"));
|
|
2430
2440
|
}, () => {
|
|
@@ -2447,7 +2457,7 @@ function xr(e) {
|
|
|
2447
2457
|
}
|
|
2448
2458
|
//#endregion
|
|
2449
2459
|
//#region src/OPFSFilesManager/FileThumbnail.tsx
|
|
2450
|
-
var
|
|
2460
|
+
var wr = {
|
|
2451
2461
|
image: {
|
|
2452
2462
|
icon: "image",
|
|
2453
2463
|
label: "Images",
|
|
@@ -2478,53 +2488,53 @@ var Sr = {
|
|
|
2478
2488
|
label: "Other",
|
|
2479
2489
|
color: "var(--seed-kind-other)"
|
|
2480
2490
|
}
|
|
2481
|
-
},
|
|
2482
|
-
function
|
|
2483
|
-
let r =
|
|
2491
|
+
}, Tr = (e) => ({ "--seed-kind": wr[e].color }), Er = (e) => /png|webp|gif|avif|svg/.test(qn(e.file));
|
|
2492
|
+
function Dr({ entry: e, size: t, children: n }) {
|
|
2493
|
+
let r = Yn(e.file), { ref: i, url: a, status: o, markError: s } = Cr(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2484
2494
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2485
|
-
l &&
|
|
2495
|
+
l && Er(e) ? "seed-fm-thumb--checker" : "",
|
|
2486
2496
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2487
2497
|
].filter(Boolean).join(" "), d;
|
|
2488
|
-
return d = l ? /* @__PURE__ */
|
|
2498
|
+
return d = l ? /* @__PURE__ */ V("img", {
|
|
2489
2499
|
src: a,
|
|
2490
2500
|
alt: "",
|
|
2491
2501
|
decoding: "async",
|
|
2492
2502
|
draggable: !1,
|
|
2493
2503
|
onError: s
|
|
2494
|
-
}) : t === "mini" ? /* @__PURE__ */
|
|
2495
|
-
name: c ? "imageOff" :
|
|
2504
|
+
}) : t === "mini" ? /* @__PURE__ */ V($, {
|
|
2505
|
+
name: c ? "imageOff" : wr[r].icon,
|
|
2496
2506
|
size: 16
|
|
2497
|
-
}) : r === "image" && !c ? null : /* @__PURE__ */
|
|
2507
|
+
}) : r === "image" && !c ? null : /* @__PURE__ */ H("span", {
|
|
2498
2508
|
className: "seed-fm-kind",
|
|
2499
|
-
children: [/* @__PURE__ */
|
|
2500
|
-
name: c ? "imageOff" :
|
|
2509
|
+
children: [/* @__PURE__ */ V($, {
|
|
2510
|
+
name: c ? "imageOff" : wr[r].icon,
|
|
2501
2511
|
size: 28,
|
|
2502
2512
|
strokeWidth: 1.6
|
|
2503
|
-
}), c ? /* @__PURE__ */
|
|
2513
|
+
}), c ? /* @__PURE__ */ V("span", {
|
|
2504
2514
|
className: "seed-fm-kind-error",
|
|
2505
2515
|
children: "Can’t decode image"
|
|
2506
|
-
}) : /* @__PURE__ */
|
|
2516
|
+
}) : /* @__PURE__ */ V("span", {
|
|
2507
2517
|
className: "seed-fm-ext",
|
|
2508
|
-
children:
|
|
2518
|
+
children: Xn(e.file)
|
|
2509
2519
|
})]
|
|
2510
|
-
}), /* @__PURE__ */
|
|
2520
|
+
}), /* @__PURE__ */ H("span", {
|
|
2511
2521
|
ref: i,
|
|
2512
2522
|
className: u,
|
|
2513
|
-
style:
|
|
2523
|
+
style: Tr(r),
|
|
2514
2524
|
children: [d, n]
|
|
2515
2525
|
});
|
|
2516
2526
|
}
|
|
2517
2527
|
//#endregion
|
|
2518
2528
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2519
|
-
function
|
|
2520
|
-
return /* @__PURE__ */
|
|
2529
|
+
function Or({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2530
|
+
return /* @__PURE__ */ V("ul", {
|
|
2521
2531
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2522
2532
|
role: "listbox",
|
|
2523
2533
|
"aria-label": "Files",
|
|
2524
2534
|
"aria-multiselectable": "true",
|
|
2525
2535
|
children: e.map((e, i) => {
|
|
2526
2536
|
let { file: o, variants: s } = e, c = t.has(o.path);
|
|
2527
|
-
return /* @__PURE__ */
|
|
2537
|
+
return /* @__PURE__ */ H("li", {
|
|
2528
2538
|
role: "option",
|
|
2529
2539
|
tabIndex: 0,
|
|
2530
2540
|
"aria-selected": c,
|
|
@@ -2536,10 +2546,10 @@ function Er({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2536
2546
|
onKeyDown: (t) => {
|
|
2537
2547
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2538
2548
|
},
|
|
2539
|
-
children: [/* @__PURE__ */
|
|
2549
|
+
children: [/* @__PURE__ */ H(Dr, {
|
|
2540
2550
|
entry: e,
|
|
2541
2551
|
size: "tile",
|
|
2542
|
-
children: [/* @__PURE__ */
|
|
2552
|
+
children: [/* @__PURE__ */ V("button", {
|
|
2543
2553
|
type: "button",
|
|
2544
2554
|
className: "seed-fm-check",
|
|
2545
2555
|
tabIndex: -1,
|
|
@@ -2547,16 +2557,16 @@ function Er({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2547
2557
|
onClick: (t) => {
|
|
2548
2558
|
t.stopPropagation(), r(e, i, t.shiftKey);
|
|
2549
2559
|
},
|
|
2550
|
-
children: c && /* @__PURE__ */
|
|
2560
|
+
children: c && /* @__PURE__ */ V($, {
|
|
2551
2561
|
name: "check",
|
|
2552
2562
|
size: 14,
|
|
2553
2563
|
strokeWidth: 3
|
|
2554
2564
|
})
|
|
2555
|
-
}), s.length > 0 && /* @__PURE__ */
|
|
2565
|
+
}), s.length > 0 && /* @__PURE__ */ H("span", {
|
|
2556
2566
|
className: "seed-fm-badge",
|
|
2557
2567
|
title: "Resized copies are grouped with this image",
|
|
2558
2568
|
children: [
|
|
2559
|
-
/* @__PURE__ */
|
|
2569
|
+
/* @__PURE__ */ V($, {
|
|
2560
2570
|
name: "layers",
|
|
2561
2571
|
size: 11,
|
|
2562
2572
|
strokeWidth: 2.2
|
|
@@ -2566,21 +2576,21 @@ function Er({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2566
2576
|
s.length === 1 ? "size" : "sizes"
|
|
2567
2577
|
]
|
|
2568
2578
|
})]
|
|
2569
|
-
}), /* @__PURE__ */
|
|
2579
|
+
}), /* @__PURE__ */ H("span", {
|
|
2570
2580
|
className: "seed-fm-tile-meta",
|
|
2571
|
-
children: [/* @__PURE__ */
|
|
2581
|
+
children: [/* @__PURE__ */ V("span", {
|
|
2572
2582
|
className: "seed-fm-tile-name",
|
|
2573
|
-
children:
|
|
2574
|
-
}), /* @__PURE__ */
|
|
2583
|
+
children: Vn(o.name, 24)
|
|
2584
|
+
}), /* @__PURE__ */ H("span", {
|
|
2575
2585
|
className: "seed-fm-tile-sub",
|
|
2576
2586
|
children: [
|
|
2577
|
-
|
|
2587
|
+
Q(o.size),
|
|
2578
2588
|
" ·",
|
|
2579
2589
|
" ",
|
|
2580
|
-
/* @__PURE__ */
|
|
2590
|
+
/* @__PURE__ */ V("time", {
|
|
2581
2591
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2582
|
-
title:
|
|
2583
|
-
children:
|
|
2592
|
+
title: Bn(o.lastModified),
|
|
2593
|
+
children: zn(o.lastModified)
|
|
2584
2594
|
})
|
|
2585
2595
|
]
|
|
2586
2596
|
})]
|
|
@@ -2591,20 +2601,20 @@ function Er({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2591
2601
|
}
|
|
2592
2602
|
//#endregion
|
|
2593
2603
|
//#region src/OPFSFilesManager/FileList.tsx
|
|
2594
|
-
function
|
|
2604
|
+
function kr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onToggleAll: o, onDownload: c, onDelete: l, deleteActionFor: u, className: d, rowClassName: f }) {
|
|
2595
2605
|
let p = s(null), m = e.filter((e) => t.has(e.file.path)).length, h = e.length > 0 && m === e.length;
|
|
2596
2606
|
i(() => {
|
|
2597
2607
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
2598
2608
|
}, [m, h]);
|
|
2599
2609
|
let g = n ? `${n}/` : "";
|
|
2600
|
-
return /* @__PURE__ */
|
|
2610
|
+
return /* @__PURE__ */ V("div", {
|
|
2601
2611
|
className: "seed-fm-list-wrap",
|
|
2602
|
-
children: /* @__PURE__ */
|
|
2612
|
+
children: /* @__PURE__ */ H("table", {
|
|
2603
2613
|
className: ["seed-fm-list", d].filter(Boolean).join(" "),
|
|
2604
|
-
children: [/* @__PURE__ */
|
|
2605
|
-
/* @__PURE__ */
|
|
2614
|
+
children: [/* @__PURE__ */ V("thead", { children: /* @__PURE__ */ H("tr", { children: [
|
|
2615
|
+
/* @__PURE__ */ V("th", {
|
|
2606
2616
|
style: { width: 28 },
|
|
2607
|
-
children: /* @__PURE__ */
|
|
2617
|
+
children: /* @__PURE__ */ V("input", {
|
|
2608
2618
|
ref: p,
|
|
2609
2619
|
type: "checkbox",
|
|
2610
2620
|
className: "seed-fm-checkbox",
|
|
@@ -2613,34 +2623,34 @@ function Dr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2613
2623
|
"aria-label": "Select all"
|
|
2614
2624
|
})
|
|
2615
2625
|
}),
|
|
2616
|
-
/* @__PURE__ */
|
|
2617
|
-
/* @__PURE__ */
|
|
2626
|
+
/* @__PURE__ */ V("th", { children: "Name" }),
|
|
2627
|
+
/* @__PURE__ */ V("th", {
|
|
2618
2628
|
className: "seed-fm-col-type",
|
|
2619
2629
|
children: "Type"
|
|
2620
2630
|
}),
|
|
2621
|
-
/* @__PURE__ */
|
|
2631
|
+
/* @__PURE__ */ V("th", {
|
|
2622
2632
|
className: "seed-fm-num seed-fm-col-size",
|
|
2623
2633
|
children: "Size"
|
|
2624
2634
|
}),
|
|
2625
|
-
/* @__PURE__ */
|
|
2635
|
+
/* @__PURE__ */ V("th", {
|
|
2626
2636
|
className: "seed-fm-col-modified",
|
|
2627
2637
|
children: "Modified"
|
|
2628
2638
|
}),
|
|
2629
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ V("th", { children: /* @__PURE__ */ V("span", {
|
|
2630
2640
|
className: "seed-fm-visually-hidden",
|
|
2631
2641
|
children: "Actions"
|
|
2632
2642
|
}) })
|
|
2633
|
-
] }) }), /* @__PURE__ */
|
|
2643
|
+
] }) }), /* @__PURE__ */ V("tbody", { children: e.map((e, n) => {
|
|
2634
2644
|
let { file: i } = e, o = t.has(i.path), s = u(e);
|
|
2635
|
-
return /* @__PURE__ */
|
|
2645
|
+
return /* @__PURE__ */ H("tr", {
|
|
2636
2646
|
"data-path": i.path,
|
|
2637
2647
|
"aria-selected": o,
|
|
2638
2648
|
className: ["seed-fm-row", f].filter(Boolean).join(" "),
|
|
2639
2649
|
onClick: (t) => r(e, n, t),
|
|
2640
2650
|
children: [
|
|
2641
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ V("td", {
|
|
2642
2652
|
onClick: (e) => e.stopPropagation(),
|
|
2643
|
-
children: /* @__PURE__ */
|
|
2653
|
+
children: /* @__PURE__ */ V("input", {
|
|
2644
2654
|
type: "checkbox",
|
|
2645
2655
|
className: "seed-fm-checkbox",
|
|
2646
2656
|
checked: o,
|
|
@@ -2649,61 +2659,61 @@ function Dr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2649
2659
|
"aria-label": `Select ${i.name}`
|
|
2650
2660
|
})
|
|
2651
2661
|
}),
|
|
2652
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ V("td", { children: /* @__PURE__ */ H("span", {
|
|
2653
2663
|
className: "seed-fm-namecell",
|
|
2654
|
-
children: [/* @__PURE__ */
|
|
2664
|
+
children: [/* @__PURE__ */ V(Dr, {
|
|
2655
2665
|
entry: e,
|
|
2656
2666
|
size: "mini"
|
|
2657
|
-
}), /* @__PURE__ */
|
|
2667
|
+
}), /* @__PURE__ */ H("span", { children: [/* @__PURE__ */ V("button", {
|
|
2658
2668
|
type: "button",
|
|
2659
2669
|
className: "seed-fm-row-name seed-fm-row-open",
|
|
2660
2670
|
onClick: (t) => {
|
|
2661
2671
|
t.stopPropagation(), r(e, n, t);
|
|
2662
2672
|
},
|
|
2663
2673
|
children: i.name
|
|
2664
|
-
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */
|
|
2674
|
+
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */ V("span", {
|
|
2665
2675
|
className: "seed-fm-row-path",
|
|
2666
2676
|
children: i.path.slice(g.length)
|
|
2667
2677
|
})] })]
|
|
2668
2678
|
}) }),
|
|
2669
|
-
/* @__PURE__ */
|
|
2679
|
+
/* @__PURE__ */ V("td", {
|
|
2670
2680
|
className: "seed-fm-col-type",
|
|
2671
|
-
children: /* @__PURE__ */
|
|
2681
|
+
children: /* @__PURE__ */ H("span", {
|
|
2672
2682
|
className: "seed-fm-type",
|
|
2673
|
-
style:
|
|
2674
|
-
children: [
|
|
2683
|
+
style: Tr(Yn(i)),
|
|
2684
|
+
children: [qn(i), i.detectedType && /* @__PURE__ */ V("small", { children: "detected" })]
|
|
2675
2685
|
})
|
|
2676
2686
|
}),
|
|
2677
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ V("td", {
|
|
2678
2688
|
className: "seed-fm-num seed-fm-col-size",
|
|
2679
2689
|
title: `${i.size.toLocaleString()} bytes`,
|
|
2680
|
-
children:
|
|
2690
|
+
children: Q(e.totalSize)
|
|
2681
2691
|
}),
|
|
2682
|
-
/* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ V("td", {
|
|
2683
2693
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2684
|
-
title:
|
|
2685
|
-
children:
|
|
2694
|
+
title: Bn(i.lastModified),
|
|
2695
|
+
children: zn(i.lastModified)
|
|
2686
2696
|
}),
|
|
2687
|
-
/* @__PURE__ */
|
|
2697
|
+
/* @__PURE__ */ H("td", {
|
|
2688
2698
|
className: "seed-fm-actions",
|
|
2689
2699
|
onClick: (e) => e.stopPropagation(),
|
|
2690
|
-
children: [/* @__PURE__ */
|
|
2700
|
+
children: [/* @__PURE__ */ V("button", {
|
|
2691
2701
|
type: "button",
|
|
2692
2702
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2693
2703
|
"aria-label": `Download ${i.name}`,
|
|
2694
2704
|
title: "Download",
|
|
2695
2705
|
onClick: () => c(e),
|
|
2696
|
-
children: /* @__PURE__ */
|
|
2706
|
+
children: /* @__PURE__ */ V($, {
|
|
2697
2707
|
name: "download",
|
|
2698
2708
|
size: 15
|
|
2699
2709
|
})
|
|
2700
|
-
}), /* @__PURE__ */
|
|
2710
|
+
}), /* @__PURE__ */ V("button", {
|
|
2701
2711
|
type: "button",
|
|
2702
2712
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2703
2713
|
"aria-label": s.label ? `${s.label}: ${i.name}` : `Delete ${i.name}`,
|
|
2704
2714
|
title: s.label ?? "Delete",
|
|
2705
2715
|
onClick: () => l(e),
|
|
2706
|
-
children: /* @__PURE__ */
|
|
2716
|
+
children: /* @__PURE__ */ V($, {
|
|
2707
2717
|
name: "trash",
|
|
2708
2718
|
size: 15
|
|
2709
2719
|
})
|
|
@@ -2717,22 +2727,22 @@ function Dr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2717
2727
|
}
|
|
2718
2728
|
//#endregion
|
|
2719
2729
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2720
|
-
var
|
|
2721
|
-
function
|
|
2722
|
-
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o =
|
|
2730
|
+
var Ar = 1048576, jr = 32768;
|
|
2731
|
+
function Mr(e) {
|
|
2732
|
+
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = Yn(e.file), s = e.file.size;
|
|
2723
2733
|
return i(() => {
|
|
2724
2734
|
let e = !1, t = null;
|
|
2725
2735
|
return n({ kind: "loading" }), (async () => {
|
|
2726
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2736
|
+
if (o === "image") return t = URL.createObjectURL(await wn(r)), {
|
|
2727
2737
|
kind: "image",
|
|
2728
2738
|
url: t
|
|
2729
2739
|
};
|
|
2730
2740
|
if (o === "json" || o === "html" || o === "text") {
|
|
2731
|
-
if (s >
|
|
2741
|
+
if (s > Ar) return {
|
|
2732
2742
|
kind: "none",
|
|
2733
2743
|
message: "This file is too large to preview."
|
|
2734
2744
|
};
|
|
2735
|
-
let e = await
|
|
2745
|
+
let e = await wn(r), t = e.size > jr, n = await e.slice(0, jr).text();
|
|
2736
2746
|
if (o === "json" && !t) try {
|
|
2737
2747
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2738
2748
|
} catch {}
|
|
@@ -2766,15 +2776,15 @@ function Ar(e) {
|
|
|
2766
2776
|
o
|
|
2767
2777
|
]), t;
|
|
2768
2778
|
}
|
|
2769
|
-
function
|
|
2770
|
-
let { file: f, variants: p } = e, m =
|
|
2779
|
+
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 = Yn(f), h = Mr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2771
2781
|
i(() => {
|
|
2772
2782
|
_(null), y(!1);
|
|
2773
2783
|
}, [f.path]), i(() => {
|
|
2774
2784
|
b.current?.focus();
|
|
2775
2785
|
}, []);
|
|
2776
2786
|
let x = `seed-fm-panel-${encodeURIComponent(f.path)}`, S = p.reduce((e, t) => e + t.file.size, 0), C;
|
|
2777
|
-
if (h.kind === "image" && !v) C = /* @__PURE__ */
|
|
2787
|
+
if (h.kind === "image" && !v) C = /* @__PURE__ */ V("img", {
|
|
2778
2788
|
src: h.url,
|
|
2779
2789
|
alt: `Preview of ${f.name}`,
|
|
2780
2790
|
onLoad: (e) => _({
|
|
@@ -2783,144 +2793,144 @@ function jr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2783
2793
|
}),
|
|
2784
2794
|
onError: () => y(!0)
|
|
2785
2795
|
});
|
|
2786
|
-
else if (h.kind === "text") C = /* @__PURE__ */
|
|
2796
|
+
else if (h.kind === "text") C = /* @__PURE__ */ H("pre", { children: [h.text, h.truncated && "\n…"] });
|
|
2787
2797
|
else if (h.kind === "loading") C = null;
|
|
2788
2798
|
else {
|
|
2789
2799
|
let e = h.kind === "none" ? h.message : "The browser can’t decode this image. The file may be corrupt or not an image.";
|
|
2790
|
-
C = /* @__PURE__ */
|
|
2800
|
+
C = /* @__PURE__ */ H("span", {
|
|
2791
2801
|
className: "seed-fm-preview-note",
|
|
2792
|
-
children: [/* @__PURE__ */
|
|
2793
|
-
name: v ? "imageOff" :
|
|
2802
|
+
children: [/* @__PURE__ */ V($, {
|
|
2803
|
+
name: v ? "imageOff" : wr[m].icon,
|
|
2794
2804
|
size: 32,
|
|
2795
2805
|
strokeWidth: 1.5
|
|
2796
2806
|
}), e]
|
|
2797
2807
|
});
|
|
2798
2808
|
}
|
|
2799
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2800
|
-
return /* @__PURE__ */
|
|
2809
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(qn(f));
|
|
2810
|
+
return /* @__PURE__ */ H("aside", {
|
|
2801
2811
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2802
2812
|
role: "dialog",
|
|
2803
2813
|
"aria-modal": "false",
|
|
2804
2814
|
"aria-labelledby": x,
|
|
2805
2815
|
children: [
|
|
2806
|
-
/* @__PURE__ */
|
|
2816
|
+
/* @__PURE__ */ H("div", {
|
|
2807
2817
|
className: "seed-fm-panel-head",
|
|
2808
2818
|
children: [
|
|
2809
|
-
/* @__PURE__ */
|
|
2819
|
+
/* @__PURE__ */ V("h3", {
|
|
2810
2820
|
id: x,
|
|
2811
2821
|
title: f.name,
|
|
2812
2822
|
children: f.name
|
|
2813
2823
|
}),
|
|
2814
|
-
/* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ V("button", {
|
|
2815
2825
|
type: "button",
|
|
2816
2826
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2817
2827
|
"aria-label": "Previous file",
|
|
2818
2828
|
disabled: !n,
|
|
2819
2829
|
onClick: n ?? void 0,
|
|
2820
|
-
children: /* @__PURE__ */
|
|
2830
|
+
children: /* @__PURE__ */ V($, { name: "chevronLeft" })
|
|
2821
2831
|
}),
|
|
2822
|
-
/* @__PURE__ */
|
|
2832
|
+
/* @__PURE__ */ V("button", {
|
|
2823
2833
|
type: "button",
|
|
2824
2834
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2825
2835
|
"aria-label": "Next file",
|
|
2826
2836
|
disabled: !r,
|
|
2827
2837
|
onClick: r ?? void 0,
|
|
2828
|
-
children: /* @__PURE__ */
|
|
2838
|
+
children: /* @__PURE__ */ V($, { name: "chevronRight" })
|
|
2829
2839
|
}),
|
|
2830
|
-
/* @__PURE__ */
|
|
2840
|
+
/* @__PURE__ */ V("button", {
|
|
2831
2841
|
ref: b,
|
|
2832
2842
|
type: "button",
|
|
2833
2843
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2834
2844
|
"aria-label": "Close details",
|
|
2835
2845
|
onClick: t,
|
|
2836
|
-
children: /* @__PURE__ */
|
|
2846
|
+
children: /* @__PURE__ */ V($, { name: "x" })
|
|
2837
2847
|
})
|
|
2838
2848
|
]
|
|
2839
2849
|
}),
|
|
2840
|
-
/* @__PURE__ */
|
|
2850
|
+
/* @__PURE__ */ H("div", {
|
|
2841
2851
|
className: "seed-fm-panel-body",
|
|
2842
2852
|
children: [
|
|
2843
|
-
/* @__PURE__ */
|
|
2853
|
+
/* @__PURE__ */ V("div", {
|
|
2844
2854
|
className: [
|
|
2845
2855
|
"seed-fm-preview",
|
|
2846
2856
|
w ? "seed-fm-thumb--checker" : "",
|
|
2847
2857
|
h.kind === "loading" ? "seed-fm-skeleton" : ""
|
|
2848
2858
|
].filter(Boolean).join(" "),
|
|
2849
|
-
style:
|
|
2859
|
+
style: Tr(m),
|
|
2850
2860
|
children: C
|
|
2851
2861
|
}),
|
|
2852
|
-
/* @__PURE__ */
|
|
2862
|
+
/* @__PURE__ */ H("dl", {
|
|
2853
2863
|
className: "seed-fm-details",
|
|
2854
2864
|
children: [
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2865
|
+
/* @__PURE__ */ V("dt", { children: "Path" }),
|
|
2866
|
+
/* @__PURE__ */ V("dd", { children: /* @__PURE__ */ H("span", {
|
|
2857
2867
|
className: "seed-fm-path",
|
|
2858
|
-
children: [/* @__PURE__ */
|
|
2868
|
+
children: [/* @__PURE__ */ V("code", { children: f.path }), /* @__PURE__ */ V("button", {
|
|
2859
2869
|
type: "button",
|
|
2860
2870
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2861
2871
|
"aria-label": "Copy path",
|
|
2862
2872
|
title: "Copy path",
|
|
2863
2873
|
onClick: u,
|
|
2864
|
-
children: /* @__PURE__ */
|
|
2874
|
+
children: /* @__PURE__ */ V($, {
|
|
2865
2875
|
name: "copy",
|
|
2866
2876
|
size: 13
|
|
2867
2877
|
})
|
|
2868
2878
|
})]
|
|
2869
2879
|
}) }),
|
|
2870
|
-
/* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
|
|
2880
|
+
/* @__PURE__ */ V("dt", { children: "Size" }),
|
|
2881
|
+
/* @__PURE__ */ H("dd", { children: [
|
|
2882
|
+
Q(f.size),
|
|
2873
2883
|
" ",
|
|
2874
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ H("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2875
2885
|
] }),
|
|
2876
|
-
/* @__PURE__ */
|
|
2877
|
-
/* @__PURE__ */
|
|
2886
|
+
/* @__PURE__ */ V("dt", { children: "Type" }),
|
|
2887
|
+
/* @__PURE__ */ H("dd", { children: [qn(f), f.detectedType && /* @__PURE__ */ H("small", { children: [
|
|
2878
2888
|
" from file contents. File.type is “",
|
|
2879
2889
|
f.type,
|
|
2880
2890
|
"”"
|
|
2881
2891
|
] })] }),
|
|
2882
|
-
g && /* @__PURE__ */
|
|
2892
|
+
g && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", { children: "Dimensions" }), /* @__PURE__ */ H("dd", { children: [
|
|
2883
2893
|
g.width.toLocaleString(),
|
|
2884
2894
|
" × ",
|
|
2885
2895
|
g.height.toLocaleString(),
|
|
2886
2896
|
" px"
|
|
2887
2897
|
] })] }),
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
/* @__PURE__ */
|
|
2890
|
-
|
|
2898
|
+
/* @__PURE__ */ V("dt", { children: "Modified" }),
|
|
2899
|
+
/* @__PURE__ */ H("dd", { children: [
|
|
2900
|
+
Bn(f.lastModified),
|
|
2891
2901
|
" ",
|
|
2892
|
-
/* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ V("small", { children: zn(f.lastModified) })
|
|
2893
2903
|
] })
|
|
2894
2904
|
]
|
|
2895
2905
|
}),
|
|
2896
|
-
p.length > 0 && /* @__PURE__ */
|
|
2906
|
+
p.length > 0 && /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("div", {
|
|
2897
2907
|
className: "seed-fm-section-label",
|
|
2898
|
-
children: ["Resized copies · ",
|
|
2899
|
-
}), /* @__PURE__ */
|
|
2908
|
+
children: ["Resized copies · ", Q(S)]
|
|
2909
|
+
}), /* @__PURE__ */ V("ul", {
|
|
2900
2910
|
className: "seed-fm-variants",
|
|
2901
|
-
children: p.map((e) => /* @__PURE__ */
|
|
2911
|
+
children: p.map((e) => /* @__PURE__ */ H("li", {
|
|
2902
2912
|
title: e.file.path,
|
|
2903
|
-
children: [/* @__PURE__ */
|
|
2913
|
+
children: [/* @__PURE__ */ H("span", { children: [e.width, "w · webp"] }), /* @__PURE__ */ V("span", { children: Q(e.file.size) })]
|
|
2904
2914
|
}, e.file.path))
|
|
2905
2915
|
})] })
|
|
2906
2916
|
]
|
|
2907
2917
|
}),
|
|
2908
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ H("div", {
|
|
2909
2919
|
className: "seed-fm-panel-foot",
|
|
2910
|
-
children: [/* @__PURE__ */
|
|
2920
|
+
children: [/* @__PURE__ */ H("button", {
|
|
2911
2921
|
type: "button",
|
|
2912
2922
|
className: "seed-fm-btn seed-fm-btn--primary",
|
|
2913
2923
|
onClick: a,
|
|
2914
|
-
children: [/* @__PURE__ */
|
|
2924
|
+
children: [/* @__PURE__ */ V($, {
|
|
2915
2925
|
name: "download",
|
|
2916
2926
|
size: 15
|
|
2917
2927
|
}), " Download"]
|
|
2918
|
-
}), /* @__PURE__ */
|
|
2928
|
+
}), /* @__PURE__ */ H("button", {
|
|
2919
2929
|
type: "button",
|
|
2920
2930
|
className: `seed-fm-btn${l.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
2921
2931
|
onClick: o,
|
|
2922
2932
|
children: [
|
|
2923
|
-
/* @__PURE__ */
|
|
2933
|
+
/* @__PURE__ */ V($, {
|
|
2924
2934
|
name: "trash",
|
|
2925
2935
|
size: 15
|
|
2926
2936
|
}),
|
|
@@ -2934,18 +2944,18 @@ function jr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2934
2944
|
}
|
|
2935
2945
|
//#endregion
|
|
2936
2946
|
//#region src/OPFSFilesManager/styles.ts
|
|
2937
|
-
var
|
|
2947
|
+
var Pr = "seed-opfs-files-manager-styles", Fr = "seed-opfs-files-manager", Ir = "\n --seed-bg: #fbfcfb;\n --seed-surface: #ffffff;\n --seed-sunken: #f0f3f1;\n --seed-hover: #e9eeeb;\n --seed-fg: #18211d;\n --seed-fg-muted: #5a6861;\n --seed-fg-faint: #8a978f;\n --seed-border: #dfe5e1;\n --seed-border-strong: #c5cfc9;\n --seed-accent: #2c6b59;\n --seed-accent-fg: #ffffff;\n --seed-accent-soft: #e0eee8;\n --seed-danger: #b4332a;\n --seed-danger-fg: #ffffff;\n --seed-danger-soft: #fbe7e4;\n --seed-danger-inverse: #ff9a8f;\n --seed-warn: #8a5208;\n --seed-warn-soft: #fdf1dc;\n --seed-kind-image: #2f7d68;\n --seed-kind-database: #6a4fb3;\n --seed-kind-json: #a2620e;\n --seed-kind-html: #b0413a;\n --seed-kind-text: #3f6f9a;\n --seed-kind-other: #66736c;\n --seed-checker-a: #eef1ef;\n --seed-checker-b: #ffffff;\n --seed-shadow: 0 10px 30px rgb(16 24 20 / 0.14), 0 2px 6px rgb(16 24 20 / 0.08);\n --seed-backdrop: rgb(8 12 10 / 0.42);\n", Lr = "\n --seed-bg: #111816;\n --seed-surface: #171f1c;\n --seed-sunken: #1d2723;\n --seed-hover: #24302b;\n --seed-fg: #e4ebe7;\n --seed-fg-muted: #9daba3;\n --seed-fg-faint: #6f7d76;\n --seed-border: #29342f;\n --seed-border-strong: #3a4842;\n --seed-accent: #6cc0a3;\n --seed-accent-fg: #0c1a15;\n --seed-accent-soft: #1c3a30;\n --seed-danger: #f08277;\n --seed-danger-fg: #2a0d0a;\n --seed-danger-soft: #3b1c19;\n --seed-danger-inverse: #b4332a;\n --seed-warn: #e9b062;\n --seed-warn-soft: #382a14;\n --seed-kind-image: #6cc0a3;\n --seed-kind-database: #b29cf0;\n --seed-kind-json: #e3ad5c;\n --seed-kind-html: #ef8a80;\n --seed-kind-text: #8fb8de;\n --seed-kind-other: #9aa8a0;\n --seed-checker-a: #1d2723;\n --seed-checker-b: #24302b;\n --seed-shadow: 0 12px 34px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);\n --seed-backdrop: rgb(0 0 0 / 0.55);\n color-scheme: dark;\n", Rr = `@layer ${Fr} {\n${`
|
|
2938
2948
|
.seed-fm {
|
|
2939
|
-
${
|
|
2949
|
+
${Ir}
|
|
2940
2950
|
--seed-radius-sm: 6px;
|
|
2941
2951
|
--seed-radius-md: 8px;
|
|
2942
2952
|
--seed-radius-lg: 12px;
|
|
2943
2953
|
--seed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
2944
2954
|
color-scheme: light;
|
|
2945
2955
|
}
|
|
2946
|
-
.seed-fm[data-seed-theme="dark"] { ${
|
|
2956
|
+
.seed-fm[data-seed-theme="dark"] { ${Lr} }
|
|
2947
2957
|
@media (prefers-color-scheme: dark) {
|
|
2948
|
-
.seed-fm[data-seed-theme="system"] { ${
|
|
2958
|
+
.seed-fm[data-seed-theme="system"] { ${Lr} }
|
|
2949
2959
|
}
|
|
2950
2960
|
|
|
2951
2961
|
.seed-fm { position: relative; color: var(--seed-fg); background: var(--seed-bg); font-family: inherit; font-size: 14px; line-height: 1.45; }
|
|
@@ -3153,14 +3163,14 @@ var Mr = "seed-opfs-files-manager-styles", Nr = "seed-opfs-files-manager", Pr =
|
|
|
3153
3163
|
.seed-fm-thumb img { transition: none; }
|
|
3154
3164
|
}
|
|
3155
3165
|
`}\n}`;
|
|
3156
|
-
function
|
|
3166
|
+
function zr() {
|
|
3157
3167
|
if (typeof document > "u" || document.getElementById("seed-opfs-files-manager-styles")) return;
|
|
3158
3168
|
let e = document.createElement("style");
|
|
3159
|
-
e.id =
|
|
3169
|
+
e.id = Pr, e.textContent = Rr, document.head.appendChild(e);
|
|
3160
3170
|
}
|
|
3161
3171
|
//#endregion
|
|
3162
3172
|
//#region src/OPFSFilesManager/useStorageEstimate.ts
|
|
3163
|
-
function
|
|
3173
|
+
function Br(e) {
|
|
3164
3174
|
let [t, n] = c(null);
|
|
3165
3175
|
return i(() => {
|
|
3166
3176
|
if (typeof navigator > "u" || typeof navigator.storage?.estimate != "function") return;
|
|
@@ -3177,40 +3187,40 @@ function Rr(e) {
|
|
|
3177
3187
|
}
|
|
3178
3188
|
//#endregion
|
|
3179
3189
|
//#region src/OPFSFilesManager/zip.ts
|
|
3180
|
-
var
|
|
3181
|
-
function
|
|
3182
|
-
if (
|
|
3183
|
-
|
|
3190
|
+
var Vr = null;
|
|
3191
|
+
function Hr() {
|
|
3192
|
+
if (Vr) return Vr;
|
|
3193
|
+
Vr = /* @__PURE__ */ new Uint32Array(256);
|
|
3184
3194
|
for (let e = 0; e < 256; e++) {
|
|
3185
3195
|
let t = e;
|
|
3186
3196
|
for (let e = 0; e < 8; e++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
3187
|
-
|
|
3197
|
+
Vr[e] = t >>> 0;
|
|
3188
3198
|
}
|
|
3189
|
-
return
|
|
3199
|
+
return Vr;
|
|
3190
3200
|
}
|
|
3191
|
-
function
|
|
3192
|
-
let t =
|
|
3201
|
+
function Ur(e) {
|
|
3202
|
+
let t = Hr(), n = 4294967295;
|
|
3193
3203
|
for (let r = 0; r < e.length; r++) n = t[(n ^ e[r]) & 255] ^ n >>> 8;
|
|
3194
3204
|
return (n ^ 4294967295) >>> 0;
|
|
3195
3205
|
}
|
|
3196
|
-
function
|
|
3206
|
+
function Wr(e) {
|
|
3197
3207
|
let t = new Date(e), n = Math.max(1980, t.getFullYear());
|
|
3198
3208
|
return {
|
|
3199
3209
|
time: t.getHours() << 11 | t.getMinutes() << 5 | Math.floor(t.getSeconds() / 2),
|
|
3200
3210
|
date: n - 1980 << 9 | t.getMonth() + 1 << 5 | t.getDate()
|
|
3201
3211
|
};
|
|
3202
3212
|
}
|
|
3203
|
-
var
|
|
3204
|
-
async function
|
|
3213
|
+
var Gr = 2048, Kr = 4294967295;
|
|
3214
|
+
async function qr(e) {
|
|
3205
3215
|
if (e.length > 65535) throw Error("Too many files for a ZIP archive (max 65,535).");
|
|
3206
3216
|
let t = new TextEncoder(), n = [], r = [], i = 0;
|
|
3207
3217
|
for (let a of e) {
|
|
3208
|
-
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s =
|
|
3209
|
-
if (i + o.length + 30 + e.length >
|
|
3218
|
+
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s = Ur(o), { time: c, date: l } = Wr(a.lastModified ?? Date.now());
|
|
3219
|
+
if (i + o.length + 30 + e.length > Kr) throw Error("Selection is too large for a ZIP archive (max 4 GB).");
|
|
3210
3220
|
let u = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(30));
|
|
3211
|
-
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6,
|
|
3221
|
+
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6, Gr, !0), u.setUint16(8, 0, !0), u.setUint16(10, c, !0), u.setUint16(12, l, !0), u.setUint32(14, s, !0), u.setUint32(18, o.length, !0), u.setUint32(22, o.length, !0), u.setUint16(26, e.length, !0), u.setUint16(28, 0, !0), n.push(u.buffer, e, o);
|
|
3212
3222
|
let d = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(46));
|
|
3213
|
-
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8,
|
|
3223
|
+
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, Gr, !0), d.setUint16(10, 0, !0), d.setUint16(12, c, !0), d.setUint16(14, l, !0), d.setUint32(16, s, !0), d.setUint32(20, o.length, !0), d.setUint32(24, o.length, !0), d.setUint16(28, e.length, !0), d.setUint32(42, i, !0);
|
|
3214
3224
|
let f = new Uint8Array(46 + e.length);
|
|
3215
3225
|
f.set(new Uint8Array(d.buffer), 0), f.set(e, 46), r.push(f), i += 30 + e.length + o.length;
|
|
3216
3226
|
}
|
|
@@ -3223,12 +3233,12 @@ async function Gr(e) {
|
|
|
3223
3233
|
}
|
|
3224
3234
|
//#endregion
|
|
3225
3235
|
//#region src/OPFSFilesManager/OPFSFilesManager.tsx
|
|
3226
|
-
var
|
|
3227
|
-
function
|
|
3236
|
+
var Jr = "Everything this app stores in the browser’s private file system (OPFS).", Yr = 4e3, Xr = (e) => e instanceof Error ? e.message : String(e), Zr = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, Qr = (e) => (e ?? "").split("/").filter(Boolean).join("/");
|
|
3237
|
+
function $r(e, t) {
|
|
3228
3238
|
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
3229
3239
|
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
3230
3240
|
}
|
|
3231
|
-
function
|
|
3241
|
+
function ei() {
|
|
3232
3242
|
let [e, t] = c([]), r = s(/* @__PURE__ */ new Set());
|
|
3233
3243
|
return i(() => {
|
|
3234
3244
|
let e = r.current;
|
|
@@ -3244,12 +3254,12 @@ function Qr() {
|
|
|
3244
3254
|
}]);
|
|
3245
3255
|
let a = setTimeout(() => {
|
|
3246
3256
|
r.current.delete(a), t((e) => e.filter((e) => e.id !== i));
|
|
3247
|
-
},
|
|
3257
|
+
}, Yr);
|
|
3248
3258
|
r.current.add(a);
|
|
3249
3259
|
}, [])
|
|
3250
3260
|
};
|
|
3251
3261
|
}
|
|
3252
|
-
var
|
|
3262
|
+
var ti = [
|
|
3253
3263
|
"image",
|
|
3254
3264
|
"database",
|
|
3255
3265
|
"json",
|
|
@@ -3257,195 +3267,195 @@ var $r = [
|
|
|
3257
3267
|
"text",
|
|
3258
3268
|
"other"
|
|
3259
3269
|
];
|
|
3260
|
-
function
|
|
3261
|
-
let n =
|
|
3262
|
-
label:
|
|
3270
|
+
function ni({ files: e, estimate: t }) {
|
|
3271
|
+
let n = sr(e), r = e.reduce((e, t) => e + t.size, 0), i = t ? Math.max(0, t.usage - r) : 0, a = r + i, o = [...ti.filter((e) => n[e] > 0).map((e) => ({
|
|
3272
|
+
label: wr[e].label,
|
|
3263
3273
|
size: n[e],
|
|
3264
|
-
color:
|
|
3274
|
+
color: wr[e].color
|
|
3265
3275
|
})), ...i > 0 ? [{
|
|
3266
3276
|
label: "Other site data",
|
|
3267
3277
|
size: i,
|
|
3268
3278
|
color: "var(--seed-border-strong)"
|
|
3269
3279
|
}] : []];
|
|
3270
|
-
return /* @__PURE__ */
|
|
3280
|
+
return /* @__PURE__ */ H("div", {
|
|
3271
3281
|
className: "seed-fm-usage",
|
|
3272
3282
|
title: "From navigator.storage.estimate(). Browsers round these numbers.",
|
|
3273
|
-
children: [/* @__PURE__ */
|
|
3283
|
+
children: [/* @__PURE__ */ H("div", {
|
|
3274
3284
|
className: "seed-fm-usage-row",
|
|
3275
|
-
children: [/* @__PURE__ */
|
|
3276
|
-
/* @__PURE__ */
|
|
3285
|
+
children: [/* @__PURE__ */ H("span", { children: [
|
|
3286
|
+
/* @__PURE__ */ V("strong", { children: Q(t ? t.usage : r) }),
|
|
3277
3287
|
" ",
|
|
3278
|
-
t ? "used by this site" : `in ${
|
|
3279
|
-
] }), t && /* @__PURE__ */
|
|
3280
|
-
}), a > 0 && /* @__PURE__ */
|
|
3288
|
+
t ? "used by this site" : `in ${Zr(e.length, "file")}`
|
|
3289
|
+
] }), t && /* @__PURE__ */ H("span", { children: [Q(t.quota), " available"] })]
|
|
3290
|
+
}), a > 0 && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
|
|
3281
3291
|
className: "seed-fm-meter",
|
|
3282
3292
|
role: "img",
|
|
3283
3293
|
"aria-label": "Storage used, by file type",
|
|
3284
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3294
|
+
children: o.map((e) => /* @__PURE__ */ V("span", { style: {
|
|
3285
3295
|
width: `${e.size / a * 100}%`,
|
|
3286
3296
|
background: e.color
|
|
3287
3297
|
} }, e.label))
|
|
3288
|
-
}), /* @__PURE__ */
|
|
3298
|
+
}), /* @__PURE__ */ V("ul", {
|
|
3289
3299
|
className: "seed-fm-legend",
|
|
3290
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3300
|
+
children: o.map((e) => /* @__PURE__ */ H("li", {
|
|
3291
3301
|
style: { "--seed-swatch": e.color },
|
|
3292
3302
|
children: [
|
|
3293
3303
|
e.label,
|
|
3294
3304
|
" ",
|
|
3295
|
-
|
|
3305
|
+
Q(e.size)
|
|
3296
3306
|
]
|
|
3297
3307
|
}, e.label))
|
|
3298
3308
|
})] })]
|
|
3299
3309
|
});
|
|
3300
3310
|
}
|
|
3301
|
-
function
|
|
3302
|
-
return /* @__PURE__ */
|
|
3311
|
+
function ri({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3312
|
+
return /* @__PURE__ */ H("div", {
|
|
3303
3313
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3304
3314
|
role: r === "error" ? "alert" : void 0,
|
|
3305
3315
|
children: [
|
|
3306
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ V("span", {
|
|
3307
3317
|
className: "seed-fm-state-icon",
|
|
3308
|
-
children: /* @__PURE__ */
|
|
3318
|
+
children: /* @__PURE__ */ V($, {
|
|
3309
3319
|
name: e,
|
|
3310
3320
|
size: 22
|
|
3311
3321
|
})
|
|
3312
3322
|
}),
|
|
3313
|
-
/* @__PURE__ */
|
|
3314
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ V("h3", { children: t }),
|
|
3324
|
+
/* @__PURE__ */ V("p", { children: n }),
|
|
3315
3325
|
i
|
|
3316
3326
|
]
|
|
3317
3327
|
});
|
|
3318
3328
|
}
|
|
3319
|
-
function
|
|
3329
|
+
function ii({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDownload: l, title: u = "Files", description: d = Jr, headingLevel: f = 2, theme: p = "system", className: m, classNames: h = {}, defaultView: g, groupImageVariants: _ = !0, deleteWarning: v = cr, confirmDelete: y, deleteAction: b, onNotify: x }) {
|
|
3320
3330
|
a(() => {
|
|
3321
|
-
p !== "none" &&
|
|
3331
|
+
p !== "none" && zr();
|
|
3322
3332
|
}, [p]);
|
|
3323
|
-
let S =
|
|
3324
|
-
i(() =>
|
|
3325
|
-
let
|
|
3326
|
-
i(() =>
|
|
3327
|
-
let [
|
|
3328
|
-
x ? x(e, t, n) :
|
|
3329
|
-
},
|
|
3330
|
-
query:
|
|
3331
|
-
sort:
|
|
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 } = Pn({ rootPath: e }), O = o(() => t ? T.filter(t) : T, [T, t]), k = Br(T), [A, re] = c(_);
|
|
3334
|
+
i(() => re(_), [_]);
|
|
3335
|
+
let ie = o(() => rr(O, A), [O, A]), [j, ae] = c(S);
|
|
3336
|
+
i(() => ae(S), [S]);
|
|
3337
|
+
let [oe, M] = c(""), [se, ce] = c("name"), [le, ue] = c(g), [N, P] = c(() => /* @__PURE__ */ new Set()), de = s(null), [F, I] = c(null), fe = s(null), [L, R] = c(null), [z, pe] = c(null), [me, he] = c(!1), { toasts: ge, showToast: _e } = ei(), ve = (e, t, n) => {
|
|
3338
|
+
x ? x(e, t, n) : _e(e, t);
|
|
3339
|
+
}, ye = o(() => ar(ie, j, {
|
|
3340
|
+
query: oe,
|
|
3341
|
+
sort: se
|
|
3332
3342
|
}), [
|
|
3333
|
-
|
|
3343
|
+
ie,
|
|
3344
|
+
j,
|
|
3334
3345
|
oe,
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
]), U = H.entries, be = U.length ? U.filter((e) => $(e.file) === "image").length / U.length : 0, xe = de ?? (be >= .5 ? "grid" : "list"), W = o(() => new Map(ae.map((e) => [e.file.path, e])), [ae]), Se = o(() => [...j].map((e) => W.get(e)).filter((e) => !!e), [j, W]), G = pe ? W.get(pe) ?? null : null, K = G ? U.indexOf(G) : -1;
|
|
3346
|
+
se
|
|
3347
|
+
]), U = ye.entries, be = U.length ? U.filter((e) => Yn(e.file) === "image").length / U.length : 0, xe = le ?? (be >= .5 ? "grid" : "list"), Se = o(() => new Map(ie.map((e) => [e.file.path, e])), [ie]), W = o(() => [...N].map((e) => Se.get(e)).filter((e) => !!e), [N, Se]), G = F ? Se.get(F) ?? null : null, K = G ? U.indexOf(G) : -1;
|
|
3338
3348
|
i(() => {
|
|
3339
|
-
|
|
3340
|
-
let t = new Set([...e].filter((e) =>
|
|
3349
|
+
P((e) => {
|
|
3350
|
+
let t = new Set([...e].filter((e) => Se.has(e)));
|
|
3341
3351
|
return t.size === e.size ? e : t;
|
|
3342
3352
|
});
|
|
3343
|
-
}, [
|
|
3353
|
+
}, [Se]);
|
|
3344
3354
|
let Ce = (e) => {
|
|
3345
|
-
|
|
3346
|
-
},
|
|
3347
|
-
let r =
|
|
3348
|
-
|
|
3355
|
+
ae(e), M(""), P(/* @__PURE__ */ new Set()), de.current = null, I(null);
|
|
3356
|
+
}, q = (e, t, n) => {
|
|
3357
|
+
let r = de.current;
|
|
3358
|
+
P((i) => {
|
|
3349
3359
|
let a = new Set(i);
|
|
3350
3360
|
if (n && r != null) {
|
|
3351
3361
|
let [e, n] = r < t ? [r, t] : [t, r];
|
|
3352
3362
|
for (let t of U.slice(e, n + 1)) a.add(t.file.path);
|
|
3353
3363
|
} else a.has(e.file.path) ? a.delete(e.file.path) : a.add(e.file.path);
|
|
3354
3364
|
return a;
|
|
3355
|
-
}), (!n || r == null) && (
|
|
3356
|
-
},
|
|
3357
|
-
|
|
3358
|
-
},
|
|
3359
|
-
|
|
3360
|
-
},
|
|
3365
|
+
}), (!n || r == null) && (de.current = t);
|
|
3366
|
+
}, we = (e) => {
|
|
3367
|
+
F || (fe.current = document.activeElement), I(e);
|
|
3368
|
+
}, Te = () => {
|
|
3369
|
+
I(null), fe.current?.focus?.(), fe.current = null;
|
|
3370
|
+
}, Ee = (e, t, n) => {
|
|
3361
3371
|
let r = n.shiftKey || n.metaKey || n.ctrlKey;
|
|
3362
|
-
|
|
3363
|
-
},
|
|
3364
|
-
let e = U.every((e) =>
|
|
3365
|
-
|
|
3372
|
+
N.size > 0 || r ? q(e, t, n.shiftKey) : we(e.file.path);
|
|
3373
|
+
}, De = () => {
|
|
3374
|
+
let e = U.every((e) => N.has(e.file.path));
|
|
3375
|
+
P((t) => {
|
|
3366
3376
|
let n = new Set(t);
|
|
3367
3377
|
for (let t of U) e ? n.delete(t.file.path) : n.add(t.file.path);
|
|
3368
3378
|
return n;
|
|
3369
3379
|
});
|
|
3370
|
-
},
|
|
3371
|
-
l ? await l(e, t) :
|
|
3372
|
-
},
|
|
3380
|
+
}, Oe = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, ke = async (e, t) => {
|
|
3381
|
+
l ? await l(e, t) : $r(e.name, t);
|
|
3382
|
+
}, J = async (e, t) => {
|
|
3373
3383
|
if (e.length === 0) return !1;
|
|
3374
|
-
|
|
3384
|
+
he(!0);
|
|
3375
3385
|
try {
|
|
3376
3386
|
if (e.length === 1 && !t) {
|
|
3377
3387
|
let [t] = e;
|
|
3378
|
-
return await
|
|
3388
|
+
return await ke(t, await wn(t.path)), !0;
|
|
3379
3389
|
}
|
|
3380
|
-
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await
|
|
3381
|
-
name: t ? e.path.slice(n.length) :
|
|
3382
|
-
data: await
|
|
3390
|
+
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) : Oe(e.path),
|
|
3392
|
+
data: await wn(e.path),
|
|
3383
3393
|
lastModified: e.lastModified
|
|
3384
3394
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3385
|
-
return await
|
|
3395
|
+
return await ke({
|
|
3386
3396
|
name: i,
|
|
3387
3397
|
path: i,
|
|
3388
3398
|
size: r.size,
|
|
3389
3399
|
type: "application/zip",
|
|
3390
3400
|
lastModified: Date.now()
|
|
3391
|
-
}, r),
|
|
3401
|
+
}, r), ve(`Saved ${i} with ${Zr(e.length, "file")}`, "success", {
|
|
3392
3402
|
kind: "download",
|
|
3393
3403
|
paths: e.map((e) => e.path),
|
|
3394
3404
|
fileName: i
|
|
3395
3405
|
}), !0;
|
|
3396
3406
|
} catch (t) {
|
|
3397
|
-
return
|
|
3407
|
+
return ve(`Couldn’t download: ${Xr(t)}`, "error", {
|
|
3398
3408
|
kind: "download",
|
|
3399
3409
|
paths: e.map((e) => e.path),
|
|
3400
|
-
error:
|
|
3410
|
+
error: Xr(t)
|
|
3401
3411
|
}), !1;
|
|
3402
3412
|
} finally {
|
|
3403
|
-
|
|
3413
|
+
he(!1);
|
|
3404
3414
|
}
|
|
3405
|
-
},
|
|
3415
|
+
}, Ae = (e) => J(e.map((e) => e.file)), Y = (e, t) => e.flatMap((e) => [e.file, ...t ? e.variants.map((e) => e.file) : []]), je = (e) => {
|
|
3406
3416
|
let t = b?.(e);
|
|
3407
3417
|
return {
|
|
3408
3418
|
label: t?.label,
|
|
3409
3419
|
destructive: t?.destructive !== !1
|
|
3410
3420
|
};
|
|
3411
|
-
},
|
|
3412
|
-
|
|
3421
|
+
}, Me = (e) => je(Y(e, !0)), Ne = async (e, t) => {
|
|
3422
|
+
he(!0);
|
|
3413
3423
|
let i = [], a = [], o = [], s = !1;
|
|
3414
3424
|
try {
|
|
3415
3425
|
let r = await navigator.storage.getDirectory();
|
|
3416
3426
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3417
3427
|
else try {
|
|
3418
|
-
await
|
|
3428
|
+
await Tn(t.path, r), i.push(t.path);
|
|
3419
3429
|
} catch (e) {
|
|
3420
3430
|
a.push({
|
|
3421
3431
|
path: t.path,
|
|
3422
|
-
error:
|
|
3432
|
+
error: Xr(e)
|
|
3423
3433
|
});
|
|
3424
3434
|
}
|
|
3425
3435
|
if (t) try {
|
|
3426
|
-
s = await
|
|
3436
|
+
s = await Dn(t.path, r);
|
|
3427
3437
|
} catch (e) {
|
|
3428
3438
|
a.push({
|
|
3429
3439
|
path: t.path,
|
|
3430
|
-
error:
|
|
3440
|
+
error: Xr(e)
|
|
3431
3441
|
});
|
|
3432
3442
|
}
|
|
3433
3443
|
} catch (e) {
|
|
3434
3444
|
a.push({
|
|
3435
3445
|
path: "",
|
|
3436
|
-
error:
|
|
3446
|
+
error: Xr(e)
|
|
3437
3447
|
});
|
|
3438
3448
|
}
|
|
3439
|
-
|
|
3449
|
+
P((e) => {
|
|
3440
3450
|
let t = new Set(e);
|
|
3441
3451
|
return i.forEach((e) => t.delete(e)), t;
|
|
3442
|
-
}),
|
|
3443
|
-
let c = [s ? `Deleted the ${t.name} folder (${
|
|
3452
|
+
}), F && i.includes(F) && I(null), await ne(), he(!1);
|
|
3453
|
+
let c = [s ? `Deleted the ${t.name} folder (${Zr(i.length, "file")})` : i.length > 0 ? `Deleted ${Zr(i.length, "file")}` : "Nothing deleted"];
|
|
3444
3454
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3445
3455
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3446
3456
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
3447
3457
|
}
|
|
3448
|
-
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`),
|
|
3458
|
+
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`), ve(c.join(". "), a.length ? "error" : "success", {
|
|
3449
3459
|
kind: "delete",
|
|
3450
3460
|
deleted: i,
|
|
3451
3461
|
skipped: o,
|
|
@@ -3455,367 +3465,367 @@ function ni({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3455
3465
|
folderRemoved: s
|
|
3456
3466
|
}
|
|
3457
3467
|
}), i.length > 0 && await r?.(i);
|
|
3458
|
-
},
|
|
3468
|
+
}, X = async (e) => {
|
|
3459
3469
|
if (e.length === 0) return;
|
|
3460
3470
|
if (!y) {
|
|
3461
|
-
|
|
3471
|
+
R(e);
|
|
3462
3472
|
return;
|
|
3463
3473
|
}
|
|
3464
|
-
let t =
|
|
3465
|
-
await y(t) && await
|
|
3466
|
-
},
|
|
3474
|
+
let t = Y(e, !0);
|
|
3475
|
+
await y(t) && await Ne(t);
|
|
3476
|
+
}, Pe = (e) => O.filter((t) => t.path.startsWith(`${e.path}/`)), Fe = async (e) => {
|
|
3467
3477
|
if (!y) {
|
|
3468
|
-
|
|
3478
|
+
pe(e);
|
|
3469
3479
|
return;
|
|
3470
3480
|
}
|
|
3471
|
-
let t =
|
|
3472
|
-
await y(t) && await
|
|
3473
|
-
},
|
|
3474
|
-
let t = () =>
|
|
3481
|
+
let t = Pe(e);
|
|
3482
|
+
await y(t) && await Ne(t, e);
|
|
3483
|
+
}, Ie = (e) => {
|
|
3484
|
+
let t = () => ve("Path copied", "success", {
|
|
3475
3485
|
kind: "copy-path",
|
|
3476
3486
|
path: e
|
|
3477
|
-
}), n = (t) =>
|
|
3487
|
+
}), n = (t) => ve("Couldn’t copy. Select the path text instead.", "error", {
|
|
3478
3488
|
kind: "copy-path",
|
|
3479
3489
|
path: e,
|
|
3480
|
-
error: t === void 0 ? "Clipboard unavailable" :
|
|
3490
|
+
error: t === void 0 ? "Clipboard unavailable" : Xr(t)
|
|
3481
3491
|
});
|
|
3482
3492
|
try {
|
|
3483
3493
|
navigator.clipboard.writeText(e).then(t, n);
|
|
3484
3494
|
} catch (e) {
|
|
3485
3495
|
n(e);
|
|
3486
3496
|
}
|
|
3487
|
-
},
|
|
3488
|
-
if (
|
|
3497
|
+
}, Le = (e) => {
|
|
3498
|
+
if (L || z) return;
|
|
3489
3499
|
let t = e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement;
|
|
3490
3500
|
if (e.key === "Escape") {
|
|
3491
|
-
if (
|
|
3492
|
-
else if (
|
|
3501
|
+
if (F) Te();
|
|
3502
|
+
else if (N.size > 0) P(/* @__PURE__ */ new Set());
|
|
3493
3503
|
else return;
|
|
3494
3504
|
e.preventDefault();
|
|
3495
3505
|
} else if (G && !t && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
3496
3506
|
let t = U[K + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3497
|
-
t &&
|
|
3507
|
+
t && I(t.file.path), e.preventDefault();
|
|
3498
3508
|
}
|
|
3499
|
-
},
|
|
3509
|
+
}, Re = o(() => O.some((e) => er(e.path)), [O]), ze = /(^|\/)images(\/\d+)?$/.test(j), Be = [{
|
|
3500
3510
|
label: C,
|
|
3501
3511
|
path: S
|
|
3502
|
-
}, ...(
|
|
3512
|
+
}, ...(j.length > S.length ? j.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3503
3513
|
label: e,
|
|
3504
3514
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3505
|
-
}))],
|
|
3506
|
-
if (!
|
|
3515
|
+
}))], Ve = `h${f}`, He = W.reduce((e, t) => e + t.file.size, 0), Ue;
|
|
3516
|
+
if (!On()) Ue = /* @__PURE__ */ V(ri, {
|
|
3507
3517
|
icon: "triangleAlert",
|
|
3508
3518
|
tone: "error",
|
|
3509
3519
|
title: "This browser doesn’t support private file storage",
|
|
3510
3520
|
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."
|
|
3511
3521
|
});
|
|
3512
|
-
else if (
|
|
3513
|
-
let e = /* @__PURE__ */
|
|
3522
|
+
else if (te) {
|
|
3523
|
+
let e = /* @__PURE__ */ H("button", {
|
|
3514
3524
|
type: "button",
|
|
3515
3525
|
className: "seed-fm-btn",
|
|
3516
|
-
onClick: () =>
|
|
3517
|
-
children: [/* @__PURE__ */
|
|
3526
|
+
onClick: () => ne(),
|
|
3527
|
+
children: [/* @__PURE__ */ V($, {
|
|
3518
3528
|
name: "refresh",
|
|
3519
3529
|
size: 15
|
|
3520
3530
|
}), " Try again"]
|
|
3521
3531
|
});
|
|
3522
|
-
|
|
3532
|
+
Ue = D === "NotFoundError" && S ? /* @__PURE__ */ H(ri, {
|
|
3523
3533
|
icon: "triangleAlert",
|
|
3524
3534
|
tone: "error",
|
|
3525
3535
|
title: `Can’t open ${S}`,
|
|
3526
3536
|
action: e,
|
|
3527
3537
|
children: [
|
|
3528
3538
|
"The folder ",
|
|
3529
|
-
/* @__PURE__ */
|
|
3539
|
+
/* @__PURE__ */ V("code", { children: S }),
|
|
3530
3540
|
" doesn’t exist in this browser’s private storage yet. Check the",
|
|
3531
3541
|
" ",
|
|
3532
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ V("code", { children: "rootPath" }),
|
|
3533
3543
|
" prop, or open the app once so the SDK creates it."
|
|
3534
3544
|
]
|
|
3535
|
-
}) : /* @__PURE__ */
|
|
3545
|
+
}) : /* @__PURE__ */ V(ri, {
|
|
3536
3546
|
icon: "triangleAlert",
|
|
3537
3547
|
tone: "error",
|
|
3538
3548
|
title: "Can’t read private storage",
|
|
3539
3549
|
action: e,
|
|
3540
|
-
children:
|
|
3550
|
+
children: te
|
|
3541
3551
|
});
|
|
3542
|
-
} else
|
|
3552
|
+
} else Ue = E ? ie.length === 0 ? /* @__PURE__ */ V(ri, {
|
|
3543
3553
|
icon: "folderOpen",
|
|
3544
3554
|
title: `No files in ${C} yet`,
|
|
3545
3555
|
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."
|
|
3546
|
-
}) :
|
|
3556
|
+
}) : ye.folders.length === 0 && U.length === 0 ? oe ? /* @__PURE__ */ H(ri, {
|
|
3547
3557
|
icon: "search",
|
|
3548
|
-
title: `No matches for “${
|
|
3549
|
-
action: /* @__PURE__ */
|
|
3558
|
+
title: `No matches for “${oe}”`,
|
|
3559
|
+
action: /* @__PURE__ */ V("button", {
|
|
3550
3560
|
type: "button",
|
|
3551
3561
|
className: "seed-fm-btn",
|
|
3552
|
-
onClick: () =>
|
|
3562
|
+
onClick: () => M(""),
|
|
3553
3563
|
children: "Clear search"
|
|
3554
3564
|
}),
|
|
3555
3565
|
children: [
|
|
3556
3566
|
"Search covers file names and paths in ",
|
|
3557
|
-
|
|
3567
|
+
Be[Be.length - 1].label,
|
|
3558
3568
|
" and every folder inside it."
|
|
3559
3569
|
]
|
|
3560
|
-
}) : /* @__PURE__ */
|
|
3570
|
+
}) : /* @__PURE__ */ V(ri, {
|
|
3561
3571
|
icon: "folderOpen",
|
|
3562
3572
|
title: "This folder is empty",
|
|
3563
3573
|
children: "Everything in it has been deleted or filtered out."
|
|
3564
|
-
}) : /* @__PURE__ */
|
|
3574
|
+
}) : /* @__PURE__ */ H(B, { children: [ye.folders.length > 0 && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
|
|
3565
3575
|
className: "seed-fm-section-label",
|
|
3566
3576
|
children: "Folders"
|
|
3567
|
-
}), /* @__PURE__ */
|
|
3577
|
+
}), /* @__PURE__ */ V("ul", {
|
|
3568
3578
|
className: "seed-fm-folders",
|
|
3569
|
-
children:
|
|
3579
|
+
children: ye.folders.map((e) => /* @__PURE__ */ H("li", { children: [/* @__PURE__ */ H("button", {
|
|
3570
3580
|
type: "button",
|
|
3571
3581
|
className: w("folder", "seed-fm-folder"),
|
|
3572
3582
|
onClick: () => Ce(e.path),
|
|
3573
|
-
children: [/* @__PURE__ */
|
|
3583
|
+
children: [/* @__PURE__ */ V($, {
|
|
3574
3584
|
name: "folder",
|
|
3575
3585
|
size: 20,
|
|
3576
3586
|
strokeWidth: 1.75
|
|
3577
|
-
}), /* @__PURE__ */
|
|
3587
|
+
}), /* @__PURE__ */ H("span", { children: [/* @__PURE__ */ V("span", {
|
|
3578
3588
|
className: "seed-fm-folder-name",
|
|
3579
3589
|
children: e.name
|
|
3580
|
-
}), /* @__PURE__ */
|
|
3590
|
+
}), /* @__PURE__ */ H("span", {
|
|
3581
3591
|
className: "seed-fm-folder-meta",
|
|
3582
3592
|
children: [
|
|
3583
|
-
|
|
3593
|
+
Zr(e.fileCount, "file"),
|
|
3584
3594
|
" · ",
|
|
3585
|
-
|
|
3595
|
+
Q(e.size)
|
|
3586
3596
|
]
|
|
3587
3597
|
})] })]
|
|
3588
|
-
}), /* @__PURE__ */
|
|
3598
|
+
}), /* @__PURE__ */ V("button", {
|
|
3589
3599
|
type: "button",
|
|
3590
3600
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon seed-fm-folder-delete",
|
|
3591
3601
|
"aria-label": `Delete folder ${e.name}`,
|
|
3592
3602
|
title: "Delete folder",
|
|
3593
|
-
disabled:
|
|
3594
|
-
onClick: () =>
|
|
3595
|
-
children: /* @__PURE__ */
|
|
3603
|
+
disabled: me,
|
|
3604
|
+
onClick: () => Fe(e),
|
|
3605
|
+
children: /* @__PURE__ */ V($, {
|
|
3596
3606
|
name: "trash",
|
|
3597
3607
|
size: 15
|
|
3598
3608
|
})
|
|
3599
3609
|
})] }, e.path))
|
|
3600
|
-
})] }), U.length > 0 && /* @__PURE__ */
|
|
3610
|
+
})] }), U.length > 0 && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
|
|
3601
3611
|
className: "seed-fm-section-label",
|
|
3602
|
-
children:
|
|
3603
|
-
}), xe === "grid" ? /* @__PURE__ */
|
|
3612
|
+
children: oe ? Zr(U.length, "result") : "Files"
|
|
3613
|
+
}), xe === "grid" ? /* @__PURE__ */ V(Or, {
|
|
3604
3614
|
entries: U,
|
|
3605
|
-
selected:
|
|
3606
|
-
onActivate:
|
|
3607
|
-
onToggle:
|
|
3615
|
+
selected: N,
|
|
3616
|
+
onActivate: Ee,
|
|
3617
|
+
onToggle: q,
|
|
3608
3618
|
className: h.grid,
|
|
3609
3619
|
tileClassName: h.tile
|
|
3610
|
-
}) : /* @__PURE__ */
|
|
3620
|
+
}) : /* @__PURE__ */ V(kr, {
|
|
3611
3621
|
entries: U,
|
|
3612
|
-
selected:
|
|
3613
|
-
cwd:
|
|
3614
|
-
onActivate:
|
|
3615
|
-
onToggle:
|
|
3616
|
-
onToggleAll:
|
|
3617
|
-
onDownload: (e) =>
|
|
3618
|
-
onDelete: (e) =>
|
|
3619
|
-
deleteActionFor: (e) =>
|
|
3622
|
+
selected: N,
|
|
3623
|
+
cwd: j,
|
|
3624
|
+
onActivate: Ee,
|
|
3625
|
+
onToggle: q,
|
|
3626
|
+
onToggleAll: De,
|
|
3627
|
+
onDownload: (e) => Ae([e]),
|
|
3628
|
+
onDelete: (e) => X([e]),
|
|
3629
|
+
deleteActionFor: (e) => Me([e]),
|
|
3620
3630
|
className: h.list,
|
|
3621
3631
|
rowClassName: h.row
|
|
3622
|
-
})] })] }) : /* @__PURE__ */
|
|
3632
|
+
})] })] }) : /* @__PURE__ */ V("ul", {
|
|
3623
3633
|
className: w("grid", "seed-fm-grid"),
|
|
3624
3634
|
"aria-busy": "true",
|
|
3625
3635
|
"aria-label": "Loading files",
|
|
3626
|
-
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */
|
|
3636
|
+
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ V("li", {
|
|
3627
3637
|
className: "seed-fm-tile",
|
|
3628
|
-
children: /* @__PURE__ */
|
|
3638
|
+
children: /* @__PURE__ */ V("span", { className: "seed-fm-thumb seed-fm-skeleton" })
|
|
3629
3639
|
}, t))
|
|
3630
3640
|
});
|
|
3631
|
-
let
|
|
3632
|
-
return /* @__PURE__ */
|
|
3641
|
+
let We = L ? Y(L, !0) : [], Z = z ? Pe(z) : [], Ge = N.size > 0 ? Me(W) : null;
|
|
3642
|
+
return /* @__PURE__ */ H("div", {
|
|
3633
3643
|
className: [w("root", "seed-fm"), m].filter(Boolean).join(" "),
|
|
3634
3644
|
"data-seed-theme": p === "none" ? void 0 : p,
|
|
3635
|
-
"data-selecting":
|
|
3636
|
-
onKeyDown:
|
|
3645
|
+
"data-selecting": N.size > 0 || void 0,
|
|
3646
|
+
onKeyDown: Le,
|
|
3637
3647
|
children: [
|
|
3638
|
-
/* @__PURE__ */
|
|
3648
|
+
/* @__PURE__ */ H("div", {
|
|
3639
3649
|
className: "seed-fm-frame",
|
|
3640
3650
|
children: [
|
|
3641
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ H("header", {
|
|
3642
3652
|
className: w("header", "seed-fm-header"),
|
|
3643
3653
|
children: [
|
|
3644
|
-
/* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ H("div", {
|
|
3645
3655
|
className: "seed-fm-titles",
|
|
3646
|
-
children: [/* @__PURE__ */
|
|
3656
|
+
children: [/* @__PURE__ */ V(Ve, {
|
|
3647
3657
|
className: "seed-fm-title",
|
|
3648
3658
|
children: u
|
|
3649
|
-
}), d && /* @__PURE__ */
|
|
3659
|
+
}), d && /* @__PURE__ */ V("p", {
|
|
3650
3660
|
className: "seed-fm-description",
|
|
3651
3661
|
children: d
|
|
3652
3662
|
})]
|
|
3653
3663
|
}),
|
|
3654
|
-
E && !
|
|
3655
|
-
files:
|
|
3656
|
-
estimate:
|
|
3664
|
+
E && !te && /* @__PURE__ */ V(ni, {
|
|
3665
|
+
files: O,
|
|
3666
|
+
estimate: k
|
|
3657
3667
|
}),
|
|
3658
|
-
/* @__PURE__ */
|
|
3668
|
+
/* @__PURE__ */ V("button", {
|
|
3659
3669
|
type: "button",
|
|
3660
3670
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3661
|
-
onClick: () =>
|
|
3671
|
+
onClick: () => ne(),
|
|
3662
3672
|
"aria-label": "Refresh",
|
|
3663
3673
|
title: "Refresh",
|
|
3664
3674
|
"data-busy": ee && E,
|
|
3665
|
-
children: /* @__PURE__ */
|
|
3675
|
+
children: /* @__PURE__ */ V($, {
|
|
3666
3676
|
name: "refresh",
|
|
3667
3677
|
size: 15
|
|
3668
3678
|
})
|
|
3669
3679
|
})
|
|
3670
3680
|
]
|
|
3671
3681
|
}),
|
|
3672
|
-
E && !
|
|
3682
|
+
E && !te && ie.length > 0 && /* @__PURE__ */ H("div", {
|
|
3673
3683
|
className: w("toolbar", "seed-fm-toolbar"),
|
|
3674
3684
|
children: [
|
|
3675
|
-
/* @__PURE__ */
|
|
3685
|
+
/* @__PURE__ */ V("nav", {
|
|
3676
3686
|
"aria-label": "Folder",
|
|
3677
|
-
children: /* @__PURE__ */
|
|
3687
|
+
children: /* @__PURE__ */ V("ol", {
|
|
3678
3688
|
className: "seed-fm-crumbs",
|
|
3679
|
-
children:
|
|
3689
|
+
children: Be.map((e, t) => /* @__PURE__ */ H("li", { children: [t > 0 && /* @__PURE__ */ V($, {
|
|
3680
3690
|
name: "chevronRight",
|
|
3681
3691
|
size: 14
|
|
3682
|
-
}), /* @__PURE__ */
|
|
3692
|
+
}), /* @__PURE__ */ V("button", {
|
|
3683
3693
|
type: "button",
|
|
3684
3694
|
onClick: () => Ce(e.path),
|
|
3685
|
-
"aria-current": t ===
|
|
3695
|
+
"aria-current": t === Be.length - 1 ? "page" : void 0,
|
|
3686
3696
|
children: e.label
|
|
3687
3697
|
})] }, e.path || "/"))
|
|
3688
3698
|
})
|
|
3689
3699
|
}),
|
|
3690
|
-
/* @__PURE__ */
|
|
3700
|
+
/* @__PURE__ */ H("label", {
|
|
3691
3701
|
className: "seed-fm-search",
|
|
3692
|
-
children: [/* @__PURE__ */
|
|
3702
|
+
children: [/* @__PURE__ */ V($, {
|
|
3693
3703
|
name: "search",
|
|
3694
3704
|
size: 14
|
|
3695
|
-
}), /* @__PURE__ */
|
|
3705
|
+
}), /* @__PURE__ */ V("input", {
|
|
3696
3706
|
type: "search",
|
|
3697
|
-
value:
|
|
3698
|
-
onChange: (e) =>
|
|
3707
|
+
value: oe,
|
|
3708
|
+
onChange: (e) => M(e.target.value),
|
|
3699
3709
|
placeholder: "Search names and paths",
|
|
3700
3710
|
"aria-label": "Search files"
|
|
3701
3711
|
})]
|
|
3702
3712
|
}),
|
|
3703
|
-
/* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ H("select", {
|
|
3704
3714
|
className: "seed-fm-select",
|
|
3705
|
-
value:
|
|
3706
|
-
onChange: (e) =>
|
|
3715
|
+
value: se,
|
|
3716
|
+
onChange: (e) => ce(e.target.value),
|
|
3707
3717
|
"aria-label": "Sort by",
|
|
3708
3718
|
children: [
|
|
3709
|
-
/* @__PURE__ */
|
|
3719
|
+
/* @__PURE__ */ V("option", {
|
|
3710
3720
|
value: "name",
|
|
3711
3721
|
children: "Name"
|
|
3712
3722
|
}),
|
|
3713
|
-
/* @__PURE__ */
|
|
3723
|
+
/* @__PURE__ */ V("option", {
|
|
3714
3724
|
value: "modified",
|
|
3715
3725
|
children: "Recently modified"
|
|
3716
3726
|
}),
|
|
3717
|
-
/* @__PURE__ */
|
|
3727
|
+
/* @__PURE__ */ V("option", {
|
|
3718
3728
|
value: "size",
|
|
3719
3729
|
children: "Largest"
|
|
3720
3730
|
})
|
|
3721
3731
|
]
|
|
3722
3732
|
}),
|
|
3723
|
-
/* @__PURE__ */
|
|
3733
|
+
/* @__PURE__ */ H("div", {
|
|
3724
3734
|
className: "seed-fm-viewtoggle",
|
|
3725
3735
|
role: "group",
|
|
3726
3736
|
"aria-label": "View",
|
|
3727
|
-
children: [/* @__PURE__ */
|
|
3737
|
+
children: [/* @__PURE__ */ V("button", {
|
|
3728
3738
|
type: "button",
|
|
3729
3739
|
"aria-pressed": xe === "grid",
|
|
3730
3740
|
"aria-label": "Grid view",
|
|
3731
|
-
onClick: () =>
|
|
3732
|
-
children: /* @__PURE__ */
|
|
3741
|
+
onClick: () => ue("grid"),
|
|
3742
|
+
children: /* @__PURE__ */ V($, {
|
|
3733
3743
|
name: "layoutGrid",
|
|
3734
3744
|
size: 15
|
|
3735
3745
|
})
|
|
3736
|
-
}), /* @__PURE__ */
|
|
3746
|
+
}), /* @__PURE__ */ V("button", {
|
|
3737
3747
|
type: "button",
|
|
3738
3748
|
"aria-pressed": xe === "list",
|
|
3739
3749
|
"aria-label": "List view",
|
|
3740
|
-
onClick: () =>
|
|
3741
|
-
children: /* @__PURE__ */
|
|
3750
|
+
onClick: () => ue("list"),
|
|
3751
|
+
children: /* @__PURE__ */ V($, {
|
|
3742
3752
|
name: "list",
|
|
3743
3753
|
size: 15
|
|
3744
3754
|
})
|
|
3745
3755
|
})]
|
|
3746
3756
|
}),
|
|
3747
|
-
|
|
3757
|
+
Re && ze && /* @__PURE__ */ H("p", {
|
|
3748
3758
|
className: "seed-fm-hint",
|
|
3749
3759
|
children: [
|
|
3750
|
-
/* @__PURE__ */
|
|
3760
|
+
/* @__PURE__ */ V($, {
|
|
3751
3761
|
name: "layers",
|
|
3752
3762
|
size: 13
|
|
3753
3763
|
}),
|
|
3754
|
-
|
|
3755
|
-
/* @__PURE__ */
|
|
3764
|
+
A ? "Resized copies are grouped with their original image." : "Resized copies are shown in their size folders.",
|
|
3765
|
+
/* @__PURE__ */ V("button", {
|
|
3756
3766
|
type: "button",
|
|
3757
3767
|
className: "seed-fm-linkbtn",
|
|
3758
3768
|
onClick: () => {
|
|
3759
|
-
|
|
3769
|
+
re(!A), P(/* @__PURE__ */ new Set());
|
|
3760
3770
|
},
|
|
3761
|
-
children:
|
|
3771
|
+
children: A ? "Show as folders" : "Group with originals"
|
|
3762
3772
|
})
|
|
3763
3773
|
]
|
|
3764
3774
|
})
|
|
3765
3775
|
]
|
|
3766
3776
|
}),
|
|
3767
|
-
/* @__PURE__ */
|
|
3777
|
+
/* @__PURE__ */ V("div", {
|
|
3768
3778
|
className: w("body", "seed-fm-body"),
|
|
3769
|
-
children:
|
|
3779
|
+
children: Ue
|
|
3770
3780
|
}),
|
|
3771
|
-
|
|
3781
|
+
Ge && /* @__PURE__ */ H("div", {
|
|
3772
3782
|
className: w("batchBar", "seed-fm-batch"),
|
|
3773
3783
|
role: "toolbar",
|
|
3774
3784
|
"aria-label": "Selected files",
|
|
3775
3785
|
children: [
|
|
3776
|
-
/* @__PURE__ */
|
|
3786
|
+
/* @__PURE__ */ H("span", {
|
|
3777
3787
|
className: "seed-fm-batch-count",
|
|
3778
3788
|
"aria-live": "polite",
|
|
3779
3789
|
children: [
|
|
3780
|
-
|
|
3790
|
+
N.size,
|
|
3781
3791
|
" selected ",
|
|
3782
|
-
/* @__PURE__ */
|
|
3792
|
+
/* @__PURE__ */ H("span", { children: ["· ", Q(He)] })
|
|
3783
3793
|
]
|
|
3784
3794
|
}),
|
|
3785
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ H("button", {
|
|
3786
3796
|
type: "button",
|
|
3787
3797
|
className: "seed-fm-btn",
|
|
3788
|
-
disabled:
|
|
3789
|
-
onClick: () =>
|
|
3798
|
+
disabled: me,
|
|
3799
|
+
onClick: () => Ae(W),
|
|
3790
3800
|
children: [
|
|
3791
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ V($, {
|
|
3792
3802
|
name: "download",
|
|
3793
3803
|
size: 15
|
|
3794
3804
|
}),
|
|
3795
3805
|
" ",
|
|
3796
|
-
|
|
3806
|
+
N.size > 1 ? "Download .zip" : "Download"
|
|
3797
3807
|
]
|
|
3798
3808
|
}),
|
|
3799
|
-
/* @__PURE__ */
|
|
3809
|
+
/* @__PURE__ */ H("button", {
|
|
3800
3810
|
type: "button",
|
|
3801
|
-
className: `seed-fm-btn${
|
|
3802
|
-
disabled:
|
|
3803
|
-
onClick: () =>
|
|
3811
|
+
className: `seed-fm-btn${Ge.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
3812
|
+
disabled: me,
|
|
3813
|
+
onClick: () => X(W),
|
|
3804
3814
|
children: [
|
|
3805
|
-
/* @__PURE__ */
|
|
3815
|
+
/* @__PURE__ */ V($, {
|
|
3806
3816
|
name: "trash",
|
|
3807
3817
|
size: 15
|
|
3808
3818
|
}),
|
|
3809
3819
|
" ",
|
|
3810
|
-
|
|
3820
|
+
Ge.label ?? "Delete"
|
|
3811
3821
|
]
|
|
3812
3822
|
}),
|
|
3813
|
-
/* @__PURE__ */
|
|
3823
|
+
/* @__PURE__ */ V("button", {
|
|
3814
3824
|
type: "button",
|
|
3815
3825
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3816
3826
|
"aria-label": "Clear selection",
|
|
3817
|
-
onClick: () =>
|
|
3818
|
-
children: /* @__PURE__ */
|
|
3827
|
+
onClick: () => P(/* @__PURE__ */ new Set()),
|
|
3828
|
+
children: /* @__PURE__ */ V($, {
|
|
3819
3829
|
name: "x",
|
|
3820
3830
|
size: 15
|
|
3821
3831
|
})
|
|
@@ -3824,49 +3834,49 @@ function ni({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3824
3834
|
})
|
|
3825
3835
|
]
|
|
3826
3836
|
}),
|
|
3827
|
-
G && /* @__PURE__ */
|
|
3837
|
+
G && /* @__PURE__ */ V(Nr, {
|
|
3828
3838
|
entry: G,
|
|
3829
3839
|
className: h.panel,
|
|
3830
|
-
onClose:
|
|
3831
|
-
onPrevious: K > 0 ? () =>
|
|
3832
|
-
onNext: K >= 0 && K < U.length - 1 ? () =>
|
|
3833
|
-
onDownload: () =>
|
|
3834
|
-
onDelete: () =>
|
|
3835
|
-
deleteAction:
|
|
3836
|
-
onCopyPath: () =>
|
|
3840
|
+
onClose: Te,
|
|
3841
|
+
onPrevious: K > 0 ? () => I(U[K - 1].file.path) : null,
|
|
3842
|
+
onNext: K >= 0 && K < U.length - 1 ? () => I(U[K + 1].file.path) : null,
|
|
3843
|
+
onDownload: () => Ae([G]),
|
|
3844
|
+
onDelete: () => X([G]),
|
|
3845
|
+
deleteAction: Me([G]),
|
|
3846
|
+
onCopyPath: () => Ie(G.file.path)
|
|
3837
3847
|
}, "panel"),
|
|
3838
|
-
|
|
3839
|
-
entries:
|
|
3848
|
+
L && /* @__PURE__ */ V(Gn, {
|
|
3849
|
+
entries: L,
|
|
3840
3850
|
rootPath: S,
|
|
3841
|
-
warning: v(
|
|
3842
|
-
deleteActionFor: (e) =>
|
|
3851
|
+
warning: v(We),
|
|
3852
|
+
deleteActionFor: (e) => je(Y(L, e)),
|
|
3843
3853
|
className: h.dialog,
|
|
3844
|
-
onCancel: () =>
|
|
3854
|
+
onCancel: () => R(null),
|
|
3845
3855
|
onConfirm: (e) => {
|
|
3846
|
-
let t =
|
|
3847
|
-
|
|
3856
|
+
let t = Y(L, e);
|
|
3857
|
+
R(null), Ne(t);
|
|
3848
3858
|
}
|
|
3849
3859
|
}),
|
|
3850
|
-
|
|
3851
|
-
folder:
|
|
3852
|
-
files:
|
|
3853
|
-
hiddenCount: T.filter((e) => e.path.startsWith(`${
|
|
3854
|
-
warning: v(
|
|
3855
|
-
action:
|
|
3856
|
-
busy:
|
|
3860
|
+
z && /* @__PURE__ */ V(Kn, {
|
|
3861
|
+
folder: z,
|
|
3862
|
+
files: Z,
|
|
3863
|
+
hiddenCount: T.filter((e) => e.path.startsWith(`${z.path}/`)).length - Z.length,
|
|
3864
|
+
warning: v(Z),
|
|
3865
|
+
action: je(Z),
|
|
3866
|
+
busy: me,
|
|
3857
3867
|
className: h.dialog,
|
|
3858
|
-
onDownload: () =>
|
|
3859
|
-
onCancel: () =>
|
|
3868
|
+
onDownload: () => J(Z, z),
|
|
3869
|
+
onCancel: () => pe(null),
|
|
3860
3870
|
onConfirm: () => {
|
|
3861
|
-
|
|
3871
|
+
pe(null), Ne(Z, z);
|
|
3862
3872
|
}
|
|
3863
3873
|
}),
|
|
3864
|
-
!x && /* @__PURE__ */
|
|
3874
|
+
!x && /* @__PURE__ */ V("ul", {
|
|
3865
3875
|
className: "seed-fm-toasts",
|
|
3866
3876
|
"aria-live": "polite",
|
|
3867
|
-
children:
|
|
3877
|
+
children: ge.map((e) => /* @__PURE__ */ H("li", {
|
|
3868
3878
|
className: w("toast", `seed-fm-toast${e.tone === "error" ? " seed-fm-toast--error" : ""}`),
|
|
3869
|
-
children: [/* @__PURE__ */
|
|
3879
|
+
children: [/* @__PURE__ */ V($, {
|
|
3870
3880
|
name: e.tone === "error" ? "triangleAlert" : "check",
|
|
3871
3881
|
size: 15,
|
|
3872
3882
|
strokeWidth: 2.5
|
|
@@ -3878,15 +3888,15 @@ function ni({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3878
3888
|
}
|
|
3879
3889
|
//#endregion
|
|
3880
3890
|
//#region src/useEnsureLocalImage.ts
|
|
3881
|
-
var
|
|
3891
|
+
var ai = (e) => {
|
|
3882
3892
|
try {
|
|
3883
3893
|
return e.getService?.()?.getSnapshot?.()?.context?.storageTransactionId || void 0;
|
|
3884
3894
|
} catch {
|
|
3885
3895
|
return;
|
|
3886
3896
|
}
|
|
3887
3897
|
};
|
|
3888
|
-
function
|
|
3889
|
-
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, _ =
|
|
3898
|
+
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(() => le(_) ?? le(r) ?? le(m) ?? le(g), [
|
|
3890
3900
|
_,
|
|
3891
3901
|
r,
|
|
3892
3902
|
m,
|
|
@@ -3899,7 +3909,7 @@ function ii(e) {
|
|
|
3899
3909
|
if (!v) return [];
|
|
3900
3910
|
let e = [];
|
|
3901
3911
|
try {
|
|
3902
|
-
for (let t of
|
|
3912
|
+
for (let t of O()) {
|
|
3903
3913
|
let n = `${t.replace(/\/$/, "")}/raw/${v}`;
|
|
3904
3914
|
e.includes(n) || e.push(n);
|
|
3905
3915
|
}
|
|
@@ -3924,7 +3934,7 @@ function ii(e) {
|
|
|
3924
3934
|
else {
|
|
3925
3935
|
e || p("loading");
|
|
3926
3936
|
try {
|
|
3927
|
-
let t = await
|
|
3937
|
+
let t = await te({
|
|
3928
3938
|
transactionId: v,
|
|
3929
3939
|
fileName: y,
|
|
3930
3940
|
widths: a == null ? void 0 : [a]
|
|
@@ -3954,23 +3964,23 @@ function ii(e) {
|
|
|
3954
3964
|
}
|
|
3955
3965
|
//#endregion
|
|
3956
3966
|
//#region src/SeedImage.tsx
|
|
3957
|
-
var
|
|
3967
|
+
var si = ge("seedSdk:react:SeedImage"), ci = /* @__PURE__ */ new Map(), li = (e) => {
|
|
3958
3968
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
3959
3969
|
return t && t[2] ? t[2] : e;
|
|
3960
3970
|
};
|
|
3961
|
-
function
|
|
3971
|
+
function ui(e) {
|
|
3962
3972
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3963
3973
|
}
|
|
3964
|
-
function
|
|
3965
|
-
let n = RegExp(`^${
|
|
3974
|
+
function di(e, t) {
|
|
3975
|
+
let n = RegExp(`^${ui(t)}$`), r = li(e);
|
|
3966
3976
|
return n.test(r);
|
|
3967
3977
|
}
|
|
3968
|
-
var
|
|
3969
|
-
let [l, u] = c(), [d, f] = c(), { property: m } =
|
|
3978
|
+
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 } = it({
|
|
3970
3980
|
propertyName: t.propertyName,
|
|
3971
3981
|
seedLocalId: t.seedLocalId,
|
|
3972
3982
|
seedUid: t.seedUid
|
|
3973
|
-
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } =
|
|
3983
|
+
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } = oi({
|
|
3974
3984
|
imageProperty: h ?? t,
|
|
3975
3985
|
filename: r,
|
|
3976
3986
|
width: n,
|
|
@@ -3982,6 +3992,8 @@ var ui = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
3982
3992
|
};
|
|
3983
3993
|
T.current = null, w(null);
|
|
3984
3994
|
}, [S, b]), i(() => {
|
|
3995
|
+
u(void 0), f(void 0);
|
|
3996
|
+
}, [g]), i(() => {
|
|
3985
3997
|
if (!g || b && ((e) => typeof e == "string" && e.startsWith("blob:"))(b) || C) return;
|
|
3986
3998
|
let e = !1;
|
|
3987
3999
|
return (async () => {
|
|
@@ -3992,7 +4004,7 @@ var ui = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
3992
4004
|
!e && n && f(n);
|
|
3993
4005
|
}
|
|
3994
4006
|
} catch (e) {
|
|
3995
|
-
|
|
4007
|
+
si("_getOriginalContentUrl error", e);
|
|
3996
4008
|
}
|
|
3997
4009
|
})(), () => {
|
|
3998
4010
|
e = !0;
|
|
@@ -4008,25 +4020,25 @@ var ui = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4008
4020
|
try {
|
|
4009
4021
|
let e = await p.getFs(), t = h?.localStoragePath ? h.localStoragePath.split("/").slice(0, -1).join("/") : p.getFilesPath("images"), r = e.readdirSync(t, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => parseInt(e.name)).filter((e) => !Number.isNaN(e));
|
|
4010
4022
|
if (r.length === 0) return;
|
|
4011
|
-
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a =
|
|
4012
|
-
if (
|
|
4013
|
-
let e =
|
|
4023
|
+
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a = li(g), o = `${a}-${i}`;
|
|
4024
|
+
if (ci.has(o)) try {
|
|
4025
|
+
let e = ci.get(o);
|
|
4014
4026
|
if (e && (await fetch(e)).ok) {
|
|
4015
4027
|
u(e);
|
|
4016
4028
|
return;
|
|
4017
4029
|
}
|
|
4018
4030
|
} catch (e) {
|
|
4019
|
-
|
|
4031
|
+
si("error", e), ci.delete(o);
|
|
4020
4032
|
}
|
|
4021
|
-
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ?
|
|
4033
|
+
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ? di(e.name, a) : !1);
|
|
4022
4034
|
if (!s) return;
|
|
4023
4035
|
let c = `${t}/${i}/${s?.name}`;
|
|
4024
4036
|
if (await p.pathExists(c)) {
|
|
4025
4037
|
let e = await p.getContentUrlFromPath(c);
|
|
4026
|
-
e && (
|
|
4038
|
+
e && (ci.set(o, e), u(e));
|
|
4027
4039
|
}
|
|
4028
4040
|
} catch (e) {
|
|
4029
|
-
|
|
4041
|
+
si("_getSizedContentUrl error", e);
|
|
4030
4042
|
}
|
|
4031
4043
|
})();
|
|
4032
4044
|
}, [
|
|
@@ -4038,21 +4050,21 @@ var ui = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4038
4050
|
]);
|
|
4039
4051
|
let ee = (e) => typeof e == "string" && e.startsWith("blob:"), E = !!l || !!d || !!C || !!x && ee(x);
|
|
4040
4052
|
if (!E && !g && !v) return null;
|
|
4041
|
-
let
|
|
4042
|
-
v &&
|
|
4053
|
+
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
|
+
v && te === v && y(), D?.(e);
|
|
4043
4055
|
};
|
|
4044
|
-
return /* @__PURE__ */
|
|
4045
|
-
src:
|
|
4056
|
+
return /* @__PURE__ */ V("img", {
|
|
4057
|
+
src: te,
|
|
4046
4058
|
alt: o.alt || t.propertyName || "Image",
|
|
4047
4059
|
width: n,
|
|
4048
|
-
...
|
|
4060
|
+
...ne,
|
|
4049
4061
|
ref: s,
|
|
4050
|
-
onError:
|
|
4062
|
+
onError: O
|
|
4051
4063
|
});
|
|
4052
4064
|
}));
|
|
4053
4065
|
//#endregion
|
|
4054
4066
|
//#region src/useResolvedMediaRef.ts
|
|
4055
|
-
function
|
|
4067
|
+
function pi(e) {
|
|
4056
4068
|
let { value: t, enabled: r = !0, treatAs: a } = e, [o, s] = c(0), l = JSON.stringify([
|
|
4057
4069
|
r,
|
|
4058
4070
|
t ?? null,
|
|
@@ -4076,7 +4088,7 @@ function di(e) {
|
|
|
4076
4088
|
error: null
|
|
4077
4089
|
});
|
|
4078
4090
|
try {
|
|
4079
|
-
let r = await
|
|
4091
|
+
let r = await fe(String(t), { treatAs: a }), i = r.status === "ready" && r.source === "localBlob" ? r.href : void 0;
|
|
4080
4092
|
if (e) {
|
|
4081
4093
|
i && URL.revokeObjectURL(i);
|
|
4082
4094
|
return;
|
|
@@ -4122,8 +4134,8 @@ function di(e) {
|
|
|
4122
4134
|
}
|
|
4123
4135
|
//#endregion
|
|
4124
4136
|
//#region src/SeedMediaImage.tsx
|
|
4125
|
-
function
|
|
4126
|
-
let { href: o } =
|
|
4137
|
+
function mi({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
4138
|
+
let { href: o } = pi({
|
|
4127
4139
|
value: e,
|
|
4128
4140
|
enabled: t,
|
|
4129
4141
|
treatAs: n
|
|
@@ -4134,18 +4146,18 @@ function fi({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
4134
4146
|
src: o,
|
|
4135
4147
|
alt: i ?? ""
|
|
4136
4148
|
};
|
|
4137
|
-
return r ? /* @__PURE__ */ B
|
|
4149
|
+
return r ? /* @__PURE__ */ V(B, { children: r(s) }) : /* @__PURE__ */ V("img", { ...s });
|
|
4138
4150
|
}
|
|
4139
4151
|
//#endregion
|
|
4140
4152
|
//#region src/SeedMediaFile.tsx
|
|
4141
|
-
function
|
|
4153
|
+
function hi(e) {
|
|
4142
4154
|
try {
|
|
4143
4155
|
return new URL(e).pathname.split("/").filter(Boolean).pop() || "Open";
|
|
4144
4156
|
} catch {
|
|
4145
4157
|
return "Open";
|
|
4146
4158
|
}
|
|
4147
4159
|
}
|
|
4148
|
-
function
|
|
4160
|
+
function gi(e) {
|
|
4149
4161
|
try {
|
|
4150
4162
|
let t = new URL(e).protocol;
|
|
4151
4163
|
return t === "http:" || t === "https:";
|
|
@@ -4153,27 +4165,27 @@ function mi(e) {
|
|
|
4153
4165
|
return !1;
|
|
4154
4166
|
}
|
|
4155
4167
|
}
|
|
4156
|
-
function
|
|
4157
|
-
let { href: l } =
|
|
4168
|
+
function _i({ value: e, enabled: t, treatAs: n, download: r, render: i, children: a, target: o, rel: s, ...c }) {
|
|
4169
|
+
let { href: l } = pi({
|
|
4158
4170
|
value: e,
|
|
4159
4171
|
enabled: t,
|
|
4160
4172
|
treatAs: n
|
|
4161
4173
|
});
|
|
4162
4174
|
if (!l) return null;
|
|
4163
|
-
let u =
|
|
4175
|
+
let u = gi(l), d = o === void 0 ? u ? "_blank" : void 0 : o, f = {
|
|
4164
4176
|
...c,
|
|
4165
4177
|
href: l,
|
|
4166
4178
|
download: r,
|
|
4167
4179
|
target: d,
|
|
4168
4180
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
4169
|
-
children: a ??
|
|
4181
|
+
children: a ?? hi(l)
|
|
4170
4182
|
};
|
|
4171
|
-
return i ? /* @__PURE__ */ B
|
|
4183
|
+
return i ? /* @__PURE__ */ V(B, { children: i(f) }) : /* @__PURE__ */ V("a", { ...f });
|
|
4172
4184
|
}
|
|
4173
4185
|
//#endregion
|
|
4174
4186
|
//#region src/SeedMediaAudio.tsx
|
|
4175
|
-
function
|
|
4176
|
-
let { href: o } =
|
|
4187
|
+
function vi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4188
|
+
let { href: o } = pi({
|
|
4177
4189
|
value: e,
|
|
4178
4190
|
enabled: t,
|
|
4179
4191
|
treatAs: n
|
|
@@ -4184,12 +4196,12 @@ function gi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4184
4196
|
src: o,
|
|
4185
4197
|
controls: i
|
|
4186
4198
|
};
|
|
4187
|
-
return r ? /* @__PURE__ */ B
|
|
4199
|
+
return r ? /* @__PURE__ */ V(B, { children: r(s) }) : /* @__PURE__ */ V("audio", { ...s });
|
|
4188
4200
|
}
|
|
4189
4201
|
//#endregion
|
|
4190
4202
|
//#region src/SeedMediaVideo.tsx
|
|
4191
|
-
function
|
|
4192
|
-
let { href: o } =
|
|
4203
|
+
function yi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4204
|
+
let { href: o } = pi({
|
|
4193
4205
|
value: e,
|
|
4194
4206
|
enabled: t,
|
|
4195
4207
|
treatAs: n
|
|
@@ -4200,63 +4212,63 @@ function _i({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4200
4212
|
src: o,
|
|
4201
4213
|
controls: i
|
|
4202
4214
|
};
|
|
4203
|
-
return r ? /* @__PURE__ */ B
|
|
4215
|
+
return r ? /* @__PURE__ */ V(B, { children: r(s) }) : /* @__PURE__ */ V("video", { ...s });
|
|
4204
4216
|
}
|
|
4205
4217
|
//#endregion
|
|
4206
4218
|
//#region src/SeedHtml.tsx
|
|
4207
|
-
function
|
|
4219
|
+
function bi(e) {
|
|
4208
4220
|
return typeof e == "string" && e.trim().length > 0;
|
|
4209
4221
|
}
|
|
4210
|
-
function
|
|
4211
|
-
if (!
|
|
4222
|
+
function xi({ html: e, sanitize: t, render: n, ...r }) {
|
|
4223
|
+
if (!bi(e)) return null;
|
|
4212
4224
|
let i = t(e);
|
|
4213
|
-
return n ? /* @__PURE__ */ B
|
|
4225
|
+
return n ? /* @__PURE__ */ V(B, { children: n({ html: i }) }) : /* @__PURE__ */ V("div", {
|
|
4214
4226
|
...r,
|
|
4215
4227
|
dangerouslySetInnerHTML: { __html: i }
|
|
4216
4228
|
});
|
|
4217
4229
|
}
|
|
4218
4230
|
//#endregion
|
|
4219
4231
|
//#region src/formatSeedJson.ts
|
|
4220
|
-
function
|
|
4232
|
+
function Si(e, t) {
|
|
4221
4233
|
return e.length <= t ? e : `${e.slice(0, t)}…`;
|
|
4222
4234
|
}
|
|
4223
|
-
function
|
|
4235
|
+
function Ci(e) {
|
|
4224
4236
|
let t = e.trim();
|
|
4225
4237
|
return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
|
|
4226
4238
|
}
|
|
4227
|
-
function
|
|
4239
|
+
function wi(e, t, n, r, i) {
|
|
4228
4240
|
if (typeof e == "bigint") return String(e);
|
|
4229
4241
|
if (typeof e == "symbol") return e.toString();
|
|
4230
4242
|
if (typeof e == "function") return "[Function]";
|
|
4231
4243
|
if (e instanceof Date) return e.toISOString();
|
|
4232
|
-
if (typeof e == "string") return
|
|
4244
|
+
if (typeof e == "string") return Si(e, n);
|
|
4233
4245
|
if (typeof e != "object" || !e) return e;
|
|
4234
4246
|
if (i.has(e)) return "[Circular]";
|
|
4235
4247
|
if (r >= t) return "[Max depth]";
|
|
4236
4248
|
i.add(e);
|
|
4237
4249
|
try {
|
|
4238
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
4250
|
+
if (Array.isArray(e)) return e.map((e) => wi(e, t, n, r + 1, i));
|
|
4239
4251
|
let a = {};
|
|
4240
|
-
for (let [o, s] of Object.entries(e)) a[o] =
|
|
4252
|
+
for (let [o, s] of Object.entries(e)) a[o] = wi(s, t, n, r + 1, i);
|
|
4241
4253
|
return a;
|
|
4242
4254
|
} finally {
|
|
4243
4255
|
i.delete(e);
|
|
4244
4256
|
}
|
|
4245
4257
|
}
|
|
4246
|
-
function
|
|
4258
|
+
function Ti(e, t) {
|
|
4247
4259
|
let n = t?.maxDepth ?? 6, r = t?.maxStringLength ?? 5e4, i = t?.space ?? 2;
|
|
4248
4260
|
if (e === void 0) return "undefined";
|
|
4249
4261
|
if (e === null) return "null";
|
|
4250
4262
|
let a = e;
|
|
4251
4263
|
if (typeof e == "string") {
|
|
4252
|
-
if (
|
|
4264
|
+
if (Ci(e)) try {
|
|
4253
4265
|
a = JSON.parse(e);
|
|
4254
4266
|
} catch {
|
|
4255
|
-
return
|
|
4267
|
+
return Si(e, r);
|
|
4256
4268
|
}
|
|
4257
|
-
else return
|
|
4269
|
+
else return Si(e, r);
|
|
4258
4270
|
}
|
|
4259
|
-
let o =
|
|
4271
|
+
let o = wi(a, n, r, 0, /* @__PURE__ */ new WeakSet());
|
|
4260
4272
|
try {
|
|
4261
4273
|
return JSON.stringify(o, null, i);
|
|
4262
4274
|
} catch {
|
|
@@ -4265,19 +4277,19 @@ function Ci(e, t) {
|
|
|
4265
4277
|
}
|
|
4266
4278
|
//#endregion
|
|
4267
4279
|
//#region src/SeedJson.tsx
|
|
4268
|
-
function
|
|
4269
|
-
let a = t ? t(e) :
|
|
4270
|
-
return r ? /* @__PURE__ */ B
|
|
4280
|
+
function Ei({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4281
|
+
let a = t ? t(e) : Ti(e, n);
|
|
4282
|
+
return r ? /* @__PURE__ */ V(B, { children: r({ text: a }) }) : /* @__PURE__ */ V("pre", {
|
|
4271
4283
|
...i,
|
|
4272
4284
|
children: a
|
|
4273
4285
|
});
|
|
4274
4286
|
}
|
|
4275
4287
|
//#endregion
|
|
4276
4288
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4277
|
-
function
|
|
4278
|
-
return o(() => e ?
|
|
4289
|
+
function Di(e, t) {
|
|
4290
|
+
return o(() => e ? ue(e, t) : {}, [e, t]);
|
|
4279
4291
|
}
|
|
4280
4292
|
//#endregion
|
|
4281
|
-
export { Ae as ADDRESSES_PERSISTED_EVENT,
|
|
4293
|
+
export { Ae as ADDRESSES_PERSISTED_EVENT, rn as FILES_QUERY_KEY_PREFIX, Y as LOCAL_COPIES_REMOVED_EVENT, ii as OPFSFilesManager, Rr as OPFS_FILES_MANAGER_CSS, yn as SeedClientGate, xi as SeedHtml, fi as SeedImage, Ei as SeedJson, vi as SeedMediaAudio, _i as SeedMediaFile, mi as SeedMediaImage, yi as SeedMediaVideo, gn as SeedProvider, Ve as createSeedQueryClient, Ti as formatSeedJson, rt as getItemPropertyQueryKey, Ke as getItemQueryKey, xt as getPercentComplete, ze as getSeedQueryDefaultOptions, _t as getServiceName, yt as getServiceUniqueKey, vt as getServiceValue, pn as invalidateItemPropertiesForItem, pt as isDbReadyState, Be as mergeSeedQueryDefaults, Rt as useAllSchemaVersions, Oe as useClientSelector, De as useClientService, Ze as useCreateItem, ut as useCreateItemProperty, Ut as useCreateModel, Qt as useCreateModelProperty, It as useCreateSchema, mt as useDbsAreReady, at as useDebouncedItemProperty, en as useDeleteItem, dt as useDestroyItemProperty, Wt as useDestroyModel, $t as useDestroyModelProperty, Lt as useDestroySchema, dn as useEasSyncProcessById, ln as useEasSyncProcesses, un as useEasSyncProcessesNonActiveCount, cn as useEasSyncProcessesState, oi as useEnsureLocalImage, an as useFiles, Ot as useGlobalServiceStatus, Tt as useHasSavedSnapshots, nn as useImageFiles, J as useIsClientReady, Ct as useIsDbReady, qe as useItem, lt as useItemProperties, it as useItemProperty, Xe as useItems, X as useLiveQuery, Le as useLiveQueryState, Ht as useModel, Kt as useModelProperties, Zt as useModelProperty, Vt as useModels, Di as useNormalizedFeedItemFields, Pn as useOPFSFiles, wt as usePersistedSnapshots, Qe as usePublishItem, pi as useResolvedMediaRef, Mt as useSchema, Ft as useSchemas, Me as useSeedAddressRevision, zt as useSeedProtocolSchema, St as useService, Dt as useServices, Br as useStorageEstimate, Cr as useThumbnail };
|
|
4282
4294
|
|
|
4283
4295
|
//# sourceMappingURL=index.js.map
|