@seedprotocol/react 0.7.0 → 0.7.2-next.593.gd5bd4ea

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