@seedprotocol/react 0.7.3 → 0.7.4-next.784.g879c6a3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SeedImage.d.ts +3 -2
- package/dist/SeedImage.d.ts.map +1 -1
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/db.d.ts +5 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/formatSeedJson.d.ts.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1061 -1053
- package/dist/index.js.map +1 -1
- package/dist/item.d.ts.map +1 -1
- package/dist/itemProperty.d.ts +6 -0
- package/dist/itemProperty.d.ts.map +1 -1
- package/dist/liveQuery.d.ts +9 -0
- package/dist/liveQuery.d.ts.map +1 -1
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/modelProperty.d.ts +0 -13
- package/dist/modelProperty.d.ts.map +1 -1
- package/dist/schema.d.ts +4 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/services.d.ts +8 -0
- package/dist/services.d.ts.map +1 -1
- package/dist/trash.d.ts.map +1 -1
- package/dist/useEasSyncProcesses.d.ts.map +1 -1
- package/dist/useEnsureLocalImage.d.ts +2 -2
- package/dist/useEnsureLocalImage.d.ts.map +1 -1
- package/dist/useResolvedMediaRef.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
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,
|
|
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 { toSnakeCase as
|
|
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, easSyncProcesses as C, ensureImageLocal as w, eventEmitter as T, getAddressesForItemsFilter as ee, getArweaveReadBaseUrls as E, getClient as D, getPropertySchema as te, getSchemaNameFromId as ne, getVersionData as re, loadAllSchemasFromDb as ie, metadata as O, modelSchemas as ae, models as k, normalizeArweaveTxIdForEnsure as A, normalizeFeedItemFields as oe, ownedSeedsSql as j, pickLatestMetadataRowPerProperty as se, placeholderUidSql as ce, properties as le, publisherInAddressListSql as ue, resolveMediaRef as de, schemas as M, seeds as N } from "@seedprotocol/sdk";
|
|
4
|
+
import { debounce as fe, orderBy as pe, startCase as P } from "lodash-es";
|
|
5
|
+
import F from "debug";
|
|
6
|
+
import { useSelector as I } from "@xstate/react";
|
|
7
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
8
|
+
import { QueryClient as me, QueryClientContext as B, QueryClientProvider as he, useQuery as V, useQueryClient as H } from "@tanstack/react-query";
|
|
9
|
+
import { and as ge, desc as _e, eq as U, gt as ve, isNotNull as W, isNull as ye, or as G } from "drizzle-orm";
|
|
10
|
+
import { toSnakeCase as be } from "drizzle-orm/casing";
|
|
11
11
|
import xe from "pluralize";
|
|
12
12
|
//#region src/client.ts
|
|
13
|
-
var
|
|
14
|
-
let e =
|
|
15
|
-
return
|
|
16
|
-
},
|
|
17
|
-
function
|
|
18
|
-
return r(
|
|
19
|
-
}
|
|
20
|
-
function
|
|
13
|
+
var K = () => {
|
|
14
|
+
let e = D().getService();
|
|
15
|
+
return I(e, (e) => e.value === p.IDLE);
|
|
16
|
+
}, q = "addresses.persisted", Se = "localCopies.removed", Ce = t(0);
|
|
17
|
+
function we() {
|
|
18
|
+
return r(Ce);
|
|
19
|
+
}
|
|
20
|
+
function Te({ queryClient: e, children: t }) {
|
|
21
21
|
let [r, a] = c(0), o = n(() => {
|
|
22
22
|
e.invalidateQueries({
|
|
23
23
|
queryKey: ["seed", "items"],
|
|
@@ -30,51 +30,76 @@ function Ee({ queryClient: e, children: t }) {
|
|
|
30
30
|
exact: !1
|
|
31
31
|
}), a((e) => e + 1);
|
|
32
32
|
}, [e]);
|
|
33
|
-
return i(() => (
|
|
34
|
-
|
|
35
|
-
}), [o]), /* @__PURE__ */
|
|
33
|
+
return i(() => (T.on(q, o), T.on(Se, o), () => {
|
|
34
|
+
T.off(q, o), T.off(Se, o);
|
|
35
|
+
}), [o]), /* @__PURE__ */ R(Ce.Provider, {
|
|
36
36
|
value: r,
|
|
37
37
|
children: t
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/liveQuery.ts
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
function J(e) {
|
|
43
|
+
return De(e).data;
|
|
44
|
+
}
|
|
45
|
+
function Ee(e) {
|
|
46
|
+
if (e && typeof e == "object" && typeof e.toSQL == "function") try {
|
|
47
|
+
let { sql: t, params: n } = e.toSQL();
|
|
48
|
+
return `sql:${t}|${JSON.stringify(n)}`;
|
|
49
|
+
} catch {
|
|
50
|
+
return e;
|
|
51
|
+
}
|
|
52
|
+
return e;
|
|
53
|
+
}
|
|
54
|
+
function De(e) {
|
|
55
|
+
let [t, n] = c({
|
|
56
|
+
data: void 0,
|
|
57
|
+
error: null
|
|
58
|
+
}), r = K(), a = Ee(e), l = s(e);
|
|
59
|
+
l.current = e;
|
|
60
|
+
let u = o(() => {
|
|
61
|
+
let e = l.current;
|
|
62
|
+
if (!r || !e) return null;
|
|
45
63
|
try {
|
|
46
64
|
return d.liveQuery(e);
|
|
47
65
|
} catch (e) {
|
|
48
66
|
return console.error("[useLiveQuery] Failed to create live query:", e), null;
|
|
49
67
|
}
|
|
50
|
-
}, [
|
|
68
|
+
}, [a, r]);
|
|
51
69
|
return i(() => {
|
|
52
|
-
if (
|
|
53
|
-
|
|
70
|
+
if (n((e) => e.data === void 0 && e.error === null ? e : {
|
|
71
|
+
data: void 0,
|
|
72
|
+
error: null
|
|
73
|
+
}), !u) return;
|
|
74
|
+
let e = u.subscribe({
|
|
54
75
|
next: (e) => {
|
|
55
|
-
n(
|
|
76
|
+
n({
|
|
77
|
+
data: e === void 0 ? void 0 : [...e],
|
|
78
|
+
error: null
|
|
79
|
+
});
|
|
56
80
|
},
|
|
57
81
|
error: (e) => {
|
|
58
|
-
console.error("[useLiveQuery] Error:", e)
|
|
82
|
+
console.error("[useLiveQuery] Error:", e), n((t) => ({
|
|
83
|
+
data: t.data,
|
|
84
|
+
error: e instanceof Error ? e : Error(String(e))
|
|
85
|
+
}));
|
|
59
86
|
}
|
|
60
87
|
});
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
}, [l]), t;
|
|
88
|
+
return () => e.unsubscribe();
|
|
89
|
+
}, [u]), t;
|
|
65
90
|
}
|
|
66
91
|
//#endregion
|
|
67
92
|
//#region src/queryClient.ts
|
|
68
|
-
var
|
|
93
|
+
var Oe = { queries: {
|
|
69
94
|
networkMode: "offlineFirst",
|
|
70
95
|
gcTime: 864e5,
|
|
71
96
|
staleTime: 6e4
|
|
72
97
|
} };
|
|
73
|
-
function
|
|
74
|
-
return { ...
|
|
98
|
+
function ke() {
|
|
99
|
+
return { ...Oe };
|
|
75
100
|
}
|
|
76
|
-
function
|
|
77
|
-
let t =
|
|
101
|
+
function Ae(e) {
|
|
102
|
+
let t = ke();
|
|
78
103
|
return e ? {
|
|
79
104
|
queries: {
|
|
80
105
|
...t.queries,
|
|
@@ -86,27 +111,27 @@ function ke(e) {
|
|
|
86
111
|
}
|
|
87
112
|
} : t;
|
|
88
113
|
}
|
|
89
|
-
function
|
|
90
|
-
let t =
|
|
91
|
-
return new
|
|
114
|
+
function Y(e) {
|
|
115
|
+
let t = ke(), { defaultOptions: n, ...r } = e ?? {};
|
|
116
|
+
return new me({
|
|
92
117
|
...r,
|
|
93
|
-
defaultOptions: n ?
|
|
118
|
+
defaultOptions: n ? Ae(n) : t
|
|
94
119
|
});
|
|
95
120
|
}
|
|
96
|
-
var
|
|
97
|
-
function
|
|
98
|
-
return r(
|
|
121
|
+
var je;
|
|
122
|
+
function Me() {
|
|
123
|
+
return r(B) || (je ?? (je = Y()), je);
|
|
99
124
|
}
|
|
100
125
|
//#endregion
|
|
101
126
|
//#region src/item.ts
|
|
102
|
-
var
|
|
127
|
+
var Ne = F("seedSdk:react:item"), Pe = (e) => [
|
|
103
128
|
"seed",
|
|
104
129
|
"item",
|
|
105
130
|
e ?? null
|
|
106
|
-
],
|
|
107
|
-
let r = t || n, [, a] = c(0), [, l] = c(0), [u, d] = c(!1), [f, p] = c(null), h = s(!1), _ =
|
|
131
|
+
], Fe = ({ modelName: e, seedLocalId: t, seedUid: n }) => {
|
|
132
|
+
let r = t || n, [, a] = c(0), [, l] = c(0), [u, d] = c(!1), [f, p] = c(null), h = s(!1), _ = K(), v = Me(), y = o(() => Pe(r), [r]), b = s(y);
|
|
108
133
|
b.current = y;
|
|
109
|
-
let x =
|
|
134
|
+
let x = V({
|
|
110
135
|
queryKey: y,
|
|
111
136
|
queryFn: async () => {
|
|
112
137
|
let i = g.peekReady(r) ?? await g.find({
|
|
@@ -115,7 +140,7 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
115
140
|
seedUid: n
|
|
116
141
|
});
|
|
117
142
|
if (i) return i;
|
|
118
|
-
|
|
143
|
+
Ne("[useItem] no item found", e, r);
|
|
119
144
|
let a = v.getQueryData(y);
|
|
120
145
|
return a && a.getService().getSnapshot().status === "active" ? a : null;
|
|
121
146
|
},
|
|
@@ -130,8 +155,8 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
130
155
|
let e = () => {
|
|
131
156
|
a((e) => e + 1), v.invalidateQueries({ queryKey: b.current });
|
|
132
157
|
};
|
|
133
|
-
return
|
|
134
|
-
|
|
158
|
+
return T.on(m, e), () => {
|
|
159
|
+
T.off(m, e);
|
|
135
160
|
};
|
|
136
161
|
}, [v]), i(() => {
|
|
137
162
|
if (h.current = !1, d(!1), p(null), !S) return;
|
|
@@ -166,7 +191,7 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
166
191
|
isLoading: !!r && x.isPending || u,
|
|
167
192
|
error: f ?? x.error
|
|
168
193
|
};
|
|
169
|
-
},
|
|
194
|
+
}, Ie = (e, t, n, r, i, a, o) => [
|
|
170
195
|
"seed",
|
|
171
196
|
"items",
|
|
172
197
|
e ?? null,
|
|
@@ -178,14 +203,14 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
178
203
|
modelFileId: a ?? null,
|
|
179
204
|
schemaName: o ?? null
|
|
180
205
|
}] : []
|
|
181
|
-
],
|
|
182
|
-
let u =
|
|
206
|
+
], Le = ({ modelName: e, modelFileId: t, schemaName: n, deleted: r = !1, includeEas: a = !1, addressFilter: l }) => {
|
|
207
|
+
let u = K(), f = we(), p = H();
|
|
183
208
|
i(() => {
|
|
184
209
|
let e = () => {
|
|
185
210
|
p.invalidateQueries({ queryKey: ["seed", "items"] });
|
|
186
211
|
};
|
|
187
|
-
return
|
|
188
|
-
|
|
212
|
+
return T.on(m, e), () => {
|
|
213
|
+
T.off(m, e);
|
|
189
214
|
};
|
|
190
215
|
}, [p]);
|
|
191
216
|
let h = s([]), _ = s(/* @__PURE__ */ new Set()), v = s(!1), [y, b] = c(null);
|
|
@@ -201,7 +226,7 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
201
226
|
e = !0;
|
|
202
227
|
};
|
|
203
228
|
}, [l, f]);
|
|
204
|
-
let x = o(() =>
|
|
229
|
+
let x = o(() => Ie(e, r, a, l, f, t, n), [
|
|
205
230
|
e,
|
|
206
231
|
r,
|
|
207
232
|
a,
|
|
@@ -213,7 +238,7 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
213
238
|
i(() => {
|
|
214
239
|
v.current = !1;
|
|
215
240
|
}, [x]);
|
|
216
|
-
let { data: S = [], isLoading: C, error: w } =
|
|
241
|
+
let { data: S = [], isLoading: C, error: w } = V({
|
|
217
242
|
queryKey: x,
|
|
218
243
|
queryFn: async () => await g.all(e, r, {
|
|
219
244
|
waitForReady: !0,
|
|
@@ -226,22 +251,22 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
226
251
|
staleTime: 0
|
|
227
252
|
});
|
|
228
253
|
h.current = S;
|
|
229
|
-
let
|
|
230
|
-
if (!
|
|
254
|
+
let E = u ? d.getAppDb() : null, D = J(o(() => {
|
|
255
|
+
if (!E || (l === "owned" || l === "watched") && y === null) return null;
|
|
231
256
|
let t = [];
|
|
232
|
-
a || t.push(
|
|
257
|
+
a || t.push(ce(N.uid)), e && t.push(U(N.type, be(e))), l === "owned" ? t.push(j(y ?? [])) : l === "watched" && t.push(ue(N.publisher, y ?? [])), r ? t.push(G(W(N._markedForDeletion), U(N._markedForDeletion, 1))) : (t.push(G(ye(N._markedForDeletion), U(N._markedForDeletion, 0))), t.push(G(ye(N.revokedAt), U(N.revokedAt, 0))));
|
|
233
258
|
let n = re();
|
|
234
|
-
return
|
|
235
|
-
localId:
|
|
236
|
-
uid:
|
|
237
|
-
type:
|
|
238
|
-
schemaUid:
|
|
239
|
-
createdAt:
|
|
240
|
-
attestationCreatedAt:
|
|
241
|
-
_markedForDeletion:
|
|
242
|
-
}).from(
|
|
259
|
+
return E.with(n).select({
|
|
260
|
+
localId: N.localId,
|
|
261
|
+
uid: N.uid,
|
|
262
|
+
type: N.type,
|
|
263
|
+
schemaUid: N.schemaUid,
|
|
264
|
+
createdAt: N.createdAt,
|
|
265
|
+
attestationCreatedAt: N.attestationCreatedAt,
|
|
266
|
+
_markedForDeletion: N._markedForDeletion
|
|
267
|
+
}).from(N).leftJoin(n, U(N.localId, n.seedLocalId)).where(ge(ve(n.versionsCount, 0), ...t)).groupBy(N.localId);
|
|
243
268
|
}, [
|
|
244
|
-
|
|
269
|
+
E,
|
|
245
270
|
u,
|
|
246
271
|
e,
|
|
247
272
|
r,
|
|
@@ -274,36 +299,36 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
274
299
|
p,
|
|
275
300
|
x
|
|
276
301
|
]), {
|
|
277
|
-
items:
|
|
278
|
-
isLoading: C,
|
|
302
|
+
items: o(() => pe(S, [(e) => e.lastVersionPublishedAt || e.attestationCreatedAt || e.createdAt], ["desc"]), [S]),
|
|
303
|
+
isLoading: C || !u,
|
|
279
304
|
error: w
|
|
280
305
|
};
|
|
281
|
-
},
|
|
282
|
-
let [e, t] = c(!1), [r, i] = c(null), a = n(() => i(null), []);
|
|
306
|
+
}, Re = () => {
|
|
307
|
+
let [e, t] = c(!1), [r, i] = c(null), a = s(!1), o = n(() => i(null), []);
|
|
283
308
|
return {
|
|
284
|
-
createItem: n(async (
|
|
285
|
-
if (
|
|
309
|
+
createItem: n(async (e, n) => {
|
|
310
|
+
if (a.current) Ne("[useCreateItem] [createItem] already creating item, skipping");
|
|
286
311
|
else {
|
|
287
|
-
i(null), l(() => t(!0));
|
|
312
|
+
a.current = !0, i(null), l(() => t(!0));
|
|
288
313
|
try {
|
|
289
|
-
let
|
|
314
|
+
let t = n ?? {};
|
|
290
315
|
return await g.create({
|
|
291
|
-
modelName:
|
|
292
|
-
...
|
|
316
|
+
modelName: e,
|
|
317
|
+
...t
|
|
293
318
|
}) ?? void 0;
|
|
294
319
|
} catch (e) {
|
|
295
|
-
|
|
320
|
+
Ne("[useCreateItem] Error creating item:", e), i(e instanceof Error ? e : Error(String(e)));
|
|
296
321
|
return;
|
|
297
322
|
} finally {
|
|
298
|
-
queueMicrotask(() => t(!1));
|
|
323
|
+
a.current = !1, queueMicrotask(() => t(!1));
|
|
299
324
|
}
|
|
300
325
|
}
|
|
301
|
-
}, [
|
|
326
|
+
}, []),
|
|
302
327
|
isLoading: e,
|
|
303
328
|
error: r,
|
|
304
|
-
resetError:
|
|
329
|
+
resetError: o
|
|
305
330
|
};
|
|
306
|
-
},
|
|
331
|
+
}, ze = () => {
|
|
307
332
|
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) => {
|
|
308
333
|
e && (t(e), l(null), e.publish(n).catch((e) => {
|
|
309
334
|
l(e instanceof Error ? e : Error(String(e)));
|
|
@@ -327,28 +352,29 @@ var Me = L("seedSdk:react:item"), Ne = (e) => [
|
|
|
327
352
|
error: o,
|
|
328
353
|
resetError: d
|
|
329
354
|
};
|
|
330
|
-
},
|
|
355
|
+
}, Be = F("seedSdk:react:property"), X = F("seedSdk:react:itemProperties"), Ve = (e, t, n) => [
|
|
331
356
|
"seed",
|
|
332
357
|
"itemProperty",
|
|
333
358
|
e ?? null,
|
|
334
359
|
t ?? null,
|
|
335
360
|
n
|
|
336
361
|
];
|
|
337
|
-
function
|
|
338
|
-
let n =
|
|
362
|
+
function He(e, t) {
|
|
363
|
+
let n = K(), r = Me(), [, 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(() => {
|
|
339
364
|
let e = p !== void 0 && p !== "" ? p : u, t = p !== void 0 && p !== "" ? void 0 : d;
|
|
340
365
|
return (e || t) && m ? {
|
|
341
366
|
type: "identifiers",
|
|
342
367
|
seedLocalId: e || void 0,
|
|
343
368
|
seedUid: t || void 0,
|
|
344
|
-
propertyName: m
|
|
369
|
+
propertyName: m,
|
|
370
|
+
itemId: p !== void 0 && p !== "" ? p : void 0
|
|
345
371
|
} : null;
|
|
346
372
|
}, [
|
|
347
373
|
p,
|
|
348
374
|
m,
|
|
349
375
|
u,
|
|
350
376
|
d
|
|
351
|
-
]), g = o(() =>
|
|
377
|
+
]), g = o(() => Ve(h?.seedLocalId, h?.seedUid, h?.propertyName ?? ""), [h]), v = V({
|
|
352
378
|
queryKey: g,
|
|
353
379
|
queryFn: async () => {
|
|
354
380
|
if (!h) return null;
|
|
@@ -356,8 +382,11 @@ function Ve(e, t) {
|
|
|
356
382
|
propertyName: h.propertyName,
|
|
357
383
|
seedLocalId: h.seedLocalId,
|
|
358
384
|
seedUid: h.seedUid
|
|
359
|
-
})
|
|
360
|
-
|
|
385
|
+
}), t = !e && h.itemId ? await _.find({
|
|
386
|
+
propertyName: h.propertyName,
|
|
387
|
+
seedUid: h.itemId
|
|
388
|
+
}) : void 0, n = e ?? t;
|
|
389
|
+
return n || Be(`[useItemProperty] no property found for Item.${h.seedLocalId || h.seedUid}.${h.propertyName}`), n ?? null;
|
|
361
390
|
},
|
|
362
391
|
initialData: () => h ? _.peekReady(h) : void 0,
|
|
363
392
|
staleTime: 0,
|
|
@@ -385,9 +414,9 @@ function Ve(e, t) {
|
|
|
385
414
|
error: v.error
|
|
386
415
|
};
|
|
387
416
|
}
|
|
388
|
-
function
|
|
389
|
-
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 } =
|
|
390
|
-
|
|
417
|
+
function Ue(e, t = 300) {
|
|
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 } = He(o(() => r ? {
|
|
419
|
+
itemId: r,
|
|
391
420
|
propertyName: l
|
|
392
421
|
} : {
|
|
393
422
|
seedLocalId: a,
|
|
@@ -398,13 +427,15 @@ function He(e, t = 300) {
|
|
|
398
427
|
a,
|
|
399
428
|
c,
|
|
400
429
|
l
|
|
401
|
-
])), p = s(""), m = o(() =>
|
|
430
|
+
])), p = s(""), m = o(() => fe((e) => {
|
|
402
431
|
e.getService().send({
|
|
403
432
|
type: "save",
|
|
404
433
|
newValue: p.current
|
|
405
434
|
});
|
|
406
435
|
}, t), [t]);
|
|
407
|
-
|
|
436
|
+
i(() => () => m.flush(), [m]);
|
|
437
|
+
let h = n(() => m.flush(), [m]);
|
|
438
|
+
return {
|
|
408
439
|
property: u,
|
|
409
440
|
setValue: n((e) => {
|
|
410
441
|
u && (p.current = e, u.getService().send({
|
|
@@ -413,11 +444,12 @@ function He(e, t = 300) {
|
|
|
413
444
|
renderValue: e
|
|
414
445
|
}), m(u));
|
|
415
446
|
}, [u, m]),
|
|
447
|
+
flush: h,
|
|
416
448
|
isLoading: d,
|
|
417
449
|
error: f
|
|
418
450
|
};
|
|
419
451
|
}
|
|
420
|
-
async function
|
|
452
|
+
async function We(e, t) {
|
|
421
453
|
if (!e && !t) return [];
|
|
422
454
|
let n = d.getAppDb();
|
|
423
455
|
if (!n) return [];
|
|
@@ -429,19 +461,19 @@ async function Ue(e, t) {
|
|
|
429
461
|
let o;
|
|
430
462
|
if (r.length > 0) {
|
|
431
463
|
let e = r[0];
|
|
432
|
-
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o =
|
|
464
|
+
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o = P(o));
|
|
433
465
|
}
|
|
434
466
|
let s = await n.select({
|
|
435
|
-
type:
|
|
436
|
-
modelFileId:
|
|
437
|
-
}).from(
|
|
438
|
-
!o && s.length > 0 && s[0].type && (o =
|
|
467
|
+
type: N.type,
|
|
468
|
+
modelFileId: N.modelFileId
|
|
469
|
+
}).from(N).where(t ? U(N.uid, t) : U(N.localId, e)).limit(1), c = s[0]?.modelFileId ?? void 0;
|
|
470
|
+
!o && s.length > 0 && s[0].type && (o = P(s[0].type));
|
|
439
471
|
let l = [];
|
|
440
472
|
if (o) try {
|
|
441
473
|
let { Model: e } = await import("@seedprotocol/sdk"), t = await e.resolveAsync(o, { modelFileId: c });
|
|
442
474
|
if (t?.properties) for (let e of t.properties) e.name && l.push(e.name);
|
|
443
475
|
} catch (e) {
|
|
444
|
-
|
|
476
|
+
X(`[useItemProperties] Error getting ModelProperties for ${o}:`, e);
|
|
445
477
|
}
|
|
446
478
|
if (o && l.length > 0) {
|
|
447
479
|
let n = r.length > 0 ? r[0].seedLocalId ?? e : e, s = r.length > 0 ? r[0].seedUid ?? t : t;
|
|
@@ -455,11 +487,11 @@ async function Ue(e, t) {
|
|
|
455
487
|
}, { waitForReady: !1 });
|
|
456
488
|
t && i.push(t);
|
|
457
489
|
} catch (t) {
|
|
458
|
-
|
|
490
|
+
Be(`[useItemProperties] Error creating ItemProperty for missing property ${e}:`, t);
|
|
459
491
|
}
|
|
460
492
|
}
|
|
461
493
|
if (e || t) {
|
|
462
|
-
let a = await n.select({ createdAt:
|
|
494
|
+
let a = await n.select({ createdAt: N.createdAt }).from(N).where(t ? U(N.uid, t) : U(N.localId, e)).limit(1);
|
|
463
495
|
if (a.length > 0 && a[0].createdAt) {
|
|
464
496
|
let n = "createdAt";
|
|
465
497
|
if (!i.some((e) => e.propertyName === n) && o) try {
|
|
@@ -472,14 +504,14 @@ async function Ue(e, t) {
|
|
|
472
504
|
}, { waitForReady: !1 });
|
|
473
505
|
l && i.push(l);
|
|
474
506
|
} catch (e) {
|
|
475
|
-
|
|
507
|
+
Be("[useItemProperties] Error creating createdAt ItemProperty:", e);
|
|
476
508
|
}
|
|
477
509
|
}
|
|
478
510
|
}
|
|
479
511
|
return i;
|
|
480
512
|
}
|
|
481
|
-
function
|
|
482
|
-
let t =
|
|
513
|
+
function Ge(e) {
|
|
514
|
+
let t = K(), n = H(), r = s(void 0), a = o(() => typeof e == "string" ? {
|
|
483
515
|
type: "itemId",
|
|
484
516
|
itemId: e
|
|
485
517
|
} : typeof e == "object" ? {
|
|
@@ -494,44 +526,44 @@ function We(e) {
|
|
|
494
526
|
"seed",
|
|
495
527
|
"itemProperties",
|
|
496
528
|
u
|
|
497
|
-
], [u]), { data: p = [], isLoading: m, error: h } =
|
|
529
|
+
], [u]), { data: p = [], isLoading: m, error: h } = V({
|
|
498
530
|
queryKey: f,
|
|
499
|
-
queryFn: () =>
|
|
531
|
+
queryFn: () => We(c, l),
|
|
500
532
|
enabled: t && !!u
|
|
501
|
-
}), g =
|
|
502
|
-
if (!t || !c && !l) return
|
|
533
|
+
}), g = J(o(() => {
|
|
534
|
+
if (!t || !c && !l) return X("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
503
535
|
let e = d.getAppDb();
|
|
504
|
-
if (!e) return
|
|
505
|
-
|
|
536
|
+
if (!e) return X("[useItemProperties] Query: returning null (no db)"), null;
|
|
537
|
+
X(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${l}`);
|
|
506
538
|
let n = l ? e.select({
|
|
507
|
-
propertyName:
|
|
508
|
-
propertyValue:
|
|
509
|
-
seedLocalId:
|
|
510
|
-
seedUid:
|
|
511
|
-
modelType:
|
|
512
|
-
schemaUid:
|
|
513
|
-
createdAt:
|
|
514
|
-
attestationCreatedAt:
|
|
515
|
-
localId:
|
|
516
|
-
revokedAt:
|
|
517
|
-
}).from(
|
|
518
|
-
propertyName:
|
|
519
|
-
propertyValue:
|
|
520
|
-
seedLocalId:
|
|
521
|
-
seedUid:
|
|
522
|
-
modelType:
|
|
523
|
-
schemaUid:
|
|
524
|
-
createdAt:
|
|
525
|
-
attestationCreatedAt:
|
|
526
|
-
localId:
|
|
527
|
-
revokedAt:
|
|
528
|
-
}).from(
|
|
529
|
-
return
|
|
539
|
+
propertyName: O.propertyName,
|
|
540
|
+
propertyValue: O.propertyValue,
|
|
541
|
+
seedLocalId: O.seedLocalId,
|
|
542
|
+
seedUid: O.seedUid,
|
|
543
|
+
modelType: O.modelType,
|
|
544
|
+
schemaUid: O.schemaUid,
|
|
545
|
+
createdAt: O.createdAt,
|
|
546
|
+
attestationCreatedAt: O.attestationCreatedAt,
|
|
547
|
+
localId: O.localId,
|
|
548
|
+
revokedAt: O.revokedAt
|
|
549
|
+
}).from(O).where(ge(U(O.seedUid, l), W(O.propertyName))) : c ? e.select({
|
|
550
|
+
propertyName: O.propertyName,
|
|
551
|
+
propertyValue: O.propertyValue,
|
|
552
|
+
seedLocalId: O.seedLocalId,
|
|
553
|
+
seedUid: O.seedUid,
|
|
554
|
+
modelType: O.modelType,
|
|
555
|
+
schemaUid: O.schemaUid,
|
|
556
|
+
createdAt: O.createdAt,
|
|
557
|
+
attestationCreatedAt: O.attestationCreatedAt,
|
|
558
|
+
localId: O.localId,
|
|
559
|
+
revokedAt: O.revokedAt
|
|
560
|
+
}).from(O).where(ge(U(O.seedLocalId, c), W(O.propertyName))) : null;
|
|
561
|
+
return X("[useItemProperties] Query: created query object", { queryType: l ? "seedUid" : "seedLocalId" }), n;
|
|
530
562
|
}, [
|
|
531
563
|
t,
|
|
532
564
|
c,
|
|
533
565
|
l
|
|
534
|
-
])), _ = o(() => !g || g.length === 0 ? [] :
|
|
566
|
+
])), _ = o(() => !g || g.length === 0 ? [] : se(g), [g]);
|
|
535
567
|
return i(() => {
|
|
536
568
|
if (!t || !c && !l || _ === void 0) return;
|
|
537
569
|
let e = JSON.stringify(_.map((e) => ({
|
|
@@ -557,7 +589,7 @@ function We(e) {
|
|
|
557
589
|
error: h
|
|
558
590
|
};
|
|
559
591
|
}
|
|
560
|
-
var
|
|
592
|
+
var Ke = () => {
|
|
561
593
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
562
594
|
if (!t.propertyName || !t.seedLocalId && !t.seedUid || !t.modelName) {
|
|
563
595
|
o(/* @__PURE__ */ Error("seedLocalId or seedUid, propertyName, and modelName are required"));
|
|
@@ -586,7 +618,7 @@ var Ge = () => {
|
|
|
586
618
|
error: a,
|
|
587
619
|
resetError: l
|
|
588
620
|
};
|
|
589
|
-
},
|
|
621
|
+
}, qe = () => {
|
|
590
622
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
591
623
|
return {
|
|
592
624
|
destroy: n(async (e) => {
|
|
@@ -594,8 +626,6 @@ var Ge = () => {
|
|
|
594
626
|
i(null), t(!0);
|
|
595
627
|
try {
|
|
596
628
|
await e.destroy();
|
|
597
|
-
let t = e.getService().getSnapshot().context;
|
|
598
|
-
t._destroyError && i(Error(t._destroyError.message));
|
|
599
629
|
} catch (e) {
|
|
600
630
|
throw i(e instanceof Error ? e : Error(String(e))), e;
|
|
601
631
|
} finally {
|
|
@@ -607,19 +637,25 @@ var Ge = () => {
|
|
|
607
637
|
error: r,
|
|
608
638
|
resetError: n(() => i(null), [])
|
|
609
639
|
};
|
|
610
|
-
},
|
|
640
|
+
}, Je = /* @__PURE__ */ new Set([
|
|
641
|
+
p.SAVE_CONFIG,
|
|
642
|
+
p.PROCESS_SCHEMA_FILES,
|
|
643
|
+
p.ADD_MODELS_TO_STORE,
|
|
644
|
+
p.ADD_MODELS_TO_DB,
|
|
645
|
+
p.IDLE
|
|
646
|
+
]), Ye = (e) => typeof e == "string" && Je.has(e), Xe = () => ({ dbsAreReady: I(D().getService(), (e) => Ye(e.value)) }), Ze = F("seedSdk:react:services"), Qe = [
|
|
611
647
|
"idle",
|
|
612
648
|
"ready",
|
|
613
649
|
"done",
|
|
614
650
|
"success",
|
|
615
651
|
"initialized"
|
|
616
|
-
],
|
|
652
|
+
], $e = (e) => {
|
|
617
653
|
let t = "actor", n = e;
|
|
618
|
-
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t =
|
|
619
|
-
},
|
|
654
|
+
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t = tt(e)), t;
|
|
655
|
+
}, et = (e) => {
|
|
620
656
|
let t;
|
|
621
|
-
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value),
|
|
622
|
-
},
|
|
657
|
+
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), $e(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;
|
|
658
|
+
}, tt = (e) => {
|
|
623
659
|
let t = e;
|
|
624
660
|
if (!e || !t.logic || !t.logic.config || !t._snapshot) return;
|
|
625
661
|
let n = t.logic.config;
|
|
@@ -630,21 +666,21 @@ var Ge = () => {
|
|
|
630
666
|
try {
|
|
631
667
|
i = e.getSnapshot();
|
|
632
668
|
} catch (e) {
|
|
633
|
-
return
|
|
669
|
+
return Ze("Error:", e), r;
|
|
634
670
|
}
|
|
635
671
|
if (i) {
|
|
636
672
|
let e = i.context;
|
|
637
673
|
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r = xe(e.modelName.toLowerCase()));
|
|
638
674
|
}
|
|
639
675
|
return r;
|
|
640
|
-
},
|
|
676
|
+
}, nt = (e) => {
|
|
641
677
|
let [t, r] = c(0), a = (e) => {
|
|
642
678
|
let t = 0, n = e;
|
|
643
679
|
if (n.logic?.states) {
|
|
644
680
|
let r = [], i = [];
|
|
645
681
|
for (let [e, t] of Object.entries(n.logic.states)) t.tags?.includes("loading") && (r.push(e), i.push(t));
|
|
646
|
-
let a = i.length, o =
|
|
647
|
-
if (o &&
|
|
682
|
+
let a = i.length, o = et(e);
|
|
683
|
+
if (o && Qe.includes(o)) return 0;
|
|
648
684
|
o && (t = r.indexOf(o) / a * 100);
|
|
649
685
|
}
|
|
650
686
|
return t;
|
|
@@ -662,47 +698,34 @@ var Ge = () => {
|
|
|
662
698
|
let e = s();
|
|
663
699
|
return () => clearInterval(e);
|
|
664
700
|
}, []), {
|
|
665
|
-
name:
|
|
701
|
+
name: $e(e),
|
|
666
702
|
timeElapsed: t,
|
|
667
|
-
value:
|
|
703
|
+
value: et(e),
|
|
668
704
|
percentComplete: a(e),
|
|
669
|
-
uniqueKey:
|
|
705
|
+
uniqueKey: tt(e)
|
|
670
706
|
};
|
|
671
|
-
},
|
|
672
|
-
let
|
|
673
|
-
return
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
s();
|
|
689
|
-
}), [r, e]);
|
|
690
|
-
}, tt = () => {
|
|
691
|
-
let [e, t] = c(!1), n = $e();
|
|
692
|
-
return i(() => {
|
|
693
|
-
n && (async () => {
|
|
694
|
-
let e = await d.getAppDb().select().from(S).where(be(S.key, "snapshot__%"));
|
|
695
|
-
e && e.length > 0 && t(!0);
|
|
696
|
-
})();
|
|
697
|
-
}, [n]), e;
|
|
698
|
-
}, nt = () => {
|
|
699
|
-
let [e, t] = c([]), [n, r] = c(5);
|
|
707
|
+
}, rt = () => {
|
|
708
|
+
let { internalStatus: e } = ct();
|
|
709
|
+
return e === "ready";
|
|
710
|
+
}, it = () => {}, at = () => !1, ot = (e) => {
|
|
711
|
+
switch (e) {
|
|
712
|
+
case p.IDLE: return 100;
|
|
713
|
+
case p.ADD_MODELS_TO_DB: return 90;
|
|
714
|
+
case p.ADD_MODELS_TO_STORE: return 80;
|
|
715
|
+
case p.PROCESS_SCHEMA_FILES: return 70;
|
|
716
|
+
case p.SAVE_CONFIG: return 60;
|
|
717
|
+
case p.DB_INIT: return 50;
|
|
718
|
+
case p.FILE_SYSTEM_INIT: return 30;
|
|
719
|
+
case p.PLATFORM_CLASSES_INIT: return 10;
|
|
720
|
+
default: return 0;
|
|
721
|
+
}
|
|
722
|
+
}, st = () => {
|
|
723
|
+
let [e, t] = c([]), [n, r] = c(() => ot(D().getService().getSnapshot().value));
|
|
700
724
|
return i(() => {
|
|
701
|
-
let e =
|
|
702
|
-
n.uniqueKey = "clientManager", t([n]);
|
|
725
|
+
let e = D().getService(), n = e;
|
|
726
|
+
n.uniqueKey = "clientManager", t([n]), r(ot(e.getSnapshot().value));
|
|
703
727
|
let i = e.subscribe((e) => {
|
|
704
|
-
|
|
705
|
-
t === p.IDLE ? n = 100 : t === p.ADD_MODELS_TO_DB ? n = 90 : t === p.ADD_MODELS_TO_STORE ? n = 80 : t === p.PROCESS_SCHEMA_FILES ? n = 70 : t === p.SAVE_CONFIG ? n = 60 : t === p.DB_INIT ? n = 50 : t === p.FILE_SYSTEM_INIT ? n = 30 : t === p.PLATFORM_CLASSES_INIT && (n = 10), r(n);
|
|
728
|
+
r(ot(e.value));
|
|
706
729
|
});
|
|
707
730
|
return () => {
|
|
708
731
|
i.unsubscribe();
|
|
@@ -711,54 +734,45 @@ var Ge = () => {
|
|
|
711
734
|
services: e,
|
|
712
735
|
percentComplete: n
|
|
713
736
|
};
|
|
714
|
-
},
|
|
715
|
-
let e =
|
|
737
|
+
}, ct = () => {
|
|
738
|
+
let e = D().getService();
|
|
716
739
|
return {
|
|
717
|
-
status:
|
|
718
|
-
internalStatus:
|
|
719
|
-
let t = e.value;
|
|
720
|
-
return t === p.DB_INIT || t === p.SAVE_CONFIG || t === p.PROCESS_SCHEMA_FILES || t === p.ADD_MODELS_TO_STORE || t === p.ADD_MODELS_TO_DB || t === p.IDLE ? "ready" : t;
|
|
721
|
-
})
|
|
740
|
+
status: I(e, (e) => e.value),
|
|
741
|
+
internalStatus: I(e, (e) => Ye(e.value) ? "ready" : e.value)
|
|
722
742
|
};
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
//#region src/db.ts
|
|
726
|
-
L("seedSdk:react:db");
|
|
727
|
-
var it = () => {
|
|
728
|
-
let [e, t] = c(!1), r = n(() => {
|
|
729
|
-
e || t(!0);
|
|
730
|
-
}, []);
|
|
731
|
-
return i(() => {
|
|
732
|
-
let e;
|
|
733
|
-
return (async () => {
|
|
734
|
-
let t = te().getService(), n = t.getSnapshot().value;
|
|
735
|
-
n === p.DB_INIT || n === p.SAVE_CONFIG || n === p.PROCESS_SCHEMA_FILES || n === p.ADD_MODELS_TO_STORE || n === p.ADD_MODELS_TO_DB || n === p.IDLE ? r() : e = t.subscribe((t) => {
|
|
736
|
-
let n = t.value;
|
|
737
|
-
(n === p.DB_INIT || n === p.SAVE_CONFIG || n === p.PROCESS_SCHEMA_FILES || n === p.ADD_MODELS_TO_STORE || n === p.ADD_MODELS_TO_DB || n === p.IDLE) && (r(), e?.unsubscribe());
|
|
738
|
-
});
|
|
739
|
-
})(), () => {
|
|
740
|
-
e && e.unsubscribe();
|
|
741
|
-
};
|
|
742
|
-
}, []), { dbsAreReady: e };
|
|
743
|
-
}, at = L("seedSdk:react:schema"), ot = (e) => {
|
|
744
|
-
let [t, r] = c(null), [a, o] = c(!!e), [u, d] = c(null), f = s(null), p = J(), m = n((e) => {
|
|
743
|
+
}, lt = F("seedSdk:react:schema"), ut = (e) => {
|
|
744
|
+
let [t, r] = c(null), [a, o] = c(!!e), [u, d] = c(null), f = s(null), p = K(), m = n(async (e, t) => {
|
|
745
745
|
o(!0), d(null);
|
|
746
746
|
try {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
747
|
+
if (!await dt(e)) {
|
|
748
|
+
if (!t()) return;
|
|
749
|
+
r(null), o(!1);
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
if (!t()) return;
|
|
753
|
+
let n = x.create(e, { waitForReady: !1 });
|
|
754
|
+
r(n);
|
|
755
|
+
let i = n.getService(), a = (t) => {
|
|
756
|
+
if (t.value === "idle") l(() => o(!1)), d(null);
|
|
757
|
+
else if (t.value === "error") {
|
|
758
|
+
let n = t.context._loadingError?.error;
|
|
759
|
+
o(!1), d(n instanceof Error ? n : /* @__PURE__ */ Error(`Failed to load schema "${e}"`));
|
|
760
|
+
} else o(!0);
|
|
761
|
+
};
|
|
762
|
+
a(i.getSnapshot()), f.current = i.subscribe(a);
|
|
753
763
|
} catch (e) {
|
|
754
|
-
|
|
764
|
+
if (lt("[useSchema] Error creating schema:", e), !t()) return;
|
|
765
|
+
d(e), r(null), o(!1);
|
|
755
766
|
}
|
|
756
767
|
}, []);
|
|
757
768
|
return i(() => {
|
|
758
|
-
if (f.current && (f.current.unsubscribe(), f.current = null), !p
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
769
|
+
if (f.current && (f.current.unsubscribe(), f.current = null), !p || !e) {
|
|
770
|
+
r(null), d(null), o(!1);
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
let t = !0;
|
|
774
|
+
return m(e, () => t), () => {
|
|
775
|
+
t = !1, f.current && (f.current.unsubscribe(), f.current = null);
|
|
762
776
|
};
|
|
763
777
|
}, [
|
|
764
778
|
e,
|
|
@@ -769,18 +783,24 @@ var it = () => {
|
|
|
769
783
|
isLoading: a,
|
|
770
784
|
error: u
|
|
771
785
|
};
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
|
|
786
|
+
};
|
|
787
|
+
async function dt(e) {
|
|
788
|
+
if (e === b) return !0;
|
|
789
|
+
let t = d.getAppDb();
|
|
790
|
+
return !t || (await t.select({ id: M.id }).from(M).where(G(U(M.name, e), U(M.schemaFileId, e))).limit(1)).length > 0;
|
|
791
|
+
}
|
|
792
|
+
var ft = ["seed", "schemas"], pt = () => {
|
|
793
|
+
let e = K(), t = H(), n = s(void 0), r = s([]), { data: a = [], isLoading: c, error: l } = V({
|
|
794
|
+
queryKey: ft,
|
|
775
795
|
queryFn: () => x.all({ waitForReady: !0 }),
|
|
776
796
|
enabled: e
|
|
777
797
|
});
|
|
778
798
|
r.current = a;
|
|
779
|
-
let u = e ? d.getAppDb() : null, f =
|
|
799
|
+
let u = e ? d.getAppDb() : null, f = J(o(() => u ? u.select().from(M).orderBy(M.name, _e(M.version)) : null, [u, e]));
|
|
780
800
|
return i(() => {
|
|
781
801
|
if (typeof BroadcastChannel > "u") return;
|
|
782
802
|
let e = new BroadcastChannel("seed-schemas-invalidate"), n = () => {
|
|
783
|
-
t.invalidateQueries({ queryKey:
|
|
803
|
+
t.invalidateQueries({ queryKey: ft });
|
|
784
804
|
};
|
|
785
805
|
return e.addEventListener("message", n), () => {
|
|
786
806
|
e.removeEventListener("message", n), e.close();
|
|
@@ -792,6 +812,7 @@ var it = () => {
|
|
|
792
812
|
n.current = f;
|
|
793
813
|
let a = /* @__PURE__ */ new Set();
|
|
794
814
|
for (let e of r.current) {
|
|
815
|
+
if (e.metadata?.name === b) continue;
|
|
795
816
|
let t = e.id || e.schemaFileId;
|
|
796
817
|
if (t) a.add(t);
|
|
797
818
|
else {
|
|
@@ -801,8 +822,8 @@ var it = () => {
|
|
|
801
822
|
}
|
|
802
823
|
let o = /* @__PURE__ */ new Set();
|
|
803
824
|
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}`));
|
|
804
|
-
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));
|
|
805
|
-
!s && c && t.invalidateQueries({ queryKey:
|
|
825
|
+
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: ft });
|
|
806
827
|
}, [
|
|
807
828
|
e,
|
|
808
829
|
f,
|
|
@@ -812,7 +833,7 @@ var it = () => {
|
|
|
812
833
|
isLoading: c,
|
|
813
834
|
error: l
|
|
814
835
|
};
|
|
815
|
-
},
|
|
836
|
+
}, mt = () => {
|
|
816
837
|
let e = s(null), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
817
838
|
o(null), r(!0), e.current?.unsubscribe(), e.current = null;
|
|
818
839
|
let n = x.create(t, { waitForReady: !1 }), i = n.getService().subscribe((e) => {
|
|
@@ -832,7 +853,7 @@ var it = () => {
|
|
|
832
853
|
error: a,
|
|
833
854
|
resetError: l
|
|
834
855
|
};
|
|
835
|
-
},
|
|
856
|
+
}, ht = () => {
|
|
836
857
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
837
858
|
return {
|
|
838
859
|
destroy: n(async (e) => {
|
|
@@ -840,8 +861,6 @@ var it = () => {
|
|
|
840
861
|
i(null), t(!0);
|
|
841
862
|
try {
|
|
842
863
|
await e.destroy();
|
|
843
|
-
let t = e.getService().getSnapshot().context;
|
|
844
|
-
t._destroyError && i(Error(t._destroyError.message));
|
|
845
864
|
} catch (e) {
|
|
846
865
|
throw i(e instanceof Error ? e : Error(String(e))), e;
|
|
847
866
|
} finally {
|
|
@@ -853,8 +872,8 @@ var it = () => {
|
|
|
853
872
|
error: r,
|
|
854
873
|
resetError: n(() => i(null), [])
|
|
855
874
|
};
|
|
856
|
-
},
|
|
857
|
-
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a =
|
|
875
|
+
}, gt = () => {
|
|
876
|
+
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a = K(), o = n(async () => {
|
|
858
877
|
if (a) try {
|
|
859
878
|
let e = await ie(), n = /* @__PURE__ */ new Set();
|
|
860
879
|
for (let t of e) {
|
|
@@ -872,7 +891,7 @@ var it = () => {
|
|
|
872
891
|
for (let [e, t] of r.current.entries()) n.has(e) || t.unload();
|
|
873
892
|
r.current = i, t(Array.from(i.values()));
|
|
874
893
|
} catch (e) {
|
|
875
|
-
|
|
894
|
+
lt("Error fetching all schema versions from database:", e), t(null);
|
|
876
895
|
}
|
|
877
896
|
}, [a]);
|
|
878
897
|
return i(() => {
|
|
@@ -882,31 +901,24 @@ var it = () => {
|
|
|
882
901
|
e.unload();
|
|
883
902
|
}), r.current.clear();
|
|
884
903
|
}, []), e;
|
|
885
|
-
},
|
|
904
|
+
}, _t = () => ut(b), vt = (e) => [
|
|
886
905
|
"seed",
|
|
887
906
|
"models",
|
|
888
907
|
e
|
|
889
|
-
],
|
|
890
|
-
let t =
|
|
891
|
-
queryKey:
|
|
908
|
+
], yt, bt = (e) => {
|
|
909
|
+
let t = K(), n = r(B) ?? yt ?? (yt = new me()), a = s(null), c = o(() => vt(e), [e]), { data: l = [], isLoading: u, error: f } = V({
|
|
910
|
+
queryKey: c,
|
|
892
911
|
queryFn: async () => {
|
|
893
|
-
let t =
|
|
894
|
-
|
|
895
|
-
if (Array.isArray(r) && r.length === 0) {
|
|
896
|
-
let e = n.getQueryData(a);
|
|
897
|
-
if (Array.isArray(e) && e.length > 0) return [...e];
|
|
898
|
-
}
|
|
899
|
-
return r;
|
|
912
|
+
let t = await v.all(e, { waitForReady: !1 }), r = n.getQueryData(c), i = a.current;
|
|
913
|
+
return t.length === 0 && r && r.length > 0 && (!i || i.size > 0) ? r : t;
|
|
900
914
|
},
|
|
901
915
|
enabled: t && !!e
|
|
902
|
-
}),
|
|
903
|
-
|
|
904
|
-
let p = r.current.length > 0 ? r.current : mt.get(f), m = e ? c.length > 0 ? c : p?.length ? p : c : c;
|
|
905
|
-
r.current = m, i(() => {
|
|
916
|
+
}, n), p = e ? l : [], m = s(p);
|
|
917
|
+
m.current = p, i(() => {
|
|
906
918
|
if (!e || typeof BroadcastChannel > "u") return;
|
|
907
919
|
let t = new BroadcastChannel("seed-models-invalidate"), r = (t) => {
|
|
908
920
|
let { schemaName: r, schemaFileId: i } = t.data || {};
|
|
909
|
-
(e === r || e === i) && (n.invalidateQueries({ queryKey:
|
|
921
|
+
(e === r || e === i) && (n.invalidateQueries({ queryKey: c }), n.refetchQueries({ queryKey: c }));
|
|
910
922
|
};
|
|
911
923
|
return t.addEventListener("message", r), () => {
|
|
912
924
|
t.removeEventListener("message", r), t.close();
|
|
@@ -914,17 +926,17 @@ var it = () => {
|
|
|
914
926
|
}, [
|
|
915
927
|
e,
|
|
916
928
|
n,
|
|
917
|
-
|
|
929
|
+
c
|
|
918
930
|
]);
|
|
919
931
|
let h = s(null), g = s(null);
|
|
920
932
|
function _() {
|
|
921
933
|
let t = d.getAppDb();
|
|
922
934
|
return !t || !e ? null : t.select({
|
|
923
|
-
modelFileId:
|
|
924
|
-
modelName:
|
|
925
|
-
}).from(
|
|
935
|
+
modelFileId: k.schemaFileId,
|
|
936
|
+
modelName: k.name
|
|
937
|
+
}).from(M).innerJoin(ae, U(M.id, ae.schemaId)).innerJoin(k, U(ae.modelId, k.id)).where(G(U(M.schemaFileId, e), U(M.name, e)));
|
|
926
938
|
}
|
|
927
|
-
let y =
|
|
939
|
+
let y = J(o(() => {
|
|
928
940
|
if (!e || !t) return null;
|
|
929
941
|
let n = {
|
|
930
942
|
schemaId: e,
|
|
@@ -936,29 +948,28 @@ var it = () => {
|
|
|
936
948
|
}, [e, t]));
|
|
937
949
|
return i(() => {
|
|
938
950
|
if (!t || !y || !e) return;
|
|
939
|
-
let
|
|
940
|
-
for (let e of
|
|
951
|
+
let r = /* @__PURE__ */ new Set();
|
|
952
|
+
for (let e of m.current) {
|
|
941
953
|
let t = e.id || e.modelFileId;
|
|
942
|
-
t ?
|
|
954
|
+
t ? r.add(t) : e.modelName && r.add(e.modelName);
|
|
943
955
|
}
|
|
944
|
-
let
|
|
945
|
-
for (let e of y) e.modelFileId ?
|
|
946
|
-
|
|
947
|
-
!s && c && n.invalidateQueries({ queryKey: a });
|
|
956
|
+
let i = /* @__PURE__ */ new Set();
|
|
957
|
+
for (let e of y) e.modelFileId ? i.add(e.modelFileId) : e.modelName && i.add(e.modelName);
|
|
958
|
+
a.current = i, r.size === i.size && [...r].every((e) => i.has(e)) || n.invalidateQueries({ queryKey: c });
|
|
948
959
|
}, [
|
|
949
960
|
t,
|
|
950
961
|
y,
|
|
951
962
|
e,
|
|
952
963
|
n,
|
|
953
|
-
|
|
964
|
+
c
|
|
954
965
|
]), {
|
|
955
|
-
models:
|
|
956
|
-
isLoading:
|
|
957
|
-
error:
|
|
966
|
+
models: p,
|
|
967
|
+
isLoading: u,
|
|
968
|
+
error: f
|
|
958
969
|
};
|
|
959
|
-
},
|
|
960
|
-
let n =
|
|
961
|
-
|
|
970
|
+
}, xt = (e, t) => {
|
|
971
|
+
let n = K(), [r, a] = c(void 0), [l, u] = c(!1), [d, f] = c(null), p = s(void 0), [, m] = c(0), h = t == null;
|
|
972
|
+
o(() => n ? h ? !!e : !!(e && t) : !1, [
|
|
962
973
|
n,
|
|
963
974
|
h,
|
|
964
975
|
e,
|
|
@@ -977,44 +988,30 @@ var it = () => {
|
|
|
977
988
|
n,
|
|
978
989
|
h,
|
|
979
990
|
e
|
|
980
|
-
])
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
991
|
+
]);
|
|
992
|
+
let { models: g, isLoading: _, error: y } = bt(h ? null : e), b = o(() => {
|
|
993
|
+
if (!h && t) return g.find((e) => (e.modelName ?? e.name) === t);
|
|
994
|
+
}, [
|
|
995
|
+
h,
|
|
996
|
+
g,
|
|
997
|
+
t
|
|
998
|
+
]), x = h ? r : b;
|
|
999
|
+
return i(() => {
|
|
1000
|
+
if (p.current?.unsubscribe(), p.current = void 0, x) return p.current = x.getService().subscribe(() => {
|
|
987
1001
|
m((e) => e + 1);
|
|
988
|
-
})
|
|
989
|
-
return p.current = e, () => {
|
|
1002
|
+
}), () => {
|
|
990
1003
|
p.current?.unsubscribe(), p.current = void 0;
|
|
991
1004
|
};
|
|
992
|
-
}, [
|
|
1005
|
+
}, [x]), h ? {
|
|
993
1006
|
model: r,
|
|
994
1007
|
isLoading: l,
|
|
995
1008
|
error: d
|
|
996
|
-
}
|
|
997
|
-
let { models: g, isLoading: _, error: y } = ht(e), b = o(() => {
|
|
998
|
-
if (t) return g.find((e) => (e.modelName ?? e.name) === t);
|
|
999
|
-
}, [g, t]);
|
|
1000
|
-
return i(() => {
|
|
1001
|
-
if (h || !b) {
|
|
1002
|
-
p.current?.unsubscribe(), p.current = void 0;
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
p.current?.unsubscribe();
|
|
1006
|
-
let e = b.getService().subscribe((e) => {
|
|
1007
|
-
m((e) => e + 1);
|
|
1008
|
-
});
|
|
1009
|
-
return p.current = e, () => {
|
|
1010
|
-
p.current?.unsubscribe(), p.current = void 0;
|
|
1011
|
-
};
|
|
1012
|
-
}, [h, b]), {
|
|
1009
|
+
} : {
|
|
1013
1010
|
model: b,
|
|
1014
1011
|
isLoading: _,
|
|
1015
1012
|
error: y
|
|
1016
1013
|
};
|
|
1017
|
-
},
|
|
1014
|
+
}, St = () => {
|
|
1018
1015
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t, n, i) => {
|
|
1019
1016
|
o(null), r(!0), e.current?.unsubscribe(), e.current = void 0;
|
|
1020
1017
|
let a = v.create(n, t, {
|
|
@@ -1033,7 +1030,7 @@ var it = () => {
|
|
|
1033
1030
|
error: a,
|
|
1034
1031
|
resetError: l
|
|
1035
1032
|
};
|
|
1036
|
-
},
|
|
1033
|
+
}, Ct = () => {
|
|
1037
1034
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1038
1035
|
return {
|
|
1039
1036
|
destroy: n(async (e) => {
|
|
@@ -1041,8 +1038,6 @@ var it = () => {
|
|
|
1041
1038
|
i(null), t(!0);
|
|
1042
1039
|
try {
|
|
1043
1040
|
await e.destroy();
|
|
1044
|
-
let t = e.getService().getSnapshot().context;
|
|
1045
|
-
t._destroyError && i(Error(t._destroyError.message));
|
|
1046
1041
|
} catch (e) {
|
|
1047
1042
|
throw i(e instanceof Error ? e : Error(String(e))), e;
|
|
1048
1043
|
} finally {
|
|
@@ -1057,9 +1052,17 @@ var it = () => {
|
|
|
1057
1052
|
};
|
|
1058
1053
|
//#endregion
|
|
1059
1054
|
//#region src/modelProperty.ts
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
let
|
|
1055
|
+
F("seedSdk:browser:react:modelProperty");
|
|
1056
|
+
async function wt(e) {
|
|
1057
|
+
let t = d.getAppDb();
|
|
1058
|
+
if (t) {
|
|
1059
|
+
let n = await t.select({ name: M.name }).from(M).where(G(U(M.name, e), U(M.schemaFileId, e))).limit(1);
|
|
1060
|
+
if (n[0]?.name) return n[0].name;
|
|
1061
|
+
}
|
|
1062
|
+
return ne(e) ?? e;
|
|
1063
|
+
}
|
|
1064
|
+
var Tt = (e, t) => {
|
|
1065
|
+
let { model: n } = xt(e, t);
|
|
1063
1066
|
o(() => {
|
|
1064
1067
|
if (n) try {
|
|
1065
1068
|
return n.modelName ?? n.name;
|
|
@@ -1067,20 +1070,20 @@ var yt = (e, t) => {
|
|
|
1067
1070
|
return;
|
|
1068
1071
|
}
|
|
1069
1072
|
}, [n]);
|
|
1070
|
-
let r =
|
|
1073
|
+
let r = K(), a = H(), c = Ot(n), l = n?.id, u = o(() => [
|
|
1071
1074
|
"seed",
|
|
1072
1075
|
"modelProperties",
|
|
1073
1076
|
l ?? ""
|
|
1074
|
-
], [l]), { data: f = [], isLoading: p, error: m } =
|
|
1077
|
+
], [l]), { data: f = [], isLoading: p, error: m } = V({
|
|
1075
1078
|
queryKey: u,
|
|
1076
1079
|
queryFn: () => y.all(l, { waitForReady: !0 }),
|
|
1077
1080
|
enabled: r && !!l
|
|
1078
|
-
}), h = r ? d.getAppDb() : null, g =
|
|
1079
|
-
id:
|
|
1080
|
-
name:
|
|
1081
|
-
dataType:
|
|
1082
|
-
schemaFileId:
|
|
1083
|
-
}).from(
|
|
1081
|
+
}), h = r ? d.getAppDb() : null, g = J(o(() => !h || !c ? null : h.select({
|
|
1082
|
+
id: le.id,
|
|
1083
|
+
name: le.name,
|
|
1084
|
+
dataType: le.dataType,
|
|
1085
|
+
schemaFileId: le.schemaFileId
|
|
1086
|
+
}).from(le).where(U(le.modelId, c)), [
|
|
1084
1087
|
h,
|
|
1085
1088
|
r,
|
|
1086
1089
|
c
|
|
@@ -1121,38 +1124,38 @@ var yt = (e, t) => {
|
|
|
1121
1124
|
isLoading: p && f.length === 0,
|
|
1122
1125
|
error: m
|
|
1123
1126
|
};
|
|
1124
|
-
},
|
|
1127
|
+
}, Et = [
|
|
1125
1128
|
400,
|
|
1126
1129
|
1200,
|
|
1127
1130
|
2500
|
|
1128
|
-
],
|
|
1131
|
+
], Dt = (e) => {
|
|
1129
1132
|
if (e) try {
|
|
1130
1133
|
return e._getSnapshotContext()._dbId;
|
|
1131
1134
|
} catch {
|
|
1132
1135
|
return;
|
|
1133
1136
|
}
|
|
1134
|
-
},
|
|
1135
|
-
let [t, n] = c(() =>
|
|
1137
|
+
}, Ot = (e) => {
|
|
1138
|
+
let [t, n] = c(() => Dt(e));
|
|
1136
1139
|
return i(() => {
|
|
1137
|
-
if (n(
|
|
1138
|
-
let t = e.getService().subscribe(() => n(
|
|
1140
|
+
if (n(Dt(e)), !e) return;
|
|
1141
|
+
let t = e.getService().subscribe(() => n(Dt(e)));
|
|
1139
1142
|
return () => t.unsubscribe();
|
|
1140
1143
|
}, [e]), t;
|
|
1141
|
-
},
|
|
1144
|
+
}, kt = async (e, t) => {
|
|
1142
1145
|
let n = await v.createById(e);
|
|
1143
1146
|
if (!n) return;
|
|
1144
1147
|
let r = n.modelName ?? n.name;
|
|
1145
|
-
if (r) return
|
|
1148
|
+
if (r) return te(r, t, {
|
|
1146
1149
|
modelFileId: e,
|
|
1147
1150
|
schemaName: n.schemaName
|
|
1148
1151
|
});
|
|
1149
1152
|
};
|
|
1150
|
-
function
|
|
1153
|
+
function At(e, t, r) {
|
|
1151
1154
|
let a = o(() => r == null ? t == null ? !!e : !!(e && t) : !!(e && t && r), [
|
|
1152
1155
|
e,
|
|
1153
1156
|
t,
|
|
1154
1157
|
r
|
|
1155
|
-
]), [u, d] = c(void 0), [f, p] = c(a), [m, h] = c(null), g = s(void 0), _ =
|
|
1158
|
+
]), [u, d] = c(void 0), [f, p] = c(a), [m, h] = c(null), g = s(void 0), _ = K(), b = o(() => r == null ? t == null ? {
|
|
1156
1159
|
type: "propertyFileId",
|
|
1157
1160
|
propertyFileId: e
|
|
1158
1161
|
} : {
|
|
@@ -1189,7 +1192,7 @@ function wt(e, t, r) {
|
|
|
1189
1192
|
d(void 0), p(!1), h(null);
|
|
1190
1193
|
return;
|
|
1191
1194
|
}
|
|
1192
|
-
t = await
|
|
1195
|
+
t = await kt(b.modelFileId, b.propertyName);
|
|
1193
1196
|
let e = await v.createById(b.modelFileId);
|
|
1194
1197
|
n = e?.modelName ?? e?.name;
|
|
1195
1198
|
} else {
|
|
@@ -1197,8 +1200,8 @@ function wt(e, t, r) {
|
|
|
1197
1200
|
d(void 0), p(!1), h(null);
|
|
1198
1201
|
return;
|
|
1199
1202
|
}
|
|
1200
|
-
let e = await
|
|
1201
|
-
t = await
|
|
1203
|
+
let e = await wt(b.schemaId);
|
|
1204
|
+
t = await te(b.modelName, b.propertyName, { schemaName: e }), n = b.modelName;
|
|
1202
1205
|
}
|
|
1203
1206
|
if (t && n) {
|
|
1204
1207
|
let e = y.create({
|
|
@@ -1227,7 +1230,7 @@ function wt(e, t, r) {
|
|
|
1227
1230
|
let C = s(!1);
|
|
1228
1231
|
C.current = f || !!u || !!m, i(() => {
|
|
1229
1232
|
if (!x || b.type === "propertyFileId") return;
|
|
1230
|
-
let e =
|
|
1233
|
+
let e = Et.map((e) => setTimeout(() => {
|
|
1231
1234
|
C.current || S({ quiet: !0 });
|
|
1232
1235
|
}, e));
|
|
1233
1236
|
return () => e.forEach((e) => clearTimeout(e));
|
|
@@ -1240,7 +1243,7 @@ function wt(e, t, r) {
|
|
|
1240
1243
|
return i(() => {
|
|
1241
1244
|
if (!u || !w) return;
|
|
1242
1245
|
g.current?.unsubscribe();
|
|
1243
|
-
let e =
|
|
1246
|
+
let e = fe(S, 100), t = u.getService().subscribe(() => {
|
|
1244
1247
|
e();
|
|
1245
1248
|
});
|
|
1246
1249
|
return g.current = t, () => {
|
|
@@ -1256,13 +1259,13 @@ function wt(e, t, r) {
|
|
|
1256
1259
|
error: m
|
|
1257
1260
|
};
|
|
1258
1261
|
}
|
|
1259
|
-
var
|
|
1262
|
+
var jt = () => {
|
|
1260
1263
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t, n, i) => {
|
|
1261
1264
|
if (o(null), r(!0), e.current?.unsubscribe(), e.current = void 0, !n || !i.name || !i.dataType) {
|
|
1262
1265
|
let e = /* @__PURE__ */ Error("modelName, property name and dataType are required");
|
|
1263
1266
|
throw o(e), r(!1), e;
|
|
1264
1267
|
}
|
|
1265
|
-
let a =
|
|
1268
|
+
let a = ne(t) ?? t, s = y.create({
|
|
1266
1269
|
...i,
|
|
1267
1270
|
modelName: n
|
|
1268
1271
|
}, {
|
|
@@ -1285,7 +1288,7 @@ var Tt = () => {
|
|
|
1285
1288
|
error: a,
|
|
1286
1289
|
resetError: l
|
|
1287
1290
|
};
|
|
1288
|
-
},
|
|
1291
|
+
}, Mt = () => {
|
|
1289
1292
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1290
1293
|
return {
|
|
1291
1294
|
destroy: n(async (e) => {
|
|
@@ -1293,8 +1296,6 @@ var Tt = () => {
|
|
|
1293
1296
|
i(null), t(!0);
|
|
1294
1297
|
try {
|
|
1295
1298
|
await e.destroy();
|
|
1296
|
-
let t = e.getService().getSnapshot().context;
|
|
1297
|
-
t._destroyError && i(Error(t._destroyError.message));
|
|
1298
1299
|
} catch (e) {
|
|
1299
1300
|
throw i(e instanceof Error ? e : Error(String(e))), e;
|
|
1300
1301
|
} finally {
|
|
@@ -1306,7 +1307,7 @@ var Tt = () => {
|
|
|
1306
1307
|
error: r,
|
|
1307
1308
|
resetError: n(() => i(null), [])
|
|
1308
1309
|
};
|
|
1309
|
-
},
|
|
1310
|
+
}, Nt = () => {
|
|
1310
1311
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1311
1312
|
return {
|
|
1312
1313
|
deleteItem: n(async (e) => {
|
|
@@ -1314,8 +1315,6 @@ var Tt = () => {
|
|
|
1314
1315
|
i(null), t(!0);
|
|
1315
1316
|
try {
|
|
1316
1317
|
await e.destroy();
|
|
1317
|
-
let t = e.getService().getSnapshot().context;
|
|
1318
|
-
t._destroyError && i(Error(t._destroyError.message));
|
|
1319
1318
|
} catch (e) {
|
|
1320
1319
|
throw i(e instanceof Error ? e : Error(String(e))), e;
|
|
1321
1320
|
} finally {
|
|
@@ -1327,23 +1326,23 @@ var Tt = () => {
|
|
|
1327
1326
|
error: r,
|
|
1328
1327
|
resetError: n(() => i(null), [])
|
|
1329
1328
|
};
|
|
1330
|
-
},
|
|
1331
|
-
function
|
|
1332
|
-
let e =
|
|
1333
|
-
queryKey:
|
|
1329
|
+
}, Pt = ["seed", "imageFiles"];
|
|
1330
|
+
function Ft() {
|
|
1331
|
+
let e = K(), t = H(), { data: n = [], isLoading: r, error: a, refetch: o } = V({
|
|
1332
|
+
queryKey: Pt,
|
|
1334
1333
|
queryFn: () => f.listImageFiles(),
|
|
1335
1334
|
enabled: e
|
|
1336
1335
|
});
|
|
1337
1336
|
return i(() => {
|
|
1338
1337
|
let e = (e) => {
|
|
1339
|
-
e.includes("/images/") && t.invalidateQueries({ queryKey:
|
|
1338
|
+
e.includes("/images/") && t.invalidateQueries({ queryKey: Pt });
|
|
1340
1339
|
}, n = () => {
|
|
1341
|
-
t.invalidateQueries({ queryKey:
|
|
1340
|
+
t.invalidateQueries({ queryKey: Pt });
|
|
1342
1341
|
}, r = (e) => {
|
|
1343
|
-
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey:
|
|
1342
|
+
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey: Pt });
|
|
1344
1343
|
};
|
|
1345
|
-
return
|
|
1346
|
-
|
|
1344
|
+
return T.on("file-saved", e), T.on("fs.downloadAll.success", n), T.on(h, r), () => {
|
|
1345
|
+
T.off("file-saved", e), T.off("fs.downloadAll.success", n), T.off(h, r);
|
|
1347
1346
|
};
|
|
1348
1347
|
}, [t]), {
|
|
1349
1348
|
imageFiles: n,
|
|
@@ -1354,9 +1353,9 @@ function kt() {
|
|
|
1354
1353
|
}
|
|
1355
1354
|
//#endregion
|
|
1356
1355
|
//#region src/useFiles.ts
|
|
1357
|
-
var
|
|
1358
|
-
function
|
|
1359
|
-
let t =
|
|
1356
|
+
var It = ["seed", "files"];
|
|
1357
|
+
function Lt(e = "files") {
|
|
1358
|
+
let t = K(), n = H(), r = o(() => [...It, e], [e]), { data: a = [], isLoading: s, error: c, refetch: l } = V({
|
|
1360
1359
|
queryKey: r,
|
|
1361
1360
|
queryFn: () => f.listFiles(e),
|
|
1362
1361
|
enabled: t
|
|
@@ -1369,8 +1368,8 @@ function jt(e = "files") {
|
|
|
1369
1368
|
}, a = (t) => {
|
|
1370
1369
|
t.some((t) => t.includes(`/${e}/`)) && n.invalidateQueries({ queryKey: r });
|
|
1371
1370
|
};
|
|
1372
|
-
return
|
|
1373
|
-
|
|
1371
|
+
return T.on("file-saved", t), T.on("fs.downloadAll.success", i), T.on(h, a), () => {
|
|
1372
|
+
T.off("file-saved", t), T.off("fs.downloadAll.success", i), T.off(h, a);
|
|
1374
1373
|
};
|
|
1375
1374
|
}, [
|
|
1376
1375
|
n,
|
|
@@ -1385,38 +1384,38 @@ function jt(e = "files") {
|
|
|
1385
1384
|
}
|
|
1386
1385
|
//#endregion
|
|
1387
1386
|
//#region src/useEasSyncProcesses.ts
|
|
1388
|
-
function
|
|
1387
|
+
function Rt() {
|
|
1389
1388
|
let e = d.getAppDb();
|
|
1390
|
-
return o(() => e ? e.select().from(
|
|
1389
|
+
return o(() => e ? e.select().from(C).orderBy(_e(C.startedAt)) : null, [e]);
|
|
1391
1390
|
}
|
|
1392
|
-
function
|
|
1393
|
-
let e =
|
|
1391
|
+
function zt() {
|
|
1392
|
+
let e = J(Rt());
|
|
1394
1393
|
return {
|
|
1395
1394
|
records: e,
|
|
1396
1395
|
nonActiveCount: o(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
|
|
1397
1396
|
};
|
|
1398
1397
|
}
|
|
1399
|
-
function
|
|
1400
|
-
return
|
|
1398
|
+
function Bt() {
|
|
1399
|
+
return J(Rt());
|
|
1401
1400
|
}
|
|
1402
|
-
function
|
|
1403
|
-
return
|
|
1401
|
+
function Vt() {
|
|
1402
|
+
return zt().nonActiveCount;
|
|
1404
1403
|
}
|
|
1405
|
-
function
|
|
1406
|
-
let t = d.getAppDb(), n =
|
|
1404
|
+
function Ht(e) {
|
|
1405
|
+
let t = d.getAppDb(), n = o(() => e != null && t ? t.select().from(C).where(U(C.id, e)).limit(1) : null, [t, e]), r = J(n), i = n != null && r === void 0;
|
|
1407
1406
|
return {
|
|
1408
|
-
record:
|
|
1409
|
-
isLoading:
|
|
1407
|
+
record: r && r.length > 0 ? r[0] : null,
|
|
1408
|
+
isLoading: i
|
|
1410
1409
|
};
|
|
1411
1410
|
}
|
|
1412
1411
|
//#endregion
|
|
1413
1412
|
//#region src/SeedProvider.tsx
|
|
1414
|
-
var
|
|
1415
|
-
function
|
|
1416
|
-
let t =
|
|
1413
|
+
var Ut = null;
|
|
1414
|
+
function Wt(e) {
|
|
1415
|
+
let t = Ut?.(e);
|
|
1417
1416
|
return typeof window < "u" && window.__SEED_INVALIDATE_ITEM_PROPERTIES__ && window.__SEED_INVALIDATE_ITEM_PROPERTIES__(e), Promise.resolve(t).then(() => {});
|
|
1418
1417
|
}
|
|
1419
|
-
function
|
|
1418
|
+
function Gt({ queryClient: e }) {
|
|
1420
1419
|
return i(() => {
|
|
1421
1420
|
let t = (t) => {
|
|
1422
1421
|
let n = [
|
|
@@ -1426,7 +1425,7 @@ function zt({ queryClient: e }) {
|
|
|
1426
1425
|
];
|
|
1427
1426
|
return e.invalidateQueries({ queryKey: n }), e.refetchQueries({ queryKey: n });
|
|
1428
1427
|
};
|
|
1429
|
-
|
|
1428
|
+
Ut = t, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = t);
|
|
1430
1429
|
let n = (e) => {
|
|
1431
1430
|
let n = e?.seedLocalId ?? e?.seedUid;
|
|
1432
1431
|
n && t(n);
|
|
@@ -1436,13 +1435,13 @@ function zt({ queryClient: e }) {
|
|
|
1436
1435
|
exact: !1
|
|
1437
1436
|
});
|
|
1438
1437
|
};
|
|
1439
|
-
return
|
|
1440
|
-
|
|
1438
|
+
return T.on("itemProperty.saved", n), T.on(m, r), () => {
|
|
1439
|
+
T.off("itemProperty.saved", n), T.off(m, r), Ut = null, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = null);
|
|
1441
1440
|
};
|
|
1442
1441
|
}, [e]), null;
|
|
1443
1442
|
}
|
|
1444
|
-
function
|
|
1445
|
-
let r = o(() => t ??
|
|
1443
|
+
function Kt({ children: e, queryClient: t, queryClientRef: n }) {
|
|
1444
|
+
let r = o(() => t ?? Y(), [t]);
|
|
1446
1445
|
if (n && (n.current = r, typeof window < "u")) {
|
|
1447
1446
|
let e = window;
|
|
1448
1447
|
e.__TEST_SEED_QUERY_CLIENT__ = r;
|
|
@@ -1450,18 +1449,18 @@ function Bt({ children: e, queryClient: t, queryClientRef: n }) {
|
|
|
1450
1449
|
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = r);
|
|
1451
1450
|
} catch {}
|
|
1452
1451
|
}
|
|
1453
|
-
return /* @__PURE__ */
|
|
1452
|
+
return /* @__PURE__ */ R(he, {
|
|
1454
1453
|
client: r,
|
|
1455
|
-
children: /* @__PURE__ */
|
|
1454
|
+
children: /* @__PURE__ */ z(Te, {
|
|
1456
1455
|
queryClient: r,
|
|
1457
|
-
children: [/* @__PURE__ */
|
|
1456
|
+
children: [/* @__PURE__ */ R(Gt, { queryClient: r }), e]
|
|
1458
1457
|
})
|
|
1459
1458
|
});
|
|
1460
1459
|
}
|
|
1461
1460
|
//#endregion
|
|
1462
1461
|
//#region src/SeedClientGate.tsx
|
|
1463
|
-
function
|
|
1464
|
-
return /* @__PURE__ */
|
|
1462
|
+
function qt() {
|
|
1463
|
+
return /* @__PURE__ */ R("div", {
|
|
1465
1464
|
style: {
|
|
1466
1465
|
display: "flex",
|
|
1467
1466
|
alignItems: "center",
|
|
@@ -1472,8 +1471,8 @@ function Vt() {
|
|
|
1472
1471
|
children: "Loading..."
|
|
1473
1472
|
});
|
|
1474
1473
|
}
|
|
1475
|
-
function
|
|
1476
|
-
let l =
|
|
1474
|
+
function Jt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1475
|
+
let l = K(), u = s(o);
|
|
1477
1476
|
u.current = o, i(() => {
|
|
1478
1477
|
let n = t ? {
|
|
1479
1478
|
...e,
|
|
@@ -1482,11 +1481,11 @@ function Ht({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1482
1481
|
schema: t
|
|
1483
1482
|
}
|
|
1484
1483
|
} : e;
|
|
1485
|
-
|
|
1484
|
+
S.init(n).catch((e) => {
|
|
1486
1485
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1487
1486
|
});
|
|
1488
1487
|
}, [e, t]);
|
|
1489
|
-
let d = n ?? /* @__PURE__ */
|
|
1488
|
+
let d = n ?? /* @__PURE__ */ R(qt, {}), f = r ? void 0 : {
|
|
1490
1489
|
position: "relative",
|
|
1491
1490
|
display: "flex",
|
|
1492
1491
|
height: "100vh",
|
|
@@ -1501,15 +1500,15 @@ function Ht({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1501
1500
|
justifyContent: "center"
|
|
1502
1501
|
}
|
|
1503
1502
|
};
|
|
1504
|
-
return /* @__PURE__ */
|
|
1503
|
+
return /* @__PURE__ */ z("div", {
|
|
1505
1504
|
className: r,
|
|
1506
1505
|
style: f,
|
|
1507
|
-
children: [/* @__PURE__ */
|
|
1506
|
+
children: [/* @__PURE__ */ R("div", {
|
|
1508
1507
|
className: a,
|
|
1509
1508
|
style: p,
|
|
1510
1509
|
"aria-hidden": l,
|
|
1511
1510
|
children: d
|
|
1512
|
-
}), /* @__PURE__ */
|
|
1511
|
+
}), /* @__PURE__ */ R("div", {
|
|
1513
1512
|
style: {
|
|
1514
1513
|
flex: 1,
|
|
1515
1514
|
display: l ? "flex" : "none",
|
|
@@ -1521,54 +1520,54 @@ function Ht({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1521
1520
|
}
|
|
1522
1521
|
//#endregion
|
|
1523
1522
|
//#region src/opfsPaths.ts
|
|
1524
|
-
function
|
|
1523
|
+
function Yt(e) {
|
|
1525
1524
|
let t = e.split("/").filter(Boolean);
|
|
1526
1525
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1527
1526
|
return t;
|
|
1528
1527
|
}
|
|
1529
|
-
async function
|
|
1528
|
+
async function Xt(e, t) {
|
|
1530
1529
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1531
1530
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1532
1531
|
return n;
|
|
1533
1532
|
}
|
|
1534
|
-
async function
|
|
1535
|
-
let n =
|
|
1533
|
+
async function Zt(e, t) {
|
|
1534
|
+
let n = Yt(e), r = n.pop();
|
|
1536
1535
|
return {
|
|
1537
|
-
dir: await
|
|
1536
|
+
dir: await Xt(n.join("/"), t),
|
|
1538
1537
|
name: r
|
|
1539
1538
|
};
|
|
1540
1539
|
}
|
|
1541
|
-
async function
|
|
1542
|
-
let { dir: n, name: r } = await
|
|
1540
|
+
async function Qt(e, t) {
|
|
1541
|
+
let { dir: n, name: r } = await Zt(e, t);
|
|
1543
1542
|
return n.getFileHandle(r);
|
|
1544
1543
|
}
|
|
1545
|
-
async function
|
|
1546
|
-
return (await
|
|
1544
|
+
async function $t(e, t) {
|
|
1545
|
+
return (await Qt(e, t)).getFile();
|
|
1547
1546
|
}
|
|
1548
|
-
async function
|
|
1549
|
-
let { dir: n, name: r } = await
|
|
1547
|
+
async function en(e, t) {
|
|
1548
|
+
let { dir: n, name: r } = await Zt(e, t);
|
|
1550
1549
|
await n.removeEntry(r);
|
|
1551
1550
|
}
|
|
1552
|
-
async function
|
|
1551
|
+
async function tn(e, t) {
|
|
1553
1552
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1554
1553
|
for await (let e of n.entries()) r.push(e);
|
|
1555
1554
|
let i = !0;
|
|
1556
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1555
|
+
for (let [e, t] of r) (t.kind === "file" || !await tn(n, e)) && (i = !1);
|
|
1557
1556
|
return i && await e.removeEntry(t), i;
|
|
1558
1557
|
}
|
|
1559
|
-
async function
|
|
1558
|
+
async function nn(e, t) {
|
|
1560
1559
|
try {
|
|
1561
|
-
let { dir: n, name: r } = await
|
|
1562
|
-
return await
|
|
1560
|
+
let { dir: n, name: r } = await Zt(e, t);
|
|
1561
|
+
return await tn(n, r);
|
|
1563
1562
|
} catch (e) {
|
|
1564
1563
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1565
1564
|
throw e;
|
|
1566
1565
|
}
|
|
1567
1566
|
}
|
|
1568
|
-
function
|
|
1567
|
+
function rn() {
|
|
1569
1568
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1570
1569
|
}
|
|
1571
|
-
var
|
|
1570
|
+
var an = [
|
|
1572
1571
|
{
|
|
1573
1572
|
type: "image/jpeg",
|
|
1574
1573
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1579,43 +1578,43 @@ var Qt = [
|
|
|
1579
1578
|
},
|
|
1580
1579
|
{
|
|
1581
1580
|
type: "image/gif",
|
|
1582
|
-
test: (e) =>
|
|
1581
|
+
test: (e) => on(e, 0, 4) === "GIF8"
|
|
1583
1582
|
},
|
|
1584
1583
|
{
|
|
1585
1584
|
type: "image/webp",
|
|
1586
|
-
test: (e) =>
|
|
1585
|
+
test: (e) => on(e, 0, 4) === "RIFF" && on(e, 8, 12) === "WEBP"
|
|
1587
1586
|
},
|
|
1588
1587
|
{
|
|
1589
1588
|
type: "image/avif",
|
|
1590
|
-
test: (e) =>
|
|
1589
|
+
test: (e) => on(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(on(e, 8, 12))
|
|
1591
1590
|
},
|
|
1592
1591
|
{
|
|
1593
1592
|
type: "application/vnd.sqlite3",
|
|
1594
|
-
test: (e) =>
|
|
1593
|
+
test: (e) => on(e, 0, 15) === "SQLite format 3"
|
|
1595
1594
|
},
|
|
1596
1595
|
{
|
|
1597
1596
|
type: "application/pdf",
|
|
1598
|
-
test: (e) =>
|
|
1597
|
+
test: (e) => on(e, 0, 5) === "%PDF-"
|
|
1599
1598
|
}
|
|
1600
1599
|
];
|
|
1601
|
-
function
|
|
1600
|
+
function on(e, t, n) {
|
|
1602
1601
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1603
1602
|
}
|
|
1604
|
-
function
|
|
1605
|
-
return
|
|
1603
|
+
function sn(e) {
|
|
1604
|
+
return an.find((t) => t.test(e))?.type;
|
|
1606
1605
|
}
|
|
1607
|
-
async function
|
|
1608
|
-
if (e.size !== 0) return
|
|
1606
|
+
async function cn(e) {
|
|
1607
|
+
if (e.size !== 0) return sn(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1609
1608
|
}
|
|
1610
1609
|
//#endregion
|
|
1611
1610
|
//#region src/useOPFSFiles.ts
|
|
1612
|
-
async function
|
|
1611
|
+
async function ln(e, t = "") {
|
|
1613
1612
|
let n = [];
|
|
1614
1613
|
try {
|
|
1615
1614
|
for await (let [r, i] of e.entries()) {
|
|
1616
1615
|
let e = t ? `${t}/${r}` : r;
|
|
1617
1616
|
if (i.kind === "file") try {
|
|
1618
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1617
|
+
let t = await i.getFile(), a = t.type ? void 0 : await cn(t).catch(() => void 0);
|
|
1619
1618
|
n.push({
|
|
1620
1619
|
name: r,
|
|
1621
1620
|
path: e,
|
|
@@ -1628,7 +1627,7 @@ async function nn(e, t = "") {
|
|
|
1628
1627
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1629
1628
|
}
|
|
1630
1629
|
else if (i.kind === "directory") {
|
|
1631
|
-
let t = await
|
|
1630
|
+
let t = await ln(i, e);
|
|
1632
1631
|
n.push(...t);
|
|
1633
1632
|
}
|
|
1634
1633
|
}
|
|
@@ -1637,11 +1636,11 @@ async function nn(e, t = "") {
|
|
|
1637
1636
|
}
|
|
1638
1637
|
return n;
|
|
1639
1638
|
}
|
|
1640
|
-
function
|
|
1639
|
+
function un(e = {}) {
|
|
1641
1640
|
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 () => {
|
|
1642
1641
|
s(!0), f(null), m(null);
|
|
1643
1642
|
try {
|
|
1644
|
-
let e = await
|
|
1643
|
+
let e = await ln(await Xt(t ?? ""), t || "");
|
|
1645
1644
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1646
1645
|
} catch (e) {
|
|
1647
1646
|
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);
|
|
@@ -1662,96 +1661,96 @@ function rn(e = {}) {
|
|
|
1662
1661
|
}
|
|
1663
1662
|
//#endregion
|
|
1664
1663
|
//#region src/OPFSFilesManager/format.ts
|
|
1665
|
-
var
|
|
1664
|
+
var dn = [
|
|
1666
1665
|
"B",
|
|
1667
1666
|
"KB",
|
|
1668
1667
|
"MB",
|
|
1669
1668
|
"GB",
|
|
1670
1669
|
"TB"
|
|
1671
1670
|
];
|
|
1672
|
-
function
|
|
1671
|
+
function Z(e) {
|
|
1673
1672
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1674
|
-
let t = Math.min(
|
|
1675
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1673
|
+
let t = Math.min(dn.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1674
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${dn[t]}`;
|
|
1676
1675
|
}
|
|
1677
|
-
var
|
|
1678
|
-
function
|
|
1676
|
+
var fn = 6e4, pn = 60 * fn, mn = 24 * pn;
|
|
1677
|
+
function hn(e, t = Date.now()) {
|
|
1679
1678
|
let n = t - e;
|
|
1680
|
-
if (n <
|
|
1681
|
-
if (n <
|
|
1682
|
-
if (n <
|
|
1683
|
-
let r = Math.round(n /
|
|
1679
|
+
if (n < fn) return "just now";
|
|
1680
|
+
if (n < pn) return `${Math.round(n / fn)} min ago`;
|
|
1681
|
+
if (n < mn) return `${Math.round(n / pn)} h ago`;
|
|
1682
|
+
let r = Math.round(n / mn);
|
|
1684
1683
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1685
1684
|
}
|
|
1686
|
-
function
|
|
1685
|
+
function gn(e) {
|
|
1687
1686
|
return new Date(e).toLocaleString(void 0, {
|
|
1688
1687
|
dateStyle: "medium",
|
|
1689
1688
|
timeStyle: "short"
|
|
1690
1689
|
});
|
|
1691
1690
|
}
|
|
1692
|
-
function
|
|
1691
|
+
function _n(e, t) {
|
|
1693
1692
|
if (e.length <= t) return e;
|
|
1694
1693
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1695
1694
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1696
1695
|
}
|
|
1697
1696
|
//#endregion
|
|
1698
1697
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1699
|
-
var
|
|
1700
|
-
check: /* @__PURE__ */
|
|
1701
|
-
chevronLeft: /* @__PURE__ */
|
|
1702
|
-
chevronRight: /* @__PURE__ */
|
|
1703
|
-
copy: /* @__PURE__ */
|
|
1698
|
+
var vn = {
|
|
1699
|
+
check: /* @__PURE__ */ R("path", { d: "M20 6 9 17l-5-5" }),
|
|
1700
|
+
chevronLeft: /* @__PURE__ */ R("path", { d: "m15 18-6-6 6-6" }),
|
|
1701
|
+
chevronRight: /* @__PURE__ */ R("path", { d: "m9 18 6-6-6-6" }),
|
|
1702
|
+
copy: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("rect", {
|
|
1704
1703
|
width: "14",
|
|
1705
1704
|
height: "14",
|
|
1706
1705
|
x: "8",
|
|
1707
1706
|
y: "8",
|
|
1708
1707
|
rx: "2",
|
|
1709
1708
|
ry: "2"
|
|
1710
|
-
}), /* @__PURE__ */
|
|
1711
|
-
database: /* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1709
|
+
}), /* @__PURE__ */ R("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
|
|
1710
|
+
database: /* @__PURE__ */ z(L, { children: [
|
|
1711
|
+
/* @__PURE__ */ R("ellipse", {
|
|
1713
1712
|
cx: "12",
|
|
1714
1713
|
cy: "5",
|
|
1715
1714
|
rx: "9",
|
|
1716
1715
|
ry: "3"
|
|
1717
1716
|
}),
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1717
|
+
/* @__PURE__ */ R("path", { d: "M3 5V19A9 3 0 0 0 21 19V5" }),
|
|
1718
|
+
/* @__PURE__ */ R("path", { d: "M3 12A9 3 0 0 0 21 12" })
|
|
1720
1719
|
] }),
|
|
1721
|
-
download: /* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1720
|
+
download: /* @__PURE__ */ z(L, { children: [
|
|
1721
|
+
/* @__PURE__ */ R("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1722
|
+
/* @__PURE__ */ R("polyline", { points: "7 10 12 15 17 10" }),
|
|
1723
|
+
/* @__PURE__ */ R("line", {
|
|
1725
1724
|
x1: "12",
|
|
1726
1725
|
x2: "12",
|
|
1727
1726
|
y1: "15",
|
|
1728
1727
|
y2: "3"
|
|
1729
1728
|
})
|
|
1730
1729
|
] }),
|
|
1731
|
-
file: /* @__PURE__ */
|
|
1732
|
-
fileCode: /* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
1730
|
+
file: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ R("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })] }),
|
|
1731
|
+
fileCode: /* @__PURE__ */ z(L, { children: [
|
|
1732
|
+
/* @__PURE__ */ R("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1733
|
+
/* @__PURE__ */ R("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1734
|
+
/* @__PURE__ */ R("path", { d: "m10 13-2 2 2 2" }),
|
|
1735
|
+
/* @__PURE__ */ R("path", { d: "m14 17 2-2-2-2" })
|
|
1737
1736
|
] }),
|
|
1738
|
-
fileJson: /* @__PURE__ */
|
|
1739
|
-
/* @__PURE__ */
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1737
|
+
fileJson: /* @__PURE__ */ z(L, { children: [
|
|
1738
|
+
/* @__PURE__ */ R("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1739
|
+
/* @__PURE__ */ R("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1740
|
+
/* @__PURE__ */ R("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" }),
|
|
1741
|
+
/* @__PURE__ */ R("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" })
|
|
1743
1742
|
] }),
|
|
1744
|
-
fileText: /* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1749
|
-
/* @__PURE__ */
|
|
1743
|
+
fileText: /* @__PURE__ */ z(L, { children: [
|
|
1744
|
+
/* @__PURE__ */ R("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1745
|
+
/* @__PURE__ */ R("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1746
|
+
/* @__PURE__ */ R("path", { d: "M10 9H8" }),
|
|
1747
|
+
/* @__PURE__ */ R("path", { d: "M16 13H8" }),
|
|
1748
|
+
/* @__PURE__ */ R("path", { d: "M16 17H8" })
|
|
1750
1749
|
] }),
|
|
1751
|
-
folder: /* @__PURE__ */
|
|
1752
|
-
folderOpen: /* @__PURE__ */
|
|
1753
|
-
image: /* @__PURE__ */
|
|
1754
|
-
/* @__PURE__ */
|
|
1750
|
+
folder: /* @__PURE__ */ R("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" }),
|
|
1751
|
+
folderOpen: /* @__PURE__ */ R("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" }),
|
|
1752
|
+
image: /* @__PURE__ */ z(L, { children: [
|
|
1753
|
+
/* @__PURE__ */ R("rect", {
|
|
1755
1754
|
width: "18",
|
|
1756
1755
|
height: "18",
|
|
1757
1756
|
x: "3",
|
|
@@ -1759,64 +1758,64 @@ var fn = {
|
|
|
1759
1758
|
rx: "2",
|
|
1760
1759
|
ry: "2"
|
|
1761
1760
|
}),
|
|
1762
|
-
/* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ R("circle", {
|
|
1763
1762
|
cx: "9",
|
|
1764
1763
|
cy: "9",
|
|
1765
1764
|
r: "2"
|
|
1766
1765
|
}),
|
|
1767
|
-
/* @__PURE__ */
|
|
1766
|
+
/* @__PURE__ */ R("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
1768
1767
|
] }),
|
|
1769
|
-
imageOff: /* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1768
|
+
imageOff: /* @__PURE__ */ z(L, { children: [
|
|
1769
|
+
/* @__PURE__ */ R("line", {
|
|
1771
1770
|
x1: "2",
|
|
1772
1771
|
x2: "22",
|
|
1773
1772
|
y1: "2",
|
|
1774
1773
|
y2: "22"
|
|
1775
1774
|
}),
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ R("path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83" }),
|
|
1776
|
+
/* @__PURE__ */ R("line", {
|
|
1778
1777
|
x1: "13.5",
|
|
1779
1778
|
x2: "6",
|
|
1780
1779
|
y1: "13.5",
|
|
1781
1780
|
y2: "21"
|
|
1782
1781
|
}),
|
|
1783
|
-
/* @__PURE__ */
|
|
1782
|
+
/* @__PURE__ */ R("line", {
|
|
1784
1783
|
x1: "18",
|
|
1785
1784
|
x2: "21",
|
|
1786
1785
|
y1: "12",
|
|
1787
1786
|
y2: "15"
|
|
1788
1787
|
}),
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ R("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" }),
|
|
1789
|
+
/* @__PURE__ */ R("path", { d: "M21 15V5a2 2 0 0 0-2-2H9" })
|
|
1791
1790
|
] }),
|
|
1792
|
-
layers: /* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1795
|
-
/* @__PURE__ */
|
|
1791
|
+
layers: /* @__PURE__ */ z(L, { children: [
|
|
1792
|
+
/* @__PURE__ */ R("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" }),
|
|
1793
|
+
/* @__PURE__ */ R("path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65" }),
|
|
1794
|
+
/* @__PURE__ */ R("path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65" })
|
|
1796
1795
|
] }),
|
|
1797
|
-
layoutGrid: /* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1796
|
+
layoutGrid: /* @__PURE__ */ z(L, { children: [
|
|
1797
|
+
/* @__PURE__ */ R("rect", {
|
|
1799
1798
|
width: "7",
|
|
1800
1799
|
height: "7",
|
|
1801
1800
|
x: "3",
|
|
1802
1801
|
y: "3",
|
|
1803
1802
|
rx: "1"
|
|
1804
1803
|
}),
|
|
1805
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ R("rect", {
|
|
1806
1805
|
width: "7",
|
|
1807
1806
|
height: "7",
|
|
1808
1807
|
x: "14",
|
|
1809
1808
|
y: "3",
|
|
1810
1809
|
rx: "1"
|
|
1811
1810
|
}),
|
|
1812
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ R("rect", {
|
|
1813
1812
|
width: "7",
|
|
1814
1813
|
height: "7",
|
|
1815
1814
|
x: "14",
|
|
1816
1815
|
y: "14",
|
|
1817
1816
|
rx: "1"
|
|
1818
1817
|
}),
|
|
1819
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__PURE__ */ R("rect", {
|
|
1820
1819
|
width: "7",
|
|
1821
1820
|
height: "7",
|
|
1822
1821
|
x: "3",
|
|
@@ -1824,51 +1823,51 @@ var fn = {
|
|
|
1824
1823
|
rx: "1"
|
|
1825
1824
|
})
|
|
1826
1825
|
] }),
|
|
1827
|
-
list: /* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
/* @__PURE__ */
|
|
1826
|
+
list: /* @__PURE__ */ z(L, { children: [
|
|
1827
|
+
/* @__PURE__ */ R("path", { d: "M3 12h.01" }),
|
|
1828
|
+
/* @__PURE__ */ R("path", { d: "M3 18h.01" }),
|
|
1829
|
+
/* @__PURE__ */ R("path", { d: "M3 6h.01" }),
|
|
1830
|
+
/* @__PURE__ */ R("path", { d: "M8 12h13" }),
|
|
1831
|
+
/* @__PURE__ */ R("path", { d: "M8 18h13" }),
|
|
1832
|
+
/* @__PURE__ */ R("path", { d: "M8 6h13" })
|
|
1834
1833
|
] }),
|
|
1835
|
-
refresh: /* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1834
|
+
refresh: /* @__PURE__ */ z(L, { children: [
|
|
1835
|
+
/* @__PURE__ */ R("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
1836
|
+
/* @__PURE__ */ R("path", { d: "M21 3v5h-5" }),
|
|
1837
|
+
/* @__PURE__ */ R("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
1838
|
+
/* @__PURE__ */ R("path", { d: "M8 16H3v5" })
|
|
1840
1839
|
] }),
|
|
1841
|
-
search: /* @__PURE__ */
|
|
1840
|
+
search: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("circle", {
|
|
1842
1841
|
cx: "11",
|
|
1843
1842
|
cy: "11",
|
|
1844
1843
|
r: "8"
|
|
1845
|
-
}), /* @__PURE__ */
|
|
1846
|
-
trash: /* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1844
|
+
}), /* @__PURE__ */ R("path", { d: "m21 21-4.3-4.3" })] }),
|
|
1845
|
+
trash: /* @__PURE__ */ z(L, { children: [
|
|
1846
|
+
/* @__PURE__ */ R("path", { d: "M3 6h18" }),
|
|
1847
|
+
/* @__PURE__ */ R("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
1848
|
+
/* @__PURE__ */ R("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
|
|
1849
|
+
/* @__PURE__ */ R("line", {
|
|
1851
1850
|
x1: "10",
|
|
1852
1851
|
x2: "10",
|
|
1853
1852
|
y1: "11",
|
|
1854
1853
|
y2: "17"
|
|
1855
1854
|
}),
|
|
1856
|
-
/* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ R("line", {
|
|
1857
1856
|
x1: "14",
|
|
1858
1857
|
x2: "14",
|
|
1859
1858
|
y1: "11",
|
|
1860
1859
|
y2: "17"
|
|
1861
1860
|
})
|
|
1862
1861
|
] }),
|
|
1863
|
-
triangleAlert: /* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1866
|
-
/* @__PURE__ */
|
|
1862
|
+
triangleAlert: /* @__PURE__ */ z(L, { children: [
|
|
1863
|
+
/* @__PURE__ */ R("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" }),
|
|
1864
|
+
/* @__PURE__ */ R("path", { d: "M12 9v4" }),
|
|
1865
|
+
/* @__PURE__ */ R("path", { d: "M12 17h.01" })
|
|
1867
1866
|
] }),
|
|
1868
|
-
x: /* @__PURE__ */
|
|
1867
|
+
x: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("path", { d: "M18 6 6 18" }), /* @__PURE__ */ R("path", { d: "m6 6 12 12" })] })
|
|
1869
1868
|
};
|
|
1870
|
-
function
|
|
1871
|
-
return /* @__PURE__ */
|
|
1869
|
+
function Q({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
1870
|
+
return /* @__PURE__ */ R("svg", {
|
|
1872
1871
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1873
1872
|
width: t,
|
|
1874
1873
|
height: t,
|
|
@@ -1881,20 +1880,20 @@ function $({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
1881
1880
|
"aria-hidden": "true",
|
|
1882
1881
|
focusable: "false",
|
|
1883
1882
|
className: r,
|
|
1884
|
-
children:
|
|
1883
|
+
children: vn[e]
|
|
1885
1884
|
});
|
|
1886
1885
|
}
|
|
1887
1886
|
//#endregion
|
|
1888
1887
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
1889
|
-
var
|
|
1890
|
-
function
|
|
1888
|
+
var yn = 6;
|
|
1889
|
+
function bn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
1891
1890
|
let a = s(null);
|
|
1892
1891
|
return i(() => {
|
|
1893
1892
|
let e = a.current;
|
|
1894
1893
|
return e && !e.open && (e.showModal(), e.querySelector("[data-initial-focus]")?.focus()), () => {
|
|
1895
1894
|
e?.open && e.close();
|
|
1896
1895
|
};
|
|
1897
|
-
}, []), /* @__PURE__ */
|
|
1896
|
+
}, []), /* @__PURE__ */ R("dialog", {
|
|
1898
1897
|
ref: a,
|
|
1899
1898
|
className: ["seed-fm-dialog", e].filter(Boolean).join(" "),
|
|
1900
1899
|
"aria-labelledby": "seed-fm-delete-title",
|
|
@@ -1904,7 +1903,7 @@ function mn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
1904
1903
|
onClick: (e) => {
|
|
1905
1904
|
e.target === e.currentTarget && t();
|
|
1906
1905
|
},
|
|
1907
|
-
children: /* @__PURE__ */
|
|
1906
|
+
children: /* @__PURE__ */ R("form", {
|
|
1908
1907
|
method: "dialog",
|
|
1909
1908
|
onSubmit: (e) => {
|
|
1910
1909
|
e.preventDefault(), n();
|
|
@@ -1913,32 +1912,32 @@ function mn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
1913
1912
|
})
|
|
1914
1913
|
});
|
|
1915
1914
|
}
|
|
1916
|
-
function
|
|
1917
|
-
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 ${
|
|
1918
|
-
return /* @__PURE__ */
|
|
1915
|
+
function xn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
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 ${_n(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
1917
|
+
return /* @__PURE__ */ z(bn, {
|
|
1919
1918
|
className: o,
|
|
1920
1919
|
onCancel: i,
|
|
1921
1920
|
onSubmit: () => a(s),
|
|
1922
1921
|
children: [
|
|
1923
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ R("h3", {
|
|
1924
1923
|
id: "seed-fm-delete-title",
|
|
1925
1924
|
children: h
|
|
1926
1925
|
}),
|
|
1927
|
-
/* @__PURE__ */
|
|
1926
|
+
/* @__PURE__ */ z("p", { children: [
|
|
1928
1927
|
"This removes ",
|
|
1929
1928
|
e.length === 1 ? "it" : "them",
|
|
1930
1929
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
1931
1930
|
] }),
|
|
1932
|
-
/* @__PURE__ */
|
|
1931
|
+
/* @__PURE__ */ z("ul", { children: [e.slice(0, yn).map((e) => /* @__PURE__ */ z("li", { children: [/* @__PURE__ */ R("code", {
|
|
1933
1932
|
title: e.file.path,
|
|
1934
1933
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
1935
|
-
}), /* @__PURE__ */
|
|
1934
|
+
}), /* @__PURE__ */ R("span", { children: Z(e.file.size) })] }, e.file.path)), e.length > yn && /* @__PURE__ */ R("li", { children: /* @__PURE__ */ z("span", { children: [
|
|
1936
1935
|
"and ",
|
|
1937
|
-
e.length -
|
|
1936
|
+
e.length - yn,
|
|
1938
1937
|
" more"
|
|
1939
1938
|
] }) })] }),
|
|
1940
|
-
u.length > 0 && /* @__PURE__ */
|
|
1941
|
-
/* @__PURE__ */
|
|
1939
|
+
u.length > 0 && /* @__PURE__ */ z("label", { children: [
|
|
1940
|
+
/* @__PURE__ */ R("input", {
|
|
1942
1941
|
type: "checkbox",
|
|
1943
1942
|
className: "seed-fm-checkbox",
|
|
1944
1943
|
checked: s,
|
|
@@ -1949,26 +1948,26 @@ function hn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
1949
1948
|
" resized ",
|
|
1950
1949
|
u.length === 1 ? "copy" : "copies",
|
|
1951
1950
|
" (",
|
|
1952
|
-
|
|
1951
|
+
Z(d),
|
|
1953
1952
|
")"
|
|
1954
1953
|
] }),
|
|
1955
|
-
n && /* @__PURE__ */
|
|
1954
|
+
n && /* @__PURE__ */ z("div", {
|
|
1956
1955
|
className: "seed-fm-warning",
|
|
1957
1956
|
role: "alert",
|
|
1958
|
-
children: [/* @__PURE__ */
|
|
1957
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
1959
1958
|
name: "triangleAlert",
|
|
1960
1959
|
size: 16
|
|
1961
|
-
}), /* @__PURE__ */
|
|
1960
|
+
}), /* @__PURE__ */ R("span", { children: n })]
|
|
1962
1961
|
}),
|
|
1963
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ z("div", {
|
|
1964
1963
|
className: "seed-fm-dialog-actions",
|
|
1965
|
-
children: [/* @__PURE__ */
|
|
1964
|
+
children: [/* @__PURE__ */ R("button", {
|
|
1966
1965
|
type: "button",
|
|
1967
1966
|
className: "seed-fm-btn",
|
|
1968
1967
|
onClick: i,
|
|
1969
1968
|
"data-initial-focus": !0,
|
|
1970
1969
|
children: "Cancel"
|
|
1971
|
-
}), /* @__PURE__ */
|
|
1970
|
+
}), /* @__PURE__ */ R("button", {
|
|
1972
1971
|
type: "submit",
|
|
1973
1972
|
className: `seed-fm-btn ${m.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
1974
1973
|
children: m.label ?? `Delete ${f} ${f === 1 ? "file" : "files"}`
|
|
@@ -1977,43 +1976,43 @@ function hn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
1977
1976
|
]
|
|
1978
1977
|
});
|
|
1979
1978
|
}
|
|
1980
|
-
function
|
|
1979
|
+
function Sn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
1981
1980
|
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;
|
|
1982
|
-
return /* @__PURE__ */
|
|
1981
|
+
return /* @__PURE__ */ z(bn, {
|
|
1983
1982
|
className: u,
|
|
1984
1983
|
onCancel: s,
|
|
1985
1984
|
onSubmit: l,
|
|
1986
1985
|
children: [
|
|
1987
|
-
/* @__PURE__ */
|
|
1986
|
+
/* @__PURE__ */ R("h3", {
|
|
1988
1987
|
id: "seed-fm-delete-title",
|
|
1989
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
1988
|
+
children: i.label ? `${i.label}?` : `Delete the “${_n(e.name, 32)}” folder?`
|
|
1990
1989
|
}),
|
|
1991
|
-
/* @__PURE__ */
|
|
1990
|
+
/* @__PURE__ */ z("p", { children: [
|
|
1992
1991
|
"This removes the folder and the ",
|
|
1993
1992
|
h,
|
|
1994
1993
|
" in it (",
|
|
1995
|
-
|
|
1994
|
+
Z(p),
|
|
1996
1995
|
g > 0 && `, including ${g} resized ${g === 1 ? "copy" : "copies"}`,
|
|
1997
1996
|
") from this browser’s private storage. Copies on Arweave or other devices aren’t affected."
|
|
1998
1997
|
] }),
|
|
1999
|
-
/* @__PURE__ */
|
|
1998
|
+
/* @__PURE__ */ z("div", {
|
|
2000
1999
|
className: "seed-fm-irreversible",
|
|
2001
|
-
children: [/* @__PURE__ */
|
|
2000
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
2002
2001
|
name: "triangleAlert",
|
|
2003
2002
|
size: 16
|
|
2004
|
-
}), /* @__PURE__ */
|
|
2003
|
+
}), /* @__PURE__ */ z("span", { children: [/* @__PURE__ */ R("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2005
2004
|
}),
|
|
2006
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ z("ul", { children: [t.slice(0, yn).map((e) => /* @__PURE__ */ z("li", { children: [/* @__PURE__ */ R("code", {
|
|
2007
2006
|
title: e.path,
|
|
2008
2007
|
children: e.path.slice(m.length)
|
|
2009
|
-
}), /* @__PURE__ */
|
|
2008
|
+
}), /* @__PURE__ */ R("span", { children: Z(e.size) })] }, e.path)), t.length > yn && /* @__PURE__ */ R("li", { children: /* @__PURE__ */ z("span", { children: [
|
|
2010
2009
|
"and ",
|
|
2011
|
-
t.length -
|
|
2010
|
+
t.length - yn,
|
|
2012
2011
|
" more"
|
|
2013
2012
|
] }) })] }),
|
|
2014
|
-
/* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ z("div", {
|
|
2015
2014
|
className: "seed-fm-keepcopy",
|
|
2016
|
-
children: [/* @__PURE__ */
|
|
2015
|
+
children: [/* @__PURE__ */ R("span", { children: d ? "Saved a copy to your computer." : "Want a copy first? Save the folder to your computer." }), /* @__PURE__ */ z("button", {
|
|
2017
2016
|
type: "button",
|
|
2018
2017
|
className: "seed-fm-btn",
|
|
2019
2018
|
disabled: a,
|
|
@@ -2021,7 +2020,7 @@ function gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2021
2020
|
await o() && f(!0);
|
|
2022
2021
|
},
|
|
2023
2022
|
children: [
|
|
2024
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ R(Q, {
|
|
2025
2024
|
name: d ? "check" : "download",
|
|
2026
2025
|
size: 15
|
|
2027
2026
|
}),
|
|
@@ -2030,7 +2029,7 @@ function gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2030
2029
|
]
|
|
2031
2030
|
})]
|
|
2032
2031
|
}),
|
|
2033
|
-
n > 0 && /* @__PURE__ */
|
|
2032
|
+
n > 0 && /* @__PURE__ */ z("p", { children: [
|
|
2034
2033
|
n,
|
|
2035
2034
|
" other ",
|
|
2036
2035
|
n === 1 ? "file" : "files",
|
|
@@ -2039,23 +2038,23 @@ function gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2039
2038
|
" ",
|
|
2040
2039
|
"hidden here and won’t be deleted, so the folder itself will stay."
|
|
2041
2040
|
] }),
|
|
2042
|
-
r && /* @__PURE__ */
|
|
2041
|
+
r && /* @__PURE__ */ z("div", {
|
|
2043
2042
|
className: "seed-fm-warning",
|
|
2044
2043
|
role: "alert",
|
|
2045
|
-
children: [/* @__PURE__ */
|
|
2044
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
2046
2045
|
name: "triangleAlert",
|
|
2047
2046
|
size: 16
|
|
2048
|
-
}), /* @__PURE__ */
|
|
2047
|
+
}), /* @__PURE__ */ R("span", { children: r })]
|
|
2049
2048
|
}),
|
|
2050
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ z("div", {
|
|
2051
2050
|
className: "seed-fm-dialog-actions",
|
|
2052
|
-
children: [/* @__PURE__ */
|
|
2051
|
+
children: [/* @__PURE__ */ R("button", {
|
|
2053
2052
|
type: "button",
|
|
2054
2053
|
className: "seed-fm-btn",
|
|
2055
2054
|
onClick: s,
|
|
2056
2055
|
"data-initial-focus": !0,
|
|
2057
2056
|
children: "Cancel"
|
|
2058
|
-
}), /* @__PURE__ */
|
|
2057
|
+
}), /* @__PURE__ */ R("button", {
|
|
2059
2058
|
type: "submit",
|
|
2060
2059
|
disabled: a,
|
|
2061
2060
|
className: `seed-fm-btn ${i.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
@@ -2067,42 +2066,42 @@ function gn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2067
2066
|
}
|
|
2068
2067
|
//#endregion
|
|
2069
2068
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2070
|
-
function
|
|
2069
|
+
function Cn(e) {
|
|
2071
2070
|
return e.detectedType ?? e.type;
|
|
2072
2071
|
}
|
|
2073
|
-
var
|
|
2074
|
-
function
|
|
2075
|
-
let t =
|
|
2076
|
-
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" ||
|
|
2072
|
+
var wn = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2073
|
+
function $(e) {
|
|
2074
|
+
let t = Cn(e);
|
|
2075
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || wn.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";
|
|
2077
2076
|
}
|
|
2078
|
-
function
|
|
2077
|
+
function Tn(e) {
|
|
2079
2078
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2080
2079
|
if (t) return t.toLowerCase();
|
|
2081
|
-
let n =
|
|
2080
|
+
let n = Cn(e);
|
|
2082
2081
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2083
2082
|
}
|
|
2084
|
-
var
|
|
2085
|
-
function
|
|
2086
|
-
let t =
|
|
2083
|
+
var En = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, Dn = /^(.*\/)?images\/([^/]+)$/, On = (e) => e.replace(/\.[^/.]+$/, "");
|
|
2084
|
+
function kn(e) {
|
|
2085
|
+
let t = En.exec(e);
|
|
2087
2086
|
return t ? {
|
|
2088
2087
|
key: `${t[1] ?? ""}images/${t[3]}`,
|
|
2089
2088
|
width: Number(t[2])
|
|
2090
2089
|
} : null;
|
|
2091
2090
|
}
|
|
2092
|
-
function
|
|
2093
|
-
let t =
|
|
2094
|
-
return t ? `${t[1] ?? ""}images/${
|
|
2091
|
+
function An(e) {
|
|
2092
|
+
let t = Dn.exec(e);
|
|
2093
|
+
return t ? `${t[1] ?? ""}images/${On(t[2])}` : null;
|
|
2095
2094
|
}
|
|
2096
|
-
var
|
|
2095
|
+
var jn = (e) => ({
|
|
2097
2096
|
file: e,
|
|
2098
2097
|
variants: [],
|
|
2099
2098
|
totalSize: e.size
|
|
2100
2099
|
});
|
|
2101
|
-
function
|
|
2102
|
-
if (!t) return e.map(
|
|
2100
|
+
function Mn(e, t) {
|
|
2101
|
+
if (!t) return e.map(jn);
|
|
2103
2102
|
let n = /* @__PURE__ */ new Map(), r = [], i = [];
|
|
2104
2103
|
for (let t of e) {
|
|
2105
|
-
let e =
|
|
2104
|
+
let e = kn(t.path);
|
|
2106
2105
|
if (e) {
|
|
2107
2106
|
i.push({
|
|
2108
2107
|
file: t,
|
|
@@ -2110,27 +2109,27 @@ function Dn(e, t) {
|
|
|
2110
2109
|
});
|
|
2111
2110
|
continue;
|
|
2112
2111
|
}
|
|
2113
|
-
let a =
|
|
2112
|
+
let a = jn(t);
|
|
2114
2113
|
r.push(a);
|
|
2115
|
-
let o =
|
|
2116
|
-
o &&
|
|
2114
|
+
let o = An(t.path);
|
|
2115
|
+
o && $(t) === "image" && n.set(o, a);
|
|
2117
2116
|
}
|
|
2118
2117
|
for (let e of i) {
|
|
2119
2118
|
let t = n.get(e.key);
|
|
2120
2119
|
t ? (t.variants.push({
|
|
2121
2120
|
file: e.file,
|
|
2122
2121
|
width: e.width
|
|
2123
|
-
}), t.totalSize += e.file.size) : r.push(
|
|
2122
|
+
}), t.totalSize += e.file.size) : r.push(jn(e.file));
|
|
2124
2123
|
}
|
|
2125
2124
|
for (let e of n.values()) e.variants.sort((e, t) => e.width - t.width);
|
|
2126
2125
|
return r;
|
|
2127
2126
|
}
|
|
2128
|
-
var
|
|
2129
|
-
function
|
|
2127
|
+
var Nn = (e, t) => e ? `${e}/${t}` : t;
|
|
2128
|
+
function Pn(e, t, n = {}) {
|
|
2130
2129
|
let r = t ? `${t}/` : "", i = e.filter((e) => e.file.path.startsWith(r)), a = n.query?.trim().toLowerCase();
|
|
2131
2130
|
if (a) return {
|
|
2132
2131
|
folders: [],
|
|
2133
|
-
entries:
|
|
2132
|
+
entries: Fn(i.filter((e) => e.file.path.slice(r.length).toLowerCase().includes(a)), n.sort)
|
|
2134
2133
|
};
|
|
2135
2134
|
let o = /* @__PURE__ */ new Map(), s = [];
|
|
2136
2135
|
for (let e of i) {
|
|
@@ -2141,7 +2140,7 @@ function kn(e, t, n = {}) {
|
|
|
2141
2140
|
}
|
|
2142
2141
|
let a = n.slice(0, i), c = o.get(a) ?? {
|
|
2143
2142
|
name: a,
|
|
2144
|
-
path:
|
|
2143
|
+
path: Nn(t, a),
|
|
2145
2144
|
fileCount: 0,
|
|
2146
2145
|
size: 0
|
|
2147
2146
|
};
|
|
@@ -2149,10 +2148,10 @@ function kn(e, t, n = {}) {
|
|
|
2149
2148
|
}
|
|
2150
2149
|
return {
|
|
2151
2150
|
folders: [...o.values()].sort((e, t) => e.name.localeCompare(t.name)),
|
|
2152
|
-
entries:
|
|
2151
|
+
entries: Fn(s, n.sort)
|
|
2153
2152
|
};
|
|
2154
2153
|
}
|
|
2155
|
-
function
|
|
2154
|
+
function Fn(e, t = "name") {
|
|
2156
2155
|
let n = {
|
|
2157
2156
|
name: (e, t) => e.file.name.localeCompare(t.file.name),
|
|
2158
2157
|
modified: (e, t) => t.file.lastModified - e.file.lastModified,
|
|
@@ -2160,7 +2159,7 @@ function An(e, t = "name") {
|
|
|
2160
2159
|
};
|
|
2161
2160
|
return [...e].sort(n[t]);
|
|
2162
2161
|
}
|
|
2163
|
-
function
|
|
2162
|
+
function In(e) {
|
|
2164
2163
|
let t = {
|
|
2165
2164
|
image: 0,
|
|
2166
2165
|
database: 0,
|
|
@@ -2169,34 +2168,34 @@ function jn(e) {
|
|
|
2169
2168
|
text: 0,
|
|
2170
2169
|
other: 0
|
|
2171
2170
|
};
|
|
2172
|
-
for (let n of e) t[
|
|
2171
|
+
for (let n of e) t[$(n)] += n.size;
|
|
2173
2172
|
return t;
|
|
2174
2173
|
}
|
|
2175
|
-
function
|
|
2174
|
+
function Ln(e) {
|
|
2176
2175
|
return e.find((e) => /(^|\/)db\/seed\.db$/.test(e.path)) ? "This includes the Seed database. The app loses its local items and drafts, and anything not yet published is gone. Reload the app afterwards." : null;
|
|
2177
2176
|
}
|
|
2178
2177
|
//#endregion
|
|
2179
2178
|
//#region src/OPFSFilesManager/useThumbnail.ts
|
|
2180
|
-
var
|
|
2181
|
-
function
|
|
2179
|
+
var Rn = 400, zn = 262144, Bn = 4, Vn = 3e4, Hn = 0, Un = [];
|
|
2180
|
+
function Wn(e) {
|
|
2182
2181
|
return new Promise((t, n) => {
|
|
2183
2182
|
let r = () => {
|
|
2184
|
-
|
|
2185
|
-
|
|
2183
|
+
Hn++, e().then(t, n).finally(() => {
|
|
2184
|
+
Hn--, Un.shift()?.();
|
|
2186
2185
|
});
|
|
2187
2186
|
};
|
|
2188
|
-
|
|
2187
|
+
Hn < Bn ? r() : Un.push(r);
|
|
2189
2188
|
});
|
|
2190
2189
|
}
|
|
2191
|
-
var
|
|
2192
|
-
function
|
|
2193
|
-
let n =
|
|
2190
|
+
var Gn = /* @__PURE__ */ new Map();
|
|
2191
|
+
function Kn(e, t) {
|
|
2192
|
+
let n = Gn.get(e);
|
|
2194
2193
|
if (!n) {
|
|
2195
2194
|
let r = {
|
|
2196
2195
|
refs: 0,
|
|
2197
2196
|
promise: Promise.resolve("")
|
|
2198
2197
|
};
|
|
2199
|
-
r.promise =
|
|
2198
|
+
r.promise = Wn(t).then((e) => (r.url = URL.createObjectURL(e), r.url)), Gn.set(e, r), n = r;
|
|
2200
2199
|
}
|
|
2201
2200
|
n.timer && (clearTimeout(n.timer), n.timer = void 0), n.refs++;
|
|
2202
2201
|
let r = n, i = !1;
|
|
@@ -2204,15 +2203,15 @@ function Vn(e, t) {
|
|
|
2204
2203
|
promise: r.promise,
|
|
2205
2204
|
release: () => {
|
|
2206
2205
|
i || (i = !0, r.refs--, !(r.refs > 0) && (r.timer = setTimeout(() => {
|
|
2207
|
-
r.url && URL.revokeObjectURL(r.url),
|
|
2208
|
-
},
|
|
2206
|
+
r.url && URL.revokeObjectURL(r.url), Gn.get(e) === r && Gn.delete(e);
|
|
2207
|
+
}, Vn)));
|
|
2209
2208
|
}
|
|
2210
2209
|
};
|
|
2211
2210
|
}
|
|
2212
|
-
async function
|
|
2213
|
-
if (e.size <
|
|
2211
|
+
async function qn(e) {
|
|
2212
|
+
if (e.size < zn || typeof createImageBitmap != "function") return e;
|
|
2214
2213
|
let t = await createImageBitmap(e, {
|
|
2215
|
-
resizeWidth:
|
|
2214
|
+
resizeWidth: Rn,
|
|
2216
2215
|
resizeQuality: "medium"
|
|
2217
2216
|
});
|
|
2218
2217
|
try {
|
|
@@ -2229,22 +2228,22 @@ async function Hn(e) {
|
|
|
2229
2228
|
t.close();
|
|
2230
2229
|
}
|
|
2231
2230
|
}
|
|
2232
|
-
async function
|
|
2231
|
+
async function Jn(e) {
|
|
2233
2232
|
let t = e.variants[0];
|
|
2234
|
-
return t ?
|
|
2235
|
-
}
|
|
2236
|
-
var
|
|
2237
|
-
function
|
|
2238
|
-
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (
|
|
2239
|
-
for (let t of e) t.isIntersecting && (
|
|
2240
|
-
}, { rootMargin: "300px" })),
|
|
2241
|
-
|
|
2233
|
+
return t ? $t(t.file.path) : qn(await $t(e.file.path));
|
|
2234
|
+
}
|
|
2235
|
+
var Yn = /* @__PURE__ */ new WeakMap(), Xn = null;
|
|
2236
|
+
function Zn(e, t) {
|
|
2237
|
+
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (Xn ?? (Xn = new IntersectionObserver((e) => {
|
|
2238
|
+
for (let t of e) t.isIntersecting && (Xn.unobserve(t.target), Yn.get(t.target)?.(), Yn.delete(t.target));
|
|
2239
|
+
}, { rootMargin: "300px" })), Yn.set(e, t), Xn.observe(e), () => {
|
|
2240
|
+
Yn.delete(e), Xn?.unobserve(e);
|
|
2242
2241
|
});
|
|
2243
2242
|
}
|
|
2244
|
-
function
|
|
2245
|
-
let t =
|
|
2243
|
+
function Qn(e) {
|
|
2244
|
+
let t = $(e.file) === "image", [r, a] = c(null), [o, s] = c(!1), [l, u] = c(null), [d, f] = c("idle"), p = n((e) => a(e), []);
|
|
2246
2245
|
i(() => {
|
|
2247
|
-
if (t && r && !o) return
|
|
2246
|
+
if (t && r && !o) return Zn(r, () => s(!0));
|
|
2248
2247
|
}, [
|
|
2249
2248
|
t,
|
|
2250
2249
|
r,
|
|
@@ -2255,7 +2254,7 @@ function qn(e) {
|
|
|
2255
2254
|
if (!t || !o) return;
|
|
2256
2255
|
let n = !1;
|
|
2257
2256
|
f("loading");
|
|
2258
|
-
let r =
|
|
2257
|
+
let r = Kn(_, () => Jn(e));
|
|
2259
2258
|
return r.promise.then((e) => {
|
|
2260
2259
|
n || (u(e), f("ready"));
|
|
2261
2260
|
}, () => {
|
|
@@ -2278,7 +2277,7 @@ function qn(e) {
|
|
|
2278
2277
|
}
|
|
2279
2278
|
//#endregion
|
|
2280
2279
|
//#region src/OPFSFilesManager/FileThumbnail.tsx
|
|
2281
|
-
var
|
|
2280
|
+
var $n = {
|
|
2282
2281
|
image: {
|
|
2283
2282
|
icon: "image",
|
|
2284
2283
|
label: "Images",
|
|
@@ -2309,53 +2308,53 @@ var Jn = {
|
|
|
2309
2308
|
label: "Other",
|
|
2310
2309
|
color: "var(--seed-kind-other)"
|
|
2311
2310
|
}
|
|
2312
|
-
},
|
|
2313
|
-
function
|
|
2314
|
-
let r =
|
|
2311
|
+
}, er = (e) => ({ "--seed-kind": $n[e].color }), tr = (e) => /png|webp|gif|avif|svg/.test(Cn(e.file));
|
|
2312
|
+
function nr({ entry: e, size: t, children: n }) {
|
|
2313
|
+
let r = $(e.file), { ref: i, url: a, status: o, markError: s } = Qn(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2315
2314
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2316
|
-
l &&
|
|
2315
|
+
l && tr(e) ? "seed-fm-thumb--checker" : "",
|
|
2317
2316
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2318
2317
|
].filter(Boolean).join(" "), d;
|
|
2319
|
-
return d = l ? /* @__PURE__ */
|
|
2318
|
+
return d = l ? /* @__PURE__ */ R("img", {
|
|
2320
2319
|
src: a,
|
|
2321
2320
|
alt: "",
|
|
2322
2321
|
decoding: "async",
|
|
2323
2322
|
draggable: !1,
|
|
2324
2323
|
onError: s
|
|
2325
|
-
}) : t === "mini" ? /* @__PURE__ */
|
|
2326
|
-
name: c ? "imageOff" :
|
|
2324
|
+
}) : t === "mini" ? /* @__PURE__ */ R(Q, {
|
|
2325
|
+
name: c ? "imageOff" : $n[r].icon,
|
|
2327
2326
|
size: 16
|
|
2328
|
-
}) : r === "image" && !c ? null : /* @__PURE__ */
|
|
2327
|
+
}) : r === "image" && !c ? null : /* @__PURE__ */ z("span", {
|
|
2329
2328
|
className: "seed-fm-kind",
|
|
2330
|
-
children: [/* @__PURE__ */
|
|
2331
|
-
name: c ? "imageOff" :
|
|
2329
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
2330
|
+
name: c ? "imageOff" : $n[r].icon,
|
|
2332
2331
|
size: 28,
|
|
2333
2332
|
strokeWidth: 1.6
|
|
2334
|
-
}), c ? /* @__PURE__ */
|
|
2333
|
+
}), c ? /* @__PURE__ */ R("span", {
|
|
2335
2334
|
className: "seed-fm-kind-error",
|
|
2336
2335
|
children: "Can’t decode image"
|
|
2337
|
-
}) : /* @__PURE__ */
|
|
2336
|
+
}) : /* @__PURE__ */ R("span", {
|
|
2338
2337
|
className: "seed-fm-ext",
|
|
2339
|
-
children:
|
|
2338
|
+
children: Tn(e.file)
|
|
2340
2339
|
})]
|
|
2341
|
-
}), /* @__PURE__ */
|
|
2340
|
+
}), /* @__PURE__ */ z("span", {
|
|
2342
2341
|
ref: i,
|
|
2343
2342
|
className: u,
|
|
2344
|
-
style:
|
|
2343
|
+
style: er(r),
|
|
2345
2344
|
children: [d, n]
|
|
2346
2345
|
});
|
|
2347
2346
|
}
|
|
2348
2347
|
//#endregion
|
|
2349
2348
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2350
|
-
function
|
|
2351
|
-
return /* @__PURE__ */
|
|
2349
|
+
function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2350
|
+
return /* @__PURE__ */ R("ul", {
|
|
2352
2351
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2353
2352
|
role: "listbox",
|
|
2354
2353
|
"aria-label": "Files",
|
|
2355
2354
|
"aria-multiselectable": "true",
|
|
2356
2355
|
children: e.map((e, i) => {
|
|
2357
2356
|
let { file: o, variants: s } = e, c = t.has(o.path);
|
|
2358
|
-
return /* @__PURE__ */
|
|
2357
|
+
return /* @__PURE__ */ z("li", {
|
|
2359
2358
|
role: "option",
|
|
2360
2359
|
tabIndex: 0,
|
|
2361
2360
|
"aria-selected": c,
|
|
@@ -2367,10 +2366,10 @@ function Qn({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2367
2366
|
onKeyDown: (t) => {
|
|
2368
2367
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2369
2368
|
},
|
|
2370
|
-
children: [/* @__PURE__ */
|
|
2369
|
+
children: [/* @__PURE__ */ z(nr, {
|
|
2371
2370
|
entry: e,
|
|
2372
2371
|
size: "tile",
|
|
2373
|
-
children: [/* @__PURE__ */
|
|
2372
|
+
children: [/* @__PURE__ */ R("button", {
|
|
2374
2373
|
type: "button",
|
|
2375
2374
|
className: "seed-fm-check",
|
|
2376
2375
|
tabIndex: -1,
|
|
@@ -2378,16 +2377,16 @@ function Qn({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2378
2377
|
onClick: (t) => {
|
|
2379
2378
|
t.stopPropagation(), r(e, i, t.shiftKey);
|
|
2380
2379
|
},
|
|
2381
|
-
children: c && /* @__PURE__ */
|
|
2380
|
+
children: c && /* @__PURE__ */ R(Q, {
|
|
2382
2381
|
name: "check",
|
|
2383
2382
|
size: 14,
|
|
2384
2383
|
strokeWidth: 3
|
|
2385
2384
|
})
|
|
2386
|
-
}), s.length > 0 && /* @__PURE__ */
|
|
2385
|
+
}), s.length > 0 && /* @__PURE__ */ z("span", {
|
|
2387
2386
|
className: "seed-fm-badge",
|
|
2388
2387
|
title: "Resized copies are grouped with this image",
|
|
2389
2388
|
children: [
|
|
2390
|
-
/* @__PURE__ */
|
|
2389
|
+
/* @__PURE__ */ R(Q, {
|
|
2391
2390
|
name: "layers",
|
|
2392
2391
|
size: 11,
|
|
2393
2392
|
strokeWidth: 2.2
|
|
@@ -2397,21 +2396,21 @@ function Qn({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2397
2396
|
s.length === 1 ? "size" : "sizes"
|
|
2398
2397
|
]
|
|
2399
2398
|
})]
|
|
2400
|
-
}), /* @__PURE__ */
|
|
2399
|
+
}), /* @__PURE__ */ z("span", {
|
|
2401
2400
|
className: "seed-fm-tile-meta",
|
|
2402
|
-
children: [/* @__PURE__ */
|
|
2401
|
+
children: [/* @__PURE__ */ R("span", {
|
|
2403
2402
|
className: "seed-fm-tile-name",
|
|
2404
|
-
children:
|
|
2405
|
-
}), /* @__PURE__ */
|
|
2403
|
+
children: _n(o.name, 24)
|
|
2404
|
+
}), /* @__PURE__ */ z("span", {
|
|
2406
2405
|
className: "seed-fm-tile-sub",
|
|
2407
2406
|
children: [
|
|
2408
|
-
|
|
2407
|
+
Z(o.size),
|
|
2409
2408
|
" ·",
|
|
2410
2409
|
" ",
|
|
2411
|
-
/* @__PURE__ */
|
|
2410
|
+
/* @__PURE__ */ R("time", {
|
|
2412
2411
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2413
|
-
title:
|
|
2414
|
-
children:
|
|
2412
|
+
title: gn(o.lastModified),
|
|
2413
|
+
children: hn(o.lastModified)
|
|
2415
2414
|
})
|
|
2416
2415
|
]
|
|
2417
2416
|
})]
|
|
@@ -2422,20 +2421,20 @@ function Qn({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2422
2421
|
}
|
|
2423
2422
|
//#endregion
|
|
2424
2423
|
//#region src/OPFSFilesManager/FileList.tsx
|
|
2425
|
-
function
|
|
2424
|
+
function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onToggleAll: o, onDownload: c, onDelete: l, deleteActionFor: u, className: d, rowClassName: f }) {
|
|
2426
2425
|
let p = s(null), m = e.filter((e) => t.has(e.file.path)).length, h = e.length > 0 && m === e.length;
|
|
2427
2426
|
i(() => {
|
|
2428
2427
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
2429
2428
|
}, [m, h]);
|
|
2430
2429
|
let g = n ? `${n}/` : "";
|
|
2431
|
-
return /* @__PURE__ */
|
|
2430
|
+
return /* @__PURE__ */ R("div", {
|
|
2432
2431
|
className: "seed-fm-list-wrap",
|
|
2433
|
-
children: /* @__PURE__ */
|
|
2432
|
+
children: /* @__PURE__ */ z("table", {
|
|
2434
2433
|
className: ["seed-fm-list", d].filter(Boolean).join(" "),
|
|
2435
|
-
children: [/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2434
|
+
children: [/* @__PURE__ */ R("thead", { children: /* @__PURE__ */ z("tr", { children: [
|
|
2435
|
+
/* @__PURE__ */ R("th", {
|
|
2437
2436
|
style: { width: 28 },
|
|
2438
|
-
children: /* @__PURE__ */
|
|
2437
|
+
children: /* @__PURE__ */ R("input", {
|
|
2439
2438
|
ref: p,
|
|
2440
2439
|
type: "checkbox",
|
|
2441
2440
|
className: "seed-fm-checkbox",
|
|
@@ -2444,34 +2443,34 @@ function $n({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2444
2443
|
"aria-label": "Select all"
|
|
2445
2444
|
})
|
|
2446
2445
|
}),
|
|
2447
|
-
/* @__PURE__ */
|
|
2448
|
-
/* @__PURE__ */
|
|
2446
|
+
/* @__PURE__ */ R("th", { children: "Name" }),
|
|
2447
|
+
/* @__PURE__ */ R("th", {
|
|
2449
2448
|
className: "seed-fm-col-type",
|
|
2450
2449
|
children: "Type"
|
|
2451
2450
|
}),
|
|
2452
|
-
/* @__PURE__ */
|
|
2451
|
+
/* @__PURE__ */ R("th", {
|
|
2453
2452
|
className: "seed-fm-num seed-fm-col-size",
|
|
2454
2453
|
children: "Size"
|
|
2455
2454
|
}),
|
|
2456
|
-
/* @__PURE__ */
|
|
2455
|
+
/* @__PURE__ */ R("th", {
|
|
2457
2456
|
className: "seed-fm-col-modified",
|
|
2458
2457
|
children: "Modified"
|
|
2459
2458
|
}),
|
|
2460
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ R("th", { children: /* @__PURE__ */ R("span", {
|
|
2461
2460
|
className: "seed-fm-visually-hidden",
|
|
2462
2461
|
children: "Actions"
|
|
2463
2462
|
}) })
|
|
2464
|
-
] }) }), /* @__PURE__ */
|
|
2463
|
+
] }) }), /* @__PURE__ */ R("tbody", { children: e.map((e, n) => {
|
|
2465
2464
|
let { file: i } = e, o = t.has(i.path), s = u(e);
|
|
2466
|
-
return /* @__PURE__ */
|
|
2465
|
+
return /* @__PURE__ */ z("tr", {
|
|
2467
2466
|
"data-path": i.path,
|
|
2468
2467
|
"aria-selected": o,
|
|
2469
2468
|
className: ["seed-fm-row", f].filter(Boolean).join(" "),
|
|
2470
2469
|
onClick: (t) => r(e, n, t),
|
|
2471
2470
|
children: [
|
|
2472
|
-
/* @__PURE__ */
|
|
2471
|
+
/* @__PURE__ */ R("td", {
|
|
2473
2472
|
onClick: (e) => e.stopPropagation(),
|
|
2474
|
-
children: /* @__PURE__ */
|
|
2473
|
+
children: /* @__PURE__ */ R("input", {
|
|
2475
2474
|
type: "checkbox",
|
|
2476
2475
|
className: "seed-fm-checkbox",
|
|
2477
2476
|
checked: o,
|
|
@@ -2480,61 +2479,61 @@ function $n({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2480
2479
|
"aria-label": `Select ${i.name}`
|
|
2481
2480
|
})
|
|
2482
2481
|
}),
|
|
2483
|
-
/* @__PURE__ */
|
|
2482
|
+
/* @__PURE__ */ R("td", { children: /* @__PURE__ */ z("span", {
|
|
2484
2483
|
className: "seed-fm-namecell",
|
|
2485
|
-
children: [/* @__PURE__ */
|
|
2484
|
+
children: [/* @__PURE__ */ R(nr, {
|
|
2486
2485
|
entry: e,
|
|
2487
2486
|
size: "mini"
|
|
2488
|
-
}), /* @__PURE__ */
|
|
2487
|
+
}), /* @__PURE__ */ z("span", { children: [/* @__PURE__ */ R("button", {
|
|
2489
2488
|
type: "button",
|
|
2490
2489
|
className: "seed-fm-row-name seed-fm-row-open",
|
|
2491
2490
|
onClick: (t) => {
|
|
2492
2491
|
t.stopPropagation(), r(e, n, t);
|
|
2493
2492
|
},
|
|
2494
2493
|
children: i.name
|
|
2495
|
-
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */
|
|
2494
|
+
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */ R("span", {
|
|
2496
2495
|
className: "seed-fm-row-path",
|
|
2497
2496
|
children: i.path.slice(g.length)
|
|
2498
2497
|
})] })]
|
|
2499
2498
|
}) }),
|
|
2500
|
-
/* @__PURE__ */
|
|
2499
|
+
/* @__PURE__ */ R("td", {
|
|
2501
2500
|
className: "seed-fm-col-type",
|
|
2502
|
-
children: /* @__PURE__ */
|
|
2501
|
+
children: /* @__PURE__ */ z("span", {
|
|
2503
2502
|
className: "seed-fm-type",
|
|
2504
|
-
style:
|
|
2505
|
-
children: [
|
|
2503
|
+
style: er($(i)),
|
|
2504
|
+
children: [Cn(i), i.detectedType && /* @__PURE__ */ R("small", { children: "detected" })]
|
|
2506
2505
|
})
|
|
2507
2506
|
}),
|
|
2508
|
-
/* @__PURE__ */
|
|
2507
|
+
/* @__PURE__ */ R("td", {
|
|
2509
2508
|
className: "seed-fm-num seed-fm-col-size",
|
|
2510
2509
|
title: `${i.size.toLocaleString()} bytes`,
|
|
2511
|
-
children:
|
|
2510
|
+
children: Z(e.totalSize)
|
|
2512
2511
|
}),
|
|
2513
|
-
/* @__PURE__ */
|
|
2512
|
+
/* @__PURE__ */ R("td", {
|
|
2514
2513
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2515
|
-
title:
|
|
2516
|
-
children:
|
|
2514
|
+
title: gn(i.lastModified),
|
|
2515
|
+
children: hn(i.lastModified)
|
|
2517
2516
|
}),
|
|
2518
|
-
/* @__PURE__ */
|
|
2517
|
+
/* @__PURE__ */ z("td", {
|
|
2519
2518
|
className: "seed-fm-actions",
|
|
2520
2519
|
onClick: (e) => e.stopPropagation(),
|
|
2521
|
-
children: [/* @__PURE__ */
|
|
2520
|
+
children: [/* @__PURE__ */ R("button", {
|
|
2522
2521
|
type: "button",
|
|
2523
2522
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2524
2523
|
"aria-label": `Download ${i.name}`,
|
|
2525
2524
|
title: "Download",
|
|
2526
2525
|
onClick: () => c(e),
|
|
2527
|
-
children: /* @__PURE__ */
|
|
2526
|
+
children: /* @__PURE__ */ R(Q, {
|
|
2528
2527
|
name: "download",
|
|
2529
2528
|
size: 15
|
|
2530
2529
|
})
|
|
2531
|
-
}), /* @__PURE__ */
|
|
2530
|
+
}), /* @__PURE__ */ R("button", {
|
|
2532
2531
|
type: "button",
|
|
2533
2532
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2534
2533
|
"aria-label": s.label ? `${s.label}: ${i.name}` : `Delete ${i.name}`,
|
|
2535
2534
|
title: s.label ?? "Delete",
|
|
2536
2535
|
onClick: () => l(e),
|
|
2537
|
-
children: /* @__PURE__ */
|
|
2536
|
+
children: /* @__PURE__ */ R(Q, {
|
|
2538
2537
|
name: "trash",
|
|
2539
2538
|
size: 15
|
|
2540
2539
|
})
|
|
@@ -2548,22 +2547,22 @@ function $n({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2548
2547
|
}
|
|
2549
2548
|
//#endregion
|
|
2550
2549
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2551
|
-
var
|
|
2552
|
-
function
|
|
2553
|
-
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o =
|
|
2550
|
+
var ar = 1048576, or = 32768;
|
|
2551
|
+
function sr(e) {
|
|
2552
|
+
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = $(e.file), s = e.file.size;
|
|
2554
2553
|
return i(() => {
|
|
2555
2554
|
let e = !1, t = null;
|
|
2556
2555
|
return n({ kind: "loading" }), (async () => {
|
|
2557
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2556
|
+
if (o === "image") return t = URL.createObjectURL(await $t(r)), {
|
|
2558
2557
|
kind: "image",
|
|
2559
2558
|
url: t
|
|
2560
2559
|
};
|
|
2561
2560
|
if (o === "json" || o === "html" || o === "text") {
|
|
2562
|
-
if (s >
|
|
2561
|
+
if (s > ar) return {
|
|
2563
2562
|
kind: "none",
|
|
2564
2563
|
message: "This file is too large to preview."
|
|
2565
2564
|
};
|
|
2566
|
-
let e = await
|
|
2565
|
+
let e = await $t(r), t = e.size > or, n = await e.slice(0, or).text();
|
|
2567
2566
|
if (o === "json" && !t) try {
|
|
2568
2567
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2569
2568
|
} catch {}
|
|
@@ -2597,15 +2596,15 @@ function nr(e) {
|
|
|
2597
2596
|
o
|
|
2598
2597
|
]), t;
|
|
2599
2598
|
}
|
|
2600
|
-
function
|
|
2601
|
-
let { file: f, variants: p } = e, m =
|
|
2599
|
+
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 = $(f), h = sr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2602
2601
|
i(() => {
|
|
2603
2602
|
_(null), y(!1);
|
|
2604
2603
|
}, [f.path]), i(() => {
|
|
2605
2604
|
b.current?.focus();
|
|
2606
2605
|
}, []);
|
|
2607
2606
|
let x = `seed-fm-panel-${encodeURIComponent(f.path)}`, S = p.reduce((e, t) => e + t.file.size, 0), C;
|
|
2608
|
-
if (h.kind === "image" && !v) C = /* @__PURE__ */
|
|
2607
|
+
if (h.kind === "image" && !v) C = /* @__PURE__ */ R("img", {
|
|
2609
2608
|
src: h.url,
|
|
2610
2609
|
alt: `Preview of ${f.name}`,
|
|
2611
2610
|
onLoad: (e) => _({
|
|
@@ -2614,144 +2613,144 @@ function rr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2614
2613
|
}),
|
|
2615
2614
|
onError: () => y(!0)
|
|
2616
2615
|
});
|
|
2617
|
-
else if (h.kind === "text") C = /* @__PURE__ */
|
|
2616
|
+
else if (h.kind === "text") C = /* @__PURE__ */ z("pre", { children: [h.text, h.truncated && "\n…"] });
|
|
2618
2617
|
else if (h.kind === "loading") C = null;
|
|
2619
2618
|
else {
|
|
2620
2619
|
let e = h.kind === "none" ? h.message : "The browser can’t decode this image. The file may be corrupt or not an image.";
|
|
2621
|
-
C = /* @__PURE__ */
|
|
2620
|
+
C = /* @__PURE__ */ z("span", {
|
|
2622
2621
|
className: "seed-fm-preview-note",
|
|
2623
|
-
children: [/* @__PURE__ */
|
|
2624
|
-
name: v ? "imageOff" :
|
|
2622
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
2623
|
+
name: v ? "imageOff" : $n[m].icon,
|
|
2625
2624
|
size: 32,
|
|
2626
2625
|
strokeWidth: 1.5
|
|
2627
2626
|
}), e]
|
|
2628
2627
|
});
|
|
2629
2628
|
}
|
|
2630
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2631
|
-
return /* @__PURE__ */
|
|
2629
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(Cn(f));
|
|
2630
|
+
return /* @__PURE__ */ z("aside", {
|
|
2632
2631
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2633
2632
|
role: "dialog",
|
|
2634
2633
|
"aria-modal": "false",
|
|
2635
2634
|
"aria-labelledby": x,
|
|
2636
2635
|
children: [
|
|
2637
|
-
/* @__PURE__ */
|
|
2636
|
+
/* @__PURE__ */ z("div", {
|
|
2638
2637
|
className: "seed-fm-panel-head",
|
|
2639
2638
|
children: [
|
|
2640
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ R("h3", {
|
|
2641
2640
|
id: x,
|
|
2642
2641
|
title: f.name,
|
|
2643
2642
|
children: f.name
|
|
2644
2643
|
}),
|
|
2645
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ R("button", {
|
|
2646
2645
|
type: "button",
|
|
2647
2646
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2648
2647
|
"aria-label": "Previous file",
|
|
2649
2648
|
disabled: !n,
|
|
2650
2649
|
onClick: n ?? void 0,
|
|
2651
|
-
children: /* @__PURE__ */
|
|
2650
|
+
children: /* @__PURE__ */ R(Q, { name: "chevronLeft" })
|
|
2652
2651
|
}),
|
|
2653
|
-
/* @__PURE__ */
|
|
2652
|
+
/* @__PURE__ */ R("button", {
|
|
2654
2653
|
type: "button",
|
|
2655
2654
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2656
2655
|
"aria-label": "Next file",
|
|
2657
2656
|
disabled: !r,
|
|
2658
2657
|
onClick: r ?? void 0,
|
|
2659
|
-
children: /* @__PURE__ */
|
|
2658
|
+
children: /* @__PURE__ */ R(Q, { name: "chevronRight" })
|
|
2660
2659
|
}),
|
|
2661
|
-
/* @__PURE__ */
|
|
2660
|
+
/* @__PURE__ */ R("button", {
|
|
2662
2661
|
ref: b,
|
|
2663
2662
|
type: "button",
|
|
2664
2663
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2665
2664
|
"aria-label": "Close details",
|
|
2666
2665
|
onClick: t,
|
|
2667
|
-
children: /* @__PURE__ */
|
|
2666
|
+
children: /* @__PURE__ */ R(Q, { name: "x" })
|
|
2668
2667
|
})
|
|
2669
2668
|
]
|
|
2670
2669
|
}),
|
|
2671
|
-
/* @__PURE__ */
|
|
2670
|
+
/* @__PURE__ */ z("div", {
|
|
2672
2671
|
className: "seed-fm-panel-body",
|
|
2673
2672
|
children: [
|
|
2674
|
-
/* @__PURE__ */
|
|
2673
|
+
/* @__PURE__ */ R("div", {
|
|
2675
2674
|
className: [
|
|
2676
2675
|
"seed-fm-preview",
|
|
2677
2676
|
w ? "seed-fm-thumb--checker" : "",
|
|
2678
2677
|
h.kind === "loading" ? "seed-fm-skeleton" : ""
|
|
2679
2678
|
].filter(Boolean).join(" "),
|
|
2680
|
-
style:
|
|
2679
|
+
style: er(m),
|
|
2681
2680
|
children: C
|
|
2682
2681
|
}),
|
|
2683
|
-
/* @__PURE__ */
|
|
2682
|
+
/* @__PURE__ */ z("dl", {
|
|
2684
2683
|
className: "seed-fm-details",
|
|
2685
2684
|
children: [
|
|
2686
|
-
/* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ R("dt", { children: "Path" }),
|
|
2686
|
+
/* @__PURE__ */ R("dd", { children: /* @__PURE__ */ z("span", {
|
|
2688
2687
|
className: "seed-fm-path",
|
|
2689
|
-
children: [/* @__PURE__ */
|
|
2688
|
+
children: [/* @__PURE__ */ R("code", { children: f.path }), /* @__PURE__ */ R("button", {
|
|
2690
2689
|
type: "button",
|
|
2691
2690
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2692
2691
|
"aria-label": "Copy path",
|
|
2693
2692
|
title: "Copy path",
|
|
2694
2693
|
onClick: u,
|
|
2695
|
-
children: /* @__PURE__ */
|
|
2694
|
+
children: /* @__PURE__ */ R(Q, {
|
|
2696
2695
|
name: "copy",
|
|
2697
2696
|
size: 13
|
|
2698
2697
|
})
|
|
2699
2698
|
})]
|
|
2700
2699
|
}) }),
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
|
|
2700
|
+
/* @__PURE__ */ R("dt", { children: "Size" }),
|
|
2701
|
+
/* @__PURE__ */ z("dd", { children: [
|
|
2702
|
+
Z(f.size),
|
|
2704
2703
|
" ",
|
|
2705
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ z("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2706
2705
|
] }),
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ R("dt", { children: "Type" }),
|
|
2707
|
+
/* @__PURE__ */ z("dd", { children: [Cn(f), f.detectedType && /* @__PURE__ */ z("small", { children: [
|
|
2709
2708
|
" from file contents. File.type is “",
|
|
2710
2709
|
f.type,
|
|
2711
2710
|
"”"
|
|
2712
2711
|
] })] }),
|
|
2713
|
-
g && /* @__PURE__ */
|
|
2712
|
+
g && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("dt", { children: "Dimensions" }), /* @__PURE__ */ z("dd", { children: [
|
|
2714
2713
|
g.width.toLocaleString(),
|
|
2715
2714
|
" × ",
|
|
2716
2715
|
g.height.toLocaleString(),
|
|
2717
2716
|
" px"
|
|
2718
2717
|
] })] }),
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
|
|
2718
|
+
/* @__PURE__ */ R("dt", { children: "Modified" }),
|
|
2719
|
+
/* @__PURE__ */ z("dd", { children: [
|
|
2720
|
+
gn(f.lastModified),
|
|
2722
2721
|
" ",
|
|
2723
|
-
/* @__PURE__ */
|
|
2722
|
+
/* @__PURE__ */ R("small", { children: hn(f.lastModified) })
|
|
2724
2723
|
] })
|
|
2725
2724
|
]
|
|
2726
2725
|
}),
|
|
2727
|
-
p.length > 0 && /* @__PURE__ */
|
|
2726
|
+
p.length > 0 && /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ z("div", {
|
|
2728
2727
|
className: "seed-fm-section-label",
|
|
2729
|
-
children: ["Resized copies · ",
|
|
2730
|
-
}), /* @__PURE__ */
|
|
2728
|
+
children: ["Resized copies · ", Z(S)]
|
|
2729
|
+
}), /* @__PURE__ */ R("ul", {
|
|
2731
2730
|
className: "seed-fm-variants",
|
|
2732
|
-
children: p.map((e) => /* @__PURE__ */
|
|
2731
|
+
children: p.map((e) => /* @__PURE__ */ z("li", {
|
|
2733
2732
|
title: e.file.path,
|
|
2734
|
-
children: [/* @__PURE__ */
|
|
2733
|
+
children: [/* @__PURE__ */ z("span", { children: [e.width, "w · webp"] }), /* @__PURE__ */ R("span", { children: Z(e.file.size) })]
|
|
2735
2734
|
}, e.file.path))
|
|
2736
2735
|
})] })
|
|
2737
2736
|
]
|
|
2738
2737
|
}),
|
|
2739
|
-
/* @__PURE__ */
|
|
2738
|
+
/* @__PURE__ */ z("div", {
|
|
2740
2739
|
className: "seed-fm-panel-foot",
|
|
2741
|
-
children: [/* @__PURE__ */
|
|
2740
|
+
children: [/* @__PURE__ */ z("button", {
|
|
2742
2741
|
type: "button",
|
|
2743
2742
|
className: "seed-fm-btn seed-fm-btn--primary",
|
|
2744
2743
|
onClick: a,
|
|
2745
|
-
children: [/* @__PURE__ */
|
|
2744
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
2746
2745
|
name: "download",
|
|
2747
2746
|
size: 15
|
|
2748
2747
|
}), " Download"]
|
|
2749
|
-
}), /* @__PURE__ */
|
|
2748
|
+
}), /* @__PURE__ */ z("button", {
|
|
2750
2749
|
type: "button",
|
|
2751
2750
|
className: `seed-fm-btn${l.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
2752
2751
|
onClick: o,
|
|
2753
2752
|
children: [
|
|
2754
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ R(Q, {
|
|
2755
2754
|
name: "trash",
|
|
2756
2755
|
size: 15
|
|
2757
2756
|
}),
|
|
@@ -2765,18 +2764,18 @@ function rr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2765
2764
|
}
|
|
2766
2765
|
//#endregion
|
|
2767
2766
|
//#region src/OPFSFilesManager/styles.ts
|
|
2768
|
-
var
|
|
2767
|
+
var lr = "seed-opfs-files-manager-styles", ur = "seed-opfs-files-manager", dr = "\n --seed-bg: #fbfcfb;\n --seed-surface: #ffffff;\n --seed-sunken: #f0f3f1;\n --seed-hover: #e9eeeb;\n --seed-fg: #18211d;\n --seed-fg-muted: #5a6861;\n --seed-fg-faint: #8a978f;\n --seed-border: #dfe5e1;\n --seed-border-strong: #c5cfc9;\n --seed-accent: #2c6b59;\n --seed-accent-fg: #ffffff;\n --seed-accent-soft: #e0eee8;\n --seed-danger: #b4332a;\n --seed-danger-fg: #ffffff;\n --seed-danger-soft: #fbe7e4;\n --seed-danger-inverse: #ff9a8f;\n --seed-warn: #8a5208;\n --seed-warn-soft: #fdf1dc;\n --seed-kind-image: #2f7d68;\n --seed-kind-database: #6a4fb3;\n --seed-kind-json: #a2620e;\n --seed-kind-html: #b0413a;\n --seed-kind-text: #3f6f9a;\n --seed-kind-other: #66736c;\n --seed-checker-a: #eef1ef;\n --seed-checker-b: #ffffff;\n --seed-shadow: 0 10px 30px rgb(16 24 20 / 0.14), 0 2px 6px rgb(16 24 20 / 0.08);\n --seed-backdrop: rgb(8 12 10 / 0.42);\n", fr = "\n --seed-bg: #111816;\n --seed-surface: #171f1c;\n --seed-sunken: #1d2723;\n --seed-hover: #24302b;\n --seed-fg: #e4ebe7;\n --seed-fg-muted: #9daba3;\n --seed-fg-faint: #6f7d76;\n --seed-border: #29342f;\n --seed-border-strong: #3a4842;\n --seed-accent: #6cc0a3;\n --seed-accent-fg: #0c1a15;\n --seed-accent-soft: #1c3a30;\n --seed-danger: #f08277;\n --seed-danger-fg: #2a0d0a;\n --seed-danger-soft: #3b1c19;\n --seed-danger-inverse: #b4332a;\n --seed-warn: #e9b062;\n --seed-warn-soft: #382a14;\n --seed-kind-image: #6cc0a3;\n --seed-kind-database: #b29cf0;\n --seed-kind-json: #e3ad5c;\n --seed-kind-html: #ef8a80;\n --seed-kind-text: #8fb8de;\n --seed-kind-other: #9aa8a0;\n --seed-checker-a: #1d2723;\n --seed-checker-b: #24302b;\n --seed-shadow: 0 12px 34px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);\n --seed-backdrop: rgb(0 0 0 / 0.55);\n color-scheme: dark;\n", pr = `@layer ${ur} {\n${`
|
|
2769
2768
|
.seed-fm {
|
|
2770
|
-
${
|
|
2769
|
+
${dr}
|
|
2771
2770
|
--seed-radius-sm: 6px;
|
|
2772
2771
|
--seed-radius-md: 8px;
|
|
2773
2772
|
--seed-radius-lg: 12px;
|
|
2774
2773
|
--seed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
2775
2774
|
color-scheme: light;
|
|
2776
2775
|
}
|
|
2777
|
-
.seed-fm[data-seed-theme="dark"] { ${
|
|
2776
|
+
.seed-fm[data-seed-theme="dark"] { ${fr} }
|
|
2778
2777
|
@media (prefers-color-scheme: dark) {
|
|
2779
|
-
.seed-fm[data-seed-theme="system"] { ${
|
|
2778
|
+
.seed-fm[data-seed-theme="system"] { ${fr} }
|
|
2780
2779
|
}
|
|
2781
2780
|
|
|
2782
2781
|
.seed-fm { position: relative; color: var(--seed-fg); background: var(--seed-bg); font-family: inherit; font-size: 14px; line-height: 1.45; }
|
|
@@ -2984,14 +2983,14 @@ var ir = "seed-opfs-files-manager-styles", ar = "seed-opfs-files-manager", or =
|
|
|
2984
2983
|
.seed-fm-thumb img { transition: none; }
|
|
2985
2984
|
}
|
|
2986
2985
|
`}\n}`;
|
|
2987
|
-
function
|
|
2986
|
+
function mr() {
|
|
2988
2987
|
if (typeof document > "u" || document.getElementById("seed-opfs-files-manager-styles")) return;
|
|
2989
2988
|
let e = document.createElement("style");
|
|
2990
|
-
e.id =
|
|
2989
|
+
e.id = lr, e.textContent = pr, document.head.appendChild(e);
|
|
2991
2990
|
}
|
|
2992
2991
|
//#endregion
|
|
2993
2992
|
//#region src/OPFSFilesManager/useStorageEstimate.ts
|
|
2994
|
-
function
|
|
2993
|
+
function hr(e) {
|
|
2995
2994
|
let [t, n] = c(null);
|
|
2996
2995
|
return i(() => {
|
|
2997
2996
|
if (typeof navigator > "u" || typeof navigator.storage?.estimate != "function") return;
|
|
@@ -3008,40 +3007,40 @@ function ur(e) {
|
|
|
3008
3007
|
}
|
|
3009
3008
|
//#endregion
|
|
3010
3009
|
//#region src/OPFSFilesManager/zip.ts
|
|
3011
|
-
var
|
|
3012
|
-
function
|
|
3013
|
-
if (
|
|
3014
|
-
|
|
3010
|
+
var gr = null;
|
|
3011
|
+
function _r() {
|
|
3012
|
+
if (gr) return gr;
|
|
3013
|
+
gr = /* @__PURE__ */ new Uint32Array(256);
|
|
3015
3014
|
for (let e = 0; e < 256; e++) {
|
|
3016
3015
|
let t = e;
|
|
3017
3016
|
for (let e = 0; e < 8; e++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
3018
|
-
|
|
3017
|
+
gr[e] = t >>> 0;
|
|
3019
3018
|
}
|
|
3020
|
-
return
|
|
3019
|
+
return gr;
|
|
3021
3020
|
}
|
|
3022
|
-
function
|
|
3023
|
-
let t =
|
|
3021
|
+
function vr(e) {
|
|
3022
|
+
let t = _r(), n = 4294967295;
|
|
3024
3023
|
for (let r = 0; r < e.length; r++) n = t[(n ^ e[r]) & 255] ^ n >>> 8;
|
|
3025
3024
|
return (n ^ 4294967295) >>> 0;
|
|
3026
3025
|
}
|
|
3027
|
-
function
|
|
3026
|
+
function yr(e) {
|
|
3028
3027
|
let t = new Date(e), n = Math.max(1980, t.getFullYear());
|
|
3029
3028
|
return {
|
|
3030
3029
|
time: t.getHours() << 11 | t.getMinutes() << 5 | Math.floor(t.getSeconds() / 2),
|
|
3031
3030
|
date: n - 1980 << 9 | t.getMonth() + 1 << 5 | t.getDate()
|
|
3032
3031
|
};
|
|
3033
3032
|
}
|
|
3034
|
-
var
|
|
3035
|
-
async function
|
|
3033
|
+
var br = 2048, xr = 4294967295;
|
|
3034
|
+
async function Sr(e) {
|
|
3036
3035
|
if (e.length > 65535) throw Error("Too many files for a ZIP archive (max 65,535).");
|
|
3037
3036
|
let t = new TextEncoder(), n = [], r = [], i = 0;
|
|
3038
3037
|
for (let a of e) {
|
|
3039
|
-
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s =
|
|
3040
|
-
if (i + o.length + 30 + e.length >
|
|
3038
|
+
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s = vr(o), { time: c, date: l } = yr(a.lastModified ?? Date.now());
|
|
3039
|
+
if (i + o.length + 30 + e.length > xr) throw Error("Selection is too large for a ZIP archive (max 4 GB).");
|
|
3041
3040
|
let u = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(30));
|
|
3042
|
-
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6,
|
|
3041
|
+
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6, br, !0), u.setUint16(8, 0, !0), u.setUint16(10, c, !0), u.setUint16(12, l, !0), u.setUint32(14, s, !0), u.setUint32(18, o.length, !0), u.setUint32(22, o.length, !0), u.setUint16(26, e.length, !0), u.setUint16(28, 0, !0), n.push(u.buffer, e, o);
|
|
3043
3042
|
let d = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(46));
|
|
3044
|
-
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8,
|
|
3043
|
+
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, br, !0), d.setUint16(10, 0, !0), d.setUint16(12, c, !0), d.setUint16(14, l, !0), d.setUint32(16, s, !0), d.setUint32(20, o.length, !0), d.setUint32(24, o.length, !0), d.setUint16(28, e.length, !0), d.setUint32(42, i, !0);
|
|
3045
3044
|
let f = new Uint8Array(46 + e.length);
|
|
3046
3045
|
f.set(new Uint8Array(d.buffer), 0), f.set(e, 46), r.push(f), i += 30 + e.length + o.length;
|
|
3047
3046
|
}
|
|
@@ -3054,12 +3053,12 @@ async function _r(e) {
|
|
|
3054
3053
|
}
|
|
3055
3054
|
//#endregion
|
|
3056
3055
|
//#region src/OPFSFilesManager/OPFSFilesManager.tsx
|
|
3057
|
-
var
|
|
3058
|
-
function
|
|
3056
|
+
var Cr = "Everything this app stores in the browser’s private file system (OPFS).", wr = 4e3, Tr = (e) => e instanceof Error ? e.message : String(e), Er = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, Dr = (e) => (e ?? "").split("/").filter(Boolean).join("/");
|
|
3057
|
+
function Or(e, t) {
|
|
3059
3058
|
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
3060
3059
|
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
3061
3060
|
}
|
|
3062
|
-
function
|
|
3061
|
+
function kr() {
|
|
3063
3062
|
let [e, t] = c([]), r = s(/* @__PURE__ */ new Set());
|
|
3064
3063
|
return i(() => {
|
|
3065
3064
|
let e = r.current;
|
|
@@ -3075,12 +3074,12 @@ function wr() {
|
|
|
3075
3074
|
}]);
|
|
3076
3075
|
let a = setTimeout(() => {
|
|
3077
3076
|
r.current.delete(a), t((e) => e.filter((e) => e.id !== i));
|
|
3078
|
-
},
|
|
3077
|
+
}, wr);
|
|
3079
3078
|
r.current.add(a);
|
|
3080
3079
|
}, [])
|
|
3081
3080
|
};
|
|
3082
3081
|
}
|
|
3083
|
-
var
|
|
3082
|
+
var Ar = [
|
|
3084
3083
|
"image",
|
|
3085
3084
|
"database",
|
|
3086
3085
|
"json",
|
|
@@ -3088,195 +3087,195 @@ var Tr = [
|
|
|
3088
3087
|
"text",
|
|
3089
3088
|
"other"
|
|
3090
3089
|
];
|
|
3091
|
-
function
|
|
3092
|
-
let n =
|
|
3093
|
-
label:
|
|
3090
|
+
function jr({ files: e, estimate: t }) {
|
|
3091
|
+
let n = In(e), r = e.reduce((e, t) => e + t.size, 0), i = t ? Math.max(0, t.usage - r) : 0, a = r + i, o = [...Ar.filter((e) => n[e] > 0).map((e) => ({
|
|
3092
|
+
label: $n[e].label,
|
|
3094
3093
|
size: n[e],
|
|
3095
|
-
color:
|
|
3094
|
+
color: $n[e].color
|
|
3096
3095
|
})), ...i > 0 ? [{
|
|
3097
3096
|
label: "Other site data",
|
|
3098
3097
|
size: i,
|
|
3099
3098
|
color: "var(--seed-border-strong)"
|
|
3100
3099
|
}] : []];
|
|
3101
|
-
return /* @__PURE__ */
|
|
3100
|
+
return /* @__PURE__ */ z("div", {
|
|
3102
3101
|
className: "seed-fm-usage",
|
|
3103
3102
|
title: "From navigator.storage.estimate(). Browsers round these numbers.",
|
|
3104
|
-
children: [/* @__PURE__ */
|
|
3103
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3105
3104
|
className: "seed-fm-usage-row",
|
|
3106
|
-
children: [/* @__PURE__ */
|
|
3107
|
-
/* @__PURE__ */
|
|
3105
|
+
children: [/* @__PURE__ */ z("span", { children: [
|
|
3106
|
+
/* @__PURE__ */ R("strong", { children: Z(t ? t.usage : r) }),
|
|
3108
3107
|
" ",
|
|
3109
|
-
t ? "used by this site" : `in ${
|
|
3110
|
-
] }), t && /* @__PURE__ */
|
|
3111
|
-
}), a > 0 && /* @__PURE__ */
|
|
3108
|
+
t ? "used by this site" : `in ${Er(e.length, "file")}`
|
|
3109
|
+
] }), t && /* @__PURE__ */ z("span", { children: [Z(t.quota), " available"] })]
|
|
3110
|
+
}), a > 0 && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("div", {
|
|
3112
3111
|
className: "seed-fm-meter",
|
|
3113
3112
|
role: "img",
|
|
3114
3113
|
"aria-label": "Storage used, by file type",
|
|
3115
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3114
|
+
children: o.map((e) => /* @__PURE__ */ R("span", { style: {
|
|
3116
3115
|
width: `${e.size / a * 100}%`,
|
|
3117
3116
|
background: e.color
|
|
3118
3117
|
} }, e.label))
|
|
3119
|
-
}), /* @__PURE__ */
|
|
3118
|
+
}), /* @__PURE__ */ R("ul", {
|
|
3120
3119
|
className: "seed-fm-legend",
|
|
3121
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3120
|
+
children: o.map((e) => /* @__PURE__ */ z("li", {
|
|
3122
3121
|
style: { "--seed-swatch": e.color },
|
|
3123
3122
|
children: [
|
|
3124
3123
|
e.label,
|
|
3125
3124
|
" ",
|
|
3126
|
-
|
|
3125
|
+
Z(e.size)
|
|
3127
3126
|
]
|
|
3128
3127
|
}, e.label))
|
|
3129
3128
|
})] })]
|
|
3130
3129
|
});
|
|
3131
3130
|
}
|
|
3132
|
-
function
|
|
3133
|
-
return /* @__PURE__ */
|
|
3131
|
+
function Mr({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3132
|
+
return /* @__PURE__ */ z("div", {
|
|
3134
3133
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3135
3134
|
role: r === "error" ? "alert" : void 0,
|
|
3136
3135
|
children: [
|
|
3137
|
-
/* @__PURE__ */
|
|
3136
|
+
/* @__PURE__ */ R("span", {
|
|
3138
3137
|
className: "seed-fm-state-icon",
|
|
3139
|
-
children: /* @__PURE__ */
|
|
3138
|
+
children: /* @__PURE__ */ R(Q, {
|
|
3140
3139
|
name: e,
|
|
3141
3140
|
size: 22
|
|
3142
3141
|
})
|
|
3143
3142
|
}),
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
/* @__PURE__ */
|
|
3143
|
+
/* @__PURE__ */ R("h3", { children: t }),
|
|
3144
|
+
/* @__PURE__ */ R("p", { children: n }),
|
|
3146
3145
|
i
|
|
3147
3146
|
]
|
|
3148
3147
|
});
|
|
3149
3148
|
}
|
|
3150
|
-
function
|
|
3149
|
+
function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDownload: l, title: u = "Files", description: d = Cr, headingLevel: f = 2, theme: p = "system", className: m, classNames: h = {}, defaultView: g, groupImageVariants: _ = !0, deleteWarning: v = Ln, confirmDelete: y, deleteAction: b, onNotify: x }) {
|
|
3151
3150
|
a(() => {
|
|
3152
|
-
p !== "none" &&
|
|
3151
|
+
p !== "none" && mr();
|
|
3153
3152
|
}, [p]);
|
|
3154
|
-
let S =
|
|
3155
|
-
i(() =>
|
|
3156
|
-
let
|
|
3157
|
-
i(() =>
|
|
3158
|
-
let [
|
|
3159
|
-
x ? x(e, t, n) :
|
|
3160
|
-
},
|
|
3161
|
-
query:
|
|
3153
|
+
let S = Dr(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: ee, hasLoaded: E, error: D, errorName: te, refetch: ne } = un({ rootPath: e }), re = o(() => t ? T.filter(t) : T, [T, t]), ie = hr(T), [O, ae] = c(_);
|
|
3154
|
+
i(() => ae(_), [_]);
|
|
3155
|
+
let k = o(() => Mn(re, O), [re, O]), [A, oe] = c(S);
|
|
3156
|
+
i(() => oe(S), [S]);
|
|
3157
|
+
let [j, se] = c(""), [ce, le] = c("name"), [ue, de] = c(g), [M, N] = c(() => /* @__PURE__ */ new Set()), fe = s(null), [pe, P] = c(null), F = s(null), [I, me] = c(null), [B, he] = c(null), [V, H] = c(!1), { toasts: ge, showToast: _e } = kr(), U = (e, t, n) => {
|
|
3158
|
+
x ? x(e, t, n) : _e(e, t);
|
|
3159
|
+
}, ve = o(() => Pn(k, A, {
|
|
3160
|
+
query: j,
|
|
3162
3161
|
sort: ce
|
|
3163
3162
|
}), [
|
|
3163
|
+
k,
|
|
3164
3164
|
A,
|
|
3165
3165
|
j,
|
|
3166
|
-
oe,
|
|
3167
3166
|
ce
|
|
3168
|
-
]),
|
|
3167
|
+
]), W = ve.entries, ye = W.length ? W.filter((e) => $(e.file) === "image").length / W.length : 0, G = ue ?? (ye >= .5 ? "grid" : "list"), be = o(() => new Map(k.map((e) => [e.file.path, e])), [k]), xe = o(() => [...M].map((e) => be.get(e)).filter((e) => !!e), [M, be]), K = pe ? be.get(pe) ?? null : null, q = K ? W.indexOf(K) : -1;
|
|
3169
3168
|
i(() => {
|
|
3170
3169
|
N((e) => {
|
|
3171
3170
|
let t = new Set([...e].filter((e) => be.has(e)));
|
|
3172
3171
|
return t.size === e.size ? e : t;
|
|
3173
3172
|
});
|
|
3174
3173
|
}, [be]);
|
|
3175
|
-
let
|
|
3176
|
-
|
|
3177
|
-
},
|
|
3178
|
-
let r =
|
|
3174
|
+
let Se = (e) => {
|
|
3175
|
+
oe(e), se(""), N(/* @__PURE__ */ new Set()), fe.current = null, P(null);
|
|
3176
|
+
}, Ce = (e, t, n) => {
|
|
3177
|
+
let r = fe.current;
|
|
3179
3178
|
N((i) => {
|
|
3180
3179
|
let a = new Set(i);
|
|
3181
3180
|
if (n && r != null) {
|
|
3182
3181
|
let [e, n] = r < t ? [r, t] : [t, r];
|
|
3183
|
-
for (let t of
|
|
3182
|
+
for (let t of W.slice(e, n + 1)) a.add(t.file.path);
|
|
3184
3183
|
} else a.has(e.file.path) ? a.delete(e.file.path) : a.add(e.file.path);
|
|
3185
3184
|
return a;
|
|
3186
|
-
}), (!n || r == null) && (
|
|
3187
|
-
},
|
|
3188
|
-
|
|
3189
|
-
},
|
|
3190
|
-
|
|
3191
|
-
},
|
|
3185
|
+
}), (!n || r == null) && (fe.current = t);
|
|
3186
|
+
}, we = (e) => {
|
|
3187
|
+
pe || (F.current = document.activeElement), P(e);
|
|
3188
|
+
}, Te = () => {
|
|
3189
|
+
P(null), F.current?.focus?.(), F.current = null;
|
|
3190
|
+
}, J = (e, t, n) => {
|
|
3192
3191
|
let r = n.shiftKey || n.metaKey || n.ctrlKey;
|
|
3193
|
-
M.size > 0 || r ?
|
|
3192
|
+
M.size > 0 || r ? Ce(e, t, n.shiftKey) : we(e.file.path);
|
|
3194
3193
|
}, Ee = () => {
|
|
3195
|
-
let e =
|
|
3194
|
+
let e = W.every((e) => M.has(e.file.path));
|
|
3196
3195
|
N((t) => {
|
|
3197
3196
|
let n = new Set(t);
|
|
3198
|
-
for (let t of
|
|
3197
|
+
for (let t of W) e ? n.delete(t.file.path) : n.add(t.file.path);
|
|
3199
3198
|
return n;
|
|
3200
3199
|
});
|
|
3201
|
-
},
|
|
3202
|
-
l ? await l(e, t) :
|
|
3203
|
-
},
|
|
3200
|
+
}, De = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, Oe = async (e, t) => {
|
|
3201
|
+
l ? await l(e, t) : Or(e.name, t);
|
|
3202
|
+
}, ke = async (e, t) => {
|
|
3204
3203
|
if (e.length === 0) return !1;
|
|
3205
3204
|
H(!0);
|
|
3206
3205
|
try {
|
|
3207
3206
|
if (e.length === 1 && !t) {
|
|
3208
3207
|
let [t] = e;
|
|
3209
|
-
return await
|
|
3208
|
+
return await Oe(t, await $t(t.path)), !0;
|
|
3210
3209
|
}
|
|
3211
|
-
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await
|
|
3212
|
-
name: t ? e.path.slice(n.length) :
|
|
3213
|
-
data: await
|
|
3210
|
+
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) : De(e.path),
|
|
3212
|
+
data: await $t(e.path),
|
|
3214
3213
|
lastModified: e.lastModified
|
|
3215
3214
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3216
|
-
return await
|
|
3215
|
+
return await Oe({
|
|
3217
3216
|
name: i,
|
|
3218
3217
|
path: i,
|
|
3219
3218
|
size: r.size,
|
|
3220
3219
|
type: "application/zip",
|
|
3221
3220
|
lastModified: Date.now()
|
|
3222
|
-
}, r),
|
|
3221
|
+
}, r), U(`Saved ${i} with ${Er(e.length, "file")}`, "success", {
|
|
3223
3222
|
kind: "download",
|
|
3224
3223
|
paths: e.map((e) => e.path),
|
|
3225
3224
|
fileName: i
|
|
3226
3225
|
}), !0;
|
|
3227
3226
|
} catch (t) {
|
|
3228
|
-
return
|
|
3227
|
+
return U(`Couldn’t download: ${Tr(t)}`, "error", {
|
|
3229
3228
|
kind: "download",
|
|
3230
3229
|
paths: e.map((e) => e.path),
|
|
3231
|
-
error:
|
|
3230
|
+
error: Tr(t)
|
|
3232
3231
|
}), !1;
|
|
3233
3232
|
} finally {
|
|
3234
3233
|
H(!1);
|
|
3235
3234
|
}
|
|
3236
|
-
},
|
|
3235
|
+
}, Ae = (e) => ke(e.map((e) => e.file)), Y = (e, t) => e.flatMap((e) => [e.file, ...t ? e.variants.map((e) => e.file) : []]), je = (e) => {
|
|
3237
3236
|
let t = b?.(e);
|
|
3238
3237
|
return {
|
|
3239
3238
|
label: t?.label,
|
|
3240
3239
|
destructive: t?.destructive !== !1
|
|
3241
3240
|
};
|
|
3242
|
-
},
|
|
3241
|
+
}, Me = (e) => je(Y(e, !0)), Ne = async (e, t) => {
|
|
3243
3242
|
H(!0);
|
|
3244
3243
|
let i = [], a = [], o = [], s = !1;
|
|
3245
3244
|
try {
|
|
3246
3245
|
let r = await navigator.storage.getDirectory();
|
|
3247
3246
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3248
3247
|
else try {
|
|
3249
|
-
await
|
|
3248
|
+
await en(t.path, r), i.push(t.path);
|
|
3250
3249
|
} catch (e) {
|
|
3251
3250
|
a.push({
|
|
3252
3251
|
path: t.path,
|
|
3253
|
-
error:
|
|
3252
|
+
error: Tr(e)
|
|
3254
3253
|
});
|
|
3255
3254
|
}
|
|
3256
3255
|
if (t) try {
|
|
3257
|
-
s = await
|
|
3256
|
+
s = await nn(t.path, r);
|
|
3258
3257
|
} catch (e) {
|
|
3259
3258
|
a.push({
|
|
3260
3259
|
path: t.path,
|
|
3261
|
-
error:
|
|
3260
|
+
error: Tr(e)
|
|
3262
3261
|
});
|
|
3263
3262
|
}
|
|
3264
3263
|
} catch (e) {
|
|
3265
3264
|
a.push({
|
|
3266
3265
|
path: "",
|
|
3267
|
-
error:
|
|
3266
|
+
error: Tr(e)
|
|
3268
3267
|
});
|
|
3269
3268
|
}
|
|
3270
3269
|
N((e) => {
|
|
3271
3270
|
let t = new Set(e);
|
|
3272
3271
|
return i.forEach((e) => t.delete(e)), t;
|
|
3273
|
-
}),
|
|
3274
|
-
let c = [s ? `Deleted the ${t.name} folder (${
|
|
3272
|
+
}), pe && i.includes(pe) && P(null), await ne(), H(!1);
|
|
3273
|
+
let c = [s ? `Deleted the ${t.name} folder (${Er(i.length, "file")})` : i.length > 0 ? `Deleted ${Er(i.length, "file")}` : "Nothing deleted"];
|
|
3275
3274
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3276
3275
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3277
3276
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
3278
3277
|
}
|
|
3279
|
-
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`),
|
|
3278
|
+
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`), U(c.join(". "), a.length ? "error" : "success", {
|
|
3280
3279
|
kind: "delete",
|
|
3281
3280
|
deleted: i,
|
|
3282
3281
|
skipped: o,
|
|
@@ -3286,98 +3285,98 @@ function Or({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3286
3285
|
folderRemoved: s
|
|
3287
3286
|
}
|
|
3288
3287
|
}), i.length > 0 && await r?.(i);
|
|
3289
|
-
},
|
|
3288
|
+
}, Pe = async (e) => {
|
|
3290
3289
|
if (e.length === 0) return;
|
|
3291
3290
|
if (!y) {
|
|
3292
|
-
|
|
3291
|
+
me(e);
|
|
3293
3292
|
return;
|
|
3294
3293
|
}
|
|
3295
|
-
let t =
|
|
3296
|
-
await y(t) && await
|
|
3297
|
-
},
|
|
3294
|
+
let t = Y(e, !0);
|
|
3295
|
+
await y(t) && await Ne(t);
|
|
3296
|
+
}, Fe = (e) => re.filter((t) => t.path.startsWith(`${e.path}/`)), Ie = async (e) => {
|
|
3298
3297
|
if (!y) {
|
|
3299
|
-
|
|
3298
|
+
he(e);
|
|
3300
3299
|
return;
|
|
3301
3300
|
}
|
|
3302
|
-
let t =
|
|
3303
|
-
await y(t) && await
|
|
3304
|
-
},
|
|
3305
|
-
let t = () =>
|
|
3301
|
+
let t = Fe(e);
|
|
3302
|
+
await y(t) && await Ne(t, e);
|
|
3303
|
+
}, Le = (e) => {
|
|
3304
|
+
let t = () => U("Path copied", "success", {
|
|
3306
3305
|
kind: "copy-path",
|
|
3307
3306
|
path: e
|
|
3308
|
-
}), n = (t) =>
|
|
3307
|
+
}), n = (t) => U("Couldn’t copy. Select the path text instead.", "error", {
|
|
3309
3308
|
kind: "copy-path",
|
|
3310
3309
|
path: e,
|
|
3311
|
-
error: t === void 0 ? "Clipboard unavailable" :
|
|
3310
|
+
error: t === void 0 ? "Clipboard unavailable" : Tr(t)
|
|
3312
3311
|
});
|
|
3313
3312
|
try {
|
|
3314
3313
|
navigator.clipboard.writeText(e).then(t, n);
|
|
3315
3314
|
} catch (e) {
|
|
3316
3315
|
n(e);
|
|
3317
3316
|
}
|
|
3318
|
-
},
|
|
3319
|
-
if (
|
|
3317
|
+
}, Re = (e) => {
|
|
3318
|
+
if (I || B) return;
|
|
3320
3319
|
let t = e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement;
|
|
3321
3320
|
if (e.key === "Escape") {
|
|
3322
|
-
if (
|
|
3321
|
+
if (pe) Te();
|
|
3323
3322
|
else if (M.size > 0) N(/* @__PURE__ */ new Set());
|
|
3324
3323
|
else return;
|
|
3325
3324
|
e.preventDefault();
|
|
3326
|
-
} else if (
|
|
3327
|
-
let t =
|
|
3328
|
-
t &&
|
|
3325
|
+
} else if (K && !t && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
3326
|
+
let t = W[q + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3327
|
+
t && P(t.file.path), e.preventDefault();
|
|
3329
3328
|
}
|
|
3330
|
-
},
|
|
3329
|
+
}, ze = o(() => re.some((e) => kn(e.path)), [re]), Be = /(^|\/)images(\/\d+)?$/.test(A), X = [{
|
|
3331
3330
|
label: C,
|
|
3332
3331
|
path: S
|
|
3333
|
-
}, ...(
|
|
3332
|
+
}, ...(A.length > S.length ? A.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3334
3333
|
label: e,
|
|
3335
3334
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3336
|
-
}))],
|
|
3337
|
-
if (!
|
|
3335
|
+
}))], Ve = `h${f}`, He = xe.reduce((e, t) => e + t.file.size, 0), Ue;
|
|
3336
|
+
if (!rn()) Ue = /* @__PURE__ */ R(Mr, {
|
|
3338
3337
|
icon: "triangleAlert",
|
|
3339
3338
|
tone: "error",
|
|
3340
3339
|
title: "This browser doesn’t support private file storage",
|
|
3341
3340
|
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."
|
|
3342
3341
|
});
|
|
3343
3342
|
else if (D) {
|
|
3344
|
-
let e = /* @__PURE__ */
|
|
3343
|
+
let e = /* @__PURE__ */ z("button", {
|
|
3345
3344
|
type: "button",
|
|
3346
3345
|
className: "seed-fm-btn",
|
|
3347
3346
|
onClick: () => ne(),
|
|
3348
|
-
children: [/* @__PURE__ */
|
|
3347
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
3349
3348
|
name: "refresh",
|
|
3350
3349
|
size: 15
|
|
3351
3350
|
}), " Try again"]
|
|
3352
3351
|
});
|
|
3353
|
-
|
|
3352
|
+
Ue = te === "NotFoundError" && S ? /* @__PURE__ */ z(Mr, {
|
|
3354
3353
|
icon: "triangleAlert",
|
|
3355
3354
|
tone: "error",
|
|
3356
3355
|
title: `Can’t open ${S}`,
|
|
3357
3356
|
action: e,
|
|
3358
3357
|
children: [
|
|
3359
3358
|
"The folder ",
|
|
3360
|
-
/* @__PURE__ */
|
|
3359
|
+
/* @__PURE__ */ R("code", { children: S }),
|
|
3361
3360
|
" doesn’t exist in this browser’s private storage yet. Check the",
|
|
3362
3361
|
" ",
|
|
3363
|
-
/* @__PURE__ */
|
|
3362
|
+
/* @__PURE__ */ R("code", { children: "rootPath" }),
|
|
3364
3363
|
" prop, or open the app once so the SDK creates it."
|
|
3365
3364
|
]
|
|
3366
|
-
}) : /* @__PURE__ */
|
|
3365
|
+
}) : /* @__PURE__ */ R(Mr, {
|
|
3367
3366
|
icon: "triangleAlert",
|
|
3368
3367
|
tone: "error",
|
|
3369
3368
|
title: "Can’t read private storage",
|
|
3370
3369
|
action: e,
|
|
3371
3370
|
children: D
|
|
3372
3371
|
});
|
|
3373
|
-
} else
|
|
3372
|
+
} else Ue = E ? k.length === 0 ? /* @__PURE__ */ R(Mr, {
|
|
3374
3373
|
icon: "folderOpen",
|
|
3375
3374
|
title: `No files in ${C} yet`,
|
|
3376
3375
|
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."
|
|
3377
|
-
}) :
|
|
3376
|
+
}) : ve.folders.length === 0 && W.length === 0 ? j ? /* @__PURE__ */ z(Mr, {
|
|
3378
3377
|
icon: "search",
|
|
3379
|
-
title: `No matches for “${
|
|
3380
|
-
action: /* @__PURE__ */
|
|
3378
|
+
title: `No matches for “${j}”`,
|
|
3379
|
+
action: /* @__PURE__ */ R("button", {
|
|
3381
3380
|
type: "button",
|
|
3382
3381
|
className: "seed-fm-btn",
|
|
3383
3382
|
onClick: () => se(""),
|
|
@@ -3385,241 +3384,241 @@ function Or({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3385
3384
|
}),
|
|
3386
3385
|
children: [
|
|
3387
3386
|
"Search covers file names and paths in ",
|
|
3388
|
-
|
|
3387
|
+
X[X.length - 1].label,
|
|
3389
3388
|
" and every folder inside it."
|
|
3390
3389
|
]
|
|
3391
|
-
}) : /* @__PURE__ */
|
|
3390
|
+
}) : /* @__PURE__ */ R(Mr, {
|
|
3392
3391
|
icon: "folderOpen",
|
|
3393
3392
|
title: "This folder is empty",
|
|
3394
3393
|
children: "Everything in it has been deleted or filtered out."
|
|
3395
|
-
}) : /* @__PURE__ */
|
|
3394
|
+
}) : /* @__PURE__ */ z(L, { children: [ve.folders.length > 0 && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("div", {
|
|
3396
3395
|
className: "seed-fm-section-label",
|
|
3397
3396
|
children: "Folders"
|
|
3398
|
-
}), /* @__PURE__ */
|
|
3397
|
+
}), /* @__PURE__ */ R("ul", {
|
|
3399
3398
|
className: "seed-fm-folders",
|
|
3400
|
-
children:
|
|
3399
|
+
children: ve.folders.map((e) => /* @__PURE__ */ z("li", { children: [/* @__PURE__ */ z("button", {
|
|
3401
3400
|
type: "button",
|
|
3402
3401
|
className: w("folder", "seed-fm-folder"),
|
|
3403
|
-
onClick: () =>
|
|
3404
|
-
children: [/* @__PURE__ */
|
|
3402
|
+
onClick: () => Se(e.path),
|
|
3403
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
3405
3404
|
name: "folder",
|
|
3406
3405
|
size: 20,
|
|
3407
3406
|
strokeWidth: 1.75
|
|
3408
|
-
}), /* @__PURE__ */
|
|
3407
|
+
}), /* @__PURE__ */ z("span", { children: [/* @__PURE__ */ R("span", {
|
|
3409
3408
|
className: "seed-fm-folder-name",
|
|
3410
3409
|
children: e.name
|
|
3411
|
-
}), /* @__PURE__ */
|
|
3410
|
+
}), /* @__PURE__ */ z("span", {
|
|
3412
3411
|
className: "seed-fm-folder-meta",
|
|
3413
3412
|
children: [
|
|
3414
|
-
|
|
3413
|
+
Er(e.fileCount, "file"),
|
|
3415
3414
|
" · ",
|
|
3416
|
-
|
|
3415
|
+
Z(e.size)
|
|
3417
3416
|
]
|
|
3418
3417
|
})] })]
|
|
3419
|
-
}), /* @__PURE__ */
|
|
3418
|
+
}), /* @__PURE__ */ R("button", {
|
|
3420
3419
|
type: "button",
|
|
3421
3420
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon seed-fm-folder-delete",
|
|
3422
3421
|
"aria-label": `Delete folder ${e.name}`,
|
|
3423
3422
|
title: "Delete folder",
|
|
3424
|
-
disabled:
|
|
3425
|
-
onClick: () =>
|
|
3426
|
-
children: /* @__PURE__ */
|
|
3423
|
+
disabled: V,
|
|
3424
|
+
onClick: () => Ie(e),
|
|
3425
|
+
children: /* @__PURE__ */ R(Q, {
|
|
3427
3426
|
name: "trash",
|
|
3428
3427
|
size: 15
|
|
3429
3428
|
})
|
|
3430
3429
|
})] }, e.path))
|
|
3431
|
-
})] }),
|
|
3430
|
+
})] }), W.length > 0 && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("div", {
|
|
3432
3431
|
className: "seed-fm-section-label",
|
|
3433
|
-
children:
|
|
3434
|
-
}),
|
|
3435
|
-
entries:
|
|
3432
|
+
children: j ? Er(W.length, "result") : "Files"
|
|
3433
|
+
}), G === "grid" ? /* @__PURE__ */ R(rr, {
|
|
3434
|
+
entries: W,
|
|
3436
3435
|
selected: M,
|
|
3437
|
-
onActivate:
|
|
3438
|
-
onToggle:
|
|
3436
|
+
onActivate: J,
|
|
3437
|
+
onToggle: Ce,
|
|
3439
3438
|
className: h.grid,
|
|
3440
3439
|
tileClassName: h.tile
|
|
3441
|
-
}) : /* @__PURE__ */
|
|
3442
|
-
entries:
|
|
3440
|
+
}) : /* @__PURE__ */ R(ir, {
|
|
3441
|
+
entries: W,
|
|
3443
3442
|
selected: M,
|
|
3444
|
-
cwd:
|
|
3445
|
-
onActivate:
|
|
3446
|
-
onToggle:
|
|
3443
|
+
cwd: A,
|
|
3444
|
+
onActivate: J,
|
|
3445
|
+
onToggle: Ce,
|
|
3447
3446
|
onToggleAll: Ee,
|
|
3448
|
-
onDownload: (e) =>
|
|
3449
|
-
onDelete: (e) =>
|
|
3450
|
-
deleteActionFor: (e) =>
|
|
3447
|
+
onDownload: (e) => Ae([e]),
|
|
3448
|
+
onDelete: (e) => Pe([e]),
|
|
3449
|
+
deleteActionFor: (e) => Me([e]),
|
|
3451
3450
|
className: h.list,
|
|
3452
3451
|
rowClassName: h.row
|
|
3453
|
-
})] })] }) : /* @__PURE__ */
|
|
3452
|
+
})] })] }) : /* @__PURE__ */ R("ul", {
|
|
3454
3453
|
className: w("grid", "seed-fm-grid"),
|
|
3455
3454
|
"aria-busy": "true",
|
|
3456
3455
|
"aria-label": "Loading files",
|
|
3457
|
-
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */
|
|
3456
|
+
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ R("li", {
|
|
3458
3457
|
className: "seed-fm-tile",
|
|
3459
|
-
children: /* @__PURE__ */
|
|
3458
|
+
children: /* @__PURE__ */ R("span", { className: "seed-fm-thumb seed-fm-skeleton" })
|
|
3460
3459
|
}, t))
|
|
3461
3460
|
});
|
|
3462
|
-
let
|
|
3463
|
-
return /* @__PURE__ */
|
|
3461
|
+
let We = I ? Y(I, !0) : [], Ge = B ? Fe(B) : [], Ke = M.size > 0 ? Me(xe) : null;
|
|
3462
|
+
return /* @__PURE__ */ z("div", {
|
|
3464
3463
|
className: [w("root", "seed-fm"), m].filter(Boolean).join(" "),
|
|
3465
3464
|
"data-seed-theme": p === "none" ? void 0 : p,
|
|
3466
3465
|
"data-selecting": M.size > 0 || void 0,
|
|
3467
|
-
onKeyDown:
|
|
3466
|
+
onKeyDown: Re,
|
|
3468
3467
|
children: [
|
|
3469
|
-
/* @__PURE__ */
|
|
3468
|
+
/* @__PURE__ */ z("div", {
|
|
3470
3469
|
className: "seed-fm-frame",
|
|
3471
3470
|
children: [
|
|
3472
|
-
/* @__PURE__ */
|
|
3471
|
+
/* @__PURE__ */ z("header", {
|
|
3473
3472
|
className: w("header", "seed-fm-header"),
|
|
3474
3473
|
children: [
|
|
3475
|
-
/* @__PURE__ */
|
|
3474
|
+
/* @__PURE__ */ z("div", {
|
|
3476
3475
|
className: "seed-fm-titles",
|
|
3477
|
-
children: [/* @__PURE__ */
|
|
3476
|
+
children: [/* @__PURE__ */ R(Ve, {
|
|
3478
3477
|
className: "seed-fm-title",
|
|
3479
3478
|
children: u
|
|
3480
|
-
}), d && /* @__PURE__ */
|
|
3479
|
+
}), d && /* @__PURE__ */ R("p", {
|
|
3481
3480
|
className: "seed-fm-description",
|
|
3482
3481
|
children: d
|
|
3483
3482
|
})]
|
|
3484
3483
|
}),
|
|
3485
|
-
|
|
3486
|
-
files:
|
|
3487
|
-
estimate:
|
|
3484
|
+
E && !D && /* @__PURE__ */ R(jr, {
|
|
3485
|
+
files: re,
|
|
3486
|
+
estimate: ie
|
|
3488
3487
|
}),
|
|
3489
|
-
/* @__PURE__ */
|
|
3488
|
+
/* @__PURE__ */ R("button", {
|
|
3490
3489
|
type: "button",
|
|
3491
3490
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3492
3491
|
onClick: () => ne(),
|
|
3493
3492
|
"aria-label": "Refresh",
|
|
3494
3493
|
title: "Refresh",
|
|
3495
|
-
"data-busy":
|
|
3496
|
-
children: /* @__PURE__ */
|
|
3494
|
+
"data-busy": ee && E,
|
|
3495
|
+
children: /* @__PURE__ */ R(Q, {
|
|
3497
3496
|
name: "refresh",
|
|
3498
3497
|
size: 15
|
|
3499
3498
|
})
|
|
3500
3499
|
})
|
|
3501
3500
|
]
|
|
3502
3501
|
}),
|
|
3503
|
-
|
|
3502
|
+
E && !D && k.length > 0 && /* @__PURE__ */ z("div", {
|
|
3504
3503
|
className: w("toolbar", "seed-fm-toolbar"),
|
|
3505
3504
|
children: [
|
|
3506
|
-
/* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ R("nav", {
|
|
3507
3506
|
"aria-label": "Folder",
|
|
3508
|
-
children: /* @__PURE__ */
|
|
3507
|
+
children: /* @__PURE__ */ R("ol", {
|
|
3509
3508
|
className: "seed-fm-crumbs",
|
|
3510
|
-
children:
|
|
3509
|
+
children: X.map((e, t) => /* @__PURE__ */ z("li", { children: [t > 0 && /* @__PURE__ */ R(Q, {
|
|
3511
3510
|
name: "chevronRight",
|
|
3512
3511
|
size: 14
|
|
3513
|
-
}), /* @__PURE__ */
|
|
3512
|
+
}), /* @__PURE__ */ R("button", {
|
|
3514
3513
|
type: "button",
|
|
3515
|
-
onClick: () =>
|
|
3516
|
-
"aria-current": t ===
|
|
3514
|
+
onClick: () => Se(e.path),
|
|
3515
|
+
"aria-current": t === X.length - 1 ? "page" : void 0,
|
|
3517
3516
|
children: e.label
|
|
3518
3517
|
})] }, e.path || "/"))
|
|
3519
3518
|
})
|
|
3520
3519
|
}),
|
|
3521
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ z("label", {
|
|
3522
3521
|
className: "seed-fm-search",
|
|
3523
|
-
children: [/* @__PURE__ */
|
|
3522
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
3524
3523
|
name: "search",
|
|
3525
3524
|
size: 14
|
|
3526
|
-
}), /* @__PURE__ */
|
|
3525
|
+
}), /* @__PURE__ */ R("input", {
|
|
3527
3526
|
type: "search",
|
|
3528
|
-
value:
|
|
3527
|
+
value: j,
|
|
3529
3528
|
onChange: (e) => se(e.target.value),
|
|
3530
3529
|
placeholder: "Search names and paths",
|
|
3531
3530
|
"aria-label": "Search files"
|
|
3532
3531
|
})]
|
|
3533
3532
|
}),
|
|
3534
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ z("select", {
|
|
3535
3534
|
className: "seed-fm-select",
|
|
3536
3535
|
value: ce,
|
|
3537
3536
|
onChange: (e) => le(e.target.value),
|
|
3538
3537
|
"aria-label": "Sort by",
|
|
3539
3538
|
children: [
|
|
3540
|
-
/* @__PURE__ */
|
|
3539
|
+
/* @__PURE__ */ R("option", {
|
|
3541
3540
|
value: "name",
|
|
3542
3541
|
children: "Name"
|
|
3543
3542
|
}),
|
|
3544
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ R("option", {
|
|
3545
3544
|
value: "modified",
|
|
3546
3545
|
children: "Recently modified"
|
|
3547
3546
|
}),
|
|
3548
|
-
/* @__PURE__ */
|
|
3547
|
+
/* @__PURE__ */ R("option", {
|
|
3549
3548
|
value: "size",
|
|
3550
3549
|
children: "Largest"
|
|
3551
3550
|
})
|
|
3552
3551
|
]
|
|
3553
3552
|
}),
|
|
3554
|
-
/* @__PURE__ */
|
|
3553
|
+
/* @__PURE__ */ z("div", {
|
|
3555
3554
|
className: "seed-fm-viewtoggle",
|
|
3556
3555
|
role: "group",
|
|
3557
3556
|
"aria-label": "View",
|
|
3558
|
-
children: [/* @__PURE__ */
|
|
3557
|
+
children: [/* @__PURE__ */ R("button", {
|
|
3559
3558
|
type: "button",
|
|
3560
|
-
"aria-pressed":
|
|
3559
|
+
"aria-pressed": G === "grid",
|
|
3561
3560
|
"aria-label": "Grid view",
|
|
3562
3561
|
onClick: () => de("grid"),
|
|
3563
|
-
children: /* @__PURE__ */
|
|
3562
|
+
children: /* @__PURE__ */ R(Q, {
|
|
3564
3563
|
name: "layoutGrid",
|
|
3565
3564
|
size: 15
|
|
3566
3565
|
})
|
|
3567
|
-
}), /* @__PURE__ */
|
|
3566
|
+
}), /* @__PURE__ */ R("button", {
|
|
3568
3567
|
type: "button",
|
|
3569
|
-
"aria-pressed":
|
|
3568
|
+
"aria-pressed": G === "list",
|
|
3570
3569
|
"aria-label": "List view",
|
|
3571
3570
|
onClick: () => de("list"),
|
|
3572
|
-
children: /* @__PURE__ */
|
|
3571
|
+
children: /* @__PURE__ */ R(Q, {
|
|
3573
3572
|
name: "list",
|
|
3574
3573
|
size: 15
|
|
3575
3574
|
})
|
|
3576
3575
|
})]
|
|
3577
3576
|
}),
|
|
3578
|
-
|
|
3577
|
+
ze && Be && /* @__PURE__ */ z("p", {
|
|
3579
3578
|
className: "seed-fm-hint",
|
|
3580
3579
|
children: [
|
|
3581
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ R(Q, {
|
|
3582
3581
|
name: "layers",
|
|
3583
3582
|
size: 13
|
|
3584
3583
|
}),
|
|
3585
|
-
|
|
3586
|
-
/* @__PURE__ */
|
|
3584
|
+
O ? "Resized copies are grouped with their original image." : "Resized copies are shown in their size folders.",
|
|
3585
|
+
/* @__PURE__ */ R("button", {
|
|
3587
3586
|
type: "button",
|
|
3588
3587
|
className: "seed-fm-linkbtn",
|
|
3589
3588
|
onClick: () => {
|
|
3590
|
-
|
|
3589
|
+
ae(!O), N(/* @__PURE__ */ new Set());
|
|
3591
3590
|
},
|
|
3592
|
-
children:
|
|
3591
|
+
children: O ? "Show as folders" : "Group with originals"
|
|
3593
3592
|
})
|
|
3594
3593
|
]
|
|
3595
3594
|
})
|
|
3596
3595
|
]
|
|
3597
3596
|
}),
|
|
3598
|
-
/* @__PURE__ */
|
|
3597
|
+
/* @__PURE__ */ R("div", {
|
|
3599
3598
|
className: w("body", "seed-fm-body"),
|
|
3600
|
-
children:
|
|
3599
|
+
children: Ue
|
|
3601
3600
|
}),
|
|
3602
|
-
|
|
3601
|
+
Ke && /* @__PURE__ */ z("div", {
|
|
3603
3602
|
className: w("batchBar", "seed-fm-batch"),
|
|
3604
3603
|
role: "toolbar",
|
|
3605
3604
|
"aria-label": "Selected files",
|
|
3606
3605
|
children: [
|
|
3607
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ z("span", {
|
|
3608
3607
|
className: "seed-fm-batch-count",
|
|
3609
3608
|
"aria-live": "polite",
|
|
3610
3609
|
children: [
|
|
3611
3610
|
M.size,
|
|
3612
3611
|
" selected ",
|
|
3613
|
-
/* @__PURE__ */
|
|
3612
|
+
/* @__PURE__ */ z("span", { children: ["· ", Z(He)] })
|
|
3614
3613
|
]
|
|
3615
3614
|
}),
|
|
3616
|
-
/* @__PURE__ */
|
|
3615
|
+
/* @__PURE__ */ z("button", {
|
|
3617
3616
|
type: "button",
|
|
3618
3617
|
className: "seed-fm-btn",
|
|
3619
|
-
disabled:
|
|
3620
|
-
onClick: () =>
|
|
3618
|
+
disabled: V,
|
|
3619
|
+
onClick: () => Ae(xe),
|
|
3621
3620
|
children: [
|
|
3622
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ R(Q, {
|
|
3623
3622
|
name: "download",
|
|
3624
3623
|
size: 15
|
|
3625
3624
|
}),
|
|
@@ -3627,26 +3626,26 @@ function Or({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3627
3626
|
M.size > 1 ? "Download .zip" : "Download"
|
|
3628
3627
|
]
|
|
3629
3628
|
}),
|
|
3630
|
-
/* @__PURE__ */
|
|
3629
|
+
/* @__PURE__ */ z("button", {
|
|
3631
3630
|
type: "button",
|
|
3632
|
-
className: `seed-fm-btn${
|
|
3633
|
-
disabled:
|
|
3634
|
-
onClick: () =>
|
|
3631
|
+
className: `seed-fm-btn${Ke.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
3632
|
+
disabled: V,
|
|
3633
|
+
onClick: () => Pe(xe),
|
|
3635
3634
|
children: [
|
|
3636
|
-
/* @__PURE__ */
|
|
3635
|
+
/* @__PURE__ */ R(Q, {
|
|
3637
3636
|
name: "trash",
|
|
3638
3637
|
size: 15
|
|
3639
3638
|
}),
|
|
3640
3639
|
" ",
|
|
3641
|
-
|
|
3640
|
+
Ke.label ?? "Delete"
|
|
3642
3641
|
]
|
|
3643
3642
|
}),
|
|
3644
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ R("button", {
|
|
3645
3644
|
type: "button",
|
|
3646
3645
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3647
3646
|
"aria-label": "Clear selection",
|
|
3648
3647
|
onClick: () => N(/* @__PURE__ */ new Set()),
|
|
3649
|
-
children: /* @__PURE__ */
|
|
3648
|
+
children: /* @__PURE__ */ R(Q, {
|
|
3650
3649
|
name: "x",
|
|
3651
3650
|
size: 15
|
|
3652
3651
|
})
|
|
@@ -3655,49 +3654,49 @@ function Or({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3655
3654
|
})
|
|
3656
3655
|
]
|
|
3657
3656
|
}),
|
|
3658
|
-
|
|
3659
|
-
entry:
|
|
3657
|
+
K && /* @__PURE__ */ R(cr, {
|
|
3658
|
+
entry: K,
|
|
3660
3659
|
className: h.panel,
|
|
3661
|
-
onClose:
|
|
3662
|
-
onPrevious:
|
|
3663
|
-
onNext:
|
|
3664
|
-
onDownload: () =>
|
|
3665
|
-
onDelete: () =>
|
|
3666
|
-
deleteAction:
|
|
3667
|
-
onCopyPath: () =>
|
|
3660
|
+
onClose: Te,
|
|
3661
|
+
onPrevious: q > 0 ? () => P(W[q - 1].file.path) : null,
|
|
3662
|
+
onNext: q >= 0 && q < W.length - 1 ? () => P(W[q + 1].file.path) : null,
|
|
3663
|
+
onDownload: () => Ae([K]),
|
|
3664
|
+
onDelete: () => Pe([K]),
|
|
3665
|
+
deleteAction: Me([K]),
|
|
3666
|
+
onCopyPath: () => Le(K.file.path)
|
|
3668
3667
|
}, "panel"),
|
|
3669
|
-
|
|
3670
|
-
entries:
|
|
3668
|
+
I && /* @__PURE__ */ R(xn, {
|
|
3669
|
+
entries: I,
|
|
3671
3670
|
rootPath: S,
|
|
3672
|
-
warning: v(
|
|
3673
|
-
deleteActionFor: (e) =>
|
|
3671
|
+
warning: v(We),
|
|
3672
|
+
deleteActionFor: (e) => je(Y(I, e)),
|
|
3674
3673
|
className: h.dialog,
|
|
3675
|
-
onCancel: () =>
|
|
3674
|
+
onCancel: () => me(null),
|
|
3676
3675
|
onConfirm: (e) => {
|
|
3677
|
-
let t =
|
|
3678
|
-
|
|
3676
|
+
let t = Y(I, e);
|
|
3677
|
+
me(null), Ne(t);
|
|
3679
3678
|
}
|
|
3680
3679
|
}),
|
|
3681
|
-
|
|
3682
|
-
folder:
|
|
3683
|
-
files:
|
|
3684
|
-
hiddenCount: T.filter((e) => e.path.startsWith(`${
|
|
3685
|
-
warning: v(
|
|
3686
|
-
action:
|
|
3687
|
-
busy:
|
|
3680
|
+
B && /* @__PURE__ */ R(Sn, {
|
|
3681
|
+
folder: B,
|
|
3682
|
+
files: Ge,
|
|
3683
|
+
hiddenCount: T.filter((e) => e.path.startsWith(`${B.path}/`)).length - Ge.length,
|
|
3684
|
+
warning: v(Ge),
|
|
3685
|
+
action: je(Ge),
|
|
3686
|
+
busy: V,
|
|
3688
3687
|
className: h.dialog,
|
|
3689
|
-
onDownload: () =>
|
|
3690
|
-
onCancel: () =>
|
|
3688
|
+
onDownload: () => ke(Ge, B),
|
|
3689
|
+
onCancel: () => he(null),
|
|
3691
3690
|
onConfirm: () => {
|
|
3692
|
-
|
|
3691
|
+
he(null), Ne(Ge, B);
|
|
3693
3692
|
}
|
|
3694
3693
|
}),
|
|
3695
|
-
!x && /* @__PURE__ */
|
|
3694
|
+
!x && /* @__PURE__ */ R("ul", {
|
|
3696
3695
|
className: "seed-fm-toasts",
|
|
3697
3696
|
"aria-live": "polite",
|
|
3698
|
-
children:
|
|
3697
|
+
children: ge.map((e) => /* @__PURE__ */ z("li", {
|
|
3699
3698
|
className: w("toast", `seed-fm-toast${e.tone === "error" ? " seed-fm-toast--error" : ""}`),
|
|
3700
|
-
children: [/* @__PURE__ */
|
|
3699
|
+
children: [/* @__PURE__ */ R(Q, {
|
|
3701
3700
|
name: e.tone === "error" ? "triangleAlert" : "check",
|
|
3702
3701
|
size: 15,
|
|
3703
3702
|
strokeWidth: 2.5
|
|
@@ -3709,15 +3708,15 @@ function Or({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3709
3708
|
}
|
|
3710
3709
|
//#endregion
|
|
3711
3710
|
//#region src/useEnsureLocalImage.ts
|
|
3712
|
-
var
|
|
3711
|
+
var Pr = (e) => {
|
|
3713
3712
|
try {
|
|
3714
3713
|
return e.getService?.()?.getSnapshot?.()?.context?.storageTransactionId || void 0;
|
|
3715
3714
|
} catch {
|
|
3716
3715
|
return;
|
|
3717
3716
|
}
|
|
3718
3717
|
};
|
|
3719
|
-
function
|
|
3720
|
-
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, _ =
|
|
3718
|
+
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(() => A(_) ?? A(r) ?? A(m) ?? A(g), [
|
|
3721
3720
|
_,
|
|
3722
3721
|
r,
|
|
3723
3722
|
m,
|
|
@@ -3730,7 +3729,7 @@ function Ar(e) {
|
|
|
3730
3729
|
if (!v) return [];
|
|
3731
3730
|
let e = [];
|
|
3732
3731
|
try {
|
|
3733
|
-
for (let t of
|
|
3732
|
+
for (let t of E()) {
|
|
3734
3733
|
let n = `${t.replace(/\/$/, "")}/raw/${v}`;
|
|
3735
3734
|
e.includes(n) || e.push(n);
|
|
3736
3735
|
}
|
|
@@ -3744,7 +3743,7 @@ function Ar(e) {
|
|
|
3744
3743
|
i(() => {
|
|
3745
3744
|
S(0);
|
|
3746
3745
|
}, [b]);
|
|
3747
|
-
let C = b[x],
|
|
3746
|
+
let C = b[x], T = n(() => {
|
|
3748
3747
|
S((e) => e < b.length ? e + 1 : e);
|
|
3749
3748
|
}, [b]);
|
|
3750
3749
|
return i(() => {
|
|
@@ -3755,7 +3754,7 @@ function Ar(e) {
|
|
|
3755
3754
|
else {
|
|
3756
3755
|
e || p("loading");
|
|
3757
3756
|
try {
|
|
3758
|
-
let t = await
|
|
3757
|
+
let t = await w({
|
|
3759
3758
|
transactionId: v,
|
|
3760
3759
|
fileName: y,
|
|
3761
3760
|
widths: a == null ? void 0 : [a]
|
|
@@ -3779,29 +3778,29 @@ function Ar(e) {
|
|
|
3779
3778
|
status: f,
|
|
3780
3779
|
gatewayHref: C,
|
|
3781
3780
|
gatewayHrefs: b,
|
|
3782
|
-
onGatewayError:
|
|
3781
|
+
onGatewayError: T,
|
|
3783
3782
|
result: l
|
|
3784
3783
|
};
|
|
3785
3784
|
}
|
|
3786
3785
|
//#endregion
|
|
3787
3786
|
//#region src/SeedImage.tsx
|
|
3788
|
-
var
|
|
3787
|
+
var Ir = F("seedSdk:react:SeedImage"), Lr = /* @__PURE__ */ new Map(), Rr = (e) => {
|
|
3789
3788
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
3790
3789
|
return t && t[2] ? t[2] : e;
|
|
3791
3790
|
};
|
|
3792
|
-
function
|
|
3791
|
+
function zr(e) {
|
|
3793
3792
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3794
3793
|
}
|
|
3795
|
-
function
|
|
3796
|
-
let n = RegExp(`^${
|
|
3794
|
+
function Br(e, t) {
|
|
3795
|
+
let n = RegExp(`^${zr(t)}$`), r = Rr(e);
|
|
3797
3796
|
return n.test(r);
|
|
3798
3797
|
}
|
|
3799
|
-
var
|
|
3800
|
-
let [s, l] = c(), [u, d] = c(), { property: p } =
|
|
3798
|
+
var Vr = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o }) => {
|
|
3799
|
+
let [s, l] = c(), [u, d] = c(), { property: p } = He({
|
|
3801
3800
|
propertyName: t.propertyName,
|
|
3802
3801
|
seedLocalId: t.seedLocalId,
|
|
3803
3802
|
seedUid: t.seedUid
|
|
3804
|
-
}), m = t ?? p, h = r ?? m?.refResolvedValue ?? m?.value, { status: g, gatewayHref: _, onGatewayError: v } =
|
|
3803
|
+
}), m = t ?? p, h = r ?? m?.refResolvedValue ?? m?.value, { status: g, gatewayHref: _, onGatewayError: v } = Fr({
|
|
3805
3804
|
imageProperty: m ?? t,
|
|
3806
3805
|
filename: r,
|
|
3807
3806
|
width: n,
|
|
@@ -3823,7 +3822,7 @@ var Ir = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o
|
|
|
3823
3822
|
!e && n && d(n);
|
|
3824
3823
|
}
|
|
3825
3824
|
} catch (e) {
|
|
3826
|
-
|
|
3825
|
+
Ir("_getOriginalContentUrl error", e);
|
|
3827
3826
|
}
|
|
3828
3827
|
})(), () => {
|
|
3829
3828
|
e = !0;
|
|
@@ -3839,25 +3838,25 @@ var Ir = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o
|
|
|
3839
3838
|
try {
|
|
3840
3839
|
let e = await f.getFs(), t = m?.localStoragePath ? m.localStoragePath.split("/").slice(0, -1).join("/") : f.getFilesPath("images"), r = e.readdirSync(t, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => parseInt(e.name)).filter((e) => !Number.isNaN(e));
|
|
3841
3840
|
if (r.length === 0) return;
|
|
3842
|
-
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a =
|
|
3843
|
-
if (
|
|
3844
|
-
let e =
|
|
3841
|
+
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a = Rr(h), o = `${a}-${i}`;
|
|
3842
|
+
if (Lr.has(o)) try {
|
|
3843
|
+
let e = Lr.get(o);
|
|
3845
3844
|
if (e && (await fetch(e)).ok) {
|
|
3846
3845
|
l(e);
|
|
3847
3846
|
return;
|
|
3848
3847
|
}
|
|
3849
3848
|
} catch (e) {
|
|
3850
|
-
|
|
3849
|
+
Ir("error", e), Lr.delete(o);
|
|
3851
3850
|
}
|
|
3852
|
-
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ?
|
|
3851
|
+
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ? Br(e.name, a) : !1);
|
|
3853
3852
|
if (!s) return;
|
|
3854
3853
|
let c = `${t}/${i}/${s?.name}`;
|
|
3855
3854
|
if (await f.pathExists(c)) {
|
|
3856
3855
|
let e = await f.getContentUrlFromPath(c);
|
|
3857
|
-
e && (
|
|
3856
|
+
e && (Lr.set(o, e), l(e));
|
|
3858
3857
|
}
|
|
3859
3858
|
} catch (e) {
|
|
3860
|
-
|
|
3859
|
+
Ir("_getSizedContentUrl error", e);
|
|
3861
3860
|
}
|
|
3862
3861
|
})();
|
|
3863
3862
|
}, [
|
|
@@ -3867,39 +3866,43 @@ var Ir = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o
|
|
|
3867
3866
|
h,
|
|
3868
3867
|
g
|
|
3869
3868
|
]);
|
|
3870
|
-
let T = (e) => typeof e == "string" && e.startsWith("blob:"),
|
|
3871
|
-
if (!
|
|
3872
|
-
let
|
|
3873
|
-
_ &&
|
|
3869
|
+
let T = (e) => typeof e == "string" && e.startsWith("blob:"), ee = !!s || !!u || !!S || !!b && T(b);
|
|
3870
|
+
if (!ee && !h && !_) return null;
|
|
3871
|
+
let E = s || u || S || (T(b) ? b : void 0) || (a && !ee ? _ : void 0) || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", { onError: D, ...te } = o, ne = (e) => {
|
|
3872
|
+
_ && E === _ && v(), D?.(e);
|
|
3874
3873
|
};
|
|
3875
|
-
return /* @__PURE__ */
|
|
3876
|
-
src:
|
|
3874
|
+
return /* @__PURE__ */ R("img", {
|
|
3875
|
+
src: E,
|
|
3877
3876
|
alt: o.alt || t.propertyName || "Image",
|
|
3877
|
+
width: n,
|
|
3878
3878
|
...te,
|
|
3879
3879
|
onError: ne
|
|
3880
3880
|
});
|
|
3881
|
-
}
|
|
3881
|
+
});
|
|
3882
3882
|
//#endregion
|
|
3883
3883
|
//#region src/useResolvedMediaRef.ts
|
|
3884
|
-
function
|
|
3884
|
+
function Hr(e) {
|
|
3885
3885
|
let { value: t, enabled: r = !0, treatAs: a } = e, [o, s] = c(0), [l, u] = c(null), [d, f] = c(null), [p, m] = c("idle");
|
|
3886
3886
|
i(() => {
|
|
3887
|
-
let e = !1;
|
|
3887
|
+
let e = !1, n;
|
|
3888
3888
|
return (async () => {
|
|
3889
3889
|
if (!r || t == null || String(t).trim() === "") e || (u(null), f(null), m("idle"));
|
|
3890
3890
|
else {
|
|
3891
3891
|
e || (m("loading"), f(null));
|
|
3892
3892
|
try {
|
|
3893
|
-
let
|
|
3894
|
-
if (e)
|
|
3895
|
-
|
|
3893
|
+
let r = await de(String(t), { treatAs: a }), i = r.status === "ready" && r.source === "localBlob" ? r.href : void 0;
|
|
3894
|
+
if (e) {
|
|
3895
|
+
i && URL.revokeObjectURL(i);
|
|
3896
|
+
return;
|
|
3897
|
+
}
|
|
3898
|
+
n = i, u(r), r.status === "empty" ? m("empty") : r.status === "ready" ? m("ready") : m("unresolved");
|
|
3896
3899
|
} catch (t) {
|
|
3897
3900
|
if (e) return;
|
|
3898
3901
|
f(t instanceof Error ? t : Error(String(t))), u(null), m("error");
|
|
3899
3902
|
}
|
|
3900
3903
|
}
|
|
3901
3904
|
})(), () => {
|
|
3902
|
-
e = !0;
|
|
3905
|
+
e = !0, n && URL.revokeObjectURL(n);
|
|
3903
3906
|
};
|
|
3904
3907
|
}, [
|
|
3905
3908
|
r,
|
|
@@ -3921,8 +3924,8 @@ function Lr(e) {
|
|
|
3921
3924
|
}
|
|
3922
3925
|
//#endregion
|
|
3923
3926
|
//#region src/SeedMediaImage.tsx
|
|
3924
|
-
function
|
|
3925
|
-
let { href: o } =
|
|
3927
|
+
function Ur({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
3928
|
+
let { href: o } = Hr({
|
|
3926
3929
|
value: e,
|
|
3927
3930
|
enabled: t,
|
|
3928
3931
|
treatAs: n
|
|
@@ -3933,18 +3936,18 @@ function Rr({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
3933
3936
|
src: o,
|
|
3934
3937
|
alt: i ?? ""
|
|
3935
3938
|
};
|
|
3936
|
-
return r ? /* @__PURE__ */
|
|
3939
|
+
return r ? /* @__PURE__ */ R(L, { children: r(s) }) : /* @__PURE__ */ R("img", { ...s });
|
|
3937
3940
|
}
|
|
3938
3941
|
//#endregion
|
|
3939
3942
|
//#region src/SeedMediaFile.tsx
|
|
3940
|
-
function
|
|
3943
|
+
function Wr(e) {
|
|
3941
3944
|
try {
|
|
3942
3945
|
return new URL(e).pathname.split("/").filter(Boolean).pop() || "Open";
|
|
3943
3946
|
} catch {
|
|
3944
3947
|
return "Open";
|
|
3945
3948
|
}
|
|
3946
3949
|
}
|
|
3947
|
-
function
|
|
3950
|
+
function Gr(e) {
|
|
3948
3951
|
try {
|
|
3949
3952
|
let t = new URL(e).protocol;
|
|
3950
3953
|
return t === "http:" || t === "https:";
|
|
@@ -3952,27 +3955,27 @@ function Br(e) {
|
|
|
3952
3955
|
return !1;
|
|
3953
3956
|
}
|
|
3954
3957
|
}
|
|
3955
|
-
function
|
|
3956
|
-
let { href: l } =
|
|
3958
|
+
function Kr({ value: e, enabled: t, treatAs: n, download: r, render: i, children: a, target: o, rel: s, ...c }) {
|
|
3959
|
+
let { href: l } = Hr({
|
|
3957
3960
|
value: e,
|
|
3958
3961
|
enabled: t,
|
|
3959
3962
|
treatAs: n
|
|
3960
3963
|
});
|
|
3961
3964
|
if (!l) return null;
|
|
3962
|
-
let u =
|
|
3965
|
+
let u = Gr(l), d = o === void 0 ? u ? "_blank" : void 0 : o, f = {
|
|
3963
3966
|
...c,
|
|
3964
3967
|
href: l,
|
|
3965
3968
|
download: r,
|
|
3966
3969
|
target: d,
|
|
3967
3970
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
3968
|
-
children: a ??
|
|
3971
|
+
children: a ?? Wr(l)
|
|
3969
3972
|
};
|
|
3970
|
-
return i ? /* @__PURE__ */
|
|
3973
|
+
return i ? /* @__PURE__ */ R(L, { children: i(f) }) : /* @__PURE__ */ R("a", { ...f });
|
|
3971
3974
|
}
|
|
3972
3975
|
//#endregion
|
|
3973
3976
|
//#region src/SeedMediaAudio.tsx
|
|
3974
|
-
function
|
|
3975
|
-
let { href: o } =
|
|
3977
|
+
function qr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
3978
|
+
let { href: o } = Hr({
|
|
3976
3979
|
value: e,
|
|
3977
3980
|
enabled: t,
|
|
3978
3981
|
treatAs: n
|
|
@@ -3983,12 +3986,12 @@ function Hr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
3983
3986
|
src: o,
|
|
3984
3987
|
controls: i
|
|
3985
3988
|
};
|
|
3986
|
-
return r ? /* @__PURE__ */
|
|
3989
|
+
return r ? /* @__PURE__ */ R(L, { children: r(s) }) : /* @__PURE__ */ R("audio", { ...s });
|
|
3987
3990
|
}
|
|
3988
3991
|
//#endregion
|
|
3989
3992
|
//#region src/SeedMediaVideo.tsx
|
|
3990
|
-
function
|
|
3991
|
-
let { href: o } =
|
|
3993
|
+
function Jr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
3994
|
+
let { href: o } = Hr({
|
|
3992
3995
|
value: e,
|
|
3993
3996
|
enabled: t,
|
|
3994
3997
|
treatAs: n
|
|
@@ -3999,58 +4002,63 @@ function Ur({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
3999
4002
|
src: o,
|
|
4000
4003
|
controls: i
|
|
4001
4004
|
};
|
|
4002
|
-
return r ? /* @__PURE__ */
|
|
4005
|
+
return r ? /* @__PURE__ */ R(L, { children: r(s) }) : /* @__PURE__ */ R("video", { ...s });
|
|
4003
4006
|
}
|
|
4004
4007
|
//#endregion
|
|
4005
4008
|
//#region src/SeedHtml.tsx
|
|
4006
|
-
function
|
|
4009
|
+
function Yr(e) {
|
|
4007
4010
|
return typeof e == "string" && e.trim().length > 0;
|
|
4008
4011
|
}
|
|
4009
|
-
function
|
|
4010
|
-
if (!
|
|
4012
|
+
function Xr({ html: e, sanitize: t, render: n, ...r }) {
|
|
4013
|
+
if (!Yr(e)) return null;
|
|
4011
4014
|
let i = t(e);
|
|
4012
|
-
return n ? /* @__PURE__ */
|
|
4015
|
+
return n ? /* @__PURE__ */ R(L, { children: n({ html: i }) }) : /* @__PURE__ */ R("div", {
|
|
4013
4016
|
...r,
|
|
4014
4017
|
dangerouslySetInnerHTML: { __html: i }
|
|
4015
4018
|
});
|
|
4016
4019
|
}
|
|
4017
4020
|
//#endregion
|
|
4018
4021
|
//#region src/formatSeedJson.ts
|
|
4019
|
-
function
|
|
4022
|
+
function Zr(e, t) {
|
|
4020
4023
|
return e.length <= t ? e : `${e.slice(0, t)}…`;
|
|
4021
4024
|
}
|
|
4022
|
-
function
|
|
4025
|
+
function Qr(e) {
|
|
4023
4026
|
let t = e.trim();
|
|
4024
4027
|
return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
|
|
4025
4028
|
}
|
|
4026
|
-
function
|
|
4029
|
+
function $r(e, t, n, r, i) {
|
|
4027
4030
|
if (typeof e == "bigint") return String(e);
|
|
4028
4031
|
if (typeof e == "symbol") return e.toString();
|
|
4029
4032
|
if (typeof e == "function") return "[Function]";
|
|
4030
4033
|
if (e instanceof Date) return e.toISOString();
|
|
4031
|
-
if (typeof e == "string") return
|
|
4034
|
+
if (typeof e == "string") return Zr(e, n);
|
|
4032
4035
|
if (typeof e != "object" || !e) return e;
|
|
4033
4036
|
if (i.has(e)) return "[Circular]";
|
|
4034
4037
|
if (r >= t) return "[Max depth]";
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4038
|
+
i.add(e);
|
|
4039
|
+
try {
|
|
4040
|
+
if (Array.isArray(e)) return e.map((e) => $r(e, t, n, r + 1, i));
|
|
4041
|
+
let a = {};
|
|
4042
|
+
for (let [o, s] of Object.entries(e)) a[o] = $r(s, t, n, r + 1, i);
|
|
4043
|
+
return a;
|
|
4044
|
+
} finally {
|
|
4045
|
+
i.delete(e);
|
|
4046
|
+
}
|
|
4039
4047
|
}
|
|
4040
|
-
function
|
|
4048
|
+
function ei(e, t) {
|
|
4041
4049
|
let n = t?.maxDepth ?? 6, r = t?.maxStringLength ?? 5e4, i = t?.space ?? 2;
|
|
4042
4050
|
if (e === void 0) return "undefined";
|
|
4043
4051
|
if (e === null) return "null";
|
|
4044
4052
|
let a = e;
|
|
4045
4053
|
if (typeof e == "string") {
|
|
4046
|
-
if (
|
|
4054
|
+
if (Qr(e)) try {
|
|
4047
4055
|
a = JSON.parse(e);
|
|
4048
4056
|
} catch {
|
|
4049
|
-
return
|
|
4057
|
+
return Zr(e, r);
|
|
4050
4058
|
}
|
|
4051
|
-
else return
|
|
4059
|
+
else return Zr(e, r);
|
|
4052
4060
|
}
|
|
4053
|
-
let o =
|
|
4061
|
+
let o = $r(a, n, r, 0, /* @__PURE__ */ new WeakSet());
|
|
4054
4062
|
try {
|
|
4055
4063
|
return JSON.stringify(o, null, i);
|
|
4056
4064
|
} catch {
|
|
@@ -4059,19 +4067,19 @@ function Yr(e, t) {
|
|
|
4059
4067
|
}
|
|
4060
4068
|
//#endregion
|
|
4061
4069
|
//#region src/SeedJson.tsx
|
|
4062
|
-
function
|
|
4063
|
-
let a = t ? t(e) :
|
|
4064
|
-
return r ? /* @__PURE__ */
|
|
4070
|
+
function ti({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4071
|
+
let a = t ? t(e) : ei(e, n);
|
|
4072
|
+
return r ? /* @__PURE__ */ R(L, { children: r({ text: a }) }) : /* @__PURE__ */ R("pre", {
|
|
4065
4073
|
...i,
|
|
4066
4074
|
children: a
|
|
4067
4075
|
});
|
|
4068
4076
|
}
|
|
4069
4077
|
//#endregion
|
|
4070
4078
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4071
|
-
function
|
|
4079
|
+
function ni(e, t) {
|
|
4072
4080
|
return o(() => e ? oe(e, t) : {}, [e, t]);
|
|
4073
4081
|
}
|
|
4074
4082
|
//#endregion
|
|
4075
|
-
export {
|
|
4083
|
+
export { q as ADDRESSES_PERSISTED_EVENT, It as FILES_QUERY_KEY_PREFIX, Se as LOCAL_COPIES_REMOVED_EVENT, Nr as OPFSFilesManager, pr as OPFS_FILES_MANAGER_CSS, Jt as SeedClientGate, Xr as SeedHtml, Vr as SeedImage, ti as SeedJson, qr as SeedMediaAudio, Kr as SeedMediaFile, Ur as SeedMediaImage, Jr as SeedMediaVideo, Kt as SeedProvider, Y as createSeedQueryClient, ei as formatSeedJson, Ve as getItemPropertyQueryKey, Pe as getItemQueryKey, ke as getSeedQueryDefaultOptions, $e as getServiceName, tt as getServiceUniqueKey, et as getServiceValue, Wt as invalidateItemPropertiesForItem, Ye as isDbReadyState, Ae as mergeSeedQueryDefaults, gt as useAllSchemaVersions, Re as useCreateItem, Ke as useCreateItemProperty, St as useCreateModel, jt as useCreateModelProperty, mt as useCreateSchema, Xe as useDbsAreReady, Ue as useDebouncedItemProperty, Nt as useDeleteItem, qe as useDestroyItemProperty, Ct as useDestroyModel, Mt as useDestroyModelProperty, ht as useDestroySchema, Ht as useEasSyncProcessById, Bt as useEasSyncProcesses, Vt as useEasSyncProcessesNonActiveCount, zt as useEasSyncProcessesState, Fr as useEnsureLocalImage, Lt as useFiles, ct as useGlobalServiceStatus, at as useHasSavedSnapshots, Ft as useImageFiles, K as useIsClientReady, rt as useIsDbReady, Fe as useItem, Ge as useItemProperties, He as useItemProperty, Le as useItems, J as useLiveQuery, De as useLiveQueryState, xt as useModel, Tt as useModelProperties, At as useModelProperty, bt as useModels, ni as useNormalizedFeedItemFields, un as useOPFSFiles, it as usePersistedSnapshots, ze as usePublishItem, Hr as useResolvedMediaRef, ut as useSchema, pt as useSchemas, we as useSeedAddressRevision, _t as useSeedProtocolSchema, nt as useService, st as useServices, hr as useStorageEstimate, Qn as useThumbnail };
|
|
4076
4084
|
|
|
4077
4085
|
//# sourceMappingURL=index.js.map
|