@harryy/react-file-browser 1.1.0 → 1.1.1
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/components/file-browser.d.ts.map +1 -1
- package/dist/index.js +322 -320
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import { createPortal as C } from "react-dom";
|
|
|
7
7
|
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
8
8
|
//#region src/core/use-file-browser.ts
|
|
9
9
|
function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, searchQuery: c, initialSearchQuery: l = "", onSearchQueryChange: u }) {
|
|
10
|
-
let d = i === void 0 ? void 0 : a(i), [f, p] = b(() => a(o)), m = d ?? f, [g, x] = b("loading"), [S, C] = b([]), [w, T] = b(), [E, ee] = b(null), [O, k] = b(() => /* @__PURE__ */ new Set()), [ae, A] = b(null), [oe, j] = b(null), [M, N] = b(null), [se, P] = b("grid"), [ce, le] = b(l), F = c ?? ce, [I, ue] = b("all"), [L, de] = b("name"), [fe, pe] = b("asc"), R = y(0),
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
let t = typeof e == "function" ? e(
|
|
14
|
-
|
|
15
|
-
}, [c, u]),
|
|
10
|
+
let d = i === void 0 ? void 0 : a(i), [f, p] = b(() => a(o)), m = d ?? f, [g, x] = b("loading"), [S, C] = b([]), [w, T] = b(), [E, ee] = b(null), [O, k] = b(() => /* @__PURE__ */ new Set()), [ae, A] = b(null), [oe, j] = b(null), [M, N] = b(null), [se, P] = b("grid"), [ce, le] = b(l), F = c ?? ce, [I, ue] = b("all"), [L, de] = b("name"), [fe, pe] = b("asc"), R = y(0), z = y(m), B = y(void 0), me = y(F);
|
|
11
|
+
me.current = F;
|
|
12
|
+
let he = h((e) => {
|
|
13
|
+
let t = typeof e == "function" ? e(me.current) : e;
|
|
14
|
+
me.current = t, c === void 0 && le(t), u?.(t);
|
|
15
|
+
}, [c, u]), V = v(() => ({
|
|
16
16
|
createFolder: typeof n.createFolder == "function",
|
|
17
17
|
rename: typeof n.rename == "function",
|
|
18
18
|
move: typeof n.move == "function",
|
|
@@ -21,7 +21,7 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
21
21
|
exists: typeof n.exists == "function",
|
|
22
22
|
multipart: typeof n.createMultipartUpload == "function" && typeof n.uploadPart == "function" && typeof n.completeMultipartUpload == "function",
|
|
23
23
|
bulkDownload: typeof n.bulkDownloadUrl == "function"
|
|
24
|
-
}), [n]),
|
|
24
|
+
}), [n]), H = v(() => re(Array.from(O)), [O]), U = v(() => S.filter((e) => O.has(e.path)), [S, O]), ge = v(() => {
|
|
25
25
|
let e = F.trim().toLowerCase();
|
|
26
26
|
return [...S].filter((t) => e ? t.name.toLowerCase().includes(e) : !0).filter((e) => I === "all" ? !0 : e.kind === (I === "files" ? "file" : "folder")).sort((e, t) => D(e, t, L, fe));
|
|
27
27
|
}, [
|
|
@@ -30,77 +30,77 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
30
30
|
F,
|
|
31
31
|
L,
|
|
32
32
|
fe
|
|
33
|
-
]),
|
|
33
|
+
]), W = h(async (e, t) => {
|
|
34
34
|
let r = a(e), i = ++R.current;
|
|
35
35
|
x((e) => t === "replace" || e === "idle" ? "loading" : e), ee(null);
|
|
36
36
|
try {
|
|
37
|
-
let e = await n.list(r, { cursor: t === "append" ?
|
|
37
|
+
let e = await n.list(r, { cursor: t === "append" ? B.current : void 0 });
|
|
38
38
|
if (i !== R.current) return;
|
|
39
|
-
C((n) => t === "append" ? te(n, e.items) : e.items),
|
|
39
|
+
C((n) => t === "append" ? te(n, e.items) : e.items), B.current = e.cursor, T(e.cursor), x("ready");
|
|
40
40
|
} catch (e) {
|
|
41
41
|
if (i !== R.current) return;
|
|
42
42
|
ee(ie(e)), x("error");
|
|
43
43
|
}
|
|
44
|
-
}, [n]),
|
|
45
|
-
await
|
|
46
|
-
}, [m,
|
|
44
|
+
}, [n]), _e = h(async () => {
|
|
45
|
+
await W(m, "replace");
|
|
46
|
+
}, [m, W]), ve = h(async (e, t = { source: "programmatic" }) => {
|
|
47
47
|
let n = a(e);
|
|
48
|
-
n !==
|
|
48
|
+
n !== z.current && (s?.(n, t), d === void 0 && (z.current = n, p(n), k(/* @__PURE__ */ new Set()), A(null), j(null), B.current = void 0, T(void 0), await W(n, "replace")));
|
|
49
49
|
}, [
|
|
50
50
|
d,
|
|
51
|
-
|
|
51
|
+
W,
|
|
52
52
|
s
|
|
53
|
-
]),
|
|
54
|
-
!w || g === "loading" || await
|
|
53
|
+
]), ye = h(async () => {
|
|
54
|
+
!w || g === "loading" || await W(m, "append");
|
|
55
55
|
}, [
|
|
56
56
|
m,
|
|
57
57
|
w,
|
|
58
|
-
|
|
58
|
+
W,
|
|
59
59
|
g
|
|
60
60
|
]);
|
|
61
61
|
_(() => {
|
|
62
62
|
let e = m;
|
|
63
|
-
e !==
|
|
63
|
+
e !== z.current && (z.current = e, k(/* @__PURE__ */ new Set()), A(null), j(null)), B.current = void 0, T(void 0), Promise.resolve().then(() => W(e, "replace"));
|
|
64
64
|
}, [n, d]);
|
|
65
|
-
let
|
|
65
|
+
let be = h((e) => {
|
|
66
66
|
let t = a(e);
|
|
67
67
|
k(/* @__PURE__ */ new Set([t])), A(t), j(t);
|
|
68
|
-
}, []),
|
|
68
|
+
}, []), xe = h((e) => {
|
|
69
69
|
let t = a(e);
|
|
70
70
|
k((e) => {
|
|
71
71
|
let n = new Set(e);
|
|
72
72
|
return n.has(t) ? n.delete(t) : n.add(t), n;
|
|
73
73
|
}), A(t);
|
|
74
|
-
}, []),
|
|
75
|
-
let t = a(e), n = oe ?? ae ?? t, r =
|
|
74
|
+
}, []), Se = h((e) => {
|
|
75
|
+
let t = a(e), n = oe ?? ae ?? t, r = ge.map((e) => e.path), i = r.indexOf(n), o = r.indexOf(t);
|
|
76
76
|
if (i === -1 || o === -1) {
|
|
77
|
-
|
|
77
|
+
be(t);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
let s = Math.min(i, o), c = Math.max(i, o);
|
|
81
81
|
k(new Set(r.slice(s, c + 1))), A(t);
|
|
82
82
|
}, [
|
|
83
|
-
|
|
83
|
+
ge,
|
|
84
84
|
ae,
|
|
85
85
|
oe,
|
|
86
|
-
|
|
87
|
-
]),
|
|
86
|
+
be
|
|
87
|
+
]), Ce = h((e, t = {}) => {
|
|
88
88
|
let n = e.map(a);
|
|
89
89
|
k((e) => {
|
|
90
90
|
let r = t.additive ? new Set(e) : /* @__PURE__ */ new Set();
|
|
91
91
|
for (let e of n) r.add(e);
|
|
92
92
|
return r;
|
|
93
93
|
}), A(n.at(-1) ?? null), j(n.at(0) ?? null);
|
|
94
|
-
}, []),
|
|
94
|
+
}, []), we = h(() => {
|
|
95
95
|
k(new Set(S.map((e) => e.path))), A(S.at(0)?.path ?? null), j(S.at(0)?.path ?? null);
|
|
96
|
-
}, [S]),
|
|
96
|
+
}, [S]), Te = h(() => {
|
|
97
97
|
k(/* @__PURE__ */ new Set()), A(null), j(null);
|
|
98
|
-
}, []),
|
|
99
|
-
e.kind === "folder" ? await
|
|
98
|
+
}, []), Ee = h(async (e) => {
|
|
99
|
+
e.kind === "folder" ? await ve(e.path, {
|
|
100
100
|
source: "item",
|
|
101
101
|
item: e
|
|
102
|
-
}) :
|
|
103
|
-
}, [
|
|
102
|
+
}) : be(e.path);
|
|
103
|
+
}, [ve, be]), De = h(async (r) => {
|
|
104
104
|
if (!n.createFolder) throw new t("not_supported", "Folder creation is not supported by this adapter");
|
|
105
105
|
let i = e(m, r.trim()), a = {
|
|
106
106
|
path: i,
|
|
@@ -115,7 +115,7 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
115
115
|
} catch (e) {
|
|
116
116
|
throw C((e) => ne(e, [i])), e;
|
|
117
117
|
}
|
|
118
|
-
}, [n, m]),
|
|
118
|
+
}, [n, m]), Oe = h(async (e, r) => {
|
|
119
119
|
if (!n.rename) throw new t("not_supported", "Rename is not supported by this adapter");
|
|
120
120
|
let i = a(e), o = S;
|
|
121
121
|
C((e) => e.map((e) => e.path === i ? {
|
|
@@ -128,7 +128,7 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
128
128
|
} catch (e) {
|
|
129
129
|
throw C(o), e;
|
|
130
130
|
}
|
|
131
|
-
}, [n, S]),
|
|
131
|
+
}, [n, S]), ke = h(async (e) => {
|
|
132
132
|
let t = e.map(a), i = S, o = O;
|
|
133
133
|
C((e) => ne(e, t)), k((e) => {
|
|
134
134
|
let n = new Set(e);
|
|
@@ -148,9 +148,9 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
148
148
|
n,
|
|
149
149
|
S,
|
|
150
150
|
O
|
|
151
|
-
]),
|
|
152
|
-
await
|
|
153
|
-
}, [
|
|
151
|
+
]), Ae = h(async () => {
|
|
152
|
+
await ke(H);
|
|
153
|
+
}, [ke, H]), G = h(async (e, i) => {
|
|
154
154
|
if (!n.move) throw new t("not_supported", "Move is not supported by this adapter");
|
|
155
155
|
let o = e.map(a);
|
|
156
156
|
if (o.length === 0) return;
|
|
@@ -160,7 +160,7 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
160
160
|
} catch (e) {
|
|
161
161
|
if (e instanceof r) {
|
|
162
162
|
let t = e.succeededPaths.map(a), n = e.failures.map((e) => a(e.path));
|
|
163
|
-
throw s === m ? await
|
|
163
|
+
throw s === m ? await _e() : C((e) => ne(e, t)), k(new Set(n)), A(n.at(0) ?? null), j(n.at(0) ?? null), e;
|
|
164
164
|
}
|
|
165
165
|
throw e;
|
|
166
166
|
}
|
|
@@ -168,24 +168,24 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
168
168
|
let t = new Set(e);
|
|
169
169
|
for (let e of o) t.delete(e);
|
|
170
170
|
return t;
|
|
171
|
-
}), A(null), j(null), s === m ? await
|
|
171
|
+
}), A(null), j(null), s === m ? await _e() : C((e) => ne(e, o));
|
|
172
172
|
}, [
|
|
173
173
|
n,
|
|
174
174
|
m,
|
|
175
|
-
|
|
176
|
-
]),
|
|
177
|
-
await
|
|
178
|
-
}, [
|
|
175
|
+
_e
|
|
176
|
+
]), je = h(async (e) => {
|
|
177
|
+
await G(H, e), N((e) => e?.type === "cut" ? null : e);
|
|
178
|
+
}, [G, H]), K = h((e = H) => {
|
|
179
179
|
N({
|
|
180
180
|
type: "copy",
|
|
181
181
|
paths: e.map(a)
|
|
182
182
|
});
|
|
183
|
-
}, [
|
|
183
|
+
}, [H]), Me = h((e = H) => {
|
|
184
184
|
N({
|
|
185
185
|
type: "cut",
|
|
186
186
|
paths: e.map(a)
|
|
187
187
|
});
|
|
188
|
-
}, [
|
|
188
|
+
}, [H]), Ne = h(async (e) => {
|
|
189
189
|
if (!M || M.paths.length === 0) return;
|
|
190
190
|
let r = a(e);
|
|
191
191
|
if (M.type === "copy") {
|
|
@@ -193,35 +193,35 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
193
193
|
await n.copy(M.paths, r);
|
|
194
194
|
} else {
|
|
195
195
|
if (!n.move) throw new t("not_supported", "Move is not supported by this adapter");
|
|
196
|
-
await
|
|
196
|
+
await G(M.paths, r), N(null);
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
|
-
r === m && await
|
|
199
|
+
r === m && await _e();
|
|
200
200
|
}, [
|
|
201
201
|
n,
|
|
202
202
|
M,
|
|
203
203
|
m,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
]),
|
|
204
|
+
G,
|
|
205
|
+
_e
|
|
206
|
+
]), Pe = h(async (t, r = {}) => {
|
|
207
207
|
if (r.onConflict === "skip") return [];
|
|
208
208
|
let i = Array.from(t), a = [];
|
|
209
209
|
for (let t of i) {
|
|
210
|
-
let i = e(
|
|
210
|
+
let i = e(z.current, t.name), o = await n.upload(i, t, { onConflict: r.onConflict ?? "keep-both" });
|
|
211
211
|
a.push(o), C((e) => te(e, [o]));
|
|
212
212
|
}
|
|
213
213
|
return a;
|
|
214
214
|
}, [n]);
|
|
215
215
|
return {
|
|
216
216
|
adapter: n,
|
|
217
|
-
capabilities:
|
|
217
|
+
capabilities: V,
|
|
218
218
|
currentPath: m,
|
|
219
219
|
status: g,
|
|
220
220
|
items: S,
|
|
221
221
|
error: E,
|
|
222
222
|
hasMore: !!w,
|
|
223
|
-
selectedPaths:
|
|
224
|
-
selectedItems:
|
|
223
|
+
selectedPaths: H,
|
|
224
|
+
selectedItems: U,
|
|
225
225
|
focusedPath: ae,
|
|
226
226
|
clipboard: M,
|
|
227
227
|
view: se,
|
|
@@ -229,32 +229,32 @@ function ee({ adapter: n, path: i, initialPath: o = "/", onPathChange: s, search
|
|
|
229
229
|
filterKind: I,
|
|
230
230
|
sortBy: L,
|
|
231
231
|
sortDirection: fe,
|
|
232
|
-
filteredItems:
|
|
232
|
+
filteredItems: ge,
|
|
233
233
|
setView: P,
|
|
234
|
-
setSearchQuery:
|
|
234
|
+
setSearchQuery: he,
|
|
235
235
|
setFilterKind: ue,
|
|
236
236
|
setSortBy: de,
|
|
237
237
|
setSortDirection: pe,
|
|
238
|
-
refresh:
|
|
239
|
-
loadMore:
|
|
240
|
-
navigate:
|
|
241
|
-
open:
|
|
242
|
-
selectOnly:
|
|
243
|
-
toggleSelection:
|
|
244
|
-
selectRange:
|
|
245
|
-
setSelection:
|
|
246
|
-
selectAllLoaded:
|
|
247
|
-
clearSelection:
|
|
248
|
-
createFolder:
|
|
249
|
-
rename:
|
|
250
|
-
deleteSelected:
|
|
251
|
-
deletePaths:
|
|
252
|
-
movePathsTo:
|
|
253
|
-
moveSelectedTo:
|
|
254
|
-
copySelection:
|
|
255
|
-
cutSelection:
|
|
256
|
-
pasteInto:
|
|
257
|
-
uploadFiles:
|
|
238
|
+
refresh: _e,
|
|
239
|
+
loadMore: ye,
|
|
240
|
+
navigate: ve,
|
|
241
|
+
open: Ee,
|
|
242
|
+
selectOnly: be,
|
|
243
|
+
toggleSelection: xe,
|
|
244
|
+
selectRange: Se,
|
|
245
|
+
setSelection: Ce,
|
|
246
|
+
selectAllLoaded: we,
|
|
247
|
+
clearSelection: Te,
|
|
248
|
+
createFolder: De,
|
|
249
|
+
rename: Oe,
|
|
250
|
+
deleteSelected: Ae,
|
|
251
|
+
deletePaths: ke,
|
|
252
|
+
movePathsTo: G,
|
|
253
|
+
moveSelectedTo: je,
|
|
254
|
+
copySelection: K,
|
|
255
|
+
cutSelection: Me,
|
|
256
|
+
pasteInto: Ne,
|
|
257
|
+
uploadFiles: Pe
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
260
|
function te(e, t) {
|
|
@@ -426,16 +426,16 @@ var O = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
426
426
|
height: "18",
|
|
427
427
|
rx: "1",
|
|
428
428
|
key: "1wsw3u"
|
|
429
|
-
}]]),
|
|
429
|
+
}]]), z = P("pencil", [["path", {
|
|
430
430
|
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
431
431
|
key: "1a8usu"
|
|
432
432
|
}], ["path", {
|
|
433
433
|
d: "m15 5 4 4",
|
|
434
434
|
key: "1mk7zo"
|
|
435
|
-
}]]),
|
|
435
|
+
}]]), B = P("play", [["path", {
|
|
436
436
|
d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
|
|
437
437
|
key: "10ikf1"
|
|
438
|
-
}]]),
|
|
438
|
+
}]]), me = P("scissors", [
|
|
439
439
|
["circle", {
|
|
440
440
|
cx: "6",
|
|
441
441
|
cy: "6",
|
|
@@ -460,7 +460,7 @@ var O = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
460
460
|
d: "M14.8 14.8 20 20",
|
|
461
461
|
key: "ptml3r"
|
|
462
462
|
}]
|
|
463
|
-
]),
|
|
463
|
+
]), he = P("search", [["path", {
|
|
464
464
|
d: "m21 21-4.34-4.34",
|
|
465
465
|
key: "14j7rj"
|
|
466
466
|
}], ["circle", {
|
|
@@ -468,20 +468,20 @@ var O = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
468
468
|
cy: "11",
|
|
469
469
|
r: "8",
|
|
470
470
|
key: "4ej97u"
|
|
471
|
-
}]]),
|
|
471
|
+
}]]), V = P("square-check-big", [["path", {
|
|
472
472
|
d: "M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",
|
|
473
473
|
key: "2acyp4"
|
|
474
474
|
}], ["path", {
|
|
475
475
|
d: "m9 11 3 3L22 4",
|
|
476
476
|
key: "1pflzl"
|
|
477
|
-
}]]),
|
|
477
|
+
}]]), H = P("square", [["rect", {
|
|
478
478
|
width: "18",
|
|
479
479
|
height: "18",
|
|
480
480
|
x: "3",
|
|
481
481
|
y: "3",
|
|
482
482
|
rx: "2",
|
|
483
483
|
key: "afitv7"
|
|
484
|
-
}]]),
|
|
484
|
+
}]]), U = P("trash-2", [
|
|
485
485
|
["path", {
|
|
486
486
|
d: "M10 11v6",
|
|
487
487
|
key: "nco0om"
|
|
@@ -502,7 +502,7 @@ var O = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
502
502
|
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
503
503
|
key: "e791ji"
|
|
504
504
|
}]
|
|
505
|
-
]),
|
|
505
|
+
]), ge = P("upload", [
|
|
506
506
|
["path", {
|
|
507
507
|
d: "M12 3v12",
|
|
508
508
|
key: "1x0j5s"
|
|
@@ -515,7 +515,7 @@ var O = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
515
515
|
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
|
|
516
516
|
key: "ih7n3h"
|
|
517
517
|
}]
|
|
518
|
-
]),
|
|
518
|
+
]), W = P("x", [["path", {
|
|
519
519
|
d: "M18 6 6 18",
|
|
520
520
|
key: "1bl5f8"
|
|
521
521
|
}], ["path", {
|
|
@@ -524,37 +524,37 @@ var O = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
524
524
|
}]]);
|
|
525
525
|
//#endregion
|
|
526
526
|
//#region src/core/upload-drop.ts
|
|
527
|
-
async function
|
|
527
|
+
async function _e(e) {
|
|
528
528
|
let t = Array.from(e.items).map((e) => e.webkitGetAsEntry?.()).filter((e) => !!e);
|
|
529
|
-
if (t.length === 0) return
|
|
529
|
+
if (t.length === 0) return ve(e.files);
|
|
530
530
|
let n = [];
|
|
531
|
-
for (let e of t) n.push(...await
|
|
531
|
+
for (let e of t) n.push(...await ye(e));
|
|
532
532
|
return n;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function ve(e) {
|
|
535
535
|
return Array.from(e).map((e) => ({
|
|
536
536
|
file: e,
|
|
537
|
-
relativePath:
|
|
537
|
+
relativePath: we(Se(e))
|
|
538
538
|
}));
|
|
539
539
|
}
|
|
540
|
-
async function
|
|
540
|
+
async function ye(e, t = "") {
|
|
541
541
|
if (e.isFile) {
|
|
542
|
-
let n = await
|
|
542
|
+
let n = await be(e);
|
|
543
543
|
return [{
|
|
544
544
|
file: n,
|
|
545
|
-
relativePath:
|
|
545
|
+
relativePath: we(Ce(t, n.name))
|
|
546
546
|
}];
|
|
547
547
|
}
|
|
548
|
-
let n =
|
|
549
|
-
for (let e of r) i.push(...await
|
|
548
|
+
let n = Ce(t, e.name), r = await xe(e), i = [];
|
|
549
|
+
for (let e of r) i.push(...await ye(e, n));
|
|
550
550
|
return i;
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function be(e) {
|
|
553
553
|
return new Promise((t, n) => {
|
|
554
554
|
e.file(t, n);
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
async function
|
|
557
|
+
async function xe(e) {
|
|
558
558
|
let t = e.createReader(), n = [];
|
|
559
559
|
for (;;) {
|
|
560
560
|
let e = await new Promise((e, n) => {
|
|
@@ -565,18 +565,18 @@ async function Se(e) {
|
|
|
565
565
|
}
|
|
566
566
|
return n;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function Se(e) {
|
|
569
569
|
return e.webkitRelativePath || e.name;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function Ce(...e) {
|
|
572
572
|
return e.filter(Boolean).join("/");
|
|
573
573
|
}
|
|
574
|
-
function
|
|
574
|
+
function we(e) {
|
|
575
575
|
return e.replaceAll("\\", "/").split("/").filter((e) => e && e !== "." && e !== "..").join("/");
|
|
576
576
|
}
|
|
577
577
|
//#endregion
|
|
578
578
|
//#region src/transfers/transfer-manager.ts
|
|
579
|
-
var
|
|
579
|
+
var Te = "react-file-browser-transfers", Ee = 1440 * 60 * 1e3, De = class {
|
|
580
580
|
uploads = /* @__PURE__ */ new Map();
|
|
581
581
|
downloads = /* @__PURE__ */ new Map();
|
|
582
582
|
uploadSpeedSamples = /* @__PURE__ */ new Map();
|
|
@@ -590,7 +590,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
590
590
|
maxConcurrentUploads;
|
|
591
591
|
snapshotCache;
|
|
592
592
|
constructor(e = {}) {
|
|
593
|
-
this.storage = e.storage ?? void 0, this.storageKey = e.storageKey ??
|
|
593
|
+
this.storage = e.storage ?? void 0, this.storageKey = e.storageKey ?? Te, this.idFactory = e.idFactory ?? q, this.now = e.now ?? (() => /* @__PURE__ */ new Date()), this.maxConcurrentUploads = Ie(e.maxConcurrentUploads), this.restorePersisted(), this.downloads.size > 0 && this.pruneExpiredDownloads();
|
|
594
594
|
}
|
|
595
595
|
subscribe(e) {
|
|
596
596
|
return this.subscribers.add(e), () => {
|
|
@@ -599,13 +599,13 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
599
599
|
}
|
|
600
600
|
getSnapshot() {
|
|
601
601
|
return this.snapshotCache ??= {
|
|
602
|
-
uploads: Array.from(this.uploads.values()).map(
|
|
603
|
-
downloads: Array.from(this.downloads.values()).map((e) => ({ ...
|
|
602
|
+
uploads: Array.from(this.uploads.values()).map(je),
|
|
603
|
+
downloads: Array.from(this.downloads.values()).map((e) => ({ ...K(e) }))
|
|
604
604
|
}, this.snapshotCache;
|
|
605
605
|
}
|
|
606
606
|
getUpload(e) {
|
|
607
607
|
let t = this.uploads.get(e);
|
|
608
|
-
return t ?
|
|
608
|
+
return t ? je(t) : void 0;
|
|
609
609
|
}
|
|
610
610
|
getRestorableUploads() {
|
|
611
611
|
return Array.from(this.uploads.values()).filter((e) => [
|
|
@@ -613,7 +613,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
613
613
|
"uploading",
|
|
614
614
|
"paused",
|
|
615
615
|
"failed"
|
|
616
|
-
].includes(e.status)).filter((e) => !e.file || !e.adapter).map(
|
|
616
|
+
].includes(e.status)).filter((e) => !e.file || !e.adapter).map(je);
|
|
617
617
|
}
|
|
618
618
|
dismissRestoredUploads(e) {
|
|
619
619
|
for (let t of e) {
|
|
@@ -624,7 +624,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
624
624
|
}
|
|
625
625
|
dismissDownload(e) {
|
|
626
626
|
let t = this.downloads.get(e);
|
|
627
|
-
t && (
|
|
627
|
+
t && (Re(t.url), this.downloads.delete(e), this.persistAndNotify());
|
|
628
628
|
}
|
|
629
629
|
hasActiveTransfers() {
|
|
630
630
|
let e = this.getSnapshot();
|
|
@@ -686,12 +686,12 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
686
686
|
if (e.bulkDownloadUrl) {
|
|
687
687
|
let n = await e.bulkDownloadUrl(t);
|
|
688
688
|
s.status = "ready", s.url = n.url, s.expiresAt = n.expiresAt;
|
|
689
|
-
} else if (i) n > r ? (s.status = "warning", s.warning = "client_zip_size") : (s.url = await
|
|
689
|
+
} else if (i) n > r ? (s.status = "warning", s.warning = "client_zip_size") : (s.url = await Be(e, t), s.status = "ready");
|
|
690
690
|
else throw Error("Client-side ZIP fallback is disabled.");
|
|
691
691
|
} catch (e) {
|
|
692
|
-
s.status = "failed", s.error =
|
|
692
|
+
s.status = "failed", s.error = ze(e);
|
|
693
693
|
}
|
|
694
|
-
return s.updatedAt = this.timestamp(), this.persistAndNotify(),
|
|
694
|
+
return s.updatedAt = this.timestamp(), this.persistAndNotify(), K(s);
|
|
695
695
|
}
|
|
696
696
|
async prepareSingleDownload({ adapter: e, path: t, selectedBytes: n = 0 }) {
|
|
697
697
|
let r = this.idFactory(), i = this.timestamp(), a = {
|
|
@@ -709,22 +709,22 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
709
709
|
try {
|
|
710
710
|
a.url = await e.signedUrl(t), a.status = "ready";
|
|
711
711
|
} catch (e) {
|
|
712
|
-
a.status = "failed", a.error =
|
|
712
|
+
a.status = "failed", a.error = ze(e);
|
|
713
713
|
}
|
|
714
|
-
return a.updatedAt = this.timestamp(), this.persistAndNotify(),
|
|
714
|
+
return a.updatedAt = this.timestamp(), this.persistAndNotify(), K(a);
|
|
715
715
|
}
|
|
716
716
|
async confirmBulkDownload(e) {
|
|
717
717
|
let t = this.downloads.get(e);
|
|
718
718
|
if (t) {
|
|
719
|
-
if (t.status !== "warning") return
|
|
720
|
-
if (!t.adapter) return t.status = "failed", t.error = "This download can no longer continue in the current session.", t.updatedAt = this.timestamp(), this.persistAndNotify(),
|
|
719
|
+
if (t.status !== "warning") return K(t);
|
|
720
|
+
if (!t.adapter) return t.status = "failed", t.error = "This download can no longer continue in the current session.", t.updatedAt = this.timestamp(), this.persistAndNotify(), K(t);
|
|
721
721
|
t.status = "preparing", t.warning = void 0, t.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
722
722
|
try {
|
|
723
|
-
t.url = await
|
|
723
|
+
t.url = await Be(t.adapter, t.paths), t.status = "ready";
|
|
724
724
|
} catch (e) {
|
|
725
|
-
t.status = "failed", t.error =
|
|
725
|
+
t.status = "failed", t.error = ze(e);
|
|
726
726
|
}
|
|
727
|
-
return t.updatedAt = this.timestamp(), this.persistAndNotify(),
|
|
727
|
+
return t.updatedAt = this.timestamp(), this.persistAndNotify(), K(t);
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
730
|
async runUpload(e) {
|
|
@@ -732,7 +732,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
732
732
|
if (!(!t?.adapter || !t.file || t.status !== "queued")) {
|
|
733
733
|
t.status = "uploading", t.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
734
734
|
try {
|
|
735
|
-
let e =
|
|
735
|
+
let e = Oe(t.adapter) ? await this.runMultipartUpload(t) : await this.runSimpleUpload(t);
|
|
736
736
|
if (["paused", "cancelled"].includes(t.status)) {
|
|
737
737
|
this.uploadSpeedSamples.delete(t.id), this.persistAndNotify();
|
|
738
738
|
return;
|
|
@@ -743,7 +743,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
743
743
|
this.uploadSpeedSamples.delete(t.id), this.persistAndNotify();
|
|
744
744
|
return;
|
|
745
745
|
}
|
|
746
|
-
t.status = "failed", t.error =
|
|
746
|
+
t.status = "failed", t.error = ze(e), this.uploadSpeedSamples.delete(t.id), t.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
749
|
}
|
|
@@ -759,16 +759,16 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
759
759
|
}
|
|
760
760
|
async runMultipartUpload(e) {
|
|
761
761
|
let t = e.adapter, n = e.file;
|
|
762
|
-
if (!t || !n || !
|
|
762
|
+
if (!t || !n || !Oe(t)) throw Error("Multipart upload is not available");
|
|
763
763
|
if (!e.uploadId || !e.partSize) {
|
|
764
|
-
await
|
|
764
|
+
await Ae(e);
|
|
765
765
|
let r = await t.createMultipartUpload(e.path, n.size);
|
|
766
766
|
e.uploadId = r.uploadId, e.partSize = r.partSize, e.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
767
767
|
}
|
|
768
768
|
let r = e.partSize, i = Math.ceil(n.size / r);
|
|
769
769
|
for (let a = 1; a <= i; a += 1) {
|
|
770
770
|
if (e.completedParts.some((e) => e.partNumber === a)) continue;
|
|
771
|
-
let i = (a - 1) * r, o = Math.min(i + r, n.size), s = n.slice(i, o), c =
|
|
771
|
+
let i = (a - 1) * r, o = Math.min(i + r, n.size), s = n.slice(i, o), c = ke(e), l = await t.uploadPart({
|
|
772
772
|
uploadId: e.uploadId,
|
|
773
773
|
partNumber: a,
|
|
774
774
|
chunk: s,
|
|
@@ -780,7 +780,7 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
780
780
|
e.completedParts = [...e.completedParts, {
|
|
781
781
|
partNumber: a,
|
|
782
782
|
etag: l.etag
|
|
783
|
-
}].sort((e, t) => e.partNumber - t.partNumber), e.loadedBytes =
|
|
783
|
+
}].sort((e, t) => e.partNumber - t.partNumber), e.loadedBytes = ke(e), e.updatedAt = this.timestamp(), this.persistAndNotify();
|
|
784
784
|
}
|
|
785
785
|
return t.completeMultipartUpload({
|
|
786
786
|
uploadId: e.uploadId,
|
|
@@ -814,8 +814,8 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
814
814
|
persist() {
|
|
815
815
|
if (!this.storage) return;
|
|
816
816
|
let e = {
|
|
817
|
-
uploads: Array.from(this.uploads.values()).map(
|
|
818
|
-
downloads: Array.from(this.downloads.values()).map(
|
|
817
|
+
uploads: Array.from(this.uploads.values()).map(Me),
|
|
818
|
+
downloads: Array.from(this.downloads.values()).map(Pe)
|
|
819
819
|
};
|
|
820
820
|
this.storage.setItem(this.storageKey, JSON.stringify(e));
|
|
821
821
|
}
|
|
@@ -825,11 +825,11 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
825
825
|
if (e) try {
|
|
826
826
|
let t = JSON.parse(e);
|
|
827
827
|
for (let e of t.uploads ?? []) {
|
|
828
|
-
let t =
|
|
828
|
+
let t = Ne(e);
|
|
829
829
|
this.uploads.set(t.id, t);
|
|
830
830
|
}
|
|
831
831
|
for (let e of t.downloads ?? []) {
|
|
832
|
-
let t =
|
|
832
|
+
let t = Fe(e);
|
|
833
833
|
this.downloads.set(t.id, t);
|
|
834
834
|
}
|
|
835
835
|
} catch {
|
|
@@ -841,33 +841,33 @@ var Ee = "react-file-browser-transfers", De = 1440 * 60 * 1e3, Oe = class {
|
|
|
841
841
|
}
|
|
842
842
|
pruneExpiredDownloads() {
|
|
843
843
|
let e = this.now().getTime(), t = !1;
|
|
844
|
-
for (let [n, r] of this.downloads)
|
|
844
|
+
for (let [n, r] of this.downloads) Le(r, e) && (Re(r.url), this.downloads.delete(n), t = !0);
|
|
845
845
|
t && (this.snapshotCache = void 0, this.persist());
|
|
846
846
|
}
|
|
847
847
|
};
|
|
848
|
-
function
|
|
848
|
+
function Oe(e) {
|
|
849
849
|
return typeof e.createMultipartUpload == "function" && typeof e.uploadPart == "function" && typeof e.completeMultipartUpload == "function";
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function ke(e) {
|
|
852
852
|
let t = e.partSize ?? e.totalBytes;
|
|
853
853
|
return e.completedParts.reduce((n, r) => {
|
|
854
854
|
let i = (r.partNumber - 1) * t;
|
|
855
855
|
return n + Math.min(t, e.totalBytes - i);
|
|
856
856
|
}, 0);
|
|
857
857
|
}
|
|
858
|
-
async function
|
|
858
|
+
async function Ae(e) {
|
|
859
859
|
let n = e.adapter;
|
|
860
860
|
if (!n?.exists) return;
|
|
861
861
|
let r = (e) => n.exists?.(e) ?? Promise.resolve({});
|
|
862
862
|
if ((await r([e.path]))[e.path]) {
|
|
863
863
|
if (e.onConflict === "keep-both") {
|
|
864
|
-
e.path = await
|
|
864
|
+
e.path = await G(r, e.path);
|
|
865
865
|
return;
|
|
866
866
|
}
|
|
867
867
|
if (e.onConflict !== "replace") throw new t("conflict", `A file browser entry already exists at ${e.path}`);
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
async function
|
|
870
|
+
async function G(n, r) {
|
|
871
871
|
let a = o(r), s = i(r), c = s.lastIndexOf("."), l = c > 0, u = l ? s.slice(0, c) : s, d = l ? s.slice(c) : "";
|
|
872
872
|
for (let t = 1; t < 2 ** 53 - 1; t += 1) {
|
|
873
873
|
let r = e(a, `${u} (${t})${d}`);
|
|
@@ -875,21 +875,21 @@ async function W(n, r) {
|
|
|
875
875
|
}
|
|
876
876
|
throw new t("conflict", `Could not allocate a unique file browser path for ${r}`);
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function je(e) {
|
|
879
879
|
return {
|
|
880
880
|
...e,
|
|
881
881
|
group: e.group ? { ...e.group } : void 0,
|
|
882
882
|
completedParts: e.completedParts.map((e) => ({ ...e }))
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function K(e) {
|
|
886
886
|
let { adapter: t, ...n } = e;
|
|
887
887
|
return {
|
|
888
888
|
...n,
|
|
889
889
|
paths: [...e.paths]
|
|
890
890
|
};
|
|
891
891
|
}
|
|
892
|
-
function
|
|
892
|
+
function Me(e) {
|
|
893
893
|
return {
|
|
894
894
|
id: e.id,
|
|
895
895
|
kind: e.kind,
|
|
@@ -909,7 +909,7 @@ function Ne(e) {
|
|
|
909
909
|
group: e.group ? { ...e.group } : void 0
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
|
-
function
|
|
912
|
+
function Ne(e) {
|
|
913
913
|
return {
|
|
914
914
|
id: e.id,
|
|
915
915
|
kind: "upload",
|
|
@@ -929,7 +929,7 @@ function Pe(e) {
|
|
|
929
929
|
group: e.group ? { ...e.group } : void 0
|
|
930
930
|
};
|
|
931
931
|
}
|
|
932
|
-
function
|
|
932
|
+
function Pe(e) {
|
|
933
933
|
return {
|
|
934
934
|
id: e.id,
|
|
935
935
|
kind: e.kind,
|
|
@@ -945,34 +945,34 @@ function Fe(e) {
|
|
|
945
945
|
error: e.error
|
|
946
946
|
};
|
|
947
947
|
}
|
|
948
|
-
function
|
|
949
|
-
return
|
|
948
|
+
function Fe(e) {
|
|
949
|
+
return Pe(e);
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Ie(e) {
|
|
952
952
|
if (e === void 0) return Infinity;
|
|
953
953
|
if (!Number.isInteger(e) || e < 1) throw RangeError("maxConcurrentUploads must be a positive integer");
|
|
954
954
|
return e;
|
|
955
955
|
}
|
|
956
|
-
function
|
|
956
|
+
function Le(e, t) {
|
|
957
957
|
if (e.status === "preparing") return !1;
|
|
958
958
|
if (e.expiresAt) {
|
|
959
959
|
let n = Date.parse(e.expiresAt);
|
|
960
960
|
if (Number.isFinite(n) && n <= t) return !0;
|
|
961
961
|
}
|
|
962
962
|
let n = Date.parse(e.updatedAt);
|
|
963
|
-
return Number.isFinite(n) && t - n >
|
|
963
|
+
return Number.isFinite(n) && t - n > Ee;
|
|
964
964
|
}
|
|
965
|
-
function
|
|
965
|
+
function Re(e) {
|
|
966
966
|
!e?.startsWith("blob:") || typeof URL > "u" || typeof URL.revokeObjectURL != "function" || URL.revokeObjectURL(e);
|
|
967
967
|
}
|
|
968
|
-
function
|
|
968
|
+
function q() {
|
|
969
969
|
return `transfer-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function ze(e) {
|
|
972
972
|
return e instanceof Error ? e.message : String(e);
|
|
973
973
|
}
|
|
974
|
-
async function
|
|
975
|
-
let n = await
|
|
974
|
+
async function Be(e, t) {
|
|
975
|
+
let n = await J(e, t), r = {};
|
|
976
976
|
for (let t of n) {
|
|
977
977
|
let n = await e.signedUrl(t.path), i = await fetch(n);
|
|
978
978
|
if (!i.ok) throw Error(`Could not fetch ${t.path} for the client zip`);
|
|
@@ -981,52 +981,52 @@ async function Ve(e, t) {
|
|
|
981
981
|
let i = d(r);
|
|
982
982
|
return URL.createObjectURL(new Blob([i], { type: "application/zip" }));
|
|
983
983
|
}
|
|
984
|
-
async function
|
|
984
|
+
async function J(e, t) {
|
|
985
985
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
986
|
-
for (let i of t) await
|
|
986
|
+
for (let i of t) await Ve(e, i, n, r);
|
|
987
987
|
return n;
|
|
988
988
|
}
|
|
989
|
-
async function
|
|
989
|
+
async function Ve(e, t, n, r) {
|
|
990
990
|
if (r.has(t)) return;
|
|
991
991
|
r.add(t);
|
|
992
|
-
let i = await
|
|
992
|
+
let i = await Ue(e, t);
|
|
993
993
|
if (i?.kind === "file") {
|
|
994
994
|
n.push({
|
|
995
995
|
path: t,
|
|
996
|
-
archivePath:
|
|
996
|
+
archivePath: Ge(t)
|
|
997
997
|
});
|
|
998
998
|
return;
|
|
999
999
|
}
|
|
1000
1000
|
if (i?.kind === "folder") {
|
|
1001
|
-
await
|
|
1001
|
+
await He(e, t, n, r);
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
let a = await
|
|
1004
|
+
let a = await We(e, t);
|
|
1005
1005
|
if (a) {
|
|
1006
|
-
for (let t of a) await
|
|
1006
|
+
for (let t of a) await Ve(e, t.path, n, r);
|
|
1007
1007
|
return;
|
|
1008
1008
|
}
|
|
1009
1009
|
n.push({
|
|
1010
1010
|
path: t,
|
|
1011
|
-
archivePath:
|
|
1011
|
+
archivePath: Ge(t)
|
|
1012
1012
|
});
|
|
1013
1013
|
}
|
|
1014
|
-
async function
|
|
1014
|
+
async function He(e, t, n, r) {
|
|
1015
1015
|
let i;
|
|
1016
1016
|
do {
|
|
1017
1017
|
let a = await e.list(t, { cursor: i });
|
|
1018
|
-
for (let t of a.items) await
|
|
1018
|
+
for (let t of a.items) await Ve(e, t.path, n, r);
|
|
1019
1019
|
i = a.cursor;
|
|
1020
1020
|
} while (i);
|
|
1021
1021
|
}
|
|
1022
|
-
async function
|
|
1022
|
+
async function Ue(e, t) {
|
|
1023
1023
|
if (e.stat) try {
|
|
1024
1024
|
return await e.stat(t);
|
|
1025
1025
|
} catch {
|
|
1026
1026
|
return;
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
|
-
async function
|
|
1029
|
+
async function We(e, t) {
|
|
1030
1030
|
try {
|
|
1031
1031
|
let n, r = [];
|
|
1032
1032
|
do {
|
|
@@ -1038,14 +1038,14 @@ async function Ge(e, t) {
|
|
|
1038
1038
|
return;
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function Ge(e) {
|
|
1042
1042
|
return e.replace(/^\/+/, "") || "download";
|
|
1043
1043
|
}
|
|
1044
1044
|
//#endregion
|
|
1045
1045
|
//#region src/transfers/file-browser-provider.tsx
|
|
1046
|
-
var
|
|
1046
|
+
var Ke = f(null), qe = "transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out motion-reduce:transition-none", Je = "transition-[background-color,border-color,box-shadow,opacity] duration-200 ease-out motion-reduce:transition-none";
|
|
1047
1047
|
function Ye({ children: e, manager: t, options: n, resolveRestoredUpload: r, showFloatingWidget: i = !0 }) {
|
|
1048
|
-
let [a] = b(() => t ?? new
|
|
1048
|
+
let [a] = b(() => t ?? new De(et(n))), o = t ?? a, s = Qe(o), [c, l] = b(!1), u = o.getRestorableUploads();
|
|
1049
1049
|
$e(o);
|
|
1050
1050
|
async function d(e) {
|
|
1051
1051
|
for (let t of e) {
|
|
@@ -1061,7 +1061,7 @@ function Ye({ children: e, manager: t, options: n, resolveRestoredUpload: r, sho
|
|
|
1061
1061
|
}
|
|
1062
1062
|
l(!0);
|
|
1063
1063
|
}
|
|
1064
|
-
return /* @__PURE__ */ E(
|
|
1064
|
+
return /* @__PURE__ */ E(Ke.Provider, {
|
|
1065
1065
|
value: o,
|
|
1066
1066
|
children: [
|
|
1067
1067
|
e,
|
|
@@ -1082,7 +1082,7 @@ function Ye({ children: e, manager: t, options: n, resolveRestoredUpload: r, sho
|
|
|
1082
1082
|
});
|
|
1083
1083
|
}
|
|
1084
1084
|
function Xe() {
|
|
1085
|
-
return g(
|
|
1085
|
+
return g(Ke) ?? it;
|
|
1086
1086
|
}
|
|
1087
1087
|
function Ze() {
|
|
1088
1088
|
return Qe(Xe());
|
|
@@ -1118,7 +1118,7 @@ function tt({ manager: e, snapshot: t }) {
|
|
|
1118
1118
|
].includes(e.status));
|
|
1119
1119
|
return n.length === 0 && o.length === 0 ? null : C(/* @__PURE__ */ E("aside", {
|
|
1120
1120
|
"aria-label": "Transfers",
|
|
1121
|
-
className: `fixed bottom-4 right-4 z-50 w-[min(360px,calc(100vw-2rem))] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-3 text-[12px] text-[var(--fb-text)] shadow-[0_16px_44px_color-mix(in_oklch,var(--fb-text)_16%,transparent)] ${
|
|
1121
|
+
className: `fixed bottom-4 right-4 z-50 w-[min(360px,calc(100vw-2rem))] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-3 text-[12px] text-[var(--fb-text)] shadow-[0_16px_44px_color-mix(in_oklch,var(--fb-text)_16%,transparent)] ${Je}`,
|
|
1122
1122
|
children: [/* @__PURE__ */ E("div", {
|
|
1123
1123
|
className: "mb-2 flex items-center justify-between gap-2",
|
|
1124
1124
|
children: [/* @__PURE__ */ T("div", {
|
|
@@ -1146,7 +1146,7 @@ function tt({ manager: e, snapshot: t }) {
|
|
|
1146
1146
|
className: "flex items-center justify-between gap-2",
|
|
1147
1147
|
children: [/* @__PURE__ */ E("a", {
|
|
1148
1148
|
"aria-label": "Open prepared download",
|
|
1149
|
-
className: `inline-flex min-w-0 items-center gap-1 rounded-[calc(var(--fb-radius)-4px)] px-1.5 py-1 font-medium text-[var(--fb-accent)] hover:bg-[var(--fb-accent-soft)] ${
|
|
1149
|
+
className: `inline-flex min-w-0 items-center gap-1 rounded-[calc(var(--fb-radius)-4px)] px-1.5 py-1 font-medium text-[var(--fb-accent)] hover:bg-[var(--fb-accent-soft)] ${qe}`,
|
|
1150
1150
|
download: !0,
|
|
1151
1151
|
href: t.url,
|
|
1152
1152
|
onClick: () => e.dismissDownload(t.id),
|
|
@@ -1162,7 +1162,7 @@ function tt({ manager: e, snapshot: t }) {
|
|
|
1162
1162
|
className: at(),
|
|
1163
1163
|
onClick: () => e.dismissDownload(t.id),
|
|
1164
1164
|
type: "button",
|
|
1165
|
-
children: /* @__PURE__ */ T(
|
|
1165
|
+
children: /* @__PURE__ */ T(W, {
|
|
1166
1166
|
"aria-hidden": "true",
|
|
1167
1167
|
className: "size-3.5"
|
|
1168
1168
|
})
|
|
@@ -1190,7 +1190,7 @@ function tt({ manager: e, snapshot: t }) {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
function nt({ group: e, manager: t }) {
|
|
1192
1192
|
return /* @__PURE__ */ E("div", {
|
|
1193
|
-
className:
|
|
1193
|
+
className: Je,
|
|
1194
1194
|
children: [/* @__PURE__ */ E("div", {
|
|
1195
1195
|
className: "flex items-center justify-between gap-2",
|
|
1196
1196
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -1210,13 +1210,13 @@ function nt({ group: e, manager: t }) {
|
|
|
1210
1210
|
},
|
|
1211
1211
|
title: "Cancel",
|
|
1212
1212
|
type: "button",
|
|
1213
|
-
children: /* @__PURE__ */ T(
|
|
1213
|
+
children: /* @__PURE__ */ T(W, {
|
|
1214
1214
|
"aria-hidden": "true",
|
|
1215
1215
|
className: "size-3.5"
|
|
1216
1216
|
})
|
|
1217
1217
|
})]
|
|
1218
1218
|
}), /* @__PURE__ */ T("div", {
|
|
1219
|
-
className: `mt-2 flex flex-col gap-1.5 border-l border-[var(--fb-border)] pl-3 ${
|
|
1219
|
+
className: `mt-2 flex flex-col gap-1.5 border-l border-[var(--fb-border)] pl-3 ${Je}`,
|
|
1220
1220
|
children: e.activeUploads.map((e) => /* @__PURE__ */ T(Y, {
|
|
1221
1221
|
compact: !0,
|
|
1222
1222
|
manager: t,
|
|
@@ -1227,7 +1227,7 @@ function nt({ group: e, manager: t }) {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
function Y({ compact: e = !1, manager: t, upload: n }) {
|
|
1229
1229
|
return /* @__PURE__ */ E("div", {
|
|
1230
|
-
className:
|
|
1230
|
+
className: Je,
|
|
1231
1231
|
children: [/* @__PURE__ */ E("div", {
|
|
1232
1232
|
className: "flex items-center justify-between gap-2",
|
|
1233
1233
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -1259,7 +1259,7 @@ function Y({ compact: e = !1, manager: t, upload: n }) {
|
|
|
1259
1259
|
onClick: () => void t.resumeUpload(n.id),
|
|
1260
1260
|
title: "Resume",
|
|
1261
1261
|
type: "button",
|
|
1262
|
-
children: /* @__PURE__ */ T(
|
|
1262
|
+
children: /* @__PURE__ */ T(B, {
|
|
1263
1263
|
"aria-hidden": "true",
|
|
1264
1264
|
className: "size-3.5"
|
|
1265
1265
|
})
|
|
@@ -1270,7 +1270,7 @@ function Y({ compact: e = !1, manager: t, upload: n }) {
|
|
|
1270
1270
|
onClick: () => void t.cancelUpload(n.id),
|
|
1271
1271
|
title: "Cancel",
|
|
1272
1272
|
type: "button",
|
|
1273
|
-
children: /* @__PURE__ */ T(
|
|
1273
|
+
children: /* @__PURE__ */ T(W, {
|
|
1274
1274
|
"aria-hidden": "true",
|
|
1275
1275
|
className: "size-3.5"
|
|
1276
1276
|
})
|
|
@@ -1278,7 +1278,7 @@ function Y({ compact: e = !1, manager: t, upload: n }) {
|
|
|
1278
1278
|
]
|
|
1279
1279
|
})]
|
|
1280
1280
|
}), /* @__PURE__ */ T("div", {
|
|
1281
|
-
className: `h-1.5 overflow-hidden rounded-full bg-[var(--fb-surface-2)] ${
|
|
1281
|
+
className: `h-1.5 overflow-hidden rounded-full bg-[var(--fb-surface-2)] ${Je} ${e ? "mt-1" : "mt-1.5"}`,
|
|
1282
1282
|
children: /* @__PURE__ */ T("div", {
|
|
1283
1283
|
className: "h-full rounded-full bg-[var(--fb-accent)] transition-[width] duration-300 ease-out motion-reduce:transition-none",
|
|
1284
1284
|
style: { width: `${Math.min(100, n.totalBytes ? n.loadedBytes / n.totalBytes * 100 : 0)}%` }
|
|
@@ -1290,10 +1290,10 @@ function rt({ count: e, onDismiss: t, onResume: n }) {
|
|
|
1290
1290
|
return C(/* @__PURE__ */ T("div", {
|
|
1291
1291
|
"aria-label": "Resume uploads",
|
|
1292
1292
|
"aria-modal": "true",
|
|
1293
|
-
className: `fixed inset-0 z-50 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 text-[13px] text-[var(--fb-text)] ${
|
|
1293
|
+
className: `fixed inset-0 z-50 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 text-[13px] text-[var(--fb-text)] ${Je}`,
|
|
1294
1294
|
role: "dialog",
|
|
1295
1295
|
children: /* @__PURE__ */ E("div", {
|
|
1296
|
-
className: `w-[min(380px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${
|
|
1296
|
+
className: `w-[min(380px,100%)] rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] p-4 shadow-[0_18px_50px_color-mix(in_oklch,var(--fb-text)_18%,transparent)] ${Je}`,
|
|
1297
1297
|
children: [
|
|
1298
1298
|
/* @__PURE__ */ T("h2", {
|
|
1299
1299
|
className: "m-0 text-[14px] font-semibold",
|
|
@@ -1326,15 +1326,15 @@ function rt({ count: e, onDismiss: t, onResume: n }) {
|
|
|
1326
1326
|
})
|
|
1327
1327
|
}), document.body);
|
|
1328
1328
|
}
|
|
1329
|
-
var it = new
|
|
1329
|
+
var it = new De();
|
|
1330
1330
|
function at() {
|
|
1331
|
-
return `grid size-7 place-items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] text-[var(--fb-muted)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${
|
|
1331
|
+
return `grid size-7 place-items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] text-[var(--fb-muted)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${qe}`;
|
|
1332
1332
|
}
|
|
1333
1333
|
function ot() {
|
|
1334
|
-
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[11px] font-medium text-[var(--fb-text)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${
|
|
1334
|
+
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[11px] font-medium text-[var(--fb-text)] outline-none hover:bg-[var(--fb-bg)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${qe}`;
|
|
1335
1335
|
}
|
|
1336
1336
|
function st() {
|
|
1337
|
-
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-accent)] bg-[var(--fb-accent)] px-2 text-[11px] font-semibold text-[var(--fb-surface)] outline-none hover:opacity-90 focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${
|
|
1337
|
+
return `inline-flex h-7 items-center rounded-[calc(var(--fb-radius)-4px)] border border-[var(--fb-accent)] bg-[var(--fb-accent)] px-2 text-[11px] font-semibold text-[var(--fb-surface)] outline-none hover:opacity-90 focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${qe}`;
|
|
1338
1338
|
}
|
|
1339
1339
|
function ct(e) {
|
|
1340
1340
|
return [
|
|
@@ -1429,44 +1429,44 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1429
1429
|
searchQuery: u,
|
|
1430
1430
|
initialSearchQuery: d,
|
|
1431
1431
|
onSearchQueryChange: f
|
|
1432
|
-
}), re = Xe(), ie = Ze(), [O, k] = b(!1), [ae, A] = b(""), [oe, j] = b(null), [M, N] = b(null), [se, P] = b(""), [F, I] = b(null), [L, R] = b(null), [
|
|
1433
|
-
|
|
1432
|
+
}), re = Xe(), ie = Ze(), [O, k] = b(!1), [ae, A] = b(""), [oe, j] = b(null), [M, N] = b(null), [se, P] = b(""), [F, I] = b(null), [L, R] = b(null), [z, B] = b(""), [me, V] = b(null), [H, U] = b(!1), [W, ye] = b(!1), [be, xe] = b(null), [Se, Ce] = b(s ?? a), [we, Te] = b([]), [Ee, De] = b("idle"), [Oe, ke] = b(null), [Ae, G] = b(null), [je, K] = b(null), [Me, Ne] = b([]), [Pe, Fe] = b(!1), [Ie, Le] = b(null), [Re, q] = b(!1), [ze, Be] = b(null), [J, Ve] = b(null), He = y(null), Ue = y(null), We = y([]), Ge = y(null), Ke = y(null), qe = y(null), Je = y(/* @__PURE__ */ new Set()), Ye = D.selectedItems.at(0) ?? null, Qe = v(() => on(S ?? vt), [S]), $e = D.capabilities.bulkDownload || C, et = cn(D.selectedItems, $e), tt = v(() => D.filteredItems.filter((e) => e.kind === "file"), [D.filteredItems]), nt = h(async (t) => {
|
|
1433
|
+
Ve({
|
|
1434
1434
|
item: t,
|
|
1435
1435
|
status: "loading"
|
|
1436
1436
|
});
|
|
1437
1437
|
try {
|
|
1438
1438
|
let n = await e.signedUrl(t.path);
|
|
1439
|
-
|
|
1439
|
+
Ve((e) => e?.item.path === t.path ? {
|
|
1440
1440
|
item: t,
|
|
1441
1441
|
status: "ready",
|
|
1442
1442
|
url: n
|
|
1443
1443
|
} : e);
|
|
1444
1444
|
} catch (e) {
|
|
1445
|
-
|
|
1445
|
+
Ve((n) => n?.item.path === t.path ? {
|
|
1446
1446
|
item: t,
|
|
1447
1447
|
status: "error",
|
|
1448
1448
|
error: tn(e)
|
|
1449
1449
|
} : n);
|
|
1450
1450
|
}
|
|
1451
1451
|
}, [e]), Y = h(() => {
|
|
1452
|
-
|
|
1452
|
+
Ge.current &&= (clearTimeout(Ge.current.timeoutId), null);
|
|
1453
1453
|
}, []), rt = h((e) => {
|
|
1454
|
-
Y(),
|
|
1454
|
+
Y(), Ge.current = {
|
|
1455
1455
|
path: e,
|
|
1456
1456
|
timeoutId: setTimeout(() => {
|
|
1457
|
-
|
|
1457
|
+
Ge.current?.path === e && (Ge.current = null, D.clearSelection());
|
|
1458
1458
|
}, gt)
|
|
1459
1459
|
};
|
|
1460
1460
|
}, [D, Y]), it = h((e, t) => {
|
|
1461
|
-
let n = Date.now(), r =
|
|
1461
|
+
let n = Date.now(), r = Ke.current, i = r?.path === e && n - r.timeMs <= gt;
|
|
1462
1462
|
if ("detail" in t && t.detail > 1) {
|
|
1463
|
-
i && (Y(),
|
|
1463
|
+
i && (Y(), qe.current = e), Ke.current = {
|
|
1464
1464
|
path: e,
|
|
1465
1465
|
timeMs: n
|
|
1466
1466
|
};
|
|
1467
1467
|
return;
|
|
1468
1468
|
}
|
|
1469
|
-
|
|
1469
|
+
qe.current = null, Ke.current = {
|
|
1470
1470
|
path: e,
|
|
1471
1471
|
timeMs: n
|
|
1472
1472
|
}, qt(D, e, t, {
|
|
@@ -1478,7 +1478,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1478
1478
|
Y,
|
|
1479
1479
|
rt
|
|
1480
1480
|
]), at = h((e) => {
|
|
1481
|
-
|
|
1481
|
+
qe.current === e.path && (qe.current = null, Y(), e.kind === "folder" ? D.open(e) : nt(e));
|
|
1482
1482
|
}, [
|
|
1483
1483
|
D,
|
|
1484
1484
|
Y,
|
|
@@ -1493,18 +1493,18 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1493
1493
|
let r = D.focusedPath ?? D.selectedPaths.at(-1), i = n.findIndex((e) => e.path === r), a = e === "ArrowUp" || e === "ArrowLeft" || e === "End" ? n.length - 1 : 0, o = n[i === -1 ? a : Xt(e, i, n.length)];
|
|
1494
1494
|
t ? D.selectRange(o.path) : D.selectOnly(o.path);
|
|
1495
1495
|
}, [D]), ct = h((e = D.selectedPaths) => {
|
|
1496
|
-
e.length !== 0 && (D.copySelection(e),
|
|
1496
|
+
e.length !== 0 && (D.copySelection(e), Le(`Copied ${an(e.length)}`));
|
|
1497
1497
|
}, [D]), lt = h((e = D.selectedPaths) => {
|
|
1498
|
-
e.length !== 0 && (D.cutSelection(e),
|
|
1498
|
+
e.length !== 0 && (D.cutSelection(e), Le(`Cut ${an(e.length)}`));
|
|
1499
1499
|
}, [D]), ut = h(async (e) => {
|
|
1500
|
-
e.length !== 0 && (await navigator.clipboard.writeText(e.join(", ")),
|
|
1500
|
+
e.length !== 0 && (await navigator.clipboard.writeText(e.join(", ")), Le(e.length === 1 ? "Copied path" : `Copied ${e.length} paths`));
|
|
1501
1501
|
}, []), dt = h(async (e) => {
|
|
1502
1502
|
let t = D.clipboard?.paths.length ?? 0;
|
|
1503
|
-
await D.pasteInto(e), t > 0 &&
|
|
1503
|
+
await D.pasteInto(e), t > 0 && Le(`Pasted ${an(t)}`);
|
|
1504
1504
|
}, [D]);
|
|
1505
1505
|
_(() => {
|
|
1506
1506
|
let e = (e) => {
|
|
1507
|
-
if (e.key === "Escape" && (D.clearSelection(), R(null),
|
|
1507
|
+
if (e.key === "Escape" && (D.clearSelection(), R(null), B(""), V(null), N(null), I(null), j(null), U(!1), ye(!1), xe(null), G(null), K(null), Ve(null)), !nn(e.target)) {
|
|
1508
1508
|
if (Yt(e.key)) {
|
|
1509
1509
|
e.preventDefault(), st(e.key, e.shiftKey);
|
|
1510
1510
|
return;
|
|
@@ -1512,11 +1512,11 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1512
1512
|
if (!m && e.key === "F2" && D.capabilities.rename && D.selectedItems.length === 1) {
|
|
1513
1513
|
e.preventDefault();
|
|
1514
1514
|
let t = D.selectedItems[0];
|
|
1515
|
-
N(null), I(null), R(t),
|
|
1515
|
+
N(null), I(null), R(t), B(t.name), V(null);
|
|
1516
1516
|
return;
|
|
1517
1517
|
}
|
|
1518
1518
|
if (!m && (e.key === "Delete" || e.key === "Backspace") && D.selectedPaths.length > 0) {
|
|
1519
|
-
e.preventDefault(),
|
|
1519
|
+
e.preventDefault(), U(!0);
|
|
1520
1520
|
return;
|
|
1521
1521
|
}
|
|
1522
1522
|
if ((e.metaKey || e.ctrlKey) && !m) {
|
|
@@ -1551,39 +1551,39 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1551
1551
|
dt,
|
|
1552
1552
|
m
|
|
1553
1553
|
]), _(() => {
|
|
1554
|
-
D.focusedPath && (
|
|
1554
|
+
D.focusedPath && (He.current?.querySelector(`[data-fb-path="${Zt(D.focusedPath)}"]`))?.focus();
|
|
1555
1555
|
}, [
|
|
1556
1556
|
D.focusedPath,
|
|
1557
1557
|
D.filteredItems,
|
|
1558
1558
|
D.view
|
|
1559
1559
|
]), _(() => {
|
|
1560
|
-
if (!
|
|
1561
|
-
let e = () =>
|
|
1560
|
+
if (!Ae) return;
|
|
1561
|
+
let e = () => G(null);
|
|
1562
1562
|
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
1563
|
-
}, [
|
|
1564
|
-
if (!
|
|
1565
|
-
let e = setTimeout(() =>
|
|
1563
|
+
}, [Ae]), _(() => {
|
|
1564
|
+
if (!Ie) return;
|
|
1565
|
+
let e = setTimeout(() => Le(null), _t);
|
|
1566
1566
|
return () => clearTimeout(e);
|
|
1567
|
-
}, [
|
|
1568
|
-
for (let e of ie.uploads) e.status !== "completed" || !e.result ||
|
|
1567
|
+
}, [Ie]), _(() => {
|
|
1568
|
+
for (let e of ie.uploads) e.status !== "completed" || !e.result || Je.current.has(e.id) || (Je.current.add(e.id), o(e.result.path) === D.currentPath && D.refresh());
|
|
1569
1569
|
}, [D, ie.uploads]), _(() => {
|
|
1570
|
-
if (!
|
|
1570
|
+
if (!W) return;
|
|
1571
1571
|
let t = !1;
|
|
1572
|
-
return Promise.resolve().then(async () => t ? [] : (
|
|
1572
|
+
return Promise.resolve().then(async () => t ? [] : (De("loading"), ke(null), Tt(e, D.selectedPaths))).then((e) => {
|
|
1573
1573
|
if (t || e.length === 0) {
|
|
1574
|
-
!t && e.length === 0 && (
|
|
1574
|
+
!t && e.length === 0 && (Te([]), De("ready"));
|
|
1575
1575
|
return;
|
|
1576
1576
|
}
|
|
1577
|
-
|
|
1577
|
+
Te(e), De("ready");
|
|
1578
1578
|
}).catch((e) => {
|
|
1579
|
-
t || (
|
|
1579
|
+
t || (Te([]), De("error"), ke(tn(e)));
|
|
1580
1580
|
}), () => {
|
|
1581
1581
|
t = !0;
|
|
1582
1582
|
};
|
|
1583
1583
|
}, [
|
|
1584
1584
|
e,
|
|
1585
1585
|
D.selectedPaths,
|
|
1586
|
-
|
|
1586
|
+
W
|
|
1587
1587
|
]);
|
|
1588
1588
|
async function ft() {
|
|
1589
1589
|
if (ae.trim()) {
|
|
@@ -1596,7 +1596,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1596
1596
|
}
|
|
1597
1597
|
}
|
|
1598
1598
|
function pt(e = D.selectedItems.at(0)) {
|
|
1599
|
-
e && (R(null),
|
|
1599
|
+
e && (R(null), B(""), V(null), N(e), P(e.name), I(null));
|
|
1600
1600
|
}
|
|
1601
1601
|
async function mt() {
|
|
1602
1602
|
let e = se.trim();
|
|
@@ -1610,40 +1610,41 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1610
1610
|
}
|
|
1611
1611
|
}
|
|
1612
1612
|
async function bt() {
|
|
1613
|
-
let e = L, t =
|
|
1614
|
-
if (
|
|
1615
|
-
R(null),
|
|
1613
|
+
let e = L, t = z.trim();
|
|
1614
|
+
if (V(null), !e || !t || t === e.name) {
|
|
1615
|
+
R(null), B("");
|
|
1616
1616
|
return;
|
|
1617
1617
|
}
|
|
1618
1618
|
try {
|
|
1619
|
-
await D.rename(e.path, t), R(null),
|
|
1619
|
+
await D.rename(e.path, t), R(null), B("");
|
|
1620
1620
|
} catch (n) {
|
|
1621
|
-
R(e),
|
|
1621
|
+
R(e), B(t), V(tn(n));
|
|
1622
1622
|
}
|
|
1623
1623
|
}
|
|
1624
1624
|
function Et() {
|
|
1625
|
-
R(null),
|
|
1625
|
+
R(null), B(""), V(null);
|
|
1626
1626
|
}
|
|
1627
1627
|
async function Ot() {
|
|
1628
|
+
U(!1);
|
|
1628
1629
|
try {
|
|
1629
|
-
await D.deleteSelected()
|
|
1630
|
+
await D.deleteSelected();
|
|
1630
1631
|
} catch (e) {
|
|
1631
1632
|
if (e instanceof r) {
|
|
1632
|
-
|
|
1633
|
+
xe(e);
|
|
1633
1634
|
return;
|
|
1634
1635
|
}
|
|
1635
|
-
throw e;
|
|
1636
|
+
throw U(!0), e;
|
|
1636
1637
|
}
|
|
1637
1638
|
}
|
|
1638
1639
|
function At() {
|
|
1639
|
-
D.selectedPaths.length !== 0 && (
|
|
1640
|
+
D.selectedPaths.length !== 0 && (Ce(D.currentPath), ye(!0));
|
|
1640
1641
|
}
|
|
1641
1642
|
async function jt() {
|
|
1642
1643
|
try {
|
|
1643
|
-
await D.moveSelectedTo(
|
|
1644
|
+
await D.moveSelectedTo(Se), ye(!1);
|
|
1644
1645
|
} catch (e) {
|
|
1645
1646
|
if (e instanceof r) {
|
|
1646
|
-
|
|
1647
|
+
ye(!1), xe(e);
|
|
1647
1648
|
return;
|
|
1648
1649
|
}
|
|
1649
1650
|
throw e;
|
|
@@ -1652,19 +1653,19 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1652
1653
|
function Mt(e, t) {
|
|
1653
1654
|
if (m || !D.capabilities.move) return;
|
|
1654
1655
|
let n = D.selectedPaths.includes(e.path) ? D.selectedPaths : [e.path];
|
|
1655
|
-
|
|
1656
|
+
We.current = n, q(!1), Be(null), D.setSelection(n), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(ht, JSON.stringify(n));
|
|
1656
1657
|
}
|
|
1657
1658
|
function Q() {
|
|
1658
|
-
|
|
1659
|
+
We.current = [], q(!1), Be(null);
|
|
1659
1660
|
}
|
|
1660
1661
|
function Rt(e) {
|
|
1661
1662
|
let t = Qt(e);
|
|
1662
|
-
return t.length > 0 ? t :
|
|
1663
|
+
return t.length > 0 ? t : We.current;
|
|
1663
1664
|
}
|
|
1664
1665
|
function Vt(e, t) {
|
|
1665
1666
|
if (m || !D.capabilities.move || e.kind !== "folder") return;
|
|
1666
1667
|
let n = Rt(t.dataTransfer);
|
|
1667
|
-
n.length === 0 || n.some((t) => e.path === t || e.path.startsWith(`${t}/`)) || (t.preventDefault(), t.stopPropagation(), t.dataTransfer.dropEffect = "move",
|
|
1668
|
+
n.length === 0 || n.some((t) => e.path === t || e.path.startsWith(`${t}/`)) || (t.preventDefault(), t.stopPropagation(), t.dataTransfer.dropEffect = "move", q(!1), Be(e.path));
|
|
1668
1669
|
}
|
|
1669
1670
|
async function en(e, t) {
|
|
1670
1671
|
if (m || !D.capabilities.move || e.kind !== "folder") return;
|
|
@@ -1675,7 +1676,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1675
1676
|
await D.movePathsTo(n, e.path);
|
|
1676
1677
|
} catch (e) {
|
|
1677
1678
|
if (e instanceof r) {
|
|
1678
|
-
|
|
1679
|
+
xe(e);
|
|
1679
1680
|
return;
|
|
1680
1681
|
}
|
|
1681
1682
|
throw e;
|
|
@@ -1683,7 +1684,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1683
1684
|
}
|
|
1684
1685
|
}
|
|
1685
1686
|
function rn(e, t) {
|
|
1686
|
-
t.preventDefault(), t.stopPropagation(), D.selectedPaths.includes(e.path) || D.selectOnly(e.path),
|
|
1687
|
+
t.preventDefault(), t.stopPropagation(), D.selectedPaths.includes(e.path) || D.selectOnly(e.path), G({
|
|
1687
1688
|
target: "item",
|
|
1688
1689
|
item: e,
|
|
1689
1690
|
x: t.clientX,
|
|
@@ -1692,7 +1693,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1692
1693
|
});
|
|
1693
1694
|
}
|
|
1694
1695
|
function sn(e) {
|
|
1695
|
-
D.selectedPaths.includes(e.path) || D.selectOnly(e.path),
|
|
1696
|
+
D.selectedPaths.includes(e.path) || D.selectOnly(e.path), G({
|
|
1696
1697
|
target: "item",
|
|
1697
1698
|
item: e,
|
|
1698
1699
|
x: 0,
|
|
@@ -1701,7 +1702,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1701
1702
|
});
|
|
1702
1703
|
}
|
|
1703
1704
|
function mn(e) {
|
|
1704
|
-
e.preventDefault(), D.clearSelection(),
|
|
1705
|
+
e.preventDefault(), D.clearSelection(), G({
|
|
1705
1706
|
target: "empty",
|
|
1706
1707
|
x: e.clientX,
|
|
1707
1708
|
y: e.clientY,
|
|
@@ -1712,8 +1713,8 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1712
1713
|
e.target !== e.currentTarget || Jt(e) || D.clearSelection();
|
|
1713
1714
|
}
|
|
1714
1715
|
function gn(e) {
|
|
1715
|
-
if (!
|
|
1716
|
-
let t = tt.findIndex((e) => e.path ===
|
|
1716
|
+
if (!J || tt.length === 0) return;
|
|
1717
|
+
let t = tt.findIndex((e) => e.path === J.item.path), n = ((t >= 0 ? t : 0) + e + tt.length) % tt.length, r = tt[n];
|
|
1717
1718
|
nt(r), D.selectOnly(r.path);
|
|
1718
1719
|
}
|
|
1719
1720
|
async function _n() {
|
|
@@ -1746,18 +1747,18 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1746
1747
|
});
|
|
1747
1748
|
}
|
|
1748
1749
|
async function bn(e) {
|
|
1749
|
-
!e || e.length === 0 || (await xn(e),
|
|
1750
|
+
!e || e.length === 0 || (await xn(e), Ue.current && (Ue.current.value = ""));
|
|
1750
1751
|
}
|
|
1751
1752
|
async function xn(e) {
|
|
1752
|
-
await Cn(
|
|
1753
|
+
await Cn(ve(e));
|
|
1753
1754
|
}
|
|
1754
1755
|
async function Sn(e) {
|
|
1755
|
-
await Cn(await
|
|
1756
|
+
await Cn(await _e(e));
|
|
1756
1757
|
}
|
|
1757
1758
|
async function Cn(e) {
|
|
1758
1759
|
if (e.length === 0) return;
|
|
1759
1760
|
if (x?.maxFilesPerBatch !== void 0 && e.length > x.maxFilesPerBatch) {
|
|
1760
|
-
|
|
1761
|
+
Ne(e.map((t) => ({
|
|
1761
1762
|
fileName: t.file.name,
|
|
1762
1763
|
relativePath: t.relativePath,
|
|
1763
1764
|
reasons: [`Batch contains ${e.length} files; maximum is ${x.maxFilesPerBatch}`]
|
|
@@ -1765,13 +1766,13 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1765
1766
|
return;
|
|
1766
1767
|
}
|
|
1767
1768
|
let { acceptedCandidates: t, rejectedCandidates: n } = Dt(e, x, D.currentPath);
|
|
1768
|
-
if (n.length > 0 &&
|
|
1769
|
+
if (n.length > 0 && Ne(n), t.length === 0) return;
|
|
1769
1770
|
let r = wn(t);
|
|
1770
1771
|
if (r.length === 0) return;
|
|
1771
1772
|
let i = await Tn(r), a = await En(r);
|
|
1772
1773
|
if (a.length > 0 && Qe.length === 0) {
|
|
1773
1774
|
let e = new Set(a), t = r.filter((t) => !e.has(xt(D.currentPath, t.relativePath))), n = r.filter((t) => e.has(xt(D.currentPath, t.relativePath)));
|
|
1774
|
-
|
|
1775
|
+
Ne((e) => [...e, ...n.map((e) => ({
|
|
1775
1776
|
fileName: e.file.name,
|
|
1776
1777
|
relativePath: e.relativePath,
|
|
1777
1778
|
reasons: ["No upload conflict resolutions are enabled"]
|
|
@@ -1783,7 +1784,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1783
1784
|
function wn(e) {
|
|
1784
1785
|
if (D.capabilities.createFolder) return e;
|
|
1785
1786
|
let [t, n] = Ct(e, (e) => e.relativePath.includes("/"));
|
|
1786
|
-
return t.length > 0 &&
|
|
1787
|
+
return t.length > 0 && Ne((e) => [...e, ...t.map((e) => ({
|
|
1787
1788
|
fileName: e.file.name,
|
|
1788
1789
|
relativePath: e.relativePath,
|
|
1789
1790
|
reasons: ["Folder uploads require folder creation support"]
|
|
@@ -1828,23 +1829,23 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1828
1829
|
let n = e[o], s = xt(D.currentPath, n.relativePath);
|
|
1829
1830
|
if (a.has(s)) {
|
|
1830
1831
|
if (!r) {
|
|
1831
|
-
|
|
1832
|
+
K({
|
|
1832
1833
|
candidates: e,
|
|
1833
1834
|
conflictPaths: t,
|
|
1834
1835
|
group: i,
|
|
1835
1836
|
index: o
|
|
1836
|
-
}),
|
|
1837
|
+
}), Fe(!1);
|
|
1837
1838
|
return;
|
|
1838
1839
|
}
|
|
1839
1840
|
r !== "skip" && An(n, r, i);
|
|
1840
1841
|
} else An(n, void 0, i);
|
|
1841
1842
|
}
|
|
1842
|
-
|
|
1843
|
+
K(null), Fe(!1);
|
|
1843
1844
|
}
|
|
1844
1845
|
function kn(e) {
|
|
1845
|
-
if (!
|
|
1846
|
-
let { candidates: t, conflictPaths: n, group: r, index: i } =
|
|
1847
|
-
if (
|
|
1846
|
+
if (!je || !Qe.includes(e)) return;
|
|
1847
|
+
let { candidates: t, conflictPaths: n, group: r, index: i } = je;
|
|
1848
|
+
if (Pe) {
|
|
1848
1849
|
On(t, n, i, e, r);
|
|
1849
1850
|
return;
|
|
1850
1851
|
}
|
|
@@ -1863,21 +1864,21 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1863
1864
|
return /* @__PURE__ */ E("section", {
|
|
1864
1865
|
className: `flex min-h-[520px] w-full overflow-hidden rounded-[var(--fb-radius)] border border-[var(--fb-border)] bg-[var(--fb-surface)] font-[inherit] text-[length:var(--fb-font)] text-[var(--fb-text)] ${Z}${n ? ` ${n}` : ""}`,
|
|
1865
1866
|
"data-fb-density": p,
|
|
1866
|
-
ref:
|
|
1867
|
+
ref: He,
|
|
1867
1868
|
style: yt[p],
|
|
1868
1869
|
onDragEnter: (e) => {
|
|
1869
1870
|
if (Rt(e.dataTransfer).length > 0) {
|
|
1870
|
-
|
|
1871
|
+
q(!1);
|
|
1871
1872
|
return;
|
|
1872
1873
|
}
|
|
1873
|
-
e.preventDefault(), m ||
|
|
1874
|
+
e.preventDefault(), m || q(!0);
|
|
1874
1875
|
},
|
|
1875
1876
|
onDragLeave: (e) => {
|
|
1876
|
-
e.currentTarget === e.target && (
|
|
1877
|
+
e.currentTarget === e.target && (q(!1), Be(null));
|
|
1877
1878
|
},
|
|
1878
1879
|
onDragOver: (e) => {
|
|
1879
1880
|
if (Rt(e.dataTransfer).length > 0) {
|
|
1880
|
-
|
|
1881
|
+
q(!1), Be(null);
|
|
1881
1882
|
return;
|
|
1882
1883
|
}
|
|
1883
1884
|
e.preventDefault();
|
|
@@ -1887,7 +1888,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1887
1888
|
Q();
|
|
1888
1889
|
return;
|
|
1889
1890
|
}
|
|
1890
|
-
|
|
1891
|
+
q(!1), !m && Sn(e.dataTransfer);
|
|
1891
1892
|
},
|
|
1892
1893
|
onPaste: (e) => {
|
|
1893
1894
|
if (m) return;
|
|
@@ -1919,18 +1920,18 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
1919
1920
|
path: D.currentPath,
|
|
1920
1921
|
rootLabel: l
|
|
1921
1922
|
}),
|
|
1922
|
-
|
|
1923
|
+
Ie ? /* @__PURE__ */ T("span", {
|
|
1923
1924
|
"aria-label": "Clipboard status",
|
|
1924
1925
|
className: `rounded-[calc(var(--fb-radius)-4px)] bg-[var(--fb-accent-soft)] px-2 py-1 text-[12px] font-medium text-[var(--fb-accent)] ${X}`,
|
|
1925
1926
|
role: "status",
|
|
1926
|
-
children:
|
|
1927
|
+
children: Ie
|
|
1927
1928
|
}) : null,
|
|
1928
1929
|
/* @__PURE__ */ E("div", {
|
|
1929
1930
|
className: "ml-auto flex min-w-0 items-center gap-1.5",
|
|
1930
1931
|
children: [
|
|
1931
1932
|
/* @__PURE__ */ E("label", {
|
|
1932
1933
|
className: "relative block min-w-[140px] max-w-[220px]",
|
|
1933
|
-
children: [/* @__PURE__ */ T(
|
|
1934
|
+
children: [/* @__PURE__ */ T(he, {
|
|
1934
1935
|
"aria-hidden": "true",
|
|
1935
1936
|
className: "pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-[var(--fb-muted)]"
|
|
1936
1937
|
}), /* @__PURE__ */ T("input", {
|
|
@@ -2021,18 +2022,19 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2021
2022
|
}), "New folder"]
|
|
2022
2023
|
}) : null,
|
|
2023
2024
|
/* @__PURE__ */ T("input", {
|
|
2025
|
+
accept: x?.allowedMimeTypes?.length ? x.allowedMimeTypes.join(",") : void 0,
|
|
2024
2026
|
"aria-label": "Upload files",
|
|
2025
2027
|
multiple: !0,
|
|
2026
2028
|
onChange: (e) => void bn(e.target.files),
|
|
2027
|
-
ref:
|
|
2029
|
+
ref: Ue,
|
|
2028
2030
|
type: "file",
|
|
2029
2031
|
className: "hidden"
|
|
2030
2032
|
}),
|
|
2031
2033
|
m ? null : /* @__PURE__ */ E("button", {
|
|
2032
2034
|
className: dn(),
|
|
2033
|
-
onClick: () =>
|
|
2035
|
+
onClick: () => Ue.current?.click(),
|
|
2034
2036
|
type: "button",
|
|
2035
|
-
children: [/* @__PURE__ */ T(
|
|
2037
|
+
children: [/* @__PURE__ */ T(ge, {
|
|
2036
2038
|
"aria-hidden": "true",
|
|
2037
2039
|
className: "size-4"
|
|
2038
2040
|
}), "Upload"]
|
|
@@ -2051,7 +2053,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2051
2053
|
itemCount: D.filteredItems.length,
|
|
2052
2054
|
onCopy: () => ct(),
|
|
2053
2055
|
onCut: () => lt(),
|
|
2054
|
-
onDelete: () =>
|
|
2056
|
+
onDelete: () => U(!0),
|
|
2055
2057
|
onDownload: () => void _n(),
|
|
2056
2058
|
onMove: At,
|
|
2057
2059
|
onRename: pt,
|
|
@@ -2059,9 +2061,9 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2059
2061
|
onSelectNone: D.clearSelection,
|
|
2060
2062
|
selectedCount: D.selectedPaths.length
|
|
2061
2063
|
}),
|
|
2062
|
-
|
|
2063
|
-
onDismiss: () =>
|
|
2064
|
-
rejections:
|
|
2064
|
+
Me.length > 0 ? /* @__PURE__ */ T(Kt, {
|
|
2065
|
+
onDismiss: () => Ne([]),
|
|
2066
|
+
rejections: Me
|
|
2065
2067
|
}) : null,
|
|
2066
2068
|
/* @__PURE__ */ E("div", {
|
|
2067
2069
|
className: `relative min-h-0 flex-1 overflow-auto bg-[var(--fb-bg)] p-[var(--fb-pad)] ${Z}`,
|
|
@@ -2077,11 +2079,11 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2077
2079
|
}) : D.view === "grid" ? /* @__PURE__ */ T(kt, {
|
|
2078
2080
|
browser: D,
|
|
2079
2081
|
canMove: !m && D.capabilities.move,
|
|
2080
|
-
folderDropTargetPath:
|
|
2081
|
-
inlineRenameError:
|
|
2082
|
+
folderDropTargetPath: ze,
|
|
2083
|
+
inlineRenameError: me,
|
|
2082
2084
|
inlineRenameLabel: L?.name ?? "",
|
|
2083
2085
|
inlineRenameItem: L,
|
|
2084
|
-
inlineRenameValue:
|
|
2086
|
+
inlineRenameValue: z,
|
|
2085
2087
|
onDragStart: Mt,
|
|
2086
2088
|
onDragEnd: Q,
|
|
2087
2089
|
onFolderDragOver: Vt,
|
|
@@ -2089,7 +2091,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2089
2091
|
onEmptyClick: () => D.clearSelection(),
|
|
2090
2092
|
onInlineRenameCancel: Et,
|
|
2091
2093
|
onInlineRenameChange: (e) => {
|
|
2092
|
-
|
|
2094
|
+
B(e), V(null);
|
|
2093
2095
|
},
|
|
2094
2096
|
onInlineRenameCommit: () => void bt(),
|
|
2095
2097
|
onContextMenu: rn,
|
|
@@ -2102,18 +2104,18 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2102
2104
|
}) : /* @__PURE__ */ T(Nt, {
|
|
2103
2105
|
browser: D,
|
|
2104
2106
|
canMove: !m && D.capabilities.move,
|
|
2105
|
-
folderDropTargetPath:
|
|
2106
|
-
inlineRenameError:
|
|
2107
|
+
folderDropTargetPath: ze,
|
|
2108
|
+
inlineRenameError: me,
|
|
2107
2109
|
inlineRenameLabel: L?.name ?? "",
|
|
2108
2110
|
inlineRenameItem: L,
|
|
2109
|
-
inlineRenameValue:
|
|
2111
|
+
inlineRenameValue: z,
|
|
2110
2112
|
onDragStart: Mt,
|
|
2111
2113
|
onDragEnd: Q,
|
|
2112
2114
|
onFolderDragOver: Vt,
|
|
2113
2115
|
onFolderDrop: (e, t) => void en(e, t),
|
|
2114
2116
|
onInlineRenameCancel: Et,
|
|
2115
2117
|
onInlineRenameChange: (e) => {
|
|
2116
|
-
|
|
2118
|
+
B(e), V(null);
|
|
2117
2119
|
},
|
|
2118
2120
|
onInlineRenameCommit: () => void bt(),
|
|
2119
2121
|
onContextMenu: rn,
|
|
@@ -2122,7 +2124,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2122
2124
|
renderItemMeta: w,
|
|
2123
2125
|
rootLabel: l,
|
|
2124
2126
|
selectedPaths: D.selectedPaths
|
|
2125
|
-
}),
|
|
2127
|
+
}), Re ? /* @__PURE__ */ T("div", {
|
|
2126
2128
|
className: `pointer-events-none absolute inset-3 z-10 grid place-items-center rounded-[var(--fb-radius)] border-2 border-dashed border-[var(--fb-accent)] bg-[var(--fb-accent-soft)] text-[13px] font-semibold text-[var(--fb-accent)] ${Z}`,
|
|
2127
2129
|
children: "Drop files to upload"
|
|
2128
2130
|
}) : null]
|
|
@@ -2151,12 +2153,12 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2151
2153
|
selectedCount: D.selectedItems.length,
|
|
2152
2154
|
totalBytes: ot
|
|
2153
2155
|
}) : null,
|
|
2154
|
-
|
|
2156
|
+
Ae ? /* @__PURE__ */ T(Pt, {
|
|
2155
2157
|
browser: D,
|
|
2156
2158
|
canDownload: et,
|
|
2157
|
-
menu:
|
|
2158
|
-
onClose: () =>
|
|
2159
|
-
onDelete: () =>
|
|
2159
|
+
menu: Ae,
|
|
2160
|
+
onClose: () => G(null),
|
|
2161
|
+
onDelete: () => U(!0),
|
|
2160
2162
|
onDownload: () => void _n(),
|
|
2161
2163
|
onMove: At,
|
|
2162
2164
|
onNewFolder: () => {
|
|
@@ -2167,7 +2169,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2167
2169
|
onCut: () => lt(),
|
|
2168
2170
|
onPaste: () => void dt(D.currentPath),
|
|
2169
2171
|
onRename: pt,
|
|
2170
|
-
onUpload: () =>
|
|
2172
|
+
onUpload: () => Ue.current?.click(),
|
|
2171
2173
|
readOnly: m
|
|
2172
2174
|
}) : null,
|
|
2173
2175
|
O ? /* @__PURE__ */ T("div", {
|
|
@@ -2270,7 +2272,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2270
2272
|
]
|
|
2271
2273
|
})
|
|
2272
2274
|
}) : null,
|
|
2273
|
-
|
|
2275
|
+
H ? /* @__PURE__ */ T("div", {
|
|
2274
2276
|
"aria-label": "Delete selected items",
|
|
2275
2277
|
"aria-modal": "true",
|
|
2276
2278
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 ${Z}`,
|
|
@@ -2300,7 +2302,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2300
2302
|
className: "mt-4 flex justify-end gap-2",
|
|
2301
2303
|
children: [/* @__PURE__ */ T("button", {
|
|
2302
2304
|
className: $(!1),
|
|
2303
|
-
onClick: () =>
|
|
2305
|
+
onClick: () => U(!1),
|
|
2304
2306
|
type: "button",
|
|
2305
2307
|
children: "Cancel"
|
|
2306
2308
|
}), /* @__PURE__ */ T("button", {
|
|
@@ -2312,7 +2314,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2312
2314
|
]
|
|
2313
2315
|
})
|
|
2314
2316
|
}) : null,
|
|
2315
|
-
|
|
2317
|
+
W ? /* @__PURE__ */ T("div", {
|
|
2316
2318
|
"aria-label": "Move selected items",
|
|
2317
2319
|
"aria-modal": "true",
|
|
2318
2320
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_20%,transparent)] p-4 ${Z}`,
|
|
@@ -2333,22 +2335,22 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2333
2335
|
}),
|
|
2334
2336
|
/* @__PURE__ */ T(Lt, {
|
|
2335
2337
|
currentPath: D.currentPath,
|
|
2336
|
-
destinations:
|
|
2337
|
-
error:
|
|
2338
|
-
onSelect:
|
|
2338
|
+
destinations: we,
|
|
2339
|
+
error: Oe,
|
|
2340
|
+
onSelect: Ce,
|
|
2339
2341
|
rootLabel: l,
|
|
2340
|
-
selectedPath:
|
|
2341
|
-
status:
|
|
2342
|
+
selectedPath: Se,
|
|
2343
|
+
status: Ee
|
|
2342
2344
|
}),
|
|
2343
2345
|
/* @__PURE__ */ E("div", {
|
|
2344
2346
|
className: "mt-3 truncate text-[11px] text-[var(--fb-muted)]",
|
|
2345
|
-
children: ["Destination: ",
|
|
2347
|
+
children: ["Destination: ", Se]
|
|
2346
2348
|
}),
|
|
2347
2349
|
/* @__PURE__ */ E("div", {
|
|
2348
2350
|
className: "mt-4 flex justify-end gap-2",
|
|
2349
2351
|
children: [/* @__PURE__ */ T("button", {
|
|
2350
2352
|
className: $(!1),
|
|
2351
|
-
onClick: () =>
|
|
2353
|
+
onClick: () => ye(!1),
|
|
2352
2354
|
type: "button",
|
|
2353
2355
|
children: "Cancel"
|
|
2354
2356
|
}), /* @__PURE__ */ T("button", {
|
|
@@ -2360,23 +2362,23 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2360
2362
|
]
|
|
2361
2363
|
})
|
|
2362
2364
|
}) : null,
|
|
2363
|
-
|
|
2364
|
-
error:
|
|
2365
|
-
onClose: () =>
|
|
2365
|
+
be ? /* @__PURE__ */ T(It, {
|
|
2366
|
+
error: be,
|
|
2367
|
+
onClose: () => xe(null)
|
|
2366
2368
|
}) : null,
|
|
2367
|
-
|
|
2368
|
-
applyToAll:
|
|
2369
|
+
je ? /* @__PURE__ */ T(Ft, {
|
|
2370
|
+
applyToAll: Pe,
|
|
2369
2371
|
currentPath: D.currentPath,
|
|
2370
|
-
onApplyToAllChange:
|
|
2372
|
+
onApplyToAllChange: Fe,
|
|
2371
2373
|
onCancel: () => {
|
|
2372
|
-
|
|
2374
|
+
K(null), Fe(!1);
|
|
2373
2375
|
},
|
|
2374
2376
|
onResolve: (e) => kn(e),
|
|
2375
|
-
queue:
|
|
2377
|
+
queue: je,
|
|
2376
2378
|
resolutions: Qe
|
|
2377
2379
|
}) : null,
|
|
2378
|
-
|
|
2379
|
-
"aria-label": `Preview ${
|
|
2380
|
+
J ? /* @__PURE__ */ T("div", {
|
|
2381
|
+
"aria-label": `Preview ${J.item.name}`,
|
|
2380
2382
|
"aria-modal": "true",
|
|
2381
2383
|
className: `fixed inset-0 z-40 grid place-items-center bg-[color-mix(in_oklch,var(--fb-text)_35%,transparent)] p-4 ${Z}`,
|
|
2382
2384
|
role: "dialog",
|
|
@@ -2386,7 +2388,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2386
2388
|
className: `flex h-12 items-center justify-between border-b border-[var(--fb-border)] px-4 ${Z}`,
|
|
2387
2389
|
children: [/* @__PURE__ */ E("div", {
|
|
2388
2390
|
className: "min-w-0 truncate font-semibold",
|
|
2389
|
-
children: ["Preview ",
|
|
2391
|
+
children: ["Preview ", J.item.name]
|
|
2390
2392
|
}), /* @__PURE__ */ E("div", {
|
|
2391
2393
|
className: "flex items-center gap-1",
|
|
2392
2394
|
children: [
|
|
@@ -2414,7 +2416,7 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2414
2416
|
}),
|
|
2415
2417
|
/* @__PURE__ */ T("button", {
|
|
2416
2418
|
className: un(!1),
|
|
2417
|
-
onClick: () =>
|
|
2419
|
+
onClick: () => Ve(null),
|
|
2418
2420
|
type: "button",
|
|
2419
2421
|
children: "Close"
|
|
2420
2422
|
})
|
|
@@ -2422,34 +2424,34 @@ function bt({ adapter: e, className: n, emptyState: i, initialPath: a = "/", pat
|
|
|
2422
2424
|
})]
|
|
2423
2425
|
}), /* @__PURE__ */ T("div", {
|
|
2424
2426
|
className: `grid min-h-[260px] place-items-center bg-[var(--fb-bg)] p-8 ${Z}`,
|
|
2425
|
-
children:
|
|
2427
|
+
children: J.item.mimeType?.startsWith("image/") && J.url || J.item.thumbnailUrl ? /* @__PURE__ */ E("div", {
|
|
2426
2428
|
className: "text-center",
|
|
2427
2429
|
children: [/* @__PURE__ */ T("img", {
|
|
2428
|
-
alt:
|
|
2430
|
+
alt: J.item.name,
|
|
2429
2431
|
className: `max-h-[420px] max-w-full rounded-[calc(var(--fb-radius)-2px)] object-contain ${Z}`,
|
|
2430
|
-
src:
|
|
2431
|
-
}), /* @__PURE__ */ T(Ut, { preview:
|
|
2432
|
+
src: J.url ?? J.item.thumbnailUrl
|
|
2433
|
+
}), /* @__PURE__ */ T(Ut, { preview: J })]
|
|
2432
2434
|
}) : /* @__PURE__ */ E("div", {
|
|
2433
2435
|
className: "text-center",
|
|
2434
2436
|
children: [
|
|
2435
2437
|
/* @__PURE__ */ T(ue, { className: "mx-auto size-12 text-[var(--fb-muted)]" }),
|
|
2436
2438
|
/* @__PURE__ */ T("div", {
|
|
2437
2439
|
className: "mt-3 font-semibold",
|
|
2438
|
-
children:
|
|
2440
|
+
children: J.item.name
|
|
2439
2441
|
}),
|
|
2440
2442
|
/* @__PURE__ */ T("div", {
|
|
2441
2443
|
className: "mt-1 text-[12px] text-[var(--fb-muted)]",
|
|
2442
|
-
children:
|
|
2444
|
+
children: J.item.mimeType ?? "File"
|
|
2443
2445
|
}),
|
|
2444
|
-
|
|
2446
|
+
J.status === "loading" ? /* @__PURE__ */ T("div", {
|
|
2445
2447
|
className: "mt-3 text-[12px] text-[var(--fb-muted)]",
|
|
2446
2448
|
children: "Loading preview"
|
|
2447
2449
|
}) : null,
|
|
2448
|
-
|
|
2450
|
+
J.status === "error" ? /* @__PURE__ */ T("div", {
|
|
2449
2451
|
className: "mt-3 text-[12px] text-[var(--fb-danger)]",
|
|
2450
|
-
children:
|
|
2452
|
+
children: J.error ?? "Could not load preview"
|
|
2451
2453
|
}) : null,
|
|
2452
|
-
/* @__PURE__ */ T(Ut, { preview:
|
|
2454
|
+
/* @__PURE__ */ T(Ut, { preview: J })
|
|
2453
2455
|
]
|
|
2454
2456
|
})
|
|
2455
2457
|
})]
|
|
@@ -3008,20 +3010,20 @@ function zt({ selectedCount: e, itemCount: t, canRename: n, canMove: r, canCopy:
|
|
|
3008
3010
|
disabled: t === 0,
|
|
3009
3011
|
onClick: m,
|
|
3010
3012
|
type: "button",
|
|
3011
|
-
children: [/* @__PURE__ */ T(
|
|
3013
|
+
children: [/* @__PURE__ */ T(V, { className: "size-4" }), "Select all"]
|
|
3012
3014
|
}),
|
|
3013
3015
|
/* @__PURE__ */ E("button", {
|
|
3014
3016
|
className: $(!1),
|
|
3015
3017
|
disabled: !g,
|
|
3016
3018
|
onClick: h,
|
|
3017
3019
|
type: "button",
|
|
3018
|
-
children: [/* @__PURE__ */ T(
|
|
3020
|
+
children: [/* @__PURE__ */ T(W, { className: "size-4" }), "Select none"]
|
|
3019
3021
|
}),
|
|
3020
3022
|
g && n && e === 1 ? /* @__PURE__ */ E("button", {
|
|
3021
3023
|
className: $(!1),
|
|
3022
3024
|
onClick: () => c(),
|
|
3023
3025
|
type: "button",
|
|
3024
|
-
children: [/* @__PURE__ */ T(
|
|
3026
|
+
children: [/* @__PURE__ */ T(z, { className: "size-4" }), "Rename"]
|
|
3025
3027
|
}) : null,
|
|
3026
3028
|
g && r ? /* @__PURE__ */ E("button", {
|
|
3027
3029
|
className: $(!1),
|
|
@@ -3039,7 +3041,7 @@ function zt({ selectedCount: e, itemCount: t, canRename: n, canMove: r, canCopy:
|
|
|
3039
3041
|
className: $(!1),
|
|
3040
3042
|
onClick: d,
|
|
3041
3043
|
type: "button",
|
|
3042
|
-
children: [/* @__PURE__ */ T(
|
|
3044
|
+
children: [/* @__PURE__ */ T(me, { className: "size-4" }), "Cut"]
|
|
3043
3045
|
}) : null,
|
|
3044
3046
|
g && s ? /* @__PURE__ */ E("button", {
|
|
3045
3047
|
className: $(!1),
|
|
@@ -3051,7 +3053,7 @@ function zt({ selectedCount: e, itemCount: t, canRename: n, canMove: r, canCopy:
|
|
|
3051
3053
|
className: fn(),
|
|
3052
3054
|
onClick: f,
|
|
3053
3055
|
type: "button",
|
|
3054
|
-
children: [/* @__PURE__ */ T(
|
|
3056
|
+
children: [/* @__PURE__ */ T(U, { className: "size-4" }), "Delete"]
|
|
3055
3057
|
}) : null
|
|
3056
3058
|
]
|
|
3057
3059
|
});
|
|
@@ -3121,7 +3123,7 @@ function Ht({ canDownload: e, item: t, onCopyPath: n, onDownload: r, renderDetai
|
|
|
3121
3123
|
className: "flex min-h-full flex-1 flex-col items-center justify-center text-center",
|
|
3122
3124
|
children: [/* @__PURE__ */ T("div", {
|
|
3123
3125
|
className: `grid h-28 w-full place-items-center rounded-[var(--fb-radius)] bg-[var(--fb-bg)] ${Z}`,
|
|
3124
|
-
children: /* @__PURE__ */ T(
|
|
3126
|
+
children: /* @__PURE__ */ T(H, { className: "size-12 text-[var(--fb-muted)]" })
|
|
3125
3127
|
}), /* @__PURE__ */ T("h2", {
|
|
3126
3128
|
className: "mt-4 text-[14px] font-semibold",
|
|
3127
3129
|
children: "No item selected"
|
|
@@ -3387,6 +3389,6 @@ function pn() {
|
|
|
3387
3389
|
return `h-[var(--fb-control-h)] rounded-[calc(var(--fb-radius)-3px)] border border-[var(--fb-border)] bg-[var(--fb-surface)] px-2 text-[12px] font-medium text-[var(--fb-text)] outline-none focus:border-[var(--fb-accent)] focus:ring-2 focus:ring-[var(--fb-accent-soft)] ${X}`;
|
|
3388
3390
|
}
|
|
3389
3391
|
//#endregion
|
|
3390
|
-
export { l as FILE_BROWSER_THEME_CONTRACT, bt as FileBrowser, t as FileBrowserAdapterError, r as FileBrowserBulkActionError, Ye as FileBrowserProvider, c as ROOT_PATH,
|
|
3392
|
+
export { l as FILE_BROWSER_THEME_CONTRACT, bt as FileBrowser, t as FileBrowserAdapterError, r as FileBrowserBulkActionError, Ye as FileBrowserProvider, c as ROOT_PATH, De as TransferManager, i as getFileBrowserBasename, u as getFileBrowserDensityAttributes, o as getFileBrowserDirname, n as isFileBrowserDescendantOrSelf, e as joinFileBrowserPath, a as normalizeFileBrowserPath, s as replaceFileBrowserPathPrefix, ee as useFileBrowser, Ze as useTransferSnapshot, Xe as useTransfers };
|
|
3391
3393
|
|
|
3392
3394
|
//# sourceMappingURL=index.js.map
|