@seedprotocol/react 0.7.13-next.1490.g7a09798 → 0.7.13-next.1534.gb51a5b1

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