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