@seedprotocol/react 0.7.7 → 0.7.8-next.1034.g2acd2a2

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