@seedprotocol/react 0.7.13 → 0.7.14-next.1599.gf17a207
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 +5 -1
- package/dist/SeedClientGate.d.ts.map +1 -1
- package/dist/SeedProvider.d.ts +5 -1
- package/dist/SeedProvider.d.ts.map +1 -1
- package/dist/index.js +324 -297
- package/dist/index.js.map +1 -1
- package/dist/useAddressesProp.d.ts +10 -0
- package/dist/useAddressesProp.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1633,14 +1633,38 @@ function An(e) {
|
|
|
1633
1633
|
};
|
|
1634
1634
|
}
|
|
1635
1635
|
//#endregion
|
|
1636
|
+
//#region src/useAddressesProp.ts
|
|
1637
|
+
function jn(e, t, n) {
|
|
1638
|
+
let r = s(e);
|
|
1639
|
+
r.current = e;
|
|
1640
|
+
let a = JSON.stringify(e ?? null), o = s(a), c = s(Promise.resolve());
|
|
1641
|
+
i(() => {
|
|
1642
|
+
if (a === o.current) return;
|
|
1643
|
+
o.current = a;
|
|
1644
|
+
let e = r.current;
|
|
1645
|
+
e !== void 0 && (c.current = c.current.then(async () => {
|
|
1646
|
+
try {
|
|
1647
|
+
await t.current;
|
|
1648
|
+
} catch {
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
try {
|
|
1652
|
+
await E.setAddresses(e);
|
|
1653
|
+
} catch (e) {
|
|
1654
|
+
console.error(`[${n}] setAddresses failed`, e);
|
|
1655
|
+
}
|
|
1656
|
+
}));
|
|
1657
|
+
}, [a]);
|
|
1658
|
+
}
|
|
1659
|
+
//#endregion
|
|
1636
1660
|
//#region src/SeedProvider.tsx
|
|
1637
|
-
var
|
|
1638
|
-
function
|
|
1639
|
-
return Promise.resolve(
|
|
1661
|
+
var Mn = null;
|
|
1662
|
+
function Nn(e) {
|
|
1663
|
+
return Promise.resolve(Mn?.(e));
|
|
1640
1664
|
}
|
|
1641
|
-
function
|
|
1665
|
+
function Pn({ queryClient: e }) {
|
|
1642
1666
|
return i(() => {
|
|
1643
|
-
|
|
1667
|
+
Mn = (t) => e.invalidateQueries({ queryKey: [
|
|
1644
1668
|
"seed",
|
|
1645
1669
|
"itemProperties",
|
|
1646
1670
|
t
|
|
@@ -1652,27 +1676,27 @@ function Nn({ queryClient: e }) {
|
|
|
1652
1676
|
});
|
|
1653
1677
|
};
|
|
1654
1678
|
return k.on(g, t), () => {
|
|
1655
|
-
k.off(g, t),
|
|
1679
|
+
k.off(g, t), Mn = null;
|
|
1656
1680
|
};
|
|
1657
1681
|
}, [e]), null;
|
|
1658
1682
|
}
|
|
1659
|
-
function
|
|
1683
|
+
function Fn({ config: e, addresses: t, onInitError: n }) {
|
|
1660
1684
|
let r = s(n);
|
|
1661
1685
|
r.current = n;
|
|
1662
1686
|
let a = s(t);
|
|
1663
1687
|
a.current = t;
|
|
1664
|
-
let o =
|
|
1688
|
+
let o = s(void 0);
|
|
1665
1689
|
return i(() => {
|
|
1666
1690
|
let t = a.current === void 0 ? { config: e } : {
|
|
1667
1691
|
config: e,
|
|
1668
1692
|
addresses: a.current
|
|
1669
1693
|
};
|
|
1670
|
-
E.init(t).catch((e) => {
|
|
1694
|
+
o.current = E.init(t), o.current.catch((e) => {
|
|
1671
1695
|
r.current ? r.current(e) : console.error("[SeedProvider] client init failed", e);
|
|
1672
1696
|
});
|
|
1673
|
-
}, [e, o
|
|
1697
|
+
}, [e]), jn(t, o, "SeedProvider"), null;
|
|
1674
1698
|
}
|
|
1675
|
-
function
|
|
1699
|
+
function In({ children: e, config: t, addresses: n, onInitError: r, queryClient: i, queryClientRef: a }) {
|
|
1676
1700
|
let s = o(() => i ?? Ge(), [i]);
|
|
1677
1701
|
if (a && (a.current = s, typeof window < "u")) {
|
|
1678
1702
|
let e = window;
|
|
@@ -1686,8 +1710,8 @@ function Fn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1686
1710
|
children: /* @__PURE__ */ W(Le, {
|
|
1687
1711
|
queryClient: s,
|
|
1688
1712
|
children: [
|
|
1689
|
-
/* @__PURE__ */ U(
|
|
1690
|
-
t && /* @__PURE__ */ U(
|
|
1713
|
+
/* @__PURE__ */ U(Pn, { queryClient: s }),
|
|
1714
|
+
t && /* @__PURE__ */ U(Fn, {
|
|
1691
1715
|
config: t,
|
|
1692
1716
|
addresses: n,
|
|
1693
1717
|
onInitError: r
|
|
@@ -1699,7 +1723,7 @@ function Fn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1699
1723
|
}
|
|
1700
1724
|
//#endregion
|
|
1701
1725
|
//#region src/SeedClientGate.tsx
|
|
1702
|
-
function
|
|
1726
|
+
function Ln() {
|
|
1703
1727
|
return /* @__PURE__ */ U("div", {
|
|
1704
1728
|
style: {
|
|
1705
1729
|
display: "flex",
|
|
@@ -1711,21 +1735,24 @@ function In() {
|
|
|
1711
1735
|
children: "Loading..."
|
|
1712
1736
|
});
|
|
1713
1737
|
}
|
|
1714
|
-
function
|
|
1738
|
+
function Rn(e) {
|
|
1715
1739
|
try {
|
|
1716
1740
|
return JSON.stringify(e ?? null);
|
|
1717
1741
|
} catch {
|
|
1718
1742
|
return e;
|
|
1719
1743
|
}
|
|
1720
1744
|
}
|
|
1721
|
-
function
|
|
1745
|
+
function zn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1722
1746
|
let l = Y(), u = s(o);
|
|
1723
1747
|
u.current = o;
|
|
1724
1748
|
let d = s(e);
|
|
1725
1749
|
d.current = e;
|
|
1726
1750
|
let f = s(t);
|
|
1727
1751
|
f.current = t;
|
|
1728
|
-
let p =
|
|
1752
|
+
let p = s(void 0), m = Rn({
|
|
1753
|
+
...e,
|
|
1754
|
+
addresses: void 0
|
|
1755
|
+
}), h = Rn(t);
|
|
1729
1756
|
i(() => {
|
|
1730
1757
|
let e = d.current, t = f.current, n = t ? {
|
|
1731
1758
|
...e,
|
|
@@ -1734,16 +1761,16 @@ function Rn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1734
1761
|
schema: t
|
|
1735
1762
|
}
|
|
1736
1763
|
} : e;
|
|
1737
|
-
E.init(n).catch((e) => {
|
|
1764
|
+
p.current = E.init(n), p.current.catch((e) => {
|
|
1738
1765
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1739
1766
|
});
|
|
1740
|
-
}, [
|
|
1741
|
-
let
|
|
1767
|
+
}, [m, h]), jn(e.addresses, p, "SeedClientGate");
|
|
1768
|
+
let g = n ?? /* @__PURE__ */ U(Ln, {}), _ = r ? void 0 : {
|
|
1742
1769
|
position: "relative",
|
|
1743
1770
|
display: "flex",
|
|
1744
1771
|
height: "100vh",
|
|
1745
1772
|
width: "100vw"
|
|
1746
|
-
},
|
|
1773
|
+
}, v = {
|
|
1747
1774
|
display: l ? "none" : "flex",
|
|
1748
1775
|
...!a && {
|
|
1749
1776
|
position: "absolute",
|
|
@@ -1755,12 +1782,12 @@ function Rn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1755
1782
|
};
|
|
1756
1783
|
return /* @__PURE__ */ W("div", {
|
|
1757
1784
|
className: r,
|
|
1758
|
-
style:
|
|
1785
|
+
style: _,
|
|
1759
1786
|
children: [/* @__PURE__ */ U("div", {
|
|
1760
1787
|
className: a,
|
|
1761
|
-
style:
|
|
1788
|
+
style: v,
|
|
1762
1789
|
"aria-hidden": l,
|
|
1763
|
-
children:
|
|
1790
|
+
children: g
|
|
1764
1791
|
}), /* @__PURE__ */ U("div", {
|
|
1765
1792
|
style: {
|
|
1766
1793
|
flex: 1,
|
|
@@ -1773,54 +1800,54 @@ function Rn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1773
1800
|
}
|
|
1774
1801
|
//#endregion
|
|
1775
1802
|
//#region src/opfsPaths.ts
|
|
1776
|
-
function
|
|
1803
|
+
function Bn(e) {
|
|
1777
1804
|
let t = e.split("/").filter(Boolean);
|
|
1778
1805
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1779
1806
|
return t;
|
|
1780
1807
|
}
|
|
1781
|
-
async function
|
|
1808
|
+
async function Vn(e, t) {
|
|
1782
1809
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1783
1810
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1784
1811
|
return n;
|
|
1785
1812
|
}
|
|
1786
|
-
async function
|
|
1787
|
-
let n =
|
|
1813
|
+
async function Hn(e, t) {
|
|
1814
|
+
let n = Bn(e), r = n.pop();
|
|
1788
1815
|
return {
|
|
1789
|
-
dir: await
|
|
1816
|
+
dir: await Vn(n.join("/"), t),
|
|
1790
1817
|
name: r
|
|
1791
1818
|
};
|
|
1792
1819
|
}
|
|
1793
|
-
async function Hn(e, t) {
|
|
1794
|
-
let { dir: n, name: r } = await Vn(e, t);
|
|
1795
|
-
return n.getFileHandle(r);
|
|
1796
|
-
}
|
|
1797
1820
|
async function Un(e, t) {
|
|
1798
|
-
|
|
1821
|
+
let { dir: n, name: r } = await Hn(e, t);
|
|
1822
|
+
return n.getFileHandle(r);
|
|
1799
1823
|
}
|
|
1800
1824
|
async function Wn(e, t) {
|
|
1801
|
-
|
|
1802
|
-
await n.removeEntry(r);
|
|
1825
|
+
return (await Un(e, t)).getFile();
|
|
1803
1826
|
}
|
|
1804
1827
|
async function Gn(e, t) {
|
|
1828
|
+
let { dir: n, name: r } = await Hn(e, t);
|
|
1829
|
+
await n.removeEntry(r);
|
|
1830
|
+
}
|
|
1831
|
+
async function Kn(e, t) {
|
|
1805
1832
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1806
1833
|
for await (let e of n.entries()) r.push(e);
|
|
1807
1834
|
let i = !0;
|
|
1808
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1835
|
+
for (let [e, t] of r) (t.kind === "file" || !await Kn(n, e)) && (i = !1);
|
|
1809
1836
|
return i && await e.removeEntry(t), i;
|
|
1810
1837
|
}
|
|
1811
|
-
async function
|
|
1838
|
+
async function qn(e, t) {
|
|
1812
1839
|
try {
|
|
1813
|
-
let { dir: n, name: r } = await
|
|
1814
|
-
return await
|
|
1840
|
+
let { dir: n, name: r } = await Hn(e, t);
|
|
1841
|
+
return await Kn(n, r);
|
|
1815
1842
|
} catch (e) {
|
|
1816
1843
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1817
1844
|
throw e;
|
|
1818
1845
|
}
|
|
1819
1846
|
}
|
|
1820
|
-
function
|
|
1847
|
+
function Jn() {
|
|
1821
1848
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1822
1849
|
}
|
|
1823
|
-
var
|
|
1850
|
+
var Yn = [
|
|
1824
1851
|
{
|
|
1825
1852
|
type: "image/jpeg",
|
|
1826
1853
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1831,43 +1858,43 @@ var Jn = [
|
|
|
1831
1858
|
},
|
|
1832
1859
|
{
|
|
1833
1860
|
type: "image/gif",
|
|
1834
|
-
test: (e) =>
|
|
1861
|
+
test: (e) => Xn(e, 0, 4) === "GIF8"
|
|
1835
1862
|
},
|
|
1836
1863
|
{
|
|
1837
1864
|
type: "image/webp",
|
|
1838
|
-
test: (e) =>
|
|
1865
|
+
test: (e) => Xn(e, 0, 4) === "RIFF" && Xn(e, 8, 12) === "WEBP"
|
|
1839
1866
|
},
|
|
1840
1867
|
{
|
|
1841
1868
|
type: "image/avif",
|
|
1842
|
-
test: (e) =>
|
|
1869
|
+
test: (e) => Xn(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(Xn(e, 8, 12))
|
|
1843
1870
|
},
|
|
1844
1871
|
{
|
|
1845
1872
|
type: "application/vnd.sqlite3",
|
|
1846
|
-
test: (e) =>
|
|
1873
|
+
test: (e) => Xn(e, 0, 15) === "SQLite format 3"
|
|
1847
1874
|
},
|
|
1848
1875
|
{
|
|
1849
1876
|
type: "application/pdf",
|
|
1850
|
-
test: (e) =>
|
|
1877
|
+
test: (e) => Xn(e, 0, 5) === "%PDF-"
|
|
1851
1878
|
}
|
|
1852
1879
|
];
|
|
1853
|
-
function
|
|
1880
|
+
function Xn(e, t, n) {
|
|
1854
1881
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1855
1882
|
}
|
|
1856
|
-
function
|
|
1857
|
-
return
|
|
1883
|
+
function Zn(e) {
|
|
1884
|
+
return Yn.find((t) => t.test(e))?.type;
|
|
1858
1885
|
}
|
|
1859
|
-
async function
|
|
1860
|
-
if (e.size !== 0) return
|
|
1886
|
+
async function Qn(e) {
|
|
1887
|
+
if (e.size !== 0) return Zn(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1861
1888
|
}
|
|
1862
1889
|
//#endregion
|
|
1863
1890
|
//#region src/useOPFSFiles.ts
|
|
1864
|
-
async function
|
|
1891
|
+
async function $n(e, t = "") {
|
|
1865
1892
|
let n = [];
|
|
1866
1893
|
try {
|
|
1867
1894
|
for await (let [r, i] of e.entries()) {
|
|
1868
1895
|
let e = t ? `${t}/${r}` : r;
|
|
1869
1896
|
if (i.kind === "file") try {
|
|
1870
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1897
|
+
let t = await i.getFile(), a = t.type ? void 0 : await Qn(t).catch(() => void 0);
|
|
1871
1898
|
n.push({
|
|
1872
1899
|
name: r,
|
|
1873
1900
|
path: e,
|
|
@@ -1880,7 +1907,7 @@ async function Qn(e, t = "") {
|
|
|
1880
1907
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1881
1908
|
}
|
|
1882
1909
|
else if (i.kind === "directory") {
|
|
1883
|
-
let t = await
|
|
1910
|
+
let t = await $n(i, e);
|
|
1884
1911
|
n.push(...t);
|
|
1885
1912
|
}
|
|
1886
1913
|
}
|
|
@@ -1889,11 +1916,11 @@ async function Qn(e, t = "") {
|
|
|
1889
1916
|
}
|
|
1890
1917
|
return n;
|
|
1891
1918
|
}
|
|
1892
|
-
function
|
|
1919
|
+
function er(e = {}) {
|
|
1893
1920
|
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 () => {
|
|
1894
1921
|
s(!0), f(null), m(null);
|
|
1895
1922
|
try {
|
|
1896
|
-
let e = await
|
|
1923
|
+
let e = await $n(await Vn(t ?? ""), t || "");
|
|
1897
1924
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1898
1925
|
} catch (e) {
|
|
1899
1926
|
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);
|
|
@@ -1914,7 +1941,7 @@ function $n(e = {}) {
|
|
|
1914
1941
|
}
|
|
1915
1942
|
//#endregion
|
|
1916
1943
|
//#region src/OPFSFilesManager/format.ts
|
|
1917
|
-
var
|
|
1944
|
+
var tr = [
|
|
1918
1945
|
"B",
|
|
1919
1946
|
"KB",
|
|
1920
1947
|
"MB",
|
|
@@ -1923,32 +1950,32 @@ var er = [
|
|
|
1923
1950
|
];
|
|
1924
1951
|
function Q(e) {
|
|
1925
1952
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1926
|
-
let t = Math.min(
|
|
1927
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1953
|
+
let t = Math.min(tr.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1954
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${tr[t]}`;
|
|
1928
1955
|
}
|
|
1929
|
-
var
|
|
1930
|
-
function
|
|
1956
|
+
var nr = 6e4, rr = 60 * nr, ir = 24 * rr;
|
|
1957
|
+
function ar(e, t = Date.now()) {
|
|
1931
1958
|
let n = t - e;
|
|
1932
|
-
if (n <
|
|
1933
|
-
if (n <
|
|
1934
|
-
if (n <
|
|
1935
|
-
let r = Math.round(n /
|
|
1959
|
+
if (n < nr) return "just now";
|
|
1960
|
+
if (n < rr) return `${Math.round(n / nr)} min ago`;
|
|
1961
|
+
if (n < ir) return `${Math.round(n / rr)} h ago`;
|
|
1962
|
+
let r = Math.round(n / ir);
|
|
1936
1963
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1937
1964
|
}
|
|
1938
|
-
function
|
|
1965
|
+
function or(e) {
|
|
1939
1966
|
return new Date(e).toLocaleString(void 0, {
|
|
1940
1967
|
dateStyle: "medium",
|
|
1941
1968
|
timeStyle: "short"
|
|
1942
1969
|
});
|
|
1943
1970
|
}
|
|
1944
|
-
function
|
|
1971
|
+
function sr(e, t) {
|
|
1945
1972
|
if (e.length <= t) return e;
|
|
1946
1973
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1947
1974
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1948
1975
|
}
|
|
1949
1976
|
//#endregion
|
|
1950
1977
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1951
|
-
var
|
|
1978
|
+
var cr = {
|
|
1952
1979
|
check: /* @__PURE__ */ U("path", { d: "M20 6 9 17l-5-5" }),
|
|
1953
1980
|
chevronLeft: /* @__PURE__ */ U("path", { d: "m15 18-6-6 6-6" }),
|
|
1954
1981
|
chevronRight: /* @__PURE__ */ U("path", { d: "m9 18 6-6-6-6" }),
|
|
@@ -2133,13 +2160,13 @@ function $({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
2133
2160
|
"aria-hidden": "true",
|
|
2134
2161
|
focusable: "false",
|
|
2135
2162
|
className: r,
|
|
2136
|
-
children:
|
|
2163
|
+
children: cr[e]
|
|
2137
2164
|
});
|
|
2138
2165
|
}
|
|
2139
2166
|
//#endregion
|
|
2140
2167
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
2141
|
-
var
|
|
2142
|
-
function
|
|
2168
|
+
var lr = 6;
|
|
2169
|
+
function ur({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
2143
2170
|
let a = s(null);
|
|
2144
2171
|
return i(() => {
|
|
2145
2172
|
let e = a.current;
|
|
@@ -2165,9 +2192,9 @@ function lr({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2165
2192
|
})
|
|
2166
2193
|
});
|
|
2167
2194
|
}
|
|
2168
|
-
function
|
|
2169
|
-
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 ${
|
|
2170
|
-
return /* @__PURE__ */ W(
|
|
2195
|
+
function dr({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
2196
|
+
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 ${sr(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
2197
|
+
return /* @__PURE__ */ W(ur, {
|
|
2171
2198
|
className: o,
|
|
2172
2199
|
onCancel: i,
|
|
2173
2200
|
onSubmit: () => a(s),
|
|
@@ -2181,12 +2208,12 @@ function ur({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2181
2208
|
e.length === 1 ? "it" : "them",
|
|
2182
2209
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
2183
2210
|
] }),
|
|
2184
|
-
/* @__PURE__ */ W("ul", { children: [e.slice(0,
|
|
2211
|
+
/* @__PURE__ */ W("ul", { children: [e.slice(0, lr).map((e) => /* @__PURE__ */ W("li", { children: [/* @__PURE__ */ U("code", {
|
|
2185
2212
|
title: e.file.path,
|
|
2186
2213
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
2187
|
-
}), /* @__PURE__ */ U("span", { children: Q(e.file.size) })] }, e.file.path)), e.length >
|
|
2214
|
+
}), /* @__PURE__ */ U("span", { children: Q(e.file.size) })] }, e.file.path)), e.length > lr && /* @__PURE__ */ U("li", { children: /* @__PURE__ */ W("span", { children: [
|
|
2188
2215
|
"and ",
|
|
2189
|
-
e.length -
|
|
2216
|
+
e.length - lr,
|
|
2190
2217
|
" more"
|
|
2191
2218
|
] }) })] }),
|
|
2192
2219
|
u.length > 0 && /* @__PURE__ */ W("label", { children: [
|
|
@@ -2229,16 +2256,16 @@ function ur({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2229
2256
|
]
|
|
2230
2257
|
});
|
|
2231
2258
|
}
|
|
2232
|
-
function
|
|
2259
|
+
function fr({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
2233
2260
|
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;
|
|
2234
|
-
return /* @__PURE__ */ W(
|
|
2261
|
+
return /* @__PURE__ */ W(ur, {
|
|
2235
2262
|
className: u,
|
|
2236
2263
|
onCancel: s,
|
|
2237
2264
|
onSubmit: l,
|
|
2238
2265
|
children: [
|
|
2239
2266
|
/* @__PURE__ */ U("h3", {
|
|
2240
2267
|
id: "seed-fm-delete-title",
|
|
2241
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
2268
|
+
children: i.label ? `${i.label}?` : `Delete the “${sr(e.name, 32)}” folder?`
|
|
2242
2269
|
}),
|
|
2243
2270
|
/* @__PURE__ */ W("p", { children: [
|
|
2244
2271
|
"This removes the folder and the ",
|
|
@@ -2255,12 +2282,12 @@ function dr({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2255
2282
|
size: 16
|
|
2256
2283
|
}), /* @__PURE__ */ W("span", { children: [/* @__PURE__ */ U("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2257
2284
|
}),
|
|
2258
|
-
/* @__PURE__ */ W("ul", { children: [t.slice(0,
|
|
2285
|
+
/* @__PURE__ */ W("ul", { children: [t.slice(0, lr).map((e) => /* @__PURE__ */ W("li", { children: [/* @__PURE__ */ U("code", {
|
|
2259
2286
|
title: e.path,
|
|
2260
2287
|
children: e.path.slice(m.length)
|
|
2261
|
-
}), /* @__PURE__ */ U("span", { children: Q(e.size) })] }, e.path)), t.length >
|
|
2288
|
+
}), /* @__PURE__ */ U("span", { children: Q(e.size) })] }, e.path)), t.length > lr && /* @__PURE__ */ U("li", { children: /* @__PURE__ */ W("span", { children: [
|
|
2262
2289
|
"and ",
|
|
2263
|
-
t.length -
|
|
2290
|
+
t.length - lr,
|
|
2264
2291
|
" more"
|
|
2265
2292
|
] }) })] }),
|
|
2266
2293
|
/* @__PURE__ */ W("div", {
|
|
@@ -2319,42 +2346,42 @@ function dr({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2319
2346
|
}
|
|
2320
2347
|
//#endregion
|
|
2321
2348
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2322
|
-
function
|
|
2349
|
+
function pr(e) {
|
|
2323
2350
|
return e.detectedType ?? e.type;
|
|
2324
2351
|
}
|
|
2325
|
-
var
|
|
2326
|
-
function mr(e) {
|
|
2327
|
-
let t = fr(e);
|
|
2328
|
-
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || pr.test(e.name) ? "database" : t === "application/json" || /\.json$/i.test(e.name) ? "json" : t === "text/html" || /\.html?$/i.test(e.name) ? "html" : t.startsWith("text/") ? "text" : "other";
|
|
2329
|
-
}
|
|
2352
|
+
var mr = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2330
2353
|
function hr(e) {
|
|
2354
|
+
let t = pr(e);
|
|
2355
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || mr.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";
|
|
2356
|
+
}
|
|
2357
|
+
function gr(e) {
|
|
2331
2358
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2332
2359
|
if (t) return t.toLowerCase();
|
|
2333
|
-
let n =
|
|
2360
|
+
let n = pr(e);
|
|
2334
2361
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2335
2362
|
}
|
|
2336
|
-
var
|
|
2337
|
-
function
|
|
2338
|
-
let t =
|
|
2363
|
+
var _r = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, vr = /^(.*\/)?images\/([^/]+)$/, yr = (e) => e.replace(/\.[^/.]+$/, "");
|
|
2364
|
+
function br(e) {
|
|
2365
|
+
let t = _r.exec(e);
|
|
2339
2366
|
return t ? {
|
|
2340
2367
|
key: `${t[1] ?? ""}images/${t[3]}`,
|
|
2341
2368
|
width: Number(t[2])
|
|
2342
2369
|
} : null;
|
|
2343
2370
|
}
|
|
2344
|
-
function
|
|
2345
|
-
let t =
|
|
2346
|
-
return t ? `${t[1] ?? ""}images/${
|
|
2371
|
+
function xr(e) {
|
|
2372
|
+
let t = vr.exec(e);
|
|
2373
|
+
return t ? `${t[1] ?? ""}images/${yr(t[2])}` : null;
|
|
2347
2374
|
}
|
|
2348
|
-
var
|
|
2375
|
+
var Sr = (e) => ({
|
|
2349
2376
|
file: e,
|
|
2350
2377
|
variants: [],
|
|
2351
2378
|
totalSize: e.size
|
|
2352
2379
|
});
|
|
2353
|
-
function
|
|
2354
|
-
if (!t) return e.map(
|
|
2380
|
+
function Cr(e, t) {
|
|
2381
|
+
if (!t) return e.map(Sr);
|
|
2355
2382
|
let n = /* @__PURE__ */ new Map(), r = [], i = [];
|
|
2356
2383
|
for (let t of e) {
|
|
2357
|
-
let e =
|
|
2384
|
+
let e = br(t.path);
|
|
2358
2385
|
if (e) {
|
|
2359
2386
|
i.push({
|
|
2360
2387
|
file: t,
|
|
@@ -2362,27 +2389,27 @@ function Sr(e, t) {
|
|
|
2362
2389
|
});
|
|
2363
2390
|
continue;
|
|
2364
2391
|
}
|
|
2365
|
-
let a =
|
|
2392
|
+
let a = Sr(t);
|
|
2366
2393
|
r.push(a);
|
|
2367
|
-
let o =
|
|
2368
|
-
o &&
|
|
2394
|
+
let o = xr(t.path);
|
|
2395
|
+
o && hr(t) === "image" && n.set(o, a);
|
|
2369
2396
|
}
|
|
2370
2397
|
for (let e of i) {
|
|
2371
2398
|
let t = n.get(e.key);
|
|
2372
2399
|
t ? (t.variants.push({
|
|
2373
2400
|
file: e.file,
|
|
2374
2401
|
width: e.width
|
|
2375
|
-
}), t.totalSize += e.file.size) : r.push(
|
|
2402
|
+
}), t.totalSize += e.file.size) : r.push(Sr(e.file));
|
|
2376
2403
|
}
|
|
2377
2404
|
for (let e of n.values()) e.variants.sort((e, t) => e.width - t.width);
|
|
2378
2405
|
return r;
|
|
2379
2406
|
}
|
|
2380
|
-
var
|
|
2381
|
-
function
|
|
2407
|
+
var wr = (e, t) => e ? `${e}/${t}` : t;
|
|
2408
|
+
function Tr(e, t, n = {}) {
|
|
2382
2409
|
let r = t ? `${t}/` : "", i = e.filter((e) => e.file.path.startsWith(r)), a = n.query?.trim().toLowerCase();
|
|
2383
2410
|
if (a) return {
|
|
2384
2411
|
folders: [],
|
|
2385
|
-
entries:
|
|
2412
|
+
entries: Er(i.filter((e) => e.file.path.slice(r.length).toLowerCase().includes(a)), n.sort)
|
|
2386
2413
|
};
|
|
2387
2414
|
let o = /* @__PURE__ */ new Map(), s = [];
|
|
2388
2415
|
for (let e of i) {
|
|
@@ -2393,7 +2420,7 @@ function wr(e, t, n = {}) {
|
|
|
2393
2420
|
}
|
|
2394
2421
|
let a = n.slice(0, i), c = o.get(a) ?? {
|
|
2395
2422
|
name: a,
|
|
2396
|
-
path:
|
|
2423
|
+
path: wr(t, a),
|
|
2397
2424
|
fileCount: 0,
|
|
2398
2425
|
size: 0
|
|
2399
2426
|
};
|
|
@@ -2401,10 +2428,10 @@ function wr(e, t, n = {}) {
|
|
|
2401
2428
|
}
|
|
2402
2429
|
return {
|
|
2403
2430
|
folders: [...o.values()].sort((e, t) => e.name.localeCompare(t.name)),
|
|
2404
|
-
entries:
|
|
2431
|
+
entries: Er(s, n.sort)
|
|
2405
2432
|
};
|
|
2406
2433
|
}
|
|
2407
|
-
function
|
|
2434
|
+
function Er(e, t = "name") {
|
|
2408
2435
|
let n = {
|
|
2409
2436
|
name: (e, t) => e.file.name.localeCompare(t.file.name),
|
|
2410
2437
|
modified: (e, t) => t.file.lastModified - e.file.lastModified,
|
|
@@ -2412,7 +2439,7 @@ function Tr(e, t = "name") {
|
|
|
2412
2439
|
};
|
|
2413
2440
|
return [...e].sort(n[t]);
|
|
2414
2441
|
}
|
|
2415
|
-
function
|
|
2442
|
+
function Dr(e) {
|
|
2416
2443
|
let t = {
|
|
2417
2444
|
image: 0,
|
|
2418
2445
|
database: 0,
|
|
@@ -2421,34 +2448,34 @@ function Er(e) {
|
|
|
2421
2448
|
text: 0,
|
|
2422
2449
|
other: 0
|
|
2423
2450
|
};
|
|
2424
|
-
for (let n of e) t[
|
|
2451
|
+
for (let n of e) t[hr(n)] += n.size;
|
|
2425
2452
|
return t;
|
|
2426
2453
|
}
|
|
2427
|
-
function
|
|
2454
|
+
function Or(e) {
|
|
2428
2455
|
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;
|
|
2429
2456
|
}
|
|
2430
2457
|
//#endregion
|
|
2431
2458
|
//#region src/OPFSFilesManager/useThumbnail.ts
|
|
2432
|
-
var
|
|
2433
|
-
function
|
|
2459
|
+
var kr = 400, Ar = 262144, jr = 4, Mr = 3e4, Nr = 0, Pr = [];
|
|
2460
|
+
function Fr(e) {
|
|
2434
2461
|
return new Promise((t, n) => {
|
|
2435
2462
|
let r = () => {
|
|
2436
|
-
|
|
2437
|
-
|
|
2463
|
+
Nr++, e().then(t, n).finally(() => {
|
|
2464
|
+
Nr--, Pr.shift()?.();
|
|
2438
2465
|
});
|
|
2439
2466
|
};
|
|
2440
|
-
|
|
2467
|
+
Nr < jr ? r() : Pr.push(r);
|
|
2441
2468
|
});
|
|
2442
2469
|
}
|
|
2443
|
-
var
|
|
2444
|
-
function
|
|
2445
|
-
let n =
|
|
2470
|
+
var Ir = /* @__PURE__ */ new Map();
|
|
2471
|
+
function Lr(e, t) {
|
|
2472
|
+
let n = Ir.get(e);
|
|
2446
2473
|
if (!n) {
|
|
2447
2474
|
let r = {
|
|
2448
2475
|
refs: 0,
|
|
2449
2476
|
promise: Promise.resolve("")
|
|
2450
2477
|
};
|
|
2451
|
-
r.promise =
|
|
2478
|
+
r.promise = Fr(t).then((e) => (r.url = URL.createObjectURL(e), r.url)), Ir.set(e, r), n = r;
|
|
2452
2479
|
}
|
|
2453
2480
|
n.timer && (clearTimeout(n.timer), n.timer = void 0), n.refs++;
|
|
2454
2481
|
let r = n, i = !1;
|
|
@@ -2456,15 +2483,15 @@ function Ir(e, t) {
|
|
|
2456
2483
|
promise: r.promise,
|
|
2457
2484
|
release: () => {
|
|
2458
2485
|
i || (i = !0, r.refs--, !(r.refs > 0) && (r.timer = setTimeout(() => {
|
|
2459
|
-
r.url && URL.revokeObjectURL(r.url),
|
|
2460
|
-
},
|
|
2486
|
+
r.url && URL.revokeObjectURL(r.url), Ir.get(e) === r && Ir.delete(e);
|
|
2487
|
+
}, Mr)));
|
|
2461
2488
|
}
|
|
2462
2489
|
};
|
|
2463
2490
|
}
|
|
2464
|
-
async function
|
|
2465
|
-
if (e.size <
|
|
2491
|
+
async function Rr(e) {
|
|
2492
|
+
if (e.size < Ar || typeof createImageBitmap != "function") return e;
|
|
2466
2493
|
let t = await createImageBitmap(e, {
|
|
2467
|
-
resizeWidth:
|
|
2494
|
+
resizeWidth: kr,
|
|
2468
2495
|
resizeQuality: "medium"
|
|
2469
2496
|
});
|
|
2470
2497
|
try {
|
|
@@ -2481,22 +2508,22 @@ async function Lr(e) {
|
|
|
2481
2508
|
t.close();
|
|
2482
2509
|
}
|
|
2483
2510
|
}
|
|
2484
|
-
async function
|
|
2511
|
+
async function zr(e) {
|
|
2485
2512
|
let t = e.variants[0];
|
|
2486
|
-
return t ?
|
|
2513
|
+
return t ? Wn(t.file.path) : Rr(await Wn(e.file.path));
|
|
2487
2514
|
}
|
|
2488
|
-
var
|
|
2489
|
-
function
|
|
2490
|
-
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (
|
|
2491
|
-
for (let t of e) t.isIntersecting && (
|
|
2492
|
-
}, { rootMargin: "300px" })),
|
|
2493
|
-
|
|
2515
|
+
var Br = /* @__PURE__ */ new WeakMap(), Vr = null;
|
|
2516
|
+
function Hr(e, t) {
|
|
2517
|
+
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (Vr ?? (Vr = new IntersectionObserver((e) => {
|
|
2518
|
+
for (let t of e) t.isIntersecting && (Vr.unobserve(t.target), Br.get(t.target)?.(), Br.delete(t.target));
|
|
2519
|
+
}, { rootMargin: "300px" })), Br.set(e, t), Vr.observe(e), () => {
|
|
2520
|
+
Br.delete(e), Vr?.unobserve(e);
|
|
2494
2521
|
});
|
|
2495
2522
|
}
|
|
2496
|
-
function
|
|
2497
|
-
let t =
|
|
2523
|
+
function Ur(e) {
|
|
2524
|
+
let t = hr(e.file) === "image", [r, a] = c(null), [o, s] = c(!1), [l, u] = c(null), [d, f] = c("idle"), p = n((e) => a(e), []);
|
|
2498
2525
|
i(() => {
|
|
2499
|
-
if (t && r && !o) return
|
|
2526
|
+
if (t && r && !o) return Hr(r, () => s(!0));
|
|
2500
2527
|
}, [
|
|
2501
2528
|
t,
|
|
2502
2529
|
r,
|
|
@@ -2507,7 +2534,7 @@ function Hr(e) {
|
|
|
2507
2534
|
if (!t || !o) return;
|
|
2508
2535
|
let n = !1;
|
|
2509
2536
|
f("loading");
|
|
2510
|
-
let r =
|
|
2537
|
+
let r = Lr(_, () => zr(e));
|
|
2511
2538
|
return r.promise.then((e) => {
|
|
2512
2539
|
n || (u(e), f("ready"));
|
|
2513
2540
|
}, () => {
|
|
@@ -2530,7 +2557,7 @@ function Hr(e) {
|
|
|
2530
2557
|
}
|
|
2531
2558
|
//#endregion
|
|
2532
2559
|
//#region src/OPFSFilesManager/FileThumbnail.tsx
|
|
2533
|
-
var
|
|
2560
|
+
var Wr = {
|
|
2534
2561
|
image: {
|
|
2535
2562
|
icon: "image",
|
|
2536
2563
|
label: "Images",
|
|
@@ -2561,11 +2588,11 @@ var Ur = {
|
|
|
2561
2588
|
label: "Other",
|
|
2562
2589
|
color: "var(--seed-kind-other)"
|
|
2563
2590
|
}
|
|
2564
|
-
},
|
|
2565
|
-
function
|
|
2566
|
-
let r =
|
|
2591
|
+
}, Gr = (e) => ({ "--seed-kind": Wr[e].color }), Kr = (e) => /png|webp|gif|avif|svg/.test(pr(e.file));
|
|
2592
|
+
function qr({ entry: e, size: t, children: n }) {
|
|
2593
|
+
let r = hr(e.file), { ref: i, url: a, status: o, markError: s } = Ur(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2567
2594
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2568
|
-
l &&
|
|
2595
|
+
l && Kr(e) ? "seed-fm-thumb--checker" : "",
|
|
2569
2596
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2570
2597
|
].filter(Boolean).join(" "), d;
|
|
2571
2598
|
return d = l ? /* @__PURE__ */ U("img", {
|
|
@@ -2575,12 +2602,12 @@ function Kr({ entry: e, size: t, children: n }) {
|
|
|
2575
2602
|
draggable: !1,
|
|
2576
2603
|
onError: s
|
|
2577
2604
|
}) : t === "mini" ? /* @__PURE__ */ U($, {
|
|
2578
|
-
name: c ? "imageOff" :
|
|
2605
|
+
name: c ? "imageOff" : Wr[r].icon,
|
|
2579
2606
|
size: 16
|
|
2580
2607
|
}) : r === "image" && !c ? null : /* @__PURE__ */ W("span", {
|
|
2581
2608
|
className: "seed-fm-kind",
|
|
2582
2609
|
children: [/* @__PURE__ */ U($, {
|
|
2583
|
-
name: c ? "imageOff" :
|
|
2610
|
+
name: c ? "imageOff" : Wr[r].icon,
|
|
2584
2611
|
size: 28,
|
|
2585
2612
|
strokeWidth: 1.6
|
|
2586
2613
|
}), c ? /* @__PURE__ */ U("span", {
|
|
@@ -2588,18 +2615,18 @@ function Kr({ entry: e, size: t, children: n }) {
|
|
|
2588
2615
|
children: "Can’t decode image"
|
|
2589
2616
|
}) : /* @__PURE__ */ U("span", {
|
|
2590
2617
|
className: "seed-fm-ext",
|
|
2591
|
-
children:
|
|
2618
|
+
children: gr(e.file)
|
|
2592
2619
|
})]
|
|
2593
2620
|
}), /* @__PURE__ */ W("span", {
|
|
2594
2621
|
ref: i,
|
|
2595
2622
|
className: u,
|
|
2596
|
-
style:
|
|
2623
|
+
style: Gr(r),
|
|
2597
2624
|
children: [d, n]
|
|
2598
2625
|
});
|
|
2599
2626
|
}
|
|
2600
2627
|
//#endregion
|
|
2601
2628
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2602
|
-
function
|
|
2629
|
+
function Jr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2603
2630
|
return /* @__PURE__ */ U("ul", {
|
|
2604
2631
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2605
2632
|
role: "listbox",
|
|
@@ -2619,7 +2646,7 @@ function qr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2619
2646
|
onKeyDown: (t) => {
|
|
2620
2647
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2621
2648
|
},
|
|
2622
|
-
children: [/* @__PURE__ */ W(
|
|
2649
|
+
children: [/* @__PURE__ */ W(qr, {
|
|
2623
2650
|
entry: e,
|
|
2624
2651
|
size: "tile",
|
|
2625
2652
|
children: [/* @__PURE__ */ U("button", {
|
|
@@ -2653,7 +2680,7 @@ function qr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2653
2680
|
className: "seed-fm-tile-meta",
|
|
2654
2681
|
children: [/* @__PURE__ */ U("span", {
|
|
2655
2682
|
className: "seed-fm-tile-name",
|
|
2656
|
-
children:
|
|
2683
|
+
children: sr(o.name, 24)
|
|
2657
2684
|
}), /* @__PURE__ */ W("span", {
|
|
2658
2685
|
className: "seed-fm-tile-sub",
|
|
2659
2686
|
children: [
|
|
@@ -2662,8 +2689,8 @@ function qr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2662
2689
|
" ",
|
|
2663
2690
|
/* @__PURE__ */ U("time", {
|
|
2664
2691
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2665
|
-
title:
|
|
2666
|
-
children:
|
|
2692
|
+
title: or(o.lastModified),
|
|
2693
|
+
children: ar(o.lastModified)
|
|
2667
2694
|
})
|
|
2668
2695
|
]
|
|
2669
2696
|
})]
|
|
@@ -2674,7 +2701,7 @@ function qr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2674
2701
|
}
|
|
2675
2702
|
//#endregion
|
|
2676
2703
|
//#region src/OPFSFilesManager/FileList.tsx
|
|
2677
|
-
function
|
|
2704
|
+
function Yr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onToggleAll: o, onDownload: c, onDelete: l, deleteActionFor: u, className: d, rowClassName: f }) {
|
|
2678
2705
|
let p = s(null), m = e.filter((e) => t.has(e.file.path)).length, h = e.length > 0 && m === e.length;
|
|
2679
2706
|
i(() => {
|
|
2680
2707
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
@@ -2734,7 +2761,7 @@ function Jr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2734
2761
|
}),
|
|
2735
2762
|
/* @__PURE__ */ U("td", { children: /* @__PURE__ */ W("span", {
|
|
2736
2763
|
className: "seed-fm-namecell",
|
|
2737
|
-
children: [/* @__PURE__ */ U(
|
|
2764
|
+
children: [/* @__PURE__ */ U(qr, {
|
|
2738
2765
|
entry: e,
|
|
2739
2766
|
size: "mini"
|
|
2740
2767
|
}), /* @__PURE__ */ W("span", { children: [/* @__PURE__ */ U("button", {
|
|
@@ -2753,8 +2780,8 @@ function Jr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2753
2780
|
className: "seed-fm-col-type",
|
|
2754
2781
|
children: /* @__PURE__ */ W("span", {
|
|
2755
2782
|
className: "seed-fm-type",
|
|
2756
|
-
style:
|
|
2757
|
-
children: [
|
|
2783
|
+
style: Gr(hr(i)),
|
|
2784
|
+
children: [pr(i), i.detectedType && /* @__PURE__ */ U("small", { children: "detected" })]
|
|
2758
2785
|
})
|
|
2759
2786
|
}),
|
|
2760
2787
|
/* @__PURE__ */ U("td", {
|
|
@@ -2764,8 +2791,8 @@ function Jr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2764
2791
|
}),
|
|
2765
2792
|
/* @__PURE__ */ U("td", {
|
|
2766
2793
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2767
|
-
title:
|
|
2768
|
-
children:
|
|
2794
|
+
title: or(i.lastModified),
|
|
2795
|
+
children: ar(i.lastModified)
|
|
2769
2796
|
}),
|
|
2770
2797
|
/* @__PURE__ */ W("td", {
|
|
2771
2798
|
className: "seed-fm-actions",
|
|
@@ -2800,22 +2827,22 @@ function Jr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2800
2827
|
}
|
|
2801
2828
|
//#endregion
|
|
2802
2829
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2803
|
-
var
|
|
2804
|
-
function
|
|
2805
|
-
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o =
|
|
2830
|
+
var Xr = 1048576, Zr = 32768;
|
|
2831
|
+
function Qr(e) {
|
|
2832
|
+
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = hr(e.file), s = e.file.size;
|
|
2806
2833
|
return i(() => {
|
|
2807
2834
|
let e = !1, t = null;
|
|
2808
2835
|
return n({ kind: "loading" }), (async () => {
|
|
2809
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2836
|
+
if (o === "image") return t = URL.createObjectURL(await Wn(r)), {
|
|
2810
2837
|
kind: "image",
|
|
2811
2838
|
url: t
|
|
2812
2839
|
};
|
|
2813
2840
|
if (o === "json" || o === "html" || o === "text") {
|
|
2814
|
-
if (s >
|
|
2841
|
+
if (s > Xr) return {
|
|
2815
2842
|
kind: "none",
|
|
2816
2843
|
message: "This file is too large to preview."
|
|
2817
2844
|
};
|
|
2818
|
-
let e = await
|
|
2845
|
+
let e = await Wn(r), t = e.size > Zr, n = await e.slice(0, Zr).text();
|
|
2819
2846
|
if (o === "json" && !t) try {
|
|
2820
2847
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2821
2848
|
} catch {}
|
|
@@ -2849,8 +2876,8 @@ function Zr(e) {
|
|
|
2849
2876
|
o
|
|
2850
2877
|
]), t;
|
|
2851
2878
|
}
|
|
2852
|
-
function
|
|
2853
|
-
let { file: f, variants: p } = e, m =
|
|
2879
|
+
function $r({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onDelete: o, deleteAction: l, onCopyPath: u, className: d }) {
|
|
2880
|
+
let { file: f, variants: p } = e, m = hr(f), h = Qr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2854
2881
|
i(() => {
|
|
2855
2882
|
_(null), y(!1);
|
|
2856
2883
|
}, [f.path]), i(() => {
|
|
@@ -2873,13 +2900,13 @@ function Qr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2873
2900
|
C = /* @__PURE__ */ W("span", {
|
|
2874
2901
|
className: "seed-fm-preview-note",
|
|
2875
2902
|
children: [/* @__PURE__ */ U($, {
|
|
2876
|
-
name: v ? "imageOff" :
|
|
2903
|
+
name: v ? "imageOff" : Wr[m].icon,
|
|
2877
2904
|
size: 32,
|
|
2878
2905
|
strokeWidth: 1.5
|
|
2879
2906
|
}), e]
|
|
2880
2907
|
});
|
|
2881
2908
|
}
|
|
2882
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2909
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(pr(f));
|
|
2883
2910
|
return /* @__PURE__ */ W("aside", {
|
|
2884
2911
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2885
2912
|
role: "dialog",
|
|
@@ -2929,7 +2956,7 @@ function Qr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2929
2956
|
w ? "seed-fm-thumb--checker" : "",
|
|
2930
2957
|
h.kind === "loading" ? "seed-fm-skeleton" : ""
|
|
2931
2958
|
].filter(Boolean).join(" "),
|
|
2932
|
-
style:
|
|
2959
|
+
style: Gr(m),
|
|
2933
2960
|
children: C
|
|
2934
2961
|
}),
|
|
2935
2962
|
/* @__PURE__ */ W("dl", {
|
|
@@ -2957,7 +2984,7 @@ function Qr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2957
2984
|
/* @__PURE__ */ W("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2958
2985
|
] }),
|
|
2959
2986
|
/* @__PURE__ */ U("dt", { children: "Type" }),
|
|
2960
|
-
/* @__PURE__ */ W("dd", { children: [
|
|
2987
|
+
/* @__PURE__ */ W("dd", { children: [pr(f), f.detectedType && /* @__PURE__ */ W("small", { children: [
|
|
2961
2988
|
" from file contents. File.type is “",
|
|
2962
2989
|
f.type,
|
|
2963
2990
|
"”"
|
|
@@ -2970,9 +2997,9 @@ function Qr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2970
2997
|
] })] }),
|
|
2971
2998
|
/* @__PURE__ */ U("dt", { children: "Modified" }),
|
|
2972
2999
|
/* @__PURE__ */ W("dd", { children: [
|
|
2973
|
-
|
|
3000
|
+
or(f.lastModified),
|
|
2974
3001
|
" ",
|
|
2975
|
-
/* @__PURE__ */ U("small", { children:
|
|
3002
|
+
/* @__PURE__ */ U("small", { children: ar(f.lastModified) })
|
|
2976
3003
|
] })
|
|
2977
3004
|
]
|
|
2978
3005
|
}),
|
|
@@ -3017,18 +3044,18 @@ function Qr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
3017
3044
|
}
|
|
3018
3045
|
//#endregion
|
|
3019
3046
|
//#region src/OPFSFilesManager/styles.ts
|
|
3020
|
-
var
|
|
3047
|
+
var ei = "seed-opfs-files-manager-styles", ti = "seed-opfs-files-manager", ni = "\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", ri = "\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", ii = `@layer ${ti} {\n${`
|
|
3021
3048
|
.seed-fm {
|
|
3022
|
-
${
|
|
3049
|
+
${ni}
|
|
3023
3050
|
--seed-radius-sm: 6px;
|
|
3024
3051
|
--seed-radius-md: 8px;
|
|
3025
3052
|
--seed-radius-lg: 12px;
|
|
3026
3053
|
--seed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
3027
3054
|
color-scheme: light;
|
|
3028
3055
|
}
|
|
3029
|
-
.seed-fm[data-seed-theme="dark"] { ${
|
|
3056
|
+
.seed-fm[data-seed-theme="dark"] { ${ri} }
|
|
3030
3057
|
@media (prefers-color-scheme: dark) {
|
|
3031
|
-
.seed-fm[data-seed-theme="system"] { ${
|
|
3058
|
+
.seed-fm[data-seed-theme="system"] { ${ri} }
|
|
3032
3059
|
}
|
|
3033
3060
|
|
|
3034
3061
|
.seed-fm { position: relative; color: var(--seed-fg); background: var(--seed-bg); font-family: inherit; font-size: 14px; line-height: 1.45; }
|
|
@@ -3236,14 +3263,14 @@ var $r = "seed-opfs-files-manager-styles", ei = "seed-opfs-files-manager", ti =
|
|
|
3236
3263
|
.seed-fm-thumb img { transition: none; }
|
|
3237
3264
|
}
|
|
3238
3265
|
`}\n}`;
|
|
3239
|
-
function
|
|
3266
|
+
function ai() {
|
|
3240
3267
|
if (typeof document > "u" || document.getElementById("seed-opfs-files-manager-styles")) return;
|
|
3241
3268
|
let e = document.createElement("style");
|
|
3242
|
-
e.id =
|
|
3269
|
+
e.id = ei, e.textContent = ii, document.head.appendChild(e);
|
|
3243
3270
|
}
|
|
3244
3271
|
//#endregion
|
|
3245
3272
|
//#region src/OPFSFilesManager/useStorageEstimate.ts
|
|
3246
|
-
function
|
|
3273
|
+
function oi(e) {
|
|
3247
3274
|
let [t, n] = c(null);
|
|
3248
3275
|
return i(() => {
|
|
3249
3276
|
if (typeof navigator > "u" || typeof navigator.storage?.estimate != "function") return;
|
|
@@ -3260,40 +3287,40 @@ function ai(e) {
|
|
|
3260
3287
|
}
|
|
3261
3288
|
//#endregion
|
|
3262
3289
|
//#region src/OPFSFilesManager/zip.ts
|
|
3263
|
-
var
|
|
3264
|
-
function
|
|
3265
|
-
if (
|
|
3266
|
-
|
|
3290
|
+
var si = null;
|
|
3291
|
+
function ci() {
|
|
3292
|
+
if (si) return si;
|
|
3293
|
+
si = /* @__PURE__ */ new Uint32Array(256);
|
|
3267
3294
|
for (let e = 0; e < 256; e++) {
|
|
3268
3295
|
let t = e;
|
|
3269
3296
|
for (let e = 0; e < 8; e++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
3270
|
-
|
|
3297
|
+
si[e] = t >>> 0;
|
|
3271
3298
|
}
|
|
3272
|
-
return
|
|
3299
|
+
return si;
|
|
3273
3300
|
}
|
|
3274
|
-
function
|
|
3275
|
-
let t =
|
|
3301
|
+
function li(e) {
|
|
3302
|
+
let t = ci(), n = 4294967295;
|
|
3276
3303
|
for (let r = 0; r < e.length; r++) n = t[(n ^ e[r]) & 255] ^ n >>> 8;
|
|
3277
3304
|
return (n ^ 4294967295) >>> 0;
|
|
3278
3305
|
}
|
|
3279
|
-
function
|
|
3306
|
+
function ui(e) {
|
|
3280
3307
|
let t = new Date(e), n = Math.max(1980, t.getFullYear());
|
|
3281
3308
|
return {
|
|
3282
3309
|
time: t.getHours() << 11 | t.getMinutes() << 5 | Math.floor(t.getSeconds() / 2),
|
|
3283
3310
|
date: n - 1980 << 9 | t.getMonth() + 1 << 5 | t.getDate()
|
|
3284
3311
|
};
|
|
3285
3312
|
}
|
|
3286
|
-
var
|
|
3287
|
-
async function
|
|
3313
|
+
var di = 2048, fi = 4294967295;
|
|
3314
|
+
async function pi(e) {
|
|
3288
3315
|
if (e.length > 65535) throw Error("Too many files for a ZIP archive (max 65,535).");
|
|
3289
3316
|
let t = new TextEncoder(), n = [], r = [], i = 0;
|
|
3290
3317
|
for (let a of e) {
|
|
3291
|
-
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s =
|
|
3292
|
-
if (i + o.length + 30 + e.length >
|
|
3318
|
+
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s = li(o), { time: c, date: l } = ui(a.lastModified ?? Date.now());
|
|
3319
|
+
if (i + o.length + 30 + e.length > fi) throw Error("Selection is too large for a ZIP archive (max 4 GB).");
|
|
3293
3320
|
let u = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(30));
|
|
3294
|
-
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6,
|
|
3321
|
+
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6, di, !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);
|
|
3295
3322
|
let d = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(46));
|
|
3296
|
-
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8,
|
|
3323
|
+
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, di, !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);
|
|
3297
3324
|
let f = new Uint8Array(46 + e.length);
|
|
3298
3325
|
f.set(new Uint8Array(d.buffer), 0), f.set(e, 46), r.push(f), i += 30 + e.length + o.length;
|
|
3299
3326
|
}
|
|
@@ -3306,12 +3333,12 @@ async function fi(e) {
|
|
|
3306
3333
|
}
|
|
3307
3334
|
//#endregion
|
|
3308
3335
|
//#region src/OPFSFilesManager/OPFSFilesManager.tsx
|
|
3309
|
-
var
|
|
3310
|
-
function
|
|
3336
|
+
var mi = "Everything this app stores in the browser’s private file system (OPFS).", hi = 4e3, gi = (e) => e instanceof Error ? e.message : String(e), _i = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, vi = (e) => (e ?? "").split("/").filter(Boolean).join("/");
|
|
3337
|
+
function yi(e, t) {
|
|
3311
3338
|
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
3312
3339
|
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
3313
3340
|
}
|
|
3314
|
-
function
|
|
3341
|
+
function bi() {
|
|
3315
3342
|
let [e, t] = c([]), r = s(/* @__PURE__ */ new Set());
|
|
3316
3343
|
return i(() => {
|
|
3317
3344
|
let e = r.current;
|
|
@@ -3327,12 +3354,12 @@ function yi() {
|
|
|
3327
3354
|
}]);
|
|
3328
3355
|
let a = setTimeout(() => {
|
|
3329
3356
|
r.current.delete(a), t((e) => e.filter((e) => e.id !== i));
|
|
3330
|
-
},
|
|
3357
|
+
}, hi);
|
|
3331
3358
|
r.current.add(a);
|
|
3332
3359
|
}, [])
|
|
3333
3360
|
};
|
|
3334
3361
|
}
|
|
3335
|
-
var
|
|
3362
|
+
var xi = [
|
|
3336
3363
|
"image",
|
|
3337
3364
|
"database",
|
|
3338
3365
|
"json",
|
|
@@ -3340,11 +3367,11 @@ var bi = [
|
|
|
3340
3367
|
"text",
|
|
3341
3368
|
"other"
|
|
3342
3369
|
];
|
|
3343
|
-
function
|
|
3344
|
-
let n =
|
|
3345
|
-
label:
|
|
3370
|
+
function Si({ files: e, estimate: t }) {
|
|
3371
|
+
let n = Dr(e), r = e.reduce((e, t) => e + t.size, 0), i = t ? Math.max(0, t.usage - r) : 0, a = r + i, o = [...xi.filter((e) => n[e] > 0).map((e) => ({
|
|
3372
|
+
label: Wr[e].label,
|
|
3346
3373
|
size: n[e],
|
|
3347
|
-
color:
|
|
3374
|
+
color: Wr[e].color
|
|
3348
3375
|
})), ...i > 0 ? [{
|
|
3349
3376
|
label: "Other site data",
|
|
3350
3377
|
size: i,
|
|
@@ -3358,7 +3385,7 @@ function xi({ files: e, estimate: t }) {
|
|
|
3358
3385
|
children: [/* @__PURE__ */ W("span", { children: [
|
|
3359
3386
|
/* @__PURE__ */ U("strong", { children: Q(t ? t.usage : r) }),
|
|
3360
3387
|
" ",
|
|
3361
|
-
t ? "used by this site" : `in ${
|
|
3388
|
+
t ? "used by this site" : `in ${_i(e.length, "file")}`
|
|
3362
3389
|
] }), t && /* @__PURE__ */ W("span", { children: [Q(t.quota), " available"] })]
|
|
3363
3390
|
}), a > 0 && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
|
|
3364
3391
|
className: "seed-fm-meter",
|
|
@@ -3381,7 +3408,7 @@ function xi({ files: e, estimate: t }) {
|
|
|
3381
3408
|
})] })]
|
|
3382
3409
|
});
|
|
3383
3410
|
}
|
|
3384
|
-
function
|
|
3411
|
+
function Ci({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3385
3412
|
return /* @__PURE__ */ W("div", {
|
|
3386
3413
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3387
3414
|
role: r === "error" ? "alert" : void 0,
|
|
@@ -3399,17 +3426,17 @@ function Si({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
|
3399
3426
|
]
|
|
3400
3427
|
});
|
|
3401
3428
|
}
|
|
3402
|
-
function
|
|
3429
|
+
function wi({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDownload: l, title: u = "Files", description: d = mi, headingLevel: f = 2, theme: p = "system", className: m, classNames: h = {}, defaultView: g, groupImageVariants: _ = !0, deleteWarning: v = Or, confirmDelete: y, deleteAction: b, onNotify: x }) {
|
|
3403
3430
|
a(() => {
|
|
3404
|
-
p !== "none" &&
|
|
3431
|
+
p !== "none" && ai();
|
|
3405
3432
|
}, [p]);
|
|
3406
|
-
let S =
|
|
3433
|
+
let S = vi(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: E, hasLoaded: D, error: O, errorName: ee, refetch: te } = er({ rootPath: e }), k = o(() => t ? T.filter(t) : T, [T, t]), ne = oi(T), [A, j] = c(_);
|
|
3407
3434
|
i(() => j(_), [_]);
|
|
3408
|
-
let M = o(() =>
|
|
3435
|
+
let M = o(() => Cr(k, A), [k, A]), [re, ie] = c(S);
|
|
3409
3436
|
i(() => ie(S), [S]);
|
|
3410
|
-
let [N, ae] = c(""), [oe, se] = c("name"), [P, ce] = c(g), [F, I] = c(() => /* @__PURE__ */ new Set()), le = s(null), [ue, de] = c(null), fe = s(null), [pe, L] = c(null), [R, me] = c(null), [he, z] = c(!1), { toasts: B, showToast: ge } =
|
|
3437
|
+
let [N, ae] = c(""), [oe, se] = c("name"), [P, ce] = c(g), [F, I] = c(() => /* @__PURE__ */ new Set()), le = s(null), [ue, de] = c(null), fe = s(null), [pe, L] = c(null), [R, me] = c(null), [he, z] = c(!1), { toasts: B, showToast: ge } = bi(), _e = (e, t, n) => {
|
|
3411
3438
|
x ? x(e, t, n) : ge(e, t);
|
|
3412
|
-
}, ve = o(() =>
|
|
3439
|
+
}, ve = o(() => Tr(M, re, {
|
|
3413
3440
|
query: N,
|
|
3414
3441
|
sort: oe
|
|
3415
3442
|
}), [
|
|
@@ -3417,7 +3444,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3417
3444
|
re,
|
|
3418
3445
|
N,
|
|
3419
3446
|
oe
|
|
3420
|
-
]), V = ve.entries, ye = V.length ? V.filter((e) =>
|
|
3447
|
+
]), V = ve.entries, ye = V.length ? V.filter((e) => hr(e.file) === "image").length / V.length : 0, be = P ?? (ye >= .5 ? "grid" : "list"), xe = o(() => new Map(M.map((e) => [e.file.path, e])), [M]), Se = o(() => [...F].map((e) => xe.get(e)).filter((e) => !!e), [F, xe]), G = ue ? xe.get(ue) ?? null : null, K = G ? V.indexOf(G) : -1;
|
|
3421
3448
|
i(() => {
|
|
3422
3449
|
I((e) => {
|
|
3423
3450
|
let t = new Set([...e].filter((e) => xe.has(e)));
|
|
@@ -3451,18 +3478,18 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3451
3478
|
return n;
|
|
3452
3479
|
});
|
|
3453
3480
|
}, Oe = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, ke = async (e, t) => {
|
|
3454
|
-
l ? await l(e, t) :
|
|
3481
|
+
l ? await l(e, t) : yi(e.name, t);
|
|
3455
3482
|
}, Ae = async (e, t) => {
|
|
3456
3483
|
if (e.length === 0) return !1;
|
|
3457
3484
|
z(!0);
|
|
3458
3485
|
try {
|
|
3459
3486
|
if (e.length === 1 && !t) {
|
|
3460
3487
|
let [t] = e;
|
|
3461
|
-
return await ke(t, await
|
|
3488
|
+
return await ke(t, await Wn(t.path)), !0;
|
|
3462
3489
|
}
|
|
3463
|
-
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await
|
|
3490
|
+
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await pi(await Promise.all(e.map(async (e) => ({
|
|
3464
3491
|
name: t ? e.path.slice(n.length) : Oe(e.path),
|
|
3465
|
-
data: await
|
|
3492
|
+
data: await Wn(e.path),
|
|
3466
3493
|
lastModified: e.lastModified
|
|
3467
3494
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3468
3495
|
return await ke({
|
|
@@ -3471,16 +3498,16 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3471
3498
|
size: r.size,
|
|
3472
3499
|
type: "application/zip",
|
|
3473
3500
|
lastModified: Date.now()
|
|
3474
|
-
}, r), _e(`Saved ${i} with ${
|
|
3501
|
+
}, r), _e(`Saved ${i} with ${_i(e.length, "file")}`, "success", {
|
|
3475
3502
|
kind: "download",
|
|
3476
3503
|
paths: e.map((e) => e.path),
|
|
3477
3504
|
fileName: i
|
|
3478
3505
|
}), !0;
|
|
3479
3506
|
} catch (t) {
|
|
3480
|
-
return _e(`Couldn’t download: ${
|
|
3507
|
+
return _e(`Couldn’t download: ${gi(t)}`, "error", {
|
|
3481
3508
|
kind: "download",
|
|
3482
3509
|
paths: e.map((e) => e.path),
|
|
3483
|
-
error:
|
|
3510
|
+
error: gi(t)
|
|
3484
3511
|
}), !1;
|
|
3485
3512
|
} finally {
|
|
3486
3513
|
z(!1);
|
|
@@ -3498,32 +3525,32 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3498
3525
|
let r = await navigator.storage.getDirectory();
|
|
3499
3526
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3500
3527
|
else try {
|
|
3501
|
-
await
|
|
3528
|
+
await Gn(t.path, r), i.push(t.path);
|
|
3502
3529
|
} catch (e) {
|
|
3503
3530
|
a.push({
|
|
3504
3531
|
path: t.path,
|
|
3505
|
-
error:
|
|
3532
|
+
error: gi(e)
|
|
3506
3533
|
});
|
|
3507
3534
|
}
|
|
3508
3535
|
if (t) try {
|
|
3509
|
-
s = await
|
|
3536
|
+
s = await qn(t.path, r);
|
|
3510
3537
|
} catch (e) {
|
|
3511
3538
|
a.push({
|
|
3512
3539
|
path: t.path,
|
|
3513
|
-
error:
|
|
3540
|
+
error: gi(e)
|
|
3514
3541
|
});
|
|
3515
3542
|
}
|
|
3516
3543
|
} catch (e) {
|
|
3517
3544
|
a.push({
|
|
3518
3545
|
path: "",
|
|
3519
|
-
error:
|
|
3546
|
+
error: gi(e)
|
|
3520
3547
|
});
|
|
3521
3548
|
}
|
|
3522
3549
|
I((e) => {
|
|
3523
3550
|
let t = new Set(e);
|
|
3524
3551
|
return i.forEach((e) => t.delete(e)), t;
|
|
3525
3552
|
}), ue && i.includes(ue) && de(null), await te(), z(!1);
|
|
3526
|
-
let c = [s ? `Deleted the ${t.name} folder (${
|
|
3553
|
+
let c = [s ? `Deleted the ${t.name} folder (${_i(i.length, "file")})` : i.length > 0 ? `Deleted ${_i(i.length, "file")}` : "Nothing deleted"];
|
|
3527
3554
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3528
3555
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3529
3556
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
@@ -3560,7 +3587,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3560
3587
|
}), n = (t) => _e("Couldn’t copy. Select the path text instead.", "error", {
|
|
3561
3588
|
kind: "copy-path",
|
|
3562
3589
|
path: e,
|
|
3563
|
-
error: t === void 0 ? "Clipboard unavailable" :
|
|
3590
|
+
error: t === void 0 ? "Clipboard unavailable" : gi(t)
|
|
3564
3591
|
});
|
|
3565
3592
|
try {
|
|
3566
3593
|
navigator.clipboard.writeText(e).then(t, n);
|
|
@@ -3579,14 +3606,14 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3579
3606
|
let t = V[K + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3580
3607
|
t && de(t.file.path), e.preventDefault();
|
|
3581
3608
|
}
|
|
3582
|
-
}, Z = o(() => k.some((e) =>
|
|
3609
|
+
}, Z = o(() => k.some((e) => br(e.path)), [k]), Re = /(^|\/)images(\/\d+)?$/.test(re), ze = [{
|
|
3583
3610
|
label: C,
|
|
3584
3611
|
path: S
|
|
3585
3612
|
}, ...(re.length > S.length ? re.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3586
3613
|
label: e,
|
|
3587
3614
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3588
3615
|
}))], Be = `h${f}`, Ve = Se.reduce((e, t) => e + t.file.size, 0), He;
|
|
3589
|
-
if (!
|
|
3616
|
+
if (!Jn()) He = /* @__PURE__ */ U(Ci, {
|
|
3590
3617
|
icon: "triangleAlert",
|
|
3591
3618
|
tone: "error",
|
|
3592
3619
|
title: "This browser doesn’t support private file storage",
|
|
@@ -3602,7 +3629,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3602
3629
|
size: 15
|
|
3603
3630
|
}), " Try again"]
|
|
3604
3631
|
});
|
|
3605
|
-
He = ee === "NotFoundError" && S ? /* @__PURE__ */ W(
|
|
3632
|
+
He = ee === "NotFoundError" && S ? /* @__PURE__ */ W(Ci, {
|
|
3606
3633
|
icon: "triangleAlert",
|
|
3607
3634
|
tone: "error",
|
|
3608
3635
|
title: `Can’t open ${S}`,
|
|
@@ -3615,18 +3642,18 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3615
3642
|
/* @__PURE__ */ U("code", { children: "rootPath" }),
|
|
3616
3643
|
" prop, or open the app once so the SDK creates it."
|
|
3617
3644
|
]
|
|
3618
|
-
}) : /* @__PURE__ */ U(
|
|
3645
|
+
}) : /* @__PURE__ */ U(Ci, {
|
|
3619
3646
|
icon: "triangleAlert",
|
|
3620
3647
|
tone: "error",
|
|
3621
3648
|
title: "Can’t read private storage",
|
|
3622
3649
|
action: e,
|
|
3623
3650
|
children: O
|
|
3624
3651
|
});
|
|
3625
|
-
} else He = D ? M.length === 0 ? /* @__PURE__ */ U(
|
|
3652
|
+
} else He = D ? M.length === 0 ? /* @__PURE__ */ U(Ci, {
|
|
3626
3653
|
icon: "folderOpen",
|
|
3627
3654
|
title: `No files in ${C} yet`,
|
|
3628
3655
|
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."
|
|
3629
|
-
}) : ve.folders.length === 0 && V.length === 0 ? N ? /* @__PURE__ */ W(
|
|
3656
|
+
}) : ve.folders.length === 0 && V.length === 0 ? N ? /* @__PURE__ */ W(Ci, {
|
|
3630
3657
|
icon: "search",
|
|
3631
3658
|
title: `No matches for “${N}”`,
|
|
3632
3659
|
action: /* @__PURE__ */ U("button", {
|
|
@@ -3640,7 +3667,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3640
3667
|
ze[ze.length - 1].label,
|
|
3641
3668
|
" and every folder inside it."
|
|
3642
3669
|
]
|
|
3643
|
-
}) : /* @__PURE__ */ U(
|
|
3670
|
+
}) : /* @__PURE__ */ U(Ci, {
|
|
3644
3671
|
icon: "folderOpen",
|
|
3645
3672
|
title: "This folder is empty",
|
|
3646
3673
|
children: "Everything in it has been deleted or filtered out."
|
|
@@ -3663,7 +3690,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3663
3690
|
}), /* @__PURE__ */ W("span", {
|
|
3664
3691
|
className: "seed-fm-folder-meta",
|
|
3665
3692
|
children: [
|
|
3666
|
-
|
|
3693
|
+
_i(e.fileCount, "file"),
|
|
3667
3694
|
" · ",
|
|
3668
3695
|
Q(e.size)
|
|
3669
3696
|
]
|
|
@@ -3682,15 +3709,15 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3682
3709
|
})] }, e.path))
|
|
3683
3710
|
})] }), V.length > 0 && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
|
|
3684
3711
|
className: "seed-fm-section-label",
|
|
3685
|
-
children: N ?
|
|
3686
|
-
}), be === "grid" ? /* @__PURE__ */ U(
|
|
3712
|
+
children: N ? _i(V.length, "result") : "Files"
|
|
3713
|
+
}), be === "grid" ? /* @__PURE__ */ U(Jr, {
|
|
3687
3714
|
entries: V,
|
|
3688
3715
|
selected: F,
|
|
3689
3716
|
onActivate: Ee,
|
|
3690
3717
|
onToggle: we,
|
|
3691
3718
|
className: h.grid,
|
|
3692
3719
|
tileClassName: h.tile
|
|
3693
|
-
}) : /* @__PURE__ */ U(
|
|
3720
|
+
}) : /* @__PURE__ */ U(Yr, {
|
|
3694
3721
|
entries: V,
|
|
3695
3722
|
selected: F,
|
|
3696
3723
|
cwd: re,
|
|
@@ -3734,7 +3761,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3734
3761
|
children: d
|
|
3735
3762
|
})]
|
|
3736
3763
|
}),
|
|
3737
|
-
D && !O && /* @__PURE__ */ U(
|
|
3764
|
+
D && !O && /* @__PURE__ */ U(Si, {
|
|
3738
3765
|
files: k,
|
|
3739
3766
|
estimate: ne
|
|
3740
3767
|
}),
|
|
@@ -3907,7 +3934,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3907
3934
|
})
|
|
3908
3935
|
]
|
|
3909
3936
|
}),
|
|
3910
|
-
G && /* @__PURE__ */ U(
|
|
3937
|
+
G && /* @__PURE__ */ U($r, {
|
|
3911
3938
|
entry: G,
|
|
3912
3939
|
className: h.panel,
|
|
3913
3940
|
onClose: Te,
|
|
@@ -3918,7 +3945,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3918
3945
|
deleteAction: Y([G]),
|
|
3919
3946
|
onCopyPath: () => Ie(G.file.path)
|
|
3920
3947
|
}, "panel"),
|
|
3921
|
-
pe && /* @__PURE__ */ U(
|
|
3948
|
+
pe && /* @__PURE__ */ U(dr, {
|
|
3922
3949
|
entries: pe,
|
|
3923
3950
|
rootPath: S,
|
|
3924
3951
|
warning: v(Ue),
|
|
@@ -3930,7 +3957,7 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3930
3957
|
L(null), X(t);
|
|
3931
3958
|
}
|
|
3932
3959
|
}),
|
|
3933
|
-
R && /* @__PURE__ */ U(
|
|
3960
|
+
R && /* @__PURE__ */ U(fr, {
|
|
3934
3961
|
folder: R,
|
|
3935
3962
|
files: We,
|
|
3936
3963
|
hiddenCount: T.filter((e) => e.path.startsWith(`${R.path}/`)).length - We.length,
|
|
@@ -3961,15 +3988,15 @@ function Ci({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3961
3988
|
}
|
|
3962
3989
|
//#endregion
|
|
3963
3990
|
//#region src/useEnsureLocalImage.ts
|
|
3964
|
-
var
|
|
3991
|
+
var Ti = (e) => {
|
|
3965
3992
|
try {
|
|
3966
3993
|
return e.getService?.()?.getSnapshot?.()?.context?.storageTransactionId || void 0;
|
|
3967
3994
|
} catch {
|
|
3968
3995
|
return;
|
|
3969
3996
|
}
|
|
3970
3997
|
};
|
|
3971
|
-
function
|
|
3972
|
-
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, u] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ =
|
|
3998
|
+
function Ei(e) {
|
|
3999
|
+
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, u] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ = Ti(t), v = o(() => le(_) ?? le(r) ?? le(m) ?? le(g), [
|
|
3973
4000
|
_,
|
|
3974
4001
|
r,
|
|
3975
4002
|
m,
|
|
@@ -4037,23 +4064,23 @@ function Ti(e) {
|
|
|
4037
4064
|
}
|
|
4038
4065
|
//#endregion
|
|
4039
4066
|
//#region src/SeedImage.tsx
|
|
4040
|
-
var
|
|
4067
|
+
var Di = ye("seedSdk:react:SeedImage"), Oi = /* @__PURE__ */ new Map(), ki = (e) => {
|
|
4041
4068
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
4042
4069
|
return t && t[2] ? t[2] : e;
|
|
4043
4070
|
};
|
|
4044
|
-
function
|
|
4071
|
+
function Ai(e) {
|
|
4045
4072
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4046
4073
|
}
|
|
4047
|
-
function
|
|
4048
|
-
let n = RegExp(`^${
|
|
4074
|
+
function ji(e, t) {
|
|
4075
|
+
let n = RegExp(`^${Ai(t)}$`), r = ki(e);
|
|
4049
4076
|
return n.test(r);
|
|
4050
4077
|
}
|
|
4051
|
-
var
|
|
4078
|
+
var Mi = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o }, s) => {
|
|
4052
4079
|
let [l, u] = c(), [d, f] = c(), { property: m } = gt({
|
|
4053
4080
|
propertyName: t.propertyName,
|
|
4054
4081
|
seedLocalId: t.seedLocalId,
|
|
4055
4082
|
seedUid: t.seedUid
|
|
4056
|
-
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } =
|
|
4083
|
+
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } = Ei({
|
|
4057
4084
|
imageProperty: h ?? t,
|
|
4058
4085
|
filename: r,
|
|
4059
4086
|
width: n,
|
|
@@ -4077,7 +4104,7 @@ var ji = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4077
4104
|
!e && n && f(n);
|
|
4078
4105
|
}
|
|
4079
4106
|
} catch (e) {
|
|
4080
|
-
|
|
4107
|
+
Di("_getOriginalContentUrl error", e);
|
|
4081
4108
|
}
|
|
4082
4109
|
})(), () => {
|
|
4083
4110
|
e = !0;
|
|
@@ -4093,25 +4120,25 @@ var ji = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4093
4120
|
try {
|
|
4094
4121
|
let e = await p.getFs(), t = h?.localStoragePath ? h.localStoragePath.split("/").slice(0, -1).join("/") : p.getFilesPath("images"), r = e.readdirSync(t, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => parseInt(e.name)).filter((e) => !Number.isNaN(e));
|
|
4095
4122
|
if (r.length === 0) return;
|
|
4096
|
-
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a =
|
|
4097
|
-
if (
|
|
4098
|
-
let e =
|
|
4123
|
+
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a = ki(g), o = `${a}-${i}`;
|
|
4124
|
+
if (Oi.has(o)) try {
|
|
4125
|
+
let e = Oi.get(o);
|
|
4099
4126
|
if (e && (await fetch(e)).ok) {
|
|
4100
4127
|
u(e);
|
|
4101
4128
|
return;
|
|
4102
4129
|
}
|
|
4103
4130
|
} catch (e) {
|
|
4104
|
-
|
|
4131
|
+
Di("error", e), Oi.delete(o);
|
|
4105
4132
|
}
|
|
4106
|
-
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ?
|
|
4133
|
+
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ? ji(e.name, a) : !1);
|
|
4107
4134
|
if (!s) return;
|
|
4108
4135
|
let c = `${t}/${i}/${s?.name}`;
|
|
4109
4136
|
if (await p.pathExists(c)) {
|
|
4110
4137
|
let e = await p.getContentUrlFromPath(c);
|
|
4111
|
-
e && (
|
|
4138
|
+
e && (Oi.set(o, e), u(e));
|
|
4112
4139
|
}
|
|
4113
4140
|
} catch (e) {
|
|
4114
|
-
|
|
4141
|
+
Di("_getSizedContentUrl error", e);
|
|
4115
4142
|
}
|
|
4116
4143
|
})();
|
|
4117
4144
|
}, [
|
|
@@ -4137,7 +4164,7 @@ var ji = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4137
4164
|
}));
|
|
4138
4165
|
//#endregion
|
|
4139
4166
|
//#region src/useResolvedMediaRef.ts
|
|
4140
|
-
function
|
|
4167
|
+
function Ni(e) {
|
|
4141
4168
|
let { value: t, enabled: r = !0, treatAs: a } = e, [o, s] = c(0), l = JSON.stringify([
|
|
4142
4169
|
r,
|
|
4143
4170
|
t ?? null,
|
|
@@ -4207,8 +4234,8 @@ function Mi(e) {
|
|
|
4207
4234
|
}
|
|
4208
4235
|
//#endregion
|
|
4209
4236
|
//#region src/SeedMediaImage.tsx
|
|
4210
|
-
function
|
|
4211
|
-
let { href: o } =
|
|
4237
|
+
function Pi({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
4238
|
+
let { href: o } = Ni({
|
|
4212
4239
|
value: e,
|
|
4213
4240
|
enabled: t,
|
|
4214
4241
|
treatAs: n
|
|
@@ -4223,14 +4250,14 @@ function Ni({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
4223
4250
|
}
|
|
4224
4251
|
//#endregion
|
|
4225
4252
|
//#region src/SeedMediaFile.tsx
|
|
4226
|
-
function
|
|
4253
|
+
function Fi(e) {
|
|
4227
4254
|
try {
|
|
4228
4255
|
return new URL(e).pathname.split("/").filter(Boolean).pop() || "Open";
|
|
4229
4256
|
} catch {
|
|
4230
4257
|
return "Open";
|
|
4231
4258
|
}
|
|
4232
4259
|
}
|
|
4233
|
-
function
|
|
4260
|
+
function Ii(e) {
|
|
4234
4261
|
try {
|
|
4235
4262
|
let t = new URL(e).protocol;
|
|
4236
4263
|
return t === "http:" || t === "https:";
|
|
@@ -4238,27 +4265,27 @@ function Fi(e) {
|
|
|
4238
4265
|
return !1;
|
|
4239
4266
|
}
|
|
4240
4267
|
}
|
|
4241
|
-
function
|
|
4242
|
-
let { href: l } =
|
|
4268
|
+
function Li({ value: e, enabled: t, treatAs: n, download: r, render: i, children: a, target: o, rel: s, ...c }) {
|
|
4269
|
+
let { href: l } = Ni({
|
|
4243
4270
|
value: e,
|
|
4244
4271
|
enabled: t,
|
|
4245
4272
|
treatAs: n
|
|
4246
4273
|
});
|
|
4247
4274
|
if (!l) return null;
|
|
4248
|
-
let u =
|
|
4275
|
+
let u = Ii(l), d = o === void 0 ? u ? "_blank" : void 0 : o, f = {
|
|
4249
4276
|
...c,
|
|
4250
4277
|
href: l,
|
|
4251
4278
|
download: r,
|
|
4252
4279
|
target: d,
|
|
4253
4280
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
4254
|
-
children: a ??
|
|
4281
|
+
children: a ?? Fi(l)
|
|
4255
4282
|
};
|
|
4256
4283
|
return i ? /* @__PURE__ */ U(H, { children: i(f) }) : /* @__PURE__ */ U("a", { ...f });
|
|
4257
4284
|
}
|
|
4258
4285
|
//#endregion
|
|
4259
4286
|
//#region src/SeedMediaAudio.tsx
|
|
4260
|
-
function
|
|
4261
|
-
let { href: o } =
|
|
4287
|
+
function Ri({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4288
|
+
let { href: o } = Ni({
|
|
4262
4289
|
value: e,
|
|
4263
4290
|
enabled: t,
|
|
4264
4291
|
treatAs: n
|
|
@@ -4273,8 +4300,8 @@ function Li({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4273
4300
|
}
|
|
4274
4301
|
//#endregion
|
|
4275
4302
|
//#region src/SeedMediaVideo.tsx
|
|
4276
|
-
function
|
|
4277
|
-
let { href: o } =
|
|
4303
|
+
function zi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4304
|
+
let { href: o } = Ni({
|
|
4278
4305
|
value: e,
|
|
4279
4306
|
enabled: t,
|
|
4280
4307
|
treatAs: n
|
|
@@ -4289,25 +4316,25 @@ function Ri({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4289
4316
|
}
|
|
4290
4317
|
//#endregion
|
|
4291
4318
|
//#region src/SeedHtml.tsx
|
|
4292
|
-
function
|
|
4319
|
+
function Bi(e) {
|
|
4293
4320
|
return typeof e == "string" && e.trim().length > 0;
|
|
4294
4321
|
}
|
|
4295
|
-
var
|
|
4322
|
+
var Vi = /* @__PURE__ */ new Set([
|
|
4296
4323
|
"img",
|
|
4297
4324
|
"video",
|
|
4298
4325
|
"audio",
|
|
4299
4326
|
"source"
|
|
4300
|
-
]),
|
|
4327
|
+
]), Hi = [
|
|
4301
4328
|
"src",
|
|
4302
4329
|
"srcset",
|
|
4303
4330
|
"poster"
|
|
4304
4331
|
];
|
|
4305
|
-
function
|
|
4332
|
+
function Ui(e) {
|
|
4306
4333
|
let t = (e) => {
|
|
4307
4334
|
let t = e.target;
|
|
4308
|
-
if (!(t instanceof Element) || !
|
|
4335
|
+
if (!(t instanceof Element) || !Vi.has(t.tagName.toLowerCase())) return;
|
|
4309
4336
|
let n = !1;
|
|
4310
|
-
for (let e of
|
|
4337
|
+
for (let e of Hi) {
|
|
4311
4338
|
let r = t.getAttribute(e);
|
|
4312
4339
|
if (!r) continue;
|
|
4313
4340
|
let i = se(e, r, (e) => I(e));
|
|
@@ -4317,11 +4344,11 @@ function Hi(e) {
|
|
|
4317
4344
|
};
|
|
4318
4345
|
return e.addEventListener("error", t, !0), () => e.removeEventListener("error", t, !0);
|
|
4319
4346
|
}
|
|
4320
|
-
function
|
|
4321
|
-
let a = e.useRef(null), o = e.useMemo(() =>
|
|
4347
|
+
function Wi({ html: t, sanitize: n, render: r, ...i }) {
|
|
4348
|
+
let a = e.useRef(null), o = e.useMemo(() => Bi(t) ? n(me(t)) : void 0, [t, n]);
|
|
4322
4349
|
return e.useEffect(() => {
|
|
4323
4350
|
let e = a.current;
|
|
4324
|
-
return e ?
|
|
4351
|
+
return e ? Ui(e) : void 0;
|
|
4325
4352
|
}, [o, r]), o === void 0 ? null : r ? /* @__PURE__ */ U(H, { children: r({ html: o }) }) : /* @__PURE__ */ U("div", {
|
|
4326
4353
|
...i,
|
|
4327
4354
|
ref: a,
|
|
@@ -4330,46 +4357,46 @@ function Ui({ html: t, sanitize: n, render: r, ...i }) {
|
|
|
4330
4357
|
}
|
|
4331
4358
|
//#endregion
|
|
4332
4359
|
//#region src/formatSeedJson.ts
|
|
4333
|
-
function
|
|
4360
|
+
function Gi(e, t) {
|
|
4334
4361
|
return e.length <= t ? e : `${e.slice(0, t)}…`;
|
|
4335
4362
|
}
|
|
4336
|
-
function
|
|
4363
|
+
function Ki(e) {
|
|
4337
4364
|
let t = e.trim();
|
|
4338
4365
|
return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
|
|
4339
4366
|
}
|
|
4340
|
-
function
|
|
4367
|
+
function qi(e, t, n, r, i) {
|
|
4341
4368
|
if (typeof e == "bigint") return String(e);
|
|
4342
4369
|
if (typeof e == "symbol") return e.toString();
|
|
4343
4370
|
if (typeof e == "function") return "[Function]";
|
|
4344
4371
|
if (e instanceof Date) return e.toISOString();
|
|
4345
|
-
if (typeof e == "string") return
|
|
4372
|
+
if (typeof e == "string") return Gi(e, n);
|
|
4346
4373
|
if (typeof e != "object" || !e) return e;
|
|
4347
4374
|
if (i.has(e)) return "[Circular]";
|
|
4348
4375
|
if (r >= t) return "[Max depth]";
|
|
4349
4376
|
i.add(e);
|
|
4350
4377
|
try {
|
|
4351
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
4378
|
+
if (Array.isArray(e)) return e.map((e) => qi(e, t, n, r + 1, i));
|
|
4352
4379
|
let a = {};
|
|
4353
|
-
for (let [o, s] of Object.entries(e)) a[o] =
|
|
4380
|
+
for (let [o, s] of Object.entries(e)) a[o] = qi(s, t, n, r + 1, i);
|
|
4354
4381
|
return a;
|
|
4355
4382
|
} finally {
|
|
4356
4383
|
i.delete(e);
|
|
4357
4384
|
}
|
|
4358
4385
|
}
|
|
4359
|
-
function
|
|
4386
|
+
function Ji(e, t) {
|
|
4360
4387
|
let n = t?.maxDepth ?? 6, r = t?.maxStringLength ?? 5e4, i = t?.space ?? 2;
|
|
4361
4388
|
if (e === void 0) return "undefined";
|
|
4362
4389
|
if (e === null) return "null";
|
|
4363
4390
|
let a = e;
|
|
4364
4391
|
if (typeof e == "string") {
|
|
4365
|
-
if (
|
|
4392
|
+
if (Ki(e)) try {
|
|
4366
4393
|
a = JSON.parse(e);
|
|
4367
4394
|
} catch {
|
|
4368
|
-
return
|
|
4395
|
+
return Gi(e, r);
|
|
4369
4396
|
}
|
|
4370
|
-
else return
|
|
4397
|
+
else return Gi(e, r);
|
|
4371
4398
|
}
|
|
4372
|
-
let o =
|
|
4399
|
+
let o = qi(a, n, r, 0, /* @__PURE__ */ new WeakSet());
|
|
4373
4400
|
try {
|
|
4374
4401
|
return JSON.stringify(o, null, i);
|
|
4375
4402
|
} catch {
|
|
@@ -4378,8 +4405,8 @@ function qi(e, t) {
|
|
|
4378
4405
|
}
|
|
4379
4406
|
//#endregion
|
|
4380
4407
|
//#region src/SeedJson.tsx
|
|
4381
|
-
function
|
|
4382
|
-
let a = t ? t(e) :
|
|
4408
|
+
function Yi({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4409
|
+
let a = t ? t(e) : Ji(e, n);
|
|
4383
4410
|
return r ? /* @__PURE__ */ U(H, { children: r({ text: a }) }) : /* @__PURE__ */ U("pre", {
|
|
4384
4411
|
...i,
|
|
4385
4412
|
children: a
|
|
@@ -4387,10 +4414,10 @@ function Ji({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
|
4387
4414
|
}
|
|
4388
4415
|
//#endregion
|
|
4389
4416
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4390
|
-
function
|
|
4417
|
+
function Xi(e, t) {
|
|
4391
4418
|
return o(() => e ? ue(e, t) : {}, [e, t]);
|
|
4392
4419
|
}
|
|
4393
4420
|
//#endregion
|
|
4394
|
-
export { Ne as ADDRESSES_PERSISTED_EVENT, Cn as FILES_QUERY_KEY_PREFIX, Pe as LOCAL_COPIES_REMOVED_EVENT,
|
|
4421
|
+
export { Ne as ADDRESSES_PERSISTED_EVENT, Cn as FILES_QUERY_KEY_PREFIX, Pe as LOCAL_COPIES_REMOVED_EVENT, wi as OPFSFilesManager, ii as OPFS_FILES_MANAGER_CSS, zn as SeedClientGate, Wi as SeedHtml, Mi as SeedImage, Yi as SeedJson, Ri as SeedMediaAudio, Li as SeedMediaFile, Pi as SeedMediaImage, zi as SeedMediaVideo, In as SeedProvider, Ui as attachArweaveLoadFailover, Ge as createSeedQueryClient, Ji as formatSeedJson, ht as getItemPropertyQueryKey, Ze as getItemQueryKey, Nt as getPercentComplete, Ue as getSeedQueryDefaultOptions, kt as getServiceName, jt as getServiceUniqueKey, At as getServiceValue, Nn as invalidateItemPropertiesForItem, N as isClientReadySnapshot, Tt as isDbReadyState, We as mergeSeedQueryDefaults, Qt as useAllSchemaVersions, J as useClientSelector, Me as useClientService, lt as useCreateItem, St as useCreateItemProperty, sn as useCreateModel, vn as useCreateModelProperty, Xt as useCreateSchema, Et as useDbsAreReady, _t as useDebouncedItemProperty, bn as useDeleteItem, Ct as useDestroyItemProperty, cn as useDestroyModel, yn as useDestroyModelProperty, Zt as useDestroySchema, An as useEasSyncProcessById, On as useEasSyncProcesses, kn as useEasSyncProcessesNonActiveCount, Dn as useEasSyncProcessesState, Ei as useEnsureLocalImage, wn as useFiles, Bt as useGlobalServiceStatus, Lt as useHasSavedSnapshots, Sn as useImageFiles, Y as useIsClientReady, Ft as useIsDbReady, Qe as useItem, xt as useItemProperties, gt as useItemProperty, at as useItems, Z as useLiveQuery, Ve as useLiveQueryState, on as useModel, fn as useModelProperties, _n as useModelProperty, an as useModels, Xi as useNormalizedFeedItemFields, er as useOPFSFiles, It as usePersistedSnapshots, ut as usePublishItem, Ni as useResolvedMediaRef, Wt as useSchema, Yt as useSchemas, Ie as useSeedAddressRevision, $t as useSeedProtocolSchema, Pt as useService, zt as useServices, oi as useStorageEstimate, Ur as useThumbnail };
|
|
4395
4422
|
|
|
4396
4423
|
//# sourceMappingURL=index.js.map
|