@seedprotocol/react 0.7.5 → 0.7.6-next.957.g6bb7768
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SeedClientGate.d.ts +3 -3
- package/dist/SeedClientGate.d.ts.map +1 -1
- package/dist/SeedProvider.d.ts +19 -4
- package/dist/SeedProvider.d.ts.map +1 -1
- package/dist/index.js +304 -279
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useInsertionEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
2
3
|
import { flushSync as l } from "react-dom";
|
|
3
4
|
import { BaseArweaveClient as u, BaseDb as d, BaseFileManager as f, ClientManagerState as p, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as m, FILES_CHANGED_EVENT as h, Item as g, ItemProperty as _, Model as v, ModelProperty as y, SEED_PROTOCOL_SCHEMA_NAME as b, Schema as x, client as S, easName as C, easSyncProcesses as w, ensureImageLocal as T, eventEmitter as E, getAddressesForItemsFilter as ee, getArweaveReadBaseUrls as D, getClient as O, getPropertySchema as te, getSchemaNameFromId as k, getVersionData as ne, loadAllSchemasFromDb as re, metadata as A, modelSchemas as j, models as M, normalizeArweaveTxIdForEnsure as ie, normalizeFeedItemFields as ae, ownedSeedsSql as oe, pickLatestMetadataRowPerProperty as se, placeholderUidSql as ce, properties as le, publisherInAddressListSql as ue, resolveMediaRef as N, schemas as P, seeds as F } from "@seedprotocol/sdk";
|
|
@@ -1439,26 +1440,50 @@ function Wt({ queryClient: e }) {
|
|
|
1439
1440
|
};
|
|
1440
1441
|
}, [e]), null;
|
|
1441
1442
|
}
|
|
1442
|
-
function Gt({
|
|
1443
|
-
let r =
|
|
1444
|
-
|
|
1443
|
+
function Gt({ config: e, addresses: t, onInitError: n }) {
|
|
1444
|
+
let r = s(n);
|
|
1445
|
+
r.current = n;
|
|
1446
|
+
let a = s(t);
|
|
1447
|
+
a.current = t;
|
|
1448
|
+
let o = JSON.stringify(t ?? null);
|
|
1449
|
+
return i(() => {
|
|
1450
|
+
let t = a.current === void 0 ? { config: e } : {
|
|
1451
|
+
config: e,
|
|
1452
|
+
addresses: a.current
|
|
1453
|
+
};
|
|
1454
|
+
S.init(t).catch((e) => {
|
|
1455
|
+
r.current ? r.current(e) : console.error("[SeedProvider] client init failed", e);
|
|
1456
|
+
});
|
|
1457
|
+
}, [e, o]), null;
|
|
1458
|
+
}
|
|
1459
|
+
function Kt({ children: e, config: t, addresses: n, onInitError: r, queryClient: i, queryClientRef: a }) {
|
|
1460
|
+
let s = o(() => i ?? X(), [i]);
|
|
1461
|
+
if (a && (a.current = s, typeof window < "u")) {
|
|
1445
1462
|
let e = window;
|
|
1446
|
-
e.__TEST_SEED_QUERY_CLIENT__ =
|
|
1463
|
+
e.__TEST_SEED_QUERY_CLIENT__ = s;
|
|
1447
1464
|
try {
|
|
1448
|
-
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ =
|
|
1465
|
+
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = s);
|
|
1449
1466
|
} catch {}
|
|
1450
1467
|
}
|
|
1451
1468
|
return /* @__PURE__ */ B(me, {
|
|
1452
|
-
client:
|
|
1469
|
+
client: s,
|
|
1453
1470
|
children: /* @__PURE__ */ V(we, {
|
|
1454
|
-
queryClient:
|
|
1455
|
-
children: [
|
|
1471
|
+
queryClient: s,
|
|
1472
|
+
children: [
|
|
1473
|
+
/* @__PURE__ */ B(Wt, { queryClient: s }),
|
|
1474
|
+
t && /* @__PURE__ */ B(Gt, {
|
|
1475
|
+
config: t,
|
|
1476
|
+
addresses: n,
|
|
1477
|
+
onInitError: r
|
|
1478
|
+
}),
|
|
1479
|
+
e
|
|
1480
|
+
]
|
|
1456
1481
|
})
|
|
1457
1482
|
});
|
|
1458
1483
|
}
|
|
1459
1484
|
//#endregion
|
|
1460
1485
|
//#region src/SeedClientGate.tsx
|
|
1461
|
-
function
|
|
1486
|
+
function qt() {
|
|
1462
1487
|
return /* @__PURE__ */ B("div", {
|
|
1463
1488
|
style: {
|
|
1464
1489
|
display: "flex",
|
|
@@ -1470,7 +1495,7 @@ function Kt() {
|
|
|
1470
1495
|
children: "Loading..."
|
|
1471
1496
|
});
|
|
1472
1497
|
}
|
|
1473
|
-
function
|
|
1498
|
+
function Jt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1474
1499
|
let l = q(), u = s(o);
|
|
1475
1500
|
u.current = o, i(() => {
|
|
1476
1501
|
let n = t ? {
|
|
@@ -1484,7 +1509,7 @@ function qt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1484
1509
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1485
1510
|
});
|
|
1486
1511
|
}, [e, t]);
|
|
1487
|
-
let d = n ?? /* @__PURE__ */ B(
|
|
1512
|
+
let d = n ?? /* @__PURE__ */ B(qt, {}), f = r ? void 0 : {
|
|
1488
1513
|
position: "relative",
|
|
1489
1514
|
display: "flex",
|
|
1490
1515
|
height: "100vh",
|
|
@@ -1519,54 +1544,54 @@ function qt({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1519
1544
|
}
|
|
1520
1545
|
//#endregion
|
|
1521
1546
|
//#region src/opfsPaths.ts
|
|
1522
|
-
function
|
|
1547
|
+
function Yt(e) {
|
|
1523
1548
|
let t = e.split("/").filter(Boolean);
|
|
1524
1549
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1525
1550
|
return t;
|
|
1526
1551
|
}
|
|
1527
|
-
async function
|
|
1552
|
+
async function Xt(e, t) {
|
|
1528
1553
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1529
1554
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1530
1555
|
return n;
|
|
1531
1556
|
}
|
|
1532
|
-
async function
|
|
1533
|
-
let n =
|
|
1557
|
+
async function Zt(e, t) {
|
|
1558
|
+
let n = Yt(e), r = n.pop();
|
|
1534
1559
|
return {
|
|
1535
|
-
dir: await
|
|
1560
|
+
dir: await Xt(n.join("/"), t),
|
|
1536
1561
|
name: r
|
|
1537
1562
|
};
|
|
1538
1563
|
}
|
|
1539
|
-
async function Zt(e, t) {
|
|
1540
|
-
let { dir: n, name: r } = await Xt(e, t);
|
|
1541
|
-
return n.getFileHandle(r);
|
|
1542
|
-
}
|
|
1543
1564
|
async function Qt(e, t) {
|
|
1544
|
-
|
|
1565
|
+
let { dir: n, name: r } = await Zt(e, t);
|
|
1566
|
+
return n.getFileHandle(r);
|
|
1545
1567
|
}
|
|
1546
1568
|
async function $t(e, t) {
|
|
1547
|
-
|
|
1548
|
-
await n.removeEntry(r);
|
|
1569
|
+
return (await Qt(e, t)).getFile();
|
|
1549
1570
|
}
|
|
1550
1571
|
async function en(e, t) {
|
|
1572
|
+
let { dir: n, name: r } = await Zt(e, t);
|
|
1573
|
+
await n.removeEntry(r);
|
|
1574
|
+
}
|
|
1575
|
+
async function tn(e, t) {
|
|
1551
1576
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1552
1577
|
for await (let e of n.entries()) r.push(e);
|
|
1553
1578
|
let i = !0;
|
|
1554
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1579
|
+
for (let [e, t] of r) (t.kind === "file" || !await tn(n, e)) && (i = !1);
|
|
1555
1580
|
return i && await e.removeEntry(t), i;
|
|
1556
1581
|
}
|
|
1557
|
-
async function
|
|
1582
|
+
async function nn(e, t) {
|
|
1558
1583
|
try {
|
|
1559
|
-
let { dir: n, name: r } = await
|
|
1560
|
-
return await
|
|
1584
|
+
let { dir: n, name: r } = await Zt(e, t);
|
|
1585
|
+
return await tn(n, r);
|
|
1561
1586
|
} catch (e) {
|
|
1562
1587
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1563
1588
|
throw e;
|
|
1564
1589
|
}
|
|
1565
1590
|
}
|
|
1566
|
-
function
|
|
1591
|
+
function rn() {
|
|
1567
1592
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1568
1593
|
}
|
|
1569
|
-
var
|
|
1594
|
+
var an = [
|
|
1570
1595
|
{
|
|
1571
1596
|
type: "image/jpeg",
|
|
1572
1597
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1577,43 +1602,43 @@ var rn = [
|
|
|
1577
1602
|
},
|
|
1578
1603
|
{
|
|
1579
1604
|
type: "image/gif",
|
|
1580
|
-
test: (e) =>
|
|
1605
|
+
test: (e) => on(e, 0, 4) === "GIF8"
|
|
1581
1606
|
},
|
|
1582
1607
|
{
|
|
1583
1608
|
type: "image/webp",
|
|
1584
|
-
test: (e) =>
|
|
1609
|
+
test: (e) => on(e, 0, 4) === "RIFF" && on(e, 8, 12) === "WEBP"
|
|
1585
1610
|
},
|
|
1586
1611
|
{
|
|
1587
1612
|
type: "image/avif",
|
|
1588
|
-
test: (e) =>
|
|
1613
|
+
test: (e) => on(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(on(e, 8, 12))
|
|
1589
1614
|
},
|
|
1590
1615
|
{
|
|
1591
1616
|
type: "application/vnd.sqlite3",
|
|
1592
|
-
test: (e) =>
|
|
1617
|
+
test: (e) => on(e, 0, 15) === "SQLite format 3"
|
|
1593
1618
|
},
|
|
1594
1619
|
{
|
|
1595
1620
|
type: "application/pdf",
|
|
1596
|
-
test: (e) =>
|
|
1621
|
+
test: (e) => on(e, 0, 5) === "%PDF-"
|
|
1597
1622
|
}
|
|
1598
1623
|
];
|
|
1599
|
-
function
|
|
1624
|
+
function on(e, t, n) {
|
|
1600
1625
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1601
1626
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1627
|
+
function sn(e) {
|
|
1628
|
+
return an.find((t) => t.test(e))?.type;
|
|
1604
1629
|
}
|
|
1605
|
-
async function
|
|
1606
|
-
if (e.size !== 0) return
|
|
1630
|
+
async function cn(e) {
|
|
1631
|
+
if (e.size !== 0) return sn(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1607
1632
|
}
|
|
1608
1633
|
//#endregion
|
|
1609
1634
|
//#region src/useOPFSFiles.ts
|
|
1610
|
-
async function
|
|
1635
|
+
async function ln(e, t = "") {
|
|
1611
1636
|
let n = [];
|
|
1612
1637
|
try {
|
|
1613
1638
|
for await (let [r, i] of e.entries()) {
|
|
1614
1639
|
let e = t ? `${t}/${r}` : r;
|
|
1615
1640
|
if (i.kind === "file") try {
|
|
1616
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1641
|
+
let t = await i.getFile(), a = t.type ? void 0 : await cn(t).catch(() => void 0);
|
|
1617
1642
|
n.push({
|
|
1618
1643
|
name: r,
|
|
1619
1644
|
path: e,
|
|
@@ -1626,7 +1651,7 @@ async function cn(e, t = "") {
|
|
|
1626
1651
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1627
1652
|
}
|
|
1628
1653
|
else if (i.kind === "directory") {
|
|
1629
|
-
let t = await
|
|
1654
|
+
let t = await ln(i, e);
|
|
1630
1655
|
n.push(...t);
|
|
1631
1656
|
}
|
|
1632
1657
|
}
|
|
@@ -1635,11 +1660,11 @@ async function cn(e, t = "") {
|
|
|
1635
1660
|
}
|
|
1636
1661
|
return n;
|
|
1637
1662
|
}
|
|
1638
|
-
function
|
|
1663
|
+
function un(e = {}) {
|
|
1639
1664
|
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 () => {
|
|
1640
1665
|
s(!0), f(null), m(null);
|
|
1641
1666
|
try {
|
|
1642
|
-
let e = await
|
|
1667
|
+
let e = await ln(await Xt(t ?? ""), t || "");
|
|
1643
1668
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1644
1669
|
} catch (e) {
|
|
1645
1670
|
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);
|
|
@@ -1660,7 +1685,7 @@ function ln(e = {}) {
|
|
|
1660
1685
|
}
|
|
1661
1686
|
//#endregion
|
|
1662
1687
|
//#region src/OPFSFilesManager/format.ts
|
|
1663
|
-
var
|
|
1688
|
+
var dn = [
|
|
1664
1689
|
"B",
|
|
1665
1690
|
"KB",
|
|
1666
1691
|
"MB",
|
|
@@ -1669,32 +1694,32 @@ var un = [
|
|
|
1669
1694
|
];
|
|
1670
1695
|
function Q(e) {
|
|
1671
1696
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1672
|
-
let t = Math.min(
|
|
1673
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1697
|
+
let t = Math.min(dn.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1698
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${dn[t]}`;
|
|
1674
1699
|
}
|
|
1675
|
-
var
|
|
1676
|
-
function
|
|
1700
|
+
var fn = 6e4, pn = 60 * fn, mn = 24 * pn;
|
|
1701
|
+
function hn(e, t = Date.now()) {
|
|
1677
1702
|
let n = t - e;
|
|
1678
|
-
if (n <
|
|
1679
|
-
if (n <
|
|
1680
|
-
if (n <
|
|
1681
|
-
let r = Math.round(n /
|
|
1703
|
+
if (n < fn) return "just now";
|
|
1704
|
+
if (n < pn) return `${Math.round(n / fn)} min ago`;
|
|
1705
|
+
if (n < mn) return `${Math.round(n / pn)} h ago`;
|
|
1706
|
+
let r = Math.round(n / mn);
|
|
1682
1707
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1683
1708
|
}
|
|
1684
|
-
function
|
|
1709
|
+
function gn(e) {
|
|
1685
1710
|
return new Date(e).toLocaleString(void 0, {
|
|
1686
1711
|
dateStyle: "medium",
|
|
1687
1712
|
timeStyle: "short"
|
|
1688
1713
|
});
|
|
1689
1714
|
}
|
|
1690
|
-
function
|
|
1715
|
+
function _n(e, t) {
|
|
1691
1716
|
if (e.length <= t) return e;
|
|
1692
1717
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1693
1718
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1694
1719
|
}
|
|
1695
1720
|
//#endregion
|
|
1696
1721
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1697
|
-
var
|
|
1722
|
+
var vn = {
|
|
1698
1723
|
check: /* @__PURE__ */ B("path", { d: "M20 6 9 17l-5-5" }),
|
|
1699
1724
|
chevronLeft: /* @__PURE__ */ B("path", { d: "m15 18-6-6 6-6" }),
|
|
1700
1725
|
chevronRight: /* @__PURE__ */ B("path", { d: "m9 18 6-6-6-6" }),
|
|
@@ -1879,13 +1904,13 @@ function $({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
1879
1904
|
"aria-hidden": "true",
|
|
1880
1905
|
focusable: "false",
|
|
1881
1906
|
className: r,
|
|
1882
|
-
children:
|
|
1907
|
+
children: vn[e]
|
|
1883
1908
|
});
|
|
1884
1909
|
}
|
|
1885
1910
|
//#endregion
|
|
1886
1911
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
1887
|
-
var
|
|
1888
|
-
function
|
|
1912
|
+
var yn = 6;
|
|
1913
|
+
function bn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
1889
1914
|
let a = s(null);
|
|
1890
1915
|
return i(() => {
|
|
1891
1916
|
let e = a.current;
|
|
@@ -1911,9 +1936,9 @@ function yn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
1911
1936
|
})
|
|
1912
1937
|
});
|
|
1913
1938
|
}
|
|
1914
|
-
function
|
|
1915
|
-
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 ${
|
|
1916
|
-
return /* @__PURE__ */ V(
|
|
1939
|
+
function xn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
1940
|
+
let [s, l] = c(!0), u = e.flatMap((e) => e.variants), d = u.reduce((e, t) => e + t.file.size, 0), f = e.length + (s ? u.length : 0), p = t ? `${t}/` : "", m = r(s), h = m.label ? `${m.label}?` : e.length === 1 ? `Delete ${_n(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
1941
|
+
return /* @__PURE__ */ V(bn, {
|
|
1917
1942
|
className: o,
|
|
1918
1943
|
onCancel: i,
|
|
1919
1944
|
onSubmit: () => a(s),
|
|
@@ -1927,12 +1952,12 @@ function bn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
1927
1952
|
e.length === 1 ? "it" : "them",
|
|
1928
1953
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
1929
1954
|
] }),
|
|
1930
|
-
/* @__PURE__ */ V("ul", { children: [e.slice(0,
|
|
1955
|
+
/* @__PURE__ */ V("ul", { children: [e.slice(0, yn).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
1931
1956
|
title: e.file.path,
|
|
1932
1957
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
1933
|
-
}), /* @__PURE__ */ B("span", { children: Q(e.file.size) })] }, e.file.path)), e.length >
|
|
1958
|
+
}), /* @__PURE__ */ B("span", { children: Q(e.file.size) })] }, e.file.path)), e.length > yn && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
1934
1959
|
"and ",
|
|
1935
|
-
e.length -
|
|
1960
|
+
e.length - yn,
|
|
1936
1961
|
" more"
|
|
1937
1962
|
] }) })] }),
|
|
1938
1963
|
u.length > 0 && /* @__PURE__ */ V("label", { children: [
|
|
@@ -1975,16 +2000,16 @@ function bn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
1975
2000
|
]
|
|
1976
2001
|
});
|
|
1977
2002
|
}
|
|
1978
|
-
function
|
|
2003
|
+
function Sn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
1979
2004
|
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;
|
|
1980
|
-
return /* @__PURE__ */ V(
|
|
2005
|
+
return /* @__PURE__ */ V(bn, {
|
|
1981
2006
|
className: u,
|
|
1982
2007
|
onCancel: s,
|
|
1983
2008
|
onSubmit: l,
|
|
1984
2009
|
children: [
|
|
1985
2010
|
/* @__PURE__ */ B("h3", {
|
|
1986
2011
|
id: "seed-fm-delete-title",
|
|
1987
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
2012
|
+
children: i.label ? `${i.label}?` : `Delete the “${_n(e.name, 32)}” folder?`
|
|
1988
2013
|
}),
|
|
1989
2014
|
/* @__PURE__ */ V("p", { children: [
|
|
1990
2015
|
"This removes the folder and the ",
|
|
@@ -2001,12 +2026,12 @@ function xn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2001
2026
|
size: 16
|
|
2002
2027
|
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2003
2028
|
}),
|
|
2004
|
-
/* @__PURE__ */ V("ul", { children: [t.slice(0,
|
|
2029
|
+
/* @__PURE__ */ V("ul", { children: [t.slice(0, yn).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
2005
2030
|
title: e.path,
|
|
2006
2031
|
children: e.path.slice(m.length)
|
|
2007
|
-
}), /* @__PURE__ */ B("span", { children: Q(e.size) })] }, e.path)), t.length >
|
|
2032
|
+
}), /* @__PURE__ */ B("span", { children: Q(e.size) })] }, e.path)), t.length > yn && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
2008
2033
|
"and ",
|
|
2009
|
-
t.length -
|
|
2034
|
+
t.length - yn,
|
|
2010
2035
|
" more"
|
|
2011
2036
|
] }) })] }),
|
|
2012
2037
|
/* @__PURE__ */ V("div", {
|
|
@@ -2065,42 +2090,42 @@ function xn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2065
2090
|
}
|
|
2066
2091
|
//#endregion
|
|
2067
2092
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2068
|
-
function
|
|
2093
|
+
function Cn(e) {
|
|
2069
2094
|
return e.detectedType ?? e.type;
|
|
2070
2095
|
}
|
|
2071
|
-
var
|
|
2072
|
-
function wn(e) {
|
|
2073
|
-
let t = Sn(e);
|
|
2074
|
-
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";
|
|
2075
|
-
}
|
|
2096
|
+
var wn = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2076
2097
|
function Tn(e) {
|
|
2098
|
+
let t = Cn(e);
|
|
2099
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || wn.test(e.name) ? "database" : t === "application/json" || /\.json$/i.test(e.name) ? "json" : t === "text/html" || /\.html?$/i.test(e.name) ? "html" : t.startsWith("text/") ? "text" : "other";
|
|
2100
|
+
}
|
|
2101
|
+
function En(e) {
|
|
2077
2102
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2078
2103
|
if (t) return t.toLowerCase();
|
|
2079
|
-
let n =
|
|
2104
|
+
let n = Cn(e);
|
|
2080
2105
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2081
2106
|
}
|
|
2082
|
-
var
|
|
2083
|
-
function
|
|
2084
|
-
let t =
|
|
2107
|
+
var Dn = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, On = /^(.*\/)?images\/([^/]+)$/, kn = (e) => e.replace(/\.[^/.]+$/, "");
|
|
2108
|
+
function An(e) {
|
|
2109
|
+
let t = Dn.exec(e);
|
|
2085
2110
|
return t ? {
|
|
2086
2111
|
key: `${t[1] ?? ""}images/${t[3]}`,
|
|
2087
2112
|
width: Number(t[2])
|
|
2088
2113
|
} : null;
|
|
2089
2114
|
}
|
|
2090
|
-
function
|
|
2091
|
-
let t =
|
|
2092
|
-
return t ? `${t[1] ?? ""}images/${
|
|
2115
|
+
function jn(e) {
|
|
2116
|
+
let t = On.exec(e);
|
|
2117
|
+
return t ? `${t[1] ?? ""}images/${kn(t[2])}` : null;
|
|
2093
2118
|
}
|
|
2094
|
-
var
|
|
2119
|
+
var Mn = (e) => ({
|
|
2095
2120
|
file: e,
|
|
2096
2121
|
variants: [],
|
|
2097
2122
|
totalSize: e.size
|
|
2098
2123
|
});
|
|
2099
|
-
function
|
|
2100
|
-
if (!t) return e.map(
|
|
2124
|
+
function Nn(e, t) {
|
|
2125
|
+
if (!t) return e.map(Mn);
|
|
2101
2126
|
let n = /* @__PURE__ */ new Map(), r = [], i = [];
|
|
2102
2127
|
for (let t of e) {
|
|
2103
|
-
let e =
|
|
2128
|
+
let e = An(t.path);
|
|
2104
2129
|
if (e) {
|
|
2105
2130
|
i.push({
|
|
2106
2131
|
file: t,
|
|
@@ -2108,27 +2133,27 @@ function Mn(e, t) {
|
|
|
2108
2133
|
});
|
|
2109
2134
|
continue;
|
|
2110
2135
|
}
|
|
2111
|
-
let a =
|
|
2136
|
+
let a = Mn(t);
|
|
2112
2137
|
r.push(a);
|
|
2113
|
-
let o =
|
|
2114
|
-
o &&
|
|
2138
|
+
let o = jn(t.path);
|
|
2139
|
+
o && Tn(t) === "image" && n.set(o, a);
|
|
2115
2140
|
}
|
|
2116
2141
|
for (let e of i) {
|
|
2117
2142
|
let t = n.get(e.key);
|
|
2118
2143
|
t ? (t.variants.push({
|
|
2119
2144
|
file: e.file,
|
|
2120
2145
|
width: e.width
|
|
2121
|
-
}), t.totalSize += e.file.size) : r.push(
|
|
2146
|
+
}), t.totalSize += e.file.size) : r.push(Mn(e.file));
|
|
2122
2147
|
}
|
|
2123
2148
|
for (let e of n.values()) e.variants.sort((e, t) => e.width - t.width);
|
|
2124
2149
|
return r;
|
|
2125
2150
|
}
|
|
2126
|
-
var
|
|
2127
|
-
function
|
|
2151
|
+
var Pn = (e, t) => e ? `${e}/${t}` : t;
|
|
2152
|
+
function Fn(e, t, n = {}) {
|
|
2128
2153
|
let r = t ? `${t}/` : "", i = e.filter((e) => e.file.path.startsWith(r)), a = n.query?.trim().toLowerCase();
|
|
2129
2154
|
if (a) return {
|
|
2130
2155
|
folders: [],
|
|
2131
|
-
entries:
|
|
2156
|
+
entries: In(i.filter((e) => e.file.path.slice(r.length).toLowerCase().includes(a)), n.sort)
|
|
2132
2157
|
};
|
|
2133
2158
|
let o = /* @__PURE__ */ new Map(), s = [];
|
|
2134
2159
|
for (let e of i) {
|
|
@@ -2139,7 +2164,7 @@ function Pn(e, t, n = {}) {
|
|
|
2139
2164
|
}
|
|
2140
2165
|
let a = n.slice(0, i), c = o.get(a) ?? {
|
|
2141
2166
|
name: a,
|
|
2142
|
-
path:
|
|
2167
|
+
path: Pn(t, a),
|
|
2143
2168
|
fileCount: 0,
|
|
2144
2169
|
size: 0
|
|
2145
2170
|
};
|
|
@@ -2147,10 +2172,10 @@ function Pn(e, t, n = {}) {
|
|
|
2147
2172
|
}
|
|
2148
2173
|
return {
|
|
2149
2174
|
folders: [...o.values()].sort((e, t) => e.name.localeCompare(t.name)),
|
|
2150
|
-
entries:
|
|
2175
|
+
entries: In(s, n.sort)
|
|
2151
2176
|
};
|
|
2152
2177
|
}
|
|
2153
|
-
function
|
|
2178
|
+
function In(e, t = "name") {
|
|
2154
2179
|
let n = {
|
|
2155
2180
|
name: (e, t) => e.file.name.localeCompare(t.file.name),
|
|
2156
2181
|
modified: (e, t) => t.file.lastModified - e.file.lastModified,
|
|
@@ -2158,7 +2183,7 @@ function Fn(e, t = "name") {
|
|
|
2158
2183
|
};
|
|
2159
2184
|
return [...e].sort(n[t]);
|
|
2160
2185
|
}
|
|
2161
|
-
function
|
|
2186
|
+
function Ln(e) {
|
|
2162
2187
|
let t = {
|
|
2163
2188
|
image: 0,
|
|
2164
2189
|
database: 0,
|
|
@@ -2167,34 +2192,34 @@ function In(e) {
|
|
|
2167
2192
|
text: 0,
|
|
2168
2193
|
other: 0
|
|
2169
2194
|
};
|
|
2170
|
-
for (let n of e) t[
|
|
2195
|
+
for (let n of e) t[Tn(n)] += n.size;
|
|
2171
2196
|
return t;
|
|
2172
2197
|
}
|
|
2173
|
-
function
|
|
2198
|
+
function Rn(e) {
|
|
2174
2199
|
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;
|
|
2175
2200
|
}
|
|
2176
2201
|
//#endregion
|
|
2177
2202
|
//#region src/OPFSFilesManager/useThumbnail.ts
|
|
2178
|
-
var
|
|
2179
|
-
function
|
|
2203
|
+
var zn = 400, Bn = 262144, Vn = 4, Hn = 3e4, Un = 0, Wn = [];
|
|
2204
|
+
function Gn(e) {
|
|
2180
2205
|
return new Promise((t, n) => {
|
|
2181
2206
|
let r = () => {
|
|
2182
|
-
|
|
2183
|
-
|
|
2207
|
+
Un++, e().then(t, n).finally(() => {
|
|
2208
|
+
Un--, Wn.shift()?.();
|
|
2184
2209
|
});
|
|
2185
2210
|
};
|
|
2186
|
-
|
|
2211
|
+
Un < Vn ? r() : Wn.push(r);
|
|
2187
2212
|
});
|
|
2188
2213
|
}
|
|
2189
|
-
var
|
|
2190
|
-
function
|
|
2191
|
-
let n =
|
|
2214
|
+
var Kn = /* @__PURE__ */ new Map();
|
|
2215
|
+
function qn(e, t) {
|
|
2216
|
+
let n = Kn.get(e);
|
|
2192
2217
|
if (!n) {
|
|
2193
2218
|
let r = {
|
|
2194
2219
|
refs: 0,
|
|
2195
2220
|
promise: Promise.resolve("")
|
|
2196
2221
|
};
|
|
2197
|
-
r.promise =
|
|
2222
|
+
r.promise = Gn(t).then((e) => (r.url = URL.createObjectURL(e), r.url)), Kn.set(e, r), n = r;
|
|
2198
2223
|
}
|
|
2199
2224
|
n.timer && (clearTimeout(n.timer), n.timer = void 0), n.refs++;
|
|
2200
2225
|
let r = n, i = !1;
|
|
@@ -2202,15 +2227,15 @@ function Kn(e, t) {
|
|
|
2202
2227
|
promise: r.promise,
|
|
2203
2228
|
release: () => {
|
|
2204
2229
|
i || (i = !0, r.refs--, !(r.refs > 0) && (r.timer = setTimeout(() => {
|
|
2205
|
-
r.url && URL.revokeObjectURL(r.url),
|
|
2206
|
-
},
|
|
2230
|
+
r.url && URL.revokeObjectURL(r.url), Kn.get(e) === r && Kn.delete(e);
|
|
2231
|
+
}, Hn)));
|
|
2207
2232
|
}
|
|
2208
2233
|
};
|
|
2209
2234
|
}
|
|
2210
|
-
async function
|
|
2211
|
-
if (e.size <
|
|
2235
|
+
async function Jn(e) {
|
|
2236
|
+
if (e.size < Bn || typeof createImageBitmap != "function") return e;
|
|
2212
2237
|
let t = await createImageBitmap(e, {
|
|
2213
|
-
resizeWidth:
|
|
2238
|
+
resizeWidth: zn,
|
|
2214
2239
|
resizeQuality: "medium"
|
|
2215
2240
|
});
|
|
2216
2241
|
try {
|
|
@@ -2227,22 +2252,22 @@ async function qn(e) {
|
|
|
2227
2252
|
t.close();
|
|
2228
2253
|
}
|
|
2229
2254
|
}
|
|
2230
|
-
async function
|
|
2255
|
+
async function Yn(e) {
|
|
2231
2256
|
let t = e.variants[0];
|
|
2232
|
-
return t ?
|
|
2233
|
-
}
|
|
2234
|
-
var
|
|
2235
|
-
function
|
|
2236
|
-
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (
|
|
2237
|
-
for (let t of e) t.isIntersecting && (
|
|
2238
|
-
}, { rootMargin: "300px" })),
|
|
2239
|
-
|
|
2257
|
+
return t ? $t(t.file.path) : Jn(await $t(e.file.path));
|
|
2258
|
+
}
|
|
2259
|
+
var Xn = /* @__PURE__ */ new WeakMap(), Zn = null;
|
|
2260
|
+
function Qn(e, t) {
|
|
2261
|
+
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (Zn ?? (Zn = new IntersectionObserver((e) => {
|
|
2262
|
+
for (let t of e) t.isIntersecting && (Zn.unobserve(t.target), Xn.get(t.target)?.(), Xn.delete(t.target));
|
|
2263
|
+
}, { rootMargin: "300px" })), Xn.set(e, t), Zn.observe(e), () => {
|
|
2264
|
+
Xn.delete(e), Zn?.unobserve(e);
|
|
2240
2265
|
});
|
|
2241
2266
|
}
|
|
2242
|
-
function
|
|
2243
|
-
let t =
|
|
2267
|
+
function $n(e) {
|
|
2268
|
+
let t = Tn(e.file) === "image", [r, a] = c(null), [o, s] = c(!1), [l, u] = c(null), [d, f] = c("idle"), p = n((e) => a(e), []);
|
|
2244
2269
|
i(() => {
|
|
2245
|
-
if (t && r && !o) return
|
|
2270
|
+
if (t && r && !o) return Qn(r, () => s(!0));
|
|
2246
2271
|
}, [
|
|
2247
2272
|
t,
|
|
2248
2273
|
r,
|
|
@@ -2253,7 +2278,7 @@ function Qn(e) {
|
|
|
2253
2278
|
if (!t || !o) return;
|
|
2254
2279
|
let n = !1;
|
|
2255
2280
|
f("loading");
|
|
2256
|
-
let r =
|
|
2281
|
+
let r = qn(_, () => Yn(e));
|
|
2257
2282
|
return r.promise.then((e) => {
|
|
2258
2283
|
n || (u(e), f("ready"));
|
|
2259
2284
|
}, () => {
|
|
@@ -2276,7 +2301,7 @@ function Qn(e) {
|
|
|
2276
2301
|
}
|
|
2277
2302
|
//#endregion
|
|
2278
2303
|
//#region src/OPFSFilesManager/FileThumbnail.tsx
|
|
2279
|
-
var
|
|
2304
|
+
var er = {
|
|
2280
2305
|
image: {
|
|
2281
2306
|
icon: "image",
|
|
2282
2307
|
label: "Images",
|
|
@@ -2307,11 +2332,11 @@ var $n = {
|
|
|
2307
2332
|
label: "Other",
|
|
2308
2333
|
color: "var(--seed-kind-other)"
|
|
2309
2334
|
}
|
|
2310
|
-
},
|
|
2311
|
-
function
|
|
2312
|
-
let r =
|
|
2335
|
+
}, tr = (e) => ({ "--seed-kind": er[e].color }), nr = (e) => /png|webp|gif|avif|svg/.test(Cn(e.file));
|
|
2336
|
+
function rr({ entry: e, size: t, children: n }) {
|
|
2337
|
+
let r = Tn(e.file), { ref: i, url: a, status: o, markError: s } = $n(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2313
2338
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2314
|
-
l &&
|
|
2339
|
+
l && nr(e) ? "seed-fm-thumb--checker" : "",
|
|
2315
2340
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2316
2341
|
].filter(Boolean).join(" "), d;
|
|
2317
2342
|
return d = l ? /* @__PURE__ */ B("img", {
|
|
@@ -2321,12 +2346,12 @@ function nr({ entry: e, size: t, children: n }) {
|
|
|
2321
2346
|
draggable: !1,
|
|
2322
2347
|
onError: s
|
|
2323
2348
|
}) : t === "mini" ? /* @__PURE__ */ B($, {
|
|
2324
|
-
name: c ? "imageOff" :
|
|
2349
|
+
name: c ? "imageOff" : er[r].icon,
|
|
2325
2350
|
size: 16
|
|
2326
2351
|
}) : r === "image" && !c ? null : /* @__PURE__ */ V("span", {
|
|
2327
2352
|
className: "seed-fm-kind",
|
|
2328
2353
|
children: [/* @__PURE__ */ B($, {
|
|
2329
|
-
name: c ? "imageOff" :
|
|
2354
|
+
name: c ? "imageOff" : er[r].icon,
|
|
2330
2355
|
size: 28,
|
|
2331
2356
|
strokeWidth: 1.6
|
|
2332
2357
|
}), c ? /* @__PURE__ */ B("span", {
|
|
@@ -2334,18 +2359,18 @@ function nr({ entry: e, size: t, children: n }) {
|
|
|
2334
2359
|
children: "Can’t decode image"
|
|
2335
2360
|
}) : /* @__PURE__ */ B("span", {
|
|
2336
2361
|
className: "seed-fm-ext",
|
|
2337
|
-
children:
|
|
2362
|
+
children: En(e.file)
|
|
2338
2363
|
})]
|
|
2339
2364
|
}), /* @__PURE__ */ V("span", {
|
|
2340
2365
|
ref: i,
|
|
2341
2366
|
className: u,
|
|
2342
|
-
style:
|
|
2367
|
+
style: tr(r),
|
|
2343
2368
|
children: [d, n]
|
|
2344
2369
|
});
|
|
2345
2370
|
}
|
|
2346
2371
|
//#endregion
|
|
2347
2372
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2348
|
-
function
|
|
2373
|
+
function ir({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2349
2374
|
return /* @__PURE__ */ B("ul", {
|
|
2350
2375
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2351
2376
|
role: "listbox",
|
|
@@ -2365,7 +2390,7 @@ function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2365
2390
|
onKeyDown: (t) => {
|
|
2366
2391
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2367
2392
|
},
|
|
2368
|
-
children: [/* @__PURE__ */ V(
|
|
2393
|
+
children: [/* @__PURE__ */ V(rr, {
|
|
2369
2394
|
entry: e,
|
|
2370
2395
|
size: "tile",
|
|
2371
2396
|
children: [/* @__PURE__ */ B("button", {
|
|
@@ -2399,7 +2424,7 @@ function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2399
2424
|
className: "seed-fm-tile-meta",
|
|
2400
2425
|
children: [/* @__PURE__ */ B("span", {
|
|
2401
2426
|
className: "seed-fm-tile-name",
|
|
2402
|
-
children:
|
|
2427
|
+
children: _n(o.name, 24)
|
|
2403
2428
|
}), /* @__PURE__ */ V("span", {
|
|
2404
2429
|
className: "seed-fm-tile-sub",
|
|
2405
2430
|
children: [
|
|
@@ -2408,8 +2433,8 @@ function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2408
2433
|
" ",
|
|
2409
2434
|
/* @__PURE__ */ B("time", {
|
|
2410
2435
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2411
|
-
title:
|
|
2412
|
-
children:
|
|
2436
|
+
title: gn(o.lastModified),
|
|
2437
|
+
children: hn(o.lastModified)
|
|
2413
2438
|
})
|
|
2414
2439
|
]
|
|
2415
2440
|
})]
|
|
@@ -2420,7 +2445,7 @@ function rr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2420
2445
|
}
|
|
2421
2446
|
//#endregion
|
|
2422
2447
|
//#region src/OPFSFilesManager/FileList.tsx
|
|
2423
|
-
function
|
|
2448
|
+
function ar({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onToggleAll: o, onDownload: c, onDelete: l, deleteActionFor: u, className: d, rowClassName: f }) {
|
|
2424
2449
|
let p = s(null), m = e.filter((e) => t.has(e.file.path)).length, h = e.length > 0 && m === e.length;
|
|
2425
2450
|
i(() => {
|
|
2426
2451
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
@@ -2480,7 +2505,7 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2480
2505
|
}),
|
|
2481
2506
|
/* @__PURE__ */ B("td", { children: /* @__PURE__ */ V("span", {
|
|
2482
2507
|
className: "seed-fm-namecell",
|
|
2483
|
-
children: [/* @__PURE__ */ B(
|
|
2508
|
+
children: [/* @__PURE__ */ B(rr, {
|
|
2484
2509
|
entry: e,
|
|
2485
2510
|
size: "mini"
|
|
2486
2511
|
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("button", {
|
|
@@ -2499,8 +2524,8 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2499
2524
|
className: "seed-fm-col-type",
|
|
2500
2525
|
children: /* @__PURE__ */ V("span", {
|
|
2501
2526
|
className: "seed-fm-type",
|
|
2502
|
-
style:
|
|
2503
|
-
children: [
|
|
2527
|
+
style: tr(Tn(i)),
|
|
2528
|
+
children: [Cn(i), i.detectedType && /* @__PURE__ */ B("small", { children: "detected" })]
|
|
2504
2529
|
})
|
|
2505
2530
|
}),
|
|
2506
2531
|
/* @__PURE__ */ B("td", {
|
|
@@ -2510,8 +2535,8 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2510
2535
|
}),
|
|
2511
2536
|
/* @__PURE__ */ B("td", {
|
|
2512
2537
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2513
|
-
title:
|
|
2514
|
-
children:
|
|
2538
|
+
title: gn(i.lastModified),
|
|
2539
|
+
children: hn(i.lastModified)
|
|
2515
2540
|
}),
|
|
2516
2541
|
/* @__PURE__ */ V("td", {
|
|
2517
2542
|
className: "seed-fm-actions",
|
|
@@ -2546,22 +2571,22 @@ function ir({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2546
2571
|
}
|
|
2547
2572
|
//#endregion
|
|
2548
2573
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2549
|
-
var
|
|
2550
|
-
function
|
|
2551
|
-
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o =
|
|
2574
|
+
var or = 1048576, sr = 32768;
|
|
2575
|
+
function cr(e) {
|
|
2576
|
+
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = Tn(e.file), s = e.file.size;
|
|
2552
2577
|
return i(() => {
|
|
2553
2578
|
let e = !1, t = null;
|
|
2554
2579
|
return n({ kind: "loading" }), (async () => {
|
|
2555
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2580
|
+
if (o === "image") return t = URL.createObjectURL(await $t(r)), {
|
|
2556
2581
|
kind: "image",
|
|
2557
2582
|
url: t
|
|
2558
2583
|
};
|
|
2559
2584
|
if (o === "json" || o === "html" || o === "text") {
|
|
2560
|
-
if (s >
|
|
2585
|
+
if (s > or) return {
|
|
2561
2586
|
kind: "none",
|
|
2562
2587
|
message: "This file is too large to preview."
|
|
2563
2588
|
};
|
|
2564
|
-
let e = await
|
|
2589
|
+
let e = await $t(r), t = e.size > sr, n = await e.slice(0, sr).text();
|
|
2565
2590
|
if (o === "json" && !t) try {
|
|
2566
2591
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2567
2592
|
} catch {}
|
|
@@ -2595,8 +2620,8 @@ function sr(e) {
|
|
|
2595
2620
|
o
|
|
2596
2621
|
]), t;
|
|
2597
2622
|
}
|
|
2598
|
-
function
|
|
2599
|
-
let { file: f, variants: p } = e, m =
|
|
2623
|
+
function lr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onDelete: o, deleteAction: l, onCopyPath: u, className: d }) {
|
|
2624
|
+
let { file: f, variants: p } = e, m = Tn(f), h = cr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2600
2625
|
i(() => {
|
|
2601
2626
|
_(null), y(!1);
|
|
2602
2627
|
}, [f.path]), i(() => {
|
|
@@ -2619,13 +2644,13 @@ function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2619
2644
|
C = /* @__PURE__ */ V("span", {
|
|
2620
2645
|
className: "seed-fm-preview-note",
|
|
2621
2646
|
children: [/* @__PURE__ */ B($, {
|
|
2622
|
-
name: v ? "imageOff" :
|
|
2647
|
+
name: v ? "imageOff" : er[m].icon,
|
|
2623
2648
|
size: 32,
|
|
2624
2649
|
strokeWidth: 1.5
|
|
2625
2650
|
}), e]
|
|
2626
2651
|
});
|
|
2627
2652
|
}
|
|
2628
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2653
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(Cn(f));
|
|
2629
2654
|
return /* @__PURE__ */ V("aside", {
|
|
2630
2655
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2631
2656
|
role: "dialog",
|
|
@@ -2675,7 +2700,7 @@ function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2675
2700
|
w ? "seed-fm-thumb--checker" : "",
|
|
2676
2701
|
h.kind === "loading" ? "seed-fm-skeleton" : ""
|
|
2677
2702
|
].filter(Boolean).join(" "),
|
|
2678
|
-
style:
|
|
2703
|
+
style: tr(m),
|
|
2679
2704
|
children: C
|
|
2680
2705
|
}),
|
|
2681
2706
|
/* @__PURE__ */ V("dl", {
|
|
@@ -2703,7 +2728,7 @@ function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2703
2728
|
/* @__PURE__ */ V("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2704
2729
|
] }),
|
|
2705
2730
|
/* @__PURE__ */ B("dt", { children: "Type" }),
|
|
2706
|
-
/* @__PURE__ */ V("dd", { children: [
|
|
2731
|
+
/* @__PURE__ */ V("dd", { children: [Cn(f), f.detectedType && /* @__PURE__ */ V("small", { children: [
|
|
2707
2732
|
" from file contents. File.type is “",
|
|
2708
2733
|
f.type,
|
|
2709
2734
|
"”"
|
|
@@ -2716,9 +2741,9 @@ function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2716
2741
|
] })] }),
|
|
2717
2742
|
/* @__PURE__ */ B("dt", { children: "Modified" }),
|
|
2718
2743
|
/* @__PURE__ */ V("dd", { children: [
|
|
2719
|
-
|
|
2744
|
+
gn(f.lastModified),
|
|
2720
2745
|
" ",
|
|
2721
|
-
/* @__PURE__ */ B("small", { children:
|
|
2746
|
+
/* @__PURE__ */ B("small", { children: hn(f.lastModified) })
|
|
2722
2747
|
] })
|
|
2723
2748
|
]
|
|
2724
2749
|
}),
|
|
@@ -2763,18 +2788,18 @@ function cr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2763
2788
|
}
|
|
2764
2789
|
//#endregion
|
|
2765
2790
|
//#region src/OPFSFilesManager/styles.ts
|
|
2766
|
-
var
|
|
2791
|
+
var ur = "seed-opfs-files-manager-styles", dr = "seed-opfs-files-manager", fr = "\n --seed-bg: #fbfcfb;\n --seed-surface: #ffffff;\n --seed-sunken: #f0f3f1;\n --seed-hover: #e9eeeb;\n --seed-fg: #18211d;\n --seed-fg-muted: #5a6861;\n --seed-fg-faint: #8a978f;\n --seed-border: #dfe5e1;\n --seed-border-strong: #c5cfc9;\n --seed-accent: #2c6b59;\n --seed-accent-fg: #ffffff;\n --seed-accent-soft: #e0eee8;\n --seed-danger: #b4332a;\n --seed-danger-fg: #ffffff;\n --seed-danger-soft: #fbe7e4;\n --seed-danger-inverse: #ff9a8f;\n --seed-warn: #8a5208;\n --seed-warn-soft: #fdf1dc;\n --seed-kind-image: #2f7d68;\n --seed-kind-database: #6a4fb3;\n --seed-kind-json: #a2620e;\n --seed-kind-html: #b0413a;\n --seed-kind-text: #3f6f9a;\n --seed-kind-other: #66736c;\n --seed-checker-a: #eef1ef;\n --seed-checker-b: #ffffff;\n --seed-shadow: 0 10px 30px rgb(16 24 20 / 0.14), 0 2px 6px rgb(16 24 20 / 0.08);\n --seed-backdrop: rgb(8 12 10 / 0.42);\n", pr = "\n --seed-bg: #111816;\n --seed-surface: #171f1c;\n --seed-sunken: #1d2723;\n --seed-hover: #24302b;\n --seed-fg: #e4ebe7;\n --seed-fg-muted: #9daba3;\n --seed-fg-faint: #6f7d76;\n --seed-border: #29342f;\n --seed-border-strong: #3a4842;\n --seed-accent: #6cc0a3;\n --seed-accent-fg: #0c1a15;\n --seed-accent-soft: #1c3a30;\n --seed-danger: #f08277;\n --seed-danger-fg: #2a0d0a;\n --seed-danger-soft: #3b1c19;\n --seed-danger-inverse: #b4332a;\n --seed-warn: #e9b062;\n --seed-warn-soft: #382a14;\n --seed-kind-image: #6cc0a3;\n --seed-kind-database: #b29cf0;\n --seed-kind-json: #e3ad5c;\n --seed-kind-html: #ef8a80;\n --seed-kind-text: #8fb8de;\n --seed-kind-other: #9aa8a0;\n --seed-checker-a: #1d2723;\n --seed-checker-b: #24302b;\n --seed-shadow: 0 12px 34px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);\n --seed-backdrop: rgb(0 0 0 / 0.55);\n color-scheme: dark;\n", mr = `@layer ${dr} {\n${`
|
|
2767
2792
|
.seed-fm {
|
|
2768
|
-
${
|
|
2793
|
+
${fr}
|
|
2769
2794
|
--seed-radius-sm: 6px;
|
|
2770
2795
|
--seed-radius-md: 8px;
|
|
2771
2796
|
--seed-radius-lg: 12px;
|
|
2772
2797
|
--seed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
2773
2798
|
color-scheme: light;
|
|
2774
2799
|
}
|
|
2775
|
-
.seed-fm[data-seed-theme="dark"] { ${
|
|
2800
|
+
.seed-fm[data-seed-theme="dark"] { ${pr} }
|
|
2776
2801
|
@media (prefers-color-scheme: dark) {
|
|
2777
|
-
.seed-fm[data-seed-theme="system"] { ${
|
|
2802
|
+
.seed-fm[data-seed-theme="system"] { ${pr} }
|
|
2778
2803
|
}
|
|
2779
2804
|
|
|
2780
2805
|
.seed-fm { position: relative; color: var(--seed-fg); background: var(--seed-bg); font-family: inherit; font-size: 14px; line-height: 1.45; }
|
|
@@ -2982,14 +3007,14 @@ var lr = "seed-opfs-files-manager-styles", ur = "seed-opfs-files-manager", dr =
|
|
|
2982
3007
|
.seed-fm-thumb img { transition: none; }
|
|
2983
3008
|
}
|
|
2984
3009
|
`}\n}`;
|
|
2985
|
-
function
|
|
3010
|
+
function hr() {
|
|
2986
3011
|
if (typeof document > "u" || document.getElementById("seed-opfs-files-manager-styles")) return;
|
|
2987
3012
|
let e = document.createElement("style");
|
|
2988
|
-
e.id =
|
|
3013
|
+
e.id = ur, e.textContent = mr, document.head.appendChild(e);
|
|
2989
3014
|
}
|
|
2990
3015
|
//#endregion
|
|
2991
3016
|
//#region src/OPFSFilesManager/useStorageEstimate.ts
|
|
2992
|
-
function
|
|
3017
|
+
function gr(e) {
|
|
2993
3018
|
let [t, n] = c(null);
|
|
2994
3019
|
return i(() => {
|
|
2995
3020
|
if (typeof navigator > "u" || typeof navigator.storage?.estimate != "function") return;
|
|
@@ -3006,40 +3031,40 @@ function hr(e) {
|
|
|
3006
3031
|
}
|
|
3007
3032
|
//#endregion
|
|
3008
3033
|
//#region src/OPFSFilesManager/zip.ts
|
|
3009
|
-
var
|
|
3010
|
-
function
|
|
3011
|
-
if (
|
|
3012
|
-
|
|
3034
|
+
var _r = null;
|
|
3035
|
+
function vr() {
|
|
3036
|
+
if (_r) return _r;
|
|
3037
|
+
_r = /* @__PURE__ */ new Uint32Array(256);
|
|
3013
3038
|
for (let e = 0; e < 256; e++) {
|
|
3014
3039
|
let t = e;
|
|
3015
3040
|
for (let e = 0; e < 8; e++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
3016
|
-
|
|
3041
|
+
_r[e] = t >>> 0;
|
|
3017
3042
|
}
|
|
3018
|
-
return
|
|
3043
|
+
return _r;
|
|
3019
3044
|
}
|
|
3020
|
-
function
|
|
3021
|
-
let t =
|
|
3045
|
+
function yr(e) {
|
|
3046
|
+
let t = vr(), n = 4294967295;
|
|
3022
3047
|
for (let r = 0; r < e.length; r++) n = t[(n ^ e[r]) & 255] ^ n >>> 8;
|
|
3023
3048
|
return (n ^ 4294967295) >>> 0;
|
|
3024
3049
|
}
|
|
3025
|
-
function
|
|
3050
|
+
function br(e) {
|
|
3026
3051
|
let t = new Date(e), n = Math.max(1980, t.getFullYear());
|
|
3027
3052
|
return {
|
|
3028
3053
|
time: t.getHours() << 11 | t.getMinutes() << 5 | Math.floor(t.getSeconds() / 2),
|
|
3029
3054
|
date: n - 1980 << 9 | t.getMonth() + 1 << 5 | t.getDate()
|
|
3030
3055
|
};
|
|
3031
3056
|
}
|
|
3032
|
-
var
|
|
3033
|
-
async function
|
|
3057
|
+
var xr = 2048, Sr = 4294967295;
|
|
3058
|
+
async function Cr(e) {
|
|
3034
3059
|
if (e.length > 65535) throw Error("Too many files for a ZIP archive (max 65,535).");
|
|
3035
3060
|
let t = new TextEncoder(), n = [], r = [], i = 0;
|
|
3036
3061
|
for (let a of e) {
|
|
3037
|
-
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s =
|
|
3038
|
-
if (i + o.length + 30 + e.length >
|
|
3062
|
+
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s = yr(o), { time: c, date: l } = br(a.lastModified ?? Date.now());
|
|
3063
|
+
if (i + o.length + 30 + e.length > Sr) throw Error("Selection is too large for a ZIP archive (max 4 GB).");
|
|
3039
3064
|
let u = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(30));
|
|
3040
|
-
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6,
|
|
3065
|
+
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6, xr, !0), u.setUint16(8, 0, !0), u.setUint16(10, c, !0), u.setUint16(12, l, !0), u.setUint32(14, s, !0), u.setUint32(18, o.length, !0), u.setUint32(22, o.length, !0), u.setUint16(26, e.length, !0), u.setUint16(28, 0, !0), n.push(u.buffer, e, o);
|
|
3041
3066
|
let d = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(46));
|
|
3042
|
-
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8,
|
|
3067
|
+
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, xr, !0), d.setUint16(10, 0, !0), d.setUint16(12, c, !0), d.setUint16(14, l, !0), d.setUint32(16, s, !0), d.setUint32(20, o.length, !0), d.setUint32(24, o.length, !0), d.setUint16(28, e.length, !0), d.setUint32(42, i, !0);
|
|
3043
3068
|
let f = new Uint8Array(46 + e.length);
|
|
3044
3069
|
f.set(new Uint8Array(d.buffer), 0), f.set(e, 46), r.push(f), i += 30 + e.length + o.length;
|
|
3045
3070
|
}
|
|
@@ -3052,12 +3077,12 @@ async function Sr(e) {
|
|
|
3052
3077
|
}
|
|
3053
3078
|
//#endregion
|
|
3054
3079
|
//#region src/OPFSFilesManager/OPFSFilesManager.tsx
|
|
3055
|
-
var
|
|
3056
|
-
function
|
|
3080
|
+
var wr = "Everything this app stores in the browser’s private file system (OPFS).", Tr = 4e3, Er = (e) => e instanceof Error ? e.message : String(e), Dr = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, Or = (e) => (e ?? "").split("/").filter(Boolean).join("/");
|
|
3081
|
+
function kr(e, t) {
|
|
3057
3082
|
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
3058
3083
|
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
3059
3084
|
}
|
|
3060
|
-
function
|
|
3085
|
+
function Ar() {
|
|
3061
3086
|
let [e, t] = c([]), r = s(/* @__PURE__ */ new Set());
|
|
3062
3087
|
return i(() => {
|
|
3063
3088
|
let e = r.current;
|
|
@@ -3073,12 +3098,12 @@ function kr() {
|
|
|
3073
3098
|
}]);
|
|
3074
3099
|
let a = setTimeout(() => {
|
|
3075
3100
|
r.current.delete(a), t((e) => e.filter((e) => e.id !== i));
|
|
3076
|
-
},
|
|
3101
|
+
}, Tr);
|
|
3077
3102
|
r.current.add(a);
|
|
3078
3103
|
}, [])
|
|
3079
3104
|
};
|
|
3080
3105
|
}
|
|
3081
|
-
var
|
|
3106
|
+
var jr = [
|
|
3082
3107
|
"image",
|
|
3083
3108
|
"database",
|
|
3084
3109
|
"json",
|
|
@@ -3086,11 +3111,11 @@ var Ar = [
|
|
|
3086
3111
|
"text",
|
|
3087
3112
|
"other"
|
|
3088
3113
|
];
|
|
3089
|
-
function
|
|
3090
|
-
let n =
|
|
3091
|
-
label:
|
|
3114
|
+
function Mr({ files: e, estimate: t }) {
|
|
3115
|
+
let n = Ln(e), r = e.reduce((e, t) => e + t.size, 0), i = t ? Math.max(0, t.usage - r) : 0, a = r + i, o = [...jr.filter((e) => n[e] > 0).map((e) => ({
|
|
3116
|
+
label: er[e].label,
|
|
3092
3117
|
size: n[e],
|
|
3093
|
-
color:
|
|
3118
|
+
color: er[e].color
|
|
3094
3119
|
})), ...i > 0 ? [{
|
|
3095
3120
|
label: "Other site data",
|
|
3096
3121
|
size: i,
|
|
@@ -3104,7 +3129,7 @@ function jr({ files: e, estimate: t }) {
|
|
|
3104
3129
|
children: [/* @__PURE__ */ V("span", { children: [
|
|
3105
3130
|
/* @__PURE__ */ B("strong", { children: Q(t ? t.usage : r) }),
|
|
3106
3131
|
" ",
|
|
3107
|
-
t ? "used by this site" : `in ${
|
|
3132
|
+
t ? "used by this site" : `in ${Dr(e.length, "file")}`
|
|
3108
3133
|
] }), t && /* @__PURE__ */ V("span", { children: [Q(t.quota), " available"] })]
|
|
3109
3134
|
}), a > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3110
3135
|
className: "seed-fm-meter",
|
|
@@ -3127,7 +3152,7 @@ function jr({ files: e, estimate: t }) {
|
|
|
3127
3152
|
})] })]
|
|
3128
3153
|
});
|
|
3129
3154
|
}
|
|
3130
|
-
function
|
|
3155
|
+
function Nr({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3131
3156
|
return /* @__PURE__ */ V("div", {
|
|
3132
3157
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3133
3158
|
role: r === "error" ? "alert" : void 0,
|
|
@@ -3145,17 +3170,17 @@ function Mr({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
|
3145
3170
|
]
|
|
3146
3171
|
});
|
|
3147
3172
|
}
|
|
3148
|
-
function
|
|
3173
|
+
function Pr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDownload: l, title: u = "Files", description: d = wr, headingLevel: f = 2, theme: p = "system", className: m, classNames: h = {}, defaultView: g, groupImageVariants: _ = !0, deleteWarning: v = Rn, confirmDelete: y, deleteAction: b, onNotify: x }) {
|
|
3149
3174
|
a(() => {
|
|
3150
|
-
p !== "none" &&
|
|
3175
|
+
p !== "none" && hr();
|
|
3151
3176
|
}, [p]);
|
|
3152
|
-
let S =
|
|
3177
|
+
let S = Or(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: E, hasLoaded: ee, error: D, errorName: O, refetch: te } = un({ rootPath: e }), k = o(() => t ? T.filter(t) : T, [T, t]), ne = gr(T), [re, A] = c(_);
|
|
3153
3178
|
i(() => A(_), [_]);
|
|
3154
|
-
let j = o(() =>
|
|
3179
|
+
let j = o(() => Nn(k, re), [k, re]), [M, ie] = c(S);
|
|
3155
3180
|
i(() => ie(S), [S]);
|
|
3156
|
-
let [ae, oe] = c(""), [se, ce] = c("name"), [le, ue] = c(g), [N, P] = c(() => /* @__PURE__ */ new Set()), F = s(null), [I, L] = c(null), de = s(null), [R, fe] = c(null), [H, pe] = c(null), [me, U] = c(!1), { toasts: he, showToast: ge } =
|
|
3181
|
+
let [ae, oe] = c(""), [se, ce] = c("name"), [le, ue] = c(g), [N, P] = c(() => /* @__PURE__ */ new Set()), F = s(null), [I, L] = c(null), de = s(null), [R, fe] = c(null), [H, pe] = c(null), [me, U] = c(!1), { toasts: he, showToast: ge } = Ar(), _e = (e, t, n) => {
|
|
3157
3182
|
x ? x(e, t, n) : ge(e, t);
|
|
3158
|
-
}, W = o(() =>
|
|
3183
|
+
}, W = o(() => Fn(j, M, {
|
|
3159
3184
|
query: ae,
|
|
3160
3185
|
sort: se
|
|
3161
3186
|
}), [
|
|
@@ -3163,7 +3188,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3163
3188
|
M,
|
|
3164
3189
|
ae,
|
|
3165
3190
|
se
|
|
3166
|
-
]), G = W.entries, ve = G.length ? G.filter((e) =>
|
|
3191
|
+
]), G = W.entries, ve = G.length ? G.filter((e) => Tn(e.file) === "image").length / G.length : 0, ye = le ?? (ve >= .5 ? "grid" : "list"), K = o(() => new Map(j.map((e) => [e.file.path, e])), [j]), be = o(() => [...N].map((e) => K.get(e)).filter((e) => !!e), [N, K]), q = I ? K.get(I) ?? null : null, J = q ? G.indexOf(q) : -1;
|
|
3167
3192
|
i(() => {
|
|
3168
3193
|
P((e) => {
|
|
3169
3194
|
let t = new Set([...e].filter((e) => K.has(e)));
|
|
@@ -3197,18 +3222,18 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3197
3222
|
return n;
|
|
3198
3223
|
});
|
|
3199
3224
|
}, Ee = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, De = async (e, t) => {
|
|
3200
|
-
l ? await l(e, t) :
|
|
3225
|
+
l ? await l(e, t) : kr(e.name, t);
|
|
3201
3226
|
}, Oe = async (e, t) => {
|
|
3202
3227
|
if (e.length === 0) return !1;
|
|
3203
3228
|
U(!0);
|
|
3204
3229
|
try {
|
|
3205
3230
|
if (e.length === 1 && !t) {
|
|
3206
3231
|
let [t] = e;
|
|
3207
|
-
return await De(t, await
|
|
3232
|
+
return await De(t, await $t(t.path)), !0;
|
|
3208
3233
|
}
|
|
3209
|
-
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await
|
|
3234
|
+
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await Cr(await Promise.all(e.map(async (e) => ({
|
|
3210
3235
|
name: t ? e.path.slice(n.length) : Ee(e.path),
|
|
3211
|
-
data: await
|
|
3236
|
+
data: await $t(e.path),
|
|
3212
3237
|
lastModified: e.lastModified
|
|
3213
3238
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3214
3239
|
return await De({
|
|
@@ -3217,16 +3242,16 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3217
3242
|
size: r.size,
|
|
3218
3243
|
type: "application/zip",
|
|
3219
3244
|
lastModified: Date.now()
|
|
3220
|
-
}, r), _e(`Saved ${i} with ${
|
|
3245
|
+
}, r), _e(`Saved ${i} with ${Dr(e.length, "file")}`, "success", {
|
|
3221
3246
|
kind: "download",
|
|
3222
3247
|
paths: e.map((e) => e.path),
|
|
3223
3248
|
fileName: i
|
|
3224
3249
|
}), !0;
|
|
3225
3250
|
} catch (t) {
|
|
3226
|
-
return _e(`Couldn’t download: ${
|
|
3251
|
+
return _e(`Couldn’t download: ${Er(t)}`, "error", {
|
|
3227
3252
|
kind: "download",
|
|
3228
3253
|
paths: e.map((e) => e.path),
|
|
3229
|
-
error:
|
|
3254
|
+
error: Er(t)
|
|
3230
3255
|
}), !1;
|
|
3231
3256
|
} finally {
|
|
3232
3257
|
U(!1);
|
|
@@ -3244,32 +3269,32 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3244
3269
|
let r = await navigator.storage.getDirectory();
|
|
3245
3270
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3246
3271
|
else try {
|
|
3247
|
-
await
|
|
3272
|
+
await en(t.path, r), i.push(t.path);
|
|
3248
3273
|
} catch (e) {
|
|
3249
3274
|
a.push({
|
|
3250
3275
|
path: t.path,
|
|
3251
|
-
error:
|
|
3276
|
+
error: Er(e)
|
|
3252
3277
|
});
|
|
3253
3278
|
}
|
|
3254
3279
|
if (t) try {
|
|
3255
|
-
s = await
|
|
3280
|
+
s = await nn(t.path, r);
|
|
3256
3281
|
} catch (e) {
|
|
3257
3282
|
a.push({
|
|
3258
3283
|
path: t.path,
|
|
3259
|
-
error:
|
|
3284
|
+
error: Er(e)
|
|
3260
3285
|
});
|
|
3261
3286
|
}
|
|
3262
3287
|
} catch (e) {
|
|
3263
3288
|
a.push({
|
|
3264
3289
|
path: "",
|
|
3265
|
-
error:
|
|
3290
|
+
error: Er(e)
|
|
3266
3291
|
});
|
|
3267
3292
|
}
|
|
3268
3293
|
P((e) => {
|
|
3269
3294
|
let t = new Set(e);
|
|
3270
3295
|
return i.forEach((e) => t.delete(e)), t;
|
|
3271
3296
|
}), I && i.includes(I) && L(null), await te(), U(!1);
|
|
3272
|
-
let c = [s ? `Deleted the ${t.name} folder (${
|
|
3297
|
+
let c = [s ? `Deleted the ${t.name} folder (${Dr(i.length, "file")})` : i.length > 0 ? `Deleted ${Dr(i.length, "file")}` : "Nothing deleted"];
|
|
3273
3298
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3274
3299
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3275
3300
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
@@ -3306,7 +3331,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3306
3331
|
}), n = (t) => _e("Couldn’t copy. Select the path text instead.", "error", {
|
|
3307
3332
|
kind: "copy-path",
|
|
3308
3333
|
path: e,
|
|
3309
|
-
error: t === void 0 ? "Clipboard unavailable" :
|
|
3334
|
+
error: t === void 0 ? "Clipboard unavailable" : Er(t)
|
|
3310
3335
|
});
|
|
3311
3336
|
try {
|
|
3312
3337
|
navigator.clipboard.writeText(e).then(t, n);
|
|
@@ -3325,14 +3350,14 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3325
3350
|
let t = G[J + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3326
3351
|
t && L(t.file.path), e.preventDefault();
|
|
3327
3352
|
}
|
|
3328
|
-
}, Re = o(() => k.some((e) =>
|
|
3353
|
+
}, Re = o(() => k.some((e) => An(e.path)), [k]), ze = /(^|\/)images(\/\d+)?$/.test(M), Z = [{
|
|
3329
3354
|
label: C,
|
|
3330
3355
|
path: S
|
|
3331
3356
|
}, ...(M.length > S.length ? M.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3332
3357
|
label: e,
|
|
3333
3358
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3334
3359
|
}))], Be = `h${f}`, Ve = be.reduce((e, t) => e + t.file.size, 0), He;
|
|
3335
|
-
if (!
|
|
3360
|
+
if (!rn()) He = /* @__PURE__ */ B(Nr, {
|
|
3336
3361
|
icon: "triangleAlert",
|
|
3337
3362
|
tone: "error",
|
|
3338
3363
|
title: "This browser doesn’t support private file storage",
|
|
@@ -3348,7 +3373,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3348
3373
|
size: 15
|
|
3349
3374
|
}), " Try again"]
|
|
3350
3375
|
});
|
|
3351
|
-
He = O === "NotFoundError" && S ? /* @__PURE__ */ V(
|
|
3376
|
+
He = O === "NotFoundError" && S ? /* @__PURE__ */ V(Nr, {
|
|
3352
3377
|
icon: "triangleAlert",
|
|
3353
3378
|
tone: "error",
|
|
3354
3379
|
title: `Can’t open ${S}`,
|
|
@@ -3361,18 +3386,18 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3361
3386
|
/* @__PURE__ */ B("code", { children: "rootPath" }),
|
|
3362
3387
|
" prop, or open the app once so the SDK creates it."
|
|
3363
3388
|
]
|
|
3364
|
-
}) : /* @__PURE__ */ B(
|
|
3389
|
+
}) : /* @__PURE__ */ B(Nr, {
|
|
3365
3390
|
icon: "triangleAlert",
|
|
3366
3391
|
tone: "error",
|
|
3367
3392
|
title: "Can’t read private storage",
|
|
3368
3393
|
action: e,
|
|
3369
3394
|
children: D
|
|
3370
3395
|
});
|
|
3371
|
-
} else He = ee ? j.length === 0 ? /* @__PURE__ */ B(
|
|
3396
|
+
} else He = ee ? j.length === 0 ? /* @__PURE__ */ B(Nr, {
|
|
3372
3397
|
icon: "folderOpen",
|
|
3373
3398
|
title: `No files in ${C} yet`,
|
|
3374
3399
|
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."
|
|
3375
|
-
}) : W.folders.length === 0 && G.length === 0 ? ae ? /* @__PURE__ */ V(
|
|
3400
|
+
}) : W.folders.length === 0 && G.length === 0 ? ae ? /* @__PURE__ */ V(Nr, {
|
|
3376
3401
|
icon: "search",
|
|
3377
3402
|
title: `No matches for “${ae}”`,
|
|
3378
3403
|
action: /* @__PURE__ */ B("button", {
|
|
@@ -3386,7 +3411,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3386
3411
|
Z[Z.length - 1].label,
|
|
3387
3412
|
" and every folder inside it."
|
|
3388
3413
|
]
|
|
3389
|
-
}) : /* @__PURE__ */ B(
|
|
3414
|
+
}) : /* @__PURE__ */ B(Nr, {
|
|
3390
3415
|
icon: "folderOpen",
|
|
3391
3416
|
title: "This folder is empty",
|
|
3392
3417
|
children: "Everything in it has been deleted or filtered out."
|
|
@@ -3409,7 +3434,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3409
3434
|
}), /* @__PURE__ */ V("span", {
|
|
3410
3435
|
className: "seed-fm-folder-meta",
|
|
3411
3436
|
children: [
|
|
3412
|
-
|
|
3437
|
+
Dr(e.fileCount, "file"),
|
|
3413
3438
|
" · ",
|
|
3414
3439
|
Q(e.size)
|
|
3415
3440
|
]
|
|
@@ -3428,15 +3453,15 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3428
3453
|
})] }, e.path))
|
|
3429
3454
|
})] }), G.length > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3430
3455
|
className: "seed-fm-section-label",
|
|
3431
|
-
children: ae ?
|
|
3432
|
-
}), ye === "grid" ? /* @__PURE__ */ B(
|
|
3456
|
+
children: ae ? Dr(G.length, "result") : "Files"
|
|
3457
|
+
}), ye === "grid" ? /* @__PURE__ */ B(ir, {
|
|
3433
3458
|
entries: G,
|
|
3434
3459
|
selected: N,
|
|
3435
3460
|
onActivate: Y,
|
|
3436
3461
|
onToggle: Se,
|
|
3437
3462
|
className: h.grid,
|
|
3438
3463
|
tileClassName: h.tile
|
|
3439
|
-
}) : /* @__PURE__ */ B(
|
|
3464
|
+
}) : /* @__PURE__ */ B(ar, {
|
|
3440
3465
|
entries: G,
|
|
3441
3466
|
selected: N,
|
|
3442
3467
|
cwd: M,
|
|
@@ -3480,7 +3505,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3480
3505
|
children: d
|
|
3481
3506
|
})]
|
|
3482
3507
|
}),
|
|
3483
|
-
ee && !D && /* @__PURE__ */ B(
|
|
3508
|
+
ee && !D && /* @__PURE__ */ B(Mr, {
|
|
3484
3509
|
files: k,
|
|
3485
3510
|
estimate: ne
|
|
3486
3511
|
}),
|
|
@@ -3653,7 +3678,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3653
3678
|
})
|
|
3654
3679
|
]
|
|
3655
3680
|
}),
|
|
3656
|
-
q && /* @__PURE__ */ B(
|
|
3681
|
+
q && /* @__PURE__ */ B(lr, {
|
|
3657
3682
|
entry: q,
|
|
3658
3683
|
className: h.panel,
|
|
3659
3684
|
onClose: we,
|
|
@@ -3664,7 +3689,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3664
3689
|
deleteAction: je([q]),
|
|
3665
3690
|
onCopyPath: () => Ie(q.file.path)
|
|
3666
3691
|
}, "panel"),
|
|
3667
|
-
R && /* @__PURE__ */ B(
|
|
3692
|
+
R && /* @__PURE__ */ B(xn, {
|
|
3668
3693
|
entries: R,
|
|
3669
3694
|
rootPath: S,
|
|
3670
3695
|
warning: v(Ue),
|
|
@@ -3676,7 +3701,7 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3676
3701
|
fe(null), Me(t);
|
|
3677
3702
|
}
|
|
3678
3703
|
}),
|
|
3679
|
-
H && /* @__PURE__ */ B(
|
|
3704
|
+
H && /* @__PURE__ */ B(Sn, {
|
|
3680
3705
|
folder: H,
|
|
3681
3706
|
files: We,
|
|
3682
3707
|
hiddenCount: T.filter((e) => e.path.startsWith(`${H.path}/`)).length - We.length,
|
|
@@ -3707,15 +3732,15 @@ function Nr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3707
3732
|
}
|
|
3708
3733
|
//#endregion
|
|
3709
3734
|
//#region src/useEnsureLocalImage.ts
|
|
3710
|
-
var
|
|
3735
|
+
var Fr = (e) => {
|
|
3711
3736
|
try {
|
|
3712
3737
|
return e.getService?.()?.getSnapshot?.()?.context?.storageTransactionId || void 0;
|
|
3713
3738
|
} catch {
|
|
3714
3739
|
return;
|
|
3715
3740
|
}
|
|
3716
3741
|
};
|
|
3717
|
-
function
|
|
3718
|
-
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, d] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ =
|
|
3742
|
+
function Ir(e) {
|
|
3743
|
+
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, d] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ = Fr(t), v = o(() => ie(_) ?? ie(r) ?? ie(m) ?? ie(g), [
|
|
3719
3744
|
_,
|
|
3720
3745
|
r,
|
|
3721
3746
|
m,
|
|
@@ -3783,23 +3808,23 @@ function Fr(e) {
|
|
|
3783
3808
|
}
|
|
3784
3809
|
//#endregion
|
|
3785
3810
|
//#region src/SeedImage.tsx
|
|
3786
|
-
var
|
|
3811
|
+
var Lr = R("seedSdk:react:SeedImage"), Rr = /* @__PURE__ */ new Map(), zr = (e) => {
|
|
3787
3812
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
3788
3813
|
return t && t[2] ? t[2] : e;
|
|
3789
3814
|
};
|
|
3790
|
-
function
|
|
3815
|
+
function Br(e) {
|
|
3791
3816
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3792
3817
|
}
|
|
3793
|
-
function
|
|
3794
|
-
let n = RegExp(`^${
|
|
3818
|
+
function Vr(e, t) {
|
|
3819
|
+
let n = RegExp(`^${Br(t)}$`), r = zr(e);
|
|
3795
3820
|
return n.test(r);
|
|
3796
3821
|
}
|
|
3797
|
-
var
|
|
3822
|
+
var Hr = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o }) => {
|
|
3798
3823
|
let [s, l] = c(), [u, d] = c(), { property: p } = Ve({
|
|
3799
3824
|
propertyName: t.propertyName,
|
|
3800
3825
|
seedLocalId: t.seedLocalId,
|
|
3801
3826
|
seedUid: t.seedUid
|
|
3802
|
-
}), m = t ?? p, h = r ?? m?.refResolvedValue ?? m?.value, { status: g, gatewayHref: _, onGatewayError: v } =
|
|
3827
|
+
}), m = t ?? p, h = r ?? m?.refResolvedValue ?? m?.value, { status: g, gatewayHref: _, onGatewayError: v } = Ir({
|
|
3803
3828
|
imageProperty: m ?? t,
|
|
3804
3829
|
filename: r,
|
|
3805
3830
|
width: n,
|
|
@@ -3821,7 +3846,7 @@ var Vr = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o
|
|
|
3821
3846
|
!e && n && d(n);
|
|
3822
3847
|
}
|
|
3823
3848
|
} catch (e) {
|
|
3824
|
-
|
|
3849
|
+
Lr("_getOriginalContentUrl error", e);
|
|
3825
3850
|
}
|
|
3826
3851
|
})(), () => {
|
|
3827
3852
|
e = !0;
|
|
@@ -3837,25 +3862,25 @@ var Vr = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o
|
|
|
3837
3862
|
try {
|
|
3838
3863
|
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));
|
|
3839
3864
|
if (r.length === 0) return;
|
|
3840
|
-
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a =
|
|
3841
|
-
if (
|
|
3842
|
-
let e =
|
|
3865
|
+
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a = zr(h), o = `${a}-${i}`;
|
|
3866
|
+
if (Rr.has(o)) try {
|
|
3867
|
+
let e = Rr.get(o);
|
|
3843
3868
|
if (e && (await fetch(e)).ok) {
|
|
3844
3869
|
l(e);
|
|
3845
3870
|
return;
|
|
3846
3871
|
}
|
|
3847
3872
|
} catch (e) {
|
|
3848
|
-
|
|
3873
|
+
Lr("error", e), Rr.delete(o);
|
|
3849
3874
|
}
|
|
3850
|
-
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ?
|
|
3875
|
+
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ? Vr(e.name, a) : !1);
|
|
3851
3876
|
if (!s) return;
|
|
3852
3877
|
let c = `${t}/${i}/${s?.name}`;
|
|
3853
3878
|
if (await f.pathExists(c)) {
|
|
3854
3879
|
let e = await f.getContentUrlFromPath(c);
|
|
3855
|
-
e && (
|
|
3880
|
+
e && (Rr.set(o, e), l(e));
|
|
3856
3881
|
}
|
|
3857
3882
|
} catch (e) {
|
|
3858
|
-
|
|
3883
|
+
Lr("_getSizedContentUrl error", e);
|
|
3859
3884
|
}
|
|
3860
3885
|
})();
|
|
3861
3886
|
}, [
|
|
@@ -3880,7 +3905,7 @@ var Vr = e.memo(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o
|
|
|
3880
3905
|
});
|
|
3881
3906
|
//#endregion
|
|
3882
3907
|
//#region src/useResolvedMediaRef.ts
|
|
3883
|
-
function
|
|
3908
|
+
function Ur(e) {
|
|
3884
3909
|
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");
|
|
3885
3910
|
i(() => {
|
|
3886
3911
|
let e = !1, n;
|
|
@@ -3923,8 +3948,8 @@ function Hr(e) {
|
|
|
3923
3948
|
}
|
|
3924
3949
|
//#endregion
|
|
3925
3950
|
//#region src/SeedMediaImage.tsx
|
|
3926
|
-
function
|
|
3927
|
-
let { href: o } =
|
|
3951
|
+
function Wr({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
3952
|
+
let { href: o } = Ur({
|
|
3928
3953
|
value: e,
|
|
3929
3954
|
enabled: t,
|
|
3930
3955
|
treatAs: n
|
|
@@ -3939,14 +3964,14 @@ function Ur({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
3939
3964
|
}
|
|
3940
3965
|
//#endregion
|
|
3941
3966
|
//#region src/SeedMediaFile.tsx
|
|
3942
|
-
function
|
|
3967
|
+
function Gr(e) {
|
|
3943
3968
|
try {
|
|
3944
3969
|
return new URL(e).pathname.split("/").filter(Boolean).pop() || "Open";
|
|
3945
3970
|
} catch {
|
|
3946
3971
|
return "Open";
|
|
3947
3972
|
}
|
|
3948
3973
|
}
|
|
3949
|
-
function
|
|
3974
|
+
function Kr(e) {
|
|
3950
3975
|
try {
|
|
3951
3976
|
let t = new URL(e).protocol;
|
|
3952
3977
|
return t === "http:" || t === "https:";
|
|
@@ -3954,27 +3979,27 @@ function Gr(e) {
|
|
|
3954
3979
|
return !1;
|
|
3955
3980
|
}
|
|
3956
3981
|
}
|
|
3957
|
-
function
|
|
3958
|
-
let { href: l } =
|
|
3982
|
+
function qr({ value: e, enabled: t, treatAs: n, download: r, render: i, children: a, target: o, rel: s, ...c }) {
|
|
3983
|
+
let { href: l } = Ur({
|
|
3959
3984
|
value: e,
|
|
3960
3985
|
enabled: t,
|
|
3961
3986
|
treatAs: n
|
|
3962
3987
|
});
|
|
3963
3988
|
if (!l) return null;
|
|
3964
|
-
let u =
|
|
3989
|
+
let u = Kr(l), d = o === void 0 ? u ? "_blank" : void 0 : o, f = {
|
|
3965
3990
|
...c,
|
|
3966
3991
|
href: l,
|
|
3967
3992
|
download: r,
|
|
3968
3993
|
target: d,
|
|
3969
3994
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
3970
|
-
children: a ??
|
|
3995
|
+
children: a ?? Gr(l)
|
|
3971
3996
|
};
|
|
3972
3997
|
return i ? /* @__PURE__ */ B(z, { children: i(f) }) : /* @__PURE__ */ B("a", { ...f });
|
|
3973
3998
|
}
|
|
3974
3999
|
//#endregion
|
|
3975
4000
|
//#region src/SeedMediaAudio.tsx
|
|
3976
|
-
function
|
|
3977
|
-
let { href: o } =
|
|
4001
|
+
function Jr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4002
|
+
let { href: o } = Ur({
|
|
3978
4003
|
value: e,
|
|
3979
4004
|
enabled: t,
|
|
3980
4005
|
treatAs: n
|
|
@@ -3989,8 +4014,8 @@ function qr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
3989
4014
|
}
|
|
3990
4015
|
//#endregion
|
|
3991
4016
|
//#region src/SeedMediaVideo.tsx
|
|
3992
|
-
function
|
|
3993
|
-
let { href: o } =
|
|
4017
|
+
function Yr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4018
|
+
let { href: o } = Ur({
|
|
3994
4019
|
value: e,
|
|
3995
4020
|
enabled: t,
|
|
3996
4021
|
treatAs: n
|
|
@@ -4005,11 +4030,11 @@ function Jr({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4005
4030
|
}
|
|
4006
4031
|
//#endregion
|
|
4007
4032
|
//#region src/SeedHtml.tsx
|
|
4008
|
-
function
|
|
4033
|
+
function Xr(e) {
|
|
4009
4034
|
return typeof e == "string" && e.trim().length > 0;
|
|
4010
4035
|
}
|
|
4011
|
-
function
|
|
4012
|
-
if (!
|
|
4036
|
+
function Zr({ html: e, sanitize: t, render: n, ...r }) {
|
|
4037
|
+
if (!Xr(e)) return null;
|
|
4013
4038
|
let i = t(e);
|
|
4014
4039
|
return n ? /* @__PURE__ */ B(z, { children: n({ html: i }) }) : /* @__PURE__ */ B("div", {
|
|
4015
4040
|
...r,
|
|
@@ -4018,46 +4043,46 @@ function Xr({ html: e, sanitize: t, render: n, ...r }) {
|
|
|
4018
4043
|
}
|
|
4019
4044
|
//#endregion
|
|
4020
4045
|
//#region src/formatSeedJson.ts
|
|
4021
|
-
function
|
|
4046
|
+
function Qr(e, t) {
|
|
4022
4047
|
return e.length <= t ? e : `${e.slice(0, t)}…`;
|
|
4023
4048
|
}
|
|
4024
|
-
function
|
|
4049
|
+
function $r(e) {
|
|
4025
4050
|
let t = e.trim();
|
|
4026
4051
|
return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
|
|
4027
4052
|
}
|
|
4028
|
-
function
|
|
4053
|
+
function ei(e, t, n, r, i) {
|
|
4029
4054
|
if (typeof e == "bigint") return String(e);
|
|
4030
4055
|
if (typeof e == "symbol") return e.toString();
|
|
4031
4056
|
if (typeof e == "function") return "[Function]";
|
|
4032
4057
|
if (e instanceof Date) return e.toISOString();
|
|
4033
|
-
if (typeof e == "string") return
|
|
4058
|
+
if (typeof e == "string") return Qr(e, n);
|
|
4034
4059
|
if (typeof e != "object" || !e) return e;
|
|
4035
4060
|
if (i.has(e)) return "[Circular]";
|
|
4036
4061
|
if (r >= t) return "[Max depth]";
|
|
4037
4062
|
i.add(e);
|
|
4038
4063
|
try {
|
|
4039
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
4064
|
+
if (Array.isArray(e)) return e.map((e) => ei(e, t, n, r + 1, i));
|
|
4040
4065
|
let a = {};
|
|
4041
|
-
for (let [o, s] of Object.entries(e)) a[o] =
|
|
4066
|
+
for (let [o, s] of Object.entries(e)) a[o] = ei(s, t, n, r + 1, i);
|
|
4042
4067
|
return a;
|
|
4043
4068
|
} finally {
|
|
4044
4069
|
i.delete(e);
|
|
4045
4070
|
}
|
|
4046
4071
|
}
|
|
4047
|
-
function
|
|
4072
|
+
function ti(e, t) {
|
|
4048
4073
|
let n = t?.maxDepth ?? 6, r = t?.maxStringLength ?? 5e4, i = t?.space ?? 2;
|
|
4049
4074
|
if (e === void 0) return "undefined";
|
|
4050
4075
|
if (e === null) return "null";
|
|
4051
4076
|
let a = e;
|
|
4052
4077
|
if (typeof e == "string") {
|
|
4053
|
-
if (
|
|
4078
|
+
if ($r(e)) try {
|
|
4054
4079
|
a = JSON.parse(e);
|
|
4055
4080
|
} catch {
|
|
4056
|
-
return
|
|
4081
|
+
return Qr(e, r);
|
|
4057
4082
|
}
|
|
4058
|
-
else return
|
|
4083
|
+
else return Qr(e, r);
|
|
4059
4084
|
}
|
|
4060
|
-
let o =
|
|
4085
|
+
let o = ei(a, n, r, 0, /* @__PURE__ */ new WeakSet());
|
|
4061
4086
|
try {
|
|
4062
4087
|
return JSON.stringify(o, null, i);
|
|
4063
4088
|
} catch {
|
|
@@ -4066,8 +4091,8 @@ function ei(e, t) {
|
|
|
4066
4091
|
}
|
|
4067
4092
|
//#endregion
|
|
4068
4093
|
//#region src/SeedJson.tsx
|
|
4069
|
-
function
|
|
4070
|
-
let a = t ? t(e) :
|
|
4094
|
+
function ni({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4095
|
+
let a = t ? t(e) : ti(e, n);
|
|
4071
4096
|
return r ? /* @__PURE__ */ B(z, { children: r({ text: a }) }) : /* @__PURE__ */ B("pre", {
|
|
4072
4097
|
...i,
|
|
4073
4098
|
children: a
|
|
@@ -4075,10 +4100,10 @@ function ti({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
|
4075
4100
|
}
|
|
4076
4101
|
//#endregion
|
|
4077
4102
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4078
|
-
function
|
|
4103
|
+
function ri(e, t) {
|
|
4079
4104
|
return o(() => e ? ae(e, t) : {}, [e, t]);
|
|
4080
4105
|
}
|
|
4081
4106
|
//#endregion
|
|
4082
|
-
export { J as ADDRESSES_PERSISTED_EVENT, Ft as FILES_QUERY_KEY_PREFIX, xe as LOCAL_COPIES_REMOVED_EVENT,
|
|
4107
|
+
export { J as ADDRESSES_PERSISTED_EVENT, Ft as FILES_QUERY_KEY_PREFIX, xe as LOCAL_COPIES_REMOVED_EVENT, Pr as OPFSFilesManager, mr as OPFS_FILES_MANAGER_CSS, Jt as SeedClientGate, Zr as SeedHtml, Hr as SeedImage, ni as SeedJson, Jr as SeedMediaAudio, qr as SeedMediaFile, Wr as SeedMediaImage, Yr as SeedMediaVideo, Kt as SeedProvider, X as createSeedQueryClient, ti as formatSeedJson, Be as getItemPropertyQueryKey, Ne as getItemQueryKey, Oe as getSeedQueryDefaultOptions, Qe as getServiceName, et as getServiceUniqueKey, $e as getServiceValue, Ut as invalidateItemPropertiesForItem, Je as isDbReadyState, ke as mergeSeedQueryDefaults, ht as useAllSchemaVersions, Le as useCreateItem, Ge as useCreateItemProperty, xt as useCreateModel, At as useCreateModelProperty, pt as useCreateSchema, Ye as useDbsAreReady, He as useDebouncedItemProperty, Mt as useDeleteItem, Ke as useDestroyItemProperty, St as useDestroyModel, jt as useDestroyModelProperty, mt as useDestroySchema, Vt as useEasSyncProcessById, zt as useEasSyncProcesses, Bt as useEasSyncProcessesNonActiveCount, Rt as useEasSyncProcessesState, Ir as useEnsureLocalImage, It as useFiles, st as useGlobalServiceStatus, it as useHasSavedSnapshots, Pt as useImageFiles, q as useIsClientReady, nt as useIsDbReady, Pe as useItem, We as useItemProperties, Ve as useItemProperty, Ie as useItems, Y as useLiveQuery, Ee as useLiveQueryState, bt as useModel, wt as useModelProperties, kt as useModelProperty, yt as useModels, ri as useNormalizedFeedItemFields, un as useOPFSFiles, rt as usePersistedSnapshots, Re as usePublishItem, Ur as useResolvedMediaRef, lt as useSchema, ft as useSchemas, Ce as useSeedAddressRevision, gt as useSeedProtocolSchema, tt as useService, ot as useServices, gr as useStorageEstimate, $n as useThumbnail };
|
|
4083
4108
|
|
|
4084
4109
|
//# sourceMappingURL=index.js.map
|