@seedprotocol/react 0.7.4-next.784.g879c6a3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +790 -791
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
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 } from "react";
|
|
2
2
|
import { flushSync as l } from "react-dom";
|
|
3
|
-
import { BaseArweaveClient as u, BaseDb as d, BaseFileManager as f, ClientManagerState as p, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as m, FILES_CHANGED_EVENT as h, Item as g, ItemProperty as _, Model as v, ModelProperty as y, SEED_PROTOCOL_SCHEMA_NAME as b, Schema as x, client as S,
|
|
4
|
-
import { debounce as
|
|
5
|
-
import
|
|
6
|
-
import { useSelector as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { QueryClient as
|
|
9
|
-
import { and as ge, desc as _e, eq as
|
|
10
|
-
import
|
|
11
|
-
import xe from "pluralize";
|
|
3
|
+
import { BaseArweaveClient as u, BaseDb as d, BaseFileManager as f, ClientManagerState as p, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as m, FILES_CHANGED_EVENT as h, Item as g, ItemProperty as _, Model as v, ModelProperty as y, SEED_PROTOCOL_SCHEMA_NAME as b, Schema as x, client as S, easName as C, easSyncProcesses as w, ensureImageLocal as T, eventEmitter as E, getAddressesForItemsFilter as ee, getArweaveReadBaseUrls as D, getClient as O, getPropertySchema as te, getSchemaNameFromId as k, getVersionData as ne, loadAllSchemasFromDb as re, metadata as A, modelSchemas as j, models as M, normalizeArweaveTxIdForEnsure as ie, normalizeFeedItemFields as ae, ownedSeedsSql as oe, pickLatestMetadataRowPerProperty as se, placeholderUidSql as ce, properties as le, publisherInAddressListSql as ue, resolveMediaRef as N, schemas as P, seeds as F } from "@seedprotocol/sdk";
|
|
4
|
+
import { debounce as I, orderBy as L, startCase as de } from "lodash-es";
|
|
5
|
+
import R from "debug";
|
|
6
|
+
import { useSelector as fe } from "@xstate/react";
|
|
7
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
8
|
+
import { QueryClient as H, QueryClientContext as pe, QueryClientProvider as me, useQuery as U, useQueryClient as he } from "@tanstack/react-query";
|
|
9
|
+
import { and as ge, desc as _e, eq as W, gt as G, isNotNull as ve, isNull as ye, or as K } from "drizzle-orm";
|
|
10
|
+
import be from "pluralize";
|
|
12
11
|
//#region src/client.ts
|
|
13
|
-
var
|
|
14
|
-
let e =
|
|
15
|
-
return
|
|
16
|
-
},
|
|
17
|
-
function
|
|
18
|
-
return r(
|
|
19
|
-
}
|
|
20
|
-
function
|
|
12
|
+
var q = () => {
|
|
13
|
+
let e = O().getService();
|
|
14
|
+
return fe(e, (e) => e.value === p.IDLE);
|
|
15
|
+
}, J = "addresses.persisted", xe = "localCopies.removed", Se = t(0);
|
|
16
|
+
function Ce() {
|
|
17
|
+
return r(Se);
|
|
18
|
+
}
|
|
19
|
+
function we({ queryClient: e, children: t }) {
|
|
21
20
|
let [r, a] = c(0), o = n(() => {
|
|
22
21
|
e.invalidateQueries({
|
|
23
22
|
queryKey: ["seed", "items"],
|
|
@@ -30,19 +29,19 @@ function Te({ queryClient: e, children: t }) {
|
|
|
30
29
|
exact: !1
|
|
31
30
|
}), a((e) => e + 1);
|
|
32
31
|
}, [e]);
|
|
33
|
-
return i(() => (
|
|
34
|
-
|
|
35
|
-
}), [o]), /* @__PURE__ */
|
|
32
|
+
return i(() => (E.on(J, o), E.on(xe, o), () => {
|
|
33
|
+
E.off(J, o), E.off(xe, o);
|
|
34
|
+
}), [o]), /* @__PURE__ */ B(Se.Provider, {
|
|
36
35
|
value: r,
|
|
37
36
|
children: t
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
//#endregion
|
|
41
40
|
//#region src/liveQuery.ts
|
|
42
|
-
function
|
|
43
|
-
return
|
|
41
|
+
function Y(e) {
|
|
42
|
+
return Ee(e).data;
|
|
44
43
|
}
|
|
45
|
-
function
|
|
44
|
+
function Te(e) {
|
|
46
45
|
if (e && typeof e == "object" && typeof e.toSQL == "function") try {
|
|
47
46
|
let { sql: t, params: n } = e.toSQL();
|
|
48
47
|
return `sql:${t}|${JSON.stringify(n)}`;
|
|
@@ -51,11 +50,11 @@ function Ee(e) {
|
|
|
51
50
|
}
|
|
52
51
|
return e;
|
|
53
52
|
}
|
|
54
|
-
function
|
|
53
|
+
function Ee(e) {
|
|
55
54
|
let [t, n] = c({
|
|
56
55
|
data: void 0,
|
|
57
56
|
error: null
|
|
58
|
-
}), r =
|
|
57
|
+
}), r = q(), a = Te(e), l = s(e);
|
|
59
58
|
l.current = e;
|
|
60
59
|
let u = o(() => {
|
|
61
60
|
let e = l.current;
|
|
@@ -90,16 +89,16 @@ function De(e) {
|
|
|
90
89
|
}
|
|
91
90
|
//#endregion
|
|
92
91
|
//#region src/queryClient.ts
|
|
93
|
-
var
|
|
92
|
+
var De = { queries: {
|
|
94
93
|
networkMode: "offlineFirst",
|
|
95
94
|
gcTime: 864e5,
|
|
96
95
|
staleTime: 6e4
|
|
97
96
|
} };
|
|
98
|
-
function
|
|
99
|
-
return { ...
|
|
97
|
+
function Oe() {
|
|
98
|
+
return { ...De };
|
|
100
99
|
}
|
|
101
|
-
function
|
|
102
|
-
let t =
|
|
100
|
+
function ke(e) {
|
|
101
|
+
let t = Oe();
|
|
103
102
|
return e ? {
|
|
104
103
|
queries: {
|
|
105
104
|
...t.queries,
|
|
@@ -111,27 +110,27 @@ function Ae(e) {
|
|
|
111
110
|
}
|
|
112
111
|
} : t;
|
|
113
112
|
}
|
|
114
|
-
function
|
|
115
|
-
let t =
|
|
116
|
-
return new
|
|
113
|
+
function X(e) {
|
|
114
|
+
let t = Oe(), { defaultOptions: n, ...r } = e ?? {};
|
|
115
|
+
return new H({
|
|
117
116
|
...r,
|
|
118
|
-
defaultOptions: n ?
|
|
117
|
+
defaultOptions: n ? ke(n) : t
|
|
119
118
|
});
|
|
120
119
|
}
|
|
121
|
-
var
|
|
122
|
-
function
|
|
123
|
-
return r(
|
|
120
|
+
var Ae;
|
|
121
|
+
function je() {
|
|
122
|
+
return r(pe) || (Ae ?? (Ae = X()), Ae);
|
|
124
123
|
}
|
|
125
124
|
//#endregion
|
|
126
125
|
//#region src/item.ts
|
|
127
|
-
var
|
|
126
|
+
var Me = R("seedSdk:react:item"), Ne = (e) => [
|
|
128
127
|
"seed",
|
|
129
128
|
"item",
|
|
130
129
|
e ?? null
|
|
131
|
-
],
|
|
132
|
-
let r = t || n, [, a] = c(0), [, l] = c(0), [u, d] = c(!1), [f, p] = c(null), h = s(!1), _ =
|
|
130
|
+
], Pe = ({ modelName: e, seedLocalId: t, seedUid: n }) => {
|
|
131
|
+
let r = t || n, [, a] = c(0), [, l] = c(0), [u, d] = c(!1), [f, p] = c(null), h = s(!1), _ = q(), v = je(), y = o(() => Ne(r), [r]), b = s(y);
|
|
133
132
|
b.current = y;
|
|
134
|
-
let x =
|
|
133
|
+
let x = U({
|
|
135
134
|
queryKey: y,
|
|
136
135
|
queryFn: async () => {
|
|
137
136
|
let i = g.peekReady(r) ?? await g.find({
|
|
@@ -140,7 +139,7 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
140
139
|
seedUid: n
|
|
141
140
|
});
|
|
142
141
|
if (i) return i;
|
|
143
|
-
|
|
142
|
+
Me("[useItem] no item found", e, r);
|
|
144
143
|
let a = v.getQueryData(y);
|
|
145
144
|
return a && a.getService().getSnapshot().status === "active" ? a : null;
|
|
146
145
|
},
|
|
@@ -155,8 +154,8 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
155
154
|
let e = () => {
|
|
156
155
|
a((e) => e + 1), v.invalidateQueries({ queryKey: b.current });
|
|
157
156
|
};
|
|
158
|
-
return
|
|
159
|
-
|
|
157
|
+
return E.on(m, e), () => {
|
|
158
|
+
E.off(m, e);
|
|
160
159
|
};
|
|
161
160
|
}, [v]), i(() => {
|
|
162
161
|
if (h.current = !1, d(!1), p(null), !S) return;
|
|
@@ -191,7 +190,7 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
191
190
|
isLoading: !!r && x.isPending || u,
|
|
192
191
|
error: f ?? x.error
|
|
193
192
|
};
|
|
194
|
-
},
|
|
193
|
+
}, Fe = (e, t, n, r, i, a, o) => [
|
|
195
194
|
"seed",
|
|
196
195
|
"items",
|
|
197
196
|
e ?? null,
|
|
@@ -203,14 +202,14 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
203
202
|
modelFileId: a ?? null,
|
|
204
203
|
schemaName: o ?? null
|
|
205
204
|
}] : []
|
|
206
|
-
],
|
|
207
|
-
let u =
|
|
205
|
+
], Ie = ({ modelName: e, modelFileId: t, schemaName: n, deleted: r = !1, includeEas: a = !1, addressFilter: l }) => {
|
|
206
|
+
let u = q(), f = Ce(), p = he();
|
|
208
207
|
i(() => {
|
|
209
208
|
let e = () => {
|
|
210
209
|
p.invalidateQueries({ queryKey: ["seed", "items"] });
|
|
211
210
|
};
|
|
212
|
-
return
|
|
213
|
-
|
|
211
|
+
return E.on(m, e), () => {
|
|
212
|
+
E.off(m, e);
|
|
214
213
|
};
|
|
215
214
|
}, [p]);
|
|
216
215
|
let h = s([]), _ = s(/* @__PURE__ */ new Set()), v = s(!1), [y, b] = c(null);
|
|
@@ -226,7 +225,7 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
226
225
|
e = !0;
|
|
227
226
|
};
|
|
228
227
|
}, [l, f]);
|
|
229
|
-
let x = o(() =>
|
|
228
|
+
let x = o(() => Fe(e, r, a, l, f, t, n), [
|
|
230
229
|
e,
|
|
231
230
|
r,
|
|
232
231
|
a,
|
|
@@ -238,7 +237,7 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
238
237
|
i(() => {
|
|
239
238
|
v.current = !1;
|
|
240
239
|
}, [x]);
|
|
241
|
-
let { data: S = [], isLoading:
|
|
240
|
+
let { data: S = [], isLoading: w, error: T } = U({
|
|
242
241
|
queryKey: x,
|
|
243
242
|
queryFn: async () => await g.all(e, r, {
|
|
244
243
|
waitForReady: !0,
|
|
@@ -251,22 +250,22 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
251
250
|
staleTime: 0
|
|
252
251
|
});
|
|
253
252
|
h.current = S;
|
|
254
|
-
let
|
|
255
|
-
if (!
|
|
253
|
+
let D = u ? d.getAppDb() : null, O = Y(o(() => {
|
|
254
|
+
if (!D || (l === "owned" || l === "watched") && y === null) return null;
|
|
256
255
|
let t = [];
|
|
257
|
-
a || t.push(ce(
|
|
258
|
-
let n =
|
|
259
|
-
return
|
|
260
|
-
localId:
|
|
261
|
-
uid:
|
|
262
|
-
type:
|
|
263
|
-
schemaUid:
|
|
264
|
-
createdAt:
|
|
265
|
-
attestationCreatedAt:
|
|
266
|
-
_markedForDeletion:
|
|
267
|
-
}).from(
|
|
256
|
+
a || t.push(ce(F.uid)), e && t.push(W(F.type, C(e))), l === "owned" ? t.push(oe(y ?? [])) : l === "watched" && t.push(ue(F.publisher, y ?? [])), r ? t.push(K(ve(F._markedForDeletion), W(F._markedForDeletion, 1))) : (t.push(K(ye(F._markedForDeletion), W(F._markedForDeletion, 0))), t.push(K(ye(F.revokedAt), W(F.revokedAt, 0))));
|
|
257
|
+
let n = ne();
|
|
258
|
+
return D.with(n).select({
|
|
259
|
+
localId: F.localId,
|
|
260
|
+
uid: F.uid,
|
|
261
|
+
type: F.type,
|
|
262
|
+
schemaUid: F.schemaUid,
|
|
263
|
+
createdAt: F.createdAt,
|
|
264
|
+
attestationCreatedAt: F.attestationCreatedAt,
|
|
265
|
+
_markedForDeletion: F._markedForDeletion
|
|
266
|
+
}).from(F).leftJoin(n, W(F.localId, n.seedLocalId)).where(ge(G(n.versionsCount, 0), ...t)).groupBy(F.localId);
|
|
268
267
|
}, [
|
|
269
|
-
|
|
268
|
+
D,
|
|
270
269
|
u,
|
|
271
270
|
e,
|
|
272
271
|
r,
|
|
@@ -275,9 +274,9 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
275
274
|
y
|
|
276
275
|
]));
|
|
277
276
|
return i(() => {
|
|
278
|
-
if (!u || !
|
|
277
|
+
if (!u || !O) return;
|
|
279
278
|
let e = /* @__PURE__ */ new Set();
|
|
280
|
-
for (let t of
|
|
279
|
+
for (let t of O) {
|
|
281
280
|
let n = t.localId || t.uid;
|
|
282
281
|
n && e.add(n);
|
|
283
282
|
}
|
|
@@ -295,19 +294,19 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
295
294
|
n.size === e.size && [...n].every((t) => e.has(t)) || (t.size === e.size && [...t].every((t) => e.has(t)) ? _.current = new Set(e) : (_.current = new Set(e), p.invalidateQueries({ queryKey: x })));
|
|
296
295
|
}, [
|
|
297
296
|
u,
|
|
298
|
-
|
|
297
|
+
O,
|
|
299
298
|
p,
|
|
300
299
|
x
|
|
301
300
|
]), {
|
|
302
|
-
items: o(() =>
|
|
303
|
-
isLoading:
|
|
304
|
-
error:
|
|
301
|
+
items: o(() => L(S, [(e) => e.lastVersionPublishedAt || e.attestationCreatedAt || e.createdAt], ["desc"]), [S]),
|
|
302
|
+
isLoading: w || !u,
|
|
303
|
+
error: T
|
|
305
304
|
};
|
|
306
|
-
},
|
|
305
|
+
}, Le = () => {
|
|
307
306
|
let [e, t] = c(!1), [r, i] = c(null), a = s(!1), o = n(() => i(null), []);
|
|
308
307
|
return {
|
|
309
308
|
createItem: n(async (e, n) => {
|
|
310
|
-
if (a.current)
|
|
309
|
+
if (a.current) Me("[useCreateItem] [createItem] already creating item, skipping");
|
|
311
310
|
else {
|
|
312
311
|
a.current = !0, i(null), l(() => t(!0));
|
|
313
312
|
try {
|
|
@@ -317,7 +316,7 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
317
316
|
...t
|
|
318
317
|
}) ?? void 0;
|
|
319
318
|
} catch (e) {
|
|
320
|
-
|
|
319
|
+
Me("[useCreateItem] Error creating item:", e), i(e instanceof Error ? e : Error(String(e)));
|
|
321
320
|
return;
|
|
322
321
|
} finally {
|
|
323
322
|
a.current = !1, queueMicrotask(() => t(!1));
|
|
@@ -328,7 +327,7 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
328
327
|
error: r,
|
|
329
328
|
resetError: o
|
|
330
329
|
};
|
|
331
|
-
},
|
|
330
|
+
}, Re = () => {
|
|
332
331
|
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) => {
|
|
333
332
|
e && (t(e), l(null), e.publish(n).catch((e) => {
|
|
334
333
|
l(e instanceof Error ? e : Error(String(e)));
|
|
@@ -352,15 +351,15 @@ var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
|
352
351
|
error: o,
|
|
353
352
|
resetError: d
|
|
354
353
|
};
|
|
355
|
-
},
|
|
354
|
+
}, ze = R("seedSdk:react:property"), Z = R("seedSdk:react:itemProperties"), Be = (e, t, n) => [
|
|
356
355
|
"seed",
|
|
357
356
|
"itemProperty",
|
|
358
357
|
e ?? null,
|
|
359
358
|
t ?? null,
|
|
360
359
|
n
|
|
361
360
|
];
|
|
362
|
-
function
|
|
363
|
-
let n =
|
|
361
|
+
function Ve(e, t) {
|
|
362
|
+
let n = q(), r = je(), [, 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(() => {
|
|
364
363
|
let e = p !== void 0 && p !== "" ? p : u, t = p !== void 0 && p !== "" ? void 0 : d;
|
|
365
364
|
return (e || t) && m ? {
|
|
366
365
|
type: "identifiers",
|
|
@@ -374,7 +373,7 @@ function He(e, t) {
|
|
|
374
373
|
m,
|
|
375
374
|
u,
|
|
376
375
|
d
|
|
377
|
-
]), g = o(() =>
|
|
376
|
+
]), g = o(() => Be(h?.seedLocalId, h?.seedUid, h?.propertyName ?? ""), [h]), v = U({
|
|
378
377
|
queryKey: g,
|
|
379
378
|
queryFn: async () => {
|
|
380
379
|
if (!h) return null;
|
|
@@ -386,7 +385,7 @@ function He(e, t) {
|
|
|
386
385
|
propertyName: h.propertyName,
|
|
387
386
|
seedUid: h.itemId
|
|
388
387
|
}) : void 0, n = e ?? t;
|
|
389
|
-
return n ||
|
|
388
|
+
return n || ze(`[useItemProperty] no property found for Item.${h.seedLocalId || h.seedUid}.${h.propertyName}`), n ?? null;
|
|
390
389
|
},
|
|
391
390
|
initialData: () => h ? _.peekReady(h) : void 0,
|
|
392
391
|
staleTime: 0,
|
|
@@ -414,8 +413,8 @@ function He(e, t) {
|
|
|
414
413
|
error: v.error
|
|
415
414
|
};
|
|
416
415
|
}
|
|
417
|
-
function
|
|
418
|
-
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 } =
|
|
416
|
+
function He(e, t = 300) {
|
|
417
|
+
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 } = Ve(o(() => r ? {
|
|
419
418
|
itemId: r,
|
|
420
419
|
propertyName: l
|
|
421
420
|
} : {
|
|
@@ -427,7 +426,7 @@ function Ue(e, t = 300) {
|
|
|
427
426
|
a,
|
|
428
427
|
c,
|
|
429
428
|
l
|
|
430
|
-
])), p = s(""), m = o(() =>
|
|
429
|
+
])), p = s(""), m = o(() => I((e) => {
|
|
431
430
|
e.getService().send({
|
|
432
431
|
type: "save",
|
|
433
432
|
newValue: p.current
|
|
@@ -449,7 +448,7 @@ function Ue(e, t = 300) {
|
|
|
449
448
|
error: f
|
|
450
449
|
};
|
|
451
450
|
}
|
|
452
|
-
async function
|
|
451
|
+
async function Ue(e, t) {
|
|
453
452
|
if (!e && !t) return [];
|
|
454
453
|
let n = d.getAppDb();
|
|
455
454
|
if (!n) return [];
|
|
@@ -461,19 +460,19 @@ async function We(e, t) {
|
|
|
461
460
|
let o;
|
|
462
461
|
if (r.length > 0) {
|
|
463
462
|
let e = r[0];
|
|
464
|
-
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o =
|
|
463
|
+
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o = de(o));
|
|
465
464
|
}
|
|
466
465
|
let s = await n.select({
|
|
467
|
-
type:
|
|
468
|
-
modelFileId:
|
|
469
|
-
}).from(
|
|
470
|
-
!o && s.length > 0 && s[0].type && (o =
|
|
466
|
+
type: F.type,
|
|
467
|
+
modelFileId: F.modelFileId
|
|
468
|
+
}).from(F).where(t ? W(F.uid, t) : W(F.localId, e)).limit(1), c = s[0]?.modelFileId ?? void 0;
|
|
469
|
+
!o && s.length > 0 && s[0].type && (o = de(s[0].type));
|
|
471
470
|
let l = [];
|
|
472
471
|
if (o) try {
|
|
473
472
|
let { Model: e } = await import("@seedprotocol/sdk"), t = await e.resolveAsync(o, { modelFileId: c });
|
|
474
473
|
if (t?.properties) for (let e of t.properties) e.name && l.push(e.name);
|
|
475
474
|
} catch (e) {
|
|
476
|
-
|
|
475
|
+
Z(`[useItemProperties] Error getting ModelProperties for ${o}:`, e);
|
|
477
476
|
}
|
|
478
477
|
if (o && l.length > 0) {
|
|
479
478
|
let n = r.length > 0 ? r[0].seedLocalId ?? e : e, s = r.length > 0 ? r[0].seedUid ?? t : t;
|
|
@@ -487,11 +486,11 @@ async function We(e, t) {
|
|
|
487
486
|
}, { waitForReady: !1 });
|
|
488
487
|
t && i.push(t);
|
|
489
488
|
} catch (t) {
|
|
490
|
-
|
|
489
|
+
ze(`[useItemProperties] Error creating ItemProperty for missing property ${e}:`, t);
|
|
491
490
|
}
|
|
492
491
|
}
|
|
493
492
|
if (e || t) {
|
|
494
|
-
let a = await n.select({ createdAt:
|
|
493
|
+
let a = await n.select({ createdAt: F.createdAt }).from(F).where(t ? W(F.uid, t) : W(F.localId, e)).limit(1);
|
|
495
494
|
if (a.length > 0 && a[0].createdAt) {
|
|
496
495
|
let n = "createdAt";
|
|
497
496
|
if (!i.some((e) => e.propertyName === n) && o) try {
|
|
@@ -504,14 +503,14 @@ async function We(e, t) {
|
|
|
504
503
|
}, { waitForReady: !1 });
|
|
505
504
|
l && i.push(l);
|
|
506
505
|
} catch (e) {
|
|
507
|
-
|
|
506
|
+
ze("[useItemProperties] Error creating createdAt ItemProperty:", e);
|
|
508
507
|
}
|
|
509
508
|
}
|
|
510
509
|
}
|
|
511
510
|
return i;
|
|
512
511
|
}
|
|
513
|
-
function
|
|
514
|
-
let t =
|
|
512
|
+
function We(e) {
|
|
513
|
+
let t = q(), n = he(), r = s(void 0), a = o(() => typeof e == "string" ? {
|
|
515
514
|
type: "itemId",
|
|
516
515
|
itemId: e
|
|
517
516
|
} : typeof e == "object" ? {
|
|
@@ -526,39 +525,39 @@ function Ge(e) {
|
|
|
526
525
|
"seed",
|
|
527
526
|
"itemProperties",
|
|
528
527
|
u
|
|
529
|
-
], [u]), { data: p = [], isLoading: m, error: h } =
|
|
528
|
+
], [u]), { data: p = [], isLoading: m, error: h } = U({
|
|
530
529
|
queryKey: f,
|
|
531
|
-
queryFn: () =>
|
|
530
|
+
queryFn: () => Ue(c, l),
|
|
532
531
|
enabled: t && !!u
|
|
533
|
-
}), g =
|
|
534
|
-
if (!t || !c && !l) return
|
|
532
|
+
}), g = Y(o(() => {
|
|
533
|
+
if (!t || !c && !l) return Z("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
535
534
|
let e = d.getAppDb();
|
|
536
|
-
if (!e) return
|
|
537
|
-
|
|
535
|
+
if (!e) return Z("[useItemProperties] Query: returning null (no db)"), null;
|
|
536
|
+
Z(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${l}`);
|
|
538
537
|
let n = l ? e.select({
|
|
539
|
-
propertyName:
|
|
540
|
-
propertyValue:
|
|
541
|
-
seedLocalId:
|
|
542
|
-
seedUid:
|
|
543
|
-
modelType:
|
|
544
|
-
schemaUid:
|
|
545
|
-
createdAt:
|
|
546
|
-
attestationCreatedAt:
|
|
547
|
-
localId:
|
|
548
|
-
revokedAt:
|
|
549
|
-
}).from(
|
|
550
|
-
propertyName:
|
|
551
|
-
propertyValue:
|
|
552
|
-
seedLocalId:
|
|
553
|
-
seedUid:
|
|
554
|
-
modelType:
|
|
555
|
-
schemaUid:
|
|
556
|
-
createdAt:
|
|
557
|
-
attestationCreatedAt:
|
|
558
|
-
localId:
|
|
559
|
-
revokedAt:
|
|
560
|
-
}).from(
|
|
561
|
-
return
|
|
538
|
+
propertyName: A.propertyName,
|
|
539
|
+
propertyValue: A.propertyValue,
|
|
540
|
+
seedLocalId: A.seedLocalId,
|
|
541
|
+
seedUid: A.seedUid,
|
|
542
|
+
modelType: A.modelType,
|
|
543
|
+
schemaUid: A.schemaUid,
|
|
544
|
+
createdAt: A.createdAt,
|
|
545
|
+
attestationCreatedAt: A.attestationCreatedAt,
|
|
546
|
+
localId: A.localId,
|
|
547
|
+
revokedAt: A.revokedAt
|
|
548
|
+
}).from(A).where(ge(W(A.seedUid, l), ve(A.propertyName))) : c ? e.select({
|
|
549
|
+
propertyName: A.propertyName,
|
|
550
|
+
propertyValue: A.propertyValue,
|
|
551
|
+
seedLocalId: A.seedLocalId,
|
|
552
|
+
seedUid: A.seedUid,
|
|
553
|
+
modelType: A.modelType,
|
|
554
|
+
schemaUid: A.schemaUid,
|
|
555
|
+
createdAt: A.createdAt,
|
|
556
|
+
attestationCreatedAt: A.attestationCreatedAt,
|
|
557
|
+
localId: A.localId,
|
|
558
|
+
revokedAt: A.revokedAt
|
|
559
|
+
}).from(A).where(ge(W(A.seedLocalId, c), ve(A.propertyName))) : null;
|
|
560
|
+
return Z("[useItemProperties] Query: created query object", { queryType: l ? "seedUid" : "seedLocalId" }), n;
|
|
562
561
|
}, [
|
|
563
562
|
t,
|
|
564
563
|
c,
|
|
@@ -589,7 +588,7 @@ function Ge(e) {
|
|
|
589
588
|
error: h
|
|
590
589
|
};
|
|
591
590
|
}
|
|
592
|
-
var
|
|
591
|
+
var Ge = () => {
|
|
593
592
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
594
593
|
if (!t.propertyName || !t.seedLocalId && !t.seedUid || !t.modelName) {
|
|
595
594
|
o(/* @__PURE__ */ Error("seedLocalId or seedUid, propertyName, and modelName are required"));
|
|
@@ -618,7 +617,7 @@ var Ke = () => {
|
|
|
618
617
|
error: a,
|
|
619
618
|
resetError: l
|
|
620
619
|
};
|
|
621
|
-
},
|
|
620
|
+
}, Ke = () => {
|
|
622
621
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
623
622
|
return {
|
|
624
623
|
destroy: n(async (e) => {
|
|
@@ -637,25 +636,25 @@ var Ke = () => {
|
|
|
637
636
|
error: r,
|
|
638
637
|
resetError: n(() => i(null), [])
|
|
639
638
|
};
|
|
640
|
-
},
|
|
639
|
+
}, qe = /* @__PURE__ */ new Set([
|
|
641
640
|
p.SAVE_CONFIG,
|
|
642
641
|
p.PROCESS_SCHEMA_FILES,
|
|
643
642
|
p.ADD_MODELS_TO_STORE,
|
|
644
643
|
p.ADD_MODELS_TO_DB,
|
|
645
644
|
p.IDLE
|
|
646
|
-
]),
|
|
645
|
+
]), Je = (e) => typeof e == "string" && qe.has(e), Ye = () => ({ dbsAreReady: fe(O().getService(), (e) => Je(e.value)) }), Xe = R("seedSdk:react:services"), Ze = [
|
|
647
646
|
"idle",
|
|
648
647
|
"ready",
|
|
649
648
|
"done",
|
|
650
649
|
"success",
|
|
651
650
|
"initialized"
|
|
652
|
-
],
|
|
651
|
+
], Qe = (e) => {
|
|
653
652
|
let t = "actor", n = e;
|
|
654
|
-
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t =
|
|
655
|
-
},
|
|
653
|
+
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t = et(e)), t;
|
|
654
|
+
}, $e = (e) => {
|
|
656
655
|
let t;
|
|
657
|
-
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value),
|
|
658
|
-
},
|
|
656
|
+
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), Qe(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;
|
|
657
|
+
}, et = (e) => {
|
|
659
658
|
let t = e;
|
|
660
659
|
if (!e || !t.logic || !t.logic.config || !t._snapshot) return;
|
|
661
660
|
let n = t.logic.config;
|
|
@@ -666,21 +665,21 @@ var Ke = () => {
|
|
|
666
665
|
try {
|
|
667
666
|
i = e.getSnapshot();
|
|
668
667
|
} catch (e) {
|
|
669
|
-
return
|
|
668
|
+
return Xe("Error:", e), r;
|
|
670
669
|
}
|
|
671
670
|
if (i) {
|
|
672
671
|
let e = i.context;
|
|
673
|
-
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r =
|
|
672
|
+
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r = be(e.modelName.toLowerCase()));
|
|
674
673
|
}
|
|
675
674
|
return r;
|
|
676
|
-
},
|
|
675
|
+
}, tt = (e) => {
|
|
677
676
|
let [t, r] = c(0), a = (e) => {
|
|
678
677
|
let t = 0, n = e;
|
|
679
678
|
if (n.logic?.states) {
|
|
680
679
|
let r = [], i = [];
|
|
681
680
|
for (let [e, t] of Object.entries(n.logic.states)) t.tags?.includes("loading") && (r.push(e), i.push(t));
|
|
682
|
-
let a = i.length, o =
|
|
683
|
-
if (o &&
|
|
681
|
+
let a = i.length, o = $e(e);
|
|
682
|
+
if (o && Ze.includes(o)) return 0;
|
|
684
683
|
o && (t = r.indexOf(o) / a * 100);
|
|
685
684
|
}
|
|
686
685
|
return t;
|
|
@@ -698,16 +697,16 @@ var Ke = () => {
|
|
|
698
697
|
let e = s();
|
|
699
698
|
return () => clearInterval(e);
|
|
700
699
|
}, []), {
|
|
701
|
-
name:
|
|
700
|
+
name: Qe(e),
|
|
702
701
|
timeElapsed: t,
|
|
703
|
-
value:
|
|
702
|
+
value: $e(e),
|
|
704
703
|
percentComplete: a(e),
|
|
705
|
-
uniqueKey:
|
|
704
|
+
uniqueKey: et(e)
|
|
706
705
|
};
|
|
707
|
-
},
|
|
708
|
-
let { internalStatus: e } =
|
|
706
|
+
}, nt = () => {
|
|
707
|
+
let { internalStatus: e } = st();
|
|
709
708
|
return e === "ready";
|
|
710
|
-
},
|
|
709
|
+
}, rt = () => {}, it = () => !1, at = (e) => {
|
|
711
710
|
switch (e) {
|
|
712
711
|
case p.IDLE: return 100;
|
|
713
712
|
case p.ADD_MODELS_TO_DB: return 90;
|
|
@@ -719,13 +718,13 @@ var Ke = () => {
|
|
|
719
718
|
case p.PLATFORM_CLASSES_INIT: return 10;
|
|
720
719
|
default: return 0;
|
|
721
720
|
}
|
|
722
|
-
},
|
|
723
|
-
let [e, t] = c([]), [n, r] = c(() =>
|
|
721
|
+
}, ot = () => {
|
|
722
|
+
let [e, t] = c([]), [n, r] = c(() => at(O().getService().getSnapshot().value));
|
|
724
723
|
return i(() => {
|
|
725
|
-
let e =
|
|
726
|
-
n.uniqueKey = "clientManager", t([n]), r(
|
|
724
|
+
let e = O().getService(), n = e;
|
|
725
|
+
n.uniqueKey = "clientManager", t([n]), r(at(e.getSnapshot().value));
|
|
727
726
|
let i = e.subscribe((e) => {
|
|
728
|
-
r(
|
|
727
|
+
r(at(e.value));
|
|
729
728
|
});
|
|
730
729
|
return () => {
|
|
731
730
|
i.unsubscribe();
|
|
@@ -734,17 +733,17 @@ var Ke = () => {
|
|
|
734
733
|
services: e,
|
|
735
734
|
percentComplete: n
|
|
736
735
|
};
|
|
737
|
-
},
|
|
738
|
-
let e =
|
|
736
|
+
}, st = () => {
|
|
737
|
+
let e = O().getService();
|
|
739
738
|
return {
|
|
740
|
-
status:
|
|
741
|
-
internalStatus:
|
|
739
|
+
status: fe(e, (e) => e.value),
|
|
740
|
+
internalStatus: fe(e, (e) => Je(e.value) ? "ready" : e.value)
|
|
742
741
|
};
|
|
743
|
-
},
|
|
744
|
-
let [t, r] = c(null), [a, o] = c(!!e), [u, d] = c(null), f = s(null), p =
|
|
742
|
+
}, ct = R("seedSdk:react:schema"), lt = (e) => {
|
|
743
|
+
let [t, r] = c(null), [a, o] = c(!!e), [u, d] = c(null), f = s(null), p = q(), m = n(async (e, t) => {
|
|
745
744
|
o(!0), d(null);
|
|
746
745
|
try {
|
|
747
|
-
if (!await
|
|
746
|
+
if (!await ut(e)) {
|
|
748
747
|
if (!t()) return;
|
|
749
748
|
r(null), o(!1);
|
|
750
749
|
return;
|
|
@@ -761,7 +760,7 @@ var Ke = () => {
|
|
|
761
760
|
};
|
|
762
761
|
a(i.getSnapshot()), f.current = i.subscribe(a);
|
|
763
762
|
} catch (e) {
|
|
764
|
-
if (
|
|
763
|
+
if (ct("[useSchema] Error creating schema:", e), !t()) return;
|
|
765
764
|
d(e), r(null), o(!1);
|
|
766
765
|
}
|
|
767
766
|
}, []);
|
|
@@ -784,23 +783,23 @@ var Ke = () => {
|
|
|
784
783
|
error: u
|
|
785
784
|
};
|
|
786
785
|
};
|
|
787
|
-
async function
|
|
786
|
+
async function ut(e) {
|
|
788
787
|
if (e === b) return !0;
|
|
789
788
|
let t = d.getAppDb();
|
|
790
|
-
return !t || (await t.select({ id:
|
|
789
|
+
return !t || (await t.select({ id: P.id }).from(P).where(K(W(P.name, e), W(P.schemaFileId, e))).limit(1)).length > 0;
|
|
791
790
|
}
|
|
792
|
-
var
|
|
793
|
-
let e =
|
|
794
|
-
queryKey:
|
|
791
|
+
var dt = ["seed", "schemas"], ft = () => {
|
|
792
|
+
let e = q(), t = he(), n = s(void 0), r = s([]), { data: a = [], isLoading: c, error: l } = U({
|
|
793
|
+
queryKey: dt,
|
|
795
794
|
queryFn: () => x.all({ waitForReady: !0 }),
|
|
796
795
|
enabled: e
|
|
797
796
|
});
|
|
798
797
|
r.current = a;
|
|
799
|
-
let u = e ? d.getAppDb() : null, f =
|
|
798
|
+
let u = e ? d.getAppDb() : null, f = Y(o(() => u ? u.select().from(P).orderBy(P.name, _e(P.version)) : null, [u, e]));
|
|
800
799
|
return i(() => {
|
|
801
800
|
if (typeof BroadcastChannel > "u") return;
|
|
802
801
|
let e = new BroadcastChannel("seed-schemas-invalidate"), n = () => {
|
|
803
|
-
t.invalidateQueries({ queryKey:
|
|
802
|
+
t.invalidateQueries({ queryKey: dt });
|
|
804
803
|
};
|
|
805
804
|
return e.addEventListener("message", n), () => {
|
|
806
805
|
e.removeEventListener("message", n), e.close();
|
|
@@ -823,7 +822,7 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
823
822
|
let o = /* @__PURE__ */ new Set();
|
|
824
823
|
for (let e of f) e.name !== "Seed Protocol" && (e.schemaFileId ? o.add(e.schemaFileId) : e.name != null && e.version !== void 0 && o.add(`${e.name}:${e.version}`));
|
|
825
824
|
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));
|
|
826
|
-
!s && (c || l) && t.invalidateQueries({ queryKey:
|
|
825
|
+
!s && (c || l) && t.invalidateQueries({ queryKey: dt });
|
|
827
826
|
}, [
|
|
828
827
|
e,
|
|
829
828
|
f,
|
|
@@ -833,7 +832,7 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
833
832
|
isLoading: c,
|
|
834
833
|
error: l
|
|
835
834
|
};
|
|
836
|
-
},
|
|
835
|
+
}, pt = () => {
|
|
837
836
|
let e = s(null), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
838
837
|
o(null), r(!0), e.current?.unsubscribe(), e.current = null;
|
|
839
838
|
let n = x.create(t, { waitForReady: !1 }), i = n.getService().subscribe((e) => {
|
|
@@ -853,7 +852,7 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
853
852
|
error: a,
|
|
854
853
|
resetError: l
|
|
855
854
|
};
|
|
856
|
-
},
|
|
855
|
+
}, mt = () => {
|
|
857
856
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
858
857
|
return {
|
|
859
858
|
destroy: n(async (e) => {
|
|
@@ -872,10 +871,10 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
872
871
|
error: r,
|
|
873
872
|
resetError: n(() => i(null), [])
|
|
874
873
|
};
|
|
875
|
-
},
|
|
876
|
-
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a =
|
|
874
|
+
}, ht = () => {
|
|
875
|
+
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a = q(), o = n(async () => {
|
|
877
876
|
if (a) try {
|
|
878
|
-
let e = await
|
|
877
|
+
let e = await re(), n = /* @__PURE__ */ new Set();
|
|
879
878
|
for (let t of e) {
|
|
880
879
|
let e = t.schema.metadata?.name;
|
|
881
880
|
e && n.add(e);
|
|
@@ -891,7 +890,7 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
891
890
|
for (let [e, t] of r.current.entries()) n.has(e) || t.unload();
|
|
892
891
|
r.current = i, t(Array.from(i.values()));
|
|
893
892
|
} catch (e) {
|
|
894
|
-
|
|
893
|
+
ct("Error fetching all schema versions from database:", e), t(null);
|
|
895
894
|
}
|
|
896
895
|
}, [a]);
|
|
897
896
|
return i(() => {
|
|
@@ -901,12 +900,12 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
901
900
|
e.unload();
|
|
902
901
|
}), r.current.clear();
|
|
903
902
|
}, []), e;
|
|
904
|
-
},
|
|
903
|
+
}, gt = () => lt(b), _t = (e) => [
|
|
905
904
|
"seed",
|
|
906
905
|
"models",
|
|
907
906
|
e
|
|
908
|
-
],
|
|
909
|
-
let t =
|
|
907
|
+
], vt, yt = (e) => {
|
|
908
|
+
let t = q(), n = r(pe) ?? vt ?? (vt = new H()), a = s(null), c = o(() => _t(e), [e]), { data: l = [], isLoading: u, error: f } = U({
|
|
910
909
|
queryKey: c,
|
|
911
910
|
queryFn: async () => {
|
|
912
911
|
let t = await v.all(e, { waitForReady: !1 }), r = n.getQueryData(c), i = a.current;
|
|
@@ -932,11 +931,11 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
932
931
|
function _() {
|
|
933
932
|
let t = d.getAppDb();
|
|
934
933
|
return !t || !e ? null : t.select({
|
|
935
|
-
modelFileId:
|
|
936
|
-
modelName:
|
|
937
|
-
}).from(
|
|
934
|
+
modelFileId: M.schemaFileId,
|
|
935
|
+
modelName: M.name
|
|
936
|
+
}).from(P).innerJoin(j, W(P.id, j.schemaId)).innerJoin(M, W(j.modelId, M.id)).where(K(W(P.schemaFileId, e), W(P.name, e)));
|
|
938
937
|
}
|
|
939
|
-
let y =
|
|
938
|
+
let y = Y(o(() => {
|
|
940
939
|
if (!e || !t) return null;
|
|
941
940
|
let n = {
|
|
942
941
|
schemaId: e,
|
|
@@ -967,8 +966,8 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
967
966
|
isLoading: u,
|
|
968
967
|
error: f
|
|
969
968
|
};
|
|
970
|
-
},
|
|
971
|
-
let n =
|
|
969
|
+
}, bt = (e, t) => {
|
|
970
|
+
let n = q(), [r, a] = c(void 0), [l, u] = c(!1), [d, f] = c(null), p = s(void 0), [, m] = c(0), h = t == null;
|
|
972
971
|
o(() => n ? h ? !!e : !!(e && t) : !1, [
|
|
973
972
|
n,
|
|
974
973
|
h,
|
|
@@ -989,7 +988,7 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
989
988
|
h,
|
|
990
989
|
e
|
|
991
990
|
]);
|
|
992
|
-
let { models: g, isLoading: _, error: y } =
|
|
991
|
+
let { models: g, isLoading: _, error: y } = yt(h ? null : e), b = o(() => {
|
|
993
992
|
if (!h && t) return g.find((e) => (e.modelName ?? e.name) === t);
|
|
994
993
|
}, [
|
|
995
994
|
h,
|
|
@@ -1011,7 +1010,7 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
1011
1010
|
isLoading: _,
|
|
1012
1011
|
error: y
|
|
1013
1012
|
};
|
|
1014
|
-
},
|
|
1013
|
+
}, xt = () => {
|
|
1015
1014
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t, n, i) => {
|
|
1016
1015
|
o(null), r(!0), e.current?.unsubscribe(), e.current = void 0;
|
|
1017
1016
|
let a = v.create(n, t, {
|
|
@@ -1030,7 +1029,7 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
1030
1029
|
error: a,
|
|
1031
1030
|
resetError: l
|
|
1032
1031
|
};
|
|
1033
|
-
},
|
|
1032
|
+
}, St = () => {
|
|
1034
1033
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1035
1034
|
return {
|
|
1036
1035
|
destroy: n(async (e) => {
|
|
@@ -1052,17 +1051,17 @@ var ft = ["seed", "schemas"], pt = () => {
|
|
|
1052
1051
|
};
|
|
1053
1052
|
//#endregion
|
|
1054
1053
|
//#region src/modelProperty.ts
|
|
1055
|
-
|
|
1056
|
-
async function
|
|
1054
|
+
R("seedSdk:browser:react:modelProperty");
|
|
1055
|
+
async function Ct(e) {
|
|
1057
1056
|
let t = d.getAppDb();
|
|
1058
1057
|
if (t) {
|
|
1059
|
-
let n = await t.select({ name:
|
|
1058
|
+
let n = await t.select({ name: P.name }).from(P).where(K(W(P.name, e), W(P.schemaFileId, e))).limit(1);
|
|
1060
1059
|
if (n[0]?.name) return n[0].name;
|
|
1061
1060
|
}
|
|
1062
|
-
return
|
|
1061
|
+
return k(e) ?? e;
|
|
1063
1062
|
}
|
|
1064
|
-
var
|
|
1065
|
-
let { model: n } =
|
|
1063
|
+
var wt = (e, t) => {
|
|
1064
|
+
let { model: n } = bt(e, t);
|
|
1066
1065
|
o(() => {
|
|
1067
1066
|
if (n) try {
|
|
1068
1067
|
return n.modelName ?? n.name;
|
|
@@ -1070,20 +1069,20 @@ var Tt = (e, t) => {
|
|
|
1070
1069
|
return;
|
|
1071
1070
|
}
|
|
1072
1071
|
}, [n]);
|
|
1073
|
-
let r =
|
|
1072
|
+
let r = q(), a = he(), c = Dt(n), l = n?.id, u = o(() => [
|
|
1074
1073
|
"seed",
|
|
1075
1074
|
"modelProperties",
|
|
1076
1075
|
l ?? ""
|
|
1077
|
-
], [l]), { data: f = [], isLoading: p, error: m } =
|
|
1076
|
+
], [l]), { data: f = [], isLoading: p, error: m } = U({
|
|
1078
1077
|
queryKey: u,
|
|
1079
1078
|
queryFn: () => y.all(l, { waitForReady: !0 }),
|
|
1080
1079
|
enabled: r && !!l
|
|
1081
|
-
}), h = r ? d.getAppDb() : null, g =
|
|
1080
|
+
}), h = r ? d.getAppDb() : null, g = Y(o(() => !h || !c ? null : h.select({
|
|
1082
1081
|
id: le.id,
|
|
1083
1082
|
name: le.name,
|
|
1084
1083
|
dataType: le.dataType,
|
|
1085
1084
|
schemaFileId: le.schemaFileId
|
|
1086
|
-
}).from(le).where(
|
|
1085
|
+
}).from(le).where(W(le.modelId, c)), [
|
|
1087
1086
|
h,
|
|
1088
1087
|
r,
|
|
1089
1088
|
c
|
|
@@ -1124,24 +1123,24 @@ var Tt = (e, t) => {
|
|
|
1124
1123
|
isLoading: p && f.length === 0,
|
|
1125
1124
|
error: m
|
|
1126
1125
|
};
|
|
1127
|
-
},
|
|
1126
|
+
}, Tt = [
|
|
1128
1127
|
400,
|
|
1129
1128
|
1200,
|
|
1130
1129
|
2500
|
|
1131
|
-
],
|
|
1130
|
+
], Et = (e) => {
|
|
1132
1131
|
if (e) try {
|
|
1133
1132
|
return e._getSnapshotContext()._dbId;
|
|
1134
1133
|
} catch {
|
|
1135
1134
|
return;
|
|
1136
1135
|
}
|
|
1137
|
-
},
|
|
1138
|
-
let [t, n] = c(() =>
|
|
1136
|
+
}, Dt = (e) => {
|
|
1137
|
+
let [t, n] = c(() => Et(e));
|
|
1139
1138
|
return i(() => {
|
|
1140
|
-
if (n(
|
|
1141
|
-
let t = e.getService().subscribe(() => n(
|
|
1139
|
+
if (n(Et(e)), !e) return;
|
|
1140
|
+
let t = e.getService().subscribe(() => n(Et(e)));
|
|
1142
1141
|
return () => t.unsubscribe();
|
|
1143
1142
|
}, [e]), t;
|
|
1144
|
-
},
|
|
1143
|
+
}, Ot = async (e, t) => {
|
|
1145
1144
|
let n = await v.createById(e);
|
|
1146
1145
|
if (!n) return;
|
|
1147
1146
|
let r = n.modelName ?? n.name;
|
|
@@ -1150,12 +1149,12 @@ var Tt = (e, t) => {
|
|
|
1150
1149
|
schemaName: n.schemaName
|
|
1151
1150
|
});
|
|
1152
1151
|
};
|
|
1153
|
-
function
|
|
1152
|
+
function kt(e, t, r) {
|
|
1154
1153
|
let a = o(() => r == null ? t == null ? !!e : !!(e && t) : !!(e && t && r), [
|
|
1155
1154
|
e,
|
|
1156
1155
|
t,
|
|
1157
1156
|
r
|
|
1158
|
-
]), [u, d] = c(void 0), [f, p] = c(a), [m, h] = c(null), g = s(void 0), _ =
|
|
1157
|
+
]), [u, d] = c(void 0), [f, p] = c(a), [m, h] = c(null), g = s(void 0), _ = q(), b = o(() => r == null ? t == null ? {
|
|
1159
1158
|
type: "propertyFileId",
|
|
1160
1159
|
propertyFileId: e
|
|
1161
1160
|
} : {
|
|
@@ -1192,7 +1191,7 @@ function At(e, t, r) {
|
|
|
1192
1191
|
d(void 0), p(!1), h(null);
|
|
1193
1192
|
return;
|
|
1194
1193
|
}
|
|
1195
|
-
t = await
|
|
1194
|
+
t = await Ot(b.modelFileId, b.propertyName);
|
|
1196
1195
|
let e = await v.createById(b.modelFileId);
|
|
1197
1196
|
n = e?.modelName ?? e?.name;
|
|
1198
1197
|
} else {
|
|
@@ -1200,7 +1199,7 @@ function At(e, t, r) {
|
|
|
1200
1199
|
d(void 0), p(!1), h(null);
|
|
1201
1200
|
return;
|
|
1202
1201
|
}
|
|
1203
|
-
let e = await
|
|
1202
|
+
let e = await Ct(b.schemaId);
|
|
1204
1203
|
t = await te(b.modelName, b.propertyName, { schemaName: e }), n = b.modelName;
|
|
1205
1204
|
}
|
|
1206
1205
|
if (t && n) {
|
|
@@ -1230,7 +1229,7 @@ function At(e, t, r) {
|
|
|
1230
1229
|
let C = s(!1);
|
|
1231
1230
|
C.current = f || !!u || !!m, i(() => {
|
|
1232
1231
|
if (!x || b.type === "propertyFileId") return;
|
|
1233
|
-
let e =
|
|
1232
|
+
let e = Tt.map((e) => setTimeout(() => {
|
|
1234
1233
|
C.current || S({ quiet: !0 });
|
|
1235
1234
|
}, e));
|
|
1236
1235
|
return () => e.forEach((e) => clearTimeout(e));
|
|
@@ -1243,7 +1242,7 @@ function At(e, t, r) {
|
|
|
1243
1242
|
return i(() => {
|
|
1244
1243
|
if (!u || !w) return;
|
|
1245
1244
|
g.current?.unsubscribe();
|
|
1246
|
-
let e =
|
|
1245
|
+
let e = I(S, 100), t = u.getService().subscribe(() => {
|
|
1247
1246
|
e();
|
|
1248
1247
|
});
|
|
1249
1248
|
return g.current = t, () => {
|
|
@@ -1259,13 +1258,13 @@ function At(e, t, r) {
|
|
|
1259
1258
|
error: m
|
|
1260
1259
|
};
|
|
1261
1260
|
}
|
|
1262
|
-
var
|
|
1261
|
+
var At = () => {
|
|
1263
1262
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t, n, i) => {
|
|
1264
1263
|
if (o(null), r(!0), e.current?.unsubscribe(), e.current = void 0, !n || !i.name || !i.dataType) {
|
|
1265
1264
|
let e = /* @__PURE__ */ Error("modelName, property name and dataType are required");
|
|
1266
1265
|
throw o(e), r(!1), e;
|
|
1267
1266
|
}
|
|
1268
|
-
let a =
|
|
1267
|
+
let a = k(t) ?? t, s = y.create({
|
|
1269
1268
|
...i,
|
|
1270
1269
|
modelName: n
|
|
1271
1270
|
}, {
|
|
@@ -1288,7 +1287,7 @@ var jt = () => {
|
|
|
1288
1287
|
error: a,
|
|
1289
1288
|
resetError: l
|
|
1290
1289
|
};
|
|
1291
|
-
},
|
|
1290
|
+
}, jt = () => {
|
|
1292
1291
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1293
1292
|
return {
|
|
1294
1293
|
destroy: n(async (e) => {
|
|
@@ -1307,7 +1306,7 @@ var jt = () => {
|
|
|
1307
1306
|
error: r,
|
|
1308
1307
|
resetError: n(() => i(null), [])
|
|
1309
1308
|
};
|
|
1310
|
-
},
|
|
1309
|
+
}, Mt = () => {
|
|
1311
1310
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1312
1311
|
return {
|
|
1313
1312
|
deleteItem: n(async (e) => {
|
|
@@ -1326,23 +1325,23 @@ var jt = () => {
|
|
|
1326
1325
|
error: r,
|
|
1327
1326
|
resetError: n(() => i(null), [])
|
|
1328
1327
|
};
|
|
1329
|
-
},
|
|
1330
|
-
function
|
|
1331
|
-
let e =
|
|
1332
|
-
queryKey:
|
|
1328
|
+
}, Nt = ["seed", "imageFiles"];
|
|
1329
|
+
function Pt() {
|
|
1330
|
+
let e = q(), t = he(), { data: n = [], isLoading: r, error: a, refetch: o } = U({
|
|
1331
|
+
queryKey: Nt,
|
|
1333
1332
|
queryFn: () => f.listImageFiles(),
|
|
1334
1333
|
enabled: e
|
|
1335
1334
|
});
|
|
1336
1335
|
return i(() => {
|
|
1337
1336
|
let e = (e) => {
|
|
1338
|
-
e.includes("/images/") && t.invalidateQueries({ queryKey:
|
|
1337
|
+
e.includes("/images/") && t.invalidateQueries({ queryKey: Nt });
|
|
1339
1338
|
}, n = () => {
|
|
1340
|
-
t.invalidateQueries({ queryKey:
|
|
1339
|
+
t.invalidateQueries({ queryKey: Nt });
|
|
1341
1340
|
}, r = (e) => {
|
|
1342
|
-
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey:
|
|
1341
|
+
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey: Nt });
|
|
1343
1342
|
};
|
|
1344
|
-
return
|
|
1345
|
-
|
|
1343
|
+
return E.on("file-saved", e), E.on("fs.downloadAll.success", n), E.on(h, r), () => {
|
|
1344
|
+
E.off("file-saved", e), E.off("fs.downloadAll.success", n), E.off(h, r);
|
|
1346
1345
|
};
|
|
1347
1346
|
}, [t]), {
|
|
1348
1347
|
imageFiles: n,
|
|
@@ -1353,9 +1352,9 @@ function Ft() {
|
|
|
1353
1352
|
}
|
|
1354
1353
|
//#endregion
|
|
1355
1354
|
//#region src/useFiles.ts
|
|
1356
|
-
var
|
|
1357
|
-
function
|
|
1358
|
-
let t =
|
|
1355
|
+
var Ft = ["seed", "files"];
|
|
1356
|
+
function It(e = "files") {
|
|
1357
|
+
let t = q(), n = he(), r = o(() => [...Ft, e], [e]), { data: a = [], isLoading: s, error: c, refetch: l } = U({
|
|
1359
1358
|
queryKey: r,
|
|
1360
1359
|
queryFn: () => f.listFiles(e),
|
|
1361
1360
|
enabled: t
|
|
@@ -1368,8 +1367,8 @@ function Lt(e = "files") {
|
|
|
1368
1367
|
}, a = (t) => {
|
|
1369
1368
|
t.some((t) => t.includes(`/${e}/`)) && n.invalidateQueries({ queryKey: r });
|
|
1370
1369
|
};
|
|
1371
|
-
return
|
|
1372
|
-
|
|
1370
|
+
return E.on("file-saved", t), E.on("fs.downloadAll.success", i), E.on(h, a), () => {
|
|
1371
|
+
E.off("file-saved", t), E.off("fs.downloadAll.success", i), E.off(h, a);
|
|
1373
1372
|
};
|
|
1374
1373
|
}, [
|
|
1375
1374
|
n,
|
|
@@ -1384,25 +1383,25 @@ function Lt(e = "files") {
|
|
|
1384
1383
|
}
|
|
1385
1384
|
//#endregion
|
|
1386
1385
|
//#region src/useEasSyncProcesses.ts
|
|
1387
|
-
function
|
|
1386
|
+
function Lt() {
|
|
1388
1387
|
let e = d.getAppDb();
|
|
1389
|
-
return o(() => e ? e.select().from(
|
|
1388
|
+
return o(() => e ? e.select().from(w).orderBy(_e(w.startedAt)) : null, [e]);
|
|
1390
1389
|
}
|
|
1391
|
-
function
|
|
1392
|
-
let e =
|
|
1390
|
+
function Rt() {
|
|
1391
|
+
let e = Y(Lt());
|
|
1393
1392
|
return {
|
|
1394
1393
|
records: e,
|
|
1395
1394
|
nonActiveCount: o(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
|
|
1396
1395
|
};
|
|
1397
1396
|
}
|
|
1398
|
-
function
|
|
1399
|
-
return
|
|
1397
|
+
function zt() {
|
|
1398
|
+
return Y(Lt());
|
|
1400
1399
|
}
|
|
1401
|
-
function
|
|
1402
|
-
return
|
|
1400
|
+
function Bt() {
|
|
1401
|
+
return Rt().nonActiveCount;
|
|
1403
1402
|
}
|
|
1404
|
-
function
|
|
1405
|
-
let t = d.getAppDb(), n = o(() => e != null && t ? t.select().from(
|
|
1403
|
+
function Vt(e) {
|
|
1404
|
+
let t = d.getAppDb(), n = o(() => e != null && t ? t.select().from(w).where(W(w.id, e)).limit(1) : null, [t, e]), r = Y(n), i = n != null && r === void 0;
|
|
1406
1405
|
return {
|
|
1407
1406
|
record: r && r.length > 0 ? r[0] : null,
|
|
1408
1407
|
isLoading: i
|
|
@@ -1410,12 +1409,12 @@ function Ht(e) {
|
|
|
1410
1409
|
}
|
|
1411
1410
|
//#endregion
|
|
1412
1411
|
//#region src/SeedProvider.tsx
|
|
1413
|
-
var
|
|
1414
|
-
function
|
|
1415
|
-
let t =
|
|
1412
|
+
var Ht = null;
|
|
1413
|
+
function Ut(e) {
|
|
1414
|
+
let t = Ht?.(e);
|
|
1416
1415
|
return typeof window < "u" && window.__SEED_INVALIDATE_ITEM_PROPERTIES__ && window.__SEED_INVALIDATE_ITEM_PROPERTIES__(e), Promise.resolve(t).then(() => {});
|
|
1417
1416
|
}
|
|
1418
|
-
function
|
|
1417
|
+
function Wt({ queryClient: e }) {
|
|
1419
1418
|
return i(() => {
|
|
1420
1419
|
let t = (t) => {
|
|
1421
1420
|
let n = [
|
|
@@ -1425,7 +1424,7 @@ function Gt({ queryClient: e }) {
|
|
|
1425
1424
|
];
|
|
1426
1425
|
return e.invalidateQueries({ queryKey: n }), e.refetchQueries({ queryKey: n });
|
|
1427
1426
|
};
|
|
1428
|
-
|
|
1427
|
+
Ht = t, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = t);
|
|
1429
1428
|
let n = (e) => {
|
|
1430
1429
|
let n = e?.seedLocalId ?? e?.seedUid;
|
|
1431
1430
|
n && t(n);
|
|
@@ -1435,13 +1434,13 @@ function Gt({ queryClient: e }) {
|
|
|
1435
1434
|
exact: !1
|
|
1436
1435
|
});
|
|
1437
1436
|
};
|
|
1438
|
-
return
|
|
1439
|
-
|
|
1437
|
+
return E.on("itemProperty.saved", n), E.on(m, r), () => {
|
|
1438
|
+
E.off("itemProperty.saved", n), E.off(m, r), Ht = null, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = null);
|
|
1440
1439
|
};
|
|
1441
1440
|
}, [e]), null;
|
|
1442
1441
|
}
|
|
1443
|
-
function
|
|
1444
|
-
let r = o(() => t ??
|
|
1442
|
+
function Gt({ children: e, queryClient: t, queryClientRef: n }) {
|
|
1443
|
+
let r = o(() => t ?? X(), [t]);
|
|
1445
1444
|
if (n && (n.current = r, typeof window < "u")) {
|
|
1446
1445
|
let e = window;
|
|
1447
1446
|
e.__TEST_SEED_QUERY_CLIENT__ = r;
|
|
@@ -1449,18 +1448,18 @@ function Kt({ children: e, queryClient: t, queryClientRef: n }) {
|
|
|
1449
1448
|
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = r);
|
|
1450
1449
|
} catch {}
|
|
1451
1450
|
}
|
|
1452
|
-
return /* @__PURE__ */
|
|
1451
|
+
return /* @__PURE__ */ B(me, {
|
|
1453
1452
|
client: r,
|
|
1454
|
-
children: /* @__PURE__ */
|
|
1453
|
+
children: /* @__PURE__ */ V(we, {
|
|
1455
1454
|
queryClient: r,
|
|
1456
|
-
children: [/* @__PURE__ */
|
|
1455
|
+
children: [/* @__PURE__ */ B(Wt, { queryClient: r }), e]
|
|
1457
1456
|
})
|
|
1458
1457
|
});
|
|
1459
1458
|
}
|
|
1460
1459
|
//#endregion
|
|
1461
1460
|
//#region src/SeedClientGate.tsx
|
|
1462
|
-
function
|
|
1463
|
-
return /* @__PURE__ */
|
|
1461
|
+
function Kt() {
|
|
1462
|
+
return /* @__PURE__ */ B("div", {
|
|
1464
1463
|
style: {
|
|
1465
1464
|
display: "flex",
|
|
1466
1465
|
alignItems: "center",
|
|
@@ -1471,8 +1470,8 @@ function qt() {
|
|
|
1471
1470
|
children: "Loading..."
|
|
1472
1471
|
});
|
|
1473
1472
|
}
|
|
1474
|
-
function
|
|
1475
|
-
let l =
|
|
1473
|
+
function qt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1474
|
+
let l = q(), u = s(o);
|
|
1476
1475
|
u.current = o, i(() => {
|
|
1477
1476
|
let n = t ? {
|
|
1478
1477
|
...e,
|
|
@@ -1485,7 +1484,7 @@ function Jt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1485
1484
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1486
1485
|
});
|
|
1487
1486
|
}, [e, t]);
|
|
1488
|
-
let d = n ?? /* @__PURE__ */
|
|
1487
|
+
let d = n ?? /* @__PURE__ */ B(Kt, {}), f = r ? void 0 : {
|
|
1489
1488
|
position: "relative",
|
|
1490
1489
|
display: "flex",
|
|
1491
1490
|
height: "100vh",
|
|
@@ -1500,15 +1499,15 @@ function Jt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1500
1499
|
justifyContent: "center"
|
|
1501
1500
|
}
|
|
1502
1501
|
};
|
|
1503
|
-
return /* @__PURE__ */
|
|
1502
|
+
return /* @__PURE__ */ V("div", {
|
|
1504
1503
|
className: r,
|
|
1505
1504
|
style: f,
|
|
1506
|
-
children: [/* @__PURE__ */
|
|
1505
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1507
1506
|
className: a,
|
|
1508
1507
|
style: p,
|
|
1509
1508
|
"aria-hidden": l,
|
|
1510
1509
|
children: d
|
|
1511
|
-
}), /* @__PURE__ */
|
|
1510
|
+
}), /* @__PURE__ */ B("div", {
|
|
1512
1511
|
style: {
|
|
1513
1512
|
flex: 1,
|
|
1514
1513
|
display: l ? "flex" : "none",
|
|
@@ -1520,54 +1519,54 @@ function Jt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1520
1519
|
}
|
|
1521
1520
|
//#endregion
|
|
1522
1521
|
//#region src/opfsPaths.ts
|
|
1523
|
-
function
|
|
1522
|
+
function Jt(e) {
|
|
1524
1523
|
let t = e.split("/").filter(Boolean);
|
|
1525
1524
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1526
1525
|
return t;
|
|
1527
1526
|
}
|
|
1528
|
-
async function
|
|
1527
|
+
async function Yt(e, t) {
|
|
1529
1528
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1530
1529
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1531
1530
|
return n;
|
|
1532
1531
|
}
|
|
1533
|
-
async function
|
|
1534
|
-
let n =
|
|
1532
|
+
async function Xt(e, t) {
|
|
1533
|
+
let n = Jt(e), r = n.pop();
|
|
1535
1534
|
return {
|
|
1536
|
-
dir: await
|
|
1535
|
+
dir: await Yt(n.join("/"), t),
|
|
1537
1536
|
name: r
|
|
1538
1537
|
};
|
|
1539
1538
|
}
|
|
1540
|
-
async function
|
|
1541
|
-
let { dir: n, name: r } = await
|
|
1539
|
+
async function Zt(e, t) {
|
|
1540
|
+
let { dir: n, name: r } = await Xt(e, t);
|
|
1542
1541
|
return n.getFileHandle(r);
|
|
1543
1542
|
}
|
|
1544
|
-
async function
|
|
1545
|
-
return (await
|
|
1543
|
+
async function Qt(e, t) {
|
|
1544
|
+
return (await Zt(e, t)).getFile();
|
|
1546
1545
|
}
|
|
1547
|
-
async function
|
|
1548
|
-
let { dir: n, name: r } = await
|
|
1546
|
+
async function $t(e, t) {
|
|
1547
|
+
let { dir: n, name: r } = await Xt(e, t);
|
|
1549
1548
|
await n.removeEntry(r);
|
|
1550
1549
|
}
|
|
1551
|
-
async function
|
|
1550
|
+
async function en(e, t) {
|
|
1552
1551
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1553
1552
|
for await (let e of n.entries()) r.push(e);
|
|
1554
1553
|
let i = !0;
|
|
1555
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1554
|
+
for (let [e, t] of r) (t.kind === "file" || !await en(n, e)) && (i = !1);
|
|
1556
1555
|
return i && await e.removeEntry(t), i;
|
|
1557
1556
|
}
|
|
1558
|
-
async function
|
|
1557
|
+
async function tn(e, t) {
|
|
1559
1558
|
try {
|
|
1560
|
-
let { dir: n, name: r } = await
|
|
1561
|
-
return await
|
|
1559
|
+
let { dir: n, name: r } = await Xt(e, t);
|
|
1560
|
+
return await en(n, r);
|
|
1562
1561
|
} catch (e) {
|
|
1563
1562
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1564
1563
|
throw e;
|
|
1565
1564
|
}
|
|
1566
1565
|
}
|
|
1567
|
-
function
|
|
1566
|
+
function nn() {
|
|
1568
1567
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1569
1568
|
}
|
|
1570
|
-
var
|
|
1569
|
+
var rn = [
|
|
1571
1570
|
{
|
|
1572
1571
|
type: "image/jpeg",
|
|
1573
1572
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1578,43 +1577,43 @@ var an = [
|
|
|
1578
1577
|
},
|
|
1579
1578
|
{
|
|
1580
1579
|
type: "image/gif",
|
|
1581
|
-
test: (e) =>
|
|
1580
|
+
test: (e) => an(e, 0, 4) === "GIF8"
|
|
1582
1581
|
},
|
|
1583
1582
|
{
|
|
1584
1583
|
type: "image/webp",
|
|
1585
|
-
test: (e) =>
|
|
1584
|
+
test: (e) => an(e, 0, 4) === "RIFF" && an(e, 8, 12) === "WEBP"
|
|
1586
1585
|
},
|
|
1587
1586
|
{
|
|
1588
1587
|
type: "image/avif",
|
|
1589
|
-
test: (e) =>
|
|
1588
|
+
test: (e) => an(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(an(e, 8, 12))
|
|
1590
1589
|
},
|
|
1591
1590
|
{
|
|
1592
1591
|
type: "application/vnd.sqlite3",
|
|
1593
|
-
test: (e) =>
|
|
1592
|
+
test: (e) => an(e, 0, 15) === "SQLite format 3"
|
|
1594
1593
|
},
|
|
1595
1594
|
{
|
|
1596
1595
|
type: "application/pdf",
|
|
1597
|
-
test: (e) =>
|
|
1596
|
+
test: (e) => an(e, 0, 5) === "%PDF-"
|
|
1598
1597
|
}
|
|
1599
1598
|
];
|
|
1600
|
-
function
|
|
1599
|
+
function an(e, t, n) {
|
|
1601
1600
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1602
1601
|
}
|
|
1603
|
-
function
|
|
1604
|
-
return
|
|
1602
|
+
function on(e) {
|
|
1603
|
+
return rn.find((t) => t.test(e))?.type;
|
|
1605
1604
|
}
|
|
1606
|
-
async function
|
|
1607
|
-
if (e.size !== 0) return
|
|
1605
|
+
async function sn(e) {
|
|
1606
|
+
if (e.size !== 0) return on(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1608
1607
|
}
|
|
1609
1608
|
//#endregion
|
|
1610
1609
|
//#region src/useOPFSFiles.ts
|
|
1611
|
-
async function
|
|
1610
|
+
async function cn(e, t = "") {
|
|
1612
1611
|
let n = [];
|
|
1613
1612
|
try {
|
|
1614
1613
|
for await (let [r, i] of e.entries()) {
|
|
1615
1614
|
let e = t ? `${t}/${r}` : r;
|
|
1616
1615
|
if (i.kind === "file") try {
|
|
1617
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1616
|
+
let t = await i.getFile(), a = t.type ? void 0 : await sn(t).catch(() => void 0);
|
|
1618
1617
|
n.push({
|
|
1619
1618
|
name: r,
|
|
1620
1619
|
path: e,
|
|
@@ -1627,7 +1626,7 @@ async function ln(e, t = "") {
|
|
|
1627
1626
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1628
1627
|
}
|
|
1629
1628
|
else if (i.kind === "directory") {
|
|
1630
|
-
let t = await
|
|
1629
|
+
let t = await cn(i, e);
|
|
1631
1630
|
n.push(...t);
|
|
1632
1631
|
}
|
|
1633
1632
|
}
|
|
@@ -1636,11 +1635,11 @@ async function ln(e, t = "") {
|
|
|
1636
1635
|
}
|
|
1637
1636
|
return n;
|
|
1638
1637
|
}
|
|
1639
|
-
function
|
|
1638
|
+
function ln(e = {}) {
|
|
1640
1639
|
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 () => {
|
|
1641
1640
|
s(!0), f(null), m(null);
|
|
1642
1641
|
try {
|
|
1643
|
-
let e = await
|
|
1642
|
+
let e = await cn(await Yt(t ?? ""), t || "");
|
|
1644
1643
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1645
1644
|
} catch (e) {
|
|
1646
1645
|
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);
|
|
@@ -1661,96 +1660,96 @@ function un(e = {}) {
|
|
|
1661
1660
|
}
|
|
1662
1661
|
//#endregion
|
|
1663
1662
|
//#region src/OPFSFilesManager/format.ts
|
|
1664
|
-
var
|
|
1663
|
+
var un = [
|
|
1665
1664
|
"B",
|
|
1666
1665
|
"KB",
|
|
1667
1666
|
"MB",
|
|
1668
1667
|
"GB",
|
|
1669
1668
|
"TB"
|
|
1670
1669
|
];
|
|
1671
|
-
function
|
|
1670
|
+
function Q(e) {
|
|
1672
1671
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1673
|
-
let t = Math.min(
|
|
1674
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1672
|
+
let t = Math.min(un.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1673
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${un[t]}`;
|
|
1675
1674
|
}
|
|
1676
|
-
var
|
|
1677
|
-
function
|
|
1675
|
+
var dn = 6e4, fn = 60 * dn, pn = 24 * fn;
|
|
1676
|
+
function mn(e, t = Date.now()) {
|
|
1678
1677
|
let n = t - e;
|
|
1679
|
-
if (n <
|
|
1680
|
-
if (n <
|
|
1681
|
-
if (n <
|
|
1682
|
-
let r = Math.round(n /
|
|
1678
|
+
if (n < dn) return "just now";
|
|
1679
|
+
if (n < fn) return `${Math.round(n / dn)} min ago`;
|
|
1680
|
+
if (n < pn) return `${Math.round(n / fn)} h ago`;
|
|
1681
|
+
let r = Math.round(n / pn);
|
|
1683
1682
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1684
1683
|
}
|
|
1685
|
-
function
|
|
1684
|
+
function hn(e) {
|
|
1686
1685
|
return new Date(e).toLocaleString(void 0, {
|
|
1687
1686
|
dateStyle: "medium",
|
|
1688
1687
|
timeStyle: "short"
|
|
1689
1688
|
});
|
|
1690
1689
|
}
|
|
1691
|
-
function
|
|
1690
|
+
function gn(e, t) {
|
|
1692
1691
|
if (e.length <= t) return e;
|
|
1693
1692
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1694
1693
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1695
1694
|
}
|
|
1696
1695
|
//#endregion
|
|
1697
1696
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1698
|
-
var
|
|
1699
|
-
check: /* @__PURE__ */
|
|
1700
|
-
chevronLeft: /* @__PURE__ */
|
|
1701
|
-
chevronRight: /* @__PURE__ */
|
|
1702
|
-
copy: /* @__PURE__ */ z
|
|
1697
|
+
var _n = {
|
|
1698
|
+
check: /* @__PURE__ */ B("path", { d: "M20 6 9 17l-5-5" }),
|
|
1699
|
+
chevronLeft: /* @__PURE__ */ B("path", { d: "m15 18-6-6 6-6" }),
|
|
1700
|
+
chevronRight: /* @__PURE__ */ B("path", { d: "m9 18 6-6-6-6" }),
|
|
1701
|
+
copy: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("rect", {
|
|
1703
1702
|
width: "14",
|
|
1704
1703
|
height: "14",
|
|
1705
1704
|
x: "8",
|
|
1706
1705
|
y: "8",
|
|
1707
1706
|
rx: "2",
|
|
1708
1707
|
ry: "2"
|
|
1709
|
-
}), /* @__PURE__ */
|
|
1710
|
-
database: /* @__PURE__ */ z
|
|
1711
|
-
/* @__PURE__ */
|
|
1708
|
+
}), /* @__PURE__ */ B("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
|
|
1709
|
+
database: /* @__PURE__ */ V(z, { children: [
|
|
1710
|
+
/* @__PURE__ */ B("ellipse", {
|
|
1712
1711
|
cx: "12",
|
|
1713
1712
|
cy: "5",
|
|
1714
1713
|
rx: "9",
|
|
1715
1714
|
ry: "3"
|
|
1716
1715
|
}),
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ B("path", { d: "M3 5V19A9 3 0 0 0 21 19V5" }),
|
|
1717
|
+
/* @__PURE__ */ B("path", { d: "M3 12A9 3 0 0 0 21 12" })
|
|
1719
1718
|
] }),
|
|
1720
|
-
download: /* @__PURE__ */ z
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
1719
|
+
download: /* @__PURE__ */ V(z, { children: [
|
|
1720
|
+
/* @__PURE__ */ B("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1721
|
+
/* @__PURE__ */ B("polyline", { points: "7 10 12 15 17 10" }),
|
|
1722
|
+
/* @__PURE__ */ B("line", {
|
|
1724
1723
|
x1: "12",
|
|
1725
1724
|
x2: "12",
|
|
1726
1725
|
y1: "15",
|
|
1727
1726
|
y2: "3"
|
|
1728
1727
|
})
|
|
1729
1728
|
] }),
|
|
1730
|
-
file: /* @__PURE__ */ z
|
|
1731
|
-
fileCode: /* @__PURE__ */ z
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1729
|
+
file: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })] }),
|
|
1730
|
+
fileCode: /* @__PURE__ */ V(z, { children: [
|
|
1731
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1732
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1733
|
+
/* @__PURE__ */ B("path", { d: "m10 13-2 2 2 2" }),
|
|
1734
|
+
/* @__PURE__ */ B("path", { d: "m14 17 2-2-2-2" })
|
|
1736
1735
|
] }),
|
|
1737
|
-
fileJson: /* @__PURE__ */ z
|
|
1738
|
-
/* @__PURE__ */
|
|
1739
|
-
/* @__PURE__ */
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
/* @__PURE__ */
|
|
1736
|
+
fileJson: /* @__PURE__ */ V(z, { children: [
|
|
1737
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1738
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1739
|
+
/* @__PURE__ */ B("path", { d: "M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1" }),
|
|
1740
|
+
/* @__PURE__ */ B("path", { d: "M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1" })
|
|
1742
1741
|
] }),
|
|
1743
|
-
fileText: /* @__PURE__ */ z
|
|
1744
|
-
/* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1742
|
+
fileText: /* @__PURE__ */ V(z, { children: [
|
|
1743
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1744
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1745
|
+
/* @__PURE__ */ B("path", { d: "M10 9H8" }),
|
|
1746
|
+
/* @__PURE__ */ B("path", { d: "M16 13H8" }),
|
|
1747
|
+
/* @__PURE__ */ B("path", { d: "M16 17H8" })
|
|
1749
1748
|
] }),
|
|
1750
|
-
folder: /* @__PURE__ */
|
|
1751
|
-
folderOpen: /* @__PURE__ */
|
|
1752
|
-
image: /* @__PURE__ */ z
|
|
1753
|
-
/* @__PURE__ */
|
|
1749
|
+
folder: /* @__PURE__ */ B("path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }),
|
|
1750
|
+
folderOpen: /* @__PURE__ */ B("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" }),
|
|
1751
|
+
image: /* @__PURE__ */ V(z, { children: [
|
|
1752
|
+
/* @__PURE__ */ B("rect", {
|
|
1754
1753
|
width: "18",
|
|
1755
1754
|
height: "18",
|
|
1756
1755
|
x: "3",
|
|
@@ -1758,64 +1757,64 @@ var vn = {
|
|
|
1758
1757
|
rx: "2",
|
|
1759
1758
|
ry: "2"
|
|
1760
1759
|
}),
|
|
1761
|
-
/* @__PURE__ */
|
|
1760
|
+
/* @__PURE__ */ B("circle", {
|
|
1762
1761
|
cx: "9",
|
|
1763
1762
|
cy: "9",
|
|
1764
1763
|
r: "2"
|
|
1765
1764
|
}),
|
|
1766
|
-
/* @__PURE__ */
|
|
1765
|
+
/* @__PURE__ */ B("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
1767
1766
|
] }),
|
|
1768
|
-
imageOff: /* @__PURE__ */ z
|
|
1769
|
-
/* @__PURE__ */
|
|
1767
|
+
imageOff: /* @__PURE__ */ V(z, { children: [
|
|
1768
|
+
/* @__PURE__ */ B("line", {
|
|
1770
1769
|
x1: "2",
|
|
1771
1770
|
x2: "22",
|
|
1772
1771
|
y1: "2",
|
|
1773
1772
|
y2: "22"
|
|
1774
1773
|
}),
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1774
|
+
/* @__PURE__ */ B("path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83" }),
|
|
1775
|
+
/* @__PURE__ */ B("line", {
|
|
1777
1776
|
x1: "13.5",
|
|
1778
1777
|
x2: "6",
|
|
1779
1778
|
y1: "13.5",
|
|
1780
1779
|
y2: "21"
|
|
1781
1780
|
}),
|
|
1782
|
-
/* @__PURE__ */
|
|
1781
|
+
/* @__PURE__ */ B("line", {
|
|
1783
1782
|
x1: "18",
|
|
1784
1783
|
x2: "21",
|
|
1785
1784
|
y1: "12",
|
|
1786
1785
|
y2: "15"
|
|
1787
1786
|
}),
|
|
1788
|
-
/* @__PURE__ */
|
|
1789
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ B("path", { d: "M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59" }),
|
|
1788
|
+
/* @__PURE__ */ B("path", { d: "M21 15V5a2 2 0 0 0-2-2H9" })
|
|
1790
1789
|
] }),
|
|
1791
|
-
layers: /* @__PURE__ */ z
|
|
1792
|
-
/* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1790
|
+
layers: /* @__PURE__ */ V(z, { children: [
|
|
1791
|
+
/* @__PURE__ */ B("path", { d: "m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z" }),
|
|
1792
|
+
/* @__PURE__ */ B("path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65" }),
|
|
1793
|
+
/* @__PURE__ */ B("path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65" })
|
|
1795
1794
|
] }),
|
|
1796
|
-
layoutGrid: /* @__PURE__ */ z
|
|
1797
|
-
/* @__PURE__ */
|
|
1795
|
+
layoutGrid: /* @__PURE__ */ V(z, { children: [
|
|
1796
|
+
/* @__PURE__ */ B("rect", {
|
|
1798
1797
|
width: "7",
|
|
1799
1798
|
height: "7",
|
|
1800
1799
|
x: "3",
|
|
1801
1800
|
y: "3",
|
|
1802
1801
|
rx: "1"
|
|
1803
1802
|
}),
|
|
1804
|
-
/* @__PURE__ */
|
|
1803
|
+
/* @__PURE__ */ B("rect", {
|
|
1805
1804
|
width: "7",
|
|
1806
1805
|
height: "7",
|
|
1807
1806
|
x: "14",
|
|
1808
1807
|
y: "3",
|
|
1809
1808
|
rx: "1"
|
|
1810
1809
|
}),
|
|
1811
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ B("rect", {
|
|
1812
1811
|
width: "7",
|
|
1813
1812
|
height: "7",
|
|
1814
1813
|
x: "14",
|
|
1815
1814
|
y: "14",
|
|
1816
1815
|
rx: "1"
|
|
1817
1816
|
}),
|
|
1818
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ B("rect", {
|
|
1819
1818
|
width: "7",
|
|
1820
1819
|
height: "7",
|
|
1821
1820
|
x: "3",
|
|
@@ -1823,51 +1822,51 @@ var vn = {
|
|
|
1823
1822
|
rx: "1"
|
|
1824
1823
|
})
|
|
1825
1824
|
] }),
|
|
1826
|
-
list: /* @__PURE__ */ z
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
1832
|
-
/* @__PURE__ */
|
|
1825
|
+
list: /* @__PURE__ */ V(z, { children: [
|
|
1826
|
+
/* @__PURE__ */ B("path", { d: "M3 12h.01" }),
|
|
1827
|
+
/* @__PURE__ */ B("path", { d: "M3 18h.01" }),
|
|
1828
|
+
/* @__PURE__ */ B("path", { d: "M3 6h.01" }),
|
|
1829
|
+
/* @__PURE__ */ B("path", { d: "M8 12h13" }),
|
|
1830
|
+
/* @__PURE__ */ B("path", { d: "M8 18h13" }),
|
|
1831
|
+
/* @__PURE__ */ B("path", { d: "M8 6h13" })
|
|
1833
1832
|
] }),
|
|
1834
|
-
refresh: /* @__PURE__ */ z
|
|
1835
|
-
/* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1833
|
+
refresh: /* @__PURE__ */ V(z, { children: [
|
|
1834
|
+
/* @__PURE__ */ B("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
1835
|
+
/* @__PURE__ */ B("path", { d: "M21 3v5h-5" }),
|
|
1836
|
+
/* @__PURE__ */ B("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
1837
|
+
/* @__PURE__ */ B("path", { d: "M8 16H3v5" })
|
|
1839
1838
|
] }),
|
|
1840
|
-
search: /* @__PURE__ */ z
|
|
1839
|
+
search: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("circle", {
|
|
1841
1840
|
cx: "11",
|
|
1842
1841
|
cy: "11",
|
|
1843
1842
|
r: "8"
|
|
1844
|
-
}), /* @__PURE__ */
|
|
1845
|
-
trash: /* @__PURE__ */ z
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1843
|
+
}), /* @__PURE__ */ B("path", { d: "m21 21-4.3-4.3" })] }),
|
|
1844
|
+
trash: /* @__PURE__ */ V(z, { children: [
|
|
1845
|
+
/* @__PURE__ */ B("path", { d: "M3 6h18" }),
|
|
1846
|
+
/* @__PURE__ */ B("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
1847
|
+
/* @__PURE__ */ B("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
|
|
1848
|
+
/* @__PURE__ */ B("line", {
|
|
1850
1849
|
x1: "10",
|
|
1851
1850
|
x2: "10",
|
|
1852
1851
|
y1: "11",
|
|
1853
1852
|
y2: "17"
|
|
1854
1853
|
}),
|
|
1855
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ B("line", {
|
|
1856
1855
|
x1: "14",
|
|
1857
1856
|
x2: "14",
|
|
1858
1857
|
y1: "11",
|
|
1859
1858
|
y2: "17"
|
|
1860
1859
|
})
|
|
1861
1860
|
] }),
|
|
1862
|
-
triangleAlert: /* @__PURE__ */ z
|
|
1863
|
-
/* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1861
|
+
triangleAlert: /* @__PURE__ */ V(z, { children: [
|
|
1862
|
+
/* @__PURE__ */ B("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
1863
|
+
/* @__PURE__ */ B("path", { d: "M12 9v4" }),
|
|
1864
|
+
/* @__PURE__ */ B("path", { d: "M12 17h.01" })
|
|
1866
1865
|
] }),
|
|
1867
|
-
x: /* @__PURE__ */ z
|
|
1866
|
+
x: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("path", { d: "M18 6 6 18" }), /* @__PURE__ */ B("path", { d: "m6 6 12 12" })] })
|
|
1868
1867
|
};
|
|
1869
|
-
function
|
|
1870
|
-
return /* @__PURE__ */
|
|
1868
|
+
function $({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
1869
|
+
return /* @__PURE__ */ B("svg", {
|
|
1871
1870
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1872
1871
|
width: t,
|
|
1873
1872
|
height: t,
|
|
@@ -1880,20 +1879,20 @@ function Q({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
1880
1879
|
"aria-hidden": "true",
|
|
1881
1880
|
focusable: "false",
|
|
1882
1881
|
className: r,
|
|
1883
|
-
children:
|
|
1882
|
+
children: _n[e]
|
|
1884
1883
|
});
|
|
1885
1884
|
}
|
|
1886
1885
|
//#endregion
|
|
1887
1886
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
1888
|
-
var
|
|
1889
|
-
function
|
|
1887
|
+
var vn = 6;
|
|
1888
|
+
function yn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
1890
1889
|
let a = s(null);
|
|
1891
1890
|
return i(() => {
|
|
1892
1891
|
let e = a.current;
|
|
1893
1892
|
return e && !e.open && (e.showModal(), e.querySelector("[data-initial-focus]")?.focus()), () => {
|
|
1894
1893
|
e?.open && e.close();
|
|
1895
1894
|
};
|
|
1896
|
-
}, []), /* @__PURE__ */
|
|
1895
|
+
}, []), /* @__PURE__ */ B("dialog", {
|
|
1897
1896
|
ref: a,
|
|
1898
1897
|
className: ["seed-fm-dialog", e].filter(Boolean).join(" "),
|
|
1899
1898
|
"aria-labelledby": "seed-fm-delete-title",
|
|
@@ -1903,7 +1902,7 @@ function bn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
1903
1902
|
onClick: (e) => {
|
|
1904
1903
|
e.target === e.currentTarget && t();
|
|
1905
1904
|
},
|
|
1906
|
-
children: /* @__PURE__ */
|
|
1905
|
+
children: /* @__PURE__ */ B("form", {
|
|
1907
1906
|
method: "dialog",
|
|
1908
1907
|
onSubmit: (e) => {
|
|
1909
1908
|
e.preventDefault(), n();
|
|
@@ -1912,32 +1911,32 @@ function bn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
1912
1911
|
})
|
|
1913
1912
|
});
|
|
1914
1913
|
}
|
|
1915
|
-
function
|
|
1916
|
-
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 ${
|
|
1917
|
-
return /* @__PURE__ */
|
|
1914
|
+
function bn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
1915
|
+
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 ${gn(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
1916
|
+
return /* @__PURE__ */ V(yn, {
|
|
1918
1917
|
className: o,
|
|
1919
1918
|
onCancel: i,
|
|
1920
1919
|
onSubmit: () => a(s),
|
|
1921
1920
|
children: [
|
|
1922
|
-
/* @__PURE__ */
|
|
1921
|
+
/* @__PURE__ */ B("h3", {
|
|
1923
1922
|
id: "seed-fm-delete-title",
|
|
1924
1923
|
children: h
|
|
1925
1924
|
}),
|
|
1926
|
-
/* @__PURE__ */
|
|
1925
|
+
/* @__PURE__ */ V("p", { children: [
|
|
1927
1926
|
"This removes ",
|
|
1928
1927
|
e.length === 1 ? "it" : "them",
|
|
1929
1928
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
1930
1929
|
] }),
|
|
1931
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ V("ul", { children: [e.slice(0, vn).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
1932
1931
|
title: e.file.path,
|
|
1933
1932
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
1934
|
-
}), /* @__PURE__ */
|
|
1933
|
+
}), /* @__PURE__ */ B("span", { children: Q(e.file.size) })] }, e.file.path)), e.length > vn && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
1935
1934
|
"and ",
|
|
1936
|
-
e.length -
|
|
1935
|
+
e.length - vn,
|
|
1937
1936
|
" more"
|
|
1938
1937
|
] }) })] }),
|
|
1939
|
-
u.length > 0 && /* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
1938
|
+
u.length > 0 && /* @__PURE__ */ V("label", { children: [
|
|
1939
|
+
/* @__PURE__ */ B("input", {
|
|
1941
1940
|
type: "checkbox",
|
|
1942
1941
|
className: "seed-fm-checkbox",
|
|
1943
1942
|
checked: s,
|
|
@@ -1948,26 +1947,26 @@ function xn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
1948
1947
|
" resized ",
|
|
1949
1948
|
u.length === 1 ? "copy" : "copies",
|
|
1950
1949
|
" (",
|
|
1951
|
-
|
|
1950
|
+
Q(d),
|
|
1952
1951
|
")"
|
|
1953
1952
|
] }),
|
|
1954
|
-
n && /* @__PURE__ */
|
|
1953
|
+
n && /* @__PURE__ */ V("div", {
|
|
1955
1954
|
className: "seed-fm-warning",
|
|
1956
1955
|
role: "alert",
|
|
1957
|
-
children: [/* @__PURE__ */
|
|
1956
|
+
children: [/* @__PURE__ */ B($, {
|
|
1958
1957
|
name: "triangleAlert",
|
|
1959
1958
|
size: 16
|
|
1960
|
-
}), /* @__PURE__ */
|
|
1959
|
+
}), /* @__PURE__ */ B("span", { children: n })]
|
|
1961
1960
|
}),
|
|
1962
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ V("div", {
|
|
1963
1962
|
className: "seed-fm-dialog-actions",
|
|
1964
|
-
children: [/* @__PURE__ */
|
|
1963
|
+
children: [/* @__PURE__ */ B("button", {
|
|
1965
1964
|
type: "button",
|
|
1966
1965
|
className: "seed-fm-btn",
|
|
1967
1966
|
onClick: i,
|
|
1968
1967
|
"data-initial-focus": !0,
|
|
1969
1968
|
children: "Cancel"
|
|
1970
|
-
}), /* @__PURE__ */
|
|
1969
|
+
}), /* @__PURE__ */ B("button", {
|
|
1971
1970
|
type: "submit",
|
|
1972
1971
|
className: `seed-fm-btn ${m.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
1973
1972
|
children: m.label ?? `Delete ${f} ${f === 1 ? "file" : "files"}`
|
|
@@ -1976,43 +1975,43 @@ function xn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
1976
1975
|
]
|
|
1977
1976
|
});
|
|
1978
1977
|
}
|
|
1979
|
-
function
|
|
1978
|
+
function xn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
1980
1979
|
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;
|
|
1981
|
-
return /* @__PURE__ */
|
|
1980
|
+
return /* @__PURE__ */ V(yn, {
|
|
1982
1981
|
className: u,
|
|
1983
1982
|
onCancel: s,
|
|
1984
1983
|
onSubmit: l,
|
|
1985
1984
|
children: [
|
|
1986
|
-
/* @__PURE__ */
|
|
1985
|
+
/* @__PURE__ */ B("h3", {
|
|
1987
1986
|
id: "seed-fm-delete-title",
|
|
1988
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
1987
|
+
children: i.label ? `${i.label}?` : `Delete the “${gn(e.name, 32)}” folder?`
|
|
1989
1988
|
}),
|
|
1990
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ V("p", { children: [
|
|
1991
1990
|
"This removes the folder and the ",
|
|
1992
1991
|
h,
|
|
1993
1992
|
" in it (",
|
|
1994
|
-
|
|
1993
|
+
Q(p),
|
|
1995
1994
|
g > 0 && `, including ${g} resized ${g === 1 ? "copy" : "copies"}`,
|
|
1996
1995
|
") from this browser’s private storage. Copies on Arweave or other devices aren’t affected."
|
|
1997
1996
|
] }),
|
|
1998
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ V("div", {
|
|
1999
1998
|
className: "seed-fm-irreversible",
|
|
2000
|
-
children: [/* @__PURE__ */
|
|
1999
|
+
children: [/* @__PURE__ */ B($, {
|
|
2001
2000
|
name: "triangleAlert",
|
|
2002
2001
|
size: 16
|
|
2003
|
-
}), /* @__PURE__ */
|
|
2002
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2004
2003
|
}),
|
|
2005
|
-
/* @__PURE__ */
|
|
2004
|
+
/* @__PURE__ */ V("ul", { children: [t.slice(0, vn).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
2006
2005
|
title: e.path,
|
|
2007
2006
|
children: e.path.slice(m.length)
|
|
2008
|
-
}), /* @__PURE__ */
|
|
2007
|
+
}), /* @__PURE__ */ B("span", { children: Q(e.size) })] }, e.path)), t.length > vn && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
2009
2008
|
"and ",
|
|
2010
|
-
t.length -
|
|
2009
|
+
t.length - vn,
|
|
2011
2010
|
" more"
|
|
2012
2011
|
] }) })] }),
|
|
2013
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ V("div", {
|
|
2014
2013
|
className: "seed-fm-keepcopy",
|
|
2015
|
-
children: [/* @__PURE__ */
|
|
2014
|
+
children: [/* @__PURE__ */ B("span", { children: d ? "Saved a copy to your computer." : "Want a copy first? Save the folder to your computer." }), /* @__PURE__ */ V("button", {
|
|
2016
2015
|
type: "button",
|
|
2017
2016
|
className: "seed-fm-btn",
|
|
2018
2017
|
disabled: a,
|
|
@@ -2020,7 +2019,7 @@ function Sn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2020
2019
|
await o() && f(!0);
|
|
2021
2020
|
},
|
|
2022
2021
|
children: [
|
|
2023
|
-
/* @__PURE__ */
|
|
2022
|
+
/* @__PURE__ */ B($, {
|
|
2024
2023
|
name: d ? "check" : "download",
|
|
2025
2024
|
size: 15
|
|
2026
2025
|
}),
|
|
@@ -2029,7 +2028,7 @@ function Sn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2029
2028
|
]
|
|
2030
2029
|
})]
|
|
2031
2030
|
}),
|
|
2032
|
-
n > 0 && /* @__PURE__ */
|
|
2031
|
+
n > 0 && /* @__PURE__ */ V("p", { children: [
|
|
2033
2032
|
n,
|
|
2034
2033
|
" other ",
|
|
2035
2034
|
n === 1 ? "file" : "files",
|
|
@@ -2038,23 +2037,23 @@ function Sn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2038
2037
|
" ",
|
|
2039
2038
|
"hidden here and won’t be deleted, so the folder itself will stay."
|
|
2040
2039
|
] }),
|
|
2041
|
-
r && /* @__PURE__ */
|
|
2040
|
+
r && /* @__PURE__ */ V("div", {
|
|
2042
2041
|
className: "seed-fm-warning",
|
|
2043
2042
|
role: "alert",
|
|
2044
|
-
children: [/* @__PURE__ */
|
|
2043
|
+
children: [/* @__PURE__ */ B($, {
|
|
2045
2044
|
name: "triangleAlert",
|
|
2046
2045
|
size: 16
|
|
2047
|
-
}), /* @__PURE__ */
|
|
2046
|
+
}), /* @__PURE__ */ B("span", { children: r })]
|
|
2048
2047
|
}),
|
|
2049
|
-
/* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ V("div", {
|
|
2050
2049
|
className: "seed-fm-dialog-actions",
|
|
2051
|
-
children: [/* @__PURE__ */
|
|
2050
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2052
2051
|
type: "button",
|
|
2053
2052
|
className: "seed-fm-btn",
|
|
2054
2053
|
onClick: s,
|
|
2055
2054
|
"data-initial-focus": !0,
|
|
2056
2055
|
children: "Cancel"
|
|
2057
|
-
}), /* @__PURE__ */
|
|
2056
|
+
}), /* @__PURE__ */ B("button", {
|
|
2058
2057
|
type: "submit",
|
|
2059
2058
|
disabled: a,
|
|
2060
2059
|
className: `seed-fm-btn ${i.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
@@ -2066,18 +2065,18 @@ function Sn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2066
2065
|
}
|
|
2067
2066
|
//#endregion
|
|
2068
2067
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2069
|
-
function
|
|
2068
|
+
function Sn(e) {
|
|
2070
2069
|
return e.detectedType ?? e.type;
|
|
2071
2070
|
}
|
|
2072
|
-
var
|
|
2073
|
-
function
|
|
2074
|
-
let t =
|
|
2075
|
-
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" ||
|
|
2071
|
+
var Cn = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2072
|
+
function wn(e) {
|
|
2073
|
+
let t = Sn(e);
|
|
2074
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || Cn.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";
|
|
2076
2075
|
}
|
|
2077
2076
|
function Tn(e) {
|
|
2078
2077
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2079
2078
|
if (t) return t.toLowerCase();
|
|
2080
|
-
let n =
|
|
2079
|
+
let n = Sn(e);
|
|
2081
2080
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2082
2081
|
}
|
|
2083
2082
|
var En = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, Dn = /^(.*\/)?images\/([^/]+)$/, On = (e) => e.replace(/\.[^/.]+$/, "");
|
|
@@ -2112,7 +2111,7 @@ function Mn(e, t) {
|
|
|
2112
2111
|
let a = jn(t);
|
|
2113
2112
|
r.push(a);
|
|
2114
2113
|
let o = An(t.path);
|
|
2115
|
-
o &&
|
|
2114
|
+
o && wn(t) === "image" && n.set(o, a);
|
|
2116
2115
|
}
|
|
2117
2116
|
for (let e of i) {
|
|
2118
2117
|
let t = n.get(e.key);
|
|
@@ -2168,7 +2167,7 @@ function In(e) {
|
|
|
2168
2167
|
text: 0,
|
|
2169
2168
|
other: 0
|
|
2170
2169
|
};
|
|
2171
|
-
for (let n of e) t[
|
|
2170
|
+
for (let n of e) t[wn(n)] += n.size;
|
|
2172
2171
|
return t;
|
|
2173
2172
|
}
|
|
2174
2173
|
function Ln(e) {
|
|
@@ -2230,7 +2229,7 @@ async function qn(e) {
|
|
|
2230
2229
|
}
|
|
2231
2230
|
async function Jn(e) {
|
|
2232
2231
|
let t = e.variants[0];
|
|
2233
|
-
return t ?
|
|
2232
|
+
return t ? Qt(t.file.path) : qn(await Qt(e.file.path));
|
|
2234
2233
|
}
|
|
2235
2234
|
var Yn = /* @__PURE__ */ new WeakMap(), Xn = null;
|
|
2236
2235
|
function Zn(e, t) {
|
|
@@ -2241,7 +2240,7 @@ function Zn(e, t) {
|
|
|
2241
2240
|
});
|
|
2242
2241
|
}
|
|
2243
2242
|
function Qn(e) {
|
|
2244
|
-
let t =
|
|
2243
|
+
let t = wn(e.file) === "image", [r, a] = c(null), [o, s] = c(!1), [l, u] = c(null), [d, f] = c("idle"), p = n((e) => a(e), []);
|
|
2245
2244
|
i(() => {
|
|
2246
2245
|
if (t && r && !o) return Zn(r, () => s(!0));
|
|
2247
2246
|
}, [
|
|
@@ -2308,36 +2307,36 @@ var $n = {
|
|
|
2308
2307
|
label: "Other",
|
|
2309
2308
|
color: "var(--seed-kind-other)"
|
|
2310
2309
|
}
|
|
2311
|
-
}, er = (e) => ({ "--seed-kind": $n[e].color }), tr = (e) => /png|webp|gif|avif|svg/.test(
|
|
2310
|
+
}, er = (e) => ({ "--seed-kind": $n[e].color }), tr = (e) => /png|webp|gif|avif|svg/.test(Sn(e.file));
|
|
2312
2311
|
function nr({ entry: e, size: t, children: n }) {
|
|
2313
|
-
let r =
|
|
2312
|
+
let r = wn(e.file), { ref: i, url: a, status: o, markError: s } = Qn(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2314
2313
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2315
2314
|
l && tr(e) ? "seed-fm-thumb--checker" : "",
|
|
2316
2315
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2317
2316
|
].filter(Boolean).join(" "), d;
|
|
2318
|
-
return d = l ? /* @__PURE__ */
|
|
2317
|
+
return d = l ? /* @__PURE__ */ B("img", {
|
|
2319
2318
|
src: a,
|
|
2320
2319
|
alt: "",
|
|
2321
2320
|
decoding: "async",
|
|
2322
2321
|
draggable: !1,
|
|
2323
2322
|
onError: s
|
|
2324
|
-
}) : t === "mini" ? /* @__PURE__ */
|
|
2323
|
+
}) : t === "mini" ? /* @__PURE__ */ B($, {
|
|
2325
2324
|
name: c ? "imageOff" : $n[r].icon,
|
|
2326
2325
|
size: 16
|
|
2327
|
-
}) : r === "image" && !c ? null : /* @__PURE__ */
|
|
2326
|
+
}) : r === "image" && !c ? null : /* @__PURE__ */ V("span", {
|
|
2328
2327
|
className: "seed-fm-kind",
|
|
2329
|
-
children: [/* @__PURE__ */
|
|
2328
|
+
children: [/* @__PURE__ */ B($, {
|
|
2330
2329
|
name: c ? "imageOff" : $n[r].icon,
|
|
2331
2330
|
size: 28,
|
|
2332
2331
|
strokeWidth: 1.6
|
|
2333
|
-
}), c ? /* @__PURE__ */
|
|
2332
|
+
}), c ? /* @__PURE__ */ B("span", {
|
|
2334
2333
|
className: "seed-fm-kind-error",
|
|
2335
2334
|
children: "Can’t decode image"
|
|
2336
|
-
}) : /* @__PURE__ */
|
|
2335
|
+
}) : /* @__PURE__ */ B("span", {
|
|
2337
2336
|
className: "seed-fm-ext",
|
|
2338
2337
|
children: Tn(e.file)
|
|
2339
2338
|
})]
|
|
2340
|
-
}), /* @__PURE__ */
|
|
2339
|
+
}), /* @__PURE__ */ V("span", {
|
|
2341
2340
|
ref: i,
|
|
2342
2341
|
className: u,
|
|
2343
2342
|
style: er(r),
|
|
@@ -2347,14 +2346,14 @@ function nr({ entry: e, size: t, children: n }) {
|
|
|
2347
2346
|
//#endregion
|
|
2348
2347
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2349
2348
|
function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2350
|
-
return /* @__PURE__ */
|
|
2349
|
+
return /* @__PURE__ */ B("ul", {
|
|
2351
2350
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2352
2351
|
role: "listbox",
|
|
2353
2352
|
"aria-label": "Files",
|
|
2354
2353
|
"aria-multiselectable": "true",
|
|
2355
2354
|
children: e.map((e, i) => {
|
|
2356
2355
|
let { file: o, variants: s } = e, c = t.has(o.path);
|
|
2357
|
-
return /* @__PURE__ */
|
|
2356
|
+
return /* @__PURE__ */ V("li", {
|
|
2358
2357
|
role: "option",
|
|
2359
2358
|
tabIndex: 0,
|
|
2360
2359
|
"aria-selected": c,
|
|
@@ -2366,10 +2365,10 @@ function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2366
2365
|
onKeyDown: (t) => {
|
|
2367
2366
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2368
2367
|
},
|
|
2369
|
-
children: [/* @__PURE__ */
|
|
2368
|
+
children: [/* @__PURE__ */ V(nr, {
|
|
2370
2369
|
entry: e,
|
|
2371
2370
|
size: "tile",
|
|
2372
|
-
children: [/* @__PURE__ */
|
|
2371
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2373
2372
|
type: "button",
|
|
2374
2373
|
className: "seed-fm-check",
|
|
2375
2374
|
tabIndex: -1,
|
|
@@ -2377,16 +2376,16 @@ function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2377
2376
|
onClick: (t) => {
|
|
2378
2377
|
t.stopPropagation(), r(e, i, t.shiftKey);
|
|
2379
2378
|
},
|
|
2380
|
-
children: c && /* @__PURE__ */
|
|
2379
|
+
children: c && /* @__PURE__ */ B($, {
|
|
2381
2380
|
name: "check",
|
|
2382
2381
|
size: 14,
|
|
2383
2382
|
strokeWidth: 3
|
|
2384
2383
|
})
|
|
2385
|
-
}), s.length > 0 && /* @__PURE__ */
|
|
2384
|
+
}), s.length > 0 && /* @__PURE__ */ V("span", {
|
|
2386
2385
|
className: "seed-fm-badge",
|
|
2387
2386
|
title: "Resized copies are grouped with this image",
|
|
2388
2387
|
children: [
|
|
2389
|
-
/* @__PURE__ */
|
|
2388
|
+
/* @__PURE__ */ B($, {
|
|
2390
2389
|
name: "layers",
|
|
2391
2390
|
size: 11,
|
|
2392
2391
|
strokeWidth: 2.2
|
|
@@ -2396,21 +2395,21 @@ function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2396
2395
|
s.length === 1 ? "size" : "sizes"
|
|
2397
2396
|
]
|
|
2398
2397
|
})]
|
|
2399
|
-
}), /* @__PURE__ */
|
|
2398
|
+
}), /* @__PURE__ */ V("span", {
|
|
2400
2399
|
className: "seed-fm-tile-meta",
|
|
2401
|
-
children: [/* @__PURE__ */
|
|
2400
|
+
children: [/* @__PURE__ */ B("span", {
|
|
2402
2401
|
className: "seed-fm-tile-name",
|
|
2403
|
-
children:
|
|
2404
|
-
}), /* @__PURE__ */
|
|
2402
|
+
children: gn(o.name, 24)
|
|
2403
|
+
}), /* @__PURE__ */ V("span", {
|
|
2405
2404
|
className: "seed-fm-tile-sub",
|
|
2406
2405
|
children: [
|
|
2407
|
-
|
|
2406
|
+
Q(o.size),
|
|
2408
2407
|
" ·",
|
|
2409
2408
|
" ",
|
|
2410
|
-
/* @__PURE__ */
|
|
2409
|
+
/* @__PURE__ */ B("time", {
|
|
2411
2410
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2412
|
-
title:
|
|
2413
|
-
children:
|
|
2411
|
+
title: hn(o.lastModified),
|
|
2412
|
+
children: mn(o.lastModified)
|
|
2414
2413
|
})
|
|
2415
2414
|
]
|
|
2416
2415
|
})]
|
|
@@ -2427,14 +2426,14 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2427
2426
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
2428
2427
|
}, [m, h]);
|
|
2429
2428
|
let g = n ? `${n}/` : "";
|
|
2430
|
-
return /* @__PURE__ */
|
|
2429
|
+
return /* @__PURE__ */ B("div", {
|
|
2431
2430
|
className: "seed-fm-list-wrap",
|
|
2432
|
-
children: /* @__PURE__ */
|
|
2431
|
+
children: /* @__PURE__ */ V("table", {
|
|
2433
2432
|
className: ["seed-fm-list", d].filter(Boolean).join(" "),
|
|
2434
|
-
children: [/* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2433
|
+
children: [/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ V("tr", { children: [
|
|
2434
|
+
/* @__PURE__ */ B("th", {
|
|
2436
2435
|
style: { width: 28 },
|
|
2437
|
-
children: /* @__PURE__ */
|
|
2436
|
+
children: /* @__PURE__ */ B("input", {
|
|
2438
2437
|
ref: p,
|
|
2439
2438
|
type: "checkbox",
|
|
2440
2439
|
className: "seed-fm-checkbox",
|
|
@@ -2443,34 +2442,34 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2443
2442
|
"aria-label": "Select all"
|
|
2444
2443
|
})
|
|
2445
2444
|
}),
|
|
2446
|
-
/* @__PURE__ */
|
|
2447
|
-
/* @__PURE__ */
|
|
2445
|
+
/* @__PURE__ */ B("th", { children: "Name" }),
|
|
2446
|
+
/* @__PURE__ */ B("th", {
|
|
2448
2447
|
className: "seed-fm-col-type",
|
|
2449
2448
|
children: "Type"
|
|
2450
2449
|
}),
|
|
2451
|
-
/* @__PURE__ */
|
|
2450
|
+
/* @__PURE__ */ B("th", {
|
|
2452
2451
|
className: "seed-fm-num seed-fm-col-size",
|
|
2453
2452
|
children: "Size"
|
|
2454
2453
|
}),
|
|
2455
|
-
/* @__PURE__ */
|
|
2454
|
+
/* @__PURE__ */ B("th", {
|
|
2456
2455
|
className: "seed-fm-col-modified",
|
|
2457
2456
|
children: "Modified"
|
|
2458
2457
|
}),
|
|
2459
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ B("th", { children: /* @__PURE__ */ B("span", {
|
|
2460
2459
|
className: "seed-fm-visually-hidden",
|
|
2461
2460
|
children: "Actions"
|
|
2462
2461
|
}) })
|
|
2463
|
-
] }) }), /* @__PURE__ */
|
|
2462
|
+
] }) }), /* @__PURE__ */ B("tbody", { children: e.map((e, n) => {
|
|
2464
2463
|
let { file: i } = e, o = t.has(i.path), s = u(e);
|
|
2465
|
-
return /* @__PURE__ */
|
|
2464
|
+
return /* @__PURE__ */ V("tr", {
|
|
2466
2465
|
"data-path": i.path,
|
|
2467
2466
|
"aria-selected": o,
|
|
2468
2467
|
className: ["seed-fm-row", f].filter(Boolean).join(" "),
|
|
2469
2468
|
onClick: (t) => r(e, n, t),
|
|
2470
2469
|
children: [
|
|
2471
|
-
/* @__PURE__ */
|
|
2470
|
+
/* @__PURE__ */ B("td", {
|
|
2472
2471
|
onClick: (e) => e.stopPropagation(),
|
|
2473
|
-
children: /* @__PURE__ */
|
|
2472
|
+
children: /* @__PURE__ */ B("input", {
|
|
2474
2473
|
type: "checkbox",
|
|
2475
2474
|
className: "seed-fm-checkbox",
|
|
2476
2475
|
checked: o,
|
|
@@ -2479,61 +2478,61 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2479
2478
|
"aria-label": `Select ${i.name}`
|
|
2480
2479
|
})
|
|
2481
2480
|
}),
|
|
2482
|
-
/* @__PURE__ */
|
|
2481
|
+
/* @__PURE__ */ B("td", { children: /* @__PURE__ */ V("span", {
|
|
2483
2482
|
className: "seed-fm-namecell",
|
|
2484
|
-
children: [/* @__PURE__ */
|
|
2483
|
+
children: [/* @__PURE__ */ B(nr, {
|
|
2485
2484
|
entry: e,
|
|
2486
2485
|
size: "mini"
|
|
2487
|
-
}), /* @__PURE__ */
|
|
2486
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("button", {
|
|
2488
2487
|
type: "button",
|
|
2489
2488
|
className: "seed-fm-row-name seed-fm-row-open",
|
|
2490
2489
|
onClick: (t) => {
|
|
2491
2490
|
t.stopPropagation(), r(e, n, t);
|
|
2492
2491
|
},
|
|
2493
2492
|
children: i.name
|
|
2494
|
-
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */
|
|
2493
|
+
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */ B("span", {
|
|
2495
2494
|
className: "seed-fm-row-path",
|
|
2496
2495
|
children: i.path.slice(g.length)
|
|
2497
2496
|
})] })]
|
|
2498
2497
|
}) }),
|
|
2499
|
-
/* @__PURE__ */
|
|
2498
|
+
/* @__PURE__ */ B("td", {
|
|
2500
2499
|
className: "seed-fm-col-type",
|
|
2501
|
-
children: /* @__PURE__ */
|
|
2500
|
+
children: /* @__PURE__ */ V("span", {
|
|
2502
2501
|
className: "seed-fm-type",
|
|
2503
|
-
style: er(
|
|
2504
|
-
children: [
|
|
2502
|
+
style: er(wn(i)),
|
|
2503
|
+
children: [Sn(i), i.detectedType && /* @__PURE__ */ B("small", { children: "detected" })]
|
|
2505
2504
|
})
|
|
2506
2505
|
}),
|
|
2507
|
-
/* @__PURE__ */
|
|
2506
|
+
/* @__PURE__ */ B("td", {
|
|
2508
2507
|
className: "seed-fm-num seed-fm-col-size",
|
|
2509
2508
|
title: `${i.size.toLocaleString()} bytes`,
|
|
2510
|
-
children:
|
|
2509
|
+
children: Q(e.totalSize)
|
|
2511
2510
|
}),
|
|
2512
|
-
/* @__PURE__ */
|
|
2511
|
+
/* @__PURE__ */ B("td", {
|
|
2513
2512
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2514
|
-
title:
|
|
2515
|
-
children:
|
|
2513
|
+
title: hn(i.lastModified),
|
|
2514
|
+
children: mn(i.lastModified)
|
|
2516
2515
|
}),
|
|
2517
|
-
/* @__PURE__ */
|
|
2516
|
+
/* @__PURE__ */ V("td", {
|
|
2518
2517
|
className: "seed-fm-actions",
|
|
2519
2518
|
onClick: (e) => e.stopPropagation(),
|
|
2520
|
-
children: [/* @__PURE__ */
|
|
2519
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2521
2520
|
type: "button",
|
|
2522
2521
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2523
2522
|
"aria-label": `Download ${i.name}`,
|
|
2524
2523
|
title: "Download",
|
|
2525
2524
|
onClick: () => c(e),
|
|
2526
|
-
children: /* @__PURE__ */
|
|
2525
|
+
children: /* @__PURE__ */ B($, {
|
|
2527
2526
|
name: "download",
|
|
2528
2527
|
size: 15
|
|
2529
2528
|
})
|
|
2530
|
-
}), /* @__PURE__ */
|
|
2529
|
+
}), /* @__PURE__ */ B("button", {
|
|
2531
2530
|
type: "button",
|
|
2532
2531
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2533
2532
|
"aria-label": s.label ? `${s.label}: ${i.name}` : `Delete ${i.name}`,
|
|
2534
2533
|
title: s.label ?? "Delete",
|
|
2535
2534
|
onClick: () => l(e),
|
|
2536
|
-
children: /* @__PURE__ */
|
|
2535
|
+
children: /* @__PURE__ */ B($, {
|
|
2537
2536
|
name: "trash",
|
|
2538
2537
|
size: 15
|
|
2539
2538
|
})
|
|
@@ -2549,11 +2548,11 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2549
2548
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2550
2549
|
var ar = 1048576, or = 32768;
|
|
2551
2550
|
function sr(e) {
|
|
2552
|
-
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o =
|
|
2551
|
+
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = wn(e.file), s = e.file.size;
|
|
2553
2552
|
return i(() => {
|
|
2554
2553
|
let e = !1, t = null;
|
|
2555
2554
|
return n({ kind: "loading" }), (async () => {
|
|
2556
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2555
|
+
if (o === "image") return t = URL.createObjectURL(await Qt(r)), {
|
|
2557
2556
|
kind: "image",
|
|
2558
2557
|
url: t
|
|
2559
2558
|
};
|
|
@@ -2562,7 +2561,7 @@ function sr(e) {
|
|
|
2562
2561
|
kind: "none",
|
|
2563
2562
|
message: "This file is too large to preview."
|
|
2564
2563
|
};
|
|
2565
|
-
let e = await
|
|
2564
|
+
let e = await Qt(r), t = e.size > or, n = await e.slice(0, or).text();
|
|
2566
2565
|
if (o === "json" && !t) try {
|
|
2567
2566
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2568
2567
|
} catch {}
|
|
@@ -2597,14 +2596,14 @@ function sr(e) {
|
|
|
2597
2596
|
]), t;
|
|
2598
2597
|
}
|
|
2599
2598
|
function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onDelete: o, deleteAction: l, onCopyPath: u, className: d }) {
|
|
2600
|
-
let { file: f, variants: p } = e, m =
|
|
2599
|
+
let { file: f, variants: p } = e, m = wn(f), h = sr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2601
2600
|
i(() => {
|
|
2602
2601
|
_(null), y(!1);
|
|
2603
2602
|
}, [f.path]), i(() => {
|
|
2604
2603
|
b.current?.focus();
|
|
2605
2604
|
}, []);
|
|
2606
2605
|
let x = `seed-fm-panel-${encodeURIComponent(f.path)}`, S = p.reduce((e, t) => e + t.file.size, 0), C;
|
|
2607
|
-
if (h.kind === "image" && !v) C = /* @__PURE__ */
|
|
2606
|
+
if (h.kind === "image" && !v) C = /* @__PURE__ */ B("img", {
|
|
2608
2607
|
src: h.url,
|
|
2609
2608
|
alt: `Preview of ${f.name}`,
|
|
2610
2609
|
onLoad: (e) => _({
|
|
@@ -2613,64 +2612,64 @@ function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2613
2612
|
}),
|
|
2614
2613
|
onError: () => y(!0)
|
|
2615
2614
|
});
|
|
2616
|
-
else if (h.kind === "text") C = /* @__PURE__ */
|
|
2615
|
+
else if (h.kind === "text") C = /* @__PURE__ */ V("pre", { children: [h.text, h.truncated && "\n…"] });
|
|
2617
2616
|
else if (h.kind === "loading") C = null;
|
|
2618
2617
|
else {
|
|
2619
2618
|
let e = h.kind === "none" ? h.message : "The browser can’t decode this image. The file may be corrupt or not an image.";
|
|
2620
|
-
C = /* @__PURE__ */
|
|
2619
|
+
C = /* @__PURE__ */ V("span", {
|
|
2621
2620
|
className: "seed-fm-preview-note",
|
|
2622
|
-
children: [/* @__PURE__ */
|
|
2621
|
+
children: [/* @__PURE__ */ B($, {
|
|
2623
2622
|
name: v ? "imageOff" : $n[m].icon,
|
|
2624
2623
|
size: 32,
|
|
2625
2624
|
strokeWidth: 1.5
|
|
2626
2625
|
}), e]
|
|
2627
2626
|
});
|
|
2628
2627
|
}
|
|
2629
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2630
|
-
return /* @__PURE__ */
|
|
2628
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(Sn(f));
|
|
2629
|
+
return /* @__PURE__ */ V("aside", {
|
|
2631
2630
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2632
2631
|
role: "dialog",
|
|
2633
2632
|
"aria-modal": "false",
|
|
2634
2633
|
"aria-labelledby": x,
|
|
2635
2634
|
children: [
|
|
2636
|
-
/* @__PURE__ */
|
|
2635
|
+
/* @__PURE__ */ V("div", {
|
|
2637
2636
|
className: "seed-fm-panel-head",
|
|
2638
2637
|
children: [
|
|
2639
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ B("h3", {
|
|
2640
2639
|
id: x,
|
|
2641
2640
|
title: f.name,
|
|
2642
2641
|
children: f.name
|
|
2643
2642
|
}),
|
|
2644
|
-
/* @__PURE__ */
|
|
2643
|
+
/* @__PURE__ */ B("button", {
|
|
2645
2644
|
type: "button",
|
|
2646
2645
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2647
2646
|
"aria-label": "Previous file",
|
|
2648
2647
|
disabled: !n,
|
|
2649
2648
|
onClick: n ?? void 0,
|
|
2650
|
-
children: /* @__PURE__ */
|
|
2649
|
+
children: /* @__PURE__ */ B($, { name: "chevronLeft" })
|
|
2651
2650
|
}),
|
|
2652
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ B("button", {
|
|
2653
2652
|
type: "button",
|
|
2654
2653
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2655
2654
|
"aria-label": "Next file",
|
|
2656
2655
|
disabled: !r,
|
|
2657
2656
|
onClick: r ?? void 0,
|
|
2658
|
-
children: /* @__PURE__ */
|
|
2657
|
+
children: /* @__PURE__ */ B($, { name: "chevronRight" })
|
|
2659
2658
|
}),
|
|
2660
|
-
/* @__PURE__ */
|
|
2659
|
+
/* @__PURE__ */ B("button", {
|
|
2661
2660
|
ref: b,
|
|
2662
2661
|
type: "button",
|
|
2663
2662
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2664
2663
|
"aria-label": "Close details",
|
|
2665
2664
|
onClick: t,
|
|
2666
|
-
children: /* @__PURE__ */
|
|
2665
|
+
children: /* @__PURE__ */ B($, { name: "x" })
|
|
2667
2666
|
})
|
|
2668
2667
|
]
|
|
2669
2668
|
}),
|
|
2670
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ V("div", {
|
|
2671
2670
|
className: "seed-fm-panel-body",
|
|
2672
2671
|
children: [
|
|
2673
|
-
/* @__PURE__ */
|
|
2672
|
+
/* @__PURE__ */ B("div", {
|
|
2674
2673
|
className: [
|
|
2675
2674
|
"seed-fm-preview",
|
|
2676
2675
|
w ? "seed-fm-thumb--checker" : "",
|
|
@@ -2679,78 +2678,78 @@ function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2679
2678
|
style: er(m),
|
|
2680
2679
|
children: C
|
|
2681
2680
|
}),
|
|
2682
|
-
/* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ V("dl", {
|
|
2683
2682
|
className: "seed-fm-details",
|
|
2684
2683
|
children: [
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */
|
|
2684
|
+
/* @__PURE__ */ B("dt", { children: "Path" }),
|
|
2685
|
+
/* @__PURE__ */ B("dd", { children: /* @__PURE__ */ V("span", {
|
|
2687
2686
|
className: "seed-fm-path",
|
|
2688
|
-
children: [/* @__PURE__ */
|
|
2687
|
+
children: [/* @__PURE__ */ B("code", { children: f.path }), /* @__PURE__ */ B("button", {
|
|
2689
2688
|
type: "button",
|
|
2690
2689
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2691
2690
|
"aria-label": "Copy path",
|
|
2692
2691
|
title: "Copy path",
|
|
2693
2692
|
onClick: u,
|
|
2694
|
-
children: /* @__PURE__ */
|
|
2693
|
+
children: /* @__PURE__ */ B($, {
|
|
2695
2694
|
name: "copy",
|
|
2696
2695
|
size: 13
|
|
2697
2696
|
})
|
|
2698
2697
|
})]
|
|
2699
2698
|
}) }),
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
|
|
2699
|
+
/* @__PURE__ */ B("dt", { children: "Size" }),
|
|
2700
|
+
/* @__PURE__ */ V("dd", { children: [
|
|
2701
|
+
Q(f.size),
|
|
2703
2702
|
" ",
|
|
2704
|
-
/* @__PURE__ */
|
|
2703
|
+
/* @__PURE__ */ V("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2705
2704
|
] }),
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ B("dt", { children: "Type" }),
|
|
2706
|
+
/* @__PURE__ */ V("dd", { children: [Sn(f), f.detectedType && /* @__PURE__ */ V("small", { children: [
|
|
2708
2707
|
" from file contents. File.type is “",
|
|
2709
2708
|
f.type,
|
|
2710
2709
|
"”"
|
|
2711
2710
|
] })] }),
|
|
2712
|
-
g && /* @__PURE__ */ z
|
|
2711
|
+
g && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("dt", { children: "Dimensions" }), /* @__PURE__ */ V("dd", { children: [
|
|
2713
2712
|
g.width.toLocaleString(),
|
|
2714
2713
|
" × ",
|
|
2715
2714
|
g.height.toLocaleString(),
|
|
2716
2715
|
" px"
|
|
2717
2716
|
] })] }),
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
|
|
2717
|
+
/* @__PURE__ */ B("dt", { children: "Modified" }),
|
|
2718
|
+
/* @__PURE__ */ V("dd", { children: [
|
|
2719
|
+
hn(f.lastModified),
|
|
2721
2720
|
" ",
|
|
2722
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ B("small", { children: mn(f.lastModified) })
|
|
2723
2722
|
] })
|
|
2724
2723
|
]
|
|
2725
2724
|
}),
|
|
2726
|
-
p.length > 0 && /* @__PURE__ */
|
|
2725
|
+
p.length > 0 && /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ V("div", {
|
|
2727
2726
|
className: "seed-fm-section-label",
|
|
2728
|
-
children: ["Resized copies · ",
|
|
2729
|
-
}), /* @__PURE__ */
|
|
2727
|
+
children: ["Resized copies · ", Q(S)]
|
|
2728
|
+
}), /* @__PURE__ */ B("ul", {
|
|
2730
2729
|
className: "seed-fm-variants",
|
|
2731
|
-
children: p.map((e) => /* @__PURE__ */
|
|
2730
|
+
children: p.map((e) => /* @__PURE__ */ V("li", {
|
|
2732
2731
|
title: e.file.path,
|
|
2733
|
-
children: [/* @__PURE__ */
|
|
2732
|
+
children: [/* @__PURE__ */ V("span", { children: [e.width, "w · webp"] }), /* @__PURE__ */ B("span", { children: Q(e.file.size) })]
|
|
2734
2733
|
}, e.file.path))
|
|
2735
2734
|
})] })
|
|
2736
2735
|
]
|
|
2737
2736
|
}),
|
|
2738
|
-
/* @__PURE__ */
|
|
2737
|
+
/* @__PURE__ */ V("div", {
|
|
2739
2738
|
className: "seed-fm-panel-foot",
|
|
2740
|
-
children: [/* @__PURE__ */
|
|
2739
|
+
children: [/* @__PURE__ */ V("button", {
|
|
2741
2740
|
type: "button",
|
|
2742
2741
|
className: "seed-fm-btn seed-fm-btn--primary",
|
|
2743
2742
|
onClick: a,
|
|
2744
|
-
children: [/* @__PURE__ */
|
|
2743
|
+
children: [/* @__PURE__ */ B($, {
|
|
2745
2744
|
name: "download",
|
|
2746
2745
|
size: 15
|
|
2747
2746
|
}), " Download"]
|
|
2748
|
-
}), /* @__PURE__ */
|
|
2747
|
+
}), /* @__PURE__ */ V("button", {
|
|
2749
2748
|
type: "button",
|
|
2750
2749
|
className: `seed-fm-btn${l.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
2751
2750
|
onClick: o,
|
|
2752
2751
|
children: [
|
|
2753
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ B($, {
|
|
2754
2753
|
name: "trash",
|
|
2755
2754
|
size: 15
|
|
2756
2755
|
}),
|
|
@@ -3097,51 +3096,51 @@ function jr({ files: e, estimate: t }) {
|
|
|
3097
3096
|
size: i,
|
|
3098
3097
|
color: "var(--seed-border-strong)"
|
|
3099
3098
|
}] : []];
|
|
3100
|
-
return /* @__PURE__ */
|
|
3099
|
+
return /* @__PURE__ */ V("div", {
|
|
3101
3100
|
className: "seed-fm-usage",
|
|
3102
3101
|
title: "From navigator.storage.estimate(). Browsers round these numbers.",
|
|
3103
|
-
children: [/* @__PURE__ */
|
|
3102
|
+
children: [/* @__PURE__ */ V("div", {
|
|
3104
3103
|
className: "seed-fm-usage-row",
|
|
3105
|
-
children: [/* @__PURE__ */
|
|
3106
|
-
/* @__PURE__ */
|
|
3104
|
+
children: [/* @__PURE__ */ V("span", { children: [
|
|
3105
|
+
/* @__PURE__ */ B("strong", { children: Q(t ? t.usage : r) }),
|
|
3107
3106
|
" ",
|
|
3108
3107
|
t ? "used by this site" : `in ${Er(e.length, "file")}`
|
|
3109
|
-
] }), t && /* @__PURE__ */
|
|
3110
|
-
}), a > 0 && /* @__PURE__ */ z
|
|
3108
|
+
] }), t && /* @__PURE__ */ V("span", { children: [Q(t.quota), " available"] })]
|
|
3109
|
+
}), a > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3111
3110
|
className: "seed-fm-meter",
|
|
3112
3111
|
role: "img",
|
|
3113
3112
|
"aria-label": "Storage used, by file type",
|
|
3114
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3113
|
+
children: o.map((e) => /* @__PURE__ */ B("span", { style: {
|
|
3115
3114
|
width: `${e.size / a * 100}%`,
|
|
3116
3115
|
background: e.color
|
|
3117
3116
|
} }, e.label))
|
|
3118
|
-
}), /* @__PURE__ */
|
|
3117
|
+
}), /* @__PURE__ */ B("ul", {
|
|
3119
3118
|
className: "seed-fm-legend",
|
|
3120
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3119
|
+
children: o.map((e) => /* @__PURE__ */ V("li", {
|
|
3121
3120
|
style: { "--seed-swatch": e.color },
|
|
3122
3121
|
children: [
|
|
3123
3122
|
e.label,
|
|
3124
3123
|
" ",
|
|
3125
|
-
|
|
3124
|
+
Q(e.size)
|
|
3126
3125
|
]
|
|
3127
3126
|
}, e.label))
|
|
3128
3127
|
})] })]
|
|
3129
3128
|
});
|
|
3130
3129
|
}
|
|
3131
3130
|
function Mr({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3132
|
-
return /* @__PURE__ */
|
|
3131
|
+
return /* @__PURE__ */ V("div", {
|
|
3133
3132
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3134
3133
|
role: r === "error" ? "alert" : void 0,
|
|
3135
3134
|
children: [
|
|
3136
|
-
/* @__PURE__ */
|
|
3135
|
+
/* @__PURE__ */ B("span", {
|
|
3137
3136
|
className: "seed-fm-state-icon",
|
|
3138
|
-
children: /* @__PURE__ */
|
|
3137
|
+
children: /* @__PURE__ */ B($, {
|
|
3139
3138
|
name: e,
|
|
3140
3139
|
size: 22
|
|
3141
3140
|
})
|
|
3142
3141
|
}),
|
|
3143
|
-
/* @__PURE__ */
|
|
3144
|
-
/* @__PURE__ */
|
|
3142
|
+
/* @__PURE__ */ B("h3", { children: t }),
|
|
3143
|
+
/* @__PURE__ */ B("p", { children: n }),
|
|
3145
3144
|
i
|
|
3146
3145
|
]
|
|
3147
3146
|
});
|
|
@@ -3150,102 +3149,102 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3150
3149
|
a(() => {
|
|
3151
3150
|
p !== "none" && mr();
|
|
3152
3151
|
}, [p]);
|
|
3153
|
-
let S = Dr(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading:
|
|
3154
|
-
i(() =>
|
|
3155
|
-
let
|
|
3156
|
-
i(() =>
|
|
3157
|
-
let [
|
|
3158
|
-
x ? x(e, t, n) :
|
|
3159
|
-
},
|
|
3160
|
-
query:
|
|
3161
|
-
sort:
|
|
3152
|
+
let S = Dr(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: E, hasLoaded: ee, error: D, errorName: O, refetch: te } = ln({ rootPath: e }), k = o(() => t ? T.filter(t) : T, [T, t]), ne = hr(T), [re, A] = c(_);
|
|
3153
|
+
i(() => A(_), [_]);
|
|
3154
|
+
let j = o(() => Mn(k, re), [k, re]), [M, ie] = c(S);
|
|
3155
|
+
i(() => ie(S), [S]);
|
|
3156
|
+
let [ae, oe] = c(""), [se, ce] = c("name"), [le, ue] = c(g), [N, P] = c(() => /* @__PURE__ */ new Set()), F = s(null), [I, L] = c(null), de = s(null), [R, fe] = c(null), [H, pe] = c(null), [me, U] = c(!1), { toasts: he, showToast: ge } = kr(), _e = (e, t, n) => {
|
|
3157
|
+
x ? x(e, t, n) : ge(e, t);
|
|
3158
|
+
}, W = o(() => Pn(j, M, {
|
|
3159
|
+
query: ae,
|
|
3160
|
+
sort: se
|
|
3162
3161
|
}), [
|
|
3163
|
-
k,
|
|
3164
|
-
A,
|
|
3165
3162
|
j,
|
|
3166
|
-
|
|
3167
|
-
|
|
3163
|
+
M,
|
|
3164
|
+
ae,
|
|
3165
|
+
se
|
|
3166
|
+
]), G = W.entries, ve = G.length ? G.filter((e) => wn(e.file) === "image").length / G.length : 0, ye = le ?? (ve >= .5 ? "grid" : "list"), K = o(() => new Map(j.map((e) => [e.file.path, e])), [j]), be = o(() => [...N].map((e) => K.get(e)).filter((e) => !!e), [N, K]), q = I ? K.get(I) ?? null : null, J = q ? G.indexOf(q) : -1;
|
|
3168
3167
|
i(() => {
|
|
3169
|
-
|
|
3170
|
-
let t = new Set([...e].filter((e) =>
|
|
3168
|
+
P((e) => {
|
|
3169
|
+
let t = new Set([...e].filter((e) => K.has(e)));
|
|
3171
3170
|
return t.size === e.size ? e : t;
|
|
3172
3171
|
});
|
|
3173
|
-
}, [
|
|
3174
|
-
let
|
|
3175
|
-
|
|
3176
|
-
},
|
|
3177
|
-
let r =
|
|
3178
|
-
|
|
3172
|
+
}, [K]);
|
|
3173
|
+
let xe = (e) => {
|
|
3174
|
+
ie(e), oe(""), P(/* @__PURE__ */ new Set()), F.current = null, L(null);
|
|
3175
|
+
}, Se = (e, t, n) => {
|
|
3176
|
+
let r = F.current;
|
|
3177
|
+
P((i) => {
|
|
3179
3178
|
let a = new Set(i);
|
|
3180
3179
|
if (n && r != null) {
|
|
3181
3180
|
let [e, n] = r < t ? [r, t] : [t, r];
|
|
3182
|
-
for (let t of
|
|
3181
|
+
for (let t of G.slice(e, n + 1)) a.add(t.file.path);
|
|
3183
3182
|
} else a.has(e.file.path) ? a.delete(e.file.path) : a.add(e.file.path);
|
|
3184
3183
|
return a;
|
|
3185
|
-
}), (!n || r == null) && (
|
|
3186
|
-
},
|
|
3187
|
-
|
|
3188
|
-
},
|
|
3189
|
-
|
|
3190
|
-
},
|
|
3184
|
+
}), (!n || r == null) && (F.current = t);
|
|
3185
|
+
}, Ce = (e) => {
|
|
3186
|
+
I || (de.current = document.activeElement), L(e);
|
|
3187
|
+
}, we = () => {
|
|
3188
|
+
L(null), de.current?.focus?.(), de.current = null;
|
|
3189
|
+
}, Y = (e, t, n) => {
|
|
3191
3190
|
let r = n.shiftKey || n.metaKey || n.ctrlKey;
|
|
3192
|
-
|
|
3193
|
-
},
|
|
3194
|
-
let e =
|
|
3195
|
-
|
|
3191
|
+
N.size > 0 || r ? Se(e, t, n.shiftKey) : Ce(e.file.path);
|
|
3192
|
+
}, Te = () => {
|
|
3193
|
+
let e = G.every((e) => N.has(e.file.path));
|
|
3194
|
+
P((t) => {
|
|
3196
3195
|
let n = new Set(t);
|
|
3197
|
-
for (let t of
|
|
3196
|
+
for (let t of G) e ? n.delete(t.file.path) : n.add(t.file.path);
|
|
3198
3197
|
return n;
|
|
3199
3198
|
});
|
|
3200
|
-
},
|
|
3199
|
+
}, Ee = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, De = async (e, t) => {
|
|
3201
3200
|
l ? await l(e, t) : Or(e.name, t);
|
|
3202
|
-
},
|
|
3201
|
+
}, Oe = async (e, t) => {
|
|
3203
3202
|
if (e.length === 0) return !1;
|
|
3204
|
-
|
|
3203
|
+
U(!0);
|
|
3205
3204
|
try {
|
|
3206
3205
|
if (e.length === 1 && !t) {
|
|
3207
3206
|
let [t] = e;
|
|
3208
|
-
return await
|
|
3207
|
+
return await De(t, await Qt(t.path)), !0;
|
|
3209
3208
|
}
|
|
3210
3209
|
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await Sr(await Promise.all(e.map(async (e) => ({
|
|
3211
|
-
name: t ? e.path.slice(n.length) :
|
|
3212
|
-
data: await
|
|
3210
|
+
name: t ? e.path.slice(n.length) : Ee(e.path),
|
|
3211
|
+
data: await Qt(e.path),
|
|
3213
3212
|
lastModified: e.lastModified
|
|
3214
3213
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3215
|
-
return await
|
|
3214
|
+
return await De({
|
|
3216
3215
|
name: i,
|
|
3217
3216
|
path: i,
|
|
3218
3217
|
size: r.size,
|
|
3219
3218
|
type: "application/zip",
|
|
3220
3219
|
lastModified: Date.now()
|
|
3221
|
-
}, r),
|
|
3220
|
+
}, r), _e(`Saved ${i} with ${Er(e.length, "file")}`, "success", {
|
|
3222
3221
|
kind: "download",
|
|
3223
3222
|
paths: e.map((e) => e.path),
|
|
3224
3223
|
fileName: i
|
|
3225
3224
|
}), !0;
|
|
3226
3225
|
} catch (t) {
|
|
3227
|
-
return
|
|
3226
|
+
return _e(`Couldn’t download: ${Tr(t)}`, "error", {
|
|
3228
3227
|
kind: "download",
|
|
3229
3228
|
paths: e.map((e) => e.path),
|
|
3230
3229
|
error: Tr(t)
|
|
3231
3230
|
}), !1;
|
|
3232
3231
|
} finally {
|
|
3233
|
-
|
|
3232
|
+
U(!1);
|
|
3234
3233
|
}
|
|
3235
|
-
},
|
|
3234
|
+
}, ke = (e) => Oe(e.map((e) => e.file)), X = (e, t) => e.flatMap((e) => [e.file, ...t ? e.variants.map((e) => e.file) : []]), Ae = (e) => {
|
|
3236
3235
|
let t = b?.(e);
|
|
3237
3236
|
return {
|
|
3238
3237
|
label: t?.label,
|
|
3239
3238
|
destructive: t?.destructive !== !1
|
|
3240
3239
|
};
|
|
3241
|
-
},
|
|
3242
|
-
|
|
3240
|
+
}, je = (e) => Ae(X(e, !0)), Me = async (e, t) => {
|
|
3241
|
+
U(!0);
|
|
3243
3242
|
let i = [], a = [], o = [], s = !1;
|
|
3244
3243
|
try {
|
|
3245
3244
|
let r = await navigator.storage.getDirectory();
|
|
3246
3245
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3247
3246
|
else try {
|
|
3248
|
-
await
|
|
3247
|
+
await $t(t.path, r), i.push(t.path);
|
|
3249
3248
|
} catch (e) {
|
|
3250
3249
|
a.push({
|
|
3251
3250
|
path: t.path,
|
|
@@ -3253,7 +3252,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3253
3252
|
});
|
|
3254
3253
|
}
|
|
3255
3254
|
if (t) try {
|
|
3256
|
-
s = await
|
|
3255
|
+
s = await tn(t.path, r);
|
|
3257
3256
|
} catch (e) {
|
|
3258
3257
|
a.push({
|
|
3259
3258
|
path: t.path,
|
|
@@ -3266,16 +3265,16 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3266
3265
|
error: Tr(e)
|
|
3267
3266
|
});
|
|
3268
3267
|
}
|
|
3269
|
-
|
|
3268
|
+
P((e) => {
|
|
3270
3269
|
let t = new Set(e);
|
|
3271
3270
|
return i.forEach((e) => t.delete(e)), t;
|
|
3272
|
-
}),
|
|
3271
|
+
}), I && i.includes(I) && L(null), await te(), U(!1);
|
|
3273
3272
|
let c = [s ? `Deleted the ${t.name} folder (${Er(i.length, "file")})` : i.length > 0 ? `Deleted ${Er(i.length, "file")}` : "Nothing deleted"];
|
|
3274
3273
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3275
3274
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3276
3275
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
3277
3276
|
}
|
|
3278
|
-
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`),
|
|
3277
|
+
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`), _e(c.join(". "), a.length ? "error" : "success", {
|
|
3279
3278
|
kind: "delete",
|
|
3280
3279
|
deleted: i,
|
|
3281
3280
|
skipped: o,
|
|
@@ -3285,26 +3284,26 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3285
3284
|
folderRemoved: s
|
|
3286
3285
|
}
|
|
3287
3286
|
}), i.length > 0 && await r?.(i);
|
|
3288
|
-
},
|
|
3287
|
+
}, Ne = async (e) => {
|
|
3289
3288
|
if (e.length === 0) return;
|
|
3290
3289
|
if (!y) {
|
|
3291
|
-
|
|
3290
|
+
fe(e);
|
|
3292
3291
|
return;
|
|
3293
3292
|
}
|
|
3294
|
-
let t =
|
|
3295
|
-
await y(t) && await
|
|
3296
|
-
},
|
|
3293
|
+
let t = X(e, !0);
|
|
3294
|
+
await y(t) && await Me(t);
|
|
3295
|
+
}, Pe = (e) => k.filter((t) => t.path.startsWith(`${e.path}/`)), Fe = async (e) => {
|
|
3297
3296
|
if (!y) {
|
|
3298
|
-
|
|
3297
|
+
pe(e);
|
|
3299
3298
|
return;
|
|
3300
3299
|
}
|
|
3301
|
-
let t =
|
|
3302
|
-
await y(t) && await
|
|
3303
|
-
},
|
|
3304
|
-
let t = () =>
|
|
3300
|
+
let t = Pe(e);
|
|
3301
|
+
await y(t) && await Me(t, e);
|
|
3302
|
+
}, Ie = (e) => {
|
|
3303
|
+
let t = () => _e("Path copied", "success", {
|
|
3305
3304
|
kind: "copy-path",
|
|
3306
3305
|
path: e
|
|
3307
|
-
}), n = (t) =>
|
|
3306
|
+
}), n = (t) => _e("Couldn’t copy. Select the path text instead.", "error", {
|
|
3308
3307
|
kind: "copy-path",
|
|
3309
3308
|
path: e,
|
|
3310
3309
|
error: t === void 0 ? "Clipboard unavailable" : Tr(t)
|
|
@@ -3314,338 +3313,338 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3314
3313
|
} catch (e) {
|
|
3315
3314
|
n(e);
|
|
3316
3315
|
}
|
|
3317
|
-
},
|
|
3318
|
-
if (
|
|
3316
|
+
}, Le = (e) => {
|
|
3317
|
+
if (R || H) return;
|
|
3319
3318
|
let t = e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement;
|
|
3320
3319
|
if (e.key === "Escape") {
|
|
3321
|
-
if (
|
|
3322
|
-
else if (
|
|
3320
|
+
if (I) we();
|
|
3321
|
+
else if (N.size > 0) P(/* @__PURE__ */ new Set());
|
|
3323
3322
|
else return;
|
|
3324
3323
|
e.preventDefault();
|
|
3325
|
-
} else if (
|
|
3326
|
-
let t =
|
|
3327
|
-
t &&
|
|
3324
|
+
} else if (q && !t && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
3325
|
+
let t = G[J + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3326
|
+
t && L(t.file.path), e.preventDefault();
|
|
3328
3327
|
}
|
|
3329
|
-
},
|
|
3328
|
+
}, Re = o(() => k.some((e) => kn(e.path)), [k]), ze = /(^|\/)images(\/\d+)?$/.test(M), Z = [{
|
|
3330
3329
|
label: C,
|
|
3331
3330
|
path: S
|
|
3332
|
-
}, ...(
|
|
3331
|
+
}, ...(M.length > S.length ? M.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3333
3332
|
label: e,
|
|
3334
3333
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3335
|
-
}))],
|
|
3336
|
-
if (!
|
|
3334
|
+
}))], Be = `h${f}`, Ve = be.reduce((e, t) => e + t.file.size, 0), He;
|
|
3335
|
+
if (!nn()) He = /* @__PURE__ */ B(Mr, {
|
|
3337
3336
|
icon: "triangleAlert",
|
|
3338
3337
|
tone: "error",
|
|
3339
3338
|
title: "This browser doesn’t support private file storage",
|
|
3340
3339
|
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."
|
|
3341
3340
|
});
|
|
3342
3341
|
else if (D) {
|
|
3343
|
-
let e = /* @__PURE__ */
|
|
3342
|
+
let e = /* @__PURE__ */ V("button", {
|
|
3344
3343
|
type: "button",
|
|
3345
3344
|
className: "seed-fm-btn",
|
|
3346
|
-
onClick: () =>
|
|
3347
|
-
children: [/* @__PURE__ */
|
|
3345
|
+
onClick: () => te(),
|
|
3346
|
+
children: [/* @__PURE__ */ B($, {
|
|
3348
3347
|
name: "refresh",
|
|
3349
3348
|
size: 15
|
|
3350
3349
|
}), " Try again"]
|
|
3351
3350
|
});
|
|
3352
|
-
|
|
3351
|
+
He = O === "NotFoundError" && S ? /* @__PURE__ */ V(Mr, {
|
|
3353
3352
|
icon: "triangleAlert",
|
|
3354
3353
|
tone: "error",
|
|
3355
3354
|
title: `Can’t open ${S}`,
|
|
3356
3355
|
action: e,
|
|
3357
3356
|
children: [
|
|
3358
3357
|
"The folder ",
|
|
3359
|
-
/* @__PURE__ */
|
|
3358
|
+
/* @__PURE__ */ B("code", { children: S }),
|
|
3360
3359
|
" doesn’t exist in this browser’s private storage yet. Check the",
|
|
3361
3360
|
" ",
|
|
3362
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ B("code", { children: "rootPath" }),
|
|
3363
3362
|
" prop, or open the app once so the SDK creates it."
|
|
3364
3363
|
]
|
|
3365
|
-
}) : /* @__PURE__ */
|
|
3364
|
+
}) : /* @__PURE__ */ B(Mr, {
|
|
3366
3365
|
icon: "triangleAlert",
|
|
3367
3366
|
tone: "error",
|
|
3368
3367
|
title: "Can’t read private storage",
|
|
3369
3368
|
action: e,
|
|
3370
3369
|
children: D
|
|
3371
3370
|
});
|
|
3372
|
-
} else
|
|
3371
|
+
} else He = ee ? j.length === 0 ? /* @__PURE__ */ B(Mr, {
|
|
3373
3372
|
icon: "folderOpen",
|
|
3374
3373
|
title: `No files in ${C} yet`,
|
|
3375
3374
|
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."
|
|
3376
|
-
}) :
|
|
3375
|
+
}) : W.folders.length === 0 && G.length === 0 ? ae ? /* @__PURE__ */ V(Mr, {
|
|
3377
3376
|
icon: "search",
|
|
3378
|
-
title: `No matches for “${
|
|
3379
|
-
action: /* @__PURE__ */
|
|
3377
|
+
title: `No matches for “${ae}”`,
|
|
3378
|
+
action: /* @__PURE__ */ B("button", {
|
|
3380
3379
|
type: "button",
|
|
3381
3380
|
className: "seed-fm-btn",
|
|
3382
|
-
onClick: () =>
|
|
3381
|
+
onClick: () => oe(""),
|
|
3383
3382
|
children: "Clear search"
|
|
3384
3383
|
}),
|
|
3385
3384
|
children: [
|
|
3386
3385
|
"Search covers file names and paths in ",
|
|
3387
|
-
|
|
3386
|
+
Z[Z.length - 1].label,
|
|
3388
3387
|
" and every folder inside it."
|
|
3389
3388
|
]
|
|
3390
|
-
}) : /* @__PURE__ */
|
|
3389
|
+
}) : /* @__PURE__ */ B(Mr, {
|
|
3391
3390
|
icon: "folderOpen",
|
|
3392
3391
|
title: "This folder is empty",
|
|
3393
3392
|
children: "Everything in it has been deleted or filtered out."
|
|
3394
|
-
}) : /* @__PURE__ */ z
|
|
3393
|
+
}) : /* @__PURE__ */ V(z, { children: [W.folders.length > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3395
3394
|
className: "seed-fm-section-label",
|
|
3396
3395
|
children: "Folders"
|
|
3397
|
-
}), /* @__PURE__ */
|
|
3396
|
+
}), /* @__PURE__ */ B("ul", {
|
|
3398
3397
|
className: "seed-fm-folders",
|
|
3399
|
-
children:
|
|
3398
|
+
children: W.folders.map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ V("button", {
|
|
3400
3399
|
type: "button",
|
|
3401
3400
|
className: w("folder", "seed-fm-folder"),
|
|
3402
|
-
onClick: () =>
|
|
3403
|
-
children: [/* @__PURE__ */
|
|
3401
|
+
onClick: () => xe(e.path),
|
|
3402
|
+
children: [/* @__PURE__ */ B($, {
|
|
3404
3403
|
name: "folder",
|
|
3405
3404
|
size: 20,
|
|
3406
3405
|
strokeWidth: 1.75
|
|
3407
|
-
}), /* @__PURE__ */
|
|
3406
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("span", {
|
|
3408
3407
|
className: "seed-fm-folder-name",
|
|
3409
3408
|
children: e.name
|
|
3410
|
-
}), /* @__PURE__ */
|
|
3409
|
+
}), /* @__PURE__ */ V("span", {
|
|
3411
3410
|
className: "seed-fm-folder-meta",
|
|
3412
3411
|
children: [
|
|
3413
3412
|
Er(e.fileCount, "file"),
|
|
3414
3413
|
" · ",
|
|
3415
|
-
|
|
3414
|
+
Q(e.size)
|
|
3416
3415
|
]
|
|
3417
3416
|
})] })]
|
|
3418
|
-
}), /* @__PURE__ */
|
|
3417
|
+
}), /* @__PURE__ */ B("button", {
|
|
3419
3418
|
type: "button",
|
|
3420
3419
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon seed-fm-folder-delete",
|
|
3421
3420
|
"aria-label": `Delete folder ${e.name}`,
|
|
3422
3421
|
title: "Delete folder",
|
|
3423
|
-
disabled:
|
|
3424
|
-
onClick: () =>
|
|
3425
|
-
children: /* @__PURE__ */
|
|
3422
|
+
disabled: me,
|
|
3423
|
+
onClick: () => Fe(e),
|
|
3424
|
+
children: /* @__PURE__ */ B($, {
|
|
3426
3425
|
name: "trash",
|
|
3427
3426
|
size: 15
|
|
3428
3427
|
})
|
|
3429
3428
|
})] }, e.path))
|
|
3430
|
-
})] }),
|
|
3429
|
+
})] }), G.length > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3431
3430
|
className: "seed-fm-section-label",
|
|
3432
|
-
children:
|
|
3433
|
-
}),
|
|
3434
|
-
entries:
|
|
3435
|
-
selected:
|
|
3436
|
-
onActivate:
|
|
3437
|
-
onToggle:
|
|
3431
|
+
children: ae ? Er(G.length, "result") : "Files"
|
|
3432
|
+
}), ye === "grid" ? /* @__PURE__ */ B(rr, {
|
|
3433
|
+
entries: G,
|
|
3434
|
+
selected: N,
|
|
3435
|
+
onActivate: Y,
|
|
3436
|
+
onToggle: Se,
|
|
3438
3437
|
className: h.grid,
|
|
3439
3438
|
tileClassName: h.tile
|
|
3440
|
-
}) : /* @__PURE__ */
|
|
3441
|
-
entries:
|
|
3442
|
-
selected:
|
|
3443
|
-
cwd:
|
|
3444
|
-
onActivate:
|
|
3445
|
-
onToggle:
|
|
3446
|
-
onToggleAll:
|
|
3447
|
-
onDownload: (e) =>
|
|
3448
|
-
onDelete: (e) =>
|
|
3449
|
-
deleteActionFor: (e) =>
|
|
3439
|
+
}) : /* @__PURE__ */ B(ir, {
|
|
3440
|
+
entries: G,
|
|
3441
|
+
selected: N,
|
|
3442
|
+
cwd: M,
|
|
3443
|
+
onActivate: Y,
|
|
3444
|
+
onToggle: Se,
|
|
3445
|
+
onToggleAll: Te,
|
|
3446
|
+
onDownload: (e) => ke([e]),
|
|
3447
|
+
onDelete: (e) => Ne([e]),
|
|
3448
|
+
deleteActionFor: (e) => je([e]),
|
|
3450
3449
|
className: h.list,
|
|
3451
3450
|
rowClassName: h.row
|
|
3452
|
-
})] })] }) : /* @__PURE__ */
|
|
3451
|
+
})] })] }) : /* @__PURE__ */ B("ul", {
|
|
3453
3452
|
className: w("grid", "seed-fm-grid"),
|
|
3454
3453
|
"aria-busy": "true",
|
|
3455
3454
|
"aria-label": "Loading files",
|
|
3456
|
-
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */
|
|
3455
|
+
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ B("li", {
|
|
3457
3456
|
className: "seed-fm-tile",
|
|
3458
|
-
children: /* @__PURE__ */
|
|
3457
|
+
children: /* @__PURE__ */ B("span", { className: "seed-fm-thumb seed-fm-skeleton" })
|
|
3459
3458
|
}, t))
|
|
3460
3459
|
});
|
|
3461
|
-
let
|
|
3462
|
-
return /* @__PURE__ */
|
|
3460
|
+
let Ue = R ? X(R, !0) : [], We = H ? Pe(H) : [], Ge = N.size > 0 ? je(be) : null;
|
|
3461
|
+
return /* @__PURE__ */ V("div", {
|
|
3463
3462
|
className: [w("root", "seed-fm"), m].filter(Boolean).join(" "),
|
|
3464
3463
|
"data-seed-theme": p === "none" ? void 0 : p,
|
|
3465
|
-
"data-selecting":
|
|
3466
|
-
onKeyDown:
|
|
3464
|
+
"data-selecting": N.size > 0 || void 0,
|
|
3465
|
+
onKeyDown: Le,
|
|
3467
3466
|
children: [
|
|
3468
|
-
/* @__PURE__ */
|
|
3467
|
+
/* @__PURE__ */ V("div", {
|
|
3469
3468
|
className: "seed-fm-frame",
|
|
3470
3469
|
children: [
|
|
3471
|
-
/* @__PURE__ */
|
|
3470
|
+
/* @__PURE__ */ V("header", {
|
|
3472
3471
|
className: w("header", "seed-fm-header"),
|
|
3473
3472
|
children: [
|
|
3474
|
-
/* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ V("div", {
|
|
3475
3474
|
className: "seed-fm-titles",
|
|
3476
|
-
children: [/* @__PURE__ */
|
|
3475
|
+
children: [/* @__PURE__ */ B(Be, {
|
|
3477
3476
|
className: "seed-fm-title",
|
|
3478
3477
|
children: u
|
|
3479
|
-
}), d && /* @__PURE__ */
|
|
3478
|
+
}), d && /* @__PURE__ */ B("p", {
|
|
3480
3479
|
className: "seed-fm-description",
|
|
3481
3480
|
children: d
|
|
3482
3481
|
})]
|
|
3483
3482
|
}),
|
|
3484
|
-
|
|
3485
|
-
files:
|
|
3486
|
-
estimate:
|
|
3483
|
+
ee && !D && /* @__PURE__ */ B(jr, {
|
|
3484
|
+
files: k,
|
|
3485
|
+
estimate: ne
|
|
3487
3486
|
}),
|
|
3488
|
-
/* @__PURE__ */
|
|
3487
|
+
/* @__PURE__ */ B("button", {
|
|
3489
3488
|
type: "button",
|
|
3490
3489
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3491
|
-
onClick: () =>
|
|
3490
|
+
onClick: () => te(),
|
|
3492
3491
|
"aria-label": "Refresh",
|
|
3493
3492
|
title: "Refresh",
|
|
3494
|
-
"data-busy":
|
|
3495
|
-
children: /* @__PURE__ */
|
|
3493
|
+
"data-busy": E && ee,
|
|
3494
|
+
children: /* @__PURE__ */ B($, {
|
|
3496
3495
|
name: "refresh",
|
|
3497
3496
|
size: 15
|
|
3498
3497
|
})
|
|
3499
3498
|
})
|
|
3500
3499
|
]
|
|
3501
3500
|
}),
|
|
3502
|
-
|
|
3501
|
+
ee && !D && j.length > 0 && /* @__PURE__ */ V("div", {
|
|
3503
3502
|
className: w("toolbar", "seed-fm-toolbar"),
|
|
3504
3503
|
children: [
|
|
3505
|
-
/* @__PURE__ */
|
|
3504
|
+
/* @__PURE__ */ B("nav", {
|
|
3506
3505
|
"aria-label": "Folder",
|
|
3507
|
-
children: /* @__PURE__ */
|
|
3506
|
+
children: /* @__PURE__ */ B("ol", {
|
|
3508
3507
|
className: "seed-fm-crumbs",
|
|
3509
|
-
children:
|
|
3508
|
+
children: Z.map((e, t) => /* @__PURE__ */ V("li", { children: [t > 0 && /* @__PURE__ */ B($, {
|
|
3510
3509
|
name: "chevronRight",
|
|
3511
3510
|
size: 14
|
|
3512
|
-
}), /* @__PURE__ */
|
|
3511
|
+
}), /* @__PURE__ */ B("button", {
|
|
3513
3512
|
type: "button",
|
|
3514
|
-
onClick: () =>
|
|
3515
|
-
"aria-current": t ===
|
|
3513
|
+
onClick: () => xe(e.path),
|
|
3514
|
+
"aria-current": t === Z.length - 1 ? "page" : void 0,
|
|
3516
3515
|
children: e.label
|
|
3517
3516
|
})] }, e.path || "/"))
|
|
3518
3517
|
})
|
|
3519
3518
|
}),
|
|
3520
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__PURE__ */ V("label", {
|
|
3521
3520
|
className: "seed-fm-search",
|
|
3522
|
-
children: [/* @__PURE__ */
|
|
3521
|
+
children: [/* @__PURE__ */ B($, {
|
|
3523
3522
|
name: "search",
|
|
3524
3523
|
size: 14
|
|
3525
|
-
}), /* @__PURE__ */
|
|
3524
|
+
}), /* @__PURE__ */ B("input", {
|
|
3526
3525
|
type: "search",
|
|
3527
|
-
value:
|
|
3528
|
-
onChange: (e) =>
|
|
3526
|
+
value: ae,
|
|
3527
|
+
onChange: (e) => oe(e.target.value),
|
|
3529
3528
|
placeholder: "Search names and paths",
|
|
3530
3529
|
"aria-label": "Search files"
|
|
3531
3530
|
})]
|
|
3532
3531
|
}),
|
|
3533
|
-
/* @__PURE__ */
|
|
3532
|
+
/* @__PURE__ */ V("select", {
|
|
3534
3533
|
className: "seed-fm-select",
|
|
3535
|
-
value:
|
|
3536
|
-
onChange: (e) =>
|
|
3534
|
+
value: se,
|
|
3535
|
+
onChange: (e) => ce(e.target.value),
|
|
3537
3536
|
"aria-label": "Sort by",
|
|
3538
3537
|
children: [
|
|
3539
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ B("option", {
|
|
3540
3539
|
value: "name",
|
|
3541
3540
|
children: "Name"
|
|
3542
3541
|
}),
|
|
3543
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ B("option", {
|
|
3544
3543
|
value: "modified",
|
|
3545
3544
|
children: "Recently modified"
|
|
3546
3545
|
}),
|
|
3547
|
-
/* @__PURE__ */
|
|
3546
|
+
/* @__PURE__ */ B("option", {
|
|
3548
3547
|
value: "size",
|
|
3549
3548
|
children: "Largest"
|
|
3550
3549
|
})
|
|
3551
3550
|
]
|
|
3552
3551
|
}),
|
|
3553
|
-
/* @__PURE__ */
|
|
3552
|
+
/* @__PURE__ */ V("div", {
|
|
3554
3553
|
className: "seed-fm-viewtoggle",
|
|
3555
3554
|
role: "group",
|
|
3556
3555
|
"aria-label": "View",
|
|
3557
|
-
children: [/* @__PURE__ */
|
|
3556
|
+
children: [/* @__PURE__ */ B("button", {
|
|
3558
3557
|
type: "button",
|
|
3559
|
-
"aria-pressed":
|
|
3558
|
+
"aria-pressed": ye === "grid",
|
|
3560
3559
|
"aria-label": "Grid view",
|
|
3561
|
-
onClick: () =>
|
|
3562
|
-
children: /* @__PURE__ */
|
|
3560
|
+
onClick: () => ue("grid"),
|
|
3561
|
+
children: /* @__PURE__ */ B($, {
|
|
3563
3562
|
name: "layoutGrid",
|
|
3564
3563
|
size: 15
|
|
3565
3564
|
})
|
|
3566
|
-
}), /* @__PURE__ */
|
|
3565
|
+
}), /* @__PURE__ */ B("button", {
|
|
3567
3566
|
type: "button",
|
|
3568
|
-
"aria-pressed":
|
|
3567
|
+
"aria-pressed": ye === "list",
|
|
3569
3568
|
"aria-label": "List view",
|
|
3570
|
-
onClick: () =>
|
|
3571
|
-
children: /* @__PURE__ */
|
|
3569
|
+
onClick: () => ue("list"),
|
|
3570
|
+
children: /* @__PURE__ */ B($, {
|
|
3572
3571
|
name: "list",
|
|
3573
3572
|
size: 15
|
|
3574
3573
|
})
|
|
3575
3574
|
})]
|
|
3576
3575
|
}),
|
|
3577
|
-
|
|
3576
|
+
Re && ze && /* @__PURE__ */ V("p", {
|
|
3578
3577
|
className: "seed-fm-hint",
|
|
3579
3578
|
children: [
|
|
3580
|
-
/* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ B($, {
|
|
3581
3580
|
name: "layers",
|
|
3582
3581
|
size: 13
|
|
3583
3582
|
}),
|
|
3584
|
-
|
|
3585
|
-
/* @__PURE__ */
|
|
3583
|
+
re ? "Resized copies are grouped with their original image." : "Resized copies are shown in their size folders.",
|
|
3584
|
+
/* @__PURE__ */ B("button", {
|
|
3586
3585
|
type: "button",
|
|
3587
3586
|
className: "seed-fm-linkbtn",
|
|
3588
3587
|
onClick: () => {
|
|
3589
|
-
|
|
3588
|
+
A(!re), P(/* @__PURE__ */ new Set());
|
|
3590
3589
|
},
|
|
3591
|
-
children:
|
|
3590
|
+
children: re ? "Show as folders" : "Group with originals"
|
|
3592
3591
|
})
|
|
3593
3592
|
]
|
|
3594
3593
|
})
|
|
3595
3594
|
]
|
|
3596
3595
|
}),
|
|
3597
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ B("div", {
|
|
3598
3597
|
className: w("body", "seed-fm-body"),
|
|
3599
|
-
children:
|
|
3598
|
+
children: He
|
|
3600
3599
|
}),
|
|
3601
|
-
|
|
3600
|
+
Ge && /* @__PURE__ */ V("div", {
|
|
3602
3601
|
className: w("batchBar", "seed-fm-batch"),
|
|
3603
3602
|
role: "toolbar",
|
|
3604
3603
|
"aria-label": "Selected files",
|
|
3605
3604
|
children: [
|
|
3606
|
-
/* @__PURE__ */
|
|
3605
|
+
/* @__PURE__ */ V("span", {
|
|
3607
3606
|
className: "seed-fm-batch-count",
|
|
3608
3607
|
"aria-live": "polite",
|
|
3609
3608
|
children: [
|
|
3610
|
-
|
|
3609
|
+
N.size,
|
|
3611
3610
|
" selected ",
|
|
3612
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ V("span", { children: ["· ", Q(Ve)] })
|
|
3613
3612
|
]
|
|
3614
3613
|
}),
|
|
3615
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ V("button", {
|
|
3616
3615
|
type: "button",
|
|
3617
3616
|
className: "seed-fm-btn",
|
|
3618
|
-
disabled:
|
|
3619
|
-
onClick: () =>
|
|
3617
|
+
disabled: me,
|
|
3618
|
+
onClick: () => ke(be),
|
|
3620
3619
|
children: [
|
|
3621
|
-
/* @__PURE__ */
|
|
3620
|
+
/* @__PURE__ */ B($, {
|
|
3622
3621
|
name: "download",
|
|
3623
3622
|
size: 15
|
|
3624
3623
|
}),
|
|
3625
3624
|
" ",
|
|
3626
|
-
|
|
3625
|
+
N.size > 1 ? "Download .zip" : "Download"
|
|
3627
3626
|
]
|
|
3628
3627
|
}),
|
|
3629
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ V("button", {
|
|
3630
3629
|
type: "button",
|
|
3631
|
-
className: `seed-fm-btn${
|
|
3632
|
-
disabled:
|
|
3633
|
-
onClick: () =>
|
|
3630
|
+
className: `seed-fm-btn${Ge.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
3631
|
+
disabled: me,
|
|
3632
|
+
onClick: () => Ne(be),
|
|
3634
3633
|
children: [
|
|
3635
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ B($, {
|
|
3636
3635
|
name: "trash",
|
|
3637
3636
|
size: 15
|
|
3638
3637
|
}),
|
|
3639
3638
|
" ",
|
|
3640
|
-
|
|
3639
|
+
Ge.label ?? "Delete"
|
|
3641
3640
|
]
|
|
3642
3641
|
}),
|
|
3643
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ B("button", {
|
|
3644
3643
|
type: "button",
|
|
3645
3644
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3646
3645
|
"aria-label": "Clear selection",
|
|
3647
|
-
onClick: () =>
|
|
3648
|
-
children: /* @__PURE__ */
|
|
3646
|
+
onClick: () => P(/* @__PURE__ */ new Set()),
|
|
3647
|
+
children: /* @__PURE__ */ B($, {
|
|
3649
3648
|
name: "x",
|
|
3650
3649
|
size: 15
|
|
3651
3650
|
})
|
|
@@ -3654,49 +3653,49 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3654
3653
|
})
|
|
3655
3654
|
]
|
|
3656
3655
|
}),
|
|
3657
|
-
|
|
3658
|
-
entry:
|
|
3656
|
+
q && /* @__PURE__ */ B(cr, {
|
|
3657
|
+
entry: q,
|
|
3659
3658
|
className: h.panel,
|
|
3660
|
-
onClose:
|
|
3661
|
-
onPrevious:
|
|
3662
|
-
onNext:
|
|
3663
|
-
onDownload: () =>
|
|
3664
|
-
onDelete: () =>
|
|
3665
|
-
deleteAction:
|
|
3666
|
-
onCopyPath: () =>
|
|
3659
|
+
onClose: we,
|
|
3660
|
+
onPrevious: J > 0 ? () => L(G[J - 1].file.path) : null,
|
|
3661
|
+
onNext: J >= 0 && J < G.length - 1 ? () => L(G[J + 1].file.path) : null,
|
|
3662
|
+
onDownload: () => ke([q]),
|
|
3663
|
+
onDelete: () => Ne([q]),
|
|
3664
|
+
deleteAction: je([q]),
|
|
3665
|
+
onCopyPath: () => Ie(q.file.path)
|
|
3667
3666
|
}, "panel"),
|
|
3668
|
-
|
|
3669
|
-
entries:
|
|
3667
|
+
R && /* @__PURE__ */ B(bn, {
|
|
3668
|
+
entries: R,
|
|
3670
3669
|
rootPath: S,
|
|
3671
|
-
warning: v(
|
|
3672
|
-
deleteActionFor: (e) =>
|
|
3670
|
+
warning: v(Ue),
|
|
3671
|
+
deleteActionFor: (e) => Ae(X(R, e)),
|
|
3673
3672
|
className: h.dialog,
|
|
3674
|
-
onCancel: () =>
|
|
3673
|
+
onCancel: () => fe(null),
|
|
3675
3674
|
onConfirm: (e) => {
|
|
3676
|
-
let t =
|
|
3677
|
-
|
|
3675
|
+
let t = X(R, e);
|
|
3676
|
+
fe(null), Me(t);
|
|
3678
3677
|
}
|
|
3679
3678
|
}),
|
|
3680
|
-
|
|
3681
|
-
folder:
|
|
3682
|
-
files:
|
|
3683
|
-
hiddenCount: T.filter((e) => e.path.startsWith(`${
|
|
3684
|
-
warning: v(
|
|
3685
|
-
action:
|
|
3686
|
-
busy:
|
|
3679
|
+
H && /* @__PURE__ */ B(xn, {
|
|
3680
|
+
folder: H,
|
|
3681
|
+
files: We,
|
|
3682
|
+
hiddenCount: T.filter((e) => e.path.startsWith(`${H.path}/`)).length - We.length,
|
|
3683
|
+
warning: v(We),
|
|
3684
|
+
action: Ae(We),
|
|
3685
|
+
busy: me,
|
|
3687
3686
|
className: h.dialog,
|
|
3688
|
-
onDownload: () =>
|
|
3689
|
-
onCancel: () =>
|
|
3687
|
+
onDownload: () => Oe(We, H),
|
|
3688
|
+
onCancel: () => pe(null),
|
|
3690
3689
|
onConfirm: () => {
|
|
3691
|
-
|
|
3690
|
+
pe(null), Me(We, H);
|
|
3692
3691
|
}
|
|
3693
3692
|
}),
|
|
3694
|
-
!x && /* @__PURE__ */
|
|
3693
|
+
!x && /* @__PURE__ */ B("ul", {
|
|
3695
3694
|
className: "seed-fm-toasts",
|
|
3696
3695
|
"aria-live": "polite",
|
|
3697
|
-
children:
|
|
3696
|
+
children: he.map((e) => /* @__PURE__ */ V("li", {
|
|
3698
3697
|
className: w("toast", `seed-fm-toast${e.tone === "error" ? " seed-fm-toast--error" : ""}`),
|
|
3699
|
-
children: [/* @__PURE__ */
|
|
3698
|
+
children: [/* @__PURE__ */ B($, {
|
|
3700
3699
|
name: e.tone === "error" ? "triangleAlert" : "check",
|
|
3701
3700
|
size: 15,
|
|
3702
3701
|
strokeWidth: 2.5
|
|
@@ -3716,7 +3715,7 @@ var Pr = (e) => {
|
|
|
3716
3715
|
}
|
|
3717
3716
|
};
|
|
3718
3717
|
function Fr(e) {
|
|
3719
|
-
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, d] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ = Pr(t), v = o(() =>
|
|
3718
|
+
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, d] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ = Pr(t), v = o(() => ie(_) ?? ie(r) ?? ie(m) ?? ie(g), [
|
|
3720
3719
|
_,
|
|
3721
3720
|
r,
|
|
3722
3721
|
m,
|
|
@@ -3729,7 +3728,7 @@ function Fr(e) {
|
|
|
3729
3728
|
if (!v) return [];
|
|
3730
3729
|
let e = [];
|
|
3731
3730
|
try {
|
|
3732
|
-
for (let t of
|
|
3731
|
+
for (let t of D()) {
|
|
3733
3732
|
let n = `${t.replace(/\/$/, "")}/raw/${v}`;
|
|
3734
3733
|
e.includes(n) || e.push(n);
|
|
3735
3734
|
}
|
|
@@ -3743,7 +3742,7 @@ function Fr(e) {
|
|
|
3743
3742
|
i(() => {
|
|
3744
3743
|
S(0);
|
|
3745
3744
|
}, [b]);
|
|
3746
|
-
let C = b[x],
|
|
3745
|
+
let C = b[x], w = n(() => {
|
|
3747
3746
|
S((e) => e < b.length ? e + 1 : e);
|
|
3748
3747
|
}, [b]);
|
|
3749
3748
|
return i(() => {
|
|
@@ -3754,7 +3753,7 @@ function Fr(e) {
|
|
|
3754
3753
|
else {
|
|
3755
3754
|
e || p("loading");
|
|
3756
3755
|
try {
|
|
3757
|
-
let t = await
|
|
3756
|
+
let t = await T({
|
|
3758
3757
|
transactionId: v,
|
|
3759
3758
|
fileName: y,
|
|
3760
3759
|
widths: a == null ? void 0 : [a]
|
|
@@ -3778,13 +3777,13 @@ function Fr(e) {
|
|
|
3778
3777
|
status: f,
|
|
3779
3778
|
gatewayHref: C,
|
|
3780
3779
|
gatewayHrefs: b,
|
|
3781
|
-
onGatewayError:
|
|
3780
|
+
onGatewayError: w,
|
|
3782
3781
|
result: l
|
|
3783
3782
|
};
|
|
3784
3783
|
}
|
|
3785
3784
|
//#endregion
|
|
3786
3785
|
//#region src/SeedImage.tsx
|
|
3787
|
-
var Ir =
|
|
3786
|
+
var Ir = R("seedSdk:react:SeedImage"), Lr = /* @__PURE__ */ new Map(), Rr = (e) => {
|
|
3788
3787
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
3789
3788
|
return t && t[2] ? t[2] : e;
|
|
3790
3789
|
};
|
|
@@ -3796,7 +3795,7 @@ function Br(e, t) {
|
|
|
3796
3795
|
return n.test(r);
|
|
3797
3796
|
}
|
|
3798
3797
|
var Vr = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o }) => {
|
|
3799
|
-
let [s, l] = c(), [u, d] = c(), { property: p } =
|
|
3798
|
+
let [s, l] = c(), [u, d] = c(), { property: p } = Ve({
|
|
3800
3799
|
propertyName: t.propertyName,
|
|
3801
3800
|
seedLocalId: t.seedLocalId,
|
|
3802
3801
|
seedUid: t.seedUid
|
|
@@ -3866,17 +3865,17 @@ var Vr = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o
|
|
|
3866
3865
|
h,
|
|
3867
3866
|
g
|
|
3868
3867
|
]);
|
|
3869
|
-
let T = (e) => typeof e == "string" && e.startsWith("blob:"),
|
|
3870
|
-
if (!
|
|
3871
|
-
let
|
|
3872
|
-
_ &&
|
|
3868
|
+
let T = (e) => typeof e == "string" && e.startsWith("blob:"), E = !!s || !!u || !!S || !!b && T(b);
|
|
3869
|
+
if (!E && !h && !_) return null;
|
|
3870
|
+
let ee = s || u || S || (T(b) ? b : void 0) || (a && !E ? _ : void 0) || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", { onError: D, ...O } = o, te = (e) => {
|
|
3871
|
+
_ && ee === _ && v(), D?.(e);
|
|
3873
3872
|
};
|
|
3874
|
-
return /* @__PURE__ */
|
|
3875
|
-
src:
|
|
3873
|
+
return /* @__PURE__ */ B("img", {
|
|
3874
|
+
src: ee,
|
|
3876
3875
|
alt: o.alt || t.propertyName || "Image",
|
|
3877
3876
|
width: n,
|
|
3878
|
-
...
|
|
3879
|
-
onError:
|
|
3877
|
+
...O,
|
|
3878
|
+
onError: te
|
|
3880
3879
|
});
|
|
3881
3880
|
});
|
|
3882
3881
|
//#endregion
|
|
@@ -3890,7 +3889,7 @@ function Hr(e) {
|
|
|
3890
3889
|
else {
|
|
3891
3890
|
e || (m("loading"), f(null));
|
|
3892
3891
|
try {
|
|
3893
|
-
let r = await
|
|
3892
|
+
let r = await N(String(t), { treatAs: a }), i = r.status === "ready" && r.source === "localBlob" ? r.href : void 0;
|
|
3894
3893
|
if (e) {
|
|
3895
3894
|
i && URL.revokeObjectURL(i);
|
|
3896
3895
|
return;
|
|
@@ -3936,7 +3935,7 @@ function Ur({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
3936
3935
|
src: o,
|
|
3937
3936
|
alt: i ?? ""
|
|
3938
3937
|
};
|
|
3939
|
-
return r ? /* @__PURE__ */
|
|
3938
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("img", { ...s });
|
|
3940
3939
|
}
|
|
3941
3940
|
//#endregion
|
|
3942
3941
|
//#region src/SeedMediaFile.tsx
|
|
@@ -3970,7 +3969,7 @@ function Kr({ value: e, enabled: t, treatAs: n, download: r, render: i, children
|
|
|
3970
3969
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
3971
3970
|
children: a ?? Wr(l)
|
|
3972
3971
|
};
|
|
3973
|
-
return i ? /* @__PURE__ */
|
|
3972
|
+
return i ? /* @__PURE__ */ B(z, { children: i(f) }) : /* @__PURE__ */ B("a", { ...f });
|
|
3974
3973
|
}
|
|
3975
3974
|
//#endregion
|
|
3976
3975
|
//#region src/SeedMediaAudio.tsx
|
|
@@ -3986,7 +3985,7 @@ function qr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
3986
3985
|
src: o,
|
|
3987
3986
|
controls: i
|
|
3988
3987
|
};
|
|
3989
|
-
return r ? /* @__PURE__ */
|
|
3988
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("audio", { ...s });
|
|
3990
3989
|
}
|
|
3991
3990
|
//#endregion
|
|
3992
3991
|
//#region src/SeedMediaVideo.tsx
|
|
@@ -4002,7 +4001,7 @@ function Jr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4002
4001
|
src: o,
|
|
4003
4002
|
controls: i
|
|
4004
4003
|
};
|
|
4005
|
-
return r ? /* @__PURE__ */
|
|
4004
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("video", { ...s });
|
|
4006
4005
|
}
|
|
4007
4006
|
//#endregion
|
|
4008
4007
|
//#region src/SeedHtml.tsx
|
|
@@ -4012,7 +4011,7 @@ function Yr(e) {
|
|
|
4012
4011
|
function Xr({ html: e, sanitize: t, render: n, ...r }) {
|
|
4013
4012
|
if (!Yr(e)) return null;
|
|
4014
4013
|
let i = t(e);
|
|
4015
|
-
return n ? /* @__PURE__ */
|
|
4014
|
+
return n ? /* @__PURE__ */ B(z, { children: n({ html: i }) }) : /* @__PURE__ */ B("div", {
|
|
4016
4015
|
...r,
|
|
4017
4016
|
dangerouslySetInnerHTML: { __html: i }
|
|
4018
4017
|
});
|
|
@@ -4069,7 +4068,7 @@ function ei(e, t) {
|
|
|
4069
4068
|
//#region src/SeedJson.tsx
|
|
4070
4069
|
function ti({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4071
4070
|
let a = t ? t(e) : ei(e, n);
|
|
4072
|
-
return r ? /* @__PURE__ */
|
|
4071
|
+
return r ? /* @__PURE__ */ B(z, { children: r({ text: a }) }) : /* @__PURE__ */ B("pre", {
|
|
4073
4072
|
...i,
|
|
4074
4073
|
children: a
|
|
4075
4074
|
});
|
|
@@ -4077,9 +4076,9 @@ function ti({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
|
4077
4076
|
//#endregion
|
|
4078
4077
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4079
4078
|
function ni(e, t) {
|
|
4080
|
-
return o(() => e ?
|
|
4079
|
+
return o(() => e ? ae(e, t) : {}, [e, t]);
|
|
4081
4080
|
}
|
|
4082
4081
|
//#endregion
|
|
4083
|
-
export {
|
|
4082
|
+
export { J as ADDRESSES_PERSISTED_EVENT, Ft as FILES_QUERY_KEY_PREFIX, xe as LOCAL_COPIES_REMOVED_EVENT, Nr as OPFSFilesManager, pr as OPFS_FILES_MANAGER_CSS, qt as SeedClientGate, Xr as SeedHtml, Vr as SeedImage, ti as SeedJson, qr as SeedMediaAudio, Kr as SeedMediaFile, Ur as SeedMediaImage, Jr as SeedMediaVideo, Gt as SeedProvider, X as createSeedQueryClient, ei as formatSeedJson, Be as getItemPropertyQueryKey, Ne as getItemQueryKey, Oe as getSeedQueryDefaultOptions, Qe as getServiceName, et as getServiceUniqueKey, $e as getServiceValue, Ut as invalidateItemPropertiesForItem, Je as isDbReadyState, ke as mergeSeedQueryDefaults, ht as useAllSchemaVersions, Le as useCreateItem, Ge as useCreateItemProperty, xt as useCreateModel, At as useCreateModelProperty, pt as useCreateSchema, Ye as useDbsAreReady, He as useDebouncedItemProperty, Mt as useDeleteItem, Ke as useDestroyItemProperty, St as useDestroyModel, jt as useDestroyModelProperty, mt as useDestroySchema, Vt as useEasSyncProcessById, zt as useEasSyncProcesses, Bt as useEasSyncProcessesNonActiveCount, Rt as useEasSyncProcessesState, Fr as useEnsureLocalImage, It as useFiles, st as useGlobalServiceStatus, it as useHasSavedSnapshots, Pt as useImageFiles, q as useIsClientReady, nt as useIsDbReady, Pe as useItem, We as useItemProperties, Ve as useItemProperty, Ie as useItems, Y as useLiveQuery, Ee as useLiveQueryState, bt as useModel, wt as useModelProperties, kt as useModelProperty, yt as useModels, ni as useNormalizedFeedItemFields, ln as useOPFSFiles, rt as usePersistedSnapshots, Re as usePublishItem, Hr as useResolvedMediaRef, lt as useSchema, ft as useSchemas, Ce as useSeedAddressRevision, gt as useSeedProtocolSchema, tt as useService, ot as useServices, hr as useStorageEstimate, Qn as useThumbnail };
|
|
4084
4083
|
|
|
4085
4084
|
//# sourceMappingURL=index.js.map
|