@epam/ai-dial-chat-hooks 1.1.0-dev.413 → 1.1.0-dev.418
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/catalog.js +1 -1
- package/file-manager.d.ts +7 -3
- package/file-manager.js +1 -1
- package/index.d.ts +7 -3
- package/index.js +2 -2
- package/package.json +15 -15
- package/{useDialFileManagerTabConfig-CljXkfhP.js → useDialFileManagerTabConfig-CjI46lMo.js} +534 -532
- package/{useSkillFilePreview-DM3YnKr4.js → useSkillFilePreview-B5o1n_0F.js} +255 -255
|
@@ -3,76 +3,76 @@ import { r as t } from "./api-error-DuLNy43N.js";
|
|
|
3
3
|
import { n } from "./string-utils-iBi2Y55C.js";
|
|
4
4
|
import { AttachmentContentType as r, AttachmentErrorType as i, getOoxmlMimeType as a, isHtmlPreviewable as o, isOoxmlPreviewable as s, isTextPreviewable as c } from "@epam/ai-dial-attachment-canvas";
|
|
5
5
|
import { AttachmentType as l, DialFileManagerActionProfile as u, DialFileManagerVariant as d, FileExtension as f, FileUploadStatus as p, HIDDEN_FILE as m, MIMEType as h, RequestStatus as g, base64ToBlob as _, getParentFolderPath as v, getUtf8ByteLength as y, messageAttachmentToDisplayAttachment as b, stripUrlQueryAndFragment as x, triggerAnchorDownload as S, truncateToUtf8Bytes as C, tryBase64ToBytes as w } from "@epam/ai-dial-chat-shared";
|
|
6
|
-
import { annotationHighlightId as T, annotationsToPdfHighlights as
|
|
7
|
-
import { useCallback as
|
|
8
|
-
import { ArchiveItemDtoNodeTypeEnum as
|
|
9
|
-
import { DialFileNodeType as
|
|
10
|
-
import { DialFileManagerActions as
|
|
6
|
+
import { annotationHighlightId as T, annotationsToPdfHighlights as E, getAnnotationPdfPage as D, parsePdfPageReference as O } from "@epam/ai-dial-quotations";
|
|
7
|
+
import { useCallback as k, useEffect as A, useMemo as j, useRef as M, useState as N } from "react";
|
|
8
|
+
import { ArchiveItemDtoNodeTypeEnum as P, CopyItemDtoNodeTypeEnum as F, DeleteItemDtoNodeTypeEnum as I, ListFilesItemDtoNodeTypeEnum as ee, MoveItemDtoNodeTypeEnum as L, RenameItemDtoNodeTypeEnum as R } from "@epam/ai-dial-chat-api-client";
|
|
9
|
+
import { DialFileNodeType as te, NOT_ALLOWED_SYMBOLS as ne, NOT_ALLOWED_SYMBOLS_REGEXP as z, NotificationVariant as B } from "@epam/ai-dial-ui-kit";
|
|
10
|
+
import { DialFileManagerActions as V, DialFileManagerTabs as H, DialFileNodeType as U, DialFilePermission as W, FileManagerColumnKey as G } from "@epam/ai-dial-react-file-manager";
|
|
11
11
|
//#region src/files/dial-files-api.ts
|
|
12
12
|
var re = /* @__PURE__ */ function(e) {
|
|
13
13
|
return e.Overwrite = "overwrite", e.CreateOnly = "create-only", e;
|
|
14
|
-
}({}), G = /* @__PURE__ */ function(e) {
|
|
15
|
-
return e.FolderLoadFailed = "folderLoadFailed", e.MetadataLoadFailed = "metadataLoadFailed", e.FolderCreateFailed = "folderCreateFailed", e.DownloadFileFailed = "downloadFileFailed", e.DownloadFilesFailed = "downloadFilesFailed", e.FilesDeleted = "filesDeleted", e.FilesDeletePartiallyFailed = "filesDeletePartiallyFailed", e.DeleteFailed = "deleteFailed", e.RenameFailed = "renameFailed", e.RenamePartiallyFailed = "renamePartiallyFailed", e.MoveFailed = "moveFailed", e.MovePartiallyFailed = "movePartiallyFailed", e.CopyFailed = "copyFailed", e.CopyPartiallyFailed = "copyPartiallyFailed", e.UnshareFailed = "unshareFailed", e.RemoveAccessFailed = "removeAccessFailed", e.UploadFailed = "uploadFailed", e.UploadCompleted = "uploadCompleted", e.UploadArchiveFailed = "uploadArchiveFailed", e.UploadArchivePartiallyFailed = "uploadArchivePartiallyFailed", e.UploadArchiveRequestFailed = "uploadArchiveRequestFailed", e;
|
|
16
14
|
}({}), K = /* @__PURE__ */ function(e) {
|
|
17
|
-
return e.
|
|
15
|
+
return e.FolderLoadFailed = "folderLoadFailed", e.MetadataLoadFailed = "metadataLoadFailed", e.FolderCreateFailed = "folderCreateFailed", e.DownloadFileFailed = "downloadFileFailed", e.DownloadFilesFailed = "downloadFilesFailed", e.FilesDeleted = "filesDeleted", e.FilesDeletePartiallyFailed = "filesDeletePartiallyFailed", e.DeleteFailed = "deleteFailed", e.RenameFailed = "renameFailed", e.RenamePartiallyFailed = "renamePartiallyFailed", e.MoveFailed = "moveFailed", e.MovePartiallyFailed = "movePartiallyFailed", e.CopyFailed = "copyFailed", e.CopyPartiallyFailed = "copyPartiallyFailed", e.UnshareFailed = "unshareFailed", e.RemoveAccessFailed = "removeAccessFailed", e.UploadFailed = "uploadFailed", e.UploadCompleted = "uploadCompleted", e.UploadArchiveFailed = "uploadArchiveFailed", e.UploadArchivePartiallyFailed = "uploadArchivePartiallyFailed", e.UploadArchiveRequestFailed = "uploadArchiveRequestFailed", e;
|
|
18
16
|
}({}), q = /* @__PURE__ */ function(e) {
|
|
17
|
+
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e.LeadingDot = "leadingDot", e;
|
|
18
|
+
}({}), J = /* @__PURE__ */ function(e) {
|
|
19
19
|
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e;
|
|
20
20
|
}({}), ie = 3, ae = m, oe = /[/\\]/, se = {
|
|
21
21
|
year: "numeric",
|
|
22
22
|
month: "short",
|
|
23
23
|
day: "2-digit"
|
|
24
24
|
}, ce = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
G.Name,
|
|
26
|
+
G.UpdatedAt,
|
|
27
|
+
G.Size,
|
|
28
|
+
G.Actions
|
|
29
29
|
], le = [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
G.Name,
|
|
31
|
+
G.UpdatedAt,
|
|
32
|
+
G.Size,
|
|
33
|
+
G.Author,
|
|
34
|
+
G.Actions
|
|
35
35
|
], ue = {
|
|
36
|
-
READ:
|
|
37
|
-
WRITE:
|
|
38
|
-
SHARE:
|
|
36
|
+
READ: W.READ,
|
|
37
|
+
WRITE: W.WRITE,
|
|
38
|
+
SHARE: W.SHARE
|
|
39
39
|
}, de = (e) => {
|
|
40
40
|
switch (e) {
|
|
41
41
|
case d.Attach: return u.Attach;
|
|
42
42
|
case d.Standalone: return u.Browse;
|
|
43
43
|
case d.FolderPicker: return u.Full;
|
|
44
44
|
}
|
|
45
|
-
},
|
|
45
|
+
}, Y = (e, t) => {
|
|
46
46
|
if (oe.test(e)) return !0;
|
|
47
47
|
if (t == null) return !1;
|
|
48
48
|
t.lastIndex = 0;
|
|
49
49
|
let n = t.test(e);
|
|
50
50
|
return t.lastIndex = 0, n;
|
|
51
|
-
},
|
|
52
|
-
let
|
|
53
|
-
return n
|
|
54
|
-
},
|
|
55
|
-
let n =
|
|
51
|
+
}, fe = (e) => e.replace(/\/+$/, "") || "/", X = (e, t) => {
|
|
52
|
+
let n = e.split("/").filter(Boolean);
|
|
53
|
+
return n[n.length - 1] ?? t;
|
|
54
|
+
}, pe = (e, t) => fe(e || `/${t}`).replace(/^\/+/, "") || t, me = (e, t) => {
|
|
55
|
+
let n = fe(t);
|
|
56
56
|
for (let r of e) {
|
|
57
|
-
if (r.nodeType !==
|
|
58
|
-
if (
|
|
59
|
-
let e =
|
|
57
|
+
if (r.nodeType !== U.FOLDER) continue;
|
|
58
|
+
if (fe(r.path) === n) return r;
|
|
59
|
+
let e = me(r.items ?? [], t);
|
|
60
60
|
if (e) return e;
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, he = (e) => e?.permissions?.includes(W.WRITE) ?? !1, ge = (e, t) => {
|
|
63
63
|
for (let n of e) {
|
|
64
64
|
if (n.path === t || n.id === t) return n;
|
|
65
|
-
let e =
|
|
65
|
+
let e = ge(n.items ?? [], t);
|
|
66
66
|
if (e) return e;
|
|
67
67
|
}
|
|
68
|
-
},
|
|
68
|
+
}, _e = (e) => {
|
|
69
69
|
switch (e) {
|
|
70
70
|
case u.Attach: return !1;
|
|
71
71
|
case u.Browse:
|
|
72
72
|
case u.Full: return !0;
|
|
73
73
|
default: throw Error(`Unhandled actionProfile: ${String(e)}`);
|
|
74
74
|
}
|
|
75
|
-
},
|
|
75
|
+
}, ve = (e) => e === u.Full, ye = (e, t) => {
|
|
76
76
|
let n = e.replace(/\/$/, ""), r = n.lastIndexOf("/");
|
|
77
77
|
if (r <= 0) {
|
|
78
78
|
let e = r === 0 ? n.slice(1) : n;
|
|
@@ -88,10 +88,10 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
88
88
|
}, Z = (e, t) => {
|
|
89
89
|
let n = `files/${t}/`;
|
|
90
90
|
return e.startsWith(n) ? e.slice(n.length) : e;
|
|
91
|
-
},
|
|
91
|
+
}, be = (e, t, r) => {
|
|
92
92
|
let i = e.replace(/\/+$/, "").split("/").filter(Boolean).map(n).join("/"), a = i ? `/${t}/${i}` : `/${t}`;
|
|
93
93
|
return r ? `${a}/` : a;
|
|
94
|
-
},
|
|
94
|
+
}, xe = (e, t, n) => {
|
|
95
95
|
if (!e) return {
|
|
96
96
|
bucket: n,
|
|
97
97
|
path: e
|
|
@@ -106,10 +106,10 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
106
106
|
bucket: a.bucket,
|
|
107
107
|
path: o + s
|
|
108
108
|
};
|
|
109
|
-
},
|
|
109
|
+
}, Se = (e) => e.startsWith("files/"), Ce = (e, t) => {
|
|
110
110
|
let r = `files/${t}/`;
|
|
111
111
|
if (e.startsWith(r)) return n(e.slice(r.length));
|
|
112
|
-
if (
|
|
112
|
+
if (Se(e)) {
|
|
113
113
|
let r = e.slice(6), i = r.indexOf("/");
|
|
114
114
|
if (i >= 0) {
|
|
115
115
|
let e = r.slice(0, i), a = r.slice(i + 1);
|
|
@@ -129,25 +129,25 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
129
129
|
}
|
|
130
130
|
let o = a.replace(/\/{2,}/g, "/");
|
|
131
131
|
return o && !o.endsWith("/") ? `${o}/` : o;
|
|
132
|
-
},
|
|
133
|
-
let r = e.nodeType ===
|
|
132
|
+
}, we = (e, t) => e.startsWith("/") || e === t || e.startsWith(`${t}/`), Te = (e, t, n) => {
|
|
133
|
+
let r = e.nodeType === U.FOLDER, i = e.id ? Ce(e.id, t) : null, a = i != null && !we(i, n) ? i : Q(e.path, n);
|
|
134
134
|
return r ? a.endsWith("/") ? a : `${a}/` : a.replace(/\/$/, "");
|
|
135
|
-
},
|
|
136
|
-
let r = e.nodeType ===
|
|
135
|
+
}, Ee = (e, t, n) => e.map((e) => {
|
|
136
|
+
let r = e.nodeType === U.FOLDER, i = Q(e.sourceUrl, n), a = Q(e.destinationUrl, n), o = X(e.sourceUrl, i);
|
|
137
137
|
return {
|
|
138
|
-
destinationName:
|
|
138
|
+
destinationName: X(e.destinationUrl, a),
|
|
139
139
|
dto: {
|
|
140
140
|
bucket: t,
|
|
141
141
|
sourcePath: r ? i.endsWith("/") ? i : `${i}/` : i.replace(/\/$/, ""),
|
|
142
142
|
destinationPath: r ? a.endsWith("/") ? a : `${a}/` : a.replace(/\/$/, ""),
|
|
143
143
|
overwrite: e.overwrite === !0,
|
|
144
|
-
nodeType: r ?
|
|
144
|
+
nodeType: r ? F.Folder : F.Item,
|
|
145
145
|
name: o
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
}),
|
|
148
|
+
}), De = (e, t, n) => {
|
|
149
149
|
let r = e.map((e) => {
|
|
150
|
-
let t = e.nodeType ===
|
|
150
|
+
let t = e.nodeType === U.FOLDER, r = Q(e.sourceUrl, n), i = Q(e.destinationUrl, n), a = X(e.sourceUrl, r), o = X(e.destinationUrl, i), s = t ? r.endsWith("/") ? r : `${r}/` : r.replace(/\/$/, ""), c = t ? i.endsWith("/") ? i : `${i}/` : i.replace(/\/$/, "");
|
|
151
151
|
return {
|
|
152
152
|
isFolder: t,
|
|
153
153
|
name: a,
|
|
@@ -164,7 +164,7 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
164
164
|
bucket: t,
|
|
165
165
|
sourcePath: e.sourcePath,
|
|
166
166
|
destinationPath: e.destinationPath,
|
|
167
|
-
nodeType: e.isFolder ?
|
|
167
|
+
nodeType: e.isFolder ? R.Folder : R.Item,
|
|
168
168
|
name: e.name
|
|
169
169
|
})),
|
|
170
170
|
preparedMoveItems: r.filter((e) => e.sourceParent !== e.destinationParent).map((e) => ({
|
|
@@ -174,57 +174,57 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
174
174
|
sourcePath: e.sourcePath,
|
|
175
175
|
destinationPath: e.destinationPath,
|
|
176
176
|
overwrite: e.overwrite,
|
|
177
|
-
nodeType: e.isFolder ?
|
|
177
|
+
nodeType: e.isFolder ? L.Folder : L.Item,
|
|
178
178
|
name: e.name
|
|
179
179
|
}
|
|
180
180
|
}))
|
|
181
181
|
};
|
|
182
|
-
},
|
|
182
|
+
}, Oe = (e) => {
|
|
183
183
|
if (!e?.length) return;
|
|
184
184
|
let t = e.map((e) => ue[e.toUpperCase()]).filter((e) => e != null);
|
|
185
185
|
return t.length > 0 ? t : void 0;
|
|
186
|
-
},
|
|
186
|
+
}, ke = (e, t) => {
|
|
187
187
|
let n = t.find((e) => e.success);
|
|
188
188
|
if (n != null) return e.find(({ dto: e }) => e.sourcePath === n.sourcePath && e.destinationPath === n.destinationPath) ?? e.find(({ dto: e }) => e.destinationPath === n.destinationPath) ?? e[0];
|
|
189
|
-
},
|
|
190
|
-
let
|
|
191
|
-
if (
|
|
192
|
-
let
|
|
193
|
-
return
|
|
194
|
-
let
|
|
195
|
-
id:
|
|
196
|
-
name:
|
|
197
|
-
path:
|
|
198
|
-
url:
|
|
199
|
-
parentPath:
|
|
200
|
-
nodeType:
|
|
201
|
-
folderId:
|
|
202
|
-
bucket:
|
|
203
|
-
author:
|
|
204
|
-
resourceType:
|
|
205
|
-
contentLength:
|
|
206
|
-
contentType:
|
|
207
|
-
updatedAt:
|
|
189
|
+
}, Ae = (e, t, n, r, i) => {
|
|
190
|
+
let a = e.get(n);
|
|
191
|
+
if (a == null) return [];
|
|
192
|
+
let o = r.replace(/\/$/, "");
|
|
193
|
+
return a.map((a) => {
|
|
194
|
+
let s = a.nodeType === ee.Folder, c = a.name, l = s ? `${o}/${c}/` : `${o}/${c}`, u = {
|
|
195
|
+
id: a.path,
|
|
196
|
+
name: c,
|
|
197
|
+
path: l,
|
|
198
|
+
url: a.url,
|
|
199
|
+
parentPath: r,
|
|
200
|
+
nodeType: s ? U.FOLDER : U.ITEM,
|
|
201
|
+
folderId: i,
|
|
202
|
+
bucket: a.bucket,
|
|
203
|
+
author: a.author,
|
|
204
|
+
resourceType: a.resourceType,
|
|
205
|
+
contentLength: a.contentLength,
|
|
206
|
+
contentType: a.contentType,
|
|
207
|
+
updatedAt: a.updatedAt ? new Date(a.updatedAt).toISOString() : void 0
|
|
208
208
|
};
|
|
209
|
-
if (
|
|
210
|
-
let
|
|
211
|
-
|
|
209
|
+
if (s) {
|
|
210
|
+
let r = `${n}${c}/`;
|
|
211
|
+
u.permissions = Oe(a.permissions) ?? Oe(t.get(r)), u.items = Ae(e, t, r, l, a.path);
|
|
212
212
|
}
|
|
213
|
-
return
|
|
213
|
+
return u;
|
|
214
214
|
});
|
|
215
|
-
},
|
|
215
|
+
}, je = (e, t, n, r) => {
|
|
216
216
|
let i = new Map(e), a = [...i.get(t) ?? []], o = {
|
|
217
217
|
name: n.name,
|
|
218
218
|
path: n.path,
|
|
219
219
|
folderId: n.folderId,
|
|
220
|
-
nodeType:
|
|
220
|
+
nodeType: ee.Folder,
|
|
221
221
|
bucket: n.bucket,
|
|
222
222
|
parentPath: n.parentPath || void 0,
|
|
223
223
|
url: n.path,
|
|
224
224
|
permissions: r
|
|
225
225
|
};
|
|
226
226
|
return a.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || a.push(o), i.set(t, a), i;
|
|
227
|
-
},
|
|
227
|
+
}, Me = (e, t, n) => {
|
|
228
228
|
if (!e) return e;
|
|
229
229
|
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e, n) => n === t ? {
|
|
230
230
|
...e,
|
|
@@ -234,8 +234,8 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
234
234
|
...e,
|
|
235
235
|
files: i
|
|
236
236
|
};
|
|
237
|
-
},
|
|
238
|
-
if (t ===
|
|
237
|
+
}, Ne = (e, t, n, r, i) => {
|
|
238
|
+
if (t === H.Shared) {
|
|
239
239
|
if (r === "") return e.listSharedFiles({ path: void 0 }).then((e) => ({ items: e.items }));
|
|
240
240
|
let t = r.indexOf("/"), n = t === -1 ? r : r.slice(0, t), a = i.get(n);
|
|
241
241
|
if (a) {
|
|
@@ -251,7 +251,7 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
251
251
|
}
|
|
252
252
|
return Promise.resolve({ items: [] });
|
|
253
253
|
}
|
|
254
|
-
return t ===
|
|
254
|
+
return t === H.Organization ? e.listPublicFiles({ path: r || void 0 }).then((e) => ({ items: e.items })) : e.listFiles({
|
|
255
255
|
bucket: n,
|
|
256
256
|
path: r,
|
|
257
257
|
permissions: !0
|
|
@@ -259,8 +259,8 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
259
259
|
items: e.items,
|
|
260
260
|
permissions: e.permissions
|
|
261
261
|
}));
|
|
262
|
-
},
|
|
263
|
-
if (t ===
|
|
262
|
+
}, Pe = async (e, t, n, r, i) => {
|
|
263
|
+
if (t === H.Shared) {
|
|
264
264
|
let t = r.indexOf("/"), n = t === -1 ? r : r.slice(0, t), a = i.get(n);
|
|
265
265
|
if (!a) return { items: [] };
|
|
266
266
|
let o = Z(a.dialCorePath, a.bucket) + (t === -1 ? "" : r.slice(t + 1)), { items: s } = await e.listFiles({
|
|
@@ -271,7 +271,7 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
271
271
|
});
|
|
272
272
|
return { items: s };
|
|
273
273
|
}
|
|
274
|
-
if (t ===
|
|
274
|
+
if (t === H.Organization) {
|
|
275
275
|
let { items: t } = await e.listPublicFiles({
|
|
276
276
|
path: r || void 0,
|
|
277
277
|
recursive: !0
|
|
@@ -285,38 +285,38 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
285
285
|
recursive: !0
|
|
286
286
|
});
|
|
287
287
|
return { items: a };
|
|
288
|
-
},
|
|
289
|
-
let
|
|
288
|
+
}, Fe = (e, t, n) => {
|
|
289
|
+
let r = e.nodeType === ee.Folder, i = e.name, a = e.bucket ?? t, o = Z(e.url ?? e.path ?? "", a).replace(/\/$/, ""), s = o.lastIndexOf("/"), c = be(s > 0 ? o.slice(0, s) : "", n, !1), l = r ? `${c}/${i}/` : `${c}/${i}`;
|
|
290
290
|
return {
|
|
291
291
|
id: e.path,
|
|
292
|
-
name:
|
|
293
|
-
path:
|
|
292
|
+
name: i,
|
|
293
|
+
path: l,
|
|
294
294
|
url: e.url,
|
|
295
|
-
parentPath:
|
|
296
|
-
nodeType:
|
|
295
|
+
parentPath: c,
|
|
296
|
+
nodeType: r ? U.FOLDER : U.ITEM,
|
|
297
297
|
folderId: e.folderId,
|
|
298
|
-
bucket:
|
|
298
|
+
bucket: a,
|
|
299
299
|
author: e.author,
|
|
300
300
|
contentLength: e.contentLength,
|
|
301
301
|
contentType: e.contentType,
|
|
302
302
|
updatedAt: e.updatedAt ? new Date(e.updatedAt).toISOString() : void 0
|
|
303
303
|
};
|
|
304
|
-
},
|
|
304
|
+
}, Ie = (e, t) => ({
|
|
305
305
|
...t,
|
|
306
306
|
bucket: e.bucket ?? t.bucket,
|
|
307
307
|
author: e.author,
|
|
308
308
|
contentLength: e.contentLength,
|
|
309
309
|
contentType: e.contentType,
|
|
310
310
|
resourceType: e.resourceType ?? t.resourceType,
|
|
311
|
-
permissions:
|
|
311
|
+
permissions: Oe(e.permissions) ?? t.permissions,
|
|
312
312
|
updatedAt: e.updatedAt ? new Date(e.updatedAt).toISOString() : t.updatedAt,
|
|
313
313
|
createdAt: e.createdAt ? new Date(e.createdAt).toISOString() : t.createdAt
|
|
314
|
-
}),
|
|
314
|
+
}), Le = (e) => e instanceof AbortSignal ? { signal: e } : e ?? {}, Re = (e, t) => ({
|
|
315
315
|
listPublicFiles: (t) => e.listPublicFiles(t),
|
|
316
316
|
listSharedFiles: (t) => e.listSharedFiles(t),
|
|
317
317
|
listFiles: (t, n) => e.listFiles(t, n ? { signal: n } : void 0),
|
|
318
318
|
uploadFile: (n, r, i, a) => {
|
|
319
|
-
let { signal: o, onProgress: s, uploadMode: c } =
|
|
319
|
+
let { signal: o, onProgress: s, uploadMode: c } = Le(a);
|
|
320
320
|
return s == null ? e.uploadFile({
|
|
321
321
|
bucket: n,
|
|
322
322
|
path: r,
|
|
@@ -347,7 +347,7 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
347
347
|
revokeAccess: (t) => e.revokeAccess({ revokeAccessDto: { items: t } }),
|
|
348
348
|
discardShared: (t) => e.discardShared({ discardSharedDto: { items: t } }),
|
|
349
349
|
listSharedByMe: (t) => e.listSharedByMe({ bucket: t })
|
|
350
|
-
}),
|
|
350
|
+
}), ze = (e) => {
|
|
351
351
|
let { uploadUrl: t, xhrFactory: n = () => new XMLHttpRequest() } = e;
|
|
352
352
|
return (r, i, a, { signal: o, onProgress: s, uploadMode: c } = {}) => new Promise((l, u) => {
|
|
353
353
|
let d = n();
|
|
@@ -385,7 +385,7 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
385
385
|
}
|
|
386
386
|
d.send(p);
|
|
387
387
|
});
|
|
388
|
-
},
|
|
388
|
+
}, Be = (t, n) => {
|
|
389
389
|
let { url: r } = t;
|
|
390
390
|
if (r == null) return;
|
|
391
391
|
let i = r.split("#")[0];
|
|
@@ -394,12 +394,12 @@ var re = /* @__PURE__ */ function(e) {
|
|
|
394
394
|
if (e == null) return;
|
|
395
395
|
S(e, t.title ?? i.split("/").pop() ?? "");
|
|
396
396
|
} else window.open(r, "_blank", "noopener,noreferrer");
|
|
397
|
-
},
|
|
398
|
-
typeof
|
|
399
|
-
},
|
|
397
|
+
}, Ve = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, He = /* @__PURE__ */ new Set(), Ue = typeof process == "object" && process ? process : {}, We = (e, t, n, r) => {
|
|
398
|
+
typeof Ue.emitWarning == "function" ? Ue.emitWarning(e, t, n, r) : console.error(`[${n}] ${t}: ${e}`);
|
|
399
|
+
}, Ge = globalThis.AbortController, Ke = globalThis.AbortSignal;
|
|
400
400
|
/* c8 ignore start */
|
|
401
|
-
if (
|
|
402
|
-
|
|
401
|
+
if (Ge === void 0) {
|
|
402
|
+
Ke = class {
|
|
403
403
|
onabort;
|
|
404
404
|
_onabort = [];
|
|
405
405
|
reason;
|
|
@@ -407,11 +407,11 @@ if (We === void 0) {
|
|
|
407
407
|
addEventListener(e, t) {
|
|
408
408
|
this._onabort.push(t);
|
|
409
409
|
}
|
|
410
|
-
},
|
|
410
|
+
}, Ge = class {
|
|
411
411
|
constructor() {
|
|
412
412
|
t();
|
|
413
413
|
}
|
|
414
|
-
signal = new
|
|
414
|
+
signal = new Ke();
|
|
415
415
|
abort(e) {
|
|
416
416
|
if (!this.signal.aborted) {
|
|
417
417
|
this.signal.reason = e, this.signal.aborted = !0;
|
|
@@ -420,21 +420,21 @@ if (We === void 0) {
|
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
|
-
let e =
|
|
424
|
-
e && (e = !1,
|
|
423
|
+
let e = Ue.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
424
|
+
e && (e = !1, We("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
427
|
/* c8 ignore stop */
|
|
428
|
-
var
|
|
428
|
+
var qe = (e) => !He.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), Je = (e) => $(e) ? e <= 2 ** 8 ? Uint8Array : e <= 2 ** 16 ? Uint16Array : e <= 2 ** 32 ? Uint32Array : e <= 2 ** 53 - 1 ? Ye : null : null, Ye = class extends Array {
|
|
429
429
|
constructor(e) {
|
|
430
430
|
super(e), this.fill(0);
|
|
431
431
|
}
|
|
432
|
-
},
|
|
432
|
+
}, Xe = class e {
|
|
433
433
|
heap;
|
|
434
434
|
length;
|
|
435
435
|
static #e = !1;
|
|
436
436
|
static create(t) {
|
|
437
|
-
let n =
|
|
437
|
+
let n = Je(t);
|
|
438
438
|
if (!n) return [];
|
|
439
439
|
e.#e = !0;
|
|
440
440
|
let r = new e(t, n);
|
|
@@ -451,7 +451,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
451
451
|
pop() {
|
|
452
452
|
return this.heap[--this.length];
|
|
453
453
|
}
|
|
454
|
-
},
|
|
454
|
+
}, Ze = class e {
|
|
455
455
|
#e;
|
|
456
456
|
#t;
|
|
457
457
|
#n;
|
|
@@ -542,7 +542,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
542
542
|
constructor(t) {
|
|
543
543
|
let { max: n = 0, ttl: r, ttlResolution: i = 1, ttlAutopurge: a, updateAgeOnGet: o, updateAgeOnHas: s, allowStale: c, dispose: l, disposeAfter: u, noDisposeOnSet: d, noUpdateTTL: f, maxSize: p = 0, maxEntrySize: m = 0, sizeCalculation: h, fetchMethod: g, memoMethod: _, noDeleteOnFetchRejection: v, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: x, ignoreFetchAbort: S } = t;
|
|
544
544
|
if (n !== 0 && !$(n)) throw TypeError("max option must be a nonnegative integer");
|
|
545
|
-
let C = n ?
|
|
545
|
+
let C = n ? Je(n) : Array;
|
|
546
546
|
if (!C) throw Error("invalid max value: " + n);
|
|
547
547
|
if (this.#e = n, this.#t = p, this.maxEntrySize = m || this.#t, this.sizeCalculation = h, this.sizeCalculation) {
|
|
548
548
|
if (!this.#t && !this.maxEntrySize) throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
@@ -550,7 +550,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
550
550
|
}
|
|
551
551
|
if (_ !== void 0 && typeof _ != "function") throw TypeError("memoMethod must be a function if defined");
|
|
552
552
|
if (this.#a = _, g !== void 0 && typeof g != "function") throw TypeError("fetchMethod must be a function if specified");
|
|
553
|
-
if (this.#i = g, this.#x = !!g, this.#c = /* @__PURE__ */ new Map(), this.#l = Array(n).fill(void 0), this.#u = Array(n).fill(void 0), this.#d = new C(n), this.#f = new C(n), this.#p = 0, this.#m = 0, this.#h =
|
|
553
|
+
if (this.#i = g, this.#x = !!g, this.#c = /* @__PURE__ */ new Map(), this.#l = Array(n).fill(void 0), this.#u = Array(n).fill(void 0), this.#d = new C(n), this.#f = new C(n), this.#p = 0, this.#m = 0, this.#h = Xe.create(n), this.#o = 0, this.#s = 0, typeof l == "function" && (this.#n = l), typeof u == "function" ? (this.#r = u, this.#g = []) : (this.#r = void 0, this.#g = void 0), this.#b = !!this.#n, this.#S = !!this.#r, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!v, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!x, this.ignoreFetchAbort = !!S, this.maxEntrySize !== 0) {
|
|
554
554
|
if (this.#t !== 0 && !$(this.#t)) throw TypeError("maxSize must be a positive integer if specified");
|
|
555
555
|
if (!$(this.maxEntrySize)) throw TypeError("maxEntrySize must be a positive integer if specified");
|
|
556
556
|
this.#O();
|
|
@@ -562,15 +562,15 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
562
562
|
if (this.#e === 0 && this.ttl === 0 && this.#t === 0) throw TypeError("At least one of max, maxSize, or ttl is required");
|
|
563
563
|
if (!this.ttlAutopurge && !this.#e && !this.#t) {
|
|
564
564
|
let t = "LRU_CACHE_UNBOUNDED";
|
|
565
|
-
|
|
565
|
+
qe(t) && (He.add(t), We("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", t, e));
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
getRemainingTTL(e) {
|
|
569
569
|
return this.#c.has(e) ? Infinity : 0;
|
|
570
570
|
}
|
|
571
571
|
#C() {
|
|
572
|
-
let e = new
|
|
573
|
-
this.#y = e, this.#v = t, this.#E = (n, r, i =
|
|
572
|
+
let e = new Ye(this.#e), t = new Ye(this.#e);
|
|
573
|
+
this.#y = e, this.#v = t, this.#E = (n, r, i = Ve.now()) => {
|
|
574
574
|
if (t[n] = r === 0 ? 0 : i, e[n] = r, r !== 0 && this.ttlAutopurge) {
|
|
575
575
|
let e = setTimeout(() => {
|
|
576
576
|
this.#D(n) && this.#B(this.#l[n], "expire");
|
|
@@ -579,7 +579,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
579
579
|
e.unref && e.unref();
|
|
580
580
|
}
|
|
581
581
|
}, this.#w = (n) => {
|
|
582
|
-
t[n] = e[n] === 0 ? 0 :
|
|
582
|
+
t[n] = e[n] === 0 ? 0 : Ve.now();
|
|
583
583
|
}, this.#T = (i, a) => {
|
|
584
584
|
if (e[a]) {
|
|
585
585
|
let o = e[a], s = t[a];
|
|
@@ -589,7 +589,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
589
589
|
}
|
|
590
590
|
};
|
|
591
591
|
let n = 0, r = () => {
|
|
592
|
-
let e =
|
|
592
|
+
let e = Ve.now();
|
|
593
593
|
if (this.ttlResolution > 0) {
|
|
594
594
|
n = e;
|
|
595
595
|
let t = setTimeout(() => n = 0, this.ttlResolution);
|
|
@@ -614,7 +614,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
614
614
|
/* c8 ignore stop */
|
|
615
615
|
#D = () => !1;
|
|
616
616
|
#O() {
|
|
617
|
-
let e = new
|
|
617
|
+
let e = new Ye(this.#e);
|
|
618
618
|
this.#s = 0, this.#_ = e, this.#k = (t) => {
|
|
619
619
|
this.#s -= e[t], e[t] = 0;
|
|
620
620
|
}, this.#j = (e, t, n, r) => {
|
|
@@ -706,7 +706,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
706
706
|
let i = { value: r };
|
|
707
707
|
if (this.#y && this.#v) {
|
|
708
708
|
let e = this.#y[t], n = this.#v[t];
|
|
709
|
-
e && n && (i.ttl = e - (
|
|
709
|
+
e && n && (i.ttl = e - (Ve.now() - n), i.start = Date.now());
|
|
710
710
|
}
|
|
711
711
|
return this.#_ && (i.size = this.#_[t]), i;
|
|
712
712
|
}
|
|
@@ -718,7 +718,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
718
718
|
let a = { value: i };
|
|
719
719
|
if (this.#y && this.#v) {
|
|
720
720
|
a.ttl = this.#y[t];
|
|
721
|
-
let e =
|
|
721
|
+
let e = Ve.now() - this.#v[t];
|
|
722
722
|
a.start = Math.floor(Date.now() - e);
|
|
723
723
|
}
|
|
724
724
|
this.#_ && (a.size = this.#_[t]), e.unshift([n, a]);
|
|
@@ -730,7 +730,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
730
730
|
for (let [t, n] of e) {
|
|
731
731
|
if (n.start) {
|
|
732
732
|
let e = Date.now() - n.start;
|
|
733
|
-
n.start =
|
|
733
|
+
n.start = Ve.now() - e;
|
|
734
734
|
}
|
|
735
735
|
this.set(t, n.value, n);
|
|
736
736
|
}
|
|
@@ -813,7 +813,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
813
813
|
#I(e, t, n, r) {
|
|
814
814
|
let i = t === void 0 ? void 0 : this.#u[t];
|
|
815
815
|
if (this.#L(i)) return i;
|
|
816
|
-
let a = new
|
|
816
|
+
let a = new Ge(), { signal: o } = n;
|
|
817
817
|
o?.addEventListener("abort", () => a.abort(o.reason), { signal: a.signal });
|
|
818
818
|
let s = {
|
|
819
819
|
signal: a.signal,
|
|
@@ -848,7 +848,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
848
848
|
#L(e) {
|
|
849
849
|
if (!this.#x) return !1;
|
|
850
850
|
let t = e;
|
|
851
|
-
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof
|
|
851
|
+
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof Ge;
|
|
852
852
|
}
|
|
853
853
|
async fetch(e, t = {}) {
|
|
854
854
|
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, ttl: a = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: s = 0, sizeCalculation: c = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: m, forceRefresh: h = !1, status: g, signal: _ } = t;
|
|
@@ -972,18 +972,18 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
972
972
|
for (; t = e?.shift();) this.#r?.(...t);
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
},
|
|
975
|
+
}, Qe = (e, t) => URL.createObjectURL(_(e, t)), $e = (e) => {
|
|
976
976
|
let t = w(e);
|
|
977
977
|
return t == null ? e : new TextDecoder().decode(t);
|
|
978
|
-
},
|
|
978
|
+
}, et = (e, t) => ({
|
|
979
979
|
type: r.Error,
|
|
980
980
|
errorType: e === 403 ? i.Forbidden : i.LoadFailed,
|
|
981
981
|
url: t
|
|
982
|
-
}),
|
|
982
|
+
}), tt = (e) => ({
|
|
983
983
|
type: r.Error,
|
|
984
984
|
errorType: i.LoadFailed,
|
|
985
985
|
url: e
|
|
986
|
-
}),
|
|
986
|
+
}), nt = (e) => {
|
|
987
987
|
let t;
|
|
988
988
|
try {
|
|
989
989
|
t = new URL(e).pathname;
|
|
@@ -996,55 +996,55 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
996
996
|
} catch {
|
|
997
997
|
return n;
|
|
998
998
|
}
|
|
999
|
-
},
|
|
1000
|
-
if (
|
|
1001
|
-
let n =
|
|
999
|
+
}, rt = (e) => e.startsWith("image/") || e.startsWith("audio/") || e === h.PDF || s("", e), it = (e, t) => {
|
|
1000
|
+
if (rt(e)) return e;
|
|
1001
|
+
let n = nt(t), r = n.lastIndexOf(".");
|
|
1002
1002
|
return (r === -1 ? "" : n.slice(r + 1).toLowerCase()) === f.PDF ? h.PDF : a(n) ?? e;
|
|
1003
|
-
},
|
|
1004
|
-
if (
|
|
1005
|
-
let n =
|
|
1003
|
+
}, at = (e, t) => {
|
|
1004
|
+
if (rt(it(e, t))) return !0;
|
|
1005
|
+
let n = nt(t);
|
|
1006
1006
|
return c(n) || o(n);
|
|
1007
|
-
},
|
|
1008
|
-
|
|
1009
|
-
},
|
|
1010
|
-
let t =
|
|
1007
|
+
}, ot = new Ze({ max: 10 }), st = new Ze({ max: 50 }), ct = () => {
|
|
1008
|
+
ot.clear(), st.clear();
|
|
1009
|
+
}, lt = (e) => {
|
|
1010
|
+
let t = ot.get(e);
|
|
1011
1011
|
return t ?? (t = fetch(e).then((e) => {
|
|
1012
1012
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
1013
1013
|
return e.blob();
|
|
1014
1014
|
}).catch((t) => {
|
|
1015
|
-
throw
|
|
1016
|
-
}),
|
|
1017
|
-
},
|
|
1018
|
-
let t =
|
|
1015
|
+
throw ot.delete(e), t;
|
|
1016
|
+
}), ot.set(e, t)), t;
|
|
1017
|
+
}, ut = (e) => {
|
|
1018
|
+
let t = st.get(e);
|
|
1019
1019
|
return t ?? (t = fetch(e).then((e) => {
|
|
1020
1020
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
1021
1021
|
return e.text();
|
|
1022
1022
|
}).catch((t) => {
|
|
1023
|
-
throw
|
|
1024
|
-
}),
|
|
1025
|
-
},
|
|
1023
|
+
throw st.delete(e), t;
|
|
1024
|
+
}), st.set(e, t)), t;
|
|
1025
|
+
}, dt = async (e, t) => {
|
|
1026
1026
|
if ("file" in e) return URL.createObjectURL(e.file);
|
|
1027
1027
|
let n = t.resolveDialUrl(e);
|
|
1028
1028
|
if (n != null) try {
|
|
1029
|
-
let e = await
|
|
1029
|
+
let e = await lt(n);
|
|
1030
1030
|
return URL.createObjectURL(e);
|
|
1031
1031
|
} catch (e) {
|
|
1032
1032
|
let t = e.status;
|
|
1033
|
-
return t == null ?
|
|
1033
|
+
return t == null ? tt(n) : et(t, n);
|
|
1034
1034
|
}
|
|
1035
1035
|
if (e.previewUrl != null) return e.previewUrl;
|
|
1036
|
-
if (e.data != null) return
|
|
1037
|
-
},
|
|
1038
|
-
if (e.data != null) return
|
|
1036
|
+
if (e.data != null) return Qe(e.data, e.contentType);
|
|
1037
|
+
}, ft = async (e, t) => {
|
|
1038
|
+
if (e.data != null) return $e(e.data);
|
|
1039
1039
|
let n = t.resolveDialUrl(e);
|
|
1040
1040
|
if (n != null) try {
|
|
1041
|
-
return await
|
|
1041
|
+
return await ut(n);
|
|
1042
1042
|
} catch (e) {
|
|
1043
1043
|
let t = e.status;
|
|
1044
|
-
return t == null ?
|
|
1044
|
+
return t == null ? tt(n) : et(t, n);
|
|
1045
1045
|
}
|
|
1046
1046
|
if ("file" in e) return e.file.text();
|
|
1047
|
-
},
|
|
1047
|
+
}, pt = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, mt = (e, t) => {
|
|
1048
1048
|
if ("file" in e) return {
|
|
1049
1049
|
type: r.Image,
|
|
1050
1050
|
url: URL.createObjectURL(e.file)
|
|
@@ -1052,7 +1052,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1052
1052
|
let n = t.resolveDialUrl(e);
|
|
1053
1053
|
return n == null ? e.previewUrl == null ? e.data == null ? null : {
|
|
1054
1054
|
type: r.Image,
|
|
1055
|
-
url:
|
|
1055
|
+
url: Qe(e.data, e.contentType)
|
|
1056
1056
|
} : {
|
|
1057
1057
|
type: r.Image,
|
|
1058
1058
|
url: e.previewUrl
|
|
@@ -1060,50 +1060,51 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1060
1060
|
type: r.Image,
|
|
1061
1061
|
url: n
|
|
1062
1062
|
};
|
|
1063
|
-
},
|
|
1064
|
-
let n = await
|
|
1063
|
+
}, ht = async (e, t) => {
|
|
1064
|
+
let n = await ft(e, t);
|
|
1065
1065
|
return n == null ? null : typeof n == "string" ? {
|
|
1066
1066
|
type: r.PlainText,
|
|
1067
1067
|
text: n
|
|
1068
1068
|
} : n;
|
|
1069
|
-
},
|
|
1070
|
-
let n = await
|
|
1069
|
+
}, gt = async (e, t) => {
|
|
1070
|
+
let n = await ft(e, t);
|
|
1071
1071
|
return n == null ? null : typeof n == "string" ? {
|
|
1072
1072
|
type: r.Markdown,
|
|
1073
1073
|
text: n
|
|
1074
1074
|
} : n;
|
|
1075
|
-
},
|
|
1076
|
-
let i = await
|
|
1075
|
+
}, _t = 1048576, vt = async (e, t, n) => {
|
|
1076
|
+
let i = await ft(e, t);
|
|
1077
1077
|
return i == null ? null : typeof i == "string" ? {
|
|
1078
1078
|
type: r.Code,
|
|
1079
1079
|
text: i,
|
|
1080
1080
|
language: n
|
|
1081
1081
|
} : i;
|
|
1082
|
-
},
|
|
1083
|
-
let n = await
|
|
1082
|
+
}, yt = async (e, t) => {
|
|
1083
|
+
let n = await ft(e, t);
|
|
1084
1084
|
if (n == null) return null;
|
|
1085
1085
|
if (typeof n != "string") return n;
|
|
1086
|
-
if (n.length >
|
|
1086
|
+
if (n.length > _t) return null;
|
|
1087
1087
|
let i = t.resolveDialUrl(e) ?? void 0;
|
|
1088
1088
|
return {
|
|
1089
1089
|
type: r.Html,
|
|
1090
1090
|
srcdoc: n,
|
|
1091
1091
|
url: i
|
|
1092
1092
|
};
|
|
1093
|
-
},
|
|
1093
|
+
}, bt = (t, n, i) => {
|
|
1094
1094
|
let a = t.body?.source?.attachment;
|
|
1095
1095
|
if (a?.type !== h.PDF) return null;
|
|
1096
1096
|
let o = e(a.url) ? i.resolveDialFileDownloadUrl(a.url) : a.url;
|
|
1097
1097
|
if (o == null) return null;
|
|
1098
|
-
let s = n.find((e) => e.
|
|
1098
|
+
let s = (n.find((e) => e.annotations.includes(t))?.annotations ?? [t]).filter((e) => e.body?.source?.attachment?.url === a.url), c = s.indexOf(t), l = E(s), u = T(t, c);
|
|
1099
1099
|
return {
|
|
1100
1100
|
type: r.Pdf,
|
|
1101
1101
|
url: o,
|
|
1102
|
-
highlights:
|
|
1103
|
-
selectedHighlightId:
|
|
1102
|
+
highlights: l,
|
|
1103
|
+
selectedHighlightId: l.some((e) => e.id === u) ? u : void 0,
|
|
1104
|
+
page: D(t)
|
|
1104
1105
|
};
|
|
1105
|
-
},
|
|
1106
|
-
let i =
|
|
1106
|
+
}, xt = (t, n) => {
|
|
1107
|
+
let i = O(t.url);
|
|
1107
1108
|
if (i == null) return null;
|
|
1108
1109
|
let a = e(i.baseUrl) ? n.resolveDialFileDownloadUrl(i.baseUrl) : i.baseUrl;
|
|
1109
1110
|
if (a == null) return null;
|
|
@@ -1129,41 +1130,42 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1129
1130
|
opacity: 0
|
|
1130
1131
|
}
|
|
1131
1132
|
}],
|
|
1132
|
-
selectedHighlightId: o
|
|
1133
|
+
selectedHighlightId: o,
|
|
1134
|
+
page: i.page
|
|
1133
1135
|
};
|
|
1134
|
-
},
|
|
1136
|
+
}, St = (e) => {
|
|
1135
1137
|
try {
|
|
1136
1138
|
let t = new URL(e).protocol;
|
|
1137
1139
|
return t === "http:" || t === "https:" || t === "blob:";
|
|
1138
1140
|
} catch {
|
|
1139
1141
|
return !1;
|
|
1140
1142
|
}
|
|
1141
|
-
},
|
|
1142
|
-
let n = await
|
|
1143
|
+
}, Ct = (t) => t.url != null && !e(t.url) && St(t.url) ? t.url : void 0, wt = async (e, t) => {
|
|
1144
|
+
let n = await dt(e, t);
|
|
1143
1145
|
if (n != null) return typeof n == "string" ? {
|
|
1144
1146
|
type: r.Pdf,
|
|
1145
1147
|
url: n
|
|
1146
1148
|
} : n;
|
|
1147
|
-
let i =
|
|
1149
|
+
let i = Ct(e);
|
|
1148
1150
|
return i == null ? null : {
|
|
1149
1151
|
type: r.Pdf,
|
|
1150
1152
|
url: i
|
|
1151
1153
|
};
|
|
1152
|
-
},
|
|
1153
|
-
let i = await
|
|
1154
|
+
}, Tt = async (e, t, n) => {
|
|
1155
|
+
let i = await dt(e, t);
|
|
1154
1156
|
if (i != null) return typeof i == "string" ? {
|
|
1155
1157
|
type: r.Ooxml,
|
|
1156
1158
|
url: i,
|
|
1157
1159
|
format: n
|
|
1158
1160
|
} : i;
|
|
1159
|
-
let a =
|
|
1161
|
+
let a = Ct(e);
|
|
1160
1162
|
return a == null ? null : {
|
|
1161
1163
|
type: r.Ooxml,
|
|
1162
1164
|
url: a,
|
|
1163
1165
|
format: n
|
|
1164
1166
|
};
|
|
1165
|
-
},
|
|
1166
|
-
let n = await
|
|
1167
|
+
}, Et = async (e, t) => {
|
|
1168
|
+
let n = await ft(e, t);
|
|
1167
1169
|
if (n == null) return null;
|
|
1168
1170
|
if (typeof n != "string") return n;
|
|
1169
1171
|
try {
|
|
@@ -1178,8 +1180,8 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1178
1180
|
text: n
|
|
1179
1181
|
};
|
|
1180
1182
|
}
|
|
1181
|
-
},
|
|
1182
|
-
let a = await
|
|
1183
|
+
}, Dt = async (e, t, n, i) => {
|
|
1184
|
+
let a = await ft(e, t);
|
|
1183
1185
|
if (a == null || typeof a != "string") return null;
|
|
1184
1186
|
let o = {};
|
|
1185
1187
|
try {
|
|
@@ -1200,7 +1202,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1200
1202
|
visualizerName: n.title,
|
|
1201
1203
|
requestTimeout: n.requestTimeout
|
|
1202
1204
|
};
|
|
1203
|
-
},
|
|
1205
|
+
}, Ot = (e, t) => b(e, t), kt = (e) => {
|
|
1204
1206
|
let t = e.body?.source?.attachment;
|
|
1205
1207
|
return t == null ? null : {
|
|
1206
1208
|
id: t.url,
|
|
@@ -1210,12 +1212,12 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1210
1212
|
status: g.Idle,
|
|
1211
1213
|
url: t.url
|
|
1212
1214
|
};
|
|
1213
|
-
},
|
|
1215
|
+
}, At = (e, t) => e?.map((e) => Ot(e, t)) ?? [], jt = (t, n) => {
|
|
1214
1216
|
let r = t.url ?? t.id;
|
|
1215
1217
|
if (r) return e(r) || r.startsWith("http://") || r.startsWith("https://") ? r : `files/${n}/${r.replace(/^\/+/, "")}`;
|
|
1216
|
-
},
|
|
1217
|
-
if (e.nodeType !==
|
|
1218
|
-
let r =
|
|
1218
|
+
}, Mt = (e, t, n) => {
|
|
1219
|
+
if (e.nodeType !== te.ITEM) return null;
|
|
1220
|
+
let r = jt(e, t);
|
|
1219
1221
|
if (!r) return null;
|
|
1220
1222
|
let i = e.contentType ?? "application/octet-stream", a = i.startsWith("image/"), o = a ? n?.resolvePreviewUrl?.(r) : void 0;
|
|
1221
1223
|
return {
|
|
@@ -1228,7 +1230,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1228
1230
|
file: new File([], e.name, { type: i }),
|
|
1229
1231
|
...o == null ? {} : { previewUrl: o }
|
|
1230
1232
|
};
|
|
1231
|
-
},
|
|
1233
|
+
}, Nt = (e, t, n) => e.map((e) => Mt(e, t, n)).filter((e) => e != null), Pt = (e) => {
|
|
1232
1234
|
let t = n(e.replace(/\/$/, "").split("/").filter(Boolean).pop() ?? "");
|
|
1233
1235
|
return {
|
|
1234
1236
|
id: e,
|
|
@@ -1239,11 +1241,11 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1239
1241
|
url: e,
|
|
1240
1242
|
file: new File([], t)
|
|
1241
1243
|
};
|
|
1242
|
-
},
|
|
1244
|
+
}, Ft = /* @__PURE__ */ function(e) {
|
|
1243
1245
|
return e.Blob = "blob", e.Stream = "stream", e.Cancelled = "cancelled", e;
|
|
1244
|
-
}({}),
|
|
1246
|
+
}({}), It = async (e, t = "application/octet-stream") => {
|
|
1245
1247
|
let n = window.showSaveFilePicker;
|
|
1246
|
-
if (n == null) return { type:
|
|
1248
|
+
if (n == null) return { type: Ft.Blob };
|
|
1247
1249
|
try {
|
|
1248
1250
|
let r = e.lastIndexOf("."), i = r >= 0 ? e.slice(r) : void 0, a = await n.call(window, {
|
|
1249
1251
|
suggestedName: e,
|
|
@@ -1253,180 +1255,180 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1253
1255
|
}]
|
|
1254
1256
|
});
|
|
1255
1257
|
return {
|
|
1256
|
-
type:
|
|
1258
|
+
type: Ft.Stream,
|
|
1257
1259
|
writable: await a.createWritable()
|
|
1258
1260
|
};
|
|
1259
1261
|
} catch (e) {
|
|
1260
|
-
if (e instanceof DOMException && e.name === "AbortError") return { type:
|
|
1262
|
+
if (e instanceof DOMException && e.name === "AbortError") return { type: Ft.Cancelled };
|
|
1261
1263
|
throw e;
|
|
1262
1264
|
}
|
|
1263
|
-
},
|
|
1265
|
+
}, Lt = (e) => {
|
|
1264
1266
|
let t = e.lastIndexOf("."), n = t > 0;
|
|
1265
1267
|
return {
|
|
1266
1268
|
base: n ? e.slice(0, t) : e,
|
|
1267
1269
|
extension: n ? e.slice(t) : ""
|
|
1268
1270
|
};
|
|
1269
|
-
},
|
|
1271
|
+
}, Rt = (e, t = 255) => {
|
|
1270
1272
|
if (y(e) <= t) return e;
|
|
1271
|
-
let { base: n, extension: r } =
|
|
1273
|
+
let { base: n, extension: r } = Lt(e), i = t - y(r);
|
|
1272
1274
|
return i <= 0 ? C(e, t) : `${C(n, i)}${r}`;
|
|
1273
|
-
},
|
|
1274
|
-
let { base: t, extension: n } =
|
|
1275
|
-
return r === "" ? e :
|
|
1276
|
-
},
|
|
1277
|
-
let [
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
}, [
|
|
1281
|
-
let [
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
}, [
|
|
1285
|
-
|
|
1286
|
-
}, []),
|
|
1287
|
-
let
|
|
1288
|
-
return
|
|
1289
|
-
|
|
1275
|
+
}, zt = (e) => {
|
|
1276
|
+
let { base: t, extension: n } = Lt(e), r = t.replace(new RegExp(z.source, "g"), "_").replace(/[.\s]+$/, "");
|
|
1277
|
+
return r === "" ? e : Rt(`${r}${n}`);
|
|
1278
|
+
}, Bt = ({ filesApi: e, bucket: n, rootLabel: r, activeTab: i, onNotification: a }) => {
|
|
1279
|
+
let [o, s] = N(""), [c, l] = N(() => /* @__PURE__ */ new Map()), u = M(c);
|
|
1280
|
+
A(() => {
|
|
1281
|
+
u.current = c;
|
|
1282
|
+
}, [c]);
|
|
1283
|
+
let [d, f] = N(() => /* @__PURE__ */ new Map()), [p, m] = N(!0), [h, g] = N(null), [_, y] = N(0), [b, x] = N(void 0), [S, C] = N(() => /* @__PURE__ */ new Set()), w = M(/* @__PURE__ */ new Map()), [T, E] = N(!1), [D, O] = N(null), P = M(null), F = M(null), I = M(/* @__PURE__ */ new Set()), L = M(/* @__PURE__ */ new Set()), [R, te] = N(() => /* @__PURE__ */ new Set()), [ne, z] = N(() => /* @__PURE__ */ new Set()), [V, W] = N(() => /* @__PURE__ */ new Set()), G = M(i);
|
|
1284
|
+
A(() => {
|
|
1285
|
+
G.current !== i && (G.current = i, l(/* @__PURE__ */ new Map()), f(/* @__PURE__ */ new Map()), s(""), x(void 0), w.current = /* @__PURE__ */ new Map(), I.current = /* @__PURE__ */ new Set(), L.current = /* @__PURE__ */ new Set(), z(/* @__PURE__ */ new Set()), W(/* @__PURE__ */ new Set()), P.current != null && (clearTimeout(P.current), P.current = null), F.current?.(), F.current = null, O(null), E(!1), te(/* @__PURE__ */ new Set()));
|
|
1286
|
+
}, [i]), A(() => () => {
|
|
1287
|
+
P.current != null && clearTimeout(P.current), F.current?.();
|
|
1288
|
+
}, []), A(() => {
|
|
1289
|
+
let a = !1;
|
|
1290
|
+
return m(!0), g(null), Ne(e, i, n, o, w.current).then(({ items: e, permissions: t }) => {
|
|
1291
|
+
a || (l((t) => {
|
|
1290
1292
|
let n = new Map(t);
|
|
1291
|
-
return n.set(
|
|
1292
|
-
}),
|
|
1293
|
+
return n.set(o, e), n;
|
|
1294
|
+
}), f((e) => new Map(e).set(o, t)), i === H.Shared && o === "" && (x(e.map((e) => be(Z(e.path, e.bucket ?? ""), r, e.nodeType === ee.Folder))), w.current = new Map(e.map((e) => [e.name, {
|
|
1293
1295
|
bucket: e.bucket ?? "",
|
|
1294
1296
|
dialCorePath: e.path
|
|
1295
1297
|
}]))));
|
|
1296
1298
|
}).catch((e) => {
|
|
1297
|
-
if (!
|
|
1298
|
-
if (
|
|
1299
|
-
|
|
1299
|
+
if (!a) {
|
|
1300
|
+
if (o !== "" && t(e) === 404) {
|
|
1301
|
+
s(v(o));
|
|
1300
1302
|
return;
|
|
1301
1303
|
}
|
|
1302
|
-
|
|
1304
|
+
g("dialFileManager.error");
|
|
1303
1305
|
}
|
|
1304
1306
|
}).finally(() => {
|
|
1305
|
-
|
|
1307
|
+
a || m(!1);
|
|
1306
1308
|
}), () => {
|
|
1307
|
-
|
|
1309
|
+
a = !0;
|
|
1308
1310
|
};
|
|
1309
1311
|
}, [
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
+
i,
|
|
1313
|
+
n,
|
|
1312
1314
|
e,
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
]),
|
|
1317
|
-
if (
|
|
1318
|
-
|
|
1315
|
+
o,
|
|
1316
|
+
_,
|
|
1317
|
+
r
|
|
1318
|
+
]), A(() => {
|
|
1319
|
+
if (i !== H.MyFiles) {
|
|
1320
|
+
C(/* @__PURE__ */ new Set());
|
|
1319
1321
|
return;
|
|
1320
1322
|
}
|
|
1321
1323
|
let t = !1;
|
|
1322
|
-
return e.listSharedByMe(
|
|
1323
|
-
t ||
|
|
1324
|
+
return e.listSharedByMe(n).then((e) => {
|
|
1325
|
+
t || C(new Set(e.items.map((e) => be(Z(e.path, n), r, e.nodeType === ee.Folder))));
|
|
1324
1326
|
}).catch(() => {
|
|
1325
|
-
t ||
|
|
1327
|
+
t || C(/* @__PURE__ */ new Set());
|
|
1326
1328
|
}), () => {
|
|
1327
1329
|
t = !0;
|
|
1328
1330
|
};
|
|
1329
1331
|
}, [
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
+
i,
|
|
1333
|
+
n,
|
|
1332
1334
|
e,
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
+
_,
|
|
1336
|
+
r
|
|
1335
1337
|
]);
|
|
1336
|
-
let
|
|
1337
|
-
id:
|
|
1338
|
-
name:
|
|
1339
|
-
path: `/${
|
|
1338
|
+
let re = j(() => [{
|
|
1339
|
+
id: n,
|
|
1340
|
+
name: r,
|
|
1341
|
+
path: `/${r}`,
|
|
1340
1342
|
parentPath: "",
|
|
1341
|
-
nodeType:
|
|
1342
|
-
folderId:
|
|
1343
|
-
permissions:
|
|
1344
|
-
items:
|
|
1343
|
+
nodeType: U.FOLDER,
|
|
1344
|
+
folderId: n,
|
|
1345
|
+
permissions: Oe(d.get("")),
|
|
1346
|
+
items: Ae(c, d, "", `/${r}`, n)
|
|
1345
1347
|
}], [
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
]),
|
|
1348
|
+
c,
|
|
1349
|
+
d,
|
|
1350
|
+
r,
|
|
1351
|
+
n
|
|
1352
|
+
]), q = k((e) => {
|
|
1351
1353
|
if (e == null) {
|
|
1352
|
-
|
|
1354
|
+
s("");
|
|
1353
1355
|
return;
|
|
1354
1356
|
}
|
|
1355
|
-
let t = `/${
|
|
1356
|
-
if (e === `/${
|
|
1357
|
-
|
|
1357
|
+
let t = `/${r}/`, n = `${r}/`;
|
|
1358
|
+
if (e === `/${r}` || e === t || e === r || e === n) {
|
|
1359
|
+
s("");
|
|
1358
1360
|
return;
|
|
1359
1361
|
}
|
|
1360
|
-
let
|
|
1361
|
-
if (e.startsWith(t))
|
|
1362
|
-
else if (e.startsWith(n))
|
|
1362
|
+
let i;
|
|
1363
|
+
if (e.startsWith(t)) i = e.slice(t.length);
|
|
1364
|
+
else if (e.startsWith(n)) i = e.slice(n.length);
|
|
1363
1365
|
else {
|
|
1364
1366
|
let t = e.replace(/^\//, "");
|
|
1365
|
-
|
|
1367
|
+
i = t.startsWith(n) ? t.slice(n.length) : t;
|
|
1366
1368
|
}
|
|
1367
|
-
|
|
1368
|
-
}, [
|
|
1369
|
-
|
|
1370
|
-
}, []),
|
|
1369
|
+
s(i && !i.endsWith("/") ? `${i}/` : i);
|
|
1370
|
+
}, [r]), J = k(() => {
|
|
1371
|
+
y((e) => e + 1);
|
|
1372
|
+
}, []), ie = J, ae = k((t) => {
|
|
1371
1373
|
if (t.length === 0) return;
|
|
1372
|
-
let
|
|
1373
|
-
|
|
1374
|
+
let s = new Set([...R].map((e) => Q(e, r))), c = (e) => e === o || o.startsWith(e) || s.has(e), u = t.filter((e) => !c(e)), d = t.filter((e) => c(e) && e !== o);
|
|
1375
|
+
u.length > 0 && (l((e) => {
|
|
1374
1376
|
let t = new Map(e);
|
|
1375
|
-
return
|
|
1376
|
-
}),
|
|
1377
|
+
return u.forEach((e) => t.delete(e)), t;
|
|
1378
|
+
}), f((e) => {
|
|
1377
1379
|
let t = new Map(e);
|
|
1378
|
-
return
|
|
1380
|
+
return u.forEach((e) => t.delete(e)), t;
|
|
1379
1381
|
})), d.forEach((t) => {
|
|
1380
1382
|
(async () => {
|
|
1381
1383
|
try {
|
|
1382
|
-
let { items:
|
|
1383
|
-
|
|
1384
|
+
let { items: r, permissions: a } = await Ne(e, i, n, t, w.current);
|
|
1385
|
+
l((e) => new Map(e).set(t, r)), a != null && f((e) => new Map(e).set(t, a));
|
|
1384
1386
|
} catch {
|
|
1385
|
-
|
|
1386
|
-
variant:
|
|
1387
|
-
reason:
|
|
1387
|
+
a?.({
|
|
1388
|
+
variant: B.Error,
|
|
1389
|
+
reason: K.FolderLoadFailed
|
|
1388
1390
|
});
|
|
1389
1391
|
}
|
|
1390
1392
|
})();
|
|
1391
1393
|
});
|
|
1392
1394
|
}, [
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
+
i,
|
|
1396
|
+
n,
|
|
1395
1397
|
e,
|
|
1396
|
-
|
|
1398
|
+
o,
|
|
1397
1399
|
R,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
]),
|
|
1401
|
-
|
|
1402
|
-
}, []),
|
|
1403
|
-
let
|
|
1404
|
-
if (
|
|
1400
|
+
r,
|
|
1401
|
+
a
|
|
1402
|
+
]), oe = k((e, t, n) => {
|
|
1403
|
+
l((r) => je(r, e, t, n));
|
|
1404
|
+
}, []), se = k((t) => {
|
|
1405
|
+
let o = t == null ? "" : Q(t, r), s = t ?? `/${r}`;
|
|
1406
|
+
if (W((e) => {
|
|
1405
1407
|
if (e.has(s)) return e;
|
|
1406
1408
|
let t = new Set(e);
|
|
1407
1409
|
return t.add(s), t;
|
|
1408
|
-
}), !
|
|
1409
|
-
if (I.current.has(
|
|
1410
|
-
|
|
1410
|
+
}), !u.current.has(o)) {
|
|
1411
|
+
if (I.current.has(o)) {
|
|
1412
|
+
z((e) => {
|
|
1411
1413
|
let t = new Set(e);
|
|
1412
1414
|
return t.add(s), t;
|
|
1413
1415
|
});
|
|
1414
1416
|
return;
|
|
1415
1417
|
}
|
|
1416
|
-
I.current.add(
|
|
1418
|
+
I.current.add(o), z((e) => {
|
|
1417
1419
|
let t = new Set(e);
|
|
1418
1420
|
return t.add(s), t;
|
|
1419
1421
|
}), (async () => {
|
|
1420
1422
|
try {
|
|
1421
|
-
let { items: t, permissions:
|
|
1422
|
-
|
|
1423
|
+
let { items: t, permissions: r } = await Ne(e, i, n, o, w.current);
|
|
1424
|
+
l((e) => new Map(e).set(o, t)), r != null && f((e) => new Map(e).set(o, r)), L.current.delete(o);
|
|
1423
1425
|
} catch {
|
|
1424
|
-
|
|
1425
|
-
variant:
|
|
1426
|
-
reason:
|
|
1426
|
+
a?.({
|
|
1427
|
+
variant: B.Error,
|
|
1428
|
+
reason: K.FolderLoadFailed
|
|
1427
1429
|
});
|
|
1428
1430
|
} finally {
|
|
1429
|
-
I.current.delete(
|
|
1431
|
+
I.current.delete(o), z((e) => {
|
|
1430
1432
|
let t = new Set(e);
|
|
1431
1433
|
return t.delete(s), t;
|
|
1432
1434
|
});
|
|
@@ -1434,42 +1436,42 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1434
1436
|
})();
|
|
1435
1437
|
}
|
|
1436
1438
|
}, [
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
+
i,
|
|
1440
|
+
n,
|
|
1439
1441
|
e,
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
]),
|
|
1443
|
-
let e = /* @__PURE__ */ new Set(), t = new Set([...R, ...
|
|
1442
|
+
a,
|
|
1443
|
+
r
|
|
1444
|
+
]), ce = j(() => {
|
|
1445
|
+
let e = /* @__PURE__ */ new Set(), t = new Set([...R, ...V]);
|
|
1444
1446
|
for (let n of t) {
|
|
1445
|
-
let t = Q(n,
|
|
1446
|
-
|
|
1447
|
+
let t = Q(n, r);
|
|
1448
|
+
c.has(t) && e.add(n);
|
|
1447
1449
|
}
|
|
1448
1450
|
return e;
|
|
1449
1451
|
}, [
|
|
1450
1452
|
R,
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
]),
|
|
1453
|
+
V,
|
|
1454
|
+
c,
|
|
1455
|
+
r
|
|
1456
|
+
]), le = k((t) => {
|
|
1455
1457
|
R.forEach((e) => {
|
|
1456
|
-
t.has(e) || L.current.delete(Q(e,
|
|
1457
|
-
}),
|
|
1458
|
-
let t = Q(e,
|
|
1459
|
-
return !
|
|
1458
|
+
t.has(e) || L.current.delete(Q(e, r));
|
|
1459
|
+
}), te(t), [...t].filter((e) => {
|
|
1460
|
+
let t = Q(e, r);
|
|
1461
|
+
return !u.current.has(t) && !I.current.has(t) && !L.current.has(t);
|
|
1460
1462
|
}).forEach((t) => {
|
|
1461
|
-
let
|
|
1462
|
-
I.current.add(
|
|
1463
|
+
let o = Q(t, r);
|
|
1464
|
+
I.current.add(o), (async () => {
|
|
1463
1465
|
try {
|
|
1464
|
-
let { items: t, permissions:
|
|
1465
|
-
|
|
1466
|
+
let { items: t, permissions: r } = await Ne(e, i, n, o, w.current);
|
|
1467
|
+
l((e) => new Map(e).set(o, t)), r != null && f((e) => new Map(e).set(o, r));
|
|
1466
1468
|
} catch {
|
|
1467
|
-
L.current.add(
|
|
1468
|
-
variant:
|
|
1469
|
-
reason:
|
|
1469
|
+
L.current.add(o), a?.({
|
|
1470
|
+
variant: B.Error,
|
|
1471
|
+
reason: K.FolderLoadFailed
|
|
1470
1472
|
});
|
|
1471
1473
|
} finally {
|
|
1472
|
-
I.current.delete(
|
|
1474
|
+
I.current.delete(o), z((e) => {
|
|
1473
1475
|
let n = new Set(e);
|
|
1474
1476
|
return n.delete(t), n;
|
|
1475
1477
|
});
|
|
@@ -1477,102 +1479,102 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1477
1479
|
})();
|
|
1478
1480
|
});
|
|
1479
1481
|
}, [
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
+
i,
|
|
1483
|
+
n,
|
|
1482
1484
|
e,
|
|
1483
1485
|
R,
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
]),
|
|
1487
|
-
|
|
1488
|
-
}, []),
|
|
1489
|
-
if (
|
|
1490
|
-
|
|
1486
|
+
a,
|
|
1487
|
+
r
|
|
1488
|
+
]), ue = k(() => {
|
|
1489
|
+
P.current != null && (clearTimeout(P.current), P.current = null), F.current?.(), F.current = null, O(null), E(!1);
|
|
1490
|
+
}, []), de = k((t, a) => {
|
|
1491
|
+
if (P.current != null && (clearTimeout(P.current), P.current = null), F.current?.(), F.current = null, !a.trim()) {
|
|
1492
|
+
O(null), E(!1);
|
|
1491
1493
|
return;
|
|
1492
1494
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
let t =
|
|
1496
|
-
if (
|
|
1497
|
-
F.current?.(), F.current = null, E(!0),
|
|
1495
|
+
P.current = setTimeout(() => {
|
|
1496
|
+
P.current = null;
|
|
1497
|
+
let t = a.toLowerCase();
|
|
1498
|
+
if (i === H.Shared && o === "") {
|
|
1499
|
+
F.current?.(), F.current = null, E(!0), O((c.get("") ?? []).filter((e) => e.name.toLowerCase().includes(t)).map((e) => Fe(e, e.bucket ?? n, r))), E(!1);
|
|
1498
1500
|
return;
|
|
1499
1501
|
}
|
|
1500
|
-
let
|
|
1502
|
+
let s = !1;
|
|
1501
1503
|
F.current = () => {
|
|
1502
|
-
|
|
1504
|
+
s = !0;
|
|
1503
1505
|
}, E(!0), (async () => {
|
|
1504
1506
|
try {
|
|
1505
|
-
let { items:
|
|
1506
|
-
if (
|
|
1507
|
-
|
|
1507
|
+
let { items: a } = await Pe(e, i, n, o, w.current);
|
|
1508
|
+
if (s) return;
|
|
1509
|
+
O(a.filter((e) => e.name.toLowerCase().includes(t)).map((e) => Fe(e, e.bucket ?? n, r)));
|
|
1508
1510
|
} catch {
|
|
1509
|
-
|
|
1511
|
+
s || O([]);
|
|
1510
1512
|
} finally {
|
|
1511
|
-
|
|
1513
|
+
s || E(!1);
|
|
1512
1514
|
}
|
|
1513
1515
|
})();
|
|
1514
1516
|
}, 300);
|
|
1515
1517
|
}, [
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1518
|
+
i,
|
|
1519
|
+
n,
|
|
1520
|
+
c,
|
|
1519
1521
|
e,
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
]),
|
|
1523
|
-
let e =
|
|
1524
|
-
if (e) return
|
|
1522
|
+
o,
|
|
1523
|
+
r
|
|
1524
|
+
]), Y = o ? `/${r}/${o}` : `/${r}`, X = j(() => {
|
|
1525
|
+
let e = re[0];
|
|
1526
|
+
if (e) return fe(Y) === fe(`/${r}`) ? e : me(e.items ?? [], Y);
|
|
1525
1527
|
}, [
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1528
|
+
re,
|
|
1529
|
+
Y,
|
|
1530
|
+
r
|
|
1529
1531
|
]);
|
|
1530
1532
|
return {
|
|
1531
|
-
items:
|
|
1532
|
-
isLoading:
|
|
1533
|
-
error:
|
|
1534
|
-
path:
|
|
1535
|
-
folderPath:
|
|
1536
|
-
onPathChange:
|
|
1537
|
-
retry:
|
|
1538
|
-
onSearchFiles:
|
|
1539
|
-
isSearching:
|
|
1540
|
-
searchResults:
|
|
1541
|
-
clearSearchResults:
|
|
1533
|
+
items: re,
|
|
1534
|
+
isLoading: p,
|
|
1535
|
+
error: h,
|
|
1536
|
+
path: Y,
|
|
1537
|
+
folderPath: o,
|
|
1538
|
+
onPathChange: q,
|
|
1539
|
+
retry: J,
|
|
1540
|
+
onSearchFiles: de,
|
|
1541
|
+
isSearching: T,
|
|
1542
|
+
searchResults: D,
|
|
1543
|
+
clearSearchResults: ue,
|
|
1542
1544
|
expandedPaths: R,
|
|
1543
|
-
loadedPaths:
|
|
1544
|
-
onExpandedPathsChange:
|
|
1545
|
-
onFolderPopupPathChange:
|
|
1546
|
-
folderPopupLoadingPaths:
|
|
1547
|
-
sharedWithMeIds:
|
|
1548
|
-
sharedByMePaths:
|
|
1549
|
-
currentFolder:
|
|
1550
|
-
cache:
|
|
1551
|
-
listingPermissionsCache:
|
|
1552
|
-
sharedRootMetaRef:
|
|
1553
|
-
setFolderPath:
|
|
1554
|
-
invalidateFolders:
|
|
1555
|
-
mergeCreatedFolder:
|
|
1556
|
-
bumpRetry:
|
|
1545
|
+
loadedPaths: ce,
|
|
1546
|
+
onExpandedPathsChange: le,
|
|
1547
|
+
onFolderPopupPathChange: se,
|
|
1548
|
+
folderPopupLoadingPaths: ne,
|
|
1549
|
+
sharedWithMeIds: j(() => i === H.Shared ? b : void 0, [i, b]),
|
|
1550
|
+
sharedByMePaths: S,
|
|
1551
|
+
currentFolder: X,
|
|
1552
|
+
cache: c,
|
|
1553
|
+
listingPermissionsCache: d,
|
|
1554
|
+
sharedRootMetaRef: w,
|
|
1555
|
+
setFolderPath: s,
|
|
1556
|
+
invalidateFolders: ae,
|
|
1557
|
+
mergeCreatedFolder: oe,
|
|
1558
|
+
bumpRetry: ie
|
|
1557
1559
|
};
|
|
1558
|
-
},
|
|
1559
|
-
let [i, a] =
|
|
1560
|
+
}, Vt = ({ filesApi: e, bucket: t, rootLabel: n, onNotification: r }) => {
|
|
1561
|
+
let [i, a] = N(void 0), [o, s] = N(!1);
|
|
1560
1562
|
return {
|
|
1561
1563
|
fileMetadata: i,
|
|
1562
1564
|
isFileMetadataLoading: o,
|
|
1563
|
-
onGetInfo:
|
|
1565
|
+
onGetInfo: k((i) => {
|
|
1564
1566
|
(async () => {
|
|
1565
1567
|
s(!0);
|
|
1566
1568
|
try {
|
|
1567
|
-
let r = i.bucket ?? t, o =
|
|
1568
|
-
a(
|
|
1569
|
+
let r = i.bucket ?? t, o = Te(i, r, n);
|
|
1570
|
+
a(Ie(await e.getFileMetadata({
|
|
1569
1571
|
bucket: r,
|
|
1570
1572
|
path: o
|
|
1571
1573
|
}), i));
|
|
1572
1574
|
} catch {
|
|
1573
1575
|
r?.({
|
|
1574
|
-
variant:
|
|
1575
|
-
reason:
|
|
1576
|
+
variant: B.Error,
|
|
1577
|
+
reason: K.MetadataLoadFailed
|
|
1576
1578
|
});
|
|
1577
1579
|
} finally {
|
|
1578
1580
|
s(!1);
|
|
@@ -1584,44 +1586,44 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1584
1586
|
n,
|
|
1585
1587
|
r
|
|
1586
1588
|
]),
|
|
1587
|
-
clearMetadata:
|
|
1589
|
+
clearMetadata: k(() => {
|
|
1588
1590
|
a(void 0), s(!1);
|
|
1589
1591
|
}, [])
|
|
1590
1592
|
};
|
|
1591
|
-
},
|
|
1592
|
-
let [g, _] =
|
|
1593
|
+
}, Ht = ({ filesApi: e, bucket: t, rootLabel: n, activeTab: r, folderPath: i, currentFolder: a, sharedRootMetaRef: o, listingPermissionsCache: s, invalidateFolders: c, bumpRetry: l, mergeCreatedFolder: u, setFolderPath: d, onNotification: f, onOperationSuccess: p, downloadDestination: m, forbiddenSymbolsRegExp: h }) => {
|
|
1594
|
+
let [g, _] = N(!1), [y, b] = N(!1), [x, S] = N(!1), [C, w] = N(!1), [T, E] = N(!1), [D, O] = N(!1), A = M(null), j = M(null), F = k((e, t) => {
|
|
1593
1595
|
let n = null;
|
|
1594
|
-
if (!e || e.trim() === "") n = { reason:
|
|
1595
|
-
else if (
|
|
1596
|
-
reason:
|
|
1597
|
-
symbols:
|
|
1596
|
+
if (!e || e.trim() === "") n = { reason: q.Empty };
|
|
1597
|
+
else if (Y(e, h)) n = {
|
|
1598
|
+
reason: q.ForbiddenSymbols,
|
|
1599
|
+
symbols: ne
|
|
1598
1600
|
};
|
|
1599
|
-
else if (e.startsWith(".")) n = { reason:
|
|
1600
|
-
else if (e === ae) n = { reason:
|
|
1601
|
+
else if (e.startsWith(".")) n = { reason: q.LeadingDot };
|
|
1602
|
+
else if (e === ae) n = { reason: q.ReservedName };
|
|
1601
1603
|
else if (e.length > 255) n = {
|
|
1602
|
-
reason:
|
|
1604
|
+
reason: q.TooLong,
|
|
1603
1605
|
maxLength: 255
|
|
1604
1606
|
};
|
|
1605
1607
|
else {
|
|
1606
1608
|
let r = t.items ?? [], i = e.toLowerCase(), a = r.find((e) => e.name.toLowerCase() === i);
|
|
1607
1609
|
a && (n = {
|
|
1608
|
-
reason:
|
|
1610
|
+
reason: q.DuplicateName,
|
|
1609
1611
|
existingName: a.name
|
|
1610
1612
|
});
|
|
1611
1613
|
}
|
|
1612
|
-
return
|
|
1613
|
-
}, [h]),
|
|
1614
|
-
let { parentVirtualPath: h, name: g } =
|
|
1614
|
+
return j.current = n, n;
|
|
1615
|
+
}, [h]), ee = k(async (c, d, m) => {
|
|
1616
|
+
let { parentVirtualPath: h, name: g } = ye(d, n), v = Q(h, n), y = a && i === v ? a : {
|
|
1615
1617
|
id: v,
|
|
1616
1618
|
path: v,
|
|
1617
1619
|
name: h.split("/").filter(Boolean).pop() ?? "",
|
|
1618
1620
|
folderId: v,
|
|
1619
|
-
nodeType:
|
|
1621
|
+
nodeType: U.FOLDER,
|
|
1620
1622
|
items: []
|
|
1621
|
-
}, b =
|
|
1622
|
-
if (
|
|
1623
|
+
}, b = j.current;
|
|
1624
|
+
if (j.current = null, F(g, y) || b) return;
|
|
1623
1625
|
_(!0);
|
|
1624
|
-
let { bucket: x, path: S } = r ===
|
|
1626
|
+
let { bucket: x, path: S } = r === H.Shared ? xe(v, o.current, t) : {
|
|
1625
1627
|
bucket: t,
|
|
1626
1628
|
path: v
|
|
1627
1629
|
};
|
|
@@ -1631,13 +1633,13 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1631
1633
|
parentPath: S,
|
|
1632
1634
|
name: g
|
|
1633
1635
|
}), s.get(v)), l(), p?.({
|
|
1634
|
-
kind:
|
|
1636
|
+
kind: J.FolderCreated,
|
|
1635
1637
|
name: g
|
|
1636
1638
|
});
|
|
1637
1639
|
} catch {
|
|
1638
1640
|
f?.({
|
|
1639
|
-
variant:
|
|
1640
|
-
reason:
|
|
1641
|
+
variant: B.Error,
|
|
1642
|
+
reason: K.FolderCreateFailed
|
|
1641
1643
|
});
|
|
1642
1644
|
} finally {
|
|
1643
1645
|
_(!1);
|
|
@@ -1648,7 +1650,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1648
1650
|
a,
|
|
1649
1651
|
e,
|
|
1650
1652
|
i,
|
|
1651
|
-
|
|
1653
|
+
F,
|
|
1652
1654
|
n,
|
|
1653
1655
|
s,
|
|
1654
1656
|
u,
|
|
@@ -1656,44 +1658,44 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1656
1658
|
p,
|
|
1657
1659
|
o,
|
|
1658
1660
|
f
|
|
1659
|
-
]), L =
|
|
1661
|
+
]), L = k((r) => {
|
|
1660
1662
|
(async () => {
|
|
1661
1663
|
b(!0);
|
|
1662
1664
|
try {
|
|
1663
|
-
let i = r.length === 1 ? r[0].nodeType ===
|
|
1664
|
-
if (a.type ===
|
|
1665
|
-
if (r.length === 1 && r[0].nodeType ===
|
|
1665
|
+
let i = r.length === 1 ? r[0].nodeType === U.ITEM ? r[0].name : `${r[0].name}.zip` : "files.zip", a = await m.resolveDestination(i, r.length === 1 && r[0].nodeType === U.ITEM ? r[0].contentType ?? "application/octet-stream" : "application/zip");
|
|
1666
|
+
if (a.type === Ft.Cancelled) return;
|
|
1667
|
+
if (r.length === 1 && r[0].nodeType === U.ITEM) {
|
|
1666
1668
|
let t = r[0];
|
|
1667
1669
|
if (!t.bucket) throw Error("File is missing bucket");
|
|
1668
|
-
let i =
|
|
1670
|
+
let i = Te(t, t.bucket, n), o = await e.downloadFile(t.bucket, i);
|
|
1669
1671
|
if (!o.ok) throw Error(`Download failed with status ${o.status}`);
|
|
1670
1672
|
let s = await m.triggerDownload(o, t.name, a);
|
|
1671
1673
|
p?.({
|
|
1672
|
-
kind:
|
|
1674
|
+
kind: J.FileDownloaded,
|
|
1673
1675
|
name: s,
|
|
1674
1676
|
count: 1
|
|
1675
1677
|
});
|
|
1676
1678
|
} else {
|
|
1677
1679
|
let o = r.map((e) => ({
|
|
1678
1680
|
bucket: e.bucket ?? t,
|
|
1679
|
-
path:
|
|
1681
|
+
path: Te(e, e.bucket ?? t, n),
|
|
1680
1682
|
name: e.name,
|
|
1681
|
-
nodeType: e.nodeType ===
|
|
1683
|
+
nodeType: e.nodeType === U.FOLDER ? P.Folder : P.Item
|
|
1682
1684
|
})), s = await e.downloadArchive(o);
|
|
1683
1685
|
if (!s.ok) throw Error(`Download failed with status ${s.status}`);
|
|
1684
1686
|
let c = await m.triggerDownload(s, i, a);
|
|
1685
1687
|
r.length === 1 ? p?.({
|
|
1686
|
-
kind:
|
|
1688
|
+
kind: J.FileDownloaded,
|
|
1687
1689
|
name: c
|
|
1688
1690
|
}) : p?.({
|
|
1689
|
-
kind:
|
|
1691
|
+
kind: J.FilesDownloaded,
|
|
1690
1692
|
count: r.length
|
|
1691
1693
|
});
|
|
1692
1694
|
}
|
|
1693
1695
|
} catch {
|
|
1694
1696
|
f?.({
|
|
1695
|
-
variant:
|
|
1696
|
-
reason: r.length === 1 ?
|
|
1697
|
+
variant: B.Error,
|
|
1698
|
+
reason: r.length === 1 ? K.DownloadFileFailed : K.DownloadFilesFailed
|
|
1697
1699
|
});
|
|
1698
1700
|
} finally {
|
|
1699
1701
|
b(!1);
|
|
@@ -1706,11 +1708,11 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1706
1708
|
f,
|
|
1707
1709
|
e,
|
|
1708
1710
|
m
|
|
1709
|
-
]),
|
|
1711
|
+
]), te = k((a, s) => {
|
|
1710
1712
|
a.length !== 0 && (async () => {
|
|
1711
1713
|
S(!0);
|
|
1712
1714
|
let u = a.map((e) => {
|
|
1713
|
-
let i = e.nodeType ===
|
|
1715
|
+
let i = e.nodeType === U.FOLDER, a = Q(e.sourceUrl, n), s = i ? a : a.replace(/\/$/, ""), c = X(e.sourceUrl, s), { bucket: l, path: u } = r === H.Shared ? xe(s, o.current, t) : {
|
|
1714
1716
|
bucket: t,
|
|
1715
1717
|
path: s
|
|
1716
1718
|
};
|
|
@@ -1718,35 +1720,35 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1718
1720
|
bucket: l,
|
|
1719
1721
|
path: u,
|
|
1720
1722
|
name: c,
|
|
1721
|
-
nodeType: i ?
|
|
1723
|
+
nodeType: i ? I.Folder : I.Item
|
|
1722
1724
|
};
|
|
1723
1725
|
});
|
|
1724
1726
|
try {
|
|
1725
1727
|
let { results: t } = await e.deleteFiles(u), r = t.filter((e) => !e.success), i = r.length, a = t.length - i, o = t.find((e) => e.success), c = u.find((e) => e.path === o?.path) ?? u[0];
|
|
1726
1728
|
if (a > 0 && f?.({
|
|
1727
|
-
variant:
|
|
1728
|
-
reason:
|
|
1729
|
+
variant: B.Success,
|
|
1730
|
+
reason: K.FilesDeleted,
|
|
1729
1731
|
count: a,
|
|
1730
1732
|
name: c?.name,
|
|
1731
1733
|
folder: s || n
|
|
1732
1734
|
}), i > 0) {
|
|
1733
1735
|
let e = r.slice(0, 3).map((e) => u.find((t) => t.path === e.path)?.name ?? e.path), t = i - e.length;
|
|
1734
1736
|
f?.({
|
|
1735
|
-
variant:
|
|
1736
|
-
reason:
|
|
1737
|
+
variant: B.Error,
|
|
1738
|
+
reason: K.FilesDeletePartiallyFailed,
|
|
1737
1739
|
names: e,
|
|
1738
1740
|
restCount: t
|
|
1739
1741
|
});
|
|
1740
1742
|
}
|
|
1741
1743
|
} catch {
|
|
1742
1744
|
f?.({
|
|
1743
|
-
variant:
|
|
1744
|
-
reason:
|
|
1745
|
+
variant: B.Error,
|
|
1746
|
+
reason: K.DeleteFailed
|
|
1745
1747
|
});
|
|
1746
1748
|
}
|
|
1747
|
-
let p = u.filter((e) => e.nodeType ===
|
|
1749
|
+
let p = u.filter((e) => e.nodeType === I.Folder).map((e) => e.path.endsWith("/") ? e.path : `${e.path}/`);
|
|
1748
1750
|
c([...new Set(u.map((e) => {
|
|
1749
|
-
if (e.nodeType ===
|
|
1751
|
+
if (e.nodeType === I.Folder) return e.path.endsWith("/") ? e.path : `${e.path}/`;
|
|
1750
1752
|
let t = e.path.lastIndexOf("/");
|
|
1751
1753
|
return t > 0 ? e.path.slice(0, t + 1) : "";
|
|
1752
1754
|
}))]), p.some((e) => i === e || i.startsWith(e)) && d((e) => e.replace(/[^/]+\/$/, "")), l(), S(!1);
|
|
@@ -1762,54 +1764,54 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1762
1764
|
c,
|
|
1763
1765
|
l,
|
|
1764
1766
|
d
|
|
1765
|
-
]),
|
|
1766
|
-
if (!e || e.trim() === "") return { reason:
|
|
1767
|
-
if (e === ae) return { reason:
|
|
1768
|
-
if (
|
|
1769
|
-
reason:
|
|
1770
|
-
symbols:
|
|
1767
|
+
]), z = k((e, t) => {
|
|
1768
|
+
if (!e || e.trim() === "") return { reason: q.Empty };
|
|
1769
|
+
if (e === ae) return { reason: q.ReservedName };
|
|
1770
|
+
if (Y(e, h)) return {
|
|
1771
|
+
reason: q.ForbiddenSymbols,
|
|
1772
|
+
symbols: ne
|
|
1771
1773
|
};
|
|
1772
1774
|
if (e.length > 255) return {
|
|
1773
|
-
reason:
|
|
1775
|
+
reason: q.TooLong,
|
|
1774
1776
|
maxLength: 255
|
|
1775
1777
|
};
|
|
1776
1778
|
let n = a?.items ?? [], r = e.toLowerCase(), i = n.find((e) => e.path !== t.path && e.name.toLowerCase() === r);
|
|
1777
1779
|
return i ? {
|
|
1778
|
-
reason:
|
|
1780
|
+
reason: q.DuplicateName,
|
|
1779
1781
|
existingName: i.name
|
|
1780
1782
|
} : null;
|
|
1781
|
-
}, [h, a]),
|
|
1782
|
-
if (r.length === 0 || T ||
|
|
1783
|
+
}, [h, a]), V = k((r, i) => {
|
|
1784
|
+
if (r.length === 0 || T || D) return;
|
|
1783
1785
|
let a = new AbortController();
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
let o =
|
|
1786
|
+
A.current = a, (async () => {
|
|
1787
|
+
E(!0);
|
|
1788
|
+
let o = Ee(r, t, n), s = o.map(({ dto: e }) => e);
|
|
1787
1789
|
try {
|
|
1788
1790
|
let { results: t } = await e.copyFiles(s, a.signal), r = t.filter((e) => !e.success).length, c = t.length - r;
|
|
1789
1791
|
if (c > 0) {
|
|
1790
|
-
let e =
|
|
1792
|
+
let e = ke(o, t);
|
|
1791
1793
|
p?.({
|
|
1792
|
-
kind: c === 1 ?
|
|
1794
|
+
kind: c === 1 ? J.FileCopied : J.FilesCopied,
|
|
1793
1795
|
name: e?.destinationName,
|
|
1794
1796
|
count: c,
|
|
1795
|
-
destinationFolderName:
|
|
1797
|
+
destinationFolderName: pe(i, n)
|
|
1796
1798
|
});
|
|
1797
1799
|
}
|
|
1798
1800
|
r > 0 && r < t.length ? f?.({
|
|
1799
|
-
variant:
|
|
1800
|
-
reason:
|
|
1801
|
+
variant: B.Error,
|
|
1802
|
+
reason: K.CopyPartiallyFailed,
|
|
1801
1803
|
count: r
|
|
1802
1804
|
}) : r === t.length && f?.({
|
|
1803
|
-
variant:
|
|
1804
|
-
reason:
|
|
1805
|
+
variant: B.Error,
|
|
1806
|
+
reason: K.CopyFailed
|
|
1805
1807
|
});
|
|
1806
1808
|
} catch {
|
|
1807
1809
|
a.signal.aborted || f?.({
|
|
1808
|
-
variant:
|
|
1809
|
-
reason:
|
|
1810
|
+
variant: B.Error,
|
|
1811
|
+
reason: K.CopyFailed
|
|
1810
1812
|
});
|
|
1811
1813
|
} finally {
|
|
1812
|
-
c([...new Set(s.flatMap((e) => [v(e.sourcePath), v(e.destinationPath)]))]), l(),
|
|
1814
|
+
c([...new Set(s.flatMap((e) => [v(e.sourcePath), v(e.destinationPath)]))]), l(), E(!1), A.current = null;
|
|
1813
1815
|
}
|
|
1814
1816
|
})();
|
|
1815
1817
|
}, [
|
|
@@ -1819,11 +1821,11 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1819
1821
|
p,
|
|
1820
1822
|
e,
|
|
1821
1823
|
T,
|
|
1822
|
-
|
|
1824
|
+
D,
|
|
1823
1825
|
c,
|
|
1824
1826
|
l
|
|
1825
|
-
]), W =
|
|
1826
|
-
|
|
1827
|
+
]), W = k(() => {
|
|
1828
|
+
A.current?.abort();
|
|
1827
1829
|
}, []);
|
|
1828
1830
|
return {
|
|
1829
1831
|
isCreatingFolder: g,
|
|
@@ -1831,16 +1833,16 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1831
1833
|
isDeleting: x,
|
|
1832
1834
|
isRenaming: C,
|
|
1833
1835
|
isCopying: T,
|
|
1834
|
-
isMoving:
|
|
1835
|
-
onCreateFolder:
|
|
1836
|
-
onCreateFolderValidate:
|
|
1836
|
+
isMoving: D,
|
|
1837
|
+
onCreateFolder: ee,
|
|
1838
|
+
onCreateFolderValidate: F,
|
|
1837
1839
|
onDownloadFiles: L,
|
|
1838
|
-
onDeleteFiles:
|
|
1839
|
-
onRenameValidate:
|
|
1840
|
-
onMoveToFiles:
|
|
1841
|
-
if (r.length === 0 || T ||
|
|
1842
|
-
let { renameDtos: s, preparedMoveItems: u } =
|
|
1843
|
-
m.length > 0 && (
|
|
1840
|
+
onDeleteFiles: te,
|
|
1841
|
+
onRenameValidate: z,
|
|
1842
|
+
onMoveToFiles: k((r, a, o) => {
|
|
1843
|
+
if (r.length === 0 || T || D || C) return;
|
|
1844
|
+
let { renameDtos: s, preparedMoveItems: u } = De(r, t, n), m = u.map(({ dto: e }) => e), h = new AbortController();
|
|
1845
|
+
m.length > 0 && (A.current = h), (async () => {
|
|
1844
1846
|
s.length > 0 && w(!0), m.length > 0 && O(!0);
|
|
1845
1847
|
let [t, r] = await Promise.all([(async () => {
|
|
1846
1848
|
if (s.length === 0) return {
|
|
@@ -1881,31 +1883,31 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1881
1883
|
}
|
|
1882
1884
|
})()]), a = t.threw ? s.length : t.results.filter((e) => !e.success).length, g = r.threw && r.aborted, _ = g ? 0 : m.length, y = g ? 0 : r.threw ? m.length : r.results.filter((e) => !e.success).length, b = r.threw ? 0 : r.results.filter((e) => e.success).length, x = s.length + _, S = a + y, C = y > 0;
|
|
1883
1885
|
if (b > 0) {
|
|
1884
|
-
let e =
|
|
1886
|
+
let e = ke(u, r.results);
|
|
1885
1887
|
p?.({
|
|
1886
|
-
kind: b === 1 ?
|
|
1888
|
+
kind: b === 1 ? J.FileMoved : J.FilesMoved,
|
|
1887
1889
|
name: e?.destinationName,
|
|
1888
1890
|
count: b,
|
|
1889
|
-
destinationFolderName:
|
|
1891
|
+
destinationFolderName: pe(o, n)
|
|
1890
1892
|
});
|
|
1891
1893
|
}
|
|
1892
1894
|
if (s.length === 1 && a === 0) {
|
|
1893
1895
|
let [e] = s;
|
|
1894
1896
|
p?.({
|
|
1895
|
-
kind:
|
|
1896
|
-
name:
|
|
1897
|
-
isFolder: e.nodeType ===
|
|
1897
|
+
kind: J.FileRenamed,
|
|
1898
|
+
name: X(e.destinationPath, e.destinationPath),
|
|
1899
|
+
isFolder: e.nodeType === R.Folder
|
|
1898
1900
|
});
|
|
1899
1901
|
}
|
|
1900
1902
|
S > 0 && (S === x ? f?.({
|
|
1901
|
-
variant:
|
|
1902
|
-
reason: C ?
|
|
1903
|
+
variant: B.Error,
|
|
1904
|
+
reason: C ? K.MoveFailed : K.RenameFailed
|
|
1903
1905
|
}) : f?.({
|
|
1904
|
-
variant:
|
|
1905
|
-
reason: C ?
|
|
1906
|
+
variant: B.Error,
|
|
1907
|
+
reason: C ? K.MovePartiallyFailed : K.RenamePartiallyFailed,
|
|
1906
1908
|
count: S
|
|
1907
1909
|
}));
|
|
1908
|
-
let T = s.find((e) => e.nodeType ===
|
|
1910
|
+
let T = s.find((e) => e.nodeType === R.Folder && t.results.some((t) => t.success && t.sourcePath === e.sourcePath));
|
|
1909
1911
|
if (T != null) {
|
|
1910
1912
|
let e = T.sourcePath.endsWith("/") ? T.sourcePath : `${T.sourcePath}/`;
|
|
1911
1913
|
if (i === e || i.startsWith(e)) {
|
|
@@ -1913,7 +1915,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1913
1915
|
d(i.replace(e, t));
|
|
1914
1916
|
}
|
|
1915
1917
|
}
|
|
1916
|
-
c([...new Set([...s, ...m].flatMap((e) => [v(e.sourcePath), v(e.destinationPath)]))]), l(), w(!1), O(!1), m.length > 0 && (
|
|
1918
|
+
c([...new Set([...s, ...m].flatMap((e) => [v(e.sourcePath), v(e.destinationPath)]))]), l(), w(!1), O(!1), m.length > 0 && (A.current = null);
|
|
1917
1919
|
})();
|
|
1918
1920
|
}, [
|
|
1919
1921
|
t,
|
|
@@ -1923,36 +1925,36 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1923
1925
|
f,
|
|
1924
1926
|
e,
|
|
1925
1927
|
T,
|
|
1926
|
-
|
|
1928
|
+
D,
|
|
1927
1929
|
C,
|
|
1928
1930
|
c,
|
|
1929
1931
|
l,
|
|
1930
1932
|
d
|
|
1931
1933
|
]),
|
|
1932
|
-
onCopyFiles:
|
|
1934
|
+
onCopyFiles: V,
|
|
1933
1935
|
cancelCopyMove: W
|
|
1934
1936
|
};
|
|
1935
|
-
},
|
|
1936
|
-
let [a, o] =
|
|
1937
|
+
}, Ut = ({ filesApi: e, bucket: t, rootLabel: n, bumpRetry: r, onNotification: i }) => {
|
|
1938
|
+
let [a, o] = N(!1), [s, c] = N(!1);
|
|
1937
1939
|
return {
|
|
1938
1940
|
isUnsharing: a,
|
|
1939
1941
|
isRemovingAccess: s,
|
|
1940
|
-
onUnshareFiles:
|
|
1942
|
+
onUnshareFiles: k((a) => {
|
|
1941
1943
|
a.length !== 0 && (async () => {
|
|
1942
1944
|
o(!0);
|
|
1943
1945
|
let s = a.map((e) => {
|
|
1944
1946
|
let r = e.bucket ?? t;
|
|
1945
1947
|
return {
|
|
1946
1948
|
bucket: r,
|
|
1947
|
-
path:
|
|
1949
|
+
path: Te(e, r, n)
|
|
1948
1950
|
};
|
|
1949
1951
|
});
|
|
1950
1952
|
try {
|
|
1951
1953
|
await e.discardShared(s), r();
|
|
1952
1954
|
} catch {
|
|
1953
1955
|
i?.({
|
|
1954
|
-
variant:
|
|
1955
|
-
reason:
|
|
1956
|
+
variant: B.Error,
|
|
1957
|
+
reason: K.UnshareFailed
|
|
1956
1958
|
});
|
|
1957
1959
|
} finally {
|
|
1958
1960
|
o(!1);
|
|
@@ -1965,22 +1967,22 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1965
1967
|
e,
|
|
1966
1968
|
r
|
|
1967
1969
|
]),
|
|
1968
|
-
onRemoveFilesAccess:
|
|
1970
|
+
onRemoveFilesAccess: k((a) => {
|
|
1969
1971
|
a.length !== 0 && (async () => {
|
|
1970
1972
|
c(!0);
|
|
1971
1973
|
let o = a.map((e) => {
|
|
1972
1974
|
let r = e.bucket ?? t;
|
|
1973
1975
|
return {
|
|
1974
1976
|
bucket: r,
|
|
1975
|
-
path:
|
|
1977
|
+
path: Te(e, r, n)
|
|
1976
1978
|
};
|
|
1977
1979
|
});
|
|
1978
1980
|
try {
|
|
1979
1981
|
await e.revokeAccess(o), r();
|
|
1980
1982
|
} catch {
|
|
1981
1983
|
i?.({
|
|
1982
|
-
variant:
|
|
1983
|
-
reason:
|
|
1984
|
+
variant: B.Error,
|
|
1985
|
+
reason: K.RemoveAccessFailed
|
|
1984
1986
|
});
|
|
1985
1987
|
} finally {
|
|
1986
1988
|
c(!1);
|
|
@@ -1994,17 +1996,17 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
1994
1996
|
r
|
|
1995
1997
|
])
|
|
1996
1998
|
};
|
|
1997
|
-
},
|
|
1998
|
-
let t = e.slice(0,
|
|
1999
|
+
}, Wt = 5, Gt = (e) => e.error ? `${e.path} (${e.error})` : e.path, Kt = (e) => {
|
|
2000
|
+
let t = e.slice(0, Wt);
|
|
1999
2001
|
return {
|
|
2000
|
-
names: t.map(
|
|
2002
|
+
names: t.map(Gt),
|
|
2001
2003
|
restCount: e.length - t.length
|
|
2002
2004
|
};
|
|
2003
|
-
},
|
|
2005
|
+
}, qt = (e, t) => `${e}${t}/`, Jt = (e) => /\.zip$/i.test(e), Yt = (e) => {
|
|
2004
2006
|
let [t] = e;
|
|
2005
|
-
if (!(e.length !== 1 || t == null)) return
|
|
2006
|
-
},
|
|
2007
|
-
let [l, u] =
|
|
2007
|
+
if (!(e.length !== 1 || t == null)) return Jt(t.fileContent.name) && !Jt(t.name) ? t : void 0;
|
|
2008
|
+
}, Xt = ({ filesApi: e, bucket: t, rootLabel: n, activeTab: r, cache: i, sharedRootMetaRef: a, invalidateFolders: o, bumpRetry: s, onNotification: c }) => {
|
|
2009
|
+
let [l, u] = N(null), d = M(null), f = k((r, i, a) => {
|
|
2008
2010
|
let l = Q(a, n);
|
|
2009
2011
|
u({
|
|
2010
2012
|
files: [{
|
|
@@ -2015,23 +2017,23 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2015
2017
|
isOpen: !0
|
|
2016
2018
|
}), (async () => {
|
|
2017
2019
|
try {
|
|
2018
|
-
let { results: n } = await e.uploadArchive(r, t,
|
|
2020
|
+
let { results: n } = await e.uploadArchive(r, t, qt(l, i)), a = n.filter((e) => e.success).length, o = n.filter((e) => !e.success), s = o.length, { names: u, restCount: d } = Kt(o);
|
|
2019
2021
|
n.length > 0 && a === 0 ? c?.({
|
|
2020
|
-
variant:
|
|
2021
|
-
reason:
|
|
2022
|
+
variant: B.Error,
|
|
2023
|
+
reason: K.UploadArchiveFailed,
|
|
2022
2024
|
names: u,
|
|
2023
2025
|
restCount: d
|
|
2024
2026
|
}) : s > 0 && c?.({
|
|
2025
|
-
variant:
|
|
2026
|
-
reason:
|
|
2027
|
+
variant: B.Error,
|
|
2028
|
+
reason: K.UploadArchivePartiallyFailed,
|
|
2027
2029
|
count: s,
|
|
2028
2030
|
names: u,
|
|
2029
2031
|
restCount: d
|
|
2030
2032
|
});
|
|
2031
2033
|
} catch {
|
|
2032
2034
|
c?.({
|
|
2033
|
-
variant:
|
|
2034
|
-
reason:
|
|
2035
|
+
variant: B.Error,
|
|
2036
|
+
reason: K.UploadArchiveRequestFailed
|
|
2035
2037
|
});
|
|
2036
2038
|
} finally {
|
|
2037
2039
|
o([l]), s(), u(null);
|
|
@@ -2046,9 +2048,9 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2046
2048
|
s
|
|
2047
2049
|
]);
|
|
2048
2050
|
return {
|
|
2049
|
-
onUploadFiles:
|
|
2051
|
+
onUploadFiles: k((l, m) => {
|
|
2050
2052
|
if (l.length === 0) return;
|
|
2051
|
-
let h =
|
|
2053
|
+
let h = Yt(l);
|
|
2052
2054
|
if (h != null) {
|
|
2053
2055
|
f(h.fileContent, h.name, m);
|
|
2054
2056
|
return;
|
|
@@ -2062,7 +2064,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2062
2064
|
})),
|
|
2063
2065
|
isOpen: !0
|
|
2064
2066
|
});
|
|
2065
|
-
let _ = Q(m, n), { bucket: v, path: y } = r ===
|
|
2067
|
+
let _ = Q(m, n), { bucket: v, path: y } = r === H.Shared ? xe(_, a.current, t) : {
|
|
2066
2068
|
bucket: t,
|
|
2067
2069
|
path: _
|
|
2068
2070
|
}, b = new Set((i.get(_) ?? []).map((e) => e.name.toLowerCase()));
|
|
@@ -2071,10 +2073,10 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2071
2073
|
for (; t < l.length;) {
|
|
2072
2074
|
let n = t++, a = l[n];
|
|
2073
2075
|
if (g.signal.aborted) {
|
|
2074
|
-
u((e) =>
|
|
2076
|
+
u((e) => Me(e, n, p.Cancelled));
|
|
2075
2077
|
continue;
|
|
2076
2078
|
}
|
|
2077
|
-
u((e) =>
|
|
2079
|
+
u((e) => Me(e, n, {
|
|
2078
2080
|
status: p.Uploading,
|
|
2079
2081
|
percent: 0
|
|
2080
2082
|
}));
|
|
@@ -2084,27 +2086,27 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2084
2086
|
signal: g.signal,
|
|
2085
2087
|
uploadMode: o,
|
|
2086
2088
|
onProgress: (e) => {
|
|
2087
|
-
u((t) =>
|
|
2089
|
+
u((t) => Me(t, n, {
|
|
2088
2090
|
status: p.Uploading,
|
|
2089
2091
|
percent: e
|
|
2090
2092
|
}));
|
|
2091
2093
|
}
|
|
2092
|
-
}), u((e) =>
|
|
2094
|
+
}), u((e) => Me(e, n, {
|
|
2093
2095
|
status: p.Completed,
|
|
2094
2096
|
percent: 100
|
|
2095
2097
|
})), r += 1;
|
|
2096
2098
|
} catch {
|
|
2097
2099
|
let e = g.signal.aborted ? p.Cancelled : p.Failed;
|
|
2098
|
-
e === p.Failed && (i += 1), u((t) =>
|
|
2100
|
+
e === p.Failed && (i += 1), u((t) => Me(t, n, e));
|
|
2099
2101
|
}
|
|
2100
2102
|
}
|
|
2101
2103
|
};
|
|
2102
2104
|
await Promise.all(Array.from({ length: 3 }, () => a())), g.signal.aborted || (r === 0 && i > 0 ? c?.({
|
|
2103
|
-
variant:
|
|
2104
|
-
reason:
|
|
2105
|
+
variant: B.Error,
|
|
2106
|
+
reason: K.UploadFailed
|
|
2105
2107
|
}) : c?.({
|
|
2106
|
-
variant:
|
|
2107
|
-
reason:
|
|
2108
|
+
variant: B.Success,
|
|
2109
|
+
reason: K.UploadCompleted,
|
|
2108
2110
|
folder: y || n
|
|
2109
2111
|
})), o([_]), s(), d.current = null, u(null);
|
|
2110
2112
|
})();
|
|
@@ -2120,29 +2122,29 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2120
2122
|
s,
|
|
2121
2123
|
f
|
|
2122
2124
|
]),
|
|
2123
|
-
onUploadArchive:
|
|
2125
|
+
onUploadArchive: k((e, t, n) => {
|
|
2124
2126
|
f(e, t, n);
|
|
2125
2127
|
}, [f]),
|
|
2126
|
-
onValidateUpload:
|
|
2127
|
-
for (let t of e) t.name =
|
|
2128
|
+
onValidateUpload: k(async (e, t, n) => {
|
|
2129
|
+
for (let t of e) t.name = zt(t.name);
|
|
2128
2130
|
return { valid: !0 };
|
|
2129
2131
|
}, []),
|
|
2130
2132
|
uploadBatchState: l,
|
|
2131
|
-
cancelUpload:
|
|
2133
|
+
cancelUpload: k(() => {
|
|
2132
2134
|
d.current?.abort();
|
|
2133
2135
|
}, []),
|
|
2134
|
-
clearUploadBatch:
|
|
2136
|
+
clearUploadBatch: k(() => {
|
|
2135
2137
|
u(null);
|
|
2136
2138
|
}, [])
|
|
2137
2139
|
};
|
|
2138
|
-
},
|
|
2139
|
-
let g = c ?? de(s), _ =
|
|
2140
|
+
}, Zt = ({ filesApi: e, bucket: t, rootLabel: n = "My files", activeTab: r = H.MyFiles, onNotification: i, onOperationSuccess: a, forbiddenSymbolsRegExp: o, variant: s = d.Attach, actionProfile: c, labels: l, locale: f, disabledNewButtonTooltip: p, downloadDestination: m, buildValidationErrorMessage: h }) => {
|
|
2141
|
+
let g = c ?? de(s), _ = Bt({
|
|
2140
2142
|
filesApi: e,
|
|
2141
2143
|
bucket: t,
|
|
2142
2144
|
rootLabel: n,
|
|
2143
2145
|
activeTab: r,
|
|
2144
2146
|
onNotification: i
|
|
2145
|
-
}), v =
|
|
2147
|
+
}), v = Xt({
|
|
2146
2148
|
filesApi: e,
|
|
2147
2149
|
bucket: t,
|
|
2148
2150
|
rootLabel: n,
|
|
@@ -2152,7 +2154,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2152
2154
|
invalidateFolders: _.invalidateFolders,
|
|
2153
2155
|
bumpRetry: _.bumpRetry,
|
|
2154
2156
|
onNotification: i
|
|
2155
|
-
}), y =
|
|
2157
|
+
}), y = Ht({
|
|
2156
2158
|
filesApi: e,
|
|
2157
2159
|
bucket: t,
|
|
2158
2160
|
rootLabel: n,
|
|
@@ -2169,33 +2171,33 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2169
2171
|
onOperationSuccess: a,
|
|
2170
2172
|
downloadDestination: m,
|
|
2171
2173
|
forbiddenSymbolsRegExp: o
|
|
2172
|
-
}), b =
|
|
2174
|
+
}), b = Ut({
|
|
2173
2175
|
filesApi: e,
|
|
2174
2176
|
bucket: t,
|
|
2175
2177
|
rootLabel: n,
|
|
2176
2178
|
bumpRetry: _.bumpRetry,
|
|
2177
2179
|
onNotification: i
|
|
2178
|
-
}), x =
|
|
2180
|
+
}), x = Vt({
|
|
2179
2181
|
filesApi: e,
|
|
2180
2182
|
bucket: t,
|
|
2181
2183
|
rootLabel: n,
|
|
2182
2184
|
onNotification: i
|
|
2183
|
-
}), S =
|
|
2185
|
+
}), S = he(_.currentFolder), C = j(() => r === H.Organization || r === H.Shared && _.folderPath === "" ? !1 : S, [
|
|
2184
2186
|
r,
|
|
2185
2187
|
_.folderPath,
|
|
2186
2188
|
S
|
|
2187
|
-
]), w =
|
|
2189
|
+
]), w = j(() => r === H.Shared ? le : ce, [r]), T = j(() => {
|
|
2188
2190
|
let e = {}, t = (t) => {
|
|
2189
2191
|
let n = l[t];
|
|
2190
2192
|
n != null && (e[t] = n);
|
|
2191
2193
|
};
|
|
2192
|
-
return t(
|
|
2194
|
+
return t(V.Download), r === H.MyFiles ? (t(V.Delete), C && (t(V.Rename), _e(g) && (t(V.Copy), t(V.Move), t(V.Duplicate))), ve(g) && t(V.RemoveAccess)) : r === H.Shared && ve(g) && t(V.Unshare), g === u.Full && t(V.Info), e;
|
|
2193
2195
|
}, [
|
|
2194
2196
|
r,
|
|
2195
2197
|
C,
|
|
2196
2198
|
g,
|
|
2197
2199
|
l
|
|
2198
|
-
]),
|
|
2200
|
+
]), E = j(() => y.isCreatingFolder || y.isDownloading || y.isDeleting || y.isRenaming || y.isCopying || y.isMoving || b.isUnsharing || b.isRemovingAccess || v.uploadBatchState != null, [
|
|
2199
2201
|
y.isCreatingFolder,
|
|
2200
2202
|
y.isDownloading,
|
|
2201
2203
|
y.isDeleting,
|
|
@@ -2205,10 +2207,10 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2205
2207
|
b.isUnsharing,
|
|
2206
2208
|
b.isRemovingAccess,
|
|
2207
2209
|
v.uploadBatchState
|
|
2208
|
-
]),
|
|
2210
|
+
]), D = k((e, t) => {
|
|
2209
2211
|
let n = y.onCreateFolderValidate(e, t);
|
|
2210
2212
|
return n ? h(n) : null;
|
|
2211
|
-
}, [y, h]), O =
|
|
2213
|
+
}, [y, h]), O = k((e, t) => {
|
|
2212
2214
|
let n = y.onRenameValidate(e, t);
|
|
2213
2215
|
return n ? h(n, t) : null;
|
|
2214
2216
|
}, [y, h]);
|
|
@@ -2235,7 +2237,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2235
2237
|
cancelUpload: v.cancelUpload,
|
|
2236
2238
|
clearUploadBatch: v.clearUploadBatch,
|
|
2237
2239
|
onCreateFolder: y.onCreateFolder,
|
|
2238
|
-
onCreateFolderValidate:
|
|
2240
|
+
onCreateFolderValidate: D,
|
|
2239
2241
|
isCreatingFolder: y.isCreatingFolder,
|
|
2240
2242
|
onDownloadFiles: y.onDownloadFiles,
|
|
2241
2243
|
isDownloading: y.isDownloading,
|
|
@@ -2265,20 +2267,20 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2265
2267
|
isFileMetadataLoading: x.isFileMetadataLoading,
|
|
2266
2268
|
onGetInfo: x.onGetInfo,
|
|
2267
2269
|
clearMetadata: x.clearMetadata,
|
|
2268
|
-
isAnyOperationInProgress:
|
|
2270
|
+
isAnyOperationInProgress: E
|
|
2269
2271
|
};
|
|
2270
|
-
},
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
],
|
|
2275
|
-
let i =
|
|
2272
|
+
}, Qt = [
|
|
2273
|
+
H.MyFiles,
|
|
2274
|
+
H.Shared,
|
|
2275
|
+
H.Organization
|
|
2276
|
+
], $t = (e, t, n, r) => {
|
|
2277
|
+
let i = k((e) => r == null || r.includes(e), [r]), a = j(() => n?.filter((e) => i(e.id)).flatMap(({ id: e, label: t, disabled: n }) => typeof t == "string" ? [{
|
|
2276
2278
|
id: e,
|
|
2277
2279
|
label: t,
|
|
2278
2280
|
disabled: n
|
|
2279
2281
|
}] : []), [n, i]);
|
|
2280
|
-
return
|
|
2281
|
-
i(e) || t(
|
|
2282
|
+
return A(() => {
|
|
2283
|
+
i(e) || t(Qt.find((e) => i(e)) ?? H.MyFiles);
|
|
2282
2284
|
}, [
|
|
2283
2285
|
i,
|
|
2284
2286
|
e,
|
|
@@ -2286,4 +2288,4 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
|
|
|
2286
2288
|
]), { tabs: a };
|
|
2287
2289
|
};
|
|
2288
2290
|
//#endregion
|
|
2289
|
-
export { Z as $,
|
|
2291
|
+
export { Z as $, gt as A, Pe as B, at as C, J as Ct, yt as D, it as E, Be as F, je as G, Oe as H, ze as I, De as J, Me as K, Re as L, wt as M, ht as N, mt as O, Dt as P, be as Q, Ae as R, pt as S, q as St, vt as T, Ie as U, ke as V, Fe as W, Te as X, v as Y, Q as Z, Ot as _, se as _t, Ht as a, Y as at, ct as b, ie as bt, zt as c, fe as ct, It as d, u as dt, ge as et, Ft as f, d as ft, kt as g, ue as gt, Pt as h, le as ht, Ut as i, he as it, Tt as j, Et as k, Lt as l, ye as lt, Nt as m, ce as mt, Zt as n, pe as nt, Vt as o, _e as ot, Mt as p, de as pt, Ee as q, Xt as r, X as rt, Bt as s, ve as st, $t as t, me as tt, Rt as u, xe as ut, At as v, oe as vt, xt as w, re as wt, nt as x, K as xt, bt as y, ae as yt, Ne as z };
|